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