server/company/src/main/java/com/doumee/api/business/AreasController.java
@@ -7,6 +7,7 @@ import com.doumee.core.model.PageWrap; import com.doumee.core.model.PageData; import com.doumee.dao.business.model.Areas; import com.doumee.dao.business.vo.AreasTree; import com.doumee.service.business.AreasService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -74,6 +75,21 @@ return ApiResponse.success(areasService.findPage(pageWrap)); } @ApiOperation("å表æ¥è¯¢") @PostMapping("/findList") public ApiResponse<List<Areas>> findList (@RequestBody Areas areas) { return ApiResponse.success(areasService.findList(areas)); } @ApiOperation("åºåæ å表") @PostMapping("/findTreeList") public ApiResponse<List<Areas>> findTreeList () { List<Areas> areasList = areasService.findList(new Areas()); AreasTree treeBuild = new AreasTree(areasList); areasList = treeBuild.buildTree(); return ApiResponse.success(areasList); } @ApiOperation("导åºExcel") @PostMapping("/exportExcel") @RequiresPermissions("business:areas:exportExcel") server/company/src/main/java/com/doumee/api/business/MemberInsuranceController.java
@@ -74,6 +74,13 @@ return ApiResponse.success(memberInsuranceService.findPage(pageWrap)); } @ApiOperation("å表æ¥è¯¢") @PostMapping("/findList") @RequiresPermissions("business:memberinsurance:query") public ApiResponse<List<MemberInsurance>> findList (@RequestBody MemberInsurance memberInsurance) { return ApiResponse.success(memberInsuranceService.findList(memberInsurance)); } @ApiOperation("导åºExcel") @PostMapping("/exportExcel") @RequiresPermissions("business:memberinsurance:exportExcel") server/company/src/main/java/com/doumee/api/business/SettleClaimsController.java
@@ -102,7 +102,7 @@ @ApiOperation("æ ¹æ®IDæ¥è¯¢") @GetMapping("/{id}") @RequiresPermissions("business:settleclaims:query") public ApiResponse findById(@PathVariable Integer id) { public ApiResponse<SettleClaims> findById(@PathVariable Integer id) { return ApiResponse.success(settleClaimsService.getSettleClaimsDetail(id)); } @ApiOperation("å é¤éä»¶") server/company/src/main/java/com/doumee/api/common/PublicController.java
@@ -129,6 +129,17 @@ String tempFileName = nowDate + "/" + fileName; String key = folder + tempFileName;// æä»¶å ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); int type = 2; if(StringUtils.endsWith(key,".mp4")){ type =1; }else if(StringUtils.endsWith(key,".jpg") || StringUtils.endsWith(key,".JPG") || StringUtils.endsWith(key,".png") || StringUtils.endsWith(key,".PNG") || StringUtils.endsWith(key,".jpeg") || StringUtils.endsWith(key,".JPEG")){ type =0; } if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { // ç§»å¨æå,è¿åæä»¶å // sendSuccessMessage(response, resourcePath+key); @@ -139,6 +150,7 @@ fileJSON.put("url", resourcePath + key); fileJSON.put("imgaddr", tempFileName); fileJSON.put("imgname", fileName); fileJSON.put("type", type); fileJSON.put("originname", originname); context.put("data",fileJSON); context.put("message","è¯·æ±æå"); server/platform/src/main/java/com/doumee/api/common/PublicController.java
@@ -176,6 +176,7 @@ type =1; }else if(StringUtils.endsWith(key,".jpg") || StringUtils.endsWith(key,".JPG") || StringUtils.endsWith(key,".png") || StringUtils.endsWith(key,".PNG") || StringUtils.endsWith(key,".jpeg") || StringUtils.endsWith(key,".JPEG")){ server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -3,6 +3,7 @@ import com.doumee.core.constants.ResponseStatus; import com.doumee.core.exception.BusinessException; import com.doumee.dao.business.model.Solutions; import com.doumee.dao.business.vo.CountCyclePriceVO; import io.swagger.models.auth.In; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; @@ -161,6 +162,23 @@ return age; } public static CountCyclePriceVO countPriceVO(Date startDate, Solutions solutions){ CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO(); if(solutions.getInsureCycleUnit().equals(Constants.ZERO)){ countCyclePriceVO.setEndDate(DateUtil.afterDateByType(startDate,0,solutions.getInsureCycle())); }else if(solutions.getInsureCycleUnit().equals(Constants.TWO)){ Integer monthDays = DateUtil.monthDays(startDate); Date afterDate = DateUtil.afterDateByType(startDate,0,monthDays); countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); }else if(solutions.getInsureCycleUnit().equals(Constants.THREE)){ Date afterDate = DateUtil.afterDateByType(startDate,2,solutions.getInsureCycle()); countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); } countCyclePriceVO.setCyclePrice(Constants.countDetailFee(solutions,countCyclePriceVO.getEndDate(),startDate)); return countCyclePriceVO; } public static Integer getSexByIdCard(String idCard){ Pattern pattern = Pattern.compile("\\d{17}[\\d|x]"); // å®ä¹èº«ä»½è¯å·ç æ ¼å¼çæ£åè¡¨è¾¾å¼ Matcher matcher = pattern.matcher(idCard); server/service/src/main/java/com/doumee/core/utils/DateUtil.java
@@ -3109,19 +3109,66 @@ } /** * æ¼æ¥æ¥ææ°æ® * @param date * @param optType 1:æ¯æ¥å¼å§ 2ï¼æ¯æ¥ç»æ 3:æ¨æ¥ç»æ * @return */ public static Date getMontageDate(Date date ,Integer optType) { String strShortDate = DateUtil.dateToString(date,"yyyy-MM-dd"); if(optType.equals(1)){ return DateUtil.StringToDate(strShortDate +" 00:00:00"); }else if(optType.equals(2)){ return DateUtil.StringToDate(strShortDate +" 23:59:59"); }else if(optType.equals(3)){ strShortDate = DateUtil.dateToString(DateUtil.getDateBetween(date,-1),"yyyy-MM-dd"); return DateUtil.StringToDate(strShortDate +" 23:59:59"); }else{ return null; } } public static void main(String[] args) { // System.out.println(DateUtil.DateToStr(DateUtil.afterDateByType( // DateUtil.stringToDate("2024-02-01","yyyy-MM-dd") // ,1,1),"yyyy-MM-dd HH:mm:ss")); System.out.println( DateUtil.daysBetweenDates(DateUtil.stringToDate("2024-02-29","yyyy-MM-dd"), DateUtil.stringToDate("2024-02-01","yyyy-MM-dd")) // System.out.println( DateUtil.daysBetweenDates(DateUtil.stringToDate("2024-02-29","yyyy-MM-dd"), // DateUtil.stringToDate("2024-02-01","yyyy-MM-dd")) // ); // // System.out.println(DateUtil.calculateBetween(DateUtil.StringToDate("2024-02-29 23:59:59"),DateUtil.StringToDate("2024-02-01 00:00:00"),0)); System.out.println( DateUtil.DateToStr( DateUtil.getMontageDate(DateUtil.StringToDate("2024-02-29 21:59:59"),1) ,"yyyy-MM-dd HH:mm:ss" ) ); System.out.println(DateUtil.calculateBetween(DateUtil.StringToDate("2024-02-29 23:59:59"),DateUtil.StringToDate("2024-02-01 00:00:00"),0)); System.out.println( DateUtil.DateToStr( DateUtil.getMontageDate(DateUtil.StringToDate("2024-02-29 21:59:59"),2) ,"yyyy-MM-dd HH:mm:ss" ) ); System.out.println( DateUtil.DateToStr( DateUtil.getMontageDate(DateUtil.StringToDate("2024-02-29 21:59:59"),3) ,"yyyy-MM-dd HH:mm:ss" ) ); // Calendar calo = Calendar.getInstance(); // Calendar caln = Calendar.getInstance(); // ,"yyyy-MM-dd HH:mm:ss" // caln.setTime(DateUtil.StringToDate("2024-02-29 23:59:59")); server/service/src/main/java/com/doumee/dao/business/dto/SCSupplementDTO.java
@@ -20,6 +20,7 @@ @ApiModelProperty(value = "æä»¶è·¯å¾") private String fileUrl; @ApiModelProperty(value = "æä»¶åç§°") private String fileName; server/service/src/main/java/com/doumee/dao/business/join/MemberInsuranceJoinMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package com.doumee.dao.business.join; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.doumee.dao.business.model.ApplyDetail; import com.doumee.dao.business.model.MemberInsurance; import com.github.yulichang.base.mapper.MPJJoinMapper; import java.util.List; /** * @author æ±è¹è¹ * @date 2024/01/22 11:55 */ public interface MemberInsuranceJoinMapper extends MPJJoinMapper<MemberInsurance> { void insertBatchSomeColumn(List<MemberInsurance> addList); } server/service/src/main/java/com/doumee/dao/business/model/ApplyDetail.java
@@ -110,6 +110,10 @@ @ExcelColumn(name="ä¿é©æ¹æ¡",index =2) private String solutionName; @ApiModelProperty(value = "æ¹æ¡ä¸»é®") @TableField(exist = false) private Integer solutionId; @ApiModelProperty(value = "æ¹åå·") @TableField(exist = false) private String validCode; server/service/src/main/java/com/doumee/dao/business/model/Areas.java
@@ -1,5 +1,6 @@ package com.doumee.dao.business.model; import com.baomidou.mybatisplus.annotation.TableField; import com.doumee.core.annotation.excel.ExcelColumn; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,6 +10,7 @@ import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import java.util.Date; import java.util.List; /** * çå¸åºä¿¡æ¯è¡¨ @@ -71,4 +73,9 @@ @ExcelColumn(name="æåºç ") private Integer sortnum; @ApiModelProperty(value = "åéæ°æ®", example = "1") @TableField(exist = false) private List<Areas> childAreasList; } server/service/src/main/java/com/doumee/dao/business/model/MemberInsurance.java
@@ -1,6 +1,8 @@ package com.doumee.dao.business.model; import com.doumee.core.annotation.excel.ExcelColumn; import com.doumee.core.model.LoginUserInfo; import com.doumee.core.utils.Constants; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import com.baomidou.mybatisplus.annotation.IdType; @@ -20,6 +22,59 @@ @ApiModel("åå·¥æä¿æç»è®°å½") @TableName("`member_insurance`") public class MemberInsurance { public MemberInsurance(){ } //æä¿ç³è¯·æ°æ® public MemberInsurance(ApplyDetail applyDetail, Integer sysUserId){ this.createDate = new Date(); this.creator = sysUserId; this.isdeleted = Constants.ZERO; this.applyId = applyDetail.getApplyId(); this.memberId = applyDetail.getMemberId(); this.endTime = applyDetail.getEndTime(); this.startTime = applyDetail.getStartTime(); this.idcardNo = applyDetail.getIdcardNo(); this.solutionId = applyDetail.getSolutionId(); this.duId = applyDetail.getDuId(); this.worktypeId = applyDetail.getWorktypeId(); this.fee = applyDetail.getFee(); this.sex = applyDetail.getSex(); this.bdCode = applyDetail.getApplyCode(); this.solutionName = applyDetail.getSolutionName(); this.worktypeName = applyDetail.getWorkTypeName(); this.duName = applyDetail.getDuName(); // this.relationType = Constants.ZERO; this.relationId = applyDetail.getId(); } //å åä¿ç³è¯·æ°æ® public MemberInsurance(ApplyChagneDetail applyChangeDetail, ApplyChange applyChange, Integer sysUserId,Integer applyDetailId){ this.createDate = new Date(); this.creator = sysUserId; this.isdeleted = Constants.ZERO; this.applyId = applyChange.getApplyId(); this.memberId = applyChangeDetail.getMemberId(); this.endTime = applyChangeDetail.getEndTime(); this.startTime = applyChangeDetail.getStartTime(); this.idcardNo = applyChangeDetail.getIdcardNo(); this.duId = applyChangeDetail.getDuId(); this.worktypeId = applyChangeDetail.getWorktypeId(); this.fee = applyChangeDetail.getFee(); this.sex = applyChangeDetail.getSex(); this.bdCode = applyChange.getApplyCode(); this.pdCode = applyChange.getCode(); this.solutionName = applyChange.getSolutionsName(); this.worktypeName = applyChangeDetail.getWorkTypeName(); this.duName = applyChangeDetail.getDuName(); // this.relationType = Constants.ONE; this.relationId = applyDetailId; } @TableId(type = IdType.AUTO) @ApiModelProperty(value = "主é®", example = "1") @@ -66,16 +121,21 @@ @ApiModelProperty(value = "å®é ä¿é©çææ¢æ") @ExcelColumn(name="å®é ä¿é©çææ¢æ") private String endTime; private Date endTime; @ApiModelProperty(value = "å®é ä¿é©çæèµ·æ") @ExcelColumn(name="å®é ä¿é©çæèµ·æ") private String startTime; private Date startTime; @ApiModelProperty(value = "æè¿æä½æ¶é´") @ExcelColumn(name="æè¿æä½æ¶é´") @JsonFormat(pattern = "yyyy-MM-dd") private Date idcardNo; @ApiModelProperty(value = "身份è¯å·ç ") @ExcelColumn(name="身份è¯å·ç ") private String idcardNo; @ApiModelProperty(value = "æ¹æ¡ä¸»é®", example = "1") @ExcelColumn(name="æ¹æ¡ä¸»é®") private Integer solutionId; @ApiModelProperty(value = "æ´¾é£åä½ç¼ç ï¼å ³èdispatch_unit)", example = "1") @ExcelColumn(name="æ´¾é£åä½ç¼ç ï¼å ³èdispatch_unit)") @@ -121,4 +181,12 @@ @ExcelColumn(name="æ´¾é£åä½åç§°") private String duName; @ApiModelProperty(value = "å ³èæç»ä¸»é®", example = "1") @ExcelColumn(name="å ³èæç»ä¸»é®") private Integer relationId; // @ApiModelProperty(value = "å ³èæç»ç±»åï¼0=æä¿ç³è¯·ï¼1=å åä¿/æ¢å", example = "1") // @ExcelColumn(name="å ³èæç»ç±»åï¼0=æä¿ç³è¯·ï¼1=å åä¿/æ¢å") // private Integer relationType; } server/service/src/main/java/com/doumee/dao/business/model/SettleClaims.java
@@ -152,7 +152,7 @@ @ApiModelProperty(value = "åºé©å°åº(å ³èareas)", example = "1") @ExcelColumn(name="åºé©å°åº(å ³èareas)") private Integer areaId; private String areaId; @ApiModelProperty(value = "åºé©å°åºåç§°ï¼çå¸ï¼") @ExcelColumn(name="åºé©å°åºåç§°ï¼çå¸ï¼") @@ -222,7 +222,7 @@ @ApiModelProperty(value = "ä¿é©çæèµ·æ") @TableField(exist = false) private Date baoxianStartTime; @ApiModelProperty(value = "ä¿é©çæèµ·æ") @ApiModelProperty(value = "ä¿é©çææ¢æ") @TableField(exist = false) private Date baoxianEndTime; server/service/src/main/java/com/doumee/dao/business/vo/AreasTree.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,90 @@ package com.doumee.dao.business.vo; import com.dingtalk.api.response.OapiNewretailQueryorginfoResponse; import com.doumee.core.utils.Constants; import com.doumee.dao.business.model.Areas; import java.util.ArrayList; import java.util.List; import java.util.Objects; /** * Created by IntelliJ IDEA. * * @Author : Rk * @create 2023/7/13 10:40 */ public class AreasTree { // ä¿ååä¸æå»ºæ å½¢çæææ°æ®ï¼éå¸¸æ°æ®åºæ¥è¯¢ç»æï¼ public List<Areas> nodeList = new ArrayList<>(); /** * æé æ¹æ³ * @param nodeList å°æ°æ®éåèµå¼ç»nodeListï¼å³æææ°æ®ä½ä¸ºææèç¹ã */ public AreasTree(List<Areas> nodeList){ this.nodeList = nodeList; } /** * è·åéæå»ºçæææ ¹èç¹ï¼é¡¶çº§èç¹ï¼ "0" * @return æææ ¹èç¹Listéå */ public List<Areas> getRootNode(){ // ä¿åæææ ¹èç¹ï¼æææ ¹èç¹çæ°æ®ï¼ List<Areas> rootNodeList = new ArrayList<>(); // treeNodeï¼æ¥è¯¢åºçæ¯ä¸æ¡æ°æ®ï¼èç¹ï¼ for (Areas treeNode : nodeList){ // 夿å½åèç¹æ¯å¦ä¸ºæ ¹èç¹ï¼æ¤å¤æ³¨æï¼è¥parentIdç±»åæ¯Stringï¼åè¦éç¨equals()æ¹æ³å¤æã if (treeNode.getType().equals(Constants.ZERO)) { rootNodeList.add(treeNode); } } return rootNodeList; } /** * æ ¹æ®æ¯ä¸ä¸ªé¡¶çº§èç¹ï¼æ ¹èç¹ï¼è¿è¡æå»ºæ å½¢ç»æ * @return æå»ºæ´æ£µæ */ public List<Areas> buildTree(){ // treeNodesï¼ä¿åä¸ä¸ªé¡¶çº§èç¹ææå»ºåºæ¥ç宿´æ å½¢ List<Areas> treeNodes = new ArrayList<Areas>(); // getRootNode()ï¼è·åææçæ ¹èç¹ for (Areas treeRootNode : getRootNode()) { // å°é¡¶çº§èç¹è¿è¡æå»ºåæ treeRootNode = buildChildTree(treeRootNode); // 宿ä¸ä¸ªé¡¶çº§èç¹ææå»ºçæ å½¢ï¼å¢å è¿æ¥ treeNodes.add(treeRootNode); } return treeNodes; } /** * éå½-----æå»ºåæ å½¢ç»æ * @param pNode æ ¹èç¹ï¼é¡¶çº§èç¹ï¼ * @return æ´æ£µæ */ public Areas buildChildTree(Areas pNode){ List<Areas> childTree = new ArrayList<Areas>(); // nodeListï¼ææèç¹éåï¼æææ°æ®ï¼ for (Areas treeNode : nodeList) { // 夿å½åèç¹çç¶èç¹IDæ¯å¦çäºæ ¹èç¹çIDï¼å³å½åèç¹ä¸ºå ¶ä¸çåèç¹ if (!Objects.isNull(treeNode.getParentId())&&treeNode.getParentId().equals(pNode.getId())) { // åéå½è¿è¡å¤æå½åèç¹çæ åµï¼è°ç¨èªèº«æ¹æ³ childTree.add(buildChildTree(treeNode)); } } // for循ç¯ç»æï¼å³èç¹ä¸æ²¡æä»»ä½èç¹ï¼æ å½¢æå»ºç»æï¼è®¾ç½®æ ç»æ pNode.setChildAreasList(childTree); return pNode; } } server/service/src/main/java/com/doumee/service/business/impl/ApplyChangeServiceImpl.java
@@ -37,6 +37,11 @@ import java.math.BigDecimal; import java.util.*; import java.math.RoundingMode; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; /** @@ -72,6 +77,9 @@ @Autowired private ApplyDetailJoinMapper applyDetailJoinMapper; @Autowired private MemberInsuranceJoinMapper memberInsuranceJoinMapper; @Autowired private MemberMapper memberMapper; @@ -195,6 +203,7 @@ ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); applyLogMapper.insert(log); return 1; } @@ -263,9 +272,14 @@ .selectAll(ApplyChagneDetail.class) .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit) .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice) .selectAs(Worktype::getName,ApplyChagneDetail::getWorkTypeName) .selectAs(DispatchUnit::getName,ApplyChagneDetail::getDuName) .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyChange::getApplyId) .leftJoin(Solutions.class, Solutions::getId, InsuranceApply::getSolutionId) .leftJoin(Solutions.class, Solutions::getId, ApplyChange::getSolutionsId) .leftJoin(Worktype.class,Worktype::getId,ApplyChagneDetail::getWorktypeId) .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyChagneDetail::getDuId) .eq(ApplyChagneDetail::getApplyChangeId,update.getId()) .eq(ApplyChagneDetail::getIsdeleted,Constants.ZERO) ); if(detailList ==null || detailList.size()==0){ @@ -281,41 +295,104 @@ if(oldModel == null ){ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对ä¸èµ·ï¼ç¨æ·ã"+detail.getMemberName()+"ãåä¿åä¿¡æ¯æè¯¯ï¼å½åç³è¯·ä¸æ¯æåä¿å¤çï¼"); } Date endDate = oldModel.getEndTime(); //å½åæ¥æå¤§äºæ¹åæ¥æ éè¦åæ»æ°æ®å®é æ°æ® Boolean flag = DateUtil.getMontageDate(new Date(),2).compareTo(DateUtil.getMontageDate(update.getStartTime(),2))>0; //æ¢åååå²è®°å½çè´¹ç¨ fee Integer days = DateUtil.daysBetweenDates(DateUtil.getMontageDate(update.getStartTime(),2),DateUtil.getMontageDate(oldModel.getStartTime(),1)) + 1; BigDecimal oldFee = this.getApplyPrice(update.getApplyId(),days); BigDecimal fee = oldModel.getFee(); BigDecimal oldCurrentFee = oldModel.getCurrentFee(); applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda() .set(ApplyDetail::getEditor,update.getEditor()) .set(ApplyDetail::getWorktypeId,detail.getWorktypeId()) .set(ApplyDetail::getDuId,detail.getDuId()) .set(ApplyDetail::getEditDate,update.getEditDate()) .set(ApplyDetail::getEndTime,DateUtil.getMontageDate(update.getStartTime(),2)) .set(ApplyDetail::getFee,oldFee) .set(flag,ApplyDetail::getCurrentFee,oldFee) .eq(ApplyDetail::getId,oldModel.getApplyId()) ); //ä¿®æ¹ åå·¥æä¿æç»è®°å½ å岿°æ® memberInsuranceJoinMapper.update(null,new UpdateWrapper<MemberInsurance>().lambda() .set(MemberInsurance::getEndTime,update.getApplyStartTime()) .set(MemberInsurance::getFee,oldFee) .eq(MemberInsurance::getRelationId,oldModel.getId()) ); ApplyDetail applyDetail = new ApplyDetail(); applyDetail.setApplyId(oldModel.getApplyId()); applyDetail.setCreateDate(new Date()); applyDetail.setCreator(update.getEditor()); applyDetail.setMemberId(oldModel.getMemberId()); applyDetail.setStartTime(DateUtil.getMontageDate(update.getApplyStartTime(),1)); applyDetail.setEndTime(endDate); applyDetail.setDuId(detail.getDuId()); applyDetail.setWorktypeId(detail.getWorktypeId()); applyDetail.setIdcardNo(oldModel.getIdcardNo()); applyDetail.setFee(fee.subtract(oldFee)); if(flag){ applyDetail.setCurrentFee(oldCurrentFee.multiply(oldFee)); }else{ applyDetail.setCurrentFee(BigDecimal.ZERO); } applyDetail.setSex(oldModel.getSex()); applyDetail.setMemberName(oldModel.getMemberName()); applyDetail.setFromId(detail.getId()); applyDetailJoinMapper.insert(applyDetail); MemberInsurance memberInsurance = new MemberInsurance(applyDetail,update.getId()); memberInsuranceJoinMapper.insert(memberInsurance); } } /** * å¤çå åä¿æç»æ°æ® * @param update */ private void dealDetailsValidTime(ApplyChange update ) { private void dealDetailsValidTime(ApplyChange update) { List<ApplyChagneDetail> detailList = applyChagneDetailJoinMapper.selectJoinList(ApplyChagneDetail.class, new MPJLambdaWrapper<ApplyChagneDetail>() .selectAll(ApplyChagneDetail.class) .selectAs(Solutions::getTimeUnit,ApplyChagneDetail::getSolutionTimeUnit) .selectAs(Solutions::getPrice,ApplyChagneDetail::getSolutionPrice) .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyChange::getApplyId) .leftJoin(Solutions.class, Solutions::getId, InsuranceApply::getSolutionId) .eq(ApplyChagneDetail::getApplyChangeId,update.getId()) .eq(ApplyChagneDetail::getIsdeleted,Constants.ZERO) ); if(detailList ==null || detailList.size()==0){ .selectAs(Solutions::getTimeUnit, ApplyChagneDetail::getSolutionTimeUnit) .selectAs(Solutions::getPrice, ApplyChagneDetail::getSolutionPrice) .selectAs(Worktype::getName, ApplyChagneDetail::getWorkTypeName) .selectAs(DispatchUnit::getName, ApplyChagneDetail::getDuName) .leftJoin(ApplyChange.class, ApplyChange::getId, ApplyChagneDetail::getApplyChangeId) .leftJoin(InsuranceApply.class, InsuranceApply::getId, ApplyChange::getApplyId) .leftJoin(Solutions.class, Solutions::getId, InsuranceApply::getSolutionId) .leftJoin(Solutions.class, Solutions::getId, ApplyChange::getSolutionsId) .leftJoin(Worktype.class, Worktype::getId, ApplyChagneDetail::getWorktypeId) .leftJoin(DispatchUnit.class, DispatchUnit::getId, ApplyChagneDetail::getDuId) .eq(ApplyChagneDetail::getApplyChangeId, update.getId()) .eq(ApplyChagneDetail::getIsdeleted, Constants.ZERO)); if (detailList == null || detailList.size() == 0) { return; } List<ApplyDetail> addList = new ArrayList<>(); List<Integer> reduceMembers = new ArrayList<>(); BigDecimal totalFee = new BigDecimal(0); BigDecimal currentFee = new BigDecimal(0); //æä¿è®°å½ å ä¿æ°æ®å å ¥æ°æ°æ® åä¿æ°æ® ä¿®æ¹èæ°æ® List<MemberInsurance> memberInsuranceList = new ArrayList<>(); for(ApplyChagneDetail detail : detailList){ if(Constants.equalsInteger(detail.getType(),Constants.ZERO)){ //å ä¿ä¸å¡ 使ç¨çå ä¿éé¢ ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO_add = new ApplyChangeCyclePriceDTO(); applyChangeCyclePriceDTO_add.setApplyId(update.getApplyId()); applyChangeCyclePriceDTO_add.setValidTime(DateUtil.getMontageDate(update.getStartTime(), 1)); //å ä¿ æ·»å çéé¢ CountCyclePriceVO countCyclePriceVO_add = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_add); //åä¿ä¸å¡ 使ç¨çåä¿éé¢ ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO_reduce = new ApplyChangeCyclePriceDTO(); applyChangeCyclePriceDTO_reduce.setApplyId(update.getApplyId()); applyChangeCyclePriceDTO_reduce.setValidTime(DateUtil.getMontageDate(update.getStartTime(), 3)); //åä¿ éè¦åå°çéé¢ CountCyclePriceVO countCyclePriceVO_reduce = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO_reduce); for (ApplyChagneDetail detail : detailList) { if (Constants.equalsInteger(detail.getType(), Constants.ZERO)) { //å ä¿ ApplyDetail add = new ApplyDetail(); add.setApplyId(update.getApplyId()); @@ -332,57 +409,88 @@ add.setEndTime(detail.getEndTime()); add.setFee(new BigDecimal(0)); // add.setFee(Constants.countDetailFee(detail.getSolutionTimeUnit(),detail.getSolutionPrice(), add.getStartTime(),add.getEndTime())); if(DateUtil.daysBetweenDates(add.getStartTime(),new Date() )>=0){ //å¦æå·²äº§çè´¹ç¨ï¼è®¡ç®å·²äº§çè´¹ç¨ add.setCurrentFee(Constants.countDetailFee(detail.getSolutionTimeUnit(),detail.getSolutionPrice(), add.getStartTime(),new Date())); if (DateUtil.daysBetweenDates(add.getStartTime(), new Date()) >= 0) { add.setStartTime(DateUtil.getMontageDate(update.getApplyStartTime(), 1)); add.setEndTime(DateUtil.getMontageDate(detail.getEndTime(), 2)); add.setFee(countCyclePriceVO_add.getCyclePrice()); if (DateUtil.daysBetweenDates(DateUtil.getMontageDate(add.getStartTime(), 2), new Date()) >= 0) { Integer days = DateUtil.daysBetweenDates(new Date(), DateUtil.getMontageDate(add.getStartTime(), 2)) + 1; //å¦æå·²äº§çè´¹ç¨ï¼è®¡ç®å·²äº§çè´¹ç¨ add.setCurrentFee(this.getApplyPrice(update.getApplyId(), days)); } // addList.add(add); applyDetailJoinMapper.insert(add); totalFee.add(add.getFee()); currentFee.add(add.getCurrentFee()); MemberInsurance memberInsurance = new MemberInsurance(detail, update, update.getEditor(), add.getId()); memberInsuranceList.add(memberInsurance); } else { //åä¿æä½ //æ¥è¯¢åå·¥æ¯å¨ä¸»åä¸ æ¯å¦åå¨çæä¸çæ°æ® ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda() .eq(ApplyDetail::getApplyId, update.getApplyId()) .eq(ApplyDetail::getMemberId, detail.getMemberId()) .orderByDesc(ApplyDetail::getCreateDate) .last("limit 1")); if (oldModel == null || oldModel.getStartTime() == null || oldModel.getStartTime().getTime() > update.getApplyStartTime().getTime()) { throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "对ä¸èµ·ï¼ç¨æ·ã" + detail.getMemberName() + "ãåä¿åä¿¡æ¯æè¯¯ï¼å½åç³è¯·ä¸æ¯æåä¿å¤çï¼"); } //éä¿éè¦éåçè´¹ç¨ BigDecimal updateFee = countCyclePriceVO_reduce.getCyclePrice().multiply(new BigDecimal(-1)); BigDecimal updateCurrentFee = oldModel.getFee().subtract(updateFee); // BigDecimal updateCurrentFee = new BigDecimal(0); // if(DateUtil.daysBetweenDates(update.getApplyStartTime(),new Date() )>0){ // //å¦æçææ¶é´ æ¯ä»å¤©ä¹åï¼éå已产çè´¹ç¨ï¼è®¡ç®å·²äº§çè´¹ç¨(æ»è´¹ç¨-已产çè´¹ç¨) // updateCurrentFee = updateFee.subtract(oldModel.getCurrentFee()); // } // BigDecimal updateFee = (Constants.countDetailFee(detail.getSolutionTimeUnit(), detail.getSolutionPrice(), oldModel.getStartTime(), update.getApplyStartTime())); // BigDecimal updateCurrentFee = new BigDecimal(0); if (DateUtil.daysBetweenDates(update.getApplyStartTime(), new Date()) > 0) { //å¦æçææ¶é´ æ¯ä»å¤©ä¹åï¼éå已产çè´¹ç¨ï¼è®¡ç®å·²äº§çè´¹ç¨(æ»è´¹ç¨-已产çè´¹ç¨) updateCurrentFee = updateFee.subtract(Constants.formatBigdecimal(oldModel.getCurrentFee())); } applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda() .setSql(" fee = ifnull(fee,0)+" + updateFee) .setSql(" current_fee = " + updateCurrentFee) .set(ApplyDetail::getEndTime, update.getApplyStartTime()) .set(ApplyDetail::getEditor, update.getEditor()) .set(ApplyDetail::getEditDate, update.getEditDate()) .eq(ApplyDetail::getId, oldModel.getApplyId()) ); totalFee.add(updateFee); currentFee.add(updateCurrentFee); //ä¿®æ¹ åå·¥æä¿æç»è®°å½ å岿°æ® memberInsuranceJoinMapper.update(null, new UpdateWrapper<MemberInsurance>().lambda() .setSql(" fee = ifnull(fee,0)+" + updateFee) .set(MemberInsurance::getEndTime, update.getApplyStartTime()) .eq(MemberInsurance::getRelationId, oldModel.getId()) ); } addList.add(add); totalFee.add(add.getFee()); currentFee.add(add.getCurrentFee()); }else{ //åä¿æä½ //æ¥è¯¢åå·¥æ¯å¨ä¸»åä¸ æ¯å¦åå¨çæä¸çæ°æ® ApplyDetail oldModel = applyDetailJoinMapper.selectOne(new QueryWrapper<ApplyDetail>().lambda() .eq(ApplyDetail::getApplyId, update.getApplyId()) .eq(ApplyDetail::getMemberId, detail.getMemberId()) .orderByDesc(ApplyDetail::getCreateDate) .last("limit 1")); if(oldModel == null || oldModel.getStartTime()==null || oldModel.getStartTime().getTime() > update.getApplyStartTime().getTime()){ throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对ä¸èµ·ï¼ç¨æ·ã"+detail.getMemberName()+"ãåä¿åä¿¡æ¯æè¯¯ï¼å½åç³è¯·ä¸æ¯æåä¿å¤çï¼"); } BigDecimal updateFee = (Constants.countDetailFee(detail.getSolutionTimeUnit(),detail.getSolutionPrice(), oldModel.getStartTime(),update.getApplyStartTime())); BigDecimal updateCurrentFee = new BigDecimal(0); if(DateUtil.daysBetweenDates(update.getApplyStartTime(),new Date() )>0){ //å¦æçææ¶é´ æ¯ä»å¤©ä¹åï¼éå已产çè´¹ç¨ï¼è®¡ç®å·²äº§çè´¹ç¨(æ»è´¹ç¨-已产çè´¹ç¨) updateCurrentFee = updateFee.subtract(Constants.formatBigdecimal(oldModel.getCurrentFee())); } applyDetailJoinMapper.update(null, new UpdateWrapper<ApplyDetail>().lambda() .setSql(" fee = ifnull(fee,0)+"+updateFee) .setSql(" current_fee = "+updateFee) .set(ApplyDetail::getEditor,update.getEditor()) .set(ApplyDetail::getEditDate,update.getEditDate()) .eq(ApplyDetail::getId,oldModel.getApplyId()) } if (memberInsuranceList != null && memberInsuranceList.size() > 0) { // applyDetailJoinMapper.insertBatchSomeColumn(addList); memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList); } if (totalFee.compareTo(new BigDecimal(0)) != 0) { //妿ä¿åéé¢åçç¼ç ï¼æ´æ°æ»ä¿åéé¢ insuranceApplyMapper.update(null, new UpdateWrapper<InsuranceApply>().lambda() .setSql(" fee = ifnull(fee,0)+" + totalFee) .setSql(" current_fee = ifnull(current_fee,0)+" + currentFee) .set(InsuranceApply::getEditor, update.getEditor()) .set(InsuranceApply::getEditDate, update.getEditDate()) .eq(InsuranceApply::getId, update.getApplyId()) ); totalFee.add(updateFee); currentFee.add(updateCurrentFee); } } if(addList!=null && addList.size()>0){ applyDetailJoinMapper.insertBatchSomeColumn(addList); } if(totalFee.compareTo(new BigDecimal(0)) != 0){ //妿ä¿åéé¢åçç¼ç ï¼æ´æ°æ»ä¿åéé¢ insuranceApplyMapper.update(null, new UpdateWrapper<InsuranceApply>().lambda() .setSql(" fee = ifnull(fee,0)+"+totalFee) .setSql(" current_fee = ifnull(current_fee,0)+"+currentFee) .set(InsuranceApply::getEditor,update.getEditor()) .set(InsuranceApply::getEditDate,update.getEditDate()) .eq(InsuranceApply::getId,update.getApplyId()) ); } } /** @@ -565,11 +673,13 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "ç³è¯·æ¥ææªå¤äºä¿åæ¥æå ï¼æ æ³è¿è¡è¯¥æä½"); } applyChange.setEditDate(new Date()); applyChange.setEditor(loginUserInfo.getId()); applyChange.setStatus(Constants.ZERO); BigDecimal fee = BigDecimal.ZERO; //å é¤å岿°æ® applyChagneDetailJoinMapper.delete(new QueryWrapper<ApplyChagneDetail>().lambda().eq(ApplyChagneDetail::getApplyChangeId,applyChange.getId())); this.dealApplyChangeData(applyChange,insuranceApply,companySolution,solutions,loginUserInfo,fee); applyChange.setFee(fee); applyChangeMapper.updateById(applyChange); @@ -605,13 +715,20 @@ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "æ°æ®å¼å¸¸ï¼ä¿é©æ¹æ¡ä¸æªæ¥è¯¢å°å·¥ç§ä¿¡æ¯"); } ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO = new ApplyChangeCyclePriceDTO(); applyChangeCyclePriceDTO.setApplyId(insuranceApply.getId()); //å ä¿æ°æ® List<ApplyChagneDetail> addDetailList = applyChange.getAddDetailList(); if (CollectionUtils.isNotEmpty(addDetailList)) { if(companySolution.getCanAdd().equals(Constants.ZERO)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该ä¼ä¸åé ä¿é©æ¹æ¡æ æ³è¿è¡å ä¿"); } this.addChangeDetail(applyChange,addDetailList,duWorktypeList,duSolutionList,insuranceApply,solutions,loginUserInfo); //å ä¿æç»æ°æ® 计ç®éé¢ æ ¹æ®æ¹åæ¶é´ è®¡ç® applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(insuranceApply.getStartTime(),1)); CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); BigDecimal detailFee = countCyclePriceVO.getCyclePrice(); this.addChangeDetail(applyChange,addDetailList,duWorktypeList,duSolutionList,insuranceApply,solutions,loginUserInfo,detailFee); fee = addDetailList.stream().map(ApplyChagneDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add); } @@ -622,7 +739,11 @@ if(companySolution.getCanReduce().equals(Constants.ZERO)){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该ä¼ä¸åé ä¿é©æ¹æ¡æ æ³è¿è¡åä¿"); } this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo); //åä¿æç»æ°æ® 计ç®éé¢ æ ¹æ®æ¹åæ¶é´ åä¸å¤© è®¡ç® applyChangeCyclePriceDTO.setValidTime(DateUtil.getMontageDate(insuranceApply.getStartTime(),3)); CountCyclePriceVO countCyclePriceVO = this.getChangeCountCyclePriceVO(applyChangeCyclePriceDTO); BigDecimal detailFee = countCyclePriceVO.getCyclePrice(); this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo,detailFee); fee = fee.add(delDetailList.stream().map(ApplyChagneDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); } @@ -663,7 +784,7 @@ * @param delDetailList * @param loginUserInfo */ public void delChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> delDetailList,InsuranceApply insuranceApply,Solutions solutions,LoginUserInfo loginUserInfo){ public void delChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> delDetailList,InsuranceApply insuranceApply,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal detailFee){ for (ApplyChagneDetail applyChagneDetail : delDetailList) { if (Objects.isNull(applyChagneDetail.getMemberId())) { throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "åä¿äººåã" + applyChagneDetail.getMemberName() + "ãå¿ å¡«é¡¹ç¼ºå¤±"); @@ -699,17 +820,10 @@ applyChagneDetail.setApplyChangeId(applyChange.getId()); applyChagneDetail.setType(Constants.ONE); System.out.println(DateUtil.dateToString(applyDetail.getEndTime(),"yyyy-MM-dd")); System.out.println(DateUtil.dateToString(applyDetail.getStartTime(),"yyyy-MM-dd")); System.out.println(DateUtil.dateToString(applyChange.getValidTime(),"yyyy-MM-dd")); applyChagneDetail.setStartTime(DateUtil.getMontageDate(applyDetail.getStartTime(),1)); applyChagneDetail.setEndTime(DateUtil.getMontageDate(applyChange.getStartTime(),3)); BigDecimal sumFee = Constants.countDetailFee(solutions, applyDetail.getEndTime(),applyDetail.getStartTime()); BigDecimal useFee = Constants.countDetailFee(solutions, applyChange.getValidTime(),applyDetail.getStartTime()); applyChagneDetail.setFee( Constants.countDetailFee(solutions, applyDetail.getEndTime(),applyDetail.getStartTime()) .subtract(Constants.countDetailFee(solutions,applyChange.getValidTime(), applyDetail.getStartTime())).multiply(new BigDecimal(-1)) ); applyChagneDetail.setFee( detailFee.multiply(new BigDecimal(-1))); applyChagneDetailJoinMapper.insert(applyChagneDetail); } } @@ -724,7 +838,7 @@ * @param duSolutionList * @param loginUserInfo */ public void addChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> addDetailList,List<DuWorktype> duWorktypeList,List<DuSolution> duSolutionList,InsuranceApply insuranceApply,Solutions solutions,LoginUserInfo loginUserInfo){ public void addChangeDetail(ApplyChange applyChange ,List<ApplyChagneDetail> addDetailList,List<DuWorktype> duWorktypeList,List<DuSolution> duSolutionList,InsuranceApply insuranceApply,Solutions solutions,LoginUserInfo loginUserInfo,BigDecimal detailFee){ for (ApplyChagneDetail applyChagneDetail : addDetailList) { if ( Objects.isNull(applyChagneDetail.getDuId()) || Objects.isNull(applyChagneDetail.getWorktypeId()) @@ -732,7 +846,6 @@ ) { throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "å ä¿äººåã" + applyChagneDetail.getMemberName() + "ãå¿ å¡«é¡¹ç¼ºå¤±"); } Member member = new Member(); if(Objects.isNull(applyChagneDetail.getMemberId())){ @@ -805,10 +918,10 @@ applyChagneDetail.setCreator(loginUserInfo.getId()); applyChagneDetail.setIsdeleted(Constants.ZERO); applyChagneDetail.setApplyChangeId(applyChange.getId()); applyChagneDetail.setStartTime(DateUtil.getMontageDate(applyChange.getStartTime(),1)); applyChagneDetail.setEndTime(DateUtil.getMontageDate(insuranceApply.getEndTime(),2)); applyChagneDetail.setType(Constants.ZERO); applyChagneDetail.setFee( Constants.countDetailFee(solutions,insuranceApply.getEndTime(),applyChange.getValidTime()) ); applyChagneDetail.setFee(detailFee); applyChagneDetailJoinMapper.insert(applyChagneDetail); } } @@ -1328,6 +1441,11 @@ } /** * å åä¿ç³è¯·æ¶ æ¥è¯¢å åéé¢ * @param applyChangeCyclePriceDTO * @return */ @Override public CountCyclePriceVO getChangeCountCyclePriceVO(ApplyChangeCyclePriceDTO applyChangeCyclePriceDTO){ if(Objects.isNull(applyChangeCyclePriceDTO) @@ -1335,7 +1453,6 @@ || Objects.isNull(applyChangeCyclePriceDTO.getValidTime())){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } InsuranceApply insuranceApply = insuranceApplyMapper.selectById(applyChangeCyclePriceDTO.getApplyId()); if(Objects.isNull(insuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°ä¿å"); @@ -1344,13 +1461,47 @@ if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢æ¹æ¡ä¿¡æ¯"); } CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO(); countCyclePriceVO.setCyclePrice(Constants.countDetailFee(solutions,insuranceApply.getEndTime(),applyChangeCyclePriceDTO.getValidTime())); return countCyclePriceVO; //æ ¹æ®æ¹åæ¥æ å ç»ææ¥æ 计ç®éé¢ //éªè¯æ¹åæ¥ææ¯å¦å¨å½åæ¥æå ä¸ å¨ä¿åç»ææ¥æå ç³è¯·æ¶é´å¿ é¡»å¤äºä¿åçæ¶é´èå´å if (!(DateUtil.compareDate( insuranceApply.getStartTime(),applyChangeCyclePriceDTO.getValidTime()) >= Constants.ZERO && DateUtil.compareDate( applyChangeCyclePriceDTO.getValidTime(),insuranceApply.getEndTime()) >= Constants.ZERO)) { throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "ç³è¯·æ¥ææªå¤äºä¿åæ¥æå ï¼æ æ³è¿è¡è¯¥æä½"); } //æ»å¤©æ° Integer sumDays = DateUtil.daysBetweenDates(insuranceApply.getEndTime(),insuranceApply.getStartTime()) + 1; //å åä¿ å°ç»æçå¤©æ° Integer optDays = DateUtil.daysBetweenDates(insuranceApply.getEndTime(),applyChangeCyclePriceDTO.getValidTime()) + 1; CountCyclePriceVO countCyclePriceVO = Constants.countPriceVO(insuranceApply.getStartTime(),solutions); //æ»éé¢ BigDecimal sumPrice = countCyclePriceVO.getCyclePrice(); CountCyclePriceVO returnCountCyclePriceVO = new CountCyclePriceVO(); //å åä¿éé¢ returnCountCyclePriceVO.setCyclePrice(sumPrice.divide(new BigDecimal(sumDays),2, RoundingMode.HALF_UP).multiply(new BigDecimal(optDays))); return returnCountCyclePriceVO; } /** * 计ç®ä¿åä¸ X天 å¤å°è´¹ç¨ * @param applyId * @param optDays * @return */ public BigDecimal getApplyPrice(Integer applyId,Integer optDays){ InsuranceApply insuranceApply = insuranceApplyMapper.selectById(applyId); if(Objects.isNull(insuranceApply)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢å°ä¿å"); } Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢æ¹æ¡ä¿¡æ¯"); } //æ»å¤©æ° Integer sumDays = DateUtil.daysBetweenDates(insuranceApply.getEndTime(),insuranceApply.getStartTime()) + 1; CountCyclePriceVO countCyclePriceVO = Constants.countPriceVO(insuranceApply.getStartTime(),solutions); //æ»éé¢ BigDecimal sumPrice = countCyclePriceVO.getCyclePrice();; return sumPrice.divide(new BigDecimal(sumDays),2, RoundingMode.HALF_UP).multiply(new BigDecimal(optDays)); } } server/service/src/main/java/com/doumee/service/business/impl/ApplyDetailServiceImpl.java
@@ -250,6 +250,7 @@ queryWrapper.selectAll(ApplyDetail.class); queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName); queryWrapper.selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode); queryWrapper.selectAs(Solutions::getId,ApplyDetail::getSolutionId); queryWrapper.selectAs(Solutions::getName,ApplyDetail::getSolutionName); queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName); queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo); server/service/src/main/java/com/doumee/service/business/impl/AreasServiceImpl.java
@@ -81,6 +81,7 @@ @Override public List<Areas> findList(Areas areas) { QueryWrapper<Areas> wrapper = new QueryWrapper<>(areas); wrapper.select("id , name , code , type , parent_id"); return areasMapper.selectList(wrapper); } server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java
@@ -15,10 +15,7 @@ import com.doumee.dao.business.dto.CountCyclePriceDTO; import com.doumee.dao.business.dto.InsuranceApplyOptDTO; import com.doumee.dao.business.dto.InsuranceApplyQueryDTO; import com.doumee.dao.business.join.ApplyDetailJoinMapper; import com.doumee.dao.business.join.ApplyLogJoinMapper; import com.doumee.dao.business.join.DuSolutionJoinMapper; import com.doumee.dao.business.join.InsuranceApplyJoinMapper; import com.doumee.dao.business.join.*; import com.doumee.dao.business.model.*; import com.doumee.dao.business.vo.CountCyclePriceVO; import com.doumee.dao.system.model.SystemUser; @@ -64,6 +61,8 @@ private InsuranceApplyJoinMapper insuranceApplyJoinMapper; @Autowired private CompanyMapper companyMapper; @Autowired private MemberInsuranceJoinMapper memberInsuranceJoinMapper; @Autowired private ApplyDetailMapper applyDetailMapper; @@ -182,6 +181,36 @@ } ApplyLog log = new ApplyLog(update,applyLogType.getName(), info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); applyLogMapper.insert(log); //åå¨åå·¥ä¿¡æ¯æä¿è®°å½ //æ¥è¯¢åæ®æç»è®°å½ MPJLambdaWrapper<ApplyDetail> queryWrapper = new MPJLambdaWrapper<>(); queryWrapper.selectAll(ApplyDetail.class); queryWrapper.selectAs(DispatchUnit::getName,ApplyDetail::getDuName); queryWrapper.selectAs(InsuranceApply::getCode,ApplyDetail::getApplyCode); queryWrapper.selectAs(Solutions::getId,ApplyDetail::getSolutionId); queryWrapper.selectAs(Solutions::getName,ApplyDetail::getSolutionName); queryWrapper.selectAs(Worktype::getName,ApplyDetail::getWorkTypeName); queryWrapper.selectAs(Member::getIdcardNo,ApplyDetail::getIdcardNo); queryWrapper.selectAs(Member::getName,ApplyDetail::getMemberName); queryWrapper.leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId); queryWrapper.leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId); queryWrapper.leftJoin(Member.class,Member::getId,ApplyDetail::getMemberId); queryWrapper.leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId); queryWrapper.leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId); queryWrapper.eq(ApplyDetail::getApplyId,insuranceApply.getId()); List<ApplyDetail> applyDetailList = applyDetailJoinMapper.selectJoinList(ApplyDetail.class,queryWrapper); if(CollectionUtils.isNotEmpty(applyDetailList)){ List<MemberInsurance> memberInsuranceList = new ArrayList<>(); for (ApplyDetail applyDetail:applyDetailList) { MemberInsurance memberInsurance = new MemberInsurance(applyDetail,user.getId()); memberInsuranceList.add(memberInsurance); } memberInsuranceJoinMapper.insertBatchSomeColumn(memberInsuranceList); } return 1; } @@ -599,6 +628,7 @@ info = info.replace("${param}", update.getCheckInfo()); ApplyLog log = new ApplyLog(update,applyLogType.getName(),info,update.getId(),applyLogType.getKey(),JSONObject.toJSONString(model), JSONObject.toJSONString(update)); applyLogMapper.insert(log); return 1; } @@ -633,14 +663,22 @@ insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); insuranceApply.setStartTime(insuranceApply.getApplyStartTime()); insuranceApply.setEndTime(insuranceApply.getApplyEndTime()); insuranceApply.setCheckDate(new Date()); insuranceApply.setCurrentFee(BigDecimal.ZERO); insuranceApply.setCheckUserId(loginUserInfo.getId()); insuranceApply.setStatus(insuranceApplyStatus.getKey()); CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO(); countCyclePriceDTO.setSolutionsId(insuranceApply.getSolutionId()); countCyclePriceDTO.setStartDate(insuranceApply.getStartTime()); CountCyclePriceVO countCyclePriceVO = this.getCountCyclePriceVO(countCyclePriceDTO); insuranceApply.setApplyEndTime(countCyclePriceVO.getEndDate()); insuranceApply.setEndTime(countCyclePriceVO.getEndDate()); insuranceApplyMapper.insert(insuranceApply); //å¤çä¸çº§æ°æ® this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo); this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo,countCyclePriceVO); InsuranceApply updBean = new InsuranceApply(); updBean.setId(insuranceApply.getId()); updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); @@ -692,14 +730,21 @@ insuranceApply.setCompanyId(loginUserInfo.getCompanyId()); insuranceApply.setCheckInfo(insuranceApplyStatus.getName()); insuranceApply.setStartTime(insuranceApply.getApplyStartTime()); insuranceApply.setEndTime(insuranceApply.getApplyEndTime()); insuranceApply.setCheckDate(new Date()); insuranceApply.setCurrentFee(BigDecimal.ZERO); insuranceApply.setCheckUserId(loginUserInfo.getId()); insuranceApply.setStatus(insuranceApplyStatus.getKey()); CountCyclePriceDTO countCyclePriceDTO = new CountCyclePriceDTO(); countCyclePriceDTO.setSolutionsId(insuranceApply.getSolutionId()); countCyclePriceDTO.setStartDate(insuranceApply.getStartTime()); CountCyclePriceVO countCyclePriceVO = this.getCountCyclePriceVO(countCyclePriceDTO); insuranceApply.setApplyEndTime(countCyclePriceVO.getEndDate()); insuranceApply.setEndTime(countCyclePriceVO.getEndDate()); applyDetailMapper.delete(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())); //å¤çä¸çº§æ°æ® this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo); this.dealApplyDetailData(insuranceApply,applyDetailList,loginUserInfo,countCyclePriceVO); insuranceApply.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); insuranceApplyMapper.updateById(insuranceApply); //å卿¥å¿æ°æ® @@ -709,7 +754,7 @@ public void dealApplyDetailData(InsuranceApply insuranceApply,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo){ public void dealApplyDetailData(InsuranceApply insuranceApply,List<ApplyDetail> applyDetailList,LoginUserInfo loginUserInfo,CountCyclePriceVO countCyclePriceVO){ Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"æªæ¥è¯¢å°æ¹æ¡ä¿¡æ¯"); @@ -796,7 +841,7 @@ applyDetail.setMemberId(member.getId()); applyDetail.setIdcardNo(member.getIdcardNo()); applyDetail.setSex(member.getSex()); applyDetail.setFee(Constants.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime())); applyDetail.setFee(countCyclePriceVO.getCyclePrice()); //éªè¯æ´¾é£åä½ä¿¡æ¯æ¯å¦åå¨ if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){ throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"ã"+applyDetail.getMemberName()+"ãå工派é£å使ªæ¥è¯¢å°ï¼"); @@ -1306,6 +1351,8 @@ @Override public CountCyclePriceVO getCountCyclePriceVO(CountCyclePriceDTO countCyclePriceDTO){ if(Objects.isNull(countCyclePriceDTO) @@ -1318,21 +1365,11 @@ if(Objects.isNull(solutions)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"æªæ¥è¯¢æ¹æ¡ä¿¡æ¯"); } CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO(); if(solutions.getInsureCycleUnit().equals(Constants.ZERO)){ countCyclePriceVO.setEndDate(DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,solutions.getInsureCycle())); }else if(solutions.getInsureCycleUnit().equals(Constants.TWO)){ Integer monthDays = DateUtil.monthDays(countCyclePriceDTO.getStartDate()); Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),0,monthDays); countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); }else if(solutions.getInsureCycleUnit().equals(Constants.THREE)){ Date afterDate = DateUtil.afterDateByType(countCyclePriceDTO.getStartDate(),2,solutions.getInsureCycle()); countCyclePriceVO.setEndDate(DateUtil.afterDateByType(afterDate,0,-1)); } countCyclePriceVO.setCyclePrice(Constants.countDetailFee(solutions,countCyclePriceVO.getEndDate(),countCyclePriceDTO.getStartDate())); return countCyclePriceVO; return Constants.countPriceVO(countCyclePriceDTO.getStartDate(),solutions); } } server/service/src/main/java/com/doumee/service/business/impl/MemberInsuranceServiceImpl.java
@@ -83,6 +83,7 @@ public List<MemberInsurance> findList(MemberInsurance memberInsurance) { memberInsurance.setIsdeleted(Constants.ZERO); QueryWrapper<MemberInsurance> wrapper = new QueryWrapper<>(memberInsurance); wrapper.orderByDesc("CREATE_DATE"); return memberInsuranceMapper.selectList(wrapper); } @@ -129,10 +130,6 @@ if (pageWrap.getModel().getStartTime() != null) { queryWrapper.lambda().eq(MemberInsurance::getStartTime, pageWrap.getModel().getStartTime()); } if (pageWrap.getModel().getIdcardNo() != null) { queryWrapper.lambda().ge(MemberInsurance::getIdcardNo, Utils.Date.getStart(pageWrap.getModel().getIdcardNo())); queryWrapper.lambda().le(MemberInsurance::getIdcardNo, Utils.Date.getEnd(pageWrap.getModel().getIdcardNo())); } if (pageWrap.getModel().getDuId() != null) { queryWrapper.lambda().eq(MemberInsurance::getDuId, pageWrap.getModel().getDuId()); } @@ -176,6 +173,8 @@ return PageData.from(memberInsuranceMapper.selectPage(page, queryWrapper)); } @Override public long count(MemberInsurance memberInsurance) { QueryWrapper<MemberInsurance> wrapper = new QueryWrapper<>(memberInsurance); server/service/src/main/java/com/doumee/service/business/impl/SettleClaimsServiceImpl.java
@@ -358,6 +358,8 @@ } settleClaims.setCreateDate(new Date()); settleClaims.setIsdeleted(Constants.ZERO); settleClaims.setCompanyId(loginUserInfo.getCompanyId()); settleClaims.setStatus(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()); settleClaims.setCreator(loginUserInfo.getId()); settleClaims.setCheckUserId(loginUserInfo.getId()); settleClaimsMapper.insert(settleClaims); @@ -368,6 +370,7 @@ Multifile multifile = reportVideo.get(i); if(Objects.isNull(multifile.getFileurl()) || Objects.isNull(multifile.getType()) || StringUtils.isBlank(multifile.getName()) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"éä»¶å 容å¼å¸¸"); } @@ -551,8 +554,8 @@ if(!oldSettleClaims.getSolutionId().equals(settleClaims.getSolutionId())){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"æ æ³ä¿®æ¹æ¹æ¡ä¿¡æ¯"); } if(!(oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) || oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ if(!(oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()) || oldSettleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡è¯¥æä½"); } oldSettleClaims.setEditor(loginUserInfo.getId()); @@ -589,8 +592,8 @@ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"éä¼ä¸åå·¥æ æ³è¿è¡è¯¥æä½"); } SettleClaims settleClaims = settleClaimsMapper.selectById(scSupplementDTO.getId()); if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()) || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡è¯¥æä½"); } settleClaims.setEditor(loginUserInfo.getId()); @@ -612,21 +615,18 @@ LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); if(Objects.isNull(scSupplementDTO) || Objects.isNull(scSupplementDTO.getId()) || Objects.isNull(scSupplementDTO.getSupplement()) || Objects.isNull(scSupplementDTO.getObjType()) || Objects.isNull(scSupplementDTO.getFileUrl()) || Objects.isNull(scSupplementDTO.getFileType()) || scSupplementDTO.getObjType().equals(Constants.ZERO) ){ throw new BusinessException(ResponseStatus.BAD_REQUEST); } SettleClaims settleClaims = settleClaimsMapper.selectById(scSupplementDTO.getId()); if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE) || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION))){ if(!(settleClaims.getStatus().equals(Constants.SettleClaimsStatus.WAIT_ACCEPTANCE.getKey()) || settleClaims.getStatus().equals(Constants.SettleClaimsStatus.CONFIRM_INFORMATION.getKey()))){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"å½åç¶ææ æ³è¿è¡è¯¥æä½"); } Multifile multifile = new Multifile(); if(loginUserInfo.getType().equals(Constants.ONE)){ multifile.setCompanyId(loginUserInfo.getCompanyId()); @@ -634,7 +634,9 @@ multifile.setCreator(loginUserInfo.getId()); multifile.setCreateDate(new Date()); multifile.setIsdeleted(Constants.ZERO); multifile.setObjType(scSupplementDTO.getObjType()); multifile.setObjId(scSupplementDTO.getId()); multifile.setFileurl(scSupplementDTO.getFileUrl()); multifile.setName(scSupplementDTO.getFileUrl().substring(scSupplementDTO.getFileUrl().lastIndexOf("/") + 1)); multifile.setType(scSupplementDTO.getFileType()); multifileJoinMapper.insert(multifile);