浏览代码

优化审批流,修改异常bug,暂时去掉 用户角色 查询权限标识

阿伏兔 4 年之前
父节点
当前提交
c3bca80f5d

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java

@@ -66,7 +66,7 @@ public class SysRoleController extends BaseController
      * @param role 条件
      * @return 结果
      */
-    @PreAuthorize("@ss.hasPermi('warehouse:paths:add')")
+//    @PreAuthorize("@ss.hasPermi('warehouse:paths:add')")  为了演示 暂时拿掉
     @GetMapping("/auditGetRolelist")
     public List<Map<String, Object>> auditGetRolelist(SysRole role)
     {

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -71,7 +71,7 @@ public class SysUserController extends BaseController {
     /**
      * 获取用户列表
      */
-    @PreAuthorize("@ss.hasPermi('system:user:list')")
+//    @PreAuthorize("@ss.hasPermi('system:user:list')")  为了演示暂时拿掉
     @GetMapping("/list")
     public TableDataInfo list(SysUser user) {
         startPage();

+ 7 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/mapper/AuditItemsMapper.java

@@ -90,4 +90,11 @@ public interface AuditItemsMapper {
      * @return
      */
     public int deletePurchaseApproval(AuditItems auditItems);
+
+    /**
+     *  更新下一级审批状态
+     * @param auditItems
+     * @return
+     */
+    public int updateAuditStatus(AuditItems auditItems);
 }

+ 14 - 25
ruoyi-warehouse/src/main/java/com/ruoyi/approvalFlow/service/impl/AuditPathsServiceImpl.java

@@ -325,12 +325,8 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                             fettle = 5L;
                         }
                         // 仓库模块
-                        AjaxResult ajaxResult = tWarehouseBillsService.warehouseFollow(auditItems.getBillId(), fettle);
-                        String code = ajaxResult.get("code").toString();
-                        if ("500".equals(code)) {
-                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                            return ajaxResult;
-                        }
+                        tWarehouseBillsMapper.warehouseFollowUpdate(auditItems.getBillId(), fettle);
+                        tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(auditItems.getBillId(), fettle);
                     } else if (auditItems.getActId() >= 210 && auditItems.getActId() <= 230) {
                         // 财务模块
                         if ("T".equals(at.getIffinalItem())) {
@@ -367,6 +363,14 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                             return ajaxResult;
                         }
                     }
+                    if ("F".equals(at.getIffinalItem())) {
+                        at.setLevelId(at.getLevelId() + 1);
+                        int updateNum = auditItemsMapper.updateAuditStatus(at);
+                        if (updateNum <= 0) {
+                            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                            return AjaxResult.error("审批通过失败: 更新审批状态失败");
+                        }
+                    }
                     break;
                 }
             }
@@ -388,15 +392,10 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
     @Transactional
     public AjaxResult approvalRejected(AuditItems auditItems) {
         long fettle = 0L;
-        if (auditItems.getActId() >= 110 && auditItems.getActId() <= 140) {
+        if (auditItems.getActId() >= 110 && auditItems.getActId() <= 150) {
             fettle = 3L;
-            // 仓库模块
-            AjaxResult ajaxResult = tWarehouseBillsService.warehouseFollow(auditItems.getBillId(), fettle);
-            String code = ajaxResult.get("code").toString();
-            if ("500".equals(code)) {
-                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                return ajaxResult;
-            }
+            tWarehouseBillsMapper.warehouseFollowUpdate(auditItems.getBillId(), fettle);
+            tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(auditItems.getBillId(), fettle);
         } else if (auditItems.getActId() >= 210 && auditItems.getActId() <= 230) {
             fettle = 3L;
             // 财务模块
@@ -484,18 +483,8 @@ public class AuditPathsServiceImpl implements IAuditPathsService {
                 TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                 return AjaxResult.error("审批撤销失败: 已经过审批");
             }
-            // 仓库模块
-            AjaxResult ajaxResult = tWarehouseBillsService.warehouseFollow(auditItems.getBillId(), fettle);
-            String code = ajaxResult.get("code").toString();
-            if ("500".equals(code)) {
-                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                return AjaxResult.error("审批撤销失败: 更新审批状态失败");
-            }
+            tWarehouseBillsMapper.warehouseFollowUpdate(auditItems.getBillId(), fettle);
             tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(auditItems.getBillId(), fettle);
-            if (auditItems.getActId() <= 120) {
-                fettle = 10L;
-            }
-            tWarehousebillsitemsMapper.warehouseItemFollowUpdate(auditItems.getBillId(), fettle);
         } else if (auditItems.getActId() >= 210 && auditItems.getActId() <= 230) {
             fettle = 2L;
             // 查询财务状态

+ 4 - 0
ruoyi-warehouse/src/main/java/com/ruoyi/basicData/service/impl/TWarehouseServiceImpl.java

@@ -87,12 +87,14 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
      * @return 结果
      */
     @Override
+    @Transactional
     public int insertTWarehouse(TWarehouse tWarehouse) {
         tWarehouse.setCreateTime(DateUtils.getNowDate());
         return tWarehouseMapper.insertTWarehouse(tWarehouse);
     }
 
     @Override
+    @Transactional
     public AjaxResult insertTWarehouse1(String tWarehouse, String tWarehouseArea, LoginUser loginUser) {
         if (StringUtils.isEmpty(tWarehouse)) {
             return AjaxResult.error("提交失败:仓库信息为空");
@@ -142,6 +144,7 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
      * @return 结果
      */
     @Override
+    @Transactional
     public AjaxResult updateTWarehouse(TWarehouse tWarehouse) {
         if(tWarehouse.getfStatus()!=null && tWarehouse.getfStatus().equals("1") ){
             TWarehouseBills   tWarehouseBill =new TWarehouseBills();
@@ -189,6 +192,7 @@ public class TWarehouseServiceImpl implements ITWarehouseService {
      * @return 结果
      */
     @Override
+    @Transactional
     public int deleteTWarehouseById(Long fId) {
         return tWarehouseMapper.deleteTWarehouseById(fId);
     }

+ 2 - 2
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseAgreementServiceImpl.java

@@ -475,8 +475,8 @@ public class TWarehouseAgreementServiceImpl implements ITWarehouseAgreementServi
                 feeId = tWarehouseAgreementitems.getfFeeid();
                 BigDecimal calculate = this.getCalculate(itemNums, tWarehouseAgreementitems.getfPrice(), days);
                 money = money.add(calculate);
-                long day = days - tWarehouseAgreementitems.getfFromdays();
-                information =  day + "天*" + tWarehouseAgreementitems.getfPrice() + "元*" + itemNums + "元 = " + calculate + "元";
+//                long day = days - tWarehouseAgreementitems.getfFromdays();
+                information =  days + "天*" + tWarehouseAgreementitems.getfPrice() + "元*" + itemNums + "元 = " + calculate + "元";
                 if (StringUtils.isEmpty(remark)) {
                     remark = information;
                 } else {

+ 8 - 90
ruoyi-warehouse/src/main/java/com/ruoyi/warehouseBusiness/service/impl/TWarehouseBillsServiceImpl.java

@@ -714,9 +714,13 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
             return AjaxResult.error("仓库更新状态未找到主表信息,请与管理员联系");
         }
         try{
-            int warehouseUpdateResult = tWarehouseBillsMapper.warehouseFollowUpdate(fPid, fettle);
-            int itemUpdateResult = tWarehousebillsitemsMapper.warehouseItemFollowUpdate(fPid, fettle);
-            int feesUpdateResult = tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(fPid, fettle);
+            tWarehouseBillsMapper.warehouseFollowUpdate(fPid, fettle);
+            tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(fPid, fettle);
+            TWarehouseBills tWarehouseBills = tWarehouseBillsMapper.selectTWarehousebillsById(fPid);
+            if ("SJRK".equals(tWarehouseBills.getfBilltype()) || "SJCK".equals(tWarehouseBills.getfBilltype())) {
+                fettle = 40L;
+            }
+            tWarehousebillsitemsMapper.warehouseItemFollowUpdate(fPid, fettle);
         } catch (Exception e){
             return   AjaxResult.error("更新库存费用状态失败,请联系管理员");
         }
@@ -1685,94 +1689,8 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
         tWarehousebills.setUpdateBy(loginUser.getUser().getUserName());
         tWarehousebills.setUpdateTime(new Date());
         tWarehousebills.setfBillstatus(2L); //撤销状态
-        tWarehousebills.setfItemsStatus(1L); //撤销状态
         tWarehouseBillsMapper.updateTWarehousebills(tWarehousebills);
-        // 查询库存明细从表数据
-        TWarehousebillsitems tWarehousebillsitems = new TWarehousebillsitems();
-        tWarehousebillsitems.setfPid(fId);
-        List<TWarehousebillsitems> warehousebillsitems = tWarehousebillsitemsMapper.selectTWarehousebillsitemsList(tWarehousebillsitems);
-        // 撤销 库存总账
-        if (StringUtils.isNotEmpty(warehousebillsitems)) {
-            int i = 1;
-            for (TWarehousebillsitems wb : warehousebillsitems) {
-                // 查询库存总账
-                TWhgenleg tWhgenle = queryTWhgenleg(tWarehousebills, wb);
-                if ("SJRKRevoke".equals(billsType)) { // 撤销 入库
-                    if (StringUtils.isNotNull(tWhgenle) && (wb.getfQty() <= tWhgenle.getfQtyblc())) { // 非空 且 撤销数 <= 结余数
-                        updateTWhgenlegData(wb, tWhgenle.getfId(), billsType);
-                    } else { // 撤销数>结余数
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("第" + i + "行撤销数大于库存结余数");
-                    }
-                    wb.setfBillstatus(10L);
-                } else if ("SJCKRevoke".equals(billsType)) { // 撤销出库
-                    if (StringUtils.isNotNull(tWhgenle)) { // 非空
-                        updateTWhgenlegData(wb, tWhgenle.getfId(), billsType);
-                    } else {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("第" + i + "行未查询到库存信息");
-                    }
-                    wb.setfBillstatus(10L);
-                } else if ("CKDBRevoke".equals(billsType)) { // 调拨 撤销
-                    Long warehouselocid = wb.getfWarehouselocid();// 原货仓库
-                    Long transferWarehouselocid = wb.getfTransferWarehouselocid(); // 新仓库
-                    //  1、新货权方撤销入库
-                    // 查询库存总账
-                    wb.setfWarehouselocid(transferWarehouselocid);
-                    TWhgenleg tWhgenle1 = queryTWhgenleg(tWarehousebills, wb);
-                    if (StringUtils.isNotNull(tWhgenle1) && (wb.getfQty() <= tWhgenle1.getfQtyblc())) {
-                        updateTWhgenlegData(wb, tWhgenle1.getfId(), "SJRKRevoke");
-                    } else {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("第" + i + "行撤销数大于库存结余数") ;
-                    }
-                    //  2、原货权方撤销出库
-                    // 查询库存总账
-                    wb.setfWarehouselocid(warehouselocid);
-                    TWhgenleg tWhgenle2 = queryTWhgenleg(tWarehousebills, wb);
-                    updateTWhgenlegData(wb, tWhgenle2.getfId(), "SJCKRevoke");
-                    wb.setfBillstatus(1L);
-                } else if ("HQZYRevoke".equals(billsType)) { // 货转撤销
-                    Long fCorpid = tWarehousebills.getfCorpid();// 原货权方
-                    Long fTocorpid = tWarehousebills.getfTocorpid(); // 新货权方
-                    //  1、新货权方撤销入库
-                    // 查询库存总账
-                    tWarehousebills.setfCorpid(fTocorpid);
-                    TWhgenleg tWhgenle1 = queryTWhgenleg(tWarehousebills, wb);
-                    if (StringUtils.isNotNull(tWhgenle1) && (wb.getfQty() <= tWhgenle1.getfQtyblc())) {
-                        updateTWhgenlegData(wb, tWhgenle1.getfId(), "SJRKRevoke");
-                    } else {
-                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                        return AjaxResult.error("第" + i + "行撤销数大于库存结余数");
-                    }
-                    //  2、原货权方撤销出库
-                    // 查询库存总账
-                    tWarehousebills.setfCorpid(fCorpid);
-                    TWhgenleg tWhgenle2 = queryTWhgenleg(tWarehousebills, wb);
-                    updateTWhgenlegData(wb, tWhgenle2.getfId(), "SJCKRevoke");
-                    wb.setfBillstatus(1L);
-                }
-                i++;
-                wb.setUpdateBy(loginUser.getUser().getUserName());
-                wb.setUpdateTime(new Date());
-                if (tWarehousebillsitemsMapper.updateTWarehousebillsitems(wb) <= 0) {
-                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                    return AjaxResult.error("新增库存明细失败");
-                }
-            }
-        }
-        TWarehousebillsfees warehousebillsfees = new TWarehousebillsfees();
-        warehousebillsfees.setfPid(fId);
-        List<TWarehousebillsfees> billsFees = tWarehousebillsfeesMapper.selectTWarehousebillsfeesList(warehousebillsfees);
-        // 收款明细添加
-        if (billsFees.size() != 0) {
-            for (TWarehousebillsfees wbDr : billsFees) {
-                wbDr.setfBillstatus(1L);
-                wbDr.setUpdateBy(loginUser.getUser().getUserName());
-                wbDr.setUpdateTime(new Date());
-                tWarehousebillsfeesMapper.insertTWarehousebillsfees(wbDr);
-            }
-        }
+        tWarehousebillsfeesMapper.warehouseFeesFollowUpdate(tWarehousebills.getfId(), 2L);
         return AjaxResult.success();
     }
 

+ 13 - 1
ruoyi-warehouse/src/main/resources/mapper/approvalFlow/AuditItemsMapper.xml

@@ -150,7 +150,7 @@
             item.refno3,
             usr.user_name AS auditUserName,
             usr.nick_name AS nickName,
-            item.audit_item AS auditItem,
+            item.send_time AS auditItem,
             item.audit_msg AS auditMsg,
             item.audit_status AS auditStatus
         FROM
@@ -206,4 +206,16 @@
         AND item.bill_id = #{billId}
     </delete>
 
+    <update id="updateAuditStatus" parameterType="com.ruoyi.approvalFlow.domain.AuditItems">
+        UPDATE audit_items it
+        LEFT JOIN audit_items_users us ON us.pid = it.id
+        SET it.audit_status = 'S', us.audit_status = 'S'
+        WHERE
+        it.level_id = #{levelId}
+        AND it.bill_no = #{billNo}
+        AND it.bill_id = #{billId}
+        AND it.act_id = #{actId}
+        AND it.audit_status = "N"
+    </update>
+
 </mapper>

+ 2 - 0
ruoyi-warehouse/src/main/resources/mapper/warehouseBusiness/TWarehouseAgreementitemsMapper.xml

@@ -131,8 +131,10 @@
             LEFT JOIN t_corps corp ON corp.f_id = agre.f_corpid
             LEFT JOIN t_warehouse_agreementitems itme ON itme.f_pid = agre.f_id
             LEFT JOIN t_fees fee ON fee.f_id = itme.f_feeid
+            Left JOIN t_goods goods ON goods.f_typeid = agre.t_packages
         <where>
             <if test="fLineno != null  and fLineno != ''">and corp.f_id = #{fLineno}</if>
+            <if test="fFeeid != null  and fFeeid != ''">and goods.f_id = #{fFeeid}</if>
             and agre.f_billstatus = 6
             and agre.f_status = 0
             and agre.f_feetypeid = 1