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

添加申诉统计业务

parent 1b581f7d
...@@ -21,8 +21,6 @@ public abstract class BaseReq implements Serializable { ...@@ -21,8 +21,6 @@ public abstract class BaseReq implements Serializable {
/** /**
* 工号 * 工号
*/ */
......
...@@ -9,6 +9,7 @@ import java.util.Date; ...@@ -9,6 +9,7 @@ import java.util.Date;
@Data @Data
public class InspectSaveReq extends BaseReq { public class InspectSaveReq extends BaseReq {
//考勤
/** /**
* 所属考勤组ID * 所属考勤组ID
*/ */
...@@ -42,8 +43,112 @@ public class InspectSaveReq extends BaseReq { ...@@ -42,8 +43,112 @@ public class InspectSaveReq extends BaseReq {
*/ */
private String errorResult; private String errorResult;
//评价
/**
* 评价结果(1.非常不满意,2.差评)
*/
private Integer reviewResult;
/**
* 评价时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date reviewTime;
/**
* 评价来源(窗口评价系统,导视系统,自助服务系统,微官网,其它)
*/
private String reviewSource;
/**
* 评价设备
*/
private String reviewDevice;
//投诉
/**
* 投诉标题
*/
private String complainTitle;
/**
* 投诉内容
*/
private String complainContent;
/**
* 投诉人真实姓名
*/
private String complainRealName;
/**
* 联系电话
*/
private String contact;
/**
* 投诉时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date complainTime;
/**
* 投诉来源
*/
private String complainSource;
/**
* 投诉设备
*/
private String complainDevice;
//办件
/**
* 办件编码
*/
private String goworkCode;
/**
* 办件所属部门
*/
private String goworkDepts;
/**
* 事项名称
*/
private String matterlName;
/**
* 办理时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date goworkTime;
//效能
/**
* 违规类型(1.脱岗,2.离岗,3.玩手机,4.睡觉)
*/
private Integer irregularType;
/**
* 发生时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date happenTime;
/**
* 持续时间,秒
*/
private Integer duration;
/**
* 报警时间
*/
private Date alarmTime;
//其它
/**
* 违规类型(1.工作纪律)
*/
private Integer irregularOtherType;
// /**
// * 发生时间
// */
// @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
// private Date happenTime;
/**
* 评分标准
*/
private String ruleDesc;
} }
...@@ -105,6 +105,8 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> { ...@@ -105,6 +105,8 @@ public class FeedbackApiController extends AbstractBaseController<FeedbackReq> {
model.put(PAGEINFO_KEY, pageAllInfo); model.put(PAGEINFO_KEY, pageAllInfo);
parsePageInfo(model, pageAllInfo); parsePageInfo(model, pageAllInfo);
rest.setData(model);
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e);
......
...@@ -7,17 +7,18 @@ import com.mortals.framework.exception.AppException; ...@@ -7,17 +7,18 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.xhx.busiz.req.AppealReq; import com.mortals.xhx.busiz.req.*;
import com.mortals.xhx.busiz.req.PerformReq;
import com.mortals.xhx.busiz.rsp.AppealStatInfo; import com.mortals.xhx.busiz.rsp.AppealStatInfo;
import com.mortals.xhx.common.code.PerformTypeEnum; import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.common.code.ProcessStatusEnum; import com.mortals.xhx.common.code.ProcessStatusEnum;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.*; import com.mortals.xhx.module.check.model.*;
import com.mortals.xhx.module.check.service.*; import com.mortals.xhx.module.check.service.*;
import com.mortals.xhx.module.perform.model.PerformAttendAppealEntity; import com.mortals.xhx.module.perform.model.*;
import com.mortals.xhx.module.perform.model.PerformAttendAppealQuery; import com.mortals.xhx.module.perform.service.*;
import com.mortals.xhx.module.perform.service.PerformAttendAppealService; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -47,107 +48,64 @@ import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT; ...@@ -47,107 +48,64 @@ import static com.mortals.xhx.common.key.ErrorCode.ERROR_TOKEN_EXPIRED_CONTENT;
@RequestMapping("/api/v1/inspect") @RequestMapping("/api/v1/inspect")
public class InspectApiController extends AbstractBaseController<PerformReq> { public class InspectApiController extends AbstractBaseController<PerformReq> {
@Autowired @Autowired
private CheckAttendRecordService checkAttendRecordService; private PerformAttendRecordService attendRecordService;
@Autowired @Autowired
private CheckReviewRecordService checkReviewRecordService; private PerformReviewRecordService reviewRecordService;
@Autowired @Autowired
private CheckComplainRecordService checkComplainRecordService; private PerformComplainRecordService complainRecordService;
@Autowired @Autowired
private CheckEffectRecordService checkEffectRecordService; private PerformGoworkRecordService performGoworkRecordService;
@Autowired @Autowired
private CheckGoworkRecordService checkGoworkRecordService; private PerformEffectRecordService effectRecordService;
@Autowired @Autowired
private CheckOtherRecordService checkOtherRecordService; private PerformOtherRecordService otherRecordService;
@Autowired @Autowired
private PerformAttendAppealService appealService; private PerformRulesService rulesService;
@Autowired
private StaffService staffService;
/**
* 个人申诉绩效统计
*/
@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") @PostMapping(value = "save")
public Rest<PerformAttendAppealEntity> appealSave(@RequestBody AppealReq req) { public Rest<PerformAttendAppealEntity> appealSave(@RequestBody InspectSaveReq req) {
String busiDesc = "个人申诉新增"; String busiDesc = "个人巡查记录新增";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(req)); log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(req));
Rest<PerformAttendAppealEntity> rest = Rest.ok(busiDesc + " 【成功】"); Rest<PerformAttendAppealEntity> rest = Rest.ok(busiDesc + " 【成功】");
Context context = this.getContext(); Context context = this.getContext();
try { try {
//根据状态 查询 当前是否已经存在正在进行的申诉 //根据状态 查询 当前是否已经存在正在进行的申诉
if (ObjectUtils.isEmpty(req.getId())) throw new AppException("核查记录Id不能为空!");
if (ObjectUtils.isEmpty(req.getPerformType())) throw new AppException("绩效类型不能为空!"); if (ObjectUtils.isEmpty(req.getPerformType())) throw new AppException("绩效类型不能为空!");
//查询当前核查是否已存在进行中的申诉记录 if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
PerformAttendAppealEntity appealEntity = appealService.selectOne(new PerformAttendAppealQuery().checkRecordId(req.getId())); if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
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));
if (PerformTypeEnum.考勤绩效.getValue().equals(req.getPerformType())) {
boolean bool = attend(req);
if (!bool) throw new AppException(busiDesc + "失败!");
} else if (PerformTypeEnum.评价差评绩效.getValue().equals(req.getPerformType())) { } else if (PerformTypeEnum.评价差评绩效.getValue().equals(req.getPerformType())) {
CheckReviewRecordEntity checkEntity = checkReviewRecordService.get(req.getId(), context); boolean bool = review(req);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); if (!bool) throw new AppException(busiDesc + "失败!");
} else if (PerformTypeEnum.评价投诉绩效.getValue().equals(req.getPerformType())) { } else if (PerformTypeEnum.评价投诉绩效.getValue().equals(req.getPerformType())) {
CheckComplainRecordEntity checkEntity = checkComplainRecordService.get(req.getId(), context); boolean bool = complain(req);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); if (!bool) throw new AppException(busiDesc + "失败!");
} else if (PerformTypeEnum.办件绩效.getValue().equals(req.getPerformType())) { } else if (PerformTypeEnum.办件绩效.getValue().equals(req.getPerformType())) {
CheckGoworkRecordEntity checkEntity = checkGoworkRecordService.get(req.getId(), context); boolean bool = gowork(req);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); if (!bool) throw new AppException(busiDesc + "失败!");
} else if (PerformTypeEnum.效能绩效.getValue().equals(req.getPerformType())) { } else if (PerformTypeEnum.效能绩效.getValue().equals(req.getPerformType())) {
CheckEffectRecordEntity checkEntity = checkEffectRecordService.get(req.getId(), context); boolean bool = effect(req);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); if (!bool) throw new AppException(busiDesc + "失败!");
} else if (PerformTypeEnum.其它绩效.getValue().equals(req.getPerformType())) { } else if (PerformTypeEnum.其它绩效.getValue().equals(req.getPerformType())) {
CheckOtherRecordEntity checkEntity = checkOtherRecordService.get(req.getId(), context); boolean bool = other(req);
BeanUtils.copyProperties(checkEntity, entity, BeanUtil.getNullPropertyNames(checkEntity)); if (!bool) throw new AppException(busiDesc + "失败!");
} else { } else {
throw new AppException("不支持当前绩效类型"); 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 + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e);
...@@ -158,20 +116,181 @@ public class InspectApiController extends AbstractBaseController<PerformReq> { ...@@ -158,20 +116,181 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
} }
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;
private boolean attend(InspectSaveReq req) throws AppException {
//考勤保存
//通过手机号码查询员工属性
PerformRulesEntity rule = getRule(req.getRuleCode());
StaffEntity staffEntity = getStaff(req.getPhone());
PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity();
recordEntity.initAttrValue();
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleNme(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date());
PerformAttendRecordEntity save = attendRecordService.save(recordEntity);
return save.newEntity();
} }
private boolean review(InspectSaveReq req) throws AppException {
//评价保存
StaffEntity staffEntity = getStaff(req.getPhone());
PerformRulesEntity rule = getRule(req.getRuleCode());
PerformReviewRecordEntity recordEntity = new PerformReviewRecordEntity();
recordEntity.initAttrValue();
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleName(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date());
PerformReviewRecordEntity save = reviewRecordService.save(recordEntity);
return save.newEntity();
}
private boolean complain(InspectSaveReq req) throws AppException {
//投诉保存
StaffEntity staffEntity = getStaff(req.getPhone());
PerformRulesEntity rule = getRule(req.getRuleCode());
PerformComplainRecordEntity recordEntity = new PerformComplainRecordEntity();
recordEntity.initAttrValue();
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleName(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date());
PerformComplainRecordEntity save = complainRecordService.save(recordEntity);
return save.newEntity();
}
private boolean gowork(InspectSaveReq req) throws AppException {
//办件保存
StaffEntity staffEntity = getStaff(req.getPhone());
PerformRulesEntity rule = getRule(req.getRuleCode());
PerformGoworkRecordEntity recordEntity = new PerformGoworkRecordEntity();
recordEntity.initAttrValue();
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleName(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date());
PerformGoworkRecordEntity save = performGoworkRecordService.save(recordEntity);
return save.newEntity();
}
private boolean effect(InspectSaveReq req) throws AppException {
//效能保存
StaffEntity staffEntity = getStaff(req.getPhone());
PerformRulesEntity rule = getRule(req.getRuleCode());
PerformEffectRecordEntity recordEntity = new PerformEffectRecordEntity();
recordEntity.initAttrValue();
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleName(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date());
PerformEffectRecordEntity save = effectRecordService.save(recordEntity);
return save.newEntity();
}
private boolean other(InspectSaveReq req) throws AppException {
//其它保存
StaffEntity staffEntity = getStaff(req.getPhone());
PerformRulesEntity rule = getRule(req.getRuleCode());
PerformOtherRecordEntity recordEntity = new PerformOtherRecordEntity();
recordEntity.initAttrValue();
BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId());
recordEntity.setRuleName(rule.getName());
recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date());
PerformOtherRecordEntity save = otherRecordService.save(recordEntity);
return save.newEntity();
}
private PerformRulesEntity getRule(String ruleCode) {
PerformRulesEntity rule = rulesService.getCache(ruleCode);
if (ObjectUtils.isEmpty(rule))
throw new AppException(String.format("当前手机号码未找到匹配的员工!rule:%s", ruleCode));
return rule;
}
private StaffEntity getStaff(String phone) {
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(phone));
if (ObjectUtils.isEmpty(staffEntity))
throw new AppException(String.format("当前手机号码未找到匹配的员工!phone:%s", phone));
return staffEntity;
}
protected void parsePageInfo(Map<String, Object> model, PageInfo pageInfo) { protected void parsePageInfo(Map<String, Object> model, PageInfo pageInfo) {
model.put(TOTAL, pageInfo.getTotalResult()); model.put(TOTAL, pageInfo.getTotalResult());
model.put(PER_PAGE, pageInfo.getPrePageResult()); model.put(PER_PAGE, pageInfo.getPrePageResult());
......
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