|
@@ -371,6 +371,51 @@ public class TaApplicationController extends BaseController {
|
371
|
371
|
}
|
372
|
372
|
}
|
373
|
373
|
|
|
374
|
+ /**
|
|
375
|
+ * 绑卡
|
|
376
|
+ * @param id 实体ID
|
|
377
|
+ * @param makeCardParam 实体对象
|
|
378
|
+ * @return
|
|
379
|
+ */
|
|
380
|
+ @RequestMapping(value="/admin/application/{id}/bindCard",method= RequestMethod.PUT)
|
|
381
|
+ @ApiOperation(value="绑卡", notes = "绑卡", httpMethod = "PUT", response = ResponseBean.class)
|
|
382
|
+ public ResponseBean bindCard(@ApiParam("对象ID") @PathVariable Integer id,
|
|
383
|
+ @ApiParam("更新内容") @RequestBody MakeCardParam makeCardParam) throws Exception{
|
|
384
|
+ SysUser sysUser = currentUser();
|
|
385
|
+ if (!checkRole(sysUser.getRoleName(), Constants.USER_MAKER)) {
|
|
386
|
+ return ResponseBean.error("暂无权限");
|
|
387
|
+ }
|
|
388
|
+
|
|
389
|
+ TaApplication taApplication = iTaApplicationService.getById(id);
|
|
390
|
+ if (null == taApplication || taApplication.getStatus() == Constants.STATUS_DELETE) {
|
|
391
|
+ return ResponseBean.error("未找到数据");
|
|
392
|
+ }
|
|
393
|
+
|
|
394
|
+ if (StringUtils.isEmpty(makeCardParam.getCardNo())) {
|
|
395
|
+ return ResponseBean.error("卡号不能为空");
|
|
396
|
+ } else {
|
|
397
|
+ TaCardNo taCardNo = iTaCardNoService.getUnuseCard(makeCardParam.getCardNo());
|
|
398
|
+ if (taCardNo == null) {
|
|
399
|
+ return ResponseBean.error("卡号无效或者已使用");
|
|
400
|
+ }
|
|
401
|
+
|
|
402
|
+ // 将卡号置为已使用
|
|
403
|
+ taCardNo.setStatus(Constants.STATUS_NORMAL);
|
|
404
|
+ iTaCardNoService.updateById(taCardNo);
|
|
405
|
+
|
|
406
|
+ TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", makeCardParam.getCardNo(), false, true);
|
|
407
|
+ if (null != taPetIdentity) {
|
|
408
|
+ return ResponseBean.error("卡号已被占用");
|
|
409
|
+ }
|
|
410
|
+ }
|
|
411
|
+
|
|
412
|
+ taApplication.setOriginCardNo(makeCardParam.getCardNo());
|
|
413
|
+ iTaApplicationService.updateById(taApplication);
|
|
414
|
+ TaPetIdentity newCard = iTaPetIdentityService.createNewCard(taApplication, makeCardParam);
|
|
415
|
+ return ResponseBean.success(newCard);
|
|
416
|
+ }
|
|
417
|
+
|
|
418
|
+
|
374
|
419
|
/**
|
375
|
420
|
* 发证
|
376
|
421
|
* @param id 实体ID
|
|
@@ -415,26 +460,6 @@ public class TaApplicationController extends BaseController {
|
415
|
460
|
}
|
416
|
461
|
}
|
417
|
462
|
|
418
|
|
- if (StringUtils.isEmpty(makeCardParam.getCardNo())) {
|
419
|
|
- return ResponseBean.error("卡号不能为空");
|
420
|
|
- } else {
|
421
|
|
- TaCardNo taCardNo = iTaCardNoService.getUnuseCard(makeCardParam.getCardNo());
|
422
|
|
- if (taCardNo == null) {
|
423
|
|
- return ResponseBean.error("卡号无效或者已使用");
|
424
|
|
- }
|
425
|
|
-
|
426
|
|
- // 将卡号置为已使用
|
427
|
|
- taCardNo.setStatus(Constants.STATUS_NORMAL);
|
428
|
|
- iTaCardNoService.updateById(taCardNo);
|
429
|
|
-
|
430
|
|
- TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", makeCardParam.getCardNo(), false, true);
|
431
|
|
- if (null != taPetIdentity) {
|
432
|
|
- return ResponseBean.error("卡号已被占用");
|
433
|
|
- }
|
434
|
|
- }
|
435
|
|
-
|
436
|
|
- // 关联证件
|
437
|
|
- taApplication.setOriginCardNo(makeCardParam.getCardNo());
|
438
|
463
|
taApplication.setMakeStatus(Constants.MAKE_STATUS_MADE);
|
439
|
464
|
taApplication.setMakeDate(LocalDateTime.now());
|
440
|
465
|
taApplication.setMakeUser(sysUser.getUserId());
|
|
@@ -443,10 +468,14 @@ public class TaApplicationController extends BaseController {
|
443
|
468
|
taApplication.setTrackingNo(makeCardParam.getTrackingNo());
|
444
|
469
|
taApplication.setStatus(Constants.WORKFLOW_STATUS_MADE);
|
445
|
470
|
|
446
|
|
- if (iTaApplicationService.updateById(taApplication)){
|
447
|
|
- TaPetIdentity newCard = iTaPetIdentityService.createNewCard(taApplication, makeCardParam);
|
|
471
|
+ TaPetIdentity taPetIdentity = iTaPetIdentityService.getExistBy("card_no", taApplication.getOriginCardNo(), false, true);
|
|
472
|
+ if (!taApplication.getApplyType().equals(Constants.APPLY_TYPE_REISSUE)) {
|
|
473
|
+ // 新办 续期,都需要重置有效期
|
|
474
|
+ iTaPetIdentityService.updateCardDate(taPetIdentity.getCardNo());
|
|
475
|
+ }
|
448
|
476
|
|
449
|
|
- return ResponseBean.success(newCard);
|
|
477
|
+ if (iTaApplicationService.updateById(taApplication)){
|
|
478
|
+ return ResponseBean.success(taApplication);
|
450
|
479
|
} else {
|
451
|
480
|
return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
452
|
481
|
}
|