|
@@ -3,8 +3,10 @@ package com.jpsoft.shinestar.modules.business.controller;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.util.StringUtil;
|
|
|
import com.jpsoft.shinestar.config.OSSConfig;
|
|
|
+import com.jpsoft.shinestar.exception.CustomException;
|
|
|
import com.jpsoft.shinestar.modules.base.entity.*;
|
|
|
import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
|
|
|
+import com.jpsoft.shinestar.modules.base.service.PersonInfoService;
|
|
|
import com.jpsoft.shinestar.modules.base.service.PersonPopedomService;
|
|
|
import com.jpsoft.shinestar.modules.base.service.WorkShiftInfoService;
|
|
|
import com.jpsoft.shinestar.modules.business.dto.UpdatePersonAttendanceDTO;
|
|
@@ -67,6 +69,9 @@ public class SupplementWorkController {
|
|
|
@Autowired
|
|
|
private PersonPopedomService personPopedomService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private PersonInfoService personInfoService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private WorkScheduleAttendanceService workScheduleAttendanceService;
|
|
|
|
|
@@ -211,6 +216,7 @@ public class SupplementWorkController {
|
|
|
@RequestParam(value="hqCompanyId",defaultValue="") String hqCompanyId,
|
|
|
@RequestParam(value="hqSubordinate",defaultValue="false") Boolean hqSubordinate,
|
|
|
@RequestParam(value = "personName", defaultValue = "") String personName,
|
|
|
+ @RequestParam(value = "swPersonName", defaultValue = "") String swPersonName,
|
|
|
@RequestParam(value = "status", defaultValue = "") String status,
|
|
|
@RequestParam(value = "type", defaultValue = "") String type,
|
|
|
@DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
|
@@ -273,6 +279,10 @@ public class SupplementWorkController {
|
|
|
searchParams.put("personName", "%" + personName + "%");
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(swPersonName)) {
|
|
|
+ searchParams.put("swPersonName", "%" + swPersonName + "%");
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtil.isNotEmpty(status)) {
|
|
|
searchParams.put("status", status);
|
|
|
}
|
|
@@ -305,13 +315,27 @@ public class SupplementWorkController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// List<SupplementWorkPerson> personList = supplementWorkPersonService.findBySupplementWorkId(supplementWork.getId());
|
|
|
-//
|
|
|
-// String personNames = personList.stream()
|
|
|
-// .map((item) -> item.getPersonName())
|
|
|
-// .collect(Collectors.joining(","));
|
|
|
-//
|
|
|
-// supplementWork.setMembers(personNames);
|
|
|
+ List<SupplementWorkPerson> personList = supplementWorkPersonService.findBySupplementWorkId(supplementWork.getId());
|
|
|
+
|
|
|
+ List<Map> members = new ArrayList<>();
|
|
|
+
|
|
|
+ for (SupplementWorkPerson supplementWorkPerson : personList) {
|
|
|
+ Map<String,Object> member = new HashMap<>();
|
|
|
+
|
|
|
+ member.put("id", supplementWorkPerson.getId());
|
|
|
+
|
|
|
+ //补卡人
|
|
|
+ member.put("name", supplementWorkPerson.getPersonName());
|
|
|
+
|
|
|
+ //当前补卡对应考勤记录
|
|
|
+ WorkScheduleAttendance wsa = workScheduleAttendanceService.findOneBySupplementWorkPersonId(supplementWorkPerson.getId());
|
|
|
+
|
|
|
+ member.put("wsa", wsa);
|
|
|
+
|
|
|
+ members.add(member);
|
|
|
+ }
|
|
|
+
|
|
|
+ supplementWork.setMembers(members);
|
|
|
}
|
|
|
|
|
|
if(exportFlag) {
|
|
@@ -336,4 +360,77 @@ public class SupplementWorkController {
|
|
|
|
|
|
return msgResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value="查看补卡当天缺卡记录列表")
|
|
|
+ @RequestMapping(value = "missAttendanceList",method = RequestMethod.GET)
|
|
|
+ public MessageResult<List> missAttendanceList(String supplementWorkPersonId){
|
|
|
+ MessageResult<List> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ SupplementWorkPerson supplementWorkPerson = supplementWorkPersonService.get(supplementWorkPersonId);
|
|
|
+ PersonPopedom personPopedom = personPopedomService.get(supplementWorkPerson.getPersonPopedomId());
|
|
|
+ PersonInfo personInfo = personInfoService.get(personPopedom.getPersonId());
|
|
|
+
|
|
|
+ SupplementWork supplementWork = supplementWorkService.get(supplementWorkPerson.getSupplementWorkId());
|
|
|
+
|
|
|
+ String attendanceDate = supplementWork.getAttendanceDate().substring(0, 10);
|
|
|
+
|
|
|
+ List<WorkScheduleAttendance> attendanceList = workScheduleAttendanceService.findByPersonIdAttendanceDateResult(personInfo.getId(), attendanceDate, "0");
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData(attendanceList);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value="补卡")
|
|
|
+ @RequestMapping(value = "patchAttendance",method = RequestMethod.POST)
|
|
|
+ public MessageResult<String> patchAttendance(String supplementWorkPersonId,String workAttendanceId){
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+ WorkScheduleAttendance workScheduleAttendance = workScheduleAttendanceService.findOneBySupplementWorkPersonId(supplementWorkPersonId);
|
|
|
+
|
|
|
+ if(workScheduleAttendance!=null){
|
|
|
+ throw new CustomException("当前补卡申请已生效!不能重复补卡!");
|
|
|
+ }
|
|
|
+
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
+ workScheduleAttendance = workScheduleAttendanceService.get(workAttendanceId);
|
|
|
+
|
|
|
+ SupplementWorkPerson supplementWorkPerson = supplementWorkPersonService.get(supplementWorkPersonId);
|
|
|
+// PersonPopedom personPopedom = personPopedomService.get(supplementWorkPerson.getPersonPopedomId());
|
|
|
+// PersonInfo personInfo = personInfoService.get(personPopedom.getPersonId());
|
|
|
+
|
|
|
+ //更新补卡记录
|
|
|
+ supplementWorkPerson.setScheduleAttendanceId(workScheduleAttendance.getId());
|
|
|
+ supplementWorkPerson.setUpdateTime(new Date());
|
|
|
+ supplementWorkPersonService.update(supplementWorkPerson);
|
|
|
+
|
|
|
+ //更新考勤记录
|
|
|
+ workScheduleAttendance.setResult("1");
|
|
|
+ workScheduleAttendance.setRemark("补卡");
|
|
|
+ workScheduleAttendance.setSupplementWorkPersonId(supplementWorkPerson.getId());
|
|
|
+ workScheduleAttendance.setUpdateTime(new Date());
|
|
|
+
|
|
|
+ workScheduleAttendanceService.update(workScheduleAttendance);
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ }
|
|
|
+ catch (Exception ex){
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+
|
|
|
+ log.error(ex.getMessage(),ex);
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
}
|