Merge branch 'dev' of https://gitea.yeyaguitu.cn/ecology/ebu_ecology_dev1 into dev
commit
80d9200fdf
|
@ -483,4 +483,56 @@ $(() => {
|
|||
}
|
||||
})
|
||||
})
|
||||
/* ******************* 当明细数据未加载完成时 控制流程提交 end ******************* */
|
||||
/* ******************* 当明细数据未加载完成时 控制流程提交 end ******************* */
|
||||
|
||||
|
||||
/* ******************* 流程明细字段包含某个字符串时给某个字段赋值为某个东西start ******************* */
|
||||
$(() => {
|
||||
let config = [{
|
||||
table: 'detail_1',
|
||||
mapping: [{
|
||||
sourceField: '',
|
||||
targetField: '',
|
||||
sourceIncludes: '',
|
||||
targetSet: ''
|
||||
}]
|
||||
}]
|
||||
|
||||
|
||||
function runJs() {
|
||||
config.forEach(item => {
|
||||
let tableName = item.table
|
||||
let mapping = item.mapping
|
||||
if (tableName === "main") {
|
||||
mapping.forEach(row => {
|
||||
let sourceValue = WfForm.getFieldValue(WfForm.convertFieldNameToId(row.sourceField, tableName));
|
||||
if (sourceValue.indexOf(row.sourceIncludes) !== -1) {
|
||||
WfForm.changeFieldValue(WfForm.convertFieldNameToId(row.targetField, tableName, {
|
||||
value: row.targetSet
|
||||
}))
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let rowIndexArr = WfForm.getDetailAllRowIndexStr(tableName).split(",");
|
||||
rowIndexArr.forEach(rowIndex => {
|
||||
mapping.forEach(row => {
|
||||
let sourceValue = WfForm.getFieldValue(WfForm.convertFieldNameToId(row.sourceField, tableName));
|
||||
if (sourceValue.indexOf(row.sourceIncludes) !== -1) {
|
||||
WfForm.changeFieldValue(WfForm.convertFieldNameToId(row.targetField, tableName) + "_" + rowIndex, {
|
||||
value: row.targetSet
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, callback => {
|
||||
runJs()
|
||||
callback()
|
||||
})
|
||||
})
|
||||
/* ******************* 流程明细字段包含某个字符串时给某个字段赋值为某个东西end ******************* */
|
||||
|
|
22
pom.xml
22
pom.xml
|
@ -64,7 +64,18 @@
|
|||
<artifactId>junit</artifactId>
|
||||
<version>4.12</version>
|
||||
</dependency>
|
||||
<!-- -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>eu.agno3.jcifs</groupId>-->
|
||||
<!-- <artifactId>jcifs-ng</artifactId>-->
|
||||
<!-- <version>2.1.9</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.hierynomus</groupId>
|
||||
<artifactId>smbj</artifactId>
|
||||
<version>0.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- easy excel -->
|
||||
<dependency>
|
||||
|
@ -80,12 +91,11 @@
|
|||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-client</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-client</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -12,23 +12,23 @@ import java.util.concurrent.*;
|
|||
*/
|
||||
|
||||
public class ThreadPoolConfig {
|
||||
private static volatile ExecutorService threadPool;
|
||||
|
||||
public static ExecutorService createThreadPoolInstance() {
|
||||
if (threadPool == null) {
|
||||
synchronized (ThreadPoolConfig.class) {
|
||||
if (threadPool == null) {
|
||||
ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("thread-pool-aiyh-%d").build();
|
||||
threadPool = new ThreadPoolExecutor(25,
|
||||
50,
|
||||
60L,
|
||||
TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(100),
|
||||
threadFactory,
|
||||
new ThreadPoolExecutor.AbortPolicy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return threadPool;
|
||||
}
|
||||
private static volatile ExecutorService threadPool;
|
||||
|
||||
public static ExecutorService createThreadPoolInstance() {
|
||||
if (threadPool == null) {
|
||||
synchronized (ThreadPoolConfig.class) {
|
||||
if (threadPool == null) {
|
||||
ThreadFactory threadFactory = new ThreadFactoryBuilder().setNameFormat("thread-pool-aiyh-%d").build();
|
||||
threadPool = new ThreadPoolExecutor(25,
|
||||
50,
|
||||
60L,
|
||||
TimeUnit.SECONDS,
|
||||
new ArrayBlockingQueue<>(100),
|
||||
threadFactory,
|
||||
new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
}
|
||||
}
|
||||
}
|
||||
return threadPool;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1151,6 +1151,34 @@ public class Util extends weaver.general.Util {
|
|||
}
|
||||
|
||||
|
||||
public static String getProperties(String fileName, String key) {
|
||||
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";
|
||||
Properties prop = new Properties();
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = new BufferedInputStream(new FileInputStream(path));
|
||||
prop.load(inputStream);
|
||||
return prop.getProperty(key);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("找不到文件:" + path);
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过文件名获取到对应的配置文件map对象
|
||||
*
|
||||
|
@ -3687,4 +3715,8 @@ public class Util extends weaver.general.Util {
|
|||
}
|
||||
return Util.getValueByKeyStr("main." + fieldInfo.getFieldName(), workflowData);
|
||||
}
|
||||
|
||||
public static <K, V> Map<K, V> createFunctionMap() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package aiyh.utils.annotation.recordset;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* <h1>sql字段映射</h1>
|
||||
*
|
||||
* <p>create: 2023-02-07 17:31</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@Documented
|
||||
public @interface SqlOracleDbFieldAnn {
|
||||
|
||||
String value();
|
||||
}
|
|
@ -10,12 +10,12 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
public class DocImageInfo {
|
||||
|
||||
private Integer docId;
|
||||
private Integer imageFileId;
|
||||
private String imageFileName;
|
||||
private Integer id;
|
||||
private Integer detailId;
|
||||
private Integer fileSize;
|
||||
|
||||
|
||||
private Integer docId;
|
||||
private Integer imageFileId;
|
||||
private String imageFileName;
|
||||
private Integer id;
|
||||
private Integer detailId;
|
||||
private Integer fileSize;
|
||||
private Integer docFileType;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package aiyh.utils.entity;
|
||||
|
||||
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
@ -17,20 +18,32 @@ import lombok.ToString;
|
|||
public class FieldViewInfo {
|
||||
|
||||
/** 字段id */
|
||||
@SqlOracleDbFieldAnn("ID")
|
||||
|
||||
private Integer id;
|
||||
|
||||
/** 字段名 */
|
||||
@SqlOracleDbFieldAnn("FIELD_NAME")
|
||||
|
||||
private String fieldName;
|
||||
|
||||
/** 字段表名 */
|
||||
@SqlOracleDbFieldAnn("TABLE_NAME")
|
||||
|
||||
private String tableName;
|
||||
|
||||
/** 表id */
|
||||
@SqlOracleDbFieldAnn("BILL_ID")
|
||||
|
||||
private Integer billId;
|
||||
|
||||
/** 字段类型 */
|
||||
@SqlOracleDbFieldAnn("FIELD_TYPE")
|
||||
|
||||
private Integer fieldType;
|
||||
|
||||
/** 字段类型名称 */
|
||||
@SqlOracleDbFieldAnn("FIELD_HTML_TYPE")
|
||||
|
||||
private String fieldHtmlType;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package aiyh.utils.httpUtil;
|
|||
import aiyh.utils.Util;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
@ -133,7 +134,11 @@ public class ResponeVo implements HttpResponse {
|
|||
ObjectMapper mapper = new ObjectMapper();
|
||||
this.entityMap = mapper.readValue(this.getEntityString(), Map.class);
|
||||
} catch (JsonProcessingException ignored) {
|
||||
this.resultList = (List<Map>) JSONArray.parseArray(this.getEntityString(), Map.class);
|
||||
try {
|
||||
this.resultList = (List<Map>) JSONArray.parseArray(this.getEntityString(), Map.class);
|
||||
} catch (JSONException e) {
|
||||
Util.getLogger().error("Unable to convert the response result to array!" + Util.getErrString(e));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Util.getLogger().error("Unable to convert the response result to map or array!" + Util.getErrString(e));
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -61,10 +61,14 @@ public interface UtilMapper {
|
|||
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid = #{docId}")
|
||||
DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
|
||||
|
||||
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in ($t{docIds})")
|
||||
@Select("select id,docid doc_id," +
|
||||
"imagefileid image_file_id, docfiletype doc_file_type," +
|
||||
"imagefilename image_file_name from docimagefile where docid in ($t{docIds})")
|
||||
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String docIds);
|
||||
|
||||
@Select("select id,docid doc_id,imagefileid image_file_id,imagefilename image_file_name from docimagefile where docid in (${docIds})")
|
||||
@Select("select id,docid doc_id,imagefileid image_file_id," +
|
||||
"docfiletype doc_file_type," +
|
||||
"imagefilename image_file_name from docimagefile where docid in (${docIds})")
|
||||
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package aiyh.utils.recordset;
|
||||
|
||||
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
||||
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||
import org.h2.util.StringUtils;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.conn.constant.DBConstant;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
@ -17,28 +19,58 @@ import java.lang.reflect.Field;
|
|||
*/
|
||||
|
||||
public class GetRsValueUtil {
|
||||
|
||||
@Nullable
|
||||
public static String getRsValue(RecordSet rs, String fieldName, Field declaredField) {
|
||||
String value = rs.getString(fieldName);
|
||||
if(StringUtils.isNullOrEmpty(value) && declaredField != null){
|
||||
SqlDbFieldAnn annotation = declaredField.getAnnotation(SqlDbFieldAnn.class);
|
||||
if (annotation != null){
|
||||
value = rs.getString(annotation.value());
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getRsValue(RecordSetTrans rs, String fieldName, Field declaredField) {
|
||||
String value = rs.getString(fieldName);
|
||||
if(StringUtils.isNullOrEmpty(value) && declaredField != null){
|
||||
SqlDbFieldAnn annotation = declaredField.getAnnotation(SqlDbFieldAnn.class);
|
||||
if (annotation != null){
|
||||
value = rs.getString(annotation.value());
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getRsValue(RecordSet rs, String fieldName, Field declaredField) {
|
||||
String value = rs.getString(fieldName);
|
||||
if (StringUtils.isNullOrEmpty(value) && declaredField != null) {
|
||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||
SqlOracleDbFieldAnn oracleDbFieldAnn = declaredField.getAnnotation(SqlOracleDbFieldAnn.class);
|
||||
if (oracleDbFieldAnn != null) {
|
||||
value = rs.getString(oracleDbFieldAnn.value());
|
||||
}
|
||||
return value;
|
||||
} else {
|
||||
SqlDbFieldAnn annotation = declaredField.getAnnotation(SqlDbFieldAnn.class);
|
||||
if (annotation != null) {
|
||||
value = rs.getString(annotation.value());
|
||||
return value;
|
||||
}
|
||||
SqlOracleDbFieldAnn oracleDbFieldAnn = declaredField.getAnnotation(SqlOracleDbFieldAnn.class);
|
||||
if (oracleDbFieldAnn != null) {
|
||||
value = rs.getString(oracleDbFieldAnn.value());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getRsValue(RecordSetTrans rs, String fieldName, Field declaredField) {
|
||||
String value = rs.getString(fieldName);
|
||||
if (StringUtils.isNullOrEmpty(value) && declaredField != null) {
|
||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||
SqlOracleDbFieldAnn oracleDbFieldAnn = declaredField.getAnnotation(SqlOracleDbFieldAnn.class);
|
||||
if (oracleDbFieldAnn != null) {
|
||||
value = rs.getString(oracleDbFieldAnn.value());
|
||||
}
|
||||
return value;
|
||||
} else {
|
||||
SqlDbFieldAnn annotation = declaredField.getAnnotation(SqlDbFieldAnn.class);
|
||||
if (annotation != null) {
|
||||
value = rs.getString(annotation.value());
|
||||
return value;
|
||||
}
|
||||
SqlOracleDbFieldAnn oracleDbFieldAnn = declaredField.getAnnotation(SqlOracleDbFieldAnn.class);
|
||||
if (oracleDbFieldAnn != null) {
|
||||
value = rs.getString(oracleDbFieldAnn.value());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import aiyh.utils.excention.TypeNonsupportException;
|
|||
import com.google.common.base.Strings;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.conn.RecordSetTrans;
|
||||
import weaver.conn.constant.DBConstant;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
|
@ -272,7 +273,20 @@ public class ResultMapper {
|
|||
|
||||
public Object getObjectTrans(RecordSetTrans rs, Object o, Method method) {
|
||||
CaseConversion annotation = method.getAnnotation(CaseConversion.class);
|
||||
boolean enable = annotation == null || annotation.value();
|
||||
boolean enable = false;
|
||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||
if (annotation == null) {
|
||||
enable = false;
|
||||
} else {
|
||||
enable = annotation.value();
|
||||
}
|
||||
} else {
|
||||
if (annotation == null) {
|
||||
enable = true;
|
||||
} else {
|
||||
enable = annotation.value();
|
||||
}
|
||||
}
|
||||
String[] columnName = rs.getColumnName();
|
||||
String[] columnTypeName = rs.getColumnTypeName();
|
||||
int[] columnTypes = rs.getColumnType();
|
||||
|
@ -353,7 +367,6 @@ public class ResultMapper {
|
|||
return o;
|
||||
}
|
||||
|
||||
// Util.getLogger().info("获取对象:" + o.toString());
|
||||
BeanInfo beanInfo = Introspector.getBeanInfo(o.getClass(), Object.class);
|
||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
|
||||
|
@ -382,7 +395,20 @@ public class ResultMapper {
|
|||
|
||||
public Object getObject(RecordSet rs, Object o, Method method) {
|
||||
CaseConversion annotation = method.getAnnotation(CaseConversion.class);
|
||||
boolean enable = annotation == null || annotation.value();
|
||||
boolean enable = false;
|
||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||
if (annotation == null) {
|
||||
enable = false;
|
||||
} else {
|
||||
enable = annotation.value();
|
||||
}
|
||||
} else {
|
||||
if (annotation == null) {
|
||||
enable = true;
|
||||
} else {
|
||||
enable = annotation.value();
|
||||
}
|
||||
}
|
||||
String[] columnName = rs.getColumnName();
|
||||
String[] columnTypeName = rs.getColumnTypeName();
|
||||
int[] columnTypes = rs.getColumnType();
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package com.api.youhong.ai.pcn.ssoyunzhao.controller;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import com.api.youhong.ai.pcn.ssoyunzhao.service.SsoYunZhaoService;
|
||||
import com.sun.jersey.api.view.Viewable;
|
||||
import org.apache.log4j.Logger;
|
||||
import weaver.hrm.HrmUserVarify;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.core.Context;
|
||||
|
||||
/**
|
||||
* <h1>单点登录云召系统</h1>
|
||||
*
|
||||
* <p>create: 2023/2/22 23:17</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
@Path("/aiyh/sso/yunzhao/")
|
||||
public class SsoYunZhaoController {
|
||||
|
||||
private final SsoYunZhaoService service = new SsoYunZhaoService();
|
||||
|
||||
private final Logger logger = Util.getLogger();
|
||||
|
||||
@Path("/send-redirect")
|
||||
@GET
|
||||
public Viewable ssoSendRedirect(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
String redirectPath = service.getRedirectPath(user);
|
||||
response.sendRedirect(redirectPath);
|
||||
} catch (Exception e) {
|
||||
logger.error("单点登录跳转失败!错误信息:" + Util.getErrString(e));
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.api.youhong.ai.pcn.ssoyunzhao.service;
|
||||
|
||||
/**
|
||||
* <h1>常量</h1>
|
||||
*
|
||||
* <p>create: 2023/2/22 23:24</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
public class SsoYunZhaoConstant {
|
||||
protected final static String PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC8R8OPv/yVtzuz\n" +
|
||||
"G/kKbhC9wr+z9I7Hfk9rFsTlJ/iHis94Wmy6HxYimUF+03Awqpap4CimwPUoKIiz\n" +
|
||||
"UOkPVrlj0sOrDIWEbcJGBysveYeocACV1lLfAS4WpnH2xRrz5N7BpNey67aCeUsD\n" +
|
||||
"UKtgv/1zxV8G0VM0xOmx7VxDnY+KBbPYptVC++IxaKfCn1K00T+d2Q3OZ47Tkaa1\n" +
|
||||
"T8tP2hZt3nrQVTpmSlk+LRDKRYorilxALTtLhdXLv7TfkWdk81YKPkt5CGtB0IhS\n" +
|
||||
"KCMOuxr3Hs1Q3QGafetrA5wugfDzsDy7WQuVdaVu22nUr1xK002NW9wzjgy+sEOG\n" +
|
||||
"fX03Qq6lAgMBAAECggEAMLT3+GYYN7rxLMKdyH70wcJxyWII1b7tWKzJPub6OkZE\n" +
|
||||
"qcPqwLNuDIFNGjwkl9Jpq4Sbv5fHVB44Tvstb5Rl3VcW21cf60Rhr7AHEf8EgySG\n" +
|
||||
"YjzRr3MksyNX9BjFgjbBEaNNUbH8wwAR0ce6rgq8zIhQrvjT56DRPABFkBBgo7mn\n" +
|
||||
"bBQlspm/x70xF5TEZdIb+YuLZakWu9TfYW8rilONkLde4LcSdp9yMDQP3nfA0USc\n" +
|
||||
"+cVWURm/29+LazyJL9xlzHPP0ttbnX1jiHsZhtzqskyomxlPGwSpv+QbIqEjX8Yn\n" +
|
||||
"JqIpf3Xv2QX0OkzqvtUT5/LB/gzoUI14mn1ZAAy3AQKBgQD5Uj/paaUNCZLkz1AR\n" +
|
||||
"ajf/kW73nWdQuMk5mTSZK+9pqyX8UKlktxk/VqG+f8zxwh/BNowLMqwF5DV85rYQ\n" +
|
||||
"tNJI8s4kRbnM2VRElCXelFDMpmxxWpY72M8xit9BHCkAPbC5fOBOq22YuS4YB104\n" +
|
||||
"FbvE62FLUU2MaZcaM86JXYeaYQKBgQDBUusq7JWkPYieq1i86zDx1l1jg4dJxyL5\n" +
|
||||
"zdI4MBIOc5WPQhC2hfDa2n6LyFFJXVhkR8Zz25sDXq93E7RnvqGN+DfESZOOimoR\n" +
|
||||
"tC879mg6k6DUdg0ear33FM/XqcNNaMFZMdQWyw4wyI374YmC4tyahoR8wkHa0V80\n" +
|
||||
"3BdcBGgixQKBgQDEWL30eDp/lfaVM57+2APZxRL69n8S1zPBpKIDrtIRCbQUjQGa\n" +
|
||||
"S4galYMznzorepG/e9G2T+WhjiOBhcAEUCL7SByH/FFivhTbHUDllTA8uyPT8V83\n" +
|
||||
"KnuhrJg9kovHoM24hluwGNlq2Qsv6TzEmnkRj71Dr3e/CLjy7bHOBFZygQKBgH/X\n" +
|
||||
"H2AxNvt3HYMfd/zl4mXqBbOq5KnrH7vlWWCCmU4pLPuhCoBIrm9rEUfKXcaQDcWy\n" +
|
||||
"mQ9AZ4+g65No2mHIc/j37ZjFtugJq/6tEpcqaN5jhXU54477s0dS4eaRgm8MGN+s\n" +
|
||||
"zb2M5YNo/EtWZ6K/9nXRAoelxfq3fafs6x2UZHCpAoGAaHUTShY2Hkf7V7xWRVYb\n" +
|
||||
"4DnA1MOrBLXIfn/CTT9LpvewB0GFwm/1ZZbzasHz4blQNr8no2lIgPnkSukpTA5f\n" +
|
||||
"JPuvPZlq7XzgqX3Q4QC3Qm4JEBouNy61sX7uLFBWTot5DcPvlWQtFC09qejYXl8V\n" +
|
||||
"isFFLZd/OdlX0bHGjuOfcoo=";
|
||||
protected final static String PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvEfDj7/8lbc7sxv5Cm4Q\n" +
|
||||
"vcK/s/SOx35PaxbE5Sf4h4rPeFpsuh8WIplBftNwMKqWqeAopsD1KCiIs1DpD1a5\n" +
|
||||
"Y9LDqwyFhG3CRgcrL3mHqHAAldZS3wEuFqZx9sUa8+TewaTXsuu2gnlLA1CrYL/9\n" +
|
||||
"c8VfBtFTNMTpse1cQ52PigWz2KbVQvviMWinwp9StNE/ndkNzmeO05GmtU/LT9oW\n" +
|
||||
"bd560FU6ZkpZPi0QykWKK4pcQC07S4XVy7+035FnZPNWCj5LeQhrQdCIUigjDrsa\n" +
|
||||
"9x7NUN0Bmn3rawOcLoHw87A8u1kLlXWlbttp1K9cStNNjVvcM44MvrBDhn19N0Ku\n" +
|
||||
"pQIDAQAB";
|
||||
|
||||
protected final static String PRO_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDQJMdNMq9yXD4X\n" +
|
||||
"hV8Pn9G9QPoWSQvVrdz6MSaBMt8vaBqIcHUr1Escs/VcU9MTFRycmCH9FQxAm0k9\n" +
|
||||
"E1DmGEwj37CaGWVFpCgVncpD04oQg34rF9DibvW3FANYsl2DmYLkHPQ5c4IUhX1w\n" +
|
||||
"Z+4B1fSC2zTzog4KkLbqowXL7jz4/o9SSZoZm+2Q0ldF+2soXw1Se7s5urM988is\n" +
|
||||
"IKQN08tKgGxHs2T1XFwGQKVMDC6Z6W2sYHPCf7yk3YDhG/XqVRfR2L/JozmOl1CH\n" +
|
||||
"z1igrMYJUF601IJugPVmbDjWXS5BLq45xAt70/3yYyH+i1dguqcf9HGLDqUa7T3v\n" +
|
||||
"FBpKkNKJAgMBAAECggEACbI86pa635v2dIgNBqBOV/+n5tPeTkT8L1eM0KX7Ca1S\n" +
|
||||
"1xpOCw2nth2YB4YMJi5sl8rqgmyxlmzle4fj0+Q738vy4Srfsd/U0jT4kDJRkzVc\n" +
|
||||
"8kr4uyOqJK40/bPJcXD8TP4gTnDYFXamgk8FImbCLjph/BuHhex56PJROc/OXVcA\n" +
|
||||
"7T1NQ9+ohZRHiKWvFMjgYcbsSW7psK4fBBt8vl+tnLM+ssJAi6dpbQaYodCYrOVb\n" +
|
||||
"B0PE73Gr2fdw4oPJ+r6yRs71irNa37/x/oNzzFcjQlZaJgW1s+fTyBS8GWYHi582\n" +
|
||||
"ldmLuKckMxitqYmd0QnLYZeKZ1jPJiTvk8KQPwBrgQKBgQD3Ykmxw5OobaxvPHQr\n" +
|
||||
"Wff6MUXSkfDWEpgnhMqUEtJ7fVyi/KYBfx6hpyQ1T1Mq0B5hxlt4MdW/GMKjTWXq\n" +
|
||||
"26rAdrnj4jQ/oXOgAcJmazRHrbExqSuUbl5pA6k6XtdsSNWKWqYDmSBTPc3UIFZt\n" +
|
||||
"T/cOyBxBo+9TkAjqsULBk+EyuQKBgQDXZJ5YbnCMebMv/QQgqGvXHuvHQKJGhYO8\n" +
|
||||
"eGD5xXjiwxbsbUSfFqdKefEdW8qqnMMWPoAPgQRGMYUzx89+JCie1t3CsXEGPmg3\n" +
|
||||
"0nxxbf4E+/qzmLXzJdLqTsL6mThd9sZ3NxEnUDlW1WErIptEkhirbdH7gTlwUfMF\n" +
|
||||
"yavHxSL2UQKBgGVhqGXritXZrHMhyVIC2vdzvfOfz51LnYOEjijE1fG53H8HH1k5\n" +
|
||||
"qWoCP3qBecnv5KOZUN8fPUPFd+7Ix13KjF23ylKz30m8dtA6KFsk0BYX/qgldjCs\n" +
|
||||
"UpCi6XV8bLh52NmMcMDEvlSe3X1zizfdL5ilNb9I2cnbG2xjHMKMQhwxAoGAGtdw\n" +
|
||||
"ICcLIYZc/SLzq7oxTiqNSVRVpKIoy4jY1Od17BRRu/7V6VliWZaepID23ZIRgaki\n" +
|
||||
"Pkxeovyy08QXqGmLIlg2ZHfGVPfb9vDlDyGc4TQhhtYF/pn9EbPk+mOzsYn6K4sS\n" +
|
||||
"OSr3KkoHBOAYJ1BpgJt76nKtHMEpntQF8ywu8jECgYEAj2FTge7fbD5j7x5QRH6F\n" +
|
||||
"5UG3P1RB6NM2wJ6Y/oDui2SawHaF4uWce5c7uJKnhELIQ5bNlDxJNfewQLKugFht\n" +
|
||||
"Pbsp7Ld1j29jqqebnmC+2hOUsfGdtj8jxaEA7FwqaNWenvdiV7LktpUhCuiR/HD/\n" +
|
||||
"F4oFFAlOJPm3xV9gAigsvU0=\n";
|
||||
protected final static String PRO_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0CTHTTKvclw+F4VfD5/R\n" +
|
||||
"vUD6FkkL1a3c+jEmgTLfL2gaiHB1K9RLHLP1XFPTExUcnJgh/RUMQJtJPRNQ5hhM\n" +
|
||||
"I9+wmhllRaQoFZ3KQ9OKEIN+KxfQ4m71txQDWLJdg5mC5Bz0OXOCFIV9cGfuAdX0\n" +
|
||||
"gts086IOCpC26qMFy+48+P6PUkmaGZvtkNJXRftrKF8NUnu7ObqzPfPIrCCkDdPL\n" +
|
||||
"SoBsR7Nk9VxcBkClTAwumeltrGBzwn+8pN2A4Rv16lUX0di/yaM5jpdQh89YoKzG\n" +
|
||||
"CVBetNSCboD1Zmw41l0uQS6uOcQLe9P98mMh/otXYLqnH/Rxiw6lGu097xQaSpDS\n" +
|
||||
"iQIDAQAB";
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package com.api.youhong.ai.pcn.ssoyunzhao.service;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import aiyh.utils.tool.Assert;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* <h1></h1>
|
||||
*
|
||||
* <p>create: 2023/2/22 23:19</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
public class SsoYunZhaoService {
|
||||
|
||||
/**
|
||||
* <h2>获取重定向路径地址</h2>
|
||||
*
|
||||
* @param user 用户
|
||||
* @return 重定向地址
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
|
||||
private final String environment = Util.getProperties("PcnYunZhaoSsoRsaKey", "yunzhao.environment");
|
||||
|
||||
public String getRedirectPath(User user) throws Exception {
|
||||
String userCodeMethod = Util.getCusConfigValueNullOrEmpty("YunZhaoSSOUserCodeMethod", "getEmail");
|
||||
Method method = User.class.getMethod(userCodeMethod);
|
||||
String value = Util.null2String(method.invoke(user));
|
||||
long currentTime = System.currentTimeMillis();
|
||||
String token = this.rsaEncryptedUserInfo(value + "\"" + String.valueOf(currentTime).substring(0, 10));
|
||||
String yunZhaoSsoPathUrl = Util.getCusConfigValue("YunZhaoSSOPathURL");
|
||||
Assert.notEmpty(yunZhaoSsoPathUrl, "can not find [YunZhaoSSOPathURL] from table [uf_cus_dev_config]");
|
||||
return yunZhaoSsoPathUrl + URLEncoder.encode(token, "UTF-8");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <h2>加密数据</h2>
|
||||
*
|
||||
* @param str 字符串
|
||||
* @return 加密后
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public String rsaEncryptedUserInfo(String str) throws Exception {
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
|
||||
String privateKey = "";
|
||||
if ("test".equals(environment)) {
|
||||
privateKey = SsoYunZhaoConstant.PRIVATE_KEY;
|
||||
}
|
||||
if ("pro".equals(environment)) {
|
||||
privateKey = SsoYunZhaoConstant.PRO_PRIVATE_KEY;
|
||||
}
|
||||
byte[] privBuffer = Base64.getDecoder().decode(privateKey.replace("\n", ""));
|
||||
PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(privBuffer);
|
||||
PrivateKey privKey = keyFactory.generatePrivate(privSpec);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privKey);
|
||||
byte[] encrypted = cipher.doFinal(str.getBytes());
|
||||
String result = Base64.getEncoder().encodeToString(encrypted);
|
||||
String checkSource = this.rsaDecryptUserInfo(result);
|
||||
if (!checkSource.equals(str)) {
|
||||
throw new CustomerException("加解密用户信息失败!");
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>解密数据</h2>
|
||||
*
|
||||
* @param str 加密字符串
|
||||
* @return 解密后
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public String rsaDecryptUserInfo(String str) throws Exception {
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
|
||||
String publicKey = "";
|
||||
if ("test".equals(environment)) {
|
||||
publicKey = SsoYunZhaoConstant.PUBLIC_KEY;
|
||||
}
|
||||
if ("pro".equals(environment)) {
|
||||
publicKey = SsoYunZhaoConstant.PRO_PUBLIC_KEY;
|
||||
}
|
||||
byte[] pubBuffer = Base64.getDecoder().decode(publicKey.replace("\n", ""));
|
||||
X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(pubBuffer);
|
||||
PublicKey pubKey = keyFactory.generatePublic(pubSpec);
|
||||
cipher.init(Cipher.DECRYPT_MODE, pubKey);
|
||||
byte[] decrypted = cipher.doFinal(Base64.getDecoder().decode(str.getBytes()));
|
||||
return new String(decrypted);
|
||||
}
|
||||
}
|
|
@ -71,6 +71,11 @@ public class ReceiptAndPaymentAction extends SafeCusBaseAction {
|
|||
@RequiredMark("ip")
|
||||
private String ip;
|
||||
|
||||
|
||||
@PrintParamMark
|
||||
@ActionOptionalParam(desc = "是否删除生成的临时本地文件,true - 删除 false - 不删除", value = "false")
|
||||
private String deleteTemp = "false";
|
||||
|
||||
@Override
|
||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||
try {
|
||||
|
@ -86,7 +91,9 @@ public class ReceiptAndPaymentAction extends SafeCusBaseAction {
|
|||
log.info("远程连接地址:" + "smb://" + ip + receiptPath);
|
||||
log.info("本地文件地址: " + filePath);
|
||||
smbjUtil.smbPut("smb://" + ip + receiptPath, filePath, userName, password, fileName);
|
||||
Files.delete(Paths.get(filePath));
|
||||
if (Boolean.parseBoolean(deleteTemp)) {
|
||||
Files.delete(Paths.get(filePath));
|
||||
}
|
||||
}
|
||||
} else if (Integer.parseInt(voucherType) == 2) {
|
||||
String tempFilePath = server.sendReceiptVoucher(onlyMark, requestId, billTable);
|
||||
|
@ -95,7 +102,9 @@ public class ReceiptAndPaymentAction extends SafeCusBaseAction {
|
|||
log.info("远程连接地址:" + "smb://" + ip + paymentPath);
|
||||
log.info("本地文件地址: " + tempFilePath);
|
||||
smbjUtil.smbPut("smb://" + ip + paymentPath, tempFilePath, userName, password, fileName);
|
||||
Files.delete(Paths.get(tempFilePath));
|
||||
if (Boolean.parseBoolean(deleteTemp)) {
|
||||
Files.delete(Paths.get(tempFilePath));
|
||||
}
|
||||
}
|
||||
/* ******************* 是否提交流程 ******************* */
|
||||
if (Boolean.parseBoolean(submitAction)) {
|
||||
|
|
|
@ -72,6 +72,10 @@ public class VoucherPayableAction extends SafeCusBaseAction {
|
|||
@RequiredMark("ip")
|
||||
private String ip;
|
||||
|
||||
@PrintParamMark
|
||||
@ActionOptionalParam(desc = "是否删除生成的临时本地文件,true - 删除 false - 不删除", value = "false")
|
||||
private String deleteTemp = "false";
|
||||
|
||||
@Override
|
||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||
|
||||
|
@ -91,7 +95,9 @@ public class VoucherPayableAction extends SafeCusBaseAction {
|
|||
log.info("远程连接地址:" + "smb://" + ip + remotePath);
|
||||
log.info("本地文件地址: " + tempFilePath);
|
||||
smbjUtil.smbPut("smb://" + ip + remotePath, tempFilePath, userName, password, fileName);
|
||||
Files.delete(Paths.get(tempFilePath));
|
||||
if (Boolean.parseBoolean(deleteTemp)) {
|
||||
Files.delete(Paths.get(tempFilePath));
|
||||
}
|
||||
/* ******************* 是否提交流程 ******************* */
|
||||
if (Boolean.parseBoolean(submitAction)) {
|
||||
this.submitWorkflow(requestId, user.getUID());
|
||||
|
|
|
@ -28,176 +28,176 @@ import java.util.UUID;
|
|||
*/
|
||||
|
||||
public class VoucherPayableService {
|
||||
|
||||
|
||||
private final SapConfigService configService = new SapConfigService();
|
||||
|
||||
@NotNull
|
||||
private static String getFilePath() {
|
||||
String sysFilePath = GCONST.getSysFilePath();
|
||||
String filePath = "";
|
||||
if (sysFilePath.endsWith(File.separator)) {
|
||||
filePath = sysFilePath + "temp" + File.separator + "voucher" + File.separator +
|
||||
System.currentTimeMillis() + "-voucher-" + UUID.randomUUID() + ".txt";
|
||||
} else {
|
||||
filePath = sysFilePath + File.separator + "temp" + File.separator + "voucher" + File.separator +
|
||||
System.currentTimeMillis() + "-voucher-" + UUID.randomUUID() + ".txt";
|
||||
}
|
||||
Path path = Paths.get(filePath);
|
||||
if (!Files.exists(path)) {
|
||||
Path parent = path.getParent();
|
||||
try {
|
||||
Files.createDirectories(parent);
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not create file [{}]", filePath));
|
||||
}
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>sendSapVoucher 获取凭证文件位置</h2>
|
||||
* <i>2023/2/3 11:34</i>
|
||||
* ************************************************************
|
||||
*
|
||||
* @param onlyMark 唯一标识
|
||||
* @param requestId 流程请求id
|
||||
* @param billTable 流程表
|
||||
* @return String 凭证文件位置
|
||||
* @author youHong.ai ******************************************
|
||||
*/
|
||||
public String sendSapVoucher(String onlyMark, String requestId, String billTable) {
|
||||
|
||||
SapVoucher voucherData = configService.getVoucherData(onlyMark, requestId, billTable);
|
||||
/* ******************* 整理数据 ******************* */
|
||||
StringBuilder voucherHeadBuilder = new StringBuilder();
|
||||
List<VoucherItem> voucherHead = voucherData.getVoucherHead();
|
||||
for (VoucherItem voucherItem : voucherHead) {
|
||||
voucherHeadBuilder.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
String voucherHeadStr = voucherHeadBuilder.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n";
|
||||
StringBuilder voucherDetailBuilder = new StringBuilder();
|
||||
List<List<VoucherItem>> voucherDetail = voucherData.getVoucherDetail();
|
||||
for (List<VoucherItem> voucherItems : voucherDetail) {
|
||||
voucherDetailBuilder.append(appendVoucherItems(voucherItems))
|
||||
.append("\r\n");
|
||||
}
|
||||
String voucherDetailStr = voucherDetailBuilder.substring(0, voucherDetailBuilder.lastIndexOf("\r\n"));
|
||||
String filePath = getFilePath();
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath))
|
||||
));
|
||||
writer.write(voucherHeadStr);
|
||||
writer.write(voucherDetailStr);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not writer file [{}]", filePath));
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public String sendReceiptVoucher(String onlyMark, String requestId, String billTable) {
|
||||
SapVoucher voucherData = configService.getReceiptPaymentData(onlyMark, requestId, billTable);
|
||||
/* ******************* 整理数据 ******************* */
|
||||
StringBuilder voucherHeadBuilder = new StringBuilder();
|
||||
List<List<VoucherItem>> voucherDetail = voucherData.getVoucherDetail();
|
||||
for (int i = 0; i < voucherDetail.size(); i++) {
|
||||
List<VoucherItem> voucherItems = voucherDetail.get(i);
|
||||
if (i == 0) {
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getName())
|
||||
.append("\t");
|
||||
}
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n");
|
||||
|
||||
}
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
if (i < voucherDetail.size() - 1) {
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n");
|
||||
} else {
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "");
|
||||
}
|
||||
}
|
||||
String filePath = getFilePath();
|
||||
try {
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath))
|
||||
));
|
||||
writer.write(voucherHeadBuilder.toString());
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not writer receipt voucher file [{}]", filePath));
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
public List<String> sendPaymentVoucher(String onlyMark, String requestId, String billTable) {
|
||||
SapVoucher voucherData = configService.getReceiptPaymentData(onlyMark, requestId, billTable);
|
||||
List<String> filePathList = new ArrayList<>();
|
||||
/* ******************* 整理数据 ******************* */
|
||||
StringBuilder voucherHeadBuilder = new StringBuilder();
|
||||
List<List<VoucherItem>> voucherDetail = voucherData.getVoucherDetail();
|
||||
for (List<VoucherItem> voucherItems : voucherDetail) {
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getName())
|
||||
.append("\t");
|
||||
}
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n");
|
||||
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "");
|
||||
|
||||
String filePath = getFilePath();
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath))
|
||||
));
|
||||
writer.write(voucherHeadBuilder.toString());
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not writer payment voucher file [{}]", filePath));
|
||||
}
|
||||
filePathList.add(filePath);
|
||||
}
|
||||
return filePathList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <h2>appendVoucherItems 拼接凭证明细</h2>
|
||||
* <i>2023/2/3 11:36</i>
|
||||
* ************************************************************
|
||||
*
|
||||
* @param voucherItems 凭证明细数据
|
||||
* @return String 拼接后字符串
|
||||
* @author youHong.ai ******************************************
|
||||
*/
|
||||
private String appendVoucherItems(List<VoucherItem> voucherItems) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
result.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
private final SapConfigService configService = new SapConfigService();
|
||||
|
||||
@NotNull
|
||||
private static String getFilePath() {
|
||||
String sysFilePath = GCONST.getSysFilePath();
|
||||
String filePath = "";
|
||||
if (sysFilePath.endsWith(File.separator)) {
|
||||
filePath = sysFilePath + "cus_temp" + File.separator + "voucher" + File.separator +
|
||||
System.currentTimeMillis() + "-voucher-" + UUID.randomUUID() + ".txt";
|
||||
} else {
|
||||
filePath = sysFilePath + File.separator + "cus_temp" + File.separator + "voucher" + File.separator +
|
||||
System.currentTimeMillis() + "-voucher-" + UUID.randomUUID() + ".txt";
|
||||
}
|
||||
Path path = Paths.get(filePath);
|
||||
if (!Files.exists(path)) {
|
||||
Path parent = path.getParent();
|
||||
try {
|
||||
Files.createDirectories(parent);
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not create file [{}]", filePath));
|
||||
}
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>sendSapVoucher 获取凭证文件位置</h2>
|
||||
* <i>2023/2/3 11:34</i>
|
||||
* ************************************************************
|
||||
*
|
||||
* @param onlyMark 唯一标识
|
||||
* @param requestId 流程请求id
|
||||
* @param billTable 流程表
|
||||
* @return String 凭证文件位置
|
||||
* @author youHong.ai ******************************************
|
||||
*/
|
||||
public String sendSapVoucher(String onlyMark, String requestId, String billTable) {
|
||||
|
||||
SapVoucher voucherData = configService.getVoucherData(onlyMark, requestId, billTable);
|
||||
/* ******************* 整理数据 ******************* */
|
||||
StringBuilder voucherHeadBuilder = new StringBuilder();
|
||||
List<VoucherItem> voucherHead = voucherData.getVoucherHead();
|
||||
for (VoucherItem voucherItem : voucherHead) {
|
||||
voucherHeadBuilder.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
String voucherHeadStr = voucherHeadBuilder.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n";
|
||||
StringBuilder voucherDetailBuilder = new StringBuilder();
|
||||
List<List<VoucherItem>> voucherDetail = voucherData.getVoucherDetail();
|
||||
for (List<VoucherItem> voucherItems : voucherDetail) {
|
||||
voucherDetailBuilder.append(appendVoucherItems(voucherItems))
|
||||
.append("\r\n");
|
||||
}
|
||||
String voucherDetailStr = voucherDetailBuilder.substring(0, voucherDetailBuilder.lastIndexOf("\r\n"));
|
||||
String filePath = getFilePath();
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath))
|
||||
));
|
||||
writer.write(voucherHeadStr);
|
||||
writer.write(voucherDetailStr);
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not writer file [{}]", filePath));
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public String sendReceiptVoucher(String onlyMark, String requestId, String billTable) {
|
||||
SapVoucher voucherData = configService.getReceiptPaymentData(onlyMark, requestId, billTable);
|
||||
/* ******************* 整理数据 ******************* */
|
||||
StringBuilder voucherHeadBuilder = new StringBuilder();
|
||||
List<List<VoucherItem>> voucherDetail = voucherData.getVoucherDetail();
|
||||
for (int i = 0; i < voucherDetail.size(); i++) {
|
||||
List<VoucherItem> voucherItems = voucherDetail.get(i);
|
||||
if (i == 0) {
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getName())
|
||||
.append("\t");
|
||||
}
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n");
|
||||
|
||||
}
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
if (i < voucherDetail.size() - 1) {
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n");
|
||||
} else {
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "");
|
||||
}
|
||||
}
|
||||
String filePath = getFilePath();
|
||||
try {
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath))
|
||||
));
|
||||
writer.write(voucherHeadBuilder.toString());
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not writer receipt voucher file [{}]", filePath));
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
|
||||
public List<String> sendPaymentVoucher(String onlyMark, String requestId, String billTable) {
|
||||
SapVoucher voucherData = configService.getReceiptPaymentData(onlyMark, requestId, billTable);
|
||||
List<String> filePathList = new ArrayList<>();
|
||||
/* ******************* 整理数据 ******************* */
|
||||
StringBuilder voucherHeadBuilder = new StringBuilder();
|
||||
List<List<VoucherItem>> voucherDetail = voucherData.getVoucherDetail();
|
||||
for (List<VoucherItem> voucherItems : voucherDetail) {
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getName())
|
||||
.append("\t");
|
||||
}
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "\r\n");
|
||||
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
voucherHeadBuilder.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
voucherHeadBuilder = new StringBuilder(voucherHeadBuilder
|
||||
.substring(0, voucherHeadBuilder.lastIndexOf("\t")) + "");
|
||||
|
||||
String filePath = getFilePath();
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(
|
||||
Files.newOutputStream(Paths.get(filePath))
|
||||
));
|
||||
writer.write(voucherHeadBuilder.toString());
|
||||
writer.flush();
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new CustomerException(Util.logStr("can not writer payment voucher file [{}]", filePath));
|
||||
}
|
||||
filePathList.add(filePath);
|
||||
}
|
||||
return filePathList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <h2>appendVoucherItems 拼接凭证明细</h2>
|
||||
* <i>2023/2/3 11:36</i>
|
||||
* ************************************************************
|
||||
*
|
||||
* @param voucherItems 凭证明细数据
|
||||
* @return String 拼接后字符串
|
||||
* @author youHong.ai ******************************************
|
||||
*/
|
||||
private String appendVoucherItems(List<VoucherItem> voucherItems) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (VoucherItem voucherItem : voucherItems) {
|
||||
result.append(voucherItem.getValue())
|
||||
.append("\t");
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import lombok.ToString;
|
|||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.UpdateDetailRowDto;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionsSetValueConfigMain;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.service.WorkflowConditionsSetValueService;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -31,7 +32,7 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
|||
|
||||
@RequiredMark("流程条件赋值配置表唯一标识字段值")
|
||||
@PrintParamMark
|
||||
@ActionDefaultTestValue("test")
|
||||
@ActionDefaultTestValue("getdata")
|
||||
private String onlyMark;
|
||||
|
||||
@ActionOptionalParam(desc = "条件修改所在明细表,1-明细1,2-明细2", value = "")
|
||||
|
@ -54,24 +55,26 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
|||
try {
|
||||
Map<String, Object> workflowData = new HashMap<>(16);
|
||||
Map<String, Object> workflowMainData = super.getObjMainTableValue(requestInfo);
|
||||
ConditionsSetValueConfigMain conditionsSetValueConfigMain = service.getConditionConfigMain(onlyMark);
|
||||
if (Strings.isNullOrEmpty(detailNo)) {
|
||||
/* ******************* 数据修改主表 ******************* */
|
||||
Map<String, Object> conditionsValue = service.getConditionsValue(onlyMark, workflowData).get(billTable);
|
||||
Map<String, Object> conditionsValue = service.getConditionsValue(conditionsSetValueConfigMain, workflowData).get(billTable);
|
||||
service.updateWorkflowData(conditionsValue, billTable, requestId);
|
||||
return;
|
||||
}
|
||||
/* ******************* 明细表 ******************* */
|
||||
List<Map<String, Object>> detailData = super.getDetailTableObjValueByDetailNo(Integer.parseInt(detailNo), requestInfo);
|
||||
List<Map<String, Object>> detailData = super.getDetailTableObjValueByDetailNo(Integer.parseInt(detailNo) - 1, requestInfo);
|
||||
workflowData.put("main", workflowMainData);
|
||||
workflowData.put("_user_", user);
|
||||
workflowData.put("_workflowId_", workflowId);
|
||||
workflowData.put("_requestId_", requestId);
|
||||
workflowData.put("_billTable_", billTable);
|
||||
workflowData.put("_detailTable_", billTable + "_dt" + detailNo);
|
||||
List<UpdateDetailRowDto> main = new ArrayList<>();
|
||||
List<UpdateDetailRowDto> detail = new ArrayList<>();
|
||||
for (Map<String, Object> detailDatum : detailData) {
|
||||
workflowData.put("detail_" + detailNo, detailDatum);
|
||||
Map<String, Map<String, Object>> conditionsValues = service.getConditionsValue(onlyMark, workflowData);
|
||||
Map<String, Map<String, Object>> conditionsValues = service.getConditionsValue(conditionsSetValueConfigMain, workflowData);
|
||||
Map<String, Object> mainConditions = conditionsValues.get(billTable);
|
||||
if (!Objects.isNull(mainConditions) && !mainConditions.isEmpty()) {
|
||||
main.add(Builder.builder(UpdateDetailRowDto::new)
|
||||
|
@ -101,6 +104,8 @@ public class WorkflowConditionsSetValueAction extends SafeCusBaseAction {
|
|||
}
|
||||
|
||||
public void submitWorkflow(String requestId, Integer userId) {
|
||||
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "邮件发送附件提交流程!");
|
||||
if (Boolean.parseBoolean(submitAction)) {
|
||||
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "流程条件赋值提交流程!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity;
|
||||
|
||||
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||
import aiyh.utils.entity.FieldViewInfo;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -16,23 +17,30 @@ import lombok.ToString;
|
|||
@Getter
|
||||
@ToString
|
||||
public class ConditionItem {
|
||||
@SqlOracleDbFieldAnn("ID")
|
||||
private Integer id;
|
||||
|
||||
/** 赋值字段 */
|
||||
@SqlOracleDbFieldAnn("ID")
|
||||
private FieldViewInfo targetField;
|
||||
/** 条件取值字段 */
|
||||
private FieldViewInfo conditionsField;
|
||||
/** 条件 */
|
||||
@SqlOracleDbFieldAnn("CONDITIONS")
|
||||
private Integer conditions;
|
||||
/** 条件对比方式 */
|
||||
@SqlOracleDbFieldAnn("CONDITIONS_TYPE")
|
||||
private Integer conditionsType;
|
||||
/** 条件对比字段 */
|
||||
private FieldViewInfo conditionsContrastField;
|
||||
/** 条件自定义值 */
|
||||
@SqlOracleDbFieldAnn("CUSTOMER_CONDITIONS_VALUE")
|
||||
private String customerConditionsValue;
|
||||
/** 赋值规则 */
|
||||
@SqlOracleDbFieldAnn("VALUE_SET_RULES")
|
||||
private Integer valueSetRules;
|
||||
/** 自定义赋值 */
|
||||
@SqlOracleDbFieldAnn("CUSTOMER_SET_VALUE")
|
||||
private String customerSetValue;
|
||||
|
||||
/** 取值字段 */
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity;
|
||||
|
||||
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
@ -19,12 +20,15 @@ import java.util.List;
|
|||
public class ConditionsSetValueConfigMain {
|
||||
|
||||
/** id */
|
||||
@SqlOracleDbFieldAnn("ID")
|
||||
private Integer id;
|
||||
|
||||
/** 唯一标识 */
|
||||
@SqlOracleDbFieldAnn("ONLY_MARK")
|
||||
private String onlyMark;
|
||||
|
||||
/** 流程类型 */
|
||||
@SqlOracleDbFieldAnn("WORKFLOW_TYPE")
|
||||
private Integer workflowType;
|
||||
|
||||
/** 明细配置表,条件配置 */
|
||||
|
|
|
@ -85,9 +85,9 @@ public interface WorkflowConditionsSetValueMapper {
|
|||
* <h2>批量更新数据</h2>
|
||||
*
|
||||
* @param sql sql
|
||||
* @param updateBatchData 批量参数
|
||||
* @param updateBatchData 参数
|
||||
* @return
|
||||
*/
|
||||
@BatchUpdate(custom = true)
|
||||
boolean batchUpdateWorkflowData(@SqlString String sql, @BatchSqlArgs List<Map<String, Object>> updateBatchData);
|
||||
@Update(custom = true)
|
||||
boolean batchUpdateWorkflowData(@SqlString String sql, Map<String, Object> updateBatchData);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package weaver.youhong.ai.pcn.actioin.conditionssetvalue.service;
|
|||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.tool.Assert;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.ConditionValueDto;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.UpdateDetailRowDto;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionItem;
|
||||
|
@ -28,17 +30,13 @@ public class WorkflowConditionsSetValueService {
|
|||
/**
|
||||
* <h2>获取条件赋值映射规则处理后的字段值</h2>
|
||||
*
|
||||
* @param onlyMark 配置表唯一标识
|
||||
* @param workflowData 流程表数据
|
||||
* @param conditionsSetValueConfigMain 配置表信息
|
||||
* @param workflowData 流程表数据
|
||||
* @return 映射结果
|
||||
*/
|
||||
public Map<String, Map<String, Object>> getConditionsValue(String onlyMark, Map<String, Object> workflowData) {
|
||||
|
||||
/* ******************* 查询配置表 ******************* */
|
||||
ConditionsSetValueConfigMain conditionsSetValueConfigMain = mapper.selectConfigByOnlyMark(onlyMark);
|
||||
Assert.notNull(conditionsSetValueConfigMain, "can not query configuration by onlyMark [{}]", onlyMark);
|
||||
public Map<String, Map<String, Object>> getConditionsValue(ConditionsSetValueConfigMain conditionsSetValueConfigMain, Map<String, Object> workflowData) {
|
||||
List<ConditionItem> conditionItemList = conditionsSetValueConfigMain.getConditionItemList();
|
||||
Assert.notEmpty(conditionItemList, "can not query conditionItemList by onlyMark [{}]", onlyMark);
|
||||
|
||||
/* ******************* 映射规则处理 ,责任链初始化 ******************* */
|
||||
ConditionsTypeTreatment conditionsTypeTreatment = new ConditionsTypeTreatment(
|
||||
new ConditionsTreatment(
|
||||
|
@ -68,6 +66,16 @@ public class WorkflowConditionsSetValueService {
|
|||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ConditionsSetValueConfigMain getConditionConfigMain(String onlyMark) {
|
||||
/* ******************* 查询配置表 ******************* */
|
||||
ConditionsSetValueConfigMain conditionsSetValueConfigMain = mapper.selectConfigByOnlyMark(onlyMark);
|
||||
Assert.notNull(conditionsSetValueConfigMain, "can not query configuration by onlyMark [{}]", onlyMark);
|
||||
List<ConditionItem> conditionItemList = conditionsSetValueConfigMain.getConditionItemList();
|
||||
Assert.notEmpty(conditionItemList, "can not query conditionItemList by onlyMark [{}]", onlyMark);
|
||||
return conditionsSetValueConfigMain;
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>更新明细表数据</h2>
|
||||
*
|
||||
|
@ -86,32 +94,42 @@ public class WorkflowConditionsSetValueService {
|
|||
return;
|
||||
}
|
||||
List<Map<String, Object>> updateBatchData = new ArrayList<>(updateDetailRowDtoList.size());
|
||||
for (UpdateDetailRowDto updateDetailRowDto : updateDetailRowDtoList) {
|
||||
for (int i = 0; i < updateDetailRowDtoList.size(); i++) {
|
||||
UpdateDetailRowDto updateDetailRowDto = updateDetailRowDtoList.get(i);
|
||||
updateDetailRow = updateDetailRowDtoList.get(i);
|
||||
Map<String, Object> updateData = updateDetailRowDto.getUpdateData();
|
||||
updateData.put("_id_", updateDetailRow.getWhereValue());
|
||||
updateData.put("_" + updateDetailRow.getWhereField() + "_", updateDetailRow.getWhereValue());
|
||||
updateBatchData.add(updateData);
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("update ");
|
||||
sb.append(billTable).append(" set ");
|
||||
for (Map.Entry<String, Object> entry : updateBatchData.get(0).entrySet()) {
|
||||
sb.append(entry.getKey())
|
||||
.append(" = #{item.")
|
||||
.append(entry.getKey())
|
||||
.append("},");
|
||||
}
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
sb.append(" where ")
|
||||
.append(updateDetailRow.getWhereField())
|
||||
.append(" = #{item._id_}");
|
||||
String sql = sb.toString();
|
||||
boolean flag = mapper.batchUpdateWorkflowData(sql, updateBatchData);
|
||||
if (!flag) {
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException ignore) {
|
||||
for (int i = 0; i < updateBatchData.size(); i++) {
|
||||
Map<String, Object> datum = updateBatchData.get(i);
|
||||
updateDetailRow = updateDetailRowDtoList.get(i);
|
||||
StringBuilder sb = new StringBuilder("update ");
|
||||
sb.append(billTable).append(" set ");
|
||||
for (Map.Entry<String, Object> entry : datum.entrySet()) {
|
||||
if (("_" + updateDetailRow.getWhereField() + "_").equals(entry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
sb.append(entry.getKey())
|
||||
.append(" = #{")
|
||||
.append(entry.getKey())
|
||||
.append("},");
|
||||
}
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
sb.append(" where ")
|
||||
.append(updateDetailRow.getWhereField())
|
||||
.append(" = #{" + "_")
|
||||
.append(updateDetailRow.getWhereField())
|
||||
.append("_")
|
||||
.append("}");
|
||||
String sql = sb.toString();
|
||||
boolean flag = mapper.batchUpdateWorkflowData(sql, datum);
|
||||
|
||||
if (!flag) {
|
||||
Util.getLogger().info("更新条件字段值失败!" + sql + " : " + JSON.toJSONString(datum));
|
||||
}
|
||||
mapper.batchUpdateWorkflowData(sql, updateBatchData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package weaver.youhong.ai.pcn.actioin.conditionssetvalue.util;
|
|||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.annotation.MethodRuleNo;
|
||||
import aiyh.utils.entity.FieldViewInfo;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.dto.ConditionValueDto;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.entity.ConditionItem;
|
||||
|
||||
|
@ -48,12 +49,21 @@ public class ConditionsTreatment {
|
|||
|
||||
public ConditionValueDto executeTreatment(ConditionItem conditionItem, Object value) {
|
||||
Map<String, Object> workflowData = ConditionsTypeTreatment.WORKFLOW_DATA.get();
|
||||
Object sourceValue = workflowData.get(conditionItem.getConditionsField().getFieldName());
|
||||
FieldViewInfo conditionsField = conditionItem.getConditionsField();
|
||||
Object sourceValue = Util.getValueByFieldViwInfo(conditionsField, workflowData);
|
||||
Boolean apply = METHOD_MAP.get(conditionItem.getConditions()).apply(
|
||||
Util.null2String(sourceValue),
|
||||
Util.null2String(value)
|
||||
);
|
||||
if (apply) {
|
||||
FieldViewInfo targetField = conditionItem.getTargetField();
|
||||
String tableName = targetField.getTableName();
|
||||
if (tableName.contains("_dt")) {
|
||||
String[] dts = tableName.split("_dt");
|
||||
((Map<String, Object>) workflowData.get("detail_" + dts[1])).put(targetField.getFieldName(), value);
|
||||
} else {
|
||||
((Map<String, Object>) workflowData.get("main")).put(targetField.getFieldName(), value);
|
||||
}
|
||||
return this.valueSetRulesTreatment.createConditionValue(conditionItem);
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -51,6 +51,7 @@ public class ValueSetRulesTreatment {
|
|||
return Builder.builder(ConditionValueDto::new)
|
||||
.with(ConditionValueDto::setFieldName, conditionItem.getTargetField().getFieldName())
|
||||
.with(ConditionValueDto::setValue, value)
|
||||
.with(ConditionValueDto::setTableName, conditionItem.getTargetField().getTableName())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
package weaver.youhong.ai.pcn.actioin.docfieltoattachment;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.action.SafeCusBaseAction;
|
||||
import aiyh.utils.annotation.ActionDesc;
|
||||
import aiyh.utils.annotation.ActionOptionalParam;
|
||||
import aiyh.utils.annotation.PrintParamMark;
|
||||
import aiyh.utils.annotation.RequiredMark;
|
||||
import aiyh.utils.entity.DocImageInfo;
|
||||
import aiyh.utils.excention.CustomerException;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.youhong.ai.pcn.actioin.docfieltoattachment.mapper.CopyDocFileToAttachmentMapper;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1>文档字段中附件复制到附件字段中</h1>
|
||||
*
|
||||
* <p>create: 2023/2/21 18:40</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ActionDesc(value = "文档字段中附件复制到附件字段中", author = "youhong.ai")
|
||||
public class CopyDocFileToAttachmentAction extends SafeCusBaseAction {
|
||||
@PrintParamMark
|
||||
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程")
|
||||
private String block = "true";
|
||||
|
||||
@PrintParamMark
|
||||
@RequiredMark("字段映射配置字段: 文档字段:附件字段;文档字段:附件字段")
|
||||
private String fieldMappings;
|
||||
|
||||
private final CopyDocFileToAttachmentMapper mapper = Util.getMapper(CopyDocFileToAttachmentMapper.class);
|
||||
|
||||
@Override
|
||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||
try {
|
||||
String[] fieldMappingArr = fieldMappings.split(";");
|
||||
Map<String, String> mainTableValue = super.getMainTableValue(requestInfo);
|
||||
Map<String, Object> sqlValue = new HashMap<>();
|
||||
for (String fieldMapping : fieldMappingArr) {
|
||||
copyFile(fieldMapping, mainTableValue, sqlValue, String.valueOf(workflowId), billTable, user.getUID());
|
||||
}
|
||||
StringBuilder sb = new StringBuilder("update ");
|
||||
sb.append(billTable).append(" set ");
|
||||
for (Map.Entry<String, Object> entry : sqlValue.entrySet()) {
|
||||
sb.append(entry.getKey()).append(" = ").append("#{").append(entry.getKey()).append("},");
|
||||
}
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
sb.append(" where requestid = ").append(requestId);
|
||||
if (mapper.updateDocIds(sb.toString(), sqlValue)) {
|
||||
Thread.sleep(500);
|
||||
mapper.updateDocIds(sb.toString(), sqlValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (Boolean.parseBoolean(block)) {
|
||||
throw new CustomerException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void copyFile(String fieldMapping, Map<String, String> mainTableValue,
|
||||
Map<String, Object> sqlValue, String workflowId,
|
||||
String billTable, int userId) {
|
||||
List<Integer> docIds = new ArrayList<>();
|
||||
String[] split = fieldMapping.split(":");
|
||||
String docField = split[0];
|
||||
String fileField = split[1];
|
||||
String docId = mainTableValue.get(docField);
|
||||
List<DocImageInfo> docImageInfos = Util.selectImageInfoByDocIds(docId);
|
||||
for (DocImageInfo docImageInfo : docImageInfos) {
|
||||
if (docImageInfo.getDocFileType() != 2) {
|
||||
continue;
|
||||
}
|
||||
InputStream inputStreamById = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
||||
String docCategorysByTable = Util.getDocCategorysByTable(workflowId, fileField, billTable);
|
||||
String[] categoryArr = docCategorysByTable.split(",");
|
||||
String category = categoryArr[categoryArr.length - 1];
|
||||
try {
|
||||
int doc = Util.createDoc(docImageInfo.getImageFileName(), Integer.parseInt(category), inputStreamById, userId);
|
||||
docIds.add(doc);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
sqlValue.put(fileField, Util.intJoin(docIds, ","));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package weaver.youhong.ai.pcn.actioin.docfieltoattachment.mapper;
|
||||
|
||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||
import aiyh.utils.annotation.recordset.SqlString;
|
||||
import aiyh.utils.annotation.recordset.Update;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1></h1>
|
||||
*
|
||||
* <p>create: 2023/2/21 19:13</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
@SqlMapper
|
||||
public interface CopyDocFileToAttachmentMapper {
|
||||
|
||||
@Update(custom = true)
|
||||
boolean updateDocIds(@SqlString String sql,
|
||||
Map<String, Object> map);
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package weaver.youhong.ai.pcn.actioin.generateloginid;
|
||||
|
||||
import aiyh.utils.Util;
|
||||
import aiyh.utils.action.SafeCusBaseAction;
|
||||
import aiyh.utils.annotation.ActionDesc;
|
||||
import aiyh.utils.annotation.ActionOptionalParam;
|
||||
import aiyh.utils.annotation.PrintParamMark;
|
||||
import aiyh.utils.annotation.RequiredMark;
|
||||
import com.google.common.base.Strings;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import weaver.hrm.User;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1>生成loginid</h1>
|
||||
*
|
||||
* <p>create: 2023/2/21 19:46</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@ActionDesc(value = "根据分部生成对应的登录名", author = "youhong.ai")
|
||||
public class GenerateLoginIdAction extends SafeCusBaseAction {
|
||||
|
||||
@PrintParamMark
|
||||
@RequiredMark("流程回写登录名字段名")
|
||||
private String loginIdField;
|
||||
|
||||
|
||||
@PrintParamMark
|
||||
@RequiredMark("分部简称流程字段名")
|
||||
private String subCompanyTextField;
|
||||
|
||||
|
||||
@PrintParamMark
|
||||
@ActionOptionalParam(value = "4", desc = "登录名序列数字位长度,序列不足时前缀补0,如0001,默认长度4位")
|
||||
private String numberFillQuantity = "4";
|
||||
|
||||
|
||||
@PrintParamMark
|
||||
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程")
|
||||
private String block = "true";
|
||||
|
||||
private final GenerateLoginIdMapper mapper = Util.getMapper(GenerateLoginIdMapper.class);
|
||||
|
||||
@Override
|
||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||
try {
|
||||
Map<String, String> mainTableValue = super.getMainTableValue(requestInfo);
|
||||
String subCompanyName = mainTableValue.get(subCompanyTextField);
|
||||
String subCompanyId = mapper.selectSubCompanyIdBySubCompanyName(subCompanyName);
|
||||
Map<String, String> lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
|
||||
String loginIdNo = lastLoginIdInfo.get("loginIdNo");
|
||||
String loginId = prefixFill(loginIdNo, subCompanyName);
|
||||
if (mapper.updateLoginId(billTable, requestId, loginId, loginIdField)) {
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
mapper.updateLoginId(billTable, requestId, loginId, loginIdField);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (Boolean.parseBoolean(block)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>前缀补齐</h2>
|
||||
*
|
||||
* @param lastLoginIdNo 最后登录名编号
|
||||
* @param prefix 前缀
|
||||
* @return 登录名
|
||||
*/
|
||||
private String prefixFill(String lastLoginIdNo, String prefix) {
|
||||
NumberFormat numberFormat = NumberFormat.getInstance();
|
||||
// 禁用数字格式化分组。
|
||||
numberFormat.setGroupingUsed(false);
|
||||
// 保留最小位数
|
||||
numberFormat.setMinimumIntegerDigits(Integer.parseInt(numberFillQuantity));
|
||||
// 保留最大位数
|
||||
numberFormat.setMaximumIntegerDigits(10);
|
||||
long i = 0L;
|
||||
try {
|
||||
if (!Strings.isNullOrEmpty(lastLoginIdNo)) {
|
||||
i = Long.parseLong(lastLoginIdNo);
|
||||
}
|
||||
} catch (NumberFormatException ignore) {
|
||||
}
|
||||
long newLoginId = i + 1;
|
||||
return prefix + numberFormat.format(newLoginId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package weaver.youhong.ai.pcn.actioin.generateloginid.mapper;
|
||||
|
||||
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||
import aiyh.utils.annotation.recordset.Select;
|
||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||
import aiyh.utils.annotation.recordset.Update;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <h1></h1>
|
||||
*
|
||||
* <p>create: 2023/2/21 20:31</p>
|
||||
*
|
||||
* @author youHong.ai
|
||||
*/
|
||||
@SqlMapper
|
||||
public interface GenerateLoginIdMapper {
|
||||
|
||||
|
||||
/**
|
||||
* <h2>通过分部简称查询分部id</h2>
|
||||
*
|
||||
* @param subCompanyName 分部简称
|
||||
* @return 分部id
|
||||
*/
|
||||
@Select("select id from hrmsubcompany where SUBCOMPANYNAME = #{subCompanyName}")
|
||||
String selectSubCompanyIdBySubCompanyName(String subCompanyName);
|
||||
|
||||
/**
|
||||
* <h2>查询当前分部的人员的登录名的最后一个编号</h2>
|
||||
*
|
||||
* @param loginIdPrefix 登录名前缀
|
||||
* @param subCompanyId 分部id
|
||||
* @param loginLike 登录名前缀+%
|
||||
* @return 当前分部人员id和登录名编号
|
||||
*/
|
||||
@Select("select id,substring(LOGINID,length(#{loginIdPrefix}) + 1) login_id_no \n" +
|
||||
"from hrmresource \n" +
|
||||
"where SUBCOMPANYID1 = #{subCompanyId} and LOGINID like #{loginLike} \n" +
|
||||
" order by cast(substring(LOGINID,length(#{loginIdPrefix}) + 1) as decimal) \n" +
|
||||
" desc limit 1")
|
||||
Map<String, String> selectLastLoginId(
|
||||
@ParamMapper("loginIdPrefix") String loginIdPrefix,
|
||||
@ParamMapper("subCompanyId") String subCompanyId,
|
||||
@ParamMapper("loginLike") String loginLike
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* <h2>更新流程中的loginId字段</h2>
|
||||
*
|
||||
* @param billTable 流程表
|
||||
* @param requestId 请求id
|
||||
* @param loginId 登录id
|
||||
* @param loginIdField 登录id所属字段
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@Update("update $t{billTable} set $t{loginIdField} = #{loginId} where requestid = #{requestId}")
|
||||
boolean updateLoginId(@ParamMapper("billTable") String billTable,
|
||||
@ParamMapper("requestId") String requestId,
|
||||
@ParamMapper("loginId") String loginId,
|
||||
@ParamMapper("loginIdField") String loginIdField);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
yunzhao.environment=test
|
|
@ -20,4 +20,10 @@ public class TestHaRiPiJiu extends BaseTest {
|
|||
GenerateFileUtil.createActionDocument(VoucherPayableAction.class);
|
||||
GenerateFileUtil.createActionDocument(ReceiptAndPaymentAction.class);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test1() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,20 @@ package youhong.ai.pcn;
|
|||
import aiyh.utils.GenerateFileUtil;
|
||||
import aiyh.utils.Util;
|
||||
import basetest.BaseTest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.api.youhong.ai.pcn.ssoyunzhao.service.SsoYunZhaoService;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.hrm.service.impl.RolesMembersServiceImpl;
|
||||
import com.google.common.base.Strings;
|
||||
import org.junit.Test;
|
||||
import weaver.hrm.User;
|
||||
import weaver.youhong.ai.pcn.actioin.conditionssetvalue.WorkflowConditionsSetValueAction;
|
||||
import weaver.youhong.ai.pcn.actioin.generateloginid.GenerateLoginIdAction;
|
||||
import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper;
|
||||
import weaver.youhong.ai.pcn.schedule.addrolebyhasundering.RegisterRoleMemberByHasUnderingCronJob;
|
||||
import weaver.youhong.ai.pcn.schedule.addrolemember.RegisterRoleMemberCronJob;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -62,10 +68,53 @@ public class RolesTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void test3() {
|
||||
String value = "1";
|
||||
System.out.println(Double.parseDouble(value));
|
||||
// String value = "1";
|
||||
// System.out.println(Double.parseDouble(value));
|
||||
GenerateLoginIdMapper mapper = Util.getMapper(GenerateLoginIdMapper.class);
|
||||
Map<String, String> wld = mapper.selectLastLoginId("wld", "3", "wld%");
|
||||
System.out.println(JSON.toJSONString(wld));
|
||||
System.out.println(this.prefixFill(wld.get("loginIdNo"), "PCN"));
|
||||
}
|
||||
|
||||
private String prefixFill(String lastLoginIdNo, String prefix) {
|
||||
NumberFormat numberFormat = NumberFormat.getInstance();
|
||||
// 禁用数字格式化分组。
|
||||
numberFormat.setGroupingUsed(false);
|
||||
// 保留最小位数
|
||||
numberFormat.setMinimumIntegerDigits(Integer.parseInt("4"));
|
||||
// 保留最大位数
|
||||
numberFormat.setMaximumIntegerDigits(10);
|
||||
long i = 0L;
|
||||
try {
|
||||
if (!Strings.isNullOrEmpty(lastLoginIdNo)) {
|
||||
i = Long.parseLong(lastLoginIdNo);
|
||||
}
|
||||
} catch (NumberFormatException ignore) {
|
||||
}
|
||||
long newLoginId = i + 1;
|
||||
return prefix + numberFormat.format(newLoginId);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testsso() throws Exception {
|
||||
User user = new User(22);
|
||||
SsoYunZhaoService service = new SsoYunZhaoService();
|
||||
System.out.println(service.getRedirectPath(user));
|
||||
String s = service.rsaEncryptedUserInfo("test_public_decrypt@email.test.com\"1234567891011");
|
||||
System.out.println(s);
|
||||
System.out.println("1234567891011".substring(0, 10));
|
||||
System.out.println(service.rsaDecryptUserInfo(s));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testToken() throws Exception {
|
||||
SsoYunZhaoService service = new SsoYunZhaoService();
|
||||
String s = service.rsaDecryptUserInfo("rO76Ung4eKvIXUK5+r9s26SQ1jyBfKjjOSUaV3Wmw6ZLE/kMHD07HOraAGdKdl9B4gwbbpYinBXT/S9O/6Jj3dDL2R81PkOYG/q+dYWkTFdAn5KsItdF6mKY/4wzPd0+5axPa5KjD7LUUwxb+G+jD3x4nTRU3HYJaCxNyjeXc5ndY/zrQKUsyLPlmgTWG1LrS2enoPg+9rZKiix/81N16O9F1om/X8LmS/N5Byh9bzYXbJrBK2AeDuF83ricyLNeKW/Wh5ZUnqfKWjeeER2uDgw9hq6njkIYYw7JLXsMeyUbNKA1R1Ng2XzxuoaBo/WRix7+5phX/4wbspMb6d/nOg==");
|
||||
System.out.println(s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWorkflowConditionSetValue() {
|
||||
|
@ -75,6 +124,6 @@ public class RolesTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void generateFile() {
|
||||
GenerateFileUtil.createActionDocument(WorkflowConditionsSetValueAction.class);
|
||||
GenerateFileUtil.createActionDocument(GenerateLoginIdAction.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package youhong.ai.pcn;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
public class Rsa {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String privateKey =
|
||||
"MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCTWNWQiLBU7v5g" + "\n" +
|
||||
"HdwWodocMRH8Hz2z3ZAMOsA0ObTD3oGkfczAG+XbNY/wK6zeeosmlMR/NraOSQmf" + "\n" +
|
||||
"Vzr2hdzErEHS04RDEtcCV9clWIO7lS9lVDx0ob5IR+vMjk+HdobdEimQ06gJqYzI" + "\n" +
|
||||
"PprUprrv5ZwuLwlyRHwAJJwyKE/MJLWBLw2641xLAjJ4v09UM5K74uBjXszDk1Ci" + "\n" +
|
||||
"MSOsEtuGYJv60KGIO50MUDK5tj8cjUfK3VzGj2ILmf7c/WISMltcnW+8O/JJqpmX" + "\n" +
|
||||
"Z+mltTKqJbdHQj2ig8/BxECIS1GyWkD3q0yB8FHkA1axdJZ+fxtt6q9AIws+Fil2" + "\n" +
|
||||
"pvE5GLIvAgMBAAECggEAVBhza1ZYLWFp1Tm1j0U40rY+6YJ7GNjvictOP4Bf5xpr" + "\n" +
|
||||
"K5KQ9WP2wDHFwPFsbF3MZWyq6WA0uOh+kW6bvG+SHL2jo8wMxKtQA4pWxH3MUZdH" + "\n" +
|
||||
"wbFd/8MAcwh5T/o48bt4JVxkVMA4O6uFKhRxEcVHE/wcM0+tOIZVr081xnqzcHL1" + "\n" +
|
||||
"YSgM1aSvDQnE3ds9j0jnd0LR0W+tidpHL/J8D+yZMIGyw7wQzZ4Xo4OmSOvb1NPY" + "\n" +
|
||||
"TThPyRy1m8D5vP6etiI/tKlLMkvJvr1G5EPzTb/ECkqcTerOZwSfRkUnpOgD11sa" + "\n" +
|
||||
"XRzJeR3ByzFweuFipUNEToCXsrSP7gdcSfcFliDjYQKBgQDDcRT8xcJt7gWX6LFV" + "\n" +
|
||||
"m8ggRBoqRgwDcr2PwW3NpcQKDKH4XhQrESFOBwEVn3vwv6NJ9NLLnOKuYbLAF1jR" + "\n" +
|
||||
"4BHZJmerrUeMFTvkdoyb07tFDfZah+yx8NKlJzNaGTJr5FwqLuPXADCQtIqz4/Ql" + "\n" +
|
||||
"jQWymB0BXwvyVWjU99AKorqh1QKBgQDBAMLUjYZNbk+D0LC79/G9GIZQvJdRQhuH" + "\n" +
|
||||
"lzC0wlOvBy47UwvE/2RMp8R+LS9nroa+O4zRmRE160nmmvzF7mPszAI+aG3Jl64L" + "\n" +
|
||||
"0ej3ynQ8ONgRRB4UBJFyzcj0Yctjk+gC9kj89DdtBdYhOfSlIfIFTv6BGH+9lvZa" + "\n" +
|
||||
"+YT3FnJB8wKBgQCtjLkqTSH+JCLrZkIy1wa7QD5L06/PUBBsm0M6Hj0a/2TE/CXE" + "\n" +
|
||||
"qI1+kFGyNdEFU+dYQQL+s+3HFBJ66UCB/gtbXPMqS9EA38ozceIibb4Z7/AXLCRP" + "\n" +
|
||||
"Tp5+8XR0SXOwwzPkcYb44L4/gVK5s26V+chZcyIumYwuQRG6K+SdzSsVkQKBgCSw" + "\n" +
|
||||
"61kTKqQPw4gQpXimk0tanTY+FBo7khY91OGYS+ZrXAulJwilcMDt5/oAxxFT6YPC" + "\n" +
|
||||
"uGukSNRSTbNMZZ+PSWncAtUwbyay8kCHAF4TG/PS7qihpYIyuB/2JSzoZo0gsivV" + "\n" +
|
||||
"/FwyZVMRl/qrFOpLwMHnmZSbPrWhPGZhJzj+CGynAoGAQOtCerAPjkMX83NpC/MK" + "\n" +
|
||||
"DtGyGpdE/7tSw7QCuwvNlN7lm/B67a/nXTUd7vWH+sRP9HbpT+gPOhsm9fljVi0j" + "\n" +
|
||||
"W3Or5jjT5n/FuA8zSr1a39BtusucOek2ATAUh5661/zJcFO3IAeUAOMRRo8NaM2M" + "\n" +
|
||||
"ssgdq0nGP23DNakgVPko8+E=" + "\n";
|
||||
|
||||
String publicKey =
|
||||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk1jVkIiwVO7+YB3cFqHa" + "\n" +
|
||||
"HDER/B89s92QDDrANDm0w96BpH3MwBvl2zWP8Cus3nqLJpTEfza2jkkJn1c69oXc" + "\n" +
|
||||
"xKxB0tOEQxLXAlfXJViDu5UvZVQ8dKG+SEfrzI5Ph3aG3RIpkNOoCamMyD6a1Ka6" + "\n" +
|
||||
"7+WcLi8JckR8ACScMihPzCS1gS8NuuNcSwIyeL9PVDOSu+LgY17Mw5NQojEjrBLb" + "\n" +
|
||||
"hmCb+tChiDudDFAyubY/HI1Hyt1cxo9iC5n+3P1iEjJbXJ1vvDvySaqZl2fppbUy" + "\n" +
|
||||
"qiW3R0I9ooPPwcRAiEtRslpA96tMgfBR5ANWsXSWfn8bbeqvQCMLPhYpdqbxORiy" + "\n" +
|
||||
"LwIDAQAB" + "\n";
|
||||
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
|
||||
|
||||
byte[] privBuffer = Base64.decodeBase64(privateKey);
|
||||
PKCS8EncodedKeySpec privSpec = new PKCS8EncodedKeySpec(privBuffer);
|
||||
PrivateKey privKey = keyFactory.generatePrivate(privSpec);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, privKey);
|
||||
byte[] encrypted = cipher.doFinal("user@example.com\"1422331953".getBytes());
|
||||
|
||||
System.out.println("Encrypted with private key:");
|
||||
System.out.println(Base64.encodeBase64String(encrypted));
|
||||
|
||||
byte[] pubBuffer = Base64.decodeBase64(publicKey);
|
||||
X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(pubBuffer);
|
||||
PublicKey pubKey = keyFactory.generatePublic(pubSpec);
|
||||
cipher.init(Cipher.DECRYPT_MODE, pubKey);
|
||||
byte[] decrypted = cipher.doFinal(encrypted);
|
||||
|
||||
System.out.println("Decrypted with public key:");
|
||||
System.out.println(new String(decrypted));
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
-- 流程类型视图,可用于数据集成或流览按钮
|
||||
create
|
||||
or replace view workflow_type_info_view as
|
||||
or replace view workflow_type_info_view as
|
||||
select wb.id,
|
||||
wb.workflowname,
|
||||
wt.typename,
|
||||
|
@ -11,7 +11,7 @@ from workflow_base wb
|
|||
|
||||
-- 流程表单视图,用于流览按钮或数据集成,配置流程类型表可以用字段联动获取流程表表名
|
||||
create
|
||||
or replace view workflow_table_view as
|
||||
or replace view workflow_table_view as
|
||||
select base.id,
|
||||
base.workflowname,
|
||||
base.formid,
|
||||
|
@ -22,7 +22,7 @@ from workflow_bill bill
|
|||
|
||||
-- 流程明细表信息,可用流程主表查询对应的明细表信息,用于流览框
|
||||
create
|
||||
or replace view workflow_detail_table_view as
|
||||
or replace view workflow_detail_table_view as
|
||||
select CONCAT(bill.id, '-', base.id) id,
|
||||
bill.id bill_id,
|
||||
base.id workflow_id,
|
||||
|
@ -34,7 +34,7 @@ from workflow_billdetailtable bill
|
|||
|
||||
-- 流程和建模字段视图,更具流程和建模的billid可以查询流程和建模中的字段信息
|
||||
create
|
||||
or replace view workflow_field_table_view as
|
||||
or replace view workflow_field_table_view as
|
||||
select wb.id,
|
||||
wb.fieldname,
|
||||
concat(ht.indexdesc, ':', wb.fieldname) indexdesc,
|
||||
|
@ -59,13 +59,14 @@ select wb.id,
|
|||
when wb.FIELDHTMLTYPE = '3' then '流览框'
|
||||
when wb.FIELDHTMLTYPE = '4' then 'check框'
|
||||
when wb.FIELDHTMLTYPE = '5' then '选择框'
|
||||
else '附件上传' end) fieldhtmltype
|
||||
else '附件上传' end) fieldhtmltype,
|
||||
wb.FIELDHTMLTYPE fieldtype
|
||||
from workflow_billfield wb
|
||||
left join htmllabelindex ht on wb.fieldlabel = ht.id;
|
||||
|
||||
-- 建模表信息视图
|
||||
create
|
||||
or replace view mode_bill_info_view as
|
||||
or replace view mode_bill_info_view as
|
||||
select bill.id, bill.tablename, hti.indexdesc
|
||||
from workflow_bill bill
|
||||
left join htmllabelindex hti on hti.id = bill.namelabel
|
||||
|
@ -74,7 +75,7 @@ where bill.id < 0
|
|||
|
||||
-- 流程节点信息视图
|
||||
create
|
||||
or replace view workflow_node_info_view as
|
||||
or replace view workflow_node_info_view as
|
||||
select distinct nb.id,
|
||||
nb.nodename,
|
||||
(case when wb.version is null then 1 else wb.version end) version,
|
||||
|
|
Loading…
Reference in New Issue