Merge branch 'master' of http://dev.vci-tech.com:1065/r/ubcs
已修改18个文件
已重命名1个文件
已添加3个文件
| | |
| | | export const remove = (oids) => { |
| | | return request({ |
| | | url: '/api/ubcs-resource/fileController/deleteFile', |
| | | method: 'post', |
| | | method: 'delete', |
| | | params: { |
| | | oids |
| | | } |
| | | }) |
| | | } |
| | | |
| | | export const upload = (row) => { |
| | | export const upload = (file) => { |
| | | return request({ |
| | | url: '/api/ubcs-resource/fileController/uploadFile', |
| | | method: 'post', |
| | | data: row |
| | | data: file |
| | | }) |
| | | } |
| | | |
| | | export const update = (row) => { |
| | | export const update = (file) => { |
| | | return request({ |
| | | url: '/api/ubcs-resource/fileController/uploadFile', |
| | | method: 'post', |
| | | data: row |
| | | data: file |
| | | }) |
| | | } |
| | | |
| | | export const download = (oids) => { |
| | | export const download = (fileOids) => { |
| | | return request({ |
| | | url: '/api/ubcs-resource/fileController/downloadFilesByOids', |
| | | method: 'get', |
| | | params: { |
| | | oids |
| | | fileOids |
| | | } |
| | | }) |
| | | } |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="options.title|| 'é件管ç'" |
| | | <el-dialog :title="options.title|| 'éä»¶å表'" |
| | | :visible.sync="visible" |
| | | append-to-body |
| | | class="avue-dialog avue-dialog--top" |
| | |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | <el-dialog title="ä¸ä¼ éä»¶å表" |
| | | <el-dialog title="é件管ç" |
| | | append-to-body |
| | | :visible.sync="attachBox" |
| | | width="555px"> |
| | | <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-before="uploadBefore" :upload-after="uploadAfter" :upload-error="uploadError"> |
| | | <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-before="uploadBefore" :upload-after="uploadAfter" :upload-error="uploadError"> |
| | | </avue-form> |
| | | </el-dialog> |
| | | </basic-container> |
| | |
| | | }, |
| | | ] |
| | | }, |
| | | columnType: { |
| | | text: "input", |
| | | combox: "select", |
| | | truefalse: "switch", |
| | | number: "number", |
| | | textarea: "textarea", |
| | | datetime: "datetime", |
| | | date: "date", |
| | | refer: "refer", |
| | | }, |
| | | data: [{ |
| | | btmname: "fileobject", |
| | | createTime: "2023-06-14 16:08:50.002", |
| | |
| | | }], |
| | | attachForm: {}, |
| | | attachOption: { |
| | | submitBtn: true, |
| | | emptyBtn: true, |
| | | column: [ |
| | | { |
| | | label: 'éä»¶ä¸ä¼ ', |
| | | prop: 'attachFile', |
| | | type: 'upload', |
| | | dragFile: true, |
| | | loadText: 'æä»¶ä¸ä¼ ä¸ï¼è¯·ç¨ç', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | action: "/api/ubcs-resource/fileController/uploadFile" |
| | | } |
| | | submitBtn: false, |
| | | emptyBtn: false, |
| | | column: [{ |
| | | prop: 'fileDocClassify', |
| | | label: 'æä»¶ç±»å', |
| | | props: { |
| | | label: 'value', |
| | | value: 'key' |
| | | }, |
| | | change: () => { |
| | | (!!this.options.fileDocClassifyCombox) && this.changeFun('fileDocClassify'); |
| | | }, |
| | | blur: () => { |
| | | (!this.options.fileDocClassifyCombox) && this.changeFun('fileDocClassify'); |
| | | }, |
| | | value: this.options.fileDocClassify || "ADMIN_SHARE", |
| | | type: (!this.options.fileDocClassifyCombox) ? 'input' : 'select', |
| | | dicData: (this.options.fileDocClassifyCombox || []),//[{key: 'text', value: 'ææ¬æ¡'}] |
| | | display: (!!this.options.fileDocClassifyCombox) |
| | | }, { |
| | | label: 'éä»¶ä¸ä¼ ', |
| | | prop: 'attachFile', |
| | | type: 'upload', |
| | | dragFile: true, |
| | | accept: this.options.uploadAccept || 'file', |
| | | loadText: 'æä»¶ä¸ä¼ ä¸ï¼è¯·ç¨ç', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | data: { |
| | | ownbizOid:this.options.ownbizOid || "share", |
| | | ownBtmname:this.options.ownbizBtm || "share", |
| | | fileDocClassify:this.options.fileDocClassify || "ADMIN_SHARE", |
| | | fileDocClassifyName:this.options.fileDocClassifyName || "管çåå
±äº«æä»¶" |
| | | }, |
| | | action: "/api/ubcs-resource/fileController/uploadFile" |
| | | } |
| | | ] |
| | | } |
| | | }; |
| | |
| | | delBtn: this.vaildData(this.permission.attach_delete, false) |
| | | }; |
| | | }, |
| | | ids() { |
| | | let ids = []; |
| | | oids() { |
| | | let oids = []; |
| | | this.selectionList.forEach(ele => { |
| | | ids.push(ele.id); |
| | | oids.push(ele.oid); |
| | | }); |
| | | return ids.join(","); |
| | | return oids.join(","); |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.setFormItem(); |
| | | this.setParams() |
| | | }, |
| | | methods: { |
| | | setParams(){ |
| | | var params={ |
| | | ownbizOid:options.ownbizOid || '6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9', |
| | | ownbizBtm:options.ownbizBtm || 'wupin', |
| | | fileDocClassify:options.fileDocClassify || '!=processAuditSuggest' |
| | | setFormItem(){ |
| | | /*this.options.formItems=[{ |
| | | field: 'fileDocClassify11', |
| | | title: 'æä»¶ç±»å', |
| | | type: 'combox', |
| | | data: [{key: 'text', value: 'ææ¬æ¡'},{key: 'number', value: 'æ°åæ¡'}] |
| | | }]*/ |
| | | if(this.options && this.options.formItems){ |
| | | this.options.formItems.forEach(item => { |
| | | // è®¾ç½®è¡¨åæ ¡éªçè§åï¼ææ¬ |
| | | let message = "è¯·éæ©"; |
| | | let trigger = "change"; |
| | | if (item.type === "text") { |
| | | message = "请è¾å
¥"; |
| | | trigger = "blur"; |
| | | } |
| | | this.attachOption.column.push( { |
| | | ...item, |
| | | label: item.title, |
| | | prop: item.field, |
| | | display: !item.hidden, |
| | | value: item.defaultValue, |
| | | disabled: item.readOnly, |
| | | type: this.columnType[item.type], |
| | | dicData: this.getDataList(item.type, item.data), |
| | | change: () => { |
| | | if(item.type !== "text" && item.type !== "number" && item.type !== "textarea"){ |
| | | this.changeFun(item.field); |
| | | } |
| | | }, |
| | | blur: () => { |
| | | if(item.type == "text" || item.type == "number" || item.type == "textarea"){ |
| | | this.changeFun(item.field); |
| | | } |
| | | }, |
| | | rules: [ |
| | | { |
| | | required: item.required, |
| | | message: `请${message}${item.title}`, |
| | | trigger, |
| | | }, |
| | | { |
| | | // å¦ææ²¡ææ£ååå¹é
ä»»ä½å符 |
| | | pattern: item.verify ? item.verify : /[\s\S.]*/g, |
| | | message: item.tooltips, |
| | | trigger, |
| | | }, |
| | | ], |
| | | props: { |
| | | label: 'value', |
| | | value: 'key' |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | this.params=params; |
| | | }, |
| | | changeFun( prop) { |
| | | this.attachOption.column[1].data[prop]=this.attachForm[prop] |
| | | }, |
| | | getDataList(type, dicData) { |
| | | if (type === "truefalse") { |
| | | return [ |
| | | { |
| | | key: false, |
| | | value: "å¦", |
| | | }, |
| | | { |
| | | key: true, |
| | | value: "æ¯", |
| | | }, |
| | | ]; |
| | | } else if (type === "combox") { |
| | | return dicData; |
| | | } |
| | | return []; |
| | | }, |
| | | setParams(){ |
| | | var queryMap = { |
| | | currentButtonKey:'VIEW', |
| | | ownbizOid:this.options.ownbizOid, |
| | | ownbizBtm:this.options.ownbizBtm |
| | | }; |
| | | if(this.options.where){ |
| | | Object.assign(queryMap,this.options.where); |
| | | } |
| | | this.params=queryMap; |
| | | }, |
| | | handleUpload() { |
| | | this.attachOption.column[1].data.fileOid=''; |
| | | delete this.attachOption.column[1].data.oid; |
| | | delete this.attachOption.column[1].data.updateFileFlag; |
| | | this.attachBox = true; |
| | | }, |
| | | handleEdit() { |
| | | if(this.selectionList.length==0){ |
| | | this.$message.error('è¯·éæ©éè¦ä¿®æ¹çæä»¶') |
| | | return false; |
| | | }else if(this.selectionList.length>1){ |
| | | this.$message.error('è¯·éæ©ä¸æ¡æ°æ®') |
| | | return false; |
| | | } |
| | | this.attachOption.column[1].data.fileOid=this.oids; |
| | | this.attachOption.column[1].data.oid=this.oids; |
| | | this.attachOption.column[1].data.updateFileFlag=true |
| | | this.attachBox = true; |
| | | }, |
| | | uploadBefore(file, done, loading,column) { |
| | | console.log(file,column) |
| | | //å¦æä½ æ³ä¿®æ¹fileæä»¶,ç±äºä¸ä¼ çfileæ¯åªè¯»æä»¶ï¼å¿
é¡»å¤å¶æ°çfileæå¯ä»¥ä¿®æ¹ååï¼å®åèµå¼å°done彿°é,妿ä¸ä¿®æ¹çè¯ç´æ¥ådone()å³å¯ |
| | | var newFile = new File([file], '1234', { type: file.type }); |
| | | done(newFile) |
| | | this.$message.success('ä¸ä¼ åçæ¹æ³') |
| | | done(); |
| | | }, |
| | | uploadAfter(res, done, loading, column) { |
| | | window.console.log(column); |
| | | this.attachBox = false; |
| | | if(res.success){ |
| | | this.attachBox = false; |
| | | this.$message.success('æä»¶ä¸ä¼ æå') |
| | | }else{ |
| | | this.$message.error(res.msg); |
| | | } |
| | | this.refreshChange(); |
| | | done(); |
| | | }, |
| | | uploadError(error, column) { |
| | | this.$message.success('ä¸ä¼ 失败åè°') |
| | | console.log(error, column) |
| | | this.$message.error('ä¸ä¼ æä»¶åºç°äºå¼å¸¸') |
| | | }, |
| | | handleDownload(row) { |
| | | window.open(`${row.link}`); |
| | | //window.open(`${row.link}`); |
| | | download(row.oid) |
| | | }, |
| | | rowDel(row) { |
| | | this.$confirm("ç¡®å®å°éæ©æä»¶å é¤?", { |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(row.id); |
| | | return remove(row.oid); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | return remove(this.ids); |
| | | return remove(this.oids); |
| | | }) |
| | | .then(() => { |
| | | this.onLoad(this.page); |
| | |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | this.onLoad(this.page); |
| | | done(); |
| | | }, |
| | | selectionChange(list) { |
| | |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params) { |
| | | //this.loading = true; |
| | | params=this.params || {} |
| | | /*getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | onLoad(page, params={}) { |
| | | this.loading = true; |
| | | var query={} |
| | | if (this.query) { |
| | | for (var key in this.query) { |
| | | query['conditionMap["' + key + '"]'] = this.query[key]; |
| | | } |
| | | } |
| | | getList(page.currentPage, page.pageSize, Object.assign(params,this.params, query,this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | });*/ |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | |
| | | import com.vci.ubcs.flow.engine.entity.FlowProcess; |
| | | import com.vci.ubcs.flow.engine.utils.FlowCache; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | |
| | | |
| | | HistoricProcessInstanceQuery historyQuery = historyService.createHistoricProcessInstanceQuery().startedBy(taskUser).orderByProcessInstanceStartTime().desc(); |
| | | |
| | | if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | historyQuery.processDefinitionCategory(bladeFlow.getCategory()); |
| | | } |
| | | if (bladeFlow.getProcessDefinitionName() != null) { |
| | |
| | | String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey()); |
| | | if (businessKey.length > 1) { |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | flow.setBusinessId(businessKey.length>1?businessKey[1]:"1"); |
| | | } |
| | | flow.setHistoryActivityName(historicProcessInstance.getName()); |
| | | flow.setProcessInstanceId(historicProcessInstance.getId()); |
| | |
| | | HistoricTaskInstanceQuery doneQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(taskUser).finished() |
| | | .includeProcessVariables().orderByHistoricTaskInstanceEndTime().desc(); |
| | | |
| | | if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | doneQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory())); |
| | | } |
| | | if (bladeFlow.getProcessDefinitionName() != null) { |
| | |
| | | if (Func.isNotEmpty(historicProcessInstance)) { |
| | | String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey()); |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | flow.setBusinessId(businessKey.length>1?businessKey[1]:"1"); |
| | | if (historicProcessInstance.getEndActivityId() != null) { |
| | | flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED); |
| | | } else { |
| | |
| | | * @param status ç¶æ |
| | | */ |
| | | private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status) { |
| | | if (bladeFlow.getCategory() != null) { |
| | | // if (bladeFlow.getCategory() != null) { |
| | | if (StringUtils.isNotEmpty(bladeFlow.getCategory())) { |
| | | taskQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory())); |
| | | } |
| | | if (bladeFlow.getProcessDefinitionName() != null) { |
| | |
| | | if (Func.isNotEmpty(historicProcessInstance)) { |
| | | String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey()); |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | flow.setBusinessId(businessKey.length>1?businessKey[1]:"1"); |
| | | } |
| | | |
| | | FlowProcess processDefinition = FlowCache.getProcessDefinition(task.getProcessDefinitionId()); |
ÎļþÃû´Ó Source/UBCS/ubcs-ops/ubcs-flow/src/main/java/com/vci/ubcs/flow/engine/controller/ProcessTSController.java ÐÞ¸Ä |
| | |
| | | @RestController |
| | | @RequestMapping("processTS") |
| | | @AllArgsConstructor |
| | | public class ProcessTSController { |
| | | public class FlowProcessTSController { |
| | | |
| | | private final FlowEngineService flowEngineService; |
| | | private final ProcessTemplateService processTemplateService; |
| | |
| | | @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") |
| | | .select("id,model_key modelKey,model_name modelName,button_Type_Key buttonTypeKey,button_Type_value buttonTypeValue,description") |
| | | .orderByDesc("last_updated")); |
| | | return R.data(pages); |
| | | } |
| | |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * æµç¨taskå®¡æ¹æ§å¶ |
| | |
| | | |
| | | /** |
| | | * æµç¨task审æ¹äººåå表 |
| | | * ProcessTemplateTypeEnum |
| | | * @return |
| | | */ |
| | | @GetMapping("list") |
| | | public R<FlowTaskUserC> list() { |
| | | return R.data(taskUserService.getUser()); |
| | | public R<Object> list(String type,String templateId) { |
| | | return R.data(taskUserService.getUser(type,templateId)); |
| | | } |
| | | |
| | | /** |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.flow.engine.controller; |
| | | |
| | | import com.vci.ubcs.flow.core.entity.BladeFlow; |
| | | import com.vci.ubcs.flow.engine.entity.FlowTaskUserC; |
| | | import com.vci.ubcs.flow.engine.service.FlowTaskUserService; |
| | | import com.vci.ubcs.flow.engine.service.VICFlowService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * å®å¶æµç¨ãå¯å¨ã转åã宿æ§å¶å¨ |
| | | * |
| | | * @author wang1 |
| | | */ |
| | | @NonDS |
| | | @RestController |
| | | @RequestMapping("vciflow") |
| | | @AllArgsConstructor |
| | | public class VCIFlowController { |
| | | |
| | | private final VICFlowService vicFlowService; |
| | | |
| | | /** |
| | | * å¯å¨ |
| | | * @return |
| | | */ |
| | | @PostMapping("start") |
| | | public R<BladeFlow> list(@RequestBody FlowTaskUserC flowTaskUserC) { |
| | | return vicFlowService.startProcess(flowTaskUserC); |
| | | } |
| | | |
| | | /** |
| | | * æµç¨é¢æµ |
| | | */ |
| | | @PostMapping("a") |
| | | public R<BladeFlow> a(@RequestBody FlowTaskUserC flowTaskUserC) { |
| | | return vicFlowService.startProcess(flowTaskUserC); |
| | | } |
| | | } |
| | |
| | | private String id; |
| | | private String name;//ä¿åçè¿ä¸ªæ¶èåç§° |
| | | private String modelKey; |
| | | private String modelName; |
| | | private String classifyId; |
| | | private String templateId; |
| | | private String taskId;//æµç¨taskid |
| | |
| | | private String createdBy; |
| | | private String name;//ä¿åçè¿ä¸ªæ¶èåç§° |
| | | private String modelKey; |
| | | private String modelName; |
| | | private String processName; |
| | | private String processDesc; |
| | | private String topName; |
| | | private String classifyId; |
| | | private String templateId; |
| | | private String taskId;//é¶æ®µidï¼å°±æ¯æµç¨taskid |
| | | private String taskName;//é¶æ®µåç§° |
| | | private List<FlowTaskUser> flowTaskUsers;//æ¯ä¸ªèç¹æ¶è人 |
| | | private List<ProcessStageAttr> processStageAttr;//æµç¨é¶æ®µä¿åç屿§ |
| | | private List<String> ids;//æµç¨åèµ·ä¸ä¼ éè¿æ¥çæ°æ®id |
| | | |
| | | |
| | | } |
| | |
| | | */ |
| | | List<Map<String,String>> getNodeByFlowableKey(String key); |
| | | |
| | | String getTaskIdString(); |
| | | |
| | | } |
| | |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç»é人对è¿ä¸ªæµç¨çtaskUser |
| | | * @param type ProcessTemplateTypeEnum |
| | | * @return |
| | | */ |
| | | FlowTaskUserC getUser(); |
| | | Object getUser(String type,String templateId); |
| | | |
| | | /** |
| | | * æ°å¢/ä¿®æ¹æµç¨èç¹å®¡æ ¸äººé
ç½®ãå¹¶ä¸ä¿®æ¹æµç¨xmlé¨ç½²æä»¶ |
| | |
| | | * @param name |
| | | */ |
| | | void deleteUser(String name); |
| | | |
| | | /** |
| | | * éè¿æ¨¡æ¿id忍¡åkeyæ¥è¯¢å®¡æ¹äºº |
| | | * @param templateId |
| | | * @param modelKey |
| | | * @return |
| | | */ |
| | | List<FlowTaskUser> getTaskUserByTemplateAndModelKey(String templateId,String modelKey); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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.core.entity.BladeFlow; |
| | | import com.vci.ubcs.flow.engine.entity.FlowTaskUser; |
| | | import com.vci.ubcs.flow.engine.entity.FlowTaskUserC; |
| | | import org.springblade.core.tool.api.R; |
| | | |
| | | /** |
| | | * FlowService |
| | | * |
| | | * @author wang1 |
| | | */ |
| | | public interface VICFlowService{ |
| | | |
| | | /** |
| | | * å¯å¨æµç¨ |
| | | * @return |
| | | */ |
| | | R<BladeFlow> startProcess(FlowTaskUserC flowTaskUserC); |
| | | } |
| | |
| | | private static final String USR_TASK = "userTask"; |
| | | private static final String IMAGE_NAME = "image"; |
| | | private static final String XML_NAME = "xml"; |
| | | private static final String TASKID = "taskId"; |
| | | private static final String TASKNAME = "taskName"; |
| | | private static final Integer INT_1024 = 1024; |
| | | private static final BpmnJsonConverter BPMN_JSON_CONVERTER = new BpmnJsonConverter(); |
| | | private static final BpmnXMLConverter BPMN_XML_CONVERTER = new BpmnXMLConverter(); |
| | |
| | | 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()); |
| | | mi.put(TASKID,flowElement.getId()); |
| | | mi.put(TASKNAME,flowElement.getName()); |
| | | ll.add(mi); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return ll; |
| | | } |
| | | |
| | | @Override |
| | | public String getTaskIdString(){ |
| | | return TASKID; |
| | | } |
| | | /** |
| | | * æ¯å¦å·²å®ç» |
| | | * |
| | |
| | | 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.mapper.ProcessTemplateMapper; |
| | | import com.vci.ubcs.flow.engine.service.FlowEngineService; |
| | | import com.vci.ubcs.flow.engine.service.FlowTaskUserService; |
| | | import com.vci.ubcs.flow.engine.utils.FlowCache; |
| | |
| | | |
| | | private FlowEngineService flowEngineService; |
| | | private FlowTaskUserMapper flowTaskUserMapper; |
| | | private ProcessTemplateMapper processTemplateMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢å½åç»é人对è¿ä¸ªæµç¨çtaskUser |
| | | * @param type ProcessTemplateTypeEnum |
| | | * @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; |
| | | public Object getUser(String type,String templateId){ |
| | | Map kv = new HashMap(); |
| | | |
| | | //æ ¹æ®typeæ¥è¯¢topæµç¨æ°æ® |
| | | Map<String, Object> m = new HashMap<>(); |
| | | m.put("button_type_key", type); |
| | | m.put("template_id", templateId); |
| | | List<ProcessTemplate> processTemplates = processTemplateMapper.selectByMap(m); |
| | | if(processTemplates.size()==0){ |
| | | throw new ServiceException("主é¢åºå®ä¹-模æ¿ç®¡ç-æµç¨æ¨¡æ¿ï¼æ²¡æç»å®æµç¨!"); |
| | | } |
| | | flowTaskUserCR.setName(flowTaskUsers.get(0).getName());//æ¶èåç§° |
| | | flowTaskUserCR.setFlowTaskUsers(flowTaskUsers); |
| | | return flowTaskUserCR; |
| | | ProcessTemplate processTemplate = processTemplates.get(0); |
| | | kv.put("flow",processTemplate); |
| | | |
| | | |
| | | //topæ¶èé¨åæ°æ® |
| | | QueryWrapper<FlowTaskUser> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("CREATED_BY", TaskUtil.getTaskUser()); |
| | | List<FlowTaskUser> flowTaskUsers = baseMapper.selectList(queryWrapper); |
| | | List<FlowTaskUserC> cl = new ArrayList<>(); |
| | | |
| | | Map<String,List<FlowTaskUser>> nameMap = new HashMap<>(); |
| | | for(FlowTaskUser flowTaskUser:flowTaskUsers){ |
| | | String name = flowTaskUser.getName();//æ¶èåç§° |
| | | List<FlowTaskUser> flowTaskUserListo = null; |
| | | if(nameMap.get(name)==null){ |
| | | flowTaskUserListo = new ArrayList<>(); |
| | | }else { |
| | | flowTaskUserListo = nameMap.get(name); |
| | | } |
| | | flowTaskUserListo.add(flowTaskUser); |
| | | nameMap.put(name,flowTaskUserListo); |
| | | } |
| | | |
| | | for (String name:nameMap.keySet()){ |
| | | FlowTaskUserC flowTaskUserCR = new FlowTaskUserC(); |
| | | flowTaskUserCR.setName(name);//æ¶èåç§° |
| | | flowTaskUserCR.setModelKey(nameMap.get(name).get(0).getModelKey()); |
| | | flowTaskUserCR.setModelName(nameMap.get(name).get(0).getModelName()); |
| | | flowTaskUserCR.setFlowTaskUsers(nameMap.get(name)); |
| | | cl.add(flowTaskUserCR); |
| | | } |
| | | kv.put("collect",cl); |
| | | |
| | | //æ°æ®èç¹æ°æ® |
| | | List<Map<String,String>> tl = flowEngineService.getNodeByFlowableKey(processTemplate.getModelKey()); |
| | | kv.put("user",tl); |
| | | return kv; |
| | | } |
| | | |
| | | @Override |
| | |
| | | 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("æ¶èåç§°å·²ç»åå¨!"); |
| | | } |
| | | Map<String, Object> m = new HashMap<>(); |
| | | m.put("name", name); |
| | | m.put("created_by", TaskUtil.getTaskUser()); |
| | | QueryWrapper q = Condition.getQueryWrapper(m, FlowTaskUser.class) |
| | | .select("1"); |
| | | if(flowTaskUserMapper.selectCount(q)>0){ |
| | | throw new ServiceException("æ¶èåç§°å·²ç»åå¨!"); |
| | | } |
| | | |
| | | for (FlowTaskUser flowTaskUseri:flowTaskUsers){ |
| | | flowTaskUseri.setName(name); |
| | | flowTaskUseri.setCreatedBy(TaskUtil.getTaskUser()); |
| | | flowTaskUseri.setTemplateId(flowTaskUserC.getTemplateId()); |
| | | flowTaskUseri.setModelKey(flowTaskUserC.getModelKey()); |
| | | } |
| | | //æ°å¢ãä¿®æ¹ |
| | | this.saveOrUpdateBatch(flowTaskUsers); |
| | |
| | | public void deleteUser(String name){ |
| | | Map<String, Object> m = new HashMap<>(); |
| | | m.put("name", name); |
| | | m.put("created_by", AuthUtil.getUserId()); |
| | | m.put("created_by", TaskUtil.getTaskUser()); |
| | | baseMapper.deleteByMap(m); |
| | | } |
| | | |
| | | public List<FlowTaskUser> getTaskUserByTemplateAndModelKey(String templateId,String modelKey){ |
| | | Map<String, Object> m = new HashMap<>(); |
| | | m.put("template_id", templateId); |
| | | m.put("model_key", modelKey); |
| | | return baseMapper.selectByMap(m); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | /* |
| | | * 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.vci.ubcs.flow.core.constant.ProcessConstant; |
| | | import com.vci.ubcs.flow.core.entity.BladeFlow; |
| | | import com.vci.ubcs.flow.core.utils.TaskUtil; |
| | | import com.vci.ubcs.flow.engine.entity.*; |
| | | import com.vci.ubcs.flow.engine.service.FlowEngineService; |
| | | import com.vci.ubcs.flow.engine.service.FlowTaskUserService; |
| | | import com.vci.ubcs.flow.engine.service.VICFlowService; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.bpmn.model.*; |
| | | import org.flowable.engine.*; |
| | | import org.flowable.engine.impl.persistence.entity.ExecutionEntity; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.flowable.engine.runtime.ProcessInstance; |
| | | import org.flowable.task.api.Task; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springframework.stereotype.Service; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 工使µæå¡å®ç°ç±» |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class VCIFlowserviceImpl implements VICFlowService { |
| | | |
| | | private final RuntimeService runtimeService; |
| | | private final IdentityService identityService; |
| | | private final RepositoryService repositoryService; |
| | | private final TaskService taskService; |
| | | private final FlowTaskUserService flowTaskUserService; |
| | | private final FlowEngineService flowEngineService; |
| | | private final HistoryService historyService; |
| | | |
| | | @Override |
| | | public R<BladeFlow> startProcess(FlowTaskUserC flowTaskUserC){ |
| | | String modelKey = flowTaskUserC.getModelKey(); |
| | | String templateId = flowTaskUserC.getTemplateId(); |
| | | |
| | | Kv kv = Kv.create() |
| | | .set(ProcessConstant.TASK_VARIABLE_CREATE_USER, AuthUtil.getUserName()); |
| | | |
| | | // 设置æµç¨å¯å¨ç¨æ· |
| | | identityService.setAuthenticatedUserId(TaskUtil.getTaskUser()); |
| | | |
| | | // å¼å¯æµç¨ |
| | | //æ¥è¯¢ææ°çæµç¨é¨ç½²id |
| | | ProcessDefinition latesDefinition = repositoryService.createProcessDefinitionQuery().latestVersion().processDefinitionKey(modelKey).singleResult(); |
| | | String processDefinitionId = latesDefinition.getId(); |
| | | |
| | | //æ¥è¯¢æ¯ä¸æ¥å®¡æ ¸äºº |
| | | List<FlowTaskUser> taskUsers = flowTaskUserService.getTaskUserByTemplateAndModelKey(templateId,modelKey); |
| | | Set<String> taskIdSet = new HashSet<>(); |
| | | for (FlowTaskUser taskUser:taskUsers){ |
| | | kv.put(taskUser.getTaskId(),TaskUtil.getTaskUser(taskUser.getUserId())); |
| | | taskIdSet.add(taskUser.getTaskId()); |
| | | } |
| | | |
| | | //对æ¯é
ç½®çå®¡æ ¸äººååæµç¨ä¸èç¹æ¯å¦ä¸è´ï¼å¯è½å卿µç¨èç¹åæ´äºï¼å¤äºæè
å°äºèç¹ï¼ä½æ¯é
ç½®å®¡æ ¸äººåçèç¹æ²¡æå |
| | | List<Map<String,String>> processTasks = flowEngineService.getNodeByFlowableKey(modelKey); |
| | | for (Map<String,String> mi:processTasks){ |
| | | String taskId = mi.get(flowEngineService.getTaskIdString()); |
| | | if(!taskIdSet.contains(taskId)){ |
| | | throw new ServiceException("æµç¨å·²éæ°é¨ç½²ï¼èç¹å·²æ¹åï¼è¯·è®¾ç½®å®¡æ ¸äººåï¼"); |
| | | } |
| | | } |
| | | if(taskIdSet.size()!=processTasks.size()){ |
| | | throw new ServiceException("æµç¨å·²éæ°é¨ç½²ï¼èç¹å·²æ¹åï¼è¯·è®¾ç½®å®¡æ ¸äººåï¼"); |
| | | } |
| | | |
| | | //æµç¨ä¸æä»¶ãåéç |
| | | //do.. |
| | | |
| | | ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId, modelKey, kv); |
| | | // ç»è£
æµç¨éç¨ç±» |
| | | BladeFlow flow = new BladeFlow(); |
| | | flow.setProcessInstanceId(processInstance.getId()); |
| | | |
| | | nextFlowNode("next","039ac1d8-0c1e-11ee-bebb-5c3a4570456d"); |
| | | return R.data(flow); |
| | | } |
| | | |
| | | /** |
| | | * è·åä»»å¡èç¹ |
| | | * |
| | | * @param node æ¥è¯¢èç¹éæ© |
| | | * @param processInstanceId æµç¨å®ä¾id |
| | | */ |
| | | public void nextFlowNode(String node, String processInstanceId) { |
| | | |
| | | Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).active().singleResult(); |
| | | |
| | | ExecutionEntity ee = (ExecutionEntity) runtimeService.createExecutionQuery() |
| | | .executionId(task.getExecutionId()).singleResult(); |
| | | // å½å审æ¹èç¹ |
| | | String crruentActivityId = ee.getActivityId(); |
| | | BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); |
| | | FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(crruentActivityId); |
| | | // è¾åºè¿çº¿ |
| | | List<SequenceFlow> outFlows = flowNode.getOutgoingFlows(); |
| | | for (SequenceFlow sequenceFlow : outFlows) { |
| | | //å½å审æ¹èç¹ |
| | | if ("now".equals(node)) { |
| | | FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); |
| | | System.out.println("å½åèç¹: id=" + sourceFlowElement.getId() + ",name=" + sourceFlowElement.getName()); |
| | | } else if ("next".equals(node)) { |
| | | // ä¸ä¸ä¸ªå®¡æ¹èç¹ |
| | | FlowElement targetFlow = sequenceFlow.getTargetFlowElement(); |
| | | if (targetFlow instanceof UserTask) { |
| | | System.out.println("ä¸ä¸èç¹: id=" + targetFlow.getId() + ",name=" + targetFlow.getName()); |
| | | } |
| | | // 妿ä¸ä¸ªå®¡æ¹èç¹ä¸ºç»æèç¹ |
| | | if (targetFlow instanceof EndEvent) { |
| | | System.out.println("ä¸ä¸èç¹ä¸ºç»æèç¹ï¼id=" + targetFlow.getId() + ",name=" + targetFlow.getName()); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * åç¨ |
| | | */ |
| | | ENABLE("ENABLE","åç¨"), |
| | | ENABLE("ENABLE","å¯ç¨"), |
| | | |
| | | /** |
| | | * å¯ç¨ |
| | | */ |
| | | DISABLE("DISABLE","å¯ç¨"); |
| | | DISABLE("DISABLE","åç¨"); |
| | | |
| | | /** |
| | | * æä¸¾çå¼ |
| | |
| | | |
| | | |
| | | |
| | | <select id="selectChildHasReleaseTemplate" resultType="list"> |
| | | <select id="selectChildHasReleaseTemplate" resultType="map"> |
| | | select t.oid as oid, cls.oid as clsoid |
| | | from platformbtm_codeclstemplate t |
| | | from pl_code_clstemplate t |
| | | left join (select oid |
| | | from platformbtm_codeclassify |
| | | from pl_code_classify |
| | | where lcstatus = #{lcstatus} |
| | | start with oid = #{classifyoid} |
| | | connect by prior oid = parentcodeclassifyoid) cls |
| | |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | @GetMapping("/allPage") |
| | | public R<List<UserVO>> allPage(User user,Long deptId) { |
| | | List<User> userss = userService.selectAllUser(user,deptId); |
| | | return R.data(UserWrapper.build().listVO(userss)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æä¿®æ¹ |
| | | */ |
| | |
| | | */ |
| | | List<User> selectUserPage(IPage<User> page, @Param("user") User user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId); |
| | | |
| | | List<User> selectUserPage(@Param("user") User user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId); |
| | | |
| | | /** |
| | | * è·åç¨æ· |
| | | * |
| | |
| | | * @param account |
| | | * @return |
| | | */ |
| | | User getUser(String tenantId, String account); |
| | | User getUser(String tenantId, String account,String name); |
| | | |
| | | /** |
| | | * è·å导åºç¨æ·æ°æ® |
| | |
| | | * èªå®ä¹å页 |
| | | * |
| | | * @param user |
| | | * @param deptId |
| | | * @return |
| | | */ |
| | | List<User> selectAllUser(User user, Long deptId); |
| | | |
| | | /** |
| | | * èªå®ä¹å页 |
| | | * |
| | | * @param user |
| | | * @param query |
| | | * @return |
| | | */ |
| | |
| | | UserInfo userInfo(String tenantId, String account); |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯,为å¥ä¸å äºä¸è¾¹é£ä¸ªæ¹æ³å¢ï¼å 为æä¸æ¢,çµæ¯æç¹å¤ |
| | | * |
| | | * @param tenantId |
| | | * @param account |
| | | * @return |
| | | */ |
| | | UserInfo userInfo(String tenantId, String account,String name); |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯ |
| | | * |
| | | * @param tenantId |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<User> selectAllUser(User user, Long deptId){ |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | | List<User> users = baseMapper.selectUserPage(user, deptIdList, (AuthUtil.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : AuthUtil.getTenantId())); |
| | | return users; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<UserVO> selectUserSearch(UserVO user, Query query) { |
| | | LambdaQueryWrapper<User> queryWrapper = Wrappers.<User>query().lambda(); |
| | | String tenantId = AuthUtil.getTenantId(); |
| | |
| | | |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account) { |
| | | User user = baseMapper.getUser(tenantId, account); |
| | | User user = baseMapper.getUser(tenantId, account,null); |
| | | return buildUserInfo(user); |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account,String name) { |
| | | User user = baseMapper.getUser(tenantId, account,name); |
| | | UserInfo userInfo = buildUserInfo(user); |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public UserInfo userInfo(String tenantId, String account, UserEnum userEnum) { |
| | | User user = baseMapper.getUser(tenantId, account); |
| | | User user = baseMapper.getUser(tenantId, account,null); |
| | | return buildUserInfo(user, userEnum); |
| | | } |
| | | |
| | |
| | | LEFT JOIN PL_SYS_USER_PWDSTRATEGY plup on plup.USER_ID=pou.ID |
| | | LEFT JOIN PL_SYS_PWDSTRATEGY pss on pss.ID=plup.PWDSTRATEGY_ID |
| | | WHERE |
| | | tenant_id = #{param1} and account = #{param2} and is_deleted = 0 |
| | | tenant_id = #{param1} and account = #{param2} |
| | | <if test="param3!=null and param3 != ''"> |
| | | and name = #{param3} |
| | | </if> |
| | | and is_deleted = 0 |
| | | </select> |
| | | |
| | | <select id="exportUser" resultType="com.vci.ubcs.system.user.excel.UserExcel"> |