From fca3a3f8358872215cf98986e8c8b72cf2dbfe02 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 10 六月 2025 18:22:14 +0800
Subject: [PATCH] git ch

---
 server/service/src/main/java/com/doumee/core/utils/Constants.java |   82 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 82 insertions(+), 0 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 3be4154..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;
@@ -2872,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