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

修改员工导出

parent 12e1f509
......@@ -14,13 +14,18 @@ import com.mortals.framework.model.Result;
import com.mortals.xhx.busiz.h5.req.AppealReq;
import com.mortals.xhx.busiz.h5.req.PerformReq;
import com.mortals.xhx.busiz.h5.rsp.AppealStatInfo;
import com.mortals.xhx.busiz.h5.rsp.PerformStatInfo;
import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.dao.CheckAllRecordDao;
import com.mortals.xhx.module.check.model.*;
import com.mortals.xhx.module.check.service.*;
import com.mortals.xhx.module.perform.model.PerformAttendAppealEntity;
import com.mortals.xhx.module.perform.model.PerformAttendAppealQuery;
import com.mortals.xhx.module.perform.service.PerformAttendAppealService;
import com.mortals.xhx.module.staff.model.StaffPerformStatEntity;
import com.mortals.xhx.module.staff.model.StaffPerformStatQuery;
import com.mortals.xhx.module.staff.service.StaffPerformStatService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -30,10 +35,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
......@@ -62,7 +64,10 @@ public class AppealApiController extends AbstractBaseController<PerformReq> {
private CheckGoworkRecordService checkGoworkRecordService;
@Autowired
private CheckOtherRecordService checkOtherRecordService;
@Autowired
private CheckAllRecordDao checkAllRecordDao;
@Autowired
private StaffPerformStatService staffPerformStatService;
@Autowired
private PerformAttendAppealService appealService;
......@@ -89,13 +94,44 @@ public class AppealApiController extends AbstractBaseController<PerformReq> {
}
log.info("【{}】【请求体】--> 用户:{}", busiDesc, context.getUser().getRealName());
try {
//todo 查询当前登录人的绩效分数
CheckAllRecordQuery checkAllRecordQuery = new CheckAllRecordQuery();
checkAllRecordQuery.setSubAddType(SubAddTypeEnum.扣除.getValue());
checkAllRecordQuery.setStaffId(context.getUser().getCustomerId());
int totalTimes = checkAllRecordDao.getCount(checkAllRecordQuery);
checkAllRecordQuery.setCheckTimeStart(DateUtil.today());
checkAllRecordQuery.setCheckTimeEnd(DateUtil.today());
int todayTimes = checkAllRecordDao.getCount(checkAllRecordQuery);
StaffPerformStatQuery staffPerformStatQuery = new StaffPerformStatQuery();
staffPerformStatQuery.setStaffId(context.getUser().getCustomerId());
staffPerformStatQuery.setYear(DateUtil.year(new Date()));
staffPerformStatQuery.setMonth(DateUtil.month(new Date()) + 1);
List<StaffPerformStatEntity> staffPerformStatEntities = staffPerformStatService.find(staffPerformStatQuery);
BigDecimal totalScore = new BigDecimal(0.0);
if (ObjectUtils.isEmpty(staffPerformStatEntities)) {
totalScore = staffPerformStatEntities.stream().map(item -> item.getTotalSubScore()).reduce(BigDecimal.ZERO, BigDecimal::add);
}
staffPerformStatQuery.setDay(DateUtil.dayOfMonth(new Date()));
//今日得分
StaffPerformStatEntity staffPerformStatEntity = staffPerformStatService.selectOne(staffPerformStatQuery);
BigDecimal todayScore = new BigDecimal(0.0);
if (!ObjectUtils.isEmpty(staffPerformStatEntity)) {
todayScore = staffPerformStatEntity.getTotalSubScore();
}
AppealStatInfo appealStatInfo = new AppealStatInfo();
appealStatInfo.setTotalScore(new BigDecimal("10.52").setScale(1,BigDecimal.ROUND_HALF_UP));
appealStatInfo.setTotalTimes(12);
appealStatInfo.setTodayScore(new BigDecimal("2.5").setScale(1,BigDecimal.ROUND_HALF_UP));
appealStatInfo.setTodayTimes(3);
appealStatInfo.setTotalScore(totalScore.setScale(1, BigDecimal.ROUND_HALF_UP));
appealStatInfo.setTotalTimes(totalTimes);
appealStatInfo.setTodayScore(todayScore.setScale(1, BigDecimal.ROUND_HALF_UP));
appealStatInfo.setTodayTimes(todayTimes);
rest.setData(appealStatInfo);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
......
......@@ -561,6 +561,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName());
recordEntity.setSubAddType(rule.getSubAddType());
......
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