浏览代码

人脸消息

傅行帆 5 年前
父节点
当前提交
1f19ffda26

+ 10
- 4
src/main/java/com.huiju.welcome/controller/TaCustomerController.java 查看文件

@@ -259,7 +259,13 @@ public class TaCustomerController extends BaseController {
259 259
 
260 260
             List<TaPerson> group = iTaCustomerService.getGroup(cust.getCustomerId());
261 261
             cust.setGroup(group);
262
-
262
+            //插入车牌信息
263
+            QueryWrapper<TaCar> queryWrapper = new QueryWrapper<>();
264
+            queryWrapper.eq("plate_number",cust.getPlateNumber());
265
+            TaCar taCar = iTaCarService.getOne(queryWrapper);
266
+            if (null != taCar){
267
+                cust.setCarImage(taCar.getCarImage());
268
+            }
263 269
             responseBean.addSuccess(cust);
264 270
         }catch (Exception e){
265 271
             e.printStackTrace();
@@ -327,7 +333,7 @@ public class TaCustomerController extends BaseController {
327 333
      * @return
328 334
      */
329 335
     @RequestMapping(value="/miniapp/customer/visitor/{state}",method= RequestMethod.GET)
330
-    public ResponseBean visitorCustomerList(@RequestParam(defaultValue = "1") int pageNumber,
336
+    public ResponseBean visitorCustomerList(@RequestParam(defaultValue = "1") int pageNum,
331 337
                                             @RequestParam(defaultValue = "10") int pageSize,
332 338
                                             @PathVariable String state,
333 339
                                             HttpServletRequest request){
@@ -341,10 +347,10 @@ public class TaCustomerController extends BaseController {
341 347
             }
342 348
             //已归属和未归属人员列表 分页
343 349
             if (state.equals(CommConstant.CUSTOMER_ATTRIBUTION)) {
344
-                IPage<TaCustomer> result = iTaCustomerService.getAttributionList(pageNumber, pageSize);
350
+                IPage<TaCustomer> result = iTaCustomerService.getAttributionList(pageNum, pageSize);
345 351
                 responseBean.addSuccess(result);
346 352
             }else if (state.equals(CommConstant.CUSTOMER_UNATTRIBUTION)){
347
-                IPage<TaCustomer> result = iTaCustomerService.getUnattributionList(pageNumber, pageSize);
353
+                IPage<TaCustomer> result = iTaCustomerService.getUnattributionList(pageNum, pageSize);
348 354
                 responseBean.addSuccess(result);
349 355
             }
350 356
             

+ 50
- 2
src/main/java/com.huiju.welcome/controller/TaFirstUsherRecordController.java 查看文件

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.welcome.common.base.BaseController;
7 7
 import com.huiju.welcome.common.base.ResponseBean;
8
+import com.huiju.welcome.model.TaCustomer;
8 9
 import com.huiju.welcome.model.TaFirstUsherRecord;
10
+import com.huiju.welcome.service.ITaCustomerService;
9 11
 import com.huiju.welcome.service.ITaFirstUsherRecordService;
10 12
 import com.huiju.welcome.utils.DateUtils;
11 13
 import com.huiju.welcome.utils.StatusUtils;
@@ -14,6 +16,10 @@ import org.slf4j.LoggerFactory;
14 16
 import org.springframework.beans.factory.annotation.Autowired;
15 17
 import org.springframework.web.bind.annotation.*;
16 18
 
19
+import java.time.LocalDateTime;
20
+import java.time.format.DateTimeFormatter;
21
+import java.util.List;
22
+
17 23
 
18 24
 /**
19 25
  * <p>
@@ -32,6 +38,8 @@ public class TaFirstUsherRecordController extends BaseController {
32 38
     @Autowired
33 39
     public ITaFirstUsherRecordService iTaFirstUsherRecordService;
34 40
 
41
+    @Autowired
42
+    private ITaCustomerService taCustomerService;
35 43
 
36 44
     /**
37 45
      * 保存对象
@@ -120,7 +128,30 @@ public class TaFirstUsherRecordController extends BaseController {
120 128
         }
121 129
         return responseBean;
122 130
     }
123
-
131
+    
132
+    /**
133
+     * 根据id查询对象
134
+     * @param id  实体ID
135
+     */
136
+    @RequestMapping(value="/miniapp/firstUsherRecord/{id}",method= RequestMethod.GET)
137
+    public ResponseBean miniappGet(@PathVariable Integer id){
138
+        ResponseBean responseBean = new ResponseBean();
139
+        try {
140
+            TaFirstUsherRecord taFirstUsherRecord = iTaFirstUsherRecordService.getById(id);
141
+            TaCustomer taCustomer = taCustomerService.getCutomerByPhoneAndPlatenumber(taFirstUsherRecord.getPhone(),taFirstUsherRecord.getPlateNumber());
142
+            if (null != taCustomer){
143
+                taFirstUsherRecord.setCustomerName(taCustomer.getCustomerName());
144
+                taFirstUsherRecord.setAvatar(taCustomer.getAvatar());
145
+                taFirstUsherRecord.setCustomerId(taCustomer.getCustomerId());
146
+            }
147
+            responseBean.addSuccess(taFirstUsherRecord);
148
+        }catch (Exception e){
149
+            logger.error("taFirstUsherRecordGetByID -=- {}",e.toString());
150
+            responseBean.addError(e.getMessage());
151
+        }
152
+        return responseBean;
153
+    }
154
+    
124 155
     /**
125 156
      * 根据id查询对象
126 157
      */
@@ -147,8 +178,25 @@ public class TaFirstUsherRecordController extends BaseController {
147 178
             queryWrapper.lt(!done, "status", StatusUtils.BizDone);
148 179
         }
149 180
         queryWrapper.orderByDesc("rec_id");
150
-
181
+    
182
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
183
+        
151 184
         IPage<TaFirstUsherRecord> result = iTaFirstUsherRecordService.page(pg, queryWrapper);
185
+        List<TaFirstUsherRecord> taFirstUsherRecordList = result.getRecords();
186
+        taFirstUsherRecordList.stream().forEach(e -> {
187
+            TaCustomer taCustomer = taCustomerService.getByPhoneOrPlate(e.getPhone(),e.getPlateNumber());
188
+            if (null != taCustomer){
189
+                if (formatter.format(taCustomer.getCreateDate()).equals(formatter.format(LocalDateTime.now()))){
190
+                    e.setNewCustomer(true);
191
+                }else {
192
+                    e.setNewCustomer(false);
193
+                }
194
+            }else {
195
+                e.setNewCustomer(true);
196
+            }
197
+        });
198
+    
199
+        result.setRecords(taFirstUsherRecordList);
152 200
 
153 201
 //            if (onlyNew) {
154 202
 //               iTaFirstUsherRecordService.updateNormal(result.getRecords());

+ 6
- 0
src/main/java/com.huiju.welcome/model/TaCustomer.java 查看文件

@@ -213,4 +213,10 @@ public class TaCustomer implements Serializable {
213 213
      */
214 214
     @TableField(exist = false)
215 215
     private LocalDateTime visiteDate;
216
+    
217
+    /**
218
+     * 车辆图片
219
+     */
220
+    @TableField(exist = false)
221
+    private String carImage;
216 222
 }

+ 12
- 0
src/main/java/com.huiju.welcome/model/TaFirstUsherRecord.java 查看文件

@@ -65,4 +65,16 @@ public class TaFirstUsherRecord implements Serializable {
65 65
     private Integer consultantId;
66 66
     
67 67
     private String realtyConsultant;
68
+    
69
+    @TableField(exist = false)
70
+    private String customerName;
71
+    
72
+    @TableField(exist = false)
73
+    private String avatar;
74
+    
75
+    @TableField(exist = false)
76
+    private Integer customerId;
77
+    
78
+    @TableField(exist = false)
79
+    private boolean newCustomer;
68 80
 }

+ 3
- 0
src/main/java/com.huiju.welcome/model/TaMainUsherRecord.java 查看文件

@@ -76,4 +76,7 @@ public class TaMainUsherRecord implements Serializable {
76 76
 
77 77
     @TableField(exist = false)
78 78
     TaMainUsherRecord lastRecord;
79
+    
80
+    @TableField(exist = false)
81
+    private boolean newCustomer;
79 82
 }

+ 1
- 0
src/main/java/com.huiju.welcome/model/TaPerson.java 查看文件

@@ -1,6 +1,7 @@
1 1
 package com.huiju.welcome.model;
2 2
 
3 3
 import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
4 5
 import com.baomidou.mybatisplus.annotation.TableId;
5 6
 import lombok.Data;
6 7
 import lombok.EqualsAndHashCode;

+ 2
- 4
src/main/java/com.huiju.welcome/service/ICameraService.java 查看文件

@@ -2,6 +2,8 @@ package com.huiju.welcome.service;
2 2
 
3 3
 import com.huiju.welcome.model.TaCustomer;
4 4
 import com.huiju.welcome.model.TaDevice;
5
+import com.huiju.welcome.model.TaFirstUsherRecord;
6
+import com.huiju.welcome.model.TaMainUsherRecord;
5 7
 import com.huiju.welcome.model.TaPerson;
6 8
 import com.huiju.welcome.model.TaSnapshotPerson;
7 9
 
@@ -9,8 +11,4 @@ public interface ICameraService {
9 11
     String dispatchPerson(TaPerson taPerson, TaDevice ...devices);
10 12
 
11 13
     boolean newPersonByDevice(TaSnapshotPerson taSnapshotPerson);
12
-    
13
-    void sendMessageToBar(TaCustomer taCustomer,Integer personNum);
14
-    
15
-    void sendMessageToConsultManager(TaCustomer taCustomer);
16 14
 }

+ 10
- 0
src/main/java/com.huiju.welcome/service/ITaCustomerService.java 查看文件

@@ -50,4 +50,14 @@ public interface ITaCustomerService extends IService<TaCustomer> {
50 50
 	IPage<TaCustomer> getAttributionList(int pageNumber, int pageSize);
51 51
     
52 52
     IPage<TaCustomer> getUnattributionList(int pageNumber, int pageSize);
53
+    
54
+    void notifyFirstUsherConsultantManager(TaFirstUsherRecord taFirstUsherRecord,TaCustomer taCustomer);
55
+    
56
+    TaCustomer getCutomerByPhoneAndPlatenumber(String phone, String plateNumber);
57
+    
58
+    void sendMessageToBar(TaCustomer taCustomer,Integer personNum);
59
+    
60
+    void sendMessageToConsultManager(TaCustomer taCustomer);
61
+    
62
+    void sendMessageAll(TaFirstUsherRecord taFirstUsherRecord, TaCustomer taCustomer, TaMainUsherRecord taMainUsherRecord);
53 63
 }

+ 6
- 57
src/main/java/com.huiju.welcome/service/impl/CameraServiceImpl.java 查看文件

@@ -12,6 +12,8 @@ import com.huiju.welcome.model.SysUser;
12 12
 import com.huiju.welcome.model.TaCustomer;
13 13
 import com.huiju.welcome.model.TaCustomerMap;
14 14
 import com.huiju.welcome.model.TaDevice;
15
+import com.huiju.welcome.model.TaFirstUsherRecord;
16
+import com.huiju.welcome.model.TaMainUsherRecord;
15 17
 import com.huiju.welcome.model.TaPerson;
16 18
 import com.huiju.welcome.model.TaSnapshotPerson;
17 19
 import com.huiju.welcome.service.*;
@@ -199,6 +201,7 @@ public class CameraServiceImpl implements ICameraService {
199 201
         TaDevice taDevice = taDeviceService.getById(taSnapshotPerson.getDeviceId());
200 202
         if(taDevice.getAfr().equals(CommConstant.DEVICE_AFR_UNFACE)){
201 203
             sendMessageToConsult(taPerson);
204
+            
202 205
     
203 206
             // 预写到访日志
204 207
             visitingLogService.newLogByDevice(taSnapshotPerson, taPerson);
@@ -213,10 +216,10 @@ public class CameraServiceImpl implements ICameraService {
213 216
             // 推送消息
214 217
             taPersonService.send2Front(taPerson);
215 218
         }
216
-
219
+    
217 220
         // 保存抓拍日志
218 221
         taSnapshotPersonService.save(taSnapshotPerson);
219
-
222
+        
220 223
         return true;
221 224
     }
222 225
     
@@ -233,65 +236,11 @@ public class CameraServiceImpl implements ICameraService {
233 236
                     //推送置业顾问
234 237
                     iTaCustomerService.notifyConsultant(taCustomer);
235 238
                     //推送置业经理
236
-                    sendMessageToConsultManager(taCustomer);
237
-                    //推送吧台
238
-                    sendMessageToBar(taCustomer,null);
239
+                    iTaCustomerService.sendMessageToConsultManager(taCustomer);
239 240
                 } catch (Exception e) {
240 241
                     e.printStackTrace();
241 242
                 }
242 243
             }
243 244
         }
244
-        //推送人脸到二号岗
245
-        sendMessageToMainusher(taPerson);
246
-    }
247
-    
248
-    /**
249
-     * 推送人脸数据到二号岗
250
-     * @param taPerson
251
-     */
252
-    private void sendMessageToMainusher(TaPerson taPerson) {
253
-        try {
254
-            WebSocketServer.sendInfo(JSONObject.toJSONString(taPerson), CommConstant.WECHAT_CLIENT_MAINUSHER, null);
255
-        } catch (Exception e) {}
256
-    }
257
-    
258
-    /**
259
-     * 推送消息去吧台
260
-     * @param taCustomer
261
-     */
262
-    @Override
263
-    public void sendMessageToBar(TaCustomer taCustomer,Integer personNum) {
264
-        Map<String,Object> map = new HashMap<>();
265
-        map.put("customerId",taCustomer.getCustomerId());
266
-        map.put("customerName",taCustomer.getCustomerName());
267
-        map.put("consultantName",taCustomer.getRealtyConsultant());
268
-        map.put("avatar",taCustomer.getAvatar());
269
-        map.put("visitorNum",personNum);
270
-        map.put("visitorTime",LocalDateTime.now());
271
-        map.put("type",CommConstant.IDENTITY_BARUSHER);
272
-        try {
273
-            WebSocketServer.sendInfo(JSONObject.toJSONString(map), CommConstant.WECHAT_CLIENT_MINIAPP, null);
274
-        } catch (Exception e) {}
275
-    }
276
-    
277
-    @Override
278
-    public void sendMessageToConsultManager(TaCustomer taCustomer) {
279
-        //获取所有的置业经理信息并推送消息
280
-        List<SysUser> sysUserList = sysUserMapper.selectConsultManagerList(CommConstant.IDENTITY_CONSULTANT_MANAGER);
281
-        sysUserList.stream().forEach(e -> {
282
-            String tpl = miniApp.getTpls().getVisitor();
283
-            String page = CommConstant.PAGE_MY_ATTRIBUTION + "?id=" + taCustomer.getCustomerId();
284
-            String openid = e.getOpenid();
285
-            if (null == openid) {
286
-                return;
287
-            }
288
-            List<Object> data = new ArrayList<Object>(){{
289
-                add(taCustomer.getCustomerName());
290
-                add(taCustomer.getPhone());
291
-                add("您有客户来访, 请及时接待!");
292
-            }};
293
-    
294
-            miniApp.sendTPLMessage(tpl, openid, page, data);
295
-        });
296 245
     }
297 246
 }

+ 18
- 0
src/main/java/com.huiju.welcome/service/impl/TaCarRecordServiceImpl.java 查看文件

@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
17 17
 
18 18
 import java.time.LocalDate;
19 19
 import java.time.LocalDateTime;
20
+import java.time.format.DateTimeFormatter;
20 21
 import java.util.Date;
21 22
 import java.util.List;
22 23
 
@@ -200,6 +201,15 @@ public class TaCarRecordServiceImpl extends ServiceImpl<TaCarRecordMapper, TaCar
200 201
 
201 202
         // 生成保安迎宾记录, 并通知小程序
202 203
         TaFirstUsherRecord taFirstUsherRecord = iTaFirstUsherRecordService.newRecordByDevice(taCarRecord,taCustomer);
204
+        if (null != taCustomer){
205
+            if (DateUtils.sameDay(taCustomer.getCreateDate(),LocalDateTime.now())){
206
+                taFirstUsherRecord.setNewCustomer(true);
207
+            }else {
208
+                taFirstUsherRecord.setNewCustomer(false);
209
+            }
210
+        }else {
211
+            taFirstUsherRecord.setNewCustomer(true);
212
+        }
203 213
         iTaFirstUsherRecordService.notifyCar(taFirstUsherRecord);
204 214
 
205 215
         // 如果客户有固定置业, 推送消息给置业
@@ -210,6 +220,14 @@ public class TaCarRecordServiceImpl extends ServiceImpl<TaCarRecordMapper, TaCar
210 220
                 log.error("发送消息给置业失败: {}", e.getMessage());
211 221
             }
212 222
         }
223
+        
224
+        //自动关联成功
225
+        if (null != taCustomer){
226
+            iTaCustomerService.sendMessageToConsultManager(taCustomer);
227
+        }
228
+        
229
+        //推送websocket消息。统一推送。
230
+        iTaCustomerService.sendMessageAll(taFirstUsherRecord,taCustomer,null);
213 231
 
214 232
         return true;
215 233
     }

+ 120
- 6
src/main/java/com.huiju.welcome/service/impl/TaCustomerServiceImpl.java 查看文件

@@ -1,10 +1,12 @@
1 1
 package com.huiju.welcome.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
5 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 8
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
9
+import com.huiju.welcome.common.WebSocketServer;
8 10
 import com.huiju.welcome.mapper.*;
9 11
 import com.huiju.welcome.model.*;
10 12
 import com.huiju.welcome.service.*;
@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
18 20
 import org.springframework.stereotype.Service;
19 21
 
20 22
 import java.time.LocalDateTime;
23
+import java.time.format.DateTimeFormatter;
21 24
 import java.util.ArrayList;
22 25
 import java.util.HashMap;
23 26
 import java.util.List;
@@ -184,7 +187,54 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
184 187
 
185 188
         miniApp.sendTPLMessage(tpl, openid, page, data);
186 189
     }
187
-
190
+    
191
+    /**
192
+     * 推送车辆信息给置业经理
193
+     * @param taFirstUsherRecord
194
+     * @param taCustomer
195
+     * @throws Exception
196
+     */
197
+    @Override
198
+    public void notifyFirstUsherConsultantManager(TaFirstUsherRecord taFirstUsherRecord, TaCustomer taCustomer) {
199
+        List<SysUser> sysUserList = sysUserMapper.selectConsultManagerList(CommConstant.IDENTITY_CONSULTANT_MANAGER);
200
+        String message ="";
201
+        if (null != taCustomer){
202
+            if (null == taCustomer.getConsultantId()){
203
+                message = "请安排置业接待。";
204
+            }else{
205
+                SysUser sysUser = sysUserMapper.selectById(taCustomer.getConsultantId());
206
+                message = "置业"+sysUser.getUsername()+"客户,请安排接待";
207
+            }
208
+        }else {
209
+            message = "客户已到达, 请及时关注。";
210
+        }
211
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
212
+        
213
+        String visitData = formatter.format(taFirstUsherRecord.getVisiteDate());
214
+        List<Object> data = new ArrayList<Object>();
215
+        data.add(visitData);
216
+        data.add(taFirstUsherRecord.getPlateNumber()+" "+ taFirstUsherRecord.getColor() + " " + taFirstUsherRecord.getCarModel());
217
+        data.add(message);
218
+        sysUserList.stream().forEach(e -> {
219
+            String tpl = miniApp.getTpls().getFirstUsher();
220
+            String page = CommConstant.PAGE_MY_FIRSTUSHER + "?id=" + taFirstUsherRecord.getRecId();
221
+            String openid = e.getOpenid();
222
+            if (null == openid) {
223
+                return;
224
+            }
225
+            miniApp.sendTPLMessage(tpl, openid, page, data);
226
+        });
227
+    }
228
+    
229
+    @Override
230
+    public TaCustomer getCutomerByPhoneAndPlatenumber(String phone, String plateNumber) {
231
+        List<TaCustomer> list = taCustomerMapper.getSomeCustMayBe(plateNumber,phone);
232
+        if (list.size() > 0){
233
+            return list.get(0);
234
+        }
235
+        return null;
236
+    }
237
+    
188 238
     @Override
189 239
     public boolean updateConsultant(TaCustomer taCustomer, Integer consultantId) {
190 240
         SysUser usr = sysUserMapper.selectById(consultantId);
@@ -248,10 +298,10 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
248 298
         }
249 299
     
250 300
         if (notify){
251
-            //通知吧台来人了
252
-            cameraService.sendMessageToBar(cust,taMainUsherRecord.getPersonNum());
301
+            //通知前端
302
+            sendMessageAll(null,cust,taMainUsherRecord);
253 303
             //推送置业经理
254
-            cameraService.sendMessageToConsultManager(cust);
304
+            sendMessageToConsultManager(cust);
255 305
         }
256 306
         
257 307
         return cust;
@@ -289,9 +339,13 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
289 339
         }
290 340
         if (notify){
291 341
             //通知吧台来人了
292
-            cameraService.sendMessageToBar(cust,taFirstUsherRecord.getPersonNum());
342
+            sendMessageAll(taFirstUsherRecord,cust,null);
343
+            
344
+            //通知吧台人数等信息
345
+            sendMessageToBar(cust,taFirstUsherRecord.getPersonNum());
346
+            
293 347
             //推送置业经理
294
-            cameraService.sendMessageToConsultManager(cust);
348
+            sendMessageToConsultManager(cust);
295 349
         }
296 350
         
297 351
         return cust;
@@ -535,5 +589,65 @@ public class TaCustomerServiceImpl extends ServiceImpl<TaCustomerMapper, TaCusto
535 589
 
536 590
         return taCustomerMapper.insert(taCustomer) > 0;
537 591
     }
592
+    
593
+    
594
+    
595
+    /**
596
+     * 推送消息去吧台
597
+     * @param taCustomer
598
+     */
599
+    @Override
600
+    public void sendMessageToBar(TaCustomer taCustomer,Integer personNum) {
601
+        Map<String,Object> map = new HashMap<>();
602
+        map.put("customerId",taCustomer.getCustomerId());
603
+        map.put("customerName",taCustomer.getCustomerName());
604
+        map.put("consultantName",taCustomer.getRealtyConsultant());
605
+        map.put("avatar",taCustomer.getAvatar());
606
+        map.put("visitorNum",personNum);
607
+        map.put("visitorTime",LocalDateTime.now());
608
+        map.put("type",CommConstant.IDENTITY_BARUSHER);
609
+        try {
610
+            WebSocketServer.sendInfo(JSONObject.toJSONString(map), CommConstant.WECHAT_CLIENT_MINIAPP, null);
611
+        } catch (Exception e) {}
612
+    }
613
+    
614
+    @Override
615
+    public void sendMessageToConsultManager(TaCustomer taCustomer) {
616
+        //获取所有的置业经理信息并推送消息
617
+        List<SysUser> sysUserList = sysUserMapper.selectConsultManagerList(CommConstant.IDENTITY_CONSULTANT_MANAGER);
618
+        sysUserList.stream().forEach(e -> {
619
+            String tpl = miniApp.getTpls().getVisitor();
620
+            String page = CommConstant.PAGE_MY_CUSTOMER + "?id=" + taCustomer.getCustomerId();
621
+            String openid = e.getOpenid();
622
+            if (null == openid) {
623
+                return;
624
+            }
625
+            List<Object> data = new ArrayList<Object>(){{
626
+                add(taCustomer.getCustomerName());
627
+                add(taCustomer.getPhone());
628
+                add("您有客户来访, 请及时接待!");
629
+            }};
630
+            
631
+            miniApp.sendTPLMessage(tpl, openid, page, data);
632
+        });
633
+    }
634
+    
635
+    @Override
636
+    public void sendMessageAll(TaFirstUsherRecord taFirstUsherRecord, TaCustomer taCustomer, TaMainUsherRecord taMainUsherRecord) {
637
+        Map<String,Object> map = new HashMap<>();
638
+        map.put("type",CommConstant.IDENTITY_ALL_USHER);
639
+        if (null != taFirstUsherRecord){
640
+            map.put("taFirstUsherRecord",taFirstUsherRecord);
641
+        }
642
+        if (null != taCustomer){
643
+            map.put("taCustomer",taCustomer);
644
+        }
645
+        if (null != taMainUsherRecord){
646
+            map.put("taMainUsherRecord",taMainUsherRecord);
647
+        }
648
+        try {
649
+            WebSocketServer.sendInfo(JSONObject.toJSONString(map), CommConstant.WECHAT_CLIENT_MINIAPP, null);
650
+        } catch (Exception e) {}
651
+    }
538 652
 
539 653
 }

+ 17
- 5
src/main/java/com.huiju.welcome/service/impl/TaFirstUsherRecordServiceImpl.java 查看文件

@@ -83,6 +83,8 @@ public class TaFirstUsherRecordServiceImpl extends ServiceImpl<TaFirstUsherRecor
83 83
         if (null != taCustomer){
84 84
             taFirstUsherRecord.setConsultantId(taCustomer.getConsultantId());
85 85
             taFirstUsherRecord.setRealtyConsultant(taCustomer.getRealtyConsultant());
86
+            taFirstUsherRecord.setPhone(taCustomer.getPhone());
87
+            taFirstUsherRecord.setPersonName(taCustomer.getCustomerName());
86 88
         }
87 89
         
88 90
         taFirstUsherRecordMapper.insert(taFirstUsherRecord);
@@ -177,6 +179,10 @@ public class TaFirstUsherRecordServiceImpl extends ServiceImpl<TaFirstUsherRecor
177 179
             if (StringUtils.isEmpty(taMainUsherRecord.getPlateNumber())) {
178 180
                 taMainUsherRecord.setPlateNumber(taFirstUsherRecord.getPlateNumber());
179 181
             }
182
+            
183
+            if(null != taMainUsherRecord.getPersonNum()){
184
+                taMainUsherRecord.setPersonNum(taFirstUsherRecord.getPersonNum());
185
+            }
180 186
 
181 187
             iTaMainUsherRecordService.updateById(taMainUsherRecord);
182 188
         }
@@ -224,13 +230,19 @@ public class TaFirstUsherRecordServiceImpl extends ServiceImpl<TaFirstUsherRecor
224 230
                 if (null != taCustomer.getConsultantId()){
225 231
                     iTaCustomerService.notifyConsultant(taCustomer);
226 232
                 }
227
-                //通知吧台来人了
228
-                cameraService.sendMessageToBar(taCustomer,taFirstUsherRecord.getPersonNum());
229
-                //推送置业经理
230
-                cameraService.sendMessageToConsultManager(taCustomer);
233
+                //通知前端
234
+                iTaCustomerService.sendMessageAll(taFirstUsherRecord,taCustomer,null);
235
+                //通知置业经理车辆信息
236
+                iTaCustomerService.notifyConsultant(taCustomer);
231 237
             } catch (Exception e) {}
238
+        }else if(StringUtils.isEmpty(taFirstUsherRecord.getPhone())){
239
+            //有手机号的情况下会新建customer,推送后置
240
+            //通知置业经理车辆信息
241
+            iTaCustomerService.notifyFirstUsherConsultantManager(taFirstUsherRecord,taCustomer);
242
+            //通知前端
243
+            iTaCustomerService.sendMessageAll(taFirstUsherRecord,taCustomer,null);
232 244
         }
233
-
245
+        
234 246
         // 依据车牌判断是否老客户来访
235 247
         //if (!StringUtils.isEmpty(plateNumber)) {
236 248
         //    List<TaCustomer> taCustomerList = iTaCustomerService.getSomeCustMayBe(plateNumber);

+ 20
- 9
src/main/java/com.huiju.welcome/service/impl/TaMainUsherRecordServiceImpl.java 查看文件

@@ -273,10 +273,6 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
273 273
                 taCustomer = iTaCustomerService.getSameByPerson(personId);
274 274
             }
275 275
         }
276
-    
277
-        //if (null == taCustomer && null == taMainUsherRecord.getCustomerId()) {
278
-        //    taCustomer = iTaCustomerService.newCustByMainUsher(taMainUsherRecord, false);
279
-        //}
280 276
         
281 277
         if (null == taCustomer){
282 278
             // 新增客户
@@ -325,6 +321,9 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
325 321
                 if (!StringUtils.isEmpty(taMainUsherRecord.getColor())){
326 322
                     taMainUsherRecordToday.setColor(taMainUsherRecord.getColor());
327 323
                 }
324
+                if (!StringUtils.isEmpty(taMainUsherRecord.getAvatar())){
325
+                    taMainUsherRecordToday.setAvatar(taMainUsherRecord.getAvatar());
326
+                }
328 327
                 return updateByMiniapp(taMainUsherRecordToday);
329 328
             }
330 329
         }
@@ -369,7 +368,8 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
369 368
 
370 369
         // 是否需要更新客户信息
371 370
         // 只更新空内容
372
-        if (StringUtils.isEmpty(taCustomer.getCustomerName()) || StringUtils.isEmpty(taCustomer.getPhone())) {
371
+        if (StringUtils.isEmpty(taCustomer.getCustomerName()) || StringUtils.isEmpty(taCustomer.getPhone()) || StringUtils.isEmpty(taCustomer.getAvatar())
372
+             || StringUtils.isEmpty(taCustomer.getPlateNumber() )) {
373 373
             if (StringUtils.isEmpty(taCustomer.getCustomerName())) {
374 374
                 taCustomer.setCustomerName(taMainUsherRecord.getPersonName());
375 375
             }
@@ -442,11 +442,12 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
442 442
             miniApp.sendTPLMessage(tplId, proxyOpenid, page, dt2);
443 443
         }
444 444
     
445
-        //通知吧台来人了
446
-        cameraService.sendMessageToBar(taCustomer,taMainUsherRecord.getPersonNum());
445
+        //通知前端
446
+        iTaCustomerService.sendMessageAll(null,taCustomer,taMainUsherRecord);
447 447
         //推送置业经理
448
-        cameraService.sendMessageToConsultManager(taCustomer);
449
-
448
+        iTaCustomerService.sendMessageToConsultManager(taCustomer);
449
+        //推送吧台
450
+        iTaCustomerService.sendMessageToBar(taCustomer,taMainUsherRecord.getPersonNum());
450 451
         return row > 0;
451 452
     }
452 453
 
@@ -472,6 +473,15 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
472 473
         taMainUsherRecord.setStatus(StatusUtils.Ready);
473 474
         taMainUsherRecord.setPersonId(taPerson.getRealId());
474 475
         int row = taMainUsherRecordMapper.insert(taMainUsherRecord);
476
+        if (null != taCustomer){
477
+            if (DateUtils.sameDay(taCustomer.getCreateDate(),LocalDateTime.now())){
478
+                taMainUsherRecord.setNewCustomer(true);
479
+            }else {
480
+                taMainUsherRecord.setNewCustomer(false);
481
+            }
482
+        }else {
483
+            taMainUsherRecord.setNewCustomer(true);
484
+        }
475 485
 
476 486
         try {
477 487
             Action act = Action.create(Action.TYPE_NEW_MAIN_USHER, JSONObject.toJSONString(taMainUsherRecord, SerializerFeature.WriteMapNullValue));
@@ -589,6 +599,7 @@ public class TaMainUsherRecordServiceImpl extends ServiceImpl<TaMainUsherRecordM
589 599
         taMainUsherRecord.setChannel(taFirstUsherRecord.getChannel());
590 600
         taMainUsherRecord.setPurpose(taFirstUsherRecord.getPurpose());
591 601
         taMainUsherRecord.setCarImage(taFirstUsherRecord.getCarImage());
602
+        taMainUsherRecord.setPersonNum(taFirstUsherRecord.getPersonNum());
592 603
 
593 604
         if (null != taCustomer) {
594 605
             taMainUsherRecord.setPersonId(taCustomer.getCustomerId());

+ 2
- 1
src/main/java/com.huiju.welcome/utils/CommConstant.java 查看文件

@@ -6,9 +6,10 @@ public class CommConstant {
6 6
     public final static String IDENTITY_MAINUSHER = "main-usher";
7 7
     public final static String IDENTITY_BARUSHER = "bar-usher";
8 8
     public final static String IDENTITY_CONSULTANT_MANAGER = "consultant_manager";
9
+    public final static String IDENTITY_ALL_USHER = "all-usher";
9 10
 
10 11
     public final static String PAGE_MY_CUSTOMER = "pages/client/clientdetail/clientdetail";
11
-    public final static String PAGE_MY_ATTRIBUTION = "pages/client/visitorList/visitorList";
12
+    public final static String PAGE_MY_FIRSTUSHER = "pages/client/visitorDetail/visitorDetail";
12 13
 
13 14
     public final static String WECHAT_CLIENT_MINIAPP = "miniapp";
14 15
     public final static String WECHAT_CLIENT_CAR = "car";

+ 2
- 0
src/main/java/com.huiju.welcome/utils/MiniApp.java 查看文件

@@ -101,5 +101,7 @@ public class MiniApp {
101 101
     @Data
102 102
     public static class Tpl {
103 103
         private String visitor;
104
+        
105
+        private String firstUsher;
104 106
     }
105 107
 }

+ 1
- 0
src/main/resources/application.yml 查看文件

@@ -50,6 +50,7 @@ miniapp:
50 50
   secret: 03fcb0228ada1dd27ba45fb5a64c6f52
51 51
   tpls:
52 52
     visitor: m5fR2X1D-iWUurRe-pQQU8VgcxSSZ5eAVoquMixphFw
53
+    firstUsher: DlpqippBqmqkWWLDxsxB7iIbhlD7px4TCnP2KcK7DY8
53 54
 
54 55
 # ali-cloud
55 56
 ali: