Commit 653ad7c0 by lal

提交

parent 7ed9030e
...@@ -28,6 +28,26 @@ import org.apache.commons.lang3.ArrayUtils; ...@@ -28,6 +28,26 @@ import org.apache.commons.lang3.ArrayUtils;
public class ClockInTool { public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd"); static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
public static void main(String[] args) {
System.out.println(isLegalDate("2020-9-12"));
System.out.println(isLegalDate("2020-09-12"));
}
public static boolean isLegalDate(String sDate) {
int legalLen = 10;
if ((sDate == null) || (sDate.length() != legalLen)) {
return false;
}
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
Date date = formatter.parse(sDate);
return sDate.equals(formatter.format(date));
} catch (Exception e) {
return false;
}
}
public static String[] shuzuqucong(String[] temp) { public static String[] shuzuqucong(String[] temp) {
......
...@@ -1520,19 +1520,13 @@ public class SalaryManagementController { ...@@ -1520,19 +1520,13 @@ public class SalaryManagementController {
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())); .eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(emp != null) { if(emp != null) {
if(ClockInTool.Str_Time_formatting(file.getSxrq().replace("/", "-"),"yyyy-MM-dd").length() == 10) { if(ClockInTool.isLegalDate(file.getSxrq())) {
//0:定薪 1:调薪 //0:定薪 1:调薪
if(file.getSfdx() == 0) { if(file.getSfdx() == 0) {
XcglAssoXzdadx xzdadx = XcglAssoXzdadx.builder().build(); XcglAssoXzdadx xzdadx = XcglAssoXzdadx.builder().build();
xzdadx.setUserid(emp.getEmpNum());//用户id xzdadx.setUserid(emp.getEmpNum());//用户id
String sxrq = file.getSxrq().substring(0,5) + "20" + file.getSxrq().substring(5,7);
if(sxrq.contains("/")) {
xzdadx.setSxrq(SalaryTool.SlashDate(sxrq));//生效日期
}else {
xzdadx.setSxrq(file.getSxrq());//生效日期 xzdadx.setSxrq(file.getSxrq());//生效日期
}
xzdadx.setAddtime(new Date().getTime()); xzdadx.setAddtime(new Date().getTime());
xzdadx.setRemarks(""); xzdadx.setRemarks("");
xzdadx.setQyid(userBean.getOrgCode()); xzdadx.setQyid(userBean.getOrgCode());
...@@ -1627,7 +1621,7 @@ public class SalaryManagementController { ...@@ -1627,7 +1621,7 @@ public class SalaryManagementController {
}else { }else {
failure++; failure++;
map.put("name", name); map.put("name", name);
map.put("msg", "日期格式不对(Excel中输入时间处设置为“短日期”即可)"); map.put("msg", "日期格式不对(必须是:YYYY-MM-dd)");
reasons.add(map); reasons.add(map);
} }
}else { }else {
......
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