|
@@ -13,7 +13,9 @@ import com.jpsoft.shinestar.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.shinestar.modules.common.dto.Sort;
|
|
|
import com.jpsoft.shinestar.modules.common.utils.OSSUtil;
|
|
|
import com.jpsoft.shinestar.modules.common.utils.PojoUtils;
|
|
|
+import com.jpsoft.shinestar.modules.sys.entity.DataDictionary;
|
|
|
import com.jpsoft.shinestar.modules.sys.entity.User;
|
|
|
+import com.jpsoft.shinestar.modules.sys.service.DataDictionaryService;
|
|
|
import com.jpsoft.shinestar.modules.sys.service.UserService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -87,6 +89,12 @@ public class WorkOverController {
|
|
|
@Autowired
|
|
|
private WorkPersonSchedulingService workPersonSchedulingService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonDeviceLogService personDeviceLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
+
|
|
|
@ApiOperation(value="创建空记录")
|
|
|
@GetMapping("create")
|
|
|
public MessageResult<WorkOver> create(){
|
|
@@ -649,7 +657,6 @@ public class WorkOverController {
|
|
|
|
|
|
//分钟转小时
|
|
|
private String formatTime(int minuteStr) {
|
|
|
-
|
|
|
String resultStr = "";
|
|
|
|
|
|
if (minuteStr != 0) {
|
|
@@ -672,6 +679,66 @@ public class WorkOverController {
|
|
|
return resultStr;
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("updateFinshTime")
|
|
|
+ @ApiOperation(value="更新加班完成时间")
|
|
|
+ public MessageResult<Integer> updateFinshTime(String day){
|
|
|
+ MessageResult<Integer> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ int affectCount = 0;
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ Date startDate = sdf.parse(day + " 00:00");
|
|
|
+ Date endDate = sdf.parse(day + " 23:59");
|
|
|
+
|
|
|
+ List<DataDictionary> ddList = dataDictionaryService.findByCatalogName("设备用途");
|
|
|
+
|
|
|
+ String scene = "";
|
|
|
+
|
|
|
+ for (DataDictionary dd : ddList) {
|
|
|
+ if (dd.getName().indexOf("考勤") != -1) {
|
|
|
+ scene = dd.getValue();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询当天申请加班记录
|
|
|
+ List<Map> mapList = workOverPersonService.findUnFinishByDate(startDate,endDate);
|
|
|
+
|
|
|
+ for (Map map : mapList) {
|
|
|
+ Long personId = Long.valueOf(map.get("person_id").toString());
|
|
|
+ DateTime startTime = new DateTime((Date)map.get("start_time"));
|
|
|
+ DateTime endTime = new DateTime((Date) map.get("end_time"));
|
|
|
+
|
|
|
+ List<PersonDeviceLog> personDeviceLogs = personDeviceLogService.findByPersonAndDateAndScene(personId,
|
|
|
+ startTime.plusHours(-1).toDate(), endTime.plusHours(2).toDate(), scene);
|
|
|
+
|
|
|
+ //取最后一条
|
|
|
+ if (personDeviceLogs.size()>0){
|
|
|
+ PersonDeviceLog personDeviceLog = personDeviceLogs.get(personDeviceLogs.size()-1);
|
|
|
+ boolean result = workOverService.punchIn(personDeviceLog.getDeviceNo(),personDeviceLog.getPersonId(),personDeviceLog.getRecordTime());
|
|
|
+
|
|
|
+ if(result){
|
|
|
+ affectCount++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo 填写具体代码
|
|
|
+ messageResult.setData(affectCount);
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("updateBeginTime")
|
|
|
@ApiOperation(value="更新加班开始时间")
|
|
|
public MessageResult<Date> updateBeginTime(String workPersonId){
|