|
@@ -7,9 +7,8 @@ import com.njyunzhi.pet_identity.common.BaseController;
|
7
|
7
|
import com.njyunzhi.pet_identity.common.Constants;
|
8
|
8
|
import com.njyunzhi.pet_identity.common.ResponseBean;
|
9
|
9
|
import com.njyunzhi.pet_identity.common.StringUtils;
|
10
|
|
-import com.njyunzhi.pet_identity.entity.SysUser;
|
11
|
|
-import com.njyunzhi.pet_identity.entity.TaPerson;
|
12
|
|
-import com.njyunzhi.pet_identity.entity.TaPetIdentity;
|
|
10
|
+import com.njyunzhi.pet_identity.entity.*;
|
|
11
|
+import com.njyunzhi.pet_identity.service.ITaOrderService;
|
13
|
12
|
import com.njyunzhi.pet_identity.service.ITaPetIdentityService;
|
14
|
13
|
import com.njyunzhi.pet_identity.vo.AuditParam;
|
15
|
14
|
import com.njyunzhi.pet_identity.vo.MakeCardParam;
|
|
@@ -25,10 +24,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
25
|
24
|
import org.springframework.web.bind.annotation.RequestMethod;
|
26
|
25
|
import org.springframework.web.bind.annotation.RequestParam;
|
27
|
26
|
import com.njyunzhi.pet_identity.service.ITaApplicationService;
|
28
|
|
-import com.njyunzhi.pet_identity.entity.TaApplication;
|
29
|
27
|
import org.springframework.web.bind.annotation.RestController;
|
30
|
28
|
|
31
|
29
|
import java.time.LocalDateTime;
|
|
30
|
+import java.util.ArrayList;
|
32
|
31
|
|
33
|
32
|
/**
|
34
|
33
|
* <p>
|
|
@@ -52,6 +51,9 @@ public class TaApplicationController extends BaseController {
|
52
|
51
|
@Autowired
|
53
|
52
|
public ITaPetIdentityService iTaPetIdentityService;
|
54
|
53
|
|
|
54
|
+ @Autowired
|
|
55
|
+ public ITaOrderService iTaOrderService;
|
|
56
|
+
|
55
|
57
|
/**
|
56
|
58
|
* 分页查询列表
|
57
|
59
|
* @param pageNum
|
|
@@ -61,7 +63,8 @@ public class TaApplicationController extends BaseController {
|
61
|
63
|
@RequestMapping(value="/admin/application",method= RequestMethod.GET)
|
62
|
64
|
@ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
|
63
|
65
|
public ResponseBean taApplicationList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
64
|
|
- @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
|
|
66
|
+ @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
67
|
+ @ApiParam("表单进度") @RequestParam(value ="process", defaultValue = "0") Integer process) throws Exception{
|
65
|
68
|
|
66
|
69
|
SysUser sysUser = currentUser();
|
67
|
70
|
|
|
@@ -69,17 +72,30 @@ public class TaApplicationController extends BaseController {
|
69
|
72
|
QueryWrapper<TaApplication> queryWrapper = new QueryWrapper<>();
|
70
|
73
|
queryWrapper.gt("status", Constants.STATUS_DELETE);
|
71
|
74
|
|
72
|
|
- // 审核人角色
|
73
|
|
- if (Constants.USER_AUDITOR.equals(sysUser.getRoleName())) {
|
74
|
|
- queryWrapper.ge("status", Constants.WORKFLOW_STATUS_PROCESSING);
|
75
|
|
- queryWrapper.le("status", Constants.WORKFLOW_STATUS_AUDIT);
|
|
75
|
+ if (Constants.WORKFLOW_PROCESS_AUDIT == process) {
|
|
76
|
+ // 过滤待审批列表
|
|
77
|
+ // 必须是已交费的 或者 续期的
|
|
78
|
+ queryWrapper.in("status", new Integer[] { Constants.WORKFLOW_STATUS_PROCESSING, Constants.WORKFLOW_STATUS_AUDIT });
|
|
79
|
+ queryWrapper.nested(q -> q.eq("pay_status", Constants.PAY_STATUS_PAID).or().eq("apply_type", Constants.APPLY_TYPE_RENEWAL));
|
|
80
|
+ } else if (Constants.WORKFLOW_PROCESS_MADE == process) {
|
|
81
|
+ // 过滤待制卡列表
|
|
82
|
+ // 必须是审核通过的, 且是初次提审或者挂失补办的
|
|
83
|
+ queryWrapper.in("status", new Integer[] { Constants.WORKFLOW_STATUS_AUDIT, Constants.WORKFLOW_STATUS_MADE });
|
|
84
|
+ queryWrapper.eq("verify_Status", Constants.AUDIT_STATUS_PASSED);
|
|
85
|
+ queryWrapper.in("apply_type", new String[] { Constants.APPLY_TYPE_FIRST, Constants.APPLY_TYPE_REISSUE});
|
76
|
86
|
}
|
77
|
87
|
|
78
|
|
- // 发证(制卡)人角色
|
79
|
|
- if (Constants.USER_MAKER.equals(sysUser.getRoleName())) {
|
80
|
|
- queryWrapper.ge("status", Constants.WORKFLOW_STATUS_AUDIT);
|
81
|
|
- queryWrapper.le("status", Constants.WORKFLOW_STATUS_MADE);
|
82
|
|
- }
|
|
88
|
+// // 审核人角色
|
|
89
|
+// if (Constants.USER_AUDITOR.equals(sysUser.getRoleName())) {
|
|
90
|
+// queryWrapper.ge("status", Constants.WORKFLOW_STATUS_PROCESSING);
|
|
91
|
+// queryWrapper.le("status", Constants.WORKFLOW_STATUS_AUDIT);
|
|
92
|
+// }
|
|
93
|
+//
|
|
94
|
+// // 发证(制卡)人角色
|
|
95
|
+// if (Constants.USER_MAKER.equals(sysUser.getRoleName())) {
|
|
96
|
+// queryWrapper.ge("status", Constants.WORKFLOW_STATUS_AUDIT);
|
|
97
|
+// queryWrapper.le("status", Constants.WORKFLOW_STATUS_MADE);
|
|
98
|
+// }
|
83
|
99
|
|
84
|
100
|
queryWrapper.orderByAsc("status");
|
85
|
101
|
queryWrapper.orderByDesc("create_date");
|
|
@@ -136,6 +152,39 @@ public class TaApplicationController extends BaseController {
|
136
|
152
|
taApplication.setVerifyStatus(Constants.AUDIT_STATUS_READY);
|
137
|
153
|
taApplication.setMakeStatus(Constants.MAKE_STATUS_READY);
|
138
|
154
|
|
|
155
|
+ if (Constants.APPLY_TYPE_RENEWAL.equals(taApplication.getApplyType())) {
|
|
156
|
+ // 如果是续期申请
|
|
157
|
+ if (StringUtils.isEmpty(taApplication.getOriginCardNo())) {
|
|
158
|
+ return ResponseBean.error("未找到原始证件信息");
|
|
159
|
+ }
|
|
160
|
+ TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
|
|
161
|
+ if (null == taPetIdentity) {
|
|
162
|
+ return ResponseBean.error("未找到原始证件信息");
|
|
163
|
+ }
|
|
164
|
+ taApplication.setStatus(Constants.WORKFLOW_STATUS_PROCESSING);
|
|
165
|
+ } else if (Constants.APPLY_TYPE_REISSUE.equals(taApplication.getApplyType())) {
|
|
166
|
+ // 如果是挂失补办
|
|
167
|
+ if (StringUtils.isEmpty(taApplication.getOriginCardNo())) {
|
|
168
|
+ return ResponseBean.error("未找到原始证件信息");
|
|
169
|
+ }
|
|
170
|
+ TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
|
|
171
|
+ if (null == taPetIdentity) {
|
|
172
|
+ return ResponseBean.error("未找到原始证件信息");
|
|
173
|
+ }
|
|
174
|
+
|
|
175
|
+ // 直接将原卡置为挂失
|
|
176
|
+ taPetIdentity.setStatus(Constants.CARD_STATUS_LOSS);
|
|
177
|
+ if (!iTaPetIdentityService.updateById(taPetIdentity)) {
|
|
178
|
+ return ResponseBean.error("挂失证件失败, 请重试");
|
|
179
|
+ }
|
|
180
|
+ } else {
|
|
181
|
+ // 当前狗狗是否存在证件
|
|
182
|
+ TaPetIdentity origin = iTaPetIdentityService.getByPet(taApplication.getPetId(), taApplication.getPersonId());
|
|
183
|
+ if (null != origin) {
|
|
184
|
+ return ResponseBean.error("请先挂失原始证件");
|
|
185
|
+ }
|
|
186
|
+ }
|
|
187
|
+
|
139
|
188
|
if (iTaApplicationService.save(taApplication)){
|
140
|
189
|
return ResponseBean.success(taApplication);
|
141
|
190
|
} else {
|
|
@@ -183,6 +232,10 @@ public class TaApplicationController extends BaseController {
|
183
|
232
|
public ResponseBean audit(@ApiParam("对象ID") @PathVariable Integer id,
|
184
|
233
|
@ApiParam("更新内容") @RequestBody AuditParam auditParam) throws Exception{
|
185
|
234
|
|
|
235
|
+ // 目前业务有 3 种, 初次申请, 挂失, 续期
|
|
236
|
+ // 其中 续期 不需要缴费
|
|
237
|
+ // 如果审核驳回,那么已缴费用, 需要原路返回
|
|
238
|
+
|
186
|
239
|
SysUser sysUser = currentUser();
|
187
|
240
|
if (!checkRole(sysUser.getRoleName(), Constants.USER_AUDITOR)) {
|
188
|
241
|
return ResponseBean.error("暂无权限");
|
|
@@ -229,14 +282,6 @@ public class TaApplicationController extends BaseController {
|
229
|
282
|
if (null == taPetIdentity) {
|
230
|
283
|
return ResponseBean.error("未找到原始证件信息");
|
231
|
284
|
}
|
232
|
|
-
|
233
|
|
- // 审核同意之后, 直接作废原始证件
|
234
|
|
- if (Constants.AUDIT_STATUS_PASSED == auditParam.getVerifyStatus()) {
|
235
|
|
- taPetIdentity.setStatus(Constants.CARD_STATUS_LOSS);
|
236
|
|
- if (!iTaPetIdentityService.updateById(taPetIdentity)) {
|
237
|
|
- return ResponseBean.error("续期挂失失败, 请重试");
|
238
|
|
- }
|
239
|
|
- }
|
240
|
285
|
} else {
|
241
|
286
|
return ResponseBean.error("申办业务类型不支持");
|
242
|
287
|
}
|
|
@@ -245,14 +290,23 @@ public class TaApplicationController extends BaseController {
|
245
|
290
|
return ResponseBean.error("当前记录已审批");
|
246
|
291
|
}
|
247
|
292
|
|
248
|
|
- if (auditParam.getVerifyStatus() == Constants.AUDIT_STATUS_REJECT && StringUtils.isEmpty(auditParam.getRejectReason())) {
|
249
|
|
- return ResponseBean.error("请填写驳回理由");
|
|
293
|
+ if (auditParam.getVerifyStatus() == Constants.AUDIT_STATUS_REJECT) {
|
|
294
|
+ if (StringUtils.isEmpty(auditParam.getRejectReason())) {
|
|
295
|
+ return ResponseBean.error("请填写驳回理由");
|
|
296
|
+ }
|
|
297
|
+
|
|
298
|
+ // 如果已经缴费, 则原路退回费用
|
|
299
|
+ if (Constants.PAY_STATUS_PAID == taApplication.getPayStatus()) {
|
|
300
|
+ iTaOrderService.refundByApplication(taApplication);
|
|
301
|
+ }
|
250
|
302
|
}
|
251
|
303
|
|
252
|
304
|
taApplication.setVerifyStatus(auditParam.getVerifyStatus());
|
|
305
|
+ taApplication.setRejectReason(auditParam.getRejectReason());
|
253
|
306
|
taApplication.setVerifyDate(LocalDateTime.now());
|
254
|
307
|
taApplication.setVerifyUser(sysUser.getUserId());
|
255
|
308
|
taApplication.setVerifyUserName(sysUser.getUserName());
|
|
309
|
+ taApplication.setStatus(Constants.WORKFLOW_STATUS_AUDIT);
|
256
|
310
|
|
257
|
311
|
if (iTaApplicationService.updateById(taApplication)){
|
258
|
312
|
return ResponseBean.success(taApplication);
|
|
@@ -297,8 +351,11 @@ public class TaApplicationController extends BaseController {
|
297
|
351
|
}
|
298
|
352
|
|
299
|
353
|
if (taApplication.getApplyMethod() == Constants.APPLY_METHOD_EXPRESS) {
|
300
|
|
- if (StringUtils.isEmpty(taApplication.getTrackingType()) || StringUtils.isEmpty(taApplication.getTrackingNo())) {
|
|
354
|
+ if (StringUtils.isEmpty(makeCardParam.getTrackingType()) || StringUtils.isEmpty(makeCardParam.getTrackingNo())) {
|
301
|
355
|
return ResponseBean.error("请填写快递信息");
|
|
356
|
+ } else {
|
|
357
|
+ taApplication.setTrackingNo(makeCardParam.getTrackingNo());
|
|
358
|
+ taApplication.setTrackingType(makeCardParam.getTrackingType());
|
302
|
359
|
}
|
303
|
360
|
}
|
304
|
361
|
|
|
@@ -311,12 +368,15 @@ public class TaApplicationController extends BaseController {
|
311
|
368
|
}
|
312
|
369
|
}
|
313
|
370
|
|
|
371
|
+ // 关联证件
|
|
372
|
+ taApplication.setOriginCardNo(makeCardParam.getCardNo());
|
314
|
373
|
taApplication.setMakeStatus(Constants.MAKE_STATUS_MADE);
|
315
|
374
|
taApplication.setMakeDate(LocalDateTime.now());
|
316
|
375
|
taApplication.setMakeUser(sysUser.getUserId());
|
317
|
376
|
taApplication.setMakeUserName(sysUser.getUserName());
|
318
|
377
|
taApplication.setTrackingType(makeCardParam.getTrackingType());
|
319
|
378
|
taApplication.setTrackingNo(makeCardParam.getTrackingNo());
|
|
379
|
+ taApplication.setStatus(Constants.WORKFLOW_STATUS_MADE);
|
320
|
380
|
|
321
|
381
|
if (iTaApplicationService.updateById(taApplication)){
|
322
|
382
|
TaPetIdentity newCard = iTaPetIdentityService.createNewCard(taApplication, makeCardParam);
|
|
@@ -363,4 +423,5 @@ public class TaApplicationController extends BaseController {
|
363
|
423
|
|
364
|
424
|
return ResponseBean.success(taApplication);
|
365
|
425
|
}
|
|
426
|
+
|
366
|
427
|
}
|