代码优化

This commit is contained in:
TL
2025-07-14 15:12:31 +08:00
parent e53a527b48
commit 2a5bab6a89
5 changed files with 29 additions and 37 deletions

View File

@ -34,6 +34,13 @@ public class CoscoDateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY_MM_DD__HH_MM_SS = "yyyy-MM-dd+HH:mm:ss";
private static String[] parsePatterns = {"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
public static Date plusYears(int year){
LocalDate currentDate = LocalDate.now(); // 获取当前日期
LocalDate futureDate = currentDate.plusYears(year); // 加年限
return Date.from(futureDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
/**
* 获取当前Date型日期
*

View File

@ -8,6 +8,7 @@ import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.CoscoCategoryConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.EvaluateTaskConstant;
import com.chinaunicom.zyhy.ebtp.supplier.base.constant.SupplierUserConstant;
import com.chinaunicom.zyhy.ebtp.supplier.common.CoscoDateUtils;
import com.chinaunicom.zyhy.ebtp.supplier.common.MessageType;
import com.chinaunicom.zyhy.ebtp.supplier.common.aop.MessageLog;
import com.chinaunicom.zyhy.ebtp.supplier.coscoBlack.dao.CoscoBlacklistMapper;
@ -23,7 +24,6 @@ import com.chinaunicom.zyhy.ebtp.supplier.coscoCategory.vo.BlackApproveVo;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.dao.mapper.CoscoSupplierBaseMapper;
import com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierBase;
import com.chinaunicom.zyhy.ebtp.supplier.dict.entity.DictProject;
import com.chinaunicom.zyhy.ebtp.supplier.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -192,7 +192,7 @@ public class CoscoBlacklistServiceImpl implements ICoscoBlacklistService {
coscoBlacklist.setApproveStatus(list.getApproveStatus());
coscoBlacklist.setStartTime(new Date());
//获取加入黑名单时间
coscoBlacklist.setEndTime(DateUtils.plusYears(Integer.parseInt(coscoBlacklist.getTimelimitType())));
coscoBlacklist.setEndTime(CoscoDateUtils.plusYears(Integer.parseInt(coscoBlacklist.getTimelimitType())));
coscoBlacklistMapper.updateCoscoBlacklist(coscoBlacklist);
if (CoscoCategoryConstant.APPROVE_STATUS_PASS.equals(list.getApproveStatus())) {
CoscoBlacklistSupplier coscoBlacklistSupplier = new CoscoBlacklistSupplier();

View File

@ -1,16 +0,0 @@
package com.chinaunicom.zyhy.ebtp.supplier.util;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
public class DateUtils {
public static Date plusYears(int year){
LocalDate currentDate = LocalDate.now(); // 获取当前日期
LocalDate futureDate = currentDate.plusYears(year); // 加年限
return Date.from(futureDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
}

View File

@ -27,7 +27,7 @@
<result property="orgNumber" column="org_number"/>
<result property="creditCode" column="credit_code"/>
<result property="property3" column="property3"/>
<result property="updatetime" column="updatetime"/>
<result property="updateTime" column="updatetime"/>
<result property="companyId" column="company_id"/>
<result property="taxNumber" column="tax_number"/>
<result property="email" column="email"/>

View File

@ -80,25 +80,26 @@
<select id="selectCoscoSupplierexitList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierexit" resultMap="CoscoSupplierexitResult">
<include refid="selectCoscoSupplierexitVo"/>
<where>
<if test="exitTheme != null and exitTheme != ''">
and exit_theme = #{exitTheme}
</if>
<if test="exitReason != null and exitReason != ''">
and exit_reason = #{exitReason}
</if>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="approveStatus != null ">
and approve_status = #{approveStatus}
</if>
<if test="workFlowId != null and workFlowId != ''">
and work_flow_id = #{workFlowId}
</if>
<if test="lastUpdateTime != null ">
and last_update_time = #{lastUpdateTime}
</if>
<if test="exitTheme != null and exitTheme != ''">
and exit_theme = #{exitTheme}
</if>
<if test="exitReason != null and exitReason != ''">
and exit_reason = #{exitReason}
</if>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="approveStatus != null ">
and approve_status = #{approveStatus}
</if>
<if test="workFlowId != null and workFlowId != ''">
and work_flow_id = #{workFlowId}
</if>
<if test="lastUpdateTime != null ">
and last_update_time = #{lastUpdateTime}
</if>
</where>
order by create_time desc
</select>
<select id="selectCoscoSupplierexitById" parameterType="String"