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

添加外部数据来源实现

parent 77293de4
...@@ -6,11 +6,10 @@ import com.mortals.xhx.common.code.ProcessStatusEnum; ...@@ -6,11 +6,10 @@ import com.mortals.xhx.common.code.ProcessStatusEnum;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
@Data @Data
public abstract class BaseReq implements Serializable { public abstract class BaseReq implements Serializable {
/** /**
* 当前页 * 当前页
*/ */
...@@ -21,4 +20,35 @@ public abstract class BaseReq implements Serializable { ...@@ -21,4 +20,35 @@ public abstract class BaseReq implements Serializable {
private Integer size; private Integer size;
/**
* 工号
*/
private String workNum;
/**
* 标题
*/
private String title;
/**
* 扣分时间
*/
private Date happenTime;
/**
* 规则编码
*/
private String ruleCode;
private String phone;
/**
* 类型
*/
private String performType;
} }
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.busiz.dingtalk.config.TalkConfiguration; import com.mortals.xhx.busiz.dingtalk.config.TalkConfiguration;
import com.mortals.xhx.busiz.dingtalk.req.DingTalkBaseReq; import com.mortals.xhx.busiz.dingtalk.req.DingTalkBaseReq;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
...@@ -29,6 +30,7 @@ public class TalkApiController { ...@@ -29,6 +30,7 @@ public class TalkApiController {
private TalkConfiguration talkConfiguration; private TalkConfiguration talkConfiguration;
/** /**
* 获取token * 获取token
* *
...@@ -39,8 +41,6 @@ public class TalkApiController { ...@@ -39,8 +41,6 @@ public class TalkApiController {
log.info("收到【getToken】请求【请求体】--> {}", JSON.toJSONString(dingTalkBaseReq)); log.info("收到【getToken】请求【请求体】--> {}", JSON.toJSONString(dingTalkBaseReq));
try { try {
// DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken"); // DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/gettoken");
// OapiGettokenRequest req = new OapiGettokenRequest(); // OapiGettokenRequest req = new OapiGettokenRequest();
// req.setHttpMethod("GET"); // req.setHttpMethod("GET");
......
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 AttendSaveReq 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;
/**
* 扩展字段
*/
private String ext;
}
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 ComplainSaveReq extends BaseReq {
/**
* 投诉标题
*/
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;
}
package com.mortals.xhx.busiz.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.xhx.busiz.BaseReq;
import lombok.Data;
import java.util.Date;
@Data
public class EffectSaveReq extends BaseReq {
/**
* 违规类型(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;
}
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 GoWorkSaveReq extends BaseReq {
/**
* 办件编码
*/
private String goworkCode;
/**
* 办件所属部门
*/
private String goworkDepts;
/**
* 事项名称
*/
private String matterlName;
/**
* 办理时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date goworkTime;
/**
* 扩展字段
*/
private String ext;
}
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 OtherSaveReq extends BaseReq {
/**
* 违规类型(1.工作纪律)
*/
private Integer irregularOtherType;
/**
* 发生时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date happenTime;
/**
* 评分标准
*/
private String ruleDesc;
/**
* 扩展字段
*/
private String ext;
}
package com.mortals.xhx.busiz.req; package com.mortals.xhx.busiz.req;
import com.mortals.framework.annotation.Excel; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq; import com.mortals.xhx.busiz.BaseReq;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@Data @Data
public class PerformSaveReq extends BaseReq { public class ReviewSaveReq extends BaseReq {
/**
* 工号
*/
private String workNum;
/**
* 标题
*/
private String title;
/**
* 扣分时间
*/
private Date happenTime;
/**
* 规则编码
*/
private String ruleCode;
private String phone;
/**
* 类型
*/
private String performType;
/** /**
* 评价结果(1.非常不满意,2.差评) * 评价结果(1.非常不满意,2.差评)
...@@ -47,6 +17,7 @@ public class PerformSaveReq extends BaseReq { ...@@ -47,6 +17,7 @@ public class PerformSaveReq extends BaseReq {
/** /**
* 评价时间 * 评价时间
*/ */
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
private Date reviewTime; private Date reviewTime;
/** /**
* 评价来源(窗口评价系统,导视系统,自助服务系统,微官网,其它) * 评价来源(窗口评价系统,导视系统,自助服务系统,微官网,其它)
...@@ -57,4 +28,6 @@ public class PerformSaveReq extends BaseReq { ...@@ -57,4 +28,6 @@ public class PerformSaveReq extends BaseReq {
*/ */
private String reviewDevice; private String reviewDevice;
} }
...@@ -119,6 +119,8 @@ public class PerformDetailInfo { ...@@ -119,6 +119,8 @@ public class PerformDetailInfo {
*/ */
private String filePaths; private String filePaths;
/** /**
* 评价结果(1.非常不满意,2.差评) * 评价结果(1.非常不满意,2.差评)
*/ */
......
...@@ -2,20 +2,20 @@ package com.mortals.xhx.busiz.web; ...@@ -2,20 +2,20 @@ package com.mortals.xhx.busiz.web;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.xhx.base.framework.annotation.ApiUserAuth; import com.mortals.xhx.base.framework.annotation.ApiUserAuth;
import com.mortals.xhx.busiz.req.PerformReq; import com.mortals.xhx.busiz.req.*;
import com.mortals.xhx.busiz.req.PerformSaveReq;
import com.mortals.xhx.busiz.rsp.ApiResp; import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.ApiRespCodeEnum; import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.common.code.PerformTypeEnum; import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.module.perform.model.PerformAttendRecordEntity; import com.mortals.xhx.module.perform.model.*;
import com.mortals.xhx.module.perform.model.PerformReviewRecordEntity;
import com.mortals.xhx.module.perform.model.PerformRulesEntity;
import com.mortals.xhx.module.perform.service.*; import com.mortals.xhx.module.perform.service.*;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffQuery; import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import javafx.scene.effect.Effect;
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;
...@@ -30,7 +30,7 @@ import java.util.Date; ...@@ -30,7 +30,7 @@ import java.util.Date;
@RestController @RestController
@Slf4j @Slf4j
@RequestMapping("/api/v1/web/perform") @RequestMapping("/api/v1/web/")
public class ApiWebPerformController extends AbstractBaseController<PerformReq> { public class ApiWebPerformController extends AbstractBaseController<PerformReq> {
@Autowired @Autowired
...@@ -52,65 +52,173 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -52,65 +52,173 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
/** /**
* 绩效外部新增 * 考勤新增
* *
* @param req * @param req
* @return * @return
*/ */
@PostMapping("save") @PostMapping("attend/save")
@ApiUserAuth @UnAuth
public String receive(HttpServletRequest request, @RequestBody PerformSaveReq req) { public Rest<Void> attendSave(@RequestBody AttendSaveReq req) {
ApiResp<String> rsp = new ApiResp<>();
rsp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel()); String busiDesc = "外部考勤新增";
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue()); Rest rest = Rest.ok(busiDesc + "成功!");
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req))); message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req)));
try { try {
if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!"); if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!"); if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
boolean bool = attend(req);
if (!bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) {
log.error(busiDesc, e);
return Rest.fail(e.getMessage());
}
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
return rest;
}
/**
* 评价新增
*
* @param req
* @return
*/
@PostMapping("review/save")
@UnAuth
public Rest<Void> reviewSave(@RequestBody ReviewSaveReq req) {
switch (PerformTypeEnum.getByValue(req.getPerformType())) { String busiDesc = "外部评价新增";
case 考勤绩效: Rest rest = Rest.ok(busiDesc + "成功!");
attend(req); StringBuilder message = new StringBuilder();
break; message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req)));
case 评价差评绩效: try {
review(req); if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
break; if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
case 评价投诉绩效: boolean bool = review(req);
complain(req); if (!bool) throw new AppException(busiDesc + "失败!");
break; } catch (Exception e) {
case 办件绩效: log.error(busiDesc, e);
gowork(req); return Rest.fail(e.getMessage());
break; }
case 效能绩效: log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
effect(req); return rest;
break; }
case 其它绩效:
other(req); /**
break; * 投诉新增
} *
} catch (AppException e) { * @param req
log.error("接收数据失败", e); * @return
rsp.setCode(e.getCode()); */
rsp.setMsg(e.getMessage()); @PostMapping("complain/save")
return JSON.toJSONString(rsp); @UnAuth
public Rest<Void> complainSave(@RequestBody ComplainSaveReq req) {
String busiDesc = "外部投诉新增";
Rest rest = Rest.ok(busiDesc + "成功!");
StringBuilder message = new StringBuilder();
message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req)));
try {
if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
boolean bool = complain(req);
if (!bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) {
log.error(busiDesc, e);
return Rest.fail(e.getMessage());
}
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
return rest;
}
/**
* 办件新增
*
* @param req
* @return
*/
@PostMapping("gowork/save")
@UnAuth
public Rest<Void> goworkSave(@RequestBody GoWorkSaveReq req) {
String busiDesc = "外部办件新增";
Rest rest = Rest.ok(busiDesc + "成功!");
StringBuilder message = new StringBuilder();
message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req)));
try {
if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
boolean bool = gowork(req);
if (!bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) {
log.error(busiDesc, e);
return Rest.fail(e.getMessage());
}
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
return rest;
}
/**
* 效能新增
*
* @param req
* @return
*/
@PostMapping("effect/save")
@UnAuth
public Rest<Void> effectSave(@RequestBody EffectSaveReq req) {
String busiDesc = "外部效能新增";
Rest rest = Rest.ok(busiDesc + "成功!");
StringBuilder message = new StringBuilder();
message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req)));
try {
if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
boolean bool = effect(req);
if (!bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) {
log.error(busiDesc, e);
return Rest.fail(e.getMessage());
}
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
return rest;
}
/**
* 其它新增
*
* @param req
* @return
*/
@PostMapping("other/save")
@UnAuth
public Rest<Void> otherSave(@RequestBody OtherSaveReq req) {
String busiDesc = "外部其它绩效新增";
Rest rest = Rest.ok(busiDesc + "成功!");
StringBuilder message = new StringBuilder();
message.append(String.format("【外部请求】类型【%s】 内容:%s", PerformTypeEnum.getByValue(req.getPerformType()).getDesc(), JSONObject.toJSONString(req)));
try {
if (ObjectUtils.isEmpty(req.getPhone())) throw new AppException("手机号码不能为空!");
if (ObjectUtils.isEmpty(req.getRuleCode())) throw new AppException("绩效规则编码不能为空!");
boolean bool = other(req);
if (!bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) { } catch (Exception e) {
log.error("接收数据失败", e); log.error(busiDesc, e);
rsp.setCode(ApiRespCodeEnum.FAILED.getValue()); return Rest.fail(e.getMessage());
rsp.setMsg(e.getMessage());
return JSON.toJSONString(rsp);
} }
recordSysLog(request, message.toString()); log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
log.info("响应【设备接收】【响应体】--> " + JSONObject.toJSONString(rsp)); return rest;
return JSON.toJSONString(rsp);
} }
private void attend(PerformSaveReq req) throws AppException {
private boolean attend(AttendSaveReq req) throws AppException {
//考勤保存 //考勤保存
//通过手机号码查询员工属性 //通过手机号码查询员工属性
StaffEntity staffEntity = getStaff(req); PerformRulesEntity rule = getRule(req.getRuleCode());
PerformRulesEntity rule = getRule(req); StaffEntity staffEntity = getStaff(req.getPhone());
PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity(); PerformAttendRecordEntity recordEntity = new PerformAttendRecordEntity();
recordEntity.initAttrValue(); recordEntity.initAttrValue();
...@@ -126,17 +234,19 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -126,17 +234,19 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCategoryId(rule.getCategoryId()); recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName()); recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
attendRecordService.save(recordEntity); PerformAttendRecordEntity save = attendRecordService.save(recordEntity);
return save.newEntity();
} }
private void review(PerformSaveReq req) throws AppException { private boolean review(ReviewSaveReq req) throws AppException {
//评价保存 //评价保存
StaffEntity staffEntity = getStaff(req); StaffEntity staffEntity = getStaff(req.getPhone());
PerformRulesEntity rule = getRule(req); PerformRulesEntity rule = getRule(req.getRuleCode());
PerformReviewRecordEntity recordEntity = new PerformReviewRecordEntity(); PerformReviewRecordEntity recordEntity = new PerformReviewRecordEntity();
...@@ -144,8 +254,6 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -144,8 +254,6 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
BeanUtils.copyProperties(req, recordEntity); BeanUtils.copyProperties(req, recordEntity);
recordEntity.setStaffId(staffEntity.getId()); recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName()); recordEntity.setStaffName(staffEntity.getName());
recordEntity.setSubAddType(rule.getSubAddType()); recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore()); recordEntity.setScore(rule.getScore());
recordEntity.setRuleId(rule.getId()); recordEntity.setRuleId(rule.getId());
...@@ -153,49 +261,130 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -153,49 +261,130 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCategoryId(rule.getCategoryId()); recordEntity.setCategoryId(rule.getCategoryId());
recordEntity.setCategoryName(rule.getCategoryName()); recordEntity.setCategoryName(rule.getCategoryName());
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
reviewRecordService.save(recordEntity); PerformReviewRecordEntity save = reviewRecordService.save(recordEntity);
return save.newEntity();
} }
private void complain(PerformSaveReq req) throws AppException { private boolean complain(ComplainSaveReq 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 void gowork(PerformSaveReq req) throws AppException { private boolean gowork(GoWorkSaveReq 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 void effect(PerformSaveReq req) throws AppException { private boolean effect(EffectSaveReq 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 void other(PerformSaveReq req) throws AppException { private boolean other(OtherSaveReq 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(PerformSaveReq req) { private PerformRulesEntity getRule(String ruleCode) {
PerformRulesEntity rule = rulesService.getCache(req.getRuleCode()); PerformRulesEntity rule = rulesService.getCache(ruleCode);
if (ObjectUtils.isEmpty(rule)) if (ObjectUtils.isEmpty(rule))
throw new AppException(String.format("当前手机号码未找到匹配的员工!rule:%s", req.getPhone())); throw new AppException(String.format("当前手机号码未找到匹配的员工!rule:%s", ruleCode));
return rule; return rule;
} }
private StaffEntity getStaff(PerformSaveReq req) { private StaffEntity getStaff(String phone) {
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(req.getPhone())); StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(phone));
if (ObjectUtils.isEmpty(staffEntity)) if (ObjectUtils.isEmpty(staffEntity))
throw new AppException(String.format("当前手机号码未找到匹配的员工!phone:%s", req.getPhone())); throw new AppException(String.format("当前手机号码未找到匹配的员工!phone:%s", phone));
return staffEntity; return staffEntity;
} }
public static void main(String[] args) { public static void main(String[] args) {
} }
......
...@@ -34,8 +34,7 @@ public class TestController { ...@@ -34,8 +34,7 @@ public class TestController {
public String idGens() { public String idGens() {
log.info("测试id生成"); log.info("测试id生成");
String stringId = idgeneratorService.getLongId(IdgeneratorServiceImpl.IdGeneratorKey.EFFECT).toString(); String stringId = idgeneratorService.getLongId(IdgeneratorServiceImpl.IdGeneratorKey.EFFECT_KEY).toString();
return stringId; return stringId;
} }
......
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