傅行帆 3 лет назад
Родитель
Сommit
742c193677

+ 2
- 0
src/main/java/com/yunzhi/marketing/dto/StatisticsDTO.java Просмотреть файл

20
     private Integer channelId;
20
     private Integer channelId;
21
 
21
 
22
     private String type;
22
     private String type;
23
+
24
+    private String customerType;
23
 }
25
 }

+ 13
- 11
src/main/java/com/yunzhi/marketing/service/impl/ChannelCustomerStatisticsServiceImpl.java Просмотреть файл

16
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
17
 import org.springframework.stereotype.Service;
17
 import org.springframework.stereotype.Service;
18
 
18
 
19
+import java.util.ArrayList;
19
 import java.util.HashMap;
20
 import java.util.HashMap;
20
 import java.util.List;
21
 import java.util.List;
21
 import java.util.Map;
22
 import java.util.Map;
96
         }
97
         }
97
         statisticsDTo.setChannelId(taChannelPerson.getChannelId());
98
         statisticsDTo.setChannelId(taChannelPerson.getChannelId());
98
 
99
 
99
-        // 获取新增客户
100
-        List<CustomerDetailVO> newCustomerDetail = channelCustomerMapper.getNewCustomerDetail(statisticsDTo);
101
-        // 获取跟进客户
102
-        List<CustomerDetailVO> followCustomerDetail = customerVisitMapper.getFollowCustomerDetail(statisticsDTo);
103
-        // 获取成交客户
104
-        List<CustomerDetailVO> successCustomerDetail = channelCustomerMapper.getSuccessCustomerDetail(statisticsDTo);
105
-        Map<String,Object> map = new HashMap<>();
106
-        map.put("newCustomerDetail",newCustomerDetail);
107
-        map.put("followCustomerDetail",followCustomerDetail);
108
-        map.put("successCustomerDetail",successCustomerDetail);
109
-        return ResponseBean.success(map);
100
+        List<CustomerDetailVO> customerDetail = new ArrayList<>();
101
+        if ("new".equals(statisticsDTo.getCustomerType())){
102
+            // 获取新增客户
103
+            customerDetail = channelCustomerMapper.getNewCustomerDetail(statisticsDTo);
104
+        }else if ("follow".equals(statisticsDTo.getCustomerType())){
105
+            // 获取跟进客户
106
+            customerDetail = customerVisitMapper.getFollowCustomerDetail(statisticsDTo);
107
+        }else if ("success".equals(statisticsDTo.getCustomerType())) {
108
+            // 获取成交客户
109
+            customerDetail = channelCustomerMapper.getSuccessCustomerDetail(statisticsDTo);
110
+        }
111
+        return ResponseBean.success(customerDetail);
110
     }
112
     }
111
 }
113
 }

+ 7
- 12
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerStatisticsController.java Просмотреть файл

31
 
31
 
32
     @ApiOperation(value = "wx-龙虎榜排名数据", notes = "wx-龙虎榜排名数据")
32
     @ApiOperation(value = "wx-龙虎榜排名数据", notes = "wx-龙虎榜排名数据")
33
     @GetMapping(value="/wx/ranklist")
33
     @GetMapping(value="/wx/ranklist")
34
-    public ResponseBean getRanklist(@RequestParam("buildingId") String buildingId,
35
-                                    @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
34
+    public ResponseBean getRanklist(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
36
                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
35
                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
37
                                     @RequestHeader("authorization") String token, HttpServletRequest request){
36
                                     @RequestHeader("authorization") String token, HttpServletRequest request){
38
         ResponseBean responseBean = new ResponseBean();
37
         ResponseBean responseBean = new ResponseBean();
46
 
45
 
47
         // 构造参数
46
         // 构造参数
48
         StatisticsDTO statisticsDTo = new StatisticsDTO();
47
         StatisticsDTO statisticsDTo = new StatisticsDTO();
49
-        statisticsDTo.setBuildingId(buildingId);
50
         statisticsDTo.setStartDate(startDate);
48
         statisticsDTo.setStartDate(startDate);
51
         statisticsDTo.setEndDate(endDate);
49
         statisticsDTo.setEndDate(endDate);
52
         statisticsDTo.setOrgId(orgId);
50
         statisticsDTo.setOrgId(orgId);
56
 
54
 
57
     @ApiOperation(value = "wx-销售简报", notes = "wx-销售简报")
55
     @ApiOperation(value = "wx-销售简报", notes = "wx-销售简报")
58
     @GetMapping(value="/wx/briefing")
56
     @GetMapping(value="/wx/briefing")
59
-    public ResponseBean getBriefing(@RequestParam("buildingId") String buildingId,
60
-                                    @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
57
+    public ResponseBean getBriefing(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
61
                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
58
                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
62
                                     @RequestHeader("authorization") String token, HttpServletRequest request){
59
                                     @RequestHeader("authorization") String token, HttpServletRequest request){
63
         ResponseBean responseBean = new ResponseBean();
60
         ResponseBean responseBean = new ResponseBean();
71
 
68
 
72
         // 构造参数
69
         // 构造参数
73
         StatisticsDTO statisticsDTo = new StatisticsDTO();
70
         StatisticsDTO statisticsDTo = new StatisticsDTO();
74
-        statisticsDTo.setBuildingId(buildingId);
75
         statisticsDTo.setStartDate(startDate);
71
         statisticsDTo.setStartDate(startDate);
76
         statisticsDTo.setEndDate(endDate);
72
         statisticsDTo.setEndDate(endDate);
77
         statisticsDTo.setOrgId(orgId);
73
         statisticsDTo.setOrgId(orgId);
79
         return  channelCustomerStatisticsService.getBriefing(statisticsDTo);
75
         return  channelCustomerStatisticsService.getBriefing(statisticsDTo);
80
     }
76
     }
81
 
77
 
82
-    @ApiOperation(value = "wx-销售简报", notes = "wx-销售简报")
78
+    @ApiOperation(value = "wx-销售简报折线图", notes = "wx-销售简报折线图")
83
     @GetMapping(value="/wx/briefing/detail")
79
     @GetMapping(value="/wx/briefing/detail")
84
-    public ResponseBean getBriefingDetail(@RequestParam("buildingId") String buildingId,
85
-                                    @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
86
-                                    @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
80
+    public ResponseBean getBriefingDetail(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime startDate,
81
+                                    @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate, @RequestParam(value = "customerType") String customerType,
87
                                     @RequestParam(value = "type") String type,
82
                                     @RequestParam(value = "type") String type,
88
-                                    @RequestHeader("authorization") String token, HttpServletRequest request){
83
+                                    @RequestHeader("authorization") String token,HttpServletRequest request){
89
         ResponseBean responseBean = new ResponseBean();
84
         ResponseBean responseBean = new ResponseBean();
90
         String openid = getOpenId(request);
85
         String openid = getOpenId(request);
91
         Integer orgId = getOrgId(request);
86
         Integer orgId = getOrgId(request);
97
 
92
 
98
         // 构造参数
93
         // 构造参数
99
         StatisticsDTO statisticsDTo = new StatisticsDTO();
94
         StatisticsDTO statisticsDTo = new StatisticsDTO();
100
-        statisticsDTo.setBuildingId(buildingId);
101
         statisticsDTo.setStartDate(startDate);
95
         statisticsDTo.setStartDate(startDate);
102
         statisticsDTo.setEndDate(endDate);
96
         statisticsDTo.setEndDate(endDate);
103
         statisticsDTo.setOrgId(orgId);
97
         statisticsDTo.setOrgId(orgId);
104
         statisticsDTo.setPersonId(person.getPersonId());
98
         statisticsDTo.setPersonId(person.getPersonId());
105
         statisticsDTo.setType(type);
99
         statisticsDTo.setType(type);
100
+        statisticsDTo.setCustomerType(customerType);
106
         return  channelCustomerStatisticsService.getBriefingDetail(statisticsDTo);
101
         return  channelCustomerStatisticsService.getBriefingDetail(statisticsDTo);
107
     }
102
     }
108
 }
103
 }

+ 13
- 8
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml Просмотреть файл

52
             p.avatarurl
52
             p.avatarurl
53
         FROM
53
         FROM
54
             xlk_channel_customer t
54
             xlk_channel_customer t
55
+        INNER JOIN xlk_customer_visit v on t.customer_id = v.customer_id
55
         LEFT JOIN ta_person p on t.recommend_person = p.person_id
56
         LEFT JOIN ta_person p on t.recommend_person = p.person_id
56
         WHERE t.channel_id  = #{params.channelId}
57
         WHERE t.channel_id  = #{params.channelId}
57
-        and t.building_id = #{params.buildingId}
58
-        and t.`status` != 3
59
         <if test="params.startDate != null or params.endDate != null">
58
         <if test="params.startDate != null or params.endDate != null">
60
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
59
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
61
         </if>
60
         </if>
104
         FROM
103
         FROM
105
         xlk_channel_customer t
104
         xlk_channel_customer t
106
         WHERE t.channel_id  = #{params.channelId}
105
         WHERE t.channel_id  = #{params.channelId}
107
-        and t.building_id = #{params.buildingId}
108
         and t.`status` = 1
106
         and t.`status` = 1
109
         <if test="params.startDate != null or params.endDate != null">
107
         <if test="params.startDate != null or params.endDate != null">
110
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
108
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
120
         xlk_channel_customer t
118
         xlk_channel_customer t
121
         LEFT join ta_recommend_customer r on t.customer_id = r.customer_id
119
         LEFT join ta_recommend_customer r on t.customer_id = r.customer_id
122
         WHERE t.channel_id  = #{params.channelId}
120
         WHERE t.channel_id  = #{params.channelId}
123
-        and t.building_id = #{params.buildingId}
124
         and r.`status` in (4,5)
121
         and r.`status` in (4,5)
125
         <if test="params.startDate != null or params.endDate != null">
122
         <if test="params.startDate != null or params.endDate != null">
126
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
123
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
131
     </select>
128
     </select>
132
     <select id="getNewCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
129
     <select id="getNewCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
133
         SELECT
130
         SELECT
134
-            date_format( t.create_date, '%Y-%m-%d' ) as coordinate,
131
+            <if test="params.type == 'day'">
132
+                date_format( t.create_date, '%Y-%m-%d' ) as coordinate,
133
+            </if>
134
+            <if test="params.type == 'month'">
135
+                date_format( t.create_date, '%Y-%m' ) as coordinate,
136
+            </if>
135
             COUNT(1) as customerNum
137
             COUNT(1) as customerNum
136
         FROM
138
         FROM
137
         xlk_channel_customer t
139
         xlk_channel_customer t
138
         WHERE t.channel_id  = #{params.channelId}
140
         WHERE t.channel_id  = #{params.channelId}
139
-        and t.building_id = #{params.buildingId}
140
         and t.`status` = 1
141
         and t.`status` = 1
141
         <if test="params.startDate != null or params.endDate != null">
142
         <if test="params.startDate != null or params.endDate != null">
142
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
143
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
153
     </select>
154
     </select>
154
     <select id="getSuccessCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
155
     <select id="getSuccessCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
155
         SELECT
156
         SELECT
156
-            date_format( t.create_date, '%%Y-%m-%d' ) as coordinate,
157
+            <if test="params.type == 'day'">
158
+                date_format( t.create_date, '%Y-%m-%d' ) as coordinate,
159
+            </if>
160
+            <if test="params.type == 'month'">
161
+                date_format( t.create_date, '%Y-%m' ) as coordinate,
162
+            </if>
157
             COUNT(1) as customerNum
163
             COUNT(1) as customerNum
158
         FROM
164
         FROM
159
         xlk_channel_customer t
165
         xlk_channel_customer t
160
         LEFT join ta_recommend_customer r on t.customer_id = r.customer_id
166
         LEFT join ta_recommend_customer r on t.customer_id = r.customer_id
161
         WHERE t.channel_id  = #{params.channelId}
167
         WHERE t.channel_id  = #{params.channelId}
162
-        and t.building_id = #{params.buildingId}
163
         and r.`status` in (4,5)
168
         and r.`status` in (4,5)
164
         <if test="params.startDate != null or params.endDate != null">
169
         <if test="params.startDate != null or params.endDate != null">
165
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}
170
             AND t.create_date BETWEEN #{params.startDate} and #{params.endDate}

+ 6
- 1
src/main/resources/mapper/xlk/CustomerVisitMapper.xml Просмотреть файл

19
     </select>
19
     </select>
20
     <select id="getFollowCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
20
     <select id="getFollowCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
21
         SELECT
21
         SELECT
22
-            date_format( t.create_date, '%Y-%m-%d' ) as coordinate,
22
+            <if test="params.type == 'day'">
23
+                date_format( t.create_date, '%Y-%m-%d' ) as coordinate,
24
+            </if>
25
+            <if test="params.type == 'month'">
26
+                date_format( t.create_date, '%Y-%m' ) as coordinate,
27
+            </if>
23
             COUNT(1) as customerNum
28
             COUNT(1) as customerNum
24
         FROM
29
         FROM
25
         xlk_channel_customer t
30
         xlk_channel_customer t