From 94fc07774a552edc838ab68dc72a89eed8888665 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期六, 20 一月 2024 17:40:04 +0800
Subject: [PATCH] 111

---
 server/service/src/main/java/com/doumee/service/business/impl/InsuranceApplyServiceImpl.java |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 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 8940095..3dbe7b2 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
@@ -143,7 +143,7 @@
             }
             applyDetail.setIdcardNo(member.getIdcardNo());
             applyDetail.setSex(member.getSex());
-            applyDetail.setFee(this.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime()));
+            applyDetail.setFee(Constants.countDetailFee(solutions,insuranceApply.getApplyEndTime(),insuranceApply.getApplyStartTime()));
             //楠岃瘉娲鹃仯鍗曚綅淇℃伅鏄惁瀛樺湪
             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()+"銆戝憳宸ユ淳閬e崟浣嶆湭鏌ヨ鍒帮紒");
@@ -176,14 +176,14 @@
 
 
 
-    public BigDecimal countDetailFee(Solutions solutions ,Date startDate,Date endDate){
-        //鏌ヨ淇濋櫓瀹為檯鍛ㄦ湡
-        Integer cycle = DateUtil.calculateBetween(endDate,startDate,solutions.getDataType());
-        if(cycle==-1){
-            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏃ユ湡淇℃伅閿欒!");
-        }
-        return solutions.getPrice().multiply(new BigDecimal(cycle));
-    }
+//    public BigDecimal countDetailFee(Solutions solutions ,Date startDate,Date endDate){
+//        //鏌ヨ淇濋櫓瀹為檯鍛ㄦ湡
+//        Integer cycle = DateUtil.calculateBetween(endDate,startDate,solutions.getDataType());
+//        if(cycle==-1){
+//            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鏃ユ湡淇℃伅閿欒!");
+//        }
+//        return solutions.getPrice().multiply(new BigDecimal(cycle));
+//    }
 
 //    public static void main(String[] args) {
 //        Date date1 = DateUtil.StringToDate("2023-03-01 00:00:00");
@@ -319,6 +319,21 @@
         insuranceApply.setInsureNum(applyDetailMapper.selectCount(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())
                 .eq(ApplyDetail::getIsdeleted,Constants.ZERO)));
 
+        //璁剧疆鍦ㄤ繚鏃堕暱锛堝ぉ鏁帮級
+        if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())){
+            //濡傛灉褰撳墠鏃堕棿澶т簬缁撴潫鏃ユ湡 鍒欎娇鐢ㄧ粨鏉熸棩鏈熷姣斿紑濮嬫棩鏈�
+            if(DateUtil.compareDate(new Date(),insuranceApply.getEndTime())>=Constants.ZERO){
+                insuranceApply.setServiceDays(DateUtil.daysBetweenDates(insuranceApply.getEndTime(),insuranceApply.getStartTime()));
+            }else if(DateUtil.compareDate(insuranceApply.getStartTime(),new Date())>=Constants.ZERO){
+                //鏈紑濮�
+                insuranceApply.setServiceDays(Constants.ZERO);
+            }else{
+                insuranceApply.setServiceDays(DateUtil.daysBetweenDates(new Date(),insuranceApply.getStartTime()));
+            }
+        }
+
+
+
         //鏌ヨ鎿嶄綔璁板綍
         List<ApplyLog> applyLogList = applyLogJoinMapper.selectJoinList(ApplyLog.class,
                 new MPJLambdaWrapper<ApplyLog>()

--
Gitblit v1.9.3