Ver código fonte

* 代码优化

顾绍勇 5 anos atrás
pai
commit
d893dd4b61

+ 1
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java Ver arquivo

@@ -465,7 +465,7 @@ public class CommConstant {
465 465
      * 审核通知  预选/认筹
466 466
      * 必须存在表   td_miniapp_template_type 中
467 467
      */
468
-    public static final String MESSAGE_CONTENT_OF_CHECK = "check-result";
468
+    public static final String MESSAGE_CONTENT_OF_HOUSE = "house";
469 469
     
470 470
     /**
471 471
      * 活动以结束

+ 1
- 1
src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java Ver arquivo

@@ -394,7 +394,7 @@ public class TaPersonVisitRecordController extends BaseController {
394 394
                     e.setHouseShareNum(shareNum);
395 395
                     break;
396 396
                 case CommConstant.LIVE:
397
-                    e.setLiveSareNum(shareNum);
397
+                    e.setLiveShareNum(shareNum);
398 398
                     break;
399 399
             }
400 400
         });

+ 1
- 1
src/main/java/com/huiju/estateagents/entity/TaConsultantInfo.java Ver arquivo

@@ -38,5 +38,5 @@ public class TaConsultantInfo {
38 38
 
39 39
     private String priceType;
40 40
 
41
-    private Integer liveSareNum;
41
+    private Integer liveShareNum;
42 42
 }

+ 11
- 0
src/main/java/com/huiju/estateagents/entity/TaLiveActivity.java Ver arquivo

@@ -146,4 +146,15 @@ public class TaLiveActivity implements Serializable {
146 146
 
147 147
     @TableField(exist = false)
148 148
     private String cityName;
149
+
150
+    @TableField(exist = false)
151
+    private String liveAppName;
152
+
153
+    @TableField(exist = false)
154
+    private String liveAppAppId;
155
+
156
+    @TableField(exist = false)
157
+    private String liveAppPath;
158
+
159
+
149 160
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IMiniAppService.java Ver arquivo

@@ -30,7 +30,7 @@ public interface IMiniAppService {
30 30
 
31 31
     void sendGroupMessage(TaPerson toUser, String link, String result, String activityName, LocalDateTime dt);
32 32
 
33
-    void sendCheckMessage(TaPerson toUser, String link, String name, String result, String programName, String failReason, String remark, LocalDateTime dt);
33
+    void sendCheckMessage(TaPerson toUser, String link, String name, String result, String programName, String failReason, String remark, LocalDateTime dt, Boolean isSuccess);
34 34
 
35 35
     ResponseBean getQrCode(String paramsStr, String appid);
36 36
 

+ 9
- 9
src/main/java/com/huiju/estateagents/service/impl/MiniAppServiceImpl.java Ver arquivo

@@ -268,7 +268,7 @@ public class MiniAppServiceImpl implements IMiniAppService {
268 268
 
269 269
     @Override
270 270
     public void sendCheckMessage(TaPerson toUser, String link, String name, String result, String programName,
271
-                                 String failReason, String remark, LocalDateTime dt) {
271
+                                 String failReason, String remark, LocalDateTime dt, Boolean isSuccess) {
272 272
         TaMiniapp miniapp = taMiniappMapper.selectById(toUser.getMiniappId());
273 273
         if (null == miniapp) {
274 274
             log.error("小程序 {} 不存在", toUser.getMiniappId());
@@ -276,32 +276,32 @@ public class MiniAppServiceImpl implements IMiniAppService {
276 276
         }
277 277
 
278 278
         // 消息内容类型
279
-        String contentType = CommConstant.MESSAGE_CONTENT_OF_CHECK;
279
+        String contentType = CommConstant.MESSAGE_CONTENT_OF_HOUSE;
280 280
         TaMiniappTemplate tpl = getTplByType(contentType, toUser.getMiniappId());
281 281
         boolean isSubscribe = null != tpl && (null == tpl.getIsSubscribe() ? false : tpl.getIsSubscribe());
282 282
         // 消息发送类型
283 283
         String messageType = null == tpl ? CommConstant.MESSAGE_TYPE_OF_SMS :
284 284
                 isSubscribe ? CommConstant.MESSAGE_TYPE_OF_MINIAPP_SUBSCRIBE : CommConstant.MESSAGE_TYPE_OF_MINIAPP_TEMPLATE;
285 285
 
286
-        String[] smsParams = {miniapp.getName() + "小程序-" + name};
286
+        String[] smsParams = {miniapp.getName() + "小程序-" + programName + name};
287 287
 
288 288
         if (null == tpl) {
289
-            log.error("小程序 {} 无通知消息模板 {}", toUser.getMiniappId(), contentType);
290
-
291
-            // 短信发送
292
-            sendSmsMessage(StringUtils.ifNull(toUser.getTel(), toUser.getPhone()), contentType, smsParams);
289
+            if (isSuccess) {
290
+                log.error("小程序 {} 无通知消息模板 {}", toUser.getMiniappId(), contentType);
291
+                // 短信发送
292
+                sendSmsMessage(StringUtils.ifNull(toUser.getTel(), toUser.getPhone()), contentType, smsParams);
293
+            }
293 294
         } else {
294 295
             if (isSubscribe) {
295 296
                 String[] data = new String[]{name, result, programName, remark, failReason, DateUtils.cutSecond(dt)};
296 297
                 ResponseBean res = sendSubscribeMessage(tpl, toUser, link, data);
297
-                if (res.getCode() != ResponseBean.CODE_SUCCESS) {
298
+                if (res.getCode() != ResponseBean.CODE_SUCCESS && isSuccess) {
298 299
                     // 使用短信发送
299 300
                     sendSmsMessage(StringUtils.ifNull(toUser.getTel(), toUser.getPhone()), contentType, smsParams);
300 301
                     messageType = CommConstant.MESSAGE_TYPE_OF_SMS;
301 302
                 }
302 303
             } else {
303 304
                 log.info("发送模板消息");
304
-
305 305
             }
306 306
         }
307 307
         // TODO 写消息发送日志

+ 22
- 6
src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java Ver arquivo

@@ -9,6 +9,7 @@ import com.huiju.estateagents.base.ResponseBean;
9 9
 import com.huiju.estateagents.common.CommConstant;
10 10
 import com.huiju.estateagents.entity.*;
11 11
 import com.huiju.estateagents.mapper.TaLiveActivityMapper;
12
+import com.huiju.estateagents.mapper.TdLiveDictMapper;
12 13
 import com.huiju.estateagents.service.*;
13 14
 import org.apache.commons.collections.CollectionUtils;
14 15
 import org.apache.commons.lang3.StringUtils;
@@ -56,6 +57,9 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
56 57
     @Autowired
57 58
     private TdPosterTemplateServiceImpl posterTemplateService;
58 59
 
60
+    @Autowired
61
+    private TdLiveDictMapper tdLiveDictMapper;
62
+
59 63
 
60 64
     @Override
61 65
     public ResponseBean taLiveActivityAdd(TaLiveActivity taLiveActivity) {
@@ -102,7 +106,7 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
102 106
 
103 107
     @Override
104 108
     public IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
105
-                                                    String cityId, String buildingId, Integer status) {
109
+                                                             String cityId, String buildingId, Integer status) {
106 110
         logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{}," +
107 111
                     "liveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{}", pageNum, pageSize,
108 112
                 liveActivityTitle, cityId, buildingId, status);
@@ -124,19 +128,31 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
124 128
     }
125 129
 
126 130
     @Override
127
-    public ResponseBean getLiveActivityDetailById(String id,Integer orgId) {
128
-        logger.info("getLiveActivityDetailById 接收参数:id:{},orgId:{}", id,orgId);
131
+    public ResponseBean getLiveActivityDetailById(String id, Integer orgId) {
132
+        logger.info("getLiveActivityDetailById 接收参数:id:{},orgId:{}", id, orgId);
129 133
 
130 134
         ResponseBean responseBean = new ResponseBean();
131 135
         QueryWrapper<TaLiveActivity> liveActivityQueryWrapper = new QueryWrapper<>();
132
-        liveActivityQueryWrapper.eq("live_activity_id",id);
133
-        liveActivityQueryWrapper.eq("org_id",orgId);
136
+        liveActivityQueryWrapper.eq("live_activity_id", id);
137
+        liveActivityQueryWrapper.eq("org_id", orgId);
134 138
         TaLiveActivity result = taLiveActivityMapper.selectOne(liveActivityQueryWrapper);
135 139
         if (result == null) {
136 140
             responseBean.addSuccess(null);
137 141
             return responseBean;
138 142
         }
139 143
 
144
+        // 获取直播小程序信息
145
+        QueryWrapper<TdLiveDict> tdLiveDictQueryWrapper = new QueryWrapper<>();
146
+        tdLiveDictQueryWrapper.eq("id", result.getLiveApp());
147
+        tdLiveDictQueryWrapper.eq("status", "1");
148
+        TdLiveDict tdLiveDict = tdLiveDictMapper.selectOne(tdLiveDictQueryWrapper);
149
+        if(tdLiveDict == null){
150
+            responseBean.addSuccess(null);
151
+            return responseBean;
152
+        }
153
+        result.setLiveAppName(tdLiveDict.getLivePlatName());
154
+        result.setLiveAppAppId(tdLiveDict.getLivePlatValue());
155
+
140 156
         // 获取海报信息
141 157
         QueryWrapper<TaPoster> queryWrapper = new QueryWrapper<>();
142 158
         queryWrapper.eq("target_id", id + "");
@@ -169,7 +185,7 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
169 185
     @Override
170 186
     public ResponseBean delLiveActivityList(Integer orgId, List<TaLiveActivity> liveActivityList) {
171 187
         ResponseBean responseBean = new ResponseBean();
172
-        taLiveActivityMapper.updateLiveActivityStatus(orgId,liveActivityList);
188
+        taLiveActivityMapper.updateLiveActivityStatus(orgId, liveActivityList);
173 189
         return responseBean;
174 190
     }
175 191
 }

+ 17
- 15
src/main/java/com/huiju/estateagents/service/impl/TaPreselectionRecordServiceImpl.java Ver arquivo

@@ -114,7 +114,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
114 114
         TaPreselectionRecord record = taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
115 115
         if (record != null) {
116 116
             tip = "已预选过此房源,请到选房记录中查看。";
117
-            sendSubscribeMsg(houseId, personId, checkType, "失败", tip);
117
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
118 118
             responseBean.addError(tip);
119 119
             return responseBean;
120 120
         }
@@ -122,7 +122,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
122 122
         TaHousingResourcesPO resourcesPO = taHousingResourcesMapper.getHousingDetailById(taPreselectionRecord.getHouseId(), "0");
123 123
         if (resourcesPO == null) {
124 124
             tip = "未知原因失败,请联系置业顾问。";
125
-            sendSubscribeMsg(houseId, personId, checkType, "失败", tip);
125
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
126 126
             responseBean.addError(tip);
127 127
             return responseBean;
128 128
         }
@@ -130,7 +130,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
130 130
         // 校验当前批次状态是否为已发布
131 131
         if (resourcesPO.getSaleBatchStatus() != 1) {
132 132
             tip = "当前销售批次已临时取消发布,请稍后再试或联系置业顾问了解详情。";
133
-            sendSubscribeMsg(houseId, personId, checkType, "失败", tip);
133
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
134 134
             responseBean.addError(tip);
135 135
             return responseBean;
136 136
         }
@@ -138,7 +138,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
138 138
         // 校验当前房源状态是否为已发布
139 139
         if (1 != resourcesPO.getStatus()) {
140 140
             tip = "当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。";
141
-            sendSubscribeMsg(houseId, personId, checkType, "失败", tip);
141
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
142 142
             responseBean.addError(tip);
143 143
             return responseBean;
144 144
         }
@@ -146,7 +146,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
146 146
         // 校验预选操作时间是否在规定范围内
147 147
         if (!DateUtils.checkTimeRange(resourcesPO.getPreselectionStartTime(), resourcesPO.getPreselectionEndTime(), null)) {
148 148
             tip = "当前时间不在预选时间范围内,请联系置业顾问了解详情。";
149
-            sendSubscribeMsg(houseId, personId, checkType, "失败", tip);
149
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
150 150
             responseBean.addError(tip);
151 151
             return responseBean;
152 152
         }
@@ -160,12 +160,12 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
160 160
         // 更新房源表热度
161 161
         Boolean result = taHousingResourcesMapper.updateForAddHeat(taPreselectionRecord.getHouseId());
162 162
         if (result) {
163
-            sendSubscribeMsg(houseId, personId, checkType, "成功", "");
163
+            sendSubscribeMsg(houseId, personId, checkType, "成功", "", true);
164 164
             responseBean.addSuccess(taPreselectionRecord);
165 165
             return responseBean;
166 166
         }
167 167
         tip = "未知原因失败,请联系置业顾问。";
168
-        sendSubscribeMsg(houseId, personId, checkType, "失败", tip);
168
+        sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
169 169
         responseBean.addError(tip);
170 170
         return responseBean;
171 171
     }
@@ -183,7 +183,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
183 183
         TaPreselectionRecord preselectionRecord = taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
184 184
         if (preselectionRecord == null) {
185 185
             tip = "未预选过此房源,或已取消预选此房源";
186
-            sendSubscribeMsg(houseId,personId,checkType,"失败",tip);
186
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
187 187
             responseBean.addError(tip);
188 188
             return responseBean;
189 189
         }
@@ -191,7 +191,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
191 191
         TaHousingResourcesPO resourcesPO = taHousingResourcesMapper.getHousingDetailById(houseId, "0");
192 192
         if (resourcesPO == null || 1 != resourcesPO.getStatus()) {
193 193
             tip = "当前房源已临时取消发布,请稍后再试或联系置业顾问了解详情。";
194
-            sendSubscribeMsg(houseId,personId,checkType,"失败",tip);
194
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
195 195
             responseBean.addError(tip);
196 196
             return responseBean;
197 197
         }
@@ -199,7 +199,7 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
199 199
         // 校验当前批次状态是否为已发布
200 200
         if (resourcesPO.getSaleBatchStatus() != 1) {
201 201
             tip = "当前销售批次已临时取消发布,请稍后再试或联系置业顾问了解详情。";
202
-            sendSubscribeMsg(houseId,personId,checkType,"失败",tip);
202
+            sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
203 203
             responseBean.addError(tip);
204 204
             return responseBean;
205 205
         }
@@ -215,10 +215,11 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
215 215
         Boolean result = taHousingResourcesMapper.updateForSubtractHeat(houseId);
216 216
         if (result) {
217 217
             responseBean.addSuccess(result);
218
+            sendSubscribeMsg(houseId, personId, checkType, "成功", "无", true);
218 219
             return responseBean;
219 220
         }
220 221
         tip = "未知原因失败,请联系置业顾问。";
221
-        sendSubscribeMsg(houseId,personId,checkType,"失败",tip);
222
+        sendSubscribeMsg(houseId, personId, checkType, "失败", tip, false);
222 223
         responseBean.addError(tip);
223 224
         return responseBean;
224 225
     }
@@ -240,8 +241,9 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
240 241
      * @param checkType  审核类型
241 242
      * @param result     审核结果
242 243
      * @param failReason 失败原因
244
+     * @param isSuccess  是否成功 true是(只有成功才发送短信)
243 245
      */
244
-    public void sendSubscribeMsg(String houseId, String personId, String checkType, String result, String failReason) {
246
+    public void sendSubscribeMsg(String houseId, String personId, String checkType, String result, String failReason, Boolean isSuccess) {
245 247
         logger.info("sendSubscribeMsg 接收参数:houseId:{},checkType:{},result:{},failReason:{}",
246 248
                 houseId, checkType, result, failReason);
247 249
 
@@ -263,9 +265,9 @@ public class TaPreselectionRecordServiceImpl extends ServiceImpl<TaPreselectionR
263 265
             }
264 266
 
265 267
             String link = "";
266
-            String remark = "";
267
-            String progranName = po.getBuildingName() + po.getTermName() + po.getBlockName() + po.getUnitName() + po.getFloorName() + po.getRoomName();
268
-            miniAppService.sendCheckMessage(toUser, link, checkType, result, progranName, failReason, remark, LocalDateTime.now());
268
+            String progranName = (po.getBuildingName() + po.getTermName() + po.getBlockName() + po.getUnitName() + po.getFloorName() + po.getRoomName()).replace("null", "");
269
+            String remark = progranName;
270
+            miniAppService.sendCheckMessage(toUser, link, checkType, result, progranName, failReason, remark, LocalDateTime.now(), isSuccess);
269 271
             logger.info("sendSubscribeMsg 结束");
270 272
         });
271 273
     }

+ 1
- 1
src/main/resources/mapper/TaPersonVisitRecordMapper.xml Ver arquivo

@@ -366,7 +366,7 @@
366 366
 						'2' AS building_name,
367 367
 						'3' AS address,
368 368
 						1 AS building_type_id,
369
-						LEFT ( t.tagert_type, 5 ) AS eventType,
369
+						LEFT ( t.tagert_type, 4 ) AS eventType,
370 370
 						t.create_date AS visit_time
371 371
 					FROM
372 372
 						ta_share t