Commit 1989a814 authored by fangxinjiang's avatar fangxinjiang

派减日期优化-fxj

parent 65707b1d
...@@ -13,6 +13,7 @@ import java.lang.reflect.Method; ...@@ -13,6 +13,7 @@ import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
...@@ -711,4 +712,27 @@ public class Common { ...@@ -711,4 +712,27 @@ public class Common {
Set<Object> seen = ConcurrentHashMap.newKeySet(); Set<Object> seen = ConcurrentHashMap.newKeySet();
return t -> seen.add(keyExtractor.apply(t)); return t -> seen.add(keyExtractor.apply(t));
} }
/**
* @Author fxj
* @Description 判断是否为日期 格式 yyyyMMdd
* @Date 11:24 2025/8/6
**/
public static boolean isValidDateAsso(String dateStr) {
// 1. 检查长度是否为8
if (dateStr == null || dateStr.length() != 8) {
return false;
}
// 2. 检查是否全为数字
if (!dateStr.matches("\\d+")) {
return false;
}
try {
Date date = new SimpleDateFormat("yyyyMMdd").parse(dateStr);
} catch (Exception e) {
return false; // 理论上不会发生(因正则已过滤)
}
return true;
}
} }
...@@ -1241,6 +1241,17 @@ public class DateUtil { ...@@ -1241,6 +1241,17 @@ public class DateUtil {
public static String getFirstDayString(String yearMonth){ public static String getFirstDayString(String yearMonth){
return yearMonth.substring(0,4)+"-"+yearMonth.substring(4,6)+"-01"; return yearMonth.substring(0,4)+"-"+yearMonth.substring(4,6)+"-01";
} }
/**
* 获取第一天
* @Author fxj
* @Date 2019-10-16
* @param yearMonth YYYYMM 返回 YYYYMMDD
* @return
**/
public static String getFirstDayStringAsso(String yearMonth){
return yearMonth+"01";
}
/** /**
* 当月第一天 * 当月第一天
* @Author fxj * @Author fxj
......
...@@ -141,7 +141,7 @@ public class FundHandleExportVo implements Serializable { ...@@ -141,7 +141,7 @@ public class FundHandleExportVo implements Serializable {
* 公积金停缴日期 * 公积金停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "公积金停缴日期", isDate = true,needExport = true) @ExcelAttribute(name = "公积金停缴日期", isDate = true,needExport = true)
@Schema(description = "公积金停缴日期" ) @Schema(description = "公积金停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
......
...@@ -219,7 +219,7 @@ public class TDispatchAuditExportVo { ...@@ -219,7 +219,7 @@ public class TDispatchAuditExportVo {
/** /**
* 社保停缴日期 * 社保停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "社保停缴日期", isDate = true) @ExcelAttribute(name = "社保停缴日期", isDate = true)
@Schema(description = "社保停缴日期" ) @Schema(description = "社保停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -229,7 +229,7 @@ public class TDispatchAuditExportVo { ...@@ -229,7 +229,7 @@ public class TDispatchAuditExportVo {
/** /**
* 公积金停缴日期 * 公积金停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "公积金停缴日期", isDate = true) @ExcelAttribute(name = "公积金停缴日期", isDate = true)
@Schema(description = "公积金停缴日期" ) @Schema(description = "公积金停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
......
...@@ -175,7 +175,7 @@ public class TDispatchInfoExportVo { ...@@ -175,7 +175,7 @@ public class TDispatchInfoExportVo {
/** /**
* 社保停缴日期 * 社保停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "社保停缴日期", isDate = true) @ExcelAttribute(name = "社保停缴日期", isDate = true)
@Schema(description = "社保停缴日期" ) @Schema(description = "社保停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
...@@ -195,7 +195,7 @@ public class TDispatchInfoExportVo { ...@@ -195,7 +195,7 @@ public class TDispatchInfoExportVo {
/** /**
* 公积金停缴日期 * 公积金停缴日期
*/ */
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "公积金停缴日期", isDate = true) @ExcelAttribute(name = "公积金停缴日期", isDate = true)
@Schema(description = "公积金停缴日期" ) @Schema(description = "公积金停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
......
...@@ -68,20 +68,20 @@ public class TDispatchReduceVo extends RowIndex implements Serializable { ...@@ -68,20 +68,20 @@ public class TDispatchReduceVo extends RowIndex implements Serializable {
/** /**
* 社保停缴日期 * 社保停缴日期
*/ */
@ExcelAttribute(name = "社保停缴日期", isDate = true) @ExcelAttribute(name = "社保停缴日期", isDate = false)
@Schema(description = "社保停缴日期:购买社保时必填" ) @Schema(description = "社保停缴日期:购买社保时必填" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保停缴日期" ) @ExcelProperty("社保停缴日期" )
private Date socialReduceDate; private String socialReduceDate;
/** /**
* 公积金停缴日期 * 公积金停缴日期
*/ */
@ExcelAttribute(name = "公积金停缴日期", isDate = true) @ExcelAttribute(name = "公积金停缴日期", isDate = false)
@Schema(description = "公积金停缴日期" ) @Schema(description = "公积金停缴日期" )
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公积金停缴日期" ) @ExcelProperty("公积金停缴日期" )
private Date fundReduceDate; private String fundReduceDate;
/** /**
* 离职日期 * 离职日期
......
...@@ -249,14 +249,14 @@ public class TSocialFundInfoExportVo extends RowIndex implements Serializable { ...@@ -249,14 +249,14 @@ public class TSocialFundInfoExportVo extends RowIndex implements Serializable {
@ExcelProperty("公积金起缴日期") @ExcelProperty("公积金起缴日期")
private Date providentStart; private Date providentStart;
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "社保停缴日期", isDate = true) @ExcelAttribute(name = "社保停缴日期", isDate = true)
@Schema(description = "社保停缴日期") @Schema(description = "社保停缴日期")
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保停缴日期") @ExcelProperty("社保停缴日期")
private Date socialReduceDate; private Date socialReduceDate;
@DateTimeFormat("yyyy-MM-dd") @DateTimeFormat("yyyyMM")
@ExcelAttribute(name = "公积金停缴日期", isDate = true) @ExcelAttribute(name = "公积金停缴日期", isDate = true)
@Schema(description = "公积金停缴日期") @Schema(description = "公积金停缴日期")
@HeadFontStyle(fontHeightInPoints = 11) @HeadFontStyle(fontHeightInPoints = 11)
......
...@@ -3289,7 +3289,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3289,7 +3289,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setSocialProvince(socialFund.getSocialProvince()); dispatch.setSocialProvince(socialFund.getSocialProvince());
dispatch.setSocialCity(socialFund.getSocialCity()); dispatch.setSocialCity(socialFund.getSocialCity());
dispatch.setSocialTown(socialFund.getSocialTown()); dispatch.setSocialTown(socialFund.getSocialTown());
dispatch.setSocialReduceDate(excel.getSocialReduceDate()); dispatch.setSocialReduceDate(DateUtil.stringToDate(excel.getSocialReduceDate(), DateUtil.ISO_DATE_FORMAT));
socialFund.setSocialReduceStatus(CommonConstants.ZERO_STRING); socialFund.setSocialReduceStatus(CommonConstants.ZERO_STRING);
socialFund.setSocialReduceStatus(CommonConstants.ZERO_STRING); socialFund.setSocialReduceStatus(CommonConstants.ZERO_STRING);
socialFund.setSocialStatus(CommonConstants.SIX_STRING); socialFund.setSocialStatus(CommonConstants.SIX_STRING);
...@@ -3333,7 +3333,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3333,7 +3333,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
dispatch.setFundProvince(socialFund.getFundProvince()); dispatch.setFundProvince(socialFund.getFundProvince());
dispatch.setFundCity(socialFund.getFundCity()); dispatch.setFundCity(socialFund.getFundCity());
dispatch.setFundTown(socialFund.getFundTown()); dispatch.setFundTown(socialFund.getFundTown());
dispatch.setFundReduceDate(excel.getFundReduceDate()); dispatch.setFundReduceDate(DateUtil.stringToDate(excel.getFundReduceDate(), DateUtil.ISO_DATE_FORMAT));
socialFund.setFundStatus(CommonConstants.FIVE_STRING); socialFund.setFundStatus(CommonConstants.FIVE_STRING);
socialFund.setFundReduceStatus(CommonConstants.ZERO_STRING); socialFund.setFundReduceStatus(CommonConstants.ZERO_STRING);
} }
...@@ -3377,6 +3377,26 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -3377,6 +3377,26 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
Map<String, TSocialFundInfo> socialFundMap, Map<String, TSocialFundInfo> socialFundMap,
TSocialFundInfo socialFund, TSocialFundInfo socialFund,
TDispatchReduceVo excel) { TDispatchReduceVo excel) {
// MVPV1.7.14 ,批量派减日志调整为年月格式
if (Common.isNotNull(excel.getSocialReduceDate())){
if (excel.getSocialReduceDate().length() == 6){
excel.setSocialReduceDate(excel.getSocialReduceDate()+"01");
}
if (!Common.isValidDateAsso(excel.getSocialReduceDate())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), DispatchConstants.EMPLOYEE + excel.getEmpName() + "社保停缴日期格式错误(例:202508)"));
return true;
}
}
if (Common.isNotNull(excel.getFundReduceDate())){
if (excel.getFundReduceDate().length() == 6){
excel.setFundReduceDate(excel.getFundReduceDate()+"01");
}
if (!Common.isValidDateAsso(excel.getFundReduceDate())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), DispatchConstants.EMPLOYEE + excel.getEmpName() + "公积金停缴日期格式错误(例:202508)"));
return true;
}
}
if (Common.isNotNull(excelVOTemp.get(excel.getEmpIdcard()))) { if (Common.isNotNull(excelVOTemp.get(excel.getEmpIdcard()))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_REDUCE_EXISTS))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.EMP_DISPATCH_REDUCE_EXISTS)));
return true; return true;
......
...@@ -425,10 +425,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -425,10 +425,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
} }
dispatchReduceVo.setTrustRemark(preInfo.getRemark()); dispatchReduceVo.setTrustRemark(preInfo.getRemark());
if (Common.isNotNull(preInfo.getPensionEndReduce())) { if (Common.isNotNull(preInfo.getPensionEndReduce())) {
dispatchReduceVo.setSocialReduceDate(DateUtil.getFirstDay(preInfo.getPensionEndReduce())); dispatchReduceVo.setSocialReduceDate(DateUtil.getFirstDayStringAsso(preInfo.getPensionEndReduce()));
} }
if (Common.isNotNull(preInfo.getFundEndReduce())){ if (Common.isNotNull(preInfo.getFundEndReduce())){
dispatchReduceVo.setFundReduceDate(DateUtil.getFirstDay(preInfo.getFundEndReduce())); dispatchReduceVo.setFundReduceDate(DateUtil.getFirstDayStringAsso(preInfo.getFundEndReduce()));
} }
dispatchReduceVo.setRowIndex(CommonConstants.ONE_INT); dispatchReduceVo.setRowIndex(CommonConstants.ONE_INT);
dispatchReduceVo.setChangeContractAndEmployee(preInfo.getChangeContractAndEmployee()); dispatchReduceVo.setChangeContractAndEmployee(preInfo.getChangeContractAndEmployee());
...@@ -2313,10 +2313,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap ...@@ -2313,10 +2313,10 @@ public class TPreDispatchInfoServiceImpl extends ServiceImpl<TPreDispatchInfoMap
**/ **/
private void dispatchReduce(TDispatchReduceVo dispatchInfo, TPreDispatchInfo pre) { private void dispatchReduce(TDispatchReduceVo dispatchInfo, TPreDispatchInfo pre) {
if (Common.isNotNull(pre.getPensionEndReduce())) { if (Common.isNotNull(pre.getPensionEndReduce())) {
dispatchInfo.setSocialReduceDate(DateUtil.getFirstDay(pre.getPensionEndReduce())); dispatchInfo.setSocialReduceDate(DateUtil.getFirstDayStringAsso(pre.getPensionEndReduce()));
} }
if (Common.isNotNull(pre.getFundEndReduce())) { if (Common.isNotNull(pre.getFundEndReduce())) {
dispatchInfo.setFundReduceDate(DateUtil.getFirstDay(pre.getFundEndReduce())); dispatchInfo.setFundReduceDate(DateUtil.getFirstDayStringAsso(pre.getFundEndReduce()));
} }
if (null != pre.getLeaveDate()) { if (null != pre.getLeaveDate()) {
dispatchInfo.setLeaveDate(DateUtil.stringToDate(pre.getLeaveDate())); dispatchInfo.setLeaveDate(DateUtil.stringToDate(pre.getLeaveDate()));
......
...@@ -1298,7 +1298,7 @@ ...@@ -1298,7 +1298,7 @@
a.FIRST_PAY_TIME, a.FIRST_PAY_TIME,
a.GRADUATION_TIME, a.GRADUATION_TIME,
IF(a.LEAVE_DATE is not null,DATE_FORMAT(a.LEAVE_DATE,"%Y-%m-%d"),"") as "LEAVE_DATE", IF(a.LEAVE_DATE is not null,DATE_FORMAT(a.LEAVE_DATE,"%Y-%m-%d"),"") as "LEAVE_DATE",
IF(a.SOCIAL_REDUCE_DATE is not null,DATE_FORMAT(a.SOCIAL_REDUCE_DATE,"%Y-%m-%d"),"") as "SOCIAL_REDUCE_DATE", IF(a.SOCIAL_REDUCE_DATE is not null,DATE_FORMAT(a.SOCIAL_REDUCE_DATE,"%Y%m"),"") as "SOCIAL_REDUCE_DATE",
a.ID as "DISPATCH_ID" a.ID as "DISPATCH_ID"
FROM t_dispatch_info a FROM t_dispatch_info a
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment