Commit 53eddca0 authored by fangxinjiang's avatar fangxinjiang

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

parent ab08f2ec
......@@ -575,6 +575,13 @@ public class DateUtil {
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
* @return string
......@@ -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));
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将按照这个转成时间
*
......@@ -1317,12 +1331,11 @@ public class DateUtil {
return cal.getTime();
}
public static Date getDateOfThisMonth(Date date){
public static Date getDayOfThisMonth(int day){
Calendar cal = Calendar.getInstance();
if (date != null) {
cal.setTime(date);
}
cal.setTime(new Date());
cal.set(Calendar.MONTH,Integer.valueOf(DateUtil.getMonth(new Date()))-1);
cal.set(Calendar.DAY_OF_MONTH,day);
return cal.getTime();
}
......
......@@ -289,6 +289,10 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
}
TSocialDeadlineInfo save;
LambdaQueryWrapper<TSocialDeadlineInfo> queryWrapper;
int medicalDay;
int socialDay;
int curlDay;
int setDay;
for (TSocialDeadlineInfo sd:baseLists){
queryWrapper= null;
save = new TSocialDeadlineInfo();
......@@ -296,10 +300,27 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
save.setId(null);
save.setMonth(Integer.parseInt(DateUtil.getThisMonth()));
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);
initMedicalEndDate(holidayMap, save);
save.setUpdateTime(null);
save.setUpdateBy(null);
save.setUpdateName(null);
queryWrapper = initCountQuery(save,queryWrapper);
if (baseMapper.selectCount(queryWrapper) > 0){
continue;
......@@ -392,6 +413,7 @@ public class TSocialDeadlineInfoServiceImpl extends ServiceImpl<TSocialDeadlineI
if (Common.isNotNull(exit)){
return R.failed("已存在对应月份与缴纳地的配置,请确认后操作!");
}
//如果是基础配置 重置之前的配置
updateType(tSocialDeadlineInfo);
if (baseMapper.insert(tSocialDeadlineInfo) >= 0){
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