serviceInOut.js
25.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
import * as types from '../constants/ActionTypes';
import React, { PropTypes } from 'react';
import { loadBackProcessStatisticsList,loadBackProcessList, loadBackProcessStatistics, insertBackProcessResult,
loadOutCheckList, backToFront, serviceOutRemain, loadOutCheckStatistics, loadBackProcessDetail,exportBackProcess,downloadBackProcess,downloadBatchBackProcess,dealBackProcess,
editBackProcessDetail,getFrontProcessList,getFrontProcessDetail,applyAct,increaseAndPayback,frontProcessRefund,frontProcessStatistics,
onlyPayback,frontProcessCancel,checkDatum,updateInfo,serviceStatistics,orderStatistics,processStatistics,datumStatistics,datumCheck,updateFiles,backProcessReturn,exportBackProcessResult
} from '../../utils/serviceInOutUtil.js';
import { message,notification } from 'antd';
import {getOssFilePath} from '../../utils/commonUtils'
import { SubmissionError,initialize,change,submit} from 'redux-form';
import { NotificationIcon } from '../../utils/comonOtherUtil';
import { getSipolicyLimitsUtil } from '../../utils/newSocialUtil';
//社保后道
//获取后道首页按账户统计的列表
export function getBackProcessStatisticsList(query) {
return dispatch => {
return loadBackProcessStatisticsList(query).then(data => {
const { items, total_count } = data;
dispatch({
type: types.BACK_PROCESS_STATISTICS_LIST,
backProcessStatisticsList : data.items,
backProcessStatisticsListCount: data.total_count
});
dispatch(change('company_server_out_index','total_count',total_count))
}).catch(err => {
throw err
});
}
}
//后道首页统计数字
export function getBackProcessStatistics(query) {
return dispatch => {
return loadBackProcessStatistics(query).then(data => {
dispatch({
type: types.BACK_PROCESS_STATISTICS,
backProcessStatistics: data,
})
}).catch(err => {
throw err
});
}
}
//参保人列表
export function getBackProcessList(query) {
return dispatch => {
return loadBackProcessList(query).then(data => {
const { items, total_count } = data;
dispatch({
type: types.BACK_PROCESS_LIST,
backProcessList : items,
backProcessListCount: total_count,
backProcessAll :data
})
dispatch(change('company_server_out_warp','total_count',total_count))
}).catch(err => {
throw err
});
}
}
//后道人员详情接口
export function getBackProcessDetail(params) {
return dispatch => {
return loadBackProcessDetail(params).then(data => {
const { item={} } = data;
const { policy={} } = item;
let si_base_arr=[],hf_base_arr=[],all_ins_arr=[];
if(policy&&policy.policy_category=='0'){//社保险种
const { insurances=[] } = policy;
insurances.map(ins_data=>{
si_base_arr.push({
'name' :ins_data.insurance,
'value' :ins_data.base,
'type' :'si_base_type',
'pay_frequency':ins_data.pay_frequency,
'pay_type' :ins_data.pay_type,
});
if(ins_data.op_result&&ins_data.op_result!='init'){
all_ins_arr.push({
'insurance' :ins_data.insurance,
'base' :ins_data.base?ins_data.base:'0',
'real_base' :ins_data.feedback_base?ins_data.feedback_base:'0',
'ent_amount' :ins_data.ent_amount,
'person_amount':ins_data.person_amount,
'ent_fee' :ins_data.feedback_ent_amount?ins_data.feedback_ent_amount:'0',
'person_fee' :ins_data.feedback_person_amount?ins_data.feedback_person_amount:'0',
'op_result' :ins_data.op_result,
'has_result' :true,
'pay_start_month' :ins_data.pay_start_month,
'pay_end_month' :ins_data.pay_end_month,
'pay_type' :ins_data.pay_type,
'operate_effective_month':ins_data.operate_effective_month,
'diff_pay_start_month' :ins_data.diff_pay_start_month,
'diff_pay_end_month' :ins_data.diff_pay_end_month,
});
}else{
all_ins_arr.push({
'insurance' :ins_data.insurance,
'base' :ins_data.base,
'real_base' :ins_data.base=='0'?'0':'',
'ent_amount' :ins_data.ent_amount,
'person_amount':ins_data.person_amount,
'ent_fee' :'',
'person_fee' :'',
'op_result' :'',
'has_result' :false,
'pay_start_month' :ins_data.pay_start_month,
'pay_end_month' :ins_data.pay_end_month,
'pay_type' :ins_data.pay_type,
'operate_effective_month':ins_data.operate_effective_month,
'diff_pay_start_month' :ins_data.diff_pay_start_month,
'diff_pay_end_month' :ins_data.diff_pay_end_month,
});
}
});
}
if(policy&&policy.policy_category=='1'){//公积金险种
const { insurances=[] } = policy;
insurances.map(ins_data=>{
hf_base_arr.push({
'name' :ins_data.insurance,
'value' :ins_data.base,
'type' :'hf_base_type',
'pay_frequency' :ins_data.pay_frequency,
'pay_type' :ins_data.pay_type,
});
if(ins_data.op_result&&ins_data.op_result!='init'){
all_ins_arr.push({
'insurance' :ins_data.insurance,
'base' :ins_data.base?ins_data.base:'0',
'real_base' :ins_data.feedback_base?ins_data.feedback_base:'0',
'ent_amount' :ins_data.ent_amount,
'person_amount':ins_data.person_amount,
'ent_fee' :ins_data.feedback_ent_amount?ins_data.feedback_ent_amount:'0',
'person_fee' :ins_data.feedback_person_amount?ins_data.feedback_person_amount:'0',
'op_result' :ins_data.op_result,
'has_result' :true,
'pay_start_month' :ins_data.pay_start_month,
'pay_end_month' :ins_data.pay_end_month,
'pay_type' :ins_data.pay_type,
'operate_effective_month':ins_data.operate_effective_month,
'diff_pay_start_month' :ins_data.diff_pay_start_month,
'diff_pay_end_month' :ins_data.diff_pay_end_month,
});
}else{
all_ins_arr.push({
'insurance' :ins_data.insurance,
'base' :ins_data.base,
'real_base' :ins_data.base=='0'?'0':'',
'ent_amount' :ins_data.ent_amount,
'person_amount' :ins_data.person_amount,
'ent_fee' :'',
'person_fee' :'',
'op_result' :'',
'has_result' :false,
'pay_start_month' :ins_data.pay_start_month,
'pay_end_month' :ins_data.pay_end_month,
'pay_type' :ins_data.pay_type,
'operate_effective_month':ins_data.operate_effective_month,
'diff_pay_start_month' :ins_data.diff_pay_start_month,
'diff_pay_end_month' :ins_data.diff_pay_end_month,
});
}
});
}
dispatch({
type : types.BACK_PROCESS_DETAIL,
backProcessDetail: { ...item,si_base_arr,hf_base_arr,all_ins_arr },
});
return {...item,all_ins_arr};
}).catch(err => {
throw err
});
}
}
//后道导入
export function importBackProcessResult(params) {
return dispatch => {
return insertBackProcessResult(params).then(data => {
const { item={} } = data;
if(JSON.parse(item.errors).length > 0 || item.missingRows.length > 0){
const { item={} } = data
const tempErrors=JSON.parse(item.errors),temp=[];
tempErrors.map(err=>{
temp.push(err.message);
});
if(tempErrors.length > 0){
dispatch({
type :types.BACK_PROCESS_IMPORT_ERROR,
backImportError:'上传文件信息填写不完全,请按照模版要求填写。'+temp.join(",")
})
}else if(item.missingRows.length > 0){
dispatch({
type :types.BACK_PROCESS_IMPORT_ERROR,
backImportError:item.missingRows.join(",")
})
}
}else{
dispatch({
type :types.BACK_PROCESS_IMPORT_ERROR,
backImportError:'',
})
}
}).catch(err => {
throw err
});
}
}
export function cheanImportBackProcessResult() {
return dispatch => {
dispatch({
type: types.BACK_PROCESS_IMPORT_ERROR,
backImportError: '',
})
}
}
//后道核对列表
export function getOutCheckList(query) {
return dispatch => {
return loadOutCheckList(query).then(data => {
const { items, total_count } = data;
dispatch({
type: types.BACK_PROCESS_CHECK_LIST,
backProcessCheckList: items,
backProcessCheckListCount: total_count
})
}).catch(err => {
throw err
});
}
}
//返回前道
export function returnToFront(params){
return dispatch => {
return backToFront(params).then(data => {
if(data.code>=300){
notification.open({
message: '失败',
description: '处理失败,'+data.message,
icon: <NotificationIcon type='error' />,
});
dispatch(getOutCheckList(params.query));
}else{
notification.open({
message: '成功',
description: '处理成功',
icon: <NotificationIcon type='success' />,
});
dispatch(getOutCheckList(params.query));
}
}).catch(err => {
throw err
});
}
}
//后道详情编辑
export function backProcessDetailEdit(params) {
return dispatch => {
return editBackProcessDetail(params).then(data => {
if(data.code>=300){
notification.open({
message: '错误',
description: '信息更新失败!',
icon: <NotificationIcon type='error' />,
});
}else{
notification.open({
message: '成功',
description: '信息更新成功!',
icon: <NotificationIcon type='success' />,
});
return data
}
}).catch(err => {
throw err
});
}
}
//按调基办理
export function serviceOutContinue(values) {
return dispatch => {
return serviceOutRemain(values).then(data => {
if(data&&data.result == 'success'){
message.success("处理成功",2)
}else{
message.error("处理失败",2)
}
}).catch(err => {
throw err
});
}
}
//导出后道名单
export function backProcessExport(params) {
return dispatch => {
return exportBackProcess(params).then(data => {
if(data&&data.download_path){
const url = getOssFilePath(data.download_path);
window.open(url);
}else if(data&&data.code==403){
notification.open({
message: '错误',
description: data.message,
icon: <NotificationIcon type='error' />,
});
}
}).catch(err => {
throw err
});
}
}
//导出后道办理结果
export function backProcessExportResult(params) {
return dispatch => {
return exportBackProcessResult(params).then(data => {
if(data&&data.download_path){
const url = getOssFilePath(data.download_path);
window.open(url);
}else if(data&&data.code==403){
notification.open({
message: '错误',
description: data.message,
icon: <NotificationIcon type='error' />,
});
}
}).catch(err => {
throw err
});
}
}
//下载资料
export function backProcessDownload(params) {
return dispatch => {
return downloadBackProcess(params).then(data => {
if(data&&data.download_path&&data.download_path!=''){
const url = getOssFilePath(data.download_path);
window.open(url);
}else if(data.code==400&&data.message=='没有资料可下载'){
notification.open({
message: '错误',
description: data.message,
icon: <NotificationIcon type='error' />,
});
}
}).catch(err => {
throw err
});
}
}
//批量下载资料
export function backProcessBatchDownload(params) {
return dispatch => {
return downloadBatchBackProcess(params).then(data => {
if(data&&data.download_path&&data.download_path!=''){
const url = getOssFilePath(data.download_path);
window.open(url);
}else if(data.code==400&&data.message=='没有资料可下载'){
notification.open({
message: '错误',
description: data.message,
icon: <NotificationIcon type='error' />,
});
}
}).catch(err => {
throw err
});
}
}
//后道反馈
export function backProcessDeal(params) {
return dispatch => {
return dealBackProcess(params).then(data => {
if(data&&data.code>=300){
notification.open({
message: '错误',
description: '操作失败,'+data.message,
icon: <NotificationIcon type='error' />,
});
}else{
notification.open({
message: '成功',
description: '操作成功',
icon: <NotificationIcon type='success' />,
});
dispatch(getBackProcessDetail(params.id));
dispatch(submit('company_server_out_warp'));
}
return data
}).catch(err => {
throw err
});
}
}
//获取后道待审核统计
export function getOutCheckStatistics(id) {
return dispatch => {
return loadOutCheckStatistics().then(data => {
dispatch({
type: types.OUT_CHECK_STATISTICS,
outCheckStatistics: data
})
}).catch(err => {
throw err
});
}
}
//前道列表
export function getFrontProcessListAction(params){
return dispatch => {
return getFrontProcessList(params).then(data=>{
dispatch({
type :types.FRONT_LIST,
frontList:data
});
// const countParams=params.split("&");
// if(countParams.length>2){
// countParams.splice(0,3);
// }
// dispatch(frontProcessStatisticsAction(countParams.join("&")));
const {total_count}=data;
dispatch(change('search_list_front_process','total_count',total_count))
}).catch(err => { throw err });
}
}
export async function formatFrontData(data){
const { si_back_return_infos=[],hf_back_return_infos=[] } = data;
let my_si_info=[],my_hf_info=[];
si_back_return_infos.map(siInfo=>{
my_si_info=JSON.parse(siInfo.insurances);
my_si_info.map(info=>{
my_si_info.push({
'account_id' :siInfo.id,
'return_reason' :siInfo.return_reason,
'return_comment':siInfo.return_comment,
'insurance' :info,
'base' :ins_map[info],
'start_month' :siInfo.start_month,
'end_month' :siInfo.end_month
});
})
});
hf_back_return_infos.map(hfInfo=>{
my_hf_info=JSON.parse(hfInfo.insurances);
my_hf_info.map(info=>{
my_hf_info.push({
'account_id' :hfInfo.id,
'return_reason' :hfInfo.return_reason,
'return_comment':hfInfo.return_comment,
'insurance' :info,
'base' :ins_map[info],
'start_month' :hfInfo.start_month,
'end_month' :hfInfo.end_month
});
})
});
if(si_back_return_infos&&si_back_return_infos.length>0){
await getSipolicyLimitsUtil({
'id' :data.ent_si_policy_id,
'query':'hhr_type='+data.hhr_type+'&policy_category=0'
}).then(data => {
const { limit={} } = data;
Object.keys(limit).map(key=>{
// limit[key].account_id
});
});
}
if(hf_back_return_infos&&hf_back_return_infos.length>0){
await getSipolicyLimitsUtil({
'id' :data.ent_hf_policy_id,
'query':'policy_category=1'
}).then(data => {
const { limit={} } = data;
});
}
dispatch({
type :types.FRONT_DETAIL,
frontDetail:{...data,my_si_info,my_hf_info}
});
}
//前道详情
export function getFrontProcessDetailAction(params){
return dispatch => {
return getFrontProcessDetail(params).then(data=>{
dispatch({
type :types.FRONT_DETAIL,
frontDetail:data
});
}).catch(err => { throw err });
}
}
//前道申请实操
export function applyActAction(params){
return dispatch => {
return applyAct(params).then(data=>{
if(data.code>=300){
if(data.code == 409){
notification.open({
message: '错误',
description: '操作失败!'+data.message,
icon: <NotificationIcon type='error' />,
});;
}else{
notification.open({
message: '错误',
description: '操作失败!',
icon: <NotificationIcon type='error' />,
});;
}
}else{
notification.open({
message: '成功',
description: '操作成功!',
icon: <NotificationIcon type='success' />,
});
dispatch(submit('search_list_front_process'));
}
return data
}).catch(err => { throw err });
}
}
//前道下月新增且补缴
export function increaseAndPaybackAction(params){
return dispatch => {
return increaseAndPayback(params).then(data=>{
if(data.code>=300){
if(data.code==409){
message.error(data.message)
}else{
message.error('操作失败!')
}
}else{
// dispatch(getFrontProcessListAction(params.query));
dispatch(submit('search_list_front_process'));
message.success('操作成功!')
}
}).catch(err => { throw err });
}
}
//前道退款
export function frontProcessRefundAction(params){
return dispatch => {
return frontProcessRefund(params).then(data=>{
if(data.code>=300){
message.error('退款失败!')
}else{
// dispatch(getFrontProcessListAction(params.query));
dispatch(submit('search_list_front_process'));
message.success('退款成功!')
}
}).catch(err => { throw err });
}
}
//前道统计信息
export function frontProcessStatisticsAction(params){
return dispatch => {
return frontProcessStatistics(params).then(data=>{
dispatch({
type :types.FRONT_STATISTICS,
frontStatistics:data
});
}).catch(err => { throw err });
}
}
//前道下月补缴
export function onlyPaybackAction(params){
return dispatch => {
return onlyPayback(params).then(data=>{
if(data.code>=300){
message.error('补缴失败!')
}else{
// dispatch(getFrontProcessListAction(params.query));
dispatch(submit('search_list_front_process'));
message.success('补缴成功!')
}
}).catch(err => { throw err });
}
}
//前道取消
export function frontProcessCancelAction(params){
return dispatch => {
return frontProcessCancel(params).then(data=>{
if(data.code>=300){
message.error('操作失败!')
}else{
// dispatch(getFrontProcessListAction(params.query));
dispatch(submit('search_list_front_process'));
message.success('操作成功!')
}
}).catch(err => { throw err });
}
}
//前道资料审核
export function checkDatumAction(params){
return dispatch => {
return checkDatum(params).then(data=>{
if(data.code>=300){
message.error('操作失败!')
}else{
// dispatch(getFrontProcessListAction(params.query));
dispatch(datumCheckAction(params.query));
dispatch(submit('search_list_front_process'));
message.success('操作成功!')
}
}).catch(err => { throw err });
}
}
//前道更新记录
export function updateInfoAction(params){
return dispatch => {
return updateInfo(params).then(data=>{
if(data.code>=300){
notification.open({
message: '错误',
description: '信息更新失败!',
icon: <NotificationIcon type='error' />,
});
}else{
dispatch(getFrontProcessDetailAction(params.id));
dispatch(submit('search_list_front_process'));
notification.open({
message: '成功',
description: '信息更新成功!',
icon: <NotificationIcon type='success' />,
});
return data
}
}).catch(err => { throw err });
}
}
//社保服务统计信息
export function serviceStatisticsAction(params){
return dispatch => {
return serviceStatistics(params).then(data=>{
dispatch({
type :types.SERVICE_STATISTICS,
serviceData:data
})
}).catch(err => { throw err });
}
}
//订单统计信息
export function orderStatisticsAction(params){
return dispatch => {
return orderStatistics(params).then(data=>{
dispatch({
type :types.ORDER_STATISTICS,
orderData:data
})
}).catch(err => { throw err });
}
}
//接单统计信息
export function processStatisticsAction(params){
return dispatch => {
return processStatistics(params).then(data=>{
dispatch({
type :types.PROCESS_STATISTICS,
processData:data
})
}).catch(err => { throw err });
}
}
//资料审核统计
export function datumStatisticsAction(params){
return dispatch => {
return datumStatistics(params).then(data=>{
dispatch({
type :types.DATUMDATA_STATISTICS,
datumData:data
})
}).catch(err => { throw err });
}
}
//资料审核列表
export function datumCheckAction(params){
return dispatch => {
return datumCheck(params).then(data=>{
dispatch({
type :types.DATUMDATA_CHECK,
datumCheck:data
})
// const { total_count } = data;
// dispatch(change('search_list','total_count',total_count))
}).catch(err => { throw err });
}
}
//更新前道社保资料
export function updateFilesAction(params){
return dispatch => {
return updateFiles(params).then(data=>{
// dispatch({
// type :types.DATUMDATA_CHECK,
// datumCheck:data
// })
if(data.code>=300){
message.error('更新失败');
}else{
dispatch(getFrontProcessDetailAction(params.id));
dispatch(submit('search_list'));
message.success('更新成功!');
}
}).catch(err => { throw err });
}
}
//退回前道操作
export function backProcessReturnAction(params) {
return dispatch => {
dispatch({ type: 'MASK_SHOW', maskShow: true });
return backProcessReturn(params).then(data => {
dispatch({ type: 'MASK_SHOW', maskShow: false });
if(data.code>=300){
notification.open({
message : '错误',
description: '退回失败',
icon : <NotificationIcon type='error'/>,
});
}else{
notification.open({
message : '成功',
description: '退回成功',
icon : <NotificationIcon type='success'/>,
});
}
dispatch(getBackProcessDetail(params.id)); //更新后道详情
dispatch(submit('company_server_out_warp'));//更新后道列表
return data;
}).catch(err => { throw err; });
};
}