ANDRU-PC\Andru
2021-12-14 124a8713f2f1d1ff2629ebc326dd1968de0661f8
批量新增划扣记录
3个文件已修改
117 ■■■■■ 已修改文件
phi_platform_user/src/main/java/com/hx/phip/deduction/controller/DeductionController.java 110 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/deduction/service/impl/DeductionSingleServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/dto/DeductionDto.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/deduction/controller/DeductionController.java
@@ -1,5 +1,6 @@
package com.hx.phip.deduction.controller;
import com.alibaba.fastjson.JSONArray;
import com.hx.common.BaseController;
import com.hx.phiappt.common.DeductionSingleConstants;
import com.hx.phiappt.model.BaseEntity;
@@ -26,6 +27,7 @@
/**
 * 执行划扣控制器
 *
 * @USER: Andru
 * @DATE: 2021/12/10
 */
@@ -51,25 +53,25 @@
    private ComparePhotoRecordPicturesService comparePhotoRecordPicturesService;
    /**
     *查看记录
     * 查看记录
     */
    @RequestMapping(value = "/see")
    public Result seeData(HttpServletRequest request,String deductionSingleId){
    public Result seeData(HttpServletRequest request, String deductionSingleId) {
        // 获取用户信息
        ThirtApplication thirtApplication= (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if(thirtApplication == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"登入失败,请登入后在试!");
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "登入失败,请登入后在试!");
        }
        Map<String,Object> mapData = new HashMap<>();
        Map<String, Object> mapData = new HashMap<>();
        DeductionSingle deductionSingle = deductionSingleService.selectOneByKey(deductionSingleId);
        if(deductionSingle != null) {
        if (deductionSingle != null) {
            // 划扣记录
            mapData.put("deductionSingle", deductionSingle);
            // 项目划扣
            DeductionProject deductionProject = deductionProjectService.selectOneByDeductionSingleId(deductionSingle.getId());
            mapData.put("deductionProject", deductionProject);
            if(deductionProject != null) {
            if (deductionProject != null) {
                // 参与人员信息
                List<DeductionJoin> deductionJoinList = deductionJoinService.selectListByDeductionSingleId(deductionSingle.getId(), deductionProject.getId());
                mapData.put("deductionJoinList", deductionJoinList);
@@ -84,10 +86,10 @@
                mapData.put("deductionSignList", deductionSignList);
                // 治疗图片
                ComparePhotoRecord comparePhotoRecord = comparePhotoRecordService.selectOneByDeductionSingleId(deductionSingle.getId(), deductionProject.getId());
                if(comparePhotoRecord != null) {
                if (comparePhotoRecord != null) {
                    List<ComparePhotoRecordPictures> comparePhotoRecordPicturesList = comparePhotoRecordPicturesService.selectListByComparePhotoRecordId(comparePhotoRecord.getId());
                    mapData.put("comparePhotoRecordPicturesList", comparePhotoRecordPicturesList);
                }else{
                } else {
                    mapData.put("comparePhotoRecordPicturesList", null);
                }
            }
@@ -103,9 +105,9 @@
        // 校验参数
        checkParam(deductionDto);
        // 获取用户信息
        ThirtApplication thirtApplication= (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if(thirtApplication == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"登入失败,请登入后在试!");
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "登入失败,请登入后在试!");
        }
        // 填充接口登入信息
        deductionDto.setSourceCode(thirtApplication.getAppId());
@@ -118,20 +120,51 @@
    }
    /**
     * 批量新增划扣记录
     */
    @RequestMapping(value = "/batch/add", method = RequestMethod.POST)
    public Result batchAddData(HttpServletRequest request, String userProjectIds, DeductionDto deductionDto) {
        // 获取用户信息
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "登入失败,请登入后在试!");
        }
        // 填充接口登入信息
        deductionDto.setSourceCode(thirtApplication.getAppId());
        deductionDto.setSourceName(thirtApplication.getName());
        // 解析批量id
        List<String> userProjectIdList = JSONArray.parseArray(userProjectIds, String.class);
        // 判断是否传值
        if(userProjectIdList == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "用户项目id列表不能为空!");
        }
        // 批量划扣
        for (String userProjectId : userProjectIdList) {
            deductionDto.setUserProjectId(userProjectId);
            // 添加数据
            deductionSingleService.editInfo(deductionDto, BaseEntity.YES);
        }
        return Result.success();
    }
    /**
     * 修改划扣记录
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Result updateData(HttpServletRequest request, DeductionDto deductionDto) {
        // 判断deductionSingleId 是否为空
        if(StringUtils.isEmpty(deductionDto.getDeductionSingleId())){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"deductionSingleId不能为空");
        if (StringUtils.isEmpty(deductionDto.getDeductionSingleId())) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空");
        }
        // 校验参数
        checkParam(deductionDto);
        // 获取用户信息
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if(thirtApplication == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"登入失败,请登入后在试!");
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "登入失败,请登入后在试!");
        }
        // 填充接口登入信息
        deductionDto.setSourceCode(thirtApplication.getAppId());
@@ -147,18 +180,18 @@
     * 删除记录
     */
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public Result deleteData(HttpServletRequest request,String deductionSingleId){
        if(StringUtils.isEmpty(deductionSingleId)){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"deductionSingleId不能为空");
    public Result deleteData(HttpServletRequest request, String deductionSingleId) {
        if (StringUtils.isEmpty(deductionSingleId)) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空");
        }
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if(thirtApplication == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"登入失败,请登入后在试!");
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "登入失败,请登入后在试!");
        }
        // 删除数据
        deductionSingleService.deleteOne(deductionSingleId,thirtApplication.getAppId(),thirtApplication.getName(), DeductionSingleConstants.STATUS_CANCEL);
        deductionSingleService.deleteOne(deductionSingleId, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_CANCEL);
        return Result.success();
    }
@@ -166,40 +199,41 @@
     * 撤销记录
     */
    @RequestMapping(value = "/rescinded", method = RequestMethod.POST)
    public Result rescindedData(HttpServletRequest request,String deductionSingleId){
        if(StringUtils.isEmpty(deductionSingleId)){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"deductionSingleId不能为空");
    public Result rescindedData(HttpServletRequest request, String deductionSingleId) {
        if (StringUtils.isEmpty(deductionSingleId)) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "deductionSingleId不能为空");
        }
        ThirtApplication thirtApplication = (ThirtApplication) request.getSession().getAttribute(LoginConstant.LOGIN_APPLY);
        if(thirtApplication == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"登入失败,请登入后在试!");
        if (thirtApplication == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "登入失败,请登入后在试!");
        }
        // 删除数据
        deductionSingleService.deleteOne(deductionSingleId,thirtApplication.getAppId(),thirtApplication.getName(), DeductionSingleConstants.STATUS_RESCINDED);
        deductionSingleService.deleteOne(deductionSingleId, thirtApplication.getAppId(), thirtApplication.getName(), DeductionSingleConstants.STATUS_RESCINDED);
        return Result.success();
    }
    /**
     * 校验参数
     *
     * @param deductionDto 参数对象
     */
    private void checkParam(DeductionDto deductionDto){
        if(StringUtils.isEmpty(deductionDto.getUserProjectId())){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"userProjectId不能为空");
    private void checkParam(DeductionDto deductionDto) {
        if (StringUtils.isEmpty(deductionDto.getUserProjectId())) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "userProjectId不能为空");
        }
        if(deductionDto.getDeductionNum() <= 0){
            throw new PlatTipsException(PlatformCode.ERROR_TIPS,"数量/划扣次数需要大于0");
        if (deductionDto.getDeductionNum() <= 0) {
            throw new PlatTipsException(PlatformCode.ERROR_TIPS, "数量/划扣次数需要大于0");
        }
        if(deductionDto.getExecuteStartTime() == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"执行开始时间不内为空!");
        if (deductionDto.getExecuteStartTime() == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "执行开始时间不内为空!");
        }
        if(deductionDto.getExecuteEndTime() == null){
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL,"执行结束时间不内为空!");
        if (deductionDto.getExecuteEndTime() == null) {
            throw new PlatTipsException(PlatformCode.ERROR_PARAMETER_NULL, "执行结束时间不内为空!");
        }
    }
}
phi_platform_user/src/main/java/com/hx/phip/deduction/service/impl/DeductionSingleServiceImpl.java
@@ -139,7 +139,6 @@
            }
            deductionSingle.setUserId(userProject.getUserId());
            deductionSingle.setType(DeductionSingleConstants.TYPE_SELF_ADD);
            deductionSingle.setSourceCode(deductionDto.getSourceCode());
            deductionSingle.setSourceName(deductionDto.getSourceName());
            deductionSingle.setStatus(DeductionSingleConstants.STATUS_DONE_EXECUTE);
@@ -147,6 +146,8 @@
            // 是否添加数据
            if(type == BaseEntity.YES) {
                // 划扣默认类型
                deductionSingle.setType(deductionDto.getType());
                int count = deductionSingleMapper.insert(deductionSingle);
                if (count != 1) {
                    throw new TipsException("新增失败!");
phi_platform_user/src/main/java/com/hx/phip/dto/DeductionDto.java
@@ -1,5 +1,7 @@
package com.hx.phip.dto;
import com.hx.phiappt.common.DeductionSingleConstants;
import java.util.Date;
/**
@@ -16,7 +18,7 @@
    private String userProjectId;
    // 新增类型
    private String type;
    private String type = DeductionSingleConstants.TYPE_SELF_ADD;
    // 科室编号
    private String departmentCode;