2022-12-12 文件提示插件测试

main
wangxuanran 2022-12-12 14:17:20 +08:00
parent ffd51db3ff
commit 24a1db60ac
8 changed files with 104 additions and 61 deletions

View File

@ -6,7 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify; import weaver.hrm.HrmUserVarify;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.xuanran.wang.common.util.CommonUtil; import weaver.xuanran.wang.common.util.CommonUtil; // 工具类
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -26,7 +26,7 @@ import java.util.stream.Collectors;
@Path("/wxr/saicTravel/") @Path("/wxr/saicTravel/")
public class CusCreateWorkFlowController { public class CusCreateWorkFlowController {
private final Logger logger = Util.getLogger(); private final Logger logger = Util.getLogger(); // 获取日志对象
@Path("cusCreateWorkFlow") @Path("cusCreateWorkFlow")
@POST @POST
@ -39,14 +39,15 @@ public class CusCreateWorkFlowController {
String choiceData = request.getParameter("choiceData"); String choiceData = request.getParameter("choiceData");
int modelId = Util.getIntValue(request.getParameter("modelId"), -1); int modelId = Util.getIntValue(request.getParameter("modelId"), -1);
List<String> dataList = Arrays.stream(choiceData.split(",")).collect(Collectors.toList()); List<String> dataList = Arrays.stream(choiceData.split(",")).collect(Collectors.toList());
List<String> requestIds = CommonUtil.doCreateWorkFlow(modelId, dataList); List<String> requestIds = CommonUtil.doCreateWorkFlow(modelId, dataList); // 通过数据审批生成流程
List<String> errorData = new ArrayList<>(); List<String> errorData = new ArrayList<>();
for (int i = 0; i < requestIds.size(); i++) { for (int i = 0; i < requestIds.size(); i++) {
if (Util.getIntValue(requestIds.get(i), -1) < 0) { if (Util.getIntValue(requestIds.get(i), -1) < 0) {
errorData.add(dataList.get(i)); errorData.add(dataList.get(i));
} }
} }
logger.error(Util.logStr("执行创建流程失败集合: {}",JSONObject.toJSONString(errorData))); logger.error(Util.logStr("执行创建流程失败集合: {}",JSONObject.toJSONString(errorData))); // 构建日志字符串
return ApiResult.success(errorData); return ApiResult.success(errorData);
} }
} }

View File

@ -10,12 +10,12 @@ import weaver.xuanran.wang.saic_travel.model_data_async.service.DataAsyncConfigS
/** /**
* <h1></h1> * <h1></h1>
* *
* @Author xuanran.wang * @Author xuanran.wang
* @Date 2022/12/1 15:20 * @Date 2022/12/1 15:20
*/ */
public class HrmDataToModelAsync extends BaseCronJob { public class CusDataToModelAsync extends BaseCronJob {
private final Logger logger = Util.getLogger(); private final Logger logger = Util.getLogger();

View File

@ -2,7 +2,6 @@ package weaver.xuanran.wang.saic_travel.model_data_async.service;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.springframework.util.Assert; import org.springframework.util.Assert;
@ -14,8 +13,6 @@ import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncD
import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncMain; import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncMain;
import weaver.xuanran.wang.saic_travel.model_data_async.config.mapper.DataAsyncConfigMapper; import weaver.xuanran.wang.saic_travel.model_data_async.config.mapper.DataAsyncConfigMapper;
import weaver.xuanran.wang.saic_travel.model_data_async.constant.DataAsyncConstant; import weaver.xuanran.wang.saic_travel.model_data_async.constant.DataAsyncConstant;
import weaver.xuanran.wang.saic_travel.model_data_async.mapper.DataAsyncMapper;
import weaver.zwl.common.ToolUtil;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -99,8 +96,7 @@ public class DataAsyncConfigService {
linkedHashMapList.add(copyMap); linkedHashMapList.add(copyMap);
} }
} }
List<String> list = CusInfoToOAUtil.executeBatch(modelId, linkedHashMapList); return CusInfoToOAUtil.executeBatch(modelId, linkedHashMapList);
return list;
} }
/** /**
* <h1></h1> * <h1></h1>

View File

@ -1,9 +1,9 @@
package weaver.xuanran.wang.schroeder.action; package weaver.xuanran.wang.schroeder.action;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.action.CusBaseAction; import aiyh.utils.action.CusBaseAction; // 基础的action实现一些基础的参数
import aiyh.utils.annotation.RequiredMark; import aiyh.utils.annotation.RequiredMark;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException; // 自定义异常类 create 2022/3/9 2:20 PM
import weaver.conn.RecordSetTrans; import weaver.conn.RecordSetTrans;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.workflow.request.RequestManager; import weaver.workflow.request.RequestManager;
@ -16,7 +16,7 @@ import weaver.xuanran.wang.schroeder.service.SchroederQRCodeService;
* @Author xuanran.wang * @Author xuanran.wang
* @Date 2022/11/30 16:08 * @Date 2022/11/30 16:08
*/ */
public class PushSealTaskAction extends CusBaseAction { public class PushSealTaskAction extends CusBaseAction { // 基础的action实现一些基础的参数
/** /**
* <h2></h2> * <h2></h2>
@ -30,24 +30,25 @@ public class PushSealTaskAction extends CusBaseAction {
@RequiredMark @RequiredMark
private String QRCodeField; private String QRCodeField;
private final SchroederQRCodeService schroederQRCodeService = new SchroederQRCodeService(); private final SchroederQRCodeService schroederQRCodeService = new SchroederQRCodeService(); // 施罗德业务方法 施罗德业务方法
@Override @Override // action 提交流程业务处理方法 具体业务逻辑实现
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestManager requestManager) { public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestManager requestManager) {
log.info("---------- PushSealTaskSealValue Begin " + requestId + "----------"); log.info("---------- PushSealTaskSealValue Begin " + requestId + "----------");
String scanNum = schroederQRCodeService.pushSealTask(onlyMark, billTable, requestId); String scanNum = schroederQRCodeService.pushSealTask(onlyMark, billTable, requestId); // 推送数据创建任务 建模配置唯一标识
RecordSetTrans trans = requestManager.getRsTrans(); RecordSetTrans trans = requestManager.getRsTrans();
trans.setAutoCommit(false); trans.setAutoCommit(false);
String updateSql = "update " + billTable + " set " + QRCodeField + " = ? where requestid = ?"; String updateSql = "update " + billTable + " set " + QRCodeField + " = ? where requestid = ?"; // 二维码来源字段
try{ try{
if(!trans.executeUpdate(updateSql, scanNum, requestId)){ if(!trans.executeUpdate(updateSql, scanNum, requestId)){
throw new CustomerException(Util.logStr("更新表单sql执行失败!sql : {}, 参数 scanNum : {}, requestId : {}", scanNum, requestId)); throw new CustomerException(Util.logStr("更新表单sql执行失败!sql : {}, 参数 scanNum : {}, requestId : {}", scanNum, requestId)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
}catch (Exception e){ }catch (Exception e){
trans.rollback(); trans.rollback();
throw new CustomerException(Util.logStr("执行提交方法异常:{}", e.getMessage())); throw new CustomerException(Util.logStr("执行提交方法异常:{}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
trans.commit(); trans.commit();
} }
} }

View File

@ -1,14 +1,14 @@
package weaver.xuanran.wang.schroeder.cus_field_value; package weaver.xuanran.wang.schroeder.cus_field_value;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException; // 自定义异常类 create 2022/3/9 2:20 PM
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; // 自定义获取参数值
import weaver.zwl.common.ToolUtil; import weaver.zwl.common.ToolUtil; // 常用工具方法-公用类
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -19,14 +19,14 @@ import java.util.stream.Collectors;
* @Author xuanran.wang * @Author xuanran.wang
* @Date 2022/12/2 16:10 * @Date 2022/12/2 16:10
*/ */
public class PushSealTaskSealValue implements CusInterfaceGetValue { public class PushSealTaskSealValue implements CusInterfaceGetValue { // 自定义获取参数值
private final ToolUtil toolUtil = new ToolUtil(); private final ToolUtil toolUtil = new ToolUtil(); // 常用工具方法-公用类 构造方法
private final Logger logger = Util.getLogger(); private final Logger logger = Util.getLogger(); // 获取日志对象
@Override @Override // 获取参数值
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) { public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
logger.info(Util.logStr("路径参数:[{}]", JSONObject.toJSONString(pathParam))); logger.info(Util.logStr("路径参数:[{}]", JSONObject.toJSONString(pathParam))); // 构建日志字符串
// 接口字段 // 接口字段
String sealSnField = pathParam.get("sealSnField"); String sealSnField = pathParam.get("sealSnField");
String sealNumField = pathParam.get("sealNumField"); String sealNumField = pathParam.get("sealNumField");
@ -36,9 +36,9 @@ public class PushSealTaskSealValue implements CusInterfaceGetValue {
String sealNumCusSql = pathParam.get("sealNumCusSql"); String sealNumCusSql = pathParam.get("sealNumCusSql");
// 非空校验 // 非空校验
if(checkBlank(sealSnField, sealNumField, sealSnCusSql, sealNumCusSql)){ if(checkBlank(sealSnField, sealNumField, sealSnCusSql, sealNumCusSql)){
throw new CustomerException(Util.logStr("自定义类路径中必要参数为空,请检查!当前pathParam : {}", JSONObject.toJSONString(pathParam))); throw new CustomerException(Util.logStr("自定义类路径中必要参数为空,请检查!当前pathParam : {}", JSONObject.toJSONString(pathParam))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
logger.info(Util.logStr("当前值 : {}", currentValue)); logger.info(Util.logStr("当前值 : {}", currentValue)); // 构建日志字符串
// 如果为空返回空集合 // 如果为空返回空集合
if(StringUtils.isBlank(currentValue)){ if(StringUtils.isBlank(currentValue)){
return Collections.emptyList(); return Collections.emptyList();
@ -50,8 +50,8 @@ public class PushSealTaskSealValue implements CusInterfaceGetValue {
} }
for (String val : currentValue.split(",")) { for (String val : currentValue.split(",")) {
// 印章类型转换执行自定义sql // 印章类型转换执行自定义sql
String inSealVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealSnCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); String inSealVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealSnCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); // 用数据库值,根据规则转换,获取其最终结果
String inSealNumVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealNumCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); String inSealNumVal = Util.null2DefaultStr(toolUtil.getValueByChangeRule(sealNumCusSql, val, String.valueOf(mainMap.get("requestid")), detailId),""); // 用数据库值,根据规则转换,获取其最终结果
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put(sealSnField, inSealVal); map.put(sealSnField, inSealVal);
map.put(sealNumField, inSealNumVal); map.put(sealNumField, inSealNumVal);
@ -64,3 +64,5 @@ public class PushSealTaskSealValue implements CusInterfaceGetValue {
return Arrays.stream(args).anyMatch(StringUtils::isBlank); return Arrays.stream(args).anyMatch(StringUtils::isBlank);
} }
} }

View File

@ -1,7 +1,7 @@
package weaver.xuanran.wang.schroeder.service; package weaver.xuanran.wang.schroeder.service;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException; // 自定义异常类 create 2022/3/9 2:20 PM
import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils; import aiyh.utils.httpUtil.util.HttpUtils;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
@ -44,10 +44,10 @@ public class SchroederQRCodeService {
**/ **/
private static final String STATUS_FIELD = "status"; private static final String STATUS_FIELD = "status";
private final DealWithMapping dealWithMapping = new DealWithMapping(); private final DealWithMapping dealWithMapping = new DealWithMapping();
private final Logger log = Util.getLogger(); private final Logger log = Util.getLogger(); // 获取日志对象
private final HttpUtils httpUtils = new HttpUtils(); private final HttpUtils httpUtils = new HttpUtils();
{ {
httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); // 全局请求头
} }
/** /**
@ -61,10 +61,10 @@ public class SchroederQRCodeService {
**/ **/
public String pushSealTask(String onlyMark, String billTable, String requestId){ public String pushSealTask(String onlyMark, String billTable, String requestId){
String res = ""; String res = "";
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); // 将配置参数通过唯一标识查询处理成树形结构
String cusWhere = Util.null2DefaultStr(requestMappingConfig.getCusWhereSql(),""); String cusWhere = Util.null2DefaultStr(requestMappingConfig.getCusWhereSql(),"");
if(StringUtils.isNotBlank(cusWhere)){ if(StringUtils.isNotBlank(cusWhere)){
cusWhere = DealWithMapping.sbc2dbcCase(cusWhere); cusWhere = DealWithMapping.sbc2dbcCase(cusWhere); // 全角转半角
} }
String selectMainSql = "select * from " + billTable + " where requestid = ? " + cusWhere; String selectMainSql = "select * from " + billTable + " where requestid = ? " + cusWhere;
log.info("查询主表数据sql { " + selectMainSql + " }, requestId { " + requestId + " }"); log.info("查询主表数据sql { " + selectMainSql + " }, requestId { " + requestId + " }");
@ -72,43 +72,45 @@ public class SchroederQRCodeService {
recordSet.executeQuery(selectMainSql, requestId); recordSet.executeQuery(selectMainSql, requestId);
if (recordSet.next()) { if (recordSet.next()) {
dealWithMapping.setMainTable(billTable); dealWithMapping.setMainTable(billTable);
Map<String, Object> requestParam = dealWithMapping.getRequestParam(recordSet, requestMappingConfig); Map<String, Object> requestParam = dealWithMapping.getRequestParam(recordSet, requestMappingConfig); // 解析请求参数配置树,转换成请求参数
log.info(Util.logStr("请求json : {}", JSONObject.toJSONString(requestParam))); log.info(Util.logStr("请求json : {}", JSONObject.toJSONString(requestParam))); // 构建日志字符串
String url = requestMappingConfig.getRequestUrl(); String url = requestMappingConfig.getRequestUrl();
ResponeVo responeVo = null; ResponeVo responeVo = null;
try { try {
responeVo = httpUtils.apiPost(url, requestParam); responeVo = httpUtils.apiPost(url, requestParam);
} catch (IOException e) { } catch (IOException e) {
throw new CustomerException(Util.logStr("发送印章请求发生异常! : {}", e.getMessage())); throw new CustomerException(Util.logStr("发送印章请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
Map<String, String> headers = httpUtils.getGlobalCache().header; Map<String, String> headers = httpUtils.getGlobalCache().header; // 全局请求头
if (responeVo.getCode() != SUCCESS_CODE) { if (responeVo.getCode() != SUCCESS_CODE) { // 相应状态码
log.error(Util.logStr("can not fetch [{}]this request params is [{}]" + log.error(Util.logStr("can not fetch [{}]this request params is [{}]" + // 构建日志字符串
"this request heard is [{}]but response status code is [{}]" + "this request heard is [{}]but response status code is [{}]" +
"this response is [{}]", url, JSON.toJSON(requestParam), JSON.toJSONString(headers), responeVo.getCode(), "this response is [{}]", url, JSON.toJSON(requestParam), JSON.toJSONString(headers), responeVo.getCode(), // 相应状态码
responeVo.getEntityString())); responeVo.getEntityString())); // 相应内容
throw new CustomerException(Util.logStr("can not fetch [{}]", url)); throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
Map<String, Object> response; Map<String, Object> response;
log.info(Util.logStr("this response is [{}]", responeVo.getEntityString())); log.info(Util.logStr("this response is [{}]", responeVo.getEntityString())); // 构建日志字符串 相应内容
try { try {
response = responeVo.getEntityMap(); response = responeVo.getEntityMap(); // 根据相应结果转化为map集合
log.info(Util.logStr("接口响应:{}", JSONObject.toJSONString(response))); log.info(Util.logStr("接口响应:{}", JSONObject.toJSONString(response))); // 构建日志字符串
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
log.error(Util.logStr("push data error, can not parse response to map" + log.error(Util.logStr("push data error, can not parse response to map" + // 构建日志字符串
"this response is [{}], url is [{}]request params is [{}] request heard is [{}];", "this response is [{}], url is [{}]request params is [{}] request heard is [{}];",
responeVo.getEntityString(), url, JSON.toJSONString(requestParam), JSON.toJSONString(headers))); responeVo.getEntityString(), url, JSON.toJSONString(requestParam), JSON.toJSONString(headers))); // 相应内容
throw new CustomerException(Util.logStr("push data error, can not parse response to map")); throw new CustomerException(Util.logStr("push data error, can not parse response to map")); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
int status = (int) response.get(STATUS_FIELD); int status = (int) response.get(STATUS_FIELD);
if(SUCCESS_STATUS != status){ if(SUCCESS_STATUS != status){
throw new CustomerException(Util.logStr("接口响应码不为0,接口响应信息:{}", Util.null2DefaultStr(response.get(MESSAGE_FIELD),""))); throw new CustomerException(Util.logStr("接口响应码不为0,接口响应信息:{}", Util.null2DefaultStr(response.get(MESSAGE_FIELD),""))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
} }
res = Util.null2DefaultStr(response.get(SCAN_NUM_FIELD),""); res = Util.null2DefaultStr(response.get(SCAN_NUM_FIELD),"");
} }
if(StringUtils.isBlank(res)){ if(StringUtils.isBlank(res)){
throw new CustomerException("获取接口中响应任务字段为空, 请检查!"); throw new CustomerException("获取接口中响应任务字段为空, 请检查!"); // 自定义异常类 create 2022/3/9 2:20 PM
} }
return res; return res;
} }
} }

View File

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
import weaver.formmode.data.ModeDataApproval; import weaver.formmode.data.ModeDataApproval;
import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.xuanran.wang.common.util.CommonUtil; import weaver.xuanran.wang.common.util.CommonUtil;
import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncMain; import weaver.xuanran.wang.saic_travel.model_data_async.config.eneity.DataAsyncMain;
@ -44,10 +45,17 @@ public class AsyncTest extends BaseTest {
@Test @Test
public void testAsync(){ public void testAsync(){
DataAsyncMain config = dataAsyncConfigService.getDataAsyncConfigByUniqueCode("hrmAsyncTest"); // try {
List<String> data = dataAsyncConfigService.asyncModelData(config, 109); // DataAsyncMain config = dataAsyncConfigService.getDataAsyncConfigByUniqueCode("wacoTest");
List<String> list = CommonUtil.doCreateWorkFlow(109, data); // List<String> data = dataAsyncConfigService.asyncModelData(config, 109);
log.info("触发成功 : " + JSONObject.toJSONString(list)); // log.info("生成的数据id : " + JSONObject.toJSONString(data));
// }catch (Exception e){
// log.error("生成建模数据异常 : " + e.getMessage());
// }
// List<String> list = CommonUtil.doCreateWorkFlow(109, data);
// log.info("触发成功 : " + JSONObject.toJSONString(list));
log.info("select hr.email from HrmResource hr where status in (0,1,2,3) AND "+ Util.getSubINClause("1,3,323,124,544","id","in") + " and " + Util.getSubINClause("1","id","not in"));
log.info(Util.getSubINClause("1,3,323,124,544","id","in",2));
} }
@Test @Test

View File

@ -4,8 +4,11 @@ import aiyh.utils.Util;
import basetest.BaseTest; import basetest.BaseTest;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.api.xuanran.wang.schroeder.download_file.mapper.DownLoadFileMapper; import com.api.xuanran.wang.schroeder.download_file.mapper.DownLoadFileMapper;
import com.icbc.api.internal.apache.http.impl.cookie.S;
import org.apache.commons.lang3.StringUtils;
import org.junit.Test; import org.junit.Test;
import weaver.file.ImageFileManager; import weaver.file.ImageFileManager;
import weaver.general.TimeUtil;
import weaver.xuanran.wang.common.util.CommonUtil; import weaver.xuanran.wang.common.util.CommonUtil;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -14,7 +17,10 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Map; import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/** /**
* <h1></h1> * <h1></h1>
@ -39,7 +45,34 @@ public class DownLoadFileTest extends BaseTest {
@Test @Test
public void testImageFileInputSteam(){ public void testImageFileInputSteam(){
InputStream inputStreamById = ImageFileManager.getInputStreamById(705); HashMap<String, String> header = new HashMap<>();
System.out.println("============="); header.put("Content-Type", "application/json;charset=utf-8");
header.put("Authorization", "");
header.put("reqFrom", "1212");
header.put("reqId", UUID.randomUUID().toString());
header.put("reqTime", TimeUtil.getCurrentTimeString());
log.info("header " + header);
}
@Test
public void testParseStr(){
String str = "<Field name=\"apb02\" value=\"#{main.jdskadas}\"/>";
String pattern = "(?<=\\{).+(?=})";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(str);
while (matcher.find()){
String group = matcher.group();
if(StringUtils.isNotBlank(group)){
if(group.startsWith("main.")){
String replaceAll = group.replaceAll("#\\{.+}","黄齑淡饭");
log.info("replaceAll : " + replaceAll);
}else if(group.startsWith("detail.")){
}else if(group.startsWith("sql.")){
}
}
}
} }
} }