From 227aedd381ad0dad5a9d1d7f59477fb8b3f8f034 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Mon, 15 Jul 2024 19:01:57 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E7=9B=B8=E5=85=B3=E5=AD=97=E6=AE=B5=E5=92=8C=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=20=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=B7=BB=E5=8A=A0=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E5=A4=9A=E4=BD=99=E5=AD=97=E6=AE=B5=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=90=84=E4=B8=AA=E8=A7=92=E8=89=B2=E7=9A=84=E5=AE=A1=E6=89=B9?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-admin/src/main/java/com/ruoyi/main.java | 2 +- .../controller/PurchaseOrderController.java | 6 +- .../service/IPurchaseOrderService.java | 1 - .../impl/PurchaseOrderServiceImpl.java | 71 +++++++++++++++++-- .../mapper/purchase/PurchaseOrderMapper.xml | 3 +- .../purchase/purchaseOrder/purchaseOrder.html | 62 +++++++++++++++- .../purchaseOrder/taskCgjlVerify.html | 2 +- .../purchaseOrder/taskCgzgVerify.html | 2 +- .../purchaseOrder/taskFzjlVerify.html | 2 +- .../purchaseOrder/taskModifyApply.html | 2 +- 10 files changed, 137 insertions(+), 16 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/main.java b/ruoyi-admin/src/main/java/com/ruoyi/main.java index c4303173..6573fde3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/main.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/main.java @@ -1,7 +1,7 @@ package com.ruoyi; import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.manufacture.controller.MaterialRequisitionInfoController; + import java.util.Scanner; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java index 2a094ca6..0d82cc73 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchaseOrderController.java @@ -168,9 +168,11 @@ public class PurchaseOrderController extends BaseController purchaseOrder.setAuditStatus("0"); purchaseOrder.setUseStatus("0"); purchaseOrder.setDelFlag("0"); - purchaseOrderService.insertPurchaseOrder(purchaseOrder); - purchaseOrderService.addPurchaseOrderPayable(purchaseOrder); + purchaseOrderService.submitApply(purchaseOrder); +// purchaseOrderService.insertPurchaseOrder(purchaseOrder); + +// purchaseOrderService.addPurchaseOrderPayable(purchaseOrder); // 数据校验,确保前端传入数据格式正确 // 执行主表插入操作 return AjaxResult.success(); // 假设toAjax方法处理成功逻辑 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java index 27dd340f..a0bb4549 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchaseOrderService.java @@ -76,7 +76,6 @@ public interface IPurchaseOrderService Integer addPurchaseOrderPayable(PurchaseOrder purchaseOrder); - @Transactional(rollbackFor = Exception.class) ProcessInstance submitApply(PurchaseOrder purchaseOrder); @Transactional(rollbackFor = Exception.class) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 0030d17c..ac9a8acc 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -1,11 +1,15 @@ package com.ruoyi.purchase.service.impl; +import com.github.pagehelper.Page; import com.ruoyi.common.core.domain.entity.SysUser; +import com.ruoyi.common.core.page.PageDomain; +import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.service.ICommonService; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.financial.domain.FinancialAccountsPayable; import com.ruoyi.financial.service.IFinancialAccountsPayableService; @@ -32,7 +36,9 @@ import com.ruoyi.warehouse.mapper.WarehouseStorageOrderDetailMapper; import com.ruoyi.warehouse.mapper.WarehouseStorageOrderMapper; import lombok.extern.slf4j.Slf4j; import org.activiti.engine.TaskService; +import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.runtime.ProcessInstance; +import org.activiti.engine.task.Task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -128,7 +134,58 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService @Override public List selectPurchaseOrderList(PurchaseOrder purchaseOrder) { - return purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder); + PageDomain pageDomain = TableSupport.buildPageRequest(); + Integer pageNum = pageDomain.getPageNum(); + Integer pageSize = pageDomain.getPageSize(); + + //PageHelper 仅对第一List分页有效 + Page list = (Page) purchaseOrderMapper.selectPurchaseOrderList(purchaseOrder);; + Page returnList = new Page<>(); + for(PurchaseOrderVo purchaseOrderVo : list){ + SysUser sysUser = userMapper.selectUserByLoginName(purchaseOrderVo.getCreateBy()); + if (sysUser != null) { + purchaseOrderVo.setCreateBy(sysUser.getUserName()); + } + SysUser sysUser2 = userMapper.selectUserByLoginName(purchaseOrderVo.getApplyUser()); + if (sysUser2!=null){ + purchaseOrderVo.setApplyUserName(sysUser2.getUserName()); + } + String instanceId = purchaseOrderVo.getInstanceId(); + // 当前环节 + if (StringUtils.isNotBlank(instanceId)) { + List taskList = taskService.createTaskQuery() + .processInstanceId(instanceId) +// .singleResult(); + .list(); // 例如请假会签,会同时拥有多个任务 + if (!CollectionUtils.isEmpty(taskList)) { + TaskEntityImpl task = (TaskEntityImpl) taskList.get(0); + String taskId = task.getId(); + purchaseOrderVo.setTaskId(taskId); + // 设置待办用户 + List todoUserList = todoItemMapper.selectUndealTodoUserList(taskId); + if(!CollectionUtils.isEmpty(taskList)){ + purchaseOrderVo.setTodoUserId(String.join(",",todoUserList)); + } + if (task.getSuspensionState() == 2) { + purchaseOrderVo.setTaskName("已挂起"); + purchaseOrderVo.setSuspendState("2"); + } else { + purchaseOrderVo.setTaskName(task.getName()); + purchaseOrderVo.setSuspendState("1"); + } + } else { + // 已办结或者已撤销 + purchaseOrderVo.setTaskName("已结束"); + } + } else { + purchaseOrderVo.setTaskName("未启动"); + } + returnList.add(purchaseOrderVo); + } + returnList.setTotal(CollectionUtils.isEmpty(list) ? 0 : list.getTotal()); + returnList.setPageNum(pageNum); + returnList.setPageSize(pageSize); + return returnList; } /** @@ -303,8 +360,6 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService purchaseOrder.setNoRmbSum(materialNoRmbSum); purchaseOrder.setRmbSum(materialRmbSum); purchaseOrder.setDelFlag("0"); - purchaseOrder.setAuditStatus("1"); - purchaseOrder.setUseStatus("1"); purchaseOrder.setEceiptStatus("0"); purchaseOrder.setPaymentStatus("0"); purchaseOrder.setPurchaseBuyer(purchaseOrder.getPurchaseBuyer()); @@ -627,7 +682,15 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService private void buildAuthority(SysUser user, Map variables) { Set roleKeys = roleService.selectRoleKeys(user.getUserId()); // 角色不同审核人不同 - + if(roleKeys.contains("cgyRole")){ + variables.put("authority",1); + }else if(roleKeys.contains("cgjlRole")){ + variables.put("authority",2); + }else if(roleKeys.contains("cgzgRole")){ + variables.put("authority",3); + }else if(roleKeys.contains("fzjlRole")){ + variables.put("authority",4); + } } } diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml index 20c78c11..b623c2f1 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseOrderMapper.xml @@ -71,7 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" close_case_no, close_case_name, close_case_time,confirm_no,confirm_time,confirm_name, del_flag, stock_no, stock_name, stock_address, stock_contact, stock_phone, approve_time, standby_one, standby_two,create_time, create_by, update_time, update_by, - instance_id, instance_type, instance_type_name, submit_instance_id, cancel_instance_id, + instance_id, instance_type, submit_instance_id, cancel_instance_id, restore_instance_id, apply_title, apply_user, apply_time from purchase_order @@ -171,7 +171,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" apply_title, apply_user, apply_time, - audit_user, del_flag, diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html index df77cf87..255f1018 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseOrder/purchaseOrder.html @@ -134,12 +134,15 @@ +