傅行帆 3 anni fa
parent
commit
593fbd70de

+ 15
- 0
src/main/java/com/yunzhi/marketing/controller/TaPersonController.java Vedi File

12
 import com.yunzhi.marketing.common.CommConstant;
12
 import com.yunzhi.marketing.common.CommConstant;
13
 import com.yunzhi.marketing.common.SMSUtils;
13
 import com.yunzhi.marketing.common.SMSUtils;
14
 import com.yunzhi.marketing.common.StringUtils;
14
 import com.yunzhi.marketing.common.StringUtils;
15
+import com.yunzhi.marketing.dto.PersonMarketingDTO;
15
 import com.yunzhi.marketing.entity.TaChannel;
16
 import com.yunzhi.marketing.entity.TaChannel;
16
 import com.yunzhi.marketing.entity.TaChannelPerson;
17
 import com.yunzhi.marketing.entity.TaChannelPerson;
17
 import com.yunzhi.marketing.entity.TaPerson;
18
 import com.yunzhi.marketing.entity.TaPerson;
22
 import com.yunzhi.marketing.service.TaChannelService;
23
 import com.yunzhi.marketing.service.TaChannelService;
23
 import com.yunzhi.marketing.third.entity.TaThirdPartyMiniappConfig;
24
 import com.yunzhi.marketing.third.entity.TaThirdPartyMiniappConfig;
24
 import com.yunzhi.marketing.third.service.ITaThirdPartyMiniappConfigService;
25
 import com.yunzhi.marketing.third.service.ITaThirdPartyMiniappConfigService;
26
+import io.swagger.annotations.Api;
27
+import io.swagger.annotations.ApiOperation;
25
 import org.springframework.beans.factory.annotation.Autowired;
28
 import org.springframework.beans.factory.annotation.Autowired;
26
 import org.springframework.web.bind.annotation.*;
29
 import org.springframework.web.bind.annotation.*;
27
 import org.springframework.web.client.RestTemplate;
30
 import org.springframework.web.client.RestTemplate;
43
  */
46
  */
44
 @RestController
47
 @RestController
45
 @RequestMapping("/api")
48
 @RequestMapping("/api")
49
+@Api(value = "微信用户表", tags = "xlk-微信用户表")
46
 public class TaPersonController extends BaseController {
50
 public class TaPersonController extends BaseController {
47
     @Autowired
51
     @Autowired
48
     ITaPersonService taPersonService;
52
     ITaPersonService taPersonService;
377
         return null;
381
         return null;
378
     }
382
     }
379
 
383
 
384
+    /**
385
+     * 成为驻场顾问
386
+     *
387
+     */
388
+    @ApiOperation(value = "wx-成为驻场顾问", notes = "admin-成为驻场顾问")
389
+    @PostMapping("/wx/marketing")
390
+    public ResponseBean marketing(@RequestBody PersonMarketingDTO marketingDTO, HttpServletRequest request) {
391
+        // 当前人员
392
+        String openid = getOpenId(request);
393
+        return taPersonService.marketing(marketingDTO,openid);
394
+    }
380
 
395
 
381
     /**
396
     /**
382
      *
397
      *

+ 9
- 0
src/main/java/com/yunzhi/marketing/dto/PersonMarketingDTO.java Vedi File

1
+package com.yunzhi.marketing.dto;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class PersonMarketingDTO {
7
+
8
+    private String marketingCode;
9
+}

+ 5
- 0
src/main/java/com/yunzhi/marketing/entity/TaBuilding.java Vedi File

365
     /** 供暖 */
365
     /** 供暖 */
366
     private String heatingSupply ;
366
     private String heatingSupply ;
367
 
367
 
368
+    /**
369
+     * 驻场code
370
+     */
371
+    private String marketingCode;
372
+
368
     /**
373
     /**
369
      * 项目亮点封面
374
      * 项目亮点封面
370
      */
375
      */

+ 2
- 0
src/main/java/com/yunzhi/marketing/po/LiveAndVideoVO.java Vedi File

20
     private String type;
20
     private String type;
21
 
21
 
22
     private String kind;
22
     private String kind;
23
+
24
+    private String images;
23
 }
25
 }

+ 9
- 0
src/main/java/com/yunzhi/marketing/service/ITaPersonService.java Vedi File

4
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
 import com.yunzhi.marketing.base.ResponseBean;
5
 import com.yunzhi.marketing.base.ResponseBean;
6
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
6
 import com.yunzhi.marketing.center.taUser.entity.TaUser;
7
+import com.yunzhi.marketing.dto.PersonMarketingDTO;
7
 import com.yunzhi.marketing.entity.TaCustomerFrom;
8
 import com.yunzhi.marketing.entity.TaCustomerFrom;
8
 import com.yunzhi.marketing.entity.TaPerson;
9
 import com.yunzhi.marketing.entity.TaPerson;
9
 import com.baomidou.mybatisplus.extension.service.IService;
10
 import com.baomidou.mybatisplus.extension.service.IService;
121
                    TaCustomerFrom customerFrom) throws Exception;
122
                    TaCustomerFrom customerFrom) throws Exception;
122
 
123
 
123
     ResponseBean updateUserPhoto(String photoUrl, String openId);
124
     ResponseBean updateUserPhoto(String photoUrl, String openId);
125
+
126
+    /**
127
+     * 成为驻场顾问
128
+     * @param marketingDTO
129
+     * @param openid
130
+     * @return
131
+     */
132
+    ResponseBean marketing(PersonMarketingDTO marketingDTO, String openid);
124
 }
133
 }

+ 21
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java Vedi File

2
 
2
 
3
 import com.alibaba.fastjson.JSONArray;
3
 import com.alibaba.fastjson.JSONArray;
4
 import com.alibaba.fastjson.JSONObject;
4
 import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
7
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
7
 import com.baomidou.mybatisplus.core.metadata.IPage;
8
 import com.baomidou.mybatisplus.core.metadata.IPage;
126
     @Autowired
127
     @Autowired
127
     private IExtendContentService iExtendContentService;
128
     private IExtendContentService iExtendContentService;
128
 
129
 
130
+    private String MARKETING_CODE;
129
     @Override
131
     @Override
130
     public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
132
     public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId, List<TaPersonBuilding> taPersonBuildingList) {
131
         Page<TaBuilding> page = new Page<>();
133
         Page<TaBuilding> page = new Page<>();
574
         building.setStatus(2);
576
         building.setStatus(2);
575
         building.setOrgId(orgId);
577
         building.setOrgId(orgId);
576
         building.setName(building.getBuildingName());
578
         building.setName(building.getBuildingName());
579
+        // 生成楼盘驻场码
580
+        getMyMarktingCode();
581
+        building.setMarketingCode(MARKETING_CODE);
577
         if (taBuildingMapper.insert(building) < 1) {
582
         if (taBuildingMapper.insert(building) < 1) {
578
             return ResponseBean.error("添加项目楼栋失败", ResponseBean.ERROR_UNAVAILABLE);
583
             return ResponseBean.error("添加项目楼栋失败", ResponseBean.ERROR_UNAVAILABLE);
579
         }
584
         }
681
         return ResponseBean.success("");
686
         return ResponseBean.success("");
682
     }
687
     }
683
 
688
 
689
+    /**
690
+     * 生成六位推荐码 重复重新生成
691
+     * @return
692
+     */
693
+    private void getMyMarktingCode() {
694
+        String code = String.valueOf((int) ((Math.random() * 9 + 1) * Math.pow(10, 5)));
695
+        // 查询这个code 在库里存不存在
696
+        LambdaQueryWrapper<TaBuilding> queryWrapper = new LambdaQueryWrapper<>();
697
+        queryWrapper.eq(TaBuilding::getMarketingCode,code);
698
+        List<TaBuilding> userInfos = taBuildingMapper.selectList(queryWrapper);
699
+        if (userInfos.size() > 0){
700
+            getMyMarktingCode();
701
+        }
702
+        MARKETING_CODE = code;
703
+    }
704
+
684
     @Override
705
     @Override
685
     public ResponseBean buildingdelete(String id, Integer orgId) {
706
     public ResponseBean buildingdelete(String id, Integer orgId) {
686
         TaBuilding building = new TaBuilding();
707
         TaBuilding building = new TaBuilding();

+ 38
- 0
src/main/java/com/yunzhi/marketing/service/impl/TaPersonServiceImpl.java Vedi File

2
 
2
 
3
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
3
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
4
 import com.alibaba.fastjson.JSONObject;
4
 import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
6
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
7
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
7
 import com.baomidou.mybatisplus.core.metadata.IPage;
8
 import com.baomidou.mybatisplus.core.metadata.IPage;
14
 import com.yunzhi.marketing.common.DateUtils;
15
 import com.yunzhi.marketing.common.DateUtils;
15
 import com.yunzhi.marketing.common.MD5Utils;
16
 import com.yunzhi.marketing.common.MD5Utils;
16
 import com.yunzhi.marketing.common.StringUtils;
17
 import com.yunzhi.marketing.common.StringUtils;
18
+import com.yunzhi.marketing.dto.PersonMarketingDTO;
17
 import com.yunzhi.marketing.event.EventBus;
19
 import com.yunzhi.marketing.event.EventBus;
18
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
20
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
19
 import com.yunzhi.marketing.entity.*;
21
 import com.yunzhi.marketing.entity.*;
1292
         responseBean.addSuccess("修改成功");
1294
         responseBean.addSuccess("修改成功");
1293
         return responseBean;
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
 }

+ 2
- 0
src/main/resources/mapper/TaLiveActivityMapper.xml Vedi File

76
             t.live_activity_title AS title,
76
             t.live_activity_title AS title,
77
             t.live_start_date AS start_time,
77
             t.live_start_date AS start_time,
78
             t.live_end_date AS end_time,
78
             t.live_end_date AS end_time,
79
+            t.detail_img as images,
79
             a.building_name,
80
             a.building_name,
80
             b.NAME AS city_name,
81
             b.NAME AS city_name,
81
             "live" as type
82
             "live" as type
93
             t.NAME AS title,
94
             t.NAME AS title,
94
             t.CREATED_TIME AS startTime,
95
             t.CREATED_TIME AS startTime,
95
             t.CREATED_TIME AS endTime,
96
             t.CREATED_TIME AS endTime,
97
+            t.vide_img as images,
96
             a.building_name,
98
             a.building_name,
97
             b.NAME AS city_name,
99
             b.NAME AS city_name,
98
             "video" as type
100
             "video" as type