diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java b/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java index a6f08c92..a6989d28 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/worker/WorkerCertificationController.java @@ -154,27 +154,23 @@ public class WorkerCertificationController extends BaseController @ResponseBody @Transactional(rollbackFor = Exception.class) public AjaxResult appAddCertify(@RequestBody WorkerCertification request) { - try { - // 将师傅状态设置为冻结 - Worker worker = new Worker(); - worker.setWorkerId(request.getWorkerId()); - worker.setStatus(WorkerStatus.DISABLE.getCode()); - int updateRows = workerService.updateWorker(worker); - Assert.isTrue(updateRows == 1, "实名认证记录新增失败"); - // 删除存在的认证记录 - workerCertificationService.deleteCertificationByWorkerId(request.getWorkerId()); - // 插入新的认证记录 - request.setStatus(WorkerCertifyStatus.AUDITING.getCode()); - int insertRows = workerCertificationService.insertWorkerCertification(request); - Assert.isTrue(insertRows == 1, "实名认证记录新增失败"); - // 入驻特殊技能信息持久化 + // 将师傅状态设置为冻结 + Worker worker = new Worker(); + worker.setWorkerId(request.getWorkerId()); + worker.setStatus(WorkerStatus.DISABLE.getCode()); + int updateRows = workerService.updateWorker(worker); + Assert.isTrue(updateRows == 1, "实名认证记录新增失败"); + // 删除存在的认证记录 + workerCertificationService.deleteCertificationByWorkerId(request.getWorkerId()); + // 插入新的认证记录 + request.setStatus(WorkerCertifyStatus.AUDITING.getCode()); + int insertRows = workerCertificationService.insertWorkerCertification(request); + Assert.isTrue(insertRows == 1, "实名认证记录新增失败"); + // 入驻特殊技能信息持久化 + if (!CollectionUtils.isEmpty(request.getSpecialSkills())) { workerSpecialSkillService.updateWorkerSpecialSkill(request.getWorkerId(), request.getSpecialSkills()); - return AjaxResult.success("保存成功"); - } catch (Exception e) { - e.printStackTrace(); - logger.error(ExceptionUtil.getExceptionMessage(e)); - return AjaxResult.error(e.getMessage()); } + return AjaxResult.success("保存成功"); } @PostMapping("/app/getByWorkerId") @@ -184,8 +180,10 @@ public class WorkerCertificationController extends BaseController WorkerCertification workerCertification = workerCertificationService.selectByWorkerId(request.getWorkerId()); if (workerCertification != null) { workerCertification.setSpecialSkills(workerSpecialSkillService.getByWorker(request.getWorkerId())); - SysArea sysArea = sysAreaService.selectById(workerCertification.getCompanyCountryId()); - workerCertification.setMergerName(sysArea.getMergerName()); + if (workerCertification.getCompanyCountryId() != null) { + SysArea sysArea = sysAreaService.selectById(workerCertification.getCompanyCountryId()); + workerCertification.setMergerName(sysArea.getMergerName()); + } } return AjaxResult.success(workerCertification); } catch (Exception e) { diff --git a/ghy-worker/src/main/resources/mapper/worker/WorkerCertificationMapper.xml b/ghy-worker/src/main/resources/mapper/worker/WorkerCertificationMapper.xml index fd4919c3..a3eed9a0 100644 --- a/ghy-worker/src/main/resources/mapper/worker/WorkerCertificationMapper.xml +++ b/ghy-worker/src/main/resources/mapper/worker/WorkerCertificationMapper.xml @@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into worker_certification - worker_id, + worker_id, name, id_card_num, id_card_url_1, @@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" remark, - #{workerId}, + #{workerId}, #{name}, #{idCardNum}, #{idCardUrl1}, @@ -166,7 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" DELETE FROM worker_certification WHERE worker_id = #{workerId} - + UPDATE worker_certification set status = #{status} WHERE worker_certification_id in ( #{ids} )