Commit 92c0b919 authored by 赵啸非's avatar 赵啸非

添加巡查,申诉发送钉钉消息

parent 479855a7
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<profiles.log.level>info</profiles.log.level> <profiles.log.level>info</profiles.log.level>
<profiles.publish.path>/home/publish</profiles.publish.path> <profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl> <profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId> <profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId>
<profiles.hik.host>8.136.255.30:8001</profiles.hik.host> <profiles.hik.host>8.136.255.30:8001</profiles.hik.host>
<profiles.hik.protocol>http://</profiles.hik.protocol> <profiles.hik.protocol>http://</profiles.hik.protocol>
...@@ -39,7 +40,7 @@ ...@@ -39,7 +40,7 @@
<profiles.dingtalk.agentId>2625340030</profiles.dingtalk.agentId> <profiles.dingtalk.agentId>2625340030</profiles.dingtalk.agentId>
<profiles.dingtalk.appKey>dingjcqjqjh1j82ho5zx</profiles.dingtalk.appKey> <profiles.dingtalk.appKey>dingjcqjqjh1j82ho5zx</profiles.dingtalk.appKey>
<profiles.dingtalk.appSecret>_wNw2J6sxTYcu3ddNkFlG3U-3UlQ-P_7ufLSJ4wRxgdUflm3lPf8LIODCQOGkydy</profiles.dingtalk.appSecret> <profiles.dingtalk.appSecret>_wNw2J6sxTYcu3ddNkFlG3U-3UlQ-P_7ufLSJ4wRxgdUflm3lPf8LIODCQOGkydy</profiles.dingtalk.appSecret>
<profiles.webUrl>http://8.136.255.30:11039/attendance</profiles.webUrl>
<package.environment>serve</package.environment> <package.environment>serve</package.environment>
<skipUi>false</skipUi> <skipUi>false</skipUi>
</properties> </properties>
...@@ -70,7 +71,7 @@ ...@@ -70,7 +71,7 @@
<profiles.dingtalk.agentId>2652674890</profiles.dingtalk.agentId> <profiles.dingtalk.agentId>2652674890</profiles.dingtalk.agentId>
<profiles.dingtalk.appKey>dingpqzradgfr4efdi2j</profiles.dingtalk.appKey> <profiles.dingtalk.appKey>dingpqzradgfr4efdi2j</profiles.dingtalk.appKey>
<profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret> <profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret>
<profiles.webUrl>http://8.136.255.30:11039/attendance</profiles.webUrl>
<package.environment>test</package.environment> <package.environment>test</package.environment>
<skipUi>false</skipUi> <skipUi>false</skipUi>
</properties> </properties>
...@@ -98,7 +99,7 @@ ...@@ -98,7 +99,7 @@
<profiles.dingtalk.agentId>2652674890</profiles.dingtalk.agentId> <profiles.dingtalk.agentId>2652674890</profiles.dingtalk.agentId>
<profiles.dingtalk.appKey>dingpqzradgfr4efdi2j</profiles.dingtalk.appKey> <profiles.dingtalk.appKey>dingpqzradgfr4efdi2j</profiles.dingtalk.appKey>
<profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret> <profiles.dingtalk.appSecret>bF2WALmo5_Wuj3hg5gXeWqezrYnZChUJ88HjzNWpkA9ivdOxfBDGOGYcfVRfB3vd</profiles.dingtalk.appSecret>
<profiles.webUrl>http://112.19.80.237:11039/attendance</profiles.webUrl>
<package.environment>build</package.environment> <package.environment>build</package.environment>
<skipUi>false</skipUi> <skipUi>false</skipUi>
</properties> </properties>
......
package com.mortals.xhx.base.system.message;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.dingding.CheckDingMsg;
public interface MessageService {
Rest<String> sendDingTalkWorkMsg(CheckDingMsg checkDingMsg);
Rest<String> sendDingTalkAppealMsg(CheckDingMsg checkDingMsg);
}
\ No newline at end of file
package com.mortals.xhx.base.system.message.impl;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.AppealResultEnum;
import com.mortals.xhx.common.code.SubAddTypeEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.dingding.CheckDingMsg;
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.Text;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq;
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.stereotype.Service;
@Service("messageService")
@Slf4j
public class MessageServiceImpl implements MessageService {
@Value("${webUrl:''}")
private String webUrl;
@Autowired
private IDingPersonService dingPersonService;
@Override
public Rest<String> sendDingTalkWorkMsg(CheckDingMsg dingMsg) {
WorkMsgReq workMsgReq = new WorkMsgReq();
Msg msg = new Msg();
msg.setMsgtype("link");
Link link = new Link();
link.setPicUrl("");
link.setMessageUrl("webUrl" + dingMsg.getPath());
if (SubAddTypeEnum.增加.getValue() == dingMsg.getSubAddType()) {
link.setText(String.format("你好,经人工核实后你在%%-%s" +
",系统自动增加绩效%s分,如有情况说明请及时向管理人员提交申诉处理,感谢你的配合。", dingMsg.getDateTime(), dingMsg.getRuleStr(), dingMsg.getScore()));
} else {
link.setText(String.format("你好,经人工核实后你在%s违反%s" +
",系统自动扣除绩效%s分,如有情况说明请及时向管理人员提交申诉处理,感谢你的配合。", dingMsg.getDateTime(), dingMsg.getRuleStr(), dingMsg.getScore()));
}
link.setTitle(String.format("%s考核核查通知", dingMsg.getPerformTypeStr()));
msg.setLink(link);
workMsgReq.setUseridList(dingMsg.getUserIds());
Rest<String> sendWorkRest = dingPersonService.sendWorkMsg(workMsgReq);
if (YesNoEnum.YES.getValue() == sendWorkRest.getCode()) {
String requestId = sendWorkRest.getData();
return Rest.ok(requestId);
} else {
log.error("发送工作消息失败,msg:{}", sendWorkRest.getMsg());
return Rest.fail(sendWorkRest.getMsg());
}
}
@Override
public Rest<String> sendDingTalkAppealMsg(CheckDingMsg dingMsg) {
WorkMsgReq workMsgReq = new WorkMsgReq();
Msg msg = new Msg();
msg.setMsgtype("text");
Text text = new Text();
if (AppealResultEnum.通过.getValue() == dingMsg.getAppealResult()) {
text.setContent(String.format("你好,你申诉的在%s违反%s,经人工核查后情况属实,本次申诉成功,将撤销之前的扣除绩效%s。", dingMsg.getDateTime(), dingMsg.getRuleStr(), dingMsg.getScore()));
} else {
text.setContent(String.format("你好,你申诉的在%s违反%s,经人工核查后情况仍继续扣除%s。本次申诉失败,原因:%s,如有疑问请联系相关负责人。", dingMsg.getDateTime(), dingMsg.getRuleStr(), dingMsg.getScore(), dingMsg.getAppealDesc()));
}
msg.setText(text);
workMsgReq.setUseridList(dingMsg.getUserIds());
Rest<String> sendWorkRest = dingPersonService.sendWorkMsg(workMsgReq);
if (YesNoEnum.YES.getValue() == sendWorkRest.getCode()) {
String requestId = sendWorkRest.getData();
return Rest.ok(requestId);
} else {
log.error("发送工作消息失败,msg:{}", sendWorkRest.getMsg());
return Rest.fail(sendWorkRest.getMsg());
}
}
}
\ No newline at end of file
...@@ -42,6 +42,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -42,6 +42,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
private PerformRulesService rulesService; private PerformRulesService rulesService;
@Autowired @Autowired
private StaffService staffService; private StaffService staffService;
@Autowired
private PerformRulesCategoryService categoryService;
/** /**
...@@ -219,6 +221,11 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -219,6 +221,11 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setDeductTime(new Date()); recordEntity.setDeductTime(new Date());
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformAttendRecordEntity save = attendRecordService.save(recordEntity); PerformAttendRecordEntity save = attendRecordService.save(recordEntity);
return save.newEntity(); return save.newEntity();
...@@ -249,6 +256,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -249,6 +256,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setDeductTime(new Date()); recordEntity.setDeductTime(new Date());
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformReviewRecordEntity save = reviewRecordService.save(recordEntity); PerformReviewRecordEntity save = reviewRecordService.save(recordEntity);
return save.newEntity(); return save.newEntity();
...@@ -278,6 +287,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -278,6 +287,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformComplainRecordEntity save = complainRecordService.save(recordEntity); PerformComplainRecordEntity save = complainRecordService.save(recordEntity);
return save.newEntity(); return save.newEntity();
...@@ -307,6 +318,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -307,6 +318,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformGoworkRecordEntity save = performGoworkRecordService.save(recordEntity); PerformGoworkRecordEntity save = performGoworkRecordService.save(recordEntity);
return save.newEntity(); return save.newEntity();
...@@ -336,6 +349,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -336,6 +349,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformEffectRecordEntity save = effectRecordService.save(recordEntity); PerformEffectRecordEntity save = effectRecordService.save(recordEntity);
return save.newEntity(); return save.newEntity();
} }
...@@ -366,6 +381,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -366,6 +381,8 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCreateUserId(1L); recordEntity.setCreateUserId(1L);
recordEntity.setCreateTime(new Date()); recordEntity.setCreateTime(new Date());
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformOtherRecordEntity save = otherRecordService.save(recordEntity); PerformOtherRecordEntity save = otherRecordService.save(recordEntity);
return save.newEntity(); return save.newEntity();
} }
......
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.CheckStatusEnum; import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.PerformTypeEnum;
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.common.utils.BeanUtil;
import com.mortals.xhx.module.check.dao.CheckComplainRecordDao; import com.mortals.xhx.module.check.dao.CheckComplainRecordDao;
import com.mortals.xhx.module.check.model.CheckComplainRecordEntity; import com.mortals.xhx.module.check.model.CheckComplainRecordEntity;
import com.mortals.xhx.module.check.model.CheckEffectRecordEntity;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.check.service.CheckComplainRecordService; import com.mortals.xhx.module.check.service.CheckComplainRecordService;
import com.mortals.xhx.module.dingding.CheckDingMsg;
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.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery; import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService; import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -41,9 +53,20 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -41,9 +53,20 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
@Autowired @Autowired
private StaffPerformSummaryService staffPerformSummaryService; private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Autowired
private MessageService messageService;
@Override @Override
protected void saveAfter(CheckComplainRecordEntity entity, Context context) throws AppException { protected void saveAfter(CheckComplainRecordEntity entity, Context context) throws AppException {
//发送钉钉通知信息
if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) {
sendCheckDingTalk(entity);
}
try{ try{
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery(); StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(entity.getStaffId()); query.setStaffId(entity.getStaffId());
...@@ -55,6 +78,32 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -55,6 +78,32 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
} }
} }
private void sendCheckDingTalk(CheckComplainRecordEntity entity) {
String ruleStr = String.format("%s/%s/%s", PerformTypeEnum.评价投诉绩效.getDesc(), entity.getCategoryName(), entity.getRuleName());
//绩效核查通知
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
CheckDingMsg checkDingMsg = new CheckDingMsg();
checkDingMsg.setUserIds(personRest.getData());
checkDingMsg.setDateTime(DateUtil.formatDateTime(entity.getComplainTime() == null ? new Date() : entity.getComplainTime()));
checkDingMsg.setRuleStr(ruleStr);
checkDingMsg.setPerformTypeStr(PerformTypeEnum.评价投诉绩效.getDesc());
checkDingMsg.setScore(entity.getScore().toString());
checkDingMsg.setSubAddType(entity.getSubAddType());
checkDingMsg.setPath(String.format("/api/v1/perform/info?id=%s&&performType=complain", entity.getId()));
Rest<String> msgRest = messageService.sendDingTalkWorkMsg(checkDingMsg);
} else {
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
}
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
}
}
@Override @Override
public void examine(CheckComplainRecordEntity entity, Context context) throws AppException { public void examine(CheckComplainRecordEntity entity, Context context) throws AppException {
if(entity.getId()==null){ if(entity.getId()==null){
...@@ -69,6 +118,7 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -69,6 +118,7 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
entity.setUpdateTime(entity.getCheckTime()); entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理) entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity); dao.update(entity);
sendCheckDingTalk(entity);
try{ try{
CheckComplainRecordEntity temp = this.get(entity.getId()); CheckComplainRecordEntity temp = this.get(entity.getId());
if(temp!=null) { if(temp!=null) {
......
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.CheckStatusEnum; import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.PerformTypeEnum;
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.common.utils.BeanUtil;
import com.mortals.xhx.module.check.dao.CheckEffectRecordDao; import com.mortals.xhx.module.check.dao.CheckEffectRecordDao;
import com.mortals.xhx.module.check.model.CheckEffectRecordEntity; import com.mortals.xhx.module.check.model.CheckEffectRecordEntity;
import com.mortals.xhx.module.check.model.CheckGoworkRecordEntity;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.check.service.CheckEffectRecordService; import com.mortals.xhx.module.check.service.CheckEffectRecordService;
import com.mortals.xhx.module.dingding.CheckDingMsg;
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.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery; import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService; import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -41,9 +53,20 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE ...@@ -41,9 +53,20 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE
@Autowired @Autowired
private StaffPerformSummaryService staffPerformSummaryService; private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Autowired
private MessageService messageService;
@Override @Override
protected void saveAfter(CheckEffectRecordEntity entity, Context context) throws AppException { protected void saveAfter(CheckEffectRecordEntity entity, Context context) throws AppException {
//发送钉钉通知信息
if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) {
sendCheckDingTalk(entity);
}
try{ try{
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery(); StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(entity.getStaffId()); query.setStaffId(entity.getStaffId());
...@@ -55,6 +78,32 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE ...@@ -55,6 +78,32 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE
} }
} }
private void sendCheckDingTalk(CheckEffectRecordEntity entity) {
String ruleStr = String.format("%s/%s/%s", PerformTypeEnum.效能绩效.getDesc(), entity.getCategoryName(), entity.getRuleName());
//绩效核查通知
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
CheckDingMsg checkDingMsg = new CheckDingMsg();
checkDingMsg.setUserIds(personRest.getData());
checkDingMsg.setDateTime(DateUtil.formatDateTime(entity.getHappenTime() == null ? new Date() : entity.getHappenTime()));
checkDingMsg.setRuleStr(ruleStr);
checkDingMsg.setPerformTypeStr(PerformTypeEnum.办件绩效.getDesc());
checkDingMsg.setScore(entity.getScore().toString());
checkDingMsg.setSubAddType(entity.getSubAddType());
checkDingMsg.setPath(String.format("/api/v1/perform/info?id=%s&&performType=effect", entity.getId()));
Rest<String> msgRest = messageService.sendDingTalkWorkMsg(checkDingMsg);
} else {
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
}
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
}
}
@Override @Override
public void examine(CheckEffectRecordEntity entity, Context context) throws AppException { public void examine(CheckEffectRecordEntity entity, Context context) throws AppException {
if(entity.getId()==null){ if(entity.getId()==null){
...@@ -69,6 +118,7 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE ...@@ -69,6 +118,7 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE
entity.setUpdateTime(entity.getCheckTime()); entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理) entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity); dao.update(entity);
sendCheckDingTalk(entity);
try{ try{
CheckEffectRecordEntity temp = this.get(entity.getId()); CheckEffectRecordEntity temp = this.get(entity.getId());
if(temp!=null) { if(temp!=null) {
......
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.CheckStatusEnum; import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.PerformTypeEnum;
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.common.utils.BeanUtil;
import com.mortals.xhx.module.check.dao.CheckGoworkRecordDao; import com.mortals.xhx.module.check.dao.CheckGoworkRecordDao;
import com.mortals.xhx.module.check.model.CheckGoworkRecordEntity; import com.mortals.xhx.module.check.model.CheckGoworkRecordEntity;
import com.mortals.xhx.module.check.model.CheckOtherRecordEntity;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.check.service.CheckGoworkRecordService; import com.mortals.xhx.module.check.service.CheckGoworkRecordService;
import com.mortals.xhx.module.dingding.CheckDingMsg;
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.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery; import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService; import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -41,9 +53,20 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG ...@@ -41,9 +53,20 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG
@Autowired @Autowired
private StaffPerformSummaryService staffPerformSummaryService; private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Autowired
private MessageService messageService;
@Override @Override
protected void saveAfter(CheckGoworkRecordEntity entity, Context context) throws AppException { protected void saveAfter(CheckGoworkRecordEntity entity, Context context) throws AppException {
//发送钉钉通知信息
if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) {
sendCheckDingTalk(entity);
}
try{ try{
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery(); StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(entity.getStaffId()); query.setStaffId(entity.getStaffId());
...@@ -55,6 +78,30 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG ...@@ -55,6 +78,30 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG
} }
} }
private void sendCheckDingTalk(CheckGoworkRecordEntity entity) {
String ruleStr = String.format("%s/%s/%s", PerformTypeEnum.办件绩效.getDesc(), entity.getCategoryName(), entity.getRuleName());
//绩效核查通知
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
CheckDingMsg checkDingMsg = new CheckDingMsg();
checkDingMsg.setUserIds(personRest.getData());
checkDingMsg.setDateTime(DateUtil.formatDateTime(entity.getGoworkTime() == null ? new Date() : entity.getGoworkTime()));
checkDingMsg.setRuleStr(ruleStr);
checkDingMsg.setPerformTypeStr(PerformTypeEnum.办件绩效.getDesc());
checkDingMsg.setScore(entity.getScore().toString());
checkDingMsg.setSubAddType(entity.getSubAddType());
checkDingMsg.setPath(String.format("/api/v1/perform/info?id=%s&&performType=gowork", entity.getId()));
Rest<String> msgRest = messageService.sendDingTalkWorkMsg(checkDingMsg);
} else {
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
}
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
}
}
@Override @Override
public void examine(CheckGoworkRecordEntity entity, Context context) throws AppException { public void examine(CheckGoworkRecordEntity entity, Context context) throws AppException {
if(entity.getId()==null){ if(entity.getId()==null){
...@@ -69,6 +116,8 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG ...@@ -69,6 +116,8 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG
entity.setUpdateTime(entity.getCheckTime()); entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理) entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity); dao.update(entity);
//发送钉钉通知信息
sendCheckDingTalk(entity);
try{ try{
CheckGoworkRecordEntity temp = this.get(entity.getId()); CheckGoworkRecordEntity temp = this.get(entity.getId());
if(temp!=null) { if(temp!=null) {
......
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.CheckStatusEnum; import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.PerformTypeEnum;
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.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.CheckReviewRecordEntity;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.dingding.CheckDingMsg;
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.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery; import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService; import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,6 +32,7 @@ import com.mortals.xhx.module.check.dao.CheckOtherRecordDao; ...@@ -20,6 +32,7 @@ import com.mortals.xhx.module.check.dao.CheckOtherRecordDao;
import com.mortals.xhx.module.check.model.CheckOtherRecordEntity; import com.mortals.xhx.module.check.model.CheckOtherRecordEntity;
import com.mortals.xhx.module.check.service.CheckOtherRecordService; import com.mortals.xhx.module.check.service.CheckOtherRecordService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -28,12 +41,12 @@ import java.util.Date; ...@@ -28,12 +41,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* CheckOtherRecordService * CheckOtherRecordService
* 其它绩效核查信息 service实现 * 其它绩效核查信息 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-07-11 * @date 2023-07-11
*/ */
@Service("checkOtherRecordService") @Service("checkOtherRecordService")
@Slf4j @Slf4j
public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOtherRecordDao, CheckOtherRecordEntity, Long> implements CheckOtherRecordService { public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOtherRecordDao, CheckOtherRecordEntity, Long> implements CheckOtherRecordService {
...@@ -41,25 +54,65 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt ...@@ -41,25 +54,65 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt
@Autowired @Autowired
private StaffPerformSummaryService staffPerformSummaryService; private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Autowired
private MessageService messageService;
@Override @Override
protected void saveAfter(CheckOtherRecordEntity entity, Context context) throws AppException { protected void saveAfter(CheckOtherRecordEntity entity, Context context) throws AppException {
try{
//发送钉钉通知信息
if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) {
sendCheckDingTalk(entity);
}
try {
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery(); StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(entity.getStaffId()); query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime())); query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart()); query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query); summaryCheck(query);
}catch (Exception e){ } catch (Exception e) {
log.error("汇总已审核的核查记录出错",e); log.error("汇总已审核的核查记录出错", e);
}
}
private void sendCheckDingTalk(CheckOtherRecordEntity entity) {
String ruleStr = String.format("%s/%s/%s", PerformTypeEnum.其它绩效.getDesc(), entity.getCategoryName(), entity.getRuleName());
//绩效核查通知
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
CheckDingMsg checkDingMsg = new CheckDingMsg();
checkDingMsg.setUserIds(personRest.getData());
checkDingMsg.setDateTime(DateUtil.formatDateTime(entity.getHappenTime() == null ? new Date() : entity.getHappenTime()));
checkDingMsg.setRuleStr(ruleStr);
checkDingMsg.setPerformTypeStr(PerformTypeEnum.评价差评绩效.getDesc());
checkDingMsg.setScore(entity.getScore().toString());
checkDingMsg.setSubAddType(entity.getSubAddType());
checkDingMsg.setPath(String.format("/api/v1/perform/info?id=%s&&performType=other", entity.getId()));
Rest<String> msgRest = messageService.sendDingTalkWorkMsg(checkDingMsg);
} else {
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
}
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
} }
} }
@Override @Override
public void examine(CheckOtherRecordEntity entity, Context context) throws AppException { public void examine(CheckOtherRecordEntity entity, Context context) throws AppException {
if(entity.getId()==null){ if (entity.getId() == null) {
throw new AppException("核查记录ID不能为空"); throw new AppException("核查记录ID不能为空");
} }
if (context != null && context.getUser()!=null) { if (context != null && context.getUser() != null) {
IUser user = context.getUser(); IUser user = context.getUser();
entity.setUpdateUserId(user.getId()); entity.setUpdateUserId(user.getId());
entity.setCheckPerson(user.getRealName()); entity.setCheckPerson(user.getRealName());
...@@ -68,23 +121,26 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt ...@@ -68,23 +121,26 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt
entity.setUpdateTime(entity.getCheckTime()); entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理) entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity); dao.update(entity);
try{ //发送钉钉通知信息
sendCheckDingTalk(entity);
try {
CheckOtherRecordEntity temp = this.get(entity.getId()); CheckOtherRecordEntity temp = this.get(entity.getId());
if(temp!=null) { if (temp != null) {
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery(); StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId()); query.setStaffId(temp.getStaffId());
summaryCheck(query); summaryCheck(query);
} }
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e); } catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
} }
} }
@Override @Override
public List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException { public List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException {
if(StringUtils.isEmpty(query.getCheckTimeStart())||StringUtils.isEmpty(query.getCheckTimeStart())){ if (StringUtils.isEmpty(query.getCheckTimeStart()) || StringUtils.isEmpty(query.getCheckTimeStart())) {
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar=Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.DAY_OF_MONTH, 1);
String startTime = format.format(calendar.getTime()); String startTime = format.format(calendar.getTime());
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
...@@ -93,27 +149,27 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt ...@@ -93,27 +149,27 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt
query.setCheckTimeEnd(endTime); query.setCheckTimeEnd(endTime);
} }
List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query); List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query);
if(CollectionUtils.isNotEmpty(summaryVoList)){ if (CollectionUtils.isNotEmpty(summaryVoList)) {
for(StaffCheckSummaryVo vo:summaryVoList){ for (StaffCheckSummaryVo vo : summaryVoList) {
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity(); StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
BeanUtils.copyProperties(vo,staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo)); BeanUtils.copyProperties(vo, staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo));
staffPerformSummaryEntity.setOtherScore(vo.getSumScore()); staffPerformSummaryEntity.setOtherScore(vo.getSumScore());
StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery(); StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery();
summaryQuery.setStaffId(vo.getStaffId()); summaryQuery.setStaffId(vo.getStaffId());
summaryQuery.setYear(vo.getYear()); summaryQuery.setYear(vo.getYear());
summaryQuery.setMonth(vo.getMonth()); summaryQuery.setMonth(vo.getMonth());
StaffPerformSummaryEntity temp = staffPerformSummaryService.selectOne(summaryQuery); StaffPerformSummaryEntity temp = staffPerformSummaryService.selectOne(summaryQuery);
if(temp!=null){ if (temp != null) {
if(temp.getReviewScore()==null){ if (temp.getReviewScore() == null) {
staffPerformSummaryEntity.setReviewScore(new BigDecimal(0)); staffPerformSummaryEntity.setReviewScore(new BigDecimal(0));
} }
if(temp.getAttendScore()==null){ if (temp.getAttendScore() == null) {
staffPerformSummaryEntity.setAttendScore(new BigDecimal(0)); staffPerformSummaryEntity.setAttendScore(new BigDecimal(0));
} }
if(temp.getGoworkScore()==null){ if (temp.getGoworkScore() == null) {
staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0)); staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0));
} }
if(temp.getEffectScore()==null){ if (temp.getEffectScore() == null) {
staffPerformSummaryEntity.setEffectScore(new BigDecimal(0)); staffPerformSummaryEntity.setEffectScore(new BigDecimal(0));
} }
BigDecimal erro = new BigDecimal(0); BigDecimal erro = new BigDecimal(0);
...@@ -131,7 +187,7 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt ...@@ -131,7 +187,7 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt
staffPerformSummaryEntity.setId(temp.getId()); staffPerformSummaryEntity.setId(temp.getId());
staffPerformSummaryEntity.setUpdateTime(new Date()); staffPerformSummaryEntity.setUpdateTime(new Date());
staffPerformSummaryService.update(staffPerformSummaryEntity); staffPerformSummaryService.update(staffPerformSummaryEntity);
}else { } else {
staffPerformSummaryEntity.setAttendScore(new BigDecimal(0)); staffPerformSummaryEntity.setAttendScore(new BigDecimal(0));
staffPerformSummaryEntity.setReviewScore(new BigDecimal(0)); staffPerformSummaryEntity.setReviewScore(new BigDecimal(0));
staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0)); staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0));
......
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.CheckStatusEnum; import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.PerformTypeEnum;
import com.mortals.xhx.common.code.SubMethodEnum; import com.mortals.xhx.common.code.SubMethodEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.dingding.CheckDingMsg;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.Link; 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.Msg;
import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq; import com.mortals.xhx.module.dingding.personal.model.req.workmsg.WorkMsgReq;
...@@ -55,6 +59,8 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR ...@@ -55,6 +59,8 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
private IDingPersonService dingPersonService; private IDingPersonService dingPersonService;
@Autowired @Autowired
private StaffService staffService; private StaffService staffService;
@Autowired
private MessageService messageService;
@Override @Override
...@@ -70,44 +76,38 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR ...@@ -70,44 +76,38 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
} }
//发送钉钉通知信息 //发送钉钉通知信息
if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) { if (SubMethodEnum.系统自动.getValue() == entity.getSubMethod()) {
//绩效核查通知 sendCheckDingTalk(entity);
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("http://www.baidu.com");
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 { private void sendCheckDingTalk(CheckReviewRecordEntity entity) {
log.error("发送工作消息失败,msg:{}", sendWorkRest.getMsg()); String ruleStr = String.format("%s/%s/%s", PerformTypeEnum.评价差评绩效.getDesc(), entity.getCategoryName(), entity.getRuleName());
}
} else { //绩效核查通知
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg()); StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
} if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
CheckDingMsg checkDingMsg = new CheckDingMsg();
checkDingMsg.setUserIds(personRest.getData());
checkDingMsg.setDateTime(DateUtil.formatDateTime(entity.getReviewTime() == null ? new Date() : entity.getReviewTime()));
checkDingMsg.setRuleStr(ruleStr);
checkDingMsg.setPerformTypeStr(PerformTypeEnum.评价差评绩效.getDesc());
checkDingMsg.setScore(entity.getScore().toString());
checkDingMsg.setSubAddType(entity.getSubAddType());
checkDingMsg.setPath(String.format("/api/v1/perform/info?id=%s&&performType=review", entity.getId()));
Rest<String> msgRest = messageService.sendDingTalkWorkMsg(checkDingMsg);
} else { } else {
log.error("员工未找到,staffId:{}", entity.getStaffId()); log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
} }
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
} }
} }
@Override @Override
public void examine(CheckReviewRecordEntity entity, Context context) throws AppException { public void examine(CheckReviewRecordEntity entity, Context context) throws AppException {
if (entity.getId() == null) { if (entity.getId() == null) {
...@@ -122,6 +122,8 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR ...@@ -122,6 +122,8 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
entity.setUpdateTime(entity.getCheckTime()); entity.setUpdateTime(entity.getCheckTime());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理) entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity); dao.update(entity);
//发送钉钉通知信息
sendCheckDingTalk(entity);
try { try {
CheckReviewRecordEntity temp = this.get(entity.getId()); CheckReviewRecordEntity temp = this.get(entity.getId());
if (temp != null) { if (temp != null) {
......
package com.mortals.xhx.module.dingding;
import lombok.Data;
@Data
public class CheckDingMsg {
private String userIds;
private String dateTime;
private String ruleStr;
private String performTypeStr;
private String score;
private Integer subAddType;
private String path; //请求路径相对地址
private Integer appealResult;
private String appealDesc;
}
...@@ -22,4 +22,8 @@ public class PerformAttendAppealVo extends BaseEntityLong { ...@@ -22,4 +22,8 @@ public class PerformAttendAppealVo extends BaseEntityLong {
*/ */
private Integer statType; private Integer statType;
private String categoryName;
private String performTypeStr;
} }
\ No newline at end of file
...@@ -8,18 +8,22 @@ import com.mortals.framework.model.OrderCol; ...@@ -8,18 +8,22 @@ import com.mortals.framework.model.OrderCol;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
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.dingding.CheckDingMsg;
import com.mortals.xhx.module.dingding.personal.service.IDingPersonService;
import com.mortals.xhx.module.perform.dao.PerformAttendAppealDao; import com.mortals.xhx.module.perform.dao.PerformAttendAppealDao;
import com.mortals.xhx.module.perform.model.PerformAttendAppealEntity; import com.mortals.xhx.module.perform.model.*;
import com.mortals.xhx.module.perform.model.PerformAttendAppealFilesEntity;
import com.mortals.xhx.module.perform.model.PerformAttendAppealFilesQuery;
import com.mortals.xhx.module.perform.model.PerformAttendAppealQuery;
import com.mortals.xhx.module.perform.model.vo.AppealInfo; import com.mortals.xhx.module.perform.model.vo.AppealInfo;
import com.mortals.xhx.module.perform.model.vo.AppealSummaryQuery; import com.mortals.xhx.module.perform.model.vo.AppealSummaryQuery;
import com.mortals.xhx.module.perform.service.PerformAttendAppealFilesService; import com.mortals.xhx.module.perform.service.PerformAttendAppealFilesService;
import com.mortals.xhx.module.perform.service.PerformAttendAppealService; import com.mortals.xhx.module.perform.service.PerformAttendAppealService;
import com.mortals.xhx.module.perform.service.PerformRulesCategoryService;
import com.mortals.xhx.module.perform.service.PerformRulesService;
import com.mortals.xhx.module.staff.model.StaffEntity;
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;
...@@ -57,6 +61,41 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -57,6 +61,41 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf
@Autowired @Autowired
private PerformAttendAppealFilesService performAttendAppealFilesService; private PerformAttendAppealFilesService performAttendAppealFilesService;
@Autowired
private IDingPersonService dingPersonService;
@Autowired
private StaffService staffService;
@Autowired
private MessageService messageService;
@Autowired
private PerformRulesCategoryService categoryService;
@Autowired
private PerformRulesService rulesService;
private void sendCheckDingTalk(PerformAttendAppealEntity entity) {
String ruleStr = String.format("%s/%s/%s", PerformTypeEnum.getByValue(entity.getPerformType()).getDesc(), entity.getCategoryName(), entity.getRuleName());
//绩效核查通知
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
Rest<String> personRest = dingPersonService.getPersonByMobile(staffCache.getPhoneNumber());
if (YesNoEnum.YES.getValue() == personRest.getCode()) {
CheckDingMsg checkDingMsg = new CheckDingMsg();
checkDingMsg.setUserIds(personRest.getData());
checkDingMsg.setDateTime(DateUtil.formatDateTime(entity.getAppealTime() == null ? new Date() : entity.getAppealTime()));
checkDingMsg.setRuleStr(ruleStr);
checkDingMsg.setScore(entity.getScore().toString());
checkDingMsg.setAppealResult(entity.getAppealResult());
checkDingMsg.setAppealDesc(entity.getAppealDesc());
Rest<String> msgRest = messageService.sendDingTalkAppealMsg(checkDingMsg);
} else {
log.error("根据手机号码获取人员错误,msg:{}", personRest.getMsg());
}
} else {
log.error("员工未找到,staffId:{}", entity.getStaffId());
}
}
@Override @Override
public Rest<Void> audit(PerformAttendAppealEntity appeal, Context context) { public Rest<Void> audit(PerformAttendAppealEntity appeal, Context context) {
...@@ -73,6 +112,15 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -73,6 +112,15 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf
appealEntity.setUpdateTime(new Date()); appealEntity.setUpdateTime(new Date());
this.getDao().update(appealEntity); this.getDao().update(appealEntity);
PerformRulesEntity ruleCache = rulesService.getCache(appealEntity.getRuleId().toString());
if (!ObjectUtils.isEmpty(ruleCache)) {
PerformRulesCategoryEntity categoryEntity = categoryService.get(ruleCache.getCategoryId());
if (!ObjectUtils.isEmpty(categoryEntity)) {
appealEntity.setCategoryName(categoryEntity.getName());
}
}
String appealMsg = "申诉成功,返回所扣分数,申诉ID:" + appeal.getId().toString(); String appealMsg = "申诉成功,返回所扣分数,申诉ID:" + appeal.getId().toString();
if (appeal.getAppealResult() == AppealResultEnum.通过.getValue()) { if (appeal.getAppealResult() == AppealResultEnum.通过.getValue()) {
if (appeal.getSubAddType() == SubAddTypeEnum.扣除.getValue()) { if (appeal.getSubAddType() == SubAddTypeEnum.扣除.getValue()) {
...@@ -149,6 +197,9 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -149,6 +197,9 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf
} }
} }
} }
sendCheckDingTalk(appealEntity);
return Rest.ok(); return Rest.ok();
} }
...@@ -183,10 +234,10 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -183,10 +234,10 @@ public class PerformAttendAppealServiceImpl extends AbstractCRUDServiceImpl<Perf
query.setSummaryType(SummaryTopTypeEnum..getValue()); query.setSummaryType(SummaryTopTypeEnum..getValue());
} }
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) { if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
query.setCheckTimeStart(DateUtils.getCurrDateTime("yyyy")+"-01-01"); query.setCheckTimeStart(DateUtils.getCurrDateTime("yyyy") + "-01-01");
} }
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) { if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
query.setCheckTimeStart(DateUtils.getCurrDateTime("yyyy-MM")+"-01"); query.setCheckTimeStart(DateUtils.getCurrDateTime("yyyy-MM") + "-01");
} }
if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) { if (query.getSummaryType() == SummaryTopTypeEnum..getValue()) {
query.setCheckTimeStart(DateUtils.getCurrStrDate()); query.setCheckTimeStart(DateUtils.getCurrStrDate());
......
...@@ -72,4 +72,5 @@ dingtalk: ...@@ -72,4 +72,5 @@ dingtalk:
agentId: @profiles.dingtalk.agentId@ agentId: @profiles.dingtalk.agentId@
AppKey: @profiles.dingtalk.appKey@ AppKey: @profiles.dingtalk.appKey@
AppSecret: @profiles.dingtalk.appSecret@ AppSecret: @profiles.dingtalk.appSecret@
webUrl: @profiles.webUrl@
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