Commit be458d01 authored by 廖旭伟's avatar 廖旭伟

修改异常考勤事假在绩效考核时变为请假的bug

parent 9cd604df
...@@ -46,10 +46,7 @@ import com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService; ...@@ -46,10 +46,7 @@ import com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService;
import org.springframework.util.StopWatch; import org.springframework.util.StopWatch;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.RedisKey.KEY_ATTENDANCE_STAT_CACHE; import static com.mortals.xhx.common.key.RedisKey.KEY_ATTENDANCE_STAT_CACHE;
...@@ -277,11 +274,11 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -277,11 +274,11 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
String leaveKey = cacheService.get(LEAVE_REIDS_KEY + redisKey); String leaveKey = cacheService.get(LEAVE_REIDS_KEY + redisKey);
if (StringUtils.isEmpty(leaveKey)) { if (StringUtils.isEmpty(leaveKey)) {
cacheService.set(LEAVE_REIDS_KEY + redisKey, redisKey, 300); //五分钟内不会重复 cacheService.set(LEAVE_REIDS_KEY + redisKey, redisKey, 300); //五分钟内不会重复
PerformAttendRecordEntity recordEntity = conversionLeaveRecord(entity); PerformAttendRecordEntity recordEntity = conversionLeaveRecord(entity,multiple);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
recordEntity.setCreateUserId(1l); recordEntity.setCreateUserId(1l);
recordEntity.setErrorTime(entity.getStartTime()); recordEntity.setErrorTime(entity.getStartTime());
recordEntity.setScore(recordEntity.getScore().multiply(new BigDecimal(multiple))); // recordEntity.setScore(recordEntity.getScore().multiply(new BigDecimal(multiple)));
performAttendRecordService.save(recordEntity, context); performAttendRecordService.save(recordEntity, context);
} }
} }
...@@ -300,7 +297,7 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -300,7 +297,7 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
} }
private PerformAttendRecordEntity conversionLeaveRecord(AttendanceLeaveRecordEntity entity) { private PerformAttendRecordEntity conversionLeaveRecord(AttendanceLeaveRecordEntity entity,int multiple) {
PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity(); PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity();
recordEntity.initAttrValue(); recordEntity.initAttrValue();
StaffEntity staffEntity = staffService.get(entity.getLeavePersonId()); StaffEntity staffEntity = staffService.get(entity.getLeavePersonId());
...@@ -318,17 +315,29 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -318,17 +315,29 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
recordEntity.setAttendanceGroupId(groupStaffEntity.getGroupId()); recordEntity.setAttendanceGroupId(groupStaffEntity.getGroupId());
recordEntity.setAttendanceGroupName(groupStaffEntity.getGroupName()); recordEntity.setAttendanceGroupName(groupStaffEntity.getGroupName());
} }
PerformRulesEntity performRulesEntity = performRulesService.selectOne(new PerformRulesQuery().ruleCode("ATTEND1009")); String ruleCode = "ATTEND1009";
if(multiple%2>0){ //奇数,半天
ruleCode = "ATTEND1010";
}
if(multiple%2==0){ //偶数,全天
ruleCode = "ATTEND1011";
}
PerformRulesEntity performRulesEntity = performRulesService.selectOne(new PerformRulesQuery().ruleCode(ruleCode));
if (performRulesEntity != null) { if (performRulesEntity != null) {
recordEntity.setRuleId(performRulesEntity.getId()); recordEntity.setRuleId(performRulesEntity.getId());
recordEntity.setRuleName(performRulesEntity.getName()); recordEntity.setRuleName(performRulesEntity.getName());
recordEntity.setCategoryId(performRulesEntity.getCategoryId()); recordEntity.setCategoryId(performRulesEntity.getCategoryId());
recordEntity.setCategoryName(performRulesEntity.getCategoryName()); recordEntity.setCategoryName(performRulesEntity.getCategoryName());
recordEntity.setSubAddType(performRulesEntity.getSubAddType()); recordEntity.setSubAddType(performRulesEntity.getSubAddType());
recordEntity.setScore(performRulesEntity.getScore()); if(ruleCode.equals("ATTEND1011")){
int m = multiple/2;
recordEntity.setScore(performRulesEntity.getScore().multiply(new BigDecimal(m)));
}else {
recordEntity.setScore(performRulesEntity.getScore().multiply(new BigDecimal(multiple)));
}
recordEntity.setRemark(performRulesEntity.getContent()); recordEntity.setRemark(performRulesEntity.getContent());
} else { } else {
throw new AppException("没有查询到请假扣分规则:ATTEND1009"); throw new AppException("没有查询到请假扣分规则:"+ruleCode);
} }
recordEntity.setSubMethod(SubMethodEnum.系统自动.getValue()); recordEntity.setSubMethod(SubMethodEnum.系统自动.getValue());
recordEntity.setDeductPerson("系统管理员"); recordEntity.setDeductPerson("系统管理员");
......
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