diff --git a/db/jeecgboot-mysql-5.7.sql b/db/jeecgboot-mysql-5.7.sql
index 82eaf1f..1f1755c 100644
--- a/db/jeecgboot-mysql-5.7.sql
+++ b/db/jeecgboot-mysql-5.7.sql
@@ -1,5 +1,5 @@
-CREATE database if NOT EXISTS `jeecg-boot` default character set utf8mb4 collate utf8mb4_general_ci;
-USE `jeecg-boot`;
+CREATE database if NOT EXISTS `guoyan_huozhou` default character set utf8mb4 collate utf8mb4_general_ci;
+USE `guoyan_huozhou`;
/*
Navicat Premium Data Transfer
diff --git a/huzhou/pom.xml b/huzhou/pom.xml
index 2d8d7d0..c3c8cd5 100644
--- a/huzhou/pom.xml
+++ b/huzhou/pom.xml
@@ -17,6 +17,10 @@
org.jeecgframework.boot
jeecg-boot-base-core
+
+ org.jeecgframework.boot
+ jeecg-system-biz
+
org.activiti
activiti-spring-boot-starter
@@ -29,4 +33,16 @@
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ 9
+
+
+
+
\ No newline at end of file
diff --git a/huzhou/src/main/java/org/jeecg/modules/huzhou/common/HuzhouCommonUtils.java b/huzhou/src/main/java/org/jeecg/modules/huzhou/common/HuzhouCommonUtils.java
new file mode 100644
index 0000000..3ab14a3
--- /dev/null
+++ b/huzhou/src/main/java/org/jeecg/modules/huzhou/common/HuzhouCommonUtils.java
@@ -0,0 +1,28 @@
+package org.jeecg.modules.huzhou.common;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+public class HuzhouCommonUtils {
+ public static List extractObjectAttributes(Object user) {
+ List attributes = new ArrayList<>();
+ Class> clazz = user.getClass();
+ Method[] methods = clazz.getDeclaredMethods();
+
+ for (Method method : methods) {
+ try {
+ String name = method.getName();
+ if (name.startsWith("get")) { // 假设所有的getter方法都不带参数,并且返回一个基本数据类型或其包装类
+ Object value = method.invoke(user);
+ if (value != null) { // 过滤掉null值
+ attributes.add(name.substring(3) + "=" + value); // 去掉"get"并添加等号和值
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return attributes;
+ }
+}
diff --git a/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouPlanController.java b/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouPlanController.java
new file mode 100644
index 0000000..3b32ac2
--- /dev/null
+++ b/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouPlanController.java
@@ -0,0 +1,148 @@
+package org.jeecg.modules.huzhou.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang.StringUtils;
+import org.checkerframework.checker.units.qual.A;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.huzhou.entity.*;
+import org.jeecg.modules.huzhou.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@RestController
+@RequestMapping("/huzhouPlan")
+public class HuzhouPlanController {
+ @Autowired
+ private IHuzhouPlaninfoService planinfoService;
+ @Autowired
+ private IHuzhouPlanmoduleService planmoduleService;
+ @Autowired
+ private IHuzhouPlanmoduledetailService planmoduledetailService;
+ @Autowired
+ private IWorkflowService workflowService;
+ @Autowired
+ private IHuzhouProcessinfoService processinfoService;
+ @Autowired
+ private IHuzhouProjectinfoService projectinfoService;
+ @GetMapping("/queryPlanModulePage")
+ public Result> queryPlanModulePage(HuzhouPlanmodule planmodule,@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ String moduleName = planmodule.getModuleName();
+ String projectType = planmodule.getProjectType();
+ queryWrapper.eq(StringUtils.isNotBlank(moduleName), HuzhouPlanmodule::getModuleName,moduleName)
+ .eq(StringUtils.isNotBlank(projectType),HuzhouPlanmodule::getProjectType,projectType);
+ Page planmodulePage = new Page<>(pageNo,pageSize);
+
+ Page page = planmoduleService.page(planmodulePage, queryWrapper);
+ return Result.OK(page);
+ }
+
+ @GetMapping("/queryPlanModuleone")
+ public Result queryPlanModuleByid(HuzhouPlanmodule planmodule){
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ int planmoduleId = planmodule.getId();
+ String projectType = planmodule.getProjectType();
+ queryWrapper.eq(planmoduleId!=0,HuzhouPlanmodule::getId,planmoduleId)
+ .eq(StringUtils.isNotBlank(projectType),HuzhouPlanmodule::getProjectType,projectType);
+ HuzhouPlanmodule one = planmoduleService.getOne(queryWrapper);
+ return Result.OK(one);
+ }
+ @PostMapping("/savePlanModule")
+ public Result> savePlanModule(@RequestBody HuzhouPlanmodule planmodule){
+ String projectType = planmodule.getProjectType();
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(HuzhouPlanmodule::getProjectType,projectType);
+ int size = planmoduleService.list(queryWrapper).size();
+ if(size>0){
+ return Result.error("此项目类型已存在模板,无法新增");
+ }
+ planmoduleService.save(planmodule);
+ return Result.ok("新增项目模板成功");
+ }
+ @PostMapping("/modifyPlanModule")
+ public Result> modifyPlanModule(@RequestBody HuzhouPlanmodule planmodule){
+ String projectType = planmodule.getProjectType();
+ int planmoduleId = planmodule.getId();
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(HuzhouPlanmodule::getProjectType,projectType);
+ queryWrapper.ne(HuzhouPlanmodule::getId,planmoduleId);
+ int size = planmoduleService.list(queryWrapper).size();
+ if(size>0){
+ return Result.error("此项目类型已存在模板");
+ }
+ planmoduleService.updateById(planmodule);
+ return Result.ok("修改项目模板成功");
+ }
+ @DeleteMapping("/deletePlanModule")
+ public Result> deletePlanModule(@RequestParam("id") Integer id){
+ planmoduleService.removeById(id);
+ return Result.ok("删除项目模板成功");
+ }
+ @GetMapping("/queryPlanModuleDetailPage")
+ public Result> queryPlanModuleDetailPage(HuzhouPlanmoduledetail planmoduledetail){
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ String moduleId = planmoduledetail.getModuleId();
+ queryWrapper.eq(StringUtils.isNotBlank(moduleId), HuzhouPlanmoduledetail::getModuleId,moduleId);
+ List list = planmoduledetailService.list(queryWrapper);
+ return Result.OK(list);
+ }
+ @PostMapping("/savePlanModuleDatail")
+ public Result> savePlanModuleDatail(@RequestBody() List planmoduledetails){
+ //先删除后增加
+ String moduleId = planmoduledetails.get(0).getModuleId();
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(HuzhouPlanmoduledetail::getModuleId,moduleId);
+ boolean remove = planmoduledetailService.remove(queryWrapper);
+ for (HuzhouPlanmoduledetail p:planmoduledetails
+ ) {
+ planmoduledetailService.save(p);
+ }
+ return Result.ok("新增项目模板成功");
+ }
+ @PostMapping("/saveProjectPlan")
+ public Result> saveProjectPlan(@RequestBody List planinfos){
+ if(planinfos.size()==0){
+ return Result.error("数量为0");
+ }
+ ArrayList arrayList = new ArrayList<>();
+ //设置下一个节点处理人
+ //使用角色查询
+ arrayList.add("1752895307869614081");
+ arrayList.add("1752895591849160705");
+ WorkFlow workFlow = workflowService.createFlow("项目计划审批流程", arrayList);
+ String processInstanceId = workFlow.getProcessInstanceId();
+ String businessKey = workFlow.getBusinessKey();
+ planinfos.forEach(item->{
+ planinfoService.save(item);
+ });
+ String projectId = planinfos.get(0).getProjectId();
+ //保存项目信息
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"5");//3表示项目资料流程审批阶段
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectId);
+ projectinfoService.update(null,updateWrapper);
+ HuzhouProcessinfo huzhouProcessinfo = new HuzhouProcessinfo();
+ huzhouProcessinfo.setBusinesskey(businessKey);
+ huzhouProcessinfo.setStatus("3");//该项目的第一个流程
+ huzhouProcessinfo.setProcessinstanceid(processInstanceId);
+ huzhouProcessinfo.setProjectid(projectId);
+ processinfoService.save(huzhouProcessinfo);
+ return Result.OK("保存成功");
+ }
+ @GetMapping("/queryProjectPlan")
+ public Result< List> queryProjectPlan(HuzhouPlaninfo planinfo){
+ String projectId = planinfo.getProjectId();
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(StringUtils.isNotBlank(projectId),HuzhouPlaninfo::getProjectId,projectId);
+ queryWrapper.orderByAsc(HuzhouPlaninfo::getOrderNumber);
+ List list = planinfoService.list(queryWrapper);
+ return Result.OK(list);
+ }
+}
diff --git a/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouProjectController.java b/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouProjectController.java
new file mode 100644
index 0000000..518cf0e
--- /dev/null
+++ b/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouProjectController.java
@@ -0,0 +1,396 @@
+package org.jeecg.modules.huzhou.controller;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.activiti.bpmn.model.BpmnModel;
+import org.activiti.bpmn.model.FlowElement;
+import org.activiti.bpmn.model.SequenceFlow;
+import org.activiti.bpmn.model.UserTask;
+import org.activiti.engine.*;
+
+import org.activiti.engine.impl.identity.Authentication;
+
+import org.activiti.engine.runtime.ProcessInstance;
+import org.activiti.engine.task.Task;
+import org.apache.commons.beanutils.BeanMap;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.checkerframework.checker.units.qual.A;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.constant.SymbolConstant;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.CommonUtils;
+import org.jeecg.modules.huzhou.common.HuzhouCommonUtils;
+import org.jeecg.modules.huzhou.entity.*;
+import org.jeecg.modules.huzhou.service.*;
+import org.jeecg.modules.huzhou.vo.ProjectApproveOV;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.security.core.parameters.P;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.FileCopyUtils;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/huzhouProject")
+public class HuzhouProjectController {
+ @Autowired
+ private RuntimeService runtimeService;
+ @Autowired
+ private TaskService taskService;
+ @Autowired
+ private RepositoryService repositoryService;
+ @Autowired
+ private HistoryService historyService;
+
+ @Autowired
+ private IWorkflowService workflowService;
+ @Autowired
+ private IHuzhouProcessinfoService processinfoService;
+ @Autowired
+ private IHuzhouProjectinfoService projectinfoService;
+ @Autowired
+ private IHuzhouUserprojectService userprojectService;
+ @Autowired
+ private IHuzhouUploadfileinfoService uploadfileinfoService;
+ @Value(value = "${jeecg.path.upload}")
+ private String uploadpath;
+ @Autowired
+ private ISysUserService userService;
+ /**
+ * 本地:local minio:minio 阿里:alioss
+ */
+ @Value(value="${jeecg.uploadType}")
+ private String uploadType;
+ @PostMapping("/submitProject")
+ public Result submitProject(@RequestBody HuzhouProjectinfo info){
+ ArrayList arrayList = new ArrayList<>();
+ //设置下一个节点处理人
+ //使用角色查询
+ arrayList.add("1752895307869614081");
+ arrayList.add("1752895591849160705");
+ WorkFlow workFlow = workflowService.createFlow("initiatesProjects", arrayList);
+ String processInstanceId = workFlow.getProcessInstanceId();
+ String businessKey = workFlow.getBusinessKey();
+ //保存项目信息
+ info.setStatus("1");//最开始的状态
+ projectinfoService.save(info);
+ //保存项目流程相关的信息
+ //设置businessKey
+ //设置项目状态
+ //新增项目人员关系表
+ List extractObjectAttributes = HuzhouCommonUtils.extractObjectAttributes(info);
+ for (String s:extractObjectAttributes) {
+ if(s.contains("Contactor")){
+ String s1 = s.split("=")[1];
+ HuzhouUserproject huzhouUserproject = new HuzhouUserproject();
+ huzhouUserproject.setProjectId(info.getId());
+ huzhouUserproject.setUserId(s1);
+ userprojectService.save(huzhouUserproject);
+ }
+ }
+ HuzhouProcessinfo huzhouProcessinfo = new HuzhouProcessinfo();
+ huzhouProcessinfo.setBusinesskey(businessKey);
+ huzhouProcessinfo.setStatus("1");//该项目的第一个流程
+ huzhouProcessinfo.setProcessinstanceid(processInstanceId);
+ huzhouProcessinfo.setProjectid(info.getId());
+ processinfoService.save(huzhouProcessinfo);
+ return Result.ok("项目入库申请已发起成功");
+ }
+ @PostMapping("/approveProjectInfo")
+ public Result> approveProjectInfo(@RequestBody HashMap param){
+ LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ String userId = currentUser.getId();
+ String taskId = (String) param.get("taskId");
+ String flag = (String) param.get("flag");
+ String comment = (String) param.get("comment");
+ String projectid = (String) param.get("projectid");
+ String status = (String) param.get("status");
+ String isEdit = (String) param.get("isEdit");
+ Map projectInfoMap = (Map) param.get("projectInfo");
+ String jsonString = JSON.toJSONString(projectInfoMap);
+ HuzhouProjectinfo projectinfo = JSON.parseObject(jsonString, HuzhouProjectinfo.class);
+ if("3".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"0");//表示作废
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ return Result.OK("流程作废成功");
+ }
+ if("1".equals(isEdit)&&"1".equals(flag)&&"1".equals(status)){
+ if(null!=projectinfo){
+ projectinfoService.updateById(projectinfo);
+ //删除此项目原来的人员和项目对应信息
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(HuzhouUserproject::getProjectId,projectid);
+ boolean remove = userprojectService.remove(queryWrapper);
+ //保存新的人员和项目对应信息
+ List extractObjectAttributes = HuzhouCommonUtils.extractObjectAttributes(projectinfo);
+ for (String s:extractObjectAttributes) {
+ if(s.contains("Contactor")){
+ String s1 = s.split("=")[1];
+ HuzhouUserproject huzhouUserproject = new HuzhouUserproject();
+ huzhouUserproject.setProjectId(projectinfo.getId());
+ huzhouUserproject.setUserId(s1);
+ userprojectService.save(huzhouUserproject);
+ }
+ }
+ }
+ }
+ WorkFlow workFlow = workflowService.approveProjectInfo(taskId, flag, comment, status);
+ String userTaskName = workFlow.getUserTask();
+
+ //管理单位审批通过,最后一个节点流程通过
+ if("管理单位审批".equals(userTaskName)&&"1".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"2");
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ }
+ if("流程审批二".equals(userTaskName)&&"1".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"4");
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ }
+ if("计划审批二".equals(userTaskName)&&"1".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"6");
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ }
+ return Result.ok("审批成功");
+ }
+ @PostMapping("/approveUploadFile")
+ public Result> approveUploadFile(@RequestParam(value = "file",required = false) MultipartFile[] file,
+ @RequestParam String taskId,
+ @RequestParam String flag,
+ @RequestParam String projectid,
+ @RequestParam String comment,
+ @RequestParam String status) throws IOException {
+ LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ String userId = currentUser.getId();
+
+
+ WorkFlow workFlow = workflowService.approveProjectInfo(taskId, flag, comment, status);
+ String userTaskName = workFlow.getUserTask();
+ if("发起人".equals(workFlow.getUserTask())&&null != file){
+ uploadfileinfoService.modifyUploadFile(file,projectid,status);
+ }
+ //管理单位审批通过,最后一个节点流程通过
+ if("管理单位审批".equals(userTaskName)&&"1".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"2");
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ }
+ if("流程审批二".equals(userTaskName)&&"1".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"4");
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ }
+ if("计划审批二".equals(userTaskName)&&"1".equals(flag)){
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"6");
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(updateWrapper);
+ }
+ return Result.ok("审批成功");
+ }
+ @PostMapping("/deleteProcesss")
+ public Result> deleteProcesss(String processInstanceId){
+ runtimeService.deleteProcessInstance(processInstanceId,"发起人删除");
+ return Result.OK("流程删除成功");
+ }
+ @GetMapping("/projectInfoPageList")
+ public Result> queryPageList(@RequestParam Map params,
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
+ IPage page = new Page(pageNo, pageSize);
+ LambdaQueryWrapper huzhouProjectinfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ String projectName = (String) params.get("projectName");
+ String projectId = (String) params.get("projectId");
+ huzhouProjectinfoLambdaQueryWrapper.like(StringUtils.isNotBlank(projectName),HuzhouProjectinfo::getProjectName,projectName);
+ huzhouProjectinfoLambdaQueryWrapper.like(StringUtils.isNotBlank(projectId),HuzhouProjectinfo::getId,projectId);
+ IPage pageList = projectinfoService.page(page, huzhouProjectinfoLambdaQueryWrapper);
+ return Result.OK(pageList);
+
+ }
+ @GetMapping("/queryProjectInfoById")
+ public Result queryProjectInfoById(String projectid){
+ //获取项目入库数据
+ HuzhouProjectinfo projectinfo = projectinfoService.getById(projectid);
+// List attributes = new ArrayList<>();
+//
+// List extractObjectAttributes = HuzhouCommonUtils.extractObjectAttributes(projectinfo);
+// for (String s:extractObjectAttributes) {
+// if(s.contains("Contactor")){
+// String s1 = s.split("=")[1];
+// SysUser user = userService.getById(s1);
+// String realname = user.getRealname();
+// Class> clazz = projectinfo.getClass();
+// Method[] methods = clazz.getDeclaredMethods();
+//
+// for (Method method : methods) {
+// try {
+// String name = method.getName();
+// if (name.contains(s.split("=")[0])) { // 假设所有的getter方法都不带参数,并且返回一个基本数据类型或其包装类
+// method.invoke(projectinfo,realname);
+// }
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// }
+// }
+// }
+// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+// queryWrapper.eq(HuzhouProcessinfo::getProjectid,projectid);
+// HuzhouProcessinfo processinfo = processinfoService.getOne(queryWrapper);
+ //获取项目入库流程数据
+
+ return Result.OK(projectinfo);
+
+ }
+ @GetMapping("/queryprocessinfoById")
+ public Result queryprocessinfoById(String projectid){
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(HuzhouProcessinfo::getProjectid,projectid);
+ queryWrapper.orderByDesc(HuzhouProcessinfo::getStatus);
+ HuzhouProcessinfo processinfo = processinfoService.list(queryWrapper).get(0);
+
+ return Result.OK(processinfo);
+
+ }
+ @PostMapping("/uploadFile")
+ @Transactional()
+ public Result> uploadFile(@RequestParam(value = "file")
+ MultipartFile[] files,@RequestParam(value = "projectid") String projectid,
+ @RequestParam(value = "status") String status) throws IOException {
+ //获取当前时间
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
+ String currentDay = dateFormat.format(new Date());
+ File filePath = new File(uploadpath + File.separator + currentDay + File.separator);
+ //文件夹不存在则创建
+ if (!filePath.exists()) {
+ // 创建文件根目录
+ filePath.mkdirs();
+ }else {
+// return modifyUploadFile(files,projectid,status);
+ }
+ for (MultipartFile item:files) {
+ String fileName =null;
+ String originalFilename = item.getOriginalFilename();
+ originalFilename = CommonUtils.getFileName(originalFilename);
+ if(originalFilename.indexOf(SymbolConstant.SPOT)!=-1){
+ fileName = originalFilename.substring(0, originalFilename.lastIndexOf(".")) + "_" + System.currentTimeMillis() + originalFilename.substring(originalFilename.lastIndexOf("."));
+ }else{
+ fileName = originalFilename+ "_" + System.currentTimeMillis();
+ }
+ String savePath = filePath.getPath() + File.separator + fileName;
+ File savefile = new File(savePath);
+ FileCopyUtils.copy(item.getBytes(), savefile);//保存文件
+ HuzhouUploadfileinfo huzhouUploadfileinfo = new HuzhouUploadfileinfo();
+ huzhouUploadfileinfo.setDocumentName(originalFilename);//未加工过的文件名称
+ huzhouUploadfileinfo.setDocumentType(item.getContentType());
+ huzhouUploadfileinfo.setDocumentPath(savePath);
+ huzhouUploadfileinfo.setStatus(status);
+ huzhouUploadfileinfo.setSize(item.getSize());
+ huzhouUploadfileinfo.setProjectid(projectid);
+ boolean save = uploadfileinfoService.save(huzhouUploadfileinfo);
+ }
+ ArrayList arrayList = new ArrayList<>();
+ //设置下一个节点处理人
+ //使用角色查询
+ arrayList.add("1752895307869614081");
+ arrayList.add("1752895591849160705");
+ WorkFlow workFlow = workflowService.createFlow("项目资料上传流程", arrayList);
+ String businessKey = workFlow.getBusinessKey();
+ String processInstanceId = workFlow.getProcessInstanceId();
+ //保存项目信息
+ LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.set(HuzhouProjectinfo::getStatus,"3");//3表示项目资料流程审批阶段
+ updateWrapper.eq(HuzhouProjectinfo::getId,projectid);
+ projectinfoService.update(null,updateWrapper);
+
+ //保存项目流程相关的信息
+ //设置businessKey
+ //设置项目状态
+ HuzhouProcessinfo huzhouProcessinfo = new HuzhouProcessinfo();
+ huzhouProcessinfo.setBusinesskey(businessKey);
+ huzhouProcessinfo.setStatus("2");//该项目的第一个流程
+ huzhouProcessinfo.setProcessinstanceid(processInstanceId);
+ huzhouProcessinfo.setProjectid(projectid);
+ processinfoService.save(huzhouProcessinfo);
+ return Result.OK("上传成功!!");
+ }
+ @GetMapping("/downloadfile")
+ public void downloadfile(HttpServletResponse response,String path,String fileName) throws IOException {
+ FileInputStream fileInputStream = new FileInputStream(path);
+ response.setContentType("application/octet-stream");
+// response.setHeader("Content-disposition", "attachment;filename=" + fileName);
+ BufferedInputStream inputStream =null;
+ try {
+ ServletOutputStream outputStream = response.getOutputStream();
+ inputStream = new BufferedInputStream(fileInputStream);
+ byte[] bytes = new byte[1024];
+ int len =inputStream.read(bytes);
+ while (len!=-1){
+ outputStream.write(bytes,0,bytes.length);
+ outputStream.flush();
+ len=inputStream.read(bytes);
+ }
+ }finally {
+ if(inputStream!=null){
+ inputStream.close();
+ }
+ }
+ }
+
+ @GetMapping("/queryResourceInfo")
+ public Result> queryResourceInfo(@RequestParam Map params,
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
+ String projectid = (String) params.get("projectid");
+ String status = (String) params.get("status");
+ IPage huzhouUploadfileinfoIPage = new Page<>(pageNo,pageSize);
+ LambdaUpdateWrapper huzhouUploadfileinfoLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
+ huzhouUploadfileinfoLambdaUpdateWrapper.eq(HuzhouUploadfileinfo::getProjectid,projectid);
+ huzhouUploadfileinfoLambdaUpdateWrapper.eq(HuzhouUploadfileinfo::getStatus,status);
+ IPage uploadfileinfoIPage = uploadfileinfoService.page(huzhouUploadfileinfoIPage, huzhouUploadfileinfoLambdaUpdateWrapper);
+ return Result.OK(uploadfileinfoIPage);
+ }
+
+ @GetMapping("/queryProjectApprovedPage")
+ public Result> queryProjectApprovedPage(HuzhouProjectinfo projectinfo,
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
+ Page projectinfoPage = new Page<>(pageNo, pageSize);
+ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>();
+ String projectName = projectinfo.getProjectName();
+ String projectinfoId = projectinfo.getId();
+ queryWrapper.like(StringUtils.isNotBlank(projectName),HuzhouProjectinfo::getProjectName,projectName);
+ queryWrapper.like(StringUtils.isNotBlank(projectinfoId),HuzhouProjectinfo::getId,projectinfoId);
+ queryWrapper.ge(HuzhouProjectinfo::getStatus,"4");
+ Page page = projectinfoService.page(projectinfoPage, queryWrapper);
+ return Result.OK(page);
+ }
+
+
+}
diff --git a/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouUserController.java b/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouUserController.java
new file mode 100644
index 0000000..d6f9cad
--- /dev/null
+++ b/huzhou/src/main/java/org/jeecg/modules/huzhou/controller/HuzhouUserController.java
@@ -0,0 +1,118 @@
+package org.jeecg.modules.huzhou.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.huzhou.entity.BaseEntity;
+import org.jeecg.modules.huzhou.entity.HuzhouProjectinfo;
+import org.jeecg.modules.huzhou.service.IHuzhouProjectinfoService;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/huzhouUser")
+public class HuzhouUserController {
+ @Autowired
+ private ISysUserService userService;
+ @Autowired
+ private IHuzhouProjectinfoService projectinfoService;
+ @GetMapping("/getMyAddressBook")
+ public Result> getMyAddressBook(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
+ //先查询当前参与的项目
+ //获取当前登录人
+ LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ String userId = loginUser.getId();
+ //查询参与的项目
+ LambdaQueryWrapper projectinfoQueryWrapper = new LambdaQueryWrapper<>();
+ projectinfoQueryWrapper.eq(HuzhouProjectinfo::getManageContactor,userId)
+ .or()
+ .eq(HuzhouProjectinfo::getControlerContactor,userId)
+ .or()
+ .eq(HuzhouProjectinfo::getOwnerContactor,userId)
+ .or()
+ .eq(HuzhouProjectinfo::getContructorContactor,userId)
+ .or()
+ .eq(HuzhouProjectinfo::getSupervisorContactor,userId)
+ .or()
+ .eq(HuzhouProjectinfo::getConsultContactor,userId)
+ .or()
+ .eq(BaseEntity::getCreator,userId);
+ //projectinfoQueryWrapper.eq(BaseEntity::getCreator,userId);
+ List projectinfoList = projectinfoService.list(projectinfoQueryWrapper);
+ List manageContactors = projectinfoList.stream()
+ .map(HuzhouProjectinfo::getManageContactor)
+ .collect(Collectors.toList());
+ List controlerContactors = projectinfoList.stream()
+ .map(HuzhouProjectinfo::getControlerContactor)
+ .collect(Collectors.toList());
+ List ownerContactors = projectinfoList.stream()
+ .map(HuzhouProjectinfo::getOwnerContactor)
+ .collect(Collectors.toList());
+ List contructorContactor = projectinfoList.stream()
+ .map(HuzhouProjectinfo::getContructorContactor)
+ .collect(Collectors.toList());
+ List supervisorContactor = projectinfoList.stream().map(HuzhouProjectinfo::getSupervisorContactor).collect(Collectors.toList());
+ List consultContactor = projectinfoList.stream().map(HuzhouProjectinfo::getConsultContactor).collect(Collectors.toList());
+ HashSet hashSet = new HashSet<>();
+ hashSet.addAll(manageContactors);
+ hashSet.addAll(controlerContactors);
+ hashSet.addAll(ownerContactors);
+ hashSet.addAll(contructorContactor);
+ hashSet.addAll(supervisorContactor);
+ hashSet.addAll(consultContactor);
+ Page sysUserPage = new Page<>(pageNo,pageSize);
+ LambdaQueryWrapper sysUserQueryWrapper = new LambdaQueryWrapper<>();
+ sysUserQueryWrapper.in(hashSet.size()>0,SysUser::getId,hashSet)
+ .or().eq(SysUser::getId,userId);
+ Page userPage = userService.page(sysUserPage, sysUserQueryWrapper);
+ return Result.OK(userPage);
+ }
+ @GetMapping("/getWorkPlaceTypeDict")
+ public Result> getWorkPlaceDict(String workPlaceType){
+ LambdaQueryWrapper sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
+ sysUserLambdaQueryWrapper.eq(SysUser::getWorkplaceType,workPlaceType)
+ .select(SysUser::getWorkplaceType,SysUser::getWorkplace);
+ List