批量更新问题处理
parent
5ff8e00b79
commit
7f5087a6ee
|
@ -14,6 +14,7 @@ import java.lang.reflect.InvocationHandler;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,7 +65,10 @@ public class RecordsetUtil implements InvocationHandler {
|
||||||
private Object invokeDefault(int type, String sql, boolean custom, RecordSet rs, Method method, Object[] args) {
|
private Object invokeDefault(int type, String sql, boolean custom, RecordSet rs, Method method, Object[] args) {
|
||||||
SqlHandler sqlHandler = new SqlHandler();
|
SqlHandler sqlHandler = new SqlHandler();
|
||||||
ResultMapper resultMapper = new ResultMapper();
|
ResultMapper resultMapper = new ResultMapper();
|
||||||
PrepSqlResultImpl handler = sqlHandler.handler(sql, custom, method, args);
|
PrepSqlResultImpl handler = null;
|
||||||
|
if(Arrays.asList(1,2,3,4).contains(type)){
|
||||||
|
handler = sqlHandler.handler(sql, custom, method, args);
|
||||||
|
}
|
||||||
String invokeMethod = method.getDeclaringClass().getName() + ":" + method.getName() + " : ";
|
String invokeMethod = method.getDeclaringClass().getName() + ":" + method.getName() + " : ";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|
|
@ -2,9 +2,11 @@ package com.api.ebu7dev1.common.getlog.controller;
|
||||||
|
|
||||||
import aiyh.utils.ApiResult;
|
import aiyh.utils.ApiResult;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.api.ebu7dev1.common.getlog.service.GetLogService;
|
import com.api.ebu7dev1.common.getlog.service.GetLogService;
|
||||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.hrm.HrmUserVarify;
|
import weaver.hrm.HrmUserVarify;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
@ -12,13 +14,12 @@ import weaver.interfaces.schedule.IpSelectUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.*;
|
||||||
import javax.ws.rs.POST;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.core.Context;
|
import javax.ws.rs.core.Context;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
import java.io.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -53,6 +54,30 @@ public class GetLogController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/down")
|
||||||
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
public Response downloadZip(@Context HttpServletRequest request,
|
||||||
|
@Context HttpServletResponse response){
|
||||||
|
try {
|
||||||
|
String zipPath = request.getParameter("zipPath");
|
||||||
|
String fileName = request.getParameter("fileName");
|
||||||
|
if(StringUtils.isBlank(zipPath) || StringUtils.isBlank(fileName)){
|
||||||
|
throw new CustomerException("zipPath or fileName can not be null!");
|
||||||
|
}
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
response.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE");
|
||||||
|
response.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
||||||
|
String ecPath = request.getRealPath("/");
|
||||||
|
StreamingOutput output = service.downloadZip(ecPath + File.separator + zipPath);
|
||||||
|
return Response.ok(output, MediaType.APPLICATION_OCTET_STREAM).header("Content-Disposition", "attachment; filename*=UTF-8''" + fileName).build();
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("下载zip文件异常 : ");
|
||||||
|
log.error(Util.getErrString(e));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("get")
|
@Path("get")
|
||||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
|
|
@ -13,8 +13,8 @@ import weaver.hrm.User;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import java.io.File;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static net.qiyuesuo.sdk.bean.template.MimeType.zip;
|
import static net.qiyuesuo.sdk.bean.template.MimeType.zip;
|
||||||
|
@ -78,6 +78,32 @@ public class GetLogService {
|
||||||
return ipList;
|
return ipList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StreamingOutput downloadZip(String zipPath){
|
||||||
|
log.info("压缩文件路径 : [ " + zipPath + " ]");
|
||||||
|
return outputStream -> {
|
||||||
|
FileInputStream inputStream = null;
|
||||||
|
BufferedInputStream bufferedInputStream = null;
|
||||||
|
try {
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int bytesRead;
|
||||||
|
inputStream = new FileInputStream(zipPath);
|
||||||
|
bufferedInputStream = new BufferedInputStream(inputStream);
|
||||||
|
while ((bytesRead = bufferedInputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
}catch (IOException e){
|
||||||
|
throw new IOException(e);
|
||||||
|
}finally {
|
||||||
|
if(bufferedInputStream != null){
|
||||||
|
bufferedInputStream.close();
|
||||||
|
}
|
||||||
|
if(inputStream != null){
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1><收集全部节点日志/h1>
|
* <h1><收集全部节点日志/h1>
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
|
|
|
@ -292,7 +292,8 @@ public class GetLogUtil {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
String innerIp = getInnerIp();
|
String innerIp = getInnerIp();
|
||||||
String zipFile = File.separator + innerIp + "_downLog.zip";
|
String fileName = innerIp + "_downLog.zip";
|
||||||
|
String zipFile = File.separator + fileName;
|
||||||
String outLogPath = outFile + zipFile;
|
String outLogPath = outFile + zipFile;
|
||||||
res = res + zipFile;
|
res = res + zipFile;
|
||||||
fos = new FileOutputStream(outLogPath);
|
fos = new FileOutputStream(outLogPath);
|
||||||
|
@ -332,6 +333,7 @@ public class GetLogUtil {
|
||||||
}
|
}
|
||||||
result.put("ip", innerIp);
|
result.put("ip", innerIp);
|
||||||
result.put("zipPath", res);
|
result.put("zipPath", res);
|
||||||
|
result.put("fileName", fileName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.api.nonstandardext.model_field_async.interfaces.TriFunction;
|
||||||
import com.api.nonstandardext.model_field_async.mapper.ModelFieldAsyncMapper;
|
import com.api.nonstandardext.model_field_async.mapper.ModelFieldAsyncMapper;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.xuanran.wang.eny.data_async.service.convert.CusAsyncConvert;
|
|
||||||
import com.api.nonstandardext.model_field_async.service.convert.CusModelFieldAsyncConvert;
|
import com.api.nonstandardext.model_field_async.service.convert.CusModelFieldAsyncConvert;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -84,8 +83,8 @@ public class EyCusModelFieldValueRuleMethod {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName(cusText);
|
Class<?> clazz = Class.forName(cusText);
|
||||||
if(!CusAsyncConvert.class.isAssignableFrom(clazz)){
|
if(!CusModelFieldAsyncConvert.class.isAssignableFrom(clazz)){
|
||||||
throw new CustomerException(cusText + " not implements getLogFilePath.api.nonstandardext.model_field_async.service.convert");
|
throw new CustomerException(cusText + " not implements com.api.nonstandardext.model_field_async.service.convert.CusModelFieldAsyncConvert");
|
||||||
}
|
}
|
||||||
CusModelFieldAsyncConvert o = (CusModelFieldAsyncConvert) clazz.newInstance();
|
CusModelFieldAsyncConvert o = (CusModelFieldAsyncConvert) clazz.newInstance();
|
||||||
Map<String, String> pathParam = Util.parseCusInterfacePathParam(cusText);
|
Map<String, String> pathParam = Util.parseCusInterfacePathParam(cusText);
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class UserUpdateToMQService {
|
||||||
logger.error(Util.logStr("userId:{}, 生成json为空!",id));
|
logger.error(Util.logStr("userId:{}, 生成json为空!",id));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if("1".equals(debug)){
|
if(!"1".equals(debug)){
|
||||||
logger.info("update user json : \n" + JSONObject.toJSONString(param));
|
logger.info("update user json : \n" + JSONObject.toJSONString(param));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,22 +38,31 @@ public class UpdateHrmInfoAop {
|
||||||
*/
|
*/
|
||||||
@WeaReplaceBefore(value = "/api/hrm/password/changePassword", order = 1, description = "人员信息修改前 进行拦截")
|
@WeaReplaceBefore(value = "/api/hrm/password/changePassword", order = 1, description = "人员信息修改前 进行拦截")
|
||||||
public void passwordUpdateBefore(WeaBeforeReplaceParam weaBeforeReplaceParam) {
|
public void passwordUpdateBefore(WeaBeforeReplaceParam weaBeforeReplaceParam) {
|
||||||
|
try {
|
||||||
Map paramMap = weaBeforeReplaceParam.getParamMap();
|
Map paramMap = weaBeforeReplaceParam.getParamMap();
|
||||||
|
HttpServletRequest request = weaBeforeReplaceParam.getRequest();
|
||||||
String newPassword = Util.null2DefaultStr(paramMap.get("passwordnew"),"");
|
String newPassword = Util.null2DefaultStr(paramMap.get("passwordnew"),"");
|
||||||
if(StringUtils.isBlank(newPassword)){
|
if(StringUtils.isBlank(newPassword)){
|
||||||
Util.getLogger().error("下发队列新密码不能为空!");
|
Util.getLogger().error("下发队列新密码不能为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, String> configMap = getMQConfigMap();
|
if(service == null){
|
||||||
HttpServletRequest request = weaBeforeReplaceParam.getRequest();
|
service = new UserUpdateToMQService();
|
||||||
|
}
|
||||||
HttpServletResponse response = weaBeforeReplaceParam.getResponse();
|
HttpServletResponse response = weaBeforeReplaceParam.getResponse();
|
||||||
User user = HrmUserVarify.getUser(request, response);
|
User user = HrmUserVarify.getUser(request, response);
|
||||||
|
String loginId = user.getLoginid();
|
||||||
|
Map<String, String> configMap = getMQConfigMap();
|
||||||
String oaPassWordOnlyMark = configMap.get("oaPassWordOnlyMark");
|
String oaPassWordOnlyMark = configMap.get("oaPassWordOnlyMark");
|
||||||
String oaPassWordTopicConfigName = configMap.get("oaPassWordTopicConfigName");
|
String oaPassWordTopicConfigName = configMap.get("oaPassWordTopicConfigName");
|
||||||
String decryPassword = RocketConsumerUtil.encryptContent(newPassword);
|
String decryPassword = RocketConsumerUtil.encryptContent(Util.null2DefaultStr(parsePassword(request, newPassword, newPassword, loginId),""));
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("decryPassword", decryPassword);
|
map.put("decryPassword", decryPassword);
|
||||||
service.toMQ(String.valueOf(user.getUID()),oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
|
service.toMQ(String.valueOf(user.getUID()),oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
|
||||||
|
}catch (Exception e){
|
||||||
|
Util.getLogger().error("/api/hrm/password/changePassword 下发队列失败! " + e.getMessage());
|
||||||
|
Util.getLogger().error(Util.getErrString(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,18 +84,22 @@ public class UpdateHrmInfoAop {
|
||||||
Util.getLogger().error("从接口中获取人员id为空!");
|
Util.getLogger().error("从接口中获取人员id为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String password = weaver.general.Util.null2String(request.getParameter("password"));
|
||||||
|
String password1 = weaver.general.Util.null2String(request.getParameter("password1"));
|
||||||
|
String loginId = weaver.general.Util.null2String(request.getParameter("loginid"));
|
||||||
// 解密后的密码
|
// 解密后的密码
|
||||||
String decryPassword = RocketConsumerUtil.encryptContent(Util.null2DefaultStr(parsePassword(request),""));
|
String decryPassword = RocketConsumerUtil.encryptContent(Util.null2DefaultStr(parsePassword(request, password, password1, loginId),""));
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("decryPassword", decryPassword);
|
map.put("decryPassword", decryPassword);
|
||||||
if(StringUtils.isBlank(decryPassword)){
|
if(StringUtils.isBlank(decryPassword)){
|
||||||
Util.getLogger().error("解密之后密码为空!");
|
Util.getLogger().error("解密之后密码为空!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Util.getLogger().info("decryPassword : " + decryPassword);
|
||||||
service.toMQ(id,oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
|
service.toMQ(id,oaPassWordOnlyMark, oaPassWordTopicConfigName, configMap.get("sendMQ"), map);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
Util.getLogger().error("/api/hrm/systeminfo/save 拦截前置接口出错! " + e.getMessage());
|
Util.getLogger().error("/api/hrm/systeminfo/save 拦截前置接口出错! " + e.getMessage());
|
||||||
Util.getErrString(e);
|
Util.getLogger().error(Util.getErrString(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,16 +110,15 @@ public class UpdateHrmInfoAop {
|
||||||
* @param request 请求对象
|
* @param request 请求对象
|
||||||
* @return 解密后的数据
|
* @return 解密后的数据
|
||||||
**/
|
**/
|
||||||
private String parsePassword(HttpServletRequest request){
|
public String parsePassword(HttpServletRequest request, String password, String password1, String loginId){
|
||||||
String password = weaver.general.Util.null2String(request.getParameter("password"));
|
|
||||||
String loginId = weaver.general.Util.null2String(request.getParameter("loginid"));
|
|
||||||
boolean isRsa = "1".equals(Prop.getPropValue("openRSA", "isrsaopen"));
|
boolean isRsa = "1".equals(Prop.getPropValue("openRSA", "isrsaopen"));
|
||||||
ArrayList<String> passwordList = new ArrayList<>();
|
ArrayList<String> passwordList = new ArrayList<>();
|
||||||
if (isRsa) {
|
if (isRsa) {
|
||||||
passwordList.add(password);
|
passwordList.add(password);
|
||||||
|
passwordList.add(password1);
|
||||||
RSA rsa = new RSA();
|
RSA rsa = new RSA();
|
||||||
List list = rsa.decryptList(request, passwordList);
|
List list = rsa.decryptList(request, passwordList);
|
||||||
return Util.null2DefaultStr(list.get(0),"");
|
password = Util.null2DefaultStr(list.get(0),"");
|
||||||
}
|
}
|
||||||
Util.getLogger().info("loginId : [ " + loginId + " ], password : [ " + password + " ]");
|
Util.getLogger().info("loginId : [ " + loginId + " ], password : [ " + password + " ]");
|
||||||
return password;
|
return password;
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
package weaver.xuanran.wang.ajx.work_flow_split.action;
|
||||||
|
|
||||||
|
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.excention.CustomerException;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.xuanran.wang.ajx.work_flow_split.mapper.ChildWorkFlowSplitMapper;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>主流程拆分</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/10 10:46
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@ActionDesc(author = "xuanran.wang", value = "子流程拆分明细")
|
||||||
|
public class ChildWorkFlowSplitAction extends SafeCusBaseAction {
|
||||||
|
|
||||||
|
@RequiredMark(value = "zth", desc = "子流程查询明细帐套号字段名")
|
||||||
|
@PrintParamMark
|
||||||
|
private String selectAccountNumberField;
|
||||||
|
|
||||||
|
@ActionOptionalParam(value = "zth", desc = "插入明细的帐套号字段名 默认与子流程查询明细帐套号字段名一致")
|
||||||
|
@PrintParamMark
|
||||||
|
private String insertAccountNumberField;
|
||||||
|
|
||||||
|
@ActionOptionalParam(value = "0", desc = "查询明细下标 明细1传0, 明细2传1")
|
||||||
|
@PrintParamMark
|
||||||
|
private String selectDetailNo = "0";
|
||||||
|
|
||||||
|
@ActionOptionalParam(value = "2", desc = "插入明细下标 正常传 明细1就传1 明细2就传2")
|
||||||
|
@PrintParamMark
|
||||||
|
private String insertDetailNo = "2";
|
||||||
|
|
||||||
|
@RequiredMark(value = "sfcfzlc", desc = "是否包含多账套字段名")
|
||||||
|
@PrintParamMark
|
||||||
|
private String hasMoreAccountField;
|
||||||
|
|
||||||
|
@RequiredMark(value = "1", desc = "包含多账套字段值 是/否 0:1")
|
||||||
|
@PrintParamMark
|
||||||
|
private String hasMoreAccountFieldValue;
|
||||||
|
|
||||||
|
private final ChildWorkFlowSplitMapper mapper = Util.getMapper(ChildWorkFlowSplitMapper.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
|
try {
|
||||||
|
Map<String, String> mainMap = getMainTableValue(requestInfo);
|
||||||
|
String id = mainMap.get("id");
|
||||||
|
if(StringUtils.isBlank(id)){
|
||||||
|
throw new CustomerException("id is empty!");
|
||||||
|
}
|
||||||
|
// 查明细数据
|
||||||
|
List<Map<String, String>> detailInfo = getDetailTableValueByDetailNo(Util.getIntValue(selectDetailNo,0), requestInfo);
|
||||||
|
if(CollectionUtils.isEmpty(detailInfo)){
|
||||||
|
log.error("detail " + selectDetailNo + " table info is empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> accountNumber = detailInfo.stream().map(item -> item.get(selectAccountNumberField)).collect(Collectors.toSet());
|
||||||
|
if(CollectionUtils.isEmpty(accountNumber) || accountNumber.size() == 1){
|
||||||
|
log.error("明细数据根据帐套号分组后为空, 或不存在多个帐套!");
|
||||||
|
log.info("accountNumber : [ " + JSONObject.toJSONString(accountNumber) + " ]");
|
||||||
|
// 如果不存在多帐套那么将主表数据hasMoreAccountField 更新为null
|
||||||
|
if (!mapper.updateMainTable(billTable, hasMoreAccountField, null, requestId)) {
|
||||||
|
throw new CustomerException("更新主表是否包含多账套字段失败!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!mapper.updateMainTable(billTable, hasMoreAccountField, hasMoreAccountFieldValue, requestId)) {
|
||||||
|
throw new CustomerException("更新主表是否包含多账套字段失败!");
|
||||||
|
}
|
||||||
|
List<Map<String, String>> insertList = accountNumber.stream()
|
||||||
|
.map(item -> {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("mainId", id);
|
||||||
|
map.put("insertAccountNumber", item);
|
||||||
|
return map;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
// 如果插入表的帐套号字段名配置为空 那么与插入表的字段名保持一致
|
||||||
|
if(StringUtils.isBlank(this.insertAccountNumberField)){
|
||||||
|
this.insertAccountNumberField = selectAccountNumberField;
|
||||||
|
}
|
||||||
|
boolean delete = mapper.selectAccountNumber(mainMap.get("id"), billTable + "_dt" + insertDetailNo);
|
||||||
|
if(!delete){
|
||||||
|
throw new CustomerException("删除明细表数据失败!");
|
||||||
|
}
|
||||||
|
if (!mapper.insertDetailTable(billTable + "_dt" + insertDetailNo, this.insertAccountNumberField, insertList)) {
|
||||||
|
throw new CustomerException("批量插入明细数据失败!");
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new CustomerException("子流程明细拆分action执行失败!",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package weaver.xuanran.wang.ajx.work_flow_split.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/10 10:53
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface ChildWorkFlowSplitMapper {
|
||||||
|
/**
|
||||||
|
* <h1>更新主表是否包含多帐套</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/10 11:48
|
||||||
|
* @param tableName 主表表名
|
||||||
|
* @param hasMoreAccountField 是否包含多帐套
|
||||||
|
* @param hasMoreAccountFieldValue 包含多帐套
|
||||||
|
* @param requestId 请求id
|
||||||
|
**/
|
||||||
|
@Update("update $t{tableName} set $t{hasMoreAccountField} = #{hasMoreAccountFieldValue} where requestid = #{requestId}")
|
||||||
|
boolean updateMainTable(@ParamMapper("tableName") String tableName,
|
||||||
|
@ParamMapper("hasMoreAccountField") String hasMoreAccountField,
|
||||||
|
@ParamMapper("hasMoreAccountFieldValue") String hasMoreAccountFieldValue,
|
||||||
|
@ParamMapper("requestId") String requestId);
|
||||||
|
/**
|
||||||
|
* <h1>删除明细表数据</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/10 11:49
|
||||||
|
* @param mainId 主表id
|
||||||
|
* @param detailTableName 明细下标
|
||||||
|
**/
|
||||||
|
@Delete("delete from $t{detailTableName} where mainid = #{mainId}")
|
||||||
|
boolean selectAccountNumber(@ParamMapper("mainId") String mainId,
|
||||||
|
@ParamMapper("detailTableName") String detailTableName);
|
||||||
|
/**
|
||||||
|
* <h1>批量插入</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/10 11:49
|
||||||
|
* @param detailTableNo 明细下标
|
||||||
|
* @param list 数据
|
||||||
|
**/
|
||||||
|
@BatchInsert("insert into $t{detailTableName} (mainid, $t{insertAccountNumberField}) " +
|
||||||
|
"values(#{item.mainId}, #{item.insertAccountNumber})")
|
||||||
|
boolean insertDetailTable(@ParamMapper("detailTableName") String detailTableNo,
|
||||||
|
@ParamMapper("insertAccountNumberField") String insertAccountNumberField,
|
||||||
|
@BatchSqlArgs List<Map<String, String>> list);
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package weaver.xuanran.wang.common.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import weaver.xuanran.wang.common.service.CusDataDecipher;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>自定义请求条件</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/4/6 19:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CusResponseSuccess {
|
||||||
|
private ResponeVo vo;
|
||||||
|
private Object requestParam;
|
||||||
|
private String successField;
|
||||||
|
private Object successValue;
|
||||||
|
private String errorMsg;
|
||||||
|
private String dataKey;
|
||||||
|
private Map<String, Object> response;
|
||||||
|
private CusDataDecipher cusDataDecipher;
|
||||||
|
private String url;
|
||||||
|
private Exception e;
|
||||||
|
private boolean checkResponse = true;
|
||||||
|
private Consumer<Exception> call;
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package weaver.xuanran.wang.common.mapper;
|
package weaver.xuanran.wang.common.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import emo.macro.ob.OB;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -124,4 +125,27 @@ public interface CommonMapper {
|
||||||
|
|
||||||
@BatchInsert(custom = true)
|
@BatchInsert(custom = true)
|
||||||
boolean batchInsertModel(@SqlString String sql,@BatchSqlArgs List<Map<String, Object>> collect);
|
boolean batchInsertModel(@SqlString String sql,@BatchSqlArgs List<Map<String, Object>> collect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>通过requestId查询流程数据</h2>
|
||||||
|
* @param requestId requestId
|
||||||
|
* @param tableName 流程表名
|
||||||
|
* @return 流程数据
|
||||||
|
*/
|
||||||
|
@Select("select * from $t{tableName} where requestid = #{requestId}")
|
||||||
|
Map<String, Object> queryWorkflowByRequestId(@ParamMapper("requestId") String requestId,
|
||||||
|
@ParamMapper("tableName") String tableName);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>通过requestId查询流程数据</h2>
|
||||||
|
* @param requestId requestId
|
||||||
|
* @param tableName 流程表名
|
||||||
|
* @return 流程数据
|
||||||
|
*/
|
||||||
|
@Select("select * from $t{tableName} " +
|
||||||
|
"where mainid = #{mainId}")
|
||||||
|
List<Map<String,Object>>queryWorkflowByMainId(@ParamMapper("mainId") String mainId,@ParamMapper("tableName") String tableName);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package weaver.xuanran.wang.common.util;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cloudstore.api.util.Util_Redis;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.xuanran.wang.common.interfaces.CusAbstractTokenConf;
|
import weaver.xuanran.wang.common.interfaces.CusAbstractTokenConf;
|
||||||
|
|
||||||
|
@ -18,6 +19,16 @@ import java.util.Objects;
|
||||||
*/
|
*/
|
||||||
public class TokenUtil {
|
public class TokenUtil {
|
||||||
private static final Map<String, CusAbstractTokenConf> TOKEN_MAP = new HashMap<>(8);
|
private static final Map<String, CusAbstractTokenConf> TOKEN_MAP = new HashMap<>(8);
|
||||||
|
private static Util_Redis instance = null;
|
||||||
|
private static boolean redis = false;
|
||||||
|
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
instance = Util_Redis.getInstance();
|
||||||
|
redis = true;
|
||||||
|
}catch (Exception e){}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>从本地缓存中获取token</h1>
|
* <h1>从本地缓存中获取token</h1>
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
|
|
|
@ -7,6 +7,10 @@ import aiyh.utils.annotation.ActionOptionalParam;
|
||||||
import aiyh.utils.annotation.PrintParamMark;
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
import aiyh.utils.annotation.RequiredMark;
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import weaver.cssc.workflow.voucher.util.InterfaceLoggerDao;
|
||||||
|
import weaver.cssc.workflow.voucher.util.VoucherConstants;
|
||||||
|
import weaver.general.TimeUtil;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
||||||
|
@ -53,6 +57,17 @@ public class WorkflowToCms extends SafeCusBaseAction {
|
||||||
@Override
|
@Override
|
||||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
log.info("-------------- " + requestId + " begin --------------");
|
log.info("-------------- " + requestId + " begin --------------");
|
||||||
|
InterfaceLoggerDao tokenDao = workflowToCmsService.initLogDao(requestInfo);
|
||||||
|
tokenDao.setDealStatus(VoucherConstants.DEAL_STATUS_SUCCESS);
|
||||||
|
tokenDao.setDealMessage("接口调用成功!");
|
||||||
|
// token类型
|
||||||
|
tokenDao.setInterfaceType(2);
|
||||||
|
|
||||||
|
InterfaceLoggerDao cmsInterfaceDao = new InterfaceLoggerDao();
|
||||||
|
BeanUtils.copyProperties(tokenDao, cmsInterfaceDao);
|
||||||
|
// 档案集成接口
|
||||||
|
cmsInterfaceDao.setInterfaceType(1);
|
||||||
|
|
||||||
CusSuccess cmsResponseVoField = CusSuccess
|
CusSuccess cmsResponseVoField = CusSuccess
|
||||||
.builder()
|
.builder()
|
||||||
.successField(Util.null2DefaultStr(successField, "success"))
|
.successField(Util.null2DefaultStr(successField, "success"))
|
||||||
|
@ -61,6 +76,7 @@ public class WorkflowToCms extends SafeCusBaseAction {
|
||||||
.dataKey(Util.null2DefaultStr(dataKey, ""))
|
.dataKey(Util.null2DefaultStr(dataKey, ""))
|
||||||
.build();
|
.build();
|
||||||
log.info("cmsResponseVoField : " + JSONObject.toJSONString(cmsResponseVoField));
|
log.info("cmsResponseVoField : " + JSONObject.toJSONString(cmsResponseVoField));
|
||||||
|
cmsResponseVoField.setDao(cmsInterfaceDao);
|
||||||
|
|
||||||
CusSuccess tokenSuccess = CusSuccess
|
CusSuccess tokenSuccess = CusSuccess
|
||||||
.builder()
|
.builder()
|
||||||
|
@ -70,6 +86,7 @@ public class WorkflowToCms extends SafeCusBaseAction {
|
||||||
.dataKey(Util.null2DefaultStr(tokenDataKey,""))
|
.dataKey(Util.null2DefaultStr(tokenDataKey,""))
|
||||||
.build();
|
.build();
|
||||||
log.info("tokenSuccess : " + JSONObject.toJSONString(tokenSuccess));
|
log.info("tokenSuccess : " + JSONObject.toJSONString(tokenSuccess));
|
||||||
|
tokenSuccess.setDao(cmsInterfaceDao);
|
||||||
workflowToCmsService.workflowToCms(onlyMark,tokenOnlyMark, billTable, requestId,cmsResponseVoField, tokenSuccess);
|
workflowToCmsService.workflowToCms(onlyMark,tokenOnlyMark, billTable, requestId,cmsResponseVoField, tokenSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import weaver.cssc.workflow.voucher.util.InterfaceLoggerDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,4 +23,5 @@ public class CusSuccess {
|
||||||
private String errorMsg;
|
private String errorMsg;
|
||||||
private String dataKey;
|
private String dataKey;
|
||||||
private Object response;
|
private Object response;
|
||||||
|
private InterfaceLoggerDao dao;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package weaver.xuanran.wang.cssc.cms.service;
|
package weaver.xuanran.wang.cssc.cms.service;
|
||||||
|
|
||||||
|
import weaver.cssc.workflow.voucher.util.InterfaceLoggerDao;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,6 +11,8 @@ import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
||||||
* @date 2023/4/26 10:53
|
* @date 2023/4/26 10:53
|
||||||
*/
|
*/
|
||||||
public interface WorkflowToCmsService {
|
public interface WorkflowToCmsService {
|
||||||
|
InterfaceLoggerDao initLogDao(RequestInfo requestInfo);
|
||||||
String getToken(String onlyMark, String billTable, String requestId, CusSuccess cusSuccess);
|
String getToken(String onlyMark, String billTable, String requestId, CusSuccess cusSuccess);
|
||||||
void workflowToCms(String onlyMark,String tokenMark,String billTable, String requestId, CusSuccess cusSuccess, CusSuccess tokenSuccess);
|
void workflowToCms(String onlyMark,String tokenMark,String billTable,
|
||||||
|
String requestId, CusSuccess cusSuccess, CusSuccess tokenSuccess);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
package weaver.xuanran.wang.cssc.cms.service.impl;
|
package weaver.xuanran.wang.cssc.cms.service.impl;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import sun.security.krb5.internal.PAData;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.conn.RecordSetTrans;
|
||||||
|
import weaver.cssc.workflow.voucher.util.InterfaceLoggerDao;
|
||||||
|
import weaver.cssc.workflow.voucher.util.VoucherConstants;
|
||||||
|
import weaver.general.TimeUtil;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
||||||
import weaver.xiao.commons.config.entity.ResponseMapping;
|
import weaver.xiao.commons.config.entity.ResponseMapping;
|
||||||
import weaver.xiao.commons.config.service.DealWithMapping;
|
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||||
|
@ -32,6 +39,38 @@ public class WorkFlowToCmsServiceImpl implements WorkflowToCmsService {
|
||||||
private final Logger log = Util.getLogger(); // 获取日志对象
|
private final Logger log = Util.getLogger(); // 获取日志对象
|
||||||
private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
|
private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
|
||||||
private final SqlUtil sqlUtil = new SqlUtil();
|
private final SqlUtil sqlUtil = new SqlUtil();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InterfaceLoggerDao initLogDao(RequestInfo requestInfo){
|
||||||
|
InterfaceLoggerDao dao = new InterfaceLoggerDao();
|
||||||
|
dao.setWorkflowId(Integer.parseInt(requestInfo.getWorkflowid()));
|
||||||
|
String requestId = requestInfo.getRequestid();
|
||||||
|
dao.setSourceRequestId(requestId);
|
||||||
|
dao.setOperateDateTime(TimeUtil.getCurrentTimeString());
|
||||||
|
//获取流程基础信息
|
||||||
|
RecordSetTrans rsts = requestInfo.getRsTrans();
|
||||||
|
|
||||||
|
if(rsts == null){
|
||||||
|
rsts = new RecordSetTrans();
|
||||||
|
}
|
||||||
|
//流程请求编号
|
||||||
|
String requestMark = "";
|
||||||
|
try {
|
||||||
|
if(rsts.executeQuery("select requestMark from workflow_requestBase where requestId = ?",requestId)){
|
||||||
|
if(rsts.next()){
|
||||||
|
requestMark = Util.null2String(rsts.getString("requestMark"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Util.actionFailException(requestInfo.getRequestManager(),"获取流程基本信息异常,异常信息:[" + e.getMessage() + "]!");
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
dao.setRequestNo(requestMark);
|
||||||
|
dao.setOperator(requestInfo.getRequestManager().getUser().getUID());
|
||||||
|
return dao;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToken(String onlyMark,String billTable,
|
public String getToken(String onlyMark,String billTable,
|
||||||
String requestId, CusSuccess cusSuccess) {
|
String requestId, CusSuccess cusSuccess) {
|
||||||
|
@ -54,7 +93,8 @@ public class WorkFlowToCmsServiceImpl implements WorkflowToCmsService {
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
public void workflowToCms(String onlyMark,String tokenMark, String billTable,
|
public void workflowToCms(String onlyMark,String tokenMark, String billTable,
|
||||||
String requestId, CusSuccess cusSuccess, CusSuccess tokenSuccess) {
|
String requestId, CusSuccess cusSuccess,
|
||||||
|
CusSuccess tokenSuccess) {
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
if(StringUtils.isNotBlank(tokenMark)) {
|
if(StringUtils.isNotBlank(tokenMark)) {
|
||||||
String token = getToken(tokenMark, billTable, requestId, tokenSuccess);
|
String token = getToken(tokenMark, billTable, requestId, tokenSuccess);
|
||||||
|
|
|
@ -5,13 +5,18 @@ import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.cssc.workflow.voucher.util.InterfaceLoggerDao;
|
||||||
|
import weaver.cssc.workflow.voucher.util.VoucherConstants;
|
||||||
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>请求模版方法</h1>
|
* <h1>请求模版方法</h1>
|
||||||
|
@ -25,24 +30,30 @@ public class RequestMasterPlate {
|
||||||
private static final int HTTP_SUCCESS_CODE = 200;
|
private static final int HTTP_SUCCESS_CODE = 200;
|
||||||
|
|
||||||
public <T> T apiGet(String url, Map<String, Object> params, Map<String, String> headers, CusSuccess cusSuccess){
|
public <T> T apiGet(String url, Map<String, Object> params, Map<String, String> headers, CusSuccess cusSuccess){
|
||||||
ResponeVo responeVo;
|
|
||||||
try {
|
try {
|
||||||
responeVo = httpUtils.apiGet(url, params, headers);
|
setLogDao(cusSuccess, params, 0, null, false);
|
||||||
} catch (IOException e) {
|
ResponeVo responeVo = httpUtils.apiGet(url, params, headers);
|
||||||
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
setLogDao(cusSuccess, responeVo.getResponseMap(), 1, null, false);
|
||||||
}
|
|
||||||
return parseResponse(url, responeVo, params, cusSuccess);
|
return parseResponse(url, responeVo, params, cusSuccess);
|
||||||
|
} catch (Exception e) {
|
||||||
|
setLogDao(cusSuccess, null, 2, e, true);
|
||||||
|
insertLog(cusSuccess);
|
||||||
|
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T apiPost(String url, Object o, Map<String, String> headers, CusSuccess cusSuccess){
|
public <T> T apiPost(String url, Object o, Map<String, String> headers, CusSuccess cusSuccess){
|
||||||
ResponeVo responeVo;
|
|
||||||
try {
|
try {
|
||||||
headers.put("Content-Type", MediaType.APPLICATION_JSON);
|
headers.put("Content-Type", MediaType.APPLICATION_JSON);
|
||||||
responeVo = httpUtils.apiPostObject(url, o, headers);
|
setLogDao(cusSuccess, o, 0, null, false);
|
||||||
} catch (IOException e) {
|
ResponeVo responeVo = httpUtils.apiPostObject(url, o, headers);
|
||||||
|
setLogDao(cusSuccess, responeVo.getResponseMap(), 1, null, false);
|
||||||
|
return parseResponse(url, responeVo, o, cusSuccess);
|
||||||
|
} catch (Exception e) {
|
||||||
|
setLogDao(cusSuccess, null, 2, e, true);
|
||||||
|
insertLog(cusSuccess);
|
||||||
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
||||||
}
|
}
|
||||||
return parseResponse(url, responeVo, o, cusSuccess);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> T parseResponse(String url, ResponeVo responseVo, Object o, CusSuccess cusSuccess){
|
public <T> T parseResponse(String url, ResponeVo responseVo, Object o, CusSuccess cusSuccess){
|
||||||
|
@ -61,15 +72,59 @@ public class RequestMasterPlate {
|
||||||
}
|
}
|
||||||
String[] split = Util.null2DefaultStr(cusSuccess.getDataKey(),"").split("\\.");
|
String[] split = Util.null2DefaultStr(cusSuccess.getDataKey(),"").split("\\.");
|
||||||
int len = split.length;
|
int len = split.length;
|
||||||
|
T res;
|
||||||
if(len == 0 || StringUtils.isBlank(cusSuccess.getDataKey())){
|
if(len == 0 || StringUtils.isBlank(cusSuccess.getDataKey())){
|
||||||
return (T)response;
|
res = (T) response;
|
||||||
}
|
}else {
|
||||||
for (int i = 0; i < len - 1; i++) {
|
for (int i = 0; i < len - 1; i++) {
|
||||||
response = (Map) response.get(split[i]);
|
response = (Map) response.get(split[i]);
|
||||||
}
|
}
|
||||||
return (T) response.get(split[len - 1]);
|
res = (T) response.get(split[len - 1]);
|
||||||
|
}
|
||||||
|
insertLog(cusSuccess);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void insertLog(CusSuccess success){
|
||||||
|
InterfaceLoggerDao dao = success.getDao();
|
||||||
|
if(null != dao){
|
||||||
|
try {
|
||||||
|
dao.insertInterfaceLog(dao);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("写入日志失败! 当前dao : " + JSONObject.toJSONString(dao));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>给自定义对象设置值</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/6 18:22
|
||||||
|
* @param cusSuccess 自定义对象
|
||||||
|
* @param o 参数
|
||||||
|
* @param type 类型 0 请求体 1 响应体
|
||||||
|
* @param e 异常
|
||||||
|
* @param error 是否失败
|
||||||
|
**/
|
||||||
|
public void setLogDao(CusSuccess cusSuccess, Object o, int type, Exception e, boolean error){
|
||||||
|
InterfaceLoggerDao dao = cusSuccess.getDao();
|
||||||
|
if(Objects.isNull(dao)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(type == 0){
|
||||||
|
dao.setRequestBody(JSONObject.toJSONString(o));
|
||||||
|
}else if(type == 1){
|
||||||
|
dao.setResponseBody(JSONObject.toJSONString(o));
|
||||||
|
}else if(type == 2){
|
||||||
|
if(Objects.isNull(e)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dao.setDealMessage(e.getMessage());
|
||||||
|
}
|
||||||
|
if(error){
|
||||||
|
dao.setDealStatus(VoucherConstants.DEAL_STATUS_SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import weaver.xuanran.wang.common.service.CusDataDecipher;
|
import weaver.xuanran.wang.sh_bigdata.common.service.CusDataDecipher;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
package weaver.xuanran.wang.sh_bigdata.common.util;
|
package weaver.xuanran.wang.sh_bigdata.common.util;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.icbc.api.internal.apache.http.impl.cookie.S;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import weaver.workflow.request.todo.RequestStatusObj;
|
import weaver.workflow.request.todo.RequestStatusObj;
|
||||||
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
||||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTask;
|
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTask;
|
||||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoLeaderTask;
|
|
||||||
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
|
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
|
||||||
import weaver.xuanran.wang.sh_bigdata.task_async.mapper.SendTodoTaskMapper;
|
import weaver.xuanran.wang.sh_bigdata.task_async.mapper.SendTodoTaskMapper;
|
||||||
|
|
||||||
|
@ -66,8 +61,8 @@ public class SendTodoTaskUtil {
|
||||||
* @param objs 任务对象
|
* @param objs 任务对象
|
||||||
* @return 三方系统任务接收对象
|
* @return 三方系统任务接收对象
|
||||||
**/
|
**/
|
||||||
public List<Object> getTodoTaskInfo(List<RequestStatusObj> objs){
|
public List<CusTodoTask> getTodoTaskInfo(List<RequestStatusObj> objs){
|
||||||
ArrayList<Object> res = new ArrayList<>();
|
List<CusTodoTask> res = new ArrayList<>();
|
||||||
for (RequestStatusObj obj : objs) {
|
for (RequestStatusObj obj : objs) {
|
||||||
String taskId = getTaskId(0, obj);
|
String taskId = getTaskId(0, obj);
|
||||||
CusTodoTask todoTask = new CusTodoTask();
|
CusTodoTask todoTask = new CusTodoTask();
|
||||||
|
@ -76,7 +71,7 @@ public class SendTodoTaskUtil {
|
||||||
todoTask.setTaskNum(taskId);
|
todoTask.setTaskNum(taskId);
|
||||||
todoTask.setAgentid(agentId);
|
todoTask.setAgentid(agentId);
|
||||||
todoTask.setTaskName(obj.getRequestnamenew());
|
todoTask.setTaskName(obj.getRequestnamenew());
|
||||||
todoTask.setTaskDesc(obj.getRequestnamenew());
|
todoTask.setTaskDesc("");
|
||||||
String pcAgentId = ShBigDataUtil.getPropertiesValByKey("pcAgentId");
|
String pcAgentId = ShBigDataUtil.getPropertiesValByKey("pcAgentId");
|
||||||
if(StringUtils.isBlank(pcAgentId)){
|
if(StringUtils.isBlank(pcAgentId)){
|
||||||
pcAgentId = agentId;
|
pcAgentId = agentId;
|
||||||
|
@ -98,14 +93,10 @@ public class SendTodoTaskUtil {
|
||||||
// 是否领导待办逻辑处理
|
// 是否领导待办逻辑处理
|
||||||
int nodeId = obj.getNodeid();
|
int nodeId = obj.getNodeid();
|
||||||
String nodeNme = obj.getNodename();
|
String nodeNme = obj.getNodename();
|
||||||
|
todoTask.setLeader("");
|
||||||
if(strContainsKey(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderNodeId"), String.valueOf(nodeId))
|
if(strContainsKey(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderNodeId"), String.valueOf(nodeId))
|
||||||
|| strContainsKey(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderNodeName"), nodeNme)){
|
|| strContainsKey(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderNodeName"), nodeNme)){
|
||||||
CusTodoLeaderTask leaderTask = new CusTodoLeaderTask();
|
todoTask.setLeader(Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderValue"),"1"));
|
||||||
// 进行数据拷贝
|
|
||||||
BeanUtils.copyProperties(todoTask, leaderTask);
|
|
||||||
leaderTask.setLeader(Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("taskAsyncLeaderValue"),"1"));
|
|
||||||
res.add(leaderTask);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
res.add(todoTask);
|
res.add(todoTask);
|
||||||
}
|
}
|
||||||
|
@ -152,12 +143,15 @@ public class SendTodoTaskUtil {
|
||||||
ArrayList<CusDoneTask> res = new ArrayList<>();
|
ArrayList<CusDoneTask> res = new ArrayList<>();
|
||||||
for (RequestStatusObj obj : objs) {
|
for (RequestStatusObj obj : objs) {
|
||||||
String taskId = getTaskId(1, obj);
|
String taskId = getTaskId(1, obj);
|
||||||
List<String> list = mapper.queryUnSendTodoTaskList(taskId);
|
List<Map<String, Object>> list = mapper.queryUnSendTodoTaskList(taskId);
|
||||||
for (String num : list) {
|
for (Map<String, Object> map : list) {
|
||||||
|
String num = Util.null2DefaultStr(map.get("TASKNUM"), Util.null2DefaultStr(map.get("tasknum"),""));
|
||||||
|
String leader = Util.null2DefaultStr(map.get("LEADER"), Util.null2DefaultStr(map.get("leader"),""));
|
||||||
CusDoneTask doneTask = new CusDoneTask();
|
CusDoneTask doneTask = new CusDoneTask();
|
||||||
doneTask.setTaskNum(num);
|
doneTask.setTaskNum(num);
|
||||||
doneTask.setStatus(1);
|
doneTask.setStatus(1);
|
||||||
doneTask.setAgentid(agentId);
|
doneTask.setAgentid(agentId);
|
||||||
|
doneTask.setLeader(leader);
|
||||||
res.add(doneTask);
|
res.add(doneTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,4 +20,5 @@ public class CusDoneTask {
|
||||||
private String taskNum;
|
private String taskNum;
|
||||||
private int status;
|
private int status;
|
||||||
private String agentid;
|
private String agentid;
|
||||||
|
private String leader;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package weaver.xuanran.wang.sh_bigdata.task_async.entity;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1>领导待办计划任务</h1>
|
|
||||||
*
|
|
||||||
* @author xuanran.wang
|
|
||||||
* @date 2023/6/25 10:50
|
|
||||||
*/
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class CusTodoLeaderTask extends CusTodoTask{
|
|
||||||
private String leader;
|
|
||||||
}
|
|
|
@ -27,4 +27,5 @@ public class CusTodoTask {
|
||||||
protected String receiver;
|
protected String receiver;
|
||||||
protected String sender;
|
protected String sender;
|
||||||
protected String pcAgentId;
|
protected String pcAgentId;
|
||||||
|
protected String leader;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,11 @@ public class CusTodoTaskToOADetail extends CusTodoTask{
|
||||||
**/
|
**/
|
||||||
@SqlFieldMapping
|
@SqlFieldMapping
|
||||||
private String error;
|
private String error;
|
||||||
|
/**
|
||||||
|
* <h2>领导</h2>
|
||||||
|
**/
|
||||||
|
@SqlFieldMapping
|
||||||
|
private String leader;
|
||||||
public CusTodoTaskToOADetail() {
|
public CusTodoTaskToOADetail() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,9 +18,9 @@ public interface SendTodoTaskMapper {
|
||||||
@Select("select oaaddress from systemset")
|
@Select("select oaaddress from systemset")
|
||||||
String queryOAAddress();
|
String queryOAAddress();
|
||||||
|
|
||||||
@Select("select taskNum from uf_todo_task_log " +
|
@Select("select taskNum, leader from uf_todo_task_log " +
|
||||||
"where sourceTaskId = #{sourceTaskId} and taskType = 0 and status = 0 and success = 0")
|
"where sourceTaskId = #{sourceTaskId} and taskType = 0 and status = 0 and success = 0")
|
||||||
List<String> queryUnSendTodoTaskList(@ParamMapper("sourceTaskId") String sourceTaskId);
|
List<Map<String, Object>> queryUnSendTodoTaskList(@ParamMapper("sourceTaskId") String sourceTaskId);
|
||||||
|
|
||||||
@Update("update uf_todo_task_log set status = 1 where taskNum in (${taskNums})")
|
@Update("update uf_todo_task_log set status = 1 where taskNum in (${taskNums})")
|
||||||
boolean updateStatusByTaskNum(@ParamMapper("taskNums") List<String> taskNums);
|
boolean updateStatusByTaskNum(@ParamMapper("taskNums") List<String> taskNums);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public class SendTodoTaskServiceImpl implements SendTodoTaskService {
|
||||||
.dataKey("")
|
.dataKey("")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
List<Object> taskInfo = sendTodoTaskUtil.getTodoTaskInfo(todoList);
|
List<CusTodoTask> taskInfo = sendTodoTaskUtil.getTodoTaskInfo(todoList);
|
||||||
log.info("---------------- todoTaskInfo ---------------- \n" + JSONObject.toJSONString(taskInfo));
|
log.info("---------------- todoTaskInfo ---------------- \n" + JSONObject.toJSONString(taskInfo));
|
||||||
Map<String, Object> response = null;
|
Map<String, Object> response = null;
|
||||||
int success = 0;
|
int success = 0;
|
||||||
|
@ -74,8 +74,7 @@ public class SendTodoTaskServiceImpl implements SendTodoTaskService {
|
||||||
success = 1;
|
success = 1;
|
||||||
}
|
}
|
||||||
ArrayList<CusTodoTaskToOADetail> details = new ArrayList<>();
|
ArrayList<CusTodoTaskToOADetail> details = new ArrayList<>();
|
||||||
for (Object obj : taskInfo) {
|
for (CusTodoTask cusTodoTask : taskInfo) {
|
||||||
CusTodoTask cusTodoTask = (CusTodoTask) obj;
|
|
||||||
CusTodoTaskToOADetail detail = new CusTodoTaskToOADetail();
|
CusTodoTaskToOADetail detail = new CusTodoTaskToOADetail();
|
||||||
detail.setTaskNum(cusTodoTask.getTaskNum());
|
detail.setTaskNum(cusTodoTask.getTaskNum());
|
||||||
detail.setRequestUrl(addTodoTaskUrl);
|
detail.setRequestUrl(addTodoTaskUrl);
|
||||||
|
@ -89,6 +88,7 @@ public class SendTodoTaskServiceImpl implements SendTodoTaskService {
|
||||||
detail.setSourceTaskId(sourceTaskId);
|
detail.setSourceTaskId(sourceTaskId);
|
||||||
detail.setSendTime(TimeUtil.getCurrentTimeString());
|
detail.setSendTime(TimeUtil.getCurrentTimeString());
|
||||||
detail.setError(error);
|
detail.setError(error);
|
||||||
|
detail.setLeader(cusTodoTask.getLeader());
|
||||||
details.add(detail);
|
details.add(detail);
|
||||||
}
|
}
|
||||||
CusInfoToOAUtil.executeBatchByEntity(modelId, details,"");
|
CusInfoToOAUtil.executeBatchByEntity(modelId, details,"");
|
||||||
|
|
|
@ -84,6 +84,17 @@ public interface ConsumerMapper {
|
||||||
boolean updatePasswordById(@ParamMapper("id") String id,
|
boolean updatePasswordById(@ParamMapper("id") String id,
|
||||||
@ParamMapper("password") String password);
|
@ParamMapper("password") String password);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>通过outKey获取oa部门id</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2022/12/30 14:33
|
||||||
|
* @param id 外部系统id
|
||||||
|
* @return true/false
|
||||||
|
**/
|
||||||
|
@Update("update hrmresource set password = #{password} where id = #{id}")
|
||||||
|
boolean updatePasswordAndSaltById(@ParamMapper("id") String id,
|
||||||
|
@ParamMapper("password") String password);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>获取第一个分部id</h1>
|
* <h1>获取第一个分部id</h1>
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
|
|
|
@ -2,23 +2,16 @@ package weaver.xuanran.wang.shyl_mq.service.impl;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
||||||
import weaver.xuanran.wang.common.entity.CusSuccess;
|
import weaver.general.PasswordUtil;
|
||||||
import weaver.xuanran.wang.common.util.RequestMasterPlate;
|
|
||||||
import weaver.xuanran.wang.common.util.TokenUtil;
|
|
||||||
import weaver.xuanran.wang.shyl_mq.entity.MQMessage;
|
import weaver.xuanran.wang.shyl_mq.entity.MQMessage;
|
||||||
import weaver.xuanran.wang.shyl_mq.entity.ModifyPassWord;
|
import weaver.xuanran.wang.shyl_mq.entity.ModifyPassWord;
|
||||||
import weaver.xuanran.wang.shyl_mq.entity.SentryLnesaTokenConf;
|
|
||||||
import weaver.xuanran.wang.shyl_mq.service.CusInfoActionService;
|
import weaver.xuanran.wang.shyl_mq.service.CusInfoActionService;
|
||||||
import weaver.xuanran.wang.shyl_mq.util.RocketConsumerUtil;
|
import weaver.xuanran.wang.shyl_mq.util.RocketConsumerUtil;
|
||||||
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>密码修改业务方法</h1>
|
* <h1>密码修改业务方法</h1>
|
||||||
|
@ -61,6 +54,11 @@ public class PassWordServiceImpl extends CusInfoActionService {
|
||||||
if (!consumerMapper.updatePasswordById(hrmId, Util.getEncrypt(RocketConsumerUtil.decryptContent(passWord.getPassword())))) {
|
if (!consumerMapper.updatePasswordById(hrmId, Util.getEncrypt(RocketConsumerUtil.decryptContent(passWord.getPassword())))) {
|
||||||
throw new CustomerException("update user password error!");
|
throw new CustomerException("update user password error!");
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
PasswordUtil.saveSign(hrmId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomerException(" PasswordUtil.saveSign error!",e);
|
||||||
|
}
|
||||||
writeInOA(message.getId());
|
writeInOA(message.getId());
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package xuanran.wang.ajx;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.bokang.xiao.common.mapper.WorkflowMapper;
|
||||||
|
import weaver.xuanran.wang.ajx.work_flow_split.mapper.ChildWorkFlowSplitMapper;
|
||||||
|
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/10 15:20
|
||||||
|
*/
|
||||||
|
public class TestA extends BaseTest {
|
||||||
|
|
||||||
|
private final CommonMapper workflowMapper = Util.getMapper(CommonMapper.class);
|
||||||
|
private final ChildWorkFlowSplitMapper mapper = Util.getMapper(ChildWorkFlowSplitMapper.class);
|
||||||
|
|
||||||
|
private String insertAccountNumberField = "";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testA(){
|
||||||
|
String selectDetailNo = "1";
|
||||||
|
String billTable = "formtable_main_208";
|
||||||
|
String requestId = "640646";
|
||||||
|
String selectAccountNumberField = "zthm";
|
||||||
|
String hasMoreAccountField = "sfbhdzt";
|
||||||
|
String insertDetailNo = "2";
|
||||||
|
String hasMoreAccountFieldValue = "0";
|
||||||
|
Map<String, Object> mainMap = workflowMapper.queryWorkflowByRequestId("640646", "formtable_main_208");
|
||||||
|
String id = Util.null2DefaultStr(mainMap.get("id"),"");
|
||||||
|
if(StringUtils.isBlank(id)){
|
||||||
|
throw new CustomerException("id is empty!");
|
||||||
|
}
|
||||||
|
// 查明细数据
|
||||||
|
List<Map<String, Object>> detailInfo = workflowMapper.queryWorkflowByMainId(id, "formtable_main_208_dt1");
|
||||||
|
if(CollectionUtils.isEmpty(detailInfo)){
|
||||||
|
log.error("detail " + selectDetailNo + " table info is empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> accountNumber = detailInfo.stream().map(item -> Util.null2DefaultStr(item.get(selectAccountNumberField),"")).filter(StringUtils::isNotBlank).collect(Collectors.toSet());
|
||||||
|
if(CollectionUtils.isEmpty(accountNumber) || accountNumber.size() == 1){
|
||||||
|
log.error("明细数据根据帐套号分组后为空, 或不存在多个帐套!");
|
||||||
|
log.info("accountNumber : [ " + JSONObject.toJSONString(accountNumber) + " ]");
|
||||||
|
// 如果不存在多帐套那么将主表数据hasMoreAccountField 更新为null
|
||||||
|
if (!mapper.updateMainTable(billTable, hasMoreAccountField, null, requestId)) {
|
||||||
|
throw new CustomerException("更新主表是否包含多账套字段失败!");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!mapper.updateMainTable(billTable, hasMoreAccountField, hasMoreAccountFieldValue, requestId)) {
|
||||||
|
throw new CustomerException("更新主表是否包含多账套字段失败!");
|
||||||
|
}
|
||||||
|
// 如果插入表的帐套号字段名配置为空 那么与插入表的字段名保持一致
|
||||||
|
if(StringUtils.isBlank(this.insertAccountNumberField)){
|
||||||
|
this.insertAccountNumberField = selectAccountNumberField;
|
||||||
|
}
|
||||||
|
List<Map<String, String>> insertList = accountNumber.stream()
|
||||||
|
.map(item -> {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("mainId", id);
|
||||||
|
map.put("insertAccountNumber", item);
|
||||||
|
return map;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
boolean delete = mapper.selectAccountNumber(id, billTable + "_dt" + insertDetailNo);
|
||||||
|
if(!delete){
|
||||||
|
throw new CustomerException("删除明细表数据失败!");
|
||||||
|
}
|
||||||
|
if (!mapper.insertDetailTable(billTable + "_dt" + insertDetailNo, this.insertAccountNumberField, insertList)) {
|
||||||
|
throw new CustomerException("批量插入明细数据失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -421,12 +421,6 @@ public class BigDataTest extends BaseTest {
|
||||||
obj2.setCreator(new User(1));
|
obj2.setCreator(new User(1));
|
||||||
requestStatusObjs.add(obj2);
|
requestStatusObjs.add(obj2);
|
||||||
|
|
||||||
List<Object> todoTaskInfo = taskUtil.getTodoTaskInfo(requestStatusObjs);
|
|
||||||
System.out.println("todoTaskInfo : " + JSONObject.toJSONString(todoTaskInfo));
|
|
||||||
for (Object todo : todoTaskInfo) {
|
|
||||||
CusTodoTask cusTodoTask = (CusTodoTask) todo;
|
|
||||||
System.out.println("cusTodoTask : " + JSONObject.toJSONString(cusTodoTask));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testI(){
|
public void testI(){
|
||||||
|
|
|
@ -2,6 +2,9 @@ package xuanran.wang.common.test;
|
||||||
|
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import weaver.xuanran.wang.common.util.CusInfoToOAUtil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1></h1>
|
||||||
|
@ -19,4 +22,11 @@ public class ServiceTest extends BaseTest {
|
||||||
service1.getA();
|
service1.getA();
|
||||||
service2.getA();
|
service2.getA();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testB(){
|
||||||
|
HashMap<String, Object> params = new HashMap<>();
|
||||||
|
params.put("class_id","1");
|
||||||
|
CusInfoToOAUtil.getDataId(97, params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,240 @@
|
||||||
|
package xuanran.wang.http_test.rest_test;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.xuanran.wang.common.entity.CusResponseSuccess;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/7 10:56
|
||||||
|
*/
|
||||||
|
public class CusRestTemplate {
|
||||||
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
private final HttpUtils httpUtils = new HttpUtils();
|
||||||
|
private static final int HTTP_SUCCESS_CODE = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>get请求</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:16
|
||||||
|
* @param url 请求url
|
||||||
|
* @param params 请求参数
|
||||||
|
* @param headers 请求头
|
||||||
|
* @param cusSuccess 请求成功对象
|
||||||
|
* @return 响应对象
|
||||||
|
**/
|
||||||
|
public ResponeVo apiGet(String url, Map<String, Object> params,
|
||||||
|
Map<String, String> headers,
|
||||||
|
CusResponseSuccess cusSuccess) {
|
||||||
|
ResponeVo responeVo;
|
||||||
|
try {
|
||||||
|
requestBeforeInit(url, params, cusSuccess);
|
||||||
|
responeVo = httpUtils.apiGet(url, params, headers);
|
||||||
|
checkResponse(url, responeVo, params, cusSuccess);
|
||||||
|
return responeVo;
|
||||||
|
} catch (Exception e) {
|
||||||
|
callBack(e,cusSuccess);
|
||||||
|
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>post请求</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:16
|
||||||
|
* @param url 请求url
|
||||||
|
* @param params 请求参数
|
||||||
|
* @param headers 请求头
|
||||||
|
* @param cusSuccess 请求成功对象
|
||||||
|
* @return 响应对象
|
||||||
|
**/
|
||||||
|
public ResponeVo apiPost(String url, Object params, Map<String, String> headers, CusResponseSuccess cusSuccess) {
|
||||||
|
ResponeVo responeVo;
|
||||||
|
try {
|
||||||
|
requestBeforeInit(url, params, cusSuccess);
|
||||||
|
responeVo = httpUtils.apiPostObject(url, params, headers);
|
||||||
|
checkResponse(url, responeVo, params, cusSuccess);
|
||||||
|
return responeVo;
|
||||||
|
} catch (Exception e) {
|
||||||
|
callBack(e,cusSuccess);
|
||||||
|
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>根据cusSuccess对象校验响应是否成功</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:17
|
||||||
|
* @param url 请求地址
|
||||||
|
* @param responseVo 响应对象
|
||||||
|
* @param o 参数
|
||||||
|
* @param cusSuccess 请求成功对象
|
||||||
|
**/
|
||||||
|
private void checkResponse(String url, ResponeVo responseVo, Object o, CusResponseSuccess cusSuccess) {
|
||||||
|
if (Objects.isNull(cusSuccess) || !cusSuccess.isCheckResponse()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cusSuccess.setVo(responseVo);
|
||||||
|
if (responseVo.getCode() != HTTP_SUCCESS_CODE) { // 相应状态码
|
||||||
|
log.error(Util.logStr("can not fetch [{}],this request params is [{}]," + // 构建日志字符串
|
||||||
|
"this request heard is [{}],but response status code is [{}]," +
|
||||||
|
"this response is [{}]", url, JSON.toJSON(o), JSON.toJSONString(httpUtils.getGlobalCache().header), responseVo.getCode(), // 相应状态码
|
||||||
|
responseVo.getEntityString())); // 相应内容
|
||||||
|
throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
||||||
|
}
|
||||||
|
Map<String, Object> response;
|
||||||
|
if (cusSuccess.getCusDataDecipher() != null) {
|
||||||
|
response = cusSuccess.getCusDataDecipher().decoder(responseVo);
|
||||||
|
} else {
|
||||||
|
response = responseVo.getResponseMap(); // 根据相应结果转化为map集合
|
||||||
|
}
|
||||||
|
cusSuccess.setResponse(response);
|
||||||
|
String responseValue = Util.null2DefaultStr(response.get(cusSuccess.getSuccessField()), "");
|
||||||
|
if (!responseValue.equals(Util.null2DefaultStr(cusSuccess.getSuccessValue(), ""))) {
|
||||||
|
throw new CustomerException(Util.logStr("接口地址:[{}], 接口响应码不为: [{}], 接口响应信息: {}", url, cusSuccess.getSuccessValue(), Util.null2DefaultStr(response.get(cusSuccess.getErrorMsg()), ""))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>解析普通值</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:18
|
||||||
|
* @param map 响应map
|
||||||
|
* @param dataKey 值路径
|
||||||
|
* @param clazz 值类型
|
||||||
|
* @return 普通值
|
||||||
|
**/
|
||||||
|
public <T> T parseCommon(Map<String, Object> map, String dataKey, Class<T> clazz) {
|
||||||
|
if (MapUtils.isEmpty(map)) {
|
||||||
|
throw new CustomerException("map can not be null!");
|
||||||
|
}
|
||||||
|
Object object = getDataObject(map, dataKey);
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
return objectMapper.convertValue(object, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>解析对象</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:18
|
||||||
|
* @param map 响应map
|
||||||
|
* @param dataKey 值路径
|
||||||
|
* @param clazz 值类型
|
||||||
|
* @return 对象
|
||||||
|
**/
|
||||||
|
public <T> T parseObj(Map<String, Object> map, String dataKey, Class<?> clazz) {
|
||||||
|
if (MapUtils.isEmpty(map)) {
|
||||||
|
throw new CustomerException("map can not be null!");
|
||||||
|
}
|
||||||
|
Object dataObject = getDataObject(map, dataKey);
|
||||||
|
if (Objects.isNull(dataObject)) {
|
||||||
|
throw new CustomerException("parse object error!");
|
||||||
|
}
|
||||||
|
if (dataObject instanceof Map) {
|
||||||
|
return (T) JSONObject.parseObject(JSONObject.toJSONString(dataObject), clazz);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>解析集合</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:18
|
||||||
|
* @param map 响应map
|
||||||
|
* @param dataKey 值路径
|
||||||
|
* @param clazz 值类型
|
||||||
|
* @return 集合
|
||||||
|
**/
|
||||||
|
public <T> List<T> parseList(Map<String, Object> map, String dataKey, Class<?> clazz) {
|
||||||
|
if (MapUtils.isEmpty(map)) {
|
||||||
|
throw new CustomerException("map can not be null!");
|
||||||
|
}
|
||||||
|
Object dataObject = getDataObject(map, dataKey);
|
||||||
|
if (Objects.isNull(dataObject)) {
|
||||||
|
throw new CustomerException("parse object error!");
|
||||||
|
}
|
||||||
|
if (dataObject instanceof List) {
|
||||||
|
JavaType listType = TypeFactory.defaultInstance().constructParametricType(List.class, clazz);
|
||||||
|
try {
|
||||||
|
String jsonString = objectMapper.writeValueAsString(dataObject);
|
||||||
|
return objectMapper.readValue(jsonString, listType);
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new CustomerException("JSON processing error!", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>按照值路径解析对象</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:19
|
||||||
|
* @param map 响应map
|
||||||
|
* @param dataKey 值路径
|
||||||
|
* @return 解析对象
|
||||||
|
**/
|
||||||
|
private Object getDataObject(Map<String, Object> map, String dataKey) {
|
||||||
|
if(StringUtils.isBlank(dataKey) || dataKey.split("\\.").length == 0){
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
Object dataObject = map;
|
||||||
|
String[] keys = dataKey.split("\\.");
|
||||||
|
for (String key : keys) {
|
||||||
|
if (dataObject instanceof Map) {
|
||||||
|
dataObject = ((Map<?, ?>) dataObject).get(key);
|
||||||
|
} else {
|
||||||
|
return dataObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dataObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>请求前填充参数</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:20
|
||||||
|
* @param url url
|
||||||
|
* @param params 请求参数
|
||||||
|
* @param cusSuccess 自定义成功对象
|
||||||
|
**/
|
||||||
|
private void requestBeforeInit(String url, Object params, CusResponseSuccess cusSuccess){
|
||||||
|
if(!Objects.isNull(cusSuccess)){
|
||||||
|
cusSuccess.setUrl(url);
|
||||||
|
cusSuccess.setRequestParam(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>请求失败执行自定义回调</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/7 17:21
|
||||||
|
* @param e 异常
|
||||||
|
* @param cusSuccess 自定义成功对象
|
||||||
|
**/
|
||||||
|
public void callBack(Exception e, CusResponseSuccess cusSuccess){
|
||||||
|
if(!Objects.isNull(cusSuccess.getCall())){
|
||||||
|
cusSuccess.setE(e);
|
||||||
|
cusSuccess.getCall().accept(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package xuanran.wang.http_test.rest_test;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/7 11:44
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class Stu{
|
||||||
|
private String blance;
|
||||||
|
private String name;
|
||||||
|
private String tel;
|
||||||
|
private String age;
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package xuanran.wang.http_test.test;
|
||||||
|
|
||||||
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cloudstore.api.util.Util_Redis;
|
||||||
|
import com.fapiao.neon.client.base.impl.RedisClientImpl;
|
||||||
|
import com.weaver.base.cache.redis.RedisCache;
|
||||||
|
import org.docx4j.wml.R;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.session.util.RedisClient;
|
||||||
|
import weaver.session.util.RedisTemplate;
|
||||||
|
import weaver.xuanran.wang.common.entity.CusResponseSuccess;
|
||||||
|
import xuanran.wang.http_test.rest_test.CusRestTemplate;
|
||||||
|
import xuanran.wang.http_test.rest_test.Stu;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/7 15:46
|
||||||
|
*/
|
||||||
|
public class TestMain extends BaseTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testA(){
|
||||||
|
CusResponseSuccess builder =
|
||||||
|
CusResponseSuccess.builder()
|
||||||
|
.checkResponse(true)
|
||||||
|
.successField("code")
|
||||||
|
.successValue(0)
|
||||||
|
.errorMsg("msg")
|
||||||
|
.build();
|
||||||
|
CusRestTemplate restTemplate = new CusRestTemplate();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
builder.setCall(e->{
|
||||||
|
map.put("msg", e.getMessage());
|
||||||
|
map.put("status", false);
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
ResponeVo vo = restTemplate.apiGet("https://gl.shstx.cn:48002/auth/oauth/token?grant_type=client_credentials&client_id=fanwei&client_secret=b7c20b12cb124cbebb0b8833caac6b87", new HashMap<>(), new HashMap<>(), builder);
|
||||||
|
Map<String, Object> o = restTemplate.parseObj(vo.getResponseMap(), "", Map.class);
|
||||||
|
System.out.println("token : " + o);
|
||||||
|
}catch (Exception e){
|
||||||
|
System.out.println("error : " + e.getMessage());
|
||||||
|
System.out.println("e map : " + JSONObject.toJSONString(map));
|
||||||
|
System.out.println("cusSuccess : " + JSONObject.toJSONString(builder));
|
||||||
|
}
|
||||||
|
|
||||||
|
// String json = "{\"code\":200,\"msg\":\"接口返回成功\",\"status\":true,\"data\":{\"name\":\"张三\",\"age\":21,\"tel\":\"1539324****\",\"class\":\"2020级计算机应用技术1122班\",\"blance\":\"100\"}}\n";
|
||||||
|
// String json = "{\"code\":200,\"msg\":\"接口返回成功\",\"status\":true,\"data\":{\"arr\":[{\"name\":\"张三\",\"age\":21,\"tel\":\"1539324****\",\"class\":\"2020级计算机应用技术1122班\",\"blance\":\"100\"},{\"name\":\"李四\",\"age\":21,\"tel\":\"1539324****\",\"class\":\"2020级计算机应用技术1122班\",\"blance\":\"100\"}],\"obj\":{\"text\":\"111\"}}}\n";
|
||||||
|
}
|
||||||
|
}
|
|
@ -228,28 +228,10 @@ public class MQTest extends BaseTest {
|
||||||
// CusInfoToOAUtil.executeBatchByEntity(111, details,"");
|
// CusInfoToOAUtil.executeBatchByEntity(111, details,"");
|
||||||
ArrayList<CusDoneTaskOA> list = new ArrayList<>();
|
ArrayList<CusDoneTaskOA> list = new ArrayList<>();
|
||||||
ArrayList<String> successTaskIds = new ArrayList<>();
|
ArrayList<String> successTaskIds = new ArrayList<>();
|
||||||
List<String> lists = mapper.queryUnSendTodoTaskList("14672332");
|
List<Map<String, Object>> maps = mapper.queryUnSendTodoTaskList("14672332");
|
||||||
for (String num : lists) {
|
for (Map<String, Object> map : maps) {
|
||||||
int success = 0;
|
|
||||||
CusDoneTaskOA taskOA = new CusDoneTaskOA();
|
|
||||||
taskOA.setTaskNum(num);
|
|
||||||
taskOA.setTaskType(1);
|
|
||||||
String sourceTaskId =num.substring(0, num.length() - 10);
|
|
||||||
taskOA.setSourceTaskId(sourceTaskId);
|
|
||||||
taskOA.setResponse("{\n" +
|
|
||||||
" \"code\": 200,\n" +
|
|
||||||
" \"msg\": \"操作成功\", //返回文字描述\n" +
|
|
||||||
" \"data\": null,\n" +
|
|
||||||
" \"total\": null,\n" +
|
|
||||||
" \"totalPage\": null,\n" +
|
|
||||||
" \"takeTime\": null\n" +
|
|
||||||
"}");
|
|
||||||
taskOA.setRequestUrl("22222222");
|
|
||||||
taskOA.setRequestJson(JSONObject.toJSONString(num));
|
|
||||||
taskOA.setSuccess(success);
|
|
||||||
list.add(taskOA);
|
|
||||||
successTaskIds.add(num);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CusInfoToOAUtil.executeBatchByEntity(111, list,"");
|
CusInfoToOAUtil.executeBatchByEntity(111, list,"");
|
||||||
mapper.updateStatusByTaskNum(successTaskIds);
|
mapper.updateStatusByTaskNum(successTaskIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,23 @@
|
||||||
package xuanran.wang.shyl.dataasync;
|
package xuanran.wang.shyl.dataasync;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.api.xuanran.wang.shyl.service.UserUpdateToMQService;
|
import com.api.xuanran.wang.shyl.service.UserUpdateToMQService;
|
||||||
|
import com.engine.hrm.util.face.HrmFaceCheckManager;
|
||||||
|
import com.weaver.formmodel.util.EncryptHelper;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.PasswordUtil;
|
||||||
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
import weaver.xuanran.wang.common.interfaces.CusAbstractTokenConf;
|
import weaver.xuanran.wang.common.interfaces.CusAbstractTokenConf;
|
||||||
import weaver.xuanran.wang.common.util.TokenUtil;
|
import weaver.xuanran.wang.common.util.TokenUtil;
|
||||||
import weaver.xuanran.wang.shyl_mq.entity.SentryLnesaTokenConf;
|
import weaver.xuanran.wang.shyl_mq.entity.SentryLnesaTokenConf;
|
||||||
|
import weaver.xuanran.wang.shyl_mq.mapper.ConsumerMapper;
|
||||||
import weaver.xuanran.wang.shyl_mq.util.RocketConsumerUtil;
|
import weaver.xuanran.wang.shyl_mq.util.RocketConsumerUtil;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,14 +28,47 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class TestPassword extends BaseTest {
|
public class TestPassword extends BaseTest {
|
||||||
private final UserUpdateToMQService service = new UserUpdateToMQService();
|
private final UserUpdateToMQService service = new UserUpdateToMQService();
|
||||||
|
ConsumerMapper consumerMapper = Util.getMapper(ConsumerMapper.class);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testA() throws InterruptedException {
|
public void testA() throws Exception {
|
||||||
String encryptContent = RocketConsumerUtil.encryptContent("wxr12345435");
|
|
||||||
System.out.println("encryptContent : " + encryptContent);
|
|
||||||
|
|
||||||
Thread.sleep(60000);
|
String[] newEncrypts = PasswordUtil.encrypt(weaver.general.Util.null2String("123321"));
|
||||||
String decryptContent = RocketConsumerUtil.decryptContent(encryptContent);
|
String encrypt = Util.getEncrypt("123321");
|
||||||
System.out.println("decryptContent : " + decryptContent );
|
|
||||||
|
ResourceComInfo info = new ResourceComInfo();
|
||||||
|
String passwordnew = newEncrypts[0];
|
||||||
|
|
||||||
|
String upperCase = EncryptHelper.encodeMd5("11111").toUpperCase();
|
||||||
|
if (!consumerMapper.updatePasswordById("97",encrypt)) {
|
||||||
|
throw new CustomerException("更新密码失败!");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
PasswordUtil.saveSign("97");
|
||||||
|
} catch (Exception var80) {
|
||||||
|
System.out.println("e : " + var80.getMessage() );
|
||||||
|
}
|
||||||
|
// String newSalt = newEncrypts[1];
|
||||||
|
// PasswordUtil.updateResourceSalt("97", newSalt);
|
||||||
|
// String var30 = "123321";
|
||||||
|
// String var17 = "97";
|
||||||
|
// String var96 = "";
|
||||||
|
// var96 = var30;
|
||||||
|
// String[] var40 = PasswordUtil.encrypt(var30);
|
||||||
|
// var30 = var40[0];
|
||||||
|
// String var41 = var40[1];
|
||||||
|
// RecordSet var42 = new RecordSet();
|
||||||
|
// var42.executeUpdate("update hrmresource set password=?,salt=? where id=?", new Object[]{var30, var41, var17});
|
||||||
|
// var42.executeUpdate("update hrmresourcemanager set password=?,salt=? where id=?", new Object[]{var30, var41, var17});
|
||||||
|
// HrmFaceCheckManager.setUserPassowrd(var17, var96);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testB(){
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("1",null);
|
||||||
|
map.put("2","");
|
||||||
|
System.out.println(JSONObject.toJSONString(map));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue