fix rs 初始化失败
parent
a4f9ded450
commit
bbcd42e79f
|
@ -692,11 +692,13 @@ $(() => {
|
||||||
// 目标字段
|
// 目标字段
|
||||||
targetField: 'htjsrq',
|
targetField: 'htjsrq',
|
||||||
// 日期加月份字段
|
// 日期加月份字段
|
||||||
numberField: 'contractperiod'
|
numberField: 'contractperiod',
|
||||||
|
monthBase: 12
|
||||||
}, {
|
}, {
|
||||||
sourceField: 'syqksrq',
|
sourceField: 'syqksrq',
|
||||||
targetField: 'syqjsrq',
|
targetField: 'syqjsrq',
|
||||||
numberField: 'probationperiod'
|
numberField: 'probationperiod',
|
||||||
|
monthBase: 1
|
||||||
}]
|
}]
|
||||||
|
|
||||||
runJs();
|
runJs();
|
||||||
|
@ -721,7 +723,8 @@ $(() => {
|
||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
let date = new Date(sourceValue)
|
let date = new Date(sourceValue)
|
||||||
date.setMonth(date.getMonth() + +value)
|
date.setMonth(date.getMonth() + +value * configItem.monthBase)
|
||||||
|
date.setDate(date.getDate() - 1)
|
||||||
let day = date.getDate();
|
let day = date.getDate();
|
||||||
let month = date.getMonth() + 1;
|
let month = date.getMonth() + 1;
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
|
@ -742,3 +745,45 @@ $(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
/* ******************* 计算年月日 end ******************* */
|
/* ******************* 计算年月日 end ******************* */
|
||||||
|
|
||||||
|
|
||||||
|
/* ******************* 年假计算 start ******************* */
|
||||||
|
$(() => {
|
||||||
|
let config = {
|
||||||
|
// 基础年假
|
||||||
|
base: 21,
|
||||||
|
// 入职日期
|
||||||
|
dateField: 'jrbsjjtsj',
|
||||||
|
// 年假
|
||||||
|
targetField: 'nj'
|
||||||
|
}
|
||||||
|
|
||||||
|
runJs()
|
||||||
|
|
||||||
|
function runJs() {
|
||||||
|
WfForm.bindFieldChangeEvent(WfForm.convertFieldNameToId(config.dateField), (obj, id, value) => {
|
||||||
|
let date = new Date(value)
|
||||||
|
let nowDate = new Date()
|
||||||
|
let njValue = calculateBonus(date, nowDate, config)
|
||||||
|
if (value !== 0) {
|
||||||
|
WfForm.changeFieldValue(WfForm.convertFieldNameToId(config.targetField), {value: njValue})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function calculateBonus(startDate, endDate, config) {
|
||||||
|
const diffInMs = endDate.getTime() - startDate.getTime();
|
||||||
|
const diffInYears = diffInMs / (1000 * 60 * 60 * 24 * 365);
|
||||||
|
|
||||||
|
if (diffInYears < 3) {
|
||||||
|
return 0;
|
||||||
|
} else if (diffInYears >= 3 && diffInYears < 6) {
|
||||||
|
return config.base;
|
||||||
|
} else {
|
||||||
|
const extraYears = Math.floor((diffInYears - 3) / 3);
|
||||||
|
return config.base + extraYears * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
/* ******************* 年假计算 end ******************* */
|
|
@ -71,6 +71,7 @@ import java.util.*;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
@ -98,7 +99,7 @@ public class Util extends weaver.general.Util {
|
||||||
public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔
|
public static final char DBC_SBC_STEP = 65248; // 全角半角转换间隔
|
||||||
public static final ExecutorService threadPool = ThreadPoolConfig.createThreadPoolInstance();
|
public static final ExecutorService threadPool = ThreadPoolConfig.createThreadPoolInstance();
|
||||||
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
|
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
|
||||||
private static final UtilService utilService = new UtilService();
|
private static UtilService utilService = null;
|
||||||
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
||||||
private static final RecordsetUtil recordsetTransUtil = new RecordsetUtil();
|
private static final RecordsetUtil recordsetTransUtil = new RecordsetUtil();
|
||||||
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
|
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
|
||||||
|
@ -110,12 +111,20 @@ public class Util extends weaver.general.Util {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
rs = new RecordSet();
|
rs = new RecordSet();
|
||||||
|
utilService = new UtilService();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
new ToolUtil().writeErrorLog("\n初始化RecordSet失败!请检查系统是否正常启动!\n");
|
new ToolUtil().writeErrorLog("\n初始化RecordSet失败!请检查系统是否正常启动!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static UtilService getUtilService() {
|
||||||
|
if (utilService == null) {
|
||||||
|
return new UtilService();
|
||||||
|
}
|
||||||
|
return utilService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定格式的当前时间
|
* 获取指定格式的当前时间
|
||||||
*
|
*
|
||||||
|
@ -1582,12 +1591,12 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
public static ApiConfigMainDTO queryApiConfig(String id) {
|
public static ApiConfigMainDTO queryApiConfig(String id) {
|
||||||
// System.out.println(JSON.toJSONString(apiConfigMain));
|
// System.out.println(JSON.toJSONString(apiConfigMain));
|
||||||
return utilService.getApiConfigMain(id);
|
return getUtilService().getApiConfigMain(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ApiConfigMainDTO queryApiConfigTree(String id) {
|
public static ApiConfigMainDTO queryApiConfigTree(String id) {
|
||||||
// System.out.println(JSON.toJSONString(apiConfigMain));
|
// System.out.println(JSON.toJSONString(apiConfigMain));
|
||||||
return utilService.getApiConfigMainTree(id);
|
return getUtilService().getApiConfigMainTree(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> AZipOutputStream createZip(List<T> inputList) throws IOException {
|
public static <T> AZipOutputStream createZip(List<T> inputList) throws IOException {
|
||||||
|
@ -1711,13 +1720,13 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> queryLanguage(int groupId, int languageId) {
|
public static Map<String, String> queryLanguage(int groupId, int languageId) {
|
||||||
return utilService.queryLanguage(groupId, languageId);
|
return getUtilService().queryLanguage(groupId, languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, String> queryLanguage(int groupId, HttpServletRequest request, HttpServletResponse response) {
|
public static Map<String, String> queryLanguage(int groupId, HttpServletRequest request, HttpServletResponse response) {
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
int languageId = user.getLanguage();
|
int languageId = user.getLanguage();
|
||||||
return utilService.queryLanguage(groupId, languageId);
|
return getUtilService().queryLanguage(groupId, languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2920,6 +2929,17 @@ public class Util extends weaver.general.Util {
|
||||||
submitWorkflowThread(requestId, userId, remark, 60);
|
submitWorkflowThread(requestId, userId, remark, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>异步提交流程,一般作用于action在节点前</h2>
|
||||||
|
*
|
||||||
|
* @param requestId 流程ID
|
||||||
|
* @param userId 用户id
|
||||||
|
* @param remark 签字意见
|
||||||
|
*/
|
||||||
|
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, Consumer<Boolean> callback) {
|
||||||
|
submitWorkflowThread(requestId, userId, remark, 60, callback);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>异步提交流程,一般作用于action在节点前</h2>
|
* <h2>异步提交流程,一般作用于action在节点前</h2>
|
||||||
*
|
*
|
||||||
|
@ -2929,6 +2949,10 @@ public class Util extends weaver.general.Util {
|
||||||
* @param seconds 延时多少秒提交
|
* @param seconds 延时多少秒提交
|
||||||
*/
|
*/
|
||||||
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, int seconds) {
|
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, int seconds) {
|
||||||
|
submitWorkflowThread(requestId, userId, remark, seconds, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void submitWorkflowThread(Integer requestId, Integer userId, String remark, int seconds, Consumer<Boolean> callback) {
|
||||||
if (seconds <= 0) {
|
if (seconds <= 0) {
|
||||||
seconds = 1;
|
seconds = 1;
|
||||||
}
|
}
|
||||||
|
@ -2941,7 +2965,9 @@ public class Util extends weaver.general.Util {
|
||||||
Util.getLogger().error("线程休眠失败", e);
|
Util.getLogger().error("线程休眠失败", e);
|
||||||
}
|
}
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
while (!Util.submitWorkflow(requestId, userId, remark)) {
|
while (!Util.submitWorkflow(requestId, userId, remark)) {
|
||||||
|
log.info("异步提交流程失败,正在进行重试!!");
|
||||||
n++;
|
n++;
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000 * 10);
|
Thread.sleep(1000 * 10);
|
||||||
|
@ -2949,10 +2975,17 @@ public class Util extends weaver.general.Util {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (n > 5) {
|
if (n > 5) {
|
||||||
|
if (callback != null) {
|
||||||
|
callback.accept(false);
|
||||||
|
}
|
||||||
Util.getLogger().error("异步流程自动提交失败!");
|
Util.getLogger().error("异步流程自动提交失败!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("异步提交流程成功!");
|
||||||
|
if (callback != null) {
|
||||||
|
callback.accept(true);
|
||||||
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4020,8 +4053,8 @@ public class Util extends weaver.general.Util {
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createTempFile(InputStream inputStream, String imageFileName) {
|
public static String createTempFile(InputStream inputStream, String imageFileName, String tempDir) {
|
||||||
String filePath = getTempFilePath("ofd", imageFileName);
|
String filePath = getTempFilePath(tempDir, imageFileName);
|
||||||
try {
|
try {
|
||||||
writeToFile(inputStream, filePath);
|
writeToFile(inputStream, filePath);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -14,4 +14,6 @@ import java.lang.annotation.*;
|
||||||
@Documented
|
@Documented
|
||||||
public @interface CollectionMethod {
|
public @interface CollectionMethod {
|
||||||
int value();
|
int value();
|
||||||
|
|
||||||
|
String desc() default "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ public class UtilDao {
|
||||||
|
|
||||||
public List<ApiConfigDetailDTO> getApiConfigDetail(int mainId) {
|
public List<ApiConfigDetailDTO> getApiConfigDetail(int mainId) {
|
||||||
String query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " +
|
String 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.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql " +
|
||||||
"from uf_api_param_config_dt1 dt " +
|
"from uf_api_param_config_dt1 dt " +
|
||||||
"left join workflow_field_table_view wf on wf.id = dt.workflow_field " +
|
"left join workflow_field_table_view wf on wf.id = dt.workflow_field " +
|
||||||
"where mainid = ? and (are_use is null or are_use = 1)";
|
"where mainid = ? and (are_use is null or are_use = 1)";
|
||||||
rs.executeQuery(query, mainId);
|
rs.executeQuery(query, mainId);
|
||||||
return Util.recordeSet2Array(rs, ApiConfigDetailDTO.class, true);
|
return Util.recordeSet2Array(rs, ApiConfigDetailDTO.class, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,56 +20,56 @@ import java.util.List;
|
||||||
public interface OrgChartMapper {
|
public interface OrgChartMapper {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询所有的在职状态人员</h2>
|
* <h2>查询所有的在职状态人员</h2>
|
||||||
* <i>2022/12/5 11:05</i>
|
* <i>2022/12/5 11:05</i>
|
||||||
* ******************************************
|
* ******************************************
|
||||||
*
|
*
|
||||||
* @param typeOfEmploymentField 人员自定义字段
|
* @param typeOfEmploymentField 人员自定义字段
|
||||||
* @return List<HrmResource> 返回的人员信息
|
* @return List<HrmResource> 返回的人员信息
|
||||||
* @author youHong.ai ******************************************
|
* @author youHong.ai ******************************************
|
||||||
*/
|
*/
|
||||||
@Select("select hrm.id, " +
|
@Select("select hrm.id, " +
|
||||||
" hrm.subcompanyid1 sub_company_id," +
|
" hrm.subcompanyid1 sub_company_id," +
|
||||||
" hrm.messagerurl avatar," +
|
" hrm.messagerurl avatar," +
|
||||||
" (case when cus.$t{lastNameEnField} is null then hrm.lastname " +
|
" (case when cus.$t{lastNameEnField} is null then hrm.lastname " +
|
||||||
" else cus.$t{lastNameEnField} end) last_name, " +
|
" else cus.$t{lastNameEnField} end) last_name, " +
|
||||||
" hrm.managerstr manager_str, " +
|
" hrm.managerstr manager_str, " +
|
||||||
" hrm.jobtitle job_title_id, " +
|
" hrm.jobtitle job_title_id, " +
|
||||||
" hrm.managerid manager_id, " +
|
" hrm.managerid manager_id, " +
|
||||||
" hrm.departmentid department_id, " +
|
" hrm.departmentid department_id, " +
|
||||||
" dept.DEPARTMENTNAME department_name, " +
|
" dept.DEPARTMENTNAME department_name, " +
|
||||||
" job.JOBTITLENAME job_title_name, " +
|
" job.JOBTITLENAME job_title_name, " +
|
||||||
" uftb.$t{parentField} type_of_employment " +
|
" uftb.$t{parentField} type_of_employment " +
|
||||||
"from hrmresource hrm " +
|
"from hrmresource hrm " +
|
||||||
" inner join hrmjobtitles job on hrm.JOBTITLE = job.id " +
|
" left join hrmjobtitles job on hrm.JOBTITLE = job.id " +
|
||||||
" inner join cus_fielddata cus on cus.ID = hrm.ID " +
|
" left join cus_fielddata cus on cus.ID = hrm.ID " +
|
||||||
" and cus.SCOPE = 'HrmCustomFieldByInfoType' " +
|
" and cus.SCOPE = 'HrmCustomFieldByInfoType' " +
|
||||||
" and cus.SCOPEID = 1 " +
|
" and cus.SCOPEID = 1 " +
|
||||||
" inner join cus_fielddata cus1 on cus1.id = hrm.id" +
|
" left join cus_fielddata cus1 on cus1.id = hrm.id" +
|
||||||
" and cus1.scope = 'HrmCustomFieldByInfoType' " +
|
" and cus1.scope = 'HrmCustomFieldByInfoType' " +
|
||||||
" and cus1.scopeid = -1" +
|
" and cus1.scopeid = -1" +
|
||||||
" inner join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " +
|
" left join hrmdepartment dept on dept.id = hrm.DEPARTMENTID " +
|
||||||
" inner join $t{typeOfEmploymentTable} uftb on uftb.$t{typeOfEmploymentIdField} = cus1.$t{typeOfEmploymentFiled} " +
|
" left join $t{typeOfEmploymentTable} uftb on uftb.$t{typeOfEmploymentIdField} = cus1.$t{typeOfEmploymentFiled} " +
|
||||||
"where hrm.status in (0, 1)")
|
"where hrm.status in (0, 1)")
|
||||||
List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField,
|
List<HrmResource> selectAll(@ParamMapper("typeOfEmploymentFiled") String typeOfEmploymentField,
|
||||||
@ParamMapper("lastNameEnField") String lastNameEnField,
|
@ParamMapper("lastNameEnField") String lastNameEnField,
|
||||||
@ParamMapper("typeOfEmploymentTable") String typeOfEmploymentTable,
|
@ParamMapper("typeOfEmploymentTable") String typeOfEmploymentTable,
|
||||||
@ParamMapper("parentField") String parentField,
|
@ParamMapper("parentField") String parentField,
|
||||||
@ParamMapper("typeOfEmploymentIdField") String typeOfEmploymentIdField);
|
@ParamMapper("typeOfEmploymentIdField") String typeOfEmploymentIdField);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询当前人员配置信息,是否全部展开,是否显示小红点点</h2>
|
* <h2>查询当前人员配置信息,是否全部展开,是否显示小红点点</h2>
|
||||||
* <i>2022/12/5 11:51</i>
|
* <i>2022/12/5 11:51</i>
|
||||||
* ******************************************
|
* ******************************************
|
||||||
*
|
*
|
||||||
* @param userId 当前用户id
|
* @param userId 当前用户id
|
||||||
* @return ShowPointOrAll 展示与否的人员信息
|
* @return ShowPointOrAll 展示与否的人员信息
|
||||||
* @author youHong.ai ******************************************
|
* @author youHong.ai ******************************************
|
||||||
*/
|
*/
|
||||||
@Select("select id,resources,show_all,show_type from uf_show_point_or_all " +
|
@Select("select id,resources,show_all,show_type from uf_show_point_or_all " +
|
||||||
"where concat(',',resources,',') like concat('%,',#{userId},',%')")
|
"where concat(',',resources,',') like concat('%,',#{userId},',%')")
|
||||||
ShowPointOrAll selectShowPointOrAll(@ParamMapper("userId") int userId);
|
ShowPointOrAll selectShowPointOrAll(@ParamMapper("userId") int userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,8 @@ public class SsoYunZhaoService {
|
||||||
Method method = User.class.getMethod(userCodeMethod);
|
Method method = User.class.getMethod(userCodeMethod);
|
||||||
String value = Util.null2String(method.invoke(user));
|
String value = Util.null2String(method.invoke(user));
|
||||||
long currentTime = System.currentTimeMillis();
|
long currentTime = System.currentTimeMillis();
|
||||||
String token = this.rsaEncryptedUserInfo(value + "\"" + String.valueOf(currentTime).substring(0, 10));
|
String str = value + "\"" + String.valueOf(currentTime).substring(0, 10);
|
||||||
|
String token = this.rsaEncryptedUserInfo(str);
|
||||||
String yunZhaoSsoPathUrl = Util.getCusConfigValue("YunZhaoSSOPathURL");
|
String yunZhaoSsoPathUrl = Util.getCusConfigValue("YunZhaoSSOPathURL");
|
||||||
Assert.notEmpty(yunZhaoSsoPathUrl, "can not find [YunZhaoSSOPathURL] from table [uf_cus_dev_config]");
|
Assert.notEmpty(yunZhaoSsoPathUrl, "can not find [YunZhaoSSOPathURL] from table [uf_cus_dev_config]");
|
||||||
return yunZhaoSsoPathUrl + URLEncoder.encode(token, "UTF-8");
|
return yunZhaoSsoPathUrl + URLEncoder.encode(token, "UTF-8");
|
||||||
|
|
|
@ -495,7 +495,7 @@ public class OpenTheBillService {
|
||||||
// 内部领用
|
// 内部领用
|
||||||
// orderUse + " " + shipTo + " " + costCenter + " " + sku
|
// orderUse + " " + shipTo + " " + costCenter + " " + sku
|
||||||
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " CostCenter:" + costCenter + " sku:" + sku;
|
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " CostCenter:" + costCenter + " sku:" + sku;
|
||||||
condition = orderUse + " :" + shipTo + ":" + costCenter + ":" + sku;
|
condition = "订单用途:" + orderUse + "、" + "shipTo:" + shipTo + "、" + "CostCenter:" + costCenter + "、" + "sku:" + sku;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "1":
|
case "1":
|
||||||
|
@ -504,7 +504,7 @@ public class OpenTheBillService {
|
||||||
// 第三方 + 柜台订单
|
// 第三方 + 柜台订单
|
||||||
// orderUse + ":" + shipTo + ":" + sku
|
// orderUse + ":" + shipTo + ":" + sku
|
||||||
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " sku:" + sku + " 订单分类:" + orderType;
|
// condition = "订单用途:" + orderUse + " " + "ShipTo:" + shipTo + " sku:" + sku + " 订单分类:" + orderType;
|
||||||
condition = orderUse + ":" + shipTo + ":" + sku + ":" + orderType;
|
condition = "订单用途:" + orderUse + "、" + "shipTo:" + shipTo + "、" + "sku:" + sku + "、" + "订单分类:" + orderType;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestEntity;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataConfig;
|
||||||
|
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
|
||||||
|
import com.engine.core.impl.aop.AbstractServiceProxy;
|
||||||
|
import com.engine.workflow.service.SubRequestService;
|
||||||
|
import com.engine.workflow.service.impl.SubRequestServiceImpl;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.workflow.request.DiffWfTriggerSetting;
|
||||||
|
import weaver.workflow.request.SameWfTriggerSetting;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>触发子流程</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 22:52</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@ServiceDynamicProxy(target = SubRequestServiceImpl.class, desc = "拦截签字意见信息,是否需要隐私控制")
|
||||||
|
public class TriSubRequestAfterInterceptImpl extends AbstractServiceProxy implements SubRequestService {
|
||||||
|
|
||||||
|
private final TriSubRequestAfterMapper mapper = Util.getMapper(TriSubRequestAfterMapper.class);
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void triSameSubRequestBefore(int i, List<SameWfTriggerSetting> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void triDiffSubRequestBefore(int i, List<DiffWfTriggerSetting> list) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void triSubRequestAfter(int i) {
|
||||||
|
List<SubRequestEntity> subRequestEntities = mapper.selectSubRequestByMainRequest(i);
|
||||||
|
if (CollectionUtil.isEmpty(subRequestEntities)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<SubRequestToDataConfig> subRequestToDataConfigs = mapper.selectConfig();
|
||||||
|
if (CollectionUtil.isEmpty(subRequestToDataConfigs)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, SubRequestToDataConfig> collect = subRequestToDataConfigs
|
||||||
|
.stream()
|
||||||
|
.collect(
|
||||||
|
Collectors.toMap(
|
||||||
|
SubRequestToDataConfig::getWorkflowType,
|
||||||
|
value -> value
|
||||||
|
));
|
||||||
|
|
||||||
|
for (SubRequestEntity subRequestEntity : subRequestEntities) {
|
||||||
|
// 查询流程对应的配置信息
|
||||||
|
String workflowId = subRequestEntity.getWorkflowId();
|
||||||
|
SubRequestToDataConfig subRequestToDataConfig = collect.get(workflowId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestEntity;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataConfig;
|
||||||
|
import com.customization.youhong.taibao.trisubreq.impl.entity.SubRequestToDataMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>sql查询</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 23:09</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface TriSubRequestAfterMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询子流程信息</h2>
|
||||||
|
*
|
||||||
|
* @param mainRequestId 主流程信息
|
||||||
|
* @return 子流程信息
|
||||||
|
*/
|
||||||
|
@Select("select requestid request_id,workflowid workflow_id from " +
|
||||||
|
"workflow_requestbase where mainrequestid = #{mainRequestId}")
|
||||||
|
List<SubRequestEntity> selectSubRequestByMainRequest(@ParamMapper("mainRequestId") Integer mainRequestId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询配置表信息</h2>
|
||||||
|
*
|
||||||
|
* @return 配置表信息
|
||||||
|
*/
|
||||||
|
@Select("select * from uf_sub_wf_to_mode")
|
||||||
|
@Associations({
|
||||||
|
@Association(
|
||||||
|
property = "modelTableName",
|
||||||
|
column = "model_table",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectModelTableInfo",
|
||||||
|
id = @Id(value = Integer.class)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
@CollectionMappings({
|
||||||
|
@CollectionMapping(
|
||||||
|
property = "mappings",
|
||||||
|
column = "id",
|
||||||
|
id = @Id(value = String.class, methodId = 1)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
List<SubRequestToDataConfig> selectConfig();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询配置表明细信息</h2>
|
||||||
|
*
|
||||||
|
* @param mainId 主表id
|
||||||
|
* @return 明细数据
|
||||||
|
*/
|
||||||
|
@CollectionMethod(value = 1, desc = "查询配置表明细信息")
|
||||||
|
@Select("select * from uf_sub_wf_to_mode_dt1 where mainid = #{mainId}")
|
||||||
|
@Associations({
|
||||||
|
@Association(
|
||||||
|
property = "modelField",
|
||||||
|
column = "model_field",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
|
||||||
|
id = @Id(value = Integer.class)
|
||||||
|
),
|
||||||
|
@Association(
|
||||||
|
property = "workflowField",
|
||||||
|
column = "workflow_field",
|
||||||
|
select = "aiyh.utils.mapper.UtilMapper.selectFieldInfo",
|
||||||
|
id = @Id(value = Integer.class)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
List<SubRequestToDataMapping> selectConfigDt(String mainId);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>子流程实体类</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 23:13</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class SubRequestEntity {
|
||||||
|
@SqlOracleDbFieldAnn("REQUEST_ID")
|
||||||
|
private String requestId;
|
||||||
|
@SqlOracleDbFieldAnn("WORKFLOW_ID")
|
||||||
|
private String workflowId;
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.entity.ModelTableInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>配置表实体类</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 10:31</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class SubRequestToDataConfig {
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/** 流程 */
|
||||||
|
private String workflowType;
|
||||||
|
/** 建模 */
|
||||||
|
private String modelTable;
|
||||||
|
/** 更新条件 */
|
||||||
|
private String conditionUpdate;
|
||||||
|
|
||||||
|
/** 建模表 */
|
||||||
|
private ModelTableInfo modelTableName;
|
||||||
|
|
||||||
|
private List<SubRequestToDataMapping> mappings;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.customization.youhong.taibao.trisubreq.impl.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
||||||
|
import aiyh.utils.entity.FieldViewInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>字段映射</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 10:37</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
public class SubRequestToDataMapping {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@SqlDbFieldAnn("mainid")
|
||||||
|
private Integer mainId;
|
||||||
|
|
||||||
|
/** 建模字段 */
|
||||||
|
private FieldViewInfo modelField;
|
||||||
|
/** 流程字段 */
|
||||||
|
private FieldViewInfo workflowField;
|
||||||
|
}
|
|
@ -687,7 +687,9 @@ public class DealWithMapping extends ToolUtil {
|
||||||
// 数据id
|
// 数据id
|
||||||
case MAIN_DATA_ID: {
|
case MAIN_DATA_ID: {
|
||||||
if ("1".equals(childSource)) {
|
if ("1".equals(childSource)) {
|
||||||
value = Util.null2String(detailMap.get("id"));
|
if (Objects.nonNull(detailMap)) {
|
||||||
|
value = Util.null2String(detailMap.get("id"));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
value = Util.null2String(mainMap.get("id"));
|
value = Util.null2String(mainMap.get("id"));
|
||||||
}
|
}
|
||||||
|
@ -1006,7 +1008,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
} else if ("0".equals(childSource)) {
|
} else if ("0".equals(childSource)) {
|
||||||
tempValue = Util.null2String(mainMap.get(fieldName));
|
tempValue = Util.null2String(mainMap.get(fieldName));
|
||||||
if ("".equals(tempValue)) {
|
if ("".equals(tempValue)) {
|
||||||
tempValue = Util.null2String(detailMap.get(fieldNameLower));
|
tempValue = Util.null2String(mainMap.get(fieldNameLower));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tempValue = Util.null2String(relationRs.getString(fieldName));
|
tempValue = Util.null2String(relationRs.getString(fieldName));
|
||||||
|
@ -1067,7 +1069,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
} else {
|
} else {
|
||||||
value = Util.null2String(mainMap.get(fieldName));
|
value = Util.null2String(mainMap.get(fieldName));
|
||||||
if ("".equals(value)) {
|
if ("".equals(value)) {
|
||||||
value = Util.null2String(detailMap.get(fieldNameLower));
|
value = Util.null2String(mainMap.get(fieldNameLower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String fileIds = Util.null2String(value);
|
String fileIds = Util.null2String(value);
|
||||||
|
@ -1107,7 +1109,7 @@ public class DealWithMapping extends ToolUtil {
|
||||||
} else {
|
} else {
|
||||||
value = Util.null2String(mainMap.get(fieldName));
|
value = Util.null2String(mainMap.get(fieldName));
|
||||||
if ("".equals(value)) {
|
if ("".equals(value)) {
|
||||||
value = Util.null2String(detailMap.get(fieldNameLower));
|
value = Util.null2String(mainMap.get(fieldNameLower));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,7 @@ package weaver.youhong.ai.geerde.action.submitfirst;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.action.SafeCusBaseAction;
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
import aiyh.utils.annotation.ActionDesc;
|
import aiyh.utils.annotation.*;
|
||||||
import aiyh.utils.annotation.ActionOptionalParam;
|
|
||||||
import aiyh.utils.annotation.PrintParamMark;
|
|
||||||
import aiyh.utils.annotation.RequiredMark;
|
|
||||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
@ -14,7 +11,10 @@ import weaver.hrm.User;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.youhong.ai.geerde.action.submitfirst.mapper.AutoSubmitFirstMapper;
|
import weaver.youhong.ai.geerde.action.submitfirst.mapper.AutoSubmitFirstMapper;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>自动提交第一次经过节点的流程</h1>
|
* <h1>自动提交第一次经过节点的流程</h1>
|
||||||
|
@ -33,29 +33,92 @@ public class AutoSubmitFirstAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
@RequiredMark(value = "account", desc = "主表流程经过标识字段,整数或单行文本字段名都可以")
|
@RequiredMark(value = "account", desc = "主表流程经过标识字段,整数或单行文本字段名都可以")
|
||||||
@PrintParamMark
|
@PrintParamMark
|
||||||
|
@ActionDefaultTestValue("account")
|
||||||
private String accountField;
|
private String accountField;
|
||||||
|
|
||||||
@ActionOptionalParam(value = "1", desc = "流程操作人id,默认为1-系统管理员")
|
@ActionOptionalParam(value = "1", desc = "流程操作人id,默认为1-系统管理员")
|
||||||
@PrintParamMark
|
@PrintParamMark
|
||||||
private String operator = "1";
|
private String operator = "1";
|
||||||
|
|
||||||
@Override
|
private static final Map<String, Integer> oneRequestLock = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("all")
|
||||||
public void doSubmit(String requestId, String billTable,
|
public void doSubmit(String requestId, String billTable,
|
||||||
int workflowId, User user,
|
int workflowId, User user,
|
||||||
RequestInfo requestInfo) {
|
RequestInfo requestInfo) {
|
||||||
|
// 如果存在当前流程id的值,表示当前action属于锁住状态,需要进入线程睡眠等待
|
||||||
|
if (oneRequestLock.containsKey(requestId)) {
|
||||||
|
log.info("流程正在异步提交中,使用线程排队");
|
||||||
|
new Thread(() -> {
|
||||||
|
log.info("开始异步等待上一个节点提交");
|
||||||
|
while (oneRequestLock.containsKey(requestId)) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000L * 60 * oneRequestLock.get(requestId));
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
log.error("线程休眠失败!");
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("开始提交流程!");
|
||||||
|
oneRequestLock.put(requestId, 2);
|
||||||
|
Map<String, Object> mainMap = mapper.selectMainMap(billTable, requestId);
|
||||||
|
String currentNode = mapper.selectCurrentNodeId(requestId);
|
||||||
|
if (mainMap.containsKey(accountField)) {
|
||||||
|
String mark = Util.null2String(mainMap.get(accountField));
|
||||||
|
String nodesStr = currentNode;
|
||||||
|
if (StrUtil.isNotBlank(mark)) {
|
||||||
|
String[] split = mark.split(",");
|
||||||
|
List<String> nodes = Arrays.asList(split);
|
||||||
|
if (nodes.contains(currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodesStr += "," + Util.join(nodes, ",");
|
||||||
|
}
|
||||||
|
int creatorId = requestInfo.getRequestManager().getCreater();
|
||||||
|
String finalNodesStr = nodesStr;
|
||||||
|
Util.submitWorkflowThread(Integer.parseInt(requestId), creatorId,
|
||||||
|
"", 60, flag -> {
|
||||||
|
oneRequestLock.remove(requestId);
|
||||||
|
if (flag) {
|
||||||
|
mapper.updateMark(billTable, accountField, finalNodesStr,
|
||||||
|
Util.null2String(mainMap.get("id")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果没有锁住,异步延时提交,延时3分钟
|
||||||
|
log.info("没有锁住流程,开始异步提交流程");
|
||||||
|
oneRequestLock.put(requestId, 2);
|
||||||
Map<String, String> mainTableValue = getMainTableValue(requestInfo);
|
Map<String, String> mainTableValue = getMainTableValue(requestInfo);
|
||||||
log.info("do submit action!");
|
String currentNode = mapper.selectCurrentNodeId(requestId);
|
||||||
|
int creatorId = requestInfo.getRequestManager().getCreater();
|
||||||
|
// 判断是否存在统计字段
|
||||||
if (mainTableValue.containsKey(accountField)) {
|
if (mainTableValue.containsKey(accountField)) {
|
||||||
if (StrUtil.isNotBlank(mainTableValue.get(accountField))) {
|
// 获取统计字段的值
|
||||||
return;
|
String mark = mainTableValue.get(accountField);
|
||||||
|
String nodesStr = currentNode;
|
||||||
|
if (StrUtil.isNotBlank(mark)) {
|
||||||
|
String[] split = mark.split(",");
|
||||||
|
List<String> nodes = Arrays.asList(split);
|
||||||
|
if (nodes.contains(currentNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nodesStr += "," + Util.join(nodes, ",");
|
||||||
}
|
}
|
||||||
String creatorId = requestInfo.getCreatorid();
|
String finalNodesStr = nodesStr;
|
||||||
mapper.updateMark(billTable, accountField, "1",
|
Util.submitWorkflowThread(Integer.parseInt(requestId), creatorId,
|
||||||
mainTableValue.get("id"));
|
"", 60, flag -> {
|
||||||
Util.submitWorkflowThread(Integer.parseInt(requestId), Integer.parseInt(creatorId),
|
oneRequestLock.remove(requestId);
|
||||||
"");
|
if (flag) {
|
||||||
|
log.info("异步提交流程完成!");
|
||||||
|
// 提交成功,更新标识
|
||||||
|
mapper.updateMark(billTable, accountField, finalNodesStr,
|
||||||
|
mainTableValue.get("id"));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package weaver.youhong.ai.geerde.action.submitfirst.mapper;
|
package weaver.youhong.ai.geerde.action.submitfirst.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.ParamMapper;
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
import aiyh.utils.annotation.recordset.Update;
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>自动提交流程标识更新</h1>
|
* <h1>自动提交流程标识更新</h1>
|
||||||
*
|
*
|
||||||
|
@ -19,4 +22,12 @@ public interface AutoSubmitFirstMapper {
|
||||||
@ParamMapper("fieldName") String fieldName,
|
@ParamMapper("fieldName") String fieldName,
|
||||||
@ParamMapper("value") String value,
|
@ParamMapper("value") String value,
|
||||||
@ParamMapper("id") String id);
|
@ParamMapper("id") String id);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select * from $t{tableName} where requestid = #{requestId}")
|
||||||
|
Map<String, Object> selectMainMap(@ParamMapper("tableName") String tableName, @ParamMapper("requestId") String requestId);
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select currentnodeid from workflow_requestbase where requestid = #{requestId}")
|
||||||
|
String selectCurrentNodeId(@ParamMapper("requestId") String requestId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,10 @@ import javax.ws.rs.core.MediaType;
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>知识产权局ca电子签</h1>
|
* <h1>知识产权局ca电子签</h1>
|
||||||
|
@ -88,6 +90,10 @@ public class CaElectronicSignatureAction extends SafeCusBaseAction {
|
||||||
}
|
}
|
||||||
Map<String, Object> responseMap = responeVo.getResponseMap();
|
Map<String, Object> responseMap = responeVo.getResponseMap();
|
||||||
Map<String, Object> data = (Map<String, Object>) responseMap.get("data");
|
Map<String, Object> data = (Map<String, Object>) responseMap.get("data");
|
||||||
|
if (Objects.isNull(data)) {
|
||||||
|
Util.actionFail(requestInfo.getRequestManager(), URLDecoder.decode(Util.null2String(responseMap.get("ret_msg")), "UTF-8"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
String documentNo = Util.null2String(data.get("document_no"));
|
String documentNo = Util.null2String(data.get("document_no"));
|
||||||
String pdf = Util.null2String(data.get("ofd"));
|
String pdf = Util.null2String(data.get("ofd"));
|
||||||
InputStream inputStream = base64ContentToFile(pdf);
|
InputStream inputStream = base64ContentToFile(pdf);
|
||||||
|
|
|
@ -10,6 +10,8 @@ import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
|
||||||
import weaver.youhong.ai.intellectualproperty.util.OFDReader;
|
import weaver.youhong.ai.intellectualproperty.util.OFDReader;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -26,26 +28,29 @@ public class GetOfdKeywordPageValue implements CusInterfaceGetValue {
|
||||||
@Override
|
@Override
|
||||||
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
|
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(currentValue);
|
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(currentValue);
|
||||||
InputStream inputStream = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
InputStream inputStream = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
||||||
String filePath = Util.createTempFile(inputStream, docImageInfo.getImageFileName());
|
String filePath = Util.createTempFile(inputStream, docImageInfo.getImageFileName(), "ofd");
|
||||||
String keywordType = pathParam.get("keywordType");
|
String keywordType = pathParam.get("keywordType");
|
||||||
String keywordValue = "";
|
String keywordValue = "";
|
||||||
String keyword = pathParam.get("keyword");
|
String keyword = pathParam.get("keyword");
|
||||||
if (StrUtil.isNotBlank(keywordType)) {
|
if (StrUtil.isNotBlank(keywordType)) {
|
||||||
if ("1".equals(keywordType)) {
|
if ("1".equals(keywordType)) {
|
||||||
keywordValue = Util.null2String(mainMap.get(keyword));
|
keywordValue = Util.null2String(mainMap.get(keyword));
|
||||||
|
} else {
|
||||||
|
keywordValue = keyword;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
keywordValue = keyword;
|
keywordValue = keyword;
|
||||||
}
|
}
|
||||||
OFDReader reader = new OFDReader(filePath, keywordValue);
|
OFDReader reader = new OFDReader(filePath, keywordValue);
|
||||||
List<OFDReader.KeywordInfo> keywordInfos = reader.findKeywords();
|
List<OFDReader.KeywordInfoRange> keywordInfos = reader.findKeywords();
|
||||||
|
Files.delete(Paths.get(filePath));
|
||||||
if (keywordInfos.isEmpty()) {
|
if (keywordInfos.isEmpty()) {
|
||||||
throw new CustomerException("关键字定位异常!未找到关键字");
|
throw new CustomerException("关键字定位异常!未找到关键字");
|
||||||
} else {
|
} else {
|
||||||
return keywordInfos.get(0).getPageNumber();
|
String pageNumber = keywordInfos.get(keywordInfos.size() - 1).getStart().getPageNumber();
|
||||||
|
return Integer.parseInt(pageNumber) + 1;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("关键字定位异常: " + Util.getErrString(e));
|
log.error("关键字定位异常: " + Util.getErrString(e));
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class OFDReader {
|
||||||
this.keyword = keyword;
|
this.keyword = keyword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<KeywordInfo> findKeywords() throws Exception {
|
public List<KeywordInfoRange> findKeywords() throws Exception {
|
||||||
// 解析OFD.xml文件,获取OFD的根目录路径
|
// 解析OFD.xml文件,获取OFD的根目录路径
|
||||||
String rootDirPath = parseOFDXmlAndGetRootDirPath();
|
String rootDirPath = parseOFDXmlAndGetRootDirPath();
|
||||||
if (rootDirPath == null) {
|
if (rootDirPath == null) {
|
||||||
|
@ -41,9 +41,9 @@ public class OFDReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找所有关键字的位置信息
|
// 查找所有关键字的位置信息
|
||||||
List<KeywordInfo> result = new ArrayList<>();
|
List<KeywordInfoRange> result = new ArrayList<>();
|
||||||
for (String pageFolder : pageFolders) {
|
for (String pageFolder : pageFolders) {
|
||||||
KeywordInfo keywordInfo = findKeywordInPage(zipFile, pageFolder);
|
KeywordInfoRange keywordInfo = findKeywordInPage(zipFile, pageFolder);
|
||||||
if (keywordInfo != null) {
|
if (keywordInfo != null) {
|
||||||
result.add(keywordInfo);
|
result.add(keywordInfo);
|
||||||
}
|
}
|
||||||
|
@ -78,10 +78,11 @@ public class OFDReader {
|
||||||
private List<String> getPageFolders(ZipFile zipFile, String rootDirPath) {
|
private List<String> getPageFolders(ZipFile zipFile, String rootDirPath) {
|
||||||
List<String> pageFolders = new ArrayList<>();
|
List<String> pageFolders = new ArrayList<>();
|
||||||
String pagesDirPath = rootDirPath + "/Pages/";
|
String pagesDirPath = rootDirPath + "/Pages/";
|
||||||
|
String pagesPrefix = pagesDirPath + "Page_";
|
||||||
|
String pagesSuffix = "Content.xml";
|
||||||
// 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹
|
// 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹
|
||||||
zipFile.stream().forEach(entry -> {
|
zipFile.stream().forEach(entry -> {
|
||||||
if (entry.getName().startsWith(pagesDirPath) && entry.isDirectory() && !entry.getName().equals(pagesDirPath)) {
|
if (entry.getName().startsWith(pagesDirPath) && entry.getName().startsWith(pagesPrefix) && entry.getName().endsWith(pagesSuffix) && !entry.getName().equals(pagesDirPath)) {
|
||||||
pageFolders.add(entry.getName());
|
pageFolders.add(entry.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -90,33 +91,70 @@ public class OFDReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在指定页面中查找关键字
|
// 在指定页面中查找关键字
|
||||||
private KeywordInfo findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception {
|
private KeywordInfoRange findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception {
|
||||||
ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder + "Content.xml");
|
ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder);
|
||||||
InputStream inputStream = zipFile.getInputStream(contentXmlEntry);
|
InputStream inputStream = zipFile.getInputStream(contentXmlEntry);
|
||||||
|
|
||||||
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
||||||
NodeList textNodes = doc.getElementsByTagName("ofd:TextObject");
|
NodeList textNodes = doc.getElementsByTagName("ofd:TextObject");
|
||||||
|
int startK = 0;
|
||||||
|
List<KeywordInfo> keywordInfos = new ArrayList<>();
|
||||||
for (int i = 0; i < textNodes.getLength(); i++) {
|
for (int i = 0; i < textNodes.getLength(); i++) {
|
||||||
Node textNode = textNodes.item(i);
|
Node textNode = textNodes.item(i);
|
||||||
String textContent = textNode.getTextContent();
|
String textContent = textNode.getTextContent();
|
||||||
|
char[] chars = textContent.toCharArray();
|
||||||
if (textContent.contains(keyword)) {
|
char[] keywordChars = keyword.toCharArray();
|
||||||
Node boundaryNode = textNode.getAttributes().getNamedItem("Boundary");
|
for (int j = 0; j < chars.length; j++) {
|
||||||
String boundary = boundaryNode.getNodeValue();
|
for (int k = startK; k < keywordChars.length; k++) {
|
||||||
String[] boundarySegments = boundary.split(" ");
|
char contentChar = chars[j];
|
||||||
|
char keywordChar = keywordChars[k];
|
||||||
double x = Double.parseDouble(boundarySegments[0]);
|
if (contentChar == keywordChar) {
|
||||||
double y = Double.parseDouble(boundarySegments[1]);
|
j++;
|
||||||
double width = Double.parseDouble(boundarySegments[2]);
|
if (j == chars.length) {
|
||||||
double height = Double.parseDouble(boundarySegments[3]);
|
startK = j;
|
||||||
|
Node boundaryNode = textNode.getAttributes().getNamedItem("Boundary");
|
||||||
KeywordInfo keywordInfo = new KeywordInfo(pageFolder, x, y, width, height);
|
String boundary = boundaryNode.getNodeValue();
|
||||||
return keywordInfo;
|
String[] boundarySegments = boundary.split(" ");
|
||||||
|
double x = Double.parseDouble(boundarySegments[0]);
|
||||||
|
double y = Double.parseDouble(boundarySegments[1]);
|
||||||
|
double width = Double.parseDouble(boundarySegments[2]);
|
||||||
|
double height = Double.parseDouble(boundarySegments[3]);
|
||||||
|
KeywordInfo keywordInfo = new KeywordInfo(pageFolder, x, y, width, height);
|
||||||
|
keywordInfos.add(keywordInfo);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startK = 0;
|
||||||
|
keywordInfos.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
if (keywordInfos.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new KeywordInfoRange(keywordInfos.get(0), keywordInfos.get(keywordInfos.size() - 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class KeywordInfoRange {
|
||||||
|
private final KeywordInfo start;
|
||||||
|
|
||||||
|
private final KeywordInfo end;
|
||||||
|
|
||||||
|
public KeywordInfoRange(KeywordInfo start, KeywordInfo end) {
|
||||||
|
this.start = start;
|
||||||
|
this.end = end;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeywordInfo getStart() {
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeywordInfo getEnd() {
|
||||||
|
return end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class KeywordInfo {
|
public static class KeywordInfo {
|
||||||
|
@ -126,6 +164,7 @@ public class OFDReader {
|
||||||
private final double width;
|
private final double width;
|
||||||
private final double height;
|
private final double height;
|
||||||
|
|
||||||
|
|
||||||
public KeywordInfo(String pageFolder, double x, double y, double width, double height) {
|
public KeywordInfo(String pageFolder, double x, double y, double width, double height) {
|
||||||
this.pageFolder = pageFolder;
|
this.pageFolder = pageFolder;
|
||||||
this.x = x;
|
this.x = x;
|
||||||
|
@ -135,7 +174,7 @@ public class OFDReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPageNumber() {
|
public String getPageNumber() {
|
||||||
int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - 1));
|
int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - "/Content.xml".length()));
|
||||||
return String.valueOf(pageNumber);
|
return String.valueOf(pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,119 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.doctoavatar;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.SafeCusBaseAction;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.IdUtil;
|
||||||
|
import com.weaver.esb.server.cache.ResourceComInfo;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
import weaver.general.GCONST;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>生成头像</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 17:40</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@ActionDesc(value = "生成头像", author = "youhong.ai")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DocToAvatarAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
|
@PrintParamMark
|
||||||
|
@RequiredMark(value = "sctxzp", desc = "上传头像的字段名称")
|
||||||
|
private String iconDocField;
|
||||||
|
|
||||||
|
@RequiredMark(value = "dqyh", desc = "上传头像的字段名称")
|
||||||
|
@PrintParamMark
|
||||||
|
private String userField;
|
||||||
|
|
||||||
|
|
||||||
|
private final DocToAvatarActionMapper mapper = Util.getMapper(DocToAvatarActionMapper.class);
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
|
Map<String, String> mainTable = getMainTableValue(requestInfo);
|
||||||
|
String docIds = "";
|
||||||
|
if (mainTable.containsKey(iconDocField)) {
|
||||||
|
docIds = mainTable.get(iconDocField);
|
||||||
|
}
|
||||||
|
String[] docArr = docIds.split(",");
|
||||||
|
if (docArr.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String avatarDoc = docArr[0];
|
||||||
|
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(avatarDoc);
|
||||||
|
if (Objects.isNull(docImageInfo)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
|
||||||
|
String avatarPath = GCONST.getRootPath();
|
||||||
|
if (avatarPath.endsWith(File.separator)) {
|
||||||
|
avatarPath += File.separator;
|
||||||
|
}
|
||||||
|
String uuid = IdUtil.randomUUID();
|
||||||
|
String imgName = docImageInfo.getImageFileName();
|
||||||
|
int dotIndex = imgName.lastIndexOf(".");
|
||||||
|
if (dotIndex > 0) {
|
||||||
|
String extension = imgName.substring(dotIndex + 1);
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
String imageFileName = "/messager/usericon/" + uuid + "-" + time + "." + extension;
|
||||||
|
avatarPath += "messager" + File.separator + "usericon" + File.separator;
|
||||||
|
File imageFile = new File(avatarPath + uuid + "-" + time + "." + extension);
|
||||||
|
if (!imageFile.getParentFile().exists()) {
|
||||||
|
imageFile.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
OutputStream os = null;
|
||||||
|
try {
|
||||||
|
os = Files.newOutputStream(imageFile.toPath());
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStreamById.read(buffer)) != -1) {
|
||||||
|
os.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.info("写入头像文件失败!" + Util.getErrString(e));
|
||||||
|
throw new CustomerException("头像生成失败!");
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (inputStreamById != null) {
|
||||||
|
inputStreamById.close();
|
||||||
|
}
|
||||||
|
if (os != null) {
|
||||||
|
os.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.info("关闭文件流失败!!" + Util.getErrString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mainTable.containsKey(userField)) {
|
||||||
|
String currentUser = mainTable.get(userField);
|
||||||
|
if (!mapper.updateAvatar(currentUser, imageFileName, docImageInfo.getImageFileId())) {
|
||||||
|
log.info("头像更新失败!sql出错!");
|
||||||
|
} else {
|
||||||
|
ResourceComInfo rsc = new ResourceComInfo();
|
||||||
|
rsc.removeCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package weaver.youhong.ai.pcn.actioin.doctoavatar;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>更新头像</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/29 18:02</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface DocToAvatarActionMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>更新人员头像信息</h2>
|
||||||
|
*
|
||||||
|
* @param currentUser 当前用户
|
||||||
|
* @param avatarImg 更新头像
|
||||||
|
* @return 是否更新成功
|
||||||
|
*/
|
||||||
|
@Update("update hrmresource set messagerurl = #{avatarImg},resourceimageid = #{imageId} where id = #{currentUser}")
|
||||||
|
boolean updateAvatar(@ParamMapper("currentUser") String currentUser,
|
||||||
|
@ParamMapper("avatarImg") String avatarImg,
|
||||||
|
@ParamMapper("imageId") Integer imgId);
|
||||||
|
}
|
|
@ -1 +1 @@
|
||||||
yunzhao.environment=test
|
yunzhao.environment=pro
|
|
@ -15,7 +15,6 @@ import org.h2.util.StringUtils;
|
||||||
import weaver.aiyh_pcn.common_fadada.entity.CreateFileEntity;
|
import weaver.aiyh_pcn.common_fadada.entity.CreateFileEntity;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
@ -36,6 +35,10 @@ public class FaRequestUtils {
|
||||||
private final static Logger log = Util.getLogger();
|
private final static Logger log = Util.getLogger();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
try {
|
try {
|
||||||
String appId = TOOL_UTIL.getSystemParamValue("FDD_appId");
|
String appId = TOOL_UTIL.getSystemParamValue("FDD_appId");
|
||||||
if (StringUtils.isNullOrEmpty(appId)) {
|
if (StringUtils.isNullOrEmpty(appId)) {
|
||||||
|
@ -256,6 +259,7 @@ public class FaRequestUtils {
|
||||||
* @return 构建结果
|
* @return 构建结果
|
||||||
*/
|
*/
|
||||||
private static String builderSign(Object data) {
|
private static String builderSign(Object data) {
|
||||||
|
init();
|
||||||
HEADER.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss"));
|
HEADER.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss"));
|
||||||
HEADER.put("bizContent", builderBizContent(data));
|
HEADER.put("bizContent", builderBizContent(data));
|
||||||
String signStr = "appId=" + HEADER.get("appId") +
|
String signStr = "appId=" + HEADER.get("appId") +
|
||||||
|
@ -319,12 +323,12 @@ public class FaRequestUtils {
|
||||||
log.info("排序后json编码:" + bizContent);
|
log.info("排序后json编码:" + bizContent);
|
||||||
// 将 JSON 字符串内特殊字符进行编码
|
// 将 JSON 字符串内特殊字符进行编码
|
||||||
bizContent = cn.hutool.core.util.URLUtil.encodeAll(bizContent,
|
bizContent = cn.hutool.core.util.URLUtil.encodeAll(bizContent,
|
||||||
Charset.forName("UTF-8"));
|
StandardCharsets.UTF_8);
|
||||||
log.info("bizContent进行JSON编码后URLEncoder编码:" + bizContent);
|
log.info("bizContent进行JSON编码后URLEncoder编码:" + bizContent);
|
||||||
// 将编码后的 JSON 字符串进行 base64 加密
|
// 将编码后的 JSON 字符串进行 base64 加密
|
||||||
bizContent =
|
bizContent =
|
||||||
cn.hutool.core.codec.Base64.encode(cn.hutool.core.util.StrUtil.bytes(bizContent,
|
cn.hutool.core.codec.Base64.encode(cn.hutool.core.util.StrUtil.bytes(bizContent,
|
||||||
Charset.forName("UTF-8")));
|
StandardCharsets.UTF_8));
|
||||||
log.info("bizContent进行JSON编码后URLEncoder编码后进行base64编码:" + bizContent);
|
log.info("bizContent进行JSON编码后URLEncoder编码后进行base64编码:" + bizContent);
|
||||||
return bizContent;
|
return bizContent;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package youhong.ai.geerde;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.youhong.ai.geerde.action.submitfirst.AutoSubmitFirstAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/25 11:21</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class GeerdeTest extends BaseTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAvtion() {
|
||||||
|
Util.actionTest(AutoSubmitFirstAction.class, 522529);
|
||||||
|
Util.actionTest(AutoSubmitFirstAction.class, 522529);
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
Util.submitWorkflow(522524, 1, "");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package youhong.ai.pcn;
|
||||||
|
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.api.youhong.ai.pcn.ssoyunzhao.service.SsoYunZhaoService;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>test</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/5/24 15:22</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class Test01 extends BaseTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testst() throws Exception {
|
||||||
|
SsoYunZhaoService service = new SsoYunZhaoService();
|
||||||
|
String redirectPath = service.getRedirectPath(new User(23));
|
||||||
|
System.out.println(redirectPath);
|
||||||
|
System.out.println(service.rsaDecryptUserInfo("EpPlcAYvNOFfJWHBuvLkWzkTOoEk3NoO95FoRlEJTGlblyBEYV0CQWnCDd4yXDCgcR1yhaig/5NrIZ5dGTTgwZ6f0fOfVDdnFPr5/GUUzxxsW8qpdHLIswFT1O4E57ny1Df6uxPaE5Hqp3QHvGkfUo4ak2mI0D11V7XzxGmVsSqoofdrCVXJIRrTkUHJ3OSxtQtkuxHcc0ivSAtJkWtdgnxRbmCvMMuPKELAq/cxqPfRSAf/sL/SI374DqlYnZDn/BCVA9Ab9TC/9g08QHSlGP+XV/CySecV5Z8bILCTV8bzcgMUznQSTuyIastzMHWLtcJ2zr4gE8jR393vRtAI9A=="));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,7 +12,7 @@ import org.apache.poi.xssf.streaming.SXSSFRow;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import weaver.youhong.ai.geerde.action.submitfirst.AutoSubmitFirstAction;
|
import weaver.youhong.ai.pcn.actioin.doctoavatar.DocToAvatarAction;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
@ -95,7 +95,7 @@ public class GenericTest extends BaseTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGre() {
|
public void testGre() {
|
||||||
GenerateFileUtil.createActionDocument(AutoSubmitFirstAction.class);
|
GenerateFileUtil.createActionDocument(DocToAvatarAction.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,10 +75,12 @@ public class OFDReader {
|
||||||
private List<String> getPageFolders(ZipFile zipFile, String rootDirPath) {
|
private List<String> getPageFolders(ZipFile zipFile, String rootDirPath) {
|
||||||
List<String> pageFolders = new ArrayList<>();
|
List<String> pageFolders = new ArrayList<>();
|
||||||
String pagesDirPath = rootDirPath + "/Pages/";
|
String pagesDirPath = rootDirPath + "/Pages/";
|
||||||
|
String pagesPrefix = pagesDirPath + "Page_";
|
||||||
|
String pagesSuffix = "Content.xml";
|
||||||
|
|
||||||
// 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹
|
// 遍历OFD文件中所有的ZipEntry对象,查找所有页面文件夹
|
||||||
zipFile.stream().forEach(entry -> {
|
zipFile.stream().forEach(entry -> {
|
||||||
if (entry.getName().startsWith(pagesDirPath) && entry.isDirectory() && !entry.getName().equals(pagesDirPath)) {
|
if (entry.getName().startsWith(pagesDirPath) && entry.getName().startsWith(pagesPrefix) && entry.getName().endsWith(pagesSuffix) && !entry.getName().equals(pagesDirPath)) {
|
||||||
pageFolders.add(entry.getName());
|
pageFolders.add(entry.getName());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -88,7 +90,7 @@ public class OFDReader {
|
||||||
|
|
||||||
// 在指定页面中查找关键字
|
// 在指定页面中查找关键字
|
||||||
private KeywordInfo findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception {
|
private KeywordInfo findKeywordInPage(ZipFile zipFile, String pageFolder) throws Exception {
|
||||||
ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder + "Content.xml");
|
ZipEntry contentXmlEntry = zipFile.getEntry(pageFolder);
|
||||||
InputStream inputStream = zipFile.getInputStream(contentXmlEntry);
|
InputStream inputStream = zipFile.getInputStream(contentXmlEntry);
|
||||||
|
|
||||||
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
|
||||||
|
@ -117,8 +119,8 @@ public class OFDReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String filePath = "/Users/aoey.oct.22/Downloads/测试.ofd";
|
String filePath = "/Users/aoey.oct.22/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/44e92f459afe6c0b31d119efb268a257/Message/MessageTemp/65ac172b9cb23c7967462468b4b5be81/File/测试文档01 (1).ofd";
|
||||||
String keyword = "签章位置";
|
String keyword = "签章位置001";
|
||||||
|
|
||||||
OFDReader reader = new OFDReader(filePath, keyword);
|
OFDReader reader = new OFDReader(filePath, keyword);
|
||||||
|
|
||||||
|
@ -154,7 +156,7 @@ public class OFDReader {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPageNumber() {
|
public String getPageNumber() {
|
||||||
int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - 1));
|
int pageNumber = Integer.parseInt(pageFolder.substring(pageFolder.lastIndexOf('_') + 1, pageFolder.length() - "/Content.xml".length()));
|
||||||
return String.valueOf(pageNumber);
|
return String.valueOf(pageNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.api.youhong.ai.zhishichanquan.ssocaiwu.util.AES;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
|
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
|
||||||
import weaver.xiao.commons.config.service.DealWithMapping;
|
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||||
|
import weaver.youhong.ai.intellectualproperty.util.OFDReader;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
@ -32,10 +33,17 @@ public class PDFODFTest extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
public void testOfdKeyword() throws IOException {
|
public void testOfdKeyword() throws IOException {
|
||||||
|
|
||||||
List<PdfPointItem> pointItemList = PdfUtil.findKeywordPoints(Files.newInputStream(Paths.get("/Users/aoey.oct.22/Downloads/测试.ofd")), "签章位置");
|
List<PdfPointItem> pointItemList = PdfUtil.findKeywordPoints(Files.newInputStream(Paths.get("/Users/aoey.oct.22/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/44e92f459afe6c0b31d119efb268a257/Message/MessageTemp/65ac172b9cb23c7967462468b4b5be81/File/测试文档01 (1).ofd")), "签章位置");
|
||||||
System.out.println(JSON.toJSONString(pointItemList));
|
System.out.println(JSON.toJSONString(pointItemList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void tesetOfdKeyWorkdasdf() throws Exception {
|
||||||
|
weaver.youhong.ai.intellectualproperty.util.OFDReader reader = new OFDReader("/Users/aoey.oct.22/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/44e92f459afe6c0b31d119efb268a257/Message/MessageTemp/65ac172b9cb23c7967462468b4b5be81/File/1684915381834-ofd-4e579378-0925-43b3-9f89-89b661772521测试文档01.ofd", "签章位置001");
|
||||||
|
System.out.println(JSON.toJSONString(reader.findKeywords()));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void teest() throws ClassNotFoundException {
|
public void teest() throws ClassNotFoundException {
|
||||||
Map<String, String> stringStringMap = Util.parseCusInterfacePathParam("weaver.youhong.ai.intellectualproperty.cusgetvalue.GetOfdKeywordPageValue?keywordType=0&keyword=电子签章001");
|
Map<String, String> stringStringMap = Util.parseCusInterfacePathParam("weaver.youhong.ai.intellectualproperty.cusgetvalue.GetOfdKeywordPageValue?keywordType=0&keyword=电子签章001");
|
||||||
|
|
Loading…
Reference in New Issue