Commit 99cc36d4 authored by 赵啸非's avatar 赵啸非

添加钉钉接口相关

parent fb9f9950
package com.mortals.xhx.busiz.dingtalk.api;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.*;
import com.dingtalk.api.response.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.xhx.busiz.dingtalk.config.TalkConfiguration;
import com.mortals.xhx.busiz.dingtalk.req.DingTalkBaseReq;
import com.mortals.xhx.busiz.dingtalk.req.UserPageReq;
import com.mortals.xhx.busiz.req.CodeReq;
import com.mortals.xhx.busiz.req.LinkMessageReq;
import com.mortals.xhx.busiz.req.MobileReq;
import com.mortals.xhx.busiz.req.ReviewSaveReq;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.busiz.dingtalk.req.CodeReq;
import com.mortals.xhx.busiz.dingtalk.req.LinkMessageReq;
import com.mortals.xhx.busiz.dingtalk.req.MobileReq;
import com.mortals.xhx.common.pdu.ApiRespPdu;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import sun.security.krb5.internal.APOptions;
import java.util.List;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.mortals.framework.annotation.Excel;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.mortals.xhx.busiz.BaseReq;
import lombok.Data;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.mortals.xhx.busiz.BaseReq;
import lombok.Data;
......
package com.mortals.xhx.busiz.req;
package com.mortals.xhx.busiz.h5.req;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.xhx.busiz.BaseReq;
......
package com.mortals.xhx.busiz.rsp;
package com.mortals.xhx.busiz.h5.rsp;
import lombok.Data;
import lombok.NoArgsConstructor;
......
package com.mortals.xhx.busiz.rsp;
package com.mortals.xhx.busiz.h5.rsp;
import com.mortals.framework.annotation.Excel;
import lombok.Data;
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.busiz.BaseReq;
import com.mortals.xhx.busiz.req.PerformReq;
import org.springframework.util.ObjectUtils;
import java.util.Map;
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import cn.hutool.core.util.IdUtil;
import com.alibaba.fastjson.JSONObject;
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import com.alibaba.fastjson.JSON;
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.xhx.base.framework.annotation.ApiUserAuth;
import com.mortals.xhx.busiz.req.*;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.busiz.h5.req.*;
import com.mortals.xhx.module.perform.model.*;
import com.mortals.xhx.module.perform.service.*;
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 javafx.scene.effect.Effect;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,7 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
@RestController
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import java.math.BigDecimal;
......@@ -10,9 +10,9 @@ 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.busiz.h5.req.AppealReq;
import com.mortals.xhx.busiz.h5.req.PerformReq;
import com.mortals.xhx.busiz.h5.rsp.AppealStatInfo;
import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.common.code.ProcessStatusEnum;
import com.mortals.xhx.common.utils.BeanUtil;
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import cn.hutool.core.date.DateUtil;
......@@ -7,8 +7,8 @@ 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.xhx.busiz.req.FeedbackReq;
import com.mortals.xhx.busiz.req.FeedbackSaveReq;
import com.mortals.xhx.busiz.h5.req.FeedbackReq;
import com.mortals.xhx.busiz.h5.req.FeedbackSaveReq;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.feedback.model.*;
import com.mortals.xhx.module.feedback.service.FeedbackAnswerService;
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
......@@ -6,12 +6,12 @@ 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.*;
import com.mortals.xhx.busiz.rsp.*;
import com.mortals.xhx.busiz.h5.req.InspectSaveReq;
import com.mortals.xhx.busiz.h5.req.PerformReq;
import com.mortals.xhx.busiz.h5.rsp.InspectStatInfo;
import com.mortals.xhx.busiz.h5.rsp.PerformDetailInfo;
import com.mortals.xhx.busiz.h5.rsp.PerformInfo;
import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.common.code.ProcessStatusEnum;
import com.mortals.xhx.common.code.SubAddTypeEnum;
import com.mortals.xhx.common.code.SubMethodEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.*;
......@@ -20,7 +20,6 @@ import com.mortals.xhx.module.check.service.*;
import com.mortals.xhx.module.perform.model.*;
import com.mortals.xhx.module.perform.service.*;
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 org.springframework.beans.BeanUtils;
......@@ -31,7 +30,6 @@ 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.List;
......@@ -177,7 +175,7 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
parsePageInfo(model, pageAllInfo);
}
if(!ObjectUtils.isEmpty(performReq.getScoreType())){
query.setSubMethod(performReq.getScoreType());
query.setSubAddType(performReq.getScoreType());
List<CheckAllRecordVo> allCheckRecord = checkAllRecordService.getAllCheckRecord(query);
List<PerformInfo> collect = allCheckRecord.stream().map(item -> {
PerformInfo performInfo = new PerformInfo();
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import java.math.BigDecimal;
......@@ -10,20 +10,15 @@ 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.xhx.busiz.req.AppealReq;
import com.mortals.xhx.busiz.req.PerformReq;
import com.mortals.xhx.busiz.rsp.PerformDetailInfo;
import com.mortals.xhx.busiz.rsp.PerformInfo;
import com.mortals.xhx.busiz.rsp.PerformStatInfo;
import com.mortals.xhx.busiz.h5.req.PerformReq;
import com.mortals.xhx.busiz.h5.rsp.PerformDetailInfo;
import com.mortals.xhx.busiz.h5.rsp.PerformInfo;
import com.mortals.xhx.busiz.h5.rsp.PerformStatInfo;
import com.mortals.xhx.common.code.AppealResultEnum;
import com.mortals.xhx.common.code.AppealStatusEnum;
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.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.*;
import com.mortals.xhx.module.check.model.vo.CheckAllRecordVo;
import com.mortals.xhx.module.check.service.*;
......@@ -31,7 +26,6 @@ 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.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
......@@ -44,7 +38,6 @@ 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;
......
package com.mortals.xhx.busiz.web;
package com.mortals.xhx.busiz.h5.web;
import com.mortals.xhx.base.system.idgenerator.service.IdgeneratorService;
......
package com.mortals.xhx.busiz.req;
import lombok.Data;
/**
* 工作流请求头信息
*
* @author: zxfei
* @date: 2021/8/25 9:50
*/
@Data
public class ApiReq<T> {
/**
* 业务平台标识(唯一)
*/
private String tenantId;
/**
* 实体数据()
*/
private T entity;
}
package com.mortals.xhx.daemon.task;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.busiz.rsp.DeptHikData;
import com.mortals.xhx.busiz.rsp.ListDept;
import com.mortals.xhx.busiz.rsp.ListItem;
import com.mortals.xhx.busiz.rsp.PersonHikData;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.attendance.dao.AttendanceStatDao;
import com.mortals.xhx.module.attendance.dao.AttendanceVacationBalanceDao;
import com.mortals.xhx.module.attendance.dao.ibatis.*;
import com.mortals.xhx.module.attendance.model.AttendanceStatEntity;
import com.mortals.xhx.module.attendance.model.AttendanceStatQuery;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceEntity;
import com.mortals.xhx.module.attendance.model.AttendanceVacationBalanceQuery;
import com.mortals.xhx.module.attendance.service.AttendanceStatService;
import com.mortals.xhx.module.attendance.service.AttendanceVacationBalanceService;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.dao.ibatis.DeptDaoImpl;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
......@@ -33,8 +20,6 @@ import com.mortals.xhx.module.hik.person.model.rsp.org.OrgInfo;
import com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo;
import com.mortals.xhx.module.hik.person.model.rsp.person.PersonInfo;
import com.mortals.xhx.module.hik.person.service.IHikPersonService;
import com.mortals.xhx.module.staff.dao.StaffDao;
import com.mortals.xhx.module.staff.dao.ibatis.StaffDaoImpl;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j;
......
package com.mortals.xhx.module.check.model;
import lombok.Data;
@Data
public class CheckAllRecordQuery {
/**
* 员工ID
......@@ -21,51 +24,10 @@ public class CheckAllRecordQuery {
*/
private Integer subMethod;
public Long getStaffId() {
return staffId;
}
public void setStaffId(Long staffId) {
this.staffId = staffId;
}
public Integer getCheckStatus() {
return checkStatus;
}
public void setCheckStatus(Integer checkStatus) {
this.checkStatus = checkStatus;
}
public String getCheckTimeStart() {
return checkTimeStart;
}
public void setCheckTimeStart(String checkTimeStart) {
this.checkTimeStart = checkTimeStart;
}
public String getCheckTimeEnd() {
return checkTimeEnd;
}
public void setCheckTimeEnd(String checkTimeEnd) {
this.checkTimeEnd = checkTimeEnd;
}
public Long getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* 增减类型(1.增加,2.扣除)
*/
private Integer subAddType;
public Integer getSubMethod() {
return subMethod;
}
public void setSubMethod(Integer subMethod) {
this.subMethod = subMethod;
}
}
package com.mortals.xhx.module.check.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.SubMethodEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.Link;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.Msg;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -20,6 +30,7 @@ import com.mortals.xhx.module.check.dao.CheckReviewRecordDao;
import com.mortals.xhx.module.check.model.CheckReviewRecordEntity;
import com.mortals.xhx.module.check.service.CheckReviewRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
......@@ -28,38 +39,81 @@ import java.util.Date;
import java.util.List;
/**
* CheckReviewRecordService
* 评价差评绩效核查信息 service实现
*
* @author zxfei
* @date 2023-07-11
*/
* CheckReviewRecordService
* 评价差评绩效核查信息 service实现
*
* @author zxfei
* @date 2023-07-11
*/
@Service("checkReviewRecordService")
@Slf4j
public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckReviewRecordDao, CheckReviewRecordEntity, Long> implements CheckReviewRecordService {
@Autowired
private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Override
protected void saveAfter(CheckReviewRecordEntity entity, Context context) throws AppException {
try{
try {
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query);
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
//发送钉钉通知信息
if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) {
//绩效核查通知
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
WorkMsgReq workMsgReq = new WorkMsgReq();
Msg msg = new Msg();
msg.setMsgtype("link");
Link link = new Link();
link.setPicUrl("测试图片链接");
link.setMessageUrl("测试消息链接");
link.setText("测试文本");
link.setTitle("测试标题");
msg.setLink(link);
workMsgReq.setUseridList(personRest.getMsg());
Rest<String> sendWorkRest = dingPersonService.sendWorkMsg(workMsgReq);
if (YesNoEnum.YES.getValue() == sendWorkRest.getCode()) {
String requestId = sendWorkRest.getData();
} else {
log.error("发送工作消息失败,msg:{}", sendWorkRest.getMsg());
}
} else {
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
}
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
}
}
}
@Override
public void examine(CheckReviewRecordEntity entity, Context context) throws AppException {
if(entity.getId()==null){
if (entity.getId() == null) {
throw new AppException("核查记录ID不能为空");
}
if (context != null && context.getUser()!=null) {
if (context != null && context.getUser() != null) {
IUser user = context.getUser();
entity.setUpdateUserId(user.getId());
entity.setCheckPerson(user.getRealName());
......@@ -68,23 +122,23 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity);
try{
try {
CheckReviewRecordEntity temp = this.get(entity.getId());
if(temp!=null) {
if (temp != null) {
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId());
summaryCheck(query);
}
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
}
@Override
public List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException {
if(StringUtils.isEmpty(query.getCheckTimeStart())||StringUtils.isEmpty(query.getCheckTimeStart())){
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance();
if (StringUtils.isEmpty(query.getCheckTimeStart()) || StringUtils.isEmpty(query.getCheckTimeStart())) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1);
String startTime = format.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
......@@ -93,27 +147,27 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
query.setCheckTimeEnd(endTime);
}
List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query);
if(CollectionUtils.isNotEmpty(summaryVoList)){
for(StaffCheckSummaryVo vo:summaryVoList){
if (CollectionUtils.isNotEmpty(summaryVoList)) {
for (StaffCheckSummaryVo vo : summaryVoList) {
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
BeanUtils.copyProperties(vo,staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo));
BeanUtils.copyProperties(vo, staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo));
staffPerformSummaryEntity.setReviewScore(vo.getSumScore());
StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery();
summaryQuery.setStaffId(vo.getStaffId());
summaryQuery.setYear(vo.getYear());
summaryQuery.setMonth(vo.getMonth());
StaffPerformSummaryEntity temp = staffPerformSummaryService.selectOne(summaryQuery);
if(temp!=null){
if(temp.getAttendScore()==null){
if (temp != null) {
if (temp.getAttendScore() == null) {
staffPerformSummaryEntity.setAttendScore(new BigDecimal(0));
}
if(temp.getOtherScore()==null){
if (temp.getOtherScore() == null) {
staffPerformSummaryEntity.setOtherScore(new BigDecimal(0));
}
if(temp.getGoworkScore()==null){
if (temp.getGoworkScore() == null) {
staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0));
}
if(temp.getEffectScore()==null){
if (temp.getEffectScore() == null) {
staffPerformSummaryEntity.setEffectScore(new BigDecimal(0));
}
BigDecimal erro = new BigDecimal(0);
......@@ -131,7 +185,7 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
staffPerformSummaryEntity.setId(temp.getId());
staffPerformSummaryEntity.setUpdateTime(new Date());
staffPerformSummaryService.update(staffPerformSummaryEntity);
}else {
} else {
staffPerformSummaryEntity.setAttendScore(new BigDecimal(0));
staffPerformSummaryEntity.setOtherScore(new BigDecimal(0));
staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0));
......
package com.mortals.xhx.module.dingding;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiGettokenRequest;
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.xhx.common.pdu.ApiRespPdu;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.Map;
/**
* 钉钉访问抽象服务类
*
* @author:
* @date: 2023/7/14 13:49
*/
@Slf4j
public abstract class AbstractDingTalkService implements IDingPersonService {
/**
* AgentId
*/
@Value("${dingtalk.agentId:0}")
protected Long agentId;
/**
* AgentId
*/
@Value("${dingtalk.domain:https://oapi.dingtalk.com}")
protected String domain;
/**
* appKey
*/
@Value("${dingtalk.AppKey:''}")
protected String appKey;
/**
* AppSecret
*/
@Value("${dingtalk.AppSecret:''}")
protected String appSecret;
/**
* getToken
*/
@Value("${dingtalk.gettoken:https://oapi.dingtalk.com/gettoken}")
protected String getTokneUrl;
protected String dingToken;
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() {
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());
} else {
throw new AppException(rsp.getMessage());
}
} catch (Exception e) {
log.error("获取TOKEN异常", e);
return Rest.fail(e.getMessage());
}
}
}
package com.mortals.xhx.module.dingding;
import com.mortals.framework.common.Rest;
public interface IDingTalkService {
Rest<String> getToken();
}
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class ActionCard {
@JSONField(name = "btn_json_list")
private BtnJsonList btnJsonList;
@JSONField(name = "single_url")
private String singleUrl;
@JSONField(name = "btn_orientation")
private String btnOrientation;
@JSONField(name = "single_title")
private String singleTitle;
@JSONField(name = "markdown")
private String markdown;
@JSONField(name = "title")
private String title;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Body{
@JSONField(name="file_count")
private String fileCount;
@JSONField(name="image")
private String image;
@JSONField(name="form")
private Form form;
@JSONField(name="author")
private String author;
@JSONField(name="rich")
private Rich rich;
@JSONField(name="title")
private String title;
@JSONField(name="content")
private String content;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class BtnJsonList{
@JSONField(name="action_url")
private String actionUrl;
@JSONField(name="title")
private String title;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class File{
@JSONField(name="media_id")
private String mediaId;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Form{
@JSONField(name="value")
private String value;
@JSONField(name="key")
private String key;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Head{
@JSONField(name="bgcolor")
private String bgcolor;
@JSONField(name="text")
private String text;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Image{
@JSONField(name="media_id")
private String mediaId;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Link{
@JSONField(name="picUrl")
private String picUrl;
@JSONField(name="messageUrl")
private String messageUrl;
@JSONField(name="text")
private String text;
@JSONField(name="title")
private String title;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Markdown{
@JSONField(name="text")
private String text;
@JSONField(name="title")
private String title;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Msg{
@JSONField(name="voice")
private Voice voice;
@JSONField(name="image")
private Image image;
@JSONField(name="oa")
private Oa oa;
@JSONField(name="file")
private File file;
@JSONField(name="action_card")
private ActionCard actionCard;
@JSONField(name="link")
private Link link;
@JSONField(name="markdown")
private Markdown markdown;
@JSONField(name="text")
private Text text;
@JSONField(name="msgtype")
private String msgtype;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Oa{
@JSONField(name="head")
private Head head;
@JSONField(name="pc_message_url")
private String pcMessageUrl;
@JSONField(name="status_bar")
private StatusBar statusBar;
@JSONField(name="body")
private Body body;
@JSONField(name="message_url")
private String messageUrl;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Rich{
@JSONField(name="unit")
private String unit;
@JSONField(name="num")
private String num;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class StatusBar{
@JSONField(name="status_value")
private String statusValue;
@JSONField(name="status_bg")
private String statusBg;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Text{
@JSONField(name="content")
private String content;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class Voice{
@JSONField(name="duration")
private String duration;
@JSONField(name="media_id")
private String mediaId;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.model.req.workmsg;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class WorkMsgReq {
@JSONField(name="msg")
private Msg msg;
@JSONField(name="to_all_user")
private String toAllUser;
@JSONField(name="agent_id")
private String agentId;
@JSONField(name="dept_id_list")
private String deptIdList;
@JSONField(name="userid_list")
private String useridList;
}
\ No newline at end of file
package com.mortals.xhx.module.dingding.personal.service;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.dingding.IDingTalkService;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq;
import com.mortals.xhx.module.hik.person.model.req.org.OrgListReq;
import com.mortals.xhx.module.hik.person.model.req.person.PersonReq;
import com.mortals.xhx.module.hik.person.model.rsp.org.OrgDataInfo;
import com.mortals.xhx.module.hik.person.model.rsp.person.PersonDataInfo;
/**
* 钉钉人事相关服务类
*
* @author:
* @date: 2023/7/14 13:54
*/
public interface IDingPersonService extends IDingTalkService {
/**
* 根据电话获取钉钉用户id
*
* @param mobile
* @return
*/
Rest<String> getPersonByMobile(String mobile);
/**
* 发送工作消息
* @param workMsgReq
* @return
*/
Rest<String> sendWorkMsg(WorkMsgReq workMsgReq);
}
package com.mortals.xhx.module.dingding.personal.service.impl;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiMessageCorpconversationAsyncsendV2Request;
import com.dingtalk.api.request.OapiV2UserGetbymobileRequest;
import com.dingtalk.api.response.OapiMessageCorpconversationAsyncsendV2Response;
import com.dingtalk.api.response.OapiV2UserGetbymobileResponse;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.dingding.AbstractDingTalkService;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.taobao.api.ApiException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service("dingPersonService")
@Slf4j
public class DingPersonServiceImpl extends AbstractDingTalkService implements IDingPersonService {
@Override
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);
log.info("OapiV2UserGetbymobileResponse:{}",rsp.getBody());
if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getResult().getUserid());
} else {
return Rest.fail(String.format("code:%s,msg:%s", rsp.getErrcode(), rsp.getErrmsg()));
}
} catch (ApiException e) {
log.info("根据手机号码查询人员异常", e);
return Rest.fail(e.getMessage());
}
}
@Override
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);
log.info("OapiMessageResponse:{}",rsp.getBody());
if (rsp.getErrcode() == 0) {
return Rest.ok(rsp.getMsg(), rsp.getRequestId());
} else {
return Rest.fail(String.format("code:%s,msg:%s", rsp.getErrcode(), rsp.getErrmsg()));
}
} catch (ApiException e) {
log.info("根据用户id发送工作消息异常", e);
return Rest.fail(e.getMessage());
}
}
}
......@@ -61,8 +61,15 @@ hik:
appKey: @profiles.hik.appKey@
protocol: @profiles.hik.protocol@
appSecret: @profiles.hik.appSecret@
#dingtalk:
# agentId: 2652674890
# AppKey: dingpqzradgfr4efdi2j
# AppSecret: bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
# domain: https://oapi.dingtalk.com
dingtalk:
agentId: 2652674890
AppKey: dingpqzradgfr4efdi2j
AppSecret: bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd
agentId: 2625340030
AppKey: dingjcqjqjh1j82ho5zx
AppSecret: _wNw2J6sxTYcu3ddNkFlG3U-3UlQ-P_7ufLSJ4wRxgdUflm3lPf8LIODCQOGkydy
domain: https://oapi.dingtalk.com
......@@ -7,6 +7,7 @@
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,score,subMethod,checkTime,createTime AS deductTime,1 AS checkType ,'attend' AS performType FROM mortals_xhx_check_attend_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
......@@ -15,6 +16,7 @@
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,4 AS checkType ,'effect' AS performType FROM mortals_xhx_check_effect_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
......@@ -23,6 +25,7 @@
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,6 AS checkType ,'complain' AS performType FROM mortals_xhx_check_complain_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
......@@ -31,6 +34,7 @@
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,3 AS checkType ,'gowork' AS performType FROM mortals_xhx_check_gowork_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
......@@ -39,6 +43,7 @@
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,2 AS checkType ,'review' AS performType FROM mortals_xhx_check_review_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
......@@ -47,6 +52,7 @@
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,2 AS subAddType,score,subMethod,checkTime,createTime AS deductTime,5 AS checkType ,'other' AS performType FROM mortals_xhx_check_other_record WHERE 1=1
<if test="checkStatus != null and checkStatus!=''"> AND checkStatus = #{checkStatus} </if>
<if test="subMethod != null and subMethod!=''"> AND subMethod = #{subMethod} </if>
<if test="subAddType != null and subAddType!=''"> AND subAddType = #{subAddType} </if>
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND checkTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
......
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