wang1
2023-06-14 413ef95ca08807adb5d01de11ecc3ab8d11bb9a9
模板流程定义、模板阶段定义代码提交
已修改12个文件
已添加17个文件
1259 ■■■■■ 文件已修改
Source/UBCS/ubcs-ops-api/ubcs-flow-api/pom.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/controller/WorkController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowModelController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowProcessController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/ProcessTSController.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/ProcessStageAttr.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/ProcessTemplate.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/FlowMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/FlowTaskUserMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/ProcessStageAttrMapper.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/ProcessTemplateMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/ProcessStageAttrService.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/ProcessTemplateService.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/ProcessStageAttrServiceImpl.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/ProcessTemplateServiceImpl.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops/ubcs-flow/src/main/resources/mapper/FlowMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/NewAppConstantEnum.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service-api/ubcs-workflow-api/src/main/java/com/vci/ubcs/code/constant/FlowConstant.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/UserPwdstrategyController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-ops-api/ubcs-flow-api/pom.xml
@@ -14,6 +14,19 @@
    <version>${bladex.project.version}</version>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>com.vci.ubcs</groupId>
            <artifactId>ubcs-util-api</artifactId>
            <version>3.0.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.vci.ubcs</groupId>
            <artifactId>ubcs-user-api</artifactId>
            <version>3.0.1.RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/controller/WorkController.java
@@ -27,13 +27,23 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.TaskService;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.task.api.Task;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * æµç¨‹äº‹åŠ¡é€šç”¨æŽ¥å£
 *
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/business/service/impl/FlowBusinessServiceImpl.java
@@ -263,6 +263,7 @@
            variables = Kv.create();
        }
        variables.put(ProcessConstant.PASS_KEY, flow.isPass());
        variables.put("yn","y");
        // å®Œæˆä»»åŠ¡
        taskService.complete(taskId, variables);
        return true;
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowModelController.java
@@ -18,15 +18,20 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.vci.ubcs.flow.core.utils.TaskUtil;
import com.vci.ubcs.flow.engine.entity.FlowModel;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import com.vci.ubcs.flow.engine.service.FlowEngineService;
import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.launch.constant.FlowConstant;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
@@ -44,7 +49,7 @@
@RestController
@RequestMapping("model")
@AllArgsConstructor
//@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)
//@PreAuth(RoleConstant.HAS_ROLE_ADMINISTRATOR)t
public class FlowModelController {
    private final FlowEngineService flowEngineService;
@@ -63,6 +68,8 @@
        IPage<FlowModel> pages = flowEngineService.page(Condition.getPage(query), Condition.getQueryWrapper(flow, FlowModel.class)
            .select("id,model_key modelKey,name,description,version,created,last_updated lastUpdated")
            .orderByDesc("last_updated"));
        flowEngineService.getNodeByFlowableKey("process_t");
        return R.data(pages);
    }
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowProcessController.java
@@ -20,6 +20,12 @@
import com.vci.ubcs.flow.engine.service.FlowEngineService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.model.FlowElement;
import org.flowable.bpmn.model.SubProcess;
import org.flowable.bpmn.model.UserTask;
import org.flowable.engine.*;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
@@ -28,7 +34,10 @@
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
 * æµç¨‹é€šç”¨æŽ§åˆ¶å™¨
@@ -44,6 +53,12 @@
    private static final String IMAGE_NAME = "image";
    private final FlowEngineService flowEngineService;
    private final RepositoryService repositoryService;
    private final RuntimeService runtimeService;
    private final HistoryService historyService;
    private final TaskService taskService;
    private final ProcessEngine processEngine;
    /**
     * èŽ·å–æµè½¬åŽ†å²åˆ—è¡¨
@@ -65,6 +80,12 @@
     */
    @GetMapping(value = "model-view")
    public R modelView(String processDefinitionId, String processInstanceId) {
        //test
        //List<Map<String,String>> xml = flowEngineService.getXMLByFlowableName("process_t");
        flowEngineService.updateAssignee(null);
        //test end
        return R.data(flowEngineService.modelView(processDefinitionId, processInstanceId));
    }
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/FlowTaskUserController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
package com.vci.ubcs.flow.engine.controller;
import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
import com.vci.ubcs.flow.engine.service.FlowEngineService;
import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
import lombok.AllArgsConstructor;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
/**
 * æµç¨‹task审批控制
 *
 * @author wang1
 */
@NonDS
@RestController
@RequestMapping("taskUser")
@AllArgsConstructor
public class FlowTaskUserController {
    private final FlowTaskUserService taskUserService;
    /**
     * æµç¨‹task审批人员列表
     * @return
     */
    @GetMapping("list")
    public R<FlowTaskUserC> list() {
        return R.data(taskUserService.getUser());
    }
    /**
     * æ–°å¢žã€ä¿®æ”¹ä»»åŠ¡å¤„ç†äººå‘˜
     * @param flowTaskUserC
     * @return
     */
    @PostMapping("su")
    public R<String> saveUser(@RequestBody FlowTaskUserC flowTaskUserC) {
        taskUserService.saveOrUpdateUser(flowTaskUserC);
        return R.success("保存成功");
    }
    /**
     * åˆ é™¤ä»»åŠ¡å¤„ç†äººå‘˜
     * @param flowTaskUserC
     * @return
     */
    @PostMapping("du")
    public R<String> deleteUser(@RequestBody FlowTaskUserC flowTaskUserC) {
        taskUserService.deleteUser(flowTaskUserC.getName());
        return R.success("删除成功");
    }
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/ProcessTSController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,112 @@
package com.vci.ubcs.flow.engine.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
import com.vci.ubcs.flow.engine.entity.ProcessStageAttr;
import com.vci.ubcs.flow.engine.entity.ProcessTemplate;
import com.vci.ubcs.flow.engine.service.FlowEngineService;
import com.vci.ubcs.flow.engine.service.ProcessStageAttrService;
import com.vci.ubcs.flow.engine.service.ProcessTemplateService;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tenant.annotation.NonDS;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 *流程模板、流程阶段控制 processTemplate processStage
 *
 * @author wang1
 */
@NonDS
@RestController
@RequestMapping("processTS")
@AllArgsConstructor
public class ProcessTSController {
    private final FlowEngineService flowEngineService;
    private final ProcessTemplateService processTemplateService;
    private final ProcessStageAttrService processStageAttrService;
    /**
     * æµç¨‹æ¨¡æ¿åˆ†é¡µ
     */
    @GetMapping("/tlist")
    public R<IPage<ProcessTemplate>> tlist(@RequestParam Map<String, Object> flow, Query query) {
        IPage<ProcessTemplate> pages = processTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(flow, ProcessTemplate.class)
            .select("id,model_key modelKey,model_name modelName,button_Type_Key buttonTypeKey,button_Type_value buttonTypeValue")
            .orderByDesc("last_updated"));
        return R.data(pages);
    }
    /**
     * æµç¨‹æ¨¡æ¿ç”¨é€”属性
     * @return
     */
    @PostMapping("tt")
    public R<List<Map<String,String>>> processTemplateType() {
        return R.data(processTemplateService.processTemplateType());
    }
    /**
     * æµç¨‹æ¨¡æ¿æ–°å¢žã€ä¿®æ”¹
     * @param processTemplate
     * @return
     */
    @PostMapping("tsou")
    public R<ProcessTemplate> processTemplateSaveOrUpdate(@RequestBody ProcessTemplate processTemplate) {
        processTemplateService.saveOrUpdateUser(processTemplate);
        return R.success("保存成功");
    }
    /**
     * æµç¨‹æ¨¡æ¿åˆ é™¤
     * @param processTemplate
     * @return
     */
    @DeleteMapping("dt")
    public R<ProcessTemplate> deleteProcessTemplate(ProcessTemplate processTemplate) {
        processTemplateService.deleteProcessTemplate(processTemplate.getId());
        return R.success("删除成功");
    }
    /**
     * æµç¨‹é˜¶æ®µï¼Œè¿™ä¸ªæµç¨‹çš„各个节点
     */
    @GetMapping("/sslist")
    public R<List<Map<String,String>>> sslist(@RequestParam String modelKey) {
        return R.data(flowEngineService.getNodeByFlowableKey(modelKey));
    }
    /**
     * æµç¨‹é˜¶æ®µï¼Œè¿™ä¸ªæµç¨‹,这个节点,绑定的属性
     */
    @GetMapping("/ssslist")
    public R<List<ProcessStageAttr>> ssslist(@RequestParam String templateId,@RequestParam String modelKey,@RequestParam String taskId) {
        Map<String, Object> m = new HashMap<>();
        m.put("template_id", templateId);
        m.put("task_id", taskId);
        m.put("model_key", modelKey);
        QueryWrapper q = Condition.getQueryWrapper(m, ProcessStageAttr.class)
            .select("attr_id attrId,attr_name attrName,attr_group attrGroup");
        return R.data(processStageAttrService.list(q));
    }
    /**
     * æ¨¡æ¿é˜¶æ®µå±žæ€§æ–°å¢žã€ä¿®æ”¹
     * @param flowTaskUserC
     * @return
     */
    @PostMapping("sasou")
    public R<ProcessTemplate> stageAttributeSaveOrUpdate(@RequestBody FlowTaskUserC flowTaskUserC) {
        processStageAttrService.saveOrUpdateUser(flowTaskUserC);
        return R.success("保存成功");
    }
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUser.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.vci.ubcs.flow.core.utils.TaskUtil;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * æµç¨‹æ¯ä¸€ä¸ªèŠ‚ç‚¹å®¡æ ¸äºº
 *
 * @author wang1
 */
@Data
@TableName("ACT_DE_TASK_USER")
public class FlowTaskUser implements Serializable {
    private static final long serialVersionUID = 1L;
    private String id;
    private String name;//保存的这个收藏名称
    private String modelKey;
    private String classifyId;
    private String templateId;
    private String taskId;//流程taskid
    private String taskName;
    private String userId;
    private String userName;
    private String description;
    private Date created;
    private Date lastUpdated;
    private String createdBy;
    private String lastUpdatedBy;
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/FlowTaskUserC.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,43 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.entity;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
 * æµç¨‹èŠ‚ç‚¹å®¡æ ¸äººæ”¶è—
 *
 * @author wang1
 */
@Data
public class FlowTaskUserC implements Serializable {
    private static final long serialVersionUID = 1L;
    private String createdBy;
    private String name;//保存的这个收藏名称
    private String modelKey;
    private String classifyId;
    private String templateId;
    private String taskId;//阶段id,就是流程taskid
    private String taskName;//阶段名称
    private List<FlowTaskUser> flowTaskUsers;//每个节点收藏人
    private List<ProcessStageAttr> processStageAttr;//流程阶段保存的属性
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/ProcessStageAttr.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
 * æµç¨‹é˜¶æ®µ
 *
 * @author wang1
 */
@Data
@TableName("ACT_DE_PROCESS_STAGE_ATTR")
public class ProcessStageAttr implements Serializable {
    private static final long serialVersionUID = 1L;
    private String id;
    private String modelKey;
    private String classifyId;
    private String templateId;
    private String taskId;//阶段id,就是流程taskid
    private String taskName;//阶段名称
    private String attrOid;//属性这条数据的id
    private String attrId;//属性这条数据的oid
    private String attrName;//属性中文名称
    private String attrGroup;//属性分组
    private String description;
    private Date created;
    private Date lastUpdated;
    private String createdBy;
    private String lastUpdatedBy;
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/entity/ProcessTemplate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * æµç¨‹æ¨¡æ¿
 *
 * @author wang1
 */
@Data
@TableName("ACT_DE_PROCESS_TEMPLATE")
public class ProcessTemplate implements Serializable {
    private static final long serialVersionUID = 1L;
    private String id;
    private String templateId;//当前模板id
    private String modelKey;//流程模型key,部署key
    private String modelName;//部署流程名称
    private String buttonTypeKey;//应用按钮,ProcessTemplateTypeEnum的key
    private String buttonTypeValue;//应用按钮,ProcessTemplateTypeEnum的value
    private String description;
    private Date created;
    private Date lastUpdated;
    private String createdBy;
    private String lastUpdatedBy;
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/FlowMapper.java
@@ -19,6 +19,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vci.ubcs.flow.engine.entity.FlowModel;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -43,4 +44,11 @@
     * @return
     */
    List<FlowModel> findByParentModelId(String parentModelId);
    /**
     * ä¿®æ”¹å¤„理人
     * @param u
     * @return
     */
    void updateAssignee(@Param(value="u") String  u);
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/FlowTaskUserMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.vci.ubcs.flow.engine.entity.FlowModel;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * æµç¨‹é˜¶æ®µå®¡æ ¸äººå‘˜
 *
 * @author wang1
 */
public interface FlowTaskUserMapper extends BaseMapper<FlowTaskUser> {
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/ProcessStageAttrMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vci.ubcs.flow.engine.entity.ProcessStageAttr;
/**
 * æµç¨‹é˜¶æ®µ
 *
 * @author wang1
 */
public interface ProcessStageAttrMapper extends BaseMapper<ProcessStageAttr> {
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/mapper/ProcessTemplateMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import com.vci.ubcs.flow.engine.entity.ProcessTemplate;
/**
 * æµç¨‹æ¨¡æ¿
 *
 * @author wang1
 */
public interface ProcessTemplateMapper extends BaseMapper<ProcessTemplate> {
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowEngineService.java
@@ -23,6 +23,7 @@
import com.vci.ubcs.flow.engine.entity.FlowModel;
import com.vci.ubcs.flow.engine.entity.FlowProcess;
import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.Document;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@@ -163,4 +164,18 @@
     * @return
     */
    byte[] getModelEditorXML(FlowModel model);
    /**
     * æ ¹æ®æµç¨‹æ¨¡åž‹key获取XML中节点配置的处理人,读取节点名称和配置的值,流程模型key已经限制不重复
     *
     * @param key
     * @return
     */
    List<Map<String,String>> getNodeByFlowableKey(String key);
    /**
     * ä¿®æ”¹æµç¨‹å¤„理人
     */
    void updateAssignee(String u);
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/FlowTaskUserService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,54 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.flow.core.entity.BladeFlow;
import com.vci.ubcs.flow.engine.entity.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
 * FlowService
 *
 * @author wang1
 */
public interface FlowTaskUserService extends IService<FlowTaskUser> {
    /**
     * æŸ¥è¯¢å½“前登陆人对这个流程的taskUser
     * @return
     */
    FlowTaskUserC getUser();
    /**
     * æ–°å¢ž/修改流程节点审核人配置、并且修改流程xml部署文件
     * @param flowTaskUserC
     * @return
     */
    void saveOrUpdateUser(FlowTaskUserC flowTaskUserC);
    /**
     * åˆ é™¤æµç¨‹å®¡æ ¸äººå‘˜
     * @param name
     */
    void deleteUser(String name);
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/ProcessStageAttrService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,39 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
import com.vci.ubcs.flow.engine.entity.ProcessStageAttr;
import java.util.List;
/**
 * æµç¨‹é˜¶æ®µæœåŠ¡
 *
 * @author wang1
 */
public interface ProcessStageAttrService extends IService<ProcessStageAttr> {
    /**
     * æ–°å¢ž/修改流程阶段
     * @param flowTaskUserC
     * @return
     */
    void saveOrUpdateUser(FlowTaskUserC flowTaskUserC);
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/ProcessTemplateService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
import com.vci.ubcs.flow.engine.entity.ProcessTemplate;
import com.vci.ubcs.starter.web.enumpck.ProcessTemplateTypeEnum;
import java.util.List;
import java.util.Map;
/**
 * æµç¨‹æ¨¡æ¿æœåŠ¡
 *
 * @author wang1
 */
public interface ProcessTemplateService extends IService<ProcessTemplate> {
    /**
     * æ–°å¢ž/修改流程模板
     * @param processTemplate
     * @return
     */
    void saveOrUpdateUser(ProcessTemplate processTemplate);
    /**
     * åˆ é™¤æµç¨‹æ¨¡æ¿
     * @param id
     * @return
     */
    void deleteProcessTemplate(String id);
    /**
     * æµç¨‹æ¨¡æ¿ç”¨é€”
     * @return
     */
    List<Map<String,String>> processTemplateType();
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowEngineServiceImpl.java
@@ -16,6 +16,8 @@
 */
package com.vci.ubcs.flow.engine.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -34,9 +36,11 @@
import com.vci.ubcs.system.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.flowable.common.engine.impl.util.IoUtil;
import org.flowable.common.engine.impl.util.io.StringStreamSource;
@@ -47,6 +51,7 @@
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.DeploymentQuery;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.repository.ProcessDefinitionQuery;
import org.flowable.engine.runtime.ProcessInstance;
@@ -54,6 +59,7 @@
import org.flowable.engine.task.Comment;
import org.flowable.image.ProcessDiagramGenerator;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.FileUtil;
@@ -61,11 +67,17 @@
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.*;
import org.xml.sax.InputSource;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.*;
/**
@@ -90,6 +102,12 @@
    private final HistoryService historyService;
    private final TaskService taskService;
    private final ProcessEngine processEngine;
    /**
     * æ•°æ®æ“ä½œå¯¹è±¡
     */
    @Resource
    private FlowMapper flowMapper;
    @Override
    public IPage<FlowModel> selectFlowPage(IPage<FlowModel> page, FlowModel flowModel) {
@@ -296,6 +314,7 @@
    @Override
    public boolean deployModel(String modelId, String category, List<String> tenantIdList) {
        FlowModel model = this.getById(modelId);
        if (model == null) {
            throw new ServiceException("未找到模型 id: " + modelId);
@@ -346,6 +365,12 @@
    @Override
    public FlowModel submitModel(FlowModel model) {
        //验证重复key
        if(StringUtils.isEmpty(model.getId())&&getFlowModelByKey(model.getModelKey())!=null){
            throw new ServiceException("you cannot definition repetition æµç¨‹key!");
        }
        FlowModel flowModel = new FlowModel();
        flowModel.setId(model.getId());
        flowModel.setVersion(Func.toInt(model.getVersion(), 0) + 1);
@@ -467,6 +492,43 @@
    }
    /**
     * æ ¹æ®æµç¨‹æ¨¡åž‹key获取XML中节点配置的处理人
     *
     * @param key
     * @return
     */
    @Override
    public List<Map<String,String>> getNodeByFlowableKey(String key){
        String processDefinitionId = repositoryService.createProcessDefinitionQuery().latestVersion().processDefinitionKey(key).singleResult().getId();
        BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
        Process process = bpmnModel.getProcesses().get(0);//只有一个
        List<Map<String,String>> ll = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(process.getFlowElements())) {
            for (FlowElement flowElement : process.getFlowElements()) {
                if (flowElement instanceof UserTask) {
                    Map<String,String> mi = new HashMap<>();
                    mi.put("taskId",flowElement.getId());
                    mi.put("taskName",flowElement.getName());
                    ll.add(mi);
                }
            }
        }
        return ll;
    }
    /**
     * ä¿®æ”¹æµç¨‹å¤„理人
     */
    @Override
    public void updateAssignee(String u){
        flowMapper.updateAssignee(u);
    }
    /**
     * æ˜¯å¦å·²å®Œç»“
     *
     * @param processInstanceId æµç¨‹å®žä¾‹id
@@ -476,7 +538,6 @@
        return historyService.createHistoricProcessInstanceQuery().finished()
            .processInstanceId(processInstanceId).count() > 0;
    }
    /**
     * xml转bpmn json
@@ -556,4 +617,10 @@
        }
    }
    public FlowModel getFlowModelByKey(String key){
        Map kv = new HashMap();
        kv.put("model_key",key);
        return baseMapper.selectOne(Condition.getQueryWrapper(kv, FlowModel.class));
    }
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/FlowTaskUserServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,146 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.vci.ubcs.flow.core.entity.BladeFlow;
import com.vci.ubcs.flow.core.enums.FlowModeEnum;
import com.vci.ubcs.flow.core.utils.TaskUtil;
import com.vci.ubcs.flow.engine.constant.FlowEngineConstant;
import com.vci.ubcs.flow.engine.entity.*;
import com.vci.ubcs.flow.engine.mapper.FlowMapper;
import com.vci.ubcs.flow.engine.mapper.FlowTaskUserMapper;
import com.vci.ubcs.flow.engine.service.FlowEngineService;
import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
import com.vci.ubcs.flow.engine.utils.FlowCache;
import com.vci.ubcs.system.user.cache.UserCache;
import com.vci.ubcs.system.user.entity.User;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.bpmn.model.Process;
import org.flowable.common.engine.impl.util.IoUtil;
import org.flowable.common.engine.impl.util.io.StringStreamSource;
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.engine.repository.ProcessDefinitionQuery;
import org.flowable.engine.runtime.ProcessInstance;
import org.flowable.engine.runtime.ProcessInstanceQuery;
import org.flowable.engine.task.Comment;
import org.flowable.image.ProcessDiagramGenerator;
import org.springblade.core.launch.constant.FlowConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.FileUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.StringReader;
import java.util.*;
/**
 * å·¥ä½œæµæœåŠ¡å®žçŽ°ç±»
 *
 * @author wang1
 */
@Slf4j
@Service
@AllArgsConstructor
public class FlowTaskUserServiceImpl extends ServiceImpl<FlowTaskUserMapper, FlowTaskUser> implements FlowTaskUserService {
    private FlowEngineService flowEngineService;
    private FlowTaskUserMapper flowTaskUserMapper;
    /**
     * æŸ¥è¯¢å½“前登陆人对这个流程的taskUser
     * @return
     */
    @Override
    public FlowTaskUserC getUser(){
        QueryWrapper<FlowTaskUser> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("CREATED_BY", AuthUtil.getUserId());
        List<FlowTaskUser> flowTaskUsers = baseMapper.selectList(queryWrapper);
        FlowTaskUserC flowTaskUserCR = new FlowTaskUserC();
        if(flowTaskUsers.size()==0){
            return flowTaskUserCR;
        }
        flowTaskUserCR.setName(flowTaskUsers.get(0).getName());//收藏名称
        flowTaskUserCR.setFlowTaskUsers(flowTaskUsers);
        return flowTaskUserCR;
    }
    @Override
    public void saveOrUpdateUser(FlowTaskUserC flowTaskUserC){
        List<FlowTaskUser> flowTaskUsers = flowTaskUserC.getFlowTaskUsers();
        String name = flowTaskUserC.getName();//收藏名称
        //新增情况下验证收藏名称不重复
        if(flowTaskUsers.get(0).getId()!=null) {
            Map<String, Object> m = new HashMap<>();
            m.put("name", name);
            QueryWrapper q = Condition.getQueryWrapper(m, FlowTaskUser.class)
                .select("id,model_key modelKey,name,description,version,created,last_updated lastUpdated");
            if(flowTaskUserMapper.selectCount(q)>0){
                throw new ServiceException("收藏名称已经存在!");
            }
        }
        for (FlowTaskUser flowTaskUseri:flowTaskUsers){
            flowTaskUseri.setName(name);
        }
        //新增、修改
        this.saveOrUpdateBatch(flowTaskUsers);
    }
    @Override
    public void deleteUser(String name){
        Map<String, Object> m = new HashMap<>();
        m.put("name", name);
        m.put("created_by", AuthUtil.getUserId());
        baseMapper.deleteByMap(m);
    }
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/ProcessStageAttrServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
import com.vci.ubcs.flow.engine.entity.ProcessStageAttr;
import com.vci.ubcs.flow.engine.mapper.ProcessStageAttrMapper;
import com.vci.ubcs.flow.engine.service.ProcessStageAttrService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * æµç¨‹é˜¶æ®µæœåŠ¡å®žçŽ°ç±»
 *
 * @author wang1
 */
@Slf4j
@Service
@AllArgsConstructor
public class ProcessStageAttrServiceImpl extends ServiceImpl<ProcessStageAttrMapper, ProcessStageAttr> implements ProcessStageAttrService {
    /**
     * æ–°å¢ž/修改流程阶段
     * @param flowTaskUserC
     * @return
     */
    @Transactional
    public void saveOrUpdateUser(FlowTaskUserC flowTaskUserC){
        List<ProcessStageAttr> processStageAttrs = flowTaskUserC.getProcessStageAttr();
        String modelKey = flowTaskUserC.getModelKey();
        String templateId = flowTaskUserC.getTemplateId();
        String taskId = flowTaskUserC.getTaskId();
        String taskName = flowTaskUserC.getTaskName();
        //直接删除以前的
        Map<String, Object> m = new HashMap<>();
        m.put("template_id", templateId);
        m.put("model_key", modelKey);
        m.put("task_id", taskId);
        QueryWrapper q = Condition.getQueryWrapper(m, FlowTaskUser.class)
            .select("id,model_key modelKey,name,description,version,created,last_updated lastUpdated");
        int i = baseMapper.deleteByMap(m);
        System.out.println("删除的属性个数: "+i);
        List<ProcessStageAttr> processStages = flowTaskUserC.getProcessStageAttr();
        for (ProcessStageAttr processStageAttr:processStages){
            processStageAttr.setModelKey(modelKey);
            processStageAttr.setTemplateId(templateId);
            processStageAttr.setTaskId(taskId);
            processStageAttr.setTaskName(taskName);
        }
        if(processStages.size()!=0) {
            this.saveOrUpdateBatch(processStages);
        }
    }
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/service/impl/ProcessTemplateServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill åº„骞 (smallchill@163.com)
 */
package com.vci.ubcs.flow.engine.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.vci.ubcs.flow.core.utils.TaskUtil;
import com.vci.ubcs.flow.engine.entity.FlowTaskUser;
import com.vci.ubcs.flow.engine.entity.FlowTaskUserC;
import com.vci.ubcs.flow.engine.entity.ProcessTemplate;
import com.vci.ubcs.flow.engine.mapper.FlowTaskUserMapper;
import com.vci.ubcs.flow.engine.mapper.ProcessTemplateMapper;
import com.vci.ubcs.flow.engine.service.FlowEngineService;
import com.vci.ubcs.flow.engine.service.FlowTaskUserService;
import com.vci.ubcs.flow.engine.service.ProcessTemplateService;
import com.vci.ubcs.starter.web.enumpck.ProcessTemplateTypeEnum;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.launch.constant.FlowConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Condition;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * æµç¨‹æ¨¡æ¿æœåŠ¡å®žçŽ°ç±»
 *
 * @author wang1
 */
@Slf4j
@Service
@AllArgsConstructor
public class ProcessTemplateServiceImpl extends ServiceImpl<ProcessTemplateMapper, ProcessTemplate> implements ProcessTemplateService {
    /**
     * æ–°å¢ž/修改流程模板
     * @param processTemplate
     * @return
     */
    public void saveOrUpdateUser(ProcessTemplate processTemplate){
        //校验这个模板下,一类按钮只能有一个模板
        QueryWrapper<ProcessTemplate> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("button_type_key", processTemplate.getButtonTypeKey());
        if(StringUtils.isNotEmpty(processTemplate.getId())) {//修改的时候,id为空就是新增
            queryWrapper.ne("id", processTemplate.getId());
        }
        if(baseMapper.selectOne(queryWrapper)!=null){
            throw new ServiceException(processTemplate.getButtonTypeValue()+"功能已经配置了流程!");
        }
        if(StringUtils.isEmpty(processTemplate.getButtonTypeValue())){
            processTemplate.setButtonTypeValue(ProcessTemplateTypeEnum.getTextByValue(processTemplate.getButtonTypeKey()));
        }
        //新增或者修改
        if(StringUtils.isEmpty(processTemplate.getId())){
            processTemplate.setCreated(Calendar.getInstance().getTime());
            processTemplate.setCreatedBy(TaskUtil.getTaskUser());
            processTemplate.setLastUpdated(Calendar.getInstance().getTime());
            processTemplate.setLastUpdatedBy(TaskUtil.getTaskUser());
        }
        this.saveOrUpdate(processTemplate);
    }
    /**
     * åˆ é™¤æµç¨‹æ¨¡æ¿
     * @param id
     * @return
     */
    public void deleteProcessTemplate(String id){
        baseMapper.deleteById(id);
    }
    /**
     * æµç¨‹æ¨¡æ¿ç”¨é€”
     * @return
     */
    public List<Map<String,String>> processTemplateType(){
        ProcessTemplateTypeEnum[] es = ProcessTemplateTypeEnum.values();
        List<Map<String,String>> ll = new ArrayList<>();
        for (ProcessTemplateTypeEnum p:es){
            Map<String,String> mi = new HashMap<>();
            String value = p.getValue();
            String text = p.getText();
            mi.put("codee",value);
            mi.put("namee",text);
            ll.add(mi);
        }
        return ll;
    }
}
Source/UBCS/ubcs-ops/ubcs-flow/src/main/resources/mapper/FlowMapper.xml
@@ -50,4 +50,8 @@
        where modelrelation.parent_model_id = #{_parameter}
    </select>
    <update id="updateAssignee" parameterType="java.lang.String" >
        ${u}
    </update>
</mapper>
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/NewAppConstantEnum.java
@@ -8,6 +8,7 @@
     * ç¼–码规则,服务启动名
     */
    APPLICATION_NAME_CODE(AppConstant.APPLICATION_NAME_CODE,"主数据"),
    APPLICATION_FLOW_NAME(AppConstant.APPLICATION_FLOW_NAME,"ubcs-flow"),
    ;
    /**
Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/enumpck/ProcessTemplateTypeEnum.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,134 @@
package com.vci.ubcs.starter.web.enumpck;
/**
 * æµç¨‹æ¨¡æ¿åº”用按钮类型
 * @author wang1
 */
public enum ProcessTemplateTypeEnum implements BaseEnum {
    /**
     * å‘布
     */
    PUBLIC("PUBLIC","发布"),
    /**
     * å˜æ›´
     */
    EDIT("EDIT","变更"),
    /**
     * åœç”¨
     */
    ENABLE("ENABLE","停用"),
    /**
     * å¯ç”¨
     */
    DISABLE("DISABLE","启用");
    /**
     * æžšä¸¾çš„值
     */
    private String value;
    /**
     * æžšä¸¾æ˜¾ç¤ºæ–‡æœ¬
     */
    private String text;
    /**
     * èŽ·å–æžšä¸¾å€¼
     *
     * @return æžšä¸¾å€¼
     */
    @Override
    public String getValue() {
        return value;
    }
    /**
     * è®¾ç½®æžšä¸¾å€¼
     *
     * @param value æžšä¸¾å€¼
     */
    public void setValue(String value) {
        this.value = value;
    }
    /**
     * èŽ·å–æžšä¸¾æ˜¾ç¤ºæ–‡æœ¬
     *
     * @return æ˜¾ç¤ºæ–‡æœ¬
     */
    @Override
    public String getText() {
        return text;
    }
    /**
     * è®¾ç½®æ˜¾ç¤ºæ–‡æœ¬
     *
     * @param text æ˜¾ç¤ºæ–‡æœ¬
     */
    public void setText(String text) {
        this.text = text;
    }
    /**
     * æž„造函数
     *
     * @param value å€¼
     * @param text  æ˜¾ç¤ºæ–‡æœ¬
     */
    private ProcessTemplateTypeEnum(String value, String text) {
        this.value = value;
        this.text = text;
    }
    /**
     * æ ¹æ®åç§°èŽ·å–å¯¹åº”çš„æžšä¸¾å€¼
     *
     * @param text åç§°
     * @return æžšä¸¾å€¼
     */
    public static String getValueByText(String text) {
        for (ProcessTemplateTypeEnum wenum : ProcessTemplateTypeEnum.values()) {
            if (wenum.getText().equalsIgnoreCase(text)) {
                return wenum.getValue();
            }
        }
        return "";
    }
    /**
     * æ ¹æ®æžšä¸¾å€¼èŽ·å–åç§°
     *
     * @param value æžšä¸¾å€¼
     * @return åç§°
     */
    public static String getTextByValue(String value) {
        for (ProcessTemplateTypeEnum wenum : ProcessTemplateTypeEnum.values()) {
            if (wenum.getValue().equalsIgnoreCase(value)) {
                return wenum.getText();
            }
        }
        return "";
    }
    /**
     * æ ¹æ®æžšä¸¾å€¼èŽ·å–æžšä¸¾å¯¹è±¡
     *
     * @param value æžšä¸¾å€¼
     * @return æžšä¸¾å¯¹è±¡ï¼Œä¸å­˜åœ¨æ—¶å€™è¿”回null
     */
    public static ProcessTemplateTypeEnum forValue(String value) {
        for (ProcessTemplateTypeEnum wenum : ProcessTemplateTypeEnum.values()) {
            if (wenum.getValue().equalsIgnoreCase(value)) {
                return wenum;
            }
        }
        return null;
    }
}
Source/UBCS/ubcs-service-api/ubcs-workflow-api/src/main/java/com/vci/ubcs/code/constant/FlowConstant.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.vci.workflow.constant;
public class FlowConstant {
    public static final String MAPPER_SCAN = "com.dragon.*.dao.*";
    /**
     * æäº¤äººçš„变量名称
     */
    public static final String FLOW_SUBMITTER_VAR = "initiator";
    /**
     * æäº¤äººèŠ‚ç‚¹åç§°
     */
    public static final String FLOW_SUBMITTER = "提交人";
    /**
     * è‡ªåŠ¨è·³è¿‡èŠ‚ç‚¹è®¾ç½®å±žæ€§
     */
    public static final String FLOWABLE_SKIP_EXPRESSION_ENABLED = "_FLOWABLE_SKIP_EXPRESSION_ENABLED";
    /**
     * æŒ‚起状态
     */
    public static final int SUSPENSION_STATE = 2;
    /**
     * æ¿€æ´»çŠ¶æ€
     */
    public static final int ACTIVATE_STATE = 1;
    //后加签
    public static final String AFTER_ADDSIGN = "after";
    //前加签
    public static final String BEFORE_ADDSIGN = "before";
}
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/UserPwdstrategyController.java
@@ -13,6 +13,7 @@
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
 * ç”¨æˆ·å¯†ç ç­–略关联(UserPwdstrategy)表控制层
Source/UBCS/ubcs-service/ubcs-user/src/main/java/com/vci/ubcs/system/user/service/impl/UserServiceImpl.java
@@ -336,7 +336,7 @@
        regex = "^"+regex+"{"+strategy.getRequiredType()+",}$";
        boolean result = RegexUtil.find(regex, newPassword1);
        if(!result){
            throw new ServiceException(resException);
            //throw new ServiceException(resException);
        }
        //修改密码同时,改变用户信息中的密码修改状态字段,密码修改时间
        return this.update(Wrappers.<User>update().lambda()