傅行帆 3 年 前
コミット
742c193677

+ 2
- 0
src/main/java/com/yunzhi/marketing/dto/StatisticsDTO.java ファイルの表示

@@ -20,4 +20,6 @@ public class StatisticsDTO {
20 20
     private Integer channelId;
21 21
 
22 22
     private String type;
23
+
24
+    private String customerType;
23 25
 }

+ 13
- 11
src/main/java/com/yunzhi/marketing/service/impl/ChannelCustomerStatisticsServiceImpl.java ファイルの表示

@@ -16,6 +16,7 @@ import org.ietf.jgss.ChannelBinding;
16 16
 import org.springframework.beans.factory.annotation.Autowired;
17 17
 import org.springframework.stereotype.Service;
18 18
 
19
+import java.util.ArrayList;
19 20
 import java.util.HashMap;
20 21
 import java.util.List;
21 22
 import java.util.Map;
@@ -96,16 +97,17 @@ public class ChannelCustomerStatisticsServiceImpl implements ChannelCustomerStat
96 97
         }
97 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,8 +31,7 @@ public class ChannelCustomerStatisticsController extends BaseController {
31 31
 
32 32
     @ApiOperation(value = "wx-龙虎榜排名数据", notes = "wx-龙虎榜排名数据")
33 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 35
                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
37 36
                                     @RequestHeader("authorization") String token, HttpServletRequest request){
38 37
         ResponseBean responseBean = new ResponseBean();
@@ -46,7 +45,6 @@ public class ChannelCustomerStatisticsController extends BaseController {
46 45
 
47 46
         // 构造参数
48 47
         StatisticsDTO statisticsDTo = new StatisticsDTO();
49
-        statisticsDTo.setBuildingId(buildingId);
50 48
         statisticsDTo.setStartDate(startDate);
51 49
         statisticsDTo.setEndDate(endDate);
52 50
         statisticsDTo.setOrgId(orgId);
@@ -56,8 +54,7 @@ public class ChannelCustomerStatisticsController extends BaseController {
56 54
 
57 55
     @ApiOperation(value = "wx-销售简报", notes = "wx-销售简报")
58 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 58
                                     @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDateTime endDate,
62 59
                                     @RequestHeader("authorization") String token, HttpServletRequest request){
63 60
         ResponseBean responseBean = new ResponseBean();
@@ -71,7 +68,6 @@ public class ChannelCustomerStatisticsController extends BaseController {
71 68
 
72 69
         // 构造参数
73 70
         StatisticsDTO statisticsDTo = new StatisticsDTO();
74
-        statisticsDTo.setBuildingId(buildingId);
75 71
         statisticsDTo.setStartDate(startDate);
76 72
         statisticsDTo.setEndDate(endDate);
77 73
         statisticsDTo.setOrgId(orgId);
@@ -79,13 +75,12 @@ public class ChannelCustomerStatisticsController extends BaseController {
79 75
         return  channelCustomerStatisticsService.getBriefing(statisticsDTo);
80 76
     }
81 77
 
82
-    @ApiOperation(value = "wx-销售简报", notes = "wx-销售简报")
78
+    @ApiOperation(value = "wx-销售简报折线图", notes = "wx-销售简报折线图")
83 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 82
                                     @RequestParam(value = "type") String type,
88
-                                    @RequestHeader("authorization") String token, HttpServletRequest request){
83
+                                    @RequestHeader("authorization") String token,HttpServletRequest request){
89 84
         ResponseBean responseBean = new ResponseBean();
90 85
         String openid = getOpenId(request);
91 86
         Integer orgId = getOrgId(request);
@@ -97,12 +92,12 @@ public class ChannelCustomerStatisticsController extends BaseController {
97 92
 
98 93
         // 构造参数
99 94
         StatisticsDTO statisticsDTo = new StatisticsDTO();
100
-        statisticsDTo.setBuildingId(buildingId);
101 95
         statisticsDTo.setStartDate(startDate);
102 96
         statisticsDTo.setEndDate(endDate);
103 97
         statisticsDTo.setOrgId(orgId);
104 98
         statisticsDTo.setPersonId(person.getPersonId());
105 99
         statisticsDTo.setType(type);
100
+        statisticsDTo.setCustomerType(customerType);
106 101
         return  channelCustomerStatisticsService.getBriefingDetail(statisticsDTo);
107 102
     }
108 103
 }

+ 13
- 8
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml ファイルの表示

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

+ 6
- 1
src/main/resources/mapper/xlk/CustomerVisitMapper.xml ファイルの表示

@@ -19,7 +19,12 @@
19 19
     </select>
20 20
     <select id="getFollowCustomerDetail" resultType="com.yunzhi.marketing.xlk.vo.CustomerDetailVO">
21 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 28
             COUNT(1) as customerNum
24 29
         FROM
25 30
         xlk_channel_customer t