|
|
@@ -6,6 +6,8 @@ package com.jeeplus.modules.wsstaff.service;
|
|
|
import java.io.IOException;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.*;
|
|
|
+import java.time.temporal.TemporalAdjusters;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
@@ -128,6 +130,17 @@ public class WsStaffService extends CrudService<WsStaffMapper, WsStaff> {
|
|
|
return convertSuccess ;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Date转Localdate
|
|
|
+ *
|
|
|
+ * @param date
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private LocalDate date2LocalDate(Date date) {
|
|
|
+ return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//校验是否在上周时间内(没上传)、已上传在一周内可以修改、一周外时间必须相同
|
|
|
public boolean getLastTimeInterval(String onaboardingDate,String outgoingDate,String idCard,String id) {
|
|
|
boolean bo=true;
|
|
|
@@ -137,16 +150,13 @@ public class WsStaffService extends CrudService<WsStaffMapper, WsStaff> {
|
|
|
if(!isValidDate1(onaboardingDate)){
|
|
|
format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
}
|
|
|
- Calendar calendar1 = Calendar.getInstance();
|
|
|
- Calendar calendar2 = Calendar.getInstance();
|
|
|
- int dayOfWeek = calendar1.get(Calendar.DAY_OF_WEEK) - 1;
|
|
|
- int offset1 = 1 - dayOfWeek;
|
|
|
- int offset2 = 7 - dayOfWeek;
|
|
|
- calendar1.add(Calendar.DATE, offset1 - 7);
|
|
|
- calendar2.add(Calendar.DATE, offset2 - 7);
|
|
|
- long time1=calendar1.getTime().getTime();
|
|
|
- long time2=calendar2.getTime().getTime()+24*3600*1000;
|
|
|
+ //本周一
|
|
|
+ LocalDate sunday= LocalDate.now().with(TemporalAdjusters.previous(DayOfWeek.MONDAY));
|
|
|
+ long time1=sunday.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli()-24*7*3600*1000;
|
|
|
+ long time2=sunday.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
|
|
+
|
|
|
try {
|
|
|
+ long time3=format.parse(onaboardingDate).getTime();
|
|
|
//离职时间不能小于入职时间
|
|
|
if(StringUtils.isNotBlank(outgoingDate)){
|
|
|
if(format.parse(onaboardingDate).getTime()>format.parse(outgoingDate).getTime()){
|