소스 검색

接口应用审批管理改造,秘钥复制,审批流程,数据隔离,

wangzhe 1 년 전
부모
커밋
b81219df12

+ 15 - 2
mybusiness/src/main/java/com/sooka/apply/controller/ApprovalController.java

@@ -11,6 +11,7 @@ import com.sooka.common.core.page.TableDataInfo;
 import com.sooka.common.enums.BusinessType;
 import com.sooka.common.utils.poi.ExcelUtil;
 import com.sooka.framework.util.ShiroUtils;
+import com.sooka.system.domain.SysUser;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -48,8 +49,20 @@ public class ApprovalController extends BaseController {
     @ResponseBody
     public TableDataInfo list(IntRecord intRecord)
     {
-        //只查政数局待审批的数据
-        intRecord.setStatus("3");
+        SysUser sysUser = ShiroUtils.getSysUser();
+        String deptId = sysUser.getDeptId().toString();
+        // @Excel(name = "接口来源", readConverterExp = "share_type_1=市共享,share_type_2=市归集,share_type_3=省上报,share_type_4=省共享")
+        // 政数局通过1,提供部门通过2,政数局待审批3,提供部门待审批4,政数局驳回5,提供部门驳回6
+        // share_type_4 = 省共享 新建0,政数局待审批3,政数局通过1
+        // share_type_1 = 市共享 新建0,政数局待审批3,提供部门待审批4,提供部门通过2
+        if(deptId.equals("103")){
+            //只查政数局待审批的数据
+            intRecord.setStatus("3");
+        }else {
+            //只查当前用户部门待审批的数据
+            intRecord.setProvideDeptId(sysUser.getDeptId().toString());
+            intRecord.setStatus("4");
+        }
         startPage();
         List<IntRecord> list = intRecordService.selectIntRecordList(intRecord);
         return getDataTable(list);

+ 3 - 0
mybusiness/src/main/java/com/sooka/apply/domain/IntDetailed.java

@@ -37,6 +37,9 @@ public class IntDetailed extends BaseEntity
     /** secret_key */
     private String secretKey;
 
+    /** secret_content */
+    private String secretContent;
+
     /** 用途 */
     private String purpose;
 

+ 3 - 1
mybusiness/src/main/java/com/sooka/apply/service/impl/IntRecordServiceImpl.java

@@ -210,10 +210,12 @@ public class IntRecordServiceImpl implements IIntRecordService
 
         List<IntDetailed> list_ = new ArrayList<IntDetailed>();
         for (int i = 0; i < list.size(); i++) {
+            String content = deptId+"/"+deptName+"/"+duration+"/"+IdUtils.fastSimpleUUID();
             IntDetailed intDetailed = new IntDetailed();
             intDetailed.setRecordId(id);
             intDetailed.setIntId(list.get(i).getIntId());
-            intDetailed.setSecretKey(SecretKeyUtil.AESEncode("3fc674da58",deptId+"/"+deptName+"/"+duration+"/"+IdUtils.fastSimpleUUID()));
+            intDetailed.setSecretKey(SecretKeyUtil.AESEncode("3fc674da58",content));
+//            intDetailed.setSecretContent(content);
             intDetailed.setPurpose(list.get(i).getPurpose());
             intDetailed.setFile(list.get(i).getFile());
             list_.add(intDetailed);

+ 5 - 0
mybusiness/src/main/java/com/sooka/applyData/controller/DataApprovalController.java

@@ -8,6 +8,8 @@ import com.sooka.common.core.controller.BaseController;
 import com.sooka.common.core.domain.AjaxResult;
 import com.sooka.common.core.page.TableDataInfo;
 import com.sooka.common.utils.poi.ExcelUtil;
+import com.sooka.framework.util.ShiroUtils;
+import com.sooka.system.domain.SysUser;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
@@ -45,6 +47,9 @@ public class DataApprovalController extends BaseController {
     @ResponseBody
     public TableDataInfo list(DataRecord DataRecord)
     {
+        SysUser sysUser = ShiroUtils.getSysUser();
+        //只查当前用户部门的数据
+        DataRecord.setProvideDeptId(sysUser.getDeptId().toString());
         //只查政数局待审批的数据
         DataRecord.setStatus("3");
         startPage();

+ 9 - 4
mybusiness/src/main/resources/mapper/apply/IntRecordMapper.xml

@@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="shareType"    column="share_type"    />
         <result property="endTime"    column="end_time"    />
         <result property="status"    column="status"    />
+        <result property="shareType"    column="share_type"    />
         <result property="approvalUserId"    column="approval_user_id"    />
         <result property="approvalUserName"    column="approval_user_name"    />
         <result property="approvalTime"    column="approval_time"    />
@@ -65,7 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             CONCAT(start_time,' - ',end_time) duration,
             start_time,
             end_time,
-            status
+            status,
+            share_type
         FROM
             int_record
     </sql>
@@ -105,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.start_time,
             a.end_time,
             a.status,
+            a.share_type,
             a.approval_user_id,
             a.approval_user_name,
             a.approval_time,
@@ -151,6 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="startTime != null">start_time,</if>
             <if test="endTime != null">end_time,</if>
             <if test="status != null">status,</if>
+            <if test="shareType != null">share_type,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="applyDeptId != null">#{applyDeptId},</if>
@@ -166,6 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="startTime != null">#{startTime},</if>
             <if test="endTime != null">#{endTime},</if>
             <if test="status != null">#{status},</if>
+            <if test="shareType != null">#{shareType},</if>
          </trim>
     </insert>
 
@@ -204,9 +209,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <!--批量新增子表-->
     <insert id="batchIntDetailed">
-        insert into int_detailed(record_id, int_id, secret_key, purpose, file) values
+        insert into int_detailed(record_id, int_id, secret_key, secret_content, purpose, file) values
         <foreach item="item" index="index" collection="list" separator=",">
-            ( #{item.recordId}, #{item.intId} ,#{item.secretKey}, #{item.purpose}, #{item.file})
+            ( #{item.recordId}, #{item.intId} ,#{item.secretKey} ,#{item.secretContent}, #{item.purpose}, #{item.file})
         </foreach>
     </insert>
 
@@ -420,7 +425,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN int_detailed d ON r.id = d.record_id
                 LEFT JOIN t_u_interfaceinfo i ON d.int_id = i.id
                 WHERE
-                    share_type in
+                    i.share_type in
                     <foreach item="share_type" collection="array" open="(" separator="," close=")">
                         #{share_type}
                     </foreach>

+ 44 - 2
mybusiness/src/main/resources/templates/apply/approval/approvalDetail.html

@@ -28,6 +28,7 @@
                     <form method="get" class="form-horizontal" id="form-record-edit">
                         <input type="hidden" name="id" th:value="${intRecord.id}">
                         <input type="hidden" name="shareType" th:value="${intRecord.shareType}">
+                        <input type="hidden" name="status" th:value="${intRecord.status}">
                         <div class="form-group">
                             <label class="col-sm-2 control-label is-required">申请部门名称</label>
                             <div class="col-sm-4">
@@ -212,7 +213,7 @@
     let dom = $('#luStep');
     dom.stepInit(data);
 
-    function ok() {
+    function ok_old() {
         let id = $("input[name='id']").val();
         let shareType = $("input[name='shareType']").val();
         let status = shareType == 'share_type_4' ? '2' : '4';//省共享部门提供部门通过2 其他情况提供部门待审批4
@@ -227,9 +228,50 @@
         });
     }
 
-    function reject() {
+    function ok() {
         let id = $("input[name='id']").val();
+        let shareType = $("input[name='shareType']").val();
+        let status = $("input[name='status']").val();
+        // let status = shareType == 'share_type_4' ? '2' : '4';//省共享部门提供部门通过2 其他情况提供部门待审批4
+        $.modal.confirm("确认审批通过吗?", function() {
+            let url = ctx + "apply/record/updateStatus";
+            // @Excel(name = "接口来源", readConverterExp = "share_type_1=市共享,share_type_2=市归集,share_type_3=省上报,share_type_4=省共享")
+            // 政数局通过1,提供部门通过2,政数局待审批3,提供部门待审批4,政数局驳回5,提供部门驳回6
+            // share_type_4 = 省共享 新建0,政数局待审批3,政数局通过1
+            // share_type_1 = 市共享 新建0,政数局待审批3,提供部门待审批4,提供部门通过2
+            if(status == 0){
+                $.operate.post(url,{ "id": id, "status": 3 },function(res){
+                    $.operate.successTabCallback(res);
+                });
+            } else if(status == 3 && shareType == "share_type_4"){
+                $.operate.post(url,{ "id": id, "status": 1 },function(res){
+                    $.operate.successTabCallback(res);
+                });
+            } else if(status == 3 && shareType == "share_type_1"){
+                $.operate.post(url,{ "id": id, "status": 4 },function(res){
+                    $.operate.successTabCallback(res);
+                });
+            } else if(status == 4 && shareType == "share_type_1"){
+                $.operate.post(url,{ "id": id, "status": 2 },function(res){
+                    $.operate.successTabCallback(res);
+                });
+            }
+
+            // let url = ctx + "apply/record/updateStatus";
+            // //当选择省共享部门,审批流程节点变为开始-政数局审批-完成。
+            // //状态:0新建,政数局通过1,提供部门通过2,政数局待审批3,提供部门待审批4,政数局驳回5,提供部门驳回6
+            // // $.operate.post(url,{ "id": id, "status": "4" },function(res){
+            // $.operate.post(url, { "id": id, "status": status },function(res){
+            //     $.operate.successTabCallback(res);
+            // });
+        });
+    }
+
+    function reject() {
+            // let shareType = $("input[name='shareType']").val();
+            // alert(shareType)
         $.modal.confirm("确认审批驳回吗?", function() {
+            let id = $("input[name='id']").val();
             let url = ctx + "apply/record/rejectDialog/" + id;
             $.modal.open("请填写驳回原因", url, '700', '540');
         });

+ 6 - 1
mybusiness/src/main/resources/templates/apply/record/detail.html

@@ -189,6 +189,7 @@
                 $("label[name='examine']").show();
                 $("div[name='examine']").show();
                 break;//申请驳回
+            case "1" :
             case "2" :
                 index = 3;
                 $("div[name='secretKey']").show();
@@ -294,7 +295,11 @@
     function copy(dom){
         let data = $(dom).attr("data");
         let arr = data.split(",");
-        data = "接口地址:" + arr[0] + "  接口编码:" + arr[1] + "  秘钥:" + arr[2];
+        data = "接口地址:" + arr[0] + "  接口编码:" + arr[1];
+        // alert($("div[name='secretKey']").css("display"))
+        if($("div[name='secretKey']").css("display") == "block"){
+           data +=  "  秘钥:" + arr[2];
+        }
         const type = 'input';
         const input = document.createElement(type);
         input.setAttribute('readonly', 'readonly'); // 设置为只读, 防止在 ios 下拉起键盘

+ 18 - 3
mybusiness/src/main/resources/templates/apply/record/record.html

@@ -105,7 +105,7 @@
                         let actions = [];
                         /**新建状态**/
                         if(row.status == 0){
-                            actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="report(\'' + row.id + '\')"><i class="fa fa-check"></i>提交审核</a> ');
+                            actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="report(\'' + row.id + '\', \'' + row.shareType + '\', \'' + row.status + '\')"><i class="fa fa-check"></i>提交审核</a> ');
                             actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                             actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                         }else{
@@ -119,10 +119,25 @@
         });
 
         /**提交审核**/
-        function report(id) {
+        function report(id, shareType, status) {
             $.modal.confirm("确认要提交审核吗?", function() {
                 let url = ctx + "apply/record/updateStatus";
-                $.operate.post(url,{ "id": id, "status": "3" });
+                // alert(id)
+                // alert(shareType)
+                // alert(status)
+                // @Excel(name = "接口来源", readConverterExp = "share_type_1=市共享,share_type_2=市归集,share_type_3=省上报,share_type_4=省共享")
+                // 政数局通过1,提供部门通过2,政数局待审批3,提供部门待审批4,政数局驳回5,提供部门驳回6
+                // share_type_4 = 省共享 新建0,政数局待审批3,政数局通过1
+                // share_type_1 = 市共享 新建0,政数局待审批3,提供部门待审批4,提供部门通过2
+                if(status == 0){
+                    $.operate.post(url,{ "id": id, "status": 3 });
+                } else if(status == 3 && shareType == "share_type_4"){
+                    $.operate.post(url,{ "id": id, "status": 1 });
+                } else if(status == 3 && shareType == "share_type_1"){
+                    $.operate.post(url,{ "id": id, "status": 4 });
+                } else if(status == 4 && shareType == "share_type_1"){
+                    $.operate.post(url,{ "id": id, "status": 2 });
+                }
             });
         }