浏览代码

接口秘钥改造

wangzhe 2 年之前
父节点
当前提交
c4b1627ee6

+ 16 - 0
mybusiness/src/main/java/com/sooka/apply/mapper/IntRecordMapper.java

@@ -32,6 +32,14 @@ public interface IntRecordMapper
     public IntDetailed selectIntRecordDetailedBySubId(String subId);
 
     /**
+     * 根据接口ID查询子表记录
+     *
+     * @param intId 申请子表记录ID
+     * @return 申请记录
+     */
+    public IntDetailed selectIntDetailedByIntId(String intId);
+
+    /**
      * 查询申请记录列表
      *
      * @param intRecord 申请记录
@@ -57,6 +65,14 @@ public interface IntRecordMapper
     public int insertIntRecord(IntRecord intRecord);
 
     /**
+     * 新增申请明细
+     *
+     * @param intDetailed 申请明细
+     * @return 结果
+     */
+    public int insertIntDetailed(IntDetailed intDetailed);
+
+    /**
      * 修改申请记录
      *
      * @param intBo 申请记录

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

@@ -27,6 +27,9 @@ public class TUInterfaceinfo extends BaseEntity
     @Excel(name = "编码")
     private String code;
 
+    /** 秘钥 */
+    private String secretKey;
+
     /** 状态 */
     @Excel(name = "状态")
     private String status;

+ 36 - 2
mybusiness/src/main/java/com/sooka/system/service/impl/TUInterfaceinfoServiceImpl.java

@@ -5,16 +5,22 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import com.sooka.apply.domain.IntDetailed;
+import com.sooka.apply.mapper.IntRecordMapper;
 import com.sooka.common.core.text.Convert;
 import com.sooka.common.utils.DateUtils;
 import com.sooka.common.utils.uuid.UUID;
+import com.sooka.framework.util.ShiroUtils;
 import com.util.NumberUtils;
+import com.util.SecretKeyUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.sooka.system.mapper.TUInterfaceinfoMapper;
 import com.sooka.system.domain.TUInterfaceinfo;
 import com.sooka.system.service.ITUInterfaceinfoService;
 
+import javax.annotation.Resource;
+
 
 /**
  * 【请填写功能名称】Service业务层处理
@@ -25,8 +31,10 @@ import com.sooka.system.service.ITUInterfaceinfoService;
 @Service
 public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
 {
-    @Autowired
+    @Resource
     private TUInterfaceinfoMapper tUInterfaceinfoMapper;
+    @Resource
+    private IntRecordMapper intRecordMapper;
 
     /**
      * 查询【请填写功能名称】
@@ -37,7 +45,33 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
     @Override
     public TUInterfaceinfo selectTUInterfaceinfoById(String id)
     {
-        return tUInterfaceinfoMapper.selectTUInterfaceinfoById(id);
+//        String str = SecretKeyUtil.AESEncode("3fc674da58", "123/政数局/2022-10-20 - 2022-10-29/b29c94d72ee74c6d94b573d90020ea59");
+//        System.out.println("解密后的明文是:" + SecretKeyUtil.AESDncode("3fc674da58", str));
+        Long deptId = ShiroUtils.getSysUser().getDept().getDeptId();
+        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
+        TUInterfaceinfo tuInterfaceinfo = tUInterfaceinfoMapper.selectTUInterfaceinfoById(id);
+        IntDetailed intDetailed = intRecordMapper.selectIntDetailedByIntId(id);
+        if(intDetailed == null){
+            IntDetailed detailed = new IntDetailed();
+            String purpose = "";
+            String shrareType = tuInterfaceinfo.getShareType();
+            switch (shrareType){
+                case "share_type_2":
+                    purpose = "市归集接口申请密钥";
+                    break;
+                case "share_type_3":
+                    purpose = "省上报接口申请密钥";
+            }
+            String secretKey = SecretKeyUtil.AESEncode("3fc674da58", deptId + "/" + deptName + "/2022-12-02 - 2099-12-31/" + id);
+            detailed.setIntId(id);
+            detailed.setPurpose(purpose);
+            detailed.setSecretKey(secretKey);
+            intRecordMapper.insertIntDetailed(detailed);
+            tuInterfaceinfo.setSecretKey(secretKey);
+        }else {
+            tuInterfaceinfo.setSecretKey(intDetailed.getSecretKey());
+        }
+        return tuInterfaceinfo;
     }
 
     /**

+ 19 - 0
mybusiness/src/main/resources/mapper/apply/IntRecordMapper.xml

@@ -165,6 +165,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
     </insert>
 
+    <!--新增申请明细-->
+    <insert id="insertIntDetailed" parameterType="IntDetailed" useGeneratedKeys="true" keyProperty="id">
+        insert into int_detailed(int_id, secret_key, purpose) values (#{intId} ,#{secretKey}, #{purpose})
+    </insert>
+
     <select id="selectIntRecordDetailedBySubId" parameterType="String" resultMap="IntDetailedResult">
         SELECT
             id,
@@ -179,6 +184,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             id = #{subId}
     </select>
 
+    <select id="selectIntDetailedByIntId" parameterType="String" resultMap="IntDetailedResult">
+        SELECT
+            id,
+            record_id,
+            int_id,
+            secret_key,
+            purpose,
+            file
+        FROM
+            int_detailed
+        WHERE
+            id = #{intId}
+    </select>
+
     <!--批量新增子表-->
     <insert id="batchIntDetailed">
         insert into int_detailed(record_id, int_id, secret_key, purpose, file) values

+ 4 - 2
mybusiness/src/main/resources/static/visualization/js/echarts_div.js

@@ -270,7 +270,8 @@ function jkgj(res) {
 	let maxSeriesData = []
 	const MAX = Math.max(...seriesData)
 	for (let i = 0; i < seriesData.length; i++) {
-		maxSeriesData.push(MAX)
+		// maxSeriesData.push(MAX)
+		maxSeriesData.push(seriesData[i]);
 	}
 	let barLinearColors = [
 		new echarts.graphic.LinearGradient(0, 1, 1, 1, [
@@ -427,7 +428,8 @@ function jkgj(res) {
 						color: 'rgba(27, 17, 134, 0.0)'
 					}
 				},
-				data: maxSeriesData
+				// data: maxSeriesData
+                data: maxSeriesData
 			}
 		]
 	};

+ 12 - 0
mybusiness/src/main/resources/templates/system/interfaceinfo/edit.html

@@ -14,6 +14,18 @@
                 </div>
             </div>
             <div class="form-group">
+                <label class="col-sm-3 control-label is-required">接口码:</label>
+                <div class="col-sm-8">
+                    <input name="interfaceName" th:field="*{code}" class="form-control" type="text" disabled>
+                </div>
+            </div>
+            <div class="form-group">
+                <label class="col-sm-3 control-label is-required">秘钥:</label>
+                <div class="col-sm-8">
+                    <input name="interfaceName" th:field="*{secretKey}" class="form-control" type="text" disabled>
+                </div>
+            </div>
+            <div class="form-group">
                 <label class="col-sm-3 control-label is-required">所属部门:</label>
                 <div class="col-sm-8">
                     <input name="deptName" class="form-control" th:field="*{deptName}" type="text" onclick="selectDeptTree()" id="treeName" placeholder="请选择归属部门" required>

+ 3 - 1
mybusiness/src/main/resources/templates/visualization/tk_iframe.html

@@ -773,7 +773,9 @@
 </script>
 <script>
     (function ($) {
+        alert(789)
         $.fn.FontScroll = function (options) {
+        alert(888)
             var d = {time: 3000, s: 'fontColor', num: 1}
             var o = $.extend(d, options);
             this.children('ul').addClass('line');
@@ -795,7 +797,7 @@
             }, function () {
                 timeID = setInterval(Up, _time);
             });
-
+            alert(_conChildH)
             function Up() {
                 _con.animate({marginTop: '-' + _conChildH});
                 //样式控制