From 3d6a8e384d31432a23f5a8c1a3135a58cbe617b5 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期二, 27 五月 2025 17:25:38 +0800 Subject: [PATCH] 提交一把 --- server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java | 144 ++++++++++++++++++++++++++++++++++++----------- 1 files changed, 109 insertions(+), 35 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java index 1242d29..3e5853d 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java @@ -2,7 +2,6 @@ import cn.hutool.core.util.IdcardUtil; import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.extension.api.R; import com.doumee.biz.system.SystemDictDataBiz; import com.doumee.core.annotation.excel.ExcelExporter; import com.doumee.core.constants.ResponseStatus; @@ -20,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; @@ -36,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; @@ -63,7 +65,6 @@ private SmsEmailService smsEmailService; @Autowired private ApplyChangeJoinMapper applyChangeMapper; - @Autowired private SystemDictDataBiz systemDictDataBiz; @Autowired @@ -72,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 @@ -105,7 +101,6 @@ private DuWorkTypeJoinMapper duWorkTypeJoinMapper; @Autowired private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper; - @Autowired private NoticesMapper noticesMapper; @Autowired @@ -120,7 +115,8 @@ private SystemUserMapper systemUserMapper; @Autowired private CompanyDepartmentMapper companyDepartmentMapper; - + @Autowired + private InsuranceMapper insuranceMapper; @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) @@ -151,7 +147,6 @@ } update.setStatus(Constants.InsuranceApplyStatus.WTB_RETURN.getKey()); } - update.setEditDate(new Date()); update.setEditor(user.getId()); update.setCheckDate(update.getEditDate()); @@ -159,7 +154,6 @@ update.setCheckUserId(user.getId()); update.setId(model.getId()); insuranceApplyMapper.updateById(update); - //瀛樺偍寰呭姙淇℃伅 Constants.NoticeObjectType noticeObjectType = Constants.NoticeObjectType.INSURANCE_APPLY; //鍒犻櫎鍏朵粬寰呭姙 @@ -169,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()); @@ -224,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); @@ -514,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()); } @@ -1105,6 +1096,7 @@ + private void startSendEmail(Multifile f, String companyName, String solutionsName, String solutionEmail) { if(StringUtils.isBlank(solutionEmail) || f==null|| StringUtils.isBlank(f.getFileurl())){ return; @@ -1117,6 +1109,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); @@ -2271,8 +2282,6 @@ } - - @Override @Transactional(rollbackFor = {Exception.class,BusinessException.class}) public Integer updateData(InsuranceApply insuranceApply) { @@ -2358,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 鍔犲叆 鏂规閰嶇疆浜嗘湁娲鹃仯鍗曚綅 鎵嶄細鍘婚獙璇佹淳閬e崟浣嶆暟鎹� List<DuSolution> duSolutionList = new ArrayList<>(); List<DuWorktype> duWorktypeList = new ArrayList<>(); @@ -2442,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()) @@ -2482,6 +2498,7 @@ member.setDuId(applyDetail.getDuId()); member.setWorktypeId(applyDetail.getWorktypeId()); memberMapper.updateById(member); + applyDetail.setMemberName(member.getName()); } }else{ member = memberMapper.selectById(applyDetail.getMemberId()); @@ -2492,6 +2509,7 @@ member.setDuId(applyDetail.getDuId()); member.setWorktypeId(applyDetail.getWorktypeId()); memberMapper.updateById(member); + applyDetail.setMemberName(member.getName()); } applyDetail.setMemberId(member.getId()); applyDetail.setIdcardNo(member.getIdcardNo()); @@ -2516,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); } } @@ -2528,7 +2546,6 @@ /** * 鏌ヨ 浼氬憳淇℃伅鍦ㄦ柟妗堜笅鏄惁瀛樺湪鍐茬獊鏁版嵁 - * @param solutionId * @param startTime * @param endTime */ @@ -2574,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 { @@ -2586,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 @@ -2604,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{ @@ -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) { @@ -3474,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()); } @@ -3559,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()); } @@ -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/20241120/1c80f0d7-ab35-4355-b9fe-944464643115.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(),"瀵逛笉璧凤紝鑾峰彇鍦ㄧ嚎绛剧珷鍦板潃澶辫触锛岃绋嶅悗閲嶈瘯锛�"); } @@ -3640,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()); } @@ -3747,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; +// } + + + } -- Gitblit v1.9.3