Your Name 3 年之前
父節點
當前提交
1f24399e03

+ 13
- 0
src/main/java/com/yunzhi/marketing/common/CommConstant.java 查看文件

78
      */
78
      */
79
     public final static String FAVOR_ACTIVITY = "activity";
79
     public final static String FAVOR_ACTIVITY = "activity";
80
 
80
 
81
+    /**
82
+     * 课程点赞
83
+     */
84
+    public final static String FAVOR_CURRICULUM = "curriculum";
85
+
81
 
86
 
82
     /**
87
     /**
83
      * 兑换商品
88
      * 兑换商品
923
      * 系统参数  通知消息次时间间隔
928
      * 系统参数  通知消息次时间间隔
924
      */
929
      */
925
     public static final String SYSPARAM_NOTICE_MESSAGE_INTERVAL = "notice_message_interval";
930
     public static final String SYSPARAM_NOTICE_MESSAGE_INTERVAL = "notice_message_interval";
931
+
932
+
933
+    /**
934
+     * 课程授权人员类型
935
+     */
936
+    public static final String CURRICULUM_TYPE_AGENT = "1";
937
+    public static final String CURRICULUM_TYPE_COUSULTANT = "2";
938
+    public static final String CURRICULUM_TYPE_COUSULTANT_AND_AGENT = "3";
926
 }
939
 }

+ 62
- 15
src/main/java/com/yunzhi/marketing/common/WorkWxUtils.java 查看文件

11
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
11
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
12
 import org.springframework.stereotype.Component;
12
 import org.springframework.stereotype.Component;
13
 
13
 
14
+import java.util.ArrayList;
15
+import java.util.HashMap;
16
+import java.util.List;
17
+
14
 @Slf4j
18
 @Slf4j
15
 @Component
19
 @Component
16
 @EnableConfigurationProperties(WorkConfig.class)
20
 @EnableConfigurationProperties(WorkConfig.class)
31
     }
35
     }
32
 
36
 
33
     /**
37
     /**
34
-     * 获取房间ID
38
+     * 依据手机号获取人员信息
39
+     * @param mobile
40
+     * @return
41
+     * @throws WxErrorException
42
+     */
43
+    public String getUserByPhone(String mobile) throws WxErrorException {
44
+        return wxCpService.getUserService().getUserId(mobile);
45
+    }
46
+
47
+    /**
48
+     * 获取人员直播房间列表
35
      * @param userId
49
      * @param userId
36
      * @return
50
      * @return
37
      * @throws Exception
51
      * @throws Exception
38
      */
52
      */
39
-    public JSONObject getLastLivingInfo(String userId) throws Exception {
53
+    public List<JSONObject> getLivingRoomsOfUser(String userId) throws Exception {
40
         if (StringUtils.isEmpty(userId)) {
54
         if (StringUtils.isEmpty(userId)) {
41
             throw new Exception("未指定用户ID");
55
             throw new Exception("未指定用户ID");
42
         }
56
         }
44
         try {
58
         try {
45
             JSONObject params = new JSONObject();
59
             JSONObject params = new JSONObject();
46
             params.put("userid", userId);
60
             params.put("userid", userId);
47
-            params.put("limit", 10);
48
-            JSONObject result = post("/cgi-bin/living/get_user_all_livingid", params);
49
-            JSONArray lst = result.getJSONArray("livingid_list");
50
-            String livingId = lst.size() > 0 ? (String) lst.get(0) : null;
61
+            params.put("limit", 20);
62
+            JSONObject response = post("/cgi-bin/living/get_user_all_livingid", params);
63
+            JSONArray lst = response.getJSONArray("livingid_list");
51
 
64
 
52
-            if (!StringUtils.isEmpty(livingId)) {
53
-                JSONObject res = post("/cgi-bin/living/get_living_info?livingid="+StringUtils.urlEncode(livingId), null);
54
-                JSONObject liveInfo = res.getJSONObject("living_info");
55
-                if (null != liveInfo) {
56
-                    liveInfo.put("livingid", livingId);
65
+            List<JSONObject> rtn = new ArrayList<>();
66
+            if (lst.size() > 0) {
67
+                for (int i = 0; i < lst.size(); i++) {
68
+                    String livingId = lst.get(i).toString();
69
+                    JSONObject res = post("/cgi-bin/living/get_living_info?livingid="+StringUtils.urlEncode(livingId), null);
70
+                    JSONObject liveInfo = res.getJSONObject("living_info");
71
+                    if (null != liveInfo) {
72
+                        liveInfo.put("livingid", livingId);
73
+                        rtn.add(liveInfo);
74
+                    }
57
                 }
75
                 }
58
-                return  liveInfo;
59
             }
76
             }
60
 
77
 
61
-            return null;
78
+            return rtn;
62
         } catch (WxErrorException e) {
79
         } catch (WxErrorException e) {
63
             if (90601 == e.getError().getErrorCode()) {
80
             if (90601 == e.getError().getErrorCode()) {
64
                 throw new Exception("直播房间不存在");
81
                 throw new Exception("直播房间不存在");
71
         }
88
         }
72
     }
89
     }
73
 
90
 
91
+    /**
92
+     * 获取房间信息
93
+     * @param livingId
94
+     * @return
95
+     * @throws Exception
96
+     */
97
+    public JSONObject getLivingInfoById(String livingId) throws Exception {
98
+        if (StringUtils.isEmpty(livingId)) {
99
+            throw new Exception("未指定房间ID");
100
+        }
101
+
102
+        try {
103
+            JSONObject res = post("/cgi-bin/living/get_living_info?livingid="+StringUtils.urlEncode(livingId), null);
104
+            JSONObject liveInfo = res.getJSONObject("living_info");
105
+            if (null != liveInfo) {
106
+                liveInfo.put("livingid", livingId);
107
+            }
108
+            return  liveInfo;
109
+        } catch (WxErrorException e) {
110
+            if (90601 == e.getError().getErrorCode()) {
111
+                throw new Exception("直播房间不存在");
112
+            } else {
113
+                throw new Exception(String.format("获取直播间信息失败: %s", e.getError().getErrorMsg()));
114
+            }
115
+        } catch (Exception e) {
116
+            e.printStackTrace();
117
+            throw e;
118
+        }
119
+    }
120
+
74
     /**
121
     /**
75
      * 获取直播授权码
122
      * 获取直播授权码
76
      * @param livingid
123
      * @param livingid
87
             JSONObject params = new JSONObject();
134
             JSONObject params = new JSONObject();
88
             params.put("livingid", livingid);
135
             params.put("livingid", livingid);
89
             params.put("openid", openid);
136
             params.put("openid", openid);
90
-            JSONObject result = post("/cgi-bin/living/get_living_code", params);
91
-            return result.getString("living_code");
137
+            JSONObject response = post("/cgi-bin/living/get_living_code", params);
138
+            return response.getString("living_code");
92
         } catch (WxErrorException e) {
139
         } catch (WxErrorException e) {
93
             if (90601 == e.getError().getErrorCode()) {
140
             if (90601 == e.getError().getErrorCode()) {
94
                 throw new Exception("直播房间不存在");
141
                 throw new Exception("直播房间不存在");

+ 10
- 3
src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java 查看文件

307
     }
307
     }
308
 
308
 
309
     @GetMapping("/wx/taLiveActivity/work/livingCode")
309
     @GetMapping("/wx/taLiveActivity/work/livingCode")
310
-    public ResponseBean getWorkLivingCode(@RequestParam("user") String user,
310
+    public ResponseBean getWorkLivingCode(@RequestParam("livingId") String livingId,
311
                                           HttpServletRequest request) {
311
                                           HttpServletRequest request) {
312
         String openid = getOpenId(request);
312
         String openid = getOpenId(request);
313
         try {
313
         try {
314
-            JSONObject liveInfo = workWxUtils.getLastLivingInfo(user);
314
+            JSONObject liveInfo = workWxUtils.getLivingInfoById(livingId);
315
             if (null == liveInfo) {
315
             if (null == liveInfo) {
316
                 return ResponseBean.error("未找到直播房间", ResponseBean.ERROR_UNAVAILABLE);
316
                 return ResponseBean.error("未找到直播房间", ResponseBean.ERROR_UNAVAILABLE);
317
             }
317
             }
318
 
318
 
319
-            String livingCode = workWxUtils.getLivingCode(liveInfo.getString("livingid"), openid);
319
+            String livingCode = workWxUtils.getLivingCode(livingId, openid);
320
             liveInfo.put("livingCode", livingCode);
320
             liveInfo.put("livingCode", livingCode);
321
 
321
 
322
             return ResponseBean.success(liveInfo);
322
             return ResponseBean.success(liveInfo);
324
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
324
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_UNAVAILABLE);
325
         }
325
         }
326
     }
326
     }
327
+
328
+    @GetMapping("/admin/taLiveActivity/work/rooms")
329
+    public ResponseBean getWorkLivingRooms(@RequestParam("phone") String phone,
330
+                                          HttpServletRequest request) throws Exception {
331
+        String userid = workWxUtils.getUserByPhone(phone);
332
+        return ResponseBean.success(workWxUtils.getLivingRoomsOfUser(userid));
333
+    }
327
 }
334
 }

+ 1
- 0
src/main/java/com/yunzhi/marketing/service/ITaSaveService.java 查看文件

24
     List<String> getTargesOfPerson(String personId, String tagertType);
24
     List<String> getTargesOfPerson(String personId, String tagertType);
25
 
25
 
26
     TaSave getInfoBy(String personId, String tagertType, String savedTarget);
26
     TaSave getInfoBy(String personId, String tagertType, String savedTarget);
27
+
27
 }
28
 }

+ 9
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaUvServiceImpl.java 查看文件

12
 import com.yunzhi.marketing.mapper.TaUvMapper;
12
 import com.yunzhi.marketing.mapper.TaUvMapper;
13
 import com.yunzhi.marketing.service.ITaUvService;
13
 import com.yunzhi.marketing.service.ITaUvService;
14
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
14
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
15
+import com.yunzhi.marketing.xlk.mapper.CurriculumMapper;
15
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.beans.factory.annotation.Autowired;
16
 import org.springframework.stereotype.Service;
17
 import org.springframework.stereotype.Service;
17
 
18
 
37
     @Autowired
38
     @Autowired
38
     TaBuildingMapper buildingMapper;
39
     TaBuildingMapper buildingMapper;
39
 
40
 
41
+    @Autowired
42
+    CurriculumMapper curriculumMapper;
43
+
40
     @Override
44
     @Override
41
     public ResponseBean saveData(String openid, String typeOf, String id) {
45
     public ResponseBean saveData(String openid, String typeOf, String id) {
42
         List<TaPerson> persons = getPersonsByOpenId(openid);
46
         List<TaPerson> persons = getPersonsByOpenId(openid);
84
         }
88
         }
85
 
89
 
86
         // 如果是点赞置业, 则人员点赞 + 1
90
         // 如果是点赞置业, 则人员点赞 + 1
87
-        if (typeOf.equals(CommConstant.FAVOR_CONSULTANT)) {
91
+        if (CommConstant.FAVOR_CONSULTANT.equals(typeOf)) {
88
             taPersonMapper.setFieldIncrement(id,"hot_num", 1);
92
             taPersonMapper.setFieldIncrement(id,"hot_num", 1);
89
         }
93
         }
90
 
94
 
95
+        if (CommConstant.FAVOR_CURRICULUM.equals(typeOf)) {
96
+            curriculumMapper.setFieldIncrement(id,"look_num", 1);
97
+        }
98
+
91
         return ResponseBean.success("");
99
         return ResponseBean.success("");
92
     }
100
     }
93
 
101
 

+ 49
- 17
src/main/java/com/yunzhi/marketing/xlk/controller/CurriculumController.java 查看文件

6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
 import com.yunzhi.marketing.base.BaseController;
7
 import com.yunzhi.marketing.base.BaseController;
8
 import com.yunzhi.marketing.base.ResponseBean;
8
 import com.yunzhi.marketing.base.ResponseBean;
9
+import com.yunzhi.marketing.common.CommConstant;
9
 import com.yunzhi.marketing.common.StringUtils;
10
 import com.yunzhi.marketing.common.StringUtils;
10
 import com.yunzhi.marketing.entity.TaPerson;
11
 import com.yunzhi.marketing.entity.TaPerson;
12
+import com.yunzhi.marketing.entity.TaSave;
11
 import com.yunzhi.marketing.service.ITaPersonService;
13
 import com.yunzhi.marketing.service.ITaPersonService;
14
+import com.yunzhi.marketing.service.ITaSaveService;
15
+import com.yunzhi.marketing.service.ITaUvService;
12
 import com.yunzhi.marketing.xlk.dto.CurriculumDTO;
16
 import com.yunzhi.marketing.xlk.dto.CurriculumDTO;
13
 import com.yunzhi.marketing.xlk.entity.Brand;
17
 import com.yunzhi.marketing.xlk.entity.Brand;
14
 import com.yunzhi.marketing.xlk.entity.Video;
18
 import com.yunzhi.marketing.xlk.entity.Video;
54
     @Autowired
58
     @Autowired
55
     public ITaPersonService taPersonService;
59
     public ITaPersonService taPersonService;
56
 
60
 
61
+    @Autowired
62
+    public ITaUvService iTaUvService;
63
+
64
+    @Autowired
65
+    public ITaSaveService iTaSaveService;
66
+
57
 
67
 
58
     /**
68
     /**
59
      * 分页查询列表
69
      * 分页查询列表
199
     @ApiOperation(value = "wx-查询课程表列表", notes = "wx-查询课程表列表")
209
     @ApiOperation(value = "wx-查询课程表列表", notes = "wx-查询课程表列表")
200
     @RequestMapping(value="/wx/curriculum",method= RequestMethod.GET)
210
     @RequestMapping(value="/wx/curriculum",method= RequestMethod.GET)
201
     public ResponseBean wxCurriculumList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
211
     public ResponseBean wxCurriculumList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
202
-                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
203
-                                       @RequestParam(value ="name",required = false) String name,
204
-                                       @RequestParam(value ="roleId",required = false) Integer roleId,
205
-                                       @RequestHeader("authorization") String token, HttpServletRequest request){
212
+                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
213
+                                         @RequestParam(value ="name",required = false) String name,
214
+                                         @RequestHeader("authorization") String token,
215
+                                         HttpServletRequest request){
206
         ResponseBean responseBean = new ResponseBean();
216
         ResponseBean responseBean = new ResponseBean();
217
+        TaPerson person = taPersonService.getById(getPersonId(request));
207
         try {
218
         try {
208
             //使用分页插件
219
             //使用分页插件
209
             IPage<Curriculum> pg = new Page<>(pageNum, pageSize);
220
             IPage<Curriculum> pg = new Page<>(pageNum, pageSize);
210
-            LambdaQueryWrapper<Curriculum> queryWrapper = new LambdaQueryWrapper<>();
211
-            queryWrapper.eq(Curriculum::getOrgId,getOrgId(request));
212
-            queryWrapper.eq(!StringUtils.isEmpty(name),Curriculum::getName,name);
213
-            queryWrapper.eq(null != roleId,Curriculum::getRoleId,roleId);
214
-            queryWrapper.orderByDesc(Curriculum::getWeight);
215
-            queryWrapper.orderByDesc(Curriculum::getCreatedTime);
216
-
217
-            IPage<Curriculum> result = iCurriculumService.page(pg, queryWrapper);
221
+            IPage<Curriculum> result = iCurriculumService.getWxList(pg, name, person);
218
             responseBean.addSuccess(result);
222
             responseBean.addSuccess(result);
219
         }catch (Exception e){
223
         }catch (Exception e){
220
             e.printStackTrace();
224
             e.printStackTrace();
233
     @ApiOperation(value = "wx-查询我收藏的课程表列表", notes = "wx-查询我收藏的课程表列表")
237
     @ApiOperation(value = "wx-查询我收藏的课程表列表", notes = "wx-查询我收藏的课程表列表")
234
     @RequestMapping(value="/wx/curriculum/save",method= RequestMethod.GET)
238
     @RequestMapping(value="/wx/curriculum/save",method= RequestMethod.GET)
235
     public ResponseBean saveCurriculumList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
239
     public ResponseBean saveCurriculumList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
236
-                                         @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
237
-                                         @RequestHeader("authorization") String token, HttpServletRequest request){
240
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
241
+                                           @RequestHeader("authorization") String token, HttpServletRequest request){
238
         ResponseBean responseBean = new ResponseBean();
242
         ResponseBean responseBean = new ResponseBean();
239
         try {
243
         try {
240
 
244
 
261
     @ApiOperation(value = "wx-根据id查询课程表详情", notes = "wx-根据id查询课程表详情")
265
     @ApiOperation(value = "wx-根据id查询课程表详情", notes = "wx-根据id查询课程表详情")
262
     @RequestMapping(value="/wx/curriculum/{id}",method= RequestMethod.GET)
266
     @RequestMapping(value="/wx/curriculum/{id}",method= RequestMethod.GET)
263
     public ResponseBean curriculum(@PathVariable String id,
267
     public ResponseBean curriculum(@PathVariable String id,
264
-                                      @RequestHeader("authorization") String token, HttpServletRequest request){
268
+                                   @RequestHeader("authorization") String token,
269
+                                   HttpServletRequest request){
265
         ResponseBean responseBean = new ResponseBean();
270
         ResponseBean responseBean = new ResponseBean();
266
         try {
271
         try {
267
             Curriculum curriculum = iCurriculumService.getById(id);
272
             Curriculum curriculum = iCurriculumService.getById(id);
268
-            curriculum.setLookNum(curriculum.getLookNum() + 1);
269
-            iCurriculumService.updateById(curriculum);
273
+            TaPerson person = taPersonService.getById(getPersonId(request));
274
+
275
+            if (!checkRights(person.getPersonType(), curriculum.getRoleId())) {
276
+                return ResponseBean.error("您暂无权限查看当前课程", ResponseBean.ERROR_UNAVAILABLE);
277
+            }
278
+
279
+            TaSave taSave = iTaSaveService.getInfoBy(getPersonId(request), CommConstant.FAVOR_CURRICULUM, id);
280
+            curriculum.setIsSaved(null != taSave);
281
+
282
+            // 记录 UV
283
+            iTaUvService.saveData(getOpenId(request), CommConstant.FAVOR_CURRICULUM, id);
284
+
270
             responseBean.addSuccess(curriculum);
285
             responseBean.addSuccess(curriculum);
271
         }catch (Exception e){
286
         }catch (Exception e){
272
             e.printStackTrace();
287
             e.printStackTrace();
275
         }
290
         }
276
         return responseBean;
291
         return responseBean;
277
     }
292
     }
293
+
294
+    private boolean checkRights(String personType, String requireRole) {
295
+        if (null == requireRole) {
296
+            return false;
297
+        }
298
+
299
+        switch (requireRole) {
300
+            case CommConstant.CURRICULUM_TYPE_COUSULTANT_AND_AGENT:
301
+                return CommConstant.PERSON_ESTATE_CHANNEL.equals(personType) || CommConstant.PERSON_REALTY_CONSULTANT.equals(personType);
302
+            case CommConstant.CURRICULUM_TYPE_COUSULTANT:
303
+                return CommConstant.PERSON_REALTY_CONSULTANT.equals(personType);
304
+            case CommConstant.CURRICULUM_TYPE_AGENT:
305
+                return CommConstant.PERSON_ESTATE_CHANNEL.equals(personType);
306
+            default:
307
+                return false;
308
+        }
309
+    }
278
 }
310
 }

+ 5
- 1
src/main/java/com/yunzhi/marketing/xlk/entity/Curriculum.java 查看文件

113
      */
113
      */
114
     private Integer isPublish;
114
     private Integer isPublish;
115
 
115
 
116
-
116
+    /**
117
+     * 是否收藏
118
+     */
119
+    @TableField(exist = false)
120
+    private Boolean isSaved;
117
 }
121
 }

+ 6
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/CurriculumMapper.java 查看文件

6
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
 import org.apache.ibatis.annotations.Param;
7
 import org.apache.ibatis.annotations.Param;
8
 
8
 
9
+import java.util.List;
10
+
9
 /**
11
 /**
10
  * <p>
12
  * <p>
11
  * 课程表  Mapper 接口
13
  * 课程表  Mapper 接口
17
 @Mapper
19
 @Mapper
18
 public interface CurriculumMapper extends BaseMapper<Curriculum> {
20
 public interface CurriculumMapper extends BaseMapper<Curriculum> {
19
 
21
 
22
+    IPage<Curriculum> getWxList(IPage<Curriculum> pg, @Param("orgId") Integer orgId, @Param("name") String name, @Param("roleList") List<String> roleList);
23
+
20
     IPage<Curriculum> selectMySaveList(IPage<Curriculum> pg,@Param("personId") String personId);
24
     IPage<Curriculum> selectMySaveList(IPage<Curriculum> pg,@Param("personId") String personId);
25
+
26
+    int setFieldIncrement(@Param("curriculumId") String curriculumId, @Param("field") String field, @Param("increment") int increment);
21
 }
27
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/xlk/service/ICurriculumService.java 查看文件

24
      * @return
24
      * @return
25
      */
25
      */
26
     IPage<Curriculum> selectMySaveList(Integer pageNum, Integer pageSize, TaPerson person);
26
     IPage<Curriculum> selectMySaveList(Integer pageNum, Integer pageSize, TaPerson person);
27
+
28
+    IPage<Curriculum> getWxList(IPage<Curriculum> pg, String name, TaPerson person);
27
 }
29
 }

+ 21
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/CurriculumServiceImpl.java 查看文件

2
 
2
 
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.yunzhi.marketing.common.CommConstant;
5
 import com.yunzhi.marketing.entity.TaPerson;
6
 import com.yunzhi.marketing.entity.TaPerson;
6
 import com.yunzhi.marketing.xlk.entity.Curriculum;
7
 import com.yunzhi.marketing.xlk.entity.Curriculum;
7
 import com.yunzhi.marketing.xlk.mapper.CurriculumMapper;
8
 import com.yunzhi.marketing.xlk.mapper.CurriculumMapper;
10
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
11
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
11
 import org.springframework.stereotype.Service;
12
 import org.springframework.stereotype.Service;
12
 
13
 
14
+import java.util.ArrayList;
15
+import java.util.List;
16
+
13
 /**
17
 /**
14
  * <p>
18
  * <p>
15
  * 课程表  服务实现类
19
  * 课程表  服务实现类
35
         IPage<Curriculum> result = this.baseMapper.selectMySaveList(pg,person.getPersonId());
39
         IPage<Curriculum> result = this.baseMapper.selectMySaveList(pg,person.getPersonId());
36
         return result;
40
         return result;
37
     }
41
     }
42
+
43
+    @Override
44
+    public IPage<Curriculum> getWxList(IPage<Curriculum> pg, String name, TaPerson person) {
45
+        List<String> roleList = new ArrayList<>();
46
+        if (CommConstant.PERSON_REALTY_CONSULTANT.equals(person.getPersonType())) {
47
+            roleList.add(CommConstant.CURRICULUM_TYPE_COUSULTANT);
48
+            roleList.add(CommConstant.CURRICULUM_TYPE_COUSULTANT_AND_AGENT);
49
+        } else if (CommConstant.PERSON_ESTATE_CHANNEL.equals(person.getPersonType())) {
50
+            roleList.add(CommConstant.CURRICULUM_TYPE_AGENT);
51
+            roleList.add(CommConstant.CURRICULUM_TYPE_COUSULTANT_AND_AGENT);
52
+        } else {
53
+            roleList.add("*");
54
+        }
55
+
56
+        IPage<Curriculum> result = this.baseMapper.getWxList(pg, person.getOrgId(), name, roleList);
57
+        return result;
58
+    }
38
 }
59
 }

+ 27
- 4
src/main/resources/mapper/xlk/CurriculumMapper.xml 查看文件

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.yunzhi.marketing.xlk.mapper.CurriculumMapper">
3
 <mapper namespace="com.yunzhi.marketing.xlk.mapper.CurriculumMapper">
4
+    <update id="setFieldIncrement">
5
+        UPDATE xlk_curriculum
6
+        SET ${field} = IFNULL(${field}, 0) + #{increment}
7
+        WHERE curriculum_id = #{curriculumId}
8
+    </update>
4
 
9
 
5
     <select id="selectMySaveList" resultType="com.yunzhi.marketing.xlk.entity.Curriculum">
10
     <select id="selectMySaveList" resultType="com.yunzhi.marketing.xlk.entity.Curriculum">
11
+        SELECT
12
+            x.*
13
+        FROM
14
+            ta_save t
15
+                LEFT JOIN xlk_curriculum x ON t.save_id = x.curriculum_id
16
+        WHERE
17
+            t.saved_target = "curriculum"
18
+          AND t.person_id = #{personId}
19
+    </select>
20
+
21
+    <select id="getWxList" resultType="com.yunzhi.marketing.xlk.entity.Curriculum">
6
         SELECT
22
         SELECT
7
         x.*
23
         x.*
8
         FROM
24
         FROM
9
-        ta_save t
10
-        LEFT JOIN xlk_curriculum x ON t.save_id = x.curriculum_id
25
+        xlk_curriculum x
11
         WHERE
26
         WHERE
12
-        t.saved_target = "curriculum"
13
-        AND t.person_id = #{personId}
27
+        x.ORG_ID = #{orgId}
28
+        AND x.is_publish = 1
29
+        <if test="name != null and name != ''">
30
+            AND x.`name` like concat('%', #{name},'%')
31
+        </if>
32
+        AND x.role_id in
33
+        <foreach collection="roleList" item="role" open="(" close=")" separator=",">
34
+            #{role}
35
+        </foreach>
36
+        ORDER BY x.WEIGHT DESC, CREATED_TIME DESC
14
     </select>
37
     </select>
15
 </mapper>
38
 </mapper>