From 6abf2479328a3ff1a560ca193f6b5b26a498b95f Mon Sep 17 00:00:00 2001 From: donqi Date: Tue, 26 Jul 2022 01:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../worker/WorkerCertificationController.java | 40 +++++++++---------- .../worker/WorkerCertificationMapper.xml | 6 +-- 2 files changed, 22 insertions(+), 24 deletions(-) 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} )