修改合同逻辑前
parent
df192939ce
commit
138947dc15
|
@ -63,10 +63,10 @@ public class Util extends weaver.general.Util {
|
||||||
private static final UtilService utilService = new UtilService();
|
private static final UtilService utilService = new UtilService();
|
||||||
private static final RecordSet rs = new RecordSet();
|
private static final RecordSet rs = new RecordSet();
|
||||||
private static final String LOGGER_NAME = "cusAYH";
|
private static final String LOGGER_NAME = "cusAYH";
|
||||||
static ToolUtil toolUtil = new ToolUtil();
|
|
||||||
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
||||||
private static final UtilMapper mapper = getMapper(UtilMapper.class);
|
private static final UtilMapper mapper = getMapper(UtilMapper.class);
|
||||||
private static final LoggerUtil loggerUtil = new LoggerUtil();
|
private static final LoggerUtil loggerUtil = new LoggerUtil();
|
||||||
|
static ToolUtil toolUtil = new ToolUtil();
|
||||||
private static volatile Logger log = null;
|
private static volatile Logger log = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1806,20 +1806,13 @@ public class Util extends weaver.general.Util {
|
||||||
public static String getErrString(Throwable throwable) {
|
public static String getErrString(Throwable throwable) {
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
throwable.printStackTrace(new PrintWriter(stringWriter, true));
|
throwable.printStackTrace(new PrintWriter(stringWriter, true));
|
||||||
new Thread(() -> {
|
String errStr = stringWriter.getBuffer().toString();
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
try {
|
try {
|
||||||
stringWriter.close();
|
stringWriter.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
return errStr;
|
||||||
});
|
|
||||||
return stringWriter.getBuffer().toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package aiyh.utils.apirequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>第三方请求工具类</p>
|
|
||||||
* <p>create 2022/1/22 0022 20:15</p>
|
|
||||||
*
|
|
||||||
* @author EBU7-dev1-ayh
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
public class ApiRequestUtil {
|
|
||||||
}
|
|
|
@ -12,7 +12,25 @@ import aiyh.utils.apirequest.pojo.ApiRequestMain;
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 彩蛋 2 书接上回
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 客户想再上级面前表扬我,让给我加点工资 ----> 主要是怕我没做完项目就离职
|
||||||
|
*
|
||||||
|
* 后来客户问老板,我会不会项目没做完离职,老板自信的说不会:
|
||||||
|
* 评了优秀员工,奖励iPhone12一个
|
||||||
|
* 年会抽奖抽中 无人机\ps4任选
|
||||||
|
* 所以坚定我不会离职 (可是,算错了,调薪没成功就已经打算离职了)
|
||||||
|
*
|
||||||
|
* 客户之前似乎争取过让我涨薪,但是具体情况不知道
|
||||||
|
*
|
||||||
|
* 客户说 那个是抽奖嘛,那你给人家加工资了没
|
||||||
|
*
|
||||||
|
* 老板说 加了,加了百分之29%
|
||||||
|
*
|
||||||
|
* 后续自行寻找
|
||||||
|
*/
|
||||||
public class ModelDataHandler implements IDataSourceHandler {
|
public class ModelDataHandler implements IDataSourceHandler {
|
||||||
@Override
|
@Override
|
||||||
public ParamConfigInfo parseDataSource(ApiRequestData apiRequestData) {
|
public ParamConfigInfo parseDataSource(ApiRequestData apiRequestData) {
|
||||||
|
|
|
@ -27,7 +27,22 @@ import java.util.Map;
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 彩蛋3 书接上回
|
||||||
|
*
|
||||||
|
* 好吧,刚好我知道了这件事
|
||||||
|
* 我震惊了,加薪了我竟然不知道,离大谱
|
||||||
|
* 不过客户争取加工资的还要一个同事,他加了,我没加(本来无所谓,大不了问问调薪机制,但是老板们说的破大防了)
|
||||||
|
*
|
||||||
|
* 这一刻,公司的印象全没了,路走死了啊!
|
||||||
|
*
|
||||||
|
* 好了,这回离职的想法更加坚定了
|
||||||
|
*
|
||||||
|
* 当这个注释被看到的时候就是离职的时候(或许没看到就离职了,后来的同学有幸看到注释的话,
|
||||||
|
* 好好想想什么样的场景,自己拿捏,在项目中加班是常事,但是依然没有加班工资,且有时候你会被好几个项目经理一起催,
|
||||||
|
* 结局就是加班到凌晨,免费劳动力。)
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class WorkflowDataHandler implements IDataSourceHandler {
|
public class WorkflowDataHandler implements IDataSourceHandler {
|
||||||
|
|
||||||
private final DataSourceMapper mapper = Util.getMapper(DataSourceMapper.class);
|
private final DataSourceMapper mapper = Util.getMapper(DataSourceMapper.class);
|
||||||
|
@ -56,6 +71,7 @@ public class WorkflowDataHandler implements IDataSourceHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询流程明细表数据,并通过明细表数据解析请求参数
|
* 查询流程明细表数据,并通过明细表数据解析请求参数
|
||||||
|
*
|
||||||
* @param apiRequestData api请求配置参数对象
|
* @param apiRequestData api请求配置参数对象
|
||||||
* @param mainData 流程主表数据信息
|
* @param mainData 流程主表数据信息
|
||||||
* @return api请求参数信息
|
* @return api请求参数信息
|
||||||
|
@ -65,6 +81,10 @@ public class WorkflowDataHandler implements IDataSourceHandler {
|
||||||
List<Map<String, Object>> detailList = mapper.selectDetailData(requestDetailTableName, String.valueOf(mainData.get("id")));
|
List<Map<String, Object>> detailList = mapper.selectDetailData(requestDetailTableName, String.valueOf(mainData.get("id")));
|
||||||
// 获取api请求配置明细表配置信息
|
// 获取api请求配置明细表配置信息
|
||||||
List<ApiRequestParamData> paramDetailList = apiRequestData.getParamDetailList();
|
List<ApiRequestParamData> paramDetailList = apiRequestData.getParamDetailList();
|
||||||
|
// 树形结构转换
|
||||||
|
paramDetailList = Util.listToTree(paramDetailList, ApiRequestParamData::getLineNum, ApiRequestParamData::getParentLine,
|
||||||
|
ApiRequestParamData::getChildList, ApiRequestParamData::setChildList,
|
||||||
|
parentLine -> parentLine == null || parentLine <= 0);
|
||||||
// 创建参数处理对象
|
// 创建参数处理对象
|
||||||
ParamValueRuleHandlerFactory paramHandlerFactory = factory.createParamHandlerFactory(ParamValueRuleHandlerFactory.class);
|
ParamValueRuleHandlerFactory paramHandlerFactory = factory.createParamHandlerFactory(ParamValueRuleHandlerFactory.class);
|
||||||
ParamTypeHandlerFactory paramTypeHandlerFactory = factory.createParamHandlerFactory(ParamTypeHandlerFactory.class);
|
ParamTypeHandlerFactory paramTypeHandlerFactory = factory.createParamHandlerFactory(ParamTypeHandlerFactory.class);
|
||||||
|
@ -78,12 +98,18 @@ public class WorkflowDataHandler implements IDataSourceHandler {
|
||||||
dataMap.put("detail", detail);
|
dataMap.put("detail", detail);
|
||||||
List<ParamInfo> paramInfoList = new ArrayList<>();
|
List<ParamInfo> paramInfoList = new ArrayList<>();
|
||||||
for (ApiRequestParamData paramDetail : paramDetailList) {
|
for (ApiRequestParamData paramDetail : paramDetailList) {
|
||||||
|
// 获取值转换类型对应的枚举对象
|
||||||
ParamValueRuleEnum paramValueRuleEnum = ParamValueRuleEnum.get(paramDetail.getValueRule());
|
ParamValueRuleEnum paramValueRuleEnum = ParamValueRuleEnum.get(paramDetail.getValueRule());
|
||||||
ParamTypeEnum paramTypeEnum = ParamTypeEnum.get(paramDetail.getParamType());
|
ParamTypeEnum paramTypeEnum = ParamTypeEnum.get(paramDetail.getParamType());
|
||||||
|
// 通过工厂获取对应的参数处理对象
|
||||||
IParamValueRuleHandler paramHandler = paramHandlerFactory.createParamHandler(paramValueRuleEnum);
|
IParamValueRuleHandler paramHandler = paramHandlerFactory.createParamHandler(paramValueRuleEnum);
|
||||||
IParamTypeHandler paramTypeHandler = paramTypeHandlerFactory.createParamHandler(paramTypeEnum);
|
IParamTypeHandler paramTypeHandler = paramTypeHandlerFactory.createParamHandler(paramTypeEnum);
|
||||||
Object value = paramTypeHandler.getValue(paramDetail, paramHandler,dataMap);
|
// 处理参数值类型
|
||||||
|
Object value = paramTypeHandler.getValue(paramDetail, paramHandler, dataMap);
|
||||||
|
// 参数类型转换
|
||||||
ParamInfo paramInfo = BeanMapper.INSTANCE.apiRequestData2ParamInfo(paramDetail);
|
ParamInfo paramInfo = BeanMapper.INSTANCE.apiRequestData2ParamInfo(paramDetail);
|
||||||
|
// 设置子结点
|
||||||
|
paramInfo.setChildList(paramDetail.getParamInfoList());
|
||||||
paramInfo.setParamValue(value);
|
paramInfo.setParamValue(value);
|
||||||
paramInfoList.add(paramInfo);
|
paramInfoList.add(paramInfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package aiyh.utils.apirequest.core.typehandler.paramtype;
|
package aiyh.utils.apirequest.core.typehandler.paramtype;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
|
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
|
||||||
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
|
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
|
||||||
import aiyh.utils.apirequest.entity.ApiRequestParamData;
|
import aiyh.utils.apirequest.entity.ApiRequestParamData;
|
||||||
|
import aiyh.utils.apirequest.mapper.ParamValueParseMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,8 +19,21 @@ import java.util.Map;
|
||||||
|
|
||||||
public class ListTypeHandler implements IParamTypeHandler {
|
public class ListTypeHandler implements IParamTypeHandler {
|
||||||
|
|
||||||
|
private ParamValueParseMapper mapper = Util.getMapper(ParamValueParseMapper.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getValue(ApiRequestParamData paramData, IParamValueRuleHandler paramValueRuleHandler, Map<String, Object> dataMap) {
|
public Object getValue(ApiRequestParamData paramData, IParamValueRuleHandler paramValueRuleHandler, Map<String, Object> dataMap) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Map<String,Object>> getDataListBySql(ApiRequestParamData paramData, Map<String,Object> dataMap){
|
||||||
|
mapper.selectListByCustomerSql(paramData.getCustomerValue(),dataMap);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String,Object>> getDataListByDetail(){
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,20 @@
|
||||||
package aiyh.utils.apirequest.core.typehandler.paramtype;
|
package aiyh.utils.apirequest.core.typehandler.paramtype;
|
||||||
|
|
||||||
|
import aiyh.utils.apirequest.core.factory.AbstractFactory;
|
||||||
|
import aiyh.utils.apirequest.core.factory.AbstractFactoryImpl;
|
||||||
|
import aiyh.utils.apirequest.core.factory.ParamTypeHandlerFactory;
|
||||||
|
import aiyh.utils.apirequest.core.factory.ParamValueRuleHandlerFactory;
|
||||||
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
|
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
|
||||||
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
|
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
|
||||||
import aiyh.utils.apirequest.entity.ApiRequestParamData;
|
import aiyh.utils.apirequest.entity.ApiRequestParamData;
|
||||||
|
import aiyh.utils.apirequest.entity.ParamInfo;
|
||||||
|
import aiyh.utils.apirequest.enumtype.ParamTypeEnum;
|
||||||
|
import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum;
|
||||||
|
import aiyh.utils.apirequest.mapsturct.BeanMapper;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,8 +27,30 @@ import java.util.Map;
|
||||||
|
|
||||||
public class ObjectTypeHandler implements IParamTypeHandler {
|
public class ObjectTypeHandler implements IParamTypeHandler {
|
||||||
|
|
||||||
|
private final AbstractFactory factory = new AbstractFactoryImpl();
|
||||||
@Override
|
@Override
|
||||||
public Object getValue(ApiRequestParamData paramData, IParamValueRuleHandler paramValueRuleHandler, Map<String, Object> dataMap) {
|
public Object getValue(ApiRequestParamData paramData, IParamValueRuleHandler paramValueRuleHandler, Map<String, Object> dataMap) {
|
||||||
|
List<ApiRequestParamData> childList = paramData.getChildList();
|
||||||
|
if(childList == null || childList.size() == 0){
|
||||||
|
return new HashMap<>(2);
|
||||||
|
}
|
||||||
|
ParamValueRuleHandlerFactory paramHandlerFactory = factory.createParamHandlerFactory(ParamValueRuleHandlerFactory.class);
|
||||||
|
ParamTypeHandlerFactory paramTypeHandlerFactory = factory.createParamHandlerFactory(ParamTypeHandlerFactory.class);
|
||||||
|
List<ParamInfo> paramInfoList = new ArrayList<>();
|
||||||
|
// 对子项进行解析和类型转换
|
||||||
|
for (ApiRequestParamData apiRequestParamData : childList) {
|
||||||
|
// 获取转换规则对应的枚举对象
|
||||||
|
ParamValueRuleEnum paramValueRuleEnum = ParamValueRuleEnum.get(apiRequestParamData.getValueRule());
|
||||||
|
ParamTypeEnum paramTypeEnum = ParamTypeEnum.get(apiRequestParamData.getParamType());
|
||||||
|
IParamTypeHandler paramTypeHandler = paramTypeHandlerFactory.createParamHandler(paramTypeEnum);
|
||||||
|
IParamValueRuleHandler paramHandler = paramHandlerFactory.createParamHandler(paramValueRuleEnum);
|
||||||
|
Object value = paramTypeHandler.getValue(apiRequestParamData, paramHandler,dataMap);
|
||||||
|
ParamInfo paramInfo = BeanMapper.INSTANCE.apiRequestData2ParamInfo(apiRequestParamData);
|
||||||
|
paramInfo.setParamValue(value);
|
||||||
|
paramInfoList.add(paramInfo);
|
||||||
|
}
|
||||||
|
paramData.setParamInfoList(paramInfoList);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package aiyh.utils.apirequest.core.typehandler.paramvalue;
|
||||||
|
|
||||||
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
|
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
|
||||||
import aiyh.utils.apirequest.entity.ApiRequestParamData;
|
import aiyh.utils.apirequest.entity.ApiRequestParamData;
|
||||||
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
|
@ -43,6 +43,7 @@ public class CustomerSqlRuleHandler implements IParamValueRuleHandler {
|
||||||
if (paramTypeEnum == ParamTypeEnum.LIST_TYPE) {
|
if (paramTypeEnum == ParamTypeEnum.LIST_TYPE) {
|
||||||
List<Map<String, Object>> maps = mapper.selectListByCustomerSql(sqlStr, dataMap);
|
List<Map<String, Object>> maps = mapper.selectListByCustomerSql(sqlStr, dataMap);
|
||||||
dataMap.put(name, maps);
|
dataMap.put(name, maps);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
// 如果是Object类型,则需要查询Map类型的数据,并将数据保存在dataMap中
|
// 如果是Object类型,则需要查询Map类型的数据,并将数据保存在dataMap中
|
||||||
if (paramTypeEnum == ParamTypeEnum.OBJECT_TYPE) {
|
if (paramTypeEnum == ParamTypeEnum.OBJECT_TYPE) {
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package aiyh.utils.apirequest.entity;
|
package aiyh.utils.apirequest.entity;
|
||||||
|
|
||||||
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Api 请求参数配置业务对象</p>
|
* <p>Api 请求参数配置业务对象</p>
|
||||||
|
@ -9,6 +13,9 @@ import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
public class ApiRequestParamData extends ApiRequestParamDetail {
|
public class ApiRequestParamData extends ApiRequestParamDetail {
|
||||||
|
private List<ApiRequestParamData> childList;
|
||||||
|
private List<ParamInfo> paramInfoList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package aiyh.utils.apirequest.entity;
|
package aiyh.utils.apirequest.entity;
|
||||||
|
|
||||||
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -20,17 +20,19 @@ public interface ParamValueParseMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询自定义SQL
|
* 查询自定义SQL
|
||||||
|
*
|
||||||
* @param sql 自定义SQL字符串
|
* @param sql 自定义SQL字符串
|
||||||
* @param map 参数
|
* @param map 参数
|
||||||
* @return 查询到的数据
|
* @return 查询到的数据
|
||||||
*/
|
*/
|
||||||
@Select(custom = true)
|
@Select(custom = true)
|
||||||
@CaseConversion(false)
|
@CaseConversion(false)
|
||||||
public String selectCustomerSql(@SqlString String sql, Map<String,Object> map);
|
public String selectCustomerSql(@SqlString String sql, Map<String, Object> map);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义查询SQL对象
|
* 自定义查询SQL对象
|
||||||
|
*
|
||||||
* @param sqlStr 自定义SQL字符串
|
* @param sqlStr 自定义SQL字符串
|
||||||
* @param dataMap 参数
|
* @param dataMap 参数
|
||||||
* @return 查询到的数据
|
* @return 查询到的数据
|
||||||
|
@ -42,11 +44,34 @@ public interface ParamValueParseMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义查询SQL集合
|
* 自定义查询SQL集合
|
||||||
|
*
|
||||||
* @param sql 自定义SQL字符串
|
* @param sql 自定义SQL字符串
|
||||||
* @param dataMap 参数
|
* @param dataMap 参数
|
||||||
* @return 查询到的数据
|
* @return 查询到的数据
|
||||||
*/
|
*/
|
||||||
@Select(custom = true)
|
@Select(custom = true)
|
||||||
@CaseConversion(false)
|
@CaseConversion(false)
|
||||||
public List<Map<String,Object>> selectListByCustomerSql(@SqlString String sql, Map<String,Object> dataMap);
|
public List<Map<String, Object>> selectListByCustomerSql(@SqlString String sql, Map<String, Object> dataMap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询普通数组的请求参数类型
|
||||||
|
*
|
||||||
|
* @param sql 自定义SQL字符串
|
||||||
|
* @param dataMap 参数
|
||||||
|
* @return 查询到的数据
|
||||||
|
*/
|
||||||
|
@Select(custom = true)
|
||||||
|
@CaseConversion(false)
|
||||||
|
public List<String> selectStringListByCustomerSql(@SqlString String sql, Map<String, Object> dataMap);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询普通数组请求参数类型
|
||||||
|
*
|
||||||
|
* @param sql 自定义SQL字符串
|
||||||
|
* @param dataMap 参数
|
||||||
|
* @return 查询到的数据
|
||||||
|
*/
|
||||||
|
@Select(custom = true)
|
||||||
|
@CaseConversion(false)
|
||||||
|
public List<Integer> selectIntegerListByCustomerSql(@SqlString String sql, Map<String, Object> dataMap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import aiyh.utils.apirequest.pojo.ApiRequestMain;
|
||||||
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -28,6 +29,20 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
* 彩蛋1
|
||||||
|
|
||||||
|
* 2022/02/14 开完会后和上级谈工资的事情
|
||||||
|
* 结果说每年固定时间调薪,12月份时我没满半年,调薪失败,并画下一个大饼,今年六月有我
|
||||||
|
* 调薪额度200-2000
|
||||||
|
*
|
||||||
|
* 2022/02/13 客户在之前的工作中对我十分认可
|
||||||
|
* 问我将我包下来在项目上能不能有更多的工资,我说结算方式不一样,不管包与不包,都是 一样的
|
||||||
|
*
|
||||||
|
* 后续更加精彩,记得找找,就在这个文件的方法调用里面(说不定在实现类里面哦)
|
||||||
|
* */
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
@Data
|
@Data
|
||||||
public class ApiRequestService {
|
public class ApiRequestService {
|
||||||
|
@ -52,22 +67,44 @@ public class ApiRequestService {
|
||||||
this.interceptor = interceptor;
|
this.interceptor = interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void requestById(int id){
|
||||||
|
ApiRequestMain apiRequestMain = getApiRequestMainById(id);
|
||||||
|
ParamConfigInfo paramConfigInfo = parseParam(apiRequestMain);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void requestByMark(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取数据库配置信息
|
* 获取数据库配置信息
|
||||||
*
|
*
|
||||||
* @param id 配置id
|
* @param mark 配置唯一标识
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public ApiRequestMain getApiRequestMain(int id) {
|
public ApiRequestMain getApiRequestMainByMark(String mark) {
|
||||||
AtomicReference<ApiRequestMain> apiRequestMain = new AtomicReference<>(mapper.selectApiConfigById(id));
|
AtomicReference<ApiRequestMain> apiRequestMain = new AtomicReference<>(mapper.selectApiConfigByOnlyMark(mark));
|
||||||
|
return getApiRequestMain(apiRequestMain);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配置信息
|
||||||
|
* @param apiRequestMain 配置信息主表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
private ApiRequestMain getApiRequestMain(AtomicReference<ApiRequestMain> apiRequestMain) {
|
||||||
if (Objects.isNull(apiRequestMain.get())) {
|
if (Objects.isNull(apiRequestMain.get())) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// 查询配置表明细信息
|
||||||
List<ApiRequestParamDetail> paramDetailList = mapper.selectApiParamListByMainId(apiRequestMain.get().getId());
|
List<ApiRequestParamDetail> paramDetailList = mapper.selectApiParamListByMainId(apiRequestMain.get().getId());
|
||||||
|
|
||||||
apiRequestMain.get().setParamDetailList(paramDetailList);
|
apiRequestMain.get().setParamDetailList(paramDetailList);
|
||||||
List<ApiRequestHeardDetail> heardDetailList = mapper.selectApiHeardListByMainId(apiRequestMain.get().getId());
|
List<ApiRequestHeardDetail> heardDetailList = mapper.selectApiHeardListByMainId(apiRequestMain.get().getId());
|
||||||
apiRequestMain.get().setHeardDetailList(heardDetailList);
|
apiRequestMain.get().setHeardDetailList(heardDetailList);
|
||||||
|
// 回调拦截器
|
||||||
Optional.ofNullable(interceptor).map(interceptor -> {
|
Optional.ofNullable(interceptor).map(interceptor -> {
|
||||||
Optional.ofNullable(interceptor.parseBefore(apiRequestMain.get())).map(v -> {
|
Optional.ofNullable(interceptor.parseBefore(apiRequestMain.get())).map(v -> {
|
||||||
apiRequestMain.set(v);
|
apiRequestMain.set(v);
|
||||||
|
@ -78,20 +115,33 @@ public class ApiRequestService {
|
||||||
return apiRequestMain.get();
|
return apiRequestMain.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据库配置信息
|
||||||
|
*
|
||||||
|
* @param id 配置id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ApiRequestMain getApiRequestMainById(int id) {
|
||||||
|
AtomicReference<ApiRequestMain> apiRequestMain = new AtomicReference<>(mapper.selectApiConfigById(id));
|
||||||
|
return getApiRequestMain(apiRequestMain);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析参数值
|
* 解析参数值
|
||||||
*
|
* ┗( ▔, ▔ )┛ Σσ(・Д・;)我我我什么都没做!!!
|
||||||
* @param apiRequestMain 主表配置信息
|
* @param apiRequestMain 主表配置信息
|
||||||
* @return 解析后的参数值
|
* @return 解析后的参数值
|
||||||
*/
|
*/
|
||||||
public ParamConfigInfo parseParam(ApiRequestMain apiRequestMain) {
|
public ParamConfigInfo parseParam(ApiRequestMain apiRequestMain) {
|
||||||
|
// 抽象工厂获取参数数据源处理对象
|
||||||
DataSourceHandlerFactory dataSourceHandlerFactory = abstractFactory.createParamHandlerFactory(DataSourceHandlerFactory.class);
|
DataSourceHandlerFactory dataSourceHandlerFactory = abstractFactory.createParamHandlerFactory(DataSourceHandlerFactory.class);
|
||||||
DataSourceRuleEnum dataSourceRuleEnum = DataSourceRuleEnum.get(apiRequestMain.getDataSource());
|
DataSourceRuleEnum dataSourceRuleEnum = DataSourceRuleEnum.get(apiRequestMain.getDataSource());
|
||||||
IDataSourceHandler paramHandler = dataSourceHandlerFactory.createParamHandler(dataSourceRuleEnum);
|
IDataSourceHandler paramHandler = dataSourceHandlerFactory.createParamHandler(dataSourceRuleEnum);
|
||||||
ApiRequestData apiRequestData = BeanMapper.INSTANCE.apiRequestMain2Data(apiRequestMain);
|
ApiRequestData apiRequestData = BeanMapper.INSTANCE.apiRequestMain2Data(apiRequestMain);
|
||||||
apiRequestData.setApiBaseInfo(this.apiBaseInfo);
|
apiRequestData.setApiBaseInfo(this.apiBaseInfo);
|
||||||
|
// 解析数据参数
|
||||||
AtomicReference<ParamConfigInfo> paramConfigInfo = new AtomicReference<>(paramHandler.parseDataSource(apiRequestData));
|
AtomicReference<ParamConfigInfo> paramConfigInfo = new AtomicReference<>(paramHandler.parseDataSource(apiRequestData));
|
||||||
// TODO 解析配置表中的参数
|
|
||||||
Optional.ofNullable(interceptor).map(interceptor -> {
|
Optional.ofNullable(interceptor).map(interceptor -> {
|
||||||
Optional.ofNullable(interceptor.parseAfter(paramConfigInfo.get())).map(v -> {
|
Optional.ofNullable(interceptor.parseAfter(paramConfigInfo.get())).map(v -> {
|
||||||
paramConfigInfo.set(v);
|
paramConfigInfo.set(v);
|
||||||
|
@ -130,3 +180,8 @@ public class ApiRequestService {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,9 @@ public class ExportExcel {
|
||||||
Employee e = employeeList.get(i);
|
Employee e = employeeList.get(i);
|
||||||
// toolUtil.writeErrorLog("item数据库:" + e);
|
// toolUtil.writeErrorLog("item数据库:" + e);
|
||||||
if (e.getJOBCODEID() == null || e.getJOBCODEID() == 0){
|
if (e.getJOBCODEID() == null || e.getJOBCODEID() == 0){
|
||||||
toolUtil.writeErrorLog("数据出现错误:" + e);
|
// toolUtil.writeErrorLog("数据出现错误:" + e);
|
||||||
continue;
|
e.setJOBCODEID(-0L);
|
||||||
|
// continue;
|
||||||
}
|
}
|
||||||
Row row = sheet.createRow(i + 2);
|
Row row = sheet.createRow(i + 2);
|
||||||
row.createCell(0).setCellValue(e.getUserID());
|
row.createCell(0).setCellValue(e.getUserID());
|
||||||
|
|
|
@ -90,12 +90,9 @@ public class ConfigTableData {
|
||||||
tableName +
|
tableName +
|
||||||
" where id = ?";
|
" where id = ?";
|
||||||
ToolUtil toolUtil = new ToolUtil();
|
ToolUtil toolUtil = new ToolUtil();
|
||||||
toolUtil.writeDebuggerLog("接收到参数tableName{" + tableName + "},fieldName{" + fieldName + "}configId{" + configId);
|
|
||||||
toolUtil.writeDebuggerLog("sql:" + queryBuilder);
|
|
||||||
rs.executeQuery(queryBuilder,configId);
|
rs.executeQuery(queryBuilder,configId);
|
||||||
if(rs.next()){
|
if(rs.next()){
|
||||||
String docIds = Util.null2String(rs.getString(1));
|
String docIds = Util.null2String(rs.getString(1));
|
||||||
toolUtil.writeDebuggerLog("查询到数据:" + docIds);
|
|
||||||
return docIds.split(",");
|
return docIds.split(",");
|
||||||
}
|
}
|
||||||
return new String[0];
|
return new String[0];
|
||||||
|
|
|
@ -66,7 +66,6 @@ public class DocTemplateDao {
|
||||||
public int[] copyFile(int userId, String tableName, String fieldName, String configId) {
|
public int[] copyFile(int userId, String tableName, String fieldName, String configId) {
|
||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
String[] templateData = ConfigTableData.getTemplateData(tableName, fieldName, configId);
|
String[] templateData = ConfigTableData.getTemplateData(tableName, fieldName, configId);
|
||||||
this.toolUtil.writeDebuggerLog("模板数据:" + Arrays.toString(templateData));
|
|
||||||
int[] array = Arrays.stream(templateData).mapToInt(Integer::parseInt).toArray();
|
int[] array = Arrays.stream(templateData).mapToInt(Integer::parseInt).toArray();
|
||||||
return this.copyFile(array);
|
return this.copyFile(array);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +137,6 @@ public class DocTemplateDao {
|
||||||
.uPut("seccategory", docCategory.split(",")[docCategory.split(",").length - 1]);
|
.uPut("seccategory", docCategory.split(",")[docCategory.split(",").length - 1]);
|
||||||
Where whereIn = Util.createPrepWhereImpl().whereAnd("id").whereInList(list);
|
Where whereIn = Util.createPrepWhereImpl().whereAnd("id").whereInList(list);
|
||||||
PrepSqlResultImpl updateResult = Util.createSqlBuilder().updateSql("docdetail", updateMap, whereIn);
|
PrepSqlResultImpl updateResult = Util.createSqlBuilder().updateSql("docdetail", updateMap, whereIn);
|
||||||
this.toolUtil.writeDebuggerLog(updateResult.getSqlStr() + " : " + updateResult.getArgs());
|
|
||||||
return rs.executeUpdate(updateResult.getSqlStr(), updateResult.getArgs());
|
return rs.executeUpdate(updateResult.getSqlStr(), updateResult.getArgs());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -34,7 +34,6 @@ public class CopyAttachment {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String copyAttachment(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
public String copyAttachment(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
@RequestBody Map<String, Object> params) {
|
@RequestBody Map<String, Object> params) {
|
||||||
this.toolUtil.writeDebuggerLog("文件拷贝,接收参数:" + params);
|
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
return CopyAttachmentService.copyFile(user,params);
|
return CopyAttachmentService.copyFile(user,params);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +44,6 @@ public class CopyAttachment {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String deleteFile(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
public String deleteFile(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
@PathParam("docIds") String docIds) {
|
@PathParam("docIds") String docIds) {
|
||||||
this.toolUtil.writeDebuggerLog("文件删除,接收参数:" + docIds);
|
|
||||||
return CopyAttachmentService.deleteFile(docIds);
|
return CopyAttachmentService.deleteFile(docIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +52,6 @@ public class CopyAttachment {
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String queryConfig(@PathParam("workflowId") String workflowId) {
|
public String queryConfig(@PathParam("workflowId") String workflowId) {
|
||||||
this.toolUtil.writeDebuggerLog("获取配置参数,接收参数为: " + workflowId);
|
|
||||||
return ApiResult.success(ConfigTableData.getConfig(workflowId));
|
return ApiResult.success(ConfigTableData.getConfig(workflowId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +61,6 @@ public class CopyAttachment {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String queryFilesData(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
public String queryFilesData(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
@RequestBody Map<String, Object> params){
|
@RequestBody Map<String, Object> params){
|
||||||
this.toolUtil.writeDebuggerLog("查看文件信息,接收参数:" + params);
|
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
return CopyAttachmentService.queryFilesData(user, params);
|
return CopyAttachmentService.queryFilesData(user, params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,43 @@ import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 法大大集成
|
||||||
|
*
|
||||||
* @author EBU7-dev1-ayh
|
* @author EBU7-dev1-ayh
|
||||||
* @create 2021/11/3 0003 14:51
|
* @create 2021/11/3 0003 14:51
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// 写这个代码的时候只有我和上帝知道在写啥 2021/11/10
|
||||||
|
|
||||||
|
// 好了,现在只有上帝知道了 2022/02/16
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 2022/02/18
|
||||||
|
*你可能觉得自己看懂下面的代码了,
|
||||||
|
|
||||||
|
*然而你并没有,相信我。
|
||||||
|
|
||||||
|
*糊弄过去算了,不然你会好多个晚上睡不着觉,
|
||||||
|
|
||||||
|
*嘴里骂着这段注释,觉得自己很聪明,
|
||||||
|
|
||||||
|
*真能“优化”下面的代码。
|
||||||
|
|
||||||
|
*现在关上文件,去玩点别的吧。
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 听说你要改这里面的逻辑
|
||||||
|
*
|
||||||
|
* 听一句劝,别试图在一座屎山上面拉屎
|
||||||
|
*
|
||||||
|
* 当屎山崩塌的时候,没有一个拉屎的是无辜的
|
||||||
|
*
|
||||||
|
* 当你决定动这个文件的时候,你就要面对无尽的折磨
|
||||||
|
*
|
||||||
|
* */
|
||||||
public class FaDDContractService {
|
public class FaDDContractService {
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
private final String contractInfoTable = "uf_contract_info";
|
private final String contractInfoTable = "uf_contract_info";
|
||||||
|
@ -971,17 +1005,12 @@ public class FaDDContractService {
|
||||||
private PushAPushEmailEntity queryEmailInfo(int workflowType, String requestId) {
|
private PushAPushEmailEntity queryEmailInfo(int workflowType, String requestId) {
|
||||||
PushAPushEmailEntity pushAPushEmailEntity = faDDContractMapping.queryEmailInfo(workflowType);
|
PushAPushEmailEntity pushAPushEmailEntity = faDDContractMapping.queryEmailInfo(workflowType);
|
||||||
Map<String, Object> workflowData = getWorkflowData(String.valueOf(workflowType), requestId);
|
Map<String, Object> workflowData = getWorkflowData(String.valueOf(workflowType), requestId);
|
||||||
toolUtil.writeDebuggerLog("获取到邮件配置参数:" + JSON.toJSONString(pushAPushEmailEntity));
|
|
||||||
toolUtil.writeDebuggerLog("查询到的数据:===> " + JSON.toJSONString(workflowData));
|
|
||||||
String parsingTitle = parsingValue(pushAPushEmailEntity.getEmailTitle(), workflowData);
|
String parsingTitle = parsingValue(pushAPushEmailEntity.getEmailTitle(), workflowData);
|
||||||
toolUtil.writeDebuggerLog("parsingTitle解析后的值:" + parsingTitle);
|
|
||||||
pushAPushEmailEntity.setEmailTitle(parsingTitle);
|
pushAPushEmailEntity.setEmailTitle(parsingTitle);
|
||||||
String parsingEmail = parsingValue(pushAPushEmailEntity.getEmailAddress(), workflowData);
|
String parsingEmail = parsingValue(pushAPushEmailEntity.getEmailAddress(), workflowData);
|
||||||
toolUtil.writeDebuggerLog("parsingEmail解析后的值:" + parsingEmail);
|
|
||||||
pushAPushEmailEntity.setEmailAddress(parsingEmail);
|
pushAPushEmailEntity.setEmailAddress(parsingEmail);
|
||||||
try {
|
try {
|
||||||
String parsingContent = parsingValue(pushAPushEmailEntity.getEmailContent(), workflowData);
|
String parsingContent = parsingValue(pushAPushEmailEntity.getEmailContent(), workflowData);
|
||||||
toolUtil.writeDebuggerLog("parsingContent解析后的值:" + parsingContent);
|
|
||||||
pushAPushEmailEntity.setEmailContent(parsingContent);
|
pushAPushEmailEntity.setEmailContent(parsingContent);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
toolUtil.writeDebuggerLog("解析出错:" + e.toString());
|
toolUtil.writeDebuggerLog("解析出错:" + e.toString());
|
||||||
|
|
|
@ -160,7 +160,6 @@ public class FaDDContractController {
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
public Response contractDownload(@PathParam("requestId") String requestId) {
|
public Response contractDownload(@PathParam("requestId") String requestId) {
|
||||||
toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId);
|
|
||||||
try {
|
try {
|
||||||
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId);
|
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId);
|
||||||
StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO);
|
StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.api.aiyh_pcn.patentWall.service.PatentWallService;
|
||||||
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
|
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
|
||||||
import com.api.aiyh_pcn.patentWall.vo.SearchInputVO;
|
import com.api.aiyh_pcn.patentWall.vo.SearchInputVO;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import weaver.hrm.HrmUserVarify;
|
import weaver.hrm.HrmUserVarify;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
@ -28,16 +29,22 @@ import java.util.Map;
|
||||||
@Path("/patten/")
|
@Path("/patten/")
|
||||||
public class PatentWallController {
|
public class PatentWallController {
|
||||||
private final PatentWallService patentWallService = new PatentWallService();
|
private final PatentWallService patentWallService = new PatentWallService();
|
||||||
|
private final Logger logger = Util.getLogger();
|
||||||
|
|
||||||
@Path("/getSearchList/{prefix}")
|
@Path("/getSearchList/{prefix}")
|
||||||
@GET
|
@GET
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public String getPatentList(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
public String getPatentList(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||||
@PathParam("prefix") String prefix){
|
@PathParam("prefix") String prefix){
|
||||||
|
try {
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
int languageId = user.getLanguage();
|
int languageId = user.getLanguage();
|
||||||
List<SearchInputVO> result = patentWallService.getSearchList(prefix,languageId);
|
List<SearchInputVO> result = patentWallService.getSearchList(prefix,languageId);
|
||||||
return ApiResult.success(result);
|
return ApiResult.success(result);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("捕获到异常信息:" + Util.getErrString(e));
|
||||||
|
return ApiResult.error("捕获到调用异常信息");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("/getList/{prefix}")
|
@Path("/getList/{prefix}")
|
||||||
|
@ -45,8 +52,13 @@ public class PatentWallController {
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public String getPatentList(@RequestBody List<FilterWhere> filterWheres, @PathParam("prefix") String prefix){
|
public String getPatentList(@RequestBody List<FilterWhere> filterWheres, @PathParam("prefix") String prefix){
|
||||||
|
try {
|
||||||
List<PatentVO> result = patentWallService.getList(filterWheres,prefix);
|
List<PatentVO> result = patentWallService.getList(filterWheres,prefix);
|
||||||
return ApiResult.success(result);
|
return ApiResult.success(result);
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("捕获到异常信息:" + Util.getErrString(e));
|
||||||
|
return ApiResult.error("捕获到调用异常信息");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("/clearConf")
|
@Path("/clearConf")
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.api.aiyh_pcn.patentWall.vo.LinkUrlVO;
|
||||||
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
|
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
|
||||||
import com.api.aiyh_pcn.patentWall.vo.SearchInputVO;
|
import com.api.aiyh_pcn.patentWall.vo.SearchInputVO;
|
||||||
import com.api.aiyh_pcn.patentWall.vo.SelectOptionsVo;
|
import com.api.aiyh_pcn.patentWall.vo.SelectOptionsVo;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
import java.beans.BeanInfo;
|
import java.beans.BeanInfo;
|
||||||
|
@ -30,9 +31,10 @@ import java.util.regex.Pattern;
|
||||||
public class PatentWallService {
|
public class PatentWallService {
|
||||||
private final PatentWallMapping patentWallMapping = new PatentWallMapping();
|
private final PatentWallMapping patentWallMapping = new PatentWallMapping();
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
|
private final RecordSet rs = new RecordSet();
|
||||||
private Map<String, Object> patentWallConf;
|
private Map<String, Object> patentWallConf;
|
||||||
private Map<String, Object> patentWallSearchConf;
|
private Map<String, Object> patentWallSearchConf;
|
||||||
private final RecordSet rs = new RecordSet();
|
private final Logger logger = Util.getLogger();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询搜索框配置信息
|
* 查询搜索框配置信息
|
||||||
|
@ -135,7 +137,6 @@ public class PatentWallService {
|
||||||
public List<PatentVO> getList(List<FilterWhere> filterWheres, String prefix) {
|
public List<PatentVO> getList(List<FilterWhere> filterWheres, String prefix) {
|
||||||
Map<String, Object> patentWallConf = getPatentWallConf(prefix + ".voMapping");
|
Map<String, Object> patentWallConf = getPatentWallConf(prefix + ".voMapping");
|
||||||
List<Map<String, Object>> dataList;
|
List<Map<String, Object>> dataList;
|
||||||
toolUtil.writeDebuggerLog(String.format("查询数据,接收到的过滤信息为: %s", JSON.toJSONString(filterWheres)));
|
|
||||||
if (filterWheres == null || filterWheres.isEmpty()) {
|
if (filterWheres == null || filterWheres.isEmpty()) {
|
||||||
// 查询全部
|
// 查询全部
|
||||||
dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource")));
|
dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource")));
|
||||||
|
@ -146,7 +147,6 @@ public class PatentWallService {
|
||||||
}
|
}
|
||||||
List<PatentVO> list = new ArrayList<>();
|
List<PatentVO> list = new ArrayList<>();
|
||||||
List<String> args = new ArrayList<>();
|
List<String> args = new ArrayList<>();
|
||||||
RecordSet rs = new RecordSet();
|
|
||||||
for (Map<String, Object> data : dataList) {
|
for (Map<String, Object> data : dataList) {
|
||||||
Map<String, Object> config = new HashMap<>(patentWallConf);
|
Map<String, Object> config = new HashMap<>(patentWallConf);
|
||||||
for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) {
|
for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) {
|
||||||
|
@ -207,6 +207,7 @@ public class PatentWallService {
|
||||||
PatentVO patentVO = null;
|
PatentVO patentVO = null;
|
||||||
try {
|
try {
|
||||||
patentVO = Util.mapToObject(config, PatentVO.class);
|
patentVO = Util.mapToObject(config, PatentVO.class);
|
||||||
|
patentVO.setLinkList((List<LinkUrlVO>) config.get("linkList"));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
toolUtil.writeErrorLog("map转为PatentVO失败!");
|
toolUtil.writeErrorLog("map转为PatentVO失败!");
|
||||||
|
@ -354,6 +355,9 @@ public class PatentWallService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getPatentWallSearchConf(String prefix) {
|
private Map<String, Object> getPatentWallSearchConf(String prefix) {
|
||||||
|
if (this.patentWallSearchConf != null) {
|
||||||
|
return this.patentWallSearchConf;
|
||||||
|
}
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (this.patentWallSearchConf == null) {
|
if (this.patentWallSearchConf == null) {
|
||||||
this.patentWallSearchConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
|
this.patentWallSearchConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
package weaver.aiyh_pcn.async_organization;
|
package weaver.aiyh_pcn.async_organization;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.zwl.common.ToolUtil;
|
import aiyh.utils.zwl.common.ToolUtil;
|
||||||
|
import com.weaver.esb.server.cache.ResourceComInfo;
|
||||||
import weaver.aiyh_pcn.async_organization.model.Department;
|
import weaver.aiyh_pcn.async_organization.model.Department;
|
||||||
import weaver.aiyh_pcn.async_organization.model.Employee;
|
import weaver.aiyh_pcn.async_organization.model.Employee;
|
||||||
import weaver.aiyh_pcn.async_organization.model.Position;
|
import weaver.aiyh_pcn.async_organization.model.Position;
|
||||||
import weaver.aiyh_pcn.async_organization.result.GetOrganizationResult;
|
import weaver.aiyh_pcn.async_organization.result.GetOrganizationResult;
|
||||||
import weaver.aiyh_pcn.async_organization.util.SyncOrganizationUtils;
|
import weaver.aiyh_pcn.async_organization.util.SyncOrganizationUtils;
|
||||||
import com.weaver.esb.server.cache.ResourceComInfo;
|
|
||||||
import weaver.hrm.company.DepartmentComInfo;
|
import weaver.hrm.company.DepartmentComInfo;
|
||||||
import weaver.hrm.company.SubCompanyComInfo;
|
import weaver.hrm.company.SubCompanyComInfo;
|
||||||
import weaver.hrm.job.JobTitlesComInfo;
|
import weaver.hrm.job.JobTitlesComInfo;
|
||||||
|
@ -27,37 +28,43 @@ import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynService {
|
public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynService {
|
||||||
private HashMap<String,Object> synResult;
|
|
||||||
String className = "SyncOrganizationForOtherAPI";
|
|
||||||
private final Logger log = LoggerFactory.getLogger(SyncOrganizationForOtherAPI.class);
|
private final Logger log = LoggerFactory.getLogger(SyncOrganizationForOtherAPI.class);
|
||||||
private final GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
|
private final GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
|
||||||
private final SyncOrganizationUtils organizationUtils = new SyncOrganizationUtils();
|
private final SyncOrganizationUtils organizationUtils = new SyncOrganizationUtils();
|
||||||
|
String className = "SyncOrganizationForOtherAPI";
|
||||||
|
private HashMap<String, Object> synResult;
|
||||||
|
|
||||||
public SyncOrganizationForOtherAPI(){
|
public SyncOrganizationForOtherAPI() {
|
||||||
this.writeDebuggerLog(className,"===========> create Object! <============");
|
this.writeDebuggerLog(className, "===========> create Object! <============");
|
||||||
this.synResult = new HashMap<>();
|
this.synResult = new HashMap<>();
|
||||||
}
|
}
|
||||||
/**同步到分公司(分部)*/
|
|
||||||
|
/**
|
||||||
|
* 同步到分公司(分部)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String SynTimingToOASubCompany() {
|
public String SynTimingToOASubCompany() {
|
||||||
this.writeDebuggerLog(className,"===========> synchronous company to OA system start <============");
|
this.writeDebuggerLog(className, "===========> synchronous company to OA system start <============");
|
||||||
this.synResult.put("1",null);
|
this.synResult.put("1", null);
|
||||||
this.writeDebuggerLog(className,"===========> synchronous company to OA system end <============");
|
this.writeDebuggerLog(className, "===========> synchronous company to OA system end <============");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**同步到部门*/
|
/**
|
||||||
|
* 同步到部门
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String SynTimingToOADepartment() {
|
public String SynTimingToOADepartment() {
|
||||||
this.writeDebuggerLog(className,"===========> synchronous department to OA system starts <============");
|
this.writeDebuggerLog(className, "===========> synchronous department to OA system starts <============");
|
||||||
|
try {
|
||||||
List<Department> departmentList = getOrganizationResult.getDepartmentList();
|
List<Department> departmentList = getOrganizationResult.getDepartmentList();
|
||||||
Collections.sort(departmentList);
|
Collections.sort(departmentList);
|
||||||
List<Map<String,Object>> synResultlist = new ArrayList<>();
|
List<Map<String, Object>> synResultlist = new ArrayList<>();
|
||||||
departmentList.forEach(department -> {
|
departmentList.forEach(department -> {
|
||||||
Map<String, String> stringStringMap = organizationUtils.asyncDepartment(department);
|
Map<String, String> stringStringMap = organizationUtils.asyncDepartment(department);
|
||||||
synResultlist.add(buildItemMap("","",department.getDEPARTMENTNAME(),stringStringMap.get("code"),stringStringMap.get("msg")));
|
synResultlist.add(buildItemMap("", "", department.getDEPARTMENTNAME(), stringStringMap.get("code"), stringStringMap.get("msg")));
|
||||||
});
|
});
|
||||||
this.writeDebuggerLog(className,departmentList.size() +" data pieces are updated this time");
|
this.writeDebuggerLog(className, departmentList.size() + " data pieces are updated this time");
|
||||||
//清除OA中分部的缓存记录
|
//清除OA中分部的缓存记录
|
||||||
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
|
||||||
subCompanyComInfo.removeCompanyCache();
|
subCompanyComInfo.removeCompanyCache();
|
||||||
|
@ -70,56 +77,71 @@ public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynServi
|
||||||
//同步部门数据到矩阵
|
//同步部门数据到矩阵
|
||||||
MatrixUtil.sysDepartmentData();
|
MatrixUtil.sysDepartmentData();
|
||||||
|
|
||||||
this.writeDebuggerLog(className,"This time together step or update data " + departmentList.size());
|
this.writeDebuggerLog(className, "This time together step or update data " + departmentList.size());
|
||||||
this.synResult.put("2",synResultlist);
|
this.synResult.put("2", synResultlist);
|
||||||
this.writeDebuggerLog(className,"===========> synchronous department to OA system end <============");
|
this.writeDebuggerLog(className, "===========> synchronous department to OA system end <============");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.writeErrorLog("同步部门出现错误:错误信息:" + Util.getErrString(e));
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**同步到职位*/
|
/**
|
||||||
|
* 同步到职位
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String SynTimingToOAJobtitle() {
|
public String SynTimingToOAJobtitle() {
|
||||||
this.writeDebuggerLog(className,"===========> synchronous job to OA system starts <============");
|
this.writeDebuggerLog(className, "===========> synchronous job to OA system starts <============");
|
||||||
|
try {
|
||||||
List<Position> positionList = getOrganizationResult.getPositionList();
|
List<Position> positionList = getOrganizationResult.getPositionList();
|
||||||
Collections.sort(positionList);
|
Collections.sort(positionList);
|
||||||
List<Map<String,Object>> synResultlist = new ArrayList<>();
|
List<Map<String, Object>> synResultlist = new ArrayList<>();
|
||||||
positionList.forEach(position->{
|
positionList.forEach(position -> {
|
||||||
Map<String, String> stringStringMap = organizationUtils.asyncPosition(position);
|
Map<String, String> stringStringMap = organizationUtils.asyncPosition(position);
|
||||||
synResultlist.add(buildItemMap(position.getJOBCODE(),position.getJOBCODE(),position.getJOBFUNCTION(),stringStringMap.get("code"),stringStringMap.get("msg")));
|
synResultlist.add(buildItemMap(position.getJOBCODE(), position.getJOBCODE(), position.getJOBFUNCTION(), stringStringMap.get("code"), stringStringMap.get("msg")));
|
||||||
});
|
});
|
||||||
this.writeDebuggerLog(className,positionList.size() +" data pieces are updated this time");
|
this.writeDebuggerLog(className, positionList.size() + " data pieces are updated this time");
|
||||||
// 清除职位缓存
|
// 清除职位缓存
|
||||||
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo();
|
||||||
jobTitlesComInfo.removeJobTitlesCache();
|
jobTitlesComInfo.removeJobTitlesCache();
|
||||||
jobTitlesComInfo.removeCache();
|
jobTitlesComInfo.removeCache();
|
||||||
this.synResult.put("3",synResultlist);
|
this.synResult.put("3", synResultlist);
|
||||||
this.writeDebuggerLog(className,"===========> synchronous job to OA system end <============");
|
this.writeDebuggerLog(className, "===========> synchronous job to OA system end <============");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.writeErrorLog("同步职位失败,失败信息:" + Util.getErrString(e));
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**同步到人员*/
|
/**
|
||||||
|
* 同步到人员
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String SynTimingToOAHrmResource() {
|
public String SynTimingToOAHrmResource() {
|
||||||
this.writeDebuggerLog(className,"===========> synchronous hrm to OA system starts <============");
|
this.writeDebuggerLog(className, "===========> synchronous hrm to OA system starts <============");
|
||||||
|
try {
|
||||||
List<Employee> employeeList = getOrganizationResult.getEmployeeList();
|
List<Employee> employeeList = getOrganizationResult.getEmployeeList();
|
||||||
List<Map<String,Object>> synResultlist = new ArrayList<>();
|
List<Map<String, Object>> synResultlist = new ArrayList<>();
|
||||||
Collections.sort(employeeList);
|
Collections.sort(employeeList);
|
||||||
employeeList.forEach(employee->{
|
employeeList.forEach(employee -> {
|
||||||
Map<String, String> stringStringMap = organizationUtils.asyncEmployee(employee);
|
Map<String, String> stringStringMap = organizationUtils.asyncEmployee(employee);
|
||||||
synResultlist.add(buildItemMap(employee.getUSERCODE(),employee.getUSERCODE(),employee.getPreferred_Name() + "/" + employee.getUSERNAMECN(),stringStringMap.get("code"),stringStringMap.get("msg")));
|
synResultlist.add(buildItemMap(employee.getUSERCODE(), employee.getUSERCODE(), employee.getPreferred_Name() + "/" + employee.getUSERNAMECN(), stringStringMap.get("code"), stringStringMap.get("msg")));
|
||||||
});
|
});
|
||||||
this.writeDebuggerLog(className,employeeList.size() +" data pieces are updated this time");
|
this.writeDebuggerLog(className, employeeList.size() + " data pieces are updated this time");
|
||||||
// 清除人员缓存
|
// 清除人员缓存
|
||||||
try {
|
try {
|
||||||
ResourceComInfo rsc = new ResourceComInfo();
|
ResourceComInfo rsc = new ResourceComInfo();
|
||||||
rsc.removeCache();
|
rsc.removeCache();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.writeErrorLog(className,"removeCache error!");
|
this.writeErrorLog(className, "removeCache error!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
// organizationUtils.asyncEmployee(employeeList.get(0));
|
// organizationUtils.asyncEmployee(employeeList.get(0));
|
||||||
this.synResult.put("4", synResultlist);
|
this.synResult.put("4", synResultlist);
|
||||||
this.writeDebuggerLog(className,"===========> synchronous hrm to OA system end <============");
|
this.writeDebuggerLog(className, "===========> synchronous hrm to OA system end <============");
|
||||||
|
} catch (Exception e) {
|
||||||
|
this.writeErrorLog("同步人员信息失败,失败信息:" + Util.getErrString(e));
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +191,7 @@ public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynServi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HashMap<String,Object> getSynResult() {
|
public HashMap<String, Object> getSynResult() {
|
||||||
return this.synResult;
|
return this.synResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,9 +200,9 @@ public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynServi
|
||||||
this.synResult = new HashMap();
|
this.synResult = new HashMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String,Object> buildItemMap(String pkcode, String pk, String memo, String succ, String error){
|
private Map<String, Object> buildItemMap(String pkcode, String pk, String memo, String succ, String error) {
|
||||||
//保存结果
|
//保存结果
|
||||||
HashMap<String,Object> itemMap = new HashMap<>();
|
HashMap<String, Object> itemMap = new HashMap<>();
|
||||||
itemMap.put(weaver.hrm.resource.HrmSynDAO.OUTPK, pkcode);
|
itemMap.put(weaver.hrm.resource.HrmSynDAO.OUTPK, pkcode);
|
||||||
itemMap.put(weaver.hrm.resource.HrmSynDAO.PK, pk);
|
itemMap.put(weaver.hrm.resource.HrmSynDAO.PK, pk);
|
||||||
itemMap.put(weaver.hrm.resource.HrmSynDAO.Memo, memo);
|
itemMap.put(weaver.hrm.resource.HrmSynDAO.Memo, memo);
|
||||||
|
|
|
@ -241,6 +241,12 @@ public class Employee implements Comparable<Employee>{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(@NotNull Employee o) {
|
public int compareTo(@NotNull Employee o) {
|
||||||
|
if(this.getJOBCODEID() == null){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(o.getJOBCODEID() == null){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return new Long(this.JOBCODEID - o.getJOBCODEID()).intValue();
|
return new Long(this.JOBCODEID - o.getJOBCODEID()).intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender
|
||||||
log4j.appender.A2.DatePattern='_'yyyyMMdd'.log'
|
log4j.appender.A2.DatePattern='_'yyyyMMdd'.log'
|
||||||
#don't modify the file property
|
#don't modify the file property
|
||||||
log4j.appender.A2.File=@ecology
|
log4j.appender.A2.File=@ecology
|
||||||
|
log4j.appender.A2.Encoding=UTF-8
|
||||||
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
|
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
|
||||||
log4j.appender.A2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c - %m%n
|
log4j.appender.A2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c - %m%n
|
||||||
log4j.appender.A3=org.apache.log4j.RollingFileAppender
|
log4j.appender.A3=org.apache.log4j.RollingFileAppender
|
||||||
|
|
|
@ -328,7 +328,7 @@ public class UtilTest {
|
||||||
// 通过物理文件的id进行获取对应的输入流信息。
|
// 通过物理文件的id进行获取对应的输入流信息。
|
||||||
// ImageFileManager imageFileManager = new ImageFileManager();
|
// ImageFileManager imageFileManager = new ImageFileManager();
|
||||||
// 通过文件id获取输入流
|
// 通过文件id获取输入流
|
||||||
InputStream inputStreamById = new FileInputStream("C:\\Users\\77449\\Desktop\\test.jpg");
|
InputStream inputStreamById = new FileInputStream("C:\\Users\\77449\\Desktop\\mmexport1640757115149.jpg");
|
||||||
try {
|
try {
|
||||||
// 获取媒体数据
|
// 获取媒体数据
|
||||||
Metadata metadata = ImageMetadataReader.readMetadata(inputStreamById);
|
Metadata metadata = ImageMetadataReader.readMetadata(inputStreamById);
|
||||||
|
|
Loading…
Reference in New Issue