k94314517
2024-03-18 94ed71de2eb6212168e62c2c2c294b86644b87d4
git ch
已添加1个文件
已修改4个文件
219 ■■■■■ 文件已修改
server/service/src/main/java/com/doumee/core/utils/Constants.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionApplyDTO.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/UnionApplyService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -564,7 +564,7 @@
        SYSTEM(0, "系统用户", "管理员",Arrays.asList(0,1,2,3,4,5,6,7,8,9,10,11)),
        COMPANY(1, "企业用户", "企业",Arrays.asList(-1)),
        ZHUBO(2, "主播", "主播",Arrays.asList(-1)),
        ZHUBO(2, "商户", "商户",Arrays.asList(-1)),
        ;
        // æˆå‘˜å˜é‡
        private String name;
@@ -844,6 +844,97 @@
        }
    }
    public  enum UnionApplyStatus {
        UPLOAD(1, "待上传投保单","",0),
        ;
        // æˆå‘˜å˜é‡
        private String name;
        private String info;
        private int key;
        private int collectStatus;
        // æž„造方法
        UnionApplyStatus(int key, String name,String info,int collectStatus) {
            this.name = name;
            this.key = key;
            this.info = info;
            this.collectStatus = collectStatus;
        }
        // æ™®é€šæ–¹æ³•
        public static String getName(int index) {
            for (UnionApplyStatus c : UnionApplyStatus.values()) {
                if (c.getKey() == index) {
                    return c.name;
                }
            }
            return null;
        }
        public static List<Integer> getKesByStatus(Integer collectStatus) {
            List<Integer>  list = new ArrayList<>();
            if(collectStatus!=null){
                for (UnionApplyStatus c : UnionApplyStatus.values()) {
                    if (Constants.equalsInteger(c.getCollectStatus() ,collectStatus)) {
                        list.add(c.getKey());
                    }
                }
            }
            return list;
        }
        public static Integer getCollectStatus(Integer index) {
            for (UnionApplyStatus c : UnionApplyStatus.values()) {
                if (Constants.equalsInteger(c.getKey() , index)) {
                    return c.collectStatus;
                }
            }
            return null;
        }
        public static String getInfo(int index) {
            for (UnionApplyStatus c : UnionApplyStatus.values()) {
                if (c.getKey() == index) {
                    return c.info;
                }
            }
            return null;
        }
        // get set æ–¹æ³•
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public int getKey() {
            return key;
        }
        public void setKey(int key) {
            this.key = key;
        }
        public String getInfo() {
            return info;
        }
        public void setInfo(String info) {
            this.info = info;
        }
        public int getCollectStatus() {
            return collectStatus;
        }
        public void setCollectStatus(int collectStatus) {
            this.collectStatus = collectStatus;
        }
    }
    public  enum InsuranceApplyStatus {
        UPLOAD(0, "提交投保","",0),
        PLATFORM_RETURN(1, "审核不通过","提交意见:${param}",4),
server/service/src/main/java/com/doumee/dao/business/dto/SaveUnionApplyDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
package com.doumee.dao.business.dto;
import com.doumee.core.annotation.excel.ExcelColumn;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Rk
 * @create 2024/3/15 14:42
 */
@Data
public class SaveUnionApplyDTO {
    @ApiModelProperty(value = "方案基础数据主键")
    private Integer baseSolutionId;
    @ApiModelProperty(value = "保单主键 å¤šä¸ªä»¥,分割")
    private List<Integer> applyIds;
    @ApiModelProperty(value = "开始日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date startDate;
    @ApiModelProperty(value = "结束日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date endDate;
}
server/service/src/main/java/com/doumee/dao/business/model/InsuranceApply.java
@@ -214,6 +214,9 @@
    @TableField(exist = false)
    private Integer timeUnit;
    @ApiModelProperty(value = "方案基础版本主键", example = "1")
    @TableField(exist = false)
    private Integer solutionBaseId;
    @ApiModelProperty(value = "最新版本的方案主键", example = "1")
    @TableField(exist = false)
server/service/src/main/java/com/doumee/service/business/UnionApplyService.java
@@ -2,6 +2,7 @@
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.dto.SaveUnionApplyDTO;
import com.doumee.dao.business.model.UnionApply;
import java.util.List;
@@ -94,4 +95,10 @@
     * @return long
     */
    long count(UnionApply unionApply);
    /**
     * ä¿å•合并
     * @param saveUnionApplyDTO
     */
    void merge(SaveUnionApplyDTO saveUnionApplyDTO);
}
server/service/src/main/java/com/doumee/service/business/impl/UnionApplyServiceImpl.java
@@ -1,20 +1,35 @@
package com.doumee.service.business.impl;
import com.doumee.core.constants.ResponseStatus;
import com.doumee.core.exception.BusinessException;
import com.doumee.core.model.LoginUserInfo;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.UnionApplyMapper;
import com.doumee.dao.business.dto.SaveUnionApplyDTO;
import com.doumee.dao.business.join.InsuranceApplyJoinMapper;
import com.doumee.dao.business.model.InsuranceApply;
import com.doumee.dao.business.model.Solutions;
import com.doumee.dao.business.model.UnionApply;
import com.doumee.service.business.UnionApplyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
 * åˆå¹¶æŠ•保单信息表Service实现
@@ -26,6 +41,9 @@
    @Autowired
    private UnionApplyMapper unionApplyMapper;
    @Autowired
    private InsuranceApplyJoinMapper insuranceApplyJoinMapper;
    @Override
    public Integer create(UnionApply unionApply) {
@@ -166,4 +184,66 @@
        QueryWrapper<UnionApply> wrapper = new QueryWrapper<>(unionApply);
        return unionApplyMapper.selectCount(wrapper);
    }
    @Override
    public void merge(SaveUnionApplyDTO saveUnionApplyDTO){
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作");
        }
        if(Objects.isNull(saveUnionApplyDTO)
            || Objects.isNull(saveUnionApplyDTO.getApplyIds())
            || Objects.isNull(saveUnionApplyDTO.getStartDate())
            || Objects.isNull(saveUnionApplyDTO.getEndDate())
        ){
            throw new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        List<InsuranceApply> insuranceApplyList = insuranceApplyJoinMapper.selectJoinList(InsuranceApply.class,
                new MPJLambdaWrapper<InsuranceApply>()
                        .selectAll(InsuranceApply.class)
                        .selectAs(InsuranceApply::getSolutionBaseId,Solutions::getBaseId)
                        .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                        .eq(InsuranceApply::getIsdeleted, Constants.ZERO)
                        .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.PLATFORM_CHECK_PASS.getKey())
                        .eq(Solutions::getBaseId,saveUnionApplyDTO.getBaseSolutionId())
                        .in(InsuranceApply::getId,saveUnionApplyDTO.getApplyIds())
                        .isNull(InsuranceApply::getUnionApplyId)
        );
        //查询数据是否存在未处于审批通过的数据
        if(insuranceApplyList.size()!=saveUnionApplyDTO.getApplyIds().size()){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"存在数据已处理,请刷新重试");
        }
        UnionApply unionApply = new UnionApply();
        unionApply.setCreateDate(new Date());
        unionApply.setCreator(user.getId());
        unionApply.setCompanyId(user.getCompanyId());
        unionApply.setStartTime(saveUnionApplyDTO.getStartDate());
        unionApply.setEndTime(saveUnionApplyDTO.getEndDate());
        unionApply.setCheckDate(new Date());
        unionApply.setStatus(Constants.UnionApplyStatus.UPLOAD.getKey());
        unionApply.setCheckUserId(user.getId());
        unionApply.setFee(insuranceApplyList.stream().map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
        unionApply.setCurrentFee(BigDecimal.ZERO);
        unionApplyMapper.insert(unionApply);
        insuranceApplyJoinMapper.update(null,new UpdateWrapper<InsuranceApply>().lambda()
                .set(InsuranceApply::getUnionApplyId,unionApply.getId())
                .set(InsuranceApply::getCheckDate,new Date())
                .set(InsuranceApply::getCheckUserId,user.getId())
                .in(InsuranceApply::getId,saveUnionApplyDTO.getApplyIds()));
    }
    public void cancelMerge(Integer id){
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        if(user.getType().equals(Constants.TWO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非商户用户,无法进行该操作");
        }
    }
}