k94314517
2025-05-26 81d7f91fa38e74cab052eb4413bd3e12686935a4
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -19,6 +19,7 @@
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.ApplyPowerVO;
import com.doumee.dao.business.vo.CountCyclePriceVO;
import com.doumee.dao.business.vo.dataBoard.InsuranceDataVO;
import com.doumee.dao.system.SystemUserMapper;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.InsuranceApplyService;
@@ -35,6 +36,8 @@
import io.swagger.models.auth.In;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -62,7 +65,6 @@
    private SmsEmailService smsEmailService;
    @Autowired
    private ApplyChangeJoinMapper applyChangeMapper;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
@@ -71,25 +73,20 @@
    private CompanyMapper companyMapper;
    @Autowired
    private MemberInsuranceJoinMapper memberInsuranceJoinMapper;
    @Autowired
    private ApplyDetailMapper applyDetailMapper;
    @Autowired
    private ApplyDetailJoinMapper applyDetailJoinMapper;
    @Autowired
    private ApplyLogMapper applyLogMapper;
    @Autowired
    private SignService signService;
    @Autowired
    private MultifileMapper multifileMapper;
    @Autowired
    private ApplyLogJoinMapper applyLogJoinMapper;
    @Autowired
    private SolutionsMapper solutionsMapper;
    @Autowired
    private MemberMapper memberMapper;
    @Autowired
@@ -104,7 +101,6 @@
    private DuWorkTypeJoinMapper duWorkTypeJoinMapper;
    @Autowired
    private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper;
    @Autowired
    private NoticesMapper noticesMapper;
    @Autowired
@@ -119,7 +115,8 @@
    private SystemUserMapper systemUserMapper;
    @Autowired
    private CompanyDepartmentMapper companyDepartmentMapper;
    @Autowired
    private InsuranceMapper insuranceMapper;
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
@@ -150,7 +147,6 @@
            }
            update.setStatus(Constants.InsuranceApplyStatus.WTB_RETURN.getKey());
        }
        update.setEditDate(new Date());
        update.setEditor(user.getId());
        update.setCheckDate(update.getEditDate());
@@ -158,7 +154,6 @@
        update.setCheckUserId(user.getId());
        update.setId(model.getId());
        insuranceApplyMapper.updateById(update);
        //存储待办信息
        Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY;
        //删除其他待办
@@ -168,8 +163,6 @@
        Notices notices = new Notices(noticeObjectType,Constants.ONE,insuranceApply.getId(),solutions.getName(),
                model.getCompanyId(), Constants.NoticeType.FOUR);
        noticesMapper.insert(notices);
        Constants.ApplyLogType applyLogType = Constants.ApplyLogType.PLATFORM_RETURN;
        String info =applyLogType.getInfo();
        info = info.replace("${param}", update.getCheckInfo());
@@ -223,7 +216,6 @@
                ||StringUtils.isBlank( insuranceApply.getBaoxiandanFile() .getName())){
            throw  new BusinessException(ResponseStatus.BAD_REQUEST);
        }
        InsuranceApply model = insuranceApplyMapper.selectById(insuranceApply.getId());
        if(model == null ||!Constants.equalsInteger(model.getIsdeleted(),Constants.ZERO)){
            throw  new BusinessException(ResponseStatus.DATA_EMPTY);
@@ -513,7 +505,7 @@
        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WAIT_SIGNATURE.getKey())){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~");
        }
        Company company = user.getCompany();
        Company company = user.getShowCompany();
        if(debugModel){
            company = companyMapper.selectById(model.getCompanyId());
        }
@@ -2375,8 +2367,13 @@
    private static Logger logger = LoggerFactory.getLogger(InsuranceApplyServiceImpl.class);
    public void dealApplyDetailData(InsuranceApply insuranceApply,Solutions solutions,List<ApplyDetail> applyDetailList,
                                    LoginUserInfo loginUserInfo,CountCyclePriceVO  countCyclePriceVO,Boolean checkNewData){
        Long start = System.currentTimeMillis();
        logger.error("处理保单数据开始时间:=========================>"+start);
        //2024年11月6日15:01:34  加入  方案配置了有派遣单位 才会去验证派遣单位数据
        List<DuSolution>  duSolutionList = new ArrayList<>();
        List<DuWorktype> duWorktypeList = new ArrayList<>();
@@ -2459,6 +2456,8 @@
            }
            memberList.addAll(addMemberList);
            for (int i = 0; i < applyDetailList.size(); i++) {
                Long singlStart = System.currentTimeMillis();
                logger.error("处理保单单条数据开始时间:=========================>"+singlStart);
                ApplyDetail applyDetail = applyDetailList.get(i);
                if(Objects.isNull(applyDetail)
                        ||StringUtils.isBlank(applyDetail.getIdcardNo())
@@ -2535,11 +2534,11 @@
                        .collect(Collectors.toList()).size()<=Constants.ZERO){
                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工工种信息未查询到!");
                }
//                if(duWorktypeList.stream().filter(d->d.getWorkTypeId().equals(applyDetail.getWorktypeId()))
//                        .collect(Collectors.toList()).size()<=Constants.ZERO){
//                    throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工工种信息未查询到!");
//                }
                Long singlEnd = System.currentTimeMillis();
                logger.error("处理保单单条数据结束时间:=========================>"+singlEnd+";耗时:====》"+(singlStart-singlEnd));
            }
            Long end = System.currentTimeMillis();
            logger.error("处理单数据结束时间:=========================>"+end +";耗时:====》"+(end-start));
            applyDetailJoinMapper.insertBatchSomeColumn(applyDetailList);
        }
    }
@@ -2592,7 +2591,7 @@
        };
    }
    public static void checkStaticMemberSolution(Integer solutionId,String idCode,String memberName,Date startTime,
    public static void checkStaticMemberSolution(Integer solutionId,Integer memberId,String memberIdCard,String memberName,Date startTime,
                                                 Date endTime,ApplyDetailJoinMapper applyDetailJoinMapper){
        List<ApplyDetail> applyDetailList = new ArrayList<ApplyDetail>();
        try {
@@ -2604,7 +2603,7 @@
                            .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId)
                            .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId)
                            .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId)
                            .eq(ApplyDetail::getIdcardNo,idCode)
                            .eq(ApplyDetail::getIdcardNo,memberIdCard)
                            .eq(Solutions::getBaseId,solutionId)
                            .eq(ApplyDetail::getIsdeleted,Constants.ZERO)
                            .notIn(InsuranceApply::getStatus
@@ -2622,6 +2621,7 @@
        }
        if(applyDetailList.size() >Constants.ZERO){
            String companyName = applyDetailList.get(Constants.ZERO).getCompanyName();
            String idCode = applyDetailList.get(Constants.ZERO).getIdcardNo();
            if(StringUtils.isNotBlank(companyName)){
                throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"该员工【"+memberName+" "+idCode+"】已在【"+companyName+"】存在保险,请联系客服确认");
            }else{
@@ -3493,7 +3493,7 @@
        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_UPLOAD.getKey())){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~");
        }
        Company company = user.getCompany();
        Company company = user.getShowCompany();
        if(debugModel){
            company = companyMapper.selectById(model.getCompanyId());
        }
@@ -3578,7 +3578,7 @@
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,该申请状态已流转,当前不支持签章操作!");
        }
        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
        Company company = user.getCompany();
        Company company = user.getShowCompany();
        if(debugModel){
            company = companyMapper.selectById(model.getCompanyId());
        }
@@ -3659,7 +3659,7 @@
        if(!Constants.equalsInteger(model.getStatus(),Constants.InsuranceApplyStatus.WTB_TOUBAOING.getKey())){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,该申请状态已流转,当前不支持该操作~");
        }
        Company company = user.getCompany();
        Company company = user.getShowCompany();
        if(debugModel){
            company = companyMapper.selectById(model.getCompanyId());
        }
@@ -3766,6 +3766,61 @@
        return applyPowerVO;
    }
//    @Override
//    public InsuranceDataVO getInsuranceDataVO(){
//        InsuranceDataVO insuranceDataVO = new InsuranceDataVO();
//        insuranceDataVO.setInsuranceTotal(Constants.ZERO);
//        insuranceDataVO.setInsuranceAddTotal(Constants.ZERO);
//        insuranceDataVO.setInsuranceApplyTotal(Constants.ZERO);
//        insuranceDataVO.setInsuranceApplyAddTotal(Constants.ZERO);
//        insuranceDataVO.setInsuranceUserTotal(Constants.ZERO);
//        insuranceDataVO.setInsuranceUserAddTotal(Constants.ZERO);
//        insuranceDataVO.setTotalAddFee(BigDecimal.ZERO);
//        insuranceDataVO.setTotalFee(BigDecimal.ZERO);
//        //本月日期
//        String monthData = DateUtil.DateToStr(new Date(),"yyyy-MM");
//        //保险公司数量
//        List<Insurance> insuranceList = insuranceMapper.selectList(new QueryWrapper<Insurance>().lambda().eq(Insurance::getIsdeleted,Constants.ZERO).eq(Insurance::getStatus,Constants.ZERO));
//        if(CollectionUtils.isNotEmpty(insuranceList)){
//            insuranceDataVO.setInsuranceTotal(insuranceList.size());
//            insuranceDataVO.setInsuranceAddTotal(insuranceList.stream().filter(i->Objects.nonNull(i.getCreateDate())&&DateUtil.DateToStr(i.getCreateDate(),"yyyy-MM").equals(monthData)).collect(Collectors.toList()).size());
//        }
//
//        //保单数量
//        List<InsuranceApply> insuranceApplyList = insuranceApplyMapper.selectList(new QueryWrapper<InsuranceApply>()
//                .lambda().eq(InsuranceApply::getIsdeleted,Constants.ZERO).in(InsuranceApply::getStatus,
//                Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_DONE.getKey())
//        );
//        if(CollectionUtils.isNotEmpty(insuranceApplyList)){
//            insuranceDataVO.setInsuranceApplyTotal(insuranceApplyList.size());
//            insuranceDataVO.setInsuranceApplyAddTotal(insuranceApplyList.stream().filter(i->Objects.nonNull(i.getCreateDate())&&DateUtil.DateToStr(i.getCreateDate(),"yyyy-MM").equals(monthData)).collect(Collectors.toList()).size());
//        }
//
//        //在保人数
//        List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>().selectAll(ApplyDetail.class)
//                .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId)
//                .eq(InsuranceApply::getIsdeleted,Constants.ZERO).in(InsuranceApply::getStatus,
//                        Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey(),Constants.InsuranceApplyStatus.WTB_DONE.getKey())
//                .eq(ApplyDetail::getIsdeleted,Constants.ZERO)
//                .apply(" ( t.START_TIME >= now() and t.END_TIME <= now() ) ")
//        );
//        if(CollectionUtils.isNotEmpty(applyDetailList)){
//            insuranceDataVO.setInsuranceUserTotal(applyDetailList.size());
//            insuranceDataVO.setInsuranceUserAddTotal(
//                    applyDetailList.stream().filter(i->Objects.nonNull(i.getCreateDate())&&DateUtil.DateToStr(i.getCreateDate(),"yyyy-MM")
//                            .equals(monthData)).collect(Collectors.toList()).size());
//
//            insuranceDataVO.setTotalFee(applyDetailList.stream().map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
//            insuranceDataVO.setTotalAddFee(applyDetailList.stream()
//                    .filter(i->Objects.nonNull(i.getCreateDate())&&DateUtil.DateToStr(i.getCreateDate(),"yyyy-MM")
//                    .equals(monthData)).map(i->i.getFee()).reduce(BigDecimal.ZERO,BigDecimal::add));
//        }
//
//        return insuranceDataVO;
//    }
}