Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java
yh 6 hari lalu
induk
melakukan
b76157c265

+ 22 - 0
fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java

@@ -13,6 +13,7 @@ import com.fs.statis.StatisticsRedisConstant;
 import com.fs.statis.dto.*;
 import com.fs.statis.param.StatisticsDeptCompanyParam;
 import com.fs.statis.service.IStatisticsService;
+import com.fs.statis.service.impl.StatisticsCompanyServiceImpl;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.service.ISysConfigService;
 import com.fs.system.service.ISysDeptService;
@@ -56,6 +57,9 @@ public class IndexStatisticsController {
 
     @Autowired
     private IStatisticsService statisticsService;
+    @Autowired
+    private StatisticsCompanyServiceImpl statisticsCompanyService;
+
     /**
      * 分析概览
      */
@@ -72,6 +76,9 @@ public class IndexStatisticsController {
         if(userType == null) {
             userType = 0;
         }
+        if(param.getType().equals(5)){
+            return R.ok().put("data",statisticsService.analysisPreview(param));
+        }
         if(medicalMallConfig.isStatics()|| (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType));
         }else if(param.getCompanyId() != null){
@@ -255,6 +262,9 @@ public class IndexStatisticsController {
             userType = 0;
         }
         List<WatchEndPlayTrendDTO> watchEndPlayTrendDTOS;
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsCompanyService.watchEndPlayTrend(param));
+        }
         // 参考watchCourseTopTen方法的处理逻辑
         if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType);
@@ -339,6 +349,9 @@ public class IndexStatisticsController {
             userType = 0;
         }
         List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = new ArrayList<>();
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.deaMemberTopTen(param));
+        }
         // 参考deaMemberTopTen方法处理逻辑
         if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType);
@@ -396,6 +409,9 @@ public class IndexStatisticsController {
         Integer dataType = param.getDataType();
         Integer userType = param.getUserType();
         List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = new ArrayList<>();
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.rewardMoneyTopTen(param));
+        }
         // 参考rewardMoneyTopTen方法处理逻辑
         if(!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType);
@@ -450,6 +466,9 @@ public class IndexStatisticsController {
         Integer type = param.getType();
         Integer userType = param.getUserType();
         List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = new ArrayList<>();
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.rewardMoneyTrendDTO(param));
+        }
         // 参考rewardMoneyTrend方法处理逻辑
         if(!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType);
@@ -503,6 +522,9 @@ public class IndexStatisticsController {
         Integer statisticalType = param.getStatisticalType();
         Integer userType = param.getUserType();
         List<CourseStatsDTO> courseStatsDTOS;
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsCompanyService.watchCourseTopTen(param));
+        }
         if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort));
         }else if(param.getCompanyId() != null){

+ 24 - 5
fs-company/src/main/java/com/fs/company/controller/company/IndexStatisticsController.java

@@ -11,6 +11,7 @@ import com.fs.framework.service.TokenService;
 import com.fs.statis.StatisticsRedisConstant;
 import com.fs.statis.dto.*;
 import com.fs.statis.service.IStatisticsService;
+import com.fs.statis.service.impl.StatisticsCompanyServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -42,6 +43,9 @@ public class IndexStatisticsController {
 
     @Autowired
     CloudHostProper cloudHostProper;
+    @Autowired
+    private StatisticsCompanyServiceImpl statisticsCompanyService;
+
     /**
      * 分析概览
      */
@@ -60,7 +64,11 @@ public class IndexStatisticsController {
         }
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId(loginUser.getCompany().getCompanyId());
-        analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
+        if (param.getType().equals(5)){// 指定日期直接查,不走缓存
+            return R.ok().put("data",statisticsCompanyService.analysisPreview(param));
+        }else {
+            analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
+        }
 
         return R.ok().put("data",analysisPreviewDTO);
     }
@@ -179,7 +187,9 @@ public class IndexStatisticsController {
         }else{
             Long companyId = loginUser.getCompany().getCompanyId();
             param.setCompanyId(companyId);
-
+            if (param.getType().equals(5)){
+                return R.ok().put("data", statisticsCompanyService.watchEndPlayTrend(param));
+            }
             String key = String.format("%s:%d:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType,param.getCompanyId());
             List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(key);
             return R.ok().put("data", deaMemberTopTenDTOS);
@@ -204,7 +214,9 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.deaMemberTopTen(param));
+        }
         List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType,param.getCompanyId()));
         if(deaMemberTopTenDTOS == null){
             deaMemberTopTenDTOS = new ArrayList<>();
@@ -223,7 +235,9 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
+        if (param.getType().equals(5)){
+            R.ok().put("data", statisticsCompanyService.rewardMoneyTopTen(param));
+        }
         List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,param.getCompanyId()));
         return R.ok().put("data", rewardMoneyTopTenDTOS);
     }
@@ -238,7 +252,9 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsCompanyService.rewardMoneyTrendDTO(param));
+        }
         List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType,param.getCompanyId()));
         return R.ok().put("data", rewardMoneyTrendDTOS);
     }
@@ -256,6 +272,9 @@ public class IndexStatisticsController {
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
 
+        if (param.getType().equals(5)){
+            return R.ok().put("data",statisticsService.watchCourseTopTen(param));
+        }
         List<CourseStatsDTO> courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%s:%d", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort,param.getCompanyId()));
         return R.ok().put("data", courseStatsDTOS);
     }

+ 6 - 20
fs-service/src/main/java/com/fs/gtPush/service/impl/uniPush2ServiceImpl.java

@@ -2,7 +2,6 @@ package com.fs.gtPush.service.impl;
 
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONUtil;
-import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -15,14 +14,12 @@ import com.fs.gtPush.domain.UniPushLog;
 import com.fs.gtPush.service.UniPushLogService;
 import com.fs.gtPush.service.uniPush2Service;
 import com.fs.im.service.OpenIMService;
-import com.fs.system.domain.SysConfig;
-import com.fs.system.service.ISysConfigService;
-import com.qiniu.util.Json;
 import org.springframework.beans.factory.annotation.Autowired;
 import com.fs.gtPush.utils.PushUtils;
 import com.fs.his.domain.FsUser;
 import com.fs.his.service.IFsUserService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
@@ -32,33 +29,22 @@ import java.util.Map;
 public class uniPush2ServiceImpl implements uniPush2Service {
     @Autowired
     private OpenIMService openIMService;
-    private static final String url = "https://fc-mp-de6e03a9-c1a3-439b-9eec-d0dc3c565e4e.next.bspapp.com/push";
+//    private static final String url = "https://fc-mp-de6e03a9-c1a3-439b-9eec-d0dc3c565e4e.next.bspapp.com/push";
+
+    @Value("${openIM.pushUrl}")
+    private String openIMpushUrl;
 
     @Autowired
     private IFsUserService userService;
 
     @Autowired
     private UniPushLogService logService;
-    @Autowired
-    private ISysConfigService iSysConfigService;
 
     @Override
     public PushResult pushMessage(PushReqBean push) {
-        SysConfig config = iSysConfigService.selectConfigByConfigKey("his.config");
-        if (config == null || StringUtils.isBlank(config.getConfigValue())) {
-            throw new RuntimeException("his.config 配置不存在");
-        }
-
-        JSONObject json = JSON.parseObject(config.getConfigValue());
-        String url = json.getString("appPushUrl");
-        if (StringUtils.isBlank(url)) {
-            throw new RuntimeException("his.config 中未配置 appPushUrl");
-        }
-
-        String result = HttpUtil.post(url, push.toString());
+        String result = HttpUtil.post(openIMpushUrl, push.toString());
         PushResult pushResult = JSONUtil.toBean(result, PushResult.class);
         return pushResult;
-
     }
     @Override
     public void pushSopAppLinkMsgByExternalIM(String cropId, String linkTile, String linkDescribe,String linkImageUrl, String link, Long companyUserId,Long fsUserId) throws JsonProcessingException {

+ 1 - 1
fs-service/src/main/java/com/fs/statis/dto/AnalysisPreviewQueryDTO.java

@@ -10,7 +10,7 @@ import java.io.Serializable;
 public class AnalysisPreviewQueryDTO implements Serializable {
 
     /**
-     * 0 今日,1昨日,2本周,3本月,4上月
+     * 0 今日,1昨日,2本周,3本月,4上月,5指定日期(不走缓存,直接查)
      */
     private Integer type;
 

+ 7 - 0
fs-service/src/main/java/com/fs/statis/service/impl/StatisticsServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fs.statis.service.impl;
 
+import cn.hutool.core.map.MapUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.fs.common.constant.FsConstants;
 import com.fs.common.core.domain.R;
@@ -1107,6 +1108,12 @@ public class StatisticsServiceImpl implements IStatisticsService {
     @Override
     public List<WatchCourseStatisticsResultDTO> getWatchCourseStatisticsData(AnalysisPreviewQueryDTO param) {
 
+        if (param.getType().equals(5)){
+            HashMap<String, Object> map = MapUtil.newHashMap();
+            map.put("startTime", param.getStartTime());
+            map.put("endTime", param.getEndTime());
+            return fsCourseWatchLogMapper.watchCourseStatisticsGroupByCompany(map);
+        }
         String redisData = redisCache.getCacheObject(FsConstants.WATCH_COURSE_STATISTICS_GROUP_COMPANY + param.getType());
         List<WatchCourseStatisticsResultDTO> watchCourseStatisticsDTOS = new ArrayList<>();
         if (StringUtils.isNotBlank(redisData)) {

+ 1 - 0
fs-service/src/main/resources/application-druid-sxjz.yml

@@ -165,6 +165,7 @@ openIM:
     secret: openIM123
     userID: imAdmin
     url: https://web.im.xianhthj.cn/api
+    pushUrl: https://fc-mp-d0421385-3496-42e7-b67f-59161a36a0e4.next.bspapp.com/push
 #是否使用新im
 im:
     type: OPENIM

+ 3 - 3
fs-service/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml

@@ -174,7 +174,7 @@
                 DATE_FORMAT(create_time, '%H') AS start_date,
             </when>
             <!-- 按天分组 -->
-            <when test="type == 2 or type == 3 or type == 4">
+            <when test="type == 2 or type == 3 or type == 4 or type == 5">
                 DATE_FORMAT(create_time, '%Y-%m-%d') AS start_date,
             </when>
         </choose>
@@ -196,7 +196,7 @@
         GROUP BY
         <choose>
             <when test="type == 0 or type == 1">DATE_FORMAT(create_time, '%H')</when>
-            <when test="type == 2 or type == 3 or type == 4">DATE_FORMAT(create_time, '%Y-%m-%d')</when>
+            <when test="type == 2 or type == 3 or type == 4 or type == 5">DATE_FORMAT(create_time, '%Y-%m-%d')</when>
         </choose>
         ORDER BY
         start_date
@@ -447,7 +447,7 @@
             DATE_FORMAT(rpl.create_time, '%H') AS start_date,
         </if>
         --                 本周/本月/上月 天
-        <if test="type == 2 or type == 3 or type == 4">
+        <if test="type == 2 or type == 3 or type == 4 or type == 5">
             DATE_FORMAT(rpl.create_time, '%Y-%m-%d') AS start_date,
         </if>
             SUM(rpl.amount) as rewardMoney