傅行帆 5 年之前
父節點
當前提交
80451c1a33

+ 3
- 1
src/main/java/com/huiju/estateagents/controller/TaChannelController.java 查看文件

266
                                                      @RequestParam(value = "targetType", required = false)String targetType,
266
                                                      @RequestParam(value = "targetType", required = false)String targetType,
267
                                                      @RequestParam(value = "buildingId", required = false)String buildingId,
267
                                                      @RequestParam(value = "buildingId", required = false)String buildingId,
268
                                                      @RequestParam(value = "channelId") Integer channelId,
268
                                                      @RequestParam(value = "channelId") Integer channelId,
269
+                                                     @RequestParam(value = "sortField", required = false) String sortField,
270
+                                                     @RequestParam(value = "sortOrder", required = false) String sortOrder,
269
                                                      HttpServletRequest request) {
271
                                                      HttpServletRequest request) {
270
-        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, targetType, buildingId, channelId);
272
+        return taChannelService.getChannelIntroductionList(pageNum, pageSize, getOrgId(request), startDate, endDate, targetType, buildingId, channelId,sortField,sortOrder);
271
     }
273
     }
272
 
274
 
273
     /**
275
     /**

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java 查看文件

56
      * @param buildingId
56
      * @param buildingId
57
      * @return
57
      * @return
58
      */
58
      */
59
-    IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId);
59
+    IPage<TsActivityDaily> getChannelIntroductionList(IPage<TsActivityDaily> pg,@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("channelType") String channelType,@Param("buildingId") String buildingId,@Param("channelId") Integer channelId,@Param("sortField") String sortField,@Param("orderType") String orderType);
60
 
60
 
61
     IPage<ChannelAddRegistNum> getChannelNewuserList(IPage<ChannelAddRegistNum> iPage, @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId);
61
     IPage<ChannelAddRegistNum> getChannelNewuserList(IPage<ChannelAddRegistNum> iPage, @Param("orgId") Integer orgId, @Param("channelId") Integer channelId, @Param("activityId") String activityId, @Param("activityType") String activityType, @Param("buildingId") String buildingId);
62
 
62
 

+ 1
- 1
src/main/java/com/huiju/estateagents/service/TaChannelService.java 查看文件

32
      * @param buildingId
32
      * @param buildingId
33
      * @return
33
      * @return
34
      */
34
      */
35
-    ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId);
35
+    ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId,String sortField,String sortOrder);
36
 
36
 
37
     /**
37
     /**
38
      * 获取注册用户列表
38
      * 获取注册用户列表

+ 13
- 2
src/main/java/com/huiju/estateagents/service/impl/TaChannelServiceImpl.java 查看文件

4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
 import com.huiju.estateagents.base.ResponseBean;
6
 import com.huiju.estateagents.base.ResponseBean;
7
+import com.huiju.estateagents.common.StringUtils;
7
 import com.huiju.estateagents.entity.TaChannel;
8
 import com.huiju.estateagents.entity.TaChannel;
8
 import com.huiju.estateagents.entity.TsActivityDaily;
9
 import com.huiju.estateagents.entity.TsActivityDaily;
9
 import com.huiju.estateagents.excel.ActivityStatistics.*;
10
 import com.huiju.estateagents.excel.ActivityStatistics.*;
42
      * @return
43
      * @return
43
      */
44
      */
44
     @Override
45
     @Override
45
-    public ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId) {
46
+    public ResponseBean getChannelIntroductionList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String channelType, String buildingId, Integer channelId,String sortField,String sortOrder) {
46
         IPage<TsActivityDaily> pg = new Page<>(pageNum, pageSize);
47
         IPage<TsActivityDaily> pg = new Page<>(pageNum, pageSize);
47
-        IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId);
48
+        String orderType = "asc";
49
+        if ("descend".equals(sortOrder)){
50
+            orderType = "desc";
51
+        }else if ("ascend".equals(sortOrder)){
52
+            orderType = "asc";
53
+        }
54
+        if(StringUtils.isEmpty(sortField)){
55
+            sortField = "new_customers";
56
+            orderType = "desc";
57
+        }
58
+        IPage<TsActivityDaily> data = taChannelMapper.getChannelIntroductionList(pg, orgId,startDate,endDate,channelType,buildingId, channelId, sortField, orderType);
48
         return ResponseBean.success(data);
59
         return ResponseBean.success(data);
49
     }
60
     }
50
 
61
 

+ 20
- 1
src/main/resources/mapper/TaChannelMapper.xml 查看文件

70
 
70
 
71
     <select id="getChannelIntroductionList" resultType="com.huiju.estateagents.entity.TsActivityDaily">
71
     <select id="getChannelIntroductionList" resultType="com.huiju.estateagents.entity.TsActivityDaily">
72
         SELECT
72
         SELECT
73
-            *
73
+            serial_no,
74
+            statis_date,
75
+            org_id,
76
+            building_id,
77
+            building_name,
78
+            target_id,
79
+            target_type,
80
+            target_name,
81
+            sum( share_num ) AS share_num,
82
+            sum( share_persons ) AS share_persons,
83
+            sum( visit_num ) AS visit_num,
84
+            sum( visit_persons ) AS visit_persons,
85
+            sum( new_persons ) AS new_persons,
86
+            sum( new_customers ) AS new_customers,
87
+            qr_code_id,
88
+            channel_id
74
         FROM
89
         FROM
75
             ts_channel_daily
90
             ts_channel_daily
76
         WHERE
91
         WHERE
85
         <if test="buildingId != null and buildingId != ''">
100
         <if test="buildingId != null and buildingId != ''">
86
             and building_id = #{buildingId}
101
             and building_id = #{buildingId}
87
         </if>
102
         </if>
103
+        GROUP BY   target_id, target_type
104
+        <if test="sortField != null and sortField != ''">
105
+            ORDER BY ${sortField} ${orderType}
106
+        </if>
88
     </select>
107
     </select>
89
     <select id="getChannelNewuserList"
108
     <select id="getChannelNewuserList"
90
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">
109
             resultType="com.huiju.estateagents.excel.ActivityStatistics.ChannelAddRegistNum">