k94314517
2025-01-18 32929606943fedfca286b052bcb280193a3e0222
server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -1104,6 +1104,7 @@
    private void startSendEmail(Multifile f, String companyName, String solutionsName, String solutionEmail) {
        if(StringUtils.isBlank(solutionEmail) || f==null|| StringUtils.isBlank(f.getFileurl())){
            return;
@@ -1116,6 +1117,25 @@
        if(file!=null && file.isFile()){
            Map<String,Object> files = new HashMap<>();
            files.put("name",f.getName());
            files.put("file",file);
            email.setFileList(new ArrayList<>());
            email.getFileList().add(files);
            smsEmailService.sendEmail(email);
            file.delete();//发送后删除临时文件
        }
    }
    @Override
    public void testSendEmail(){
        SmsEmail email = new SmsEmail();
        email.setTitle("测试邮件");
        email.setEmail("94314517@qq.com");
        email.setContent("来自企业【测试企业】关于保险方案【测试方案】的测试邮件");
        File file = Constants.getFileByNetFile("https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20250116/600faf2f-5ba2-44e2-9a96-c99052dc013d.pdf","1111.pdf");
        if(file!=null && file.isFile()){
            Map<String,Object> files = new HashMap<>();
            files.put("name","测试文件");
            files.put("file",file);
            email.setFileList(new ArrayList<>());
            email.getFileList().add(files);
@@ -2270,8 +2290,6 @@
    }
    @Override
    @Transactional(rollbackFor = {Exception.class,BusinessException.class})
    public Integer updateData(InsuranceApply insuranceApply) {
@@ -3024,8 +3042,8 @@
                .selectAs(Solutions::getType,InsuranceApply::getSolutionType)
                .selectAs(Solutions::getName,InsuranceApply::getSolutionsName)
                .selectAs(Solutions::getHasDispatchUnit,InsuranceApply::getHasDispatchUnit)
                .selectAs(Solutions::getSignType,InsuranceApply::getSignType)
                .selectAs(Company::getName,InsuranceApply::getCompanyName)
                .selectAs(Solutions::getCorrectWarnTime,InsuranceApply::getCorrectWarnTime)
                .select("( select ifnull(sum(ad.FEE),0) from apply_chagne_detail ad left join  apply_change a on a.id = ad.APPLY_CHANGE_ID  where t.id = a.APPLY_ID  and a.status = 2  )",InsuranceApply::getChangeMoney)
                .select(" ( select max(ac.APPLY_START_TIME) from apply_change ac  where ac.apply_id = t.id and ac.status = 2 ) as lastChangeDate")
                .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.apply_id = t.id ) as insureNum")
@@ -3036,16 +3054,20 @@
                .leftJoin(Company.class,Company::getId,Solutions::getShopId)
                .eq(InsuranceApply::getId,id)
                .last("limit 1");
        InsuranceApply insuranceApply = insuranceApplyJoinMapper.selectJoinOne(InsuranceApply.class,wrapper);
        if(Objects.isNull(insuranceApply)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY);
        }
        this.dealDataDetail(insuranceApply);
        return insuranceApply;
    }
    public void dealDataDetail(InsuranceApply insuranceApply){
        Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId());
        if(Objects.isNull(solutions)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"未查询到方案信息");
        }
        insuranceApply.setCorrectWarnTime(solutions.getCorrectWarnTime());
        if(solutions.getDataType().equals(Constants.ONE)){
            Solutions newVersionSolution = solutionsMapper.selectOne(new QueryWrapper<Solutions>().lambda().eq(Solutions::getBaseId,solutions.getBaseId()).eq(Solutions::getDataType,Constants.TWO).last("limit 1"));
            if(Objects.isNull(newVersionSolution)){
@@ -3061,10 +3083,8 @@
        initApplyStatus(insuranceApply);
        //查询附件数据
        initImgData(insuranceApply);
        insuranceApply.setChangeMoney(Constants.getTwoPoint(insuranceApply.getChangeMoney()));
        insuranceApply.setFee(Constants.getTwoPoint(insuranceApply.getFee()));
        //查询操作记录
        List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class,
                new MPJLambdaWrapper<ApplyLog>()
@@ -3079,7 +3099,6 @@
                        .orderByAsc(ApplyLog::getCreateDate)
        );
        insuranceApply.setApplyLogList(applyLogList);
        return insuranceApply;
    }
    private void setServiceDays(InsuranceApply insuranceApply) {
@@ -3573,11 +3592,11 @@
        if(solutions.getType().equals(Constants.ZERO)){
            throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,非委托保方案保单,无法进行该操作!");
        }
        String fileUrl = "https://yybred.oss-cn-hangzhou.aliyuncs.com/apply/20241230/a0d128f2-ba6c-4ad4-b86b-b2610a513d41.pdf";//ExcelExporter.build(InsuranceApply.class).exportApplyExcelToPdf(model,"人员名单");
        String fileUrl = ExcelExporter.build(InsuranceApply.class).exportApplyExcelToPdf(model,"人员名单");
        String notifyUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.SIGN_DONE_NOTIFY_URL).getCode();
        notifyUrl = notifyUrl.replace("${type}","0").replace("${id}",model.getId().toString());
        //String applyNo = signService.applySignLocalFile(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"投保名单签章",company.getSignId(),notifyUrl);
        String applyNo = signService.applySign(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),model.getSignKeyword(),company.getSignId(),notifyUrl);
        String applyNo = signService.applySignLocalFileByParam(company.getName(),company.getName(),fileUrl,company.getCode(),company.getEmail(),"投保名单签章",company.getSignId(),notifyUrl,new Float(0.7));
//        String applyNo = signService.applySign(company.getName(),fileUrl,company.getName(),company.getCode(),company.getEmail(),model.getSignKeyword(),company.getSignId(),notifyUrl);
        if(StringUtils.isBlank(applyNo) ){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,获取在线签章地址失败,请稍后重试!");
        }