胡轶钦 5 年 前
コミット
ac2d7361ca

+ 4
- 4
src/main/java/com/huiju/estateagents/common/CommConstant.java ファイルの表示

@@ -182,22 +182,22 @@ public class CommConstant {
182 182
     /**
183 183
      * 客户报备
184 184
      */
185
-    public static final String CUSTOMER_REPORT = "1";
185
+    public static final Integer CUSTOMER_REPORT = 1;
186 186
 
187 187
     /**
188 188
      * 客户到访
189 189
      */
190
-    public static final String CUSTOMER_VISITE = "2";
190
+    public static final Integer CUSTOMER_VISITE = 2;
191 191
 
192 192
     /**
193 193
      * 客户认购
194 194
      */
195
-    public static final String CUSTOMER_PREORDER = "3";
195
+    public static final Integer CUSTOMER_PREORDER = 3 ;
196 196
 
197 197
     /**
198 198
      * 客户签约
199 199
      */
200
-    public static final String CUSTOMER_SIGNED = "4";
200
+    public static final Integer CUSTOMER_SIGNED = 4;
201 201
 
202 202
 
203 203
     /**

+ 17
- 23
src/main/java/com/huiju/estateagents/controller/MiniAppController.java ファイルの表示

@@ -71,13 +71,13 @@ public class MiniAppController {
71 71
      * 登陆接口
72 72
      */
73 73
     @PostMapping("/login")
74
-    public ResponseBean login(String code,@RequestParam(required = false) String from,@RequestParam(required = false)String recommender) {
74
+    public ResponseBean login(String code,@RequestParam(required = false) String from,@RequestParam(required = false)String recommender,HttpServletRequest request) {
75 75
         if (StringUtils.isBlank(code)) {
76 76
             return ResponseBean.error("参数 code 不能为空", ResponseBean.ERROR_ILLEGAL_PARAMS);
77 77
         }
78 78
         try {
79 79
             WxMaJscode2SessionResult session = miniAppService.getSessionInfo(code);
80
-
80
+            Integer orgId =getOrgId(request);
81 81
             Map<String, String> miniResp = new HashMap<>();
82 82
             miniResp.put("openid", session.getOpenid());
83 83
             miniResp.put("sessionKey", session.getSessionKey());
@@ -86,13 +86,14 @@ public class MiniAppController {
86 86
             //如果是分享进来且没有进入过小程序,给分享人发放积分
87 87
             QueryWrapper<TaPerson> personQueryWrapper = new QueryWrapper<>();
88 88
             personQueryWrapper.eq("mini_openid",session.getOpenid());
89
+            personQueryWrapper.eq("org_id",orgId);
89 90
             int count = taPersonService.count(personQueryWrapper);
90 91
 
91 92
             if(from.contains("share") && StringUtils.isNotBlank(recommender) && count>0){
92 93
                 // 添加积分
93 94
                  applicationContext.publishEvent(new EventBus(recommender, EventBus.EventType.SharePosterAll));
94 95
             }
95
-            TaPerson taPerson = taPersonService.newPersonByOpenid(session.getOpenid());
96
+            TaPerson taPerson = taPersonService.newPersonByOpenid(session.getOpenid(),orgId);
96 97
             if (null == taPerson) {
97 98
                 return ResponseBean.error("发生未知错误", ResponseBean.ERROR_UNAVAILABLE);
98 99
             }
@@ -221,14 +222,13 @@ public class MiniAppController {
221 222
 
222 223
         // 更新用户绑定手机
223 224
         String openid = JWTUtils.getSubject(request);
224
-        taPersonService.updatePersonPhone(openid, phoneNoInfo.getPhoneNumber());
225
+        Integer orgId = getOrgId(request);
226
+        taPersonService.updatePersonPhone(openid, phoneNoInfo.getPhoneNumber(),orgId);
225 227
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
226 228
         if (null == taPersons || taPersons.size() != 1) {
227 229
             return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
228 230
         }
229 231
         TaPerson person = taPersons.get(0);
230
-        person.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
231
-        taPersonService.updateById(person);
232 232
         QueryWrapper<TaRecommendCustomer> cus= new QueryWrapper<>();
233 233
         cus.eq("phone",phoneNoInfo.getPhoneNumber());
234 234
         cus.orderByDesc("create_date");
@@ -262,23 +262,6 @@ public class MiniAppController {
262 262
 //            if(list.size()<=0){
263 263
 //                taCustomerPersonService.insertBean(person.getPersonId(),customers.getCustomerId());
264 264
 //            }
265
-        } else{
266
-            TaRecommendCustomer reCustomer = new TaRecommendCustomer();
267
-            reCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
268
-            reCustomer.setName(person.getNickname());
269
-            reCustomer.setPhone(phoneNoInfo.getPhoneNumber());
270
-            reCustomer.setSex(Integer.valueOf(person.getGender()));
271
-            reCustomer.setPersonId(person.getPersonId());
272
-            reCustomer.setPicture(person.getAvatarurl());
273
-            reCustomer.setCountry(person.getCountry());
274
-            reCustomer.setCity(person.getCity());
275
-            reCustomer.setProvince(person.getProvince());
276
-            reCustomer.setEntryType(CommConstant.ENTRY_VOLUNTEER);
277
-            reCustomer.setCreateDate(LocalDateTime.now());
278
-            reCustomer.setReportRecommendStatus(CommConstant.READY);
279
-            if(!taRecommendCustomerService.save(reCustomer)){
280
-                return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
281
-            }
282 265
         }
283 266
         return ResponseBean.success(phoneNoInfo);
284 267
     }
@@ -312,4 +295,15 @@ public class MiniAppController {
312 295
             return ResponseBean.error("获取二维码参数失败: " + e.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR);
313 296
         }
314 297
     }
298
+
299
+
300
+    public Integer getOrgId(HttpServletRequest request){
301
+
302
+        Map map = JWTUtils.getUserIdAndOrgId(request);
303
+        if (null != map && null != map.get("orgId")){
304
+            return Integer.valueOf(map.get("orgId").toString());
305
+        }
306
+
307
+        return null;
308
+    }
315 309
 }

+ 6
- 3
src/main/java/com/huiju/estateagents/controller/TaPersonController.java ファイルの表示

@@ -70,6 +70,7 @@ public class TaPersonController extends BaseController {
70 70
         if (pageNumber < 0 || pageSize < 0) {
71 71
             return ResponseBean.error("分页参数不正确", ResponseBean.ERROR_ILLEGAL_PARAMS);
72 72
         }
73
+        Integer orgId = getOrgId(request);
73 74
         if (mine){
74 75
             String openid = JWTUtils.getSubject(request);
75 76
             List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
@@ -80,7 +81,7 @@ public class TaPersonController extends BaseController {
80 81
             IPage<Map<String, Object>>  result = taPersonService.getSavedConsaultants(pageNumber,pageSize,person.getPersonId());
81 82
             return ResponseBean.success(result);
82 83
         }else {
83
-            IPage<Map<String, Object>> result = taPersonService.getCardList(pageNumber, pageSize,buildingId);
84
+            IPage<Map<String, Object>> result = taPersonService.getCardList(pageNumber, pageSize,buildingId,orgId);
84 85
             return ResponseBean.success(result);
85 86
         }
86 87
 
@@ -88,7 +89,8 @@ public class TaPersonController extends BaseController {
88 89
     }
89 90
 
90 91
     @PutMapping("/wx/registerConsultant")
91
-    public ResponseBean registerConsultant(@RequestParam Integer orgId,HttpServletRequest request) {
92
+    public ResponseBean registerConsultant(HttpServletRequest request) {
93
+        Integer orgId =getOrgId(request);
92 94
         ResponseBean responseBean = new ResponseBean();
93 95
         String openid = JWTUtils.getSubject(request);
94 96
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
@@ -114,8 +116,9 @@ public class TaPersonController extends BaseController {
114 116
     }
115 117
 
116 118
     @PutMapping("/wx/registerAgent")
117
-    public ResponseBean registerAgent(@RequestParam String recommendAgentCode, @RequestParam String channelCode,@RequestParam Integer orgId,HttpServletRequest request) {
119
+    public ResponseBean registerAgent(@RequestParam String recommendAgentCode, @RequestParam String channelCode,HttpServletRequest request) {
118 120
         ResponseBean responseBean = new ResponseBean();
121
+        Integer orgId =getOrgId(request);
119 122
         String openid = JWTUtils.getSubject(request);
120 123
         List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
121 124
         if (null == taPersons || taPersons.size() != 1) {

+ 4
- 2
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java ファイルの表示

@@ -95,7 +95,8 @@ public class TaRecommendCustomerController extends BaseController {
95 95
     @PostMapping("/wx/customer/new")
96 96
     public ResponseBean recommendCust(@RequestBody String paramStr, HttpServletRequest request) {
97 97
         String openid = JWTUtils.getSubject(request);
98
-        return taRecommendCustomerService.recommendCust(paramStr, openid);
98
+        Integer orgId = getOrgId(request);
99
+        return taRecommendCustomerService.recommendCust(paramStr, openid,orgId);
99 100
     }
100 101
 
101 102
     /**
@@ -107,7 +108,8 @@ public class TaRecommendCustomerController extends BaseController {
107 108
     @PostMapping("/wx/customer/report")
108 109
     public ResponseBean reportCust(@RequestBody String paramStr, HttpServletRequest request) {
109 110
         String openid = JWTUtils.getSubject(request);
110
-        return taRecommendCustomerService.reportCust(paramStr, openid);
111
+        Integer orgId = getOrgId(request);
112
+        return taRecommendCustomerService.reportCust(paramStr, openid,orgId);
111 113
     }
112 114
 
113 115
     @PostMapping("/wx/customer/recommend")

+ 1
- 1
src/main/java/com/huiju/estateagents/entity/TaPerson.java ファイルの表示

@@ -228,7 +228,7 @@ public class TaPerson implements Serializable {
228 228
 
229 229
     private String fromCode;
230 230
 
231
-    private String orgId;
231
+    private Integer orgId;
232 232
 
233 233
     private Integer userId;
234 234
 

+ 3
- 1
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java ファイルの表示

@@ -105,7 +105,7 @@ public class TaRecommendCustomer implements Serializable {
105 105
      * 状态
106 106
      */
107 107
     @TableField(value = "`status`")
108
-    private String status;
108
+    private Integer status;
109 109
 
110 110
     /**
111 111
      * 推荐人
@@ -147,6 +147,8 @@ public class TaRecommendCustomer implements Serializable {
147 147
 
148 148
     private Integer reportRecommendStatus;
149 149
 
150
+    private Integer orgId;
151
+
150 152
     @TableField(exist = false)
151 153
     private List<TaPersonVisitRecord> visitRecords;
152 154
 

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java ファイルの表示

@@ -23,7 +23,7 @@ import java.util.Map;
23 23
  */
24 24
 @Mapper
25 25
 public interface TaPersonMapper extends BaseMapper<TaPerson> {
26
-    List<Map<String,Object>> selectCardList(IPage<Map<String,Object>> page, @Param("personType") String personType, @Param("status") int status,@Param("buildingId")String buildingId);
26
+    List<Map<String,Object>> selectCardList(IPage<Map<String,Object>> page, @Param("personType") String personType, @Param("status") int status,@Param("buildingId")String buildingId,@Param("orgId")Integer orgId);
27 27
 
28 28
     int setFieldIncrement(@Param("personId") String personId, @Param("field") String field, @Param("increment") int increment);
29 29
 

+ 3
- 3
src/main/java/com/huiju/estateagents/service/ITaPersonService.java ファイルの表示

@@ -22,9 +22,9 @@ import java.util.Map;
22 22
 public interface ITaPersonService extends IService<TaPerson> {
23 23
     TaPerson mergePersonWxInfo(WxMaUserInfo userInfo);
24 24
 
25
-    TaPerson updatePersonPhone(String miniOpenid, String phone);
25
+    TaPerson updatePersonPhone(String miniOpenid, String phone,Integer orgId);
26 26
 
27
-    IPage<Map<String, Object>> getCardList(int pageNumber, int pageSize,String buildingId);
27
+    IPage<Map<String, Object>> getCardList(int pageNumber, int pageSize,String buildingId,Integer orgId);
28 28
 
29 29
     ResponseBean checkPhoneAndPass(String phone, String pass);
30 30
 
@@ -42,7 +42,7 @@ public interface ITaPersonService extends IService<TaPerson> {
42 42
 
43 43
     IPage<TaPerson> getPersonList(int pageNumber, int pageSize, String personType, String name, String phone,Integer status,String buildingId,String personTags);
44 44
 
45
-    TaPerson newPersonByOpenid(String openid);
45
+    TaPerson newPersonByOpenid(String openid,Integer orgId);
46 46
 
47 47
     ResponseBean bindCard(String phone, String pass, String openid);
48 48
 

+ 2
- 2
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java ファイルの表示

@@ -22,9 +22,9 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
22 22
 
23 23
     ResponseBean updateCustByJSON(String paramStr);
24 24
 
25
-    ResponseBean recommendCust(String paramStr, String openid);
25
+    ResponseBean recommendCust(String paramStr, String openid,Integer orgId);
26 26
 
27
-    ResponseBean reportCust(String paramStr, String openid);
27
+    ResponseBean reportCust(String paramStr, String openid,Integer orgId);
28 28
 
29 29
     IPage<TaRecommendCustomer> getUnSignedCustomerList(int pageNumber, int pageSize, String building,String personId);
30 30
 

+ 9
- 7
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java ファイルの表示

@@ -123,7 +123,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
123 123
     }
124 124
 
125 125
     @Override
126
-    public TaPerson updatePersonPhone(String miniOpenid, String phone) {
126
+    public TaPerson updatePersonPhone(String miniOpenid, String phone,Integer orgId) {
127 127
         // 先查询是否存在用户
128 128
         TaPerson person = null;
129 129
         List<TaPerson> taPersons = getPersonsByOpenId(miniOpenid);
@@ -145,9 +145,9 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
145 145
 
146 146
         UpdateWrapper<TaPerson> wrapper = new UpdateWrapper<>();
147 147
         wrapper.set("phone", phone);
148
-        wrapper.set("person_type",CommConstant.PERSON_ESTATE_AGENT);
148
+        wrapper.set("person_type",CommConstant.PERSON_ESTATE_CUSTOMER);
149 149
         wrapper.eq("mini_openid", miniOpenid);
150
-        wrapper.isNull("person_type");
150
+        wrapper.eq("person_type",CommConstant.PERSON_ESTATE_DRIFT);
151 151
         taPersonMapper.update(new TaPerson(), wrapper);
152 152
 
153 153
         person.setPhone(phone);
@@ -155,7 +155,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
155 155
             person.setTel(phone);
156 156
         }
157 157
 
158
-        iTaRecommendCustomerService.newByPerson(person);
158
+       // iTaRecommendCustomerService.newByPerson(person);
159 159
         
160 160
         // 发放积分
161 161
         applicationContext.publishEvent(new EventBus(person, EventBus.EventType.SignUpAgent));
@@ -164,13 +164,13 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
164 164
     }
165 165
 
166 166
     @Override
167
-    public IPage<Map<String, Object>> getCardList(int pageNumber, int pageSize,String buildingId) {
167
+    public IPage<Map<String, Object>> getCardList(int pageNumber, int pageSize,String buildingId,Integer orgId) {
168 168
         Page<Map<String, Object>> page = new Page<>();
169 169
         page.setSize(pageSize);
170 170
         page.setPages(pageNumber);
171 171
         page.setCurrent(pageNumber);
172 172
 
173
-        List<Map<String, Object>> result = taPersonMapper.selectCardList(page, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.STATUS_NORMAL,buildingId);
173
+        List<Map<String, Object>> result = taPersonMapper.selectCardList(page, CommConstant.PERSON_REALTY_CONSULTANT, CommConstant.STATUS_NORMAL,buildingId,orgId);
174 174
         page.setRecords(result);
175 175
 
176 176
         return page;
@@ -398,13 +398,15 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
398 398
     }
399 399
 
400 400
     @Override
401
-    public TaPerson newPersonByOpenid(String openid) {
401
+    public TaPerson newPersonByOpenid(String openid,Integer orgId) {
402 402
         List<TaPerson> taPersons = getPersonsByOpenId(openid);
403 403
         if (null == taPersons || taPersons.size() != 1) {
404 404
             TaPerson taPerson = new TaPerson();
405 405
             taPerson.setMiniOpenid(openid);
406 406
             taPerson.setNickname("匿名用户");
407
+            taPerson.setOrgId(orgId);
407 408
             taPerson.setAvatarurl(CommConstant.MINIAPP_DEFAULT_AVATAR);
409
+            taPerson.setPersonType(CommConstant.PERSON_ESTATE_DRIFT);
408 410
             taPerson.setStatus(CommConstant.STATUS_NORMAL);
409 411
             taPerson.setCreateDate(LocalDateTime.now());
410 412
             if (taPersonMapper.insert(taPerson) > 0) {

+ 10
- 8
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java ファイルの表示

@@ -140,7 +140,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
140 140
     }
141 141
 
142 142
     @Override
143
-    public ResponseBean recommendCust(String paramStr, String openid) {
143
+    public ResponseBean recommendCust(String paramStr, String openid,Integer orgId) {
144 144
         JSONObject params = JSONObject.parseObject(paramStr);
145 145
         if (null == params) {
146 146
             return ResponseBean.error("解析参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);
@@ -159,6 +159,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
159 159
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
160 160
 
161 161
         taRecommendCustomer.setName(params.getString("name"));
162
+        taRecommendCustomer.setOrgId(orgId);
162 163
         taRecommendCustomer.setPicture(params.getString("picture"));
163 164
         taRecommendCustomer.setPhone(params.getString("phone"));
164 165
         taRecommendCustomer.setSex(params.getInteger("sex"));
@@ -186,8 +187,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
186 187
 
187 188
 
188 189
         String status = params.getString("status");
189
-        if (null == status) status = "1";
190
-        taRecommendCustomer.setStatus(status);
190
+        int statusInt = 0;
191
+        if (null == status) statusInt = Integer.parseInt(status);
192
+        taRecommendCustomer.setStatus(statusInt);
191 193
         taRecommendCustomer.setRecommendPerson(taPerson.getPersonId());
192 194
 
193 195
         // 报备有 10 天有效期
@@ -218,7 +220,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
218 220
 
219 221
 
220 222
     @Override
221
-    public ResponseBean reportCust(String paramStr, String openid) {
223
+    public ResponseBean reportCust(String paramStr, String openid,Integer orgId) {
222 224
         JSONObject params = JSONObject.parseObject(paramStr);
223 225
         if (null == params) {
224 226
             return ResponseBean.error("解析参数失败", ResponseBean.ERROR_ILLEGAL_PARAMS);
@@ -235,7 +237,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
235 237
 //        }
236 238
 
237 239
         TaRecommendCustomer taRecommendCustomer = new TaRecommendCustomer();
238
-
240
+        taRecommendCustomer.setOrgId(orgId);
239 241
         taRecommendCustomer.setName(taPerson.getNickname());
240 242
         taRecommendCustomer.setPicture(taPerson.getAvatarurl());
241 243
         taRecommendCustomer.setPhone(params.getString("phone"));
@@ -243,7 +245,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
243 245
 //        taRecommendCustomer.setDescribe(params.getString("describe"));
244 246
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
245 247
         taRecommendCustomer.setBuildingId(params.getString("buildingId"));
246
-        taRecommendCustomer.setReportRecommendStatus(CommConstant.REPORTED);
248
+        taRecommendCustomer.setReportRecommendStatus(CommConstant.READY);
247 249
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
248 250
         taRecommendCustomer.setReportDate(LocalDateTime.now());
249 251
 
@@ -260,8 +262,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
260 262
 //        taRecommendCustomer.setDemandType(params.getString("demandType"));
261 263
 //        taRecommendCustomer.setPriceRange(params.getString("priceRange"));
262 264
         taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
263
-        taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
264
-        taRecommendCustomer.setStatus(CommConstant.STATUS_NORMAL + "");
265
+        taRecommendCustomer.setVerifyStatus(CommConstant.READY);
266
+        taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
265 267
 
266 268
 
267 269
 //        String status = params.getString("status");

+ 1
- 0
src/main/resources/mapper/TaPersonMapper.xml ファイルの表示

@@ -17,6 +17,7 @@
17 17
         WHERE
18 18
             t.person_type = #{personType}
19 19
         AND t.status = #{status}
20
+        and t.org_id = #{orgId}
20 21
         <if test="buildingId != null and buildingId != ''">
21 22
             and p.building_id = #{buildingId}
22 23
         </if>