修改开发环境

dev
IT-xiaoXiong 2021-12-14 10:28:23 +08:00
parent 062fc0466d
commit c8b9453e9d
236 changed files with 1882 additions and 5597 deletions

BIN
.DS_Store vendored

Binary file not shown.

12
.gitignore vendored
View File

@ -7,12 +7,22 @@ bin-release/
# Other files and folders # Other files and folders
.settings/ .settings/
# Executables # Executables
#.gitignore
log
*.swf *.swf
*.air *.air
*.ipa *.ipa
*.apk *.apk
classbeanLib/*
weaverLib/*
web/**/*.properties
web/**/*.xml
target
classbean
.idea/
!/web/WEB-INF/prop/prop2map/*.properties
# Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties` # Project files, i.e. `.project`, `.actionScriptProperties` and `.flexProperties`
# should NOT be excluded as they contain compiler settings and other important # should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder. # information for Eclipse / Flash Builder.

View File

@ -1,184 +0,0 @@
package com.api.aiyh_pcn.fadada.dao;
import aiyh.utils.Util;
import aiyh.utils.zwl.common.ToolUtil;
import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO;
import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO;
import weaver.aiyh_pcn.fadada.entity.FileInfo;
import weaver.conn.RecordSet;
import weaver.workflow.workflow.WorkflowVersion;
import java.util.List;
import java.util.Map;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/3 0003 14:56
*/
public class FaDDContractMapping {
private final RecordSet rs = new RecordSet();
private final ToolUtil toolUtil = new ToolUtil();
/**
*
*
* @param workflowId id
* @param type
* @return
*/
public FaDaDaConfigDTO queryConfig(String workflowId, int type) {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
String query = "select main.id,main.workflow_type,main.api_type, main.params_config," +
"main.signed_type,wf2.fieldname field_control1," +
"wf.fieldname field_control, wf1.fieldname contract_doc, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.only_own)) only_own, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.only_other)) only_other, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.both_all)) both_all, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.check_personal)) check_personal, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " +
"where FIND_IN_SET(id,main.check_enterprise)) check_enterprise," +
"main.check_source_type,wdt.tablename check_source " +
"from uf_contract_config main " +
"left join workflow_field_table_view wf on wf.id = main.field_control " +
"left join workflow_field_table_view wf1 on wf1.id = main.contract_doc " +
"left join workflow_field_table_view wf2 on wf2.id = main.field_control1 " +
"left join workflow_detail_table_view wdt on wdt.id = main.check_source and " +
"wdt.workflow_id = main.workflow_type " +
"where main.workflow_type in ( " + versionStringByWfid + ") and api_type = ?";
rs.executeQuery(query, type);
return Util.recordeSet2Entity(rs, FaDaDaConfigDTO.class, true);
}
/**
* workflowId
*
* @param versionStringByWfid workflowId
* @return
*/
public String getAllVersion(String versionStringByWfid) {
String query = "select distinct workflow_type from uf_contract_config where workflow_type in (" + versionStringByWfid + ")";
rs.executeQuery(query);
rs.next();
return rs.getString(1);
}
/**
*
*
* @param versionStringByWfid
* @param markOnly
* @return
*/
public String getNodes(String versionStringByWfid) {
String query = "select workflow_nodes from uf_node_config where workflow_type in (" + versionStringByWfid + ") and enable_nodes = ?";
rs.executeQuery(query, 1);
rs.next();
return rs.getString(1);
}
/**
*
*
* @param workflowId
* @return
*/
public String getMainTable(String workflowId) {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
String query = "select tablename from workflow_bill " +
" where id in (select formid from workflow_base " +
" where id in (" + versionStringByWfid + ") )";
rs.executeQuery(query);
rs.next();
String mainTable = rs.getString(1);
toolUtil.writeDebuggerLog("mainTable:" + mainTable);
return mainTable;
}
/**
*
*
* @param workflowId
* @param type
* @return
*/
public String getDetailTable(String workflowId, int type) {
FaDaDaConfigDTO faDaDaConfigDTO = this.queryConfig(workflowId, type);
String detailTable = faDaDaConfigDTO.getCheckSource();
toolUtil.writeDebuggerLog("detailTable:" + detailTable);
return detailTable;
}
/**
* id
*
* @param requestId id
* @param mainTableName
* @return
*/
public Map<String, Object> queryMainMap(String requestId, String mainTableName) {
String query = "select * from " + mainTableName + " where requestid = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(query, requestId);
return Util.recordSet2Map(rs);
}
/**
*
*
* @param mainId id
* @param tableName
* @return
*/
public List<Map<String, Object>> queryDetailMaps(String mainId, String tableName) {
String query = "select * from " + tableName + " where mainid = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(query, mainId);
return Util.recordSet2MapList(rs);
}
/**
*
*
* @param workflowId
* @return
*/
/* public Map<String, Object> queryContractConfig(String workflowId) {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId);
RecordSet rs = new RecordSet();
rs.executeQuery("select * from uf_contract_config where workflow_type in ( " + versionStringByWfid + " ) and api_type = ?", 2);
return Util.recordSet2Map(rs);
}*/
/**
* idid
* @param fileIds
* @return
*/
public List<FileInfo> queryImgFileIdByDocIds(String fileIds) {
String query = "select imagefileid,imagefilename from docimagefile where docid in ( " + fileIds + " )";
rs.executeQuery(query);
return Util.recordeSet2Array(rs, FileInfo.class);
}
public UfContractInfoDTO queryContractInfo(String contractNo) {
String query = "select * from uf_contract_info where contract_no = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(query,contractNo);
return Util.recordeSet2Entity(rs,UfContractInfoDTO.class,true);
}
public UfContractInfoDTO queryContractInfoByRequestId(String requestId) {
String query = "select * from uf_contract_info where workflow_request_id = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(query,requestId);
return Util.recordeSet2Entity(rs,UfContractInfoDTO.class,true);
}
}

View File

@ -1,213 +0,0 @@
package com.api.aiyh_pcn.fadada.entity;
public class UfContractInfoDTO {
private int id;
private int requestId;
private int workflowType;
private String contractNo;
private String fileNo;
private String fileName;
private int signedNum;
private int shouldSignedNum;
private int contractStatus;
private String contractViewUrl;
private String contractDownUrl;
private String workflowMainTable;
private int queueSigned;
private int singleContractFileNum;
private int singleSignedNum;
private String workflowRequestId;
private String workflowDetailTable;
private String signedType;
private String userInfo;
private int mainId;
public void setId(int id) {
this.id = id;
}
public void setRequestId(int requestId) {
this.requestId = requestId;
}
public void setWorkflowType(int workflowType) {
this.workflowType = workflowType;
}
public void setContractNo(String contractNo) {
this.contractNo = contractNo;
}
public void setFileNo(String fileNo) {
this.fileNo = fileNo;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public void setSignedNum(int signedNum) {
this.signedNum = signedNum;
}
public void setShouldSignedNum(int shouldSignedNum) {
this.shouldSignedNum = shouldSignedNum;
}
public void setContractStatus(int contractStatus) {
this.contractStatus = contractStatus;
}
public void setContractViewUrl(String contractViewUrl) {
this.contractViewUrl = contractViewUrl;
}
public void setContractDownUrl(String contractDownUrl) {
this.contractDownUrl = contractDownUrl;
}
public void setWorkflowMainTable(String workflowMainTable) {
this.workflowMainTable = workflowMainTable;
}
public void setQueueSigned(int queueSigned) {
this.queueSigned = queueSigned;
}
public void setSingleContractFileNum(int singleContractFileNum) {
this.singleContractFileNum = singleContractFileNum;
}
public void setSingleSignedNum(int singleSignedNum) {
this.singleSignedNum = singleSignedNum;
}
public void setWorkflowRequestId(String workflowRequestId) {
this.workflowRequestId = workflowRequestId;
}
public void setWorkflowDetailTable(String workflowDetailTable) {
this.workflowDetailTable = workflowDetailTable;
}
public void setMainId(int mainId) {
this.mainId = mainId;
}
public int getId() {
return this.id;
}
public int getRequestId() {
return this.requestId;
}
public int getWorkflowType() {
return this.workflowType;
}
public String getContractNo() {
return this.contractNo;
}
public String getFileNo() {
return this.fileNo;
}
public String getFileName() {
return this.fileName;
}
public int getSignedNum() {
return this.signedNum;
}
public int getShouldSignedNum() {
return this.shouldSignedNum;
}
public int getContractStatus() {
return this.contractStatus;
}
public String getContractViewUrl() {
return this.contractViewUrl;
}
public String getContractDownUrl() {
return this.contractDownUrl;
}
public String getWorkflowMainTable() {
return this.workflowMainTable;
}
public int getQueueSigned() {
return this.queueSigned;
}
public int getSingleContractFileNum() {
return this.singleContractFileNum;
}
public int getSingleSignedNum() {
return this.singleSignedNum;
}
public String getWorkflowRequestId() {
return this.workflowRequestId;
}
public String getWorkflowDetailTable() {
return this.workflowDetailTable;
}
public int getMainId() {
return this.mainId;
}
public String getSignedType() {
return signedType;
}
public void setSignedType(String signedType) {
this.signedType = signedType;
}
public String getUserInfo() {
return userInfo;
}
public void setUserInfo(String userInfo) {
this.userInfo = userInfo;
}
@Override
public String toString() {
return "UfContractInfoDTO{" +
"id=" + id +
", requestId=" + requestId +
", workflowType=" + workflowType +
", contractNo='" + contractNo + '\'' +
", fileNo='" + fileNo + '\'' +
", fileName='" + fileName + '\'' +
", signedNum=" + signedNum +
", shouldSignedNum=" + shouldSignedNum +
", contractStatus=" + contractStatus +
", contractViewUrl='" + contractViewUrl + '\'' +
", contractDownUrl='" + contractDownUrl + '\'' +
", workflowMainTable='" + workflowMainTable + '\'' +
", queueSigned=" + queueSigned +
", singleContractFileNum=" + singleContractFileNum +
", singleSignedNum=" + singleSignedNum +
", workflowRequestId='" + workflowRequestId + '\'' +
", workflowDetailTable='" + workflowDetailTable + '\'' +
", signedType='" + signedType + '\'' +
", userInfo='" + userInfo + '\'' +
", mainId=" + mainId +
'}';
}
}

Binary file not shown.

View File

@ -1,54 +0,0 @@
package customization.action.demo;
import customization.commons.Console;
import customization.commons.CustomAction;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;
/**
*
* SAP
* +SAP MM050_SC_1230_FI_DocCreate_eg
* ********************************************
* SAP
* __nodeid (before)/(after)/(export)/()end
*
*
*/
public class MM050_SC_1230_FI_DocCreate_eg extends CustomAction implements Action {
@Override
public String execute(RequestInfo request) {
//封装流程表单的值
super.getWorkflowDataValue(request);
writeLog("execute action MM050_SC_1230_FI_DocCreate_eg");//打印日志
RequestManager rm = request.getRequestManager();
String requestid = request.getRequestid();
try {
String srcString = Util.null2String(rm.getSrc());
writeLog("srcString:"+srcString);
//当提交时执行
if (srcString.equals("submit")) {
//在这里编写业务逻辑代码调用往SAP系统写入值如果需要阻止流程继续流转参考下方catch里面信息处理。
Console.log( "mainFieldValuesMap"+mainMap);
Console.log( "detailFieldValuesMap"+detailMap);
System.out.println("selectvalue:"+super.getSeletItemValue("cgsqlxjms",rm.getFormid(), Util.null2String(mainMap.get("cgsqlxjms"))));
}
}catch (Exception e){
//异常报错是填写异常信息,阻止流程继续流转
request.getRequestManager().setMessageid("90001");
request.getRequestManager().setMessagecontent("-"+rm.getRequestid()+" 系统异常终止流程提交!");
}
return Action.SUCCESS;
}
}

View File

@ -1,76 +0,0 @@
package customization.action.demo;
import customization.commons.Console;
import customization.commons.CustomAction;
import customization.commons.CustomUtil;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;
/**
*
* SAP
* +SAP MM050_SC_1230_FI_DocCreate_eg
*
* SAP
* __nodeid (before)/(after)/(export)/()end
* type
*/
public class MM050_node688_after extends CustomAction implements Action {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String execute(RequestInfo requestInfo) {
RequestManager rm = requestInfo.getRequestManager();
int requestid=rm.getRequestid();
try {
String srcString = Util.null2String(rm.getSrc());//submit 提交 reject 退回
if (srcString.equals("submit")) {
//获取流程的数据
super.getWorkflowDataValue(requestInfo);
System.out.println("主表数据:"+mainMap);
System.out.println("明细表数据:"+detailMap);
Console.log("type:" + this.getType());
//todo 在这里写相关业务逻辑
if(!true){
String errorinfo="我是测试信息";
requestInfo.getRequestManager().setMessageid(""+requestid);
requestInfo.getRequestManager().setMessage("Action集成报错");
requestInfo.getRequestManager().setMessagecontent("请求ID:" + rm.getRequestid() + ";<br/>操作时间:"+ CustomUtil.getStringDate("yyyy-MM-dd HH:mm:ss") +";<br/><font style=\"color:#6e6e6e;font-size: 12px; font-weight: 700;\">和异构系统交互时返回错误!" +
"参考信息具体如下:</font><br/>" +errorinfo);
super.sendActionErrorInfo(requestid);
return Action.FAILURE_AND_CONTINUE;
}
}
}catch (Exception e){
e.printStackTrace();
//在这里编写业务逻辑代码调用往SAP系统写入值如果需要阻止流程继续流转参考下方catch里面信息处理。
requestInfo.getRequestManager().setMessageid(""+requestid);
requestInfo.getRequestManager().setMessage("Action集成报错");
requestInfo.getRequestManager().setMessagecontent("请求ID:" + rm.getRequestid() + ";<br/>操作时间:"+ CustomUtil.getStringDate("yyyy-MM-dd HH:mm:ss") +";<br/><font style=\"color:#6e6e6e;font-size: 12px; font-weight: 700;\">和异构系统交互时返回错误!" +
"参考信息具体如下:</font><br/>" +e.toString());
super.sendActionErrorInfo(requestid);
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

View File

@ -1,39 +0,0 @@
package customization.action.demo;
import customization.commons.Console;
import customization.commons.CustomAction;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
/**
*
* SAP
* +SAP MM050_SC_1230_FI_DocCreate_eg
*
* SAP
* __nodeid (before)/(after)/(export)/()end
*
*/
public class MM050_node688_before extends CustomAction implements Action {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String execute(RequestInfo requestInfo) {
Console.log("type:" + this.getType());
requestInfo.getRequestManager().setMessageid("90002");
requestInfo.getRequestManager().setMessagecontent("MM050_node688_before");
return Action.FAILURE_AND_CONTINUE;
}
}

View File

@ -1,37 +0,0 @@
package customization.action.demo;
import customization.commons.Console;
import customization.commons.CustomAction;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
/**
*
* SAP
* +SAP MM050_SC_1230_FI_DocCreate_eg
*
* SAP
* __nodeid (before)/(after)/(export)/()end
*
*/
public class MM050_node688_export extends CustomAction implements Action {
private String type;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public String execute(RequestInfo requestInfo) {
Console.log("type:"+this.getType());
requestInfo.getRequestManager().setMessageid("90002");
requestInfo.getRequestManager().setMessagecontent("MM050_node688_before");
return Action.FAILURE_AND_CONTINUE;
}
}

Binary file not shown.

View File

@ -1,174 +0,0 @@
package customization.commons;
import weaver.conn.RecordSet;
import weaver.general.GCONST;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @author liutaihong
* @version 1.0.0
* @ClassName Console.java
* @Description UTF-8
* @createTime 2020-04-29 14:31:00
*/
public class Console {
public static void log(String logStr) {
StackTraceElement[] stacks = new Throwable().getStackTrace();
//int stacksLen = stacks.length;
String className = stacks[1].getClassName();
String method = stacks[1].getMethodName();
int number = stacks[1].getLineNumber();
String actionFileName = stacks[1].getFileName();
write(logStr,"log",className,method,number,actionFileName);
}
public static void info(String logStr) {
StackTraceElement[] stacks = new Throwable().getStackTrace();
//int stacksLen = stacks.length;
String className = stacks[1].getClassName();
String method = stacks[1].getMethodName();
int number = stacks[1].getLineNumber();
String actionFileName = stacks[1].getFileName();
write(logStr,"info",className,method,number,actionFileName);
}
/**
* action
* <p>
* NoPrintLog.properties classNameclass
* eg className=com.custompage.NodeBefore
* com.custompage.NodeBefore
* <p>
*
* 1:80Gecology
* 2:1
* 3:log/log/ecology*.log200m
* 4200M使访
* <p>
* action
* 1. extends BaseBeanwriteLog extends ActionUtil
* 使writeLog();
* 2.使
* <p>
*
* <<<<<<< HEAD
* /log/devlog/ java
* eg
* /log/devlog/NodeBefore.java_2017-06-18.log
* /log/devlog/NodeAfter.java_2017-06-18.log
* SendHrmResourceInfo.java_2017-06-28.log
* =======
* /log/devlog/ java
* eg
* /log/devlog/NodeBefore.java_2017-06-18.log
* /log/devlog/NodeAfter.java_2017-06-18.log
* >>>>>>> 84c78e050685929fbe1387a54a96dc120300b2a7
* <p>
*
* eg
* m=execute;n=14;t=10:06:23.743===>>
* <<<<<<< HEAD
* m=execute;n=14;t=10:10:08.774===>>NoPrintLog"com.customcode.action.ExportEg"
* =======
* m=execute;n=14;t=10:10:08.774===>>NoPrintLog"com.customcode.action.Export"
* >>>>>>> 84c78e050685929fbe1387a54a96dc120300b2a7
* <p>
*
* m=(method);n=(number);t=(time)==>>log
* execute 14 10:06:23.743
*
* @param logStr log
*/
private static void write(String logStr,String type,String className,String method,int number , String actionFileName ) {
actionFileName = actionFileName.substring(0, actionFileName.indexOf("."));
SimpleDateFormat CurrentDate = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat CurrentTime = new SimpleDateFormat("HH:mm:ss.SSS");
SimpleDateFormat CurrentHour = new SimpleDateFormat("HH");
Date date = new Date();
String thisHour = CurrentHour.format(date);
String thisDate = CurrentDate.format(date);
String thisTime = CurrentTime.format(date);
String log = type+":m=" + method + ";n=" + number + ";t=" + thisTime + "===>>";
String logPath = GCONST.getRootPath() + "log"+File.separatorChar +"devlog" ;
File dir = new File(logPath);
//writeLog(logPath);
if (!dir.exists()) {
dir.mkdir();
System.out.println("创建"+logPath);
}
logPath = GCONST.getRootPath() + "log"+File.separatorChar +"devlog" + File.separatorChar + thisDate;
dir = new File(logPath);
//writeLog(logPath);
if (!dir.exists()) {
dir.mkdir();
System.out.println("创建"+logPath);
}
logPath = GCONST.getRootPath() +"log"+File.separatorChar +"devlog" + File.separatorChar + thisDate + File.separator + actionFileName;
dir = new File(logPath);
//writeLog(logPath);
if (!dir.exists()) {
dir.mkdir();
System.out.println("创建"+logPath);
}
String dirStr = logPath + File.separatorChar + thisHour + ".log";
// writeLog("dirStr:"+dirStr);
File fileName = new File(dirStr);
if (!fileName.exists()) {
try {
fileName.createNewFile();
writeLog(fileName, "m=方法名(method);n=行数(number);t=执行时间(time)==>>打印日志log");
} catch (IOException e) {
e.printStackTrace();
}
}
RecordSet recordSet = new RecordSet();
String allNoPrintLogClass = recordSet.getPropValue("NoPrintLog", "className");
if (allNoPrintLogClass.contains(className)) {
// Log(fileName, log+ "日志未打印如需打开请从配置文件NoPrintLog中删除\""+className+"\"");
} else {
writeLog(fileName, log + logStr);
}
}
/**
* @param fileName
* @param log
*/
private static void writeLog(File fileName, String log) {
try {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName, true), StandardCharsets.UTF_8));
writer.write(log + "\r\n");
if (writer != null)
writer.close();
if (writer != null)
writer.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
}
}
}

View File

@ -1,319 +0,0 @@
package customization.commons;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.soa.workflow.request.*;
import weaver.workflow.request.RequestManager;
import weaver.workflow.workflow.WorkflowRequestComInfo;
import java.net.InetAddress;
import java.util.HashMap;
import java.util.LinkedHashMap;
/**
* Created by liutaihong on 16-06-17.
*
*/
public class CustomAction extends BaseBean {
protected HashMap<String, String> mainMap;//主字段的值
protected HashMap<String, HashMap <String, HashMap<String, String>>> detailMap ;//所有明细表的值
protected WSBaseInfo wsBaseInfo ;
protected int wf_creater ;
protected int wf_formid ;
protected int wf_isbill ;
protected String formtablename ;
protected int wf_user ;
public CustomAction(){
mainMap = new HashMap<String, String>();//主字段的值
detailMap = new HashMap<String, HashMap<String, HashMap<String, String>>>();//所有明细表的值
wsBaseInfo = new WSBaseInfo();
wf_creater = 0;
wf_formid = 0;
wf_isbill = 0;
formtablename = "";
wf_user = 0;
}
/**
*
* actionMap
* <p>
*
* 1.使SQL()
* 2.requestInfo.getMainTableInfo().getProperty()
* <p>
* 使
* map.get("requestName");
* requestidmap.get("requestId");
* map.get("creatorId");
* idmap.get("workflowId");
*
* @param requestInfo
* @return mainMap
*/
public synchronized void getWorkflowDataValue(RequestInfo requestInfo) {
/*
Console.log(" 执行getWorkflowDataValue");
long waittime=ProcessingUtil.start();
Console.log(requestInfo.getRequestid()+"等待"+waittime+"ms");
*/
RequestManager rm = requestInfo.getRequestManager();
//System.out.println("select * from formtable_main_"+Math.abs(rm.getFormid())+" where requestid='"+rm.getRequestid()+"'");
RequestManager RequestManager = requestInfo.getRequestManager();
wf_formid = RequestManager.getFormid();//流程表单id
wf_creater = RequestManager.getCreater();//流程创建人
wf_isbill = RequestManager.getIsbill();//是否为单据
wf_user = RequestManager.getUser().getUID();//当前操作者
mainMap.put("requestname", requestInfo.getDescription());//流程标题
mainMap.put("requestid", requestInfo.getRequestid());//流程id
mainMap.put("creatorid", requestInfo.getCreatorid());//流程创建人ID
mainMap.put("workflowid", requestInfo.getWorkflowid());
try {
ResourceComInfo rci = new ResourceComInfo();
DepartmentComInfo dci = new DepartmentComInfo();
wsBaseInfo.setCreater_departmentcode(dci.getDepartmentCode(rci.getDepartmentID("" + wf_creater)));
wsBaseInfo.setCreater_departmentid(rci.getDepartmentID("" + wf_creater));
wsBaseInfo.setCreater_departmentname(dci.getDepartmentname(rci.getDepartmentID("" + wf_creater)));
wsBaseInfo.setCreater_department_codeAndName(dci.getDepartmentCode(rci.getDepartmentID("" + wf_creater)) + "|" + dci.getDepartmentname(rci.getDepartmentID("" + wf_creater)));
wsBaseInfo.setCreater_lastname(rci.getLastname("" + wf_creater));
wsBaseInfo.setCreater_workcode(rci.getWorkcode("" + wf_creater));
wsBaseInfo.setCreater_workcodeAndName(rci.getWorkcode("" + wf_creater) + "|" + rci.getLastname("" + wf_creater));
wsBaseInfo.setCurrent_departmentcode(dci.getDepartmentname(rci.getDepartmentID("" + wf_user)));
wsBaseInfo.setCurrent_departmentid(rci.getDepartmentID("" + wf_user));
wsBaseInfo.setCurrent_departmentname(dci.getDepartmentCode(rci.getDepartmentID("" + wf_user)));
wsBaseInfo.setCurrent_department_codeAndName(dci.getDepartmentname(rci.getDepartmentID("" + wf_user)) + "|" + dci.getDepartmentCode(rci.getDepartmentID("" + wf_user)));
wsBaseInfo.setCurrent_lastname(rci.getLastname("" + wf_user));
wsBaseInfo.setCurrent_workcode(rci.getWorkcode("" + wf_user));
wsBaseInfo.setCurrent_workcodeAndName(rci.getWorkcode("" + wf_user) + "|" + rci.getLastname("" + wf_user));
wsBaseInfo.setFormid(Math.abs(rm.getFormid()));
//************ 这部部分非30项目全新的项目可以去掉
mainMap.put("createrworkcode", rci.getWorkcode("" + wf_creater));//流程创建人工号
mainMap.put("createrlastname", rci.getLastname("" + wf_creater));//流程创建人姓名
mainMap.put("createrdepartmentid", rci.getDepartmentID("" + wf_creater));//流程创建人部门ID
mainMap.put("createrdepartmentname", dci.getDepartmentname(rci.getDepartmentID("" + wf_creater)));//流程创建人部门名称
mainMap.put("createrdepartmentcode", dci.getDepartmentCode(rci.getDepartmentID("" + wf_creater)));//流程创建人部门编号
mainMap.put("currentworkcode", rci.getWorkcode("" + wf_user));//当前操作人工号
mainMap.put("currentlastname", rci.getLastname("" + wf_user));//当前操作人姓名
mainMap.put("currentdepartmentid", rci.getDepartmentID("" + wf_user));//当前操作人部门ID
mainMap.put("currentdepartmentname", dci.getDepartmentname(rci.getDepartmentID("" + wf_user)));//当前操作人部门名称
mainMap.put("currentdepartmentcode", dci.getDepartmentCode(rci.getDepartmentID("" + wf_user)));//当前操作人部门编号
} catch (Exception e) {
System.out.println("流程基础信息获取:" + e.toString());
}
// System.out.println(".......>"+wsBaseInfo.getSys());
System.out.println("requestid:" + requestInfo.getRequestid());
Property[] properties = requestInfo.getMainTableInfo().getProperty();// 获取表单主字段信息
for (int i = 0; i < properties.length; i++) {// 主表数据
String name = properties[i].getName().toLowerCase();
String value = Util.null2String(properties[i].getValue());
//System.out.println("formtable_main_"+Math.abs(wf_formid)+"."+name+""+ Util.null2String(value));
mainMap.put(name, Util.null2String(value));
//writeLog(name + ":" + value);
}
DetailTable[] detailtable = null;
try {
detailtable = requestInfo.getDetailTableInfo().getDetailTable();// 获取明细表
if (detailtable.length > 0) {
for (int i = 1; i <= detailtable.length; i++) {//遍历明细表
HashMap<String, HashMap<String, String>> rowList = new LinkedHashMap<String, HashMap<String, String>>();
DetailTable dt = detailtable[i-1];
Row[] s = dt.getRow();
for (int j = 1; j <= s.length; j++) {
HashMap<String, String> rowMap = new LinkedHashMap<String, String>();
Row r = s[j-1];
Cell[] c = r.getCell();
for (int k = 0; k < c.length; k++) {
Cell c1 = c[k];
String name = c1.getName().toLowerCase();
String value = c1.getValue();
//System.out.println(i+""+"-"+name+":"+value);
rowMap.put(name, Util.null2String(value));
}
if (rowMap.size() > 0) {
rowList.put(r.getId(), rowMap);
}
}
detailMap.put(dt.getTableDBName(), rowList);
}
}
} catch (Exception e) {
}
Console.log("-------------requestid:"+requestInfo.getRequestid()+"--------------");
Console.log("mainMap:"+mainMap.toString());
Console.log("detailMap:"+detailMap.toString());
}
private String getSeletItemValue(String fieldname, int formid, String selectvalue, Integer index) {
String name = "";
try {
RecordSet recordSet = new RecordSet();
if (selectvalue.equals("null") || selectvalue == null) {
selectvalue = "";
}
String detailtable = "";
String fname = fieldname;
String billid = "";
if (fieldname.contains(".")) {
detailtable = fieldname.split("\\.")[0];
fname = fieldname.split("\\.")[1];
}
String sqls = "select * from workflow_billfield where billid= '" + formid + "' and fieldname='" + fname + "' ";
if (detailtable.equals("")) {
sqls = sqls + " and detailtable is null ";
} else {
sqls = sqls + " and detailtable ='" + detailtable + "'";
}
recordSet.execute(sqls);
if (recordSet.first()) {
billid = recordSet.getString("id");
}
sqls = "select * from WORKFLOW_SELECTITEM where SELECTvalue='" + selectvalue + "' and FIELDID='" + billid + "'";
recordSet.execute(sqls);
if (recordSet.first()) {
name = recordSet.getString("selectName");
}
if (index != null && !name.isEmpty() && name.contains("|")) {
name = name.split("\\|")[index];
}
} catch (Exception var11) {
}
return name.trim();
}
public static String getSeletItemValue(String fieldname, int formid, String selectvalue) {
return new CustomAction().getSeletItemValue(fieldname, formid, selectvalue, (Integer)null);
}
public static String getSeletItemValueBefore(String fieldname, int formid, String selectvalue) {
return new CustomAction().getSeletItemValue(fieldname, formid, selectvalue, 0);
}
public static String getSeletItemValueAfter(String fieldname, int formid, String selectvalue) {
return new CustomAction().getSeletItemValue(fieldname, formid, selectvalue, 1);
}
/**
*
* @param requestid
*/
public static void sendActionErrorInfo(int requestid){
Boolean istrue = true;
String sendErrorWfCode = "," + Util.null2String(new BaseBean().getPropValue("customPropSet", "sendErrorWf"), "0") + ",";
String sqlstr = "select WORKFLOWID from workflow_requestbase where requestid='" + requestid + "'";
RecordSet recordSet = new RecordSet();
recordSet.execute(sqlstr);
if (recordSet.next()) {
if (sendErrorWfCode.contains("," + recordSet.getString("WORKFLOWID") + ",")) {
//当为设置的流程wrokflow时
istrue = false;
}
}
if(sendErrorWfCode.equals(",0,")){
istrue = true;
}
if (istrue) {
new Thread((new Runnable() {
@Override
public void run() {
String remarkfs = ""; //发送报文内容
try {
WorkflowRequestComInfo requestComInfo = new WorkflowRequestComInfo();
String requestname = "【流程Action集成报错】相关请求\"" + requestComInfo.getRequestName("" + requestid) + "(" + requestid + ")\"";
String remark = requestname + "</br>操作时间:" + CustomUtil.getStringDate("yyyy-MM-dd HH:mm:ss") + "";
remark += "</br>相关请求:<a target=\"_blank\" href=\"/spa/workflow/static4form/index.html?#/main/workflow/req?requestid=" + requestid + "&ismonitor=1\">" + requestid + "</a>";
InetAddress addr = InetAddress.getLocalHost();
String ip = addr.getHostAddress().toString(); //获取本机ip
String hostName = addr.getHostName().toString(); //获取本机计算机名称
remark += "</br>执行服务器IP:" + ip;
remark += "</br>服务主机名:" + hostName;
int resourceid = Util.getIntValue(Util.null2String(new BaseBean().getPropValue("customPropSet", "actionResourceid")), 1);
setSysRemindInfo(requestname, resourceid, remark);
// 设置主表信息
} catch (Exception e) {
e.printStackTrace();
}
}
})).start();
}
}
/**
*
* @param requestname
* @param resource
* @param remark
* @throws Exception
*/
public static void setSysRemindInfo(String requestname,int resource,String remark) throws Exception{
new weaver.system.SysRemindWorkflow().setSysRemindInfo(requestname,0,0,0,0,resource,""+resource,remark);
}
}

View File

@ -1,259 +0,0 @@
package customization.commons;
import weaver.conn.RecordSet;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author
*/
public class CustomUtil {
public static String dateFormat(String format) {
return dateFormat(new Date(), format);
}
public static String dateFormat(Date date, String format) {
return new SimpleDateFormat(format).format(date);
}
public static Double getDouble(String v) {
return isBlank(v) ? null : getDouble(v, -1.0);
}
/**
* 202002201212122020-02-20 12-12
*
* @param s
* @return
*/
public synchronized static String getDateofhour(String s) {
String r = "";
Date d = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
d = sdf.parse(s);
r = sdf1.format(d);
} catch (Exception e) {
// 格式不正确
}
return r;
}
/**
* 202002202020-02-20
*
* @param s
* @return
*/
public synchronized static String stringFormatToString(String s) {
String r = "";
Date d = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd");
try {
d = sdf.parse(s);
r = sdf1.format(d);
} catch (Exception e) {
// 格式不正确
}
System.out.println("格式化结果 = " + r);
return r;
}
public static Double getDouble(String v, Double defValue) {
try {
return Double.parseDouble(v);
} catch (Exception e) {
return defValue;
}
}
/**
* NullInteger
* @param v
* @return
*/
public static Integer getInteger(String v) {
return isBlank(v) ? null : Integer.parseInt(v);
}
/**
*
* @param value
* @return
*/
public static Integer getInteger(Object value, Integer defValue) {
try {
return Integer.parseInt(getString(value));
} catch (Exception e) {
}
return defValue;
}
/**
* -1
* @param v
* @return
*/
public static int getInt(String v) {
return getInt(v, -1);
}
/**
*
* @param v
* @param defValue
* @return
*/
public static int getInt(String v, Integer defValue) {
try {
return Integer.parseInt(v);
} catch (Exception e) {
return defValue;
}
}
public static boolean isBlank(String v) {
return v == null || v.trim().length() == 0;
}
public static boolean isNotBlank(String v) {
return !isBlank(v);
}
public static String getDBValue(String val) {
if (val != null) {
val = "'" + val + "'";
}
return val;
}
public static String getString(Object obj) {
return getString(obj, null);
}
public static String getString(Object obj, String defValue) {
if (obj == null) {
return defValue;
}
return obj.toString();
}
public static String getStringLeft(String str, int len) {
if (isBlank(str)) {
return "";
}
len = str.length() > len ? len : str.length();
return str.substring(0, len);
}
public static void checkStringEmpty(String str, String errMessage) {
if (str == null || str.isEmpty()) {
throw new RuntimeException(errMessage);
}
}
public static void checkNull(Object o, String errMessage) {
if (o == null) {
throw new RuntimeException(errMessage);
}
}
public static void checkArrayEmpty(Object o, String errMessage) {
if (o == null) {
throw new RuntimeException(errMessage);
}
}
public static List<String> getDeclares(String str) {
Pattern p = Pattern.compile("(?<=\\u007B).*?(?=\\u007D)");
Matcher m = p.matcher(str);
List<String> result = new ArrayList<String>();
while (m.find()){
if (m.group() != null){
result.add(m.group());
}
}
return result;
}
public static void stdout(StackTraceElement[] stackTrace, Object... args){
StackTraceElement s = stackTrace[1];
String str = String.format("[%s] %s.%s(Line: %d) ", CustomUtil.dateFormat(new Date(), "HH:mm:ss.SSS"),
s.getClassName(), s.getMethodName(), s.getLineNumber());
for (Object obj : args) {
str += ", " + obj;
}
System.out.println(str);
}
public static String getStringDate(String format) {
return new SimpleDateFormat(format).format(new Date());
}
public static String getStringDate(String format, String date) throws ParseException {
String olddate=date;
if(date.isEmpty()||date.equals("00000000")){
return "";
}
if(date.contains("-")){
date=date.replace("-","");
}
if(format.contains("-")){
Date rq = new SimpleDateFormat("yyyyMMdd").parse(date);
SimpleDateFormat sdf = new SimpleDateFormat(format);
date=sdf.format(rq);
}
return date;
}
public static String upperFirstWord(String str) {
String firstWord = str.substring(0, 1).toUpperCase();
return firstWord + str.substring(1);
}
public static String replace(String str){
str=str.replaceAll("'","''");
str=str.trim();
return str;
}
public static char getSeparator() {
return '\002';
}
public static String MerchantCode2name(String code){
if(code.isEmpty())return "";
String name="";
RecordSet rs= new RecordSet();
rs.execute("select NAME_ORG1 from uf_Merchant where PARTNER= '" + code + "'");
if (rs.next()) {
name = rs.getString("NAME_ORG1");
}
return name;
}
public static void main(String[] args) {
try {
System.out.println(getStringDate("yyyyMMdd",null));
} catch (ParseException e) {
e.printStackTrace();
}
}
}

View File

@ -1,136 +0,0 @@
package customization.commons;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.RequestService;
import java.util.HashMap;
import java.util.Map;
/**
* Action
* @author
*/
public class LocalTestAction {
private Integer requestId;
private String actionClass;
private Integer lastOperator;
private String src;
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
private String remark;
private String mainFields;
private Map<String, String> dtFields;
public LocalTestAction(Integer requestId, String actionClass) {
this.requestId = requestId;
this.actionClass = actionClass;
}
public Integer getRequestId() {
return requestId;
}
public void setRequestId(Integer requestId) {
this.requestId = requestId;
}
public String getActionClass() {
return actionClass;
}
public void setActionClass(String actionClass) {
this.actionClass = actionClass;
}
public Integer getLastOperator() {
return lastOperator;
}
public void setLastOperator(Integer lastOperator) {
this.lastOperator = lastOperator;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public String execute() throws Exception {
String result = null;
Action action = (Action) Class.forName(this.actionClass).newInstance();
RequestService requestService = new RequestService();
RequestInfo req = requestService.getRequest(requestId);
req.setLastoperator(this.lastOperator == null ? null : this.lastOperator.toString());
//req.setRequestManager(new RequestManager());
req.getRequestManager().setSrc(this.src);
req.getRequestManager().setFormid(Util.getIntValue(getByRequestId(requestId).get("FORMID").toString()));
req.getRequestManager().setCreater(Util.getIntValue(getByRequestId(requestId).get("CREATER").toString()));
req.getRequestManager().setLastoperator(this.lastOperator);
req.getRequestManager().setBillid(Util.getIntValue(getByRequestId(requestId).get("FORMID").toString()));
req.getRequestManager().setIsbill(Util.getIntValue(getByRequestId(requestId).get("ISBILL").toString()));
req.getRequestManager().setRequestid(this.requestId);
req.getRequestManager().setRemark(this.remark);
User user=new User(1);
req.getRequestManager().setUser(user);
result = action.execute(req);
if (CustomUtil.isNotBlank(req.getRequestManager().getMessageid())) {
throw new Exception(req.getRequestManager().getMessageid() + ": " + req.getRequestManager().getMessagecontent());
}
System.out.println("执行结果:"+result);
/*
if("1".equals(result)) {
WorkflowRequestInfo responseInfo = new WorkflowServiceImpl().getWorkflowRequest(this.requestId, this.lastOperator, this.requestId);
String resp = new WorkflowServiceImpl().submitWorkflowRequest(responseInfo, this.requestId, this.lastOperator, this.src, this.remark);
System.out.println("流程提交结果:"+resp);
}
*/
return result;
}
private static Map<String, Object> getByRequestId(int requestId) {
RecordSet rs = new RecordSet();
String sql = "SELECT T1.REQUESTID, T1.WORKFLOWID, T1.REQUESTNAME,T2.ISBILL, "
+ " T1.CREATER, T2.FORMID FROM WORKFLOW_REQUESTBASE T1"
+ " INNER JOIN WORKFLOW_BASE T2 ON T2.ID=T1.WORKFLOWID"
+ " WHERE T1.REQUESTID=?";
Map<String, Object> data = new HashMap<String, Object>();
if (rs.executeQuery(sql, requestId) && rs.next()) {
data.put("REQUESTID", rs.getInt("REQUESTID"));
data.put("WORKFLOWID", rs.getInt("WORKFLOWID"));
data.put("REQUESTNAME", rs.getString("REQUESTNAME"));
data.put("CREATER", rs.getInt("CREATER"));
data.put("FORMID", rs.getInt("FORMID"));
data.put("ISBILL", rs.getInt("ISBILL"));
}
return data;
}
}

View File

@ -1,152 +0,0 @@
package customization.commons;
public class WSBaseInfo {
private int formid = 0;
private String creater_workcode = "";
private String creater_lastname = "";
private String creater_departmentid = "";
private String creater_departmentname = "";
private String creater_departmentcode = "";
private String creater_workcodeAndName = "";
private String creater_department_codeAndName = "";
private String sys = "";
private String current_workcode = "";
private String current_lastname = "";
private String current_departmentid = "";
private String current_departmentname = "";
private String current_departmentcode = "";
private String current_workcodeAndName = "";
private String current_department_codeAndName = "";
public int getFormid() {
return formid;
}
public void setFormid(int formid) {
this.formid = formid;
}
public String getCreater_workcodeAndName() {
return creater_workcodeAndName;
}
public void setCreater_workcodeAndName(String creater_workcodeAndName) {
this.creater_workcodeAndName = creater_workcodeAndName;
}
public String getCreater_department_codeAndName() {
return creater_department_codeAndName;
}
public void setCreater_department_codeAndName(String creater_department_codeAndName) {
this.creater_department_codeAndName = creater_department_codeAndName;
}
public String getCurrent_workcodeAndName() {
return current_workcodeAndName;
}
public void setCurrent_workcodeAndName(String current_workcodeAndName) {
this.current_workcodeAndName = current_workcodeAndName;
}
public String getSys() {
return sys;
}
public void setSys(String sys) {
this.sys = sys;
}
public String getCurrent_department_codeAndName() {
return current_department_codeAndName;
}
public void setCurrent_department_codeAndName(String current_department_codeAndName) {
this.current_department_codeAndName = current_department_codeAndName;
}
public String getCreater_workcode() {
return creater_workcode;
}
public void setCreater_workcode(String creater_workcode) {
this.creater_workcode = creater_workcode;
}
public String getCreater_lastname() {
return creater_lastname;
}
public void setCreater_lastname(String creater_lastname) {
this.creater_lastname = creater_lastname;
}
public String getCreater_departmentid() {
return creater_departmentid;
}
public void setCreater_departmentid(String creater_departmentid) {
this.creater_departmentid = creater_departmentid;
}
public String getCreater_departmentname() {
return creater_departmentname;
}
public void setCreater_departmentname(String creater_departmentname) {
this.creater_departmentname = creater_departmentname;
}
public String getCreater_departmentcode() {
return creater_departmentcode;
}
public void setCreater_departmentcode(String creater_departmentcode) {
this.creater_departmentcode = creater_departmentcode;
}
public String getCurrent_workcode() {
return current_workcode;
}
public void setCurrent_workcode(String current_workcode) {
this.current_workcode = current_workcode;
}
public String getCurrent_lastname() {
return current_lastname;
}
public void setCurrent_lastname(String current_lastname) {
this.current_lastname = current_lastname;
}
public String getCurrent_departmentid() {
return current_departmentid;
}
public void setCurrent_departmentid(String current_departmentid) {
this.current_departmentid = current_departmentid;
}
public String getCurrent_departmentname() {
return current_departmentname;
}
public void setCurrent_departmentname(String current_departmentname) {
this.current_departmentname = current_departmentname;
}
public String getCurrent_departmentcode() {
return current_departmentcode;
}
public void setCurrent_departmentcode(String current_departmentcode) {
this.current_departmentcode = current_departmentcode;
}
}

View File

@ -1,51 +0,0 @@
package customization.proxy;
import customization.commons.Console;
import com.engine.core.cfg.annotation.CommandDynamicProxy;
import com.engine.core.interceptor.AbstractCommandProxy;
import com.engine.core.interceptor.Command;
import com.engine.cube.cmd.resource.ResourceViewCmd;
import java.util.Map;
/**
* @author liutaihong
* @version 1.0.0
* @ClassName CustomResourceViewCmd.java
* @Description TODO
* @createTime 2020-04-29 11:51:00
*/
@CommandDynamicProxy(target = ResourceViewCmd.class, desc="重写resourceView.cmd")
public class CustomResourceViewCmd extends AbstractCommandProxy<Map<String,Object>> {
@Override
public Map<String, Object> execute(Command<Map<String, Object>> targetCommand) {
System.out.println(getClass().getName() + "command 执行之前做一些事");
//获取到被代理对象
ResourceViewCmd rmCmd = (ResourceViewCmd) targetCommand;
//获取被代理对象的参数
Map<String, Object> params = rmCmd.getParams();
/* params.put("sqlwhere","id = t2.sourceid and (t2.sourceid in " +
"(select sbmc from uf_gxsboayy where ((startdate >= '2020-02-02' and startdate <= '2020-02-08') " +
"or (startdate >= '2020-02-02' and enddate <= '2020-02-08' )or (enddate >= '2020-02-02' and enddate <= '2020-02-08') " +
"or (startdate <= '2020-02-02' and enddate >= '2020-02-08')))or t2.sourceid in (select id from uf_yfsb where zyjb =0 )) " );
*/ Console.log(params.toString());
//对参数做预处理
//TODO
//参数回写
//rmCmd.setParams(params);
//执行标准的业务处理
Map<String, Object> result = nextExecute(targetCommand);
//对返回值做加工处理
result.put("我是Test的key", "我是");
result.put("params", params);
System.out.println(getClass().getName() + "command 执行之后做一些事");
return result;
}
}

View File

@ -1,96 +0,0 @@
package customization.test;
import org.junit.Test;
import aiyh.utils.fileUtil.WatermarkPoint;
import aiyh.utils.fileUtil.WatermarkPointEnum;
import weaver.file.FileUpload;
import weaver.soa.workflow.request.RequestInfo;
import weaver.system.SystemComInfo;
import weaver.workflow.request.RequestManager;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/7 0007 18:43
* Action test
*/
public class ActionTest extends BaseTest {
@Test
public void testConfig(){
// AddWatermarkAction addWatermarkAction = new AddWatermarkAction();
// RequestInfo requestInfo = new RequestInfo();
// RequestManager requestManager = new RequestManager();
// requestManager.setBilltablename("formtable_main_32");
// requestInfo.setRequestManager(requestManager);
// requestInfo.setWorkflowid("6");
// addWatermarkAction.execute(requestInfo);
}
@Test
public void testPath(){
System.out.println(-170 % 90);
// System.out.println(Math.toRadians(0));
// System.out.println(new WatermarkPoint(WatermarkPointEnum.CENTER));
// System.out.println(FileUpload.getCreateDir(new SystemComInfo().getFilesystem()));
}
@Test
public void createWaterMarkByText() {
File srcImgFile = new File("C:\\Users\\77449\\Desktop\\test.jpg");
String logoText = "[ 天使的翅膀 ]";
File outputImageFile = new File("C:\\Users\\77449\\Desktop\\test_mark.jpg");
double degree = -45;
OutputStream os = null;
try {
Image srcImg = ImageIO.read(srcImgFile);
BufferedImage buffImg = new BufferedImage(srcImg.getWidth(null),
srcImg.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = buffImg.createGraphics();
graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null),
srcImg.getHeight(null), Image.SCALE_SMOOTH), 0, 0, null);
graphics.rotate(Math.toRadians(degree),
(double) buffImg.getWidth() / 2,
(double) buffImg.getHeight() / 2);
graphics.setColor(Color.RED);
graphics.setFont(new Font("宋体", Font.BOLD, 36));
float alpha = 0.5f;
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP,
alpha));
graphics.drawString(logoText, buffImg.getWidth()/3, buffImg.getHeight()/2);
graphics.dispose();
os = new FileOutputStream(outputImageFile);
// 生成图片
ImageIO.write(buffImg, "JPG", os);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != os) {
os.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@ -1,771 +0,0 @@
package customization.test;
import aiyh.utils.Util;
import aiyh.utils.fileUtil.WatermarkPoint;
import aiyh.utils.fileUtil.WatermarkPointEnum;
import aiyh.utils.fileUtil.WritWatermark;
import aiyh.utils.httpUtil.HttpManager;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.staticUtil.GlobalStaticCache;
import aiyh.utils.httpUtil.staticUtil.HttpStaticUtils;
import aiyh.utils.httpUtil.util.HttpUtils;
import aiyh.utils.mapUtil.ParaMap;
import aiyh.utils.mapUtil.UtilHashMap;
import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
import aiyh.utils.sqlUtil.whereUtil.Where;
import com.api.aiyh_guijiu.service.WorkflowQueueService;
import com.api.aiyh_guijiu.vo.PicPsVO;
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import com.mzlion.core.http.ContentType;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.h2.util.StringUtils;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
import sun.font.FontDesignMetrics;
import weaver.aiyh_quanshi.RequestApi;
import weaver.aiyh_quanshi.entity.QsResponse;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.fna.invoice.utils.HttpUtil;
import weaver.general.GCONST;
import weaver.hrm.User;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.LinkOption;
import java.nio.file.Paths;
import java.nio.file.attribute.BasicFileAttributeView;
import java.nio.file.attribute.BasicFileAttributes;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.List;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author EBU7-dev1-ayh
* @create 2021/8/23 0023 17:55
*
*/
public class AiyhUtilTest extends BaseTest {
@Test
public void testParaMap() {
// 使map可以链式调用但是只支持StringObject的泛型写死了
Map<String, Object> map = ParaMap.create()
.put("name", "aiyh")
.put("age", 22)
.put("sex", "男");
System.out.println(map);
}
@Test
public void testUtilMap() {
UtilHashMap<String, Object> map = Util.createUtilHashMap().uPut("id", 1).uPut("name", "%aiyh%");
map.uPut("key", null).uPut(null, "value");
System.out.println(map);
// 过滤键值都不为null返回一个新的map不影响原来的map
Map<String, Object> newMap = map.filter((key, value) -> !Objects.isNull(key) && !Objects.isNull(value));
System.out.println(newMap);
// UtilLinkedHashMap用法一样。
}
/**
* SQL
*/
@Test
public void testWhere() {
System.out.println(aiyh.utils.Util.createSqlBuilder().updateSql("docimagefile"
, ParaMap.create().put("imagefileid", 2)
, aiyh.utils.Util.createPrepWhereImpl().whereAnd("docid").whereEqual(1)).getSqlStr());
Where where = Util.createPrepWhereImpl()
.whereOr("test").whereEqual(2)
.whereAnd("id").whereEqual(1)
.whereOr("name").whereLike("%aiyh%");
// 等效于下面代码
// Where where = new PrepWhereImpl();
// where.whereAnd("id").whereEqual(1).whereOr("name").whereLike("%aiyh%");
System.out.println(where.getSql());
System.out.println(where.getArgs());
// WhereImpl类用法类似但不推荐使用
}
@Test
public void testInnerPrepWhere() {
Where where = Util.createPrepWhereImpl()
.whereAnd("id").whereEqual(1)
.andInnerWhere("test").whereEqual("9")
.whereOr("innerOr").whereEqual("yes").endInnerWhere()
.whereOr("name").whereLike("%aiyh%");
System.out.println(where.getSql());
System.out.println(where.getArgs());
}
@Test
public void testInnerWhere() {
Where where = Util.createWhereImpl()
.whereAnd("id").whereEqual(1)
.andInnerWhere("test").whereEqual("9")
.whereOr("innerOr").whereEqual("yes").endInnerWhere()
.whereOr("name").whereLike("%aiyh%");
System.out.println(where.getSql());
}
/**
* SQL
*/
@Test
public void testBuilderSql1() {
// 创建键值对对应关系map
Map<String, Object> map = new HashMap<>();
map.put("id", "1");
map.put("name", "aiyh");
map.put("age", "22");
map.put("job", "java 开发");
map.put("isnull", null);
PrepSqlResultImpl insertSql = Util.createSqlBuilder().insertSql("tableName", map);
System.out.println(insertSql.getSqlStr());
System.out.println(insertSql.getArgs());
}
/**
* SQL
*/
@Test
public void testBuilderSql2() {
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
// 创建键值对对应关系map
for (int i = 0; i < 5; i++) {
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
map.put("id", i);
map.put("name", "aiyh" + i);
map.put("age", "22");
map.put("job", "java 开发");
list.add(map);
}
BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().insertBatchSql("tableName", list);
System.out.println(batchSqlResult.getSqlStr());
System.out.println(batchSqlResult.getBatchList());
}
/**
* SQL
*/
@Test
public void testBuilderSql3() {
Map<String, Object> map = new HashMap<>();
map.put("lastname", "aiyh");
map.put("loginid", "aiyh");
Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual("22058");
PrepSqlResultImpl updateSql = Util.createSqlBuilder().updateSql("hrmresource", map, where);
System.out.println(updateSql.getSqlStr());
System.out.println(updateSql.getArgs());
RecordSet recordSet = new RecordSet();
recordSet.executeUpdate(updateSql.getSqlStr(), updateSql.getArgs());
}
/**
* SQL
*/
@Test
public void testBuilderSql4() {
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
List<Where> whereList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
map.put("name", "aiyh" + i);
map.put("age", "22");
map.put("job", "java 开发");
list.add(map);
Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual(i);
whereList.add(where);
}
BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("tableName", list, whereList);
System.out.println(batchSqlResult.getSqlStr());
System.out.println(batchSqlResult.getBatchList());
}
@Test
public void testHttpClient() throws IOException, JSONException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
CloseableHttpClient httpConnection = HttpManager.getHttpConnection("");
HttpGet httpGet = new HttpGet("https://www.baidu.com");
CloseableHttpResponse execute = httpConnection.execute(httpGet);
HttpEntity entity = execute.getEntity();
System.out.println(EntityUtils.toString(entity, StandardCharsets.UTF_8));
// http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList
// yZGiC98iGbbyQXw3WG19w5rE3swjU3ld
// CloseableHttpClient httpConnection1 = HttpManager.getHttpConnection();
JSONObject param = new JSONObject();
param.put("page", 1);
HttpPost httpPost = new HttpPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList");
StringEntity stringEntity = new StringEntity(param.toString());
stringEntity.setContentType(ContentType.APPLICATION_JSON.toString());
httpPost.setEntity(stringEntity);
httpPost.setHeader("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
httpPost.setHeader("content-type", ContentType.APPLICATION_JSON.toString());
CloseableHttpResponse execute1 = httpConnection.execute(httpPost);
HttpEntity entity1 = execute1.getEntity();
System.out.println(EntityUtils.toString(entity1, StandardCharsets.UTF_8));
// CloseableHttpClient httpConnection2 = HttpManager.getHttpConnection();
HttpPost httpPost1 = new HttpPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList");
List<NameValuePair> nvps = new ArrayList<>();
nvps.add(new BasicNameValuePair("name", "value"));
httpPost1.setEntity(new UrlEncodedFormEntity(nvps));
httpPost1.setHeader("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
CloseableHttpResponse execute2 = httpConnection.execute(httpPost1);
HttpEntity entity2 = execute2.getEntity();
System.out.println(EntityUtils.toString(entity2, StandardCharsets.UTF_8));
ResponeVo post = HttpStaticUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList", null);
System.out.println();
}
@Test
public void testUtil() throws IOException {
GlobalStaticCache.header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
ResponeVo responeVo = HttpStaticUtils.apiGet("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList");
System.out.println("=========" + Arrays.toString(responeVo.getAllHeaders()));
System.out.println(responeVo.getEntityString());
System.out.println(responeVo.getEntityMap());
System.out.println(responeVo.getCode());
System.out.println(responeVo.getEntity(TestVo.class));
TestVo entity = responeVo.getEntity(TestVo.class);
entity.getItems().forEach(item -> System.out.println(item.getCurrency() + " => " + item.getLocalCurrency() + " : " + item.getRate()));
}
@Test
public void testCallBack() throws IOException {
HttpStaticUtils.apiGet("https://www.baidu.com/s", new HashMap<String, String>() {{
put("wd", "java");
put("ie", "utf-8");
}}, null, response -> {
try {
System.out.println(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8));
System.out.println(response.getStatusLine().getStatusCode());
} catch (IOException e) {
e.printStackTrace();
}
});
}
@Test
public void testPost() throws IOException {
GlobalStaticCache.header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
GlobalStaticCache.paramMap.put("", "");
long l = System.currentTimeMillis();
ResponeVo responeVo = HttpStaticUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList",
null, null);
long l1 = System.currentTimeMillis();
System.out.println(l1 - l);
TestVo entity = responeVo.getEntity(TestVo.class);
System.out.println(entity);
System.out.println(responeVo.getEntityMap());
}
@Test
public void testAsync() throws IOException, ExecutionException, InterruptedException {
HttpUtils httpUtils = new HttpUtils();
httpUtils.getGlobalCache().header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
long l = System.currentTimeMillis();
Future<ResponeVo> responeVoFuture = httpUtils.asyncApiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList",
null, null);
long l1 = System.currentTimeMillis();
System.out.println(l1 - l);
System.out.println("test");
ResponeVo responeVo = responeVoFuture.get();
long l2 = System.currentTimeMillis();
System.out.println(l2 - l1);
System.out.println(l2 - l);
System.out.println("aaaa");
System.out.println(responeVo.getEntityMap());
}
@Test
public void testPDFUTil() throws IOException {
// File file = new File("C:\\Users\\77449\\Pictures\\Saved Pictures\\7c3fbba87cac45568374bdb64622f8d2!400x400.png");
// String path = WritWatermark.addWatermark(file, "C:\\Users\\77449\\Pictures\\Saved Pictures\\2.jpg",
// "这个是水印\nthis is water", "宋体", 0, new Color(249, 231, 186), 0, 20, 0);
// System.out.println(path);
// Files.delete(Paths.get(path));
// ImageFileManager imageFileManager ImageFileManager();
// imageFileManager.getInputStreamById();
// imageFileManager.saveImageFileByInputStream();
}
@Test
public void testPDfUtil2() throws IOException {
/*ImageFileManager imageFileManager = new ImageFileManager();
InputStream inputStreamById = ImageFileManager.getInputStreamById(3639);
Image image = ImageIO.read(inputStreamById);
int width = image.getWidth(null);
int height = image.getHeight(null);
BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics graphics = bufferedImage.createGraphics();
graphics.drawImage(image, 0, 0, width, height, null);
graphics.setColor(new Color(200, 120, 120));
graphics.setFont(new Font("宋体", 0, 50));
String[] pressTexts = "我是水印".split("\n");
for (int i = 0; i < pressTexts.length; i++) {
graphics.drawString(pressTexts[i], 20, 20 + (50 * (i + 1)) + (int) Math.round((height * 0.02)));
}
graphics.dispose();
FileOutputStream fileOutputStream1 = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Pictures\\Saved Pictures\\水印-1.jpg", "utf-8"));
ImageIO.write(bufferedImage, "jpg", fileOutputStream1);
fileOutputStream1.close();
ByteArrayOutputStream bs = new ByteArrayOutputStream();
ImageOutputStream imOut = ImageIO.createImageOutputStream(bs);
ImageIO.write(bufferedImage, "jpg", imOut);
//将图片转为inputStream流
InputStream inputStream = new ByteArrayInputStream(bs.toByteArray());
int i = imageFileManager.saveImageFileByInputStream(new FileInputStream("C:\\Users\\77449\\Pictures\\Saved Pictures\\水印-1.jpg"), "水印1.jpg");
System.out.println(i);*/
int i = WritWatermark.addTextTileWatermarkById(3639, "文字水印测试!", new Color(200, 100, 155),
"宋体", 0, 50, -40, 0.5F,1, 300, 100, 200);
//FileInputStream fs = new FileInputStream(URLDecoder.decode("I:\\wind主题\\开始按钮\\gLogoMid-v3.png","utf-8"));
// int i = WritWatermark.addPicWatermarkById(3639, 3724,new WatermarkPoint(WatermarkPointEnum.CENTER), -45, 0.5F);
InputStream inputStreamById1 = ImageFileManager.getInputStreamById(i);
Image image1 = ImageIO.read(inputStreamById1);
int width1 = image1.getWidth(null);
int height1 = image1.getHeight(null);
BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB);
Graphics graphics1 = bufferedImage1.createGraphics();
graphics1.drawImage(image1, 0, 0, width1, height1, null);
graphics1.dispose();
FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\水印1-1.jpg", "utf-8"));
ImageIO.write(bufferedImage1, "jpg", fileOutputStream);
fileOutputStream.close();
}
@Test
public void testCase() {
String query = "select * from uf_temp_attachment";
RecordSet rs = new RecordSet();
rs.executeQuery(query);
// 如果有时间转换需要添加自定义注解weaver.aiyh_pcn.aiyh.aiyh.utils.annotation.DateFormatAn指定个话类型
TestCaseVo testCaseVo = Util.recordeSet2Entity(rs, TestCaseVo.class, true);
System.out.println(testCaseVo);
}
@Test
public void creatJava() throws IOException {
Util.creatJavaFileByTable("uf_htmb", "createJava.test.createFile");
String selectConfigBase = "select lf.id, lf.is_out_user,lf.is_sell_change,lf.will_write, " +
"wfvw.fieldname as will_write_field,wfvw.tablename as will_write_table, " +
"lf.is_customer_address,lf.workflow_type, lf.customer_id, " +
"lf.change_setting, wslu.selectvalue as update_mark, " +
"lf.manager_type, lf.customer_manager, wfvm.fieldname as manager_field, " +
"wsli.selectvalue as insert_mark,wfv.fieldname as update_insert, " +
"wfv.tablename as update_insert_table " +
"from uf_external_law_fir as lf " +
"left join workflow_selectitem as wslu on wslu.id = lf.update_mark " +
"left join workflow_selectitem as wsli on wsli.id = lf.insert_mark " +
"left join workflow_field_view as wfv on wfv.id = lf.update_insert " +
"left join workflow_field_view as wfvm on wfvm.id = lf.manager_field " +
"left join workflow_field_view as wfvw on wfvw.id = lf.will_write_field " +
"where workflow_type in " +
"(select id from workflow_base where activeVersionID in " +
"(select activeVersionID from workflow_base where id = 2) or id = 2)";
Util.creatJavaFileBySql(selectConfigBase, "testSqlJava", "createJava.test.createFile");
}
@Test
public void testPicPs() {
FileInputStream fileInputStream = null;
try {
BasicFileAttributeView basicview = Files.getFileAttributeView(Paths.get("C:\\Users\\77449\\Desktop\\5dc086a14941f4d5aeec44068986d04.jpg"), BasicFileAttributeView.class,
LinkOption.NOFOLLOW_LINKS);
BasicFileAttributes attr;
try {
attr = basicview.readAttributes();
//attr.lastModifiedTime();
Date lastmodfiyTimeDate = new Date(attr.lastModifiedTime().toMillis());
Date createTimeDate = new Date(attr.creationTime().toMillis());
System.out.println(lastmodfiyTimeDate);
System.out.println(createTimeDate);
} catch (Exception e) {
e.printStackTrace();
}
// 获取媒体数据
fileInputStream = new FileInputStream(
URLDecoder.decode("C:\\Users\\77449\\Desktop\\8308CC261209F70EBC82293C4092C8B5.jpg",
"utf-8"));
Metadata metadata = ImageMetadataReader.readMetadata(fileInputStream);
// 遍历Directory对象每个对象里面包含标签
for (Directory directory : metadata.getDirectories()) {
String directoryName = directory.getName();
if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName)
|| directoryName.contains("Adobe")) {
System.out.println("图片经过Adobe Photoshop");
}
System.out.println(directoryName);
for (Tag tag : directory.getTags()) {
if ("Software".equalsIgnoreCase(tag.getTagName())) {
if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())
|| tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) {
System.out.println("图片经过 Adobe Photoshop!");
} else {
System.out.println("图片经过 " + tag.getDescription() + "!");
}
}
if ("User Comment".equalsIgnoreCase(tag.getTagName())) {
try {
com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription());
System.out.println("图片经过手机端图片处理软件,软件未知!");
} catch (Exception e) {
e.printStackTrace();
}
}
System.out.println(tag);
}
}
} catch (ImageProcessingException | IOException e) {
e.printStackTrace();
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
@Test
public void testPic() {
PicPsVO picPsVO = PicPsVO.PicPsVOBuilder.aPicPsVO()
.docId(0)
.fileId(0)
.fileName("name")
.build();
// 通过物理文件的id进行获取对应的输入流信息。
ImageFileManager imageFileManager = new ImageFileManager();
// 通过文件id获取输入流
InputStream inputStreamById = ImageFileManager.getInputStreamById(3786);
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(
URLDecoder.decode("C:\\Users\\77449\\Desktop\\50c42dffc1d2af366364daf0adcd694.jpg",
"utf-8"));
// 获取媒体数据
Metadata metadata = ImageMetadataReader.readMetadata(fileInputStream);
// 遍历Directory对象每个对象里面包含标签
for (Directory directory : metadata.getDirectories()) {
String directoryName = directory.getName();
if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName)
|| directoryName.contains("Adobe")) {
if (picPsVO.getScore() > 80) {
continue;
}
picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核");
picPsVO.setScore(80);
}
String model = "";
for (Tag tag : directory.getTags()) {
if(tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())){
System.out.println(tag + " ===============> ");
}
System.out.println(tag);
if ("Software".equalsIgnoreCase(tag.getTagName())) {
if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())
|| tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) {
picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核");
picPsVO.setScore(100);
} else {
if (picPsVO.getScore() > 70) {
continue;
}
picPsVO.setDescribe("图片经过" + tag.getDescription() + "软件,注意审核!");
picPsVO.setScore(70);
}
if (!StringUtils.isNullOrEmpty(model) && picPsVO.getDescribe().contains(model)) {
picPsVO.setDescribe("");
picPsVO.setScore(-1);
}
}
if ("Model".equalsIgnoreCase(tag.getTagName())) {
model = tag.getDescription();
if (!StringUtils.isNullOrEmpty(picPsVO.getDescribe())) {
if (picPsVO.getDescribe().contains(tag.getDescription())) {
picPsVO.setDescribe("");
picPsVO.setScore(-1);
}
}
}
if ("User Comment".equalsIgnoreCase(tag.getTagName())) {
try {
if (picPsVO.getScore() > 60) {
continue;
}
com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription());
picPsVO.setDescribe("图片经过手机端图片处理软件,软件未知!请注意审核!");
picPsVO.setScore(60);
} catch (Exception e) {
if (picPsVO.getScore() > 30) {
continue;
}
picPsVO.setDescribe("图片可能经过未知软件!请注意审核!");
picPsVO.setScore(30);
}
}
}
}
} catch (ImageProcessingException | IOException e) {
e.printStackTrace();
} finally {
if(fileInputStream != null){
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
System.out.println(picPsVO);
}
@Test
public void testRe2String(){
RecordSet rs = new RecordSet();
String query = "select id from workflow_base " +
"where activeVersionID in (select activeVersionID " +
"from workflow_base where id = ?) or id = ?";
rs.executeQuery(query,2,2);
System.out.println(Util.recordeSet2Array(rs, Integer.class));
}
@Test
public void testConfig(){
WorkflowQueueService workflowQueueService = new WorkflowQueueService();
// String watermarkConfig = workflowQueueService.getWatermarkConfig("2");
// System.out.println(watermarkConfig);
// String picIsPs = workflowQueueService.getPicIsPs("259,260,261");
// System.out.println(picIsPs);
// String workflowConflictConfig = workflowQueueService.getWorkflowConflictConfig("3");
// System.out.println(workflowConflictConfig);
// String picPsConfig = workflowQueueService.getPicPsConfig();
// System.out.println(picPsConfig);
// String watermarkConfig = workflowQueueService.getWatermarkConfig();
// System.out.println(watermarkConfig);
Properties prop = new Properties();
try {
// 通过输入缓冲流进行读取配置文件
InputStream InputStream = new BufferedInputStream(new FileInputStream(new File("H:\\e-cology-dev\\web\\test.properties")));
// 加载输入流
prop.load(InputStream);
// 根据关键字获取value值
Enumeration<?> enumeration = prop.propertyNames();
while (enumeration.hasMoreElements()){
String key = (String) enumeration.nextElement();
System.out.println(key);
System.out.println(prop.getProperty(key));
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testE(){
System.out.println(!"-1".equals("1002095"));
}
@Test
public void testLock(){
// Lock lock = new ReentrantLock();
// lock.lock();
// lock.unlock();
}
@Test
public void testMap(){
String query = "select * from meeting where id = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(query,8);
Map<String, Object> stringObjectMap = Util.recordSet2Map(rs,true);
System.out.println(stringObjectMap);
}
public Map<String,Object> getPropertiesMap(String prx){
Properties prop = new Properties();
Map<String,Object> map = new HashMap<>();
try {
// 通过输入缓冲流进行读取配置文件
InputStream InputStream = new BufferedInputStream(new FileInputStream(new File("H:\\e-cology-dev\\web\\test.properties")));
// 加载输入流
prop.load(InputStream);
// 根据关键字获取value值
Enumeration<?> enumeration = prop.propertyNames();
while (enumeration.hasMoreElements()){
String key = (String) enumeration.nextElement();
if(key.contains(prx)){
map.put(key.replace(prx + ".", ""),prop.getProperty(key));
}
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
@Test
public void getProp2Map(){
System.out.println(GCONST.getPropertyPath());
System.out.println(Util.null2String(null,"-1"));
Map<String, Object> propertiesMap = Util.getProperties2Map("test","aiyh.test");
System.out.println(propertiesMap);
}
@Test
public void getInfo(){
RequestApi requestApi = new RequestApi();
QsResponse quanShiInfo = requestApi.getQuanShiInfo("59733978");
}
@Test
public void testHttpUtil() throws IOException {
// HttpUtil
HttpUtils httpUtils = new HttpUtils();
httpUtils.getGlobalCache().header.put("authentication","8cb0ddd0fd07424e9e77140d1f7378ab");
ResponeVo files = httpUtils.apiUploadFileById("http://192.168.3.2:8081/upload/fileUpload",
713, "files", "2008年全国统一高考英语试卷全国卷Ⅱ含解析版.doc",
new HashMap<String,Object>(){{
put("fileName","2008年全国统一高考英语试卷全国卷Ⅱ含解析版.doc");
}}, null);
System.out.println(files.getEntityString());
}
@Test
public void testHttpInvoice(){
net.sf.json.JSONObject jsonObject = HttpUtil.postImage(new byte[1], new User());
System.out.println(jsonObject);
}
@Test
public void getMap() {
Map<String, Object> patentWall = Util.getProperties2Map("PatentWall", "aiyh.patentWall");
List<String> args = new ArrayList<>();
patentWall.forEach((key,value)->{
System.out.println("key ——> " + key);
String pattern = "\\$\\{(?<field>(\\s\\S)+?)}";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(String.valueOf(value));
System.out.println("value --> " + value);
String parsing = String.valueOf(value);
while (matcher.find()){
System.out.println("解析 ---> " + matcher.group("field"));
parsing = parsing.replaceFirst(pattern,"反正是对的");
System.out.println("解析后———> " + parsing);
}
pattern = "#\\{(?<field>(\\s\\S)+?)}";
compile = Pattern.compile(pattern);
matcher = compile.matcher(String.valueOf(parsing));
while (matcher.find()){
parsing = parsing.replaceFirst(pattern,"?");
args.add("haoba ");
}
pattern = "#sql\\{(?<field>([\\s\\S])+?)}";
compile = Pattern.compile(pattern);
matcher = compile.matcher(parsing);
while (matcher.find()){
System.out.println("============执行SQL============");
System.out.println(matcher.group("field"));
System.out.println(args);
System.out.println("============执行SQL结束============");
}
args.clear();
});
System.out.println(patentWall);
}
@Test
public void testFormat(){
System.out.printf("sql %s参数 %s%n","我是SQL","我是参数");
}
@Test
public void testGetList(){
PatentWallService patentWallService = new PatentWallService();
patentWallService.getList(null,"");
}
@Test
public void testWidth(){
Font font = new Font("微软雅黑", Font.PLAIN,10);
int wordWidth = getWordWidth(font, "我不知道具体是怎么回事,反正我不清楚");
System.out.println(wordWidth);
}
public int getWordWidth(Font font, String content) {
FontDesignMetrics metrics = FontDesignMetrics.getMetrics(font);
int width = 0;
for (int i = 0; i < content.length(); i++) {
width += metrics.charWidth(content.charAt(i));
}
return width;
}
}

View File

@ -1,26 +0,0 @@
package customization.test;
import customization.commons.Console;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import weaver.general.GCONST;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class BaseTest {
@Before
public void before() throws Exception {
GCONST.setServerName("ecology");
GCONST.setRootPath("H:\\e-cology-dev\\web\\");
}
@AfterClass
public static void after() {
System.out.println("单元测试结束!");
}
}

View File

@ -1,64 +0,0 @@
package customization.test;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils;
import aiyh.utils.mapUtil.ParaMap;
import com.api.aiyh_pcn.copy_attachment.dao.ConfigTableData;
import com.api.aiyh_pcn.copy_attachment.model.ConfigEmpty;
import com.api.aiyh_pcn.copy_attachment.web.CopyAttachment;
import org.junit.Test;
import weaver.docs.docs.seconddev.CreateDocForJSGJXT;
import weaver.docs.pdf.docpreview.ConvertMultiPdfTools;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* @author EBU7-dev1-ayh
* @create 2021/8/29 0029 17:31
* ceshilei
*/
public class CopyFileTest extends BaseTest{
@Test
public void testGetConfig(){
CopyAttachment copyAttachment = new CopyAttachment();
String s = copyAttachment.queryConfig("5");
System.out.println(s);
}
@Test
public void testRequest() throws IOException {
HttpUtils httpUtils = new HttpUtils();
httpUtils.getGlobalCache().header.put("apiKey","yZGiC98iGbbyQXw3WG19w5rE3swjU3ld");
httpUtils.getGlobalCache().paramMap.put("ToKen","1");
httpUtils.getGlobalCache().paramMap.put("pageSize","100");
httpUtils.getGlobalCache().paramMap.put("page","1");
ResponeVo responeVo = httpUtils.apiPost("https://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/Services/ToiBuyService.asmx/GetVendorList", null);
VendorResult entity = responeVo.getEntity(VendorResult.class);
System.out.println(entity);
}
@Test
public void testInt(){
TestVo testVo = new TestVo();
System.out.println(testVo);
}
@Test
public void testInvoice(){
}
@Test
public void testPdf(){
// ConvertMultiPdfTools convertMultiPdfTools = new ConvertMultiPdfTools();
CreateDocForJSGJXT createDocForJSGJXT = new CreateDocForJSGJXT();
int fileName = createDocForJSGJXT.creatDoc(null, "fileName", 8, "1,2,3");
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,189 +0,0 @@
package customization.test;
import aiyh.utils.Util;
import aiyh.utils.entity.ApiConfigMainDTO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.aiyh_kafang.dao.InvoiceMapping;
import com.api.aiyh_kafang.entity.UfInvoiceConfigDTO;
import com.api.aiyh_kafang.service.InvoiceService;
import com.api.aiyh_kafang.web.InvoiceController;
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO;
import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils;
import com.cloudstore.dev.api.util.Util_DataCache;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.Test;
import weaver.aiyh_pcn.fadada.UploadFile2FaDDAction;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
/**
* @author EBU7-dev1-ayh
* @create 2021/10/21 0021 11:48
* ce shi action
*/
/* = 西
creditNo = 916100007273444965
= e23deb7a29714d0da5b806665ab3e2f8*/
public class NewActionTest extends BaseTest {
@Test
public void testAction() {
UploadFile2FaDDAction uploadFile2FaDDAction = new UploadFile2FaDDAction();
RequestInfo requestInfo = new RequestInfo();
requestInfo.setRequestid("68072");
requestInfo.setWorkflowid("45");
RequestManager requestManager = new RequestManager();
requestManager.setBilltablename("formtable_main_17");
requestInfo.setRequestManager(requestManager);
uploadFile2FaDDAction.setContractField("htwj");
uploadFile2FaDDAction.execute(requestInfo);
// uploadFile2FaDDAction.signedContract();
}
@Test
public void testContractStatus() throws JsonProcessingException {
Map<String, Object> data = new HashMap<>();
data.put("contractNo", "7622cb620bc04e77b4e85950c564493b");
Map<String, Object> stringObjectMap = FaDDRequestUtils.queryDetailContractStatus(data);
System.out.println(stringObjectMap);
}
@Test
public void getCode() throws UnsupportedEncodingException {
Map<String, Object> map = new HashMap<>();
map.put("companyName", "陕西正天建设有限公司");
map.put("creditNo", "916100007273444965");
String s = FaDDRequestUtils.builderBizContent(map);
System.out.println(s);
byte[] decode = Base64.getDecoder().decode(s.getBytes(StandardCharsets.UTF_8));
String decodeStr = new String(decode, "UTF-8");
System.out.println(decodeStr);
String decode1 = URLDecoder.decode(decodeStr, "UTF-8");
System.out.println(decode1);
JSONObject jsonObject = JSON.parseObject(decode1);
System.out.println(jsonObject);
// Map<String, Object> stringObjectMap = FaDDRequestUtils.checkCompanyInfo(map);
// System.out.println(JSON.toJSONString(stringObjectMap));
}
@Test
public void testDown() throws UnsupportedEncodingException {
FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();
FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig("45", 2);
System.out.println(JSONObject.toJSONString(faDaDaConfigDTO));
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig());
// System.out.println(JSONObject.toJSONString(apiConfigMainDTO));
// FaDDController faDDController = new FaDDController();
// faDDController.getAllVersion("45");
// FaDDServiceImpl faDDService = new FaDDServiceImpl();
// faDDService.queryContractStatus("45","68072");
// faDDController.signedContract("45","68072");
// Response response = faDDController.contractDownload("68072");
// Response response1 = faDDController.contractDownload("68072");
// System.out.println(response);
// System.out.println(response1);
// FaDDServiceImpl faDDService = new FaDDServiceImpl();
// StreamingOutput contractZipStream = faDDService.contractDownload("68072");
// Response build = Response.ok(contractZipStream)
// .type("application/zip")
// .header("Content-Disposition", "attachment;filename=contracts.zip").build();
// System.out.println(build);
// String str = "public.docx";
// System.out.println(str.substring(0,str.indexOf(".")));
// FaDDRequestUtils.downContract(ParaMap.create().put("contractNo","bc8485e3ce1343f5bc898325f371d739"));
// FaDDServiceImpl faDDService = new FaDDServiceImpl();
// faDDService.queryContractStatus("45","68072");
// ModeDataIdUpdate modeDataIdUpdate = ModeDataIdUpdate.getInstance();
// ModeRightInfo mr = new ModeRightInfo();
// mr.rebuildModeDataShareByEdit(1, 11, Util.getIntValue("5"));//数据权限重构
}
@Test
public void testCha() throws IOException {
List<String> list = new ArrayList<>();
List<String> list_rm = new ArrayList<>();
List<String> list1 = new ArrayList<>();
List<String> list1_rm = new ArrayList<>();
list.add("1");
list.add("2");
list.add("3");
list.add("4");
list.add("5");
list.add("6");
list.add("7");
list.add("8");
list1.add("2");
list1.add("4");
list1.add("6");
list1.add("8");
list1.add("10");
list1.add("20");
for (String s : list) {
for (String s1 : list1) {
if (s.equals(s1)) {
list_rm.add(s);
list1_rm.add(s1);
}
}
}
list.removeAll(list_rm);
list1.removeAll(list1_rm);
// Util_DataCache.setObjVal("list_123",list,20);
System.out.println(list);
System.out.println(list1);
}
@Test
public void getCache() {
List<String> list = (List<String>) Util_DataCache.getObjVal("list_123");
System.out.println(list);
}
@Test
public void testInvoiceConfig() {
InvoiceMapping invoiceMapping = new InvoiceMapping();
UfInvoiceConfigDTO configInfo = invoiceMapping.getConfigInfo("48");
System.out.println(JSON.toJSONString(configInfo));
}
@Test
public void testIncoiceCheck(){
Map<String, Object> testData = new HashMap<>();
testData.put("requestId","171172");
testData.put("workflowId","48");
InvoiceService invoiceService = new InvoiceService();
Map<String, Object> result = invoiceService.contrastInvoiceInfo(testData);
System.out.println(JSON.toJSONString(result));
}
@Test
public void testIncoiceCheckController(){
Map<String, Object> testData = new HashMap<>();
testData.put("requestId","171172");
testData.put("workflowId","48");
InvoiceController invoiceController = new InvoiceController();
String result = invoiceController.check(null, null, testData);
System.out.println(result);
}
}

View File

@ -1,529 +0,0 @@
package customization.test;
import aiyh.utils.Util;
import aiyh.utils.entity.ApiConfigMainDTO;
import aiyh.utils.entity.FnainvoiceinterfaceDTO;
import aiyh.utils.httpUtil.HttpArgsType;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils;
import aiyh.utils.mapUtil.UtilLinkedHashMap;
import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
import aiyh.utils.sqlUtil.whereUtil.Where;
import aiyh.utils.sqlUtil.whereUtil.impl.PrepWhereImpl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping;
import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl;
import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils;
import com.api.aiyh_pcn.patentWall.vo.LinkUrlVO;
import com.weaver.general.TimeUtil;
import org.apache.axiom.util.base64.Base64Utils;
import org.apache.commons.codec.binary.Hex;
import org.apache.http.HttpEntity;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.junit.Test;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.formmode.data.ModeDataIdUpdate;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.xcommon.IOUtils;
import weaver.hrm.User;
import weaver.soa.workflow.FileProcessor;
import weaver.workflow.workflow.WorkflowVersion;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/30 0030 12:50
* xinceshilei
*/
public class NewTest extends BaseTest {
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
// putIfAbsent添加不存在的键返回null如果为null表示不重复
return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null;
}
public static String string2SHA256(String str) {
MessageDigest messageDigest;
String encdeStr = "";
try {
messageDigest = MessageDigest.getInstance("SHA-256");
byte[] hash = messageDigest.digest(str.getBytes(StandardCharsets.UTF_8));
encdeStr = Hex.encodeHexString(hash);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return encdeStr.toUpperCase();
}
@Test
public void testNewSQL() {
String sql = "select * from workflow_base";
RecordSet rs = new RecordSet();
rs.executeQuery(sql);
List<Map<String, Object>> maps = Util.recordSet2MapList(rs);
System.out.println(maps);
System.out.println("jiehus");
}
@Test
public void test() {
String versionStringByWfid = WorkflowVersion.getVersionStringByWfid("45");
System.out.println(versionStringByWfid);
}
@Test
public void createJavaFile() throws IOException {
String query = "";
/*query = "select main.id,main.workflow_type, wf.fieldname field_control, " +
"(select GROUP_CONCAT('',selectvalue,'') result from workflow_selectitem where FIND_IN_SET(id,main.check_personal)) check_personal, " +
"(select GROUP_CONCAT('',selectvalue,'') result from workflow_selectitem where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " +
"main.check_source_type,wdt.tablename check_source " +
"from uf_attestation_conf main " +
"left join workflow_field_table_view wf on wf.id = main.field_control " +
"left join workflow_detail_table_view wdt on wdt.id = main.check_source and wdt.workflow_id = main.workflow_type";
query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " +
"dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql,dt.api_type " +
"from uf_attestation_conf_dt1 dt " +
"left join workflow_field_table_view wf on wf.id = dt.workflow_field ";
*/
/*query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " +
"dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql " +
"from uf_api_param_config_dt1 dt " +
"left join workflow_field_table_view wf on wf.id = dt.workflow_field ";
Util.creatJavaFileBySql(query, "ApiConfigDetail", "aiyh.utils.entity");
query = "select id,workflow_type,api_url,api_name from uf_api_param_config ";
Util.creatJavaFileBySql(query, "ApiConfigMain", "aiyh.utils.entity");*/
/*query = "select main.id,main.workflow_type,main.api_type, main.params_config, " +
"wf.fieldname field_control, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_personal)) check_personal, " +
"(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " +
"main.check_source_type,wdt.tablename check_source " +
"from uf_contract_config main " +
"left join workflow_field_table_view wf on wf.id = main.field_control " +
"left join workflow_detail_table_view wdt on wdt.id = main.check_source and wdt.workflow_id = main.workflow_type ";*/
query = "select * from uf_multi_language_dt1";
Util.creatJavaFileBySql(query, "MultiLanguage", "aiyh.utils.entity");
}
@Test
public void testQueryConf() {
FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();
// FaDDConfigMainDTO configParam = faDDServiceMapping.getConfigParam("45");
// System.out.println(JSON.toJSONString(configParam));
}
@Test
public void testSubString() {
String str = "formtable_main_17_dt1";
System.out.println(str.substring(str.indexOf("_dt") + 3));
}
@Test
public void pattern() {
String str = "流程的requestid{{$requestId}}流程路径的{{$workflowid}}我不知道{{main.test}}对不对,{{detail.field}}";
String pattern = "\\{{2}(?<table>((?!\\$)\\S)+?)\\.(?<field>\\S+?)}{2}";
String pattern1 = "\\{{2}\\$(?<value>(\\S)+?)}{2}";
Pattern compile1 = Pattern.compile(pattern1);
Matcher matcher1 = compile1.matcher(str);
// while (matcher1.find()){
// str = str.replaceFirst(pattern1,matcher1.group("value"));
// System.out.println(str);
// System.out.println(matcher1.group("value"));
// }
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(str);
while (matcher.find()) {
System.out.println(matcher.group("table"));
System.out.println(matcher.group("field"));
}
System.out.println(matcher);
}
@Test
public void testParsingSql() {
Map<String, Object> params = new HashMap<>();
params.put("requestId", "67544");
params.put("workflowId", "45");
params.put("main.field", null);
params.put("main.field1", "field1");
params.put("main.field2", "field2");
params.put("main.field3", "field3");
String map = Util.parsingSq("select * from maintable where " +
"test1 = {{main.field1}} and " +
"test2 = {{main.field2}} and " +
"test3 = {{main.field}} and " +
"test4 = {{main.field1}} and " +
"test5 = {{main.field3}}", params);
System.out.println(map);
}
@Test
public void testParsingSqlByWorkflowId() {
Map<String, Object> params = new HashMap<>();
params.put("requestId", "67544");
params.put("workflowId", "45");
params.put("main.field", "field");
params.put("main.field1", "field1");
params.put("main.field2", "field2");
params.put("main.field3", "field3");
params.put("main.indata", "1,2,3,4,5,6");
String result = "select * from maintable where " +
"test1 = {{main.field1}} and " +
"test2 = {{main.field2}} and " +
"test3 = {{main.field}} and " +
"test4 = {{main.field1}} and " +
"test5 = {{main.field3}} and " +
"id in (#{{main.indata}})";
String s = Util.parsingSq(result, params);
System.out.println(s);
}
@Test
public void testImp() {
FaDDServiceImpl faDDService = new FaDDServiceImpl();
// Map<String, Object> configParam1 = faDDService.getConfigParam1("45");
// System.out.println(JSON.toJSONString(configParam1));
// Map<String, Object> configParam = faDDService.getConfigParam("45");
// System.out.println(JSON.toJSONString(configParam));
// Map<String,Object> map = new HashMap<>();
// map.put("workflowId","45");
// map.put("dataArr",new ArrayList<TableFieldMappingVO>(){{
// TableFieldMappingVO tableFieldMappingVO = new TableFieldMappingVO();
// tableFieldMappingVO.setField("field");
// tableFieldMappingVO.setTableName("tableName");
// add(tableFieldMappingVO);
// TableFieldMappingVO tableFieldMappingVO1 = new TableFieldMappingVO();
// tableFieldMappingVO1.setField("field1");
// tableFieldMappingVO1.setTableName("tableName1");
// add(tableFieldMappingVO1);
// }});
// faDDService.checkCertification(map);
Map<String, Object> map = new HashMap<>();
List<Map<String, Object>> dataArr = new ArrayList<Map<String, Object>>() {{
Map<String, Object> map = new HashMap<>();
map.put("detail_1.gyshtfmczw", "gyshtfmczw-value-api");
map.put("detail_1.tyshxydm", "gyshtflb-value-api");
add(map);
Map<String, Object> map1 = new HashMap<>();
map1.put("detail_1.gyshtfmczw", "gyshtfmczw1-value-api");
map1.put("detail_1.tyshxydm", "gyshtflb1-value-api");
add(map1);
Map<String, Object> map2 = new HashMap<>();
map2.put("detail_1.gyshtfmczw", "gyshtfmczw2-value-api");
map2.put("detail_1.tyshxydm", "gyshtflb2-value-api");
add(map2);
Map<String, Object> map3 = new HashMap<>();
map3.put("detail_1.gyshtfmczw", "gyshtfmczw3-value-api");
map3.put("detail_1.tyshxydm", "gyshtflb3-value-api");
add(map3);
Map<String, Object> map4 = new HashMap<>();
map4.put("detail_1.gyshtfmczw", "gyshtfmczw4-value-api");
map4.put("detail_1.tyshxydm", "gyshtflb4-value-api");
add(map4);
}};
map.put("dataArr", dataArr);
map.put("workflowId", "45");
Map<String, Object> stringObjectMap = faDDService.checkCertification(map);
// faDDService.checkCertification1(map);
System.out.println(stringObjectMap);
}
@Test
public void testMap() {
List<String> list = new ArrayList<String>() {{
add("测试");
add("测试1");
add("测试2");
add("测试3");
add("测试4");
add("测试");
}};
List<String> collect = list.stream().map(item -> item + "[aaa]").collect(Collectors.toList());
System.out.println(collect);
System.out.println(list);
}
@Test
public void testHttp() throws UnsupportedEncodingException {
HttpUtils httpUtils = new HttpUtils();
Map<String, String> header = httpUtils.getGlobalCache().header;
header.put("appId", "100001");
header.put("signType", "SHA256");
header.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss"));
Map<String, Object> data = new HashMap<>();
data.put("companyName", "公司名称");
data.put("creditNo", "统一社会信用代码");
String jsonString = JSONObject.toJSONString(data);
String encode = URLEncoder.encode(jsonString, "UTF-8");
String bizContent = Base64.getEncoder().encodeToString(encode.getBytes(StandardCharsets.UTF_8));
header.put("bizContent", bizContent);
StringBuilder signBuilder = new StringBuilder();
String signStr = signBuilder.append("appId=").append(header.get("appId"))
.append("&bizContent=").append(header.get("bizContent"))
.append("&signType=").append(header.get("signType"))
.append("&timestamp=").append(header.get("timestamp")).toString();
System.out.println(signStr);
String appkey = "L7P59oqA2An0XgJ1LeMN0fRu1";
String sha256 = string2SHA256(signStr) + appkey;
String sign = Base64.getEncoder().encodeToString(string2SHA256(sha256).getBytes(StandardCharsets.UTF_8));
System.out.println(sign);
header.put("sign", sign);
header.put("apikey", "TulQxnZSRKeHoQfmeZzOUzGn6KpTDkDK");
header.put("Content-Type", HttpArgsType.APPLICATION_JSON);
try {
ResponeVo responeVo = httpUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/account/company/info",
data, null);
System.out.println(responeVo.getEntityString());
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void testApi() {
ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig("2");
}
@Test
public void getCode() {
Map<String, Object> map = new HashMap<>();
map.put("companyName", "陕西正天建设有限公司");
map.put("creditNo", "916100007273444965");
Map<String, Object> stringObjectMap = FaDDRequestUtils.checkCompanyInfo(map);
System.out.println(JSON.toJSONString(stringObjectMap));
}
@Test
public void testBatch() {
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
List<Where> whereList = new ArrayList<>();
for (int i = 0; i < 50; i++) {
int finalI = i;
list.add(new UtilLinkedHashMap<String, Object>() {{
put("mobile", "1111111" + finalI);
}});
whereList.add(new PrepWhereImpl().whereAnd("id").whereEqual(22 + finalI));
}
BatchSqlResultImpl hrmresource = Util.createSqlBuilder().updateBatchSql("hrmresource", list, whereList);
RecordSet rs = new RecordSet();
long l = System.currentTimeMillis();
boolean b = rs.executeBatchSql(hrmresource.getSqlStr(), hrmresource.getBatchList());
long l1 = System.currentTimeMillis();
System.out.println(l1 - l);
System.out.println(b);
}
@Test
public void testUpdate() {
long constTime = 0L;
RecordSet rs = new RecordSet();
for (int i = 0; i < 50; i++) {
int finalI = i;
UtilLinkedHashMap<String, Object> mobile = new UtilLinkedHashMap<String, Object>() {{
put("mobile", "111111" + finalI);
}};
Where id = new PrepWhereImpl().whereAnd("id").whereEqual(22 + finalI);
PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("hrmresource", mobile, id);
long l = System.currentTimeMillis();
boolean b = rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs());
long l1 = System.currentTimeMillis();
constTime += (l1 - l);
System.out.println(b);
}
System.out.println(constTime);
}
@Test
public void testSuffix() {
String str = "【保时捷】合同管理需求文档-第一阶段流程V5.3.pdf";
String substring = str.substring(str.lastIndexOf("."));
System.out.println(substring);
}
@Test
public void testUpload() {
RecordSet rs = new RecordSet();
String query = "select * from formtable_main_17_dt1 where mainid = 5";
rs.executeQuery(query);
List<Map<String, Object>> maps = Util.recordSet2MapList(rs);
System.out.println(JSONObject.toJSONString(maps));
// Map<String, String> map = Util.queryLanguage(1, 8);
// System.out.println(map);
}
@Test
public void invoice() throws IOException {
String query = "select * from fnainvoiceinterface where interfaceType=2 and status=1 and subIdStatus=0";
RecordSet rs = new RecordSet();
rs.executeQuery(query);
FnainvoiceinterfaceDTO fnainvoiceinterfaceDTO = Util.recordeSet2Entity(rs, FnainvoiceinterfaceDTO.class);
System.out.println(fnainvoiceinterfaceDTO);
// Util.creatJavaFileByTable("fnainvoiceinterface","aiyh.utils.entity");
}
@Test
public void testLanguage() {
System.out.println(Util.getHtmlLabelName(1, 7, "不知道"));
}
@Test
public void createJava() throws IOException {
Util.creatJavaFileByTable("uf_invoice_config", "com.api.aiyh_kafang.entity");
}
@Test
public void testUtil() {
RecordSet rs = new RecordSet();
rs.executeQuery("select formid from workflow_base where id = 45");
String s = Util.recordeSet2Entity(rs, String.class);
System.out.println(s);
}
@Test
public void testMode() {
ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance();
String formModeId = "52";
int dataid = mdu.getModeDataNewId("uf_contract_config",
Util.getIntValue(formModeId, -1),
1, 0, TimeUtil.getCurrentDateString(),
TimeUtil.getOnlyCurrentTimeString());
//数据权限重构
ModeRightInfo mri = new ModeRightInfo();
mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), 1);
}
@Test
public void donwTest() throws IOException {
Map<String, Object> data = new HashMap<>();
data.put("contractNo", "bda970602f4a4e1dbe37ee9c43908cfc");
AtomicReference<InputStream> content = new AtomicReference<>();
FaDDRequestUtils.downContract(data, response -> {
HttpEntity entity = response.getEntity();
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("法大大请求接口错误!");
}
try {
content.set(entity.getContent());
} catch (IOException e) {
e.printStackTrace();
}
InputStream inputStream = content.get();
try {
byte[] bytes = IOUtils.toByteArray(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
}, "https://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/download");
}
@Test
public void testBase642system() throws IOException {
String path = "C:\\Users\\77449\\Downloads\\154157.pdf";
InputStream is = new FileInputStream(path);
byte[] bytes = IOUtils.toByteArray(is);
String base64 = Base64Utils.encode(bytes);
FileProcessor fileProcessor = new FileProcessor();
User user = new User();
user.setUid(1);
user.setLogintype("1");
int process = fileProcessor.Process("base64:"+base64, ",,88", user, "测试合同下载保存.pdf");
System.out.println(process);
}
@Test
public void downPDF() throws IOException {
InputStream inputStreamById = ImageFileManager.getInputStreamById(3618);
OutputStream out = new FileOutputStream("C:\\Users\\77449\\Downloads\\154157合同测试.pdf");
int cache = 1024 * 10;
byte[] bytes = new byte[cache];
int len = 0;
while ((len = inputStreamById.read(bytes)) != -1){
out.write(bytes,0,len);
}
out.flush();
out.close();
}
@Test
public void testDocCategorys(){
String docCategorys = Util.getDocCategorys("47","khpj");
System.out.println(docCategorys);
}
@Test
public void testToint(){
List<Integer> docIds = new ArrayList<>();
docIds.add(1);
docIds.add(2);
docIds.add(3);
docIds.add(4);
Integer[] strings = docIds.toArray(new Integer[0]);
int[] ints = Arrays.stream(strings).mapToInt(Integer::valueOf).toArray();
System.out.println(Arrays.toString(ints));
}
@Test
public void tesetLong() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IntrospectionException {
LinkUrlVO linkUrlVO = new LinkUrlVO();
String linkUrl = "linkUrl";
BeanInfo beanInfo = Introspector.getBeanInfo(LinkUrlVO.class,Object.class);
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
System.out.println(propertyDescriptor.getName());
if (propertyDescriptor.getPropertyType().equals(Integer.class)){
propertyDescriptor.getWriteMethod().invoke(linkUrlVO,1);
}else{
propertyDescriptor.getWriteMethod().invoke(linkUrlVO,propertyDescriptor.getName());
}
}
// Class<? extends LinkUrlVO> aClass = linkUrlVO.getClass();
// Method method = aClass.getMethod("set" + linkUrl.substring(0, 1).toUpperCase() + linkUrl.substring(1));
// method.invoke(linkUrlVO,"https://baidu.com");
System.out.println(linkUrlVO);
}
}

View File

@ -1,425 +0,0 @@
package customization.test;
import aiyh.utils.LabelHtmlUtils;
import aiyh.utils.Util;
import aiyh.utils.entity.LabelHtmlIndex;
import aiyh.utils.fileUtil.ProperUtil;
import com.alibaba.fastjson.JSON;
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
import com.api.aiyh_pcn.patentWall.vo.PatentVO;
import com.api.aiyh_pcn.patentWall.vo.SearchInputVO;
import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Test;
import weaver.common.util.string.StringUtil;
import weaver.general.GCONST;
import java.io.*;
import java.nio.charset.Charset;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/29 0029 10:16
*/
public class NewUtilTest {
@Before
public void before() throws Exception {
GCONST.setServerName("ecology");
GCONST.setRootPath("H:\\e-cology-dev\\web\\");
}
@AfterClass
public static void after() {
System.out.println("单元测试结束!");
}
@Test
public void testKey() {
String key = "aiyh.patent.config[11].public";
String pattern = "^(aiyh.patent\\.)(?<key>(\\w+))$";
String pattern1 = "^(aiyh.patent\\.)(?<key>(?<objKey>(\\w+))\\.(\\S)+(?!\\[))";
String pattern2 = "^(aiyh.patent\\.)(?<key>(\\w+))(\\[([0-9])+])$";
String pattern3 = "^(aiyh.patent\\.)(?<key>(\\w+))(\\[(?<index>([0-9])+)])\\.(?<objKey>(\\S)+)$";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(key);
while (matcher.find()) {
System.out.println("单一值");
System.out.println(matcher.group("key"));
}
compile = Pattern.compile(pattern2);
matcher = compile.matcher(key);
while (matcher.find()) {
System.out.println("数组");
System.out.println(matcher.group("key"));
}
compile = Pattern.compile(pattern3);
matcher = compile.matcher(key);
while (matcher.find()) {
System.out.println("对象数组");
System.out.println(matcher.group("key"));
System.out.println(matcher.group("objKey"));
System.out.println(matcher.group("index"));
}
compile = Pattern.compile(pattern1);
matcher = compile.matcher(key);
while (matcher.find()) {
System.out.println("多个");
System.out.println(matcher.group("key"));
System.out.println(matcher.group("objKey"));
}
}
@Test
public void testGetPro() {
String key = "aiyh.patent.config[0]";
String prefix = "aiyh.patent";
String value = "第一个元素";
getPro(prefix, key, value);
}
public void getPro(String prefix, String key, Object value) {
Map<String, Object> result = new HashMap<>();
// result = keyHandler(prefix, key, value, result);
String key2 = "aiyh.patent.config[1]";
// result = keyHandler(prefix, key2, "第二个元素", result);
System.out.println(JSON.toJSONString(result));
}
@Test
public void redPro() {
String fileName = "test";
String prefix = "aiyh.patentWall";
Map<String, Object> result = Util.readProperties2Map(fileName, prefix);
System.out.println(JSON.toJSONString(result));
}
public Map<String, Object> getProperties2Map(String fileName, String prefix) {
String propertyPath = GCONST.getPropertyPath();
if (StringUtil.isNullOrEmpty(fileName)) {
return null;
}
if (fileName.contains(".properties")) {
fileName.replace(".properties", "");
}
String path = propertyPath + "prop2map" + File.separator + fileName + ".properties";
ProperUtil prop = new ProperUtil();
Map<String, Object> map = new HashMap<>();
InputStream inputStream = null;
try {
inputStream = new BufferedInputStream(new FileInputStream(path));
prop.load(inputStream);
// Enumeration<?> enumeration = prop.propertyNames();
// 顺序读取
Enumeration<?> enumeration = prop.keys();
while (enumeration.hasMoreElements()) {
String key = (String) enumeration.nextElement();
String value = prop.getProperty(key);
System.out.println(key);
keyHandler(prefix, key, value, map);
;
}
} catch (IOException e) {
throw new RuntimeException("找不到文件:" + path);
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return map;
}
public Map<String, Object> keyHandler(String prePrefix, String key, Object value, Map<String, Object> preResult) {
String objRegex = "^(" + prePrefix + "\\.)(?<key>(\\w+))$";
Pattern compile = Pattern.compile(objRegex);
Matcher matcher = compile.matcher(key);
if (matcher.find()) {
// 只匹配前缀.key=value模式的
String resultKey = matcher.group("key");
preResult.put(resultKey, prop2MapPutValue(value));
}
String moreKey = "^(" + prePrefix + "\\.)(?<key>(?<objKey>(\\w+))\\.(\\S)+(?!\\[))";
compile = Pattern.compile(moreKey);
matcher = compile.matcher(key);
if (matcher.find()) {
// 匹配前缀.key1.key2=value模式的
String objKey = matcher.group("objKey");
String prefixStr = prePrefix + "." + objKey;
Map<String, Object> valueMap;
if (preResult.containsKey(objKey)) {
valueMap = (Map<String, Object>) preResult.get(objKey);
keyHandler(prefixStr, key, value, valueMap);
return null;
}
valueMap = new HashMap<>();
keyHandler(prefixStr, key, value, valueMap);
preResult.put(objKey, valueMap);
return null;
}
String strList = "^(" + prePrefix + "\\.)(?<key>(\\w+))(\\[(?<index>([0-9])+)])$";
compile = Pattern.compile(strList);
matcher = compile.matcher(key);
if (matcher.find()) {
// 匹配前缀.key[0]=value模式的
String objKey = matcher.group("key");
int index = Integer.parseInt(matcher.group("index"));
if (preResult.containsKey(objKey)) {
// 存在值
List<Object> valueList = (List<Object>) preResult.get(objKey);
if (index >= valueList.size()) {
valueList.add(prop2MapPutValue(value));
} else {
valueList.set(index, prop2MapPutValue(value));
}
return null;
}
List<Object> valueList = new ArrayList<>();
valueList.add(prop2MapPutValue(value));
preResult.put(objKey, valueList);
return null;
}
String objArray = "^(" + prePrefix + "\\.)(?<arrKey>(\\w+))(\\[(?<index>([0-9])+)])\\.(?<objKey>(\\S)+)$";
// String objArray = "^("+prePrefix+"\\.)(?<arrKey>(\\w+))(\\[(?<index>([0-9])+)])(\\.(?<objKey>(\\S)+))+";
compile = Pattern.compile(objArray);
matcher = compile.matcher(key);
if (matcher.find()) {
// 匹配前缀.key[0].name=value的模式
String arrKey = matcher.group("arrKey");
String objKey = matcher.group("objKey");
int index = Integer.parseInt(matcher.group("index"));
List<Map<String, Object>> mapList;
if (preResult.containsKey(arrKey)) {
// 存在
mapList = (List<Map<String, Object>>) preResult.get(arrKey);
// mapList
Map<String, Object> valueMap;
if (index >= mapList.size()) {
valueMap = new HashMap<>();
valueMap.put(objKey, prop2MapPutValue(value));
mapList.add(valueMap);
return null;
}
valueMap = mapList.get(index);
String arrMoreKey = "(?<key>(\\w+))\\.(\\S)+(?!\\[)";
Pattern arrMoreKeyCompile = Pattern.compile(arrMoreKey);
Matcher arrMoreKeyMatcher = arrMoreKeyCompile.matcher(objKey);
if (arrMoreKeyMatcher.find()) {
String arrMoreObjKey = arrMoreKeyMatcher.group("key");
Map<String, Object> arrMoreValue;
if (valueMap.containsKey(arrMoreObjKey)) {
arrMoreValue = (Map<String, Object>) valueMap.get(arrMoreObjKey);
keyHandler(arrMoreObjKey, objKey, value, arrMoreValue);
return null;
}
arrMoreValue = new HashMap<>();
keyHandler(arrMoreObjKey, objKey, value, arrMoreValue);
valueMap.put(arrMoreObjKey, arrMoreValue);
return null;
}
arrMoreKey = "(?<key>(\\w+))(\\[(?<index>([0-9])+)])$";
arrMoreKeyCompile = Pattern.compile(arrMoreKey);
arrMoreKeyMatcher = arrMoreKeyCompile.matcher(objKey);
if (arrMoreKeyMatcher.find()) {
String arrMoreArrKey = arrMoreKeyMatcher.group("key");
int arrMoreIndex = Integer.parseInt(arrMoreKeyMatcher.group("index"));
List<Object> arrMoreListValue;
if (valueMap.containsKey(arrMoreArrKey)) {
// 存在值
arrMoreListValue = (List<Object>) valueMap.get(arrMoreArrKey);
if (arrMoreIndex >= arrMoreListValue.size()) {
arrMoreListValue.add(prop2MapPutValue(value));
} else {
arrMoreListValue.set(arrMoreIndex, prop2MapPutValue(value));
}
return null;
}
arrMoreListValue = new ArrayList<>();
arrMoreListValue.add(prop2MapPutValue(value));
valueMap.put(arrMoreArrKey, arrMoreListValue);
return null;
}
// 直接添加
valueMap.put(objKey, prop2MapPutValue(value));
return null;
}
// 不存在
mapList = new ArrayList<>();
Map<String, Object> valueMap = new HashMap<>();
valueMap.put(objKey, prop2MapPutValue(value));
mapList.add(valueMap);
preResult.put(arrKey, mapList);
}
return null;
}
public Object prop2MapPutValue(Object value) {
if (value == null) {
return null;
}
String valueStr = String.valueOf(value).trim();
if (valueStr.startsWith("\"") && valueStr.endsWith("\"")) {
return valueStr.substring(1, valueStr.length() - 1);
}
if (valueStr.contains(",")) {
return valueStr.split(",");
}
return value;
}
@Test
public void testSubstr() {
System.out.println("\"这个是文本框\"".trim().substring(1, "\"这个是文本框\"".trim().length() - 1));
}
@Test
public void testSplit() {
String str = "12,343,89\\,99";
String str1 = "abcd'efg'hig?'klmn";
String[] data = str1.split("(?<!\\?)'");
System.out.println(Arrays.toString(data));
String[] split = str.split("(?<!\\\\),");
System.out.println(Arrays.toString(split));
for (int i = 0; i < split.length; i++) {
split[i] = split[i].replaceAll("\\\\,", ",");
}
for (String s : split) {
System.out.println(s);
}
}
@Test
public void testLanguage() {
String selectName = "~`~`7 其它 不知道 管他呢,阿斯顿发的`~`8 other`~`9 其它`~`~";
String showName = selectName;
if (selectName.startsWith("~`~`") && selectName.endsWith("`~`~")) {
String pattern = "(`~`7 )(?<lable>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher(selectName);
if (matcher.find()) {
showName = matcher.group("lable");
}
}
System.out.println(showName);
}
@Test
public void testPatentServer() {
PatentWallService patentWallService = new PatentWallService();
List<SearchInputVO> inputList = patentWallService.getSearchList("patentWall", 8);
System.out.println(JSON.toJSONString(inputList));
List<PatentVO> patentWallList = patentWallService.getList(null, "patentWall");
System.out.println(JSON.toJSONString(patentWallList));
}
@Test
public void testRegx() {
String pattern = "\\$\\{(?<field>(\\s|\\S)+?)}";
Pattern compile = Pattern.compile(pattern);
Matcher matcher = compile.matcher("${id}");
if (matcher.find()) {
System.out.println(matcher.group("field"));
}
}
@Test
public void testSplic() {
List<Integer> list = new ArrayList<>();
list.add(0);
list.add(1);
list.add(2);
list.add(3);
list.add(4);
list.add(5);
list.add(6);
System.out.println(list);
System.out.println(list.subList(0, 2));
list.removeAll(list.subList(0, 2));
System.out.println(list);
}
@Test
public void test() {
String bizContent = "{\"contractExtension\":\".pdf\",\"contractTitle\":\"PCN Template - Non-Disclosure Agreement (Corporate).pdf\",\"uploadType\":1,\"customerNo\":\"ecef845ba95a409393cb66271a41b0a6\"}";
System.out.println(cn.hutool.core.util.URLUtil.encodeAll(bizContent, Charset.forName("UTF-8")));
}
@Test
public void testReg() {
String var15 = "<html> \n" +
" <head> \n" +
" <title></title> \n" +
" <link href=\"/cloudstore/resource/pc/ckeditor-4.6.2/weaver/contents.css\" rel=\"stylesheet\" type=\"text/css\" /> \n" +
" <link href=\"/cloudstore/resource/pc/ckeditor-4.6.2/plugins/copyformatting/styles/copyformatting.css\" rel=\"stylesheet\" type=\"text/css\" /> \n" +
" <link href=\"/cloudstore/resource/pc/ckeditor-4.6.2/plugins/tableselection/styles/tableselection.css\" rel=\"stylesheet\" type=\"text/css\" /> \n" +
" <link href=\"/cloudstore/resource/pc/ckeditor-4.6.2/plugins/image2/styles/image2.css\" rel=\"stylesheet\" type=\"text/css\" /> \n" +
" <link href=\"/cloudstore/resource/pc/ckeditor-4.6.2/plugins/widget/styles/widget.css\" rel=\"stylesheet\" type=\"text/css\" /> \n" +
" </head> \n" +
" <body style=\"height: 747px;\"> \n" +
" <p>< img alt=\"\" src=\"/weaver/weaver.file.FileDownload?fileid=acdde79d8027d30e809be35a885a28eb184a3d7609b33666049ac12a48c5c8c3c10908eae8d1f6d650bfffce6db986fb5069726005eaf18c1\" /></p > \n" +
" </body> \n" +
" </html> \n" +
" ";
ArrayList var17 = Util.matchAll(var15, "/weaver/weaver.file.FileDownload\\?fileid=([a-z0-9]+)", 1, 1);
System.out.println(var17.size());
System.out.println(var17);
}
@Test
public void testMessage() {
Set<String> userIdList = new HashSet<>(); //接收人id
userIdList.add("22");
userIdList.add("1");
String linkUrl = "/spa/cube/index.html#/main/cube/search?customid=36"; //PC端链接
String linkMobileUrl = ""; //移动端链接
String title = "我是标题淦";
String context = "我是内容啊啊啊";
try {
MessageBean messageBean = Util_Message.createMessage(MessageType.newInstance(1146), userIdList, title, context, linkUrl, linkMobileUrl);
messageBean.setCreater(1);//创建人id
Util_Message.store(messageBean);
} catch (IOException e) {
e.printStackTrace();
}
}
@Test
public void testGetTime() {
System.out.println(System.currentTimeMillis());
System.out.println(System.currentTimeMillis());
}
@Test
public void testPro() {
LabelHtmlUtils labelHtmlUtils = new LabelHtmlUtils("aiyh.htmlLabel.porsche");
Map<String, Object> faDDContractController = labelHtmlUtils.getHtmlLabelMap("FaDDContractController");
System.out.println(faDDContractController);
LabelHtmlIndex labelHtmlIndex = labelHtmlUtils.getLabelHtmlIndex(faDDContractController, "singedErr");
System.out.println(labelHtmlIndex);
}
}

View File

@ -1,22 +0,0 @@
package customization.test;
import aiyh.utils.ApiResult;
import com.api.aiyh_guijiu.service.WorkflowQueueService;
import org.junit.Test;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/16 0016 14:22
*
*/
public class PsApiTest extends BaseTest {
@Test
public void test() {
WorkflowQueueService workflowQueueService = new WorkflowQueueService();
String picIsPs = workflowQueueService.getPicIsPs("73");
System.out.println(picIsPs);
}
}

View File

@ -1,370 +0,0 @@
package customization.test;
import aiyh.utils.zwl.common.ToolUtil;
import com.alibaba.fastjson.JSON;
import com.api.aiyh_guijiu.service.WorkflowQueueService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ibm.icu.text.SimpleDateFormat;
import com.interfaces.toolkit.SSOLoginUtil;
import km.org.apache.poi.hssf.usermodel.HSSFCellStyle;
import km.org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.h2.util.StringUtils;
import org.junit.Test;
import aiyh.utils.HotDeployToolUtil;
import tebie.applib.api.M;
import weaver.aiyh_pcn.async_organization.SyncOrganizationForOtherAPI;
import weaver.aiyh_pcn.async_organization.model.Department;
import weaver.aiyh_pcn.async_organization.model.Employee;
import weaver.aiyh_pcn.async_organization.model.Position;
import weaver.aiyh_pcn.async_organization.result.ApiAsyncConfigResult;
import weaver.aiyh_pcn.async_organization.result.GetOrganizationResult;
import weaver.aiyh_pcn.async_organization.util.GetModelValue;
import weaver.aiyh_quanshi.QsAPI;
import weaver.aiyh_quanshi.RequestApi;
import weaver.aiyh_quanshi.entity.QsResponse;
import weaver.conn.RecordSet;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.*;
/**
* @author liutaihong
* @version 1.0.0
* @ClassName TestAction.java
* @Description TODO
* @createTime 2020-05-15 10:55:00
*/
public class TestAction extends BaseTest {
@Test
public void testHot() throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InterruptedException {
int i = 0;
while (true) {
HotDeployToolUtil hotDeployToolUtil = new HotDeployToolUtil("d:\\WEAVER\\ecology\\classbean\\", "");
Class<?> aClass = hotDeployToolUtil.loadClass("com.api.aiyhTools.TestHot");
Object o = aClass.newInstance();
Method test = o.getClass().getMethod("test");
Object invoke = test.invoke(o);
Thread.sleep(1000);
System.out.println(invoke);
if (i > 100) {
return;
}
i++;
}
}
@Test
public void testFile() throws ClassNotFoundException {
HotDeployToolUtil hotDeployTool = new HotDeployToolUtil("d:\\WEAVER\\ecology\\classbean\\", "");
hotDeployTool.findClass("com\\api\\aiyhTools\\HotDeployTool.class");
}
@Test
public void testLog4j() {
ToolUtil toolUtil = new ToolUtil();
toolUtil.writeDebuggerLog("TestAction", "i am is test log4j method, are you ok?");
}
@Test
public void getDate() {
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
// return "?date=" + formatter.format(date);
System.out.println("?date=" + formatter.format(date));
}
@Test
public void testAsync() {
SyncOrganizationForOtherAPI syncOrganization = new SyncOrganizationForOtherAPI();
syncOrganization.SynTimingToOADepartment();
syncOrganization.SynTimingToOAJobtitle();
syncOrganization.SynTimingToOAHrmResource();
}
@Test
public void testString() {
RecordSet rs = new RecordSet();
rs.executeProc("HrmResourceMaxId_Get", "");
rs.next();
int hrmid = rs.getInt(1);
System.out.println(hrmid);
StringBuilder sysSetSql = new StringBuilder();
System.out.println(StringUtils.isNullOrEmpty(null));
System.out.println(sysSetSql.lastIndexOf(","));
String str = "q=1,w=2,e=3,";
System.out.println(str.substring(0, str.lastIndexOf(",")));
}
@Test
public void testCallMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
ApiAsyncConfigResult asyncConfigResult = new ApiAsyncConfigResult();
asyncConfigResult.setId(1);
asyncConfigResult.setAsyncType(0);
asyncConfigResult.setApiField("apiField");
asyncConfigResult.setoAField("oAField");
asyncConfigResult.setFieldType(1);
asyncConfigResult.setChangeRules(2);
asyncConfigResult.setCustomRules("customRules");
String str = "Id";
GetModelValue<ApiAsyncConfigResult> apiAsyncConfigResultGetModelValue = new GetModelValue<>();
Object id = apiAsyncConfigResultGetModelValue.getValueForString(asyncConfigResult, "Id");
// Class<? extends ApiAsyncConfigResult> clazz = asyncConfigResult.getClass();
// Method getId = clazz.getDeclaredMethod("get" + str);
// Object invoke = getId.invoke(asyncConfigResult);
System.out.println(id);
}
@Test
public void testQueryConfigTableInfo() {
GetModelValue<Position> getModelValue = new GetModelValue<>();
Position position = new Position();
position.setCompany_Code("public static void main test~");
this.builderSql("Company_Code", position, getModelValue);
}
public void builderSql(String filedName, Object obj, GetModelValue getModelValue) {
// 拼接系统部门字段
try {
String value = getModelValue.getValueForString(obj, filedName).toString();
System.out.println(value);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
}
@Test
public void testSyncOrganizationForOtherAPI() {
new SyncOrganizationForOtherAPI().SynTimingToOADepartment();
}
@Test
public void testFormatSql() {
Map<String, Object> map = new HashMap<>();
URL resource = Thread.currentThread().getContextClassLoader().getResource("");
String path = resource.getPath().replaceFirst("/", "").replace("/", "\\");
map.put("packageName", "com.api.aiyhTools");
map.put("filePath", path);
map.put("path", path);
map.put("classPath", path + "com.api.aiyhTools".replace(".", System.getProperties().getProperty("file.separator")));
System.out.println(map);
File file = new File((String) map.get("classPath"));
if (file.exists()) {
System.out.println(map.get("classPath"));
}
}
@Test
public void testWritExcel() throws IOException {
GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
List<Employee> employeeList = getOrganizationResult.getEmployeeList();
SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook();
CellStyle cellStyle = sxssfWorkbook.createCellStyle();
// 设置单元格居中对齐
cellStyle.setAlignment(HorizontalAlignment.forInt(HSSFCellStyle.ALIGN_CENTER));
Font font = sxssfWorkbook.createFont();
font.setColor(HSSFColor.RED.index);
cellStyle.setFont(font);
Sheet sheet = sxssfWorkbook.createSheet("人员信息");
Row desc = sheet.createRow(0);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 13));
Cell cell2 = desc.createCell(0);
cell2.setCellValue("员工信息表同步数据时按照岗位id进行同步");
cell2.setCellStyle(cellStyle);
Row th = sheet.createRow(1);
th.createCell(0).setCellValue("员工ID");
th.createCell(1).setCellValue("名(英文)");
th.createCell(2).setCellValue("姓(英文)");
th.createCell(3).setCellValue("中文姓名");
th.createCell(4).setCellValue("英文名");
th.createCell(5).setCellValue("员工编号");
th.createCell(6).setCellValue("岗位ID");
th.createCell(7).setCellValue("部门ID");
th.createCell(8).setCellValue("部门名称");
th.createCell(9).setCellValue("成本中心编码");
th.createCell(10).setCellValue("邮箱");
th.createCell(11).setCellValue("公司实体");
th.createCell(12).setCellValue("电话号");
th.createCell(13).setCellValue("座机号");
for (int i = 0; i < employeeList.size(); i++) {
Employee e = employeeList.get(i);
Row row = sheet.createRow(i + 2);
row.createCell(0).setCellValue(e.getUserID());
row.createCell(1).setCellValue(e.getFIRSTNAMEEN());
row.createCell(2).setCellValue(e.getLASTNAMEEN());
row.createCell(3).setCellValue(e.getUSERNAMECN());
row.createCell(4).setCellValue(e.getPreferred_Name());
row.createCell(5).setCellValue(e.getUSERCODE());
row.createCell(6).setCellValue(e.getJOBCODEID());
row.createCell(7).setCellValue(e.getDEPARTMENTID());
row.createCell(8).setCellValue(e.getDEPARTMENTNAME());
row.createCell(9).setCellValue(e.getCOSTCENTERCODE());
row.createCell(10).setCellValue(e.getEMAIL());
row.createCell(11).setCellValue(e.getORGANIZATION());
row.createCell(12).setCellValue(e.getMOBILENO());
row.createCell(13).setCellValue(e.getTEL());
}
List<Department> departmentList = getOrganizationResult.getDepartmentList();
Sheet depSheet = sxssfWorkbook.createSheet("部门信息");
Row depdesc = depSheet.createRow(0);
depSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 2));
Cell cell1 = depdesc.createCell(0);
cell1.setCellValue("部门信息表同步数据时按照该上级部门id进行排序同步红色字体为根部门");
cell1.setCellStyle(cellStyle);
Row depTh = depSheet.createRow(1);
depTh.createCell(0).setCellValue("部门ID");
depTh.createCell(1).setCellValue("部门名称");
depTh.createCell(2).setCellValue("上级部门");
for (int i = 0; i < departmentList.size(); i++) {
Row row = depSheet.createRow(i + 2);
Department d = departmentList.get(i);
row.createCell(0).setCellValue(d.getDEPARTMENTID());
row.createCell(1).setCellValue(d.getDEPARTMENTNAME());
Cell cell = row.createCell(2);
cell.setCellValue(d.getPARENTDEPARTMENDID());
if (d.getPARENTDEPARTMENDID() == 0) {
cell.setCellStyle(cellStyle);
}
}
List<Position> positionList = getOrganizationResult.getPositionList();
Sheet posSheet = sxssfWorkbook.createSheet("职位信息");
Row posdesc = posSheet.createRow(0);
posSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 3));
Cell cell3 = posdesc.createCell(0);
cell3.setCellValue("职位信息表职位同步过程中以上级岗位id升序排序进行同步");
cell3.setCellStyle(cellStyle);
Row posTh = posSheet.createRow(1);
posTh.createCell(0).setCellValue("岗位编号");
posTh.createCell(1).setCellValue("岗位编号");
posTh.createCell(2).setCellValue("岗位描述");
posTh.createCell(3).setCellValue("上级岗位ID");
for (int i = 0; i < positionList.size(); i++) {
Row row = posSheet.createRow(i + 2);
Position p = positionList.get(i);
row.createCell(0).setCellValue(p.getJOBCODEID());
row.createCell(1).setCellValue(p.getJOBCODE());
row.createCell(2).setCellValue(p.getJOBFUNCTION());
row.createCell(3).setCellValue(p.getSUPERIORJOBCODEID());
}
File file = new File("F:\\fanwei\\cms_async\\cms_data_proud.xlsx");
if (!file.exists()) {
//先得到文件的上级目录,并创建上级目录,在创建文件
file.getParentFile().mkdir();
try {
//创建文件
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
FileOutputStream fileOutputStream = new FileOutputStream(file);
//写入文件
sxssfWorkbook.write(fileOutputStream);
fileOutputStream.close();
}
@Test
public void testSyncOrganization() throws IOException {
GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
List<Employee> employeeList = getOrganizationResult.getEmployeeList();
System.out.println(employeeList.size());
BufferedWriter employeeListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\employee-list.json"));
employeeListOut.write(JSON.toJSONString(employeeList));
employeeListOut.close();
List<Department> departmentList = getOrganizationResult.getDepartmentList();
BufferedWriter departmentListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\department-list.json"));
departmentListOut.write(JSON.toJSONString(departmentList));
departmentListOut.close();
System.out.println(departmentList.size());
List<Position> positionList = getOrganizationResult.getPositionList();
BufferedWriter positionListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\position-list.json"));
positionListOut.write(JSON.toJSONString(positionList));
positionListOut.close();
System.out.println(positionList.size());
}
@Test
public void testContains() {
String str = "select d.id,m.api_field_type,d.api_field,d.change_rules,d.custom_rules_value,d.ao_field,oa_field_type from uf_cms_async as m inner join uf_cms_async_dt1 as d on d.mainid = m.id";
RecordSet rs = new RecordSet();
rs.executeQuery(str);
rs.next();
System.out.println(rs.getString(0));
}
@Test
public void testSortEmployee() throws IOException {
GetOrganizationResult getOrganizationResult = new GetOrganizationResult();
List<Employee> employeeList = getOrganizationResult.getEmployeeList();
Collections.sort(employeeList);
System.out.println(employeeList.size());
BufferedWriter employeeListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\employee-list-sort.json"));
employeeListOut.write(JSON.toJSONString(employeeList));
employeeListOut.close();
}
@Test
public void testCav(){
Map<String,String> map = new HashMap<>();
map.put("contrast","[{\n" +
"\t\"start\": \"fieldName\",\n" +
"\t\"tableName\": \"databaseTableName\",\n" +
"\t\"end\": \"endFieldName\",\n" +
"\t\"workflowId\": 9,\n" +
"\t\"user\": 10\n" +
"}, {\n" +
"\t\"start\": \"fieldName\",\n" +
"\t\"tableName\": \"databaseTableName\",\n" +
"\t\"end\": \"endFieldName\",\n" +
"\t\"workflowId\": 9,\n" +
"\t\"user\": 10\n" +
"}, {\n" +
"\t\"start\": \"fieldName\",\n" +
"\t\"tableName\": \"databaseTableName\",\n" +
"\t\"end\": \"endFieldName\",\n" +
"\t\"workflowId\": 9,\n" +
"\t\"user\": 10\n" +
"}]");
WorkflowQueueService workflowQueueService = new WorkflowQueueService();
workflowQueueService.getWorkflowQueue(map);
}
@Test
public void testEmailgetID(){
RequestApi requestApi = new RequestApi();
QsResponse userIdsByEmails = requestApi.getInfoByEmail( new ArrayList<String>() {{
add("ZhangYun03@saicmotor.com");
}});
Map<String, Object> resultMap = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
try {
resultMap = mapper.readValue(userIdsByEmails.getResult(), Map.class);
} catch (JsonProcessingException e) {
// toolUtil.writeErrorLog("请求结果转换失败,失败信息:" + e);
}
System.out.println(((Map<String,Object>) resultMap.get("ZhangYun03@saicmotor.com")).get("userId"));
System.out.println(userIdsByEmails);
}
}

View File

@ -1,48 +0,0 @@
package customization.test;
import aiyh.utils.annotation.DateFormatAn;
import java.util.Date;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/3 0003 15:39
* testVo
*/
public class TestCaseVo {
int id;
int requestId;
int workflowType;
int attachmentField;
int showField;
String modelTableName;
String modelField;
int showValue;
int hiddenValue;
int formmodeid;
String templateField;
String isTemplateShow;
@DateFormatAn("yyyy-MM-dd")
Date modedatacreatedate;
@Override
public String toString() {
return "TestCaseVo{" +
"id=" + id +
", requestId=" + requestId +
", workflowType=" + workflowType +
", attachmentField=" + attachmentField +
", showField=" + showField +
", modelTableName='" + modelTableName + '\'' +
", modelField='" + modelField + '\'' +
", showValue=" + showValue +
", hiddenValue=" + hiddenValue +
", formmodeid=" + formmodeid +
", templateField='" + templateField + '\'' +
", isTemplateShow='" + isTemplateShow + '\'' +
", modedatacreatedate=" + modedatacreatedate +
'}';
}
}

View File

@ -1,31 +0,0 @@
package customization.test;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/3 0003 14:59
* shujv
*/
public class TestDBVo {
int id;
String fieldname;
String indexdesc;
String tablename;
int billid;
String showtablename;
int fieldhtmltype;
@Override
public String toString() {
return "TestDBVo{" +
"id=" + id +
", fieldname='" + fieldname + '\'' +
", indexdesc='" + indexdesc + '\'' +
", tablename='" + tablename + '\'' +
", billid=" + billid +
", showtablename='" + showtablename + '\'' +
", fieldhtmltype=" + fieldhtmltype +
'}';
}
}

View File

@ -1,71 +0,0 @@
package customization.test;
import com.simplerss.dataobject.Item;
import java.util.List;
/**
* @author EBU7-dev1-ayh
* @create 2021/8/31 0031 23:28
* testVo
*/
public class TestVo {
boolean code;
String errorMessage;
String traceId;
int index;
List<TestVoItem> items;
@Override
public String toString() {
return "TestVo{" +
"code=" + code +
", errorMessage='" + errorMessage + '\'' +
", traceId='" + traceId + '\'' +
", index=" + index +
", items=" + items +
'}';
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
public boolean isCode() {
return code;
}
public void setCode(boolean code) {
this.code = code;
}
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public List<TestVoItem> getItems() {
return items;
}
public void setItems(List<TestVoItem> items) {
this.items = items;
}
}

View File

@ -1,71 +0,0 @@
package customization.test;
/**
* @author EBU7-dev1-ayh
* @create 2021/8/31 0031 23:29
* testVoItem
*/
public class TestVoItem {
/**
*
*/
String currency;
/**
*
*/
String localCurrency;
/**
*
*/
String rate;
/**
*
*/
String validDate;
@Override
public String toString() {
return "TestVoItem{" +
"currency='" + currency + '\'' +
", localCurrency='" + localCurrency + '\'' +
", rate='" + rate + '\'' +
", validDate='" + validDate + '\'' +
'}';
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getLocalCurrency() {
return localCurrency;
}
public void setLocalCurrency(String localCurrency) {
this.localCurrency = localCurrency;
}
public String getRate() {
return rate;
}
public void setRate(String rate) {
this.rate = rate;
}
public String getValidDate() {
return validDate;
}
public void setValidDate(String validDate) {
this.validDate = validDate;
}
}

View File

@ -1,47 +0,0 @@
package customization.test;
public class UfTempAttachmentDTO{
private int id;
private int requestId;
private int workflowType;
private String attachmentField;
private String showField;
private String modelTableName;
private String modelField;
private String showValue;
private String hiddenValue;
private int formmodeid;
private int modedatacreater;
private int modedatacreatertype;
private String modedatacreatedate;
private String modedatacreatetime;
private int modedatamodifier;
private String modedatamodifydatetime;
private String MODEUUID;
private String templateField;
private int isTemplateShow;
@Override
public String toString() {
return "UfTempAttachmentDTO{" +
"id=" + id +
", requestId=" + requestId +
", workflowType=" + workflowType +
", attachmentField='" + attachmentField + '\'' +
", showField='" + showField + '\'' +
", modelTableName='" + modelTableName + '\'' +
", modelField='" + modelField + '\'' +
", showValue='" + showValue + '\'' +
", hiddenValue='" + hiddenValue + '\'' +
", formmodeid=" + formmodeid +
", modedatacreater=" + modedatacreater +
", modedatacreatertype=" + modedatacreatertype +
", modedatacreatedate='" + modedatacreatedate + '\'' +
", modedatacreatetime='" + modedatacreatetime + '\'' +
", modedatamodifier=" + modedatamodifier +
", modedatamodifydatetime='" + modedatamodifydatetime + '\'' +
", MODEUUID='" + MODEUUID + '\'' +
", templateField='" + templateField + '\'' +
", isTemplateShow=" + isTemplateShow +
'}';
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,86 +0,0 @@
package customization.test;
import aiyh.utils.Util;
import org.junit.Test;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.util.Collection;
/**
* @author EBU7-dev1-ayh
* @create 2021/9/6 0006 20:03
*
*/
public class UtilTest extends BaseTest {
@Test
public void createJava() throws IOException {
/* Util.creatJavaFileBySql("select upw.workflow,upw.water_type,upw.water_point,upw.font_size, " +
"upw.water_content,upw.font_style,upw.font_color,upw.water_fields, " +
"wftv.fieldname as water_field,upw.save_source,wftv1.fieldname as source_field," +
"upw.water_text,upw.add_time,upw.water_alpha from uf_pic_watermark as upw " +
"left join workflow_field_table_view as wftv on wftv.id = upw.water_field " +
"left join workflow_field_table_view as wftv1 on wftv1.id = upw.source_field",
"config","com.api.aiyh_guijiu.pojo");*/
/* Util.creatJavaFileBySql("select dt.id,main.enable,wf.tablename,wf.fieldname as start_date_field, " +
"wf1.fieldname as start_time_field,wf2.fieldname as end_date_field, " +
"wf3.fieldname as end_time_field from uf_workflow_conflic_dt1 as dt " +
"left join workflow_field_table_view as wf on wf.id = dt.start_date_field " +
"left join workflow_field_table_view as wf1 on wf1.id = dt.start_time_field " +
"left join workflow_field_table_view as wf2 on wf2.id = dt.end_date_field " +
"left join workflow_field_table_view as wf3 on wf3.id = dt.end_time_field " +
"left join uf_workflow_conflic as main on dt.mainid = main.id",
"workflowConfig","com.api.aiyh_guijiu.pojo");*/
Util.creatJavaFileBySql("select id,name,meetingtype,begindate,begintime,endtime,enddate,desc_n,creater,hrmmembers from meeting where id = 8",
"meetingInfo", "com.customization.quanshimeting.entity");
// Util.creatJavaFileByTable("uf_workflow_conflic_dt1","com.api.aiyh_guijiu.pojo");
}
@Test
public void testIntrospector() throws IntrospectionException {
// 不内省父类的信息,第二个参数stopClass代表从stopClass开始往上的父类不再内省
BeanInfo beanInfo = Introspector.getBeanInfo(TestVo.class, Object.class);
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor p : propertyDescriptors) {
System.out.println(p.getName());
System.out.println(p.getPropertyType());
System.out.println(p.getPropertyType().equals(String.class));
}
}
public <T> void toJsonString(T t) throws Exception {
BeanInfo beanInfo = Introspector.getBeanInfo(t.getClass(), Object.class);
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor proper : propertyDescriptors) {
String name = proper.getName();
Class<?> propertyType = proper.getPropertyType();
if (int.class.equals(propertyType) || long.class.equals(propertyType)
|| short.class.equals(propertyType) || byte.class.equals(propertyType)
|| float.class.equals(propertyType) || double.class.equals(propertyType)
|| boolean.class.equals(propertyType) || Boolean.class.equals(propertyType)
|| Integer.class.equals(propertyType) || Long.class.equals(propertyType)
|| Short.class.equals(propertyType) || Byte.class.equals(propertyType)
|| Float.class.equals(propertyType) || Double.class.equals(propertyType)) {
// 整数类型和浮点数以及boolean类型
continue;
}
if (String.class.equals(propertyType) || Character.class.equals(propertyType)
|| char.class.equals(propertyType)) {
// 字符串类型的数据处理
continue;
}
if (proper.getReadMethod().invoke(t) instanceof Collection<?>) {
}
}
}
}

View File

@ -1,205 +0,0 @@
package customization.test;
import com.engine.crm.util.CrmCommonUtil;
import org.junit.Test;
import aiyh.utils.Util;
import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
import aiyh.utils.sqlUtil.whereUtil.Where;
import weaver.aiyh_pcn.workflow_to_customer.AddCustomer_Action;
import weaver.aiyh_pcn.workflow_to_customer.config.CRM_Config;
import weaver.aiyh_pcn.workflow_to_customer.model.MainResult;
import weaver.aiyh_pcn.workflow_to_customer.utils.*;
import weaver.conn.RecordSet;
import weaver.crm.Maint.*;
import weaver.hrm.companyvirtual.ResourceVirtualComInfo;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;
import java.util.*;
/**
* @author EBU7-dev1-ayh
* @create 2021/8/6 0006 15:46
* ceshi
*/
public class WorkflowToCustomerTest extends BaseTest{
@Test
public void testSqlBuilderBatch(){
List<LinkedHashMap<String, Object>> list = new ArrayList<>();
List<Where> whereList = new ArrayList<>();
list.add(new LinkedHashMap<String, Object>(){{
put("id",9);
put("name","updateSql");
put("status","prod");
}});
list.add(new LinkedHashMap<String, Object>(){{
put("id",10);
put("name","updateSql1");
put("status","prod1");
}});
list.add(new LinkedHashMap<String, Object>(){{
put("id",11);
put("name","updateSql2");
put("status","prod3");
}});
whereList.add(Util.createPrepWhereImpl()
.whereAnd("id").whereEqual(9)
.whereAnd("name").whereLike("%Sql%"));
whereList.add(Util.createPrepWhereImpl()
.whereAnd("id").whereEqual(10)
.whereAnd("name").whereLike("%Sql%"));
whereList.add(Util.createPrepWhereImpl()
.whereAnd("id").whereEqual(11)
.whereAnd("name").whereLike("%Sql%"));
BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("tablename", list, whereList);
System.out.println(batchSqlResult.getSqlStr());
System.out.println(batchSqlResult.getBatchList());
}
@Test
public void testSqlBuilder(){
PrepSqlResultImpl prepSqlResult = Util.createSqlBuilder().insertSql("tablename",
ParaMap.create().put("id", 10)
.put("name", "insertSql")
.put("status", "test"));
System.out.println(prepSqlResult.getSqlStr());
System.out.println(prepSqlResult.getArgs());
}
// @Test
// public void testUtilSql(){
// String sql = Util.createWhereImpl().whereAnd("id").whereEqual("90").whereOr("name")
// .whereLike("%不知道%")
// .whereAnd("age").whereIn(1,2,3,4,5).getSql();
// System.out.println(sql);
// }
// @Test
// public void testUtilPreSql(){
// Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual("90").whereOr("name")
// .whereLike("%不知道%")
// .whereAnd("age").whereIn(1, 2, 3, 4, 5);
// System.out.println(where.getSql());
// System.out.println(where.getArgs());
// }
@Test
public void testMap(){
UtilMap<String, Object> utilMap = new UtilMap<>();
utilMap.uPut("test","testValue").uPut("liu","liu").uPut("isnull",null);
Map<String, Object> filter = utilMap.filter((key,value) -> !Objects.isNull(value));
System.out.println(filter);
System.out.println(utilMap);
}
@Test
public void testPinYin(){
CrmCommonUtil crmCommonUtil = new CrmCommonUtil();
System.out.println(crmCommonUtil.getPinYin("不知道", 7));
}
@Test
public void testInsert(){
RecordSet rs = new RecordSet();
boolean b = rs.executeUpdate("insert into formtable_main_2 (requestId,jbr) values (-121,2);");
rs.executeQuery("select @@identity");
System.out.println(rs.getString(1));
System.out.println(rs.getString(2));
}
@Test
public void testSQLWhere(){
SQLWhere sqlWhere = SQLWhere.creatWhere()
.and("id").equal(90)
.or("name").like("%testname%")
.and("mainid").equalSql("select id from maintable")
.create();
Map<String, Object > map = new HashMap<>();
map.put("id", "90");
String tablename = BuilderSqlUtil.builderUpdateFullSql("tablename", map, sqlWhere);
System.out.println(tablename);
}
@Test
public void testPrepSQLWhere(){
PrepSQLWhere prepSQLWhere = PrepSQLWhere.creatPrepWhere()
.and("id").equal(6)
.or("name").like("%public%")
.and("status").in(2,3,4,5,6)
.create();
Map<String, Object > map = new HashMap<>();
map.put("id", "90");
SqlResult tablename = BuilderSqlUtil.builderUpdateSql("tablename", map, prepSQLWhere);
System.out.println(tablename.getSqlStr());
System.out.println(Arrays.toString(tablename.getArgs()));
}
@Test
public void testInnerPrepSQLWhere(){
PrepSQLWhere prepSQLWhere = PrepSQLWhere.creatPrepWhere()
.and("id").equal(6)
.or("name").like("%public%")
.and("status").in(2,3,4,5,6)
.create();
Map<String, Object > map = new HashMap<>();
map.put("id", "90");
SqlResult tablename = BuilderSqlUtil.builderUpdateSql("tablename", map, prepSQLWhere);
System.out.println(tablename.getSqlStr());
System.out.println(Arrays.toString(tablename.getArgs()));
}
@Test
public void testRemoveCache(){
CustomerInfoComInfo customerInfo = new CustomerInfoComInfo();
customerInfo.removeCustomerInfoCache();
customerInfo.removeCache();
ResourceVirtualComInfo resource = new ResourceVirtualComInfo();
resource.removeCache();
resource.removeResourceVirtualCache();
(new CustomerContacterComInfo()).removeCustomerContacterCache();
}
@Test
public void test_crm_config(){
// CRM_Config conf = new CRM_Config("6","formtable_main_32","105106");
RequestInfo requestInfo = new RequestInfo();
AddCustomer_Action addCustomer = new AddCustomer_Action();
requestInfo.setRequestid("179181");
requestInfo.setWorkflowid("6");
requestInfo.setCreatorid("1");
requestInfo.setRequestManager(new RequestManager(){{setBilltablename("formtable_main_32");}});
addCustomer.execute(requestInfo);
// System.out.println(conf.getConfigInfo());;
}
@Test
public void test_removeSegmentation(){
StringBuilder sqlBuilder = new StringBuilder(" ,insert into 1,2,3,4,5 , ");
System.out.println(Utils.removeSeparator(sqlBuilder));
}
@Test
public void testAddCustomerAction(){
AddCustomer_Action addCustomer_action = new AddCustomer_Action();
CRM_Config config = new CRM_Config("4","formtable_main_2","5011");
Map<String, List<Map<String, Object>>> configInfoMap = config.getConfigInfo();
MainResult mainResult = config.getMainResult();
System.out.println(configInfoMap);
System.out.println(mainResult);
if(mainResult.getChangeSetting() == 0){
// 表示插入
addCustomer_action.insertCustomerModel(mainResult,configInfoMap);
}else{
// 表示根据流程字段判断是插入还是更新
}
}
}

View File

@ -1,15 +0,0 @@
package customutil.proxy.dynamicProxy;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:53
*/
public class Customer implements IOrderInterface{
@Override
public String order(String foodName){
System.out.println("顾客下单。。。");
return "已经下单了" + foodName;
}
}

View File

@ -1,11 +0,0 @@
package customutil.proxy.dynamicProxy;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:05
*/
public interface IOrderInterface {
public String order(String foodName);
}

View File

@ -1,30 +0,0 @@
package customutil.proxy.dynamicProxy;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:53
*/
public class Test {
public static void main(String[] args) {
Customer customer = new Customer();
IOrderInterface iOrderInterface = (IOrderInterface) Proxy.newProxyInstance(
customer.getClass().getClassLoader(),
customer.getClass().getInterfaces(),
new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Object result = method.invoke(customer,args);
System.out.println("接收到订单,正在去取餐途中。。。");
return result;
}
});
String result = iOrderInterface.order("鱼香肉丝");
System.out.println(result);
}
}

View File

@ -1,29 +0,0 @@
package customutil.proxy.dynamicProxy;
import net.sf.cglib.proxy.Enhancer;
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import java.lang.reflect.Method;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 13:06
*/
public class TestCGLIB {
public static void main(String[] args) {
Customer customer = new Customer();
Customer deliveryClerk = (Customer) Enhancer.create(Customer.class, new MethodInterceptor() {
@Override
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
Object result = method.invoke(customer,objects);
System.out.println("接收到订单,正在去取餐途中。。。");
return result;
}
});
String result = deliveryClerk.order("口水鸡");
System.out.println(result);
}
}

View File

@ -1,15 +0,0 @@
package customutil.proxy.staticProxy;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 11:57
*
*/
public class Customer {
public String order(String foodName){
System.out.println("顾客下单。。。");
return "已经下单了" + foodName;
}
}

View File

@ -1,17 +0,0 @@
package customutil.proxy.staticProxy;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 11:59
*
*/
public class DeliverClerk extends Customer {
@Override
public String order(String foodName) {
String result = super.order(foodName);
System.out.println("接收到订单,正在去取餐途中。。。");
return result+",已经搅拌均匀";
}
}

View File

@ -1,15 +0,0 @@
package customutil.proxy.staticProxy;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:02
*/
public class Test {
public static void main(String[] args) {
Customer customer = new DeliverClerk();
String result = customer.order("小炒肉");
System.out.println(result);
}
}

View File

@ -1,22 +0,0 @@
package customutil.proxy.staticProxy.interfaceModel;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:07
*/
public class DeliverClerkImpl implements IOrderInterface {
private IOrderInterface iOrderInterface;
public DeliverClerkImpl(IOrderInterface iOrderInterface) {
this.iOrderInterface = iOrderInterface;
}
@Override
public String order(String foodName) {
String result = iOrderInterface.order(foodName);
System.out.println("接收到订单,正在去取餐途中。。。");
return result + ",已经搅拌均匀";
}
}

View File

@ -1,11 +0,0 @@
package customutil.proxy.staticProxy.interfaceModel;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:05
*/
public interface IOrderInterface {
public String order(String foodName);
}

View File

@ -1,17 +0,0 @@
package customutil.proxy.staticProxy.interfaceModel;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:09
*/
public class Test {
public static void main(String[] args) {
customerImpl customer = new customerImpl();
// 创建代理对象
IOrderInterface orderInterface = new DeliverClerkImpl(customer);
String result = orderInterface.order("红烧肉");
System.out.println(result);
}
}

View File

@ -1,15 +0,0 @@
package customutil.proxy.staticProxy.interfaceModel;
/**
* @author EBU7-dev1-ayh
* @create 2021/11/25 0025 12:06
*/
public class customerImpl implements IOrderInterface {
@Override
public String order(String foodName) {
System.out.println("顾客下单。。。");
return "已经下单了" + foodName;
}
}

BIN
lib/hamcrest-core-1.3.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/hutool-all-5.7.12.jar Normal file

Binary file not shown.

BIN
lib/lombok1.18.22.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/xmpcore-6.1.11.jar Normal file

Binary file not shown.

View File

@ -2,6 +2,7 @@ package aiyh.utils;
import aiyh.utils.entity.LabelHtmlIndex; import aiyh.utils.entity.LabelHtmlIndex;
import aiyh.utils.service.UtilService; import aiyh.utils.service.UtilService;
import aiyh.utils.zwl.common.ToolUtil;
import weaver.systeminfo.SystemEnv; import weaver.systeminfo.SystemEnv;
import java.util.Map; import java.util.Map;
@ -19,9 +20,11 @@ public class LabelHtmlUtils {
private final UtilService utilService = new UtilService(); private final UtilService utilService = new UtilService();
private Map<String, Object> htmlLabel = null; private Map<String, Object> htmlLabel = null;
private ToolUtil toolUtil = new ToolUtil();
public LabelHtmlUtils(String prefix) { public LabelHtmlUtils(String prefix) {
if (!this.init(prefix)) { if (!this.init(prefix)) {
toolUtil.writeErrorLog("配置文件异常,请检查配置文件结构是否符合要求!");
throw new RuntimeException("配置文件异常,请检查配置文件结构是否符合要求!"); throw new RuntimeException("配置文件异常,请检查配置文件结构是否符合要求!");
} }
} }
@ -44,6 +47,7 @@ public class LabelHtmlUtils {
return this.htmlLabel != null; return this.htmlLabel != null;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
toolUtil.writeErrorLog(e.toString());
return false; return false;
} }
} }

View File

@ -1,10 +1,7 @@
package aiyh.utils; package aiyh.utils;
import aiyh.utils.annotation.DateFormatAn; import aiyh.utils.annotation.DateFormatAn;
import aiyh.utils.entity.AInputStream; import aiyh.utils.entity.*;
import aiyh.utils.entity.AZipOutputStream;
import aiyh.utils.entity.ApiConfigMainDTO;
import aiyh.utils.entity.ListZipEntity;
import aiyh.utils.fileUtil.ProperUtil; import aiyh.utils.fileUtil.ProperUtil;
import aiyh.utils.mapUtil.UtilHashMap; import aiyh.utils.mapUtil.UtilHashMap;
import aiyh.utils.mapUtil.UtilLinkedHashMap; import aiyh.utils.mapUtil.UtilLinkedHashMap;
@ -1541,6 +1538,11 @@ public class Util extends weaver.general.Util {
return SystemEnv.getHtmlLabelName(id, languageId); return SystemEnv.getHtmlLabelName(id, languageId);
} }
public static String getHtmlLabelName(LabelHtmlIndex labelHtmlIndex, User user) {
return Util.getHtmlLabelName(labelHtmlIndex.getLabelIndex(),
user.getLanguage(), labelHtmlIndex.getDefaultStr());
}
/** /**
* *

Some files were not shown because too many files have changed in this diff Show More