Compare commits
5 Commits
52102ba058
...
9bf767afb5
Author | SHA1 | Date |
---|---|---|
youHong.ai | 9bf767afb5 | |
youHong.ai | ff371a3cc9 | |
youHong.ai | 98923a4b27 | |
youHong.ai | c02aea81be | |
youHong.ai | b45887564d |
|
@ -33,6 +33,9 @@ log
|
||||||
/src/main/resources/file
|
/src/main/resources/file
|
||||||
/src/*/resources/ssl/
|
/src/*/resources/ssl/
|
||||||
DirectoryV2.xml
|
DirectoryV2.xml
|
||||||
|
/lib/classbeanLib/ecology-dev-lib.jar
|
||||||
|
/lib/classbeanLib/web-inf-class-lib.jar
|
||||||
|
/lib/weaverLib/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -17,7 +17,7 @@ import java.io.InputStream;
|
||||||
@Setter
|
@Setter
|
||||||
@Getter
|
@Getter
|
||||||
@ToString
|
@ToString
|
||||||
public class MultipartFile {
|
public class HttpMultipartFile {
|
||||||
/**
|
/**
|
||||||
* 文件名
|
* 文件名
|
||||||
*/
|
*/
|
|
@ -439,7 +439,7 @@ public class HttpUtils {
|
||||||
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
Map<String, Object> paramsMap = paramsHandle(params);
|
Map<String, Object> paramsMap = paramsHandle(params);
|
||||||
Map<String, String> headerMap = headersHandle(headers);
|
Map<String, String> headerMap = headersHandle(headers);
|
||||||
MultipartFile multipartFile = new MultipartFile();
|
HttpMultipartFile multipartFile = new HttpMultipartFile();
|
||||||
multipartFile.setFileName(fileName);
|
multipartFile.setFileName(fileName);
|
||||||
multipartFile.setFileKey(fileKey);
|
multipartFile.setFileKey(fileKey);
|
||||||
multipartFile.setStream(inputStream);
|
multipartFile.setStream(inputStream);
|
||||||
|
@ -459,7 +459,7 @@ public class HttpUtils {
|
||||||
* @return 响应数
|
* @return 响应数
|
||||||
* @throws IOException Io异常
|
* @throws IOException Io异常
|
||||||
*/
|
*/
|
||||||
public ResponeVo apiUploadFiles(String url, List<MultipartFile> multipartFileList, Map<String, Object> params,
|
public ResponeVo apiUploadFiles(String url, List<HttpMultipartFile> multipartFileList, Map<String, Object> params,
|
||||||
Map<String, String> headers) throws IOException {
|
Map<String, String> headers) throws IOException {
|
||||||
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
Map<String, Object> paramsMap = paramsHandle(params);
|
Map<String, Object> paramsMap = paramsHandle(params);
|
||||||
|
@ -479,7 +479,7 @@ public class HttpUtils {
|
||||||
* @return 响应数
|
* @return 响应数
|
||||||
* @throws IOException Io异常
|
* @throws IOException Io异常
|
||||||
*/
|
*/
|
||||||
public ResponeVo apiPutUploadFiles(String url, List<MultipartFile> multipartFileList, Map<String, Object> params,
|
public ResponeVo apiPutUploadFiles(String url, List<HttpMultipartFile> multipartFileList, Map<String, Object> params,
|
||||||
Map<String, String> headers) throws IOException {
|
Map<String, String> headers) throws IOException {
|
||||||
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
Map<String, Object> paramsMap = paramsHandle(params);
|
Map<String, Object> paramsMap = paramsHandle(params);
|
||||||
|
@ -505,7 +505,7 @@ public class HttpUtils {
|
||||||
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
Map<String, Object> paramsMap = paramsHandle(params);
|
Map<String, Object> paramsMap = paramsHandle(params);
|
||||||
Map<String, String> headerMap = headersHandle(headers);
|
Map<String, String> headerMap = headersHandle(headers);
|
||||||
MultipartFile multipartFile = new MultipartFile();
|
HttpMultipartFile multipartFile = new HttpMultipartFile();
|
||||||
multipartFile.setFileName(fileName);
|
multipartFile.setFileName(fileName);
|
||||||
multipartFile.setFileKey(fileKey);
|
multipartFile.setFileKey(fileKey);
|
||||||
multipartFile.setStream(inputStream);
|
multipartFile.setStream(inputStream);
|
||||||
|
@ -554,7 +554,7 @@ public class HttpUtils {
|
||||||
Map<String, Object> paramsMap = paramsHandle(params);
|
Map<String, Object> paramsMap = paramsHandle(params);
|
||||||
Map<String, String> headerMap = headersHandle(headers);
|
Map<String, String> headerMap = headersHandle(headers);
|
||||||
InputStream inputStream = ImageFileManager.getInputStreamById(id);
|
InputStream inputStream = ImageFileManager.getInputStreamById(id);
|
||||||
MultipartFile multipartFile = new MultipartFile();
|
HttpMultipartFile multipartFile = new HttpMultipartFile();
|
||||||
multipartFile.setFileName(fileName);
|
multipartFile.setFileName(fileName);
|
||||||
multipartFile.setFileKey(fileKey);
|
multipartFile.setFileKey(fileKey);
|
||||||
multipartFile.setStream(inputStream);
|
multipartFile.setStream(inputStream);
|
||||||
|
@ -1013,13 +1013,13 @@ public class HttpUtils {
|
||||||
/**
|
/**
|
||||||
* <h2>上传文件</h2>
|
* <h2>上传文件</h2>
|
||||||
*
|
*
|
||||||
* @param url 上床地址
|
* @param url 上传地址
|
||||||
* @param multipartFileList 文件信息
|
* @param multipartFileList 文件信息
|
||||||
* @param params 其他参数
|
* @param params 其他参数
|
||||||
* @param headers 请求头信息
|
* @param headers 请求头信息
|
||||||
* @return 返回httpPost
|
* @return 返回httpPost
|
||||||
*/
|
*/
|
||||||
private HttpPost uploadFileByInputStream(String url, List<MultipartFile> multipartFileList,
|
private HttpPost uploadFileByInputStream(String url, List<HttpMultipartFile> multipartFileList,
|
||||||
Map<String, Object> params, Map<String, String> headers) {
|
Map<String, Object> params, Map<String, String> headers) {
|
||||||
log.info(Util.logStr("start request : url is [{}]" +
|
log.info(Util.logStr("start request : url is [{}]" +
|
||||||
"", url));
|
"", url));
|
||||||
|
@ -1033,7 +1033,7 @@ public class HttpUtils {
|
||||||
builder.setCharset(StandardCharsets.UTF_8);
|
builder.setCharset(StandardCharsets.UTF_8);
|
||||||
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
Long totalSize = 0L;
|
Long totalSize = 0L;
|
||||||
for (MultipartFile multipartFile : multipartFileList) {
|
for (HttpMultipartFile multipartFile : multipartFileList) {
|
||||||
log.info(Util.logStr("add file: fileName => [{}], fileKey => [{}], fileSize => [{}]kb",
|
log.info(Util.logStr("add file: fileName => [{}], fileKey => [{}], fileSize => [{}]kb",
|
||||||
multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize()));
|
multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize()));
|
||||||
totalSize += multipartFile.getFileSize();
|
totalSize += multipartFile.getFileSize();
|
||||||
|
@ -1062,13 +1062,13 @@ public class HttpUtils {
|
||||||
/**
|
/**
|
||||||
* <h2>上传文件</h2>
|
* <h2>上传文件</h2>
|
||||||
*
|
*
|
||||||
* @param url 上床地址
|
* @param url 上传地址
|
||||||
* @param multipartFileList 文件信息
|
* @param multipartFileList 文件信息
|
||||||
* @param params 其他参数
|
* @param params 其他参数
|
||||||
* @param headers 请求头信息
|
* @param headers 请求头信息
|
||||||
* @return 返回httpPost
|
* @return 返回httpPost
|
||||||
*/
|
*/
|
||||||
private HttpPut uploadFileByInputStreamPut(String url, List<MultipartFile> multipartFileList,
|
private HttpPut uploadFileByInputStreamPut(String url, List<HttpMultipartFile> multipartFileList,
|
||||||
Map<String, Object> params, Map<String, String> headers) {
|
Map<String, Object> params, Map<String, String> headers) {
|
||||||
log.info(Util.logStr("start request : url is [{}]" +
|
log.info(Util.logStr("start request : url is [{}]" +
|
||||||
"", url));
|
"", url));
|
||||||
|
@ -1082,7 +1082,7 @@ public class HttpUtils {
|
||||||
builder.setCharset(StandardCharsets.UTF_8);
|
builder.setCharset(StandardCharsets.UTF_8);
|
||||||
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
|
||||||
Long totalSize = 0L;
|
Long totalSize = 0L;
|
||||||
for (MultipartFile multipartFile : multipartFileList) {
|
for (HttpMultipartFile multipartFile : multipartFileList) {
|
||||||
log.info(Util.logStr("add file: fileName => [{}], fileKey => [{}], fileSize => [{}]kb",
|
log.info(Util.logStr("add file: fileName => [{}], fileKey => [{}], fileSize => [{}]kb",
|
||||||
multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize()));
|
multipartFile.getFileName(), multipartFile.getFileKey(), multipartFile.getFileSize()));
|
||||||
totalSize += multipartFile.getFileSize();
|
totalSize += multipartFile.getFileSize();
|
||||||
|
|
|
@ -33,7 +33,7 @@ public interface UtilMapper {
|
||||||
* @param onlyMark 唯一标识
|
* @param onlyMark 唯一标识
|
||||||
* @return 参数值
|
* @return 参数值
|
||||||
*/
|
*/
|
||||||
@Select("select param_value from $t{cusConfigTableName} where only_mark = #{onlyMark} and enable_param = 1")
|
@Select("select param_value from $t{configTableName} where only_mark = #{onlyMark} and enable_param = 1")
|
||||||
public String selectCusConfigParam(@ParamMapper("onlyMark") String onlyMark,
|
public String selectCusConfigParam(@ParamMapper("onlyMark") String onlyMark,
|
||||||
@ParamMapper("configTableName") String cusConfigTableName);
|
@ParamMapper("configTableName") String cusConfigTableName);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.api.youhong.ai.pcn.organization.orgchart.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import com.api.youhong.ai.pcn.organization.orgchart.service.OrgChartService;
|
||||||
|
import com.api.youhong.ai.pcn.organization.orgchart.vo.OrgChartNodeVo;
|
||||||
|
import weaver.hrm.HrmUserVarify;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>人员组织架构图后端接口</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2022-12-01 11:58</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Path("/aiyh/orgchart/")
|
||||||
|
public class OrgChartController {
|
||||||
|
|
||||||
|
private final OrgChartService service = new OrgChartService();
|
||||||
|
|
||||||
|
|
||||||
|
@Path("get")
|
||||||
|
@GET
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String getOrgChartTree(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
User logInUser = HrmUserVarify.getUser(request, response);
|
||||||
|
List<OrgChartNodeVo> treeList = service.getOrgChartTree(logInUser);
|
||||||
|
return ApiResult.success(treeList);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.api.youhong.ai.pcn.organization.orgchart.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import com.api.youhong.ai.pcn.organization.orgchart.pojo.HrmResource;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>人员组织架构图查询</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2022-12-01 12:14</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SqlMapper
|
||||||
|
public interface OrgChartMapper {
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select * from hrmresource")
|
||||||
|
List<HrmResource> selectAll();
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.api.youhong.ai.pcn.organization.orgchart.pojo;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>人员数据信息</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2022-12-01 15:10</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class HrmResource {
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.api.youhong.ai.pcn.organization.orgchart.service;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.api.youhong.ai.pcn.organization.orgchart.mapper.OrgChartMapper;
|
||||||
|
import com.api.youhong.ai.pcn.organization.orgchart.vo.OrgChartNodeVo;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>人员组织架构图逻辑处理</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2022-12-01 12:00</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OrgChartService {
|
||||||
|
|
||||||
|
private final OrgChartMapper mapper = Util.getMapper(OrgChartMapper.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取人员组织架构图数据</h2>
|
||||||
|
*
|
||||||
|
* @param logInUser 当前登陆对象
|
||||||
|
* @return 组织架构图数据
|
||||||
|
*/
|
||||||
|
public List<OrgChartNodeVo> getOrgChartTree(User logInUser) {
|
||||||
|
int userId = logInUser.getUID();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
package com.api.youhong.ai.pcn.organization.orgchart.vo;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>人员组织架构图节点VO对象</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2022-12-01 12:23</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class OrgChartNodeVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员头像
|
||||||
|
*/
|
||||||
|
private String avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员部门
|
||||||
|
*/
|
||||||
|
private String department;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员职位
|
||||||
|
*/
|
||||||
|
private String job;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员国籍类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否展示
|
||||||
|
*/
|
||||||
|
private Integer show;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否展示下级兄弟
|
||||||
|
*/
|
||||||
|
private Integer showBrother;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是当前的登陆人员
|
||||||
|
*/
|
||||||
|
private boolean current;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是当前登陆人员的直属上级
|
||||||
|
*/
|
||||||
|
private boolean currenParent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否展示子节点
|
||||||
|
*/
|
||||||
|
private Integer showChildren;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子节点
|
||||||
|
*/
|
||||||
|
private List<OrgChartNodeVo> children;
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package ebu7common.youhong.ai.bean;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>构造者模式</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2022-11-26 16:46</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Builder<T> {
|
||||||
|
|
||||||
|
private Supplier<T> constructor;
|
||||||
|
|
||||||
|
private List<Consumer<T>> propertiesInjects = new ArrayList<>();
|
||||||
|
|
||||||
|
private Builder(Supplier<T> constructor) {
|
||||||
|
this.constructor = constructor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取建造者对象</h2>
|
||||||
|
*
|
||||||
|
* @param constructor 传入需要创造的对象的构造方法
|
||||||
|
* @param <T> 需要创造的对象的范型
|
||||||
|
* @return 建造者对象
|
||||||
|
*/
|
||||||
|
public static <T> Builder<T> builder(Supplier<T> constructor) {
|
||||||
|
return new Builder<T>(constructor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>设置值方法</h2>
|
||||||
|
*
|
||||||
|
* @param setFun 对象字段的set方法
|
||||||
|
* @param value 需要设置的值
|
||||||
|
* @param <V> 值的范型
|
||||||
|
* @return 当前建造者对象本省
|
||||||
|
*/
|
||||||
|
public <V> Builder<T> with(PropertiesInject<T, V> setFun, V value) {
|
||||||
|
Consumer<T> c = instance -> setFun.accept(instance, value);
|
||||||
|
propertiesInjects.add(c);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>创建出目标对象</h2>
|
||||||
|
*
|
||||||
|
* @return 目标对象
|
||||||
|
*/
|
||||||
|
public T build() {
|
||||||
|
T instance = this.constructor.get();
|
||||||
|
this.propertiesInjects.forEach(inject -> inject.accept(instance));
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface PropertiesInject<T, V> {
|
||||||
|
void accept(T setFun, V value);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,128 +0,0 @@
|
||||||
package ebu7common.youhong.ai.csv.entity;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1>csv表信息</h1>
|
|
||||||
*
|
|
||||||
* <p>create: 2022-11-23 17:19</p>
|
|
||||||
*
|
|
||||||
* @author youHong.ai
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
public class CsvTable {
|
|
||||||
|
|
||||||
private List<CsvRow> csvRows = new ArrayList<>();
|
|
||||||
|
|
||||||
private CsvTableHeard csvTableHeard;
|
|
||||||
|
|
||||||
private int rowSize = 0;
|
|
||||||
|
|
||||||
|
|
||||||
public void setCsvTableHeard(CsvTableHeard csvTableHeard) {
|
|
||||||
this.csvTableHeard = csvTableHeard;
|
|
||||||
this.rowSize++;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addRow(CsvRow csvRow) {
|
|
||||||
csvRows.add(csvRow);
|
|
||||||
rowSize++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1>csv列数据</h1>
|
|
||||||
*
|
|
||||||
* <p>create: 2022-11-23 17:21</p>
|
|
||||||
*
|
|
||||||
* @author youHong.ai
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
static class CsvColumn {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1>csv表行数据</h1>
|
|
||||||
*
|
|
||||||
* <p>create: 2022-11-23 17:21</p>
|
|
||||||
*
|
|
||||||
* @author youHong.ai
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
static class CsvRow {
|
|
||||||
private List<CsvColumn> csvColumns = new ArrayList<>();
|
|
||||||
private int rowSize = 0;
|
|
||||||
|
|
||||||
public void add(CsvColumn csvColumn) {
|
|
||||||
csvColumns.add(csvColumn);
|
|
||||||
rowSize++;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1>csv表头数据</h1>
|
|
||||||
*
|
|
||||||
* <p>create: 2022-11-23 17:21</p>
|
|
||||||
*
|
|
||||||
* @author youHong.ai
|
|
||||||
*/
|
|
||||||
@ToString
|
|
||||||
static class CsvTableHeard {
|
|
||||||
private List<String> heard;
|
|
||||||
|
|
||||||
private Map<String, Integer> mapping;
|
|
||||||
|
|
||||||
private int heardSize = 0;
|
|
||||||
|
|
||||||
public void addHeard(String value) {
|
|
||||||
if (heard == null) {
|
|
||||||
this.heard = new ArrayList<>();
|
|
||||||
this.mapping = new HashMap<>();
|
|
||||||
}
|
|
||||||
mapping.put(value, heardSize++);
|
|
||||||
heard.add(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeardRow(String value) {
|
|
||||||
if (mapping != null) {
|
|
||||||
return mapping.get(value);
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHeard(int columnIndex) {
|
|
||||||
if (heard != null) {
|
|
||||||
return this.heard.get(columnIndex);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -308,6 +308,24 @@ public class DealWithMapping extends ToolUtil {
|
||||||
return rootList;
|
return rootList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>方法重载 通过主表数据map转为请求参数</h2>
|
||||||
|
*
|
||||||
|
* @param mainMap 主表数据集合
|
||||||
|
* @param requestMappingConfig 配置树
|
||||||
|
* @return 请求参数
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getRequestParam(Map<String, Object> mainMap, RequestMappingConfig requestMappingConfig) {
|
||||||
|
this.fileInputStreams.clear();
|
||||||
|
this.multipartFileList.clear();
|
||||||
|
this.fileNames.clear();
|
||||||
|
Map<String, Object> requestParam = new HashMap<>();
|
||||||
|
List<MappingDetail> configDetail = requestMappingConfig.getConfigDetail();
|
||||||
|
this.objValueDeal(mainMap, null, configDetail, requestParam);
|
||||||
|
return requestParam;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析请求参数配置树,转换成请求参数
|
* 解析请求参数配置树,转换成请求参数
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
package youhong.ai.pcn;
|
package youhong.ai.pcn;
|
||||||
|
|
||||||
|
import aiyh.utils.httpUtil.HttpMultipartFile;
|
||||||
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import ebu7common.youhong.ai.bean.Builder;
|
||||||
import ebu7common.youhong.ai.sftp.SftpConnectUtil;
|
import ebu7common.youhong.ai.sftp.SftpConnectUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
import weaver.general.GCONST;
|
import weaver.general.GCONST;
|
||||||
|
import weaver.xiao.commons.config.entity.MultipartFile;
|
||||||
|
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
||||||
|
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||||
import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Department;
|
import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Department;
|
||||||
import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Employee;
|
import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Employee;
|
||||||
import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Position;
|
import weaver.youhong.ai.pcn.hrorganization.wesmat.model.Position;
|
||||||
|
@ -14,10 +23,7 @@ import java.io.BufferedReader;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
@ -65,6 +71,59 @@ public class TestOrganization extends BaseTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBuilder() {
|
||||||
|
Position build = Builder.builder(Position::new)
|
||||||
|
.with(Position::setCompany_Code, "asdf")
|
||||||
|
.with(Position::setJOBCODE, "hahsdf")
|
||||||
|
.build();
|
||||||
|
System.out.println(build);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpload() {
|
||||||
|
HttpUtils httpUtils = new HttpUtils();
|
||||||
|
//TODO 设置签名
|
||||||
|
DealWithMapping dealWithMapping = new DealWithMapping();
|
||||||
|
dealWithMapping.setMainTable("mainTable");
|
||||||
|
RequestMappingConfig unique = dealWithMapping.treeDealWithUniqueCode("unique");
|
||||||
|
// 获取到请求参数,不包含文件流数据
|
||||||
|
Map<String, Object> requestParam = dealWithMapping.getRequestParam(new RecordSet(), unique);
|
||||||
|
//获取到对应的附件
|
||||||
|
List<MultipartFile> multipartFileList = dealWithMapping.getMultipartFileList();
|
||||||
|
for (MultipartFile multipartFile : multipartFileList) {
|
||||||
|
// faqingqiu
|
||||||
|
HttpMultipartFile file = new HttpMultipartFile();
|
||||||
|
file.setFileKey(multipartFile.getFileKey());
|
||||||
|
file.setFileName(multipartFile.getFileName());
|
||||||
|
file.setStream(multipartFile.getStream());
|
||||||
|
file.setFileSize(multipartFile.getFileSize());
|
||||||
|
HttpMultipartFile build = Builder.builder(HttpMultipartFile::new)
|
||||||
|
.with(HttpMultipartFile::setFileKey, multipartFile.getFileKey())
|
||||||
|
.with(HttpMultipartFile::setFileName, multipartFile.getFileName())
|
||||||
|
.with(HttpMultipartFile::setFileSize, multipartFile.getFileSize())
|
||||||
|
.with(HttpMultipartFile::setStream, multipartFile.getStream())
|
||||||
|
.build();
|
||||||
|
//BeanUtils.copyProperties(file,);//
|
||||||
|
ResponeVo responeVo = null;
|
||||||
|
try {
|
||||||
|
responeVo = httpUtils.apiUploadFiles(unique.getRequestUrl(),
|
||||||
|
Collections.singletonList(file), requestParam, new HashMap<>());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
if (responeVo.getCode() == 200) {
|
||||||
|
// TODO success
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Map<String, Object> entityMap = responeVo.getEntityMap();
|
||||||
|
} catch (JsonProcessingException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
// 响应的数据
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadCsv() {
|
public void testReadCsv() {
|
||||||
|
|
39
常用信息.md
39
常用信息.md
|
@ -11,14 +11,20 @@
|
||||||
|
|
||||||
### 前端
|
### 前端
|
||||||
|
|
||||||
**获取用户信息**
|
**1.获取用户信息**
|
||||||
> 维护人员:youhong.ai
|
> 维护人员:youhong.ai
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const userInfo = JSON.parse(localStorage.getItem("theme-account"))
|
const userInfo = JSON.parse(localStorage.getItem("theme-account"))
|
||||||
```
|
```
|
||||||
|
|
||||||
**获取url参数**
|
**2.ecode访问上传的resource静态文件**
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
let src = "/cloudstore/release/${appId}/resources/"
|
||||||
|
```
|
||||||
|
|
||||||
|
**3.获取url参数**
|
||||||
> 维护人员: youHong.ai
|
> 维护人员: youHong.ai
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
@ -37,7 +43,7 @@ getQueryString = (name) => {
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**ajax请求**
|
**4.ajax请求**
|
||||||
> 维护人员: youHong.ai
|
> 维护人员: youHong.ai
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
@ -68,7 +74,7 @@ getQueryString = (name) => {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**通过js获取react组件,操作组件内部数据**
|
**5.通过js获取react组件,操作组件内部数据**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function FindReact(dom, traverseUp = 0) {
|
function FindReact(dom, traverseUp = 0) {
|
||||||
|
@ -109,6 +115,28 @@ const myComp = FindReact(someElement);
|
||||||
myComp.setState({test1: test2});
|
myComp.setState({test1: test2});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**6.ecode集成iconfont**
|
||||||
|
|
||||||
|
```css
|
||||||
|
/*修改url,字体文件上传到cloudstore/iconfont/xx/下,没有目录自己创建*/
|
||||||
|
/*修改font-family,命名为其他名称,防止与系统自带的或与其他iconfont冲突*/
|
||||||
|
@font-face {
|
||||||
|
font-family: "cus_iconfont"; /* Project id 3789451 */
|
||||||
|
src: url('/cloudstore/iconfont/pcn/iconfont.woff2?t=1669223019749') format('woff2'),
|
||||||
|
url('/cloudstore/iconfont/pcn/iconfont.woff?t=1669223019749') format('woff'),
|
||||||
|
url('/cloudstore/iconfont/pcn/iconfont.ttf?t=1669223019749') format('truetype');
|
||||||
|
}
|
||||||
|
|
||||||
|
/*修改iconfont类名为font-family的名称*/
|
||||||
|
.cus_iconfont {
|
||||||
|
font-family: "cus_iconfont" !important;
|
||||||
|
font-size: 16px;
|
||||||
|
font-style: normal;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### 数据库
|
### 数据库
|
||||||
|
|
||||||
**备份mysql数据库**
|
**备份mysql数据库**
|
||||||
|
@ -388,7 +416,8 @@ from workflow_nodebase nb
|
||||||
> 维护人员:xuanran.wang
|
> 维护人员:xuanran.wang
|
||||||
|
|
||||||
```java
|
```java
|
||||||
User logInUser=HrmUserVarify.getUser(request,response));
|
//@Context HttpServletRequest request, @Context HttpServletResponse response
|
||||||
|
User logInUser=HrmUserVarify.getUser(request,response);
|
||||||
// 传入id会将此人员信息带出
|
// 传入id会将此人员信息带出
|
||||||
User user=new User(id);
|
User user=new User(id);
|
||||||
// 获取人员id
|
// 获取人员id
|
||||||
|
|
432
快速入门开发.md
432
快速入门开发.md
|
@ -7,7 +7,437 @@
|
||||||
|
|
||||||
### 第一个action
|
### 第一个action
|
||||||
|
|
||||||
> 维护人员:
|
> 维护人员:youHong.ai
|
||||||
|
|
||||||
|
# 附加操作Action/操作者Action相关开发培训
|
||||||
|
|
||||||
|
### 节点附加操作执行顺序
|
||||||
|
|
||||||
|
保存表单数据-->节点后附加操作-->生成编号-->出口附加规则-->节点前附加操作-->插入操作者和签字意见
|
||||||
|
|
||||||
|
注:流程存为文档(workflowToDoc)接口特殊处理,作为流程提交的最后一个action执行
|
||||||
|
|
||||||
|
#### 如何编写一个action
|
||||||
|
|
||||||
|
编写一个JAVA类,实现weaver/interfaces/workflow/action/Action.java接口
|
||||||
|
|
||||||
|
```java
|
||||||
|
package weaver.interfaces.workflow.action;
|
||||||
|
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: xiaofeng.zhang
|
||||||
|
* Date: 2007-9-7
|
||||||
|
* Time: 17:52:53
|
||||||
|
* To change this template use File | Settings | File Templates.
|
||||||
|
*/
|
||||||
|
public interface Action {
|
||||||
|
public static final String SUCCESS = "1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败信息,返回此信息,如果是节点前附加操作,将会阻止流程提交
|
||||||
|
*/
|
||||||
|
public static final String FAILURE_AND_CONTINUE = "0";
|
||||||
|
|
||||||
|
public String execute(RequestInfo request);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
常量 | 值 | 说明
|
||||||
|
---|---|---
|
||||||
|
SUCCESS | "1" | 成功标识,继续流程提交或执行下一个附加操作
|
||||||
|
FAILURE_AND_CONTINUE | "0" | 失败标识,阻断流程提交
|
||||||
|
|
||||||
|
方法 | 说明
|
||||||
|
---|---
|
||||||
|
String execute(RequestInfo request); | action实现逻辑,执行时调用此方法
|
||||||
|
|
||||||
|
实现示例
|
||||||
|
|
||||||
|
```java
|
||||||
|
package weaver.interfaces.workflow.action.actionDemo;
|
||||||
|
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
public class BaseActionDemo implements Action {
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
|
||||||
|
/**********执行action的业务逻辑************/
|
||||||
|
new BaseBean().writeLog("我是action,我正在执行");
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### action参数使用方式
|
||||||
|
|
||||||
|
使用自定义接口时,可以进行参数设置,和指定参数值。
|
||||||
|
|
||||||
|
设置后,需在action中实现对应的setter方法,oa会自动将设置的参数值注入
|
||||||
|
|
||||||
|
如果参数值为数据源,则注入的为DataSource对象,参数值为集成中设置的数据源名称
|
||||||
|
|
||||||
|
如参数值不为数据源,则注入的值为设置的String对象
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class TestMsgAction implements Action {
|
||||||
|
|
||||||
|
//action中定义属性,接收参数值,如参数值不为数据源,则注入的值为设置的String对象
|
||||||
|
private String aaa = "";
|
||||||
|
|
||||||
|
//action中定义属性,接收参数值,参数值为数据源,则注入的为DataSource对象
|
||||||
|
private DataSource bbb = null;
|
||||||
|
|
||||||
|
//设置对应的stter方法
|
||||||
|
public void setAaa(String aaa) {
|
||||||
|
this.aaa = aaa;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置对应的stter方法
|
||||||
|
public void setBbb(DataSource bbb) {
|
||||||
|
this.bbb = bbb;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### action能做的事情
|
||||||
|
|
||||||
|
1、获取流程相关信息(requestid、workflowid、formid、isbill、表单信息等);
|
||||||
|
|
||||||
|
2、执行sql语句,查询或更新OA系统中的数据;
|
||||||
|
|
||||||
|
3、返回失败标识和提示信息,阻断前台流程提交,并显示提示信息;
|
||||||
|
|
||||||
|
4、强制收回触发action回滚
|
||||||
|
|
||||||
|
5、调用第三方系统的接口
|
||||||
|
|
||||||
|
6、实现自定义操作者
|
||||||
|
|
||||||
|
#### 实现的方式
|
||||||
|
|
||||||
|
1、获取流程相关信息
|
||||||
|
|
||||||
|
```java
|
||||||
|
public String execute(RequestInfo info){
|
||||||
|
//获取工作流id
|
||||||
|
String workflowId=info.getWorkflowid();
|
||||||
|
//获取流程id
|
||||||
|
String requestid=info.getRequestid();
|
||||||
|
//获取RequestManager对象
|
||||||
|
RequestManager RequestManager=info.getRequestManager();
|
||||||
|
//获取当前节点id
|
||||||
|
int currentnodeid=RequestManager.getNodeid();
|
||||||
|
//下一个节点id
|
||||||
|
int nextnodeid=RequestManager.getNextNodeid();
|
||||||
|
//获取流程表单id
|
||||||
|
int formid=RequestManager.getFormid();
|
||||||
|
//是否为单据
|
||||||
|
int isbill=RequestManager.getIsbill();
|
||||||
|
//获取数据库主表名
|
||||||
|
String tableName=isbill==1?"workflow_form":RequestManager.getBillTableName();
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
2、执行sql语句,查询或更新OA系统中的数据;
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class SQLExecuteActionDemo implements Action {
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo info) {
|
||||||
|
//获取流程id
|
||||||
|
String requestid = info.getRequestid();
|
||||||
|
|
||||||
|
/*************1.不带事务执行SQL开始***************/
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
//执行查询语句,查询数据
|
||||||
|
rs.executeQuery("select testFieldName from formtable_main_45 where requestid = ?", requestid);
|
||||||
|
if (rs.next()) {
|
||||||
|
String testFieldValue = rs.getString(1);
|
||||||
|
new BaseBean().writeLog("testFieldName 的值是 :" + testFieldValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
//执行update语句,更新数据
|
||||||
|
rs.executeUpdate("update formtable_main_45 set testFieldName = ? where requestid = ?", "testValue", requestid);
|
||||||
|
/*************1.不带事务执行SQL结束***************/
|
||||||
|
|
||||||
|
|
||||||
|
/*************2.带事务执行SQL开始***************/
|
||||||
|
RecordSetTrans rst = new RecordSetTrans();
|
||||||
|
rst.setAutoCommit(false);
|
||||||
|
try {
|
||||||
|
rst.executeUpdate("update formtable_main_45 set testFieldName1 = ? where requestid = ?", "testValue1", requestid);
|
||||||
|
|
||||||
|
rst.executeUpdate("update formtable_main_45 set testFieldName2 = ? where requestid = ?", "testValue2", requestid);
|
||||||
|
|
||||||
|
//手动提交事务
|
||||||
|
rst.commit();
|
||||||
|
} catch (Exception e) {
|
||||||
|
//执行失败,回滚数据
|
||||||
|
rst.rollback();
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
/*************2.带事务执行SQL结束***************/
|
||||||
|
|
||||||
|
|
||||||
|
/*************3.查询或操作流程流转相关表开始***************/
|
||||||
|
/*************此处需注意不要将RecordSetTrans对象的事务提交掉***************/
|
||||||
|
RecordSetTrans requestRst = info.getRequestManager().getRsTrans();
|
||||||
|
|
||||||
|
try {
|
||||||
|
requestRst.executeQuery("select status from workflow_requestbase where requestid = ?", requestid);
|
||||||
|
if (requestRst.next()) {
|
||||||
|
String statusValue = rs.getString("status");
|
||||||
|
new BaseBean().writeLog("statusValue 的值是 :" + statusValue);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************3.查询或操作流程流转相关表结束***************/
|
||||||
|
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
> 注意点1:操作OA数据库中数据,必须使用OA自带的数据库操作类(推荐Recordet、RecordSetTrans),使用其他方式操作数据库,可能会出现数据库缓存读取不到最新数据的情况
|
||||||
|
|
||||||
|
> 注意点2:使用requestInfo.getRequestManager().getRsTrans()获取到的RecordSetTrans对象,不要手动提交或者回滚数据,会导致流程提交错误。
|
||||||
|
|
||||||
|
3、返回失败标识和提示信息,阻断前台流程提交,并显示提示信息;
|
||||||
|
|
||||||
|
```java
|
||||||
|
public String execute(RequestInfo request){
|
||||||
|
|
||||||
|
//获取requestId
|
||||||
|
String requestId=request.getRequestid();
|
||||||
|
|
||||||
|
float amount=0;
|
||||||
|
|
||||||
|
/*************1.直接查询数据库获取表单值***************/
|
||||||
|
RecordSet rs=new RecordSet();
|
||||||
|
rs.executeQuery("select amount from formtable_main_16 where requestid = ?",requestId);
|
||||||
|
//获取金额字段的值
|
||||||
|
if(rs.next()){
|
||||||
|
amount=rs.getFloat(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************2.直接查询数据库获取表单值***************/
|
||||||
|
//获取主表数据
|
||||||
|
Map<String, String> mainDatas=new HashMap<>();
|
||||||
|
Property[]properties=request.getMainTableInfo().getProperty();
|
||||||
|
for(Property propertie:properties){
|
||||||
|
mainDatas.put(propertie.getName(),propertie.getValue());
|
||||||
|
}
|
||||||
|
amount=Util.getFloatValue(Util.null2String(mainDatas.get("amount")));
|
||||||
|
|
||||||
|
|
||||||
|
//金额字段值大于10000,阻断流程提交
|
||||||
|
if(amount>10000){
|
||||||
|
RequestManager requestManager=request.getRequestManager();
|
||||||
|
requestManager.setMessagecontent("不允许提交金额大于10000的流程");
|
||||||
|
return FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
4、强制收回触发action回滚
|
||||||
|
|
||||||
|
```java
|
||||||
|
public String execute(RequestInfo request){
|
||||||
|
|
||||||
|
//获取requestId
|
||||||
|
String requestId=request.getRequestid();
|
||||||
|
|
||||||
|
//对应节点强制收回,则回滚数据
|
||||||
|
if(request.getRequestManager().getNodeid()==123){
|
||||||
|
RecordSet rs=new RecordSet();
|
||||||
|
rs.executeUpdate("delete from uf_fix_log where requestid = ?",requestId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
> 注意点:所有节点执行强制收回或者删除都会执行,需在action中判断当前节点Id
|
||||||
|
|
||||||
|
5、调用第三方系统的接口
|
||||||
|
|
||||||
|
```java
|
||||||
|
package weaver.interfaces.workflow.action.actionDemo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.Property;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class HttpTestAction implements Action {
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo requestInfo) {
|
||||||
|
|
||||||
|
//打印日志对象
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
baseBean.writeLog("获取到归属地action执行 requestid = " + requestInfo.getRequestid());
|
||||||
|
|
||||||
|
Map<String, String> mainTableDatas = new HashMap<>();
|
||||||
|
|
||||||
|
//获取主表字段数据
|
||||||
|
Property[] properties = requestInfo.getMainTableInfo().getProperty();
|
||||||
|
for (Property property : properties) {
|
||||||
|
mainTableDatas.put(property.getName(), property.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
String url = "https://tcc.taobao.com/cc/json/mobile_tel_segment.htm?";
|
||||||
|
String result = httpUtil(url, "tel=" + mainTableDatas.get("dhhm"));
|
||||||
|
|
||||||
|
String results[] = result.split("=");
|
||||||
|
if (result.length() > 1) {
|
||||||
|
JSONObject object = JSONObject.parseObject(results[1]);
|
||||||
|
//获取到归属地
|
||||||
|
String carrier = (String) object.get("carrier");
|
||||||
|
baseBean.writeLog("获取到归属地 :" + carrier);
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String sql = "update formtable_main_199 set gsd = ? where requestid = ?";
|
||||||
|
rs.executeUpdate(sql, carrier, requestInfo.getRequestid());
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String httpUtil(String path, String data) {
|
||||||
|
StringBuilder result = new StringBuilder();
|
||||||
|
try {
|
||||||
|
URL url = new URL(path);
|
||||||
|
//打开url的连接
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
//设置请求方式
|
||||||
|
conn.setRequestMethod("POST");
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
conn.setDoInput(true);
|
||||||
|
|
||||||
|
PrintWriter out = new PrintWriter(conn.getOutputStream());
|
||||||
|
//发送请求参数
|
||||||
|
out.print(data);
|
||||||
|
out.flush();
|
||||||
|
//获取响应输入流
|
||||||
|
InputStream is = conn.getInputStream();
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(is, "GBK"));
|
||||||
|
String str = "";
|
||||||
|
while ((str = br.readLine()) != null) {
|
||||||
|
result.append(str);
|
||||||
|
}
|
||||||
|
//关闭输入流
|
||||||
|
is.close();
|
||||||
|
conn.disconnect();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
6、实现自定义操作者
|
||||||
|
|
||||||
|
> 需实现weaver/interfaces/workflow/action/OperatorAction.java接口
|
||||||
|
|
||||||
|
```java
|
||||||
|
package weaver.interfaces.workflow.action;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程节点操作者自定义接口
|
||||||
|
* @author Mcr
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface OperatorAction {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取节点操作者,返回人员id集合
|
||||||
|
* @param requestInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<String> execute(RequestInfo requestInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
实现示例:
|
||||||
|
|
||||||
|
```java
|
||||||
|
package weaver.interfaces.workflow.action.actionDemo;
|
||||||
|
|
||||||
|
import weaver.interfaces.workflow.action.OperatorAction;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class OperatorActionTest implements OperatorAction {
|
||||||
|
/**
|
||||||
|
* 取节点操作者,返回人员id集合
|
||||||
|
*
|
||||||
|
* @param requestInfo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<String> execute(RequestInfo requestInfo) {
|
||||||
|
|
||||||
|
List<String> operatorList = new ArrayList<>();
|
||||||
|
|
||||||
|
//返回人员id
|
||||||
|
operatorList.add("21");
|
||||||
|
operatorList.add("22");
|
||||||
|
|
||||||
|
return operatorList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
7、流程提交失败,调用action回滚逻辑(E9+2006KB支持)
|
||||||
|
|
||||||
|
8、节点附加操作执行失败问题的简单排查
|
||||||
|
|
||||||
### 第一个定时任务
|
### 第一个定时任务
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue