张延森 5 years ago
parent
commit
2d9d53d52e

+ 38
- 0
src/main/java/com/huiju/estateagents/common/ExcelUtils.java View File

@@ -0,0 +1,38 @@
1
+package com.huiju.estateagents.common;
2
+
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
6
+import com.huiju.estateagents.excel.ConsultantKPIExport;
7
+import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
8
+
9
+import javax.servlet.http.HttpServletResponse;
10
+import java.io.IOException;
11
+import java.lang.reflect.ParameterizedType;
12
+import java.lang.reflect.Type;
13
+import java.util.List;
14
+
15
+public class ExcelUtils {
16
+
17
+    /**
18
+     * 发送 excel 到客户端
19
+     * 暂时只支持单 sheet 页
20
+     * @param response
21
+     * @param data
22
+     * @param fileName
23
+     * @throws IOException
24
+     */
25
+    public static void flush(HttpServletResponse response, Class dataClass, List data, String fileName) throws IOException {
26
+        response.setContentType("application/octet-stream");
27
+        response.setCharacterEncoding("utf-8");
28
+        response.setHeader("Content-disposition", "attachment;filename="+StringUtils.strToUnicode(fileName)+".xlsx");
29
+
30
+//        ParameterizedType type = (ParameterizedType) data.getClass().getGenericSuperclass();
31
+//        Class dataClass = (Class) type.getActualTypeArguments()[0];
32
+
33
+        ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), dataClass).registerWriteHandler(new CustomCellWriteHandler()).build();
34
+        WriteSheet sheet1 = EasyExcel.writerSheet("sheet1").build();
35
+        excelWriter.write(data, sheet1);
36
+        excelWriter.finish();
37
+    }
38
+}

+ 105
- 0
src/main/java/com/huiju/estateagents/controller/TsActivityDailyController.java View File

@@ -0,0 +1,105 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.DateUtils;
9
+import com.huiju.estateagents.common.ExcelUtils;
10
+import com.huiju.estateagents.common.StringUtils;
11
+import com.huiju.estateagents.excel.ActivityDailyExport;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.*;
16
+import com.huiju.estateagents.service.ITsActivityDailyService;
17
+import com.huiju.estateagents.entity.TsActivityDaily;
18
+
19
+import javax.servlet.http.HttpServletRequest;
20
+import javax.servlet.http.HttpServletResponse;
21
+import java.io.IOException;
22
+import java.util.List;
23
+
24
+/**
25
+ * <p>
26
+    * 活动统计  前端控制器
27
+    * </p>
28
+ *
29
+ * @author yansen
30
+ * @since 2020-04-20
31
+ */
32
+@RestController
33
+@RequestMapping("/api/admin/stats")
34
+public class TsActivityDailyController extends BaseController {
35
+
36
+    private final Logger logger = LoggerFactory.getLogger(TsActivityDailyController.class);
37
+
38
+    @Autowired
39
+    public ITsActivityDailyService iTsActivityDailyService;
40
+
41
+    @GetMapping("/activity/detail")
42
+    public ResponseBean getActivityDetail(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
43
+                                          @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
44
+                                          // startDate 默认格式 YYYY-MM-DD
45
+                                          @RequestParam(value ="startDate", required = false) String startDate,
46
+                                          @RequestParam(value ="endDate", required = false) String endDate,
47
+                                          @RequestParam(value ="buildingId", required = false) String buildingId,
48
+                                          @RequestParam(value ="targetType", required = false) String targetType,
49
+                                          @RequestParam(value ="targetId", required = false) String targetId,
50
+                                          @RequestParam(value ="targetName", required = false) String targetName,
51
+                                          @RequestParam(value ="asc", required = false) String asc,
52
+                                          @RequestParam(value ="desc", required = false) String desc,
53
+                                          HttpServletRequest request) {
54
+
55
+        if (null == startDate || "".equals(startDate)) {
56
+            return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
57
+        }
58
+        if (null == endDate || "".equals(endDate)) {
59
+            endDate = DateUtils.today();
60
+        }
61
+
62
+        Integer orgId = getOrgId(request);
63
+
64
+//        IPage<TsActivityDaily> page = new Page<>(pageNum, pageSize);
65
+//        IPage<TsActivityDaily> result = iTsActivityDailyService.getActivityDetail(page, orgId, startDate, endDate, buildingId, targetType, targetId, targetName, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
66
+        List<TsActivityDaily>  result = iTsActivityDailyService.getActivityDetail(orgId, startDate, endDate, buildingId, targetType, targetId, targetName, StringUtils.humpToLine(asc), StringUtils.humpToLine(desc));
67
+
68
+        return ResponseBean.success(result);
69
+    }
70
+
71
+    @PostMapping("/activity/detail")
72
+    public ResponseBean getActivityDetail(// startDate 默认格式 YYYY-MM-DD
73
+                                          @RequestParam(value ="startDate", required = false) String startDate,
74
+                                          @RequestParam(value ="endDate", required = false) String endDate,
75
+                                          @RequestParam(value ="buildingId", required = false) String buildingId,
76
+                                          @RequestParam(value ="targetType", required = false) String targetType,
77
+                                          @RequestParam(value ="targetId", required = false) String targetId,
78
+                                          @RequestParam(value ="targetName", required = false) String targetName,
79
+                                          HttpServletRequest request,
80
+                                          HttpServletResponse response) {
81
+
82
+        if (null == startDate || "".equals(startDate)) {
83
+            return ResponseBean.error("开始日期不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
84
+        }
85
+        if (null == endDate || "".equals(endDate)) {
86
+            endDate = DateUtils.today();
87
+        }
88
+        if (null == targetType || "".equals(targetType) || null == targetId || "".equals(targetId)) {
89
+            return ResponseBean.error("活动类型或者ID 不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
90
+        }
91
+
92
+        Integer orgId = getOrgId(request);
93
+        List<ActivityDailyExport> result = iTsActivityDailyService.getActivityExport(orgId, startDate, endDate, buildingId, targetType, targetId);
94
+
95
+        try {
96
+            ExcelUtils.flush(response, ActivityDailyExport.class, result, StringUtils.strToUnicode(targetName + "活动统计"));
97
+        } catch (IOException e) {
98
+//            e.printStackTrace();
99
+            return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
100
+        }
101
+
102
+        return null;
103
+    }
104
+
105
+}

+ 11
- 16
src/main/java/com/huiju/estateagents/controller/TsConsultantKpiController.java View File

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9 9
 import com.huiju.estateagents.base.BaseController;
10 10
 import com.huiju.estateagents.base.ResponseBean;
11 11
 import com.huiju.estateagents.common.DateUtils;
12
+import com.huiju.estateagents.common.ExcelUtils;
12 13
 import com.huiju.estateagents.common.StringUtils;
13 14
 import com.huiju.estateagents.entity.*;
14 15
 import com.huiju.estateagents.excel.ConsultantKPIExport;
@@ -116,19 +117,13 @@ public class TsConsultantKpiController extends BaseController {
116 117
 
117 118
         Integer orgId = getOrgId(request);
118 119
         try {
119
-            response.setContentType("application/octet-stream");
120
-            response.setCharacterEncoding("utf-8");
121
-            response.setHeader("Content-disposition", "attachment;filename="+StringUtils.strToUnicode("置业顾问KPI统计")+DateUtils.today()+".xlsx");
122 120
 
123 121
             // 汇总明细
124 122
             List<ConsultantKPIExport> result = iTsConsultantKpiService.stsKPIDailyExport(orgId, buildingId, startDate, endDate);
125
-            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), ConsultantKPIExport.class).registerWriteHandler(new CustomCellWriteHandler()).build();
126
-            WriteSheet sheet1 = EasyExcel.writerSheet("sheet1").build();
127
-            excelWriter.write(result, sheet1);
128
-            excelWriter.finish();
123
+            ExcelUtils.flush(response, ConsultantKPIExport.class, result, "置业顾问KPI统计" + DateUtils.today());
129 124
         } catch (Exception e){
130 125
 //            e.printStackTrace();
131
-            return ResponseBean.error("查询出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
126
+            return ResponseBean.error("导出Excel出错, 请重试 : " + e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
132 127
         }
133 128
 
134 129
         return null;
@@ -429,16 +424,16 @@ public class TsConsultantKpiController extends BaseController {
429 424
      */
430 425
     @GetMapping("/consultant/share/times")
431 426
     public ResponseBean getConsultantShareTimes(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
432
-                                                  @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
433
-                                                  @RequestParam(value ="buildingId", required = false) String buildingId,
434
-                                                  @RequestParam(value ="userId") String userId,
435
-                                                  @RequestParam(value ="startDate", required = false) String startDate,
436
-                                                  @RequestParam(value ="endDate", required = false) String endDate,
437
-                                                  @RequestParam(value ="targetType", required = false) String targetType,
438
-                                                  @RequestParam(value ="targetName", required = false) String targetName,
427
+                                                @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
428
+                                                @RequestParam(value ="buildingId", required = false) String buildingId,
429
+                                                @RequestParam(value ="userId") String userId,
430
+                                                @RequestParam(value ="startDate", required = false) String startDate,
431
+                                                @RequestParam(value ="endDate", required = false) String endDate,
432
+                                                @RequestParam(value ="targetType", required = false) String targetType,
433
+                                                @RequestParam(value ="targetName", required = false) String targetName,
439 434
                                                 @RequestParam(value ="userName", required = false) String userName,
440 435
                                                 @RequestParam(value ="personId", required = false) String personId,
441
-                                                  HttpServletRequest request) {
436
+                                                HttpServletRequest request) {
442 437
         LocalDateTime[] dateRange = {null, null};
443 438
         try {
444 439
             dateRange = getLocalTimeRangeBy(startDate, endDate);

+ 3
- 0
src/main/java/com/huiju/estateagents/entity/TaPerson.java View File

@@ -316,15 +316,18 @@ public class TaPerson implements Serializable {
316 316
     /**
317 317
      * 访问内容类型
318 318
      */
319
+    @TableField(exist = false)
319 320
     private String targetType;
320 321
 
321 322
     /**
322 323
      * 访问内容ID
323 324
      */
325
+    @TableField(exist = false)
324 326
     private String targetId;
325 327
 
326 328
     /**
327 329
      * 访问内容名称
328 330
      */
331
+    @TableField(exist = false)
329 332
     private String targetName;
330 333
 }

+ 97
- 0
src/main/java/com/huiju/estateagents/entity/TsActivityDaily.java View File

@@ -0,0 +1,97 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import java.io.Serializable;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+/**
11
+ * <p>
12
+ * 活动统计 
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2020-04-20
17
+ */
18
+@Data
19
+@EqualsAndHashCode(callSuper = false)
20
+@Accessors(chain = true)
21
+public class TsActivityDaily implements Serializable {
22
+
23
+    private static final long serialVersionUID = 1L;
24
+
25
+    /**
26
+     * 序号
27
+     */
28
+    @TableId(value = "serial_no", type = IdType.AUTO)
29
+    private Integer serialNo;
30
+
31
+    /**
32
+     * 统计时间
33
+     */
34
+    private String statisDate;
35
+
36
+    /**
37
+     * 公司id
38
+     */
39
+    private Integer orgId;
40
+
41
+    /**
42
+     * 楼盘id
43
+     */
44
+    private String buildingId;
45
+
46
+    /**
47
+     * 楼盘名称
48
+     */
49
+    private String buildingName;
50
+
51
+    /**
52
+     * 活动类型
53
+     */
54
+    private String targetType;
55
+
56
+    /**
57
+     * 活动ID
58
+     */
59
+    private String targetId;
60
+
61
+    /**
62
+     * 活动名称
63
+     */
64
+    private String targetName;
65
+
66
+    /**
67
+     * 分享次数
68
+     */
69
+    private Integer shareNum;
70
+
71
+    /**
72
+     * 分享人数
73
+     */
74
+    private Integer sharePersons;
75
+
76
+    /**
77
+     * 访问次数
78
+     */
79
+    private Integer visitNum;
80
+
81
+    /**
82
+     * 访问人数
83
+     */
84
+    private Integer visitPersons;
85
+
86
+    /**
87
+     * 新增用户
88
+     */
89
+    private Integer newPersons;
90
+
91
+    /**
92
+     * 新增客户
93
+     */
94
+    private Integer newCustomers;
95
+
96
+
97
+}

+ 48
- 0
src/main/java/com/huiju/estateagents/excel/ActivityDailyExport.java View File

@@ -0,0 +1,48 @@
1
+package com.huiju.estateagents.excel;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import lombok.Data;
5
+
6
+@Data
7
+public class ActivityDailyExport {
8
+
9
+    /**
10
+     * 统计时间
11
+     */
12
+    @ExcelProperty(value = "日期", index = 1)
13
+    private String statisDate;
14
+
15
+
16
+    @ExcelProperty(value = "分享标题", index = 0)
17
+    private String targetName;
18
+
19
+    /**
20
+     * 分享次数
21
+     */
22
+    @ExcelProperty(value = "分享次数", index = 3)
23
+    private Integer shareNum;
24
+
25
+    /**
26
+     * 分享人数
27
+     */
28
+    @ExcelProperty(value = "分享人数", index = 2)
29
+    private Integer sharePersons;
30
+
31
+    /**
32
+     * 访问次数
33
+     */
34
+    @ExcelProperty(value = "访问次数", index = 5)
35
+    private Integer visitNum;
36
+
37
+    /**
38
+     * 访问人数
39
+     */
40
+    @ExcelProperty(value = "访问人数", index = 4)
41
+    private Integer visitPersons;
42
+
43
+    /**
44
+     * 新增客户
45
+     */
46
+    @ExcelProperty(value = "新增注册用户", index = 6)
47
+    private Integer newCustomers;
48
+}

+ 64
- 0
src/main/java/com/huiju/estateagents/mapper/TsActivityDailyMapper.java View File

@@ -0,0 +1,64 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TsActivityDaily;
5
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
6
+import com.huiju.estateagents.excel.ActivityDailyExport;
7
+import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.List;
11
+
12
+/**
13
+ * <p>
14
+ * 活动统计  Mapper 接口
15
+ * </p>
16
+ *
17
+ * @author yansen
18
+ * @since 2020-04-20
19
+ */
20
+@Mapper
21
+public interface TsActivityDailyMapper extends BaseMapper<TsActivityDaily> {
22
+
23
+    /**
24
+     * 按天汇总活动统计信息
25
+     * @param orgId
26
+     * @param startDate
27
+     * @param endDate
28
+     * @param buildingId
29
+     * @param targetType
30
+     * @param targetId
31
+     * @param targetName
32
+     * @param asc
33
+     * @param desc
34
+     * @return
35
+     */
36
+    List<TsActivityDaily> getActivityDetail(@Param("orgId") Integer orgId,
37
+                                             @Param("startDate") String startDate,
38
+                                             @Param("endDate") String endDate,
39
+                                             @Param("buildingId") String buildingId,
40
+                                             @Param("targetType") String targetType,
41
+                                             @Param("targetId") String targetId,
42
+                                             @Param("targetName") String targetName,
43
+                                             @Param("asc") String asc,
44
+                                             @Param("desc") String desc);
45
+
46
+    /**
47
+     * 活动统计详情导出
48
+     * @param orgId
49
+     * @param startDate
50
+     * @param endDate
51
+     * @param buildingId
52
+     * @param targetType
53
+     * @param targetIdd
54
+     * @return
55
+     */
56
+    List<ActivityDailyExport> getActivityExport(@Param("orgId") Integer orgId,
57
+                                                @Param("startDate") String startDate,
58
+                                                @Param("endDate") String endDate,
59
+                                                @Param("buildingId") String buildingId,
60
+                                                @Param("targetType") String targetType,
61
+                                                @Param("targetId") String targetIdd);
62
+
63
+
64
+}

+ 23
- 0
src/main/java/com/huiju/estateagents/service/ITsActivityDailyService.java View File

@@ -0,0 +1,23 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.entity.TsActivityDaily;
5
+import com.baomidou.mybatisplus.extension.service.IService;
6
+import com.huiju.estateagents.excel.ActivityDailyExport;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 活动统计  服务类
13
+ * </p>
14
+ *
15
+ * @author yansen
16
+ * @since 2020-04-20
17
+ */
18
+public interface ITsActivityDailyService extends IService<TsActivityDaily> {
19
+
20
+    List<TsActivityDaily> getActivityDetail(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId, String targetName, String asc, String desc);
21
+
22
+    List<ActivityDailyExport> getActivityExport(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId);
23
+}

+ 41
- 0
src/main/java/com/huiju/estateagents/service/impl/TsActivityDailyServiceImpl.java View File

@@ -0,0 +1,41 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.huiju.estateagents.common.StringUtils;
5
+import com.huiju.estateagents.entity.TsActivityDaily;
6
+import com.huiju.estateagents.excel.ActivityDailyExport;
7
+import com.huiju.estateagents.mapper.TsActivityDailyMapper;
8
+import com.huiju.estateagents.service.ITsActivityDailyService;
9
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.stereotype.Service;
12
+
13
+import java.util.List;
14
+
15
+/**
16
+ * <p>
17
+ * 活动统计  服务实现类
18
+ * </p>
19
+ *
20
+ * @author yansen
21
+ * @since 2020-04-20
22
+ */
23
+@Service
24
+public class TsActivityDailyServiceImpl extends ServiceImpl<TsActivityDailyMapper, TsActivityDaily> implements ITsActivityDailyService {
25
+    @Autowired
26
+    private TsActivityDailyMapper tsActivityDailyMapper;
27
+
28
+    @Override
29
+    public List<TsActivityDaily> getActivityDetail(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId, String targetName, String asc, String desc) {
30
+        if (StringUtils.isEmpty(asc) && StringUtils.isEmpty(desc)) {
31
+            desc = "statis_date";
32
+        }
33
+
34
+        return tsActivityDailyMapper.getActivityDetail(orgId, startDate, endDate, buildingId, targetType, targetId, targetName, asc, desc);
35
+    }
36
+
37
+    @Override
38
+    public List<ActivityDailyExport> getActivityExport(Integer orgId, String startDate, String endDate, String buildingId, String targetType, String targetId) {
39
+        return tsActivityDailyMapper.getActivityExport(orgId, startDate, endDate, buildingId, targetType, targetId);
40
+    }
41
+}

+ 74
- 0
src/main/resources/mapper/TsActivityDailyMapper.xml View File

@@ -0,0 +1,74 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.huiju.estateagents.mapper.TsActivityDailyMapper">
4
+
5
+    <select id="getActivityDetail" resultType="com.huiju.estateagents.entity.TsActivityDaily">
6
+        SELECT
7
+            t.statis_date,
8
+            SUM(t.share_num) as share_num,
9
+            SUM(t.share_persons) as share_persons,
10
+            SUM(t.visit_num) as visit_num,
11
+            SUM(t.visit_persons) as visit_persons,
12
+            SUM(t.new_persons) as new_persons,
13
+            SUM(t.new_customers) as new_customers
14
+        FROM
15
+            ts_activity_daily t
16
+        WHERE
17
+            t.org_id = #{orgId}
18
+            AND t.statis_date BETWEEN #{startDate} AND #{endDate}
19
+
20
+        <if test="buildingId != null and buildingId != ''">
21
+            AND t.building_id = #{buildingId}
22
+        </if>
23
+
24
+        <if test="targetType != null and targetType != ''">
25
+            AND t.target_type = #{targetType}
26
+        </if>
27
+
28
+        <if test="targetId != null and targetId != ''">
29
+            AND t.target_id = #{targetId}
30
+        </if>
31
+
32
+        <if test="targetName != null and targetName != ''">
33
+            AND t.target_name like CONCAT('%', #{targetName}, '%')
34
+        </if>
35
+
36
+        GROUP BY t.statis_date
37
+
38
+        <if test="asc != null and asc != ''">
39
+            ORDER BY ${asc} ASC
40
+        </if>
41
+        <if test="desc != null and desc != ''">
42
+            ORDER BY ${desc} DESC
43
+        </if>
44
+    </select>
45
+
46
+    <select id="getActivityExport" resultType="com.huiju.estateagents.excel.ActivityDailyExport">
47
+        SELECT
48
+            t.statis_date,
49
+            t.target_type,
50
+            t.target_id,
51
+            t.target_name,
52
+            SUM(t.share_num) as share_num,
53
+            SUM(t.share_persons) as share_persons,
54
+            SUM(t.visit_num) as visit_num,
55
+            SUM(t.visit_persons) as visit_persons,
56
+            SUM(t.new_persons) as new_persons,
57
+            SUM(t.new_customers) as new_customers
58
+        FROM
59
+            ts_activity_daily t
60
+        WHERE
61
+            t.org_id = #{orgId}
62
+            AND t.statis_date BETWEEN #{startDate} AND #{endDate}
63
+
64
+        <if test="buildingId != null and buildingId != ''">
65
+            AND t.building_id = #{buildingId}
66
+        </if>
67
+
68
+        AND t.target_type = #{targetType}
69
+        AND t.target_id = #{targetId}
70
+
71
+        GROUP BY t.statis_date, t.target_type, t.target_id
72
+        ORDER BY t.statis_date DESC
73
+    </select>
74
+</mapper>

+ 3
- 2
src/main/resources/mapper/TsConsultantKpiMapper.xml View File

@@ -326,14 +326,15 @@
326 326
         <!-- 没有设置 targetType 查询条件, 则只查询固定的几个 -->
327 327
         <if test="targetType == null or targetType ==''">
328 328
             AND (
329
-            e.target_type IN ( 'building_share', 'dynamic_share', 'group_share', 'h5_share', 'help_share', 'house_share', 'live_share', 'news_share' )
329
+            e.target_type IN ( 'building_share', 'dynamic_share', 'group_share', 'h5_share', 'help_share', 'house_share', 'live_share', 'news_share', 'poster' )
330 330
             OR ( e.target_type = 'share' AND e.target_id = 'index' )
331 331
             )
332 332
         </if>
333 333
         <if test="targetType != null and targetType !=''">
334
-            AND e.target_type = 'share'
334
+            AND e.target_type = #{targetType}
335 335
         </if>
336 336
         <if test="targetType != null and targetType =='share'">
337
+            AND e.target_type = 'share'
337 338
             AND e.target_id = 'index'
338 339
         </if>
339 340