Merge branch 'dev' of https://gitea.yeyaguitu.cn/ecology/ebu_ecology_dev1 into dev
合并远程分支,保时捷流程数据推送,api创建流程,ihg用户信息元素后段dev
commit
2c3fcb7ac4
|
@ -59,7 +59,7 @@ function initTimeoutDate(){
|
|||
console.log('计算下次超时日期 ', computeTimeoutDate);
|
||||
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
||||
var detail2LineNum = WfForm.getDetailRowCount("detail_2");
|
||||
setTimeout(()=>{
|
||||
setTimeout(function (){
|
||||
WfForm.changeFieldValue(timeoutRemindDateFiled, {value: computeTimeoutDate});
|
||||
// 判断流程提交走向
|
||||
console.log('主表跟踪触发行数 : ', trackingLine)
|
||||
|
@ -102,6 +102,9 @@ function getCurrentDate() {
|
|||
function parseDate(date) {
|
||||
var currentYear = date.getFullYear();
|
||||
var currentMonth = date.getMonth() + 1;// getMonth()返回0~11,需要加1
|
||||
if(currentMonth < 10){
|
||||
currentMonth = '0' + currentMonth;
|
||||
}
|
||||
var currentDay = date.getDate();
|
||||
return currentYear + '-' + currentMonth + '-' + currentDay;
|
||||
}
|
||||
|
|
|
@ -1210,9 +1210,15 @@ public class Util extends weaver.general.Util {
|
|||
Properties prop = new Properties();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
InputStream inputStream = null;
|
||||
InputStreamReader reader = null;
|
||||
try {
|
||||
inputStream = new BufferedInputStream(new FileInputStream(path));
|
||||
prop.load(inputStream);
|
||||
/**
|
||||
* <h2>解决配置文件中 值包含中文乱码问题</h2>
|
||||
* <h2>xuanran.wang 2023-06-26 10:16</h2>
|
||||
**/
|
||||
reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
prop.load(reader);
|
||||
Enumeration<?> enumeration = prop.propertyNames();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
String key = String.valueOf(enumeration.nextElement());
|
||||
|
@ -1222,6 +1228,9 @@ public class Util extends weaver.general.Util {
|
|||
throw new RuntimeException("找不到文件:" + path);
|
||||
} finally {
|
||||
try {
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.api.xuanran.wang.immc.controller;
|
||||
|
||||
import aiyh.utils.ApiResult;
|
||||
import aiyh.utils.Util;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.api.xuanran.wang.immc.dto.ImmcWorkFlowToKafkaDto;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.apache.log4j.Logger;
|
||||
import weaver.xuanran.wang.immc.service.WorkFlowToVmsAndMQService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1>智己流程操作下发kafka</h1>
|
||||
*
|
||||
* @author xuanran.wang
|
||||
* @date 2023/6/21 15:40
|
||||
*/
|
||||
@Path("/wxr/immc/workflow/kafka")
|
||||
public class ApiImmcWorkFlowToKafka {
|
||||
|
||||
private final Logger log = Util.getLogger();
|
||||
|
||||
private final WorkFlowToVmsAndMQService service = new WorkFlowToVmsAndMQService();
|
||||
|
||||
@Path("/del")
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
public String delWorkFlowToKafka(@Context HttpServletRequest request,
|
||||
@Context HttpServletResponse response,
|
||||
@RequestBody ImmcWorkFlowToKafkaDto config){
|
||||
try {
|
||||
log.info("删除流程下发kafka配置对象 : " + JSONObject.toJSONString(config));
|
||||
// ImmcWorkFlowToKafkaDto dto = JSONObject.parseObject(JSONObject.toJSONString(config), ImmcWorkFlowToKafkaDto.class);
|
||||
service.workFlowToKafkaByDto(config);
|
||||
return ApiResult.successNoData();
|
||||
}catch (Exception e){
|
||||
log.error("删除流程下发kafka执行失败 : [ " + e.getMessage() + " ]");
|
||||
log.error(Util.getErrString(e));
|
||||
return ApiResult.error("下发kafka失败! " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.api.xuanran.wang.immc.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* <h1>vo 智己流程下发kafka</h1>
|
||||
*
|
||||
* @author xuanran.wang
|
||||
* @date 2023/6/21 16:08
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ImmcWorkFlowToKafkaDto {
|
||||
private String onlyMark;
|
||||
private Integer billTable;
|
||||
private String config;
|
||||
private Integer requestId;
|
||||
private String skip;
|
||||
}
|
|
@ -49,6 +49,10 @@ public class WorkFlowToVmsAndMQ extends SafeCusBaseAction {
|
|||
@PrintParamMark
|
||||
@ActionOptionalParam(value = "message", desc = "报错返回信息字段")
|
||||
private String msg;
|
||||
@PrintParamMark
|
||||
@ActionOptionalParam(value = "0", desc = "发送mq跳过校验")
|
||||
private String mqSkip;
|
||||
|
||||
|
||||
@Override
|
||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||
|
@ -59,6 +63,6 @@ public class WorkFlowToVmsAndMQ extends SafeCusBaseAction {
|
|||
.successVal(Util.null2DefaultStr(successVal, "200"))
|
||||
.message(Util.null2DefaultStr(msg, "message"))
|
||||
.build();
|
||||
workFlowToVmsAndMQService.workFlowToVmsAndMQ(onlyMark, billTable, requestId, vmsResponseVoField, kafkaConfig);
|
||||
workFlowToVmsAndMQService.workFlowToVmsAndMQ(onlyMark, billTable, requestId, vmsResponseVoField, kafkaConfig, mqSkip);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,19 +32,20 @@ public class CusListValue implements CusInterfaceGetValue {
|
|||
// 如果fileName不为空则对集合中每个map添加"fileName":value value则是附件字段名称
|
||||
String fileName = Util.null2DefaultStr(pathParam.get("fileName"), "");
|
||||
if(StringUtils.isNotBlank(cusSql)){
|
||||
cusSql = cusSql.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
|
||||
if (StringUtils.isNotBlank(attachmentField)) {
|
||||
for (String item : attachmentField.split(",")) {
|
||||
String[] fields = attachmentField.split(",");
|
||||
for (String item : fields) {
|
||||
String filedValue = Util.null2DefaultStr(mainMap.get(item),"");
|
||||
if(StringUtils.isNotBlank(Util.null2DefaultStr(mainMap.get(filedValue),""))){
|
||||
cusSql = cusSql
|
||||
.replace("{?docIds}", "( " + filedValue + " )")
|
||||
.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
|
||||
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
|
||||
String fileSql = cusSql;
|
||||
if(StringUtils.isNotBlank(filedValue)){
|
||||
fileSql = fileSql.replace("{?docIds}", "( " + filedValue + " )");
|
||||
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(fileSql);
|
||||
if(CollectionUtils.isEmpty(attachmentInfo)){
|
||||
continue;
|
||||
}
|
||||
// 往map中put附件字段名
|
||||
if(StringUtils.isBlank(fileName)){
|
||||
if(StringUtils.isNotBlank(fileName)){
|
||||
attachmentInfo.forEach(file ->{
|
||||
file.put(fileName, item);
|
||||
});
|
||||
|
@ -52,6 +53,11 @@ public class CusListValue implements CusInterfaceGetValue {
|
|||
list.addAll(attachmentInfo);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
|
||||
if(CollectionUtils.isNotEmpty(attachmentInfo)){
|
||||
list.addAll(attachmentInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package weaver.xuanran.wang.immc.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import weaver.conn.RecordSet;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1>请求url, 请求参数</h1>
|
||||
*
|
||||
* @author xuanran.wang
|
||||
* @date 2023/6/21 15:50
|
||||
*/
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class CusRequestParam {
|
||||
private String url;
|
||||
private RecordSet rs;
|
||||
private Map<String, Object> param;
|
||||
private String requestId;
|
||||
}
|
|
@ -6,24 +6,25 @@ import aiyh.utils.httpUtil.ResponeVo;
|
|||
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import com.api.xuanran.wang.immc.dto.ImmcWorkFlowToKafkaDto;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.kafka.clients.producer.KafkaProducer;
|
||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||
import org.apache.kafka.clients.producer.RecordMetadata;
|
||||
import org.apache.log4j.Logger;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
||||
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||
import weaver.xuanran.wang.common.util.CommonUtil;
|
||||
import weaver.xuanran.wang.immc.entity.CusRequestParam;
|
||||
import weaver.xuanran.wang.immc.entity.VmsResponseVoField;
|
||||
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.file.Files;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
|
@ -43,10 +44,23 @@ public class WorkFlowToVmsAndMQService {
|
|||
private static final String VMS_SUCCESS = "vms_success";
|
||||
private static final String SUCCESS = "0";
|
||||
|
||||
private static final String SKIP = "1";
|
||||
|
||||
{
|
||||
httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); // 全局请求头
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>将流程数据下发到kafka中</h1>
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/6/21 16:14
|
||||
* @param dto 接口封装对象
|
||||
**/
|
||||
public void workFlowToKafkaByDto(ImmcWorkFlowToKafkaDto dto){
|
||||
this.checkDtoFieldValueNotNull(dto);
|
||||
this.workFlowToVmsAndMQ(dto.getOnlyMark(), "formtable_main_" + Math.abs(dto.getBillTable()),
|
||||
String.valueOf(dto.getRequestId()), null, dto.getConfig(), dto.getSkip());
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>推送数据</h1>
|
||||
|
@ -59,19 +73,19 @@ public class WorkFlowToVmsAndMQService {
|
|||
* @author xuanran.wang
|
||||
* @dateTime 2022/12/5 17:05
|
||||
**/
|
||||
public void workFlowToVmsAndMQ(String onlyMark, String billTable, String requestId, VmsResponseVoField vmsResponseVoField, String config) {
|
||||
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); // 将配置参数通过唯一标识查询处理成树形结构
|
||||
String selectMainSql = CommonUtil.getSelectSql(requestMappingConfig, billTable);
|
||||
log.info(Util.logStr("查询主表数据sql : {}, requestId : {}", selectMainSql, requestId));
|
||||
RecordSet recordSet = new RecordSet();
|
||||
recordSet.executeQuery(selectMainSql, requestId);
|
||||
recordSet.next();
|
||||
String url = requestMappingConfig.getRequestUrl();
|
||||
dealWithMapping.setMainTable(billTable);
|
||||
Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig);
|
||||
String vmsSuccess = Util.null2DefaultStr(recordSet.getString(VMS_SUCCESS), "");
|
||||
String mqSuccess = Util.null2DefaultStr(recordSet.getString(MQ_SUCCESS), "");
|
||||
if (!SUCCESS.equals(vmsSuccess)) {
|
||||
public void workFlowToVmsAndMQ(String onlyMark, String billTable,
|
||||
String requestId, VmsResponseVoField vmsResponseVoField,
|
||||
String config, String skip) {
|
||||
CusRequestParam requestParam = getRequestParam(onlyMark, billTable, requestId);
|
||||
if(Objects.isNull(requestParam)){
|
||||
return;
|
||||
}
|
||||
RecordSet rs = requestParam.getRs();
|
||||
Map<String, Object> param = requestParam.getParam();
|
||||
String url = requestParam.getUrl();
|
||||
String vmsSuccess = Util.null2DefaultStr(rs.getString(VMS_SUCCESS),"");
|
||||
String mqSuccess = Util.null2DefaultStr(rs.getString(MQ_SUCCESS),"");
|
||||
if(!SUCCESS.equals(vmsSuccess) && !Objects.isNull(vmsResponseVoField)){
|
||||
ResponeVo responeVo;
|
||||
try {
|
||||
responeVo = httpUtils.apiPost(url, param);
|
||||
|
@ -81,20 +95,68 @@ public class WorkFlowToVmsAndMQService {
|
|||
parseResponseVo(responeVo, url, param, vmsResponseVoField);
|
||||
updateWorkFlow(VMS_SUCCESS, billTable, requestId);
|
||||
}
|
||||
if (!SUCCESS.equals(mqSuccess) && StringUtils.isNotBlank(config)) {
|
||||
if((!SUCCESS.equals(mqSuccess) || SKIP.equals(skip)) && StringUtils.isNotBlank(config)){
|
||||
sendToMQ(config, param);
|
||||
updateWorkFlow(MQ_SUCCESS, billTable, requestId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>校验对象中字段值是否为空</h1>
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/6/21 16:17
|
||||
* @param object 对象
|
||||
**/
|
||||
public void checkDtoFieldValueNotNull(Object object){
|
||||
try {
|
||||
Field[] fields = object.getClass().getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
Object o = field.get(object);
|
||||
if(Objects.isNull(o)){
|
||||
throw new CustomerException("该对象中 " + field.getName() + " 字段值为空!");
|
||||
}
|
||||
}
|
||||
}catch (Exception e) {
|
||||
throw new CustomerException("校验对象失败 : [ " + e.getMessage() + " ]", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>对发送对数据参数进行封装</h1>
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/6/21 15:56
|
||||
* @param onlyMark 建模配置唯一标识
|
||||
* @param billTable 流程表名
|
||||
* @param requestId 请求id
|
||||
* @return 封装的数据
|
||||
**/
|
||||
public CusRequestParam getRequestParam(String onlyMark, String billTable, String requestId){
|
||||
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); // 将配置参数通过唯一标识查询处理成树形结构
|
||||
if(Objects.isNull(requestMappingConfig)){
|
||||
throw new CustomerException("唯一标识为 : " + onlyMark + " ,在参数配置表中没有找到对应的配置!");
|
||||
}
|
||||
String selectMainSql = CommonUtil.getSelectSql(requestMappingConfig, billTable);
|
||||
// log.info(Util.logStr("查询主表数据sql : {}, requestId : {}", selectMainSql, requestId));
|
||||
RecordSet recordSet = new RecordSet();
|
||||
if (recordSet.executeQuery(selectMainSql, requestId) && recordSet.next()) {
|
||||
String url = requestMappingConfig.getRequestUrl();
|
||||
dealWithMapping.setMainTable(billTable);
|
||||
Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig);
|
||||
return CusRequestParam.builder().url(url).rs(recordSet).requestId(requestId).param(param).build();
|
||||
}else {
|
||||
log.error("该流程暂未查到数据! requestId : " + requestId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>解析响应对象</h1>
|
||||
*
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2022/12/23 11:25
|
||||
* @param responseVo 响应对象
|
||||
* @param url 地址
|
||||
* @param requestParam 请求
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2022/12/23 11:25
|
||||
**/
|
||||
private void parseResponseVo(ResponeVo responseVo, String url, Map<String, Object> requestParam, VmsResponseVoField vmsResponseVoField){
|
||||
if (responseVo.getCode() != SUCCESS_CODE) { // 相应状态码
|
||||
|
@ -114,11 +176,10 @@ public class WorkFlowToVmsAndMQService {
|
|||
|
||||
/**
|
||||
* <h1>将流程信息发送到kafka</h1>
|
||||
*
|
||||
* @param kafkaConfig kafka配置文件名称
|
||||
* @param message 消息对象
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/3/30 14:56
|
||||
* @param kafkaConfig kafka配置文件名称
|
||||
* @param message 消息对象
|
||||
**/
|
||||
public void sendToMQ(String kafkaConfig, Map<String, Object> message){
|
||||
KafkaProducer<String, String> producer = null;
|
||||
|
@ -162,12 +223,11 @@ public class WorkFlowToVmsAndMQService {
|
|||
|
||||
/**
|
||||
* <h1>更新流程sql</h1>
|
||||
*
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/3/30 19:18
|
||||
* @param field 主表字段
|
||||
* @param tableName 表名
|
||||
* @param requestId 请求id
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/3/30 19:18
|
||||
**/
|
||||
public void updateWorkFlow(String field, String tableName, String requestId){
|
||||
String updateSQL = "update " + tableName + " set " + field + " = " + SUCCESS + " where requestid = ?";
|
||||
|
|
|
@ -3,13 +3,16 @@ package weaver.xuanran.wang.sh_bigdata.common.util;
|
|||
import aiyh.utils.Util;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.icbc.api.internal.apache.http.impl.cookie.S;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import weaver.workflow.request.todo.RequestStatusObj;
|
||||
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTask;
|
||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoLeaderTask;
|
||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
|
||||
import weaver.xuanran.wang.sh_bigdata.task_async.mapper.SendTodoTaskMapper;
|
||||
|
||||
|
@ -63,8 +66,8 @@ public class SendTodoTaskUtil {
|
|||
* @param objs 任务对象
|
||||
* @return 三方系统任务接收对象
|
||||
**/
|
||||
public List<CusTodoTask> getTodoTaskInfo(List<RequestStatusObj> objs){
|
||||
ArrayList<CusTodoTask> res = new ArrayList<>();
|
||||
public List<Object> getTodoTaskInfo(List<RequestStatusObj> objs){
|
||||
ArrayList<Object> res = new ArrayList<>();
|
||||
for (RequestStatusObj obj : objs) {
|
||||
String taskId = getTaskId(0, obj);
|
||||
CusTodoTask todoTask = new CusTodoTask();
|
||||
|
@ -80,20 +83,62 @@ public class SendTodoTaskUtil {
|
|||
}
|
||||
todoTask.setPcAgentId(pcAgentId);
|
||||
String todoSSOCallBackUrl = ShBigDataUtil.getPropertiesValByKey("todoSSOCallBackUrl");
|
||||
StringBuilder sb = new StringBuilder(todoSSOCallBackUrl);
|
||||
String todoPcSSOCallBackUrl = ShBigDataUtil.getPropertiesValByKey("todoPcSSOCallBackUrl");
|
||||
if(StringUtils.isBlank(todoPcSSOCallBackUrl)){
|
||||
todoPcSSOCallBackUrl = todoSSOCallBackUrl;
|
||||
}
|
||||
// 移动端链接
|
||||
StringBuilder mobileUrl = new StringBuilder(todoSSOCallBackUrl);
|
||||
// pc端链接
|
||||
StringBuilder pcUrl = new StringBuilder(todoPcSSOCallBackUrl);
|
||||
todoTask.setLinkUrl(appendParam(pcUrl, userId, requestId).toString());
|
||||
todoTask.setMobileLinkUrl(appendParam(mobileUrl, userId, requestId).append("&mobile=1").toString());
|
||||
todoTask.setSender(getConvertHrm(0, obj, String.valueOf(obj.getCreator().getUID())));
|
||||
todoTask.setReceiver(getConvertHrm(1, obj, String.valueOf(userId)));
|
||||
// 是否领导待办逻辑处理
|
||||
int nodeId = obj.getNodeid();
|
||||
String nodeNme = obj.getNodename();
|
||||
if(strContainsKey(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderNodeId"), String.valueOf(nodeId))
|
||||
|| strContainsKey(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderNodeName"), nodeNme)){
|
||||
CusTodoLeaderTask leaderTask = new CusTodoLeaderTask();
|
||||
// 进行数据拷贝
|
||||
BeanUtils.copyProperties(todoTask, leaderTask);
|
||||
leaderTask.setLeader(Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderValue"),"1"));
|
||||
res.add(leaderTask);
|
||||
continue;
|
||||
}
|
||||
res.add(todoTask);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>判断字符串中是否含有指定字符</h1>
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/6/25 13:24
|
||||
* @param str 字符串
|
||||
* @param key 标识
|
||||
* @return true/false
|
||||
**/
|
||||
public static boolean strContainsKey(String str, String key){
|
||||
return StringUtils.isNotBlank(str) && Arrays.asList(str.split(",")).contains(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h1>参数拼接</h1>
|
||||
* @author xuanran.wang
|
||||
* @dateTime 2023/6/25 13:22
|
||||
* @param sb stringBuilder
|
||||
* @param userId 用户id
|
||||
* @param requestId 请求id
|
||||
* @return 进行字符串拼接
|
||||
**/
|
||||
public static StringBuilder appendParam(StringBuilder sb, int userId, int requestId){
|
||||
sb.append("?user=")
|
||||
.append(userId)
|
||||
.append("&requestId=")
|
||||
.append(requestId);
|
||||
// todoTask.setLinkUrl(Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("taskPcUrl"), oaAddress) + "/spa/workflow/static4form/index.html?#/main/workflow/req?requestid="+requestId);
|
||||
// todoTask.setMobileLinkUrl(Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("taskMobileUrl"), oaAddress) + "/spa/workflow/static4mobileform/index.html?#/req?requestid="+requestId);
|
||||
todoTask.setLinkUrl(sb.toString());
|
||||
todoTask.setMobileLinkUrl(sb.append("&mobile=1").toString());
|
||||
todoTask.setSender(getConvertHrm(0, obj, String.valueOf(obj.getCreator().getUID())));
|
||||
todoTask.setReceiver(getConvertHrm(1, obj, String.valueOf(userId)));
|
||||
res.add(todoTask);
|
||||
}
|
||||
return res;
|
||||
return sb;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
|||
public class ShBigDataUtil {
|
||||
|
||||
private static final String CONFIG_NAME = "ShBigdataConf";
|
||||
|
||||
// 白名单
|
||||
private static final List<String> WHILTE_LIST = new ArrayList<>();
|
||||
|
||||
static {
|
||||
|
@ -38,6 +38,12 @@ public class ShBigDataUtil {
|
|||
WHILTE_LIST.add("ssoInterfaceCompareField");
|
||||
WHILTE_LIST.add("ssoOaCompareField");
|
||||
WHILTE_LIST.add("pcAgentId");
|
||||
// pc回调地址
|
||||
WHILTE_LIST.add("todoPcSSOCallBackUrl");
|
||||
// 统一待办推送领导节点id
|
||||
WHILTE_LIST.add("taskAsyncLeaderNodeId");
|
||||
// 统一待办推送领导节点名称
|
||||
WHILTE_LIST.add("taskAsyncLeaderNodeName");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package weaver.xuanran.wang.sh_bigdata.task_async.entity;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* <h1>领导待办计划任务</h1>
|
||||
*
|
||||
* @author xuanran.wang
|
||||
* @date 2023/6/25 10:50
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CusTodoLeaderTask extends CusTodoTask{
|
||||
private String leader;
|
||||
}
|
|
@ -61,7 +61,7 @@ public class SendTodoTaskServiceImpl implements SendTodoTaskService {
|
|||
.dataKey("")
|
||||
.build();
|
||||
|
||||
List<CusTodoTask> taskInfo = sendTodoTaskUtil.getTodoTaskInfo(todoList);
|
||||
List<Object> taskInfo = sendTodoTaskUtil.getTodoTaskInfo(todoList);
|
||||
log.info("---------------- todoTaskInfo ---------------- \n" + JSONObject.toJSONString(taskInfo));
|
||||
Map<String, Object> response = null;
|
||||
int success = 0;
|
||||
|
@ -74,8 +74,8 @@ public class SendTodoTaskServiceImpl implements SendTodoTaskService {
|
|||
success = 1;
|
||||
}
|
||||
ArrayList<CusTodoTaskToOADetail> details = new ArrayList<>();
|
||||
for (CusTodoTask cusTodoTask : taskInfo) {
|
||||
|
||||
for (Object obj : taskInfo) {
|
||||
CusTodoTask cusTodoTask = (CusTodoTask) obj;
|
||||
CusTodoTaskToOADetail detail = new CusTodoTaskToOADetail();
|
||||
detail.setTaskNum(cusTodoTask.getTaskNum());
|
||||
detail.setRequestUrl(addTodoTaskUrl);
|
||||
|
|
|
@ -26,9 +26,10 @@ taskPcUrl=http://127.0.0.1/spa/workflow/static4form/index.html?#/main/workflow/r
|
|||
taskMobileUrl=http://127.0.0.1/spa/workflow/static4mobileform/index.html?#/req?requestid={requestId}
|
||||
# oa token缓存对象提前过期时间
|
||||
expiryBeforeTime=5
|
||||
# 统一待办单点接口地址
|
||||
# 统一待办单点移动端接口地址
|
||||
todoSSOCallBackUrl=http://127.0.0.1/api/wxr/sh_big_data/sso/login/dhajhdsajdhsajdaskdlakdl
|
||||
|
||||
# 统一待办单点pc接口地址
|
||||
todoPcSSOCallBackUrl=http://127.0.0.1/api/wxr/sh_big_data/sso/login/dhajhdsajdhsajdaskdlakdl
|
||||
# ================ 组织架构同步新增 ================
|
||||
# 分部最大的层级
|
||||
maxLevel=3
|
||||
|
@ -58,3 +59,12 @@ ssoOaCompareField=
|
|||
# sso校验时 接口取值字段
|
||||
ssoInterfaceCompareField=
|
||||
|
||||
|
||||
# =============== 统一待办推送 ===============
|
||||
# 统一待办推送领导节点id
|
||||
taskAsyncLeaderNodeId=1,2
|
||||
# 统一待办推送领导节点名称
|
||||
taskAsyncLeaderNodeName=节点名1,21212
|
||||
# leader字段默认值
|
||||
taskAsyncLeaderValue=1
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import aiyh.utils.GenerateFileUtil;
|
|||
import basetest.BaseTest;
|
||||
import org.junit.Test;
|
||||
import weaver.xuanran.wang.eighty_five_degreec.sap.action.WorkflowToSap;
|
||||
import weaver.xuanran.wang.immc.WorkFlowToVmsAndMQ;
|
||||
|
||||
/**
|
||||
* <h1></h1>
|
||||
|
@ -16,6 +17,6 @@ public class NormalTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testWord(){
|
||||
GenerateFileUtil.createActionDocument(WorkflowToSap.class);
|
||||
GenerateFileUtil.createActionDocument(WorkFlowToVmsAndMQ.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,11 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.junit.Test;
|
||||
import weaver.email.EmailWorkRunnable;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.hrm.User;
|
||||
import weaver.workflow.request.todo.RequestStatusObj;
|
||||
import weaver.xuanran.wang.common.util.CusInfoToOAUtil;
|
||||
import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
|
||||
import weaver.xuanran.wang.sh_bigdata.common.util.SendTodoTaskUtil;
|
||||
import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
|
||||
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.OrganizationHrmSyncFromOtherSys;
|
||||
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OrgHrmAsyncConfigMain;
|
||||
|
@ -22,6 +25,7 @@ import weaver.xuanran.wang.sh_bigdata.org_hrm_async.mapper.OrgHrmAsyncMapper;
|
|||
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.OrgHrmAsyncApiService;
|
||||
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.impl.OrgHrmAsyncApiServiceImpl;
|
||||
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.impl.OrgHrmAsyncServiceImpl;
|
||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
@ -396,4 +400,44 @@ public class BigDataTest extends BaseTest {
|
|||
int id = otherSystemToOAMapper.selectUserIdByOutKey(sql, oaOutKey);
|
||||
log.info("id => " + id);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH(){
|
||||
SendTodoTaskUtil taskUtil = new SendTodoTaskUtil();
|
||||
List<RequestStatusObj> requestStatusObjs = new ArrayList<>();
|
||||
RequestStatusObj obj = new RequestStatusObj();
|
||||
obj.setNodeid(121212);
|
||||
obj.setRequestid(1234455);
|
||||
obj.setUser(new User(1));
|
||||
obj.setNodename("节点名1");
|
||||
obj.setCreator(new User(1));
|
||||
requestStatusObjs.add(obj);
|
||||
|
||||
RequestStatusObj obj2 = new RequestStatusObj();
|
||||
obj2.setNodeid(121);
|
||||
obj2.setRequestid(232432143);
|
||||
obj2.setUser(new User(1));
|
||||
obj2.setNodename("test2");
|
||||
obj2.setCreator(new User(1));
|
||||
requestStatusObjs.add(obj2);
|
||||
|
||||
List<Object> todoTaskInfo = taskUtil.getTodoTaskInfo(requestStatusObjs);
|
||||
System.out.println("todoTaskInfo : " + JSONObject.toJSONString(todoTaskInfo));
|
||||
for (Object todo : todoTaskInfo) {
|
||||
CusTodoTask cusTodoTask = (CusTodoTask) todo;
|
||||
System.out.println("cusTodoTask : " + JSONObject.toJSONString(cusTodoTask));
|
||||
}
|
||||
}
|
||||
@Test
|
||||
public void testI(){
|
||||
String value = "";
|
||||
String valueContext = "123";
|
||||
Map<String, Object> mainMap = new HashMap<>();
|
||||
mainMap.put("requestid","123456");
|
||||
String workFlowVal = "";
|
||||
value = weaver.general.Util.null2String(valueContext)
|
||||
.replace("{?requestid}", String.valueOf(mainMap.get("requestid")))
|
||||
.replace("{?}", workFlowVal);
|
||||
System.out.println(value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue