Browse Source

Merge branch 'develop' of http://git.ycjcjy.com/marketing/services into develop

Your Name 3 years ago
parent
commit
dc96164f7b

+ 2
- 0
src/main/java/com/yunzhi/marketing/dto/ChannelReportDTO.java View File

38
      * 性别
38
      * 性别
39
      */
39
      */
40
     private Integer sex;
40
     private Integer sex;
41
+
42
+    private String remark;
41
 }
43
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/dto/StatisticsDTO.java View File

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 View File

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
 }

+ 1
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java View File

432
         channelCustomer.setStatus("1");
432
         channelCustomer.setStatus("1");
433
         channelCustomer.setChannelId(taChannelPeople.getChannelId());
433
         channelCustomer.setChannelId(taChannelPeople.getChannelId());
434
         channelCustomer.setOrgId(channelReportDTO.getOrgId());
434
         channelCustomer.setOrgId(channelReportDTO.getOrgId());
435
+        channelCustomer.setRemark(channelReportDTO.getRemark());
435
         channelCustomerMapper.insert(channelCustomer);
436
         channelCustomerMapper.insert(channelCustomer);
436
         return ResponseBean.success(channelCustomer);
437
         return ResponseBean.success(channelCustomer);
437
     }
438
     }

+ 1
- 1
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerController.java View File

194
             if (StringUtils.isEmpty(channelCustomer.getCustomerId())){
194
             if (StringUtils.isEmpty(channelCustomer.getCustomerId())){
195
                 return ResponseBean.success(channelCustomer);
195
                 return ResponseBean.success(channelCustomer);
196
             }
196
             }
197
-            responseBean.addSuccess(taRecommendCustomerService.getCustDetail(channelCustomer.getCustomerId()));
197
+            responseBean = taRecommendCustomerService.getCustDetail(channelCustomer.getCustomerId());
198
         }catch (Exception e){
198
         }catch (Exception e){
199
             e.printStackTrace();
199
             e.printStackTrace();
200
             logger.error("channelCustomerDelete -=- {}",e.toString());
200
             logger.error("channelCustomerDelete -=- {}",e.toString());

+ 7
- 12
src/main/java/com/yunzhi/marketing/xlk/controller/ChannelCustomerStatisticsController.java View File

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
 }

+ 3
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/CustomerPreparatory.java View File

1
 package com.yunzhi.marketing.xlk.entity;
1
 package com.yunzhi.marketing.xlk.entity;
2
 
2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
3
 import com.baomidou.mybatisplus.annotation.TableName;
5
 import com.baomidou.mybatisplus.annotation.TableName;
4
 import lombok.Data;
6
 import lombok.Data;
5
 import lombok.EqualsAndHashCode;
7
 import lombok.EqualsAndHashCode;
27
     /**
29
     /**
28
      * 客户认筹id
30
      * 客户认筹id
29
      */
31
      */
32
+    @TableId(type = IdType.UUID)
30
     private String customerPreparatoryId;
33
     private String customerPreparatoryId;
31
 
34
 
32
     /**
35
     /**

+ 3
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/CustomerSignatory.java View File

1
 package com.yunzhi.marketing.xlk.entity;
1
 package com.yunzhi.marketing.xlk.entity;
2
 
2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
3
 import com.baomidou.mybatisplus.annotation.TableName;
5
 import com.baomidou.mybatisplus.annotation.TableName;
4
 import lombok.Data;
6
 import lombok.Data;
5
 import lombok.EqualsAndHashCode;
7
 import lombok.EqualsAndHashCode;
27
     /**
29
     /**
28
      * 主键
30
      * 主键
29
      */
31
      */
32
+    @TableId(type = IdType.UUID)
30
     private String customerSignatoryId;
33
     private String customerSignatoryId;
31
 
34
 
32
     /**
35
     /**

+ 3
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/CustomerVisit.java View File

1
 package com.yunzhi.marketing.xlk.entity;
1
 package com.yunzhi.marketing.xlk.entity;
2
 
2
 
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
3
 import com.baomidou.mybatisplus.annotation.TableName;
5
 import com.baomidou.mybatisplus.annotation.TableName;
4
 import lombok.Data;
6
 import lombok.Data;
5
 import lombok.EqualsAndHashCode;
7
 import lombok.EqualsAndHashCode;
27
     /**
29
     /**
28
      * 客户到访id
30
      * 客户到访id
29
      */
31
      */
32
+    @TableId(type = IdType.UUID)
30
     private String customerVisitId;
33
     private String customerVisitId;
31
 
34
 
32
     /**
35
     /**

+ 48
- 9
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java View File

7
 import com.yunzhi.marketing.base.ResponseBean;
7
 import com.yunzhi.marketing.base.ResponseBean;
8
 import com.yunzhi.marketing.common.CommConstant;
8
 import com.yunzhi.marketing.common.CommConstant;
9
 import com.yunzhi.marketing.common.StringUtils;
9
 import com.yunzhi.marketing.common.StringUtils;
10
+import com.yunzhi.marketing.entity.TaPerson;
10
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
11
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
12
+import com.yunzhi.marketing.mapper.TaPersonMapper;
11
 import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
13
 import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
12
 import com.yunzhi.marketing.po.MineRecommendCustomerPO;
14
 import com.yunzhi.marketing.po.MineRecommendCustomerPO;
13
 import com.yunzhi.marketing.po.TaRecommendCustomerPO;
15
 import com.yunzhi.marketing.po.TaRecommendCustomerPO;
45
 
47
 
46
     @Autowired
48
     @Autowired
47
     private CustomerSignatoryMapper customerSignatoryMapper;
49
     private CustomerSignatoryMapper customerSignatoryMapper;
50
+
51
+    @Autowired
52
+    private TaPersonMapper taPersonMapper;
48
     /**
53
     /**
49
      * 审核
54
      * 审核
50
      *
55
      *
64
 
69
 
65
         // 保存到访单
70
         // 保存到访单
66
         CustomerVisit customerVisit = channelCustomerDTO.getCustomerVisit();
71
         CustomerVisit customerVisit = channelCustomerDTO.getCustomerVisit();
67
-        customerVisit.setCreateDate(LocalDateTime.now());
68
-        customerVisitMapper.insert(customerVisit);
72
+        customerVisit.setBuildingId(customer.getBuildingId());
73
+        customerVisit.setName(customer.getName());
74
+        customerVisit.setRecommendPerson(customer.getRecommendPerson());
75
+        TaPerson recommendPerson = taPersonMapper.getById(customer.getRecommendPerson());
76
+        if (null != recommendPerson) {
77
+            customerVisit.setRealtyConsultantName(recommendPerson.getName());
78
+        }
79
+        customerVisit.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
80
+        TaPerson channelPerson = taPersonMapper.getById(channelCustomerDTO.getRealtyConsultant());
81
+        if (null != channelPerson) {
82
+            customerVisit.setRealtyConsultantName(channelPerson.getName());
83
+        }
84
+        customerVisit.setOrgId(customer.getOrgId());
69
 
85
 
70
         // 审核通过 先查看在ta_recommend_customer 手机号是否存在
86
         // 审核通过 先查看在ta_recommend_customer 手机号是否存在
71
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
87
         LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
95
             // 审核通过
111
             // 审核通过
96
             customer.setStatus("2");
112
             customer.setStatus("2");
97
             customer.setCustomerId(taRecommendCustomer.getCustomerId());
113
             customer.setCustomerId(taRecommendCustomer.getCustomerId());
114
+            customerVisit.setCustomerId(taRecommendCustomer.getCustomerId());
98
             customer.setVisitDate(LocalDateTime.now());
115
             customer.setVisitDate(LocalDateTime.now());
99
             channelCustomerMapper.updateById(customer);
116
             channelCustomerMapper.updateById(customer);
100
-            return ResponseBean.success("审核成功");
101
-        }
102
-
103
-        if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
117
+        }else if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
104
                 (StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
118
                 (StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
105
             // 审核通过
119
             // 审核通过
106
             customer.setStatus("2");
120
             customer.setStatus("2");
107
             customer.setCustomerId(recommendCustomer.getCustomerId());
121
             customer.setCustomerId(recommendCustomer.getCustomerId());
122
+            customerVisit.setCustomerId(recommendCustomer.getCustomerId());
108
             customer.setVisitDate(LocalDateTime.now());
123
             customer.setVisitDate(LocalDateTime.now());
124
+            customer.setRealtyConsultant(channelCustomerDTO.getRealtyConsultant());
109
             channelCustomerMapper.updateById(customer);
125
             channelCustomerMapper.updateById(customer);
110
-            return ResponseBean.success("审核成功");
126
+        }else {
127
+            return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
111
         }
128
         }
112
 
129
 
113
-        return ResponseBean.error("此客户是私客或已被报备", ResponseBean.ERROR_UNAVAILABLE);
130
+
131
+        customerVisit.setCreateDate(LocalDateTime.now());
132
+        customerVisitMapper.insert(customerVisit);
133
+
134
+        return ResponseBean.success("审核成功");
114
     }
135
     }
115
 
136
 
116
     /**
137
     /**
122
      */
143
      */
123
     @Override
144
     @Override
124
     public ResponseBean markingChannelCustomer(MarkingChannelCustomerDTO params) {
145
     public ResponseBean markingChannelCustomer(MarkingChannelCustomerDTO params) {
146
+        CustomerVisit customerVisit = params.getCustomerVisit();
125
         // 渠道推荐的客户
147
         // 渠道推荐的客户
126
         if ("report".equals(params.getType())) {
148
         if ("report".equals(params.getType())) {
127
             ChannelCustomer customer = channelCustomerMapper.selectById(params.getId());
149
             ChannelCustomer customer = channelCustomerMapper.selectById(params.getId());
150
+
151
+            customerVisit.setBuildingId(customer.getBuildingId());
152
+            customerVisit.setName(customer.getName());
153
+            customerVisit.setRecommendPerson(customer.getRecommendPerson());
154
+            TaPerson recommendPerson = taPersonMapper.getById(customer.getRecommendPerson());
155
+            if (null != recommendPerson) {
156
+                customerVisit.setRealtyConsultantName(recommendPerson.getName());
157
+            }
158
+            customerVisit.setRealtyConsultant(params.getRealtyConsultant());
159
+            TaPerson channelPerson = taPersonMapper.getById(params.getRealtyConsultant());
160
+            if (null != channelPerson) {
161
+                customerVisit.setRealtyConsultantName(channelPerson.getName());
162
+            }
163
+            customerVisit.setOrgId(customer.getOrgId());
164
+
128
             // 审核通过 先查看在ta_recommend_customer 手机号是否存在
165
             // 审核通过 先查看在ta_recommend_customer 手机号是否存在
129
             LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
166
             LambdaQueryWrapper<TaRecommendCustomer> queryWrapper = new LambdaQueryWrapper<>();
130
             queryWrapper.eq(TaRecommendCustomer::getPhone,customer.getPhone());
167
             queryWrapper.eq(TaRecommendCustomer::getPhone,customer.getPhone());
155
                 customer.setStatus("2");
192
                 customer.setStatus("2");
156
                 customer.setVisitDate(LocalDateTime.now());
193
                 customer.setVisitDate(LocalDateTime.now());
157
                 customer.setCustomerId(taRecommendCustomer.getCustomerId());
194
                 customer.setCustomerId(taRecommendCustomer.getCustomerId());
195
+                customerVisit.setCustomerId(taRecommendCustomer.getCustomerId());
158
                 channelCustomerMapper.updateById(customer);
196
                 channelCustomerMapper.updateById(customer);
159
             }else if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
197
             }else if (StringUtils.isEmpty(recommendCustomer.getRealtyConsultant()) &&
160
                     (StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
198
                     (StringUtils.isEmpty(recommendCustomer.getRecommendPerson()) || recommendCustomer.getRecommendPerson().equals(customer.getRecommendPerson()))){
162
                 customer.setStatus("2");
200
                 customer.setStatus("2");
163
                 customer.setVisitDate(LocalDateTime.now());
201
                 customer.setVisitDate(LocalDateTime.now());
164
                 customer.setCustomerId(recommendCustomer.getCustomerId());
202
                 customer.setCustomerId(recommendCustomer.getCustomerId());
203
+                customerVisit.setCustomerId(recommendCustomer.getCustomerId());
165
                 channelCustomerMapper.updateById(customer);
204
                 channelCustomerMapper.updateById(customer);
166
 
205
 
167
                 // 修改状态为确认到访状态
206
                 // 修改状态为确认到访状态
178
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
217
             taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
179
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
218
             taRecommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
180
             taRecommendCustomer.setCirculationTime(LocalDateTime.now());
219
             taRecommendCustomer.setCirculationTime(LocalDateTime.now());
220
+            customerVisit.setCustomerId(taRecommendCustomer.getCustomerId());
181
             taRecommendCustomerMapper.updateById(taRecommendCustomer);
221
             taRecommendCustomerMapper.updateById(taRecommendCustomer);
182
         }else {
222
         }else {
183
             return ResponseBean.error("请输入正确的类型参数", ResponseBean.ERROR_UNAVAILABLE);
223
             return ResponseBean.error("请输入正确的类型参数", ResponseBean.ERROR_UNAVAILABLE);
184
         }
224
         }
185
 
225
 
186
         // 保存到访单
226
         // 保存到访单
187
-        CustomerVisit customerVisit = params.getCustomerVisit();
188
         customerVisit.setCreateDate(LocalDateTime.now());
227
         customerVisit.setCreateDate(LocalDateTime.now());
189
         customerVisitMapper.insert(customerVisit);
228
         customerVisitMapper.insert(customerVisit);
190
 
229
 

+ 13
- 8
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml View File

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 View File

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