From 95c8d8cc92be4287787f9cef4bbaccc66fed4979 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期二, 22 八月 2023 20:03:51 +0800
Subject: [PATCH] #报销审核完善

---
 src/main/webapp/views/reimburseOnline/reimburseOnline.html                 |    2 
 src/main/resources/mapper/ReimburseOnlineMapper.xml                        |    3 -
 src/main/java/com/zy/crm/manager/entity/ReimburseOnline.java               |   15 +++++++
 src/main/webapp/static/js/reimburseOnline/reimburseOnline.js               |   16 +++++++-
 src/main/java/com/zy/crm/manager/controller/ReimburseOnlineController.java |   29 +++++++++++---
 5 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/ReimburseOnlineController.java b/src/main/java/com/zy/crm/manager/controller/ReimburseOnlineController.java
index f5d1969..789c294 100644
--- a/src/main/java/com/zy/crm/manager/controller/ReimburseOnlineController.java
+++ b/src/main/java/com/zy/crm/manager/controller/ReimburseOnlineController.java
@@ -92,12 +92,14 @@
                   @RequestParam(required = false)String condition,
                   @RequestParam Map<String, Object> param){
         EntityWrapper<ReimburseOnline> wrapper = new EntityWrapper<>();
-        wrapper.setSqlSelect("id,title,create_time as createTime,filepath,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,dept_id as deptId,status,update_time as updateTime,check_data as checkData,update_user_id as updateUserId,member_id as memberId");
-        wrapper.in("member_id", getUserRoleBelongsToUserId("allopen"));
+        wrapper.setSqlSelect("id,settle,title,create_time as createTime,filepath,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,dept_id as deptId,status,update_time as updateTime,check_data as checkData,update_user_id as updateUserId,member_id as memberId");
+//        wrapper.in("member_id", getUserRoleBelongsToUserId());
+        wrapper.andNew();
         excludeTrash(param);
         convert(param, wrapper);
         allLike(ReimburseOnline.class, param.keySet(), wrapper, condition);
         if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+        wrapper.or().eq("member_id",getUserId());
         return R.ok(reimburseOnlineService.selectPage(new Page<>(curr, limit), wrapper));
     }
 
@@ -105,9 +107,13 @@
         Long deptId = getDeptId();
         boolean signUserId = false;
         boolean signDeptId = false;
+        boolean signHostId = false;
         for (Map.Entry<String, Object> entry : map.entrySet()){
             if (entry.getKey().equals("dept_id")){
                 signDeptId = true;
+                if (String.valueOf(entry.getValue()).equals("19")){
+                    signHostId = true;
+                }
             }
         }
         for (Map.Entry<String, Object> entry : map.entrySet()){
@@ -129,6 +135,9 @@
         }
         if (!signUserId && !signDeptId){
             wrapper.eq("user_id", getUserId());
+        }
+        if (signHostId){
+            wrapper.or().eq("host_id",1);
         }
     }
     @RequestMapping(value = "/reimburseOnline/from/add/auth")
@@ -172,9 +181,8 @@
         map.put("orderNo",param.getOrderNo());
         map.put("templateName",param.getTemplateName());
         map.put("checkData",param.getCheckData());
-        map.put("reimburseOnlineDetls",param.getReimburseOnlineDetls());
         reimburseOnline.setForm(JSON.toJSONString(map));
-        reimburseOnline.setMemberId(president3.getId());
+        reimburseOnline.setMemberId(manager.getId());
 
         if (!reimburseOnlineService.insert(reimburseOnline)){
             return R.error("娣诲姞鎶ラ攢涓绘。澶辫触");
@@ -433,7 +441,7 @@
         return R.ok().add(vos);
     }
 
-    @PostMapping(value = "/reimburseOnline/approval/auth")
+    @PostMapping(value = "/reimburseOnline/approval2/auth")
     @ManagerAuth
     public R approvalReimburseOnline(@RequestParam Long planId,
                               @RequestParam(required = false) Long plannerId){
@@ -470,6 +478,8 @@
                     reimburseOnline.setSettle(2);  // 鎬昏鍔炲緟瀹�
                     reimburseOnline.setUpdateUserId(getUserId());
                     reimburseOnline.setUpdateTime(new Date());
+                    ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 3).eq("process", reimburseOnline.getCheckData().equals("鍚�") ? "3-1" : "3-2"));//3锛氭姤閿�娴佺▼
+                    reimburseOnline.setMemberId(processPermissions.getUserId());
 
                     if (!reimburseOnlineService.updateById(reimburseOnline)) {
                         throw new CoolException("瀹℃牳澶辫触锛岃鑱旂郴绠$悊鍛�");
@@ -526,7 +536,14 @@
                 reimburseOnline.setSettle(settle+1);
                 reimburseOnline.setUpdateUserId(getUserId());
                 reimburseOnline.setUpdateTime(new Date());
-                reimburseOnline.setMemberId(planLeader.getId());
+                String[] split = process.split("-");
+                if (settle!=5){
+                    settle=settle+2;
+                }else {
+                    settle++;
+                }
+                ProcessPermissions processPermissions2 = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 3).eq("process", settle+"-"+split[1]));//3锛氭姤閿�娴佺▼
+                reimburseOnline.setMemberId(processPermissions2.getUserId());
 
                 if (!reimburseOnlineService.updateById(reimburseOnline)) {
                     throw new CoolException("瀹℃牳澶辫触锛岃鑱旂郴绠$悊鍛�");
diff --git a/src/main/java/com/zy/crm/manager/entity/ReimburseOnline.java b/src/main/java/com/zy/crm/manager/entity/ReimburseOnline.java
index 1572031..7112703 100644
--- a/src/main/java/com/zy/crm/manager/entity/ReimburseOnline.java
+++ b/src/main/java/com/zy/crm/manager/entity/ReimburseOnline.java
@@ -74,6 +74,10 @@
     @TableField("dept_id")
     private Long deptId;
 
+    @ApiModelProperty(value= "")
+    @TableField("host_id")
+    private Long hostId;
+
     @ApiModelProperty(value= "鐘舵�亄0锛氭湭瀹屾垚锛�1锛氬凡瀹屾垚}")
     @TableField("status")
     private Integer status;
@@ -138,6 +142,17 @@
         this.updateUserId = user.getId();
     }
 
+    public ReimburseOnline(Long itemId,String orderNum,Date createTime,User user,Integer settle) {
+        this.itemId = itemId;
+        this.orderNum = orderNum;
+        this.createTime = createTime;
+        this.updateTime = createTime;
+        this.userId = user.getId();
+        this.deptId = user.getDeptId();
+        this.status = 0;
+        this.updateUserId = user.getId();
+        this.settle = settle;
+    }
 
 //    PriOnline priOnline = new PriOnline(
 //            null,    // excel琛ㄦ爣棰�
diff --git a/src/main/resources/mapper/ReimburseOnlineMapper.xml b/src/main/resources/mapper/ReimburseOnlineMapper.xml
index 67c7c02..a5f1b4d 100644
--- a/src/main/resources/mapper/ReimburseOnlineMapper.xml
+++ b/src/main/resources/mapper/ReimburseOnlineMapper.xml
@@ -35,9 +35,6 @@
         <result column="dept_id" property="deptId" />
         <result column="status" property="status" />
         <result column="update_time" property="updateTime" />
-        <result column="form" property="form" />
-        <result column="settle" property="settle" />
-        <result column="settle_msg" property="settleMsg" />
     </resultMap>
 
     <select id="listByPage" resultMap="NoDataResultMap">
diff --git a/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js b/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
index c6b4fa7..5da477a 100644
--- a/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
+++ b/src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
@@ -89,6 +89,7 @@
             ,{field: 'checkData', align: 'center',title: '鏄惁鍐茶处',hide: false}
             ,{field: 'orderNum', align: 'center',title: '鎶ラ攢鍗曞彿',width: 320, style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
             ,{field: 'planId$', align: 'center',title: '椤圭洰鍙�',hide: false}
+            ,{field: 'settle', align: 'center',title: '杩涘害',hide: false}
             ,{field: 'createTime$', align: 'center',title: '鍒涘缓鏃堕棿',hide: false}
             ,{field: 'updateTime$', align: 'center',title: '鏇存柊鏃堕棿',hide: false}
             ,{field: 'status$', align: 'center',title: '鐘舵��',hide: false}
@@ -236,6 +237,17 @@
     table.on('tool(reimburseOnline)', function(obj){
         var data = obj.data;
         switch (obj.event) {
+            case 'approval2':
+                layer.confirm('瀹℃壒閫氳繃锛�', {
+                    skin: 'layui-layer-admin',
+                    shade: .1,
+                    offset: '200px',
+                    title: data.name
+                }, function (i) {
+                    layer.close(i);
+                    approval2(data.id);
+                });
+                break;
             case 'more':
                 top.reimburseOnlineByMore=data.id;
                 console.log(top.reimburseOnlineByMore)
@@ -712,10 +724,10 @@
         });
     }
 
-    function approval(planId, plannerId, dIdx) {
+    function approval2(planId, plannerId, dIdx) {
         let loadIndex = layer.load(2);
         $.ajax({
-            url: baseUrl+"/reimburseOnline/approval/auth",
+            url: baseUrl+"/reimburseOnline/approval2/auth",
             headers: {'token': localStorage.getItem('token')},
             data: {
                 planId: planId,
diff --git a/src/main/webapp/views/reimburseOnline/reimburseOnline.html b/src/main/webapp/views/reimburseOnline/reimburseOnline.html
index dcfeb94..5201bd7 100644
--- a/src/main/webapp/views/reimburseOnline/reimburseOnline.html
+++ b/src/main/webapp/views/reimburseOnline/reimburseOnline.html
@@ -82,7 +82,7 @@
 
 
 <script type="text/html" id="operate">
-  {{# if (d.settle == 1 || d.settle == 2 || d.settle == 3) { }}
+  {{# if (d.settle == 1 || d.settle == 2 || d.settle == 3 || d.settle == 4 || d.settle == 5 || d.settle == 6) { }}
   <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval2">瀹℃壒</a>
   {{# } }}
   <a class="layui-btn layui-btn-xs btn-edit" lay-event="approval">鎻愪氦</a>

--
Gitblit v1.9.1