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

修改固定班次考勤

parent 5e32ade9
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
} }
this.$post('/attendance/record/hik/addAttendanceRecord',{...params}).then(res => { this.$post('/attendance/record/hik/addAttendanceRecord',{...params}).then(res => {
if(res.code == 1){ if(res.code == 1){
this.$message.success("生成打卡记录成功!")
} }
}) })
}, },
......
...@@ -10,6 +10,9 @@ public class LoginForm extends BaseForm { ...@@ -10,6 +10,9 @@ public class LoginForm extends BaseForm {
private String securityCode; private String securityCode;
private String dingCode;
public String getLoginName() { public String getLoginName() {
return loginName; return loginName;
} }
...@@ -35,6 +38,14 @@ public class LoginForm extends BaseForm { ...@@ -35,6 +38,14 @@ public class LoginForm extends BaseForm {
this.securityCode = securityCode; this.securityCode = securityCode;
} }
public String getDingCode() {
return dingCode;
}
public void setDingCode(String dingCode) {
this.dingCode = dingCode;
}
@Override @Override
public String toString() { public String toString() {
return "loginName:" + this.loginName + " password:" + this.password + " securityCode:" + this.securityCode; return "loginName:" + this.loginName + " password:" + this.password + " securityCode:" + this.securityCode;
......
...@@ -14,6 +14,7 @@ import com.mortals.framework.exception.AppException; ...@@ -14,6 +14,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.SecurityUtil; import com.mortals.framework.util.SecurityUtil;
...@@ -56,6 +57,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -56,6 +57,9 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
private ResourceService resourceService; private ResourceService resourceService;
@Autowired @Autowired
private RoleUserService roleUserService; private RoleUserService roleUserService;
@Autowired
private ICacheService cacheService;
@Override @Override
public void doHandlerUser(UserEntity entity) throws AppException { public void doHandlerUser(UserEntity entity) throws AppException {
if (StringUtils.isNotEmpty(entity.getLoginPwd())) { if (StringUtils.isNotEmpty(entity.getLoginPwd())) {
...@@ -97,6 +101,17 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -97,6 +101,17 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
} }
} }
@Override
protected void updateAfter(UserEntity entity, Context context) throws AppException {
//更新用户后 删除当前用户的token
Set<String> keys = cacheService.scan(SysConstains.LOGIN_TOKEN_KEY + entity.getId());
if (!ObjectUtils.isEmpty(keys)) {
for (String key : keys) {
cacheService.del(key);
}
}
}
@Override @Override
protected void saveAfter(UserEntity entity, Context context) throws AppException { protected void saveAfter(UserEntity entity, Context context) throws AppException {
//更新角色 //更新角色
......
...@@ -33,4 +33,6 @@ public class ReviewSaveReq extends BaseReq { ...@@ -33,4 +33,6 @@ public class ReviewSaveReq extends BaseReq {
*/ */
private String windowNum; private String windowNum;
private String filePaths;
} }
...@@ -93,6 +93,12 @@ public class ApiLoginController extends BaseJsonBodyController { ...@@ -93,6 +93,12 @@ public class ApiLoginController extends BaseJsonBodyController {
userEntity.setExpireTime(DateUtils.addCurrDate(3).getTime()); userEntity.setExpireTime(DateUtils.addCurrDate(3).getTime());
String token = authTokenService.createToken(userEntity); String token = authTokenService.createToken(userEntity);
data.put("token", token); data.put("token", token);
if (!ObjectUtils.isEmpty(loginForm.getDingCode())) {
//更新绑定钉钉
userEntity.setDingUserId(loginForm.getDingCode());
userService.getUserDao().update(userEntity);
}
ret.put(KEY_RESULT_DATA, data); ret.put(KEY_RESULT_DATA, data);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "用户登录系统成功!"); ret.put(KEY_RESULT_MSG, "用户登录系统成功!");
......
...@@ -113,7 +113,7 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U ...@@ -113,7 +113,7 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
userEntity = userService.selectOne(userQuery); userEntity = userService.selectOne(userQuery);
if (ObjectUtils.isEmpty(userEntity)) { if (ObjectUtils.isEmpty(userEntity)) {
ret.put("openId", personRest.getData()); ret.put("openId", personRest.getData());
throw new AppException(REGISTER_AUTH_FAIL, "不存在当前匹配的钉钉关联用户2!"); throw new AppException(REGISTER_AUTH_FAIL, "不存在当前匹配的钉钉关联用户!");
} }
data.put("id", userEntity.getId()); data.put("id", userEntity.getId());
......
...@@ -427,7 +427,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -427,7 +427,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(req, recordEntity); BeanUtils.copyProperties(req, recordEntity);
// recordEntity.setStaffId(staffEntity.getId()); // recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName()); recordEntity.setStaffName(staffEntity.getName());
recordEntity.setWorkNum(staffEntity.getWorkNum());
recordEntity.setDeductTime(new Date()); recordEntity.setDeductTime(new Date());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString()); StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName()); recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
...@@ -459,7 +459,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -459,7 +459,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(req, recordEntity); BeanUtils.copyProperties(req, recordEntity);
// recordEntity.setStaffId(staffEntity.getId()); // recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName()); recordEntity.setStaffName(staffEntity.getName());
recordEntity.setWorkNum(staffEntity.getWorkNum());
recordEntity.setDeptId(staffEntity.getDeptId()); recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName()); recordEntity.setDeptName(staffEntity.getDeptName());
...@@ -493,7 +493,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -493,7 +493,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(req, recordEntity); BeanUtils.copyProperties(req, recordEntity);
// recordEntity.setStaffId(staffEntity.getId()); // recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName()); recordEntity.setStaffName(staffEntity.getName());
recordEntity.setWorkNum(staffEntity.getWorkNum());
recordEntity.setDeductTime(new Date()); recordEntity.setDeductTime(new Date());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString()); StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName()); recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
...@@ -526,6 +526,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -526,6 +526,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
//recordEntity.setStaffId(staffEntity.getId()); //recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName()); recordEntity.setStaffName(staffEntity.getName());
recordEntity.setWorkNum(staffEntity.getWorkNum());
recordEntity.setDeductTime(new Date()); recordEntity.setDeductTime(new Date());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString()); StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName()); recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
...@@ -557,7 +559,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -557,7 +559,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(req, recordEntity); BeanUtils.copyProperties(req, recordEntity);
//recordEntity.setStaffId(staffEntity.getId()); //recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName()); recordEntity.setStaffName(staffEntity.getName());
recordEntity.setWorkNum(staffEntity.getWorkNum());
recordEntity.setDeductTime(new Date()); recordEntity.setDeductTime(new Date());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString()); StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName()); recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
......
...@@ -188,7 +188,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -188,7 +188,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
List<PerformInfo> collect = allCheckRecord.stream().map(item -> { List<PerformInfo> collect = allCheckRecord.stream().map(item -> {
PerformInfo performInfo = new PerformInfo(); PerformInfo performInfo = new PerformInfo();
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item)); BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(item.getPerformType()));
PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(item.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -212,7 +217,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -212,7 +217,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item)); BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
performInfo.setPerformType(PerformTypeEnum.考勤绩效.getValue()); performInfo.setPerformType(PerformTypeEnum.考勤绩效.getValue());
//判断是否存在申诉 //判断是否存在申诉
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType())); PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(performInfo.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
//PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType()));
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -235,7 +245,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -235,7 +245,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item)); BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
performInfo.setPerformType(PerformTypeEnum.评价差评绩效.getValue()); performInfo.setPerformType(PerformTypeEnum.评价差评绩效.getValue());
//判断是否存在申诉 //判断是否存在申诉
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType())); PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(performInfo.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
//PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType()));
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
...@@ -259,7 +274,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -259,7 +274,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
performInfo.setPerformType(PerformTypeEnum.评价投诉绩效.getValue()); performInfo.setPerformType(PerformTypeEnum.评价投诉绩效.getValue());
//判断是否存在申诉 //判断是否存在申诉
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType())); PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(performInfo.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
//PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType()));
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -281,7 +301,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -281,7 +301,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item)); BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
performInfo.setPerformType(PerformTypeEnum.办件绩效.getValue()); performInfo.setPerformType(PerformTypeEnum.办件绩效.getValue());
//判断是否存在申诉 //判断是否存在申诉
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType())); PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(performInfo.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
// PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType()));
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
...@@ -304,7 +329,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -304,7 +329,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item)); BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
performInfo.setPerformType(PerformTypeEnum.效能绩效.getValue()); performInfo.setPerformType(PerformTypeEnum.效能绩效.getValue());
//判断是否存在申诉 //判断是否存在申诉
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType())); PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(performInfo.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
// PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType()));
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -324,7 +354,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -324,7 +354,12 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item)); BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
performInfo.setPerformType(PerformTypeEnum.其它绩效.getValue()); performInfo.setPerformType(PerformTypeEnum.其它绩效.getValue());
//判断是否存在申诉 //判断是否存在申诉
PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType())); PerformAttendAppealQuery appealQuery = new PerformAttendAppealQuery();
appealQuery.setCheckRecordId(item.getId());
appealQuery.setPerformType(performInfo.getPerformType());
appealQuery.setOrderColList(Arrays.asList(new OrderCol("appealResult",OrderCol.DESCENDING)));
PerformAttendAppealEntity entity = appealService.selectOne(appealQuery);
// PerformAttendAppealEntity entity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(item.getId()).performType(performInfo.getPerformType()));
updateAppealResult(performInfo, entity); updateAppealResult(performInfo, entity);
return performInfo; return performInfo;
...@@ -370,6 +405,28 @@ public class PerformApiController extends AbstractBaseController<PerformReq> { ...@@ -370,6 +405,28 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
} }
} }
private void updateAppealResult(PerformInfo performInfo, List<PerformAttendAppealEntity> list) {
if (!ObjectUtils.isEmpty(list)) {
for (PerformAttendAppealEntity entity : list) {
if (ObjectUtils.isEmpty(entity.getAppealResult())) {
performInfo.setAppealStatus(AppealStatusEnum.申诉中.getValue());
} else {
if (AppealResultEnum.通过.getValue() == entity.getAppealResult()) {
performInfo.setAppealStatus(AppealStatusEnum.申诉通过.getValue());
} else if (AppealResultEnum.不通过.getValue() == entity.getAppealResult()) {
performInfo.setAppealStatus(AppealStatusEnum.申诉拒绝.getValue());
} else {
performInfo.setAppealStatus(AppealStatusEnum.申诉中.getValue());
}
}
}
} else {
performInfo.setAppealStatus(AppealStatusEnum.未申诉.getValue());
}
}
/** /**
* 详细 * 详细
*/ */
......
...@@ -2,10 +2,15 @@ package com.mortals.xhx.module.attendance.service.work; ...@@ -2,10 +2,15 @@ package com.mortals.xhx.module.attendance.service.work;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.xhx.common.code.TypeEnum; import com.mortals.framework.model.Context;
import com.mortals.xhx.module.attendance.model.AttendanceGroupFixedworkEntity; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.module.attendance.model.*;
import org.springframework.beans.BeanUtils;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* 工作排班抽象类 * 工作排班抽象类
...@@ -26,7 +31,8 @@ public abstract class AttendanceWorkAbstract { ...@@ -26,7 +31,8 @@ public abstract class AttendanceWorkAbstract {
public static AttendanceWorkAbstract newType(int type) { public static AttendanceWorkAbstract newType(int type) {
if (type == TypeEnum.固定班制.getValue()) { if (type == TypeEnum.固定班制.getValue()) {
return new FixWorkAttendance(type); //return new FixWorkAttendance(type);
return new FixWorkOtherAttendance(type);
} else if (type == TypeEnum.自由工时.getValue()) { } else if (type == TypeEnum.自由工时.getValue()) {
return new FreedomWorkAttendance(type); return new FreedomWorkAttendance(type);
} }
...@@ -115,6 +121,8 @@ public abstract class AttendanceWorkAbstract { ...@@ -115,6 +121,8 @@ public abstract class AttendanceWorkAbstract {
return weekClassId; return weekClassId;
} }
public AttendanceWorkAbstract(int type) { public AttendanceWorkAbstract(int type) {
this.type = type; this.type = type;
} }
......
package com.mortals.xhx.module.attendance.service.work; package com.mortals.xhx.module.attendance.service.work;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.attendance.model.AttendanceGroupEntity; import com.mortals.xhx.module.attendance.model.AttendanceGroupEntity;
import com.mortals.xhx.module.attendance.model.AttendanceRecordDetailEntity; import com.mortals.xhx.module.attendance.model.AttendanceRecordDetailEntity;
import com.mortals.xhx.module.attendance.model.AttendanceRecordEntity;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
...@@ -24,6 +26,12 @@ public class CommonData { ...@@ -24,6 +26,12 @@ public class CommonData {
private Date attendanceDate; private Date attendanceDate;
private Long staffId; private Long staffId;
//当前日期
private String dateStr;
//当天考勤信息
private AttendanceRecordEntity attendanceRecordEntity;
private Context context;
} }
...@@ -2,19 +2,24 @@ package com.mortals.xhx.module.attendance.service.work; ...@@ -2,19 +2,24 @@ package com.mortals.xhx.module.attendance.service.work;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.mortals.xhx.common.code.GoWorkResultEnum; import com.mortals.xhx.common.code.GoWorkResultEnum;
import com.mortals.xhx.common.code.MustEnum;
import com.mortals.xhx.common.code.TypeEnum; import com.mortals.xhx.common.code.TypeEnum;
import com.mortals.xhx.module.attendance.model.*; import com.mortals.xhx.module.attendance.model.*;
import com.mortals.xhx.module.attendance.service.AttendanceClassService; import com.mortals.xhx.module.attendance.service.AttendanceClassService;
import com.mortals.xhx.module.attendance.service.AttendanceGroupFixedworkService; import com.mortals.xhx.module.attendance.service.AttendanceGroupFixedworkService;
import com.mortals.xhx.module.attendance.service.AttendanceGroupFixedworkSpecialService;
import com.mortals.xhx.utils.SpringUtils; import com.mortals.xhx.utils.SpringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 固定班 * 固定班
*
* @author: * @author:
* @date: 2023/7/31 15:15 * @date: 2023/7/31 15:15
*/ */
...@@ -26,11 +31,14 @@ public class FixWorkAttendance extends AttendanceWorkAbstract { ...@@ -26,11 +31,14 @@ public class FixWorkAttendance extends AttendanceWorkAbstract {
private AttendanceClassService attendanceClassService; private AttendanceClassService attendanceClassService;
private AttendanceGroupFixedworkSpecialService specialService;
public FixWorkAttendance(int type) { public FixWorkAttendance(int type) {
super(type); super(type);
this.attendanceGroupFixedworkService = SpringUtils.getBean(AttendanceGroupFixedworkService.class); this.attendanceGroupFixedworkService = SpringUtils.getBean(AttendanceGroupFixedworkService.class);
this.attendanceClassService = SpringUtils.getBean(AttendanceClassService.class); this.attendanceClassService = SpringUtils.getBean(AttendanceClassService.class);
this.specialService = SpringUtils.getBean(AttendanceGroupFixedworkSpecialService.class);
} }
...@@ -64,6 +72,68 @@ public class FixWorkAttendance extends AttendanceWorkAbstract { ...@@ -64,6 +72,68 @@ public class FixWorkAttendance extends AttendanceWorkAbstract {
//跳过本次循环 //跳过本次循环
return; return;
} }
//特殊日期考勤配置
List<AttendanceGroupFixedworkSpecialEntity> specialEntities = specialService.find(new AttendanceGroupFixedworkSpecialQuery().fixedWorkId(attendanceGroupFixedworkEntity.getId()));
if (!ObjectUtils.isEmpty(specialEntities)) {
//分组 需要考勤与不需要考勤
Map<Boolean, List<AttendanceGroupFixedworkSpecialEntity>> collect = specialEntities.stream().collect(Collectors.partitioningBy(item -> item.getMust() == MustEnum..getValue()));
List<AttendanceGroupFixedworkSpecialEntity> mustList = collect.get(true);
if (!ObjectUtils.isEmpty(mustList)) {
//需要打卡
for (AttendanceGroupFixedworkSpecialEntity specialEntity : mustList) {
//必须考勤时间,单位日
Date specialTime = specialEntity.getSpecialTime();
//判断当前考勤日期是否需要考勤,如果需要重叠 则更新为特殊日期考勤
//判断考勤日期与特殊日期是否一致
if (DateUtil.formatDate(commonData.getAttendanceDate()).equals(DateUtil.formatDate(specialTime))) {
//更新打卡情况
weekClassId = specialEntity.getClassId();
}
}
}
List<AttendanceGroupFixedworkSpecialEntity> mustNotList = collect.get(false);
if (!ObjectUtils.isEmpty(mustNotList)) {
//不需要考勤 查看是时间段还是单独时间
for (AttendanceGroupFixedworkSpecialEntity specialEntity : mustNotList) {
Date specialTime = specialEntity.getSpecialTime();
if (!ObjectUtils.isEmpty(specialTime)) {
if (DateUtil.formatDate(commonData.getAttendanceDate()).equals(DateUtil.formatDate(specialTime))) {
//当前日期不需要考勤打卡
//获取班次信息
AttendanceClassEntity attendanceClassEntity = attendanceClassService.get(weekClassId);
if (ObjectUtils.isEmpty(attendanceClassEntity)) {
log.info("attendanceClassEntity is null ,weekClassId:{}", weekClassId);
return;
}
//List<AttendanceClassDetailEntity> attendanceClassDetailEntities = attendanceClassDetailService.find(new AttendanceClassDetailQuery().classId(attendanceClassEntity.getId()));
//获取当前班的多个班次,一个班次为一个上下班时间段
List<AttendanceClassDetailEntity> attendanceClassDetailEntities = attendanceClassEntity.getAttendanceClassDetailList();
for (AttendanceClassDetailEntity classDetail : attendanceClassDetailEntities) {
for (AttendanceRecordDetailEntity attendanceRecordDetailEntity : commonData.getDetailEntityList()) {
if (attendanceRecordDetailEntity.getShiftsId() == classDetail.getId()) {
attendanceRecordDetailEntity.setGoWorkResult(GoWorkResultEnum.正常.getValue());
attendanceRecordDetailEntity.setGoWorkDate(commonData.getAttendanceDate());
}
}
for (AttendanceRecordDetailEntity attendanceRecordDetailEntity : commonData.getDetailEntityList()) {
if (attendanceRecordDetailEntity.getShiftsId() == classDetail.getId()) {
attendanceRecordDetailEntity.setOffWorkResult(GoWorkResultEnum.正常.getValue());
attendanceRecordDetailEntity.setOffWorkDate(commonData.getAttendanceDate());
}
}
}
}
return;
}
}
}
}
//获取班次信息 //获取班次信息
AttendanceClassEntity attendanceClassEntity = attendanceClassService.get(weekClassId); AttendanceClassEntity attendanceClassEntity = attendanceClassService.get(weekClassId);
if (ObjectUtils.isEmpty(attendanceClassEntity)) { if (ObjectUtils.isEmpty(attendanceClassEntity)) {
...@@ -77,7 +147,7 @@ public class FixWorkAttendance extends AttendanceWorkAbstract { ...@@ -77,7 +147,7 @@ public class FixWorkAttendance extends AttendanceWorkAbstract {
Integer orderNum = 0; Integer orderNum = 0;
//构造数据 //构造数据
if (ObjectUtils.isEmpty(commonData.getDetailEntityList())) { if (ObjectUtils.isEmpty(commonData.getDetailEntityList())) {
//遍历班次 构建详细考勤数据 //遍历班次 构建初始详细考勤数据 当天的第二次考勤记录进来时不做初始化
for (AttendanceClassDetailEntity classDetailEntity : attendanceClassDetailEntities) { for (AttendanceClassDetailEntity classDetailEntity : attendanceClassDetailEntities) {
orderNum++; orderNum++;
AttendanceRecordDetailEntity recordDetailEntity = new AttendanceRecordDetailEntity(); AttendanceRecordDetailEntity recordDetailEntity = new AttendanceRecordDetailEntity();
...@@ -89,6 +159,7 @@ public class FixWorkAttendance extends AttendanceWorkAbstract { ...@@ -89,6 +159,7 @@ public class FixWorkAttendance extends AttendanceWorkAbstract {
commonData.getDetailEntityList().add(recordDetailEntity); commonData.getDetailEntityList().add(recordDetailEntity);
} }
} }
//遍历班次详细记录
for (AttendanceClassDetailEntity classDetail : attendanceClassDetailEntities) { for (AttendanceClassDetailEntity classDetail : attendanceClassDetailEntities) {
//计算区间范围 //计算区间范围
//上班打卡前时间 //上班打卡前时间
...@@ -147,7 +218,7 @@ public class FixWorkAttendance extends AttendanceWorkAbstract { ...@@ -147,7 +218,7 @@ public class FixWorkAttendance extends AttendanceWorkAbstract {
} }
} }
} }
}
}
} }
...@@ -35,8 +35,6 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract { ...@@ -35,8 +35,6 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract {
private AttendanceGroupFreeworkSpecialService specialService; private AttendanceGroupFreeworkSpecialService specialService;
@Autowired
private AttendanceRecordHikService recordHikService; private AttendanceRecordHikService recordHikService;
...@@ -46,6 +44,7 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract { ...@@ -46,6 +44,7 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract {
this.attendanceClassService = SpringUtils.getBean(AttendanceClassService.class); this.attendanceClassService = SpringUtils.getBean(AttendanceClassService.class);
this.attendanceRecordService = SpringUtils.getBean(AttendanceRecordService.class); this.attendanceRecordService = SpringUtils.getBean(AttendanceRecordService.class);
this.specialService = SpringUtils.getBean(AttendanceGroupFreeworkSpecialService.class); this.specialService = SpringUtils.getBean(AttendanceGroupFreeworkSpecialService.class);
this.recordHikService = SpringUtils.getBean(AttendanceRecordHikService.class);
} }
@Override @Override
...@@ -72,8 +71,9 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract { ...@@ -72,8 +71,9 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract {
// 查询当前这个人今日的考勤数据,并且按打卡时间进行升序排列 // 查询当前这个人今日的考勤数据,并且按打卡时间进行升序排列
AttendanceRecordHikQuery recordHikQuery = new AttendanceRecordHikQuery(); AttendanceRecordHikQuery recordHikQuery = new AttendanceRecordHikQuery();
recordHikQuery.setAttendanceDateStart(DateUtil.today());
recordHikQuery.setAttendanceDateEnd(DateUtil.today()); recordHikQuery.setAttendanceDateStart(DateUtil.date(commonData.getAttendanceDate()).toDateStr());
recordHikQuery.setAttendanceDateEnd(DateUtil.date(commonData.getAttendanceDate()).toDateStr());
recordHikQuery.setStaffId(commonData.getStaffId()); recordHikQuery.setStaffId(commonData.getStaffId());
recordHikQuery.setOrderColList(Arrays.asList(new OrderCol("attendanceDate"))); recordHikQuery.setOrderColList(Arrays.asList(new OrderCol("attendanceDate")));
List<AttendanceRecordHikEntity> recordHikEntities = recordHikService.find(recordHikQuery); List<AttendanceRecordHikEntity> recordHikEntities = recordHikService.find(recordHikQuery);
...@@ -123,19 +123,14 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract { ...@@ -123,19 +123,14 @@ public class FreedomWorkAttendance extends AttendanceWorkAbstract {
Map<Boolean, List<AttendanceGroupFreeworkSpecialEntity>> collect = specialEntities.stream().collect(Collectors.partitioningBy(item -> item.getMust() == MustEnum..getValue())); Map<Boolean, List<AttendanceGroupFreeworkSpecialEntity>> collect = specialEntities.stream().collect(Collectors.partitioningBy(item -> item.getMust() == MustEnum..getValue()));
List<AttendanceGroupFreeworkSpecialEntity> mustList = collect.get(true); List<AttendanceGroupFreeworkSpecialEntity> mustList = collect.get(true);
if(!ObjectUtils.isEmpty(mustList)){ if (!ObjectUtils.isEmpty(mustList)) {
//需要打卡 //需要打卡
for (AttendanceGroupFreeworkSpecialEntity specialEntity : mustList) { for (AttendanceGroupFreeworkSpecialEntity specialEntity : mustList) {
} }
} }
List<AttendanceGroupFreeworkSpecialEntity> mustNotList = collect.get(false); List<AttendanceGroupFreeworkSpecialEntity> mustNotList = collect.get(false);
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor"> <plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="true" /> <property name="enableExecutorTime" value="true" />
<property name="showSql" value="true" /> <property name="showSql" value="false" />
</plugin> </plugin>
</plugins> </plugins>
</configuration> </configuration>
\ No newline at end of file
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