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

Merge remote-tracking branch 'origin/master'

parents 9a162b73 e0e60418
......@@ -32,6 +32,7 @@ public class AttendanceGroupServiceImpl extends AbstractCRUDServiceImpl<Attendan
if(!ObjectUtils.isEmpty(entity.getAttendanceGroupStaffList())){
entity.getAttendanceGroupStaffList().stream().peek(item->{
item.setGroupId(entity.getId());
item.setGroupName(entity.getGroupName());
item.setCreateUser(context.getUser().getLoginName());
item.setCreateUserId(context.getUser().getId());
item.setCreateTime(new Date());
......@@ -48,6 +49,7 @@ public class AttendanceGroupServiceImpl extends AbstractCRUDServiceImpl<Attendan
attendanceGroupStaffService.remove(attendanceGroupStaffIds,context);
entity.getAttendanceGroupStaffList().stream().peek(item ->{
item.setGroupId(entity.getId());
item.setGroupName(entity.getGroupName());
item.setCreateUser(context.getUser().getLoginName());
item.setCreateUserId(context.getUser().getId());
item.setCreateTime(new Date());
......
......@@ -11,19 +11,21 @@ import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.AppealResultEnum;
import com.mortals.xhx.common.code.AuditStatusEnum;
import com.mortals.xhx.common.code.ProcessInstanceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.AddAttendThread;
import com.mortals.xhx.common.utils.AttendSummaryThread;
import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordQuery;
import com.mortals.xhx.module.attendance.model.AttendanceRecordHikEntity;
import com.mortals.xhx.module.attendance.model.AttendanceRecordHikQuery;
import com.mortals.xhx.module.attendance.model.*;
import com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery;
import com.mortals.xhx.module.attendance.service.AttendanceGroupStaffService;
import com.mortals.xhx.module.attendance.service.AttendanceRecordHikService;
import com.mortals.xhx.module.attendance.service.AttendanceStatService;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.mortals.xhx.module.perform.model.PerformAttendRecordEntity;
import com.mortals.xhx.module.perform.model.PerformRulesEntity;
import com.mortals.xhx.module.perform.model.PerformRulesQuery;
import com.mortals.xhx.module.perform.service.PerformAttendRecordService;
import com.mortals.xhx.module.perform.service.PerformRulesService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -32,9 +34,9 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.attendance.dao.AttendanceLeaveRecordDao;
import com.mortals.xhx.module.attendance.model.AttendanceLeaveRecordEntity;
import com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
......@@ -65,6 +67,12 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
private AttendanceRecordHikService hikService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private PerformAttendRecordService performAttendRecordService;
@Autowired
private AttendanceGroupStaffService attendanceGroupStaffService;
@Autowired
private PerformRulesService performRulesService;
@Override
protected void updateAfter(AttendanceLeaveRecordEntity entity, Context context) throws AppException {
......@@ -77,7 +85,7 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
query.setSummaryTimeEnd(DateUtils.getStrDate(entity.getEndTime()));
cacheService.lpush(KEY_ATTENDANCE_STAT_CACHE, query);
}*/
creatPerformAttend(entity, context);
doUpdateRecordAndSummary(entity, context);
}
......@@ -109,7 +117,7 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
@Override
protected void saveAfter(AttendanceLeaveRecordEntity entity, Context context) throws AppException {
super.saveAfter(entity, context);
creatPerformAttend(entity, context);
doUpdateRecordAndSummary(entity, context);
}
......@@ -210,4 +218,60 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
}
}
}
private void creatPerformAttend(AttendanceLeaveRecordEntity entity, Context context){
try {
if(AppealResultEnum.通过.getValue() == entity.getAuditResult() && LeaveTypeEnum.事假.getValue() == entity.getLeaveType()){
//以半天4小时为计算单位进行扣分
int multiple = entity.getDuration()/14400;
if(multiple >0 ) {
PerformAttendRecordEntity recordEntity = conversionLeaveRecord(entity);
recordEntity.setCreateTime(new Date());
recordEntity.setCreateUserId(1l);
recordEntity.setErrorTime(entity.getStartTime());
recordEntity.setScore(recordEntity.getScore().multiply(new BigDecimal(multiple)));
performAttendRecordService.save(recordEntity, context);
}
}
}catch (Exception e){
log.error(e.getMessage());
}
}
private PerformAttendRecordEntity conversionLeaveRecord(AttendanceLeaveRecordEntity entity){
PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity();
recordEntity.initAttrValue();
StaffEntity staffEntity = staffService.get(entity.getLeavePersonId());
recordEntity.setStaffId(entity.getLeavePersonId());
recordEntity.setStaffName(entity.getLeavePerson());
if(staffEntity!=null){
recordEntity.setWorkNum(staffEntity.getWorkNum());
}
recordEntity.setDeptId(entity.getDeptId());
recordEntity.setDeptName(entity.getDeptName());
recordEntity.setSalaId(entity.getSalaId());
recordEntity.setSalaName(entity.getSalaName());
AttendanceGroupStaffEntity groupStaffEntity = attendanceGroupStaffService.selectOne(new AttendanceGroupStaffQuery().staffId(entity.getLeavePersonId()));
if(groupStaffEntity!=null){
recordEntity.setAttendanceGroupId(groupStaffEntity.getGroupId());
recordEntity.setAttendanceGroupName(groupStaffEntity.getGroupName());
}
PerformRulesEntity performRulesEntity = performRulesService.selectOne(new PerformRulesQuery().ruleCode("ATTEND1009"));
if(performRulesEntity!=null){
recordEntity.setRuleId(performRulesEntity.getId());
recordEntity.setRuleName(performRulesEntity.getName());
recordEntity.setCategoryId(performRulesEntity.getCategoryId());
recordEntity.setCategoryName(performRulesEntity.getCategoryName());
recordEntity.setSubAddType(performRulesEntity.getSubAddType());
recordEntity.setScore(performRulesEntity.getScore());
recordEntity.setRemark(performRulesEntity.getContent());
}else {
throw new AppException("没有查询到请假扣分规则:ATTEND1009");
}
recordEntity.setSubMethod(SubMethodEnum.系统自动.getValue());
recordEntity.setDeductPerson("系统管理员");
return recordEntity;
}
}
\ No newline at end of file
......@@ -95,6 +95,7 @@ public class PerformAttendRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
entity.setDeptName(staffCache == null ? "" : staffCache.getDeptName());
entity.setSalaId(staffCache == null ? null : staffCache.getSalaId());
entity.setSalaName(staffCache == null ? "" : staffCache.getSalaName());
entity.setWorkNum(staffCache == null ? "" : staffCache.getWorkNum());
}
entity.setErrorResult(entity.getRuleName());
entity.setDeductTime(new Date());
......
......@@ -106,6 +106,8 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win
item.setDeptName(staff.getDeptName());
item.setSalaId(staff.getSalaId());
item.setSalaName(staff.getSalaName());
item.setYear(entity.getYear());
item.setMonth(entity.getMonth());
}
});
windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList());
......@@ -133,6 +135,8 @@ public class WindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<Win
item.setDeptName(staff.getDeptName());
item.setSalaId(staff.getSalaId());
item.setSalaName(staff.getSalaName());
item.setYear(entity.getYear());
item.setMonth(entity.getMonth());
}
});
windowWorkmanPerformDetailService.save(entity.getWorkmanPerformDetailList());
......
......@@ -557,7 +557,13 @@
<include refid="_orderColsNew_"/>
</select>
<sql id="_orderColsNew_">
order by CONVERT(a.salaName USING gbk),CONVERT(a.deptName USING gbk),CONVERT(a.staffName USING gbk)
order by
<if test="orderColList != null and !orderColList.isEmpty()">
<foreach collection="orderColList" open="" close="," index="index" item="item" separator=",">
a.${item.colName} ${item.sortKind}
</foreach>
</if>
CONVERT(a.salaName USING gbk),CONVERT(a.deptName USING gbk),CONVERT(a.staffName USING gbk)
</sql>
......
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