yansen 5 年前
父节点
当前提交
9c16dbe708

+ 558
- 558
src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java
文件差异内容过多而无法显示
查看文件


+ 244
- 244
src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java 查看文件

@@ -1,244 +1,244 @@
1
-package com.huiju.estateagents.center.taUser.entity;
2
-
3
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
4
-import com.baomidou.mybatisplus.annotation.IdType;
5
-import com.baomidou.mybatisplus.annotation.TableField;
6
-import com.baomidou.mybatisplus.annotation.TableId;
7
-import com.huiju.estateagents.entity.*;
8
-import lombok.Data;
9
-import lombok.EqualsAndHashCode;
10
-import lombok.experimental.Accessors;
11
-
12
-import java.io.Serializable;
13
-import java.time.LocalDateTime;
14
-import java.util.ArrayList;
15
-import java.util.List;
16
-
17
-/**
18
- * <p>
19
- * 用户表 
20
- * </p>
21
- *
22
- * @author jobob
23
- * @since 2019-09-11
24
- */
25
-@Data
26
-@EqualsAndHashCode(callSuper = false)
27
-@Accessors(chain = true)
28
-public class TaUser implements Serializable {
29
-
30
-    private static final long serialVersionUID = 1L;
31
-
32
-    /**
33
-     * 用户ID
34
-     */
35
-    @TableId(value = "user_id", type = IdType.AUTO)
36
-    private Integer userId;
37
-
38
-    /**
39
-     * 公司id
40
-     */
41
-    private Integer orgId;
42
-
43
-    /**
44
-     * 用户名称
45
-     */
46
-    private String userName;
47
-
48
-    /**
49
-     * 登录账户
50
-     */
51
-    private String loginName;
52
-
53
-    /**
54
-     * 手机号
55
-     */
56
-    private String phone;
57
-
58
-    /**
59
-     * 登录密码
60
-     */
61
-    private String loginPassword;
62
-
63
-    /**
64
-     * 用户头像
65
-     */
66
-    private String avatar;
67
-
68
-    /**
69
-     * 用户状态
70
-     */
71
-    private Integer status;
72
-
73
-    /**
74
-     * 创建时间
75
-     */
76
-    private LocalDateTime createDate;
77
-
78
-    /**
79
-     * 账户过期时间
80
-     */
81
-    private LocalDateTime expDate;
82
-
83
-    /**
84
-     * 是否管理员
85
-     */
86
-    private Boolean isAdmin;
87
-
88
-    /**
89
-     * 公司名称
90
-     */
91
-    private String orgName;
92
-
93
-    /**
94
-     * 部门
95
-     */
96
-    private String department;
97
-
98
-    /**
99
-     * 职位
100
-     */
101
-    private String position;
102
-
103
-    /**
104
-     * 邮箱
105
-     */
106
-    private String email;
107
-
108
-    /**
109
-     * 身份证号
110
-     */
111
-    private String idNo;
112
-    
113
-    private String address;
114
-    private String photo;
115
-    private String description;
116
-
117
-    /**
118
-     * 权重
119
-     */
120
-    @TableField(strategy= FieldStrategy.IGNORED)
121
-    private String weight;
122
-
123
-    /**
124
-     * 是否置业顾问
125
-     */
126
-    private Boolean isConsultant;
127
-
128
-    /**
129
-     * 公司水印
130
-     */
131
-    @TableField(exist = false)
132
-    private String waterMark;
133
-
134
-    /**
135
-     * 关联小程序
136
-     */
137
-    @TableField(exist = false)
138
-    private TaMiniapp miniapp;
139
-
140
-    /**
141
-     * 授权角色列表
142
-     */
143
-    @TableField(exist = false)
144
-    private List<TaRole> roles;
145
-
146
-    /**
147
-     * 授权菜单列表
148
-     */
149
-    @TableField(exist = false)
150
-    private List<SysMenu> menus;
151
-
152
-    /**
153
-     * 授权按钮列表
154
-     */
155
-    @TableField(exist = false)
156
-    private List<SysButtonInMenu> buttons;
157
-    
158
-    @TableField(exist = false)
159
-    private List<TaTags> taTagsList = new ArrayList<TaTags>();
160
-    
161
-    @TableField(exist = false)
162
-    private List<Integer> taTags = new ArrayList<Integer>();
163
-    
164
-    @TableField(exist = false)
165
-    private List<Integer> roleIds = new ArrayList<Integer>();
166
-    
167
-    @TableField(exist = false)
168
-    private String buildingId;
169
-
170
-    @TableField(exist = false)
171
-    private List<String> projects;
172
-
173
-    /**
174
-     * ta_org/orgNum楼盘最大数
175
-     */
176
-  @TableField(exist = false)
177
-    private int orgNum;
178
-
179
-    // 所有省份城市
180
-    @TableField(exist = false)
181
-    List<TdCity> tdCityList;
182
-
183
-    /**
184
-     * 前台传值城市
185
-     */
186
-    @TableField(exist = false)
187
-    private ArrayList<String> selectCityTree;
188
-
189
-    /**
190
-     * 城市ID
191
-     */
192
-    @TableField(exist = false)
193
-    private Integer cityId;
194
-
195
-    /**
196
-     * 默认城市
197
-     */
198
-    @TableField(exist = false)
199
-    private Integer defaultCityId;
200
-
201
-    /**
202
-     * 小程序绑定状态
203
-     *
204
-     * 0 未绑定 1 绑定
205
-     */
206
-    @TableField(exist = false)
207
-    private Integer miniStatus;
208
-
209
-    @TableField(exist = false)
210
-    private List<String> buildingIds = new ArrayList<String>();
211
-
212
-    /**
213
-     * 新密码
214
-     */
215
-    @TableField(exist = false)
216
-    private String newPassword;
217
-
218
-    /**
219
-     * 确认新密码
220
-     */
221
-    @TableField(exist = false)
222
-    private String confirmPassword;
223
-
224
-    /**
225
-     * 置业顾问的personid
226
-     */
227
-    @TableField(exist = false)
228
-    private String consultantPersonId;
229
-
230
-    /**
231
-     * personId集合
232
-     */
233
-    @TableField(exist = false)
234
-    private List<TaPerson> personIds;
235
-
236
-    /**
237
-     * customerId集合
238
-     */
239
-    @TableField(exist = false)
240
-    private List<TaRecommendCustomer> customerIds;
241
-
242
-    @TableField(exist = false)
243
-    private String miniAppName;
244
-}
1
+package com.huiju.estateagents.center.taUser.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
4
+import com.baomidou.mybatisplus.annotation.IdType;
5
+import com.baomidou.mybatisplus.annotation.TableField;
6
+import com.baomidou.mybatisplus.annotation.TableId;
7
+import com.huiju.estateagents.entity.*;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+import lombok.experimental.Accessors;
11
+
12
+import java.io.Serializable;
13
+import java.time.LocalDateTime;
14
+import java.util.ArrayList;
15
+import java.util.List;
16
+
17
+/**
18
+ * <p>
19
+ * 用户表 
20
+ * </p>
21
+ *
22
+ * @author jobob
23
+ * @since 2019-09-11
24
+ */
25
+@Data
26
+@EqualsAndHashCode(callSuper = false)
27
+@Accessors(chain = true)
28
+public class TaUser implements Serializable {
29
+
30
+    private static final long serialVersionUID = 1L;
31
+
32
+    /**
33
+     * 用户ID
34
+     */
35
+    @TableId(value = "user_id", type = IdType.AUTO)
36
+    private Integer userId;
37
+
38
+    /**
39
+     * 公司id
40
+     */
41
+    private Integer orgId;
42
+
43
+    /**
44
+     * 用户名称
45
+     */
46
+    private String userName;
47
+
48
+    /**
49
+     * 登录账户
50
+     */
51
+    private String loginName;
52
+
53
+    /**
54
+     * 手机号
55
+     */
56
+    private String phone;
57
+
58
+    /**
59
+     * 登录密码
60
+     */
61
+    private String loginPassword;
62
+
63
+    /**
64
+     * 用户头像
65
+     */
66
+    private String avatar;
67
+
68
+    /**
69
+     * 用户状态
70
+     */
71
+    private Integer status;
72
+
73
+    /**
74
+     * 创建时间
75
+     */
76
+    private LocalDateTime createDate;
77
+
78
+    /**
79
+     * 账户过期时间
80
+     */
81
+    private LocalDateTime expDate;
82
+
83
+    /**
84
+     * 是否管理员
85
+     */
86
+    private Boolean isAdmin;
87
+
88
+    /**
89
+     * 公司名称
90
+     */
91
+    private String orgName;
92
+
93
+    /**
94
+     * 部门
95
+     */
96
+    private String department;
97
+
98
+    /**
99
+     * 职位
100
+     */
101
+    private String position;
102
+
103
+    /**
104
+     * 邮箱
105
+     */
106
+    private String email;
107
+
108
+    /**
109
+     * 身份证号
110
+     */
111
+    private String idNo;
112
+    
113
+    private String address;
114
+    private String photo;
115
+    private String description;
116
+
117
+    /**
118
+     * 权重
119
+     */
120
+    @TableField(strategy= FieldStrategy.IGNORED)
121
+    private String weight;
122
+
123
+    /**
124
+     * 是否置业顾问
125
+     */
126
+    private Boolean isConsultant;
127
+
128
+    /**
129
+     * 公司水印
130
+     */
131
+    @TableField(exist = false)
132
+    private String waterMark;
133
+
134
+    /**
135
+     * 关联小程序
136
+     */
137
+    @TableField(exist = false)
138
+    private TaMiniapp miniapp;
139
+
140
+    /**
141
+     * 授权角色列表
142
+     */
143
+    @TableField(exist = false)
144
+    private List<TaRole> roles;
145
+
146
+    /**
147
+     * 授权菜单列表
148
+     */
149
+    @TableField(exist = false)
150
+    private List<SysMenu> menus;
151
+
152
+    /**
153
+     * 授权按钮列表
154
+     */
155
+    @TableField(exist = false)
156
+    private List<SysButtonInMenu> buttons;
157
+    
158
+    @TableField(exist = false)
159
+    private List<TaTags> taTagsList = new ArrayList<TaTags>();
160
+    
161
+    @TableField(exist = false)
162
+    private List<Integer> taTags = new ArrayList<Integer>();
163
+    
164
+    @TableField(exist = false)
165
+    private List<Integer> roleIds = new ArrayList<Integer>();
166
+    
167
+    @TableField(exist = false)
168
+    private String buildingId;
169
+
170
+    @TableField(exist = false)
171
+    private List<String> projects;
172
+
173
+    /**
174
+     * ta_org/orgNum楼盘最大数
175
+     */
176
+  @TableField(exist = false)
177
+    private int orgNum;
178
+
179
+    // 所有省份城市
180
+    @TableField(exist = false)
181
+    List<TdCity> tdCityList;
182
+
183
+    /**
184
+     * 前台传值城市
185
+     */
186
+    @TableField(exist = false)
187
+    private ArrayList<String> selectCityTree;
188
+
189
+    /**
190
+     * 城市ID
191
+     */
192
+    @TableField(exist = false)
193
+    private Integer cityId;
194
+
195
+    /**
196
+     * 默认城市
197
+     */
198
+    @TableField(exist = false)
199
+    private Integer defaultCityId;
200
+
201
+    /**
202
+     * 小程序绑定状态
203
+     *
204
+     * 0 未绑定 1 绑定
205
+     */
206
+    @TableField(exist = false)
207
+    private Integer miniStatus;
208
+
209
+    @TableField(exist = false)
210
+    private List<String> buildingIds = new ArrayList<String>();
211
+
212
+    /**
213
+     * 新密码
214
+     */
215
+    @TableField(exist = false)
216
+    private String newPassword;
217
+
218
+    /**
219
+     * 确认新密码
220
+     */
221
+    @TableField(exist = false)
222
+    private String confirmPassword;
223
+
224
+    /**
225
+     * 置业顾问的personid
226
+     */
227
+    @TableField(exist = false)
228
+    private String consultantPersonId;
229
+
230
+    /**
231
+     * personId集合
232
+     */
233
+    @TableField(exist = false)
234
+    private List<TaPerson> personIds;
235
+
236
+    /**
237
+     * customerId集合
238
+     */
239
+    @TableField(exist = false)
240
+    private List<TaRecommendCustomer> customerIds;
241
+
242
+    @TableField(exist = false)
243
+    private String miniAppName;
244
+}

+ 263
- 263
src/main/java/com/huiju/estateagents/controller/TaChannelController.java 查看文件

@@ -1,263 +1,263 @@
1
-package com.huiju.estateagents.controller;
2
-
3
-import com.alibaba.fastjson.JSONObject;
4
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.baomidou.mybatisplus.core.metadata.IPage;
6
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
-import com.huiju.estateagents.base.BaseController;
8
-import com.huiju.estateagents.base.ResponseBean;
9
-import io.swagger.annotations.ApiOperation;
10
-import com.huiju.estateagents.common.JWTUtils;
11
-import com.huiju.estateagents.common.StringUtils;
12
-import com.huiju.estateagents.entity.TaBuildingReport;
13
-import com.huiju.estateagents.entity.TaChannel;
14
-import com.huiju.estateagents.entity.TaPerson;
15
-import com.huiju.estateagents.mapper.TaChannelMapper;
16
-import com.huiju.estateagents.service.ITaPersonService;
17
-import com.huiju.estateagents.service.TaChannelService;
18
-import io.swagger.annotations.Api;
19
-import io.swagger.annotations.ApiImplicitParam;
20
-import io.swagger.annotations.ApiImplicitParams;
21
-import org.apache.http.HttpRequest;
22
-import org.slf4j.Logger;
23
-import org.slf4j.LoggerFactory;
24
-import org.springframework.beans.factory.annotation.Autowired;
25
-import org.springframework.web.bind.annotation.PathVariable;
26
-import org.springframework.web.bind.annotation.RequestBody;
27
-import org.springframework.web.bind.annotation.RequestMapping;
28
-import org.springframework.web.bind.annotation.RequestMethod;
29
-import org.springframework.web.bind.annotation.RequestParam;
30
-import org.springframework.web.bind.annotation.ResponseBody;
31
-import org.springframework.web.bind.annotation.RestController;
32
-
33
-import javax.servlet.http.HttpServletRequest;
34
-
35
-import java.time.LocalDateTime;
36
-import java.util.HashMap;
37
-import java.util.List;
38
-import java.util.stream.Collectors;
39
-
40
-
41
-/**
42
- * <p>
43
-    *   前端控制器
44
-    * </p>
45
- *
46
- * @author jobob
47
- * @since 2019-09-17
48
- */
49
-@RestController
50
-@RequestMapping("/api")
51
-@Api(value = "渠道管理", tags = "渠道管理")
52
-public class TaChannelController extends BaseController {
53
-
54
-    private final Logger logger = LoggerFactory.getLogger(TaChannelController.class);
55
-
56
-    @Autowired
57
-    public TaChannelService taChannelService;
58
-
59
-    @Autowired
60
-    public ITaPersonService taPersonService;
61
-
62
-    @Autowired
63
-    public TaChannelMapper taChannelMapper;
64
-
65
-
66
-    /**
67
-     * 渠道管理列表
68
-     * @param pageNum
69
-     * @param pageSize
70
-     * @return
71
-     */
72
-    @ApiOperation(value = "渠道管理列表", notes = "渠道管理列表")
73
-    @ApiImplicitParams({
74
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNum", paramType = "query",value = "第几页"),
75
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "一页多少行"),
76
-            @ApiImplicitParam(dataTypeClass = String.class, name = "channelId", paramType = "query",value = "渠道Id"),
77
-    })
78
-    @RequestMapping(value="/admin/channel",method= RequestMethod.GET)
79
-    public ResponseBean channelList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
80
-                                    @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
81
-                                    @RequestParam(value ="channelId",required = false) Integer channelId,
82
-                                    HttpServletRequest request){
83
-        ResponseBean responseBean = new ResponseBean();
84
-        Integer orgId = getOrgId(request);
85
-        try {
86
-            //使用分页插件
87
-		    IPage<TaChannel> pg = new Page<>(pageNum, pageSize);
88
-            IPage<TaChannel> result = taChannelMapper.pageTaChannel(pg,orgId,channelId);
89
-            List<TaChannel> recommendCount = taChannelMapper.recommendCount(orgId, channelId);
90
-
91
-            result.getRecords().stream().forEach(e -> {
92
-                for(TaChannel channel : recommendCount){
93
-                    if (channel.getChannelId().equals(e.getChannelId())){
94
-                        e.setRecommendCount(channel.getRecommendCount());
95
-                    }
96
-                }
97
-            });
98
-
99
-            HashMap hashMap  = new HashMap<>();
100
-            hashMap.put("result",result);
101
-            // 下拉列表的数据 all
102
-            List<TaChannel> taChannelList = taChannelMapper.selectChannelList(orgId);
103
-            hashMap.put("channelNmae",taChannelList);
104
-            responseBean.addSuccess(hashMap);
105
-        }catch (Exception e){
106
-            e.printStackTrace();
107
-            logger.error("channelList -=- {}",e.toString());
108
-            responseBean.addError(e.getMessage());
109
-        }
110
-        return responseBean;
111
-    }
112
-
113
-    /**
114
-     * 渠道保存
115
-     * @param channel 实体对象
116
-     * @return
117
-     */
118
-    @ApiOperation(value = "渠道保存", notes = "渠道保存")
119
-    @ApiImplicitParams({
120
-            @ApiImplicitParam(dataTypeClass = TaChannel.class, name = "channel", paramType = "body",value = "当前对象"),
121
-    })
122
-    @RequestMapping(value="/admin/channel",method= RequestMethod.POST)
123
-    public ResponseBean channelAdd(@RequestBody TaChannel channel ,HttpServletRequest request){
124
-        Integer orgId = getOrgId(request);
125
-        ResponseBean responseBean = new ResponseBean();
126
-        try {
127
-            // 生成6位数的渠道码
128
-            int channelCode= taChannelMapper.channelCode();
129
-            channel.setChannelCode(String.valueOf(channelCode));
130
-            channel.setOrgId(orgId);
131
-            if (taChannelService.save(channel)){
132
-                responseBean.addSuccess(channel);
133
-            }else {
134
-                responseBean.addError("fail");
135
-            }
136
-        }catch (Exception e){
137
-            e.printStackTrace();
138
-            logger.error("channelAdd -=- {}",e.toString());
139
-            responseBean.addError(e.getMessage());
140
-        }
141
-        return responseBean;
142
-    }
143
-
144
-    /**
145
-     * 根据id删除对象
146
-     * @param id  实体ID
147
-     */
148
-    @ApiOperation(value = "根据渠道ID删除", notes = "根据渠道ID删除")
149
-    @ApiImplicitParams({
150
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "id", paramType = "query",value = "渠道id"),
151
-    })
152
-    @ResponseBody
153
-    @RequestMapping(value="/channel/{id}", method= RequestMethod.DELETE)
154
-    public ResponseBean channelDelete(@PathVariable Integer id){
155
-        ResponseBean responseBean = new ResponseBean();
156
-        try {
157
-            if(taChannelService.removeById(id)){
158
-                responseBean.addSuccess("success");
159
-            }else {
160
-                responseBean.addError("fail");
161
-            }
162
-        }catch (Exception e){
163
-            e.printStackTrace();
164
-            logger.error("channelDelete -=- {}",e.toString());
165
-            responseBean.addError(e.getMessage());
166
-        }
167
-        return responseBean;
168
-    }
169
-
170
-    /**
171
-     * 修改对象
172
-     * @param id  实体ID
173
-     * @param channel 实体对象
174
-     * @return
175
-     */
176
-    @ApiOperation(value = "根据渠道ID修改", notes = "根据渠道ID修改")
177
-    @ApiImplicitParams({
178
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "id", paramType = "query",value = "渠道id"),
179
-    })
180
-    @RequestMapping(value="/admin/channel/{id}",method= RequestMethod.PUT)
181
-    public ResponseBean channelUpdate(@PathVariable Integer id,
182
-                                        @RequestBody TaChannel channel){
183
-        ResponseBean responseBean = new ResponseBean();
184
-        try {
185
-            channel.setChannelId(id);
186
-            if (taChannelService.updateById(channel)){
187
-                responseBean.addSuccess(channel);
188
-            }else {
189
-                responseBean.addError("fail");
190
-            }
191
-        }catch (Exception e){
192
-            e.printStackTrace();
193
-            logger.error("channelUpdate -=- {}",e.toString());
194
-            responseBean.addError(e.getMessage());
195
-        }
196
-        return responseBean;
197
-    }
198
-
199
-    /**
200
-     * 根据id查询对象
201
-     * @param id  实体ID
202
-     */
203
-    @ApiOperation(value = "根据渠道ID查询", notes = "根据渠道ID查询")
204
-    @ApiImplicitParams({
205
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "id", paramType = "query",value = "渠道id"),
206
-    })
207
-    @RequestMapping(value="/admin/channel/{id}",method= RequestMethod.GET)
208
-    public ResponseBean channelGet(@PathVariable Integer id){
209
-        ResponseBean responseBean = new ResponseBean();
210
-        try {
211
-            responseBean.addSuccess(taChannelService.getById(id));
212
-        }catch (Exception e){
213
-            e.printStackTrace();
214
-            logger.error("channelDelete -=- {}",e.toString());
215
-            responseBean.addError(e.getMessage());
216
-        }
217
-        return responseBean;
218
-    }
219
-
220
-    /**
221
-     * 渠道管理下的经纪人
222
-     */
223
-    @ApiOperation(value = "渠道管理下的经纪人", notes = "渠道管理下的经纪人")
224
-    @ApiImplicitParams({
225
-            @ApiImplicitParam(dataTypeClass = String.class, name = "name", paramType = "query",value = "姓名"),
226
-            @ApiImplicitParam(dataTypeClass = String.class, name = "phone", paramType = "query",value = "电话"),
227
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "channelId", paramType = "query",value = "渠道id"),
228
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNum", paramType = "query",value = "多少页"),
229
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "每页多少条"),
230
-    })
231
-    @RequestMapping(value="/admin/channel/broker",method= RequestMethod.GET)
232
-    public  ResponseBean channelBrokerList(@RequestParam(value="name",required = false) String name,
233
-                                           @RequestParam(value="phone",required = false) String phone,
234
-                                           @RequestParam(value="channelId",required = false) Integer channelId,
235
-                                           @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
236
-                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
237
-                                           HttpServletRequest request){
238
-        Integer orgid = getOrgId(request);
239
-        ResponseBean taPerson =  taPersonService.channelBrokerList(name,phone,pageNum,pageSize,orgid,channelId);
240
-        return taPerson;
241
-    }
242
-
243
-    /**
244
-     * 渠道邀请经纪人列表
245
-     */
246
-    @ApiOperation(value = "渠道邀请经纪人列表", notes = "渠道邀请经纪人列表")
247
-    @ApiImplicitParams({
248
-            @ApiImplicitParam(dataTypeClass = String.class, name = "id", paramType = "query",value = "姓名"),
249
-            @ApiImplicitParam(dataTypeClass = String.class, name = "phone", paramType = "query",value = "电话"),
250
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "channelId", paramType = "query",value = "渠道id"),
251
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNum", paramType = "query",value = "多少页"),
252
-            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "每页多少条"),
253
-    })
254
-    @RequestMapping(value="/admin/channel/InviteClientsList",method= RequestMethod.GET)
255
-    public  ResponseBean InviteClientsList(@RequestParam(value="id",required = false) String id,
256
-                                           @RequestParam(value="phone",required = false) String phone,
257
-                                           @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
258
-                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
259
-                                           HttpServletRequest request){
260
-        ResponseBean taPerson =  taPersonService.InviteClientsList(id,phone,pageNum,pageSize);
261
-        return taPerson;
262
-    }
263
-}
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.baomidou.mybatisplus.core.metadata.IPage;
6
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7
+import com.huiju.estateagents.base.BaseController;
8
+import com.huiju.estateagents.base.ResponseBean;
9
+import io.swagger.annotations.ApiOperation;
10
+import com.huiju.estateagents.common.JWTUtils;
11
+import com.huiju.estateagents.common.StringUtils;
12
+import com.huiju.estateagents.entity.TaBuildingReport;
13
+import com.huiju.estateagents.entity.TaChannel;
14
+import com.huiju.estateagents.entity.TaPerson;
15
+import com.huiju.estateagents.mapper.TaChannelMapper;
16
+import com.huiju.estateagents.service.ITaPersonService;
17
+import com.huiju.estateagents.service.TaChannelService;
18
+import io.swagger.annotations.Api;
19
+import io.swagger.annotations.ApiImplicitParam;
20
+import io.swagger.annotations.ApiImplicitParams;
21
+import org.apache.http.HttpRequest;
22
+import org.slf4j.Logger;
23
+import org.slf4j.LoggerFactory;
24
+import org.springframework.beans.factory.annotation.Autowired;
25
+import org.springframework.web.bind.annotation.PathVariable;
26
+import org.springframework.web.bind.annotation.RequestBody;
27
+import org.springframework.web.bind.annotation.RequestMapping;
28
+import org.springframework.web.bind.annotation.RequestMethod;
29
+import org.springframework.web.bind.annotation.RequestParam;
30
+import org.springframework.web.bind.annotation.ResponseBody;
31
+import org.springframework.web.bind.annotation.RestController;
32
+
33
+import javax.servlet.http.HttpServletRequest;
34
+
35
+import java.time.LocalDateTime;
36
+import java.util.HashMap;
37
+import java.util.List;
38
+import java.util.stream.Collectors;
39
+
40
+
41
+/**
42
+ * <p>
43
+    *   前端控制器
44
+    * </p>
45
+ *
46
+ * @author jobob
47
+ * @since 2019-09-17
48
+ */
49
+@RestController
50
+@RequestMapping("/api")
51
+@Api(value = "渠道管理", tags = "渠道管理")
52
+public class TaChannelController extends BaseController {
53
+
54
+    private final Logger logger = LoggerFactory.getLogger(TaChannelController.class);
55
+
56
+    @Autowired
57
+    public TaChannelService taChannelService;
58
+
59
+    @Autowired
60
+    public ITaPersonService taPersonService;
61
+
62
+    @Autowired
63
+    public TaChannelMapper taChannelMapper;
64
+
65
+
66
+    /**
67
+     * 渠道管理列表
68
+     * @param pageNum
69
+     * @param pageSize
70
+     * @return
71
+     */
72
+    @ApiOperation(value = "渠道管理列表", notes = "渠道管理列表")
73
+    @ApiImplicitParams({
74
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNum", paramType = "query",value = "第几页"),
75
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "一页多少行"),
76
+            @ApiImplicitParam(dataTypeClass = String.class, name = "channelId", paramType = "query",value = "渠道Id"),
77
+    })
78
+    @RequestMapping(value="/admin/channel",method= RequestMethod.GET)
79
+    public ResponseBean channelList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
80
+                                    @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
81
+                                    @RequestParam(value ="channelId",required = false) Integer channelId,
82
+                                    HttpServletRequest request){
83
+        ResponseBean responseBean = new ResponseBean();
84
+        Integer orgId = getOrgId(request);
85
+        try {
86
+            //使用分页插件
87
+		    IPage<TaChannel> pg = new Page<>(pageNum, pageSize);
88
+            IPage<TaChannel> result = taChannelMapper.pageTaChannel(pg,orgId,channelId);
89
+            List<TaChannel> recommendCount = taChannelMapper.recommendCount(orgId, channelId);
90
+
91
+            result.getRecords().stream().forEach(e -> {
92
+                for(TaChannel channel : recommendCount){
93
+                    if (channel.getChannelId().equals(e.getChannelId())){
94
+                        e.setRecommendCount(channel.getRecommendCount());
95
+                    }
96
+                }
97
+            });
98
+
99
+            HashMap hashMap  = new HashMap<>();
100
+            hashMap.put("result",result);
101
+            // 下拉列表的数据 all
102
+            List<TaChannel> taChannelList = taChannelMapper.selectChannelList(orgId);
103
+            hashMap.put("channelNmae",taChannelList);
104
+            responseBean.addSuccess(hashMap);
105
+        }catch (Exception e){
106
+            e.printStackTrace();
107
+            logger.error("channelList -=- {}",e.toString());
108
+            responseBean.addError(e.getMessage());
109
+        }
110
+        return responseBean;
111
+    }
112
+
113
+    /**
114
+     * 渠道保存
115
+     * @param channel 实体对象
116
+     * @return
117
+     */
118
+    @ApiOperation(value = "渠道保存", notes = "渠道保存")
119
+    @ApiImplicitParams({
120
+            @ApiImplicitParam(dataTypeClass = TaChannel.class, name = "channel", paramType = "body",value = "当前对象"),
121
+    })
122
+    @RequestMapping(value="/admin/channel",method= RequestMethod.POST)
123
+    public ResponseBean channelAdd(@RequestBody TaChannel channel ,HttpServletRequest request){
124
+        Integer orgId = getOrgId(request);
125
+        ResponseBean responseBean = new ResponseBean();
126
+        try {
127
+            // 生成6位数的渠道码
128
+            int channelCode= taChannelMapper.channelCode();
129
+            channel.setChannelCode(String.valueOf(channelCode));
130
+            channel.setOrgId(orgId);
131
+            if (taChannelService.save(channel)){
132
+                responseBean.addSuccess(channel);
133
+            }else {
134
+                responseBean.addError("fail");
135
+            }
136
+        }catch (Exception e){
137
+            e.printStackTrace();
138
+            logger.error("channelAdd -=- {}",e.toString());
139
+            responseBean.addError(e.getMessage());
140
+        }
141
+        return responseBean;
142
+    }
143
+
144
+    /**
145
+     * 根据id删除对象
146
+     * @param id  实体ID
147
+     */
148
+    @ApiOperation(value = "根据渠道ID删除", notes = "根据渠道ID删除")
149
+    @ApiImplicitParams({
150
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "id", paramType = "query",value = "渠道id"),
151
+    })
152
+    @ResponseBody
153
+    @RequestMapping(value="/channel/{id}", method= RequestMethod.DELETE)
154
+    public ResponseBean channelDelete(@PathVariable Integer id){
155
+        ResponseBean responseBean = new ResponseBean();
156
+        try {
157
+            if(taChannelService.removeById(id)){
158
+                responseBean.addSuccess("success");
159
+            }else {
160
+                responseBean.addError("fail");
161
+            }
162
+        }catch (Exception e){
163
+            e.printStackTrace();
164
+            logger.error("channelDelete -=- {}",e.toString());
165
+            responseBean.addError(e.getMessage());
166
+        }
167
+        return responseBean;
168
+    }
169
+
170
+    /**
171
+     * 修改对象
172
+     * @param id  实体ID
173
+     * @param channel 实体对象
174
+     * @return
175
+     */
176
+    @ApiOperation(value = "根据渠道ID修改", notes = "根据渠道ID修改")
177
+    @ApiImplicitParams({
178
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "id", paramType = "query",value = "渠道id"),
179
+    })
180
+    @RequestMapping(value="/admin/channel/{id}",method= RequestMethod.PUT)
181
+    public ResponseBean channelUpdate(@PathVariable Integer id,
182
+                                        @RequestBody TaChannel channel){
183
+        ResponseBean responseBean = new ResponseBean();
184
+        try {
185
+            channel.setChannelId(id);
186
+            if (taChannelService.updateById(channel)){
187
+                responseBean.addSuccess(channel);
188
+            }else {
189
+                responseBean.addError("fail");
190
+            }
191
+        }catch (Exception e){
192
+            e.printStackTrace();
193
+            logger.error("channelUpdate -=- {}",e.toString());
194
+            responseBean.addError(e.getMessage());
195
+        }
196
+        return responseBean;
197
+    }
198
+
199
+    /**
200
+     * 根据id查询对象
201
+     * @param id  实体ID
202
+     */
203
+    @ApiOperation(value = "根据渠道ID查询", notes = "根据渠道ID查询")
204
+    @ApiImplicitParams({
205
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "id", paramType = "query",value = "渠道id"),
206
+    })
207
+    @RequestMapping(value="/admin/channel/{id}",method= RequestMethod.GET)
208
+    public ResponseBean channelGet(@PathVariable Integer id){
209
+        ResponseBean responseBean = new ResponseBean();
210
+        try {
211
+            responseBean.addSuccess(taChannelService.getById(id));
212
+        }catch (Exception e){
213
+            e.printStackTrace();
214
+            logger.error("channelDelete -=- {}",e.toString());
215
+            responseBean.addError(e.getMessage());
216
+        }
217
+        return responseBean;
218
+    }
219
+
220
+    /**
221
+     * 渠道管理下的经纪人
222
+     */
223
+    @ApiOperation(value = "渠道管理下的经纪人", notes = "渠道管理下的经纪人")
224
+    @ApiImplicitParams({
225
+            @ApiImplicitParam(dataTypeClass = String.class, name = "name", paramType = "query",value = "姓名"),
226
+            @ApiImplicitParam(dataTypeClass = String.class, name = "phone", paramType = "query",value = "电话"),
227
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "channelId", paramType = "query",value = "渠道id"),
228
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNum", paramType = "query",value = "多少页"),
229
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "每页多少条"),
230
+    })
231
+    @RequestMapping(value="/admin/channel/broker",method= RequestMethod.GET)
232
+    public  ResponseBean channelBrokerList(@RequestParam(value="name",required = false) String name,
233
+                                           @RequestParam(value="phone",required = false) String phone,
234
+                                           @RequestParam(value="channelId",required = false) Integer channelId,
235
+                                           @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
236
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
237
+                                           HttpServletRequest request){
238
+        Integer orgid = getOrgId(request);
239
+        ResponseBean taPerson =  taPersonService.channelBrokerList(name,phone,pageNum,pageSize,orgid,channelId);
240
+        return taPerson;
241
+    }
242
+
243
+    /**
244
+     * 渠道邀请经纪人列表
245
+     */
246
+    @ApiOperation(value = "渠道邀请经纪人列表", notes = "渠道邀请经纪人列表")
247
+    @ApiImplicitParams({
248
+            @ApiImplicitParam(dataTypeClass = String.class, name = "id", paramType = "query",value = "姓名"),
249
+            @ApiImplicitParam(dataTypeClass = String.class, name = "phone", paramType = "query",value = "电话"),
250
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "channelId", paramType = "query",value = "渠道id"),
251
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageNum", paramType = "query",value = "多少页"),
252
+            @ApiImplicitParam(dataTypeClass = Integer.class, name = "pageSize", paramType = "query",value = "每页多少条"),
253
+    })
254
+    @RequestMapping(value="/admin/channel/InviteClientsList",method= RequestMethod.GET)
255
+    public  ResponseBean InviteClientsList(@RequestParam(value="id",required = false) String id,
256
+                                           @RequestParam(value="phone",required = false) String phone,
257
+                                           @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
258
+                                           @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
259
+                                           HttpServletRequest request){
260
+        ResponseBean taPerson =  taPersonService.InviteClientsList(id,phone,pageNum,pageSize);
261
+        return taPerson;
262
+    }
263
+}

+ 42
- 42
src/main/java/com/huiju/estateagents/mapper/TaChannelMapper.java 查看文件

@@ -1,42 +1,42 @@
1
-package com.huiju.estateagents.mapper;
2
-
3
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.baomidou.mybatisplus.core.metadata.IPage;
5
-import com.huiju.estateagents.entity.TaChannel;
6
-import org.apache.ibatis.annotations.Mapper;
7
-import org.apache.ibatis.annotations.Param;
8
-
9
-import java.util.List;
10
-
11
-/**
12
- * <p>
13
- *   Mapper 接口
14
- * </p>
15
- *
16
- * @author jobob
17
- * @since 2019-09-17
18
- */
19
-@Mapper
20
-public interface TaChannelMapper extends BaseMapper<TaChannel> {
21
-
22
-    /**
23
-     * 渠道码
24
-     * @return
25
-     */
26
-    int channelCode();
27
-
28
-    /**
29
-     * 渠道页面下拉列表的所有数据
30
-     * @return
31
-     */
32
-    List<TaChannel> selectChannelList(@Param("orgId")Integer orgId);
33
-
34
-    /**
35
-     * 渠道列表
36
-     * @param pg
37
-     * @return
38
-     */
39
-    IPage<TaChannel> pageTaChannel(IPage<TaChannel> pg,@Param("orgId")Integer orgId,@Param("channelId")Integer channelId);
40
-
41
-    List<TaChannel> recommendCount(@Param("orgId")Integer orgId,@Param("channelId")Integer channelId);
42
-}
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.huiju.estateagents.entity.TaChannel;
6
+import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * <p>
13
+ *   Mapper 接口
14
+ * </p>
15
+ *
16
+ * @author jobob
17
+ * @since 2019-09-17
18
+ */
19
+@Mapper
20
+public interface TaChannelMapper extends BaseMapper<TaChannel> {
21
+
22
+    /**
23
+     * 渠道码
24
+     * @return
25
+     */
26
+    int channelCode();
27
+
28
+    /**
29
+     * 渠道页面下拉列表的所有数据
30
+     * @return
31
+     */
32
+    List<TaChannel> selectChannelList(@Param("orgId")Integer orgId);
33
+
34
+    /**
35
+     * 渠道列表
36
+     * @param pg
37
+     * @return
38
+     */
39
+    IPage<TaChannel> pageTaChannel(IPage<TaChannel> pg,@Param("orgId")Integer orgId,@Param("channelId")Integer channelId);
40
+
41
+    List<TaChannel> recommendCount(@Param("orgId")Integer orgId,@Param("channelId")Integer channelId);
42
+}

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TsConsultantKpiMapper.java 查看文件

@@ -24,6 +24,7 @@ public interface TsConsultantKpiMapper extends BaseMapper<TsConsultantKpi> {
24 24
 
25 25
     /**
26 26
      * 置业KPI 汇总
27
+     * bug #6929 要求跟时间没关系
27 28
      * @param page
28 29
      * @param orgId
29 30
      * @param buildingIds
@@ -53,6 +54,7 @@ public interface TsConsultantKpiMapper extends BaseMapper<TsConsultantKpi> {
53 54
 
54 55
     /**
55 56
      * 统计当前时间段内的, 已经固化的置业数据的所有客户
57
+     * bug #6929 要求跟时间没关系
56 58
      * @param orgId
57 59
      * @param buildingIds
58 60
      * @param startDate

+ 748
- 748
src/main/resources/mapper/TaBuildingMapper.xml
文件差异内容过多而无法显示
查看文件


+ 67
- 67
src/main/resources/mapper/TaChannelMapper.xml 查看文件

@@ -1,67 +1,67 @@
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">
3
-<mapper namespace="com.huiju.estateagents.mapper.TaChannelMapper">
4
-
5
-    <select id="channelCode" resultType="int">
6
-        drop FUNCTION if exists roundNum;
7
-        create function roundNum() returns int
8
-        begin
9
-        declare x int default 1;
10
-        declare y int default 0;
11
-        declare a int default 20;
12
-        declare b int default 1;
13
-        while (b <![CDATA[ < a ]]> ) do
14
-        set x = (select (select FLOOR(100000 + RAND()*900000))  as num);
15
-        set y = (select count(1) from ta_channel where channel_code = x);
16
-        if y = 0
17
-        then return x;
18
-        END IF;
19
-        set b = b + 1;
20
-        end while;
21
-        return 0;
22
-        end;
23
-        select roundNum();
24
-    </select>
25
-    
26
-    <select id="selectChannelList" resultType="com.huiju.estateagents.entity.TaChannel">
27
-        select * from ta_channel
28
-        where org_id = #{orgId}
29
-    </select>
30
-
31
-    <select id="pageTaChannel" resultType="com.huiju.estateagents.entity.TaChannel">
32
-        SELECT
33
-        c.*,
34
-        count(tp.person_id) AS brokerCount,
35
-        (SELECT COUNT(p.recommend_agent ) from ta_person p WHERE cp.person_id = p.recommend_agent) AS inviteCount,
36
-        cp.person_id
37
-        FROM
38
-        ta_channel c
39
-        LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
40
-        LEFT JOIN ta_person tp ON cp.person_id = tp.person_id 	AND tp.person_type = 'estate agent' 	AND cp.STATUS = 1
41
-        <where>
42
-            <if test="channelId != null and channelId != ''">
43
-                c.channel_id = #{channelId}
44
-            </if>
45
-            and c.org_id = #{orgId}
46
-        </where>
47
-        GROUP BY c.channel_id
48
-    </select>
49
-
50
-    <select id="recommendCount" resultType="com.huiju.estateagents.entity.TaChannel">
51
-        SELECT
52
-            c.channel_id,
53
-            COUNT( rc.recommend_person ) AS recommendCount
54
-        FROM
55
-        ta_channel c
56
-        LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
57
-        LEFT JOIN ta_recommend_customer rc ON cp.person_id = rc.recommend_person 	AND rc.verify_status = 1 	AND rc.`status` = 1
58
-        <where>
59
-            <if test="channelId != null and channelId != ''">
60
-                c.channel_id = #{channelId}
61
-            </if>
62
-            and c.org_id = #{orgId}
63
-        </where>
64
-        GROUP BY c.channel_id
65
-    </select>
66
-
67
-</mapper>
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">
3
+<mapper namespace="com.huiju.estateagents.mapper.TaChannelMapper">
4
+
5
+    <select id="channelCode" resultType="int">
6
+        drop FUNCTION if exists roundNum;
7
+        create function roundNum() returns int
8
+        begin
9
+        declare x int default 1;
10
+        declare y int default 0;
11
+        declare a int default 20;
12
+        declare b int default 1;
13
+        while (b <![CDATA[ < a ]]> ) do
14
+        set x = (select (select FLOOR(100000 + RAND()*900000))  as num);
15
+        set y = (select count(1) from ta_channel where channel_code = x);
16
+        if y = 0
17
+        then return x;
18
+        END IF;
19
+        set b = b + 1;
20
+        end while;
21
+        return 0;
22
+        end;
23
+        select roundNum();
24
+    </select>
25
+    
26
+    <select id="selectChannelList" resultType="com.huiju.estateagents.entity.TaChannel">
27
+        select * from ta_channel
28
+        where org_id = #{orgId}
29
+    </select>
30
+
31
+    <select id="pageTaChannel" resultType="com.huiju.estateagents.entity.TaChannel">
32
+        SELECT
33
+        c.*,
34
+        count(tp.person_id) AS brokerCount,
35
+        (SELECT COUNT(p.recommend_agent ) from ta_person p WHERE cp.person_id = p.recommend_agent) AS inviteCount,
36
+        cp.person_id
37
+        FROM
38
+        ta_channel c
39
+        LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
40
+        LEFT JOIN ta_person tp ON cp.person_id = tp.person_id 	AND tp.person_type = 'estate agent' 	AND cp.STATUS = 1
41
+        <where>
42
+            <if test="channelId != null and channelId != ''">
43
+                c.channel_id = #{channelId}
44
+            </if>
45
+            and c.org_id = #{orgId}
46
+        </where>
47
+        GROUP BY c.channel_id
48
+    </select>
49
+
50
+    <select id="recommendCount" resultType="com.huiju.estateagents.entity.TaChannel">
51
+        SELECT
52
+            c.channel_id,
53
+            COUNT( rc.recommend_person ) AS recommendCount
54
+        FROM
55
+        ta_channel c
56
+        LEFT JOIN ta_channel_person cp ON c.channel_id = cp.channel_id
57
+        LEFT JOIN ta_recommend_customer rc ON cp.person_id = rc.recommend_person 	AND rc.verify_status = 1 	AND rc.`status` = 1
58
+        <where>
59
+            <if test="channelId != null and channelId != ''">
60
+                c.channel_id = #{channelId}
61
+            </if>
62
+            and c.org_id = #{orgId}
63
+        </where>
64
+        GROUP BY c.channel_id
65
+    </select>
66
+
67
+</mapper>

+ 728
- 728
src/main/resources/mapper/TaPersonMapper.xml
文件差异内容过多而无法显示
查看文件


+ 446
- 446
src/main/resources/mapper/TaPersonVisitRecordMapper.xml 查看文件

@@ -1,446 +1,446 @@
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">
3
-<mapper namespace="com.huiju.estateagents.mapper.TaPersonVisitRecordMapper">
4
-
5
-    <sql id="columnSql">
6
-        <trim suffixOverrides=",">
7
-            t.record_id,
8
-            t.person_id,
9
-            c.person_type,
10
-            t.visit_time,
11
-            t.leave_time,
12
-            t.visit_duration,
13
-            t.event,
14
-            t.data,
15
-            t.activity,
16
-            t.org_id,
17
-            t.building_id,
18
-            t.event_type,
19
-            t.target_id,
20
-            t.consultant_id,
21
-            t.share_person_id,
22
-        </trim>
23
-    </sql>
24
-
25
-    <select id="visitRecordByPersonId" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
26
-        select
27
-            t.* ,
28
-            b.parent_type_id from ta_person_visit_record t
29
-        left join td_biz_event_type b on t.event_type = b.type_id
30
-        where t.person_id = #{personId}
31
-        <if test="personBuildingList != null and personBuildingList.size > 0">
32
-            AND (b.parent_type_id = 'public' or t.building_id in
33
-            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
34
-                #{personBuilding.buildingId}
35
-            </foreach>
36
-            )
37
-        </if>
38
-        <if test="buildingId != null and buildingId != ''">
39
-            AND (b.parent_type_id = 'public' or t.building_id = #{buildingId} )
40
-        </if>
41
-        order by t.visit_time desc
42
-    </select>
43
-
44
-    <select id="selectAll" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
45
-        SELECT
46
-            tpvr.record_id as recordId,
47
-            tpvr.person_id as personId,
48
-            tpvr.person_type as personType,
49
-            tpvr.building_id as buildingId,
50
-            tpvr.activity as activity,
51
-            tpvr.event as event,
52
-            tpvr.event_type as eventType,
53
-            tpvr.visit_duration as visitDuration,
54
-            (SELECT MIN(t.visit_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as visitTime,
55
-            (SELECT MAX(t.leave_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as leaveTime,
56
-            ifnull(tp.name, tp.nickname) as userName,
57
-            tbe.event_name as eventName,
58
-            COUNT(1) as accessCount
59
-        FROM
60
-            ta_person_visit_record tpvr
61
-            LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
62
-            LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
63
-            <trim prefix="where" prefixOverrides="and | or">
64
-                tpvr.org_id = #{orgId}
65
-                and tp.org_id = #{orgId}
66
-                <if test="startDate != null and endDate != null">
67
-                    and tpvr.visit_time between #{startDate} and #{endDate}
68
-                </if>
69
-                <if test="buildingId != null and buildingId != ''">
70
-                    and tpvr.building_id = #{buildingId}
71
-                </if>
72
-                <if test="eventType != null and eventType != ''">
73
-                    and tpvr.event_type = #{eventType}
74
-                </if>
75
-                <if test="event != null and event != ''">
76
-                    and tpvr.event = #{event}
77
-                </if>
78
-                <if test="activity != null and activity != ''">
79
-                    and tpvr.activity = #{activity}
80
-                </if>
81
-            </trim>
82
-
83
-        GROUP BY tpvr.person_id, tpvr.event
84
-        ORDER BY 	accessCount DESC,tpvr.visit_time DESC
85
-    </select>
86
-    <select id="getPersonVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
87
-        SELECT
88
-            t.*,
89
-            b.building_name
90
-        FROM
91
-            ta_person_visit_record t
92
-            LEFT JOIN ta_building b ON t.building_id = b.building_id
93
-        WHERE
94
-            t.person_id = #{personId}
95
-        ORDER BY
96
-            t.visit_time DESC
97
-    </select>
98
-
99
-    <select id="getDurationByPersonId" resultType="java.lang.Integer">
100
-        select SUM(visit_duration) from ta_person_visit_record where person_id = #{personId}
101
-    </select>
102
-
103
-    <select id="getFirstVisitTimeByPersonId" resultType="java.time.LocalDateTime">
104
-        select visit_time from ta_person_visit_record where person_id = #{personId} order by visit_time asc limit 1
105
-    </select>
106
-    <select id="getWxVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
107
-        SELECT
108
-            t.* ,
109
-	        p.`name` as user_name,
110
-	        p.`nickname` as nickname,
111
-	        p.avatarurl,
112
-	        d.name as activity_name,
113
-	        d.create_date
114
-        FROM
115
-            ( SELECT * FROM ta_person_visit_record WHERE org_id = #{orgId} and event_type = #{eventType} AND consultant_id = #{userId} and person_id != #{personId} ORDER BY visit_time DESC LIMIT 999) t
116
-            left JOIN ta_person p on t.person_id = p.person_id
117
-            LEFT join ta_drainage d on t.target_id = d.drainage_id
118
-        GROUP BY
119
-            t.person_id
120
-        ORDER BY
121
-	        t.visit_time DESC
122
-    </select>
123
-
124
-    <select id="getWxActivityVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
125
-        SELECT
126
-            t.share_from_id, t.share_person as consultant_id, t.share_person_type, t.person_id, t.target_type, t.target_id, t.create_date as visit_time, t.org_id ,t.building_id, t.status, t.is_first_time,
127
-	        p.`name` as user_name,
128
-	        p.`nickname` as nickname,
129
-	        p.avatarurl
130
-        FROM
131
-            ( SELECT * FROM ta_share_person_from WHERE org_id = #{orgId} and target_id = #{targetId} AND (share_person = #{userId} or share_person = #{personId}) and target_type = #{eventType} ORDER BY create_date DESC LIMIT 999) t
132
-            left JOIN ta_person p on t.person_id = p.person_id
133
-            where t.person_id != #{personId}
134
-        GROUP BY
135
-            t.person_id
136
-        ORDER BY
137
-	        t.create_date DESC
138
-    </select>
139
-
140
-
141
-    <select id="getWxVisitRecordActivityList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
142
-            SELECT
143
-                t.*,
144
-                d.NAME AS activity_name,
145
-                d.create_date
146
-            FROM
147
-                ( SELECT * FROM ta_person_visit_record WHERE event_type = #{eventType} AND consultant_id = #{userId} AND person_id = #{personId} ORDER BY visit_time DESC ) t
148
-                LEFT JOIN ta_drainage d ON t.target_id = d.drainage_id
149
-            GROUP BY
150
-                t.target_id
151
-            ORDER BY
152
-	            t.visit_time DESC
153
-    </select>
154
-
155
-    <select id="getDrainageVisitRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
156
-        select * from (
157
-            select
158
-            t.share_person as share_person_id,
159
-            t.person_id,
160
-            c.person_type,
161
-            t.create_date as visit_time,
162
-            t.target_type as event_type,
163
-            t.target_id as target_id,
164
-            b.name as drainageName,
165
-            d.building_name as buildingName,
166
-            tn.news_name as newsName,
167
-            tha.title as helpActivityName,
168
-            tsa.activity_name as groupActivityName,
169
-            tbd.title as activityName,
170
-            b.drainage_id
171
-            from ta_share_person_from t
172
-            left join ta_drainage b on t.target_id = b.drainage_id
173
-            left join ta_building d on t.target_id = d.building_id
174
-            left join ta_news tn on t.target_id = tn.news_id
175
-            left join ta_help_activity tha on t.target_id = tha.help_activity_id
176
-            left join ta_share_activity tsa on t.target_id = tsa.group_activity_id
177
-            left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
178
-            left join ta_person c on t.org_id = c.org_id and (t.share_person = c.person_id or t.share_person = c.user_id)
179
-            where t.org_id = #{orgId}
180
-            and t.target_type in ('h5_share','group_share','help_share','news_share','dynamic_share','building_share')
181
-            <if test="eventType !=null and eventType != ''">
182
-                and t.target_type = #{eventType}
183
-            </if>
184
-            <if test="activityName !=null and activityName != ''">
185
-                and (
186
-                (b.name like concat('%',#{activityName},'%') and t.target_type = 'h5_share')or (d.name like concat('%',#{activityName},'%') and t.target_type = 'building_share') or (tn.news_name like concat('%',#{activityName},'%') and t.target_type = 'news_share')
187
-                or (tha.title like concat( '%', #{activityName}, '%' ) and t.target_type = 'help_share')  or (tsa.activity_name like concat('%',#{activityName},'%') and t.target_type = 'group_share') or (tbd.title like concat('%',#{activityName},'%') and t.target_type = 'dynamic_share')
188
-                )
189
-            </if>
190
-            <if test="shareName !=null and shareName != ''">
191
-                and c.nickname like concat('%',#{shareName},'%')
192
-            </if>
193
-            <if test="shareTel !=null and shareTel != ''">
194
-                and c.phone = #{shareTel}
195
-            </if>
196
-            <if test="personType == 'Realty Consultant'">
197
-                and c.person_type = 'Realty Consultant'
198
-            </if>
199
-            <if test="personType == 'customer'">
200
-                and c.person_type != 'Realty Consultant'
201
-            </if>
202
-            <if test="buildingId !=null and buildingId != ''">
203
-                and d.building_id = #{buildingId}
204
-            </if>
205
-            <if test="personBuildingList != null and personBuildingList.size > 0">
206
-                AND d.building_id in
207
-                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
208
-                    #{personBuilding.buildingId}
209
-                </foreach>
210
-            </if>
211
-            order by t.create_date desc
212
-        ) t
213
-        group by t.person_id, t.target_id,t.event_type, t.share_person_id
214
-        order by t.visit_time desc
215
-    </select>
216
-
217
-    <select id="getConsultantShareInfoList" resultType="com.huiju.estateagents.entity.TaConsultantInfo">
218
-        select * From (
219
-            select * from (
220
-                select
221
-                t.be_share as target_id,
222
-                a.url as activity_img,
223
-                a.building_name as activity_name,
224
-                a.building_name,
225
-                a.address,
226
-                a.price,
227
-                a.building_type_id,
228
-                t.tagert_type as eventType,
229
-				t.create_date as visit_time
230
-                from ta_share t
231
-                left join (select b.url, a.building_name,a.address,a.price,a.building_id,a.building_type_id from ta_building a left join ta_building_img b on a.building_id = b.building_id where b.img_type = 'list') a on t.be_share = a.building_id
232
-                where t.tagert_type = 'project'
233
-                and t.person_id = #{personId} order by t.create_date desc limit 9999
234
-            ) t
235
-            group by t.target_id
236
-
237
-        union all
238
-
239
-        select * from (
240
-        select
241
-        t.be_share as target_id,
242
-        b.list_img_url as activity_img,
243
-        b.title as activity_name,
244
-        '1' as price,
245
-        '2' as building_name,
246
-        '3' as address,
247
-        1 as building_type_id,
248
-        t.tagert_type as eventType,
249
-		t.create_date as visit_time
250
-        from ta_share t
251
-        left join ta_building_dynamic b on t.be_share = b.dynamic_id
252
-        where t.tagert_type = 'activity'
253
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
254
-        ) t
255
-        group by t.target_id
256
-
257
-        union all
258
-
259
-        select * from (
260
-        select
261
-        t.be_share as target_id,
262
-        c.list_img as activity_img,
263
-        c.title as activity_name,
264
-        '1' as price,
265
-        '2' as building_name,
266
-        '3' as address,
267
-        1 as building_type_id,
268
-        t.tagert_type as eventType,
269
-		t.create_date as visit_time
270
-        from ta_share t
271
-        left join ta_help_activity c on t.be_share = c.help_activity_id
272
-        where t.tagert_type = 'help'
273
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
274
-        ) t
275
-        group by t.target_id
276
-
277
-        union all
278
-
279
-        select * from (
280
-        select
281
-        t.be_share as target_id,
282
-        d.list_img as activity_img,
283
-        d.activity_name as activity_name,
284
-        '1' as price,
285
-        '2' as building_name,
286
-        '3' as address,
287
-        1 as building_type_id,
288
-        t.tagert_type as eventType,
289
-		t.create_date as visit_time
290
-        from ta_share t
291
-        left join ta_share_activity d on t.be_share = d.group_activity_id
292
-        where t.tagert_type = 'group'
293
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
294
-        ) t
295
-		group by t.target_id
296
-
297
-        union all
298
-
299
-        select * from (
300
-        select
301
-        t.be_share as target_id,
302
-        e.news_img as activity_img,
303
-        e.news_name as activity_name,
304
-        '1' as price,
305
-        '2' as building_name,
306
-        '3' as address,
307
-        1 as building_type_id,
308
-        t.tagert_type as eventType,
309
-		t.create_date as visit_time
310
-        from ta_share t
311
-        left join ta_news e on t.be_share = e.news_id
312
-        where t.tagert_type = 'news'
313
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
314
-        ) t
315
-        group by t.target_id
316
-
317
-        union all
318
-
319
-        select * from (
320
-            select
321
-            t.be_share as target_id,
322
-            f.share_img as activity_img,
323
-            f.`name` as activity_name,
324
-            '1' as price,
325
-            '2' as building_name,
326
-            '3' as address,
327
-            1 as building_type_id,
328
-			t.tagert_type as eventType,
329
-			t.create_date as visit_time
330
-            from ta_share t
331
-            left join ta_drainage f on t.be_share = f.drainage_id
332
-            where t.tagert_type = 'h5'
333
-            and t.person_id = #{personId} order by t.create_date desc limit 9999
334
-            ) t
335
-            group by t.target_id
336
-         union all
337
-
338
-        select * from (
339
-            select
340
-            t.be_share as target_id,
341
-            g.aerial_view_img as activity_img,
342
-            g.sales_batch_name as activity_name,
343
-            '1' as price,
344
-            '2' as building_name,
345
-            '3' as address,
346
-            1 as building_type_id,
347
-			left(t.tagert_type,5) as eventType,
348
-			t.create_date as visit_time
349
-            from ta_share t
350
-            left join ta_sales_batch g on t.be_share = g.sales_batch_id
351
-            where t.tagert_type like CONCAT('house' , '%')
352
-            and t.person_id = #{personId} order by t.create_date desc limit 9999
353
-            ) t
354
-            group by t.target_id
355
-
356
-			union all
357
-				select * from (
358
-					SELECT
359
-						t.be_share AS target_id,
360
-						g.list_img AS activity_img,
361
-						g.live_activity_title AS activity_name,
362
-						'1' AS price,
363
-						'2' AS building_name,
364
-						'3' AS address,
365
-						1 AS building_type_id,
366
-						LEFT ( t.tagert_type, 4 ) AS eventType,
367
-						t.create_date AS visit_time
368
-					FROM
369
-						ta_share t
370
-						LEFT JOIN ta_live_activity g ON t.be_share = g.live_activity_id
371
-					WHERE
372
-						t.tagert_type LIKE CONCAT( 'live', '%' )
373
-							AND t.person_id = #{personId}
374
-						ORDER BY
375
-							t.create_date DESC
376
-							LIMIT 9999
377
-					) t
378
-				group by t.target_id
379
-        ) t
380
-        order by t.visit_time desc
381
-    </select>
382
-
383
-    <select id="countShareNumByEventType" resultType="java.lang.Integer">
384
-        select count(DISTINCT t.person_id)  from ta_share_person_from t
385
-        left join ta_person a on t.person_id = a.person_id
386
-        where
387
-        (t.share_person = #{personId}
388
-        <if test="userId != null and userId != ''">
389
-            or t.share_person = #{userId}
390
-        </if>
391
-        )
392
-        and t.org_id = #{orgId}
393
-        and t.target_type = #{eventType}
394
-        and t.target_id = #{targetId}
395
-        and t.status = 1
396
-        and t.person_id != #{personId}
397
-        group by t.target_type
398
-    </select>
399
-
400
-    <select id="selectData" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
401
-		select t.share_person_id, t.target_id,
402
-		if(t.target_type = 'help' and t.event_type = 'activity', 'help', if(t.target_type = 'group' and t.event_type = 'activity' , 'group', t.event_type)) as target_type,
403
-		a.nickname, a.avatarurl FROM
404
-        ta_person_visit_record t
405
-        LEFT JOIN ta_person a ON t.share_person_id = a.person_id
406
-        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
407
-        WHERE
408
-        (
409
-            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
410
-            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
411
-        )
412
-        AND t.person_id != t.share_person_id
413
-        AND t.`event` = 'detail'
414
-        AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
415
-        GROUP BY
416
-        t.target_id, t.event_type;
417
-    </select>
418
-
419
-    <select id="selectTapersonFromShare" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
420
-        select t.share_person_id, if (t.consultant_id != '' and t.consultant_id is not null, 'Realty Consultant', 'customer') as person_type, t.person_id, b.target_type, t.target_id,t.org_id, t.building_id  From ta_person_visit_record t
421
-        left join ta_person a on t.share_person_id = a.person_id
422
-        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
423
-        where
424
-        (
425
-            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
426
-            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
427
-            )
428
-            AND t.person_id != t.share_person_id
429
-            AND t.`event` = 'detail'
430
-            AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
431
-        GROUP BY
432
-            t.target_id, t.event_type;
433
-    </select>
434
-
435
-    <select id="selectTodayVisitCount" resultType="java.lang.Integer">
436
-        SELECT
437
-        COUNT(1) as visit_count
438
-        FROM
439
-        ta_person_visit_record tp
440
-        where tp.org_id = #{orgId} AND
441
-        tp.event  = 'start'
442
-        AND DATE_FORMAT(tp.visit_time,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
443
-    </select>
444
-
445
-
446
-</mapper>
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">
3
+<mapper namespace="com.huiju.estateagents.mapper.TaPersonVisitRecordMapper">
4
+
5
+    <sql id="columnSql">
6
+        <trim suffixOverrides=",">
7
+            t.record_id,
8
+            t.person_id,
9
+            c.person_type,
10
+            t.visit_time,
11
+            t.leave_time,
12
+            t.visit_duration,
13
+            t.event,
14
+            t.data,
15
+            t.activity,
16
+            t.org_id,
17
+            t.building_id,
18
+            t.event_type,
19
+            t.target_id,
20
+            t.consultant_id,
21
+            t.share_person_id,
22
+        </trim>
23
+    </sql>
24
+
25
+    <select id="visitRecordByPersonId" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
26
+        select
27
+            t.* ,
28
+            b.parent_type_id from ta_person_visit_record t
29
+        left join td_biz_event_type b on t.event_type = b.type_id
30
+        where t.person_id = #{personId}
31
+        <if test="personBuildingList != null and personBuildingList.size > 0">
32
+            AND (b.parent_type_id = 'public' or t.building_id in
33
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
34
+                #{personBuilding.buildingId}
35
+            </foreach>
36
+            )
37
+        </if>
38
+        <if test="buildingId != null and buildingId != ''">
39
+            AND (b.parent_type_id = 'public' or t.building_id = #{buildingId} )
40
+        </if>
41
+        order by t.visit_time desc
42
+    </select>
43
+
44
+    <select id="selectAll" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
45
+        SELECT
46
+            tpvr.record_id as recordId,
47
+            tpvr.person_id as personId,
48
+            tpvr.person_type as personType,
49
+            tpvr.building_id as buildingId,
50
+            tpvr.activity as activity,
51
+            tpvr.event as event,
52
+            tpvr.event_type as eventType,
53
+            tpvr.visit_duration as visitDuration,
54
+            (SELECT MIN(t.visit_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as visitTime,
55
+            (SELECT MAX(t.leave_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as leaveTime,
56
+            ifnull(tp.name, tp.nickname) as userName,
57
+            tbe.event_name as eventName,
58
+            COUNT(1) as accessCount
59
+        FROM
60
+            ta_person_visit_record tpvr
61
+            LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
62
+            LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
63
+            <trim prefix="where" prefixOverrides="and | or">
64
+                tpvr.org_id = #{orgId}
65
+                and tp.org_id = #{orgId}
66
+                <if test="startDate != null and endDate != null">
67
+                    and tpvr.visit_time between #{startDate} and #{endDate}
68
+                </if>
69
+                <if test="buildingId != null and buildingId != ''">
70
+                    and tpvr.building_id = #{buildingId}
71
+                </if>
72
+                <if test="eventType != null and eventType != ''">
73
+                    and tpvr.event_type = #{eventType}
74
+                </if>
75
+                <if test="event != null and event != ''">
76
+                    and tpvr.event = #{event}
77
+                </if>
78
+                <if test="activity != null and activity != ''">
79
+                    and tpvr.activity = #{activity}
80
+                </if>
81
+            </trim>
82
+
83
+        GROUP BY tpvr.person_id, tpvr.event
84
+        ORDER BY 	accessCount DESC,tpvr.visit_time DESC
85
+    </select>
86
+    <select id="getPersonVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
87
+        SELECT
88
+            t.*,
89
+            b.building_name
90
+        FROM
91
+            ta_person_visit_record t
92
+            LEFT JOIN ta_building b ON t.building_id = b.building_id
93
+        WHERE
94
+            t.person_id = #{personId}
95
+        ORDER BY
96
+            t.visit_time DESC
97
+    </select>
98
+
99
+    <select id="getDurationByPersonId" resultType="java.lang.Integer">
100
+        select SUM(visit_duration) from ta_person_visit_record where person_id = #{personId}
101
+    </select>
102
+
103
+    <select id="getFirstVisitTimeByPersonId" resultType="java.time.LocalDateTime">
104
+        select visit_time from ta_person_visit_record where person_id = #{personId} order by visit_time asc limit 1
105
+    </select>
106
+    <select id="getWxVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
107
+        SELECT
108
+            t.* ,
109
+	        p.`name` as user_name,
110
+	        p.`nickname` as nickname,
111
+	        p.avatarurl,
112
+	        d.name as activity_name,
113
+	        d.create_date
114
+        FROM
115
+            ( SELECT * FROM ta_person_visit_record WHERE org_id = #{orgId} and event_type = #{eventType} AND consultant_id = #{userId} and person_id != #{personId} ORDER BY visit_time DESC LIMIT 999) t
116
+            left JOIN ta_person p on t.person_id = p.person_id
117
+            LEFT join ta_drainage d on t.target_id = d.drainage_id
118
+        GROUP BY
119
+            t.person_id
120
+        ORDER BY
121
+	        t.visit_time DESC
122
+    </select>
123
+
124
+    <select id="getWxActivityVisitRecordList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
125
+        SELECT
126
+            t.share_from_id, t.share_person as consultant_id, t.share_person_type, t.person_id, t.target_type, t.target_id, t.create_date as visit_time, t.org_id ,t.building_id, t.status, t.is_first_time,
127
+	        p.`name` as user_name,
128
+	        p.`nickname` as nickname,
129
+	        p.avatarurl
130
+        FROM
131
+            ( SELECT * FROM ta_share_person_from WHERE org_id = #{orgId} and target_id = #{targetId} AND (share_person = #{userId} or share_person = #{personId}) and target_type = #{eventType} ORDER BY create_date DESC LIMIT 999) t
132
+            left JOIN ta_person p on t.person_id = p.person_id
133
+            where t.person_id != #{personId}
134
+        GROUP BY
135
+            t.person_id
136
+        ORDER BY
137
+	        t.create_date DESC
138
+    </select>
139
+
140
+
141
+    <select id="getWxVisitRecordActivityList" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
142
+            SELECT
143
+                t.*,
144
+                d.NAME AS activity_name,
145
+                d.create_date
146
+            FROM
147
+                ( SELECT * FROM ta_person_visit_record WHERE event_type = #{eventType} AND consultant_id = #{userId} AND person_id = #{personId} ORDER BY visit_time DESC ) t
148
+                LEFT JOIN ta_drainage d ON t.target_id = d.drainage_id
149
+            GROUP BY
150
+                t.target_id
151
+            ORDER BY
152
+	            t.visit_time DESC
153
+    </select>
154
+
155
+    <select id="getDrainageVisitRecord" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
156
+        select * from (
157
+            select
158
+            t.share_person as share_person_id,
159
+            t.person_id,
160
+            c.person_type,
161
+            t.create_date as visit_time,
162
+            t.target_type as event_type,
163
+            t.target_id as target_id,
164
+            b.name as drainageName,
165
+            d.building_name as buildingName,
166
+            tn.news_name as newsName,
167
+            tha.title as helpActivityName,
168
+            tsa.activity_name as groupActivityName,
169
+            tbd.title as activityName,
170
+            b.drainage_id
171
+            from ta_share_person_from t
172
+            left join ta_drainage b on t.target_id = b.drainage_id
173
+            left join ta_building d on t.target_id = d.building_id
174
+            left join ta_news tn on t.target_id = tn.news_id
175
+            left join ta_help_activity tha on t.target_id = tha.help_activity_id
176
+            left join ta_share_activity tsa on t.target_id = tsa.group_activity_id
177
+            left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
178
+            left join ta_person c on t.org_id = c.org_id and (t.share_person = c.person_id or t.share_person = c.user_id)
179
+            where t.org_id = #{orgId}
180
+            and t.target_type in ('h5_share','group_share','help_share','news_share','dynamic_share','building_share')
181
+            <if test="eventType !=null and eventType != ''">
182
+                and t.target_type = #{eventType}
183
+            </if>
184
+            <if test="activityName !=null and activityName != ''">
185
+                and (
186
+                (b.name like concat('%',#{activityName},'%') and t.target_type = 'h5_share')or (d.name like concat('%',#{activityName},'%') and t.target_type = 'building_share') or (tn.news_name like concat('%',#{activityName},'%') and t.target_type = 'news_share')
187
+                or (tha.title like concat( '%', #{activityName}, '%' ) and t.target_type = 'help_share')  or (tsa.activity_name like concat('%',#{activityName},'%') and t.target_type = 'group_share') or (tbd.title like concat('%',#{activityName},'%') and t.target_type = 'dynamic_share')
188
+                )
189
+            </if>
190
+            <if test="shareName !=null and shareName != ''">
191
+                and c.nickname like concat('%',#{shareName},'%')
192
+            </if>
193
+            <if test="shareTel !=null and shareTel != ''">
194
+                and c.phone = #{shareTel}
195
+            </if>
196
+            <if test="personType == 'Realty Consultant'">
197
+                and c.person_type = 'Realty Consultant'
198
+            </if>
199
+            <if test="personType == 'customer'">
200
+                and c.person_type != 'Realty Consultant'
201
+            </if>
202
+            <if test="buildingId !=null and buildingId != ''">
203
+                and d.building_id = #{buildingId}
204
+            </if>
205
+            <if test="personBuildingList != null and personBuildingList.size > 0">
206
+                AND d.building_id in
207
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
208
+                    #{personBuilding.buildingId}
209
+                </foreach>
210
+            </if>
211
+            order by t.create_date desc
212
+        ) t
213
+        group by t.person_id, t.target_id,t.event_type, t.share_person_id
214
+        order by t.visit_time desc
215
+    </select>
216
+
217
+    <select id="getConsultantShareInfoList" resultType="com.huiju.estateagents.entity.TaConsultantInfo">
218
+        select * From (
219
+            select * from (
220
+                select
221
+                t.be_share as target_id,
222
+                a.url as activity_img,
223
+                a.building_name as activity_name,
224
+                a.building_name,
225
+                a.address,
226
+                a.price,
227
+                a.building_type_id,
228
+                t.tagert_type as eventType,
229
+				t.create_date as visit_time
230
+                from ta_share t
231
+                left join (select b.url, a.building_name,a.address,a.price,a.building_id,a.building_type_id from ta_building a left join ta_building_img b on a.building_id = b.building_id where b.img_type = 'list') a on t.be_share = a.building_id
232
+                where t.tagert_type = 'project'
233
+                and t.person_id = #{personId} order by t.create_date desc limit 9999
234
+            ) t
235
+            group by t.target_id
236
+
237
+        union all
238
+
239
+        select * from (
240
+        select
241
+        t.be_share as target_id,
242
+        b.list_img_url as activity_img,
243
+        b.title as activity_name,
244
+        '1' as price,
245
+        '2' as building_name,
246
+        '3' as address,
247
+        1 as building_type_id,
248
+        t.tagert_type as eventType,
249
+		t.create_date as visit_time
250
+        from ta_share t
251
+        left join ta_building_dynamic b on t.be_share = b.dynamic_id
252
+        where t.tagert_type = 'activity'
253
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
254
+        ) t
255
+        group by t.target_id
256
+
257
+        union all
258
+
259
+        select * from (
260
+        select
261
+        t.be_share as target_id,
262
+        c.list_img as activity_img,
263
+        c.title as activity_name,
264
+        '1' as price,
265
+        '2' as building_name,
266
+        '3' as address,
267
+        1 as building_type_id,
268
+        t.tagert_type as eventType,
269
+		t.create_date as visit_time
270
+        from ta_share t
271
+        left join ta_help_activity c on t.be_share = c.help_activity_id
272
+        where t.tagert_type = 'help'
273
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
274
+        ) t
275
+        group by t.target_id
276
+
277
+        union all
278
+
279
+        select * from (
280
+        select
281
+        t.be_share as target_id,
282
+        d.list_img as activity_img,
283
+        d.activity_name as activity_name,
284
+        '1' as price,
285
+        '2' as building_name,
286
+        '3' as address,
287
+        1 as building_type_id,
288
+        t.tagert_type as eventType,
289
+		t.create_date as visit_time
290
+        from ta_share t
291
+        left join ta_share_activity d on t.be_share = d.group_activity_id
292
+        where t.tagert_type = 'group'
293
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
294
+        ) t
295
+		group by t.target_id
296
+
297
+        union all
298
+
299
+        select * from (
300
+        select
301
+        t.be_share as target_id,
302
+        e.news_img as activity_img,
303
+        e.news_name as activity_name,
304
+        '1' as price,
305
+        '2' as building_name,
306
+        '3' as address,
307
+        1 as building_type_id,
308
+        t.tagert_type as eventType,
309
+		t.create_date as visit_time
310
+        from ta_share t
311
+        left join ta_news e on t.be_share = e.news_id
312
+        where t.tagert_type = 'news'
313
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
314
+        ) t
315
+        group by t.target_id
316
+
317
+        union all
318
+
319
+        select * from (
320
+            select
321
+            t.be_share as target_id,
322
+            f.share_img as activity_img,
323
+            f.`name` as activity_name,
324
+            '1' as price,
325
+            '2' as building_name,
326
+            '3' as address,
327
+            1 as building_type_id,
328
+			t.tagert_type as eventType,
329
+			t.create_date as visit_time
330
+            from ta_share t
331
+            left join ta_drainage f on t.be_share = f.drainage_id
332
+            where t.tagert_type = 'h5'
333
+            and t.person_id = #{personId} order by t.create_date desc limit 9999
334
+            ) t
335
+            group by t.target_id
336
+         union all
337
+
338
+        select * from (
339
+            select
340
+            t.be_share as target_id,
341
+            g.aerial_view_img as activity_img,
342
+            g.sales_batch_name as activity_name,
343
+            '1' as price,
344
+            '2' as building_name,
345
+            '3' as address,
346
+            1 as building_type_id,
347
+			left(t.tagert_type,5) as eventType,
348
+			t.create_date as visit_time
349
+            from ta_share t
350
+            left join ta_sales_batch g on t.be_share = g.sales_batch_id
351
+            where t.tagert_type like CONCAT('house' , '%')
352
+            and t.person_id = #{personId} order by t.create_date desc limit 9999
353
+            ) t
354
+            group by t.target_id
355
+
356
+			union all
357
+				select * from (
358
+					SELECT
359
+						t.be_share AS target_id,
360
+						g.list_img AS activity_img,
361
+						g.live_activity_title AS activity_name,
362
+						'1' AS price,
363
+						'2' AS building_name,
364
+						'3' AS address,
365
+						1 AS building_type_id,
366
+						LEFT ( t.tagert_type, 4 ) AS eventType,
367
+						t.create_date AS visit_time
368
+					FROM
369
+						ta_share t
370
+						LEFT JOIN ta_live_activity g ON t.be_share = g.live_activity_id
371
+					WHERE
372
+						t.tagert_type LIKE CONCAT( 'live', '%' )
373
+							AND t.person_id = #{personId}
374
+						ORDER BY
375
+							t.create_date DESC
376
+							LIMIT 9999
377
+					) t
378
+				group by t.target_id
379
+        ) t
380
+        order by t.visit_time desc
381
+    </select>
382
+
383
+    <select id="countShareNumByEventType" resultType="java.lang.Integer">
384
+        select count(DISTINCT t.person_id)  from ta_share_person_from t
385
+        left join ta_person a on t.person_id = a.person_id
386
+        where
387
+        (t.share_person = #{personId}
388
+        <if test="userId != null and userId != ''">
389
+            or t.share_person = #{userId}
390
+        </if>
391
+        )
392
+        and t.org_id = #{orgId}
393
+        and t.target_type = #{eventType}
394
+        and t.target_id = #{targetId}
395
+        and t.status = 1
396
+        and t.person_id != #{personId}
397
+        group by t.target_type
398
+    </select>
399
+
400
+    <select id="selectData" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
401
+		select t.share_person_id, t.target_id,
402
+		if(t.target_type = 'help' and t.event_type = 'activity', 'help', if(t.target_type = 'group' and t.event_type = 'activity' , 'group', t.event_type)) as target_type,
403
+		a.nickname, a.avatarurl FROM
404
+        ta_person_visit_record t
405
+        LEFT JOIN ta_person a ON t.share_person_id = a.person_id
406
+        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
407
+        WHERE
408
+        (
409
+            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
410
+            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
411
+        )
412
+        AND t.person_id != t.share_person_id
413
+        AND t.`event` = 'detail'
414
+        AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
415
+        GROUP BY
416
+        t.target_id, t.event_type;
417
+    </select>
418
+
419
+    <select id="selectTapersonFromShare" resultType="com.huiju.estateagents.entity.TaPersonVisitRecord">
420
+        select t.share_person_id, if (t.consultant_id != '' and t.consultant_id is not null, 'Realty Consultant', 'customer') as person_type, t.person_id, b.target_type, t.target_id,t.org_id, t.building_id  From ta_person_visit_record t
421
+        left join ta_person a on t.share_person_id = a.person_id
422
+        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
423
+        where
424
+        (
425
+            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
426
+            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
427
+            )
428
+            AND t.person_id != t.share_person_id
429
+            AND t.`event` = 'detail'
430
+            AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
431
+        GROUP BY
432
+            t.target_id, t.event_type;
433
+    </select>
434
+
435
+    <select id="selectTodayVisitCount" resultType="java.lang.Integer">
436
+        SELECT
437
+        COUNT(1) as visit_count
438
+        FROM
439
+        ta_person_visit_record tp
440
+        where tp.org_id = #{orgId} AND
441
+        tp.event  = 'start'
442
+        AND DATE_FORMAT(tp.visit_time,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
443
+    </select>
444
+
445
+
446
+</mapper>

+ 925
- 925
src/main/resources/mapper/TaRecommendCustomerMapper.xml
文件差异内容过多而无法显示
查看文件


+ 158
- 158
src/main/resources/mapper/TaUserMapper.xml 查看文件

@@ -1,158 +1,158 @@
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">
3
-<mapper namespace="com.huiju.estateagents.center.taUser.mapper.TaUserMapper">
4
-
5
-    <select id="getPageList" resultType="map">
6
-        SELECT
7
-            t.user_id AS userId,
8
-            t.org_id AS orgId,
9
-            t.user_name AS userName,
10
-            t.login_name AS loginName,
11
-            t.phone,
12
-            t.avatar,
13
-            t.create_date AS createDate,
14
-            t.status,
15
-            o.NAME AS orgName,
16
-            o.address,
17
-            o.logo,
18
-            o.remark,
19
-            m.miniapp_id AS miniappId,
20
-            m.secret,
21
-            m.token,
22
-            m.NAME AS miniappName,
23
-            m.qr_code AS qrCode,
24
-            t.exp_date as expire_date,
25
-            m.org_id
26
-        FROM
27
-            ta_user t
28
-            LEFT JOIN ta_org o ON t.org_id = o.org_id
29
-            LEFT JOIN ta_miniapp m ON o.org_id = m.org_id
30
-            left join ta_channel_app_relation n on o.org_id = n.org_id
31
-            left join ta_channel_proxy z on z.channel_id = n.channel_id
32
-        WHERE
33
-            t.is_admin =1
34
-            <if test="channelId != null and channelId != ''">
35
-                and n.channel_id = #{channelId}
36
-            </if>
37
-            <if test="miniAppName != null and miniAppName != ''">
38
-                and m.name like CONCAT('%', #{miniAppName}, '%')
39
-            </if>
40
-    </select>
41
-
42
-    <select id="getTagsList" resultType="com.huiju.estateagents.center.taUser.entity.TaTags">
43
-        SELECT
44
-            t.*
45
-        FROM
46
-            ta_tag_user u
47
-            LEFT JOIN ta_tags t ON u.tag_id = t.tag_id
48
-            AND t.org_id = #{orgId}
49
-        WHERE
50
-            u.user_id = #{userId}
51
-    </select>
52
-
53
-    <select id="getUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
54
-    SELECT
55
-        *
56
-    FROM
57
-        ta_user
58
-    WHERE
59
-        org_id = #{orgId}
60
-        and phone = #{phone}
61
-    </select>
62
-    <select id="seleUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
63
-        SELECT
64
-            t.*,
65
-            b.building_id,
66
-            d.person_id as consultant_person_id,
67
-            if(d.person_id is not null,1,0) as mini_status
68
-        FROM
69
-            ta_user t
70
-            LEFT JOIN ta_person_building b ON t.user_id = b.user_id
71
-            LEFT JOIN ta_person d on t.user_id = d.user_id
72
-        WHERE
73
-            t.org_id = #{taUser.orgId} AND (t.is_admin != 1 or t.is_admin is null)
74
-            <if test="taUser.userName != null and taUser.userName != ''">
75
-                and t.user_name like CONCAT('%', #{taUser.userName}, '%')
76
-            </if>
77
-            <if test="taUser.phone != null and taUser.phone != ''">
78
-                and t.phone like CONCAT('%', #{taUser.phone}, '%')
79
-            </if>
80
-            <if test="taUser.status != null and taUser.status != ''">
81
-                and t.status = #{taUser.status}
82
-            </if>
83
-            <if test="taUser.isConsultant != null">
84
-                and t.is_consultant = #{taUser.isConsultant}
85
-            </if>
86
-            <if test="taUser.miniStatus == 0">
87
-                and d.person_id is null
88
-            </if>
89
-            <if test="taUser.miniStatus != null and taUser.miniStatus != '' and taUser.miniStatus == 1">
90
-                and d.person_id is not null
91
-            </if>
92
-            <if test="taUser.buildingId != null and taUser.buildingId != ''">
93
-                and b.building_id = #{taUser.buildingId}
94
-            </if>
95
-            <if test="personBuildingList != null and personBuildingList.size > 0">
96
-                AND b.building_id in
97
-                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
98
-                    #{personBuilding.buildingId}
99
-                </foreach>
100
-            </if>
101
-            GROUP BY user_id
102
-            order by t.weight desc, create_date desc
103
-    </select>
104
-
105
-    <select id="validateWeight" resultType="integer">
106
-      select count(*) from ta_user t
107
-      LEFT JOIN ta_person_building a on t.user_id = a.user_id
108
-      where 1=1
109
-      <if test="weight != null and weight != ''">
110
-          and t.weight = #{weight}
111
-      </if>
112
-      <if test="buildingIds != null and buildingIds.size() > 0 ">
113
-          and a.building_id in
114
-          <foreach collection="buildingIds" item="item" index="index" open="(" close=")" separator=",">
115
-              #{item}
116
-          </foreach>
117
-      </if>
118
-      <if test="buildingId != null and buildingId != '' ">
119
-          and a.building_id = #{buildingId}
120
-      </if>
121
-      <if test="userId != null and userId != ''">
122
-          and t.user_id != #{userId}
123
-      </if>
124
-    </select>
125
-
126
-    <select id="getAdminByAppID" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
127
-        SELECT
128
-        m.*
129
-        FROM
130
-        ta_miniapp t
131
-        JOIN ta_user m USING (org_id)
132
-        WHERE
133
-        t.miniapp_id = #{appid}
134
-        AND m.is_admin = 1
135
-    </select>
136
-
137
-    <select id="getBuildingIdsOf" resultType="java.lang.String">
138
-        select building_id from ta_person_building
139
-        where user_id = #{userId}
140
-        <if test="buildingId != null and buildingId != ''">
141
-            and building_id = #{buildingId}
142
-        </if>
143
-    </select>
144
-
145
-    <select id="getUserByPerson" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
146
-        SELECT
147
-            t.*
148
-        FROM
149
-            ta_user t
150
-        INNER JOIN ta_person s ON s.org_id = #{orgId} AND s.user_id = t.user_id
151
-        WHERE
152
-            t.org_id = #{orgId}
153
-        AND s.person_id = #{personId}
154
-        AND t.status &gt; -1
155
-        Limit 1
156
-    </select>
157
-
158
-</mapper>
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">
3
+<mapper namespace="com.huiju.estateagents.center.taUser.mapper.TaUserMapper">
4
+
5
+    <select id="getPageList" resultType="map">
6
+        SELECT
7
+            t.user_id AS userId,
8
+            t.org_id AS orgId,
9
+            t.user_name AS userName,
10
+            t.login_name AS loginName,
11
+            t.phone,
12
+            t.avatar,
13
+            t.create_date AS createDate,
14
+            t.status,
15
+            o.NAME AS orgName,
16
+            o.address,
17
+            o.logo,
18
+            o.remark,
19
+            m.miniapp_id AS miniappId,
20
+            m.secret,
21
+            m.token,
22
+            m.NAME AS miniappName,
23
+            m.qr_code AS qrCode,
24
+            t.exp_date as expire_date,
25
+            m.org_id
26
+        FROM
27
+            ta_user t
28
+            LEFT JOIN ta_org o ON t.org_id = o.org_id
29
+            LEFT JOIN ta_miniapp m ON o.org_id = m.org_id
30
+            left join ta_channel_app_relation n on o.org_id = n.org_id
31
+            left join ta_channel_proxy z on z.channel_id = n.channel_id
32
+        WHERE
33
+            t.is_admin =1
34
+            <if test="channelId != null and channelId != ''">
35
+                and n.channel_id = #{channelId}
36
+            </if>
37
+            <if test="miniAppName != null and miniAppName != ''">
38
+                and m.name like CONCAT('%', #{miniAppName}, '%')
39
+            </if>
40
+    </select>
41
+
42
+    <select id="getTagsList" resultType="com.huiju.estateagents.center.taUser.entity.TaTags">
43
+        SELECT
44
+            t.*
45
+        FROM
46
+            ta_tag_user u
47
+            LEFT JOIN ta_tags t ON u.tag_id = t.tag_id
48
+            AND t.org_id = #{orgId}
49
+        WHERE
50
+            u.user_id = #{userId}
51
+    </select>
52
+
53
+    <select id="getUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
54
+    SELECT
55
+        *
56
+    FROM
57
+        ta_user
58
+    WHERE
59
+        org_id = #{orgId}
60
+        and phone = #{phone}
61
+    </select>
62
+    <select id="seleUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
63
+        SELECT
64
+            t.*,
65
+            b.building_id,
66
+            d.person_id as consultant_person_id,
67
+            if(d.person_id is not null,1,0) as mini_status
68
+        FROM
69
+            ta_user t
70
+            LEFT JOIN ta_person_building b ON t.user_id = b.user_id
71
+            LEFT JOIN ta_person d on t.user_id = d.user_id
72
+        WHERE
73
+            t.org_id = #{taUser.orgId} AND (t.is_admin != 1 or t.is_admin is null)
74
+            <if test="taUser.userName != null and taUser.userName != ''">
75
+                and t.user_name like CONCAT('%', #{taUser.userName}, '%')
76
+            </if>
77
+            <if test="taUser.phone != null and taUser.phone != ''">
78
+                and t.phone like CONCAT('%', #{taUser.phone}, '%')
79
+            </if>
80
+            <if test="taUser.status != null and taUser.status != ''">
81
+                and t.status = #{taUser.status}
82
+            </if>
83
+            <if test="taUser.isConsultant != null">
84
+                and t.is_consultant = #{taUser.isConsultant}
85
+            </if>
86
+            <if test="taUser.miniStatus == 0">
87
+                and d.person_id is null
88
+            </if>
89
+            <if test="taUser.miniStatus != null and taUser.miniStatus != '' and taUser.miniStatus == 1">
90
+                and d.person_id is not null
91
+            </if>
92
+            <if test="taUser.buildingId != null and taUser.buildingId != ''">
93
+                and b.building_id = #{taUser.buildingId}
94
+            </if>
95
+            <if test="personBuildingList != null and personBuildingList.size > 0">
96
+                AND b.building_id in
97
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
98
+                    #{personBuilding.buildingId}
99
+                </foreach>
100
+            </if>
101
+            GROUP BY user_id
102
+            order by t.weight desc, create_date desc
103
+    </select>
104
+
105
+    <select id="validateWeight" resultType="integer">
106
+      select count(*) from ta_user t
107
+      LEFT JOIN ta_person_building a on t.user_id = a.user_id
108
+      where 1=1
109
+      <if test="weight != null and weight != ''">
110
+          and t.weight = #{weight}
111
+      </if>
112
+      <if test="buildingIds != null and buildingIds.size() > 0 ">
113
+          and a.building_id in
114
+          <foreach collection="buildingIds" item="item" index="index" open="(" close=")" separator=",">
115
+              #{item}
116
+          </foreach>
117
+      </if>
118
+      <if test="buildingId != null and buildingId != '' ">
119
+          and a.building_id = #{buildingId}
120
+      </if>
121
+      <if test="userId != null and userId != ''">
122
+          and t.user_id != #{userId}
123
+      </if>
124
+    </select>
125
+
126
+    <select id="getAdminByAppID" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
127
+        SELECT
128
+        m.*
129
+        FROM
130
+        ta_miniapp t
131
+        JOIN ta_user m USING (org_id)
132
+        WHERE
133
+        t.miniapp_id = #{appid}
134
+        AND m.is_admin = 1
135
+    </select>
136
+
137
+    <select id="getBuildingIdsOf" resultType="java.lang.String">
138
+        select building_id from ta_person_building
139
+        where user_id = #{userId}
140
+        <if test="buildingId != null and buildingId != ''">
141
+            and building_id = #{buildingId}
142
+        </if>
143
+    </select>
144
+
145
+    <select id="getUserByPerson" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
146
+        SELECT
147
+            t.*
148
+        FROM
149
+            ta_user t
150
+        INNER JOIN ta_person s ON s.org_id = #{orgId} AND s.user_id = t.user_id
151
+        WHERE
152
+            t.org_id = #{orgId}
153
+        AND s.person_id = #{personId}
154
+        AND t.status &gt; -1
155
+        Limit 1
156
+    </select>
157
+
158
+</mapper>

+ 5
- 4
src/main/resources/mapper/TsConsultantKpiMapper.xml 查看文件

@@ -27,8 +27,9 @@
27 27
                  where s.org_id = t.org_id and (s.realty_consultant = t.user_id or s.realty_consultant = m.person_id)
28 28
                  and (s.building_id = t.building_id or IFNULL(t.building_id, '') = '')
29 29
                  and s.status > 0
30
-                 AND s.create_date BETWEEN STR_TO_DATE( #{startDate}, '%Y%m%d' )
31
-                 AND  STR_TO_DATE(concat(#{endDate}, '235959'), '%Y%m%d%H%i%s')) as total_persons
30
+<!--                 AND s.create_date BETWEEN STR_TO_DATE( #{startDate}, '%Y%m%d' )-->
31
+<!--                 AND  STR_TO_DATE(concat(#{endDate}, '235959'), '%Y%m%d%H%i%s')-->
32
+                ) as total_persons
32 33
             FROM
33 34
                 ts_consultant_kpi t
34 35
             LEFT JOIN ta_person m on m.org_id = #{orgId} and m.user_id = t.user_id
@@ -145,8 +146,8 @@
145 146
         WHERE
146 147
             p.org_id = #{orgId}
147 148
             AND p.`status` > 0
148
-            AND p.create_date BETWEEN STR_TO_DATE( #{startDate}, '%Y%m%d')
149
-            AND  STR_TO_DATE(concat(#{endDate}, '235959'), '%Y%m%d%H%i%s')
149
+<!--            AND p.create_date BETWEEN STR_TO_DATE( #{startDate}, '%Y%m%d')-->
150
+<!--            AND  STR_TO_DATE(concat(#{endDate}, '235959'), '%Y%m%d%H%i%s')-->
150 151
         <if test="buildingIds != null">
151 152
             AND t.building_id in
152 153
             <foreach item="buildingId" index="index" collection="buildingIds"