浏览代码

完善接口申请流程

yhliang 3 年之前
父节点
当前提交
6b8e28fde0

+ 10 - 0
mybusiness/src/main/java/com/sooka/apply/domain/IntBo.java

@@ -14,6 +14,8 @@ public class IntBo {
 
     private String intIds;
 
+    private String intCodes;
+
     private Long deptId;
 
     private String datetime;
@@ -34,6 +36,14 @@ public class IntBo {
         this.intIds = intIds;
     }
 
+    public String getIntCodes() {
+        return intCodes;
+    }
+
+    public void setIntCodes(String intCodes) {
+        this.intCodes = intCodes;
+    }
+
     public Long getDeptId() {
         return deptId;
     }

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

@@ -26,6 +26,14 @@ public class IntDetailed extends BaseEntity
     @Excel(name = "接口表id")
     private String intId;
 
+    /** 接口编码 */
+    @Excel(name = "接口编码")
+    private String intCode;
+
+    /** 接口名称 */
+    @Excel(name = "接口名称")
+    private String intName;
+
     /** 开始时间 */
     @Excel(name = "开始时间")
     private String strAt;
@@ -107,6 +115,22 @@ public class IntDetailed extends BaseEntity
         return status;
     }
 
+    public String getIntCode() {
+        return intCode;
+    }
+
+    public void setIntCode(String intCode) {
+        this.intCode = intCode;
+    }
+
+    public String getIntName() {
+        return intName;
+    }
+
+    public void setIntName(String intName) {
+        this.intName = intName;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 20 - 7
mybusiness/src/main/java/com/sooka/apply/service/impl/IntRecordServiceImpl.java

@@ -89,9 +89,13 @@ public class IntRecordServiceImpl implements IIntRecordService
 
         intBo.setId(intRecord.getId());
 
-        int rows = intRecordMapper.insertIntRecord(intRecord);
-        insertIntDetailed(intBo);
-        return rows;
+        try {
+            insertIntDetailed(intBo);
+            return intRecordMapper.insertIntRecord(intRecord);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
     }
 
     /**
@@ -125,19 +129,28 @@ public class IntRecordServiceImpl implements IIntRecordService
      * 
      * @param intBo 申请记录对象
      */
-    private void insertIntDetailed(IntBo intBo)
-    {
+    private void insertIntDetailed(IntBo intBo) throws Exception {
 
         String[] intIds = intBo.getIntIds().split(",");
+        String[] intCodes = intBo.getIntCodes().split(",");
+
+        if (intIds.length != intCodes.length) {
+            throw new Exception("接口信息不全,无法完成申请");
+        }
+
         String id = intBo.getId();
         String str_at = intBo.getDatetime().split(" - ")[0];
         String end_at = intBo.getDatetime().split(" - ")[1];
 
         List<IntDetailed> list = new ArrayList<IntDetailed>();
-        for (String intId : intIds) {
+
+        for (int i = 0; i < intIds.length; i++) {
+            String intId = intIds[i];
+            String intCode = intCodes[i];
             IntDetailed intDetailed = new IntDetailed();
             intDetailed.setId(IdUtils.fastSimpleUUID());
             intDetailed.setIntId(intId);
+            intDetailed.setIntCode(intCode);
             intDetailed.setRecordId(id);
             intDetailed.setStrAt(str_at);
             intDetailed.setEndAt(end_at);
@@ -145,8 +158,8 @@ public class IntRecordServiceImpl implements IIntRecordService
             intDetailed.setStatus("1");
             list.add(intDetailed);
         }
+        
         if (list.size() > 0) {
-            System.out.println(Arrays.toString(list.toArray()));
             intRecordMapper.batchIntDetailed(list);
         }
     }

+ 12 - 0
mybusiness/src/main/java/com/sooka/system/domain/TUInterfaceinfo.java

@@ -20,6 +20,10 @@ public class TUInterfaceinfo extends BaseEntity
     private String id;
 
     /** 状态 */
+    @Excel(name = "编码")
+    private String code;
+
+    /** 状态 */
     @Excel(name = "状态")
     private String status;
 
@@ -184,6 +188,14 @@ public class TUInterfaceinfo extends BaseEntity
         return typeAksk;
     }
 
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 11 - 6
mybusiness/src/main/resources/mapper/apply/IntRecordMapper.xml

@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="recordId"    column="record_id"    />
         <result property="intId"    column="int_id"    />
+        <result property="intCode"    column="int_code"    />
+        <result property="intName"    column="interface_name"    />
         <result property="strAt"    column="str_at"    />
         <result property="endAt"    column="end_at"    />
         <result property="secretKey"    column="secret_key"    />
@@ -51,12 +53,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             b.id,
             b.record_id,
             b.int_id,
+            i.interface_name,
+            b.int_code,
             b.str_at,
             b.end_at,
             b.secret_key,
             b.STATUS
         FROM
-            int_detailed b
+            int_detailed b,
+            t_u_interfaceinfo i
+        WHERE
+            b.int_id = i.id
     </sql>
 
     <select id="selectIntRecordList" parameterType="IntRecord" resultMap="IntRecordResult">
@@ -72,9 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectIntDetailedList" parameterType="IntDetailed" resultMap="IntDetailedResult">
         <include refid="selectIntDetailedVo"/>
-        <where>
-            <if test="recordId != null "> and record_id = #{recordId}</if>
-        </where>
+        <if test="recordId != null "> and b.record_id = #{recordId}</if>
     </select>
     
     <select id="selectIntRecordById" parameterType="String" resultMap="IntRecordIntDetailedResult">
@@ -130,9 +135,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <insert id="batchIntDetailed">
-        insert into int_detailed( id, record_id, int_id, str_at, end_at, secret_key, status) values
+        insert into int_detailed( id, record_id, int_id, int_code, str_at, end_at, secret_key, status) values
 		<foreach item="item" index="index" collection="list" separator=",">
-            ( #{item.id}, #{item.recordId}, #{item.intId}, #{item.strAt}, #{item.endAt}, #{item.secretKey}, #{item.status})
+            ( #{item.id}, #{item.recordId}, #{item.intId} ,#{item.intCode}, #{item.strAt}, #{item.endAt}, #{item.secretKey}, #{item.status})
         </foreach>
     </insert>
 

+ 2 - 1
mybusiness/src/main/resources/mapper/system/TUInterfaceinfoMapper.xml

@@ -22,11 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="signServeraddress"    column="sign_serveraddress"    />
         <result property="interfaceAddress"    column="interface_address"    />
         <result property="typeIam"    column="type_iam"    />
+        <result property="code"    column="code"    />
         <result property="typeAksk"    column="type_aksk"    />
     </resultMap>
 
     <sql id="selectTUInterfaceinfoVo">
-        select id, status, remark, del_flag, create_by, create_time, update_by, update_time, interface_name, info_item, usage_scenarios, share_type, interface_type, env, sign_serveraddress, interface_address, type_iam, type_aksk from t_u_interfaceinfo
+        select id, status, code, remark, del_flag, create_by, create_time, update_by, update_time, interface_name, info_item, usage_scenarios, share_type, interface_type, env, sign_serveraddress, interface_address, type_iam, type_aksk from t_u_interfaceinfo
     </sql>
 
     <select id="selectTUInterfaceinfoList" parameterType="TUInterfaceinfo" resultMap="TUInterfaceinfoResult">

+ 8 - 2
mybusiness/src/main/resources/templates/apply/record/add.html

@@ -42,6 +42,7 @@
                     </div>
                     <div class="col-sm-12 select-table table-striped">
                         <input type="hidden" id="intIds" name="intIds">
+                        <input type="hidden" id="intCodes" name="intCodes">
                         <table id="bootstrap-table"></table>
                     </div>
                 </div>
@@ -103,6 +104,9 @@
                 field: 'interfaceName',
                 title: '接口名称'
             },{
+                field: 'code',
+                title: '接口编码'
+            },{
                 field: 'usageScenarios',
                 title: '使用场景'
             },{
@@ -135,8 +139,10 @@
     // 选中数据
     function checkItem(){
         // var arrays = $.table.selectColumns("userId");
-        var arrays = $.table.selectColumns("id");
-        $("#intIds").val(arrays);
+        var intIds = $.table.selectColumns("id");
+        $("#intIds").val(intIds);
+        var intCodes = $.table.selectColumns("code");
+        $("#intCodes").val(intCodes);
     }
 
     $('#btnExpand').click(function() {

+ 17 - 8
mybusiness/src/main/resources/templates/apply/record/edit.html

@@ -7,6 +7,11 @@
 <body class="white-bg">
     <div class="container-div">
         <div class="row">
+            <div class="col-sm-12 search-collapse">
+                <form id="record_form">
+                    <input type="hidden" id="recordId" name="recordId" th:value="${intRecord.id}">
+                </form>
+            </div>
             <div class="col-sm-12">
                 <div class="col-sm-12 select-table table-striped">
                     <table id="bootstrap-table"></table>
@@ -40,23 +45,27 @@
                     	var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
                     	return columnIndex + $.table.serialNumber(index);
                     }
-                },
-                {
+                },{
+                    field: 'intName',
+                    align: 'center',
+                    title: '接口名称'
+                },{
+                    field: 'intCode',
+                    align: 'center',
+                    title: '接口编码'
+                },{
                     field: 'strAt',
                     align: 'center',
                     title: '开始时间'
-				},
-                {
+				},{
                     field: 'endAt',
                     align: 'center',
                     title: '结束时间'
-				},
-                {
+				},{
                     field: 'secretKey',
                     align: 'center',
                     title: 'secret_key'
-				},
-                {
+				},{
                     visible: editFlag !== 'hidden',
                     title: '状态',
                     align: 'center',

+ 5 - 0
mybusiness/src/main/resources/templates/apply/record/record.html

@@ -111,6 +111,11 @@
             };
             $.table.init(options);
         });
+
+        function info(recordId) {
+
+        }
+
     </script>
 </body>
 </html>