|
@@ -2,6 +2,7 @@ package com.yunzhi.marketing.service.impl;
|
2
|
2
|
|
3
|
3
|
import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
|
4
|
4
|
import com.alibaba.fastjson.JSONObject;
|
|
5
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
5
|
6
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
6
|
7
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
7
|
8
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -14,6 +15,7 @@ import com.yunzhi.marketing.common.CommConstant;
|
14
|
15
|
import com.yunzhi.marketing.common.DateUtils;
|
15
|
16
|
import com.yunzhi.marketing.common.MD5Utils;
|
16
|
17
|
import com.yunzhi.marketing.common.StringUtils;
|
|
18
|
+import com.yunzhi.marketing.dto.PersonMarketingDTO;
|
17
|
19
|
import com.yunzhi.marketing.event.EventBus;
|
18
|
20
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
19
|
21
|
import com.yunzhi.marketing.entity.*;
|
|
@@ -1292,4 +1294,40 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
|
1292
|
1294
|
responseBean.addSuccess("修改成功");
|
1293
|
1295
|
return responseBean;
|
1294
|
1296
|
}
|
|
1297
|
+
|
|
1298
|
+ /**
|
|
1299
|
+ * 成为驻场顾问
|
|
1300
|
+ *
|
|
1301
|
+ * @param marketingDTO
|
|
1302
|
+ * @param openid
|
|
1303
|
+ * @return
|
|
1304
|
+ */
|
|
1305
|
+ @Override
|
|
1306
|
+ public ResponseBean marketing(PersonMarketingDTO marketingDTO, String openid) {
|
|
1307
|
+ List<TaPerson> taPersons = getPersonsByOpenId(openid);
|
|
1308
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
1309
|
+ return ResponseBean.error("验证当前人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
1310
|
+ }
|
|
1311
|
+
|
|
1312
|
+ TaPerson taPerson = taPersons.get(0);
|
|
1313
|
+
|
|
1314
|
+ // 校验marketingCode 是否正确
|
|
1315
|
+ LambdaQueryWrapper<TaBuilding> taBuildingLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
1316
|
+ taBuildingLambdaQueryWrapper.eq(TaBuilding::getMarketingCode,marketingDTO.getMarketingCode());
|
|
1317
|
+ TaBuilding taBuilding = taBuildingMapper.selectOne(taBuildingLambdaQueryWrapper);
|
|
1318
|
+ if (null == taBuilding){
|
|
1319
|
+ return ResponseBean.error("不合法的驻场码", ResponseBean.ERROR_UNAVAILABLE);
|
|
1320
|
+ }
|
|
1321
|
+ // 成为驻场顾问并绑定楼盘
|
|
1322
|
+ taPerson.setPersonType("marketing");
|
|
1323
|
+ taPersonMapper.updateById(taPerson);
|
|
1324
|
+
|
|
1325
|
+ TaPersonBuilding taPersonBuilding = new TaPersonBuilding();
|
|
1326
|
+ taPersonBuilding.setBuildingId(taBuilding.getBuildingId());
|
|
1327
|
+ taPersonBuilding.setPersonId(taPerson.getPersonId());
|
|
1328
|
+ taPersonBuilding.setCreateDate(LocalDateTime.now());
|
|
1329
|
+ taPersonBuildingMapper.insert(taPersonBuilding);
|
|
1330
|
+
|
|
1331
|
+ return ResponseBean.success("绑定成功");
|
|
1332
|
+ }
|
1295
|
1333
|
}
|