提交线上测试催办接口

This commit is contained in:
wulin 2020-12-02 11:41:20 +08:00
parent 2bf88f1fe1
commit 34524d4680
7 changed files with 82 additions and 3 deletions

View File

@ -14,7 +14,7 @@ public enum WorkMsgTypeEnum {
LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"), LEADER_PASS(2, "绩效已打分", "去提交给人事", "# 绩效已打分\n ## 你的绩效已经打分"),
//绩效通过人事老板审核的最终审核通知 //绩效通过人事老板审核的最终审核通知
PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"), PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"),
URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"), URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @的绩效需您处理"),
END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"), END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"),
START_WORK(6, "绩效考评待办事项", "去查看", "# 绩效目标制定\n ## @,你的绩效需要制定目标"), START_WORK(6, "绩效考评待办事项", "去查看", "# 绩效目标制定\n ## @,你的绩效需要制定目标"),
START_SCORE(7, "绩效考评待办事项", "去查看", "# 绩效结果输入\n ## @,你的绩效需要输入结果"), START_SCORE(7, "绩效考评待办事项", "去查看", "# 绩效结果输入\n ## @,你的绩效需要输入结果"),

View File

@ -20,6 +20,7 @@ import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.*; import com.lz.modules.flow.model.*;
import com.lz.modules.flow.req.ResultDetailReq; import com.lz.modules.flow.req.ResultDetailReq;
import com.lz.modules.flow.service.*; import com.lz.modules.flow.service.*;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.sys.controller.AbstractController; import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultComment; import com.lz.modules.sys.entity.app.ResultComment;
@ -105,6 +106,9 @@ public class ResultRecordController extends AbstractController {
@Autowired @Autowired
private FlowChartDetailRecordService flowChartDetailRecordService; private FlowChartDetailRecordService flowChartDetailRecordService;
@Autowired
private DingtalkBusiness dingtalkBusiness;
/** /**
* 列表 * 列表
*/ */
@ -331,6 +335,31 @@ public class ResultRecordController extends AbstractController {
return R.ok().put("lzResultRecord", lzResultRecord); return R.ok().put("lzResultRecord", lzResultRecord);
} }
/**
* 信息
*/
@GetMapping("/urging")
@ApiOperation("绩效意见催办-吴林")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "绩效id")})
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = R.class)})
public R getDetail(@RequestParam Long id) {
ResultRecord lzResultRecord = lzResultRecordService.selectResultRecordById(id);
//获取当前节点谁在处理
List<FlowRecord> flowRecords = flowRecordService.selectFlowRecordsByRecordIdAndStatus(id, 2);
if(flowRecords.size() > 0){
List<Long> ids = flowRecords.stream().map(new Function<FlowRecord, Long>() {
@Override
public Long apply(FlowRecord flowRecord) {
return flowRecord.getApprovalStaffId();
}
}).collect(Collectors.toList());
List<StaffEntity> staffs = staffService.selectNamesByIds(ids);
dingtalkBusiness.sendNoticeMsg(lzResultRecord, staffs);
return R.ok("催办成功");
}
return R.error("无可催办人员");
}
/** /**
* 信息 * 信息
*/ */

View File

@ -90,5 +90,7 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId); List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId);
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status); List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex, @Param("status") int status);
List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(@Param("recordId") Long recordId, @Param("status") int status);
} }

View File

@ -86,4 +86,6 @@ public interface FlowRecordService extends IService<FlowRecord> {
List<FlowRecord> selectSkipFlowRecordsById(Long recordId); List<FlowRecord> selectSkipFlowRecordsById(Long recordId);
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status); List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(Long recordId, int status);
} }

View File

@ -231,4 +231,9 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectFirstFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status); return flowRecordMapper.selectFirstFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status);
} }
@Override
public List<FlowRecord> selectFlowRecordsByRecordIdAndStatus(Long recordId, int status){
return flowRecordMapper.selectFlowRecordsByRecordIdAndStatus(recordId, status);
}
} }

View File

@ -104,6 +104,7 @@ public class DingtalkBusiness {
@Resource @Resource
StaffDao staffDao; StaffDao staffDao;
static String homeUrl = "https://lzmanagement.ldxinyong.com/digitization";
@Value("${dingtalk.appid}") @Value("${dingtalk.appid}")
private String appid; private String appid;
@ -585,6 +586,39 @@ public class DingtalkBusiness {
} }
} }
public String sendNoticeMsg(ResultRecord lzResultRecord, List<StaffEntity> staffs) {
ThirdAppConfig thirdAppConfig = thirdAppConfigService.getByAppId(appid);
String token = dingTalkUtil.getAccessTokenWitchEntity(thirdAppConfig);
if(token != null && token.length() > 0){
String url = homeUrl;
if(url.contains("?")){
url += "&halokit=" + System.currentTimeMillis();
}else{
url += "?halokit=" + System.currentTimeMillis();
}
url += ("&detail=1&id=" + lzResultRecord.getId());
url = URLEncoder.encode(url);
url = "dingtalk://dingtalkclient/action/openapp?corpid=" + thirdAppConfig.getCorpId() +
"&container_type=work_platform&app_id=0_" +
appid + "&redirect_type=jump&redirect_url=" + url;
logger.info("推送消息个数{}", staffs.size());
for (StaffEntity info:
staffs) {
logger.info("发送消息给{}url:{}", info, url);
String content = WorkMsgTypeEnum.URGING.getContent().replace("@", lzResultRecord.getStaffName());
dingTalkUtil.sendSingleActionCardMSG(appid, info, WorkMsgTypeEnum.URGING.getTitle(),
content, WorkMsgTypeEnum.URGING.getBtnText(), url, token);
}
return "OK";
}else{
return "token无效";
}
}
public String sendWorkMSG(String appid, Long fromStaffid, long toStaffid, int type) { public String sendWorkMSG(String appid, Long fromStaffid, long toStaffid, int type) {
//获取Token //获取Token
StaffEntity toStaffEntity = staffService.selectStaffById(toStaffid); StaffEntity toStaffEntity = staffService.selectStaffById(toStaffid);
@ -741,13 +775,15 @@ public class DingtalkBusiness {
return R.error("未授权登录"); return R.error("未授权登录");
} }
public class ThreadSendMessage implements Runnable{ public class ThreadSendMessage implements Runnable{
List<StaffSimpleInfo> toStaffids; List<StaffSimpleInfo> toStaffids;
StaffSimpleInfo fromStaff = null; StaffSimpleInfo fromStaff = null;
List<Long> recordIds; List<Long> recordIds;
WorkMsgTypeEnum workMsgTypeEnum; WorkMsgTypeEnum workMsgTypeEnum;
String appid; String appid;
String hostUrl = "https://lzmanagement.ldxinyong.com/digitization"; String hostUrl = homeUrl;
public ThreadSendMessage(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){ public ThreadSendMessage(StaffSimpleInfo fromStaff, List<StaffSimpleInfo> toStaffids, WorkMsgTypeEnum typeEnum, String appid){
this.fromStaff = fromStaff; this.fromStaff = fromStaff;
this.toStaffids = toStaffids; this.toStaffids = toStaffids;

View File

@ -322,5 +322,10 @@
select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[>=]]> #{flowIndex} select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[>=]]> #{flowIndex}
and record_id = #{recordId} and status=#{status} order by flow_index asc and record_id = #{recordId} and status=#{status} order by flow_index asc
</select> </select>
<select id="selectFlowRecordsByRecordIdAndStatus" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0
and record_id = #{recordId} and status=#{status} order by flow_index asc
</select>
</mapper> </mapper>