Commit f7f3ddbf authored by 赵啸非's avatar 赵啸非

修改考勤自动审核

parent 36590982
...@@ -136,12 +136,12 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte ...@@ -136,12 +136,12 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
//SimpleDateFormat sdft = new SimpleDateFormat("HH:mm:ss"); //SimpleDateFormat sdft = new SimpleDateFormat("HH:mm:ss");
Integer goWorkResult = recordDetailEntity.getGoWorkResult(); Integer goWorkResult = recordDetailEntity.getGoWorkResult();
Integer offWorkResult = recordDetailEntity.getOffWorkResult(); Integer offWorkResult = recordDetailEntity.getOffWorkResult();
//判断上班 //判断上班
if (GoWorkResultEnum.正常.getValue() != goWorkResult) { if (GoWorkResultEnum.正常.getValue() != goWorkResult) {
AttendanceRecordErrorEntity errorEntity = new AttendanceRecordErrorEntity(); AttendanceRecordErrorEntity errorEntity = new AttendanceRecordErrorEntity();
BeanUtils.copyProperties(attendanceRecordEntity, errorEntity, new String[]{"id"}); BeanUtils.copyProperties(attendanceRecordEntity, errorEntity, new String[]{"id"});
Date goWorkDate = attendanceClassDetailService.selectOne(new AttendanceClassDetailQuery().id(recordDetailEntity.getShiftsId())).getGoWorkDate(); Date goWorkDate = attendanceClassDetailService.selectOne(new AttendanceClassDetailQuery().classId(recordDetailEntity.getShiftsId())).getGoWorkDate();
errorEntity.setGoOffDateTime(goWorkDate); errorEntity.setGoOffDateTime(goWorkDate);
if (!ObjectUtils.isEmpty(recordDetailEntity.getGoWorkDate())) { if (!ObjectUtils.isEmpty(recordDetailEntity.getGoWorkDate())) {
...@@ -170,14 +170,14 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte ...@@ -170,14 +170,14 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
errorEntity.initAttrValue(); errorEntity.initAttrValue();
BeanUtils.copyProperties(attendanceRecordEntity, errorEntity, new String[]{"id"}); BeanUtils.copyProperties(attendanceRecordEntity, errorEntity, new String[]{"id"});
Date offWorkDate = attendanceClassDetailService.selectOne(new AttendanceClassDetailQuery().id(recordDetailEntity.getShiftsId())).getOffWorkDate(); /* Date offWorkDate = attendanceClassDetailService.selectOne(new AttendanceClassDetailQuery().classId(recordDetailEntity.getShiftsId())).getOffWorkDate();
errorEntity.setGoOffDateTime(offWorkDate); errorEntity.setGoOffDateTime(offWorkDate);
if (!ObjectUtils.isEmpty(recordDetailEntity.getGoWorkDate())) { if (!ObjectUtils.isEmpty(recordDetailEntity.getGoWorkDate())) {
errorEntity.setErrorDateTime(recordDetailEntity.getGoWorkDate()); errorEntity.setErrorDateTime(recordDetailEntity.getGoWorkDate());
errorEntity.setActualAttendanceDateTime(recordDetailEntity.getGoWorkDate()); errorEntity.setActualAttendanceDateTime(recordDetailEntity.getGoWorkDate());
} else { } else {
errorEntity.setErrorDateTime(offWorkDate); errorEntity.setErrorDateTime(offWorkDate);
} }*/
if (OffWorkResultEnum.缺卡.getValue() == recordDetailEntity.getOffWorkResult()) { if (OffWorkResultEnum.缺卡.getValue() == recordDetailEntity.getOffWorkResult()) {
errorEntity.setErrorStatus(ErrorStatusEnum.缺卡.getValue()); errorEntity.setErrorStatus(ErrorStatusEnum.缺卡.getValue());
} }
......
package com.mortals.xhx.module.attendance.web; package com.mortals.xhx.module.attendance.web;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
...@@ -7,12 +8,15 @@ import com.mortals.xhx.module.workman.model.WorkmanEntity; ...@@ -7,12 +8,15 @@ import com.mortals.xhx.module.workman.model.WorkmanEntity;
import com.mortals.xhx.module.workman.model.WorkmanQuery; import com.mortals.xhx.module.workman.model.WorkmanQuery;
import com.mortals.xhx.module.workman.service.WorkmanService; import com.mortals.xhx.module.workman.service.WorkmanService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.attendance.model.AttendanceClassEntity; import com.mortals.xhx.module.attendance.model.AttendanceClassEntity;
import com.mortals.xhx.module.attendance.service.AttendanceClassService; import com.mortals.xhx.module.attendance.service.AttendanceClassService;
...@@ -21,39 +25,45 @@ import com.mortals.framework.util.StringUtils; ...@@ -21,39 +25,45 @@ import com.mortals.framework.util.StringUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
/** /**
* * 考勤班次信息
* 考勤班次信息 *
* * @author zxfei
* @author zxfei * @date 2023-04-08
* @date 2023-04-08 */
*/
@RestController @RestController
@RequestMapping("attendance/class") @RequestMapping("attendance/class")
public class AttendanceClassController extends BaseCRUDJsonBodyMappingController<AttendanceClassService,AttendanceClassEntity,Long> { public class AttendanceClassController extends BaseCRUDJsonBodyMappingController<AttendanceClassService, AttendanceClassEntity, Long> {
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired @Autowired
private WorkmanService workmanService; private WorkmanService workmanService;
public AttendanceClassController(){ public AttendanceClassController() {
super.setModuleDesc( "考勤班次信息"); super.setModuleDesc("考勤班次信息");
} }
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model,"workManId",workmanService.find(new WorkmanQuery()).stream().collect(Collectors.toMap(x->x.getId().toString(),y->y.getName(),(o,n)->n))); this.addDict(model, "workManId", workmanService.find(new WorkmanQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getName(), (o, n) -> n)));
super.init(model, context); super.init(model, context);
} }
@Override @Override
protected void saveBefore(AttendanceClassEntity entity, Map<String, Object> model, Context context) throws AppException { protected void saveBefore(AttendanceClassEntity entity, Map<String, Object> model, Context context) throws AppException {
entity.setClassResponsiblePersonName(workmanService.selectOne(new WorkmanQuery().id(entity.getClassResponsiblePersonId())).getName());
if (!ObjectUtils.isEmpty(entity.getClassResponsiblePersonId())) {
WorkmanEntity workmanEntity = workmanService.get(entity.getClassResponsiblePersonId());
entity.setClassResponsiblePersonName(workmanEntity == null ? "" : workmanEntity.getName());
}
super.saveBefore(entity, model, context); super.saveBefore(entity, model, context);
} }
} }
...@@ -159,10 +159,6 @@ public class CheckAttendRecordServiceImpl extends AbstractCRUDServiceImpl<CheckA ...@@ -159,10 +159,6 @@ public class CheckAttendRecordServiceImpl extends AbstractCRUDServiceImpl<CheckA
entity.setUpdateTime(entity.getCheckTime()); entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理) entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity); dao.update(entity);
try { try {
CheckAttendRecordEntity temp = this.get(entity.getId()); CheckAttendRecordEntity temp = this.get(entity.getId());
if (temp != null) { if (temp != null) {
......
...@@ -75,7 +75,8 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -75,7 +75,8 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
private void updateStaffRuleNames(PerformAttendRecordEntity entity) { private void updateStaffRuleNames(PerformAttendRecordEntity entity) {
if (!ObjectUtils.isEmpty(entity.getRuleId())) { if (!ObjectUtils.isEmpty(entity.getRuleId())) {
PerformRulesEntity rulesEntity = rulesService.getCache(entity.getRuleId().toString()); PerformRulesEntity rulesEntity = rulesService.getCache(entity.getRuleId().toString());
entity.setRuleName(rulesEntity.getName()); entity.setRuleName(rulesEntity == null ? "" : rulesEntity.getName());
entity.setSubAddType(rulesEntity == null ? 2 : rulesEntity.getSubAddType());
} }
if (!ObjectUtils.isEmpty(entity.getStaffId())) { if (!ObjectUtils.isEmpty(entity.getStaffId())) {
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString()); StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
...@@ -86,54 +87,56 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -86,54 +87,56 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
if (!ObjectUtils.isEmpty(entity.getAttendanceGroupId())) { if (!ObjectUtils.isEmpty(entity.getAttendanceGroupId())) {
AttendanceGroupEntity attendanceGroupEntity = attendanceGroupService.get(entity.getAttendanceGroupId()); AttendanceGroupEntity attendanceGroupEntity = attendanceGroupService.get(entity.getAttendanceGroupId());
entity.setAttendanceGroupName(attendanceGroupEntity == null ? "" : attendanceGroupEntity.getGroupName()); entity.setAttendanceGroupName(attendanceGroupEntity == null ? "" : attendanceGroupEntity.getGroupName());
//判断上下班时间
if (TypeEnum.固定班制.getValue() == attendanceGroupEntity.getType()) {
AttendanceGroupFixedworkEntity fixedworkEntity = fixedworkService.selectOne(new AttendanceGroupFixedworkQuery().groupId(attendanceGroupEntity.getId()));
if (!ObjectUtils.isEmpty(fixedworkEntity)) {
//查看当前时间是星期几
int dayOfWeek = DateUtil.dayOfWeek(entity.getAttendanceDate());
switch (dayOfWeek) {
case 1:
String goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getSundayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 2:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getMondayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 3:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getTuesdayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 4:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getWednesdayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 5:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getTuesdayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 6:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getFridayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 7:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getSundayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
default:
entity.setGoOffTimeStr("");
}
}
} else if (TypeEnum.自由工时.getValue() == attendanceGroupEntity.getType()) {
} else if (TypeEnum.排班制.getValue() == attendanceGroupEntity.getType()) { if (!ObjectUtils.isEmpty(attendanceGroupEntity)) {
//判断上下班时间
if (TypeEnum.固定班制.getValue() == attendanceGroupEntity.getType()) {
AttendanceGroupFixedworkEntity fixedworkEntity = fixedworkService.selectOne(new AttendanceGroupFixedworkQuery().groupId(attendanceGroupEntity.getId()));
if (!ObjectUtils.isEmpty(fixedworkEntity)) {
//查看当前时间是星期几
int dayOfWeek = DateUtil.dayOfWeek(entity.getAttendanceDate());
switch (dayOfWeek) {
case 1:
String goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getSundayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 2:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getMondayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 3:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getTuesdayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 4:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getWednesdayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 5:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getTuesdayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 6:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getFridayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
case 7:
goOffWorkStr = getGoOffWorkStr(fixedworkEntity.getSundayClassId());
entity.setGoOffTimeStr(goOffWorkStr);
break;
default:
entity.setGoOffTimeStr("");
}
}
} else if (TypeEnum.自由工时.getValue() == attendanceGroupEntity.getType()) {
} else { } else if (TypeEnum.排班制.getValue() == attendanceGroupEntity.getType()) {
} } else {
}
}
} }
...@@ -149,13 +152,13 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -149,13 +152,13 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
String goWorkStr = ""; String goWorkStr = "";
String offWorkStr = ""; String offWorkStr = "";
if (!ObjectUtils.isEmpty(classDetailEntity.getGoWorkDate())) { if (!ObjectUtils.isEmpty(classDetailEntity.getGoWorkDate())) {
goWorkStr = DateUtil.formatDateTime(classDetailEntity.getGoWorkDate()); goWorkStr = DateUtil.formatTime(classDetailEntity.getGoWorkDate());
} }
if (!ObjectUtils.isEmpty(classDetailEntity.getOffWorkDate())) { if (!ObjectUtils.isEmpty(classDetailEntity.getOffWorkDate())) {
offWorkStr = DateUtil.formatDateTime(classDetailEntity.getOffWorkDate()); offWorkStr = DateUtil.formatTime(classDetailEntity.getOffWorkDate());
} }
goOffWorkSb.append(goWorkStr); goOffWorkSb.append(goWorkStr);
goOffWorkSb.append("--"); goOffWorkSb.append("~~");
goOffWorkSb.append(offWorkStr); goOffWorkSb.append(offWorkStr);
goOffWorkSb.append(" \n"); goOffWorkSb.append(" \n");
} }
......
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