Commit 53eddca0 authored by fangxinjiang's avatar fangxinjiang

节假日配置表及社保医疗截止配置表调整

parent ab08f2ec
...@@ -575,6 +575,13 @@ public class DateUtil { ...@@ -575,6 +575,13 @@ public class DateUtil {
return formater.format(date); return formater.format(date);
} }
public static int getDays(Date date) {
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
int day = cal.get(Calendar.DAY_OF_MONTH);
return day;
}
/** /**
* @param date * @param date
* @return string * @return string
...@@ -1188,6 +1195,13 @@ public class DateUtil { ...@@ -1188,6 +1195,13 @@ public class DateUtil {
c1.set(Integer.valueOf(yearMonth.substring(0,4)),Integer.valueOf(yearMonth.substring(4,6))-1,c1.getActualMaximum(Calendar.DAY_OF_MONTH)); c1.set(Integer.valueOf(yearMonth.substring(0,4)),Integer.valueOf(yearMonth.substring(4,6))-1,c1.getActualMaximum(Calendar.DAY_OF_MONTH));
return c1.getTime(); return c1.getTime();
} }
public static int getLastDayOfDate(Date date){
Calendar c2 =Calendar.getInstance();
int day = c2.getActualMaximum(Calendar.DAY_OF_MONTH);
return day;
}
/** /**
* 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间 * 根据指定的格式将字符串转换成Date 如输入:2003-11-19 11:20:20将按照这个转成时间
* *
...@@ -1317,12 +1331,11 @@ public class DateUtil { ...@@ -1317,12 +1331,11 @@ public class DateUtil {
return cal.getTime(); return cal.getTime();
} }
public static Date getDateOfThisMonth(Date date){ public static Date getDayOfThisMonth(int day){
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
if (date != null) { cal.setTime(new Date());
cal.setTime(date);
}
cal.set(Calendar.MONTH,Integer.valueOf(DateUtil.getMonth(new Date()))-1); cal.set(Calendar.MONTH,Integer.valueOf(DateUtil.getMonth(new Date()))-1);
cal.set(Calendar.DAY_OF_MONTH,day);
return cal.getTime(); return cal.getTime();
} }
......
...@@ -289,6 +289,10 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI ...@@ -289,6 +289,10 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
} }
TSocialDeadlineInfo save; TSocialDeadlineInfo save;
LambdaQueryWrapper<TSocialDeadlineInfo> queryWrapper; LambdaQueryWrapper<TSocialDeadlineInfo> queryWrapper;
int medicalDay;
int socialDay;
int curlDay;
int setDay;
for (TSocialDeadlineInfo sd:baseLists){ for (TSocialDeadlineInfo sd:baseLists){
queryWrapper= null; queryWrapper= null;
save = new TSocialDeadlineInfo(); save = new TSocialDeadlineInfo();
...@@ -296,10 +300,27 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI ...@@ -296,10 +300,27 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
save.setId(null); save.setId(null);
save.setMonth(Integer.parseInt(DateUtil.getThisMonth())); save.setMonth(Integer.parseInt(DateUtil.getThisMonth()));
save.setType(CommonConstants.ZERO_STRING); save.setType(CommonConstants.ZERO_STRING);
save.setSocialEndDate(DateUtil.getDateOfThisMonth(save.getSocialEndDate())); //如果月份超出当前月 大概率是 日设置有问题这里做个优化
save.setMedicalEndDate(DateUtil.getDateOfThisMonth(save.getMedicalEndDate())); setDay = DateUtil.getDays(save.getMedicalEndDate());
curlDay = DateUtil.getLastDayOfDate(new Date());
if (setDay > curlDay){
medicalDay = curlDay;
}else {
medicalDay=setDay;
}
save.setMedicalEndDate(DateUtil.getDayOfThisMonth(medicalDay));
setDay = DateUtil.getDays(save.getSocialEndDate());
if (setDay > curlDay){
socialDay = curlDay;
}else {
socialDay=setDay;
}
save.setSocialEndDate(DateUtil.getDayOfThisMonth(socialDay));
initSocialEndDate(holidayMap, save); initSocialEndDate(holidayMap, save);
initMedicalEndDate(holidayMap, save); initMedicalEndDate(holidayMap, save);
save.setUpdateTime(null);
save.setUpdateBy(null);
save.setUpdateName(null);
queryWrapper = initCountQuery(save,queryWrapper); queryWrapper = initCountQuery(save,queryWrapper);
if (baseMapper.selectCount(queryWrapper) > 0){ if (baseMapper.selectCount(queryWrapper) > 0){
continue; continue;
...@@ -392,6 +413,7 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI ...@@ -392,6 +413,7 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
if (Common.isNotNull(exit)){ if (Common.isNotNull(exit)){
return R.failed("已存在对应月份与缴纳地的配置,请确认后操作!"); return R.failed("已存在对应月份与缴纳地的配置,请确认后操作!");
} }
//如果是基础配置 重置之前的配置
updateType(tSocialDeadlineInfo); updateType(tSocialDeadlineInfo);
if (baseMapper.insert(tSocialDeadlineInfo) >= 0){ if (baseMapper.insert(tSocialDeadlineInfo) >= 0){
return R.ok(); return R.ok();
......
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