diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfFileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfFileController.java new file mode 100644 index 0000000..8569901 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfFileController.java @@ -0,0 +1,60 @@ +package com.ruoyi.web.controller.workflow; + +import cn.hutool.core.util.ObjectUtil; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.system.domain.vo.SysOssVo; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +/** + * @author LJF + * @version 1.0 + * @project ruoyi-flowable-plus + * @description 流程文件Controller + * @date 2024-04-26 15:25:13 + */ +@Slf4j +@RequiredArgsConstructor +@RestController +@RequestMapping("/workflow/file") +public class WfFileController extends BaseController { + + @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public R> upload(@RequestPart("file") MultipartFile file) throws IOException { + //http://localhost:81/dev-api/workflow/file/upload + if (ObjectUtil.isNull(file)) { + return R.fail("上传文件不能为空"); + } + //获取原始文件名 + String originalFilename = file.getOriginalFilename(); + //获取文件扩展名 123.2.1.jpg + int index = originalFilename.lastIndexOf("."); //最后一个.的下标 + String extname = originalFilename.substring(index); + //构造唯一的文件名(不能重复) -- uuid(通用唯一识别码)040bf482-284b-40a6-bf61-15c811d1b0d0 + String newFilename = UUID.randomUUID().toString() + extname; + log.info("新的文件名:{}", newFilename); + + //将文件存储在服务器的磁盘目录中 D:\demo\files + file.transferTo(new File("D:\\mh_code\\flowable\\image\\" + + newFilename)); + Map map = new HashMap<>(2); + map.put("url", "https://bx.mhito.net/images/"+newFilename); + map.put("fileName", originalFilename); + map.put("ossId", String.valueOf(UUID.randomUUID())); + return R.ok(map); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfProcessController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfProcessController.java index 7f7b9e4..e9703a3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfProcessController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/workflow/WfProcessController.java @@ -199,8 +199,23 @@ public class WfProcessController extends BaseController { * @param variables 变量集合,json对象 */ @SaCheckPermission("workflow:process:start") - @PostMapping("/start/{processDefId}/{cellphone}") + @PostMapping("/start/{processDefId}") public R start(@PathVariable(value = "processDefId") String processDefId, + @RequestBody Map variables) { + processService.startProcessByDefId(processDefId, null, variables); + return R.ok("流程启动成功"); + + } + + /** + * 根据流程定义id启动流程实例 + * + * @param processDefId 流程定义id + * @param variables 变量集合,json对象 + */ + @SaCheckPermission("workflow:process:start") + @PostMapping("/start/{processDefId}/{cellphone}") + public R startCellphone(@PathVariable(value = "processDefId") String processDefId, @PathVariable(value = "cellphone") String cellphone, @RequestBody Map variables) { processService.startProcessByDefId(processDefId, cellphone, variables); @@ -208,6 +223,7 @@ public class WfProcessController extends BaseController { } + /** * 删除流程实例 * diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index 35cb7aa..9e87b2e 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/ruoyi-admin/src/main/resources/application-prod.yml @@ -172,3 +172,8 @@ sms: signName: 测试 # 腾讯专用 sdkAppId: +server: + ssl: + key-store: classpath:bxserver.mhito.net.jks + key-password: 177d9hyfm595i2 + key-store-type: JKS diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 9c44631..ea9678d 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -45,10 +45,6 @@ server: io: 8 # 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载 worker: 256 - ssl: - key-store: classpath:bxserver.mhito.net.jks - key-password: 177d9hyfm595i2 - key-store-type: JKS # 日志配置 logging: @@ -74,7 +70,7 @@ spring: # 国际化资源文件路径 basename: i18n/messages profiles: - active: prod + active: dev # 文件上传 servlet: multipart: diff --git a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfProcessServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfProcessServiceImpl.java index 81cfe84..4aa4f16 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfProcessServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/workflow/service/impl/WfProcessServiceImpl.java @@ -713,13 +713,15 @@ public class WfProcessServiceImpl extends FlowServiceFactory implements IWfProce ProcessInstance processInstance = runtimeService.startProcessInstanceById(procDef.getId(), variables); // 第一个用户任务为发起人,则自动完成任务 wfTaskService.startFirstTask(processInstance, variables); - // 流程编号跟手机绑定 - String deploymentId = procDef.getDeploymentId(); - UserDeployRelationBo userDeployRelationBo = new UserDeployRelationBo(); - userDeployRelationBo.setDeployId(deploymentId); - userDeployRelationBo.setProcInsId(processInstance.getProcessInstanceId()); - userDeployRelationBo.setCellphone(cellphone); - userDeployRelationService.insertByBo(userDeployRelationBo); + if (StringUtils.isNotBlank(cellphone)) { + // 流程编号跟手机绑定 + String deploymentId = procDef.getDeploymentId(); + UserDeployRelationBo userDeployRelationBo = new UserDeployRelationBo(); + userDeployRelationBo.setDeployId(deploymentId); + userDeployRelationBo.setProcInsId(processInstance.getProcessInstanceId()); + userDeployRelationBo.setCellphone(cellphone); + userDeployRelationService.insertByBo(userDeployRelationBo); + } } diff --git a/ruoyi-ui/.env.development b/ruoyi-ui/.env.development index 3547885..07da1aa 100644 --- a/ruoyi-ui/.env.development +++ b/ruoyi-ui/.env.development @@ -1,5 +1,5 @@ # 页面标题 -VUE_APP_TITLE = 广州城市学院报修管理系统 +VUE_APP_TITLE = 广州市城市建设职业学校 # 开发环境配置 ENV = 'development' diff --git a/ruoyi-ui/.env.production b/ruoyi-ui/.env.production index 967488f..54e4348 100644 --- a/ruoyi-ui/.env.production +++ b/ruoyi-ui/.env.production @@ -1,5 +1,5 @@ # 页面标题 -VUE_APP_TITLE = 广州城市学院报修管理系统 +VUE_APP_TITLE = 广州市城市建设职业学校 # 生产环境配置 ENV = 'production' diff --git a/ruoyi-ui/package.json b/ruoyi-ui/package.json index baf8e6a..a47faa3 100644 --- a/ruoyi-ui/package.json +++ b/ruoyi-ui/package.json @@ -1,7 +1,7 @@ { "name": "flowable-plus", "version": "0.8.3", - "description": "广州城市学院报修管理系统", + "description": "广州市城市建设职业学校", "author": "mh", "license": "MIT", "scripts": { diff --git a/ruoyi-ui/src/api/workflow/process.js b/ruoyi-ui/src/api/workflow/process.js index 9576bea..5542bf7 100644 --- a/ruoyi-ui/src/api/workflow/process.js +++ b/ruoyi-ui/src/api/workflow/process.js @@ -19,7 +19,7 @@ export function getProcessForm(query) { } // 部署流程实例 -export function startProcess(processDefId, cellphone, data) { +export function startProcessCellphone(processDefId, cellphone, data) { return request({ url: '/workflow/process/start/' + processDefId + '/' + cellphone, method: 'post', @@ -27,6 +27,15 @@ export function startProcess(processDefId, cellphone, data) { }) } +// 部署流程实例 +export function startProcess(processDefId, data) { + return request({ + url: '/workflow/process/start/' + processDefId, + method: 'post', + data: data + }) +} + // 删除流程实例 export function delProcess(ids) { return request({ diff --git a/ruoyi-ui/src/assets/images/bg.png b/ruoyi-ui/src/assets/images/bg.png new file mode 100644 index 0000000..6104e14 Binary files /dev/null and b/ruoyi-ui/src/assets/images/bg.png differ diff --git a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue index 3aa60fa..89fa85f 100644 --- a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue +++ b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue @@ -40,7 +40,7 @@ export default { }, data() { return { - title: '广州城市学院报修管理系统', + title: '广州市城市建设职业学校', logo: logoImg } } diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 77cca42..fa56376 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -5,6 +5,7 @@ Vue.use(Router) /* Layout */ import Layout from '@/layout' +import { getToken } from '@/utils/auth' /** * Note: 路由配置项 @@ -250,3 +251,22 @@ export default new Router({ scrollBehavior: () => ({ y: 0 }), routes: constantRoutes }) + + +//使用钩子函数对路由进行权限跳转 +// Router.beforeEach((to, from, next) => { +// let accessToken = getToken(); +// if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限 +// if (!accessToken) { // 判断当前的token是否存在 +// next({ +// name: 'login', +// query: { redirect: to.fullPath } //将跳转的路由path作为参数,登录成功后跳转到该路由 +// }) +// } else { +// next() +// } +// } else { +// next() +// } +// } +// ) \ No newline at end of file diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index f63e9de..ac717f0 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -63,46 +63,46 @@ service.interceptors.request.use(config => { } return config }, error => { - console.log(error) - Promise.reject(error) + console.log(error) + Promise.reject(error) }) // 响应拦截器 service.interceptors.response.use(res => { - // 未设置状态码则默认成功状态 - const code = res.data.code || 200; - // 获取错误信息 - const msg = errorCode[code] || res.data.msg || errorCode['default'] - // 二进制数据则直接返回 - if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { - return res.data - } - if (code === 401) { - if (!isRelogin.show) { - isRelogin.show = true; - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { - isRelogin.show = false; - store.dispatch('LogOut').then(() => { - location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; - }) + // 未设置状态码则默认成功状态 + const code = res.data.code || 200; + // 获取错误信息 + const msg = errorCode[code] || res.data.msg || errorCode['default'] + // 二进制数据则直接返回 + if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { + return res.data + } + if (code === 401) { + if (!isRelogin.show) { + isRelogin.show = true; + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { + isRelogin.show = false; + store.dispatch('LogOut').then(() => { + location.href = process.env.VUE_APP_CONTEXT_PATH + "index"; + }) }).catch(() => { isRelogin.show = false; }); } - return Promise.reject('无效的会话,或者会话已过期,请重新登录。') - } else if (code === 500) { - Message({ message: msg, type: 'error' }) - return Promise.reject(new Error(msg)) - } else if (code === 601) { - Message({ message: msg, type: 'warning' }) - return Promise.reject('error') - } else if (code !== 200) { - Notification.error({ title: msg }) - return Promise.reject('error') - } else { - return res.data - } - }, + return Promise.reject('无效的会话,或者会话已过期,请重新登录。') + } else if (code === 500) { + Message({ message: msg, type: 'error' }) + return Promise.reject(new Error(msg)) + } else if (code === 601) { + Message({ message: msg, type: 'warning' }) + return Promise.reject('error') + } else if (code !== 200) { + Notification.error({ title: msg }) + return Promise.reject('error') + } else { + return res.data + } +}, error => { console.log('err' + error) let { message } = error; diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index b699eb4..7b00e86 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -1,7 +1,7 @@