修改合同逻辑前

dev
IT-xiaoXiong 2022-02-17 10:43:48 +08:00
parent df192939ce
commit 138947dc15
24 changed files with 750 additions and 525 deletions

View File

@ -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 { try {
Thread.sleep(1000); stringWriter.close();
} catch (InterruptedException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} finally { }
try { return errStr;
stringWriter.close();
} catch (IOException e) {
e.printStackTrace();
}
}
});
return stringWriter.getBuffer().toString();
} }
/** /**

View File

@ -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 {
}

View File

@ -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) {

View File

@ -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,8 +71,9 @@ public class WorkflowDataHandler implements IDataSourceHandler {
/** /**
* *
*
* @param apiRequestData api * @param apiRequestData api
* @param mainData * @param mainData
* @return api * @return api
*/ */
public List<List<ParamInfo>> parseValueForDetail(ApiRequestData apiRequestData, Map<String, Object> mainData) { public List<List<ParamInfo>> parseValueForDetail(ApiRequestData apiRequestData, Map<String, Object> mainData) {
@ -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);
} }

View File

@ -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;
}
} }

View File

@ -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;
} }
} }

View File

@ -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;

View File

@ -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) {

View File

@ -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;
} }

View File

@ -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;

View File

@ -20,18 +20,20 @@ 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);
} }

View File

@ -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 {
} }
} }

View File

@ -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());

View File

@ -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];

View File

@ -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;

View File

@ -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);
} }

View File

@ -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());

View File

@ -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);

View File

@ -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){
User user = HrmUserVarify.getUser(request, response); try {
int languageId = user.getLanguage(); User user = HrmUserVarify.getUser(request, response);
List<SearchInputVO> result = patentWallService.getSearchList(prefix,languageId); int languageId = user.getLanguage();
return ApiResult.success(result); List<SearchInputVO> result = patentWallService.getSearchList(prefix,languageId);
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){
List<PatentVO> result = patentWallService.getList(filterWheres,prefix); try {
return ApiResult.success(result); List<PatentVO> result = patentWallService.getList(filterWheres,prefix);
return ApiResult.success(result);
}catch (Exception e){
logger.error("捕获到异常信息:" + Util.getErrString(e));
return ApiResult.error("捕获到调用异常信息");
}
} }
@Path("/clearConf") @Path("/clearConf")

View File

@ -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;
@ -28,344 +29,347 @@ import java.util.regex.Pattern;
* @create 2021/11/25 0025 15:23 * @create 2021/11/25 0025 15:23
*/ */
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 Map<String, Object> patentWallConf; private final RecordSet rs = new RecordSet();
private Map<String, Object> patentWallSearchConf; private Map<String, Object> patentWallConf;
private final RecordSet rs = new RecordSet(); private Map<String, Object> patentWallSearchConf;
private final Logger logger = Util.getLogger();
/** /**
* *
* *
* @param prefix * @param prefix
* @return * @return
*/ */
public List<SearchInputVO> getSearchList(String prefix, int languageId) { public List<SearchInputVO> getSearchList(String prefix, int languageId) {
Map<String, Object> patentWallSearchConf = getPatentWallSearchConf(prefix + ".search"); Map<String, Object> patentWallSearchConf = getPatentWallSearchConf(prefix + ".search");
String dataResource = String.valueOf(patentWallSearchConf.get("dataResource")); String dataResource = String.valueOf(patentWallSearchConf.get("dataResource"));
List<Map<String, Object>> inputs = List<Map<String, Object>> inputs =
(List<Map<String, Object>>) patentWallSearchConf.get("inputs"); (List<Map<String, Object>>) patentWallSearchConf.get("inputs");
List<SearchInputVO> searchInputList = new ArrayList<>(); List<SearchInputVO> searchInputList = new ArrayList<>();
for (Map<String, Object> input : inputs) { for (Map<String, Object> input : inputs) {
SearchInputVO searchInputVO = new SearchInputVO(); SearchInputVO searchInputVO = new SearchInputVO();
int type = Integer.parseInt(Util.null2DefaultStr(input.get("type"), "0")); int type = Integer.parseInt(Util.null2DefaultStr(input.get("type"), "0"));
String dbFieldName = Util.null2String(input.get("dbFieldName")); String dbFieldName = Util.null2String(input.get("dbFieldName"));
String value = Util.null2String(input.get("value")); String value = Util.null2String(input.get("value"));
String labelName = Util.null2String(input.get("labelName")); String labelName = Util.null2String(input.get("labelName"));
Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"), "0")); Integer labelIndex = Integer.valueOf(Util.null2DefaultStr(input.get("labelIndex"), "0"));
Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"), "0")); Integer searchType = Integer.valueOf(Util.null2DefaultStr(input.get("searchType"), "0"));
Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"), "false")); Boolean multiple = Boolean.valueOf(Util.null2DefaultStr(input.get("multiple"), "false"));
searchInputVO.setType(type); searchInputVO.setType(type);
searchInputVO.setLabelName(labelName); searchInputVO.setLabelName(labelName);
searchInputVO.setSearchType(searchType); searchInputVO.setSearchType(searchType);
searchInputVO.setDbFieldName(dbFieldName); searchInputVO.setDbFieldName(dbFieldName);
searchInputVO.setLabelIndex(labelIndex); searchInputVO.setLabelIndex(labelIndex);
searchInputVO.setLabelIndex(labelIndex); searchInputVO.setLabelIndex(labelIndex);
searchInputVO.setMultiple(multiple); searchInputVO.setMultiple(multiple);
searchInputVO.setValue(value); searchInputVO.setValue(value);
searchInputList.add(searchInputVO); searchInputList.add(searchInputVO);
switch (type) { switch (type) {
case 1: case 1:
// 下拉框 查询options // 下拉框 查询options
List<SelectOptionsVo> optionsVos = List<SelectOptionsVo> optionsVos =
getSelectOptions(dataResource, dbFieldName, languageId); getSelectOptions(dataResource, dbFieldName, languageId);
searchInputVO.setSelectOptions(optionsVos); searchInputVO.setSelectOptions(optionsVos);
case 2: case 2:
// 单行文本 // 单行文本
break; break;
case 3: case 3:
// 日期 // 日期
case 4: case 4:
// 单人力资源 // 单人力资源
break; break;
case 5: case 5:
// 多人力资源 // 多人力资源
break; break;
case 6: case 6:
// 流程路径 // 流程路径
break; break;
case 7: case 7:
// 多流程路径 // 多流程路径
break; break;
default: default:
toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!"); toolUtil.writeDebuggerLog("未匹配输入框类型!请检查配置文件是否正确!");
break; break;
} }
}
return searchInputList;
}
private List<SelectOptionsVo> getSelectOptions(
String dataResource, String dbFieldName, int languageId) {
List<Map<String, Object>> selectOptions =
patentWallMapping.getSelectOptions(dataResource, dbFieldName);
List<SelectOptionsVo> optionsVos = new ArrayList<>();
SelectOptionsVo optionsDefault = new SelectOptionsVo();
optionsDefault.setSelected(true);
optionsDefault.setKey("");
optionsDefault.setShowname("");
optionsVos.add(optionsDefault);
for (Map<String, Object> selectOption : selectOptions) {
SelectOptionsVo optionsVo = new SelectOptionsVo();
optionsVo.setSelected(false);
optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"), ""));
String selectName = Util.null2DefaultStr(selectOption.get("selectname"), "");
String showName = selectName;
if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
String pattern = "(`~`" + languageId + " )(?<label>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(selectName);
if (matcher.find()) {
showName = matcher.group("label");
} }
} return searchInputList;
optionsVo.setShowname(showName);
optionsVos.add(optionsVo);
} }
return optionsVos;
}
/** private List<SelectOptionsVo> getSelectOptions(
* String dataResource, String dbFieldName, int languageId) {
* List<Map<String, Object>> selectOptions =
* @param filterWheres patentWallMapping.getSelectOptions(dataResource, dbFieldName);
* @param prefix List<SelectOptionsVo> optionsVos = new ArrayList<>();
* @return SelectOptionsVo optionsDefault = new SelectOptionsVo();
*/ optionsDefault.setSelected(true);
public List<PatentVO> getList(List<FilterWhere> filterWheres, String prefix) { optionsDefault.setKey("");
Map<String, Object> patentWallConf = getPatentWallConf(prefix + ".voMapping"); optionsDefault.setShowname("");
List<Map<String, Object>> dataList; optionsVos.add(optionsDefault);
toolUtil.writeDebuggerLog(String.format("查询数据,接收到的过滤信息为: %s", JSON.toJSONString(filterWheres))); for (Map<String, Object> selectOption : selectOptions) {
if (filterWheres == null || filterWheres.isEmpty()) { SelectOptionsVo optionsVo = new SelectOptionsVo();
// 查询全部 optionsVo.setSelected(false);
dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource"))); optionsVo.setKey(Util.null2DefaultStr(selectOption.get("selectvalue"), ""));
} else { String selectName = Util.null2DefaultStr(selectOption.get("selectname"), "");
// 筛选查询 String showName = selectName;
dataList = if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
handleFilterWhere(filterWheres, Util.null2String(patentWallConf.get("dataResource"))); String pattern = "(`~`" + languageId + " )(?<label>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(selectName);
if (matcher.find()) {
showName = matcher.group("label");
}
}
optionsVo.setShowname(showName);
optionsVos.add(optionsVo);
}
return optionsVos;
} }
List<PatentVO> list = new ArrayList<>();
List<String> args = new ArrayList<>(); /**
RecordSet rs = new RecordSet(); *
for (Map<String, Object> data : dataList) { *
Map<String, Object> config = new HashMap<>(patentWallConf); * @param filterWheres
for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) { * @param prefix
String patentVoField = entry.getKey(); * @return
// linkList */
String parsing = null; public List<PatentVO> getList(List<FilterWhere> filterWheres, String prefix) {
// 值解析 Map<String, Object> patentWallConf = getPatentWallConf(prefix + ".voMapping");
if ("linkList".equals(patentVoField)) { List<Map<String, Object>> dataList;
List<LinkUrlVO> linkUrlVOS = new ArrayList<>(); if (filterWheres == null || filterWheres.isEmpty()) {
List<Map<String, Object>> linkUrlList = (List<Map<String, Object>>) entry.getValue(); // 查询全部
for (Map<String, Object> linkUrlMap : linkUrlList) { dataList = patentWallMapping.getAllList(Util.null2String(patentWallConf.get("dataResource")));
LinkUrlVO linkUrlVO = new LinkUrlVO();
BeanInfo beanInfo = null;
try {
beanInfo = Introspector.getBeanInfo(LinkUrlVO.class, Object.class);
} catch (IntrospectionException e) {
e.printStackTrace();
toolUtil.writeDebuggerLog("获取beanInfo错误");
continue;
}
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
String keyName = propertyDescriptor.getName();
String parsingValue = String.valueOf(linkUrlMap.get(keyName));
parsingValue = handleParsingConf(parsingValue, data, args);
// 清除参数信息
args.clear();
if (propertyDescriptor.getPropertyType().equals(Integer.class)) {
try {
propertyDescriptor
.getWriteMethod()
.invoke(linkUrlVO, Integer.valueOf(parsingValue));
} catch (IllegalAccessException | InvocationTargetException e) {
toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误");
e.printStackTrace();
}
} else {
try {
propertyDescriptor.getWriteMethod().invoke(linkUrlVO, parsingValue);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误");
}
}
}
linkUrlVOS.add(linkUrlVO);
}
config.replace(patentVoField, linkUrlVOS);
} else { } else {
parsing = String.valueOf(entry.getValue()); // 筛选查询
parsing = handleParsingConf(parsing, data, args); dataList =
// 修改数据 handleFilterWhere(filterWheres, Util.null2String(patentWallConf.get("dataResource")));
config.replace(patentVoField, parsing);
// 清除参数信息
args.clear();
} }
} List<PatentVO> list = new ArrayList<>();
PatentVO patentVO = null; List<String> args = new ArrayList<>();
try { for (Map<String, Object> data : dataList) {
patentVO = Util.mapToObject(config, PatentVO.class); Map<String, Object> config = new HashMap<>(patentWallConf);
} catch (Exception e) { for (Map.Entry<String, Object> entry : patentWallConf.entrySet()) {
e.printStackTrace(); String patentVoField = entry.getKey();
toolUtil.writeErrorLog("map转为PatentVO失败"); // linkList
} String parsing = null;
list.add(patentVO); // 值解析
if ("linkList".equals(patentVoField)) {
List<LinkUrlVO> linkUrlVOS = new ArrayList<>();
List<Map<String, Object>> linkUrlList = (List<Map<String, Object>>) entry.getValue();
for (Map<String, Object> linkUrlMap : linkUrlList) {
LinkUrlVO linkUrlVO = new LinkUrlVO();
BeanInfo beanInfo = null;
try {
beanInfo = Introspector.getBeanInfo(LinkUrlVO.class, Object.class);
} catch (IntrospectionException e) {
e.printStackTrace();
toolUtil.writeDebuggerLog("获取beanInfo错误");
continue;
}
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
String keyName = propertyDescriptor.getName();
String parsingValue = String.valueOf(linkUrlMap.get(keyName));
parsingValue = handleParsingConf(parsingValue, data, args);
// 清除参数信息
args.clear();
if (propertyDescriptor.getPropertyType().equals(Integer.class)) {
try {
propertyDescriptor
.getWriteMethod()
.invoke(linkUrlVO, Integer.valueOf(parsingValue));
} catch (IllegalAccessException | InvocationTargetException e) {
toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误");
e.printStackTrace();
}
} else {
try {
propertyDescriptor.getWriteMethod().invoke(linkUrlVO, parsingValue);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
toolUtil.writeErrorLog("设置值失败调用beanInfo的set方法错误");
}
}
}
linkUrlVOS.add(linkUrlVO);
}
config.replace(patentVoField, linkUrlVOS);
} else {
parsing = String.valueOf(entry.getValue());
parsing = handleParsingConf(parsing, data, args);
// 修改数据
config.replace(patentVoField, parsing);
// 清除参数信息
args.clear();
}
}
PatentVO patentVO = null;
try {
patentVO = Util.mapToObject(config, PatentVO.class);
patentVO.setLinkList((List<LinkUrlVO>) config.get("linkList"));
} catch (Exception e) {
e.printStackTrace();
toolUtil.writeErrorLog("map转为PatentVO失败");
}
list.add(patentVO);
}
return list;
} }
return list;
}
public String handleParsingConf(String parsing, Map<String, Object> data, List<String> args) { public String handleParsingConf(String parsing, Map<String, Object> data, List<String> args) {
// 值解析 // 值解析
// 解析 ${}类型的参数,直接替换 // 解析 ${}类型的参数,直接替换
String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}"; String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}";
Pattern compile = Pattern.compile(pattern); Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(parsing); Matcher matcher = compile.matcher(parsing);
while (matcher.find()) { while (matcher.find()) {
parsing = parsing.replaceFirst(pattern, Util.null2String(data.get(matcher.group("field")))); parsing = parsing.replaceFirst(pattern, Util.null2String(data.get(matcher.group("field"))));
}
// 解析#{}类型的参数,替换为?并按照顺序收集args
pattern = "#\\{(?<field>(\\s|\\S)+?)}";
compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing);
while (matcher.find()) {
parsing = parsing.replaceFirst(pattern, "?");
args.add(Util.null2String(data.get(matcher.group("field"))));
}
// 解析#sql{}类型的参数并执行SQL获取到SQL的值
pattern = "#sql\\{(?<sqlStr>([\\s\\S])+?)}";
compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing);
while (matcher.find()) {
String sqlStr = matcher.group("sqlStr");
toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}", sqlStr, args));
rs.executeQuery(sqlStr, args);
rs.next();
parsing = parsing.replaceFirst(pattern, Util.null2String(rs.getString(1)));
;
}
return parsing;
} }
// 解析#{}类型的参数,替换为?并按照顺序收集args
pattern = "#\\{(?<field>(\\s|\\S)+?)}";
compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing);
while (matcher.find()) {
parsing = parsing.replaceFirst(pattern, "?");
args.add(Util.null2String(data.get(matcher.group("field"))));
}
// 解析#sql{}类型的参数并执行SQL获取到SQL的值
pattern = "#sql\\{(?<sqlStr>([\\s\\S])+?)}";
compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing);
while (matcher.find()) {
String sqlStr = matcher.group("sqlStr");
toolUtil.writeDebuggerLog(String.format("执行SQL {%s} ---> 参数: {%s}", sqlStr, args));
rs.executeQuery(sqlStr, args);
rs.next();
parsing = parsing.replaceFirst(pattern, Util.null2String(rs.getString(1)));
;
}
return parsing;
}
public List<Map<String, Object>> handleFilterWhere( public List<Map<String, Object>> handleFilterWhere(
List<FilterWhere> filterWheres, String tableName) { List<FilterWhere> filterWheres, String tableName) {
StringBuilder whereBuilder = new StringBuilder(" where "); StringBuilder whereBuilder = new StringBuilder(" where ");
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
for (FilterWhere filterWhere : filterWheres) { for (FilterWhere filterWhere : filterWheres) {
whereBuilder.append(" add "); whereBuilder.append(" add ");
if (filterWhere.getSearchType() == 1) { if (filterWhere.getSearchType() == 1) {
// 等于 // 等于
whereBuilder.append(filterWhere.getDbField()).append(" = ? "); whereBuilder.append(filterWhere.getDbField()).append(" = ? ");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 2) { if (filterWhere.getSearchType() == 2) {
// 大于 // 大于
whereBuilder.append(filterWhere.getDbField()).append(" > ?"); whereBuilder.append(filterWhere.getDbField()).append(" > ?");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 3) { if (filterWhere.getSearchType() == 3) {
// 小于 // 小于
whereBuilder.append(filterWhere.getDbField()).append(" < ?"); whereBuilder.append(filterWhere.getDbField()).append(" < ?");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 4) { if (filterWhere.getSearchType() == 4) {
// in // in
whereBuilder whereBuilder
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(" in ( ") .append(" in ( ")
.append(filterWhere.getValue()) .append(filterWhere.getValue())
.append(") "); .append(") ");
continue; continue;
} }
if (filterWhere.getSearchType() == 5) { if (filterWhere.getSearchType() == 5) {
// 日期大于 // 日期大于
whereBuilder whereBuilder
.append(" DATE_FORMAT(") .append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') > ") .append(",'%y-%m-%d') > ")
.append("DATE_FORMAT(?,'%y-%m-%d')"); .append("DATE_FORMAT(?,'%y-%m-%d')");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 6) { if (filterWhere.getSearchType() == 6) {
// 日期小于 // 日期小于
whereBuilder whereBuilder
.append(" DATE_FORMAT(") .append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') < ") .append(",'%y-%m-%d') < ")
.append("DATE_FORMAT(?,'%y-%m-%d')"); .append("DATE_FORMAT(?,'%y-%m-%d')");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 7) { if (filterWhere.getSearchType() == 7) {
// 日期等于 // 日期等于
whereBuilder whereBuilder
.append(" DATE_FORMAT(") .append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') = ") .append(",'%y-%m-%d') = ")
.append("DATE_FORMAT(?,'%y-%m-%d')"); .append("DATE_FORMAT(?,'%y-%m-%d')");
args.add(filterWhere.getValue()); args.add(filterWhere.getValue());
continue; continue;
} }
if (filterWhere.getSearchType() == 8) { if (filterWhere.getSearchType() == 8) {
// 日期范围 // 日期范围
whereBuilder whereBuilder
.append(" DATE_FORMAT(") .append(" DATE_FORMAT(")
.append(filterWhere.getDbField()) .append(filterWhere.getDbField())
.append(",'%y-%m-%d') between ") .append(",'%y-%m-%d') between ")
.append("DATE_FORMAT(?,'%y-%m-%d')") .append("DATE_FORMAT(?,'%y-%m-%d')")
.append(" and DATE_FORMAT(?,'%y-%m-%d')"); .append(" and DATE_FORMAT(?,'%y-%m-%d')");
args.add(filterWhere.getValue().split("&")[0]); args.add(filterWhere.getValue().split("&")[0]);
args.add(filterWhere.getValue().split("&")[1]); args.add(filterWhere.getValue().split("&")[1]);
continue; continue;
} }
}
return patentWallMapping.getListByFilterWhere(whereBuilder, args, tableName);
} }
return patentWallMapping.getListByFilterWhere(whereBuilder, args, tableName);
}
/** /**
* *
* *
* @return * @return
*/ */
private Map<String, Object> getPatentWallConf(String prefix) { private Map<String, Object> getPatentWallConf(String prefix) {
synchronized (this) { synchronized (this) {
if (this.patentWallConf == null) { if (this.patentWallConf == null) {
this.patentWallConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix); this.patentWallConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
} }
if (this.patentWallConf == null) { if (this.patentWallConf == null) {
return new HashMap<>(0); return new HashMap<>(0);
} }
return new HashMap<>(this.patentWallConf); return new HashMap<>(this.patentWallConf);
}
} }
}
public void clearPatentWallConf() { public void clearPatentWallConf() {
this.patentWallConf = null; this.patentWallConf = null;
}
/**
*
*
* @return
*/
private Map<String, Object> getPatentWallSearchConf(String prefix) {
synchronized (this) {
if (this.patentWallSearchConf == null) {
this.patentWallSearchConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
}
if (this.patentWallSearchConf == null) {
return new HashMap<>(0);
}
return new HashMap<>(this.patentWallSearchConf);
} }
}
public void clearPatentWallSerachConf() { /**
this.patentWallSearchConf = null; *
} *
* @return
*/
private Map<String, Object> getPatentWallSearchConf(String prefix) {
if (this.patentWallSearchConf != null) {
return this.patentWallSearchConf;
}
synchronized (this) {
if (this.patentWallSearchConf == null) {
this.patentWallSearchConf = Util.readProperties2Map("PatentWall", "aiyh." + prefix);
}
if (this.patentWallSearchConf == null) {
return new HashMap<>(0);
}
return new HashMap<>(this.patentWallSearchConf);
}
}
public void clearPatentWallSerachConf() {
this.patentWallSearchConf = null;
}
} }

View File

@ -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,165 +28,186 @@ import java.util.*;
public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynService { public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynService {
private HashMap<String,Object> synResult; private final Logger log = LoggerFactory.getLogger(SyncOrganizationForOtherAPI.class);
String className = "SyncOrganizationForOtherAPI"; private final GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
private final Logger log = LoggerFactory.getLogger(SyncOrganizationForOtherAPI.class); private final SyncOrganizationUtils organizationUtils = new SyncOrganizationUtils();
private final GetOrganizationResult getOrganizationResult = new GetOrganizationResult(); String className = "SyncOrganizationForOtherAPI";
private final SyncOrganizationUtils organizationUtils = new SyncOrganizationUtils(); 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
public String SynTimingToOASubCompany() {
this.writeDebuggerLog(className,"===========> synchronous company to OA system start <============");
this.synResult.put("1",null);
this.writeDebuggerLog(className,"===========> synchronous company to OA system end <============");
return null;
}
/**同步到部门*/ /**
@Override * ()
public String SynTimingToOADepartment() { */
this.writeDebuggerLog(className,"===========> synchronous department to OA system starts <============"); @Override
List<Department> departmentList = getOrganizationResult.getDepartmentList(); public String SynTimingToOASubCompany() {
Collections.sort(departmentList); this.writeDebuggerLog(className, "===========> synchronous company to OA system start <============");
List<Map<String,Object>> synResultlist = new ArrayList<>(); this.synResult.put("1", null);
departmentList.forEach(department -> { this.writeDebuggerLog(className, "===========> synchronous company to OA system end <============");
Map<String, String> stringStringMap = organizationUtils.asyncDepartment(department); return null;
synResultlist.add(buildItemMap("","",department.getDEPARTMENTNAME(),stringStringMap.get("code"),stringStringMap.get("msg"))); }
});
this.writeDebuggerLog(className,departmentList.size() +" data pieces are updated this time");
//清除OA中分部的缓存记录
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
subCompanyComInfo.removeCompanyCache();
subCompanyComInfo.removeCache();
//清除部门缓存
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
departmentComInfo.removeCompanyCache();
departmentComInfo.removeCache();
//同步部门数据到矩阵 /**
MatrixUtil.sysDepartmentData(); *
*/
@Override
public String SynTimingToOADepartment() {
this.writeDebuggerLog(className, "===========> synchronous department to OA system starts <============");
try {
List<Department> departmentList = getOrganizationResult.getDepartmentList();
Collections.sort(departmentList);
List<Map<String, Object>> synResultlist = new ArrayList<>();
departmentList.forEach(department -> {
Map<String, String> stringStringMap = organizationUtils.asyncDepartment(department);
synResultlist.add(buildItemMap("", "", department.getDEPARTMENTNAME(), stringStringMap.get("code"), stringStringMap.get("msg")));
});
this.writeDebuggerLog(className, departmentList.size() + " data pieces are updated this time");
//清除OA中分部的缓存记录
SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo();
subCompanyComInfo.removeCompanyCache();
subCompanyComInfo.removeCache();
//清除部门缓存
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
departmentComInfo.removeCompanyCache();
departmentComInfo.removeCache();
this.writeDebuggerLog(className,"This time together step or update data " + departmentList.size()); //同步部门数据到矩阵
this.synResult.put("2",synResultlist); MatrixUtil.sysDepartmentData();
this.writeDebuggerLog(className,"===========> synchronous department to OA system end <============");
return null;
}
/**同步到职位*/ this.writeDebuggerLog(className, "This time together step or update data " + departmentList.size());
@Override this.synResult.put("2", synResultlist);
public String SynTimingToOAJobtitle() { this.writeDebuggerLog(className, "===========> synchronous department to OA system end <============");
this.writeDebuggerLog(className,"===========> synchronous job to OA system starts <============"); } catch (Exception e) {
List<Position> positionList = getOrganizationResult.getPositionList(); this.writeErrorLog("同步部门出现错误:错误信息:" + Util.getErrString(e));
Collections.sort(positionList); }
List<Map<String,Object>> synResultlist = new ArrayList<>(); return null;
positionList.forEach(position->{ }
Map<String, String> stringStringMap = organizationUtils.asyncPosition(position);
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"); */
@Override
public String SynTimingToOAJobtitle() {
this.writeDebuggerLog(className, "===========> synchronous job to OA system starts <============");
try {
List<Position> positionList = getOrganizationResult.getPositionList();
Collections.sort(positionList);
List<Map<String, Object>> synResultlist = new ArrayList<>();
positionList.forEach(position -> {
Map<String, String> stringStringMap = organizationUtils.asyncPosition(position);
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");
// 清除职位缓存 // 清除职位缓存
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 <============");
return null; } catch (Exception e) {
} this.writeErrorLog("同步职位失败,失败信息:" + Util.getErrString(e));
}
return null;
}
/**同步到人员*/ /**
@Override *
public String SynTimingToOAHrmResource() { */
this.writeDebuggerLog(className,"===========> synchronous hrm to OA system starts <============"); @Override
List<Employee> employeeList = getOrganizationResult.getEmployeeList(); public String SynTimingToOAHrmResource() {
List<Map<String,Object>> synResultlist = new ArrayList<>(); this.writeDebuggerLog(className, "===========> synchronous hrm to OA system starts <============");
Collections.sort(employeeList); try {
employeeList.forEach(employee->{ List<Employee> employeeList = getOrganizationResult.getEmployeeList();
Map<String, String> stringStringMap = organizationUtils.asyncEmployee(employee); List<Map<String, Object>> synResultlist = new ArrayList<>();
synResultlist.add(buildItemMap(employee.getUSERCODE(),employee.getUSERCODE(),employee.getPreferred_Name() + "/" + employee.getUSERNAMECN(),stringStringMap.get("code"),stringStringMap.get("msg"))); Collections.sort(employeeList);
}); employeeList.forEach(employee -> {
this.writeDebuggerLog(className,employeeList.size() +" data pieces are updated this time"); 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")));
try { });
ResourceComInfo rsc = new ResourceComInfo(); this.writeDebuggerLog(className, employeeList.size() + " data pieces are updated this time");
rsc.removeCache(); // 清除人员缓存
} catch (Exception e) { try {
this.writeErrorLog(className,"removeCache error!"); ResourceComInfo rsc = new ResourceComInfo();
e.printStackTrace(); rsc.removeCache();
} } catch (Exception e) {
this.writeErrorLog(className, "removeCache error!");
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 <============");
return null; } catch (Exception e) {
} this.writeErrorLog("同步人员信息失败,失败信息:" + Util.getErrString(e));
}
return null;
}
@Override @Override
public void SynTimingFromOASubCompany(SubCompanyBean[] subCompanyBeans) { public void SynTimingFromOASubCompany(SubCompanyBean[] subCompanyBeans) {
} }
@Override @Override
public void SynTimingFromOADepartment(DepartmentBean[] departmentBeans) { public void SynTimingFromOADepartment(DepartmentBean[] departmentBeans) {
} }
@Override @Override
public void SynTimingFromOAJobtitle(JobTitleBean[] jobTitleBeans) { public void SynTimingFromOAJobtitle(JobTitleBean[] jobTitleBeans) {
} }
@Override @Override
public void SynTimingFromOAHrmResource(UserBean[] userBeans) { public void SynTimingFromOAHrmResource(UserBean[] userBeans) {
} }
@Override @Override
public void SynInstantSubCompany(SubCompanyBean subCompanyBean) { public void SynInstantSubCompany(SubCompanyBean subCompanyBean) {
} }
@Override @Override
public void SynInstantDepartment(DepartmentBean departmentBean) { public void SynInstantDepartment(DepartmentBean departmentBean) {
} }
@Override @Override
public void SynInstantJobtitle(JobTitleBean jobTitleBean) { public void SynInstantJobtitle(JobTitleBean jobTitleBean) {
} }
@Override @Override
public void SynInstantHrmResource(UserBean userBean) { public void SynInstantHrmResource(UserBean userBean) {
} }
@Override @Override
public boolean SynSendMessage(String s, String s1, String s2, String s3, String s4) { public boolean SynSendMessage(String s, String s1, String s2, String s3, String s4) {
return false; return false;
} }
@Override @Override
public HashMap<String,Object> getSynResult() { public HashMap<String, Object> getSynResult() {
return this.synResult; return this.synResult;
} }
@Override @Override
public void removeSynResult() { public void removeSynResult() {
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);
itemMap.put(weaver.hrm.resource.HrmSynDAO.Success, succ); itemMap.put(weaver.hrm.resource.HrmSynDAO.Success, succ);
itemMap.put(HrmSynDAO.ErrorMessage, error); itemMap.put(HrmSynDAO.ErrorMessage, error);
return itemMap; return itemMap;
} }
} }

View File

@ -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();
} }
} }

View File

@ -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

View File

@ -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);