From 2df41be2478656dd1362bade59962947e461eb17 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 17 六月 2025 11:17:27 +0800
Subject: [PATCH] 提交一把订单
---
server/service/src/main/java/com/doumee/core/utils/Constants.java | 122 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 119 insertions(+), 3 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 00e3625..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;
@@ -21,7 +23,10 @@
import java.math.RoundingMode;
import java.net.URL;
import java.net.URLDecoder;
+import java.time.Instant;
import java.time.LocalDate;
+import java.time.Period;
+import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.Date;
@@ -316,6 +321,38 @@
}
return Constants.countPriceVO(countCyclePriceDTO.getStartDate(),countCyclePriceDTO.getSolutions());
}
+
+ public static int calculateAge(String idCard,Date dateDate) {
+ 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(),"骞撮緞淇℃伅閿欒");
+ }
+
+
+
+
+
+// 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;
+ }
+
public static CountCyclePriceVO countPriceVO(Date startDate, Solutions solutions){
CountCyclePriceVO countCyclePriceVO = new CountCyclePriceVO();
@@ -1976,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),
;
@@ -2035,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, "骞冲彴涓婁紶璧勬枡",""),
@@ -2143,7 +2180,6 @@
}
return null;
}
-
// 鏅�氭柟娉�
public static SettleClaimsLogParentStatus getAll(int index) {
@@ -2838,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