Browse Source

作者:张哲
时间:2023/05/22
类型:优化
描述:里程碑(1) bug修改

zizg 1 year ago
parent
commit
a6b02b0ec1

+ 8 - 1
src/main/java/com/redxun/knowledge/controller/KnowledgeController.java

@@ -119,9 +119,16 @@ public class KnowledgeController extends BaseController<Knowledge> {
     @GetMapping("info")
     public JsonResult info(@RequestParam(value = "pkId") String pkId,
                            @RequestParam(value = "isPc", required = false) Integer flag) {
-        KnowledgeVo knowledgeVo = knowledgeService.info(pkId, flag);
         JsonResult jsonResult;
         jsonResult = JsonResult.getSuccessResult("");
+        KnowledgeVo knowledgeVo = null;
+        try {
+            knowledgeVo = knowledgeService.info(pkId, flag);
+        } catch (Exception e) {
+            jsonResult.setMessage(e.getMessage());
+            jsonResult.setSuccess(false);
+            return jsonResult;
+        }
         if (knowledgeVo == null) {
             // 知识不存在或者没有权限
             jsonResult.setMessage("您查看的知识不存在或您没有访问权限");

+ 4 - 0
src/main/java/com/redxun/knowledge/service/KnowledgeServiceImpl.java

@@ -213,6 +213,10 @@ public class KnowledgeServiceImpl extends SuperServiceImpl<KnowledgeMapper, Know
             return null;
         }
 
+        if (flag != null && flag == 1 && knowledge.getApprovalStatus() != 5 && !knowledge.getCreateBy().equals(userService.queryLoginUser())){
+            throw new RuntimeException("您查看的知识还未完成审核流程!");
+        }
+
         KnowledgeVo knowledgeVo = new KnowledgeVo();
         if (knowledge != null) {
             knowledgeVo.setPkId(knowledge.getPkId());

+ 4 - 5
src/main/java/com/redxun/search/service/impl/SearchServiceImpl.java

@@ -16,6 +16,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
@@ -38,14 +39,12 @@ import java.util.stream.Stream;
  */
 @Slf4j
 @Service
+@RefreshScope
 public class SearchServiceImpl implements SearchService {
 
     @Value("${search.url}")
     private String searchUrl; //测试环境搜索服务地址
 
-    @Value("${search.fetch.url}")
-    private String searchFetchUrl; //正式环境搜索平台地址
-
     @Autowired
     private UserService userService;
 
@@ -82,7 +81,7 @@ public class SearchServiceImpl implements SearchService {
         String userId = userService.queryLoginUser();
         headerMap.put("userId", userId);
         //发送搜索请求
-        JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchFetchUrl + "/api-kmsearch/search/search");
+        JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchUrl + "/api-kmsearch/search/search");
         if (null != respone && 200 == respone.getIntValue("code")) {
             result.put("code", respone.getIntValue("code"));
             result.put("message", respone.getString("message"));
@@ -160,7 +159,7 @@ public class SearchServiceImpl implements SearchService {
         headerMap.put("signature", sign);
         headerMap.put("businessKey", httpServletRequest.getHeader("businessKey"));
         headerMap.put("userId", userService.queryLoginUser());
-        JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchFetchUrl + "/api-kmsearch/search/view");
+        JSONObject respone = HttpRequestHelper.sendRequest(headerMap, paramMap, searchUrl + "/api-kmsearch/search/view");
         if (null != respone && 200 == respone.getIntValue("code")) {
             result.put("code", respone.getIntValue("code"));
             result.put("message", respone.getString("message"));

+ 6 - 27
src/main/resources/mapper/knowledge/analysis/AnalysisSynthesizeMapper.xml

@@ -117,9 +117,8 @@
     <select id="moduleUserUniqueVisits" resultType="com.redxun.knowledge.analysis.entity.vo.AlbumDetailVisitsVo">
         select MODULE as name, count (*) as value, round(count (*) / sum (count (*)) over (), 2) percentage from (
         select distinct
-        module, sub_module, user_id, company_id, page, platform, ussd, company_id_,
-        create_dep_id_, tenant_id_, create_by_, to_char(create_time_,'yyyy-mm-dd') as createTime, update_by_,
-        to_char(update_time_,'yyyy-mm-dd') as updateTime
+        module, user_id,
+        to_char(create_time_,'yyyy-mm-dd') as createTime
         from KM_PV_LOG)
         <where>
             <if test="firstDay != null and lastDay != null">
@@ -161,6 +160,7 @@
             <if test="module != null">
                 and MODULE = #{module}
             </if>
+            and MODULE != '其他'
         </where>
         <if test="firstDay == null and lastDay == null">
             group by to_char(CREATE_TIME_, 'yyyy-mm')
@@ -189,19 +189,8 @@
         ,count(*) count
         from (
         select distinct module,
-        sub_module,
         user_id,
-        company_id,
-        page,
-        platform,
-        ussd,
-        company_id_,
-        create_dep_id_,
-        tenant_id_,
-        create_by_,
-        to_char(create_time_, 'yyyy-mm-dd') as createTime,
-        update_by_,
-        to_char(update_time_, 'yyyy-mm-dd') as updateTime
+        to_char(create_time_, 'yyyy-mm-dd') as createTime
         from KM_PV_LOG
         <where>
             <if test="firstDay != null and lastDay != null">
@@ -211,6 +200,7 @@
             <if test="module != null">
                 and MODULE = #{module}
             </if>
+            and MODULE != '其他'
         </where>
         )
         group by createTime)
@@ -326,19 +316,8 @@
         from (select to_char(to_date(createTime, 'yyyy-MM-dd'), 'mm"月"dd"日"') name,
         count(*) count
         from (select distinct module,
-        sub_module,
         user_id,
-        company_id,
-        page,
-        platform,
-        ussd,
-        company_id_,
-        create_dep_id_,
-        tenant_id_,
-        create_by_,
-        to_char(create_time_, 'yyyy-mm-dd') as createTime,
-        update_by_,
-        to_char(update_time_, 'yyyy-mm-dd') as updateTime
+        to_char(create_time_, 'yyyy-mm-dd') as createTime
         from KM_PV_LOG
         WHERE TO_CHAR(CREATE_TIME_, 'yyyy-mm-dd') &gt;= #{firstDay}
         and TO_CHAR(CREATE_TIME_, 'yyyy-mm-dd') &lt;= #{lastDay}

+ 1 - 1
src/main/resources/mapper/knowledge/analysis/PvLogMapper.xml

@@ -78,7 +78,7 @@
         from KM_PV_LOG
         where to_char(CREATE_TIME_, 'yyyy-mm') &lt;= #{lastDay}
         and to_char(CREATE_TIME_, 'yyyy-mm') &gt;= #{firstDay}
-        and SUB_MODULE = '详情'
+        and SUB_MODULE = '详情' and MODULE = '搜索服务'
         group by to_char(CREATE_TIME_, 'yyyy-mm'), PLATFORM
         ) t1
         right join (SELECT TO_CHAR(ADD_MONTHS(TO_DATE(#{firstDay}, 'yyyy-MM'), ROWNUM - 1),