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

Merge remote-tracking branch 'origin/master'

parents 2f6965a1 d8a91550
...@@ -4,6 +4,9 @@ package com.mortals.xhx.busiz.web; ...@@ -4,6 +4,9 @@ package com.mortals.xhx.busiz.web;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseJsonBodyController; import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.busiz.req.AppealReq; import com.mortals.xhx.busiz.req.AppealReq;
import com.mortals.xhx.busiz.req.PerformReq; import com.mortals.xhx.busiz.req.PerformReq;
...@@ -11,17 +14,34 @@ import com.mortals.xhx.busiz.rsp.PerformDetailInfo; ...@@ -11,17 +14,34 @@ import com.mortals.xhx.busiz.rsp.PerformDetailInfo;
import com.mortals.xhx.busiz.rsp.PerformInfo; import com.mortals.xhx.busiz.rsp.PerformInfo;
import com.mortals.xhx.busiz.rsp.PerformStatInfo; import com.mortals.xhx.busiz.rsp.PerformStatInfo;
import com.mortals.xhx.common.code.PerformTypeEnum; import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.attendance.model.AttendanceRecordEntity;
import com.mortals.xhx.module.attendance.model.AttendanceRecordQuery;
import com.mortals.xhx.module.attendance.service.AttendanceRecordService;
import com.mortals.xhx.module.check.model.CheckAttendRecordEntity;
import com.mortals.xhx.module.check.model.CheckAttendRecordQuery;
import com.mortals.xhx.module.check.service.*; import com.mortals.xhx.module.check.service.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.framework.ap.SysConstains.LAST_PAGE;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
/** /**
* h5 绩效 * h5 绩效
*
* @author: zxfei * @author: zxfei
* @date: 2023/7/7 13:20 * @date: 2023/7/7 13:20
*/ */
...@@ -30,6 +50,7 @@ import java.util.List; ...@@ -30,6 +50,7 @@ import java.util.List;
@RequestMapping("/api/v1/perform") @RequestMapping("/api/v1/perform")
public class PerformApiController extends BaseJsonBodyController { public class PerformApiController extends BaseJsonBodyController {
@Autowired @Autowired
private CheckAttendRecordService checkAttendRecordService; private CheckAttendRecordService checkAttendRecordService;
@Autowired @Autowired
...@@ -66,20 +87,45 @@ public class PerformApiController extends BaseJsonBodyController { ...@@ -66,20 +87,45 @@ public class PerformApiController extends BaseJsonBodyController {
* 个人当月绩效加分扣分列表 * 个人当月绩效加分扣分列表
*/ */
@PostMapping(value = "list") @PostMapping(value = "list")
public Rest<List<PerformInfo>> performList(@RequestBody PerformReq performReq) { public Rest<Object> performList(@RequestBody PerformReq performReq) {
Rest<Object> rest = Rest.ok();
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
if (ObjectUtils.isEmpty(context) || ObjectUtils.isEmpty(context.getUser())) {
throw new AppException(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT);
}
String busiDesc = "个人绩效列表"; String busiDesc = "个人绩效列表";
Rest<List<PerformInfo>> rest = Rest.ok(busiDesc + " 【成功】");
try { try {
if (ObjectUtils.isEmpty(performReq.getPerformStartDate())) { if (ObjectUtils.isEmpty(performReq.getPerformStartDate())) {
//未设置时间的情况,默认为当月 //未设置时间的情况,默认为当月
performReq.setPerformStartDate(DateUtil.beginOfMonth(new Date()).toDateStr()); performReq.setPerformStartDate(DateUtil.beginOfMonth(new Date()).toDateStr());
performReq.setPerformEndDate(DateUtil.today()); performReq.setPerformEndDate(DateUtil.today());
} }
PageInfo pageInfo = buildPageInfo(performReq);
//todo 查询全部扣分绩效 //todo 查询全部扣分绩效
if (PerformTypeEnum.全部.getValue().equals(performReq.getPerformType())) { if (PerformTypeEnum.全部.getValue().equals(performReq.getPerformType())) {
} else if (PerformTypeEnum.考勤绩效.getValue().equals(performReq.getPerformType())) { } else if (PerformTypeEnum.考勤绩效.getValue().equals(performReq.getPerformType())) {
CheckAttendRecordQuery query = new CheckAttendRecordQuery();
query.setCheckTimeStart(performReq.getPerformStartDate());
query.setCheckTimeEnd(performReq.getPerformEndDate());
query.setStaffId(context.getUser().getCustomerId());
Result<CheckAttendRecordEntity> result = checkAttendRecordService.find(query, pageInfo, context);
List<PerformInfo> collect = result.getList().stream().map(item -> {
PerformInfo performInfo = new PerformInfo();
BeanUtils.copyProperties(item, performInfo, BeanUtil.getNullPropertyNames(item));
performInfo.setPerformType(PerformTypeEnum.考勤绩效.getValue());
return performInfo;
}).collect(Collectors.toList());
model.put(KEY_RESULT_DATA, collect);
model.put(PAGEINFO_KEY, result.getPageInfo());
parsePageInfo(model, result.getPageInfo());
} else if (PerformTypeEnum.评价差评绩效.getValue().equals(performReq.getPerformType())) { } else if (PerformTypeEnum.评价差评绩效.getValue().equals(performReq.getPerformType())) {
} else if (PerformTypeEnum.评价投诉绩效.getValue().equals(performReq.getPerformType())) { } else if (PerformTypeEnum.评价投诉绩效.getValue().equals(performReq.getPerformType())) {
...@@ -94,7 +140,6 @@ public class PerformApiController extends BaseJsonBodyController { ...@@ -94,7 +140,6 @@ public class PerformApiController extends BaseJsonBodyController {
throw new AppException("不支持当前绩效类型"); throw new AppException("不支持当前绩效类型");
} }
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e);
...@@ -141,6 +186,29 @@ public class PerformApiController extends BaseJsonBodyController { ...@@ -141,6 +186,29 @@ public class PerformApiController extends BaseJsonBodyController {
return rest; return rest;
} }
protected PageInfo buildPageInfo(PerformReq query) {
PageInfo pageInfo = new PageInfo();
if (!ObjectUtils.isEmpty(query) && !ObjectUtils.isEmpty(query.getPage())) {
pageInfo.setCurrPage(query.getPage());
}
if (!ObjectUtils.isEmpty(query) && !ObjectUtils.isEmpty(query.getSize())) {
pageInfo.setPrePageResult(query.getSize());
}
return pageInfo;
}
protected void parsePageInfo(Map<String, Object> model, PageInfo pageInfo) {
model.put(TOTAL, pageInfo.getTotalResult());
model.put(PER_PAGE, pageInfo.getPrePageResult());
model.put(CURRENT_PAGE, pageInfo.getCurrPage());
model.put(LAST_PAGE, pageInfo.getTotalPage());
model.put(PAGEINFO_KEY, pageInfo);
}
public static void main(String[] args) { public static void main(String[] args) {
} }
......
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