Commit 0cac0506 authored by 赵啸非's avatar 赵啸非

添加钉钉接口相关

parent 99cc36d4
......@@ -9,18 +9,11 @@ public class RedisKey {
* 登录 key
*/
public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:";
/**
* 设备心跳上报
*/
public static final String KEY_DEVICE_ONLINE_CACHE = "device:online:";
public static final String KEY_SITE_CACHE = "siteDict";
public static final String KEY_PLATFORM_CACHE = "platformDict";
public static final String KEY_PRODUCT_CACHE = "productDict";
/**
* 钉钉 访问token
*/
public static final String KEY_DINGTALK_ACCESSTOKEN_CACHE = "dingtalk:token:";
public static final String KEY_TOKEN_API_CACHE = "token:api:";
}
......@@ -83,9 +83,9 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
msg.setMsgtype("link");
Link link = new Link();
link.setPicUrl("测试图片链接");
link.setMessageUrl("测试消息链接");
link.setText("测试文本");
link.setTitle("测试标题");
link.setMessageUrl("http://www.baidu.com");
link.setText("你有一条绩效考核核查通知,请及时查看!");
link.setTitle("绩效考核核查通知");
msg.setLink(link);
workMsgReq.setUseridList(personRest.getMsg());
......
......@@ -7,9 +7,12 @@ import com.dingtalk.api.response.OapiGettokenResponse;
import com.hikvision.artemis.sdk.config.ArtemisConfig;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ICacheService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.ApiRespPdu;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
......@@ -32,7 +35,7 @@ public abstract class AbstractDingTalkService implements IDingPersonService {
protected Long agentId;
/**
* AgentId
* domain
*/
@Value("${dingtalk.domain:https://oapi.dingtalk.com}")
protected String domain;
......@@ -49,43 +52,38 @@ public abstract class AbstractDingTalkService implements IDingPersonService {
@Value("${dingtalk.AppSecret:''}")
protected String appSecret;
/**
* getToken
*/
@Value("${dingtalk.gettoken:https://oapi.dingtalk.com/gettoken}")
protected String getTokneUrl;
protected String dingToken;
@Autowired
private ICacheService cacheService;
protected DingTalkClient getDingTalkClient(String path) {
DingTalkClient client = new DefaultDingTalkClient(domain + path);
return client;
}
protected void checkToken() {
if (ObjectUtils.isEmpty(dingToken)) {
dingToken = getToken().getData();
}
}
@Override
public Rest<String> getToken() {
public String getToken() {
try {
DingTalkClient client = getDingTalkClient("/gettoken");
OapiGettokenRequest req = new OapiGettokenRequest();
req.setAppkey(appKey);
req.setAppsecret(appSecret);
OapiGettokenResponse rsp = client.execute(req);
log.info("OapiGettokenResponse:{}",rsp.getBody());
if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getAccessToken());
String dingToken = cacheService.get(RedisKey.KEY_DINGTALK_ACCESSTOKEN_CACHE);
if (ObjectUtils.isEmpty(dingToken)) {
DingTalkClient client = getDingTalkClient("/gettoken");
OapiGettokenRequest req = new OapiGettokenRequest();
req.setAppkey(appKey);
req.setAppsecret(appSecret);
OapiGettokenResponse rsp = client.execute(req);
log.info("OapiGettokenResponse:{}", rsp.getBody());
if (rsp.getErrcode() == 0) {
cacheService.setex(RedisKey.KEY_DINGTALK_ACCESSTOKEN_CACHE, rsp.getAccessToken(), 4800);
return rsp.getAccessToken();
} else {
throw new AppException(String.format("code:{},errorMsg:{}", rsp.getErrcode(), rsp.getErrmsg()));
}
} else {
throw new AppException(rsp.getMessage());
return dingToken;
}
} catch (Exception e) {
log.error("获取TOKEN异常", e);
return Rest.fail(e.getMessage());
throw new AppException(e.getMessage());
}
}
......
......@@ -3,5 +3,5 @@ package com.mortals.xhx.module.dingding;
import com.mortals.framework.common.Rest;
public interface IDingTalkService {
Rest<String> getToken();
String getToken();
}
......@@ -24,11 +24,10 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
public Rest<String> getPersonByMobile(String mobile) {
try {
DingTalkClient client = getDingTalkClient("/topapi/v2/user/getbymobile");
checkToken();
OapiV2UserGetbymobileRequest req = new OapiV2UserGetbymobileRequest();
req.setMobile(mobile);
log.info("getPersonByMobile:{}",mobile);
OapiV2UserGetbymobileResponse rsp = client.execute(req, dingToken);
OapiV2UserGetbymobileResponse rsp = client.execute(req, getToken());
log.info("OapiV2UserGetbymobileResponse:{}",rsp.getBody());
if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getResult().getUserid());
......@@ -45,13 +44,13 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
public Rest<String> sendWorkMsg(WorkMsgReq workMsgReq) {
try {
DingTalkClient client = getDingTalkClient("/topapi/message/corpconversation/asyncsend_v2");
checkToken();
OapiMessageCorpconversationAsyncsendV2Request req = new OapiMessageCorpconversationAsyncsendV2Request();
req.setAgentId(agentId);
req.setUseridList(workMsgReq.getUseridList());
req.setMsg(JSON.toJSONString(workMsgReq.getMsg()));
log.info("sendWorkMsg:{}", JSON.toJSONString(workMsgReq));
OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(req, dingToken);
OapiMessageCorpconversationAsyncsendV2Response rsp = client.execute(req, getToken());
log.info("OapiMessageResponse:{}",rsp.getBody());
if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getMsg(), rsp.getRequestId());
......
......@@ -11,236 +11,245 @@ import com.mortals.xhx.module.perform.model.vo.PerformAttendAppealVo;
import com.mortals.xhx.module.perform.model.PerformAttendAppealFilesEntity;
import lombok.Data;
/**
* 绩效记录申诉信息实体对象
*
* @author zxfei
* @date 2023-07-12
*/
* 绩效记录申诉信息实体对象
*
* @author zxfei
* @date 2023-07-15
*/
@Data
public class PerformAttendAppealEntity extends PerformAttendAppealVo {
private static final long serialVersionUID = 1L;
/**
* 核查记录Id
*/
* 核查记录Id
*/
private Long checkRecordId;
/**
* 员工ID
*/
* 员工ID
*/
private Long staffId;
/**
* 员工姓名
*/
* 员工姓名
*/
private String staffName;
/**
* 工号
*/
* 工号
*/
private String workNum;
/**
* 所属部门
*/
* 所属部门
*/
private Long deptId;
/**
* 所属部门名称
*/
* 所属部门名称
*/
private String deptName;
/**
* 所属考勤组ID
*/
* 所属考勤组ID
*/
private Long attendanceGroupId;
/**
* 所属考勤组名称
*/
* 所属考勤组名称
*/
private String attendanceGroupName;
/**
* 扣分时间
*/
* 扣分时间
*/
private Date attendanceDate;
/**
* 绩效规则id
*/
* 绩效规则id
*/
private Long ruleId;
/**
* 规则名称
*/
* 规则名称
*/
private String ruleName;
/**
* 扣分方式(1.系统自动,2.人工添加,3.大厅巡查)
*/
* 扣分方式(1.系统自动,2.人工添加,3.大厅巡查)
*/
private Integer subMethod;
/**
* 增减类型(1.增加,2.扣除)
*/
* 增减类型(1.增加,2.扣除)
*/
private Integer subAddType;
/**
* 扣分或增加分值
*/
* 扣分或增加分值
*/
private BigDecimal score;
/**
* 上下班时间
*/
* 上下班时间
*/
private String goOffTimeStr;
/**
* 异常时间
*/
* 异常时间
*/
private Date errorTime;
/**
* 实际打卡时间
*/
* 实际打卡时间
*/
private Date actualAttendTime;
/**
* 异常处理结果
*/
* 异常处理结果
*/
private String errorResult;
/**
* 核查人员
*/
* 核查人员
*/
@Excel(name = "核查人员")
private String checkPerson;
/**
* 核查时间
*/
* 核查时间
*/
private Date checkTime;
/**
* 核查说明
*/
* 核查说明
*/
@Excel(name = "核查说明")
private String checkDesc;
/**
* 核查结果
*/
* 核查结果
*/
@Excel(name = "核查结果")
private String checkResult;
/**
* 处理状态(1.未处理,2.已处理)
*/
* 处理状态(1.未处理,2.已处理)
*/
private Integer processStatus;
/**
* 申诉说明
*/
* 申诉说明
*/
@Excel(name = "申诉说明")
private String appealDesc;
/**
* 申诉时间
*/
* 申诉时间
*/
private Date appealTime;
/**
* 申诉结果(1.通过,2.不通过)
*/
* 申诉结果(1.通过,2.不通过)
*/
private Integer appealResult;
/**
* 说明
*/
* 说明
*/
@Excel(name = "说明")
private String remark;
/**
* 违规类型,
*/
* 违规类型,
*/
private String violationType;
/**
* 评价结果(1.非常不满意,2.差评)
*/
* 评价结果(1.非常不满意,2.差评)
*/
private Integer reviewResult;
/**
* 评价时间
*/
* 评价时间
*/
private Date reviewTime;
/**
* 评价来源(窗口评价系统,导视系统,自助服务系统,微官网,其它)
*/
* 评价来源(窗口评价系统,导视系统,自助服务系统,微官网,其它)
*/
@Excel(name = "评价来源", readConverterExp = "评价来源(窗口评价系统,导视系统,自助服务系统,微官网,其它)")
private String reviewSource;
/**
* 评价设备
*/
* 评价设备
*/
private String reviewDevice;
/**
* 投诉标题
*/
* 投诉标题
*/
@Excel(name = "投诉标题")
private String complainTitle;
/**
* 投诉内容
*/
* 投诉内容
*/
@Excel(name = "投诉内容")
private String complainContent;
/**
* 投诉人真实姓名
*/
* 投诉人真实姓名
*/
private String complainRealName;
/**
* 联系电话
*/
* 联系电话
*/
@Excel(name = "联系电话")
private String contact;
/**
* 投诉时间
*/
* 投诉时间
*/
private Date complainTime;
/**
* 投诉来源
*/
* 投诉来源
*/
private String complainSource;
/**
* 投诉设备
*/
* 投诉设备
*/
private String complainDevice;
/**
* 办件编码
*/
* 办件编码
*/
@Excel(name = "办件编码")
private String goworkCode;
/**
* 办件所属部门
*/
* 办件所属部门
*/
@Excel(name = "办件所属部门")
private String goworkDepts;
/**
* 事项名称
*/
* 事项名称
*/
@Excel(name = "事项名称")
private String matterlName;
/**
* 办理时间
*/
* 办理时间
*/
@Excel(name = "办理时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date goworkTime;
/**
* 违规类型(1.脱岗,2.离岗,3.玩手机,4.睡觉)
*/
* 违规类型(1.脱岗,2.离岗,3.玩手机,4.睡觉)
*/
@Excel(name = "违规类型", readConverterExp = "1=脱岗,2.离岗,3.玩手机,4.睡觉")
private Integer irregularType;
/**
* 发生时间
*/
* 发生时间
*/
@Excel(name = "发生时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date happenTime;
/**
* 持续时间,秒
*/
* 持续时间,秒
*/
private Integer duration;
/**
* 报警时间
*/
* 报警时间
*/
private Date alarmTime;
/**
* 图片凭证地址
*/
* 图片凭证地址
*/
private String snapPath;
/**
* 违规类型(1.工作纪律)
*/
* 违规类型(1.工作纪律)
*/
private Integer irregularOtherType;
/**
* 绩效类型【attend:考勤绩效,review:评价差评绩效,complain:评价投诉绩效,gowork:办件绩效,effect:效能绩效,other:其它绩效】
*/
* 绩效类型【attend:考勤绩效,review:评价差评绩效,complain:评价投诉绩效,gowork:办件绩效,effect:效能绩效,other:其它绩效】
*/
private String performType;
/**
* 绩效记录申诉附件信息信息
*/
* 扣分人员
*/
@Excel(name = "扣分人员")
private String deductPerson;
/**
* 扣分时间
*/
private Date deductTime;
/**
* 绩效记录申诉附件信息信息
*/
private List<PerformAttendAppealFilesEntity> performAttendAppealFilesList=new ArrayList<>();;
public List<PerformAttendAppealFilesEntity> getPerformAttendAppealFilesList(){
return performAttendAppealFilesList;
return performAttendAppealFilesList;
}
public void setPerformAttendAppealFilesList(List<PerformAttendAppealFilesEntity> performAttendAppealFilesList){
......@@ -248,7 +257,7 @@ public class PerformAttendAppealEntity extends PerformAttendAppealVo {
}
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -256,7 +265,7 @@ public class PerformAttendAppealEntity extends PerformAttendAppealVo {
if (obj instanceof PerformAttendAppealEntity) {
PerformAttendAppealEntity tmp = (PerformAttendAppealEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
......@@ -264,104 +273,108 @@ public class PerformAttendAppealEntity extends PerformAttendAppealVo {
public void initAttrValue(){
this.checkRecordId = -1L;
this.checkRecordId = -1L;
this.staffId = -1L;
this.staffName = "";
this.staffId = -1L;
this.workNum = "";
this.staffName = "";
this.deptId = -1L;
this.workNum = "";
this.deptName = "";
this.deptId = -1L;
this.attendanceGroupId = -1L;
this.deptName = "";
this.attendanceGroupName = "";
this.attendanceGroupId = -1L;
this.attendanceDate = null;
this.attendanceGroupName = "";
this.ruleId = -1L;
this.attendanceDate = null;
this.ruleName = "";
this.ruleId = -1L;
this.subMethod = 1;
this.ruleName = "";
this.subAddType = 1;
this.subMethod = 1;
this.score = BigDecimal.valueOf(0.00);
this.subAddType = 1;
this.goOffTimeStr = "";
this.score = BigDecimal.valueOf(0.00);
this.errorTime = null;
this.goOffTimeStr = "";
this.actualAttendTime = null;
this.errorTime = null;
this.errorResult = "";
this.actualAttendTime = null;
this.checkPerson = "";
this.errorResult = "";
this.checkTime = null;
this.checkPerson = "";
this.checkDesc = "";
this.checkTime = null;
this.checkResult = "";
this.checkDesc = "";
this.processStatus = 1;
this.checkResult = "";
this.appealDesc = "";
this.processStatus = 1;
this.appealTime = null;
this.appealDesc = "";
this.appealResult = 2;
this.appealTime = null;
this.remark = "";
this.appealResult = 2;
this.violationType = "";
this.remark = "";
this.reviewResult = -1;
this.violationType = "";
this.reviewTime = null;
this.reviewResult = -1;
this.reviewSource = "";
this.reviewTime = null;
this.reviewDevice = "";
this.reviewSource = "";
this.complainTitle = "";
this.reviewDevice = "";
this.complainContent = "";
this.complainTitle = "";
this.complainRealName = "";
this.complainContent = "";
this.contact = "";
this.complainRealName = "";
this.complainTime = null;
this.contact = "";
this.complainSource = "";
this.complainTime = null;
this.complainDevice = "";
this.complainSource = "";
this.goworkCode = "";
this.complainDevice = "";
this.goworkDepts = "";
this.goworkCode = "";
this.matterlName = "";
this.goworkDepts = "";
this.goworkTime = null;
this.matterlName = "";
this.irregularType = -1;
this.goworkTime = null;
this.happenTime = null;
this.irregularType = -1;
this.duration = 0;
this.happenTime = null;
this.alarmTime = null;
this.duration = 0;
this.snapPath = "";
this.alarmTime = null;
this.irregularOtherType = -1;
this.snapPath = "";
this.performType = "";
this.irregularOtherType = -1;
this.deductPerson = "";
this.performType = "";
this.deductTime = null;
}
}
\ No newline at end of file
......@@ -641,3 +641,12 @@ CREATE TABLE mortals_xhx_staff_perform_summary(
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工绩效统计';
-- ----------------------------
2023-7-15
-- ----------------------------
ALTER TABLE mortals_xhx_perform_attend_appeal ADD COLUMN `deductPerson` varchar(128) COMMENT '扣分人员' AFTER subMethod;
ALTER TABLE mortals_xhx_perform_attend_appeal ADD COLUMN `deductTime` datetime COMMENT '扣分时间' AFTER deductPerson;
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