Browse Source

检验申请 撤回接口

huangzhiyong 6 năm trước cách đây
mục cha
commit
242e5103cf

+ 16 - 2
src/main/java/com/yihu/ehr/svrinspection/controller/AssistanceApplyController.java

@ -168,8 +168,8 @@ public class AssistanceApplyController extends EnvelopRestEndPoint {
    @ApiOperation(value = "检验协助申请", response = AssistanceApplyModel.class)
    @PostMapping(value = "apply",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop createAssistanceApply(
            @ApiParam(name = "apply", value = "档案申请JSON结构")
            @RequestBody AssistanceApplyModel apply)  {
            @ApiParam(name = "apply", value = "档案申请JSON结构",required = true)
            @RequestBody(required = true) AssistanceApplyModel apply)  {
        AssistanceApplyModel save = null;
        try {
@ -199,6 +199,20 @@ public class AssistanceApplyController extends EnvelopRestEndPoint {
        return success(save);
    }
    @ApiOperation(value = "检验申请撤回", response = AssistanceApplyModel.class)
    @PostMapping(value = "apply/retract",consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop applyRetract (
            @ApiParam(name = "applyId", value = "申请记录ID", defaultValue = "")
            @RequestParam(value = "applyId", required = false) int applyId)  {
        AssistanceApplyModel save = null;
        try {
            save = assistanceApplyService.retractApply(applyId,2);
        } catch (ManageException e) {
            return failed(e.getMessage());
        }
        return success(save);
    }
}

+ 27 - 2
src/main/java/com/yihu/ehr/svrinspection/service/AssistanceApplyService.java

@ -29,8 +29,14 @@ public class AssistanceApplyService  extends BaseJpaService<AssistanceApplyModel
    }
    public AssistanceApplyModel saveApply(AssistanceApplyModel assistanceApplyModel) throws ManageException {
        AssistanceApplyModel save = assistanceApplyDao.save(assistanceApplyModel);
        return save;
        if (assistanceApplyModel.getId() == null ){
            assistanceApplyModel.setCreateTime(new Date());
            //已申请
            assistanceApplyModel.setSolutionStatus(0);
            assistanceApplyModel.setIsRead(0);
        }
         assistanceApplyModel = assistanceApplyDao.save(assistanceApplyModel);
        return assistanceApplyModel;
    }
@ -116,4 +122,23 @@ public class AssistanceApplyService  extends BaseJpaService<AssistanceApplyModel
        return todayCount;
    }
    /**
     * 申请撤回
     * @param id        申请记录id
     * @param status    申请记录状态
     * @return
     * @throws ManageException
     */
    public AssistanceApplyModel retractApply(int id,int status) throws ManageException {
        AssistanceApplyModel applyModel = findById(id);
        if (applyModel == null) {
            throw new ManageException("申请记录不存在!");
        }
        applyModel.setSolutionStatus(status);
        assistanceApplyDao.save(applyModel);
        return applyModel;
    }
}