From 78a173f85f8a4666d83cf8d900f04dd9f8e3e127 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 17 六月 2025 08:53:12 +0800
Subject: [PATCH] 提交一把订单

---
 server/service/src/main/java/com/doumee/core/utils/Constants.java |  122 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 108 insertions(+), 14 deletions(-)

diff --git a/server/service/src/main/java/com/doumee/core/utils/Constants.java b/server/service/src/main/java/com/doumee/core/utils/Constants.java
index 81902fb..470525b 100644
--- a/server/service/src/main/java/com/doumee/core/utils/Constants.java
+++ b/server/service/src/main/java/com/doumee/core/utils/Constants.java
@@ -4,8 +4,10 @@
 import cn.hutool.core.util.IdcardUtil;
 import com.doumee.core.constants.ResponseStatus;
 import com.doumee.core.exception.BusinessException;
+import com.doumee.dao.business.dto.ApplyPowerDTO;
 import com.doumee.dao.business.dto.CountCyclePriceDTO;
 import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.vo.ApplyPowerVO;
 import com.doumee.dao.business.vo.ChangeDealTypeVO;
 import com.doumee.dao.business.vo.CountCyclePriceVO;
 import io.swagger.models.auth.In;
@@ -321,22 +323,34 @@
     }
 
     public static int calculateAge(String idCard,Date dateDate) {
-        if (idCard == null || idCard.length() != 18) {
-            throw new IllegalArgumentException("韬唤璇佸彿鐮佸繀椤绘槸18浣�");
+        try{
+            Integer happenYear = Integer.valueOf(DateUtil.dateToString(dateDate,"yyyy"));
+            Integer birthYear = Integer.valueOf(idCard.substring(6,10));
+            return happenYear - birthYear;
+        }catch (Exception e){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"骞撮緞淇℃伅閿欒");
         }
 
-        // 鎻愬彇鍑虹敓鏃ユ湡
-        String birthDateStr = idCard.substring(6, 14); // 渚嬪锛�19900101
-        LocalDate birthDate = LocalDate.parse(birthDateStr);
-        Instant instant = dateDate.toInstant();
-        // 鑾峰彇褰撳墠鏃ユ湡
-        LocalDate currentDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); // 杞崲涓� LocalDate
 
-        // 璁$畻骞撮緞
-        Period period = Period.between(birthDate, currentDate);
-        int age = period.getYears(); // 鐩存帴鑾峰彇骞翠唤宸嵆涓哄勾榫�
 
-        return age;
+
+
+//        if (idCard == null || idCard.length() != 18) {
+//            throw new IllegalArgumentException("韬唤璇佸彿鐮佸繀椤绘槸18浣�");
+//        }
+//
+//        // 鎻愬彇鍑虹敓鏃ユ湡
+//        String birthDateStr = idCard.substring(6, 14); // 渚嬪锛�19900101
+//        LocalDate birthDate = LocalDate.parse(birthDateStr);
+//        Instant instant = dateDate.toInstant();
+//        // 鑾峰彇褰撳墠鏃ユ湡
+//        LocalDate currentDate = instant.atZone(ZoneId.systemDefault()).toLocalDate(); // 杞崲涓� LocalDate
+//
+//        // 璁$畻骞撮緞
+//        Period period = Period.between(birthDate, currentDate);
+//        int age = period.getYears(); // 鐩存帴鑾峰彇骞翠唤宸嵆涓哄勾榫�
+
+//        return age;
     }
 
 
@@ -1999,7 +2013,7 @@
         ACCEPTANCE(9, "宸插彈鐞�",3),//寰呯悊绠�
         WAIT_AUDIT_COMPENSATION(10, "寰呮牳璧�",4),
         COMPENSATION(11, "宸叉牳璧�",5),
-        CONFIRM_FEE(12, "宸茬‘璁ら噾棰�",5),
+        CONFIRM_FEE(12, "寰呯粨妗�",5),
         CLOSE_CASE(13, "宸茬粨妗�",6),
         RETURN(14, "宸叉挙妗�",7),
         ;
@@ -2058,7 +2072,7 @@
         SUPPLEMENT(5, "琛ュ厖璇存槑","鎻愪氦鎰忚锛�${param}"),
         PLATFORM_LP_DEAL(6, "骞冲彴鐞嗚禂澶勭悊","宸插湪骞冲彴瀹屾垚鐞嗚禂"),
         PLATFORM_REMARK(7, "澶囨敞鏍囩","${param}"),
-        PLATFORM_ADDCODE(8, "骞冲彴娣诲姞鎶ユ鍙�","澶囨鍙凤細${param}"),
+        PLATFORM_ADDCODE(8, "骞冲彴淇敼鎶ユ鍙�","澶囨鍙凤細${param}"),
         PLATFORM_UN_AGREE_BACK(9, "浼佷笟涓嬭浇璧勬枡",""),
         PLATFORM_DOWNLOAD(10, "骞冲彴涓嬭浇璧勬枡",""),
         PLATFORM_CHECK_PASS(11, "骞冲彴涓婁紶璧勬枡",""),
@@ -2860,5 +2874,85 @@
 
     }
 
+    public static void  initApplyStatus(InsuranceApply apply){
+        apply.setStatusCollect(Constants.InsuranceApplyStatus.getCollectStatus(apply.getStatus()));
+        if(Constants.equalsInteger(apply.getStatus(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                || Constants.equalsInteger(apply.getStatus(),Constants.InsuranceApplyStatus.WTB_DONE.getKey())){
+            //濡傛灉宸插畬鎴�
+            if(apply.getEndTime()==null || System.currentTimeMillis()>apply.getEndTime().getTime()){
+                apply.setStatusCollect(Constants.THREE);//宸茶繃鏈�
+            }
+        }
+        Constants.setServiceDays(apply);
+        apply.setStatusInfo(Constants.ApplyCollectStatus.getName(apply.getStatusCollect()));
+        if(Constants.equalsInteger(apply.getStatus(),Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                || Constants.equalsInteger(apply.getStatus(),Constants.InsuranceApplyStatus.WTB_DONE.getKey()) ){
+            if(apply.getStartTime().getTime()>System.currentTimeMillis()){
+                apply.setStatusInfo("寰呯敓鏁�");
+            }else if(apply.getEndTime().getTime()<System.currentTimeMillis()){
+                apply.setStatusInfo("宸茶繃鏈�");
+            }else{
+                apply.setStatusInfo("淇濋殰涓�");
+            }
+        }
+    }
+
+    public static void setServiceDays(InsuranceApply insuranceApply) {
+        //璁剧疆鍦ㄤ繚鏃堕暱锛堝ぉ鏁帮級
+        insuranceApply.setServiceDays(Constants.ZERO);
+        if(insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey())
+                || insuranceApply.getStatus().equals(Constants.InsuranceApplyStatus.WTB_DONE.getKey())){
+            //濡傛灉褰撳墠鏃堕棿澶т簬缁撴潫鏃ユ湡 鍒欎娇鐢ㄧ粨鏉熸棩鏈熷姣斿紑濮嬫棩鏈�
+            if(DateUtil.compareDate(new Date(),insuranceApply.getEndTime())>=Constants.ZERO){
+                insuranceApply.setServiceDays(
+                        DateUtil.daysBetweenDates(insuranceApply.getEndTime(),insuranceApply.getStartTime())+1
+                );
+            }else if(DateUtil.compareDate(insuranceApply.getStartTime(),new Date())>=Constants.ZERO){
+                //鏈紑濮�
+                insuranceApply.setServiceDays(Constants.ZERO);
+            }else{
+                insuranceApply.setServiceDays(DateUtil.daysBetweenDates(new Date(),insuranceApply.getStartTime())+1);
+            }
+        }
+    }
+
+    public static ApplyPowerVO getApplyPowerStatic(ApplyPowerDTO applyPowerDTO, InsuranceApply insuranceApply, Solutions solutions){
+        if(Objects.isNull(applyPowerDTO)
+                || Objects.isNull(applyPowerDTO.getApplyId())){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"鍙傛暟閿欒");
+        }
+        if(Objects.isNull(applyPowerDTO.getBeginDate())){
+            applyPowerDTO.setBeginDate(new Date());
+        }
+        ApplyPowerVO applyPowerVO = new ApplyPowerVO();
+        //鑾峰彇鏂规 缁撴潫鏃堕棿
+        Date endTime = insuranceApply.getEndTime();
+        //鏌ヨ褰撳墠鍘诲姞淇濈殑寮�濮嬫棩鏈�  yyyy-MM-dd HH:mm:ss 2024-10-29 00:00:00
+        Date addStartDate = DateUtil.getMontageDate(
+                DateUtil.afterDateByType(applyPowerDTO.getBeginDate(),Constants.ZERO,solutions.getAddValidDays()),
+                1
+        );
+        applyPowerVO.setAddStartDate(addStartDate);
+        //鍔犱繚鐢熸晥鏃ユ湡澶т簬 淇濆崟缁撴潫鏃ユ湡 鍒欎笉鍙互杩涜鍔犱繚
+        if(addStartDate.getTime()>=endTime.getTime()){
+            applyPowerVO.setAddTrue(Constants.ONE);
+        }else{
+            applyPowerVO.setAddTrue(Constants.ZERO);
+        }
+        //鏌ヨ褰撳墠鍘诲噺淇濈殑寮�濮嬫棩鏈�  yyyy-MM-dd HH:mm:ss 2024-10-29 00:00:00
+        Date delStartDate = DateUtil.getMontageDate(
+                DateUtil.afterDateByType(applyPowerDTO.getBeginDate(),Constants.ZERO,solutions.getAddValidDays()),
+                1
+        );
+        applyPowerVO.setDelStartDate(delStartDate);
+        //鍔犱繚鐢熸晥鏃ユ湡澶т簬 淇濆崟缁撴潫鏃ユ湡 鍒欎笉鍙互杩涜鍑忎繚
+        if(delStartDate.getTime()>=endTime.getTime()){
+            applyPowerVO.setDelTrue(Constants.ONE);
+        }else{
+            applyPowerVO.setDelTrue(Constants.ZERO);
+        }
+        return applyPowerVO;
+    }
+
 
 }

--
Gitblit v1.9.3