去掉错误的提交

This commit is contained in:
zer0Black
2023-04-17 15:06:23 +08:00
parent b87f9c3461
commit 8350f9688a
385 changed files with 0 additions and 117480 deletions
@@ -1,270 +0,0 @@
package com.adc.da.wkflow.business_activiti.define;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.iservice.IUserEoService;
import com.adc.da.wkflow.enums.FlowTypeEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tmsps.fk.common.base.action.BaseAction;
import com.tmsps.fk.common.util.ChkUtil;
import com.tmsps.fk.common.wrapper.WrapMapper;
import com.tmsps.fk.common.wrapper.Wrapper;
import com.adc.da.wkflow.business_main.entity.*;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
import com.adc.da.wkflow.enums.SubmitStatusEnum;
import com.adc.da.wkflow.util.ImpulseSenderUtils;
import com.adc.da.wkflow.util.SessionTool;
import com.adc.da.wkflow.util.activiti.ActivitiTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.IdentityService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Api(description = "流程定义管理")
@RestController
public class ActivitDefineController extends BaseAction {
@Autowired
private RuntimeService runtimeService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private TaskService taskService;
@Autowired
private IdentityService identityService;
@Autowired
private IBusProcessNameService ibusprocessnameService;
@Autowired
IUserEoService userEoService;
@ApiOperation(value = "流程定义列表-分页")
@ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "category_id", value = "类型id"), @ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数") })
@GetMapping("/activitDefineListPage")
public Wrapper<Map<String, Object>> activitDefineListPage(String name, String category_id, int current, int size) {
// 创建查询对象
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
// 使用流程定义的名称模糊查询
if (ChkUtil.isNotNull(name)) {
processDefinitionQuery.processDefinitionNameLike("%" + name + "%");
}
if (ChkUtil.isNotNull(category_id)) {
processDefinitionQuery.processDefinitionCategory(category_id);
}
long total = processDefinitionQuery.count();
List<ProcessDefinition> list = processDefinitionQuery.orderByProcessDefinitionKey().asc().listPage((current - 1) * size, size);
List<Map<String, Object>> definitions = ActivitiTools.turnProcessDefinitions(list);
for (Map<String, Object> map : definitions) {
Model model = repositoryService.createModelQuery().deploymentId(map.get("deploymentId")+"").singleResult();
if(ChkUtil.isNotNull(model)) {
map.put("modelId", model.getId());
}else {
map.put("modelId", "");
}
}
Map<String, Object> map = new HashMap<>();
map.put("records", definitions);
map.put("current", current);
map.put("size", size);
map.put("total", total);
return WrapMapper.ok(map);
}
@ApiOperation(value = "流程定义列表")
@ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "category_id", value = "类型id") })
@GetMapping("/activitDefineList")
public Wrapper<List<Map<String, Object>>> activitDefineList(String name, String category_id) {
// 创建查询对象
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
// 使用流程定义的名称模糊查询
if (name == null) {
name = "";
}
if (ChkUtil.isNotNull(category_id)) {
processDefinitionQuery.processDefinitionCategory(category_id);
}
processDefinitionQuery.orderByDeploymentId().desc();
List<ProcessDefinition> list = processDefinitionQuery.processDefinitionNameLike("%" + name + "%").list();
return WrapMapper.ok(ActivitiTools.turnProcessDefinitions(list));
}
@ApiOperation(value = "删除流程定义")
@ApiImplicitParam(name = "deploymentId", value = "流程deploymentId")
@GetMapping("/activiti_define_delete")
public Wrapper<String> activiti_define_delete(String deploymentId) {
repositoryService.deleteDeployment(deploymentId);
return WrapMapper.ok("删除成功");
}
@ApiOperation(value = "启动流程-以流程定义id")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "流程定义Id"),
@ApiImplicitParam(name = "userId", value = "流程发起人Id"),
@ApiImplicitParam(name = "bpnId", value = "流程表单ID"),
@ApiImplicitParam(name = "prcType", value = "流程类型"),
@ApiImplicitParam(name = "prcName", value = "流程名称"),
})
@PostMapping("/activiti_define_start_user")
public Wrapper<String> activiti_define_start(@RequestBody JSONObject jsonObject) {
/**
* String id,
* String userId,
* String bpnId,
* String prcType,
* String msg
*/
String id = jsonObject.getString("id");
String userId = jsonObject.getString("loginUserId");
String bpnId = jsonObject.getString("bpnId");
String prcType = jsonObject.getString("type");
Object msg = jsonObject.get("msg");
// 创建查询对象
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
// 使用流程定义的名称模糊查询
processDefinitionQuery.processDefinitionCategory("4bdf0b396b4aa6ea10dd5e19956a1e22");
long total = processDefinitionQuery.count();
List<ProcessDefinition> list = processDefinitionQuery.orderByProcessDefinitionKey().asc().list();
List<Map<String, Object>> definitions = ActivitiTools.turnProcessDefinitions(list);
String pid = "";
for(Map<String, Object> map:definitions){
if(map.get("key").toString().equals(id)){
pid = map.get("id").toString();
}
}
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(pid).singleResult();
ProcessInstance pi = runtimeService.startProcessInstanceById(pid);
Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
task.setAssignee(userId);
taskService.saveTask(task);
Map<String, Object> prcNameAndPrcNum = createPrcNameAndPrcNum(prcType);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if(StringUtils.isEmpty(bpnId)) {
BusProcessName busProcessName = new BusProcessName();
busProcessName.setPrcId(pi.getId());
busProcessName.setCreatTime(sdf.format(new Date()));
busProcessName.setCreatUser(userId);
UserEO byId = userEoService.getUserById(userId);
busProcessName.setCreatUserName(byId.getUsname());
busProcessName.setPrcNum((String) prcNameAndPrcNum.get("prcNum"));
busProcessName.setPrcType(prcType);
busProcessName.setMes(JSON.toJSONString(msg, SerializerFeature.DisableCircularReferenceDetect));
busProcessName.setPrcName((String) prcNameAndPrcNum.get("prcName"));
busProcessName.setSubmitStatus(SubmitStatusEnum.SUBMIT.getValue());
ibusprocessnameService.save(busProcessName);
}else{
// 删除重新增加的目的是为了留下历史的流程编号,方便发号器生成
QueryWrapper<BusProcessName> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("ID", bpnId);
BusProcessName one = ibusprocessnameService.getOne(queryWrapper);
one.setSubmitStatus(SubmitStatusEnum.DELETE.getValue());
ibusprocessnameService.saveOrUpdate(one);
String newId = UUID.randomUUID().toString().replace("-", "");
one.setId(newId);
one.setPrcNum((String) prcNameAndPrcNum.get("prcNum"));
one.setPrcName((String) prcNameAndPrcNum.get("prcName"));
one.setPrcId(pi.getId());
one.setSubmitStatus(SubmitStatusEnum.SUBMIT.getValue());
one.setCreatTime(sdf.format(new Date()));
one.setMes(JSON.toJSONString(msg, SerializerFeature.DisableCircularReferenceDetect));
ibusprocessnameService.save(one);
}
logger.info("启动流程实例,获取id-->{},实例名称-->{}", pi.getId(), pd.getName());
return WrapMapper.ok(task.getId());
}
@ApiOperation(value = "启动流程-以key")
@ApiImplicitParam(name = "keyName", value = "key")
@GetMapping("/start")
public Wrapper<String> startProcess(String keyName) {
// 在流程启动之前设置发起人
identityService.setAuthenticatedUserId(SessionTool.getSessionAdminId());
// 启动流程
ProcessInstance process = runtimeService.startProcessInstanceByKey(keyName);
// 用于开启第一个 task任务
Task task = taskService.createTaskQuery().processInstanceId(process.getId()).singleResult();
task.setAssignee(SessionTool.getSessionAdminId());
taskService.saveTask(task);
return WrapMapper.ok(process.getId() + " : " + process.getProcessDefinitionId());
}
@ApiOperation(value = "判断流程定义key的唯一性")
@GetMapping("/check_define_key")
public Wrapper<String> check_define_key(String modelId, String key) {
Model modelData = repositoryService.getModel(modelId);
System.out.println("modelData"+modelData);
ProcessDefinition pd = null;
if(modelData.getDeploymentId()!=null){
pd = repositoryService.createProcessDefinitionQuery()
.deploymentId(modelData.getDeploymentId()).singleResult();
}
if (ChkUtil.isNotNull(pd) && pd.getKey().equals(key)) {
return WrapMapper.ok("TRUE");
}
Pattern p = Pattern.compile(".*\\d+.*");
Matcher m = p.matcher(key);
if (m.matches()) {
return WrapMapper.ok("NUM");
}
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key)
.list();
if (list.size() > 0) {
return WrapMapper.ok("FALSE");
}
return WrapMapper.ok("TRUE");
}
/**
* 生成流程单号、名称
* @param prcType
* @return
*/
public Map<String,Object> createPrcNameAndPrcNum(String prcType){
Map<String,Object> result = new HashMap<>();
Map<String,Object> prcInfoMap = ibusprocessnameService.ruleGeneratePrcNumAndPrcNum(prcType);
String prcNum = (String) prcInfoMap.get("prcNum");
String prcName = (String) prcInfoMap.get("prcName");
result.put("prcName",prcName);
result.put("prcNum",prcNum);
return result;
}
@GetMapping("/getNumberByFlowType")
public String getNumberByFlowType(@RequestParam("flowType") String flowType) {
return ImpulseSenderUtils.getNumberByFlowType(flowType);
}
}
@@ -1,293 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
import java.util.List;
/**
* Auto-generated: 2020-11-16 22:42:30
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class Children {
private String VSEId;
private boolean isTree;
private String deptName;
private String resNum;
private String resName;
private List<ItemsList> itemsList;
private String deptId;
private String resId;
private String VSEName;
private List<ZNodes> zNodes;
private Form form;
private String type;
private String taskId;
private String DREId;
private String DREName;
private String resType;
/**
* 审批意见
*/
private String approvalOpinions;
/**
* 审批内容
*/
private String approvalContent;
private Date opinionTime;
private String opinion;
private String opinionContent;
private String opinionName;
private String opinionNode;
private String termsConditions;
private String XMPGJS;
private String XMPGJSName;
private String newPutText;
private String prodPutText;
private String authObj;
private String authDelive;
private String performInfo;
public void setVSEId(String VSEId) {
this.VSEId = VSEId;
}
public String getVSEId() {
return VSEId;
}
public void setIsTree(boolean isTree) {
this.isTree = isTree;
}
public boolean getIsTree() {
return isTree;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getDeptName() {
return deptName;
}
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getResNum() {
return resNum;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResName() {
return resName;
}
public void setItemsList(List<ItemsList> itemsList) {
this.itemsList = itemsList;
}
public List<ItemsList> getItemsList() {
return itemsList;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getDeptId() {
return deptId;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getResId() {
return resId;
}
public void setVSEName(String VSEName) {
this.VSEName = VSEName;
}
public String getVSEName() {
return VSEName;
}
public void setZNodes(List<ZNodes> zNodes) {
this.zNodes = zNodes;
}
public List<ZNodes> getZNodes() {
return zNodes;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getDREId() {
return DREId;
}
public void setDREId(String DREId) {
this.DREId = DREId;
}
public String getDREName() {
return DREName;
}
public void setDREName(String DREName) {
this.DREName = DREName;
}
public Form getForm() {
return form;
}
public void setForm(Form form) {
this.form = form;
}
public String getApprovalOpinions() {
return approvalOpinions;
}
public void setApprovalOpinions(String approvalOpinions) {
this.approvalOpinions = approvalOpinions;
}
public String getApprovalContent() {
return approvalContent;
}
public void setApprovalContent(String approvalContent) {
this.approvalContent = approvalContent;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getOpinion() {
return opinion;
}
public void setOpinion(String opinion) {
this.opinion = opinion;
}
public String getOpinionContent() {
return opinionContent;
}
public void setOpinionContent(String opinionContent) {
this.opinionContent = opinionContent;
}
public String getOpinionName() {
return opinionName;
}
public void setOpinionName(String opinionName) {
this.opinionName = opinionName;
}
public String getOpinionNode() {
return opinionNode;
}
public void setOpinionNode(String opinionNode) {
this.opinionNode = opinionNode;
}
public Date getOpinionTime() {
return opinionTime;
}
public void setOpinionTime(Date opinionTime) {
this.opinionTime = opinionTime;
}
public String getTermsConditions() {
return termsConditions;
}
public void setTermsConditions(String termsConditions) {
this.termsConditions = termsConditions;
}
public String getXMPGJS() {
return XMPGJS;
}
public void setXMPGJS(String XMPGJS) {
this.XMPGJS = XMPGJS;
}
public String getXMPGJSName() {
return XMPGJSName;
}
public void setXMPGJSName(String XMPGJSName) {
this.XMPGJSName = XMPGJSName;
}
public String getNewPutText() {
return newPutText;
}
public void setNewPutText(String newPutText) {
this.newPutText = newPutText;
}
public String getProdPutText() {
return prodPutText;
}
public void setProdPutText(String prodPutText) {
this.prodPutText = prodPutText;
}
public String getAuthObj() {
return authObj;
}
public void setAuthObj(String authObj) {
this.authObj = authObj;
}
public String getAuthDelive() {
return authDelive;
}
public void setAuthDelive(String authDelive) {
this.authDelive = authDelive;
}
public String getPerformInfo() {
return performInfo;
}
public void setPerformInfo(String performInfo) {
this.performInfo = performInfo;
}
}
@@ -1,85 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
public class Data {
private String attId;
private String fileName;
private String fileSuffix;
private String filePath;
private String name;
private String id;
private String standNum;
private String standName;
private String oldFileName;
public String getOldFileName() {
return oldFileName;
}
public void setOldFileName(String oldFileName) {
this.oldFileName = oldFileName;
}
public String getStandName() {
return standName;
}
public void setStandName(String standName) {
this.standName = standName;
}
public String getStandNum() {
return standNum;
}
public void setStandNum(String standNum) {
this.standNum = standNum;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFileSuffix() {
return fileSuffix;
}
public void setFileSuffix(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getAttId() {
return attId;
}
public void setAttId(String attId) {
this.attId = attId;
}
}
@@ -1,247 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.List;
public class Form {
private String estimatedChangeCycle;
private String itemNumber;
private String justified;
private String SupportingMaterials;
private String changeScheme;
private String cost;
private String current;
private String cycle;
private String enterpriseLabel;
private String enterpriseLabel2;
private String enterpriseLabel3;
private String estimatedCost;
private String feedback;
private String nonConformity;
private String riskPoint;
private String verificationScheme;
private List<String> fileInfoList;
private String fileInfo;
private List<FromFile> file;
private String compTime;
private String compPerson;
private String nonConfomity;
private String resNum;
private String creatUser;
private String creatOrgId;
private String creatUserName;
public String getEstimatedChangeCycle() {
return estimatedChangeCycle;
}
public void setEstimatedChangeCycle(String estimatedChangeCycle) {
this.estimatedChangeCycle = estimatedChangeCycle;
}
public String getItemNumber() {
return itemNumber;
}
public void setItemNumber(String itemNumber) {
this.itemNumber = itemNumber;
}
public String getJustified() {
return justified;
}
public void setJustified(String justified) {
this.justified = justified;
}
public String getSupportingMaterials() {
return SupportingMaterials;
}
public void setSupportingMaterials(String supportingMaterials) {
SupportingMaterials = supportingMaterials;
}
public String getChangeScheme() {
return changeScheme;
}
public void setChangeScheme(String changeScheme) {
this.changeScheme = changeScheme;
}
public String getCost() {
return cost;
}
public void setCost(String cost) {
this.cost = cost;
}
public String getCurrent() {
return current;
}
public void setCurrent(String current) {
this.current = current;
}
public String getCycle() {
return cycle;
}
public void setCycle(String cycle) {
this.cycle = cycle;
}
public String getEnterpriseLabel() {
return enterpriseLabel;
}
public void setEnterpriseLabel(String enterpriseLabel) {
this.enterpriseLabel = enterpriseLabel;
}
public String getEnterpriseLabel2() {
return enterpriseLabel2;
}
public void setEnterpriseLabel2(String enterpriseLabel2) {
this.enterpriseLabel2 = enterpriseLabel2;
}
public String getEnterpriseLabel3() {
return enterpriseLabel3;
}
public void setEnterpriseLabel3(String enterpriseLabel3) {
this.enterpriseLabel3 = enterpriseLabel3;
}
public String getEstimatedCost() {
return estimatedCost;
}
public void setEstimatedCost(String estimatedCost) {
this.estimatedCost = estimatedCost;
}
public String getFeedback() {
return feedback;
}
public void setFeedback(String feedback) {
this.feedback = feedback;
}
public String getNonConformity() {
return nonConformity;
}
public void setNonConformity(String nonConformity) {
this.nonConformity = nonConformity;
}
public String getRiskPoint() {
return riskPoint;
}
public void setRiskPoint(String riskPoint) {
this.riskPoint = riskPoint;
}
public String getVerificationScheme() {
return verificationScheme;
}
public void setVerificationScheme(String verificationScheme) {
this.verificationScheme = verificationScheme;
}
public List<String> getFileInfoList() {
return fileInfoList;
}
public void setFileInfoList(List<String> fileInfoList) {
this.fileInfoList = fileInfoList;
}
public String getFileInfo() {
return fileInfo;
}
public void setFileInfo(String fileInfo) {
this.fileInfo = fileInfo;
}
public List<FromFile> getFile() {
return file;
}
public void setFile(List<FromFile> file) {
this.file = file;
}
public String getCompTime() {
return compTime;
}
public void setCompTime(String compTime) {
this.compTime = compTime;
}
public String getCompPerson() {
return compPerson;
}
public void setCompPerson(String compPerson) {
this.compPerson = compPerson;
}
public String getNonConfomity() {
return nonConfomity;
}
public void setNonConfomity(String nonConfomity) {
this.nonConfomity = nonConfomity;
}
public String getResNum() {
return resNum;
}
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getCreatUser() {
return creatUser;
}
public void setCreatUser(String creatUser) {
this.creatUser = creatUser;
}
public String getCreatOrgId() {
return creatOrgId;
}
public void setCreatOrgId(String creatOrgId) {
this.creatOrgId = creatOrgId;
}
public String getCreatUserName() {
return creatUserName;
}
public void setCreatUserName(String creatUserName) {
this.creatUserName = creatUserName;
}
}
@@ -1,49 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
public class FromFile {
private String uid;
private String size;
private String percentage;
private String name;
private Response response;
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getSize() {
return size;
}
public void setSize(String size) {
this.size = size;
}
public String getPercentage() {
return percentage;
}
public void setPercentage(String percentage) {
this.percentage = percentage;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Response getResponse() {
return response;
}
public void setResponse(Response response) {
this.response = response;
}
}
@@ -1,281 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
import java.util.List;
public class ItemListNew {
private List<String> deptName;
private List<String> foName;
private String resNum;
private String resName;
private List<String> foId;
private List<String> deptId;
private String resId;
private String taskId;
private List<ZNodes> zNodes;
private Form form;
private String type;
private String userId;
private String VSEId;
private String VSEName;
private String DREId;
private String DREName;
private String termsConditions;
private String resType;
/**
* 审批意见
*/
private String approvalOpinions;
/**
* 审批内容
*/
private String approvalContent;
private Date opinionTime;
private String opinion;
private String opinionContent;
private String opinionName;
private String opinionNode;
private String compTime;
private String compPerson;
private List<String> XMPGJS;
private List<String> XMPGJSName;
public List<String> getDeptName() {
return deptName;
}
public void setDeptName(List<String> deptName) {
this.deptName = deptName;
}
public List<String> getFoName() {
return foName;
}
public void setFoName(List<String> foName) {
this.foName = foName;
}
public String getResNum() {
return resNum;
}
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getResName() {
return resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public List<String> getFoId() {
return foId;
}
public void setFoId(List<String> foId) {
this.foId = foId;
}
public String getResId() {
return resId;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public List<ZNodes> getzNodes() {
return zNodes;
}
public void setzNodes(List<ZNodes> zNodes) {
this.zNodes = zNodes;
}
public Form getForm() {
return form;
}
public void setForm(Form form) {
this.form = form;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getVSEId() {
return VSEId;
}
public void setVSEId(String VSEId) {
this.VSEId = VSEId;
}
public String getVSEName() {
return VSEName;
}
public void setVSEName(String VSEName) {
this.VSEName = VSEName;
}
public String getDREId() {
return DREId;
}
public void setDREId(String DREId) {
this.DREId = DREId;
}
public String getDREName() {
return DREName;
}
public void setDREName(String DREName) {
this.DREName = DREName;
}
public String getTermsConditions() {
return termsConditions;
}
public void setTermsConditions(String termsConditions) {
this.termsConditions = termsConditions;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getApprovalOpinions() {
return approvalOpinions;
}
public void setApprovalOpinions(String approvalOpinions) {
this.approvalOpinions = approvalOpinions;
}
public String getApprovalContent() {
return approvalContent;
}
public void setApprovalContent(String approvalContent) {
this.approvalContent = approvalContent;
}
public Date getOpinionTime() {
return opinionTime;
}
public void setOpinionTime(Date opinionTime) {
this.opinionTime = opinionTime;
}
public String getOpinion() {
return opinion;
}
public void setOpinion(String opinion) {
this.opinion = opinion;
}
public String getOpinionContent() {
return opinionContent;
}
public void setOpinionContent(String opinionContent) {
this.opinionContent = opinionContent;
}
public String getOpinionName() {
return opinionName;
}
public void setOpinionName(String opinionName) {
this.opinionName = opinionName;
}
public String getOpinionNode() {
return opinionNode;
}
public void setOpinionNode(String opinionNode) {
this.opinionNode = opinionNode;
}
public String getCompTime() {
return compTime;
}
public void setCompTime(String compTime) {
this.compTime = compTime;
}
public String getCompPerson() {
return compPerson;
}
public void setCompPerson(String compPerson) {
this.compPerson = compPerson;
}
public List<String> getXMPGJS() {
return XMPGJS;
}
public void setXMPGJS(List<String> XMPGJS) {
this.XMPGJS = XMPGJS;
}
public List<String> getXMPGJSName() {
return XMPGJSName;
}
public void setXMPGJSName(List<String> XMPGJSName) {
this.XMPGJSName = XMPGJSName;
}
public List<String> getDeptId() {
return deptId;
}
public void setDeptId(List<String> deptId) {
this.deptId = deptId;
}
}
@@ -1,328 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
import java.util.List;
public class ItemsList {
private String deptName;
private String foName;
private String resNum;
private String resName;
private List<String> foId;
private String deptId;
private String resId;
private String taskId;
private List<ZNodes> zNodes;
private Form form;
private String type;
private String userId;
private String VSEId;
private String VSEName;
private String DREId;
private String DREName;
private String termsConditions;
private String resType;
/**
* 审批意见
*/
private String approvalOpinions;
/**
* 审批内容
*/
private String approvalContent;
private Date opinionTime;
private String opinion;
private String opinionContent;
private String opinionName;
private String opinionNode;
private String compTime;
private String compPerson;
private String XMPGJS;
private String XMPGJSName;
private String newPutText;
private String prodPutText;
private String authObj;
private String authDelive;
private String performInfo;
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public String getFoName() {
return foName;
}
public void setFoName(String foName) {
this.foName = foName;
}
public String getResNum() {
return resNum;
}
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getResName() {
return resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public List<String> getFoId() {
return foId;
}
public void setFoId(List<String> foId) {
this.foId = foId;
}
public String getDeptId() {
return deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId;
}
public String getResId() {
return resId;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public List<ZNodes> getzNodes() {
return zNodes;
}
public void setzNodes(List<ZNodes> zNodes) {
this.zNodes = zNodes;
}
public Form getForm() {
return form;
}
public void setForm(Form form) {
this.form = form;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getVSEId() {
return VSEId;
}
public void setVSEId(String VSEId) {
this.VSEId = VSEId;
}
public String getVSEName() {
return VSEName;
}
public void setVSEName(String VSEName) {
this.VSEName = VSEName;
}
public String getDREId() {
return DREId;
}
public void setDREId(String DREId) {
this.DREId = DREId;
}
public String getDREName() {
return DREName;
}
public void setDREName(String DREName) {
this.DREName = DREName;
}
public String getTermsConditions() {
return termsConditions;
}
public void setTermsConditions(String termsConditions) {
this.termsConditions = termsConditions;
}
public String getApprovalOpinions() {
return approvalOpinions;
}
public void setApprovalOpinions(String approvalOpinions) {
this.approvalOpinions = approvalOpinions;
}
public String getApprovalContent() {
return approvalContent;
}
public void setApprovalContent(String approvalContent) {
this.approvalContent = approvalContent;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getOpinion() {
return opinion;
}
public void setOpinion(String opinion) {
this.opinion = opinion;
}
public String getOpinionContent() {
return opinionContent;
}
public void setOpinionContent(String opinionContent) {
this.opinionContent = opinionContent;
}
public String getOpinionName() {
return opinionName;
}
public void setOpinionName(String opinionName) {
this.opinionName = opinionName;
}
public String getOpinionNode() {
return opinionNode;
}
public void setOpinionNode(String opinionNode) {
this.opinionNode = opinionNode;
}
public Date getOpinionTime() {
return opinionTime;
}
public void setOpinionTime(Date opinionTime) {
this.opinionTime = opinionTime;
}
public String getCompTime() {
return compTime;
}
public void setCompTime(String compTime) {
this.compTime = compTime;
}
public String getCompPerson() {
return compPerson;
}
public void setCompPerson(String compPerson) {
this.compPerson = compPerson;
}
public String getXMPGJS() {
return XMPGJS;
}
public void setXMPGJS(String XMPGJS) {
this.XMPGJS = XMPGJS;
}
public String getXMPGJSName() {
return XMPGJSName;
}
public void setXMPGJSName(String XMPGJSName) {
this.XMPGJSName = XMPGJSName;
}
public String getNewPutText() {
return newPutText;
}
public void setNewPutText(String newPutText) {
this.newPutText = newPutText;
}
public String getProdPutText() {
return prodPutText;
}
public void setProdPutText(String prodPutText) {
this.prodPutText = prodPutText;
}
public String getAuthObj() {
return authObj;
}
public void setAuthObj(String authObj) {
this.authObj = authObj;
}
public String getAuthDelive() {
return authDelive;
}
public void setAuthDelive(String authDelive) {
this.authDelive = authDelive;
}
public String getPerformInfo() {
return performInfo;
}
public void setPerformInfo(String performInfo) {
this.performInfo = performInfo;
}
}
@@ -1,22 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tmsps.fk.common.base.dto.BaseVueQuery;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "ModelQuery 对象", description = "")
public class ModelQuery<T> extends BaseVueQuery<T> {
private static final long serialVersionUID = 1L;
public Wrapper<T> makeQueryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
return queryWrapper;
}
}
@@ -1,44 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import java.util.List;
public class Page {
private Integer pageNo;
private Integer pageSize;
private Long count;
private List<BusProcessName> list;
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public List<BusProcessName> getList() {
return list;
}
public void setList(List<BusProcessName> list) {
this.list = list;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
}
@@ -1,580 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
import java.util.List;
/**
* Auto-generated: 2020-11-16 22:42:30
*
* @author bejson.com (i@bejson.com)
* @website http://www.bejson.com/java2pojo/
*/
public class ProjectAssessDTO {
private String prodectCode;
private String creationUser;
private Date creationTime;
private Date planPassTime;
private String productBrand;
private String flatform;
private String productName;
private String productSet;
private String saleMarket;
private Date modifyTime;
private String targetMarket;
// private Children children;
private List<Children> children;
private String id;
private String productType;
private Date eopTime;
private String dataType;
private String relatePerson;
private Date sopTime;
private Date actualPassTime;
private List<String> carModeFileList;
private String isDevelop;
private String pointTime;
private String carModel;
private String opinion;
private Date opinionTime;
private String opinionContent;
private String vseOpinion;
private String vseOpinionContent;
private String carModeFile;
private String energyKind;
private String validFlag;
private String relatePersonShow;
private String energyKindShow;
private String productTypeShow;
private String standId;
private String standType;
private String shownumber;
private String showname;
private String country;
private String notId;
private String testItemId;
private String testItemName;
private String testItemCode;
private String standName;
private String authTypeShow;
private String standCode;
private String productBrandShow;
private String targetMarketShow;
private String saleMarketShow;
private String creatUser;
private String productNo;
private String producePlace;
private String baseCartype;
private String leftRight;
private String productManager;
private String productManagerShow;
private String productTypeCode;
private String productTypeCodeShow;
private String producePlaceShow;
private String prcNum;
private String produceCode;
private String productStage;
private String zhengcarNo;
private String zhengcarSopTime;
private List<String> userEOList;
public void setProdectCode(String prodectCode) {
this.prodectCode = prodectCode;
}
public String getProdectCode() {
return prodectCode;
}
public void setCreationUser(String creationUser) {
this.creationUser = creationUser;
}
public String getCreationUser() {
return creationUser;
}
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
public Date getCreationTime() {
return creationTime;
}
public void setPlanPassTime(Date planPassTime) {
this.planPassTime = planPassTime;
}
public Date getPlanPassTime() {
return planPassTime;
}
public void setProductBrand(String productBrand) {
this.productBrand = productBrand;
}
public String getProductBrand() {
return productBrand;
}
public void setFlatform(String flatform) {
this.flatform = flatform;
}
public String getFlatform() {
return flatform;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return productName;
}
public void setProductSet(String productSet) {
this.productSet = productSet;
}
public String getProductSet() {
return productSet;
}
public void setSaleMarket(String saleMarket) {
this.saleMarket = saleMarket;
}
public String getSaleMarket() {
return saleMarket;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setTargetMarket(String targetMarket) {
this.targetMarket = targetMarket;
}
public String getTargetMarket() {
return targetMarket;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setProductType(String productType) {
this.productType = productType;
}
public String getProductType() {
return productType;
}
public void setEopTime(Date eopTime) {
this.eopTime = eopTime;
}
public Date getEopTime() {
return eopTime;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDataType() {
return dataType;
}
public void setRelatePerson(String relatePerson) {
this.relatePerson = relatePerson;
}
public String getRelatePerson() {
return relatePerson;
}
public void setSopTime(Date sopTime) {
this.sopTime = sopTime;
}
public Date getSopTime() {
return sopTime;
}
public void setActualPassTime(Date actualPassTime) {
this.actualPassTime = actualPassTime;
}
public Date getActualPassTime() {
return actualPassTime;
}
public void setCarModeFileList(List<String> carModeFileList) {
this.carModeFileList = carModeFileList;
}
public List<String> getCarModeFileList() {
return carModeFileList;
}
public void setIsDevelop(String isDevelop) {
this.isDevelop = isDevelop;
}
public String getIsDevelop() {
return isDevelop;
}
public void setPointTime(String pointTime) {
this.pointTime = pointTime;
}
public String getPointTime() {
return pointTime;
}
public void setCarModel(String carModel) {
this.carModel = carModel;
}
public String getCarModel() {
return carModel;
}
public List<Children> getChildren() {
return children;
}
public void setChildren(List<Children> children) {
this.children = children;
}
public String getOpinion() {
return opinion;
}
public void setOpinion(String opinion) {
this.opinion = opinion;
}
public String getOpinionContent() {
return opinionContent;
}
public void setOpinionContent(String opinionContent) {
this.opinionContent = opinionContent;
}
public String getVseOpinion() {
return vseOpinion;
}
public void setVseOpinion(String vseOpinion) {
this.vseOpinion = vseOpinion;
}
public String getVseOpinionContent() {
return vseOpinionContent;
}
public void setVseOpinionContent(String vseOpinionContent) {
this.vseOpinionContent = vseOpinionContent;
}
public String getCarModeFile() {
return carModeFile;
}
public void setCarModeFile(String carModeFile) {
this.carModeFile = carModeFile;
}
public String getEnergyKind() {
return energyKind;
}
public void setEnergyKind(String energyKind) {
this.energyKind = energyKind;
}
public String getValidFlag() {
return validFlag;
}
public void setValidFlag(String validFlag) {
this.validFlag = validFlag;
}
public String getRelatePersonShow() {
return relatePersonShow;
}
public void setRelatePersonShow(String relatePersonShow) {
this.relatePersonShow = relatePersonShow;
}
public String getEnergyKindShow() {
return energyKindShow;
}
public void setEnergyKindShow(String energyKindShow) {
this.energyKindShow = energyKindShow;
}
public String getProductTypeShow() {
return productTypeShow;
}
public void setProductTypeShow(String productTypeShow) {
this.productTypeShow = productTypeShow;
}
public String getStandId() {
return standId;
}
public void setStandId(String standId) {
this.standId = standId;
}
public String getStandType() {
return standType;
}
public void setStandType(String standType) {
this.standType = standType;
}
public String getShownumber() {
return shownumber;
}
public void setShownumber(String shownumber) {
this.shownumber = shownumber;
}
public String getShowname() {
return showname;
}
public void setShowname(String showname) {
this.showname = showname;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getNotId() {
return notId;
}
public void setNotId(String notId) {
this.notId = notId;
}
public String getTestItemId() {
return testItemId;
}
public void setTestItemId(String testItemId) {
this.testItemId = testItemId;
}
public String getTestItemName() {
return testItemName;
}
public void setTestItemName(String testItemName) {
this.testItemName = testItemName;
}
public String getTestItemCode() {
return testItemCode;
}
public void setTestItemCode(String testItemCode) {
this.testItemCode = testItemCode;
}
public String getAuthTypeShow() {
return authTypeShow;
}
public void setAuthTypeShow(String authTypeShow) {
this.authTypeShow = authTypeShow;
}
public String getStandName() {
return standName;
}
public void setStandName(String standName) {
this.standName = standName;
}
public String getStandCode() {
return standCode;
}
public void setStandCode(String standCode) {
this.standCode = standCode;
}
public String getProductBrandShow() {
return productBrandShow;
}
public void setProductBrandShow(String productBrandShow) {
this.productBrandShow = productBrandShow;
}
public String getTargetMarketShow() {
return targetMarketShow;
}
public void setTargetMarketShow(String targetMarketShow) {
this.targetMarketShow = targetMarketShow;
}
public String getSaleMarketShow() {
return saleMarketShow;
}
public void setSaleMarketShow(String saleMarketShow) {
this.saleMarketShow = saleMarketShow;
}
public String getCreatUser() {
return creatUser;
}
public void setCreatUser(String creatUser) {
this.creatUser = creatUser;
}
public String getProductNo() {
return productNo;
}
public void setProductNo(String productNo) {
this.productNo = productNo;
}
public String getProducePlace() {
return producePlace;
}
public void setProducePlace(String producePlace) {
this.producePlace = producePlace;
}
public String getBaseCartype() {
return baseCartype;
}
public void setBaseCartype(String baseCartype) {
this.baseCartype = baseCartype;
}
public String getLeftRight() {
return leftRight;
}
public void setLeftRight(String leftRight) {
this.leftRight = leftRight;
}
public String getProductManager() {
return productManager;
}
public void setProductManager(String productManager) {
this.productManager = productManager;
}
public String getProductManagerShow() {
return productManagerShow;
}
public void setProductManagerShow(String productManagerShow) {
this.productManagerShow = productManagerShow;
}
public String getProductTypeCode() {
return productTypeCode;
}
public void setProductTypeCode(String productTypeCode) {
this.productTypeCode = productTypeCode;
}
public String getProductTypeCodeShow() {
return productTypeCodeShow;
}
public void setProductTypeCodeShow(String productTypeCodeShow) {
this.productTypeCodeShow = productTypeCodeShow;
}
public String getProducePlaceShow() {
return producePlaceShow;
}
public void setProducePlaceShow(String producePlaceShow) {
this.producePlaceShow = producePlaceShow;
}
public String getPrcNum() {
return prcNum;
}
public void setPrcNum(String prcNum) {
this.prcNum = prcNum;
}
public String getProduceCode() {
return produceCode;
}
public void setProduceCode(String produceCode) {
this.produceCode = produceCode;
}
public String getProductStage() {
return productStage;
}
public void setProductStage(String productStage) {
this.productStage = productStage;
}
public String getZhengcarNo() {
return zhengcarNo;
}
public void setZhengcarNo(String zhengcarNo) {
this.zhengcarNo = zhengcarNo;
}
public String getZhengcarSopTime() {
return zhengcarSopTime;
}
public void setZhengcarSopTime(String zhengcarSopTime) {
this.zhengcarSopTime = zhengcarSopTime;
}
public List<String> getUserEOList() {
return userEOList;
}
public void setUserEOList(List<String> userEOList) {
this.userEOList = userEOList;
}
public Date getOpinionTime() {
return opinionTime;
}
public void setOpinionTime(Date opinionTime) {
this.opinionTime = opinionTime;
}
}
@@ -1,244 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
/**
* 项目评估符合不符合列表
* @author david
*/
public class ProjectFormDTO extends Form {
/**
* 标准或者条款ID
*/
private String resId;
/**
* 标准编号
*/
private String resNum;
/**
* 标准名称
*/
private String resName;
/**
* 填写人id
*/
private String writeUserId;
/**
* 填写人名称
*/
private String writeUsername;
/**
* 条款编号
*/
private String clauseNum;
/**
* 条款名称
*/
private String clauseName;
/**
* 条款内容
*/
private String clauseContent;
/**
* 审批意见
*/
private String approvalOpinions;
/**
* 审批内容
*/
private String approvalContent;
/**
* 任务id,用于查询任务数据,修改json
*/
private String taskId;
private String opinion;
private Date opinionTime;
private String opinionContent;
private String vseOpinion;
private String vseOpinionContent;
private String opinionName;
private String opinionNode;
private String termsConditions;
private String XMPGJS;
private String XMPGJSName;
public String getResId() {
return resId;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getResNum() {
return resNum;
}
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getResName() {
return resName;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getWriteUserId() {
return writeUserId;
}
public void setWriteUserId(String writeUserId) {
this.writeUserId = writeUserId;
}
public String getWriteUsername() {
return writeUsername;
}
public void setWriteUsername(String writeUsername) {
this.writeUsername = writeUsername;
}
public String getClauseNum() {
return clauseNum;
}
public void setClauseNum(String clauseNum) {
this.clauseNum = clauseNum;
}
public String getClauseName() {
return clauseName;
}
public void setClauseName(String clauseName) {
this.clauseName = clauseName;
}
public String getClauseContent() {
return clauseContent;
}
public void setClauseContent(String clauseContent) {
this.clauseContent = clauseContent;
}
public String getApprovalOpinions() {
return approvalOpinions;
}
public void setApprovalOpinions(String approvalOpinions) {
this.approvalOpinions = approvalOpinions;
}
public String getApprovalContent() {
return approvalContent;
}
public void setApprovalContent(String approvalContent) {
this.approvalContent = approvalContent;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getOpinion() {
return opinion;
}
public void setOpinion(String opinion) {
this.opinion = opinion;
}
public String getOpinionContent() {
return opinionContent;
}
public void setOpinionContent(String opinionContent) {
this.opinionContent = opinionContent;
}
public String getVseOpinion() {
return vseOpinion;
}
public void setVseOpinion(String vseOpinion) {
this.vseOpinion = vseOpinion;
}
public String getVseOpinionContent() {
return vseOpinionContent;
}
public void setVseOpinionContent(String vseOpinionContent) {
this.vseOpinionContent = vseOpinionContent;
}
public String getOpinionName() {
return opinionName;
}
public void setOpinionName(String opinionName) {
this.opinionName = opinionName;
}
public String getOpinionNode() {
return opinionNode;
}
public void setOpinionNode(String opinionNode) {
this.opinionNode = opinionNode;
}
public Date getOpinionTime() {
return opinionTime;
}
public void setOpinionTime(Date opinionTime) {
this.opinionTime = opinionTime;
}
public String getTermsConditions() {
return termsConditions;
}
public void setTermsConditions(String termsConditions) {
this.termsConditions = termsConditions;
}
public String getXMPGJS() {
return XMPGJS;
}
public void setXMPGJS(String XMPGJS) {
this.XMPGJS = XMPGJS;
}
public String getXMPGJSName() {
return XMPGJSName;
}
public void setXMPGJSName(String XMPGJSName) {
this.XMPGJSName = XMPGJSName;
}
}
@@ -1,40 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
public class Response {
private String ok;
private String message;
private String respCode;
private Data data;
public String getOk() {
return ok;
}
public void setOk(String ok) {
this.ok = ok;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getRespCode() {
return respCode;
}
public void setRespCode(String respCode) {
this.respCode = respCode;
}
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
}
@@ -1,175 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
import java.util.List;
public class StandardDTO {
private String resNum;
private String resName;
private List<ItemsList> itemsList;
private String resId;
private String taskId;
private List<String> foId;
private Form form;
private String type;
private String userId;
private String resType;
private String deadline;
private List<FromFile> fileList;
private Date Time;
private String fileIds;
/**
* 审批意见
*/
private String approvalOpinions;
/**
* 审批内容
*/
private String approvalContent;
private String compTime;
private String compPerson;
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getResNum() {
return resNum;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResName() {
return resName;
}
public void setItemsList(List<ItemsList> itemsList) {
this.itemsList = itemsList;
}
public List<ItemsList> getItemsList() {
return itemsList;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getResId() {
return resId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public List<String> getFoId() {
return foId;
}
public void setFoId(List<String> foId) {
this.foId = foId;
}
public Form getForm() {
return form;
}
public void setForm(Form form) {
this.form = form;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getApprovalOpinions() {
return approvalOpinions;
}
public void setApprovalOpinions(String approvalOpinions) {
this.approvalOpinions = approvalOpinions;
}
public String getApprovalContent() {
return approvalContent;
}
public void setApprovalContent(String approvalContent) {
this.approvalContent = approvalContent;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getDeadline() {
return deadline;
}
public void setDeadline(String deadline) {
this.deadline = deadline;
}
public List<FromFile> getFileList() {
return fileList;
}
public void setFileList(List<FromFile> fileList) {
this.fileList = fileList;
}
public Date getTime() {
return Time;
}
public void setTime(Date time) {
Time = time;
}
public String getFileIds() {
return fileIds;
}
public void setFileIds(String fileIds) {
this.fileIds = fileIds;
}
public String getCompTime() {
return compTime;
}
public void setCompTime(String compTime) {
this.compTime = compTime;
}
public String getCompPerson() {
return compPerson;
}
public void setCompPerson(String compPerson) {
this.compPerson = compPerson;
}
}
@@ -1,250 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
import java.util.List;
public class StandardDTONew {
private String resNum;
private String resName;
private String resId;
private String taskId;
private List<String> foId;
private Form form;
private String type;
private String userId;
private String resType;
private String deadline;
private List<FromFile> fileList;
private Date Time;
private String fileIds;
private List<ItemListNew> itemsList;
/**
* 审批意见
*/
private String approvalOpinions;
/**
* 审批内容
*/
private String approvalContent;
private String compTime;
private String compPerson;
private List<String> deptName;
private List<String> roleIdAndId;
private List<String> deptId;
private List<String> XMPGJSName;
private List<String> XMPGJS;
private List<String> roleName;
private List<String> foName;
private String backSaveFlag;
public void setResNum(String resNum) {
this.resNum = resNum;
}
public String getResNum() {
return resNum;
}
public void setResName(String resName) {
this.resName = resName;
}
public String getResName() {
return resName;
}
public void setResId(String resId) {
this.resId = resId;
}
public String getResId() {
return resId;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public List<String> getFoId() {
return foId;
}
public void setFoId(List<String> foId) {
this.foId = foId;
}
public Form getForm() {
return form;
}
public void setForm(Form form) {
this.form = form;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getApprovalOpinions() {
return approvalOpinions;
}
public void setApprovalOpinions(String approvalOpinions) {
this.approvalOpinions = approvalOpinions;
}
public String getApprovalContent() {
return approvalContent;
}
public void setApprovalContent(String approvalContent) {
this.approvalContent = approvalContent;
}
public String getResType() {
return resType;
}
public void setResType(String resType) {
this.resType = resType;
}
public String getDeadline() {
return deadline;
}
public void setDeadline(String deadline) {
this.deadline = deadline;
}
public List<FromFile> getFileList() {
return fileList;
}
public void setFileList(List<FromFile> fileList) {
this.fileList = fileList;
}
public Date getTime() {
return Time;
}
public void setTime(Date time) {
Time = time;
}
public String getFileIds() {
return fileIds;
}
public void setFileIds(String fileIds) {
this.fileIds = fileIds;
}
public String getCompTime() {
return compTime;
}
public void setCompTime(String compTime) {
this.compTime = compTime;
}
public String getCompPerson() {
return compPerson;
}
public void setCompPerson(String compPerson) {
this.compPerson = compPerson;
}
public List<ItemListNew> getItemsList() {
return itemsList;
}
public void setItemsList(List<ItemListNew> itemsList) {
this.itemsList = itemsList;
}
public List<String> getDeptName() {
return deptName;
}
public void setDeptName(List<String> deptName) {
this.deptName = deptName;
}
public List<String> getRoleIdAndId() {
return roleIdAndId;
}
public void setRoleIdAndId(List<String> roleIdAndId) {
this.roleIdAndId = roleIdAndId;
}
public List<String> getDeptId() {
return deptId;
}
public void setDeptId(List<String> deptId) {
this.deptId = deptId;
}
public List<String> getXMPGJSName() {
return XMPGJSName;
}
public void setXMPGJSName(List<String> XMPGJSName) {
this.XMPGJSName = XMPGJSName;
}
public List<String> getXMPGJS() {
return XMPGJS;
}
public void setXMPGJS(List<String> XMPGJS) {
this.XMPGJS = XMPGJS;
}
public List<String> getRoleName() {
return roleName;
}
public void setRoleName(List<String> roleName) {
this.roleName = roleName;
}
public List<String> getFoName() {
return foName;
}
public void setFoName(List<String> foName) {
this.foName = foName;
}
public String getBackSaveFlag() {
return backSaveFlag;
}
public void setBackSaveFlag(String backSaveFlag) {
this.backSaveFlag = backSaveFlag;
}
}
@@ -1,69 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
/**
* @Description: 任务高级查询
* @Author: wangzhijiang
* date: 2021/09/15 13:40
*/
public class TaskAdvanceSearchVO {
private String field; //字段 如 标准类别
private String value; //值
private String timeSt; //日期开始值
private String timeEd; //日期结束值
private String type; //查询类型 如 = = like
private String connect; //连接符号 如 and or
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getConnect() {
return connect;
}
public void setConnect(String connect) {
this.connect = connect;
}
public String getTimeSt() {
return timeSt;
}
public void setTimeSt(String timeSt) {
this.timeSt = timeSt;
}
public String getTimeEd() {
return timeEd;
}
public void setTimeEd(String timeEd) {
this.timeEd = timeEd;
}
}
@@ -1,59 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
@Data
@EqualsAndHashCode(callSuper = false)
public class TaskCommonQuery {
@ApiModelProperty(value = "当前页")
private int current;
@ApiModelProperty(value = "数量")
private int size;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "开始时间从")
private String startTime;
@ApiModelProperty(value = "")
private String endTime;
@ApiModelProperty(value = "结束时间从")
private String finishStartTime;
@ApiModelProperty(value = "")
private String finishEndTime;
@ApiModelProperty(value = "流程分类")
private String category_id;
@ApiModelProperty(value = "用户Id")
private String userId;
@ApiModelProperty(value = "创建用户Id")
private String creatuserId;
@ApiModelProperty(value = "流程类型")
private String prcType;
@ApiModelProperty(value = "流程名称或编号")
private String prcNameOrId;
@ApiModelProperty(value = "流程状态")
private String prcState;
@ApiModelProperty(value = "节点名称")
private String taskName;
@ApiModelProperty(value = "任务集合")
private List<String> taskList;
@ApiModelProperty(value = "流程名称")
private String prcName;
@ApiModelProperty(value = "流程编号")
private String prcNum;
@ApiModelProperty(value = "高级搜索字符串")
private String advanceSearchVOStr;
}
@@ -1,107 +0,0 @@
package com.adc.da.wkflow.business_activiti.dto;
import java.util.Date;
public class ZNodes {
private String orgName;
private boolean isParent;
private Date creationTime;
private String roleId;
private String icon;
private String pId;
private String title;
private Date modifyTime;
private String name;
private String roleName;
private String id;
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public String getOrgName() {
return orgName;
}
public void setIsParent(boolean isParent) {
this.isParent = isParent;
}
public boolean getIsParent() {
return isParent;
}
public void setCreationTime(Date creationTime) {
this.creationTime = creationTime;
}
public Date getCreationTime() {
return creationTime;
}
public void setRoleId(String roleId) {
this.roleId = roleId;
}
public String getRoleId() {
return roleId;
}
public void setIcon(String icon) {
this.icon = icon;
}
public String getIcon() {
return icon;
}
public void setPId(String pId) {
this.pId = pId;
}
public String getPId() {
return pId;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public Date getModifyTime() {
return modifyTime;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getRoleName() {
return roleName;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
}
@@ -1,75 +0,0 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adc.da.wkflow.business_activiti.editor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.tmsps.fk.common.base.action.BaseAction;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author Tijs Rademakers
*/
@Api(description = "工作流编辑器")
@RestController
@RequestMapping(value = "/service")
public class ModelEditorJsonRestResource extends BaseAction implements ModelDataJsonConstants {
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@ApiOperation(value = "获取模型json数据")
@ApiImplicitParam(name = "modelId", value = "模型id")
@SuppressWarnings("deprecation")
@GetMapping(value = "/model/{modelId}/json", produces = "application/json")
public ObjectNode getEditorJson(@PathVariable String modelId) {
ObjectNode modelNode = null;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName());
}
modelNode.put(MODEL_ID, model.getId());
ObjectNode editorJsonNode = (ObjectNode) objectMapper
.readTree(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
modelNode.put("model", editorJsonNode);
} catch (Exception e) {
logger.error("Error creating model JSON", e);
throw new ActivitiException("Error creating model JSON", e);
}
}
return modelNode;
}
}
@@ -1,99 +0,0 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adc.da.wkflow.business_activiti.editor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
/**
* @author Tijs Rademakers
*/
@Api(description = "工作流编辑器")
@RestController
@RequestMapping(value = "/service")
public class ModelSaveRestResource implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@ApiOperation(value = "模型保存")
@ApiImplicitParams({ @ApiImplicitParam(name = "modelId", value = "模型id"),
@ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "json_xml", value = "流程图xml"),
@ApiImplicitParam(name = "svg_xml", value = "流程配置xml"),
@ApiImplicitParam(name = "description", value = "描述") })
@PutMapping(value = "/model/{modelId}/save")
@ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId, @RequestParam("name") String name,
@RequestParam("json_xml") String json_xml, @RequestParam("svg_xml") String svg_xml,
@RequestParam("description") String description) {
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, name);
modelJson.put(MODEL_DESCRIPTION, description);
model.setMetaInfo(modelJson.toString());
model.setName(name);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("Error saving model", e);
throw new ActivitiException("Error saving model", e);
}
}
}
@@ -1,44 +0,0 @@
/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adc.da.wkflow.business_activiti.editor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.ActivitiException;
import org.apache.commons.io.IOUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.io.InputStream;
/**
* @author Tijs Rademakers
*/
@Api(description = "工作流编辑器")
@RestController
@RequestMapping(value = "/service")
public class StencilsetRestResource {
@ApiOperation(value = "获取模型stencilset的数据")
@GetMapping(value = "/editor/stencilset", produces = "application/json;charset=utf-8")
public @ResponseBody String getStencilset() {
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
try {
return IOUtils.toString(stencilsetStream, "utf-8");
} catch (Exception e) {
throw new ActivitiException("Error while loading stencil set", e);
}
}
}
@@ -1,56 +0,0 @@
package com.adc.da.wkflow.business_activiti.instance;
import com.tmsps.fk.common.wrapper.WrapMapper;
import com.tmsps.fk.common.wrapper.Wrapper;
import com.adc.da.wkflow.util.activiti.ActivitiTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.runtime.ProcessInstanceQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@Api(description = "流程实例管理")
@RestController
public class ActivitiInstanceController {
@Autowired
private RuntimeService runtimeService;
@ApiOperation(value = "流程实例列表")
@ApiImplicitParam(name = "name", value = "名称")
@GetMapping("/activitiInstanceList")
public List<Map<String, Object>> activitiInstanceList(String name) {
// 创建查询对象
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
if (name != null && !"".equals(name)) {
processInstanceQuery.processInstanceNameLike("%" + name + "%");
}
processInstanceQuery.orderByProcessInstanceId().desc();
List<ProcessInstance> list = processInstanceQuery.list();
return ActivitiTools.turnProcessInstances(list);
}
@ApiOperation(value = "流程挂起")
@ApiImplicitParam(name = "processInstanceId", value = "流程实例id")
@GetMapping("/instance/suspend")
public Wrapper<String> suspend(String processInstanceId) {
runtimeService.suspendProcessInstanceById(processInstanceId);
return WrapMapper.ok("挂起成功");
}
@ApiOperation(value = "流程重新激活")
@ApiImplicitParam(name = "processInstanceId", value = "流程实例id")
@GetMapping("/instance/gorun")
public Wrapper<String> gorun(String processInstanceId) {
runtimeService.activateProcessInstanceById(processInstanceId);
return WrapMapper.ok("重新激活成功");
}
}
@@ -1,61 +0,0 @@
package com.adc.da.wkflow.business_activiti.instance;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.adc.da.wkflow.business_activiti.instance.service.InstanceService;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(description = "流程实例图")
@RestController
@RequestMapping("/instance")
public class InstanceImageController {
@Autowired
private InstanceService instanceService;
@Autowired
private IBusProcessNameService iBusProcessNameService;
// @ApiOperation(value = "获取图片")
// @ApiImplicitParam(name = "processInstanceId", value = "流程实例id")
// @GetMapping("/getImg")
// public void getImg(String processInstanceId, HttpServletResponse response) throws Exception {
// response.setContentType("image/jpg"); // 设置返回的文件类型
//
// byte[] bytes = instanceService.getProcessImage(processInstanceId);
//
// OutputStream os = response.getOutputStream();
// os.write(bytes);
// os.flush();
// os.close();
// }
@ApiOperation(value = "获取图片")
@ApiImplicitParam(name = "processInstanceId", value = "流程实例id")
@GetMapping("/getImg")
public byte[] getImg(String prcNum) throws Exception {
QueryWrapper queryWrapper = new QueryWrapper();
if(prcNum.indexOf("(子)") != -1){
final String[] split = prcNum.split("\\)");
queryWrapper.eq("PRC_NUM",split[1]);
queryWrapper.eq("PRC_TYPE","72");
}else {
queryWrapper.eq("PRC_NUM",prcNum);
}
BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
if (one == null || StringUtils.isEmpty(one.getPrcId())){
return new byte[0];
}
byte[] bytes = instanceService.getProcessImage(one.getPrcId());
return bytes;
}
}
@@ -1,124 +0,0 @@
package com.adc.da.wkflow.business_activiti.instance.service;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.PvmTransition;
import org.activiti.engine.impl.pvm.process.ActivityImpl;
import org.activiti.image.impl.DefaultProcessDiagramGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
@Service
public class InstanceService {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private RepositoryService repositoryService;
@Autowired
private HistoryService historyService;
public byte[] getProcessImage(String processInstanceId) throws Exception {
// TODO 获取流程图像,已执行节点和流程线高亮显示
// 获取历史流程实例
HistoricProcessInstance historicProcessInstance = queryHistoricProcessInstance(processInstanceId);
if (historicProcessInstance == null) {
throw new Exception();
} else {
// 获取流程定义
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService
.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
// 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
List<HistoricActivityInstance> historicActivityInstanceList = historyService
.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId)
.orderByHistoricActivityInstanceStartTime().asc().list();
// 已执行的节点ID集合
List<String> executedActivityIdList = new ArrayList<String>();
int index = 1;
logger.info("获取已经执行的节点ID");
for (HistoricActivityInstance activityInstance : historicActivityInstanceList) {
executedActivityIdList.add(activityInstance.getActivityId());
logger.info("第[" + index + "]个已执行节点=" + activityInstance.getActivityId() + " : "
+ activityInstance.getActivityName());
index++;
}
// 得到高亮线
List<String> highLightedFlowsList = getHighLightedFlows(processDefinition, historicActivityInstanceList);
// 获取流程图图像字符流
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId());
DefaultProcessDiagramGenerator generator = new DefaultProcessDiagramGenerator();
InputStream imageStream = generator.generateDiagram(bpmnModel, "png", executedActivityIdList,
highLightedFlowsList, "宋体", "宋体", "宋体", null, 1.0);
byte[] buffer = new byte[imageStream.available()];
imageStream.read(buffer);
imageStream.close();
return buffer;
}
}
private HistoricProcessInstance queryHistoricProcessInstance(String processInstanceId) {
// TODO 通过流程id查询流程
return historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
}
/**
* 获取高亮的线
*
* @param processDefinitionEntity
* @param historicActivityInstances
* @return
*
*/
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinitionEntity,
List<HistoricActivityInstance> historicActivityInstances) {
List<String> highFlows = new ArrayList<String>();// 用以保存高亮的线flowId
for (int i = 0; i < historicActivityInstances.size() - 1; i++) {// 对历史流程节点进行遍历
ActivityImpl activityImpl = processDefinitionEntity
.findActivity(historicActivityInstances.get(i).getActivityId());// 得到节点定义的详细信息
LinkedHashSet<ActivityImpl> sameStartTimeNodes = new LinkedHashSet<ActivityImpl>();// 用以保存后需开始时间相同的节点
ActivityImpl sameActivityImpl1 = processDefinitionEntity
.findActivity(historicActivityInstances.get(i + 1).getActivityId());
// 将后面第一个节点放在时间相同节点的集合里
sameStartTimeNodes.add(sameActivityImpl1);
for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
// HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);// 后续第一个节点
HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + 1);// 后续第二个节点
// if (activityImpl1.getStartTime().equals(activityImpl2.getStartTime()) || activityImpl1.getEndTime().equals(activityImpl2.getStartTime())) {
// 如果第一个节点和第二个节点开始时间相同保存
ActivityImpl sameActivityImpl2 = processDefinitionEntity
.findActivity(activityImpl2.getActivityId());
sameStartTimeNodes.add(sameActivityImpl2);
// }else {
// // 有不相同跳出循环
// continue;
// }
}
List<PvmTransition> pvmTransitions = activityImpl.getOutgoingTransitions();// 取出节点的所有出去的线
for (PvmTransition pvmTransition : pvmTransitions) {
// 对所有的线进行遍历
ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition.getDestination();
// 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
if (sameStartTimeNodes.contains(pvmActivityImpl) ) {
highFlows.add(pvmTransition.getId());
}
}
}
return highFlows;
}
}
@@ -1,254 +0,0 @@
package com.adc.da.wkflow.business_activiti.model;
import cn.hutool.core.util.CharsetUtil;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.tmsps.fk.common.base.action.BaseAction;
import com.tmsps.fk.common.util.ChkUtil;
import com.tmsps.fk.common.wrapper.WrapMapper;
import com.tmsps.fk.common.wrapper.Wrapper;
import com.adc.da.wkflow.util.CommonConstant;
import com.adc.da.wkflow.util.CreatedTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ModelQuery;
import org.activiti.engine.repository.NativeModelQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.activiti.editor.constants.ModelDataJsonConstants.*;
@Api(description = "工作流模板管理")
@RestController
public class ActivitiModelController extends BaseAction {
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@ApiOperation(value = "新建模板")
@SuppressWarnings("deprecation")
@GetMapping("/createModel")
public Model createModel(String name, String desc, String category){
try {
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode properties = objectMapper.createObjectNode();
properties.put("process_author", CommonConstant.LICENSE);
editorNode.set("properties", properties);
ObjectNode stencilset = objectMapper.createObjectNode();
stencilset.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
editorNode.set("stencilset", stencilset);
Model model = repositoryService.newModel();
String key = "m_" + CreatedTools.getCreated();
model.setTenantId("子系统1");
model.setKey(key);
model.setName(name);
model.setCategory(category);
model.setVersion(Integer.parseInt(
String.valueOf(repositoryService.createModelQuery()
.modelKey(model.getKey()).count() + 1)));
ObjectNode modelObjectNode = objectMapper.createObjectNode();
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, name);
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, model.getVersion());
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, desc);
model.setMetaInfo(modelObjectNode.toString());
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), editorNode.toString().getBytes("utf-8"));
return model;
} catch (UnsupportedEncodingException e) {
logger.error("UnsupportedEncodingException", e);
}
return null;
}
/**
* 根据modelId获取model
* @param modelId
* @return
*/
@GetMapping(value = "/model/json")
public Object getEditorJson(String modelId) {
ObjectNode modelNode;
Model model = repositoryService.getModel(modelId);
if (model != null) {
try {
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
} else {
modelNode = objectMapper.createObjectNode();
modelNode.put(MODEL_NAME, model.getName());
}
byte[] source = repositoryService.getModelEditorSource(model.getId());
modelNode.put(MODEL_ID, model.getId());
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(new String(source, CharsetUtil.UTF_8));
modelNode.set("model", editorJsonNode);
return modelNode;
} catch (Exception e) {
logger.error("Error creating model JSON", e);
throw new ActivitiException("Error creating model JSON", e);
}
}
return null;
}
/**
* 保存model信息
*
* @param modelId
* @param name
* @param description
* @param jsonXml
* @param svgXml
*/
@GetMapping("/model/save")
public boolean saveModel(String modelId, String name, String description, String jsonXml, String svgXml) {
boolean flag = true;
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, name);
modelJson.put(MODEL_DESCRIPTION, description);
model.setMetaInfo(modelJson.toString());
model.setName(name);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), jsonXml.getBytes(CharsetUtil.UTF_8));
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
flag = false;
logger.error("Error saving model", e);
throw new ActivitiException("Error saving model", e);
}
return flag;
}
@ApiOperation(value = "模板列表")
@ApiImplicitParams({ @ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "category_id", value = "类型id") })
@GetMapping("/modelList")
public Wrapper<List<Model>> modelList(String name, String category_id) {
String sql = "select distinct RES.* from ACT_RE_MODEL RES WHERE RES.TENANT_ID_ = '子系统1' and RES.NAME_<>'' and RES.CATEGORY_=#{category} order by RES.CREATE_TIME_ desc";
NativeModelQuery nativeModelQuery = repositoryService.createNativeModelQuery();
if (ChkUtil.isNull(category_id)) {
sql = sql.replace("and RES.CATEGORY_=#{category}", "");
}else {
nativeModelQuery.parameter("category", category_id);
}
nativeModelQuery.sql(sql);
List<Model> list = nativeModelQuery.list();
return WrapMapper.ok(list);
}
public static <T> Map<String, Object> beanToMap(T bean) {
Map<String, Object> map = new HashMap<>();
if (bean != null) {
BeanMap beanMap = BeanMap.create(bean);
for (Object key : beanMap.keySet()) {
map.put(key+"", beanMap.get(key));
}
}
return map;
}
@ApiOperation(value = "删除模板")
@ApiImplicitParam(name = "modelId", value = "模型id")
@GetMapping("/deleteModel")
public Wrapper<String> deleteModel(String modelId) {
repositoryService.deleteModel(modelId);
return WrapMapper.ok("删除成功");
}
@ApiOperation(value = "修改流程所属分类")
@ApiImplicitParam(name = "modelId", value = "模型id")
@GetMapping("/updatModel")
public Wrapper<String> updatModel(String modelId,String categoryId) {
Model modelData = repositoryService.getModel(modelId);
modelData.setCategory(categoryId);
repositoryService.saveModel(modelData);
return WrapMapper.ok("修改成功");
}
@ApiOperation(value = "部署")
@ApiImplicitParam(name = "modelId", value = "模型id")
@GetMapping("/deploy")
public Wrapper<String> deploy(String modelId) throws Exception {
// 获取模型
Model modelData = repositoryService.getModel(modelId);
byte[] bytes = repositoryService.getModelEditorSource(modelData.getId());
if (bytes == null) {
return WrapMapper.ok("模型数据为空,请先设计流程并成功保存,再进行发布。");
}
JsonNode modelNode = new ObjectMapper().readTree(bytes);
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
model.setTargetNamespace(modelData.getCategory());
if (model.getProcesses().size() == 0) {
return WrapMapper.ok("数据模型不符要求,请至少设计一条主线流程。");
}
byte[] bpmnBytes = new BpmnXMLConverter().convertToXML(model);
// 发布流程
String processName = modelData.getName() + ".bpmn20.xml";
Deployment deployment = repositoryService.createDeployment().name(modelData.getName())
.category(modelData.getCategory()).addString(processName, new String(bpmnBytes, "UTF-8")).deploy();
modelData.setDeploymentId(deployment.getId());
repositoryService.saveModel(modelData);
return WrapMapper.ok("部署成功");
}
/**
* 复制流程
* @param modelId
* @throws IOException
*/
@GetMapping("copyModel")
public Wrapper<String> copyModel(String modelId) throws IOException {
Model modelData = repositoryService.newModel();
Model oldModel = repositoryService.getModel(modelId);
modelData.setName(oldModel.getName() + "-复制");
modelData.setKey(oldModel.getKey());
modelData.setMetaInfo(oldModel.getMetaInfo());
modelData.setTenantId(oldModel.getTenantId());
modelData.setCategory(oldModel.getCategory());
repositoryService.saveModel(modelData);
repositoryService.addModelEditorSource(modelData.getId(), this.repositoryService.getModelEditorSource(oldModel.getId()));
repositoryService.addModelEditorSourceExtra(modelData.getId(), this.repositoryService.getModelEditorSourceExtra(oldModel.getId()));
return WrapMapper.ok(modelData.getId());
}
}
@@ -1,67 +0,0 @@
package com.adc.da.wkflow.business_activiti.model;
import com.tmsps.fk.common.util.ChkUtil;
import com.tmsps.fk.common.wrapper.WrapMapper;
import com.tmsps.fk.common.wrapper.Wrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Base64;
@Api(description = "流程图片管理")
@RestController
@RequestMapping("/model")
public class ActivitiModelImageController {
@Autowired
private RepositoryService repositoryService;
@ApiOperation(value = "获取图片-base64")
@ApiImplicitParam(name = "modelId", value = "模型id")
@GetMapping("/getImgBase64")
public Wrapper<String> getImgBase64(String modelId) {
// 模型模块
byte[] bytes = repositoryService.getModelEditorSourceExtra(modelId);
String image = Base64.getEncoder().encodeToString(bytes);
return WrapMapper.ok("data:image/png;base64," + image);
}
@ApiOperation(value = "获取图片")
@ApiImplicitParam(name = "modelId", value = "模型id")
@GetMapping("/getImg")
public void getImg(String modelId, HttpServletResponse response) throws IOException {
response.setContentType("image/jpg"); // 设置返回的文件类型
// 模型模块
byte[] bytes = repositoryService.getModelEditorSourceExtra(modelId);
OutputStream os = response.getOutputStream();
if(ChkUtil.isNotNull(bytes)) {
os.write(bytes);
os.flush();
os.close();
}
}
@ApiOperation(value = "获取图片-通过deploymentId")
@ApiImplicitParam(name = "deploymentId", value = "流程deploymentId")
@GetMapping("/getImgByDeploymentId")
public void getImgByDeploymentId(String deploymentId, HttpServletResponse response) throws IOException {
Model model = repositoryService.createModelQuery().deploymentId(deploymentId).singleResult();
String modelId = model.getId();
getImg(modelId, response);
}
}
@@ -1,59 +0,0 @@
package com.adc.da.wkflow.business_activiti.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tmsps.fk.common.util.ChkUtil;
import com.adc.da.wkflow.business_main.entity.Datas;
import com.adc.da.wkflow.business_main.entity.HiDatas;
import com.adc.da.wkflow.business_main.service.IDatasService;
import com.adc.da.wkflow.business_main.service.IHiDatasService;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricTaskInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* TODO 任务回退
*
* @author Administrator
*
*/
@Service
public class TaskRollBackService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private HistoryService historyService;
@Autowired
private IDatasService datasService;
@Autowired
private IHiDatasService hiDatasService;
@Transactional
public String rollBack(String backTaskId) {
// TODO 流程回退
logger.info("任务流程回退-->{}", backTaskId);
HistoricTaskInstance preTask = historyService.createHistoricTaskInstanceQuery().taskId(backTaskId)
.singleResult();
if (ChkUtil.isNull(preTask)) {
return "任务不存在";
}
// 获取任务提交信息
QueryWrapper<Datas> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("ACTI_PROC_INST_ID", preTask.getProcessInstanceId());
queryWrapper.eq("ACTI_TASK_ID", preTask.getId());
Datas datas = datasService.getOne(queryWrapper);
QueryWrapper<HiDatas> hiQueryWrapper = new QueryWrapper<>();
hiQueryWrapper.eq("DATAS_ID", datas.getObjectId());
HiDatas hiDatas = hiDatasService.getOne(hiQueryWrapper);
// 删除工作流历史记录数据
hiDatasService.rollBack(hiDatas, preTask.getProcessInstanceId());
// 删除任务记录数据
datasService.rollBack(datas);
return "回退成功";
}
}
@@ -1,83 +0,0 @@
package com.adc.da.wkflow.business_activiti.service;
import com.tmsps.fk.common.util.ChkUtil;
import com.adc.da.wkflow.business_activiti.dto.TaskCommonQuery;
import com.adc.da.wkflow.util.SessionTool;
import com.adc.da.wkflow.util.date.DateTools;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.NativeTaskQuery;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 待办任务注入类,动态修改 Task的assignee等
*
* @author 冯晓东
*
*/
@Service
public class TaskTodoService {
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private TaskService taskService;
/**
* 查询待办任务 拼接sql 包含待办任务和委托任务
* @param taskCommonQuery
* @return
*/
public NativeTaskQuery createSql(TaskCommonQuery taskCommonQuery) {
Date start = DateTools.strToDate2(taskCommonQuery.getStartTime());
Date end = DateTools.strToDate2(taskCommonQuery.getEndTime());
NativeTaskQuery nativeTaskQuery = taskService.createNativeTaskQuery();
StringBuilder sb = new StringBuilder();
sb.append(
"select distinct RES.* from ACT_RU_TASK RES left join ACT_RU_IDENTITYLINK I on I.TASK_ID_ = RES.ID_ inner join ACT_RE_PROCDEF D on RES.PROC_DEF_ID_ = D.ID_ ");
sb.append(" left join t_delegate_business db on RES.PROC_DEF_ID_=db.BUSINESS_KEY and db.IS_DELETED=0 ");
sb.append(" left join t_delegate de on db.DELEGATE_ID=de.OBJECT_ID and de.USERD=#{userd} ");
sb.append(" WHERE ");
//任务名称
if (ChkUtil.isNotNull(taskCommonQuery.getName())) {
sb.append(" RES.NAME_ LIKE #{taskName} and ");
nativeTaskQuery = nativeTaskQuery.parameter("taskName", taskCommonQuery.getName());
}
//日期查询
if (ChkUtil.isNotNull(taskCommonQuery.getStartTime())) {
sb.append(" RES.CREATE_TIME_ >= #{starttime} and ");
nativeTaskQuery = nativeTaskQuery.parameter("starttime", start);
}
if (ChkUtil.isNotNull(taskCommonQuery.getEndTime())) {
sb.append(" RES.CREATE_TIME_ <= #{endtime} and ");
nativeTaskQuery = nativeTaskQuery.parameter("endtime", end);
}
sb.append(
" (RES.ASSIGNEE_=#{assignee} or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and (I.USER_ID_=#{user_id} ))) ");
sb.append(
" or (RES.ASSIGNEE_ = de.USER or (RES.ASSIGNEE_ is null and I.TYPE_ = 'candidate' and (I.USER_ID_ = de.USER ))) ");
sb.append(" order by RES.CREATE_TIME_ desc ");
if(StringUtils.isBlank(taskCommonQuery.getUserId())){
nativeTaskQuery = nativeTaskQuery.parameter("userd", SessionTool.getSessionAdminId())
.parameter("assignee", SessionTool.getSessionAdminId())
.parameter("user_id", SessionTool.getSessionAdminId());
}else{
nativeTaskQuery = nativeTaskQuery.parameter("userd", taskCommonQuery.getUserId())
.parameter("assignee", taskCommonQuery.getUserId())
.parameter("user_id", taskCommonQuery.getUserId());
}
nativeTaskQuery = nativeTaskQuery.sql(sb.toString());
return nativeTaskQuery;
}
}
@@ -1,166 +0,0 @@
package com.adc.da.wkflow.business_activiti.task;
import com.adc.da.sys.entity.UserEO;
import com.adc.da.sys.service.UserEOServiceImpl;
import com.adc.da.sys.service.iservice.IUserEoService;
import com.adc.da.wkflow.business_main.service.IBusProcessNewService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tmsps.fk.common.util.ChkUtil;
import com.adc.da.wkflow.business_main.entity.*;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
import com.adc.da.wkflow.util.activiti.ActivitiTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.HistoryService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.history.HistoricTaskInstanceQuery;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import static com.adc.da.wkflow.util.date.DateTools.disposeApprovalTime;
@Api(description = "流程明细管理")
@RestController
@RequestMapping("/task")
public class TaskController {
@Autowired
private HistoryService historyService;
@Autowired
IUserEoService userEoService;
@Autowired
private IBusProcessNameService iBusProcessNameService;
@Autowired
private IBusProcessNewService iBusProcessNewService;
@ApiOperation(value = "流程实例明细列表")
@ApiImplicitParam(name = "prcNum", value = "流程实例id")
@GetMapping("/get_list_by_instance")
public List<Map<String, Object>> get_list_by_instance(String prcNum,String sortWord,String shunxu) {
QueryWrapper queryWrapper = new QueryWrapper();
if(prcNum.indexOf("(子)") != -1){
String[] split = prcNum.split("\\)");
queryWrapper.eq("PRC_NUM",split[1]);
queryWrapper.eq("PRC_TYPE","72");
}else {
queryWrapper.eq("PRC_NUM",prcNum);
}
BusProcessName one = iBusProcessNameService.getOne(queryWrapper);
// 缺了PRCID导致的BUg
if (one == null || StringUtils.isEmpty(one.getPrcId())){
return ActivitiTools.turnHistoricTaskInstance(new ArrayList<HistoricTaskInstance>());
}
HistoricTaskInstanceQuery historicTaskInstanceQuery = historyService.createHistoricTaskInstanceQuery()
.processInstanceId(one.getPrcId()).orderByTaskCreateTime().asc();
List<HistoricTaskInstance> list2 = historicTaskInstanceQuery.list();
List<Map<String,Object>> list = ActivitiTools.turnHistoricTaskInstance(list2);
for (Map<String, Object> historicTaskInstance : list) {
// 获取办理的历史信息
if(ChkUtil.isNull(historicTaskInstance.get("assignee"))) {
String taskId = historicTaskInstance.get("id").toString();
QueryWrapper processNewQueryWrapper = new QueryWrapper<BusProcessNew>();
processNewQueryWrapper.eq("TASK_ID",taskId);
BusProcessNew processNew = iBusProcessNewService.getOne(processNewQueryWrapper);
if(processNew!=null){
UserEO assignee = userEoService.getUserById(processNew.getUserId());
if(assignee != null){
historicTaskInstance.put("assignee", assignee.getUsname());
historicTaskInstance.put("assigneeId", assignee.getUsid());
}
}
}else{
UserEO assignee = userEoService.getUserById(historicTaskInstance.get("assignee").toString());
if(assignee != null){
historicTaskInstance.put("assignee", assignee.getUsname());
historicTaskInstance.put("assigneeId", assignee.getUsid());
historicTaskInstance.put("orgName",assignee.getData().getOrgName());
QueryWrapper queryWrapper2 = new QueryWrapper();
queryWrapper2.eq("TASK_ID",historicTaskInstance.get("id"));
queryWrapper2.orderByAsc("CREATE_TIME");
List<BusProcessEntrust> list1 = iBusProcessEntrustService.list(queryWrapper2);
String str = "";
if(list1.size()>0){
ResponseMessage<UserVO> assignee1 = userEoService.getUserById(list1.get(0).getUserId());
historicTaskInstance.put("assignee", assignee.getData().getUname()+"("+assignee1.getData().getUname()+" 委托)");
}
}
}
historicTaskInstance.put("prcType",one.getPrcType());
historicTaskInstance.put("prcName",one.getPrcName());
historicTaskInstance.put("prcNum",one.getPrcNum());
QueryWrapper queryWrapper1 = new QueryWrapper();
queryWrapper1.eq("TASK_ID",historicTaskInstance.get("id"));
List<BusProcessNew> list1 = iBusProcessNewService.list(queryWrapper1);
if(list1.size()>0){
historicTaskInstance.put("comment",list1.get(0).getCommitFlag());
historicTaskInstance.put("commentText",list1.get(0).getCommitText());
}else{
historicTaskInstance.put("comment","");
historicTaskInstance.put("commentText","");
}
QueryWrapper<Datas> datasQueryWrapper = new QueryWrapper<>();
datasQueryWrapper.lambda().eq(Datas::getActiTaskId,historicTaskInstance.get("id"));
List<Datas> datasList = iDatasService.list(datasQueryWrapper);
if(datasList.size()>0){
Map<String,String> formValsJsonMap = JSONObject.parseObject(datasList.get(0).getFormValsJson(),Map.class);
historicTaskInstance.put("approvalOpinion",formValsJsonMap.get("approvalOpinion"));
historicTaskInstance.put("approvalResult",formValsJsonMap.get("flag")!=null ? formValsJsonMap.get("flag"):"");
historicTaskInstance.put("approvalFile",formValsJsonMap.get("approvalFile")!=null ? formValsJsonMap.get("approvalFile"):"");
}
Date createTime = (Date) historicTaskInstance.get("createTime");
Date endTime = (Date) historicTaskInstance.get("endTime");
if(endTime!=null){
long approvalTime = disposeApprovalTime(createTime,endTime);
historicTaskInstance.put("approvalTime",approvalTime + "小时");
}
}
if(StringUtils.isNotBlank(sortWord)){
Collections.sort(list, new Comparator<Map<String, Object>>() {
@Override
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
String id1 = (String) o1.get(sortWord);
String id2 = (String) o2.get(sortWord);
if(shunxu.equals("desc")){
return id1.compareTo(id2);
}else{
return id2.compareTo(id1);
}
}
});
}
return list;
}
@ApiOperation(value = "通过流程实例id查询当前待办的流程实例是否结束")
@ApiImplicitParam(name = "prcId", value = "流程实例id")
@GetMapping("/queryTaskWhetherToEnd")
public boolean queryTaskWhetherToEnd(@RequestParam("prcId") String prcId) {
boolean result = false;
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(prcId).singleResult();
if(historicProcessInstance!=null){
if (!Objects.isNull(historicProcessInstance.getEndTime())) {
return true;
}
}
return result;
}
}
@@ -1,22 +0,0 @@
package com.adc.da.wkflow.business_main.entity;
import lombok.Data;
@Data
public class BusMes {
private String userId;
private String taskId;
private String submitJson; // 提交的数据
private String prcType;
private String createUser;
private String createUserName;
private String dept;
}
@@ -1,100 +0,0 @@
package com.adc.da.wkflow.business_main.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author 冯晓东
* @since 2020-11-11
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("BUS_PROCESS_NAME")
@ApiModel(value="BusProcessName对象", description="")
public class BusProcessName implements Serializable {
private static final long serialVersionUID=1L;
@TableId(value = "ID", type = IdType.UUID)
private String id;
@TableField("PRC_NAME")
private String prcName;
@TableField("PRC_ID")
private String prcId;
@TableField("PRC_MES")
private String prcMes;
@TableField("OVER_TIME")
private String overTime;
@TableField("PRC_NUM")
private String prcNum;
@TableField("CREAT_TIME")
private String creatTime;
@TableField("CREAT_USER")
private String creatUser;
@TableField("PRC_TYPE")
private String prcType;
@TableField("CREATE_USER_NAME")
private String creatUserName;
@TableField("MES")
private String mes;
@TableField("END_TIME")
private String endTime;
@TableField(exist = false)
private String taskIds;
@TableField(exist = false)
private String taskInfo;
@TableField(exist = false)
private String taskAssignee;
@TableField(exist = false)
private String isEnd;
@TableField(exist = false)
private String taskBackAssignee;
//流程节点(任务)定义key
@TableField(exist = false)
private String taskDefinitionKey;
@TableField(exist = false)
private String taskId;
//审批时间
@TableField(exist = false)
private String approvalTime;
//状态
@TableField(exist = false)
private String status;
//提交状态 0:草稿、1:提交 对应枚举 SubmitStatusEnum
@TableField("SUBMIT_STATUS")
private String submitStatus;
}
@@ -1,87 +0,0 @@
package com.adc.da.wkflow.business_main.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author 冯晓东
* @since 2020-11-10
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("BUS_PROCESS_NEW")
@ApiModel(value="BusProcessNew对象", description="")
public class BusProcessNew implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(value = "主键")
@TableId(value = "ID", type = IdType.UUID)
private String id;
@ApiModelProperty(value = "资源类型")
@TableField("MSG_TYPE")
private String msgType;
@ApiModelProperty(value = "标准id")
@TableField("STAND_ID")
private String standId;
@ApiModelProperty(value = "条款id")
@TableField("CLAUSE_ID")
private String clauseId;
@ApiModelProperty(value = "处理人")
@TableField("USER_ID")
private String userId;
@ApiModelProperty(value = "信息")
@TableField("MESG")
private String mesg;
@ApiModelProperty(value = "节点信息")
@TableField("TASK_INFO")
private String taskInfo;
@ApiModelProperty(value = "父级id")
@TableField("PARENT_ID")
private String parentId;
@ApiModelProperty(value = "任务id")
@TableField("TASK_ID")
private String taskId;
@ApiModelProperty(value = "流程实例id")
@TableField("P_ID")
private String pId;
@ApiModelProperty(value = "完成注记")
@TableField("FINISH_FLAG")
private String finishFlag;
@ApiModelProperty(value = "审批意见")
@TableField("COMMIT_FLAG")
private String commitFlag;
@ApiModelProperty(value = "审批意见")
@TableField("COMMIT_TEXT")
private String commitText;
@ApiModelProperty(value = "子流程ID")
@TableField("SUB_ID")
private String subId;
}
@@ -1,21 +0,0 @@
package com.adc.da.wkflow.business_main.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author 冯晓东
* @since 2020-11-11
*/
public interface BusProcessNameMapper extends BaseMapper<BusProcessName> {
//查询符合要求的 name 信息
List<BusProcessName> findBusProcessNameForEnd();
}
@@ -1,29 +0,0 @@
package com.adc.da.wkflow.business_main.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author 冯晓东
* @since 2020-11-10
*/
public interface BusProcessNewMapper extends BaseMapper<BusProcessNew> {
/**
* 根据taskIds查询未完成的任务数据
* @param taskIds
* @return
*/
List<BusProcessNew> findNoExecuteBusProcessNew(@Param("taskIds")List<String> taskIds);
List<BusProcessNew> findNoExecuteBusProcessNewForEnd(@Param("taskIds")List<String> taskIds);
// String queryTaskName(@Param("id")String id);
}
@@ -1,27 +0,0 @@
package com.adc.da.wkflow.business_main.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author 冯晓东
* @since 2020-11-11
*/
public interface IBusProcessNameService extends IService<BusProcessName> {
List<BusProcessName> findBusProcessNameForEnd();
/**
* 根据规则生成流程单号和流程名称
* @param prcType
* @return
*/
Map<String, Object> ruleGeneratePrcNumAndPrcNum(String prcType);
}
@@ -1,32 +0,0 @@
package com.adc.da.wkflow.business_main.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import org.activiti.engine.task.Task;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author 冯晓东
* @since 2020-11-10
*/
public interface IBusProcessNewService extends IService<BusProcessNew> {
List<BusProcessNew> findtodotask(String userId, String pId);
List<Task> QueryTask(String userId, String pId);
/**
* 根据taskId集合查下任务
* @param taskIdList
* @return
*/
List<BusProcessNew> findTaskDetailByTaskIds(List<String> taskIdList);
List<BusProcessNew> findNoExecuteBusProcessNewForEnd(List<String> taskIdList);
}
@@ -1,59 +0,0 @@
package com.adc.da.wkflow.business_main.service.impl;
import com.adc.da.wkflow.enums.FlowTypeEnum;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import com.adc.da.wkflow.business_main.mapper.BusProcessNameMapper;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
import com.adc.da.wkflow.util.ImpulseSenderUtils;
import org.activiti.engine.ActivitiException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author 冯晓东
* @since 2020-11-11
*/
@Service
public class BusProcessNameServiceImpl extends ServiceImpl<BusProcessNameMapper, BusProcessName> implements IBusProcessNameService {
@Autowired
BusProcessNameMapper busProcessNameMapper;
public List<BusProcessName> findBusProcessNameForEnd(){
//该接口中,CREATE_USER_NAME 存放 BusProcessNew 中的 userId
return busProcessNameMapper.findBusProcessNameForEnd();
}
@Override
public Map<String, Object> ruleGeneratePrcNumAndPrcNum(String prcType) {
String currentDay = new SimpleDateFormat("yyyyMMdd").format(new Date());
Map<String,Object> result = new HashMap<>();
String prcName = "";
String prcNum = "";
if(StringUtils.equals(FlowTypeEnum.BGQXSQLC.getValue(), prcType)){
prcName = FlowTypeEnum.BGQXSQLC.getPrcName();
prcNum = FlowTypeEnum.BGQXSQLC.getPrcNum();
}else {
throw new ActivitiException("非法的流程类型: " + prcType);
}
String numberByFlowType = ImpulseSenderUtils.getNumberByFlowType(prcType);
prcNum = prcNum + currentDay + numberByFlowType;
prcName = prcName + currentDay + numberByFlowType;
result.put("prcName",prcName);
result.put("prcNum",prcNum);
return result;
}
}
@@ -1,71 +0,0 @@
package com.adc.da.wkflow.business_main.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.adc.da.wkflow.business_main.entity.BusProcessNew;
import com.adc.da.wkflow.business_main.mapper.BusProcessNewMapper;
import com.adc.da.wkflow.business_main.service.IBusProcessNewService;
import org.activiti.engine.TaskService;
import org.activiti.engine.task.Task;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
/**
* <p>
* 服务实现类
* </p>
*
* @author 冯晓东
* @since 2020-11-10
*/
@Service
public class BusProcessNewServiceImpl extends ServiceImpl<BusProcessNewMapper, BusProcessNew> implements IBusProcessNewService {
private TaskService taskService;
/*
* @Author yuzhong
* @Description
* @Date 2020/11/11
* 返回待办信息详情
*/
@Override
public List<BusProcessNew> findtodotask(String userId,String pId) {
QueryWrapper<BusProcessNew> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("FINISH_FLAG","0");
queryWrapper.eq("P_ID",pId);
queryWrapper.eq("USER_ID",userId);
List<BusProcessNew> taskList = this.list(queryWrapper);
return taskList;
}
/*
* @Author yuzhong
* @Description
* @Date 2020/11/11
* 返回待办任务列表
*/
public List<Task> QueryTask(String userId,String pId){
List<Task> list = taskService.createTaskQuery().processInstanceId(pId).taskCandidateUser(userId).list();
//list根据人员去重
list = list.stream().collect( Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(o -> o.getAssignee()))),
ArrayList::new));
return list;
}
@Override
public List<BusProcessNew> findTaskDetailByTaskIds(List<String> taskIdList) {
return baseMapper.findNoExecuteBusProcessNew(taskIdList);
}
@Override
public List<BusProcessNew> findNoExecuteBusProcessNewForEnd(List<String> taskIdList) {
return baseMapper.findNoExecuteBusProcessNewForEnd(taskIdList);
}
}
@@ -1,53 +0,0 @@
package com.adc.da.wkflow.enums;
import org.apache.commons.codec.binary.StringUtils;
/**
* 流程类型枚举类
*/
public enum FlowTypeEnum {
BGQXSQLC("1","报告权限申请流程","QXSQ","报告权限申请流程",""),
;
private String value;
private String lable;
private String prcNum;
private String prcName;
private String route; //待办页面路由
private FlowTypeEnum(String value, String lable, String prcNum, String prcName, String route) {
this.value = value;
this.lable = lable;
this.prcNum = prcNum;
this.prcName = prcName;
this.route = route;
}
public String getValue() {
return value;
}
public String getLable() {
return lable;
}
public String getPrcNum() {
return prcNum;
}
public String getPrcName() {
return prcName;
}
public String getRoute() {
return route;
}
public static FlowTypeEnum getFlowTypeEnumByValue(String value){
FlowTypeEnum[] values = FlowTypeEnum.values();
for (FlowTypeEnum flowTypeEnum : values) {
if (flowTypeEnum.getValue().equals(value)){
return flowTypeEnum;
}
}
return null;
}
}
@@ -1,26 +0,0 @@
package com.adc.da.wkflow.enums;
/**
* 提交状态枚举类
*/
public enum SubmitStatusEnum {
DRAFT("0","草稿"),
SUBMIT("1","提交"),
DELETE("2","删除"),
;
private String value;
private String lable;
private SubmitStatusEnum(String value, String lable) {
this.value = value;
this.lable = lable;
}
public String getValue() {
return value;
}
public String getLable() {
return lable;
}
}
@@ -1,28 +0,0 @@
package com.adc.da.wkflow.util;
public interface CommonConstant {
/**
* 项目的license
*/
String LICENSE = "made by hujw";
/**
* 成功标记
*/
Integer SUCCESS=0;
/**
* 失败标记
*/
Integer FAIL=1;
/**
* 当前页
*/
String CURRENT="current";
/**
* 每页大小
*/
String SIZE="size";
}
@@ -1,30 +0,0 @@
package com.adc.da.wkflow.util;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class CreatedTools {
private final static DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
// 返回long型的创建时间
public static long getCreated() {
Date d = new Date();
long l = Long.parseLong(df.format(d));
return l;
}
public static long getCreated(int add) {
long t = System.currentTimeMillis() + add;
Timestamp time = new Timestamp(t);
long l = Long.parseLong(df.format(time));
return l;
}
public static long t() {
return 0l;
}
}
@@ -1,124 +0,0 @@
package com.adc.da.wkflow.util;
import com.adc.da.wkflow.enums.FlowTypeEnum;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.adc.da.wkflow.business_main.entity.BusProcessName;
import com.adc.da.wkflow.business_main.service.IBusProcessNameService;
import org.activiti.engine.ActivitiException;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 发号器工具类
* @Author: wzj
* @Date: 2022/10/10 10:54
**/
@Component
@EnableScheduling
public class ImpulseSenderUtils {
protected Logger logger = LoggerFactory.getLogger(ImpulseSenderUtils.class);
//定义每天最多生成编号数量,因为项目中流程编号是4位流水号。
private static final int MAX_NUM = 9999;
//初始值
private static final int INITIAL_VALUE = 0;
//定义每个流程的编号原子变量
private static AtomicInteger bgqxsqNumber;
private static IBusProcessNameService busProcessNameService;
@Autowired
public void setBusProcessNameService(IBusProcessNameService busProcessNameService) {
ImpulseSenderUtils.busProcessNameService = busProcessNameService;
}
/**
* 初始化流程编号中的流水号,每次启动项目的时候初始化、使用定时器在每天0点初始化。
*/
@PostConstruct
public static void initNumber (){
//先初始化一遍,如果有发起流程,会在下方判断中代码处理
bgqxsqNumber = new AtomicInteger(INITIAL_VALUE);
String currentDay = new SimpleDateFormat("yyyyMMdd").format(new Date());
QueryWrapper<BusProcessName> queryWrap = new QueryWrapper<>();
queryWrap.lambda().like(BusProcessName::getPrcName,currentDay);
queryWrap.orderByDesc("CREAT_TIME");
List<BusProcessName> busProcessNameList = ImpulseSenderUtils.busProcessNameService.list(queryWrap);
if (CollectionUtils.isNotEmpty(busProcessNameList)) {
//如果当天发起过流程,将数据根据流程类型进行分组,处理每个流程的流水号
Map<String, List<BusProcessName>> collect = busProcessNameList.stream().collect(Collectors.groupingBy(BusProcessName::getPrcType));
for (Map.Entry<String, List<BusProcessName>> entry : collect.entrySet()) {
//当日发起流程总数量
int count = (int) entry.getValue().stream().count();
//流程类型
String prcType = entry.getKey();
FlowTypeEnum flowTypeEnumByValue = FlowTypeEnum.getFlowTypeEnumByValue(prcType);
switch (flowTypeEnumByValue){
case BGQXSQLC:
bgqxsqNumber = new AtomicInteger(count);
break;
}
}
}
}
/**
* 根据流程类型,获取流程编号(每日的4位流水号)。
*/
public static String getNumberByFlowType(String flowType){
String result;
int number;
FlowTypeEnum flowTypeEnum = FlowTypeEnum.getFlowTypeEnumByValue(flowType);
if(Objects.isNull(flowTypeEnum)){
throw new ActivitiException("非法的流程类型: " + flowType);
}
switch (flowTypeEnum){
case BGQXSQLC:
number = bgqxsqNumber.incrementAndGet();
checkNumberLegitimate(number,"报告权限申请流程");
break;
default:
throw new ActivitiException("流程类型 " + flowType + " 非法!");
}
//例如number=1 变成0001,如果想变成001---“%03d”
result = String.format("%04d",number);
return result;
}
/**
* 验证编号合法
* @param number 编号
* @param flowTypeName 流程类型名称
*/
public static void checkNumberLegitimate(int number,String flowTypeName){
if(number > MAX_NUM){
throw new ActivitiException(flowTypeName + "流程,当日发起已达最大上限,请明日再发起!");
}
}
/**
* 定时任务初始化每天的流程流水号
* @throws Exception
*/
@Scheduled(cron = "5 0 0 * * ? ") //每天凌晨0点0分第五秒执行。 参数下标 1:秒 2:分 3:时 执行任务。
public void initNumberTimer() throws Exception {
logger.info("定时任务初始化每天的流程流水号=============================================开始");
initNumber();
logger.info("定时任务初始化每天的流程流水号=============================================结束");
}
}
@@ -1,59 +0,0 @@
package com.adc.da.wkflow.util;
import com.tmsps.fk.common.util.ChkUtil;
import com.tmsps.fk.common.util.CookieUtil;
import com.tmsps.fk.common.util.DesUtil;
import com.adc.da.wkflow.config.WebConfig;
/**
* Session业务相关工具类
*
* @author 冯晓东 398479251@qq.com
*
*/
public class SessionMemberTool {
// Session 分割符
private static final String SPLIT = ":";
/**
* 设置 or 取消设置 登录key
*
* 加密 memberId
*
* @param sessionKey
* @return
*/
public static String setSessionMemberLoginKey(String memberId) {
String sessionKey = DesUtil.encrypt(WebConfig.MEMBERSESSION + SPLIT + memberId, WebConfig.DESKEY);
CookieUtil.setCookie(WebUtil.getReponse(), WebConfig.MEMBERSESSION, sessionKey, 10 * 365 * 24 * 60 * 60);
return sessionKey;
}
/**
* 解密 memberId
*
* @param loginKey
* @return
*/
public static String getMemberIdFromKey(String loginKey) {
if (ChkUtil.isNull(loginKey) || "null".equals(loginKey)) {
return null;
}
System.err.println(loginKey);
String key = DesUtil.decrypt(loginKey, WebConfig.DESKEY);
if (key == null || !key.startsWith(WebConfig.MEMBERSESSION + SPLIT)) {
return null;
}
String memberId = key.substring((WebConfig.MEMBERSESSION + SPLIT).length());
return memberId;
}
public static void setSessionMemberId(String memberId) {
WebUtil.getSession().setAttribute("MEMBER_ID", memberId);
}
public static String getSessionMemberId() {
return (String) WebUtil.getSession().getAttribute("MEMBER_ID");
}
}
@@ -1,55 +0,0 @@
package com.adc.da.wkflow.util;
import com.alibaba.fastjson.JSONObject;
import com.tmsps.fk.common.util.ChkUtil;
import com.tmsps.fk.common.util.CookieUtil;
import com.tmsps.fk.common.util.DesUtil;
import com.tmsps.fk.common.util.JsonUtil;
import com.adc.da.wkflow.config.WebConfig;
/**
* Session业务相关工具类
*
* @author 冯晓东 398479251@qq.com
*
*/
public class SessionTool {
// Session 分割符
private static final String SPLIT = ":";
// 短信验证码
public static final String CODE = "SMS_CODE";
/**
* 设置 or 取消设置 登录key
*
* @param sessionKey
*/
public static void setSessionAdminLoginKey(String userJson) {
String sessionKey = DesUtil.encrypt(WebConfig.ADMINSESSION + SPLIT + userJson, WebConfig.DESKEY);
CookieUtil.setCookie(WebUtil.getReponse(), WebConfig.ADMINSESSION, sessionKey, 1 * 24 * 60 * 60);
}
public static JSONObject getSessionAdmin() {
String sessionKey = CookieUtil.getCookie(WebUtil.getRequest(), WebConfig.ADMINSESSION);
if (ChkUtil.isNull(sessionKey)) {
return null;
} else {
String key = DesUtil.decrypt(sessionKey, WebConfig.DESKEY);
if (!key.startsWith(WebConfig.ADMINSESSION + SPLIT)) {
return null;
}
String userJson = key.substring((WebConfig.ADMINSESSION + SPLIT).length());
JSONObject user = JsonUtil.jsonStrToJsonObject(userJson);
return user;
}
}
public static String getSessionAdminId() {
JSONObject userJSON = getSessionAdmin();
if(ChkUtil.isNotNull(userJSON)) {
return userJSON.getString("objectId");
}
return null;
}
}
@@ -1,38 +0,0 @@
package com.adc.da.wkflow.util;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class SpringContextUtil implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringContextUtil.applicationContext = applicationContext;
}
// 获取applicationContext
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
// 通过name获取 Bean.
public static Object getBean(String name) {
return getApplicationContext().getBean(name);
}
// 通过class获取Bean.
public static <T> T getBean(Class<T> clazz) {
return getApplicationContext().getBean(clazz);
}
// 通过name,以及Clazz返回指定的Bean
public static <T> T getBean(String name, Class<T> clazz) {
return getApplicationContext().getBean(name, clazz);
}
}
@@ -1,20 +0,0 @@
package com.adc.da.wkflow.util;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
public class StringUtils {
/**
* 使用逗号拼接的字符串数据去重。
* @return
*/
public static String StringDisposeDistinct(String value){
String[] valueArr = value.split(",");
List<String> valueArrList = Arrays.stream(valueArr).distinct().collect(Collectors.toList());
String values = valueArrList.stream().collect(Collectors.joining(","));
return values;
}
}
@@ -1,112 +0,0 @@
package com.adc.da.wkflow.util;
import com.tmsps.fk.common.util.ChkUtil;
import java.text.SimpleDateFormat;
import java.util.*;
public class TjTools {
// 获取统计数据
public static Map<String, Integer> groupBy(List<Map<String, Object>> list, String key) {
Map<String, Integer> result = new HashMap<>();
if (ChkUtil.isNull(list)) {
return result;
}
for (Map<String, Object> map : list) {
String val = (String) map.get(key);
if (val == null) {
continue;
}
Integer cnt = result.get(val);
if (cnt == null) {
cnt = 1;
} else {
cnt++;
}
result.put(val, cnt);
}
return result;
}
// 分组保存每年12个月的数据
public static List<Map<String, Object>> groupByAddTimes(List<Map<String, Object>> list,
List<Map<String, Object>> type) {
if (list.size() == 0 || type.size() == 0) {
return null;
}
List<Map<String, Object>> list2 = new ArrayList<Map<String, Object>>();
// 遍历type中的数据
type.forEach(t -> {
// 创建map用来保存数据
Map<String, Object> map = new HashMap<String, Object>();
// 创建int[] 用来保存12个月的数据
int[] data = new int[12];
// 遍历list中的数据
if (t.get("type") != null) {
list.forEach(l -> {
long num = (long) l.get("num");
String times = (String) l.get("times");
if (l.get("type") != null && l.get("type").equals(t.get("type"))) {
data[ChkUtil.getInteger(times.substring(times.indexOf("-") + 1)) - 1] = (int) num;
}
});
map.put("name", t.get("type"));
map.put("data", data);
list2.add(map);
}
});
return list2;
}
// 保存每年12个月的数据
public static Map<String, Object> addTimes(Map<String, Integer> map) {
Map<String, Object> map1 = new HashMap<String, Object>();
int[] a = new int[12];
Set<String> timeKey = map.keySet();
for (String s : timeKey) {
a[ChkUtil.getInteger(s.substring(s.indexOf("-") + 1)) - 1] = map.get(s);
}
map1.put("time", a);
return map1;
}
// 保存每年每天的数据
public static Map<String, Object> addYearTimes(List<Map<String, Object>> list, int date) {
Map<String, Object> map = new LinkedHashMap<String, Object>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-M-d");
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, date);
cal.set(Calendar.MONTH, 1);
cal.set(Calendar.DAY_OF_YEAR, 1);
Calendar cal1 = Calendar.getInstance();
cal1.set(Calendar.YEAR, date + 1);
cal1.set(Calendar.MONTH, 1);
cal1.set(Calendar.DAY_OF_YEAR, 1);
cal1.set(Calendar.HOUR_OF_DAY, 0);
cal1.set(Calendar.MINUTE, 0);
cal1.set(Calendar.SECOND, 0);
while (cal.compareTo(cal1) < 0) {
map.put(sdf.format(cal.getTime()), 0);
cal.add(Calendar.DAY_OF_YEAR, 1);
}
list.forEach(l -> {
map.put((String) l.get("times"), l.get("num"));
});
return map;
}
public static void main(String[] args) {
addYearTimes(null, 2017);
}
}
@@ -1,38 +0,0 @@
package com.adc.da.wkflow.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: TODO
* @author: super_liu
* @date: 2021年03月04日 17:13
*/
public class Utils {
public static Map<String, JSONArray> jsonArrGroup(JSONArray arr, String groupName, String sGroupName) {
Map<String, JSONArray> map = new HashMap<>();
String tempIdStr = "";
JSONArray list;
for(Object obj : arr){
JSONObject jsonObject = (JSONObject) obj;
tempIdStr = jsonObject.getString(groupName);
if(tempIdStr.equals("")){
continue;
}
if(map.containsKey(tempIdStr)){
list = map.get(tempIdStr);
list.add(obj);
}else{
list = new JSONArray();
list.add(obj);
map.put(tempIdStr, list);
}
}
return map;
}
}
@@ -1,60 +0,0 @@
package com.adc.da.wkflow.util;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* web层相关工具类
*
* @author 冯晓东 398479251@qq.com
*
*/
public class WebUtil {
public static HttpServletRequest getRequest() {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getRequest();
return request;
}
public static HttpServletResponse getReponse() {
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
.getResponse();
return response;
}
public static HttpSession getSession() {
HttpSession sn = WebUtil.getRequest().getSession();
return sn;
}
public static ServletContext getServletContext() {
WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();
if (webApplicationContext == null) {
return null;
}
ServletContext servletContext = webApplicationContext.getServletContext();
return servletContext;
}
/**
* 同步获取token值并移除
*
* @param string
* @return
*/
public static synchronized String getAsyncToken(String key) {
HttpSession sn = WebUtil.getRequest().getSession();
String val = (String) sn.getAttribute(key);
sn.removeAttribute(key);
return val;
}
}
@@ -1,204 +0,0 @@
/**
*
*/
package com.adc.da.wkflow.util.activiti;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* TODO 工作流表结构转换
* @author hxj
*
*/
public class ActivitiTools {
public static List<Map<String, Object>> turnModels(List<Model> models) {
List<Map<String, Object>> list = new ArrayList<>();
for (Model model : models) {
Map<String, Object> map = new HashMap<>();
map.put("id", model.getId());
map.put("name", model.getName());
map.put("key", model.getKey());
map.put("category", model.getCategory());
map.put("createTime", model.getCreateTime());
map.put("lastUpdateTime", model.getLastUpdateTime());
map.put("version", model.getVersion());
map.put("metaInfo", model.getMetaInfo());
map.put("deploymentId", model.getDeploymentId());
map.put("tenanId", model.getTenantId());
list.add(map);
}
return list;
}
public static List<Map<String, Object>> turnProcessDefinitions(List<ProcessDefinition> models) {
List<Map<String, Object>> list = new ArrayList<>();
for (ProcessDefinition model : models) {
Map<String, Object> map = new HashMap<>();
map.put("id", model.getId());
map.put("category", model.getCategory());
map.put("name", model.getName());
map.put("key", model.getKey());
map.put("description", model.getDescription());
map.put("version", model.getVersion());
map.put("resourceName", model.getResourceName());
map.put("deploymentId", model.getDeploymentId());
map.put("diagramResourceName", model.getDiagramResourceName());
map.put("hasStartFormKey", model.hasStartFormKey());
map.put("isGraphicalNotationDefined", model.hasGraphicalNotation());
map.put("suspensionState", model.isSuspended());
map.put("tenanId", model.getTenantId());
list.add(map);
}
return list;
}
public static List<Map<String, Object>> turnTasks(List<Task> models) {
List<Map<String, Object>> list = new ArrayList<>();
for (Task model : models) {
Map<String, Object> map = new HashMap<>();
map.put("id", model.getId());
map.put("name", model.getName());
map.put("description", model.getDescription());
map.put("priority", model.getPriority());
map.put("owner", model.getOwner());
map.put("assignee", model.getAssignee());
map.put("processInstanceId", model.getProcessInstanceId());
map.put("executionId", model.getExecutionId());
map.put("processDefinitionId", model.getProcessDefinitionId());
map.put("createTime", model.getCreateTime());
map.put("taskDefinitionKey", model.getTaskDefinitionKey());
map.put("dueDate", model.getDueDate());
map.put("category", model.getCategory());
map.put("parentTaskId", model.getParentTaskId());
map.put("tenantId", model.getTenantId());
map.put("formKey", model.getFormKey());
map.put("delegationState", model.getDelegationState());
map.put("suspended", model.isSuspended());
map.put("taskLocalVariables", model.getTaskLocalVariables());
map.put("processVariables", model.getProcessVariables());
list.add(map);
}
return list;
}
public static Map<String, Object> turnProcessInstance(ProcessInstance model) {
Map<String, Object> map = new HashMap<>();
map.put("id", model.getId());
map.put("isSuspended", model.isSuspended());
map.put("isEnded", model.isEnded());
map.put("activityId", model.getActivityId());
map.put("processInstanceId", model.getProcessInstanceId());
map.put("parentId", model.getParentId());
map.put("superExecutionId", model.getSuperExecutionId());
map.put("tenantId", model.getTenantId());
map.put("name", model.getName());
map.put("description", model.getDescription());
map.put("processDefinitionId", model.getProcessDefinitionId());
map.put("processDefinitionName", model.getProcessDefinitionName());
map.put("processDefinitionKey", model.getProcessDefinitionKey());
map.put("processDefinitionVersion", model.getProcessDefinitionVersion());
map.put("deploymentId", model.getDeploymentId());
map.put("businessKey", model.getBusinessKey());
map.put("processVariables", model.getProcessVariables());
map.put("localizedName", model.getLocalizedName());
map.put("localizedDescription", model.getLocalizedDescription());
return map;
}
public static List<Map<String, Object>> turnProcessInstances(List<ProcessInstance> models) {
List<Map<String, Object>> list = new ArrayList<>();
for (ProcessInstance model : models) {
Map<String, Object> map = new HashMap<>();
map.put("id", model.getId());
map.put("isSuspended", model.isSuspended());
map.put("isEnded", model.isEnded());
map.put("activityId", model.getActivityId());
map.put("processInstanceId", model.getProcessInstanceId());
map.put("parentId", model.getParentId());
map.put("superExecutionId", model.getSuperExecutionId());
map.put("tenantId", model.getTenantId());
map.put("name", model.getName());
map.put("description", model.getDescription());
map.put("processDefinitionId", model.getProcessDefinitionId());
map.put("processDefinitionName", model.getProcessDefinitionName());
map.put("processDefinitionKey", model.getProcessDefinitionKey());
map.put("processDefinitionVersion", model.getProcessDefinitionVersion());
map.put("deploymentId", model.getDeploymentId());
map.put("businessKey", model.getBusinessKey());
map.put("processVariables", model.getProcessVariables());
map.put("localizedName", model.getLocalizedName());
map.put("localizedDescription", model.getLocalizedDescription());
list.add(map);
}
return list;
}
public static List<Map<String, Object>> turnHistoryProcessInstances(List<HistoricProcessInstance> models) {
List<Map<String, Object>> list = new ArrayList<>();
for (HistoricProcessInstance model : models) {
Map<String, Object> map = new HashMap<>();
map.put("id", model.getId());
map.put("businessKey", model.getBusinessKey());
map.put("processDefinitionId", model.getProcessDefinitionId());
map.put("processDefinitionName", model.getProcessDefinitionName());
map.put("processDefinitionKey", model.getProcessDefinitionKey());
map.put("processDefinitionVersion", model.getProcessDefinitionVersion());
map.put("deploymentId", model.getDeploymentId());
map.put("startTime", model.getStartTime());
map.put("endTime", model.getEndTime());
map.put("durationInMillis", model.getDurationInMillis());
map.put("startUserId", model.getStartUserId());
map.put("startActivityId", model.getStartActivityId());
map.put("deleteReason", model.getDeleteReason());
map.put("superProcessInstanceId", model.getSuperProcessInstanceId());
map.put("tenantId", model.getTenantId());
map.put("name", model.getName());
map.put("description", model.getDescription());
map.put("processVariables", model.getProcessVariables());
list.add(map);
}
return list;
}
public static List<Map<String, Object>> turnHistoricTaskInstance(List<HistoricTaskInstance> models) {
List<Map<String, Object>> list = new ArrayList<>();
for (HistoricTaskInstance model : models) {
Map<String, Object> map = new HashMap<>();
map.put("assignee", model.getAssignee());
map.put("category", model.getCategory());
map.put("claimTime", model.getClaimTime());
map.put("createTime", model.getCreateTime());
map.put("deleteReason", model.getDeleteReason());
map.put("description", model.getDescription());
map.put("dueDate", model.getDueDate());
map.put("drationInMillis", model.getDurationInMillis());
map.put("endTime", model.getEndTime());
map.put("executionId", model.getExecutionId());
map.put("formKey", model.getFormKey());
map.put("id", model.getId());
map.put("name", model.getName());
map.put("owner", model.getOwner());
map.put("ParentTaskId", model.getParentTaskId());
map.put("priority", model.getPriority());
map.put("processDefinitionId", model.getProcessDefinitionId());
map.put("processInstanceId", model.getProcessInstanceId());
map.put("processVariables", model.getProcessVariables());
map.put("startTime", model.getStartTime());
map.put("taskDefinitionKey", model.getTaskDefinitionKey());
map.put("taskLocalVariables", model.getTaskLocalVariables());
list.add(map);
}
return list;
}
}
@@ -1,152 +0,0 @@
/**
*
*/
package com.adc.da.wkflow.util.coder;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.VelocityTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* 代码生成 - mybatis-plus
* 官方示例
* @author 冯晓东
*
*/
public class CodeGenerator {
private static final String parent = "com.adc.da.wkflow.business_main";
private static final String jdbcUrl = "jdbc:mysql://106.2.13.59:8037/bat-wkflow?nullCatalogMeansCurrent=true&serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=utf-8";
private static final String driver = "com.mysql.cj.jdbc.Driver";
private static final String uname = "rczbuser";
private static final String password = "91isoft@PT";
/**
* <p>
* 读取控制台内容
* </p>
*/
public static String scanner(String tip) {
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in);
StringBuilder help = new StringBuilder();
help.append("请输入" + tip + "");
System.out.println(help.toString());
if (scanner.hasNext()) {
String ipt = scanner.next();
if (StringUtils.isNotEmpty(ipt)) {
return ipt;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "");
}
public static void main(String[] args) {
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
String projectPath = System.getProperty("user.dir");
gc.setOutputDir(projectPath + "/src/main/java");
gc.setAuthor("冯晓东");
gc.setOpen(false);
//实体属性 Swagger2 注解
gc.setSwagger2(true);
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl(jdbcUrl);
// dsc.setSchemaName("public");
dsc.setDriverName(driver);
dsc.setUsername(uname);
dsc.setPassword(password);
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setModuleName(scanner("模块名"));
pc.setParent(parent);
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
// 如果模板引擎是 freemarker
//String templatePath = "/templates/mapper.xml.ftl";
// 如果模板引擎是 velocity
String templatePath = "/templates/mapper.xml.vm";
// 自定义输出配置
List<FileOutConfig> focList = new ArrayList<>();
// 自定义配置会被优先输出
focList.add(new FileOutConfig(templatePath) {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!!
return projectPath + "/src/main/resources/mapper/" + pc.getModuleName()
+ "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML;
}
});
/*
cfg.setFileCreate(new IFileCreate() {
@Override
public boolean isCreate(ConfigBuilder configBuilder, FileType fileType, String filePath) {
// 判断自定义文件夹是否需要创建
checkDir("调用默认方法创建的目录");
return false;
}
});
*/
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
// 配置模板
TemplateConfig templateConfig = new TemplateConfig();
// 配置自定义输出模板
//指定自定义模板路径,注意不要带上.ftl/.vm, 会根据使用的模板引擎自动识别
// templateConfig.setEntity("templates/entity2.java");
// templateConfig.setService();
// templateConfig.setController();
templateConfig.setXml(null);
mpg.setTemplate(templateConfig);
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// strategy.setSuperEntityClass("你自己的父类实体,没有就不用设置!");
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
// 公共父类
// strategy.setSuperControllerClass("你自己的父类控制器,没有就不用设置!");
// 写于父类中的公共字段
strategy.setSuperEntityColumns("id");
strategy.setInclude(scanner("表名,多个英文逗号分割").split(","));
strategy.setControllerMappingHyphenStyle(true);
strategy.setTablePrefix("t_");
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new VelocityTemplateEngine());
mpg.execute();
}
}
@@ -1,539 +0,0 @@
package com.adc.da.wkflow.util.date;
import com.tmsps.fk.common.util.ChkUtil;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateTools {
public static SimpleDateFormat SimpleDateFormat_YMD = new SimpleDateFormat("yyyy-MM-dd");
public static SimpleDateFormat SimpleDateFormat_YMD_HMS = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 增加对应天数
public static Timestamp addDay(Timestamp end, int day) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(end.getTime());
cal.add(Calendar.DAY_OF_YEAR, day);
return new Timestamp(cal.getTimeInMillis());
}
// 增加对应天数
public static java.sql.Date addDay(java.sql.Date end, int day) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(end.getTime());
cal.add(Calendar.DAY_OF_YEAR, day);
return new java.sql.Date(cal.getTimeInMillis());
}
public static String getstrDate(long created) {
String creat = created + "";
String year = creat.substring(0, 4);
String month = creat.substring(4, 6);
String day = creat.substring(6, 8);
String hour = creat.substring(8, 10);
String minute = creat.substring(10, 12);
String sec = creat.substring(12, 14);
return year + "" + month + "" + day + "" + hour + "" + minute + "" + sec + "";
}
public static String getstrDate1(long created) {
String creat = created + "";
String year = creat.substring(0, 4);
String month = creat.substring(4, 6);
String day = creat.substring(6, 8);
String hour = creat.substring(8, 10);
String minute = creat.substring(10, 12);
String sec = creat.substring(12, 14);
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + sec;
}
public static String getstrDate2(String created) {
String creat = created + "";
String year = creat.substring(0, 4);
String month = creat.substring(4, 6);
String day = creat.substring(6, 8);
String hour = creat.substring(8, 10);
String minute = creat.substring(10, 12);
String sec = creat.substring(12, 14);
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + sec;
}
// 增加对应年数
public static Timestamp addYear(Timestamp end, int day) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(end.getTime());
cal.add(Calendar.YEAR, day);
return new Timestamp(cal.getTimeInMillis());
}
// 增加一年
public static String addOneYear(String date) {
String pattern = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
Timestamp time = new Timestamp(d.getTime());
return DateTools.addYear(time, 1).toString();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 减一年
public static String subtractOneYear(String date) {
String pattern = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
Timestamp time = new Timestamp(d.getTime());
return DateTools.addYear(time, -1).toString();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 增加对应秒数
public static Timestamp addSecond(Timestamp end, int sec) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(end.getTime());
cal.add(Calendar.SECOND, sec);
return new Timestamp(cal.getTimeInMillis());
}
public static int countDays(Timestamp begin, Timestamp end) {
long beginTime = begin.getTime();
long endTime = end.getTime();
int days = (int) ((endTime - beginTime) / (1000 * 60 * 60 * 24));
return days;
}
public static long strToLong(String date) {
String pattern = "yyyy-MM-dd HH:mm:ss";
java.sql.Date date1 = strToDate(date, pattern);
if (date1 != null) {
return date1.getTime();
} else {
return 0L;
}
}
public static long strToLong1(String date) {
String pattern = "yyyy-MM-dd HH:mm";
java.sql.Date date1 = strToDate(date, pattern);
if (date1 != null) {
return date1.getTime();
} else {
return 0L;
}
}
public static long strToLongTwo(String date) {
String pattern = "yyyy-MM-dd";
// return strToDate(date, pattern).getTime();
java.sql.Date date1 = strToDate(date, pattern);
if (date1 != null) {
return date1.getTime();
} else {
return 0L;
}
}
public static long strToLongTwo1(String date) {
String pattern = "yyyyMMddHHmmss";
// return strToDate(date, pattern).getTime();
java.sql.Date date1 = strToDate(date, pattern);
if (date1 != null) {
return date1.getTime();
} else {
return 0L;
}
}
/**
* 字符串转 Timestamp对象
*
* @param date
*/
public static Timestamp strToTimestamp(String date) {
String pattern = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
return new Timestamp(d.getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static String addOneDay(String date) {
String pattern = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
Timestamp time = new Timestamp(d.getTime());
return DateTools.addDay(time, 1).toString();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* 字符串转 Timestamp对象
*
* @param date
*/
public static Timestamp strToDatestamp(String datetime) {
String pattern = "yyyy-MM-dd HH:mm:ss";
return strToDatestamp(datetime, pattern);
}
public static Timestamp strToDatestamp(String datetime, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(datetime);
return new Timestamp(d.getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
/**
* 字符串转 Timestamp对象
*
* @param date
*/
public static String strDateToStr(String date) {
return format(strToDate(date));
}
public static java.sql.Date strToDate(String date) {
String pattern = "yyyy-MM-dd";
return strToDate(date, pattern);
}
public static java.sql.Date strNumToDate(String date) {
String pattern = "yyyyMMdd";
return strToDate(date, pattern);
}
public static java.sql.Date strToDate(String date, String pattern) {
if (ChkUtil.isNull(date)) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
return new java.sql.Date(d.getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static java.sql.Date strToDate2(String date) {
if (ChkUtil.isNull(date)) {
return null;
}
date = date.replace("Z", " UTC");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS Z");
try {
Date d = sdf.parse(date);
return new java.sql.Date(d.getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
public static java.sql.Date strToDate(String date, String pattern, boolean ifNullToNow) {
if (ChkUtil.isNull(date)) {
if (ifNullToNow) {
return new java.sql.Date(System.currentTimeMillis());
} else {
return null;
}
}
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
return new java.sql.Date(d.getTime());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
// 取得当前的年月
public static String getYearMonth() {
String pattern = "yyyy-MM";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(new Date(System.currentTimeMillis()));
}
// 获取上个月的年月
public static String getLastYearMonth() {
Calendar cal = Calendar.getInstance();
// 取得系统当前时间所在月第一天时间对象
cal.set(Calendar.DAY_OF_MONTH, 1);
// 日期减一,取得上月最后一天时间对象
cal.add(Calendar.DAY_OF_MONTH, -1);
Date date = cal.getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
return df.format(date);
}
public static java.sql.Date getYearMonth(String date) {
String pattern = "yyyy-MM";
return strToDate(date, pattern);
}
public static int getYear() {
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR);
return year;
}
public static int getMonth() {
Calendar cal = Calendar.getInstance();
int month = cal.get(Calendar.MONTH);
return month;
}
public static String getToday() {
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
return df.format(date);
}
public static String getToday(String reg) {
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
SimpleDateFormat df = new SimpleDateFormat(reg);
return df.format(date);
}
public static String format() {
return DateTools.format(new java.sql.Date(System.currentTimeMillis()));
}
public static String format(java.sql.Date date) {
if (ChkUtil.isNull(date)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
return df.format(date);
}
public static String getTodayTime() {
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(date);
}
public static int countDaysVSToday(java.sql.Date start) {
Timestamp now = new Timestamp(System.currentTimeMillis());
int days = (int) ((now.getTime() - start.getTime()) / (1000 * 60 * 60 * 24));
return days;
}
// 获取每月最大天数
// 参数 yyyy-MM 格式
public static int getDayOfMonth(String yearMonth) {
java.sql.Date date = getYearMonth(yearMonth);
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(date.getTime());
int dateOfMonth = cal.getActualMaximum(Calendar.DATE);
return dateOfMonth;
}
// 获取每月最大天数
public static int getDayOfMonth(int year, int month) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month - 1);// Java月份才0开始算
int dateOfMonth = cal.getActualMaximum(Calendar.DATE);
return dateOfMonth;
}
public static String formatDateTime(Timestamp date) {
if (ChkUtil.isNull(date)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(date);
}
public static String formatDateTime(Date date) {
if (ChkUtil.isNull(date)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return df.format(date);
}
public static String formatDate(Timestamp date) {
if (ChkUtil.isNull(date)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
return df.format(date);
}
public static String formatDate(Timestamp date, String patten) {
if (ChkUtil.isNull(date)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat(patten);
return df.format(date);
}
public static String formatDate(Date date) {
if (ChkUtil.isNull(date)) {
return "";
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
return df.format(date);
}
// 获取某月的最后一天 month格式:yyyy-MM-dd or yyyy-MM
public static String getMonthFinalDay(String month) {
if (month.length() < 10) {
month = month + "-01";
}
Calendar cal = Calendar.getInstance();
cal.setTime(DateTools.strToDate(month));
cal.add(Calendar.MONTH, 1);
cal.set(Calendar.DAY_OF_MONTH, 1);
// 日期减一,取得上月最后一天时间对象
cal.add(Calendar.DAY_OF_MONTH, -1);
Date date = cal.getTime();
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
return df.format(date);
}
// 获取距今i天的时间 long型
public static long getSomeDaysBefore(int i) {
Calendar c = Calendar.getInstance();
c.setTime(strToDate(getToday()));
c.add(Calendar.DAY_OF_YEAR, i);
return c.getTimeInMillis();
}
public static Long getstrDate3(String str) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long a = sdf.parse(str).getTime();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmmss");
String newdate = sdf1.format(new Date(a));
return Long.valueOf(newdate);
}
public static void main(String[] args) throws ParseException {
String str = getstrDate1(20181113110947L);
System.out.println(str);
// System.err.println(getDayOfMonth(2000, 2));
// System.err.println(getDayOfMonth("2000-02"));
/*
* System.err.println(getYearToLong(2016));
* System.err.println(getYearToLong(2017));
* System.err.println(getYearToLong(2018));
*/
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long a = sdf.parse(str).getTime();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMddHHmmss");
System.out.println(sdf1.format(new Date(a)));
}
public static long getYearToLong(int year) {
java.sql.Date date = strToDate(year + "-01-01");
return date.getTime();
}
public static long getCreated() {
Date d = new Date();
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
long l = Long.parseLong(df.format(d));
return l;
}
/**
* 处理审批时长
* @param createTime
* @param endTime
* @return
*/
public static long disposeApprovalTime(Date createTime,Date endTime){
long approvalTime = 0;
if(endTime != null){
Calendar calendar = Calendar.getInstance();
calendar.setTime(createTime);
long timeInMillisStart = calendar.getTimeInMillis();
calendar.setTime(endTime);
long timeInMillisEnd = calendar.getTimeInMillis();
approvalTime = ((timeInMillisEnd - timeInMillisStart) / (1000L*3600L));
}else {
Calendar calendar = Calendar.getInstance();
calendar.setTime(createTime);
long timeInMillisStart = calendar.getTimeInMillis();
calendar.setTime(new Date());
long timeInMillisEnd = calendar.getTimeInMillis();
approvalTime = ((timeInMillisEnd - timeInMillisStart) / (1000L*3600L));
}
return approvalTime;
}
/**
* 计算两个时间之间的小时差。
* @param startDate
* @param endDate
* @return
*/
public static long timeDifference(Date startDate,Date endDate){
if(startDate != null && endDate != null){
long startTime = startDate.getTime();
long endTime = endDate.getTime();
int hours = (int) ((endTime - startTime) / (1000 * 60 * 60));
return hours;
}
return 0;
}
}
@@ -1,327 +0,0 @@
package com.adc.da.wkflow.util.file;
import com.tmsps.fk.common.util.ChkUtil;
import com.tmsps.fk.common.util.JsonUtil;
import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.HashMap;
import java.util.Map;
public class FileTools {
// 解析propertis中的字符串
public static String parseStr(String str) {
str = str.replace("{", "").replace("}", "");
System.err.println(JsonUtil.toJson(str));
String[] split = str.split(",");
System.err.println(JsonUtil.toJson(split));
Map<String, Object> map = new HashMap<String, Object>();
for (int i = 0; i < split.length; i++) {
String[] split2 = split[i].split("=");
map.put(split2[0].trim(), split2[1].trim());
}
return map.get("bidPrice").toString();
}
// 解析propertis中的字符串
public static Map<String, Object> parseStrToMap(String str) {
str = str.replace("{", "").replace("}", "");
String[] split = str.split(",");
Map<String, Object> map = new HashMap<String, Object>();
for (int i = 0; i < split.length; i++) {
String[] split2 = split[i].split("=");
map.put(split2[0].trim(), split2[1].trim());
}
return map;
}
public static String getSuffix(String filename) {
if (ChkUtil.isNull(filename)) {
return "";
}
if (!filename.contains(".")) {
return "";
}
return filename.substring(filename.lastIndexOf(".") + 1);
}
/**
*
* copy文件从一个目录到另一个目录
*
* @param srcFile 源文件路径
* @param destFile 目标文件路径
* @return
*/
public static boolean copyFile(String srcFile, String destFile) {
boolean flag = false;
FileInputStream fin = null;
FileOutputStream fout = null;
FileChannel fcin = null;
FileChannel fcout = null;
try {
// 获取源文件和目标文件的输入输出流
fin = new FileInputStream(srcFile);
fout = new FileOutputStream(destFile);
// 获取输入输出通道
fcin = fin.getChannel();
fcout = fout.getChannel();
// 创建缓冲区
ByteBuffer buffer = ByteBuffer.allocate(1024);
while (true) {
// clear方法重设缓冲区,使它可以接受读入的数据
buffer.clear();
// 从输入通道中将数据读到缓冲区
int r = fcin.read(buffer);
// read方法返回读取的字节数,可能为零,如果该通道已到达流的末尾,则返回-1
if (r == -1) {
flag = true;
break;
}
// flip方法让缓冲区可以将新读入的数据写入另一个通道
buffer.flip();
// 从输出通道中将数据写入缓冲区
fcout.write(buffer);
}
fout.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (null != fin) {
fin.close();
}
if (null != fout) {
fout.close();
}
if (null != fcin) {
fcin.close();
}
if (null != fcout) {
fcout.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return flag;
}
/**
* 判断文件夹中所有文件的名字是否含有.bid
*
* @param file 想要读取的文件对象
* @return boolean
*/
public static boolean checkFileName(String filePath, String exclusive_name) {
File f = new File(filePath);
if (!f.exists()) {
System.out.println(filePath + " not exists");
return false;
}
// 含有.bid,返回true,否则返回false
boolean status = false;
File fa[] = f.listFiles();
for (int i = 0; i < fa.length; i++) {
File fs = fa[i];
String name = fs.getName();
if (name.contains(exclusive_name)) {
status = true;
return status;
} else {
status = false;
}
}
return status;
}
/**
* 读取txt文件的内容
*
* @param file 想要读取的文件对象
* @return 返回文件内容
*/
/*
* public static String getKey(File file) { try { return
* FileUtils.readFileToString(file, "utf-8"); } catch (IOException e) {
* e.printStackTrace(); return ""; } } public static String getKeyOld(File file)
* { StringBuilder result = new StringBuilder(); try { BufferedReader br = new
* BufferedReader(new FileReader(file));// 构造一个BufferedReader类来读取文件 String s =
* null; while ((s = br.readLine()) != null) {// 使用readLine方法,一次读一行
* result.append(System.lineSeparator() + s); } br.close(); } catch (Exception
* e) { e.printStackTrace(); } return result.toString().trim(); }
*/
/**
*
* 查找某个文件下,包含某个关键字的文件
*
* @param folder
* @param keyWord
* @return
*/
public static File searchFile(File folder, final String keyWord) {// 递归查找包含关键字的文件
File[] subFolders = folder.listFiles(new FileFilter() {// 运用内部匿名类获得文件
@Override
public boolean accept(File pathname) {// 实现FileFilter类的accept方法
// 目录或文件包含关键字
if (pathname.isFile() && pathname.getName().toLowerCase().contains(keyWord.toLowerCase())) {
return true;
}
return false;
}
});
File foldResult = null;
for (int i = 0; i < subFolders.length; i++) {// 循环显示文件夹或文件
if (subFolders[i].isFile()) {// 如果是文件则将文件添加到结果列表中
foldResult = subFolders[i];
} else {// 如果是文件夹,则递归调用本方法,然后把所有的文件加到结果列表中
searchFile(subFolders[i], keyWord);
}
}
return foldResult;
}
/**
*
* 查找某个文件下,包含某个关键字的文件夹
*
* @param folder
* @param keyWord
* @return
*/
public static File searchFileFolder(File folder, final String keyWord) {// 递归查找包含关键字的文件
File[] subFolders = folder.listFiles(new FileFilter() {// 运用内部匿名类获得文件
@Override
public boolean accept(File pathname) {// 实现FileFilter类的accept方法
// 目录或文件包含关键字
if (pathname.isDirectory() && pathname.getName().toLowerCase().contains(keyWord.toLowerCase())) {
return true;
}
return false;
}
});
File foldResult = null;
for (int i = 0; i < subFolders.length; i++) {// 循环显示文件夹或文件
if (subFolders[i].isDirectory()) {// 如果是文件夹则将文件夹添加到结果列表中
foldResult = subFolders[i];
}
}
return foldResult;
}
/**
* 文件写入数据
*
* @param content
* @param write_url
* @return
*/
public static boolean writeFile(String content, String url) {
if (ChkUtil.isNull(url)) {
return false;
}
BufferedWriter writer = null;
try {
File file = new File(url);
if (file.exists()) {
file.delete();
}
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream writerStream = new FileOutputStream(file);
writer = new BufferedWriter(new OutputStreamWriter(writerStream, "UTF-8"));
writer.write(content);
writer.flush();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return true;
}
public static void main(String[] args) {
// String s = "x.ds"; System.err.println(FileTools.getSuffix(s));
// boolean fileName =
// checkFileName("C:\\tmp\\74f926b3-26cb-4d36-8f86-634b49323d33");
// System.err.println(fileName);
// File file = new
// File("C:\\data\\data\\bid\\6Yyfh6wZxyBJkYDzn5M95T\\key.txt");
// System.out.println(getKey(file));
// File folder = new
// File("C:\\data\\data\\bid\\KTugyHVuGAvFrkCngLBXnc");// 默认目录
// String keyword = ".bid";
// if (!folder.exists()) {// 如果文件夹不存在
// System.out.println("目录不存在:" + folder.getAbsolutePath());
// return;
// }
// File result = searchFile(folder, keyword);// 调用方法获得文件数组
// System.out.println("在 " + folder + " 以及所有子文件时查找对象" + keyword);
// System.out.println(result.getAbsolutePath() + " ");// 显示文件绝对路径
String unzip_dir_url = "C:/data/data/bid/8rGZfcqDHbc9W7WTKUUrZe/ceshi";
File attachmentFileFolder = FileTools.searchFile(new File(unzip_dir_url), ".docx");
System.err.println(JsonUtil.toJson(attachmentFileFolder));
// File[] attachmentFiles = attachmentFileFolder.listFiles();
// System.err.println(JsonUtil.toJson(attachmentFiles));
}
public static String readFileToString(String file) {
String content = "";
// 2、建立数据通道
FileInputStream fis = null;
try {
fis = new FileInputStream(file);
byte[] buf = new byte[1024];
int length = 0;
// 循环读取文件内容,输入流中将最多buf.length个字节的数据读入一个buf数组中,返回类型是读取到的字节数。
// 当文件读取到结尾时返回 -1,循环结束。
while ((length = fis.read(buf)) != -1) {
content += new String(buf, 0, length);
}
// 最后记得,关闭流
} catch (Exception e) {
e.printStackTrace();
} finally {
if (fis != null) {
try {
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return content;
}
}
@@ -1,71 +0,0 @@
package com.adc.da.wkflow.util.form;
import com.tmsps.fk.common.util.ChkUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* 读取模板表单
*
* var formData = '@loadFormData()';
*
* 替换 '@loadFormData()' 为json值
*
* @author 冯晓东
*
*/
public class FormReadTools {
private static final String htmlSubmit;
private static final String htmlRead;
static {
htmlSubmit = readModel("/models/form/form.html");
htmlRead = readModel("/models/form/form-read.html");
}
public static String readModel(String file) {
String htmlStr = "";
InputStream is = FormReadTools.class.getResourceAsStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
try {
while ((line = br.readLine()) != null) {
htmlStr += line + "\n";
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return htmlStr;
}
public static String replaceSubmitModel(String json) {
if (ChkUtil.isNull(json)) {
return null;
}
// var formData = '@loadFormData()';
return htmlSubmit.replace("'@loadFormData()'", json);
}
public static String replaceReadModel(String json) {
if (ChkUtil.isNull(json)) {
return null;
}
// var formData = '@loadFormData()';
return htmlRead.replace("'@loadFormData()'", json);
}
public static void main(String[] args) {
System.err.println(readModel("/form_model/form.html"));
System.err.println(readModel("/form_model/form-read.html"));
}
}
@@ -1,49 +0,0 @@
package com.adc.da.wkflow.util.token;
import com.tmsps.fk.common.base.exception.BusinessException;
import com.adc.da.wkflow.util.WebUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* 重复提交aop
*
* @author 冯晓东
*/
@Aspect
@Component
public class TokenAspect {
private static final Logger logger = LoggerFactory.getLogger(TokenAspect.class);
/**
* @param jp
*
* 经测试,会按照单个浏览器,并行执行. 无需担心同步问题.
*/
@Before("@annotation(com.tmsps.fk.common.token.TokenCheck)")
public void before(JoinPoint jp) throws Throwable {
String token = WebUtil.getRequest().getParameter("token");
logger.info("token --> {}", token);
if (token == null || "".equals(token.trim())) {
throw new BusinessException("500:Parameter <token> can not be null.");
}
if (!token.contains("@@")) {
throw new BusinessException("500:Parameter <token> is invalid key.");
}
String key = token.split("@@")[0];
String snToken = WebUtil.getAsyncToken("token@@" + key);
logger.info("session token --> {}", snToken);
if (!token.equals(snToken)) {
throw new BusinessException("500:Token is invalid.");
}
}
}
@@ -1,29 +0,0 @@
package com.adc.da.wkflow.util.token;
import com.adc.da.wkflow.util.WebUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.UUID;
@RestController
public class TokenController {
/**
*
* @param key
* @return
*/
@GetMapping("/getToken")
public String getToken(String key) {
if (key == null || "".equals(key.trim())) {
throw new RuntimeException("500:Parameter <key> can not be null.");
}
// 设置token值
String token = key + "@@" + UUID.randomUUID();
WebUtil.getSession().setAttribute("token@@" + key, token);
return token;
}
}
@@ -1,79 +0,0 @@
package com.adc.da.wkflow.util.tree;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
* @author 冯晓东 398479251@qq.com
*
*/
public class AuthTreeTools {
/**
* 预处理树节点
*
* @param menuList
* @param isChecked
* @return
*/
private static JSONArray handleTree(JSONArray menuList, boolean isChecked) {
for (int i = 0; i < menuList.size(); i++) {
JSONObject map = menuList.getJSONObject(i);
map.put("key", map.getString("code"));
map.put("value", map.getString("code"));
map.put("title", map.getString("name"));
if (isChecked) {
map.put("checked", false);
}
}
return menuList;
}
public static List<Map<String, Object>> turnListToTree(JSONArray menuList) {
// 转换List为树形结构
return turnListToTree(menuList, false);
}
@SuppressWarnings("unchecked")
public static List<Map<String, Object>> turnListToTree(JSONArray menuList, boolean isChecked) {
// 转换List为树形结构
menuList = handleTree(menuList, isChecked);
List<Map<String, Object>> nodeList = new ArrayList<Map<String, Object>>();
for (int i = 0; i < menuList.size(); i++) {
JSONObject node1 = menuList.getJSONObject(i);
String node1_code = (String) node1.get("code");
String node1_parent_code = node1_code.substring(0, node1_code.length() - 3);
boolean mark = false;
for (int j = 0; j < menuList.size(); j++) {
Map<String, Object> node2 = menuList.getJSONObject(j);
String node2_code = (String) node2.get("code");
if (node1_parent_code != null && node1_parent_code.equals(node2_code)) {
mark = true;
if (node2.get("children") == null) {
node2.put("children", new ArrayList<Map<String, Object>>());
}
((List<Map<String, Object>>) node2.get("children")).add(node1);
node2.put("leaf", false);
if (!isChecked) {
node2.put("expanded", false);
}
break;
}
}
if (!mark) {
nodeList.add(node1);
}
}
return nodeList;
}
}
@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.wkflow.business_main.mapper.BusProcessNameMapper">
<select id="findBusProcessNameForEnd"
resultType="com.adc.da.wkflow.business_main.entity.BusProcessName">
SELECT
BUS_PROCESS_NAME.ID,
BUS_PROCESS_NAME.PRC_ID,
BUS_PROCESS_NAME.PRC_MES,
BUS_PROCESS_NAME.OVER_TIME,
BUS_PROCESS_NAME.PRC_NUM,
BUS_PROCESS_NAME.CREAT_TIME,
BUS_PROCESS_NAME.CREAT_USER,
BUS_PROCESS_NAME.PRC_TYPE,
BUS_PROCESS_NEW.USER_ID AS CREATE_USER_NAME,
BUS_PROCESS_NAME.MES,
BUS_PROCESS_NAME.END_TIME
FROM
BUS_PROCESS_NEW
LEFT JOIN BUS_PROCESS_NAME ON BUS_PROCESS_NAME.PRC_ID = BUS_PROCESS_NEW.P_ID
WHERE
BUS_PROCESS_NAME.END_TIME IS NULL
AND BUS_PROCESS_NAME.OVER_TIME > now( )
AND date_add( now( ), INTERVAL 3 DAY ) > BUS_PROCESS_NAME.OVER_TIME
</select>
</mapper>
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.adc.da.wkflow.business_main.mapper.BusProcessNewMapper">
<select id="findNoExecuteBusProcessNew"
resultType="com.adc.da.wkflow.business_main.entity.BusProcessNew">
select BUS_PROCESS_NEW.* from BUS_PROCESS_NEW
INNER JOIN ACT_HI_TASKINST on BUS_PROCESS_NEW.TASK_ID = ACT_HI_TASKINST.ID_
where BUS_PROCESS_NEW.TASK_ID in
<foreach collection="taskIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and ACT_HI_TASKINST.END_TIME_ is null
</select>
<select id="findNoExecuteBusProcessNewForEnd"
resultType="com.adc.da.wkflow.business_main.entity.BusProcessNew">
select BUS_PROCESS_NEW.* from BUS_PROCESS_NEW
INNER JOIN ACT_HI_TASKINST on BUS_PROCESS_NEW.TASK_ID = ACT_HI_TASKINST.ID_
where BUS_PROCESS_NEW.TASK_ID in
<foreach collection="taskIds" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
-- and ACT_HI_TASKINST.END_TIME_ is NOT null
</select>
<select id="queryTaskName" resultType="java.lang.String">
SELECT NAME_ FROM ACT_HI_TASKINST WHERE ID_ = #{id}
</select>
</mapper>