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

添加申诉统计业务

parent edbbb9ac
package com.mortals.xhx.busiz.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
import lombok.Data;
import java.util.Date;
@Data
public class InspectSaveReq extends BaseReq {
/**
* 所属考勤组ID
*/
private Long attendanceGroupId;
/**
* 所属考勤组名称
*/
private String attendanceGroupName;
/**
* 考勤时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date attendanceDate;
/**
* 异常时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date errorTime;
/**
* 上下班时间
*/
private String goOffTimeStr;
/**
* 实际打卡时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date actualAttendTime;
/**
* 异常处理结果
*/
private String errorResult;
}
package com.mortals.xhx.busiz.web;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
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.xhx.busiz.req.AppealReq;
import com.mortals.xhx.busiz.req.PerformReq;
import com.mortals.xhx.busiz.rsp.AppealStatInfo;
import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.common.code.ProcessStatusEnum;
import com.mortals.xhx.common.utils.BeanUtil;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static com.mortals.framework.ap.SysConstains.*;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
/**
* h5 巡查
*
* @author: zxfei
* @date: 2023/7/7 15:08
*/
@RestController
@Slf4j
@RequestMapping("/api/v1/inspect")
public class InspectApiController extends AbstractBaseController<PerformReq> {
@Autowired
private CheckAttendRecordService checkAttendRecordService;
@Autowired
private CheckReviewRecordService checkReviewRecordService;
@Autowired
private CheckComplainRecordService checkComplainRecordService;
@Autowired
private CheckEffectRecordService checkEffectRecordService;
@Autowired
private CheckGoworkRecordService checkGoworkRecordService;
@Autowired
private CheckOtherRecordService checkOtherRecordService;
@Autowired
private PerformAttendAppealService appealService;
/**
* 个人申诉绩效统计
*/
@PostMapping(value = "stat")
public Rest<AppealStatInfo> appealStat() {
String busiDesc = "H5个人申诉绩效统计";
Rest<AppealStatInfo> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
if (ObjectUtils.isEmpty(context) || ObjectUtils.isEmpty(context.getUser())) {
throw new AppException(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT);
}
log.info("【{}】【请求体】--> 用户:{}", busiDesc, context.getUser().getRealName());
try {
//todo 查询当前登录人的绩效分数
AppealStatInfo appealStatInfo = new AppealStatInfo();
appealStatInfo.setTotalScore(new BigDecimal("10.52"));
appealStatInfo.setTotalTimes(12);
appealStatInfo.setTodayScore(new BigDecimal("2.5"));
appealStatInfo.setTodayTimes(3);
rest.setData(appealStatInfo);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 巡查新增
*/
@PostMapping(value = "save")
public Rest<PerformAttendAppealEntity> appealSave(@RequestBody AppealReq req) {
String busiDesc = "个人申诉新增";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(req));
Rest<PerformAttendAppealEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext();
try {
//根据状态 查询 当前是否已经存在正在进行的申诉
if (ObjectUtils.isEmpty(req.getId())) throw new AppException("核查记录Id不能为空!");
if (ObjectUtils.isEmpty(req.getPerformType())) throw new AppException("绩效类型不能为空!");
//查询当前核查是否已存在进行中的申诉记录
PerformAttendAppealEntity appealEntity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(req.getId()));
if (!ObjectUtils.isEmpty(appealEntity) && appealEntity.getProcessStatus() == ProcessStatusEnum.未处理.getValue()) {
throw new AppException("当前绩效核查已经存在正在进行中的申诉记录!");
}
PerformAttendAppealEntity entity = new PerformAttendAppealEntity();
entity.initAttrValue();
if (PerformTypeEnum.考勤绩效.getValue().equals(req.getPerformType())) {
CheckAttendRecordEntity checkEntity = checkAttendRecordService.get(req.getId(), context);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity));
} else if (PerformTypeEnum.评价差评绩效.getValue().equals(req.getPerformType())) {
CheckReviewRecordEntity checkEntity = checkReviewRecordService.get(req.getId(), context);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity));
} else if (PerformTypeEnum.评价投诉绩效.getValue().equals(req.getPerformType())) {
CheckComplainRecordEntity checkEntity = checkComplainRecordService.get(req.getId(), context);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity));
} else if (PerformTypeEnum.办件绩效.getValue().equals(req.getPerformType())) {
CheckGoworkRecordEntity checkEntity = checkGoworkRecordService.get(req.getId(), context);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity));
} else if (PerformTypeEnum.效能绩效.getValue().equals(req.getPerformType())) {
CheckEffectRecordEntity checkEntity = checkEffectRecordService.get(req.getId(), context);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity));
} else if (PerformTypeEnum.其它绩效.getValue().equals(req.getPerformType())) {
CheckOtherRecordEntity checkEntity = checkOtherRecordService.get(req.getId(), context);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity));
} else {
throw new AppException("不支持当前绩效类型");
}
entity.setPerformType(req.getPerformType());
entity.setPerformAttendAppealFilesList(req.getPerformAttendAppealFilesList());
entity.setProcessStatus(1);
entity.setAppealDesc(req.getAppealDesc());
PerformAttendAppealEntity saveEntity = appealService.save(entity, context);
rest.setData(saveEntity);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
log.info("【{}】【响应体】--> {}", busiDesc, JSONObject.toJSONString(req));
return rest;
}
protected PageInfo buildPageInfo(AppealReq 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) {
}
}
......@@ -98,7 +98,8 @@ public class PerformApiController extends AbstractBaseController<PerformReq> {
performStatInfo.setTotalScore(new BigDecimal("15.9"));
performStatInfo.setTotalTimes(12);
performStatInfo.setTodayScore(new BigDecimal("12.6"));
performStatInfo.setTodayTimes(11);
performStatInfo.setTodayTimes(4);
rest.setData(performStatInfo);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
......
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