From 93ef3f2ab542b7b6fe941c30bf56b35e743cf299 Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期六, 04 十一月 2023 17:51:39 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java |   72 +++++++++++++++++++++++
 src/main/webapp/views/priOnline2/priOnline.html                       |   19 ++++++
 src/main/webapp/static/js/priOnline2/priOnline.js                     |   68 ++++++++++++++++++++++
 3 files changed, 157 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
index bf22ba6..8f72fd0 100644
--- a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
+++ b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
@@ -16,6 +16,7 @@
 import com.zy.crm.common.web.BaseController;
 import com.zy.crm.manager.entity.*;
 import com.zy.crm.manager.service.*;
+import com.zy.crm.manager.utils.CompanySearchUtils;
 import com.zy.crm.system.entity.User;
 import com.zy.crm.system.service.UserService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -142,6 +143,69 @@
             wrapper.or().eq("host_id", 1);
         }
     }
+    @RequestMapping(value = "/priOnline2/HJ/add/auth")
+    @ManagerAuth(memo = "鎺ュ彇闆嗘垚鏍镐环浠诲姟")
+    public R addHJ(PriOnline2 priOnline2) {
+        PriOnline2 priOnline21 = priOnline2Service.selectById(priOnline2.getId());
+        if (priOnline21.getSettle()!=1 || !priOnline21.getMemberId().equals(0L)){
+            return R.error("姝ら泦鎴愭牳浠峰崟鐘舵�佸凡鏀瑰彉锛岃鍒锋柊椤甸潰閲嶆柊閫夋嫨锛�");
+        }
+        Date now = new Date();
+        priOnline21.setMemberId(getUserId());
+
+
+        List<SettleDto> planDtos = JSON.parseArray(priOnline21.getSettleMsg(), SettleDto.class);
+        List<SettleDto> planDtoList = new ArrayList<>();
+        for (SettleDto dto : planDtos) {
+            if (dto.getStep().equals(2)) {
+                dto.setUserId(getUserId());
+                dto.setUsername(getUser().getNickname());
+                if (Cools.isEmpty(dto.getMsg())) {
+                    dto.setMsg(getUser().getNickname() + "鎺ュ彇鏍镐环");
+                } else {
+                    dto.setMsg(dto.getMsg() + PZH + DateUtils.convert(now) + " " + getUser().getNickname() + "鎺ュ彇鏍镐环");
+                }
+                dto.setTime(DateUtils.convert(new Date()));
+            }
+            planDtoList.add(dto);
+        }
+        priOnline21.setSettleMsg(JSON.toJSONString(planDtoList));
+        priOnline21.setUpdateUserId(getUserId());
+        priOnline21.setUpdateTime(now);
+        priOnline2Service.updateById(priOnline21);
+        return R.ok("鎺ュ彇鎴愬姛");
+    }
+
+    @RequestMapping(value = "/priOnline2/HJ/search/auth")
+    @ManagerAuth
+    public R priOnline2Search(String condition) {
+        EntityWrapper<PriOnline2> wrapper = new EntityWrapper<>();
+        wrapper.like("template_name", condition);
+        wrapper.eq("member_id",0L);
+
+        List<ProcessPermissions> processPermissionsList = processPermissionsService.selectList(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5));//2锛氭牳浠锋祦绋�
+        int type =0;
+        for (ProcessPermissions processPermissions:processPermissionsList){
+            if (getUserId().equals(processPermissions.getUserId())){
+                type=1;
+                break;
+            }
+        }
+        if (type==0){
+            return R.error("浣犱笉鏄牳浠峰憳,鏃犳潈鎺ヤ换鍔�");
+        }
+        List<Map<String, Object>> result = new ArrayList<>();
+
+        List<PriOnline2> priOnline2s = priOnline2Service.selectList(wrapper);
+        for (PriOnline2 priOnline2 : priOnline2s){
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", priOnline2.getId());
+            map.put("name", priOnline2.getTemplateName()+" - ID:"+priOnline2.getId());
+            result.add(map);
+        }
+        return R.ok(result);
+    }
+
 
     @RequestMapping(value = "/priOnline2/add/auth")
     @ManagerAuth(memo = "娣诲姞鏍镐环绠$悊")
@@ -208,7 +272,7 @@
         users.add(getUser());
         users.add(getUser());
         if (planType.getType().equals(2)) {
-            users.add(userService.selectById(73));
+            users.add(new User());
         }
         users.add(userUp);
         priOnline2.setSettleMsg(JSON.toJSONString(SettleDto.InItFlowPath(users, initNames, users.size())));
@@ -529,7 +593,11 @@
                 }
                 dto.setTime(DateUtils.convert(new Date()));
             } else if (dto.getStep().equals(priOnline2.getSettle() + 2)) {
-                nextUserId=dto.getUserId();
+                if (priOnline2.getSettleSize().equals(4)){
+                    nextUserId = 0L;
+                }else {
+                    nextUserId=dto.getUserId();
+                }
             }
         }
         priOnline2.setSettleMsg(JSON.toJSONString(list));
diff --git a/src/main/webapp/static/js/priOnline2/priOnline.js b/src/main/webapp/static/js/priOnline2/priOnline.js
index f710787..b2a6eb5 100644
--- a/src/main/webapp/static/js/priOnline2/priOnline.js
+++ b/src/main/webapp/static/js/priOnline2/priOnline.js
@@ -177,6 +177,9 @@
             case 'addBlank':
                 showEditModel();
                 break;
+            case 'addBlank2':
+                showEditModel2();
+                break;
             case 'refreshData':
                 tableIns.reload({
                     page: {
@@ -547,6 +550,42 @@
         });
     }
 
+    /* 寮圭獥 - 鏂板銆佷慨鏀� */
+    function showEditModel2(mData) {
+        admin.open({
+            type: 1,
+            area: '800px',
+            title: '鎺ュ彇' + '鏍镐环',
+            content: $('#editDialogHJ').html(),
+            success: function (layero, dIndex) {
+                let loadNameXml = loadNameXmlSel()
+                form.val('detailHJ', mData);
+                form.on('submit(editSubmitHJ)', function (data) {
+                    data.field.id = loadNameXml.getValue()[0] ? loadNameXml.getValue()[0].id : null;
+                    $.ajax({
+                        url: baseUrl+"/priOnline2/HJ/add/auth",
+                        headers: {'token': localStorage.getItem('token')},
+                        data: data.field,
+                        method: 'POST',
+                        success: function (res) {
+                            if (res.code === 200){
+                                layer.close(dIndex);
+                                layer.msg(res.msg, {icon: 1});
+                                tableReload()
+                            } else if (res.code === 403){
+                                top.location.href = baseUrl+"/";
+                            }else {
+                                layer.msg(res.msg, {icon: 2});
+                            }
+                        }
+                    })
+                });
+                $(layero).children('.layui-layer-content').css('overflow', 'visible');
+                layui.form.render('select');
+            }
+        });
+    }
+
     //鏇存柊form
     function showEditForm(mData) {
         admin.open({
@@ -640,6 +679,35 @@
         })
     }
 
+    window.loadNameXmlSel = function () {
+        return xmSelect.render({
+            el: '#nameXmlSel',
+            autoRow: true,
+            filterable: true,
+            remoteSearch: true,
+            clickClose: true,
+            radio: true,
+            remoteMethod: function (val, cb, show) {
+                $.ajax({
+                    url: baseUrl + "/priOnline2/HJ/search/auth",
+                    headers: {'token': localStorage.getItem('token')},
+                    data: {
+                        condition: val
+                    },
+                    method: 'POST',
+                    success: function (res) {
+                        if (res.code === 200) {
+                            cb(res.data)
+                        } else {
+                            cb([]);
+                            layer.msg(res.msg, {icon: 2});
+                        }
+                    }
+                });
+            }
+        });
+    }
+
 });
 
 // 鍏抽棴鍔ㄤ綔
diff --git a/src/main/webapp/views/priOnline2/priOnline.html b/src/main/webapp/views/priOnline2/priOnline.html
index cde8625..72e86c3 100644
--- a/src/main/webapp/views/priOnline2/priOnline.html
+++ b/src/main/webapp/views/priOnline2/priOnline.html
@@ -66,6 +66,7 @@
 <script type="text/html" id="toolbar">
     <div class="layui-btn-container">
         <button class="layui-btn layui-btn-sm" lay-event="addBlank">鏂板鏍镐环</button>
+        <button class="layui-btn layui-btn-sm" lay-event="addBlank2">鎺ュ彇闆嗘垚鏍镐环浠诲姟</button>
         <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="deleteData">鍒犻櫎</button>
     </div>
 </script>
@@ -169,6 +170,24 @@
     </div>
 </script>
 
+<script type="text/html" id="editDialogHJ">
+    <div id="detailHJ" lay-filter="detail" class="layui-form admin-form model-form">
+        <input name="id" type="hidden">
+        <div class="layui-form-item">
+            <label class="layui-form-label layui-form-required">瀹㈡埛鍚嶇О: </label>
+            <div class="layui-input-block">
+                <div id="nameXmlSel" name="nameXmlSel">
+                </div>
+            </div>
+        </div>
+        <hr class="layui-bg-gray">
+        <div class="layui-form-item text-right">
+            <button class="layui-btn" lay-filter="editSubmitHJ" lay-submit="">淇濆瓨</button>
+            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">鍙栨秷</button>
+        </div>
+    </div>
+</script>
+
 <!-- 琛ㄥ崟寮圭獥 -->
 <script type="text/html" id="editStatus">
     <div id="editStatusDetail" lay-filter="editStatusDetail" class="layui-form admin-form model-form">

--
Gitblit v1.9.1