|  | @@ -35,6 +35,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  |  import org.jeecg.common.system.base.controller.JeecgController;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import org.jeecg.modules.workOvertime.mapper.workOvertimeMapper;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  import org.springframework.web.servlet.ModelAndView;
 | 
	
	
		
			
				|  | @@ -60,6 +61,8 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 | 
	
		
			
				|  |  |  	 private IAttendanceService attendanceService;
 | 
	
		
			
				|  |  |  	 @Autowired
 | 
	
		
			
				|  |  |  	 private IShiftService shiftService;
 | 
	
		
			
				|  |  | +	 @Autowired
 | 
	
		
			
				|  |  | +	 private workOvertimeMapper overtimeMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  //	 public List<Map> getMap(){
 | 
	
		
			
				|  |  |  //		 LambdaQueryWrapper<Shift> query = new LambdaQueryWrapper<Shift>();
 | 
	
	
		
			
				|  | @@ -96,11 +99,37 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 | 
	
		
			
				|  |  |  		 LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 | 
	
		
			
				|  |  |  		 DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  |  		 Attendance attendance = new Attendance();
 | 
	
		
			
				|  |  | -		 String shiftTimeS = jsonObject.get("shiftTimeS").toString();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		 String shiftTimeS = jsonObject.get("shiftTimeS").toString();//校准后时间
 | 
	
		
			
				|  |  |  		 String shiftTimeX = jsonObject.get("shiftTimeX").toString();
 | 
	
		
			
				|  |  | +		 if(jsonObject.get("shiftTimeSYs") != null && jsonObject.get("shiftTimeSYs") != ""){
 | 
	
		
			
				|  |  | +			 String shiftTimeSYs = jsonObject.get("shiftTimeSYs").toString();//校准前时间
 | 
	
		
			
				|  |  | +		 	 //compareTo()方法的返回值,date1小于date2返回-1,date1大于date2返回1,相等返回0
 | 
	
		
			
				|  |  | +			 int compareTo = sdf.parse(shiftTimeS).compareTo(sdf.parse(shiftTimeSYs));
 | 
	
		
			
				|  |  | +			 if(compareTo != -1){
 | 
	
		
			
				|  |  | +				 return Result.error("最早打卡时间不能早于已有打卡时间");
 | 
	
		
			
				|  |  | +			 }
 | 
	
		
			
				|  |  | +		 }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		 if(jsonObject.get("shiftTimeXYs") != null && jsonObject.get("shiftTimeXYs") != ""){
 | 
	
		
			
				|  |  | +			 String shiftTimeXYs = jsonObject.get("shiftTimeXYs").toString();
 | 
	
		
			
				|  |  | +		 	 //compareTo()方法的返回值,date1小于date2返回-1,date1大于date2返回1,相等返回0
 | 
	
		
			
				|  |  | +			 int compareTo = sdf.parse(shiftTimeX).compareTo(sdf.parse(shiftTimeXYs));
 | 
	
		
			
				|  |  | +			 if(compareTo != 1){
 | 
	
		
			
				|  |  | +				 return Result.error("最迟打卡时间不能晚于已有打卡时间");
 | 
	
		
			
				|  |  | +			 }
 | 
	
		
			
				|  |  | +		 }
 | 
	
		
			
				|  |  | +		 int compareTo1 = sdf.parse(shiftTimeS).compareTo(sdf.parse(shiftTimeX));
 | 
	
		
			
				|  |  | +		 if(compareTo1 == 0){
 | 
	
		
			
				|  |  | +			 return Result.error("最早和最迟打卡时间不能相同");
 | 
	
		
			
				|  |  | +		 }
 | 
	
		
			
				|  |  | +		 if(compareTo1 == 1){
 | 
	
		
			
				|  |  | +			 return Result.error("最早打卡时间不能晚于最迟打卡时间");
 | 
	
		
			
				|  |  | +		 }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  		 String username = jsonObject.get("username").toString();
 | 
	
		
			
				|  |  |  		 attendance.setUserId(username);
 | 
	
		
			
				|  |  | -		 attendance.setNotes("手工校准"+user.getRealname());
 | 
	
		
			
				|  |  | +		 attendance.setNotes("手工校准 "+user.getRealname());
 | 
	
		
			
				|  |  |  		 attendance.setUserDate(sdf.parse(shiftTimeS));
 | 
	
		
			
				|  |  |  		 attendance.setCheckinType("上班打卡");
 | 
	
		
			
				|  |  |  		 attendance.setExceptionType("正常");
 | 
	
	
		
			
				|  | @@ -113,13 +142,17 @@ public class viewClockInController extends JeecgController<ViewClockIn, IviewClo
 | 
	
		
			
				|  |  |  //		 if(jsonObject.get("setInfo") != null){
 | 
	
		
			
				|  |  |  //		 	attendance2.setSetInfo(jsonObject.get("setInfo").toString());
 | 
	
		
			
				|  |  |  //		 }
 | 
	
		
			
				|  |  | -		 attendance2.setNotes("手工校准"+user.getRealname());
 | 
	
		
			
				|  |  | +		 attendance2.setNotes("手工校准 "+user.getRealname());
 | 
	
		
			
				|  |  |  		 attendance2.setUserId(username);
 | 
	
		
			
				|  |  |  		 attendance2.setUserDate(sdf.parse(shiftTimeX));
 | 
	
		
			
				|  |  |  		 attendance2.setCheckinType("下班打卡");
 | 
	
		
			
				|  |  |  		 attendance2.setExceptionType("正常");
 | 
	
		
			
				|  |  |  		 attendanceService.save(attendance2);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		 String viewDate = jsonObject.get("viewDate").toString();//校准后时间
 | 
	
		
			
				|  |  | +		 overtimeMapper.delAttendanceByUser(username,viewDate);
 | 
	
		
			
				|  |  |  		 return Result.OK("校准成功!");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  //		 return "校准成功";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	 }
 |