From fd7405fbc2621694ac402cae6f766d096b3f8e9c Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Sat, 15 May 2021 21:16:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=90=8D=E5=A2=9E=E5=8A=A0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=8A=A5=E5=90=8D=E6=9C=BA=E6=9E=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/api/apply/ApplyController.java | 15 ++++++++ .../tenlion/service/apply/IApplyService.java | 7 ++++ .../service/apply/impl/ApplyServiceImpl.java | 35 +++++++++++++++++-- .../mybatis/mapper/apply/apply-mapper.xml | 3 ++ 4 files changed, 57 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/com/tenlion/controller/api/apply/ApplyController.java b/src/main/java/cn/com/tenlion/controller/api/apply/ApplyController.java index 3519277..45bca16 100644 --- a/src/main/java/cn/com/tenlion/controller/api/apply/ApplyController.java +++ b/src/main/java/cn/com/tenlion/controller/api/apply/ApplyController.java @@ -40,6 +40,21 @@ public class ApplyController extends DefaultBaseController { private IApplyService applyService; + @ApiOperation(value = "报名信息报道", notes = "报名信息报道接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "applyId", value = "报名信息ID", paramType = "path"), + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @PutMapping("updateInstitutionId/{targetId}") + @CheckRequestBodyAnnotation + public SuccessResult updateInstitutionId(@PathVariable("targetId") String targetId) { + Map params = requestParams(); + String sourceIds = params.get("sourceIds").toString(); + applyService.updateInstitutionId(targetId,Arrays.asList(sourceIds.split(","))); + return new SuccessResult(); + } + + @ApiOperation(value = "自定义新增报名信息", notes = "自定义新增报名信息") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) diff --git a/src/main/java/cn/com/tenlion/service/apply/IApplyService.java b/src/main/java/cn/com/tenlion/service/apply/IApplyService.java index 7ea6e10..51fcc6f 100644 --- a/src/main/java/cn/com/tenlion/service/apply/IApplyService.java +++ b/src/main/java/cn/com/tenlion/service/apply/IApplyService.java @@ -22,6 +22,13 @@ import java.util.Map; **/ public interface IApplyService { + /** + * 修改报名机构 + * @param targetId 目标id + * @param sourceIds 源id + */ + void updateInstitutionId(String targetId,List sourceIds); + /** * 自定义新增报名信息 * @param applyVO diff --git a/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java b/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java index 9abdedc..776e395 100644 --- a/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/apply/impl/ApplyServiceImpl.java @@ -86,12 +86,41 @@ public class ApplyServiceImpl extends DefaultBaseService implements IApplyServic @Autowired private ServerProperties serverProperties; + /** + * 修改报名机构 + * @param targetId 目标id + * @param sourceIds 源id + */ + public void updateInstitutionId(String targetId,List sourceIds){ + InstitutionDTO institutionDTO = iInstitutionService.get(targetId); + if(institutionDTO != null){ + throw new SearchException("未查询到目标机构信息"); + } + Map params = new HashMap<>(); + for (String sourceId : sourceIds) { + params.put("applyInstitutionId",sourceId); + List applyDTOList = this.list(params);//查询源报名的人 + for (ApplyDTO applyDTO : applyDTOList) { + Map updateParams = new HashMap<>(); + updateParams.put("applyId",applyDTO.getApplyId()); + updateParams.put("applyInstitutionId",applyDTO.getApplyInstitutionId()); + applyDao.update(params); + //增加操作日志 + ApplyAuditLogVO auditLogVO = new ApplyAuditLogVO(); + auditLogVO.setApplyId(applyDTO.getApplyId()); + auditLogVO.setApplyAuditState(0); + InstitutionDTO sourceInstitutionDTO = iInstitutionService.get(applyDTO.getApplyInstitutionId()); + if(sourceInstitutionDTO != null){ + throw new SearchException("未查询到源机构信息"); + } + auditLogVO.setApplyAuditExplain("【因报名人数不足】 报名培训机构 由原【"+sourceInstitutionDTO.getInstitutionName()+"】培训机构 调整到【"+institutionDTO.getInstitutionName()+"】培训机构"); + applyAuditLogService.save(null,auditLogVO); + } + } + } - private ISystemConfigManager systemConfigManager; - - public String saveRelationReturnId(ApplyVO applyVO){ String applyId = UUIDUtil.getUUID(); diff --git a/src/main/resources/mybatis/mapper/apply/apply-mapper.xml b/src/main/resources/mybatis/mapper/apply/apply-mapper.xml index deba6a8..476a304 100644 --- a/src/main/resources/mybatis/mapper/apply/apply-mapper.xml +++ b/src/main/resources/mybatis/mapper/apply/apply-mapper.xml @@ -686,4 +686,7 @@ + + + \ No newline at end of file