浏览代码

中台-日志改造-第一步-修改秘钥及数据库字段

limeng 2 年之前
父节点
当前提交
b510b35126

+ 3 - 3
leiSP-admin/src/main/resources/templates/index.html

@@ -183,9 +183,9 @@
 					通化市接口中台智能管理平台
 				</h6>
                 <ul class="nav navbar-top-links navbar-right welcome-message">
-					<li><a title="可视化" th:href="@{/visualization/index}" target="_blank"><i class="fa fa-video-camera"></i> 可视化</a></li>
-					<li><a title="示例" href="" target="_blank"><i class="fa fa-video-camera"></i> 示例</a></li>
-                    <li><a title="文档" href="" target="_blank"><i class="fa fa-question-circle"></i> 文档</a></li>
+					<li><a title="可视化" th:href="@{/visualization/index}" target="_blank"><i class="fa fa-bar-chart"></i> 可视化</a></li>
+<!--					<li><a title="示例" href="" target="_blank"><i class="fa fa-video-camera"></i> 示例</a></li>-->
+<!--                    <li><a title="文档" href="" target="_blank"><i class="fa fa-question-circle"></i> 文档</a></li>-->
 	                <li><a title="全屏显示" href="javascript:void(0)" id="fullScreen"><i class="fa fa-arrows-alt"></i> 全屏</a></li>
                     <li class="dropdown user-menu">
 						<a href="javascript:void(0)" class="dropdown-toggle" data-hover="dropdown">

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

@@ -204,12 +204,16 @@ public class IntRecordServiceImpl implements IIntRecordService
      * @param list 申请记录对象
      */
     private int insertIntDetailed(String id, String duration, List<IntDetailed> list){
+
+        String deptId = ShiroUtils.getSysUser().getDept().getDeptId().toString();
+        String deptName = ShiroUtils.getSysUser().getDept().getDeptName();
+
         List<IntDetailed> list_ = new ArrayList<IntDetailed>();
         for (int i = 0; i < list.size(); i++) {
             IntDetailed intDetailed = new IntDetailed();
             intDetailed.setRecordId(id);
             intDetailed.setIntId(list.get(i).getIntId());
-            intDetailed.setSecretKey(SecretKeyUtil.AESEncode("3fc674da58",duration+"/"+IdUtils.fastSimpleUUID()));
+            intDetailed.setSecretKey(SecretKeyUtil.AESEncode("3fc674da58",deptId+"/"+deptName+"/"+duration+"/"+IdUtils.fastSimpleUUID()));
             intDetailed.setPurpose(list.get(i).getPurpose());
             intDetailed.setFile(list.get(i).getFile());
             list_.add(intDetailed);

+ 6 - 0
mybusiness/src/main/java/com/sooka/system/domain/BaseBusinessEntity.java

@@ -18,6 +18,12 @@ public class BaseBusinessEntity extends BaseEntity {
     private String interfaceinfoName;
     private String interfacetype;
 
+    /** 调用者部门ID lm 20221101 add **/
+    private String deptId;
+
+    /** 调用者部门 lm 20221101 add **/
+    private String deptName;
+
     /** 操作状态 lm 20220810 add **/
     private Long operationStatus;
 

+ 10 - 179
mybusiness/src/main/java/com/sooka/system/domain/TULog.java

@@ -3,13 +3,7 @@ package com.sooka.system.domain;
 import com.sooka.common.annotation.Excel;
 import com.sooka.common.constant.Constants;
 import com.sooka.common.core.domain.BaseEntity;
-import com.sooka.common.core.text.Convert;
-import com.sooka.common.utils.CacheUtils;
-import com.sooka.system.service.ITULogService;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import org.apache.shiro.cache.Cache;
-import org.springframework.beans.factory.annotation.Autowired;
+import lombok.Data;
 
 
 /**
@@ -18,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
  * @author lei
  * @date 2021-07-06
  */
+@Data
 public class TULog extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -48,6 +43,14 @@ public class TULog extends BaseEntity
     @Excel(name = "调用接口名")
     private String interfaceinfoName;
 
+    /** 调用者部门ID */
+    @Excel(name = "调用者部门ID")
+    private String deptId;
+
+    /** 调用者部门 */
+    @Excel(name = "调用者部门")
+    private String deptName;
+
     /** ip地址 */
     @Excel(name = "ip地址")
     private String ipaddress;
@@ -84,7 +87,6 @@ public class TULog extends BaseEntity
     @Excel(name = "异常记录")
     private String exceptionLog;
 
-
     /**
      * 获取cache name
      *
@@ -104,175 +106,4 @@ public class TULog extends BaseEntity
         return Constants.LOG_TOTAL_KEY;
     }
 
-    public void setId(String id)
-    {
-        this.id = id;
-    }
-
-    public String getId()
-    {
-        return id;
-    }
-    public void setStatus(String status)
-    {
-        this.status = status;
-    }
-
-    public String getStatus()
-    {
-        return status;
-    }
-    public void setDelFlag(String delFlag)
-    {
-        this.delFlag = delFlag;
-    }
-
-    public String getDelFlag()
-    {
-        return delFlag;
-    }
-    public void setLoginUser(Long loginUser)
-    {
-        this.loginUser = loginUser;
-    }
-
-    public Long getLoginUser()
-    {
-        return loginUser;
-    }
-    public void setLoginName(String loginName)
-    {
-        this.loginName = loginName;
-    }
-
-    public String getLoginName()
-    {
-        return loginName;
-    }
-    public void setInterfaceinfoId(String interfaceinfoId)
-    {
-        this.interfaceinfoId = interfaceinfoId;
-    }
-
-    public String getInterfaceinfoId()
-    {
-        return interfaceinfoId;
-    }
-    public void setInterfaceinfoName(String interfaceinfoName)
-    {
-        this.interfaceinfoName = interfaceinfoName;
-    }
-
-    public String getInterfaceinfoName()
-    {
-        return interfaceinfoName;
-    }
-    public void setIpaddress(String ipaddress)
-    {
-        this.ipaddress = ipaddress;
-    }
-
-    public String getIpaddress()
-    {
-        return ipaddress;
-    }
-    public void setOs(String os)
-    {
-        this.os = os;
-    }
-
-    public String getOs()
-    {
-        return os;
-    }
-    public void setPlatformInterfacetype(String platformInterfacetype)
-    {
-        this.platformInterfacetype = platformInterfacetype;
-    }
-
-    public String getPlatformInterfacetype()
-    {
-        return platformInterfacetype;
-    }
-    public void setBrowser(String browser)
-    {
-        this.browser = browser;
-    }
-
-    public String getBrowser()
-    {
-        return browser;
-    }
-    public void setParam(String params)
-    {
-        this.param = params;
-    }
-
-    public String getParam()
-    {
-        return param;
-    }
-    public void setResults(String results)
-    {
-        this.results = results;
-    }
-
-    public String getResults()
-    {
-        return results;
-    }
-    public void setOperationQuantity(Long operationQuantity)
-    {
-        this.operationQuantity = operationQuantity;
-    }
-
-    public Long getOperationQuantity()
-    {
-        return operationQuantity;
-    }
-    public void setOperationStatus(Long operationStatus)
-    {
-        this.operationStatus = operationStatus;
-    }
-
-    public Long getOperationStatus()
-    {
-        return operationStatus;
-    }
-    public void setExceptionLog(String exceptionLog)
-    {
-        this.exceptionLog = exceptionLog;
-    }
-
-    public String getExceptionLog()
-    {
-        return exceptionLog;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("status", getStatus())
-            .append("remark", getRemark())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("loginUser", getLoginUser())
-            .append("loginName", getLoginName())
-            .append("interfaceinfoId", getInterfaceinfoId())
-            .append("interfaceinfoName", getInterfaceinfoName())
-            .append("ipaddress", getIpaddress())
-            .append("os", getOs())
-            .append("platformInterfacetype", getPlatformInterfacetype())
-            .append("browser", getBrowser())
-            .append("param", getParam())
-            .append("results", getResults())
-            .append("operationQuantity", getOperationQuantity())
-            .append("operationStatus", getOperationStatus())
-            .append("exceptionLog", getExceptionLog())
-            .toString();
-    }
 }

+ 4 - 7
mybusiness/src/main/java/com/sooka/system/service/impl/Guiji_Base_Service.java

@@ -39,12 +39,14 @@ public class Guiji_Base_Service {
         String ipaddress = HttpUtil.getIPAddress(request);
         //添加操作日志
         SysUser sysUser = userInfoUtil.getLoginUserInfo();
-        //
         TULog tuLog = new TULog();
         tuLog.setId(UUID.fastUUID().toString());
         tuLog.setBrowser(browser);
         tuLog.setInterfaceinfoId(baseBusinessEntity.getInterfaceinfoId());
         tuLog.setInterfaceinfoName(baseBusinessEntity.getInterfaceinfoName());
+        /** 写入调用者部门ID,名称 lm 20221101 add **/
+        tuLog.setDeptId(baseBusinessEntity.getDeptId());
+        tuLog.setDeptName(baseBusinessEntity.getDeptName());
         tuLog.setIpaddress(ipaddress);
         tuLog.setLoginUser(sysUser.getUserId());
         tuLog.setLoginName(sysUser.getLoginName());
@@ -54,14 +56,9 @@ public class Guiji_Base_Service {
         tuLog.setResults(baseBusinessEntity.getResults());
         tuLog.setExceptionLog(baseBusinessEntity.getExceptionLog());
         /** 记录操作状态、请求参数、返回结果、异常记录 lm 20220810 add **/
-//        tuLog.setOperationQuantity(new Long(ls.size()));
         tuLog.setOs(os);
-        //共享接口
-//        tuLog.setPlatformInterfacetype("platform_interfacetype_1");
-        //归集接口
-//        tuLog.setPlatformInterfacetype("platform_interfacetype_2");
         tuLog.setPlatformInterfacetype(baseBusinessEntity.getInterfacetype());
-        /** 每次新增日志后要清空缓存,以达到更新缓存的效果 lm 202201011 add **/
+        /** 每次新增日志后要清空分页数据缓存,以达到更新缓存的效果 lm 20221011 add **/
         CacheUtils.remove(tuLog.getCacheName(),tuLog.getCacheKey());
         tuLogMapper.insertTULog(tuLog);
 

+ 1 - 1
mybusiness/src/main/java/com/util/SecretKeyUtil.java

@@ -105,7 +105,7 @@ public class SecretKeyUtil {
         /*
          * 加密
          */
-        String str = SecretKeyUtil.AESEncode("3fc674da58", "2022-10-20 - 2022-10-29/b29c94d72ee74c6d94b573d90020ea59");
+        String str = SecretKeyUtil.AESEncode("3fc674da58", "123/政数局/2022-10-20 - 2022-10-29/b29c94d72ee74c6d94b573d90020ea59");
         System.out.println("加密后的密文是:" + str);
 
         /*

+ 11 - 1
mybusiness/src/main/resources/mapper/system/TULogMapper.xml

@@ -17,6 +17,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="loginName"    column="login_name"    />
         <result property="interfaceinfoId"    column="interfaceinfo_id"    />
         <result property="interfaceinfoName"    column="interfaceinfo_name"    />
+        <result property="deptId"    column="dept_id"    />
+        <result property="deptName"    column="dept_name"    />
         <result property="ipaddress"    column="ipaddress"    />
         <result property="os"    column="os"    />
         <result property="platformInterfacetype"    column="platform_interfacetype"    />
@@ -29,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTULogVo">
-        select id, status, remark, del_flag, create_by, create_time, update_by, update_time, login_user, login_name, interfaceinfo_id, interfaceinfo_name, ipaddress, os, platform_interfacetype, browser, param, results, operation_quantity, operation_status, exception_log from t_u_log
+        select id, status, remark, del_flag, create_by, create_time, update_by, update_time, login_user, login_name, interfaceinfo_id, interfaceinfo_name, dept_id, dept_name, ipaddress, os, platform_interfacetype, browser, param, results, operation_quantity, operation_status, exception_log from t_u_log
     </sql>
 
     <select id="selectTULogList" parameterType="TULog" resultMap="TULogResult">
@@ -40,6 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="loginName != null  and loginName != ''"> and login_name like concat('%', #{loginName}, '%')</if>
             <if test="interfaceinfoId != null  and interfaceinfoId != ''"> and interfaceinfo_id = #{interfaceinfoId}</if>
             <if test="interfaceinfoName != null  and interfaceinfoName != ''"> and interfaceinfo_name like concat('%', #{interfaceinfoName}, '%')</if>
+            <if test="deptId != null  and deptId != ''"> and dept_id = #{deptId}</if>
+            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
             <if test="ipaddress != null  and ipaddress != ''"> and ipaddress = #{ipaddress}</if>
             <if test="os != null  and os != ''"> and os = #{os}</if>
             <if test="platformInterfacetype != null  and platformInterfacetype != ''"> and platform_interfacetype = #{platformInterfacetype}</if>
@@ -73,6 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="loginName != null">login_name,</if>
             <if test="interfaceinfoId != null">interfaceinfo_id,</if>
             <if test="interfaceinfoName != null">interfaceinfo_name,</if>
+            <if test="deptId != null">dept_id,</if>
+            <if test="deptName != null">dept_name,</if>
             <if test="ipaddress != null">ipaddress,</if>
             <if test="os != null">os,</if>
             <if test="platformInterfacetype != null">platform_interfacetype,</if>
@@ -96,6 +102,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="loginName != null">#{loginName},</if>
             <if test="interfaceinfoId != null">#{interfaceinfoId},</if>
             <if test="interfaceinfoName != null">#{interfaceinfoName},</if>
+            <if test="deptId != null">#{deptId},</if>
+            <if test="deptName != null">#{deptName},</if>
             <if test="ipaddress != null">#{ipaddress},</if>
             <if test="os != null">#{os},</if>
             <if test="platformInterfacetype != null">#{platformInterfacetype},</if>
@@ -122,6 +130,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="loginName != null">login_name = #{loginName},</if>
             <if test="interfaceinfoId != null">interfaceinfo_id = #{interfaceinfoId},</if>
             <if test="interfaceinfoName != null">interfaceinfo_name = #{interfaceinfoName},</if>
+            <if test="deptId != null">dept_id = #{deptId},</if>
+            <if test="deptName != null">dept_name = #{deptName},</if>
             <if test="ipaddress != null">ipaddress = #{ipaddress},</if>
             <if test="os != null">os = #{os},</if>
             <if test="platformInterfacetype != null">platform_interfacetype = #{platformInterfacetype},</if>