张延森 5 年之前
父節點
當前提交
2ca391ee5b
共有 83 個檔案被更改,包括 1400 行新增319 行删除
  1. 9
    4
      pom.xml
  2. 9
    2
      src/main/java/com/huiju/estateagents/activity/controller/ActivityController.java
  3. 2
    0
      src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java
  4. 7
    1
      src/main/java/com/huiju/estateagents/center/taUser/entity/TaUser.java
  5. 2
    0
      src/main/java/com/huiju/estateagents/center/taUser/mapper/TaUserMapper.java
  6. 46
    19
      src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java
  7. 11
    1
      src/main/java/com/huiju/estateagents/common/CommConstant.java
  8. 9
    9
      src/main/java/com/huiju/estateagents/controller/HelpActivityController.java
  9. 4
    3
      src/main/java/com/huiju/estateagents/controller/MiniAppController.java
  10. 27
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingController.java
  11. 13
    5
      src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java
  12. 143
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingMapRelationController.java
  13. 11
    0
      src/main/java/com/huiju/estateagents/controller/TaBuildingProjectTypeController.java
  14. 2
    1
      src/main/java/com/huiju/estateagents/controller/TaGoodsController.java
  15. 7
    5
      src/main/java/com/huiju/estateagents/controller/TaNewsController.java
  16. 7
    3
      src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java
  17. 15
    2
      src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java
  18. 26
    0
      src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java
  19. 50
    4
      src/main/java/com/huiju/estateagents/controller/TdCityController.java
  20. 1
    0
      src/main/java/com/huiju/estateagents/entity/TaBuilding.java
  21. 5
    0
      src/main/java/com/huiju/estateagents/entity/TaBuildingDynamic.java
  22. 51
    0
      src/main/java/com/huiju/estateagents/entity/TaBuildingMapRelation.java
  23. 14
    1
      src/main/java/com/huiju/estateagents/entity/TaOrgCity.java
  24. 6
    0
      src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java
  25. 3
    0
      src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java
  26. 3
    3
      src/main/java/com/huiju/estateagents/excel/AgentsRecommendCustomer.java
  27. 8
    15
      src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java
  28. 18
    0
      src/main/java/com/huiju/estateagents/mapper/TaBuildingMapRelationMapper.java
  29. 1
    1
      src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java
  30. 13
    0
      src/main/java/com/huiju/estateagents/mapper/TaOrgCityMapper.java
  31. 2
    0
      src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java
  32. 6
    0
      src/main/java/com/huiju/estateagents/mapper/TdCityMapper.java
  33. 7
    0
      src/main/java/com/huiju/estateagents/service/IExtendContentService.java
  34. 1
    1
      src/main/java/com/huiju/estateagents/service/IHelpActivityService.java
  35. 16
    0
      src/main/java/com/huiju/estateagents/service/ITaBuildingMapRelationService.java
  36. 1
    1
      src/main/java/com/huiju/estateagents/service/ITaBuildingService.java
  37. 9
    0
      src/main/java/com/huiju/estateagents/service/ITdCityService.java
  38. 13
    0
      src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java
  39. 3
    2
      src/main/java/com/huiju/estateagents/service/impl/HelpActivityServiceImpl.java
  40. 5
    1
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java
  41. 20
    0
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingMapRelationServiceImpl.java
  42. 104
    17
      src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java
  43. 2
    2
      src/main/java/com/huiju/estateagents/service/impl/TaGoodsServiceImpl.java
  44. 10
    2
      src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java
  45. 55
    0
      src/main/java/com/huiju/estateagents/service/impl/TaPersonVisitRecordServiceImpl.java
  46. 46
    9
      src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java
  47. 3
    0
      src/main/java/com/huiju/estateagents/service/impl/TaUvServiceImpl.java
  48. 41
    0
      src/main/java/com/huiju/estateagents/service/impl/TdCityServiceImpl.java
  49. 8
    4
      src/main/java/com/huiju/estateagents/statistic/controller/TaCustomerFollowUpRecordController.java
  50. 25
    13
      src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerGenderStatisticController.java
  51. 22
    12
      src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticDailyController.java
  52. 23
    13
      src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticMonthlyController.java
  53. 2
    0
      src/main/java/com/huiju/estateagents/statistic/entity/GenderStatistic.java
  54. 6
    1
      src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerGenderStatistic.java
  55. 12
    4
      src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticDaily.java
  56. 7
    4
      src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticMonthly.java
  57. 6
    4
      src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerGenderStatisticMapper.java
  58. 8
    7
      src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticDailyMapper.java
  59. 8
    6
      src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticMonthlyMapper.java
  60. 2
    2
      src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerGenderStatisticService.java
  61. 5
    3
      src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticDailyService.java
  62. 5
    3
      src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticMonthlyService.java
  63. 14
    11
      src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerGenderStatisticServiceImpl.java
  64. 42
    15
      src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java
  65. 38
    18
      src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticMonthlyServiceImpl.java
  66. 56
    1
      src/main/resources/application-gzysd.yml
  67. 15
    15
      src/main/resources/application-test.yml
  68. 39
    7
      src/main/resources/mapper/Activity.xml
  69. 2
    2
      src/main/resources/mapper/HelpActivityMapper.xml
  70. 12
    8
      src/main/resources/mapper/TaActivityDynamicEnlistMapper.xml
  71. 1
    1
      src/main/resources/mapper/TaBuildingImgMapper.xml
  72. 5
    0
      src/main/resources/mapper/TaBuildingMapRelationMapper.xml
  73. 4
    1
      src/main/resources/mapper/TaBuildingMapper.xml
  74. 1
    1
      src/main/resources/mapper/TaMiniFormidsMapper.xml
  75. 22
    0
      src/main/resources/mapper/TaOrgCity.xml
  76. 1
    0
      src/main/resources/mapper/TaPersonMapper.xml
  77. 20
    10
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  78. 11
    0
      src/main/resources/mapper/TaUserMapper.xml
  79. 28
    1
      src/main/resources/mapper/TdCityMapper.xml
  80. 9
    6
      src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml
  81. 22
    16
      src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml
  82. 22
    16
      src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml
  83. 30
    0
      src/test/java/com/huiju/estateagents/TdCityServiceImplTest.java

+ 9
- 4
pom.xml 查看文件

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.huiju</groupId>
12 12
 	<artifactId>estateagents</artifactId>
13
-	<version>v3.5.1</version>
13
+	<version>v3.5.1.0</version>
14 14
 	<name>estateages</name>
15 15
 	<description>置业经纪人</description>
16 16
 
@@ -128,7 +128,6 @@
128 128
 			<artifactId>springfox-swagger-ui</artifactId>
129 129
 			<version>2.7.0</version>
130 130
 		</dependency>
131
-
132 131
 	</dependencies>
133 132
 
134 133
 	<profiles>
@@ -171,6 +170,12 @@
171 170
 				<profiles.active>nj</profiles.active>
172 171
 			</properties>
173 172
 		</profile>
173
+		<profile>
174
+			<id>hj</id>
175
+			<properties>
176
+				<profiles.active>hj</profiles.active>
177
+			</properties>
178
+		</profile>
174 179
 		<profile>
175 180
 			<id>gzysd</id>
176 181
 			<properties>
@@ -178,9 +183,9 @@
178 183
 			</properties>
179 184
 		</profile>
180 185
 		<profile>
181
-			<id>v3</id>
186
+			<id>jj</id>
182 187
 			<properties>
183
-				<profiles.active>v3</profiles.active>
188
+				<profiles.active>jj</profiles.active>
184 189
 			</properties>
185 190
 		</profile>
186 191
 	</profiles>

+ 9
- 2
src/main/java/com/huiju/estateagents/activity/controller/ActivityController.java 查看文件

@@ -1,6 +1,7 @@
1 1
 package com.huiju.estateagents.activity.controller;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
4 5
 import com.huiju.estateagents.activity.service.ActivityServiceI;
5 6
 import com.huiju.estateagents.base.BaseController;
6 7
 import com.huiju.estateagents.base.ResponseBean;
@@ -66,15 +67,21 @@ public class ActivityController extends BaseController {
66 67
 		queryWrapper.eq("customer_id",customerId);
67 68
 		TaRecommendCustomer taRecommendCustomer = taRecommendCustomerService.getOne(queryWrapper);
68 69
 		if (null == taRecommendCustomer){
69
-			return ResponseBean.error("验证人员信息失败",ResponseBean.ERROR_UNAVAILABLE);
70
+			//验证人员信息失败小程序端希望是空数组对象
71
+			return ResponseBean.success(new Page(pageNumber,pageSize));
70 72
 		}
71 73
 		if (null == taRecommendCustomer.getPersonId()){
72
-			return ResponseBean.error("验证人员信息失败",ResponseBean.ERROR_UNAVAILABLE);
74
+			//验证人员信息失败小程序端希望是空数组对象
75
+			return ResponseBean.success(new Page(pageNumber,pageSize));
73 76
 		}
74 77
 		
75 78
 		QueryWrapper<TaPerson> taPersonQueryWrapper = new QueryWrapper<>();
76 79
 		taPersonQueryWrapper.eq("person_id",taRecommendCustomer.getPersonId());
77 80
 		TaPerson person = taPersonService.getOne(taPersonQueryWrapper);
81
+		if (null == person){
82
+			//验证人员信息失败小程序端希望是空数组对象
83
+			return ResponseBean.success(new Page(pageNumber,pageSize));
84
+		}
78 85
 		responseBean = activityService.getCustomerActivityList(pageNumber,pageSize,orgId,person);
79 86
 		return responseBean;
80 87
 	}

+ 2
- 0
src/main/java/com/huiju/estateagents/center/taUser/controller/TaUserController.java 查看文件

@@ -372,6 +372,8 @@ public class TaUserController extends BaseController {
372 372
             taUserQueryWrapper.eq(null != status,"status",status);
373 373
             if(null != isConsultant && isConsultant == 1){
374 374
                 taUserQueryWrapper.eq("is_consultant",true);
375
+            }else if (null != isConsultant && isConsultant == 0){
376
+                taUserQueryWrapper.eq("is_consultant",false);
375 377
             }
376 378
             taUserQueryWrapper.ne("IFNULL(is_admin,0)",CommConstant.STATUS_NORMAL);
377 379
             IPage<TaUser> result = iTaUserService.page(pg,taUserQueryWrapper);

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

@@ -177,11 +177,17 @@ public class TaUser implements Serializable {
177 177
      * 前台传值城市
178 178
      */
179 179
     @TableField(exist = false)
180
-    private ArrayList<Integer> selectCityTree;
180
+    private ArrayList<String> selectCityTree;
181 181
 
182 182
     /**
183 183
      * 城市ID
184 184
      */
185 185
     @TableField(exist = false)
186 186
     private Integer cityId;
187
+
188
+    /**
189
+     * 默认城市
190
+     */
191
+    @TableField(exist = false)
192
+    private Integer defaultCityId;
187 193
 }

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

@@ -24,4 +24,6 @@ public interface TaUserMapper extends BaseMapper<TaUser> {
24 24
 	List<Map<String,Object>> getPageList(IPage<TaUser> pg);
25 25
 	
26 26
 	List<TaTags> getTagsList(@Param("userId") Integer userId,@Param("orgId") Integer orgId);
27
+	
28
+	List<TaUser> getUserList(@Param("phone") String phone,@Param("loginName") String loginName,@Param("orgId") Integer orgId);
27 29
 }

+ 46
- 19
src/main/java/com/huiju/estateagents/center/taUser/service/impl/TaUserServiceImpl.java 查看文件

@@ -100,6 +100,9 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
100 100
 			taUser.setLoginName(taUser.getPhone());
101 101
 		}
102 102
 
103
+		//判断默认城市是否在维护城市内
104
+		verificationCity(taUser.getSelectCityTree(),taUser.getDefaultCityId());
105
+
103 106
 		QueryWrapper<TaUser> wrapper = new QueryWrapper<>();
104 107
 		wrapper.eq("phone", taUser.getPhone()).or().eq("login_Name", taUser.getLoginName());
105 108
 		List<TaUser> taUserList = this.list(wrapper);
@@ -113,7 +116,7 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
113 116
 		taOrg.setWaterMark(taUser.getWaterMark());
114 117
 		taOrg.setCreateDate(LocalDateTime.now());
115 118
 		taOrg.setBuildingNum(taUser.getOrgNum());
116
-		taOrg.setDefaultCityId(taUser.getCityId());
119
+		taOrg.setDefaultCityId(taUser.getDefaultCityId());
117 120
 		if (taOrgMapper.insert(taOrg) < 1) {
118 121
 			throw new Exception("生成用户公司信息失败");
119 122
 		}
@@ -164,31 +167,52 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
164 167
 	}
165 168
 
166 169
 	// 维护公司所在城市
167
-	public void addAndupdate(ArrayList<Integer> selectCityTree,boolean isA,Integer orgid){
168
-
170
+	public void addAndupdate(ArrayList<String> selectCityTree,boolean isA,Integer orgid){
171
+			// 查询当前所有的市
169 172
 			QueryWrapper<TdCity> tdCityQuery= new QueryWrapper<>();
170
-			tdCityQuery.eq("leveltype",1);
171
-			 List<TdCity> tdCityList= tdCityMapper.selectList(tdCityQuery);
173
+			tdCityQuery.eq("leveltype",2);
174
+			List<TdCity> tdCityList= tdCityMapper.selectList(tdCityQuery);
172 175
 
173 176
 		// isA=true删除所有城市重新添加
174 177
 		if (isA == true){
175
-			for(Integer city:selectCityTree) {
176
-				taOrgCityMapper.deleteById(city);
177
-			}
178
+			QueryWrapper<TaOrgCity> taOrgCity= new  QueryWrapper<>();
179
+			taOrgCity.eq("org_id",orgid);
180
+			taOrgCityMapper.delete(taOrgCity);
178 181
 		}
182
+		TaOrgCity  taOrgCity = new TaOrgCity();
179 183
 			 // 对比现在的城市ID
180
-			 for(Integer city:selectCityTree){
184
+			 for(String city:selectCityTree){
181 185
 				for (TdCity tdCity : tdCityList){
182
-					if (city.equals(tdCity.getId())){
183
-						TaOrgCity  taOrgCity = new TaOrgCity();
184
-						taOrgCity.setId(city).setName(tdCity.getName()).setOrgId(orgid).setStatus(1).setParentid(tdCity.getParentid());
186
+						// 入库城市
187
+					if (city.equals(String.valueOf(tdCity.getId()))){
188
+						taOrgCity.setCityId(Integer.valueOf(city)).setName(tdCity.getName()).setOrgId(orgid).setStatus(1).setParentid(tdCity.getParentid());
189
+						taOrgCityMapper.insert(taOrgCity);
190
+						// 查询当前公司选择省份是否存在
191
+                       QueryWrapper<TaOrgCity> taOrgCityParent = new QueryWrapper<>();
192
+                        taOrgCityParent.eq("city_id",tdCity.getParentid());
193
+                        taOrgCityParent.eq("org_id",orgid);
194
+						TaOrgCity taOrgParent = taOrgCityMapper.selectOne(taOrgCityParent);
195
+						// 如果为空,查询行政表
196
+						if (null == taOrgParent){
197
+							TdCity  tdCityParent = tdCityMapper.selectById(tdCity.getParentid());
198
+							taOrgCity.setCityId(tdCityParent.getId()).setName(tdCityParent.getName()).setOrgId(orgid).setStatus(1).setParentid(100000);
199
+							taOrgCityMapper.insert(taOrgCity);
200
+						}
185 201
 					}
186 202
 
187 203
 				}
188 204
 			 }
189 205
 
190 206
 	}
191
-
207
+	// 判断当前城市是否存在
208
+	public void  verificationCity(ArrayList<String> selectCityTree,Integer city)throws Exception{
209
+		for (String id: selectCityTree) {
210
+			if (id.equals(String.valueOf(city))) {
211
+				return;
212
+				}
213
+			}
214
+		throw new Exception("当前默认城市不在维护城市内");
215
+	}
192 216
 	@Override
193 217
 	public TaUser getInfoWithOrg(Integer id) {
194 218
 		TaUser taUser = this.getById(id);
@@ -201,7 +225,7 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
201 225
 			taUser.setOrgName(taOrg.getName());
202 226
 			taUser.setWaterMark(taOrg.getWaterMark());
203 227
 			taUser.setOrgNum(taOrg.getBuildingNum());
204
-			taOrg.setDefaultCityId(taUser.getCityId());
228
+			taUser.setDefaultCityId(taOrg.getDefaultCityId());
205 229
 		}
206 230
 
207 231
 		QueryWrapper<TaMiniapp> wrapper = new QueryWrapper<>();
@@ -216,17 +240,23 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
216 240
 
217 241
 		taUser.setMiniapp(taMiniapp);
218 242
 		taUser.setLoginPassword(null);
243
+		// 查询所有城市id
244
+		ArrayList<String> taOrgCityList= taOrgCityMapper.selectByIdCity(taUser.getOrgId());
245
+		taUser.setSelectCityTree(taOrgCityList);
219 246
 		return taUser;
220 247
 	}
221 248
 
222 249
 	@Override
223 250
 	public void updateInfoWithOrg(TaUser taUser) throws Exception {
251
+		//判断默认城市是否在维护城市内
252
+		verificationCity(taUser.getSelectCityTree(),taUser.getDefaultCityId());
253
+
224 254
 		TaOrg taOrg = taOrgMapper.selectById(taUser.getOrgId());
225 255
 		if (null != taOrg) {
226 256
 			taOrg.setName(taUser.getOrgName());
227 257
 			taOrg.setWaterMark(taUser.getWaterMark());
228 258
 			taOrg.setBuildingNum(taUser.getOrgNum());
229
-
259
+			taOrg.setDefaultCityId(taUser.getDefaultCityId());
230 260
 			if (taOrgMapper.updateById(taOrg) < 1) {
231 261
 				throw new Exception("更新用户公司信息失败");
232 262
 			}
@@ -292,10 +322,7 @@ public class TaUserServiceImpl extends ServiceImpl<TaUserMapper, TaUser> impleme
292 322
 			taUser.setLoginName(taUser.getPhone());
293 323
 		}
294 324
 		
295
-		QueryWrapper<TaUser> wrapper = new QueryWrapper<>();
296
-		wrapper.eq("phone", taUser.getPhone()).or().eq("login_Name", taUser.getLoginName());
297
-		wrapper.eq("org_id",taUser.getOrgId());
298
-		List<TaUser> taUserList = this.list(wrapper);
325
+		List<TaUser> taUserList = taUserMapper.getUserList(taUser.getPhone(),taUser.getLoginName(),taUser.getOrgId());
299 326
 		if (null != taUserList && taUserList.size() > 0) {
300 327
 			throw new Exception("电话号码或登录名重复");
301 328
 		}

+ 11
- 1
src/main/java/com/huiju/estateagents/common/CommConstant.java 查看文件

@@ -482,7 +482,7 @@ public class CommConstant {
482 482
     public static final String BUILDING_IMG_BANNER = "banner";
483 483
 
484 484
     /**
485
-     * 项目列表图
485
+     * 项目列表图(现在是用于楼盘封面图)
486 486
      */
487 487
     public static final String BUILDING_IMG_LIST = "list";
488 488
 
@@ -495,4 +495,14 @@ public class CommConstant {
495 495
      * 户型图
496 496
      */
497 497
     public static final String BUILDING_IMG_APARMENT = "aparment";
498
+    
499
+    /**
500
+     * 高德地图url
501
+     */
502
+	public static final String AMAP_HTTP = "https://restapi.amap.com/v3/geocode/regeo";
503
+    
504
+    /**
505
+     * 高德地图key
506
+     */
507
+    public static final String AMAP_KEY = "14f05ce59c26364fd0674014dc0d8b1b";
498 508
 }

+ 9
- 9
src/main/java/com/huiju/estateagents/controller/HelpActivityController.java 查看文件

@@ -17,14 +17,7 @@ import com.huiju.estateagents.excel.HelpRecordExport;
17 17
 import com.huiju.estateagents.excel.PublicCustomerExport;
18 18
 import com.huiju.estateagents.excel.handler.CustomCellWriteHandler;
19 19
 import com.huiju.estateagents.mapper.HelpInitiateRecordMapper;
20
-import com.huiju.estateagents.service.IHelpActivityService;
21
-import com.huiju.estateagents.service.IHelpInitiateRecordService;
22
-import com.huiju.estateagents.service.IHelpRecordService;
23
-import com.huiju.estateagents.service.ITaBuildingService;
24
-import com.huiju.estateagents.service.ITaPersonService;
25
-import com.huiju.estateagents.service.ITdPosterTemplateService;
26
-import com.huiju.estateagents.service.TaPosterService;
27
-import com.huiju.estateagents.service.TaShareContentService;
20
+import com.huiju.estateagents.service.*;
28 21
 import io.swagger.annotations.Api;
29 22
 import io.swagger.annotations.ApiOperation;
30 23
 import io.swagger.annotations.ApiImplicitParam;
@@ -84,6 +77,9 @@ public class HelpActivityController extends BaseController {
84 77
     
85 78
     @Autowired
86 79
     private ITdPosterTemplateService tdPosterTemplateService;
80
+
81
+    @Autowired
82
+    private IExtendContentService iExtendContentService;
87 83
     /**
88 84
      * 活动助力列表
89 85
      *
@@ -164,7 +160,8 @@ public class HelpActivityController extends BaseController {
164 160
         helpActivity.setStatus(1);
165 161
         helpActivity.setWeight(0);
166 162
         helpActivity.setIsMain(false);
167
-        taHelpActivityService.helpActivityAdd(helpActivity, orgId);
163
+         int id = taHelpActivityService.helpActivityAdd(helpActivity, orgId);
164
+        responseBean.addSuccess(id);
168 165
         return responseBean;
169 166
     }
170 167
 
@@ -202,6 +199,7 @@ public class HelpActivityController extends BaseController {
202 199
         HelpActivity helpActivity = JSONObject.parseObject(parameter, HelpActivity.class);
203 200
         QueryWrapper<HelpActivity> helpActivityQueryWrapper = new QueryWrapper<>();
204 201
         helpActivityQueryWrapper.eq("heavy", helpActivity.getHeavy());
202
+        helpActivityQueryWrapper.ne("help_activity_id", helpActivity.getHelpActivityId());
205 203
         Integer heavyCount = taHelpActivityService.count(helpActivityQueryWrapper);
206 204
         if (heavyCount != 0){
207 205
             responseBean.addError("权重已存在,请重新编辑");
@@ -291,6 +289,8 @@ public class HelpActivityController extends BaseController {
291 289
         helpActivity.setStatus(-1);
292 290
         helpActivity.setOrgId(getOrgId(request));
293 291
         taHelpActivityService.update(helpActivity, taShareActivityQueryWrapper);
292
+        // 设置为取消发布以后把轮播图和资讯设置为停用
293
+        iExtendContentService.updateActivity(helpActivityId,"help",getOrgId(request));
294 294
         return responseBean;
295 295
     }
296 296
 

+ 4
- 3
src/main/java/com/huiju/estateagents/controller/MiniAppController.java 查看文件

@@ -154,7 +154,7 @@ public class MiniAppController extends BaseController {
154 154
                 TaSharePersonFrom taSharePersonFrom = new TaSharePersonFrom();
155 155
                 TaPerson recommenderPerson = taPersonService.getById(recommender);
156 156
                 taSharePersonFrom.setCreateDate(LocalDateTime.now());
157
-                taSharePersonFrom.setOrgId(getOrgId(request));
157
+                taSharePersonFrom.setOrgId(orgId);
158 158
                 taSharePersonFrom.setPersonId(taPerson.getPersonId());
159 159
                 taSharePersonFrom.setSharePersonType(recommenderPerson.getPersonType());
160 160
                 taSharePersonFrom.setTargetId(targetId);
@@ -204,12 +204,13 @@ public class MiniAppController extends BaseController {
204 204
 
205 205
             // 获取其余信息
206 206
             Map<String, Object> extraInfo = taPersonService.getExtraInfo(taPerson.getPersonId());
207
-            if (CommConstant.PERSON_REALTY_CONSULTANT.equals(taPerson.getPersonType())){
207
+            // 所有人员都返回 org yansen 2019-11-13 19:56:18
208
+//            if (CommConstant.PERSON_REALTY_CONSULTANT.equals(taPerson.getPersonType())){
208 209
                 QueryWrapper<TaOrg>orgQueryWrapper = new QueryWrapper<>();
209 210
                 orgQueryWrapper.eq("org_id",taPerson.getOrgId());
210 211
                 TaOrg org = taOrgService.getOne(orgQueryWrapper);
211 212
                 taPerson.setOrg(org);
212
-            }
213
+//            }
213 214
             Map<String, Object> result = new HashMap<>();
214 215
             result.put("miniApp", miniResp);
215 216
             result.put("person", taPerson);

+ 27
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingController.java 查看文件

@@ -1,12 +1,16 @@
1 1
 package com.huiju.estateagents.controller;
2 2
 
3 3
 
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 5
 import com.huiju.estateagents.base.ResponseBean;
5 6
 import com.huiju.estateagents.common.CommConstant;
6 7
 import com.huiju.estateagents.common.JWTUtils;
7 8
 import com.huiju.estateagents.common.StringUtils;
8 9
 import com.huiju.estateagents.entity.TaBuilding;
10
+import com.huiju.estateagents.entity.TaOrg;
9 11
 import com.huiju.estateagents.entity.TaPerson;
12
+import com.huiju.estateagents.mapper.TaBuildingMapper;
13
+import com.huiju.estateagents.mapper.TaOrgMapper;
10 14
 import com.huiju.estateagents.service.ITaBuildingService;
11 15
 import com.huiju.estateagents.service.ITaPersonService;
12 16
 import com.huiju.estateagents.service.ITaSaveService;
@@ -51,6 +55,12 @@ public class TaBuildingController extends BaseController {
51 55
     @Autowired
52 56
     ITaPersonService iTaPersonService;
53 57
 
58
+    @Autowired
59
+    TaBuildingMapper taBuildingMapper;
60
+
61
+    @Autowired
62
+    TaOrgMapper taOrgMapper;
63
+
54 64
 
55 65
     /**
56 66
      * 楼盘详情
@@ -350,5 +360,22 @@ public class TaBuildingController extends BaseController {
350 360
         ResponseBean taBuilding= taBuildingService.buildingAll(getOrgId(request));
351 361
         return taBuilding;
352 362
     }
363
+
364
+    /**
365
+     * 校验楼盘是否可以添加
366
+     */
367
+    @RequestMapping(value = "/admin/verifyMax", method = RequestMethod.GET)
368
+    public ResponseBean verifyMax(HttpServletRequest request) {
369
+        // 根据orgId查询当前楼盘最大数
370
+        TaOrg taOrg = taOrgMapper.selectById(getOrgId(request));
371
+        QueryWrapper<TaBuilding> taBuildingQuery = new QueryWrapper<>();
372
+        taBuildingQuery.eq("org_id", getOrgId(request));
373
+        taBuildingQuery.gt("status", -1);
374
+        int orgNum = taBuildingMapper.selectCount(taBuildingQuery);
375
+        if (orgNum >= taOrg.getBuildingNum()) {
376
+            return ResponseBean.error("当前系统仅供维护" + taOrg.getBuildingNum() + "个项目,需要维护更多项目,请联系相关管理人员", ResponseBean.ERROR_UNAVAILABLE);
377
+        }
378
+        return ResponseBean.success("成功");
379
+    }
353 380
 }
354 381
 

+ 13
- 5
src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java 查看文件

@@ -99,6 +99,9 @@ public class TaBuildingDynamicController extends BaseController {
99 99
     @Autowired
100 100
     private ITaPointsRecordsService taPointsRecordsService;
101 101
 
102
+    @Autowired
103
+    private IExtendContentService iExtendContentService;
104
+
102 105
     @InitBinder
103 106
     protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
104 107
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@@ -310,14 +313,17 @@ public class TaBuildingDynamicController extends BaseController {
310 313
                Integer tempIsCheckin = enlist.getIsCheckin();
311 314
                enlist.setIsCheckin(CommConstant.STATUS_NORMAL);
312 315
                if(taActivityDynamicEnlistMapper.updateById(enlist)>0){
313
-                   if (tempIsCheckin.intValue() == CommConstant.STATUS_UNACCALIMED.intValue()){
316
+                   System.out.println("验证1");
317
+                   if (tempIsCheckin.equals(CommConstant.STATUS_UNACCALIMED)){
318
+                       System.out.println("验证2");
314 319
                        enlist.setEnlistId(Integer.valueOf(enlistId));
315 320
                        applicationContext.publishEvent(new EventBus(enlist,ActivityCheckin,getOrgId(request)));
316 321
                        QueryWrapper<TaRecommendCustomer> customerQueryWrapper = new QueryWrapper<>();
317 322
                        customerQueryWrapper.eq("person_id",enlist.getPersonId());
318 323
                        customerQueryWrapper.eq("building_id",enlist.getBuildingId());
319 324
                        TaRecommendCustomer recommendCustomer = recommendCustomerService.getOne(customerQueryWrapper);
320
-                       if (recommendCustomer.getStatus() < CommConstant.CUSTOMER_VISITE){
325
+                       if (null != recommendCustomer&&recommendCustomer.getStatus().equals(CommConstant.CUSTOMER_REPORT)){
326
+                           System.out.println("验证3");
321 327
                            recommendCustomer.setStatus(CommConstant.CUSTOMER_VISITE);
322 328
                            recommendCustomer.setArrivalDate(LocalDateTime.now());
323 329
                            recommendCustomerService.updateById(recommendCustomer);
@@ -416,6 +422,7 @@ public class TaBuildingDynamicController extends BaseController {
416 422
         dynamic.setStatus(1);
417 423
         //活动状态,如果不需要报名则直接置为进行中
418 424
         dynamic.setActivityStatus(1);
425
+        dynamic.setIsEnlist(1);
419 426
         //3.5.1版本去除是否需要报名
420 427
 //        if (dynamic.getIsEnlist() == 0){
421 428
 //            dynamic.setActivityStatus(0);
@@ -423,7 +430,7 @@ public class TaBuildingDynamicController extends BaseController {
423 430
         dynamic.setPublishDate(LocalDateTime.now());
424 431
         dynamic.setCreateDate(LocalDateTime.now());
425 432
 
426
-        Integer heavyCount = iTaBuildingService.countNumByHeavy(dynamic.getHeavy());
433
+        Integer heavyCount = iTaBuildingService.countNumByHeavy(dynamic.getHeavy(), dynamic.getDynamicId());
427 434
         if (heavyCount != 0){
428 435
             responseBean.addError("权重已存在,请重新编辑");
429 436
             return responseBean;
@@ -459,7 +466,7 @@ public class TaBuildingDynamicController extends BaseController {
459 466
         if (dynamic.getEnlistEnd() != null && LocalDateTime.now().isAfter(dynamic.getEnlistEnd())){
460 467
             dynamic.setActivityStatus(2);
461 468
         }
462
-        Integer heavyCount = iTaBuildingService.countNumByHeavy(dynamic.getHeavy());
469
+        Integer heavyCount = iTaBuildingService.countNumByHeavy(dynamic.getHeavy(), dynamic.getDynamicId());
463 470
         if (heavyCount != 0){
464 471
             responseBean.addError("权重已存在,请重新编辑");
465 472
             return responseBean;
@@ -529,7 +536,8 @@ public class TaBuildingDynamicController extends BaseController {
529 536
         dynamicQueryWrapper.eq("dynamic_id", dynamicId);
530 537
         TaBuildingDynamic dynamic = iBuildingDynamicService.getOne(dynamicQueryWrapper);
531 538
         dynamic.setStatus(0);
532
-        dynamic.setOrgId(getOrgId(request));
539
+        // 设置为取消发布以后把轮播图和资讯设置为停用
540
+        iExtendContentService.updateActivity(dynamicId,"activity",getOrgId(request));
533 541
         iBuildingDynamicService.update(dynamic, dynamicQueryWrapper);
534 542
         return responseBean;
535 543
     }

+ 143
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingMapRelationController.java 查看文件

@@ -0,0 +1,143 @@
1
+package com.huiju.estateagents.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.huiju.estateagents.base.BaseController;
7
+import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.entity.TaBuildingMapRelation;
9
+import com.huiju.estateagents.service.ITaBuildingMapRelationService;
10
+import org.slf4j.Logger;
11
+import org.slf4j.LoggerFactory;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.web.bind.annotation.*;
14
+
15
+/**
16
+ * <p>
17
+    *  前端控制器
18
+    * </p>
19
+ *
20
+ * @author jobob
21
+ * @since 2019-11-13
22
+ */
23
+@RestController
24
+@RequestMapping("/")
25
+public class TaBuildingMapRelationController extends BaseController {
26
+
27
+    private final Logger logger = LoggerFactory.getLogger(TaBuildingMapRelationController.class);
28
+
29
+    @Autowired
30
+    public ITaBuildingMapRelationService iTaBuildingMapRelationService;
31
+
32
+
33
+    /**
34
+     * 分页查询列表
35
+     * @param pageNum
36
+     * @param pageSize
37
+     * @return
38
+     */
39
+    @RequestMapping(value="/buildingMapRelation",method= RequestMethod.GET)
40
+    public ResponseBean buildingMapRelationList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
41
+                                                @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize){
42
+        ResponseBean responseBean = new ResponseBean();
43
+        try {
44
+            //使用分页插件
45
+		    IPage<TaBuildingMapRelation> pg = new Page<>(pageNum, pageSize);
46
+            QueryWrapper<TaBuildingMapRelation> queryWrapper = new QueryWrapper<>();
47
+            queryWrapper.orderByDesc("create_date");
48
+
49
+            IPage<TaBuildingMapRelation> result = iTaBuildingMapRelationService.page(pg, queryWrapper);
50
+            responseBean.addSuccess(result);
51
+        }catch (Exception e){
52
+            e.printStackTrace();
53
+            logger.error("buildingMapRelationList -=- {}",e.toString());
54
+            responseBean.addError(e.getMessage());
55
+        }
56
+        return responseBean;
57
+    }
58
+
59
+    /**
60
+     * 保存对象
61
+     * @param taBuildingMapRelation 实体对象
62
+     * @return
63
+     */
64
+    @RequestMapping(value="/buildingMapRelation",method= RequestMethod.POST)
65
+    public ResponseBean buildingMapRelationAdd(@RequestBody TaBuildingMapRelation taBuildingMapRelation){
66
+        ResponseBean responseBean = new ResponseBean();
67
+        try {
68
+            if (iTaBuildingMapRelationService.save(taBuildingMapRelation)){
69
+                responseBean.addSuccess(taBuildingMapRelation);
70
+            }else {
71
+                responseBean.addError("fail");
72
+            }
73
+        }catch (Exception e){
74
+            e.printStackTrace();
75
+            logger.error("buildingMapRelationAdd -=- {}",e.toString());
76
+            responseBean.addError(e.getMessage());
77
+        }
78
+        return responseBean;
79
+    }
80
+
81
+    /**
82
+     * 根据id删除对象
83
+     * @param id  实体ID
84
+     */
85
+    @ResponseBody
86
+    @RequestMapping(value="/buildingMapRelation/{id}", method= RequestMethod.DELETE)
87
+    public ResponseBean buildingMapRelationDelete(@PathVariable Integer id){
88
+        ResponseBean responseBean = new ResponseBean();
89
+        try {
90
+            if(iTaBuildingMapRelationService.removeById(id)){
91
+                responseBean.addSuccess("success");
92
+            }else {
93
+                responseBean.addError("fail");
94
+            }
95
+        }catch (Exception e){
96
+            e.printStackTrace();
97
+            logger.error("buildingMapRelationDelete -=- {}",e.toString());
98
+            responseBean.addError(e.getMessage());
99
+        }
100
+        return responseBean;
101
+    }
102
+
103
+    /**
104
+     * 修改对象
105
+     * @param id  实体ID
106
+     * @param taBuildingMapRelation 实体对象
107
+     * @return
108
+     */
109
+    @RequestMapping(value="/buildingMapRelation/{id}",method= RequestMethod.PUT)
110
+    public ResponseBean buildingMapRelationUpdate(@PathVariable Integer id,
111
+                                        @RequestBody TaBuildingMapRelation taBuildingMapRelation){
112
+        ResponseBean responseBean = new ResponseBean();
113
+        try {
114
+            if (iTaBuildingMapRelationService.updateById(taBuildingMapRelation)){
115
+                responseBean.addSuccess(taBuildingMapRelation);
116
+            }else {
117
+                responseBean.addError("fail");
118
+            }
119
+        }catch (Exception e){
120
+            e.printStackTrace();
121
+            logger.error("buildingMapRelationUpdate -=- {}",e.toString());
122
+            responseBean.addError(e.getMessage());
123
+        }
124
+        return responseBean;
125
+    }
126
+
127
+    /**
128
+     * 根据id查询对象
129
+     * @param id  实体ID
130
+     */
131
+    @RequestMapping(value="/buildingMapRelation/{id}",method= RequestMethod.GET)
132
+    public ResponseBean buildingMapRelationGet(@PathVariable Integer id){
133
+        ResponseBean responseBean = new ResponseBean();
134
+        try {
135
+            responseBean.addSuccess(iTaBuildingMapRelationService.getById(id));
136
+        }catch (Exception e){
137
+            e.printStackTrace();
138
+            logger.error("buildingMapRelationDelete -=- {}",e.toString());
139
+            responseBean.addError(e.getMessage());
140
+        }
141
+        return responseBean;
142
+    }
143
+}

+ 11
- 0
src/main/java/com/huiju/estateagents/controller/TaBuildingProjectTypeController.java 查看文件

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7 7
 import com.huiju.estateagents.entity.TaBuildingProjectType;
8 8
 import com.huiju.estateagents.service.ITaBuildingProjectTypeService;
9
+import com.huiju.estateagents.service.ITaPersonBuildingService;
10
+import com.huiju.estateagents.service.ITaPersonService;
9 11
 import org.slf4j.Logger;
10 12
 import org.slf4j.LoggerFactory;
11 13
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +20,9 @@ import org.springframework.web.bind.annotation.ResponseBody;
18 20
 import org.springframework.web.bind.annotation.RestController;
19 21
 import com.huiju.estateagents.base.BaseController;
20 22
 
23
+import javax.servlet.http.HttpServletRequest;
24
+import java.util.List;
25
+
21 26
 /**
22 27
  * <p>
23 28
     *   前端控制器
@@ -35,6 +40,12 @@ public class TaBuildingProjectTypeController extends BaseController {
35 40
     @Autowired
36 41
     public ITaBuildingProjectTypeService iTaBuildingProjectTypeService;
37 42
 
43
+    @Autowired
44
+    private ITaPersonBuildingService iTaPersonBuildingService;
45
+
46
+    @Autowired
47
+    private ITaPersonService iTaPersonService;
48
+
38 49
 
39 50
     /**
40 51
      * 分页查询列表

+ 2
- 1
src/main/java/com/huiju/estateagents/controller/TaGoodsController.java 查看文件

@@ -337,7 +337,8 @@ public class TaGoodsController extends BaseController {
337 337
             //兑换商品
338 338
             String state = iTaGoodsService.exchangeGoods(id,openid);
339 339
             if (state.equals(CommConstant.SUCCESS)){
340
-                responseBean.addSuccess("兑换成功");
340
+                TaGoods taGoods = iTaGoodsService.getById(id);
341
+                responseBean.addSuccess(taGoods);
341 342
             }else{
342 343
                 responseBean.addError(state);
343 344
             }

+ 7
- 5
src/main/java/com/huiju/estateagents/controller/TaNewsController.java 查看文件

@@ -10,10 +10,7 @@ import com.huiju.estateagents.common.JWTUtils;
10 10
 import com.huiju.estateagents.entity.TaBuildingDynamic;
11 11
 import com.huiju.estateagents.entity.TaNews;
12 12
 import com.huiju.estateagents.entity.TaPerson;
13
-import com.huiju.estateagents.service.ITaBuildingService;
14
-import com.huiju.estateagents.service.ITaNewsService;
15
-import com.huiju.estateagents.service.ITaPersonService;
16
-import com.huiju.estateagents.service.ITaSaveService;
13
+import com.huiju.estateagents.service.*;
17 14
 import io.swagger.annotations.Api;
18 15
 import io.swagger.annotations.ApiImplicitParam;
19 16
 import io.swagger.annotations.ApiImplicitParams;
@@ -61,7 +58,8 @@ public class TaNewsController extends BaseController {
61 58
     @Autowired
62 59
     public ITaBuildingService iTaBuildingService;
63 60
 
64
-
61
+    @Autowired
62
+    private IExtendContentService iExtendContentService;
65 63
     /**
66 64
      * 分页查询列表
67 65
      * @param pageNum
@@ -168,6 +166,10 @@ public class TaNewsController extends BaseController {
168 166
         taNews.setCityId(cityId);
169 167
         taNews.setOrgId(getOrgId(request));
170 168
         ResponseBean responseBean = iTaNewsService.updateTaNews(taNews);
169
+        if ("1".equals(String.valueOf(taNews.getNewsStatus()))){
170
+            // 设置为取消发布以后把轮播图和资讯设置为停用
171
+            iExtendContentService.updateActivity(String.valueOf(id),"news",getOrgId(request));
172
+        }
171 173
         return responseBean;
172 174
     }
173 175
 

+ 7
- 3
src/main/java/com/huiju/estateagents/controller/TaPersonVisitRecordController.java 查看文件

@@ -171,6 +171,9 @@ public class TaPersonVisitRecordController extends BaseController {
171 171
     @RequestMapping(value="/wx/taPersonVisitRecord/{id}",method= RequestMethod.PUT)
172 172
     public ResponseBean taPersonVisitRecordUpdate(@PathVariable Integer id){
173 173
         TaPersonVisitRecord taPersonVisitRecord = iTaPersonVisitRecordService.getById(id);
174
+        if(null == taPersonVisitRecord){
175
+            return ResponseBean.error("更新失败",ResponseBean.ERROR_UNAVAILABLE);
176
+        }
174 177
         taPersonVisitRecord.setLeaveTime(LocalDateTime.now());
175 178
         taPersonVisitRecord.setRecordId(id);
176 179
         Long duation = taPersonVisitRecord.getLeaveTime().atZone(ZoneOffset.UTC).toEpochSecond()-taPersonVisitRecord.getVisitTime().atZone(ZoneOffset.UTC).toEpochSecond();
@@ -203,20 +206,21 @@ public class TaPersonVisitRecordController extends BaseController {
203 206
     
204 207
     /**
205 208
      * 盘客工具分页获取访问记录
206
-     * @param pageNum
209
+     * @param pageNumber
207 210
      * @param pageSize
208 211
      * @return
209 212
      */
210 213
     @RequestMapping(value="/wx/taPersonVisitRecord",method= RequestMethod.GET)
211
-    public ResponseBean wxPersonVisitRecordList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
214
+    public ResponseBean wxPersonVisitRecordList(@RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
212 215
                                                 @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
213 216
                                                 @RequestParam(value = "customerId") String customerId){
214 217
         try {
215 218
             //使用分页插件
216
-            IPage<TaPersonVisitRecord> pg = new Page<>(pageNum, pageSize);
219
+            IPage<TaPersonVisitRecord> pg = new Page<>(pageNumber, pageSize);
217 220
             IPage<TaPersonVisitRecord> result = iTaPersonVisitRecordService.getPersonVisitRecordList(pg, customerId);
218 221
             return ResponseBean.success(result);
219 222
         }catch (Exception e){
223
+            e.printStackTrace();
220 224
             logger.error("taPersonVisitRecordList -=- {}",e.toString());
221 225
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
222 226
         }

+ 15
- 2
src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java 查看文件

@@ -68,6 +68,9 @@ public class TaShareActivityController extends BaseController {
68 68
     @Autowired
69 69
     private ITdPosterTemplateService tdPosterTemplateService;
70 70
 
71
+    @Autowired
72
+    private  IExtendContentService iExtendContentService;
73
+
71 74
 
72 75
     /**
73 76
      * 分页查询列表
@@ -126,8 +129,8 @@ public class TaShareActivityController extends BaseController {
126 129
     @RequestMapping(value="/admin/taShareActivity",method= RequestMethod.POST)
127 130
     public ResponseBean taShareActivityAdd(@RequestBody String parameter, HttpServletRequest request){
128 131
         ResponseBean responseBean = new ResponseBean();
132
+        TaShareActivity taShareActivity = JSONObject.parseObject(parameter, TaShareActivity.class);
129 133
         try {
130
-            TaShareActivity taShareActivity = JSONObject.parseObject(parameter, TaShareActivity.class);
131 134
             if  (taShareActivity.getGroupBuyPeople() <= 1){
132 135
                 responseBean.addError("拼团人数必须大于等于2人");
133 136
                 return responseBean;
@@ -158,6 +161,7 @@ public class TaShareActivityController extends BaseController {
158 161
             logger.error("taShareActivityAdd -=- {}",e.toString());
159 162
             responseBean.addError(e.getMessage());
160 163
         }
164
+        responseBean.addSuccess(taShareActivity.getGroupActivityId());
161 165
         return responseBean;
162 166
     }
163 167
 
@@ -198,6 +202,7 @@ public class TaShareActivityController extends BaseController {
198 202
 
199 203
             QueryWrapper<TaShareActivity> taShareActivityQueryWrapper = new QueryWrapper<>();
200 204
             taShareActivityQueryWrapper.eq("heavy", taShareActivity.getHeavy());
205
+            taShareActivityQueryWrapper.ne("group_activity_id", taShareActivity.getGroupActivityId());
201 206
             Integer heavyCount = iTaShareActivityService.count(taShareActivityQueryWrapper);
202 207
             if (heavyCount != 0){
203 208
                 responseBean.addError("权重已存在,请重新编辑");
@@ -245,11 +250,17 @@ public class TaShareActivityController extends BaseController {
245 250
         try{
246 251
             Integer orgId = getOrgId(request);
247 252
             Integer sumPoints = taPersonService.sumPointsByOrgId(orgId);
253
+            sumPoints = sumPoints == null ? 0 : sumPoints;
248 254
             QueryWrapper<TaPerson> taPersonWrapper = new QueryWrapper<>();
249 255
             taPersonWrapper.eq("org_id", orgId);
250 256
             Integer personNum = taPersonService.count(taPersonWrapper);
251 257
             TaShareActivity taShareActivity = new TaShareActivity();
252
-            taShareActivity.setAverageScore(sumPoints/personNum);
258
+            if (personNum == 0){
259
+                taShareActivity.setAverageScore(0);
260
+            }else{
261
+                taShareActivity.setAverageScore(sumPoints/personNum);
262
+            }
263
+
253 264
             responseBean.addSuccess(taShareActivity);
254 265
         }catch (Exception e){
255 266
             e.printStackTrace();
@@ -310,6 +321,8 @@ public class TaShareActivityController extends BaseController {
310 321
         dynamic.setStatus(-1);
311 322
         dynamic.setOrgId(getOrgId(request));
312 323
         iTaShareActivityService.update(dynamic, taShareActivityQueryWrapper);
324
+        // 设置为取消发布以后把轮播图和资讯设置为停用
325
+        iExtendContentService.updateActivity(groupActivityId,"group",getOrgId(request));
313 326
         return responseBean;
314 327
     }
315 328
 

+ 26
- 0
src/main/java/com/huiju/estateagents/controller/TdBuildingTypeController.java 查看文件

@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7 7
 import com.huiju.estateagents.entity.TaBuilding;
8
+import com.huiju.estateagents.entity.TaBuildingProjectType;
8 9
 import com.huiju.estateagents.entity.TdBuildingType;
9 10
 import com.huiju.estateagents.exception.EstaException;
10 11
 import com.huiju.estateagents.mapper.TaBuildingMapper;
12
+import com.huiju.estateagents.service.ITaBuildingProjectTypeService;
11 13
 import com.huiju.estateagents.service.ITaBuildingService;
12 14
 import com.huiju.estateagents.service.ITdBuildingTypeService;
13 15
 import io.swagger.annotations.Api;
@@ -52,6 +54,9 @@ public class TdBuildingTypeController extends BaseController {
52 54
     @Autowired
53 55
     public TaBuildingMapper taBuildingMapper;
54 56
 
57
+    @Autowired
58
+    public ITaBuildingProjectTypeService iTaBuildingProjectTypeService;
59
+
55 60
     /**
56 61
      * 分页查询列表
57 62
      * @param pageNum
@@ -85,6 +90,27 @@ public class TdBuildingTypeController extends BaseController {
85 90
         return responseBean;
86 91
     }
87 92
 
93
+    /**
94
+     * 分页查询列表
95
+     * @return
96
+     */
97
+    @RequestMapping(value="/wx/getByBuildingIdSelectBuildingProjectType/{buildingId}",method= RequestMethod.GET)
98
+    public ResponseBean wxGetBuildingProjectTypeByBuildingIdList(@PathVariable(value ="buildingId") String buildingId, HttpServletRequest request){
99
+        ResponseBean responseBean = new ResponseBean();
100
+        try {
101
+            // 项目类型
102
+            QueryWrapper<TaBuildingProjectType> projectTypeQueryWrapper = new QueryWrapper<>();
103
+            projectTypeQueryWrapper.eq("building_id", buildingId);
104
+            projectTypeQueryWrapper.eq("status", 1);
105
+            List<TaBuildingProjectType> result = iTaBuildingProjectTypeService.list(projectTypeQueryWrapper);
106
+            responseBean.addSuccess(result);
107
+        }catch (Exception e){
108
+            logger.error("taBuildingProjectTypeList -=- {}",e.toString());
109
+            responseBean.addError(e.getMessage());
110
+        }
111
+        return responseBean;
112
+    }
113
+
88 114
     /**
89 115
      * 分页查询列表
90 116
      * @param pageNum

+ 50
- 4
src/main/java/com/huiju/estateagents/controller/TdCityController.java 查看文件

@@ -5,7 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.ResponseBean;
7 7
 import com.huiju.estateagents.common.CommConstant;
8
+import com.huiju.estateagents.entity.TaMiniapp;
9
+import com.huiju.estateagents.entity.TaOrgCity;
8 10
 import com.huiju.estateagents.entity.TdCity;
11
+import com.huiju.estateagents.mapper.TaOrgCityMapper;
12
+import com.huiju.estateagents.service.ITaMiniappService;
9 13
 import com.huiju.estateagents.service.ITdCityService;
10 14
 import org.slf4j.Logger;
11 15
 import org.slf4j.LoggerFactory;
@@ -19,6 +23,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
19 23
 import org.springframework.web.bind.annotation.RestController;
20 24
 import com.huiju.estateagents.base.BaseController;
21 25
 
26
+import javax.servlet.http.HttpServletRequest;
22 27
 import java.util.List;
23 28
 
24 29
 /**
@@ -38,12 +43,17 @@ public class TdCityController extends BaseController {
38 43
     @Autowired
39 44
     public ITdCityService iTdCityService;
40 45
 
46
+    @Autowired
47
+    private TaOrgCityMapper taOrgCityMapper;
48
+
49
+    @Autowired
50
+    private ITaMiniappService iTaMiniappService;
41 51
 
42 52
     /**
43
-     * 查询列表
53
+     * 中心端城市
44 54
      * @return
45 55
      */
46
-    @RequestMapping(value="/admin/tdCity",method= RequestMethod.GET)
56
+    @RequestMapping(value="/center/tdCity",method= RequestMethod.GET)
47 57
     public ResponseBean tdCityList(@RequestParam(value = "leveltype", required = false) String leveltype){
48 58
         ResponseBean responseBean = new ResponseBean();
49 59
         try {
@@ -56,15 +66,33 @@ public class TdCityController extends BaseController {
56 66
         return responseBean;
57 67
     }
58 68
 
69
+    /**
70
+     * 业务端城市
71
+     */
72
+    @RequestMapping(value="/admin/tdCityList/tdCity",method= RequestMethod.GET)
73
+    public ResponseBean adminTdCityList(HttpServletRequest request){
74
+        ResponseBean responseBean = new ResponseBean<>();
75
+        List<TaOrgCity> taOrgCityList = taOrgCityMapper.selectAdminTdCityList(getOrgId(request));
76
+        responseBean.addSuccess(taOrgCityList);
77
+        return responseBean;
78
+    }
79
+
80
+
59 81
     /**
60 82
      * 查询列表
61 83
      * @return
62 84
      */
63 85
     @RequestMapping(value="/wx/tdCity",method= RequestMethod.GET)
64
-    public ResponseBean tdCityListWx(@RequestParam(value = "leveltype", required = false) String leveltype){
86
+    public ResponseBean tdCityListWx(@RequestParam(value = "leveltype", required = false) String leveltype,HttpServletRequest request){
65 87
         ResponseBean responseBean = new ResponseBean();
88
+        String appId = request.getHeader("appId");
66 89
         try {
67
-            List<TdCity> result = iTdCityService.selectCity(leveltype, "1");
90
+            //通过appid获取orgId
91
+            QueryWrapper<TaMiniapp> taMiniappQueryWrapper = new QueryWrapper<>();
92
+            taMiniappQueryWrapper.eq("miniapp_id", appId);
93
+            TaMiniapp taMiniapp = iTaMiniappService.getOne(taMiniappQueryWrapper);
94
+            /**leveltype,暂时保留*/
95
+            List<TdCity> result = iTdCityService.selectWxCity(leveltype, taMiniapp.getOrgId());
68 96
             responseBean.addSuccess(result);
69 97
         }catch (Exception e){
70 98
             logger.error("tdCityList -=- {}",e.toString());
@@ -152,4 +180,22 @@ public class TdCityController extends BaseController {
152 180
         }
153 181
         return responseBean;
154 182
     }
183
+    
184
+    /**
185
+     * 根据经纬度查询城市ID
186
+     * 经度在前,纬度在后,经纬度间以“,”分割,经纬度小数点后不要超过 6 位
187
+     * @return
188
+     */
189
+    @RequestMapping(value="/wx/location/city",method= RequestMethod.GET)
190
+    public ResponseBean wxLocationCityDetail(@RequestParam(value = "location") String location,HttpServletRequest request){
191
+        ResponseBean responseBean = new ResponseBean();
192
+        try {
193
+            TdCity tdCity = iTdCityService.getLocationCity(location);
194
+            responseBean.addSuccess(tdCity);
195
+        }catch (Exception e){
196
+            logger.error("tdCityList -=- {}",e.toString());
197
+            responseBean.addError(e.getMessage());
198
+        }
199
+        return responseBean;
200
+    }
155 201
 }

+ 1
- 0
src/main/java/com/huiju/estateagents/entity/TaBuilding.java 查看文件

@@ -201,6 +201,7 @@ public class TaBuilding implements Serializable {
201 201
     /**
202 202
      * 地图数据
203 203
      */
204
+    @TableField(exist = false)
204 205
     private String mapJson;
205 206
 
206 207
     /**

+ 5
- 0
src/main/java/com/huiju/estateagents/entity/TaBuildingDynamic.java 查看文件

@@ -205,6 +205,11 @@ public class TaBuildingDynamic implements Serializable {
205 205
 
206 206
     private String qrCode;
207 207
 
208
+    /**
209
+     * 活动主图2 用于首页底部活动轮播
210
+     */
211
+    private  String bannerListImg;
212
+
208 213
     @TableField(exist = false)
209 214
     private List<TaPoster> posters;
210 215
 

+ 51
- 0
src/main/java/com/huiju/estateagents/entity/TaBuildingMapRelation.java 查看文件

@@ -0,0 +1,51 @@
1
+package com.huiju.estateagents.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import com.baomidou.mybatisplus.annotation.TableName;
7
+import lombok.Data;
8
+import lombok.EqualsAndHashCode;
9
+import lombok.experimental.Accessors;
10
+
11
+import java.io.Serializable;
12
+import java.time.LocalDateTime;
13
+
14
+/**
15
+ * <p>
16
+ * 
17
+ * </p>
18
+ *
19
+ * @author jobob
20
+ * @since 2019-11-13
21
+ */
22
+@Data
23
+@EqualsAndHashCode(callSuper = false)
24
+@Accessors(chain = true)
25
+@TableName("ta_building_map_relation")
26
+public class TaBuildingMapRelation implements Serializable {
27
+
28
+    @TableId(value = "map_id", type = IdType.AUTO)
29
+    private Integer mapId;
30
+
31
+    private static final long serialVersionUID = 1L;
32
+
33
+    private String buildingId;
34
+
35
+    private Integer orgId;
36
+
37
+    private String types;
38
+
39
+    private String data;
40
+
41
+    private String label;
42
+
43
+    @TableField(value = "`key`")
44
+    private String key;
45
+
46
+    private Integer status;
47
+
48
+    private LocalDateTime createDate;
49
+
50
+
51
+}

+ 14
- 1
src/main/java/com/huiju/estateagents/entity/TaOrgCity.java 查看文件

@@ -24,11 +24,18 @@ import java.util.List;
24 24
 public class TaOrgCity implements Serializable {
25 25
 
26 26
     private static final long serialVersionUID = 1L;
27
+
28
+    /**
29
+     * id
30
+     */
31
+    @TableId(value = "id", type = IdType.AUTO)
32
+    private Integer id;
33
+
27 34
     /**
28 35
      * 省份id
29 36
      * 城市id
30 37
      */
31
-    private Integer id;
38
+    private Integer cityId;
32 39
 
33 40
     /**
34 41
      * 省市区名称
@@ -49,4 +56,10 @@ public class TaOrgCity implements Serializable {
49 56
      * 上级ID
50 57
      */
51 58
     private Integer parentid;
59
+
60
+    /**
61
+     * 城市首字母
62
+     */
63
+    @TableField(exist = false)
64
+    private String initial;
52 65
 }

+ 6
- 0
src/main/java/com/huiju/estateagents/entity/TaPersonVisitRecord.java 查看文件

@@ -107,5 +107,11 @@ public class TaPersonVisitRecord implements Serializable {
107 107
      */
108 108
     @TableField(exist = false)
109 109
     private String buildingName;
110
+    
111
+    /**
112
+     * 活动名称
113
+     */
114
+    @TableField(exist = false)
115
+    private String activityName;
110 116
 
111 117
 }

+ 3
- 0
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java 查看文件

@@ -195,4 +195,7 @@ public class TaRecommendCustomer implements Serializable {
195 195
 
196 196
     @TableField(exist = false)
197 197
     private Map<String,String> geoInfo;
198
+
199
+    @TableField(exist = false)
200
+    private String avatarurl;
198 201
 }

+ 3
- 3
src/main/java/com/huiju/estateagents/excel/AgentsRecommendCustomer.java 查看文件

@@ -55,8 +55,8 @@ public class AgentsRecommendCustomer {
55 55
     /**
56 56
      * 邀请经纪人(数量)
57 57
      */
58
-    @ColumnWidth(15)
59
-    @ExcelProperty(value = "邀请经纪人(数量)", index = 6)
60
-    private String agentCount;
58
+//    @ColumnWidth(15)
59
+//    @ExcelProperty(value = "邀请经纪人(数量)", index = 6)
60
+//    private String agentCount;
61 61
 
62 62
 }

+ 8
- 15
src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java 查看文件

@@ -1,17 +1,9 @@
1 1
 package com.huiju.estateagents.job;
2 2
 
3 3
 import com.huiju.estateagents.base.BaseController;
4
-import com.huiju.estateagents.common.DateUtils;
5
-import com.huiju.estateagents.service.IHelpActivityService;
6
-import com.huiju.estateagents.service.IHelpInitiateRecordService;
7
-import com.huiju.estateagents.service.IHelpRecordService;
8
-import com.huiju.estateagents.service.ITaBuildingDynamicService;
9
-import com.huiju.estateagents.service.ITaShareActivityService;
10
-import com.huiju.estateagents.service.ITaShareChildRecordService;
11
-import com.huiju.estateagents.service.ITaShareRecordService;
12
-import com.huiju.estateagents.statistic.service.ITaCustomerGenderStatisticService;
13
-import com.huiju.estateagents.statistic.service.ITaCustomerStatisticDailyService;
14
-import com.huiju.estateagents.statistic.service.ITaCustomerStatisticMonthlyService;
4
+import com.huiju.estateagents.statistic.service.ITsCustomerGenderStatisticService;
5
+import com.huiju.estateagents.statistic.service.ITsCustomerStatisticDailyService;
6
+import com.huiju.estateagents.statistic.service.ITsCustomerStatisticMonthlyService;
15 7
 import org.slf4j.Logger;
16 8
 import org.slf4j.LoggerFactory;
17 9
 import org.springframework.beans.factory.annotation.Autowired;
@@ -36,13 +28,13 @@ public class CustomerStatisticTimeJob extends BaseController {
36 28
     private final Logger logger = LoggerFactory.getLogger(CustomerStatisticTimeJob.class);
37 29
 
38 30
     @Autowired
39
-    private ITaCustomerStatisticDailyService customerStatisticDailyService;
31
+    private ITsCustomerStatisticDailyService customerStatisticDailyService;
40 32
     
41 33
     @Autowired
42
-    private ITaCustomerGenderStatisticService taCustomerGenderStatisticService;
34
+    private ITsCustomerGenderStatisticService taCustomerGenderStatisticService;
43 35
     
44 36
     @Autowired
45
-    private ITaCustomerStatisticMonthlyService customerStatisticMonthlyService;
37
+    private ITsCustomerStatisticMonthlyService customerStatisticMonthlyService;
46 38
 
47 39
     /**
48 40
      *
@@ -50,7 +42,8 @@ public class CustomerStatisticTimeJob extends BaseController {
50 42
      *
51 43
      * 开启定时任务,每天23:50执行
52 44
      */
53
-    @Scheduled(cron = "00 50 23 * * ?")
45
+    @Scheduled(cron = "59 50 23 * * ?")
46
+    //@Scheduled(cron = "* 0/5 * * * ?")
54 47
     private void configureTasks() {
55 48
         LocalDateTime nowDate = LocalDateTime.now();
56 49
     

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

@@ -0,0 +1,18 @@
1
+package com.huiju.estateagents.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.huiju.estateagents.entity.TaBuildingMapRelation;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+/**
8
+ * <p>
9
+ *  Mapper 接口
10
+ * </p>
11
+ *
12
+ * @author jobob
13
+ * @since 2019-11-13
14
+ */
15
+@Mapper
16
+public interface TaBuildingMapRelationMapper extends BaseMapper<TaBuildingMapRelation> {
17
+
18
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaBuildingMapper.java 查看文件

@@ -90,5 +90,5 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
90 90
      * 根据权重统计该权重是否存在
91 91
      * @return
92 92
      */
93
-    int countNumByHeavy(@Param("heavy") Integer heavy);
93
+    int countNumByHeavy(@Param("heavy") Integer heavy, @Param("dynamicId") String dynamicId);
94 94
 }

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

@@ -3,6 +3,10 @@ package com.huiju.estateagents.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.huiju.estateagents.entity.TaOrgCity;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.ArrayList;
9
+import java.util.List;
6 10
 
7 11
 /**
8 12
  * <p>
@@ -14,4 +18,13 @@ import org.apache.ibatis.annotations.Mapper;
14 18
  */
15 19
 @Mapper
16 20
 public interface TaOrgCityMapper extends BaseMapper<TaOrgCity> {
21
+    // 查询所有的城市排除省份
22
+    ArrayList<String> selectByIdCity(@Param("orgId") Integer orgId);
23
+
24
+    /**
25
+     * 根据orgid查询城市并排除省份
26
+     * @param orgId
27
+     * @return
28
+     */
29
+    List<TaOrgCity> selectAdminTdCityList(Integer orgId);
17 30
 }

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

@@ -187,4 +187,6 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
187 187
     TaRecommendCustomer getMyCustDetailById(String customerId);
188 188
 
189 189
     List<PersonIntention> getCustomerIntentions(@Param("personId")String personId);
190
+
191
+    IPage<TaRecommendCustomer>getCustomersIRecommended(IPage<TaRecommendCustomer> page,@Param("customerId")String customerId,@Param("status")Integer status,@Param("orgId") Integer orgId);
190 192
 }

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

@@ -20,4 +20,10 @@ import java.util.List;
20 20
 public interface TdCityMapper extends BaseMapper<TdCity> {
21 21
     List<TdCity> selectCity(@Param("leveltype")String leveltype,@Param("status") String status);
22 22
 
23
+    /**
24
+     *查出当前ta_org_city下的城市
25
+     * @param orgId
26
+     * @return
27
+     */
28
+    List<TdCity> selectWxCity(@Param("orgId") Integer orgId);
23 29
 }

+ 7
- 0
src/main/java/com/huiju/estateagents/service/IExtendContentService.java 查看文件

@@ -38,4 +38,11 @@ public interface IExtendContentService extends IService<ExtendContent> {
38 38
      * @return
39 39
      */
40 40
     ResponseBean selectExtendContentListShowType(String showType, String showPosition, String targetId, String contentType, String buildingId, String contentId, Integer cityId,Integer orgId);
41
+
42
+    /**
43
+     * 更新活动拼团助力
44
+     * @param dynamicId
45
+     * @param type
46
+     */
47
+    void updateActivity(String dynamicId, String type,Integer orgId);
41 48
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IHelpActivityService.java 查看文件

@@ -38,7 +38,7 @@ public interface IHelpActivityService extends IService<HelpActivity> {
38 38
      * 活动助力添加
39 39
      * @param helpActivity
40 40
      */
41
-    void helpActivityAdd(HelpActivity helpActivity,Integer orgId);
41
+    int helpActivityAdd(HelpActivity helpActivity,Integer orgId);
42 42
 
43 43
     /**
44 44
      * 活动助力修改

+ 16
- 0
src/main/java/com/huiju/estateagents/service/ITaBuildingMapRelationService.java 查看文件

@@ -0,0 +1,16 @@
1
+package com.huiju.estateagents.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.huiju.estateagents.entity.TaBuildingMapRelation;
5
+
6
+/**
7
+ * <p>
8
+ *  服务类
9
+ * </p>
10
+ *
11
+ * @author jobob
12
+ * @since 2019-11-13
13
+ */
14
+public interface ITaBuildingMapRelationService extends IService<TaBuildingMapRelation> {
15
+
16
+}

+ 1
- 1
src/main/java/com/huiju/estateagents/service/ITaBuildingService.java 查看文件

@@ -165,5 +165,5 @@ public interface ITaBuildingService extends IService<TaBuilding> {
165 165
      * @param heavy
166 166
      * @return
167 167
      */
168
-    int countNumByHeavy(Integer heavy);
168
+    int countNumByHeavy(Integer heavy, String dynamicId);
169 169
 }

+ 9
- 0
src/main/java/com/huiju/estateagents/service/ITdCityService.java 查看文件

@@ -17,4 +17,13 @@ import java.util.List;
17 17
 public interface ITdCityService extends IService<TdCity> {
18 18
     List<TdCity> selectCity(String leveltype,String status);
19 19
 
20
+    // 微信端城市
21
+    List<TdCity> selectWxCity(String leveltype,Integer orgId);
22
+	
23
+	/**
24
+	 * 根据经纬度获取城市详情信息
25
+	 * @param location
26
+	 * @return
27
+	 */
28
+	TdCity getLocationCity(String location);
20 29
 }

+ 13
- 0
src/main/java/com/huiju/estateagents/service/impl/ExtendContentServiceImpl.java 查看文件

@@ -71,4 +71,17 @@ public class ExtendContentServiceImpl extends ServiceImpl<ExtendContentMapper, E
71 71
         responseBean.addSuccess(taExtendContent);
72 72
         return responseBean;
73 73
     }
74
+
75
+    @Override
76
+    public void updateActivity(String dynamicId, String type,Integer orgId) {
77
+    QueryWrapper<ExtendContent> queryWrapperExtendContent = new QueryWrapper<>();
78
+        queryWrapperExtendContent.eq("target_id",dynamicId);
79
+        queryWrapperExtendContent.eq("content_type",type);
80
+        queryWrapperExtendContent.eq("org_id",orgId);
81
+        List<ExtendContent> list = extendContentMapper.selectList(queryWrapperExtendContent);
82
+        for (ExtendContent extendContent : list){
83
+            extendContent.setStatus(0);
84
+            extendContentMapper.updateById(extendContent);
85
+        }
86
+    }
74 87
 }

+ 3
- 2
src/main/java/com/huiju/estateagents/service/impl/HelpActivityServiceImpl.java 查看文件

@@ -65,10 +65,11 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
65 65
     }
66 66
 
67 67
     @Override
68
-    public void helpActivityAdd(HelpActivity helpActivity, Integer orgId) {
68
+    public int helpActivityAdd(HelpActivity helpActivity, Integer orgId) {
69 69
         helpActivity.setOrgId(orgId)
70 70
                 .setCreateDate(LocalDateTime.now());
71
-        taHelpActivityMapper.insert(helpActivity);
71
+                taHelpActivityMapper.insert(helpActivity);
72
+        return helpActivity.getHelpActivityId();
72 73
     }
73 74
 
74 75
     @Override

+ 5
- 1
src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java 查看文件

@@ -241,6 +241,10 @@ public class TaBuildingDynamicServiceImpl extends ServiceImpl<TaBuildingDynamicM
241 241
             responseBean.addError("当前报名人数已满");
242 242
             return responseBean;
243 243
         }
244
+        if(null != buildingDynamic.getEnlistStart() && buildingDynamic.getEnlistStart().isAfter(LocalDateTime.now())){
245
+            responseBean.addError("当前活动未开始报名");
246
+            return responseBean;
247
+        }
244 248
         if(null != buildingDynamic.getEnlistEnd() && buildingDynamic.getEnlistEnd().isBefore(LocalDateTime.now())){
245 249
             responseBean.addError("当前活动已结束报名");
246 250
             return responseBean;
@@ -258,7 +262,7 @@ public class TaBuildingDynamicServiceImpl extends ServiceImpl<TaBuildingDynamicM
258 262
         // 默认未签到
259 263
         taActivityDynamicEnlist.setIsCheckin(0);
260 264
         taActivityDynamicEnlist.setCreateDate(LocalDateTime.now())
261
-                .setBuildingId(taBuildingDynamic.getDynamicId());
265
+                .setBuildingId(taBuildingDynamic.getBuildingId());
262 266
         int state = taActivityDynamicEnlistMapper.insert(taActivityDynamicEnlist);
263 267
         int joinNum = taBuildingDynamic.getEnlistNum() == null ? taActivityDynamicEnlist.getAttendNum():taBuildingDynamic.getEnlistNum()+taActivityDynamicEnlist.getAttendNum();
264 268
         taBuildingDynamic.setEnlistNum(joinNum);

+ 20
- 0
src/main/java/com/huiju/estateagents/service/impl/TaBuildingMapRelationServiceImpl.java 查看文件

@@ -0,0 +1,20 @@
1
+package com.huiju.estateagents.service.impl;
2
+
3
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4
+import com.huiju.estateagents.entity.TaBuildingMapRelation;
5
+import com.huiju.estateagents.mapper.TaBuildingMapRelationMapper;
6
+import com.huiju.estateagents.service.ITaBuildingMapRelationService;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * <p>
11
+ *  服务实现类
12
+ * </p>
13
+ *
14
+ * @author jobob
15
+ * @since 2019-11-13
16
+ */
17
+@Service
18
+public class TaBuildingMapRelationServiceImpl extends ServiceImpl<TaBuildingMapRelationMapper, TaBuildingMapRelation> implements ITaBuildingMapRelationService {
19
+
20
+}

+ 104
- 17
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java 查看文件

@@ -13,6 +13,7 @@ import com.huiju.estateagents.common.DateUtils;
13 13
 import com.huiju.estateagents.common.StringUtils;
14 14
 import com.huiju.estateagents.entity.*;
15 15
 import com.huiju.estateagents.mapper.*;
16
+import com.huiju.estateagents.service.ITaBuildingMapRelationService;
16 17
 import com.huiju.estateagents.service.ITaBuildingService;
17 18
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
18 19
 import com.huiju.estateagents.service.TaPosterService;
@@ -86,6 +87,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
86 87
     @Autowired
87 88
     private  TaOrgMapper  taOrgMapper;
88 89
 
90
+    @Autowired
91
+    private ITaBuildingMapRelationService iTaBuildingMapRelationService;
92
+
89 93
     @Override
90 94
     public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId) {
91 95
         Page<TaBuilding> page = new Page<>();
@@ -104,6 +108,15 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
104 108
 
105 109
                 List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(queryWrapper);
106 110
                 taBuilding.setBuildingImg(buildingImg);
111
+
112
+                //查询封面当前图片
113
+                QueryWrapper<TaBuildingImg> queryListWrapper = new QueryWrapper<>();
114
+                queryListWrapper.eq("building_id", taBuilding.getBuildingId());
115
+                queryListWrapper.eq("img_type", CommConstant.BUILDING_IMG_LIST);
116
+                queryListWrapper.orderByAsc("create_date");
117
+
118
+                List<TaBuildingImg> buildingListImg = taBuildingImgMapper.selectList(queryListWrapper);
119
+                taBuilding.setBuildingListImg(buildingListImg);
107 120
             }
108 121
         }
109 122
 
@@ -130,10 +143,11 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
130 143
      */
131 144
     private List<TaBuildingImg> getBuildingImg(String buildingId, String imgType) {
132 145
         //查询当前图片
133
-        QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
134
-        BuildingImgQueryWrapper.eq("building_id", buildingId);
135
-        BuildingImgQueryWrapper.eq("img_type", imgType);
136
-        List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(BuildingImgQueryWrapper);
146
+        QueryWrapper<TaBuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
147
+        buildingImgQueryWrapper.eq("building_id", buildingId);
148
+        buildingImgQueryWrapper.eq("img_type", imgType);
149
+        buildingImgQueryWrapper.orderByAsc("order_no");
150
+        List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
137 151
         return  buildingImg.size() > 0 ? buildingImg : null;
138 152
     }
139 153
 
@@ -168,6 +182,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
168 182
         building.setPosters(taPosterService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
169 183
         building.setShareContents(taShareContentService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
170 184
 
185
+        // 查询 周边数据
186
+        QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
187
+        mapRelationQueryWrapper.eq("building_id", building.getBuildingId());
188
+        mapRelationQueryWrapper.eq("org_id", building.getOrgId());
189
+        List<TaBuildingMapRelation> mapRelationList = iTaBuildingMapRelationService.list(mapRelationQueryWrapper);
190
+        building.setMapJson(mapRelationList.size() > 0 ? JSONObject.toJSONString(mapRelationList) : null);
191
+
171 192
         return ResponseBean.success(building);
172 193
     }
173 194
 
@@ -179,6 +200,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
179 200
         buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,id);
180 201
         TaBuilding building = taBuildingMapper.selectOne(buildingtWrapper);
181 202
 
203
+        if (null == building){
204
+            return ResponseBean.error("项目不存在",ResponseBean.ERROR_UNAVAILABLE);
205
+        }
182 206
         //查询当前图片
183 207
         building.setBuildingImg(getBuildingImg(id, CommConstant.BUILDING_IMG_BANNER));
184 208
 
@@ -202,6 +226,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
202 226
         QueryWrapper<TaBuildingApartment> AppointmentQueryWrapper = new QueryWrapper<>();
203 227
         AppointmentQueryWrapper.eq("building_id", id);
204 228
         AppointmentQueryWrapper.eq("status", 1);
229
+        AppointmentQueryWrapper.orderByDesc("create_date");
205 230
         List<TaBuildingApartment> appoint = taBuildingApartmentMapper.selectList(AppointmentQueryWrapper);
206 231
         for (TaBuildingApartment apar:appoint) {
207 232
             List<TaBuildingImg> imgs = taBuildingImgMapper.getBuildingImgByApartment(apar.getApartmentId());
@@ -247,9 +272,14 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
247 272
         shareActivityQueryWrapper.eq("status", 1);
248 273
         shareActivityQueryWrapper.in("activity_status", 0, 1);
249 274
         List<TaShareActivity> shareActivityList = taShareActivityMapper.selectList(shareActivityQueryWrapper);
250
-
251 275
         building.setShareActivityList(shareActivityList);
252 276
 
277
+        // 查询 周边数据
278
+        QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
279
+        mapRelationQueryWrapper.eq("building_id", building.getBuildingId());
280
+        mapRelationQueryWrapper.eq("org_id", building.getOrgId());
281
+        List<TaBuildingMapRelation> mapRelationList = iTaBuildingMapRelationService.list(mapRelationQueryWrapper);
282
+        building.setMapJson(mapRelationList.size() > 0 ? JSONObject.toJSONString(mapRelationList) : null);
253 283
 
254 284
         return ResponseBean.success(building);
255 285
     }
@@ -258,7 +288,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
258 288
     public ResponseBean buildingUpdate(String parameter, Integer orgId) {
259 289
         JSONObject object= JSONObject.parseObject(parameter);
260 290
 
261
-        TaBuilding building = JSONObject.parseObject(parameter,TaBuilding.class);
291
+        TaBuilding building = object.toJavaObject(TaBuilding.class);
262 292
 
263 293
         // 先删除视频
264 294
         UpdateWrapper<TaBuilding> updateWrapper = new UpdateWrapper<>();
@@ -328,6 +358,20 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
328 358
         if (CollectionUtils.isNotEmpty(buildingProjectTypeArray)) {
329 359
             taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
330 360
         }
361
+
362
+        // 地图周边
363
+        JSONArray mapJson = object.getJSONArray("mapJson");
364
+        if (null != mapJson) {
365
+            // 先删除
366
+            QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
367
+            mapRelationQueryWrapper.eq("building_id", building.getBuildingId());
368
+            mapRelationQueryWrapper.eq("org_id", orgId);
369
+            iTaBuildingMapRelationService.remove(mapRelationQueryWrapper);
370
+
371
+            List<TaBuildingMapRelation> taBuildingMapRelations = mapJson.toJavaList(TaBuildingMapRelation.class);
372
+            insertBuildingMapRelationBeach(taBuildingMapRelations, building.getBuildingId(), orgId);
373
+        }
374
+
331 375
         return ResponseBean.success(building);
332 376
     }
333 377
 
@@ -347,10 +391,10 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
347 391
         taBuildingQuery.gt("status",-1);
348 392
         int orgNum= taBuildingMapper.selectCount(taBuildingQuery);
349 393
         if (orgNum >= taOrg.getBuildingNum()){
350
-            return ResponseBean.error("楼盘已超过最大限制", ResponseBean.ERROR_UNAVAILABLE);
394
+            return ResponseBean.error("当前系统仅供维护"+taOrg.getBuildingNum()+"个项目,需要维护更多项目,请联系相关管理人员", ResponseBean.ERROR_UNAVAILABLE);
351 395
         }
352 396
 
353
-        TaBuilding building = JSONObject.parseObject(parameter,TaBuilding.class);
397
+        TaBuilding building = object.toJavaObject(TaBuilding.class);
354 398
         if(null!= object.getDate("openingDate")){
355 399
             building.setOpeningDate(DateUtils.date2LocalDateTime(object.getDate("openingDate")));
356 400
         }
@@ -376,7 +420,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
376 420
 
377 421
         // 视频封面图
378 422
         String videoImage = object.getString("videoImage");
379
-        List<TaBuildingImg> videoImageList = JSONObject.parseArray(imgStr, TaBuildingImg.class);
423
+        List<TaBuildingImg> videoImageList = JSONObject.parseArray(videoImage, TaBuildingImg.class);
380 424
         if (CollectionUtils.isNotEmpty(videoImageList)) {
381 425
             videoImageList = insertImgBatch(videoImageList, building.getBuildingId());
382 426
         }
@@ -401,9 +445,37 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
401 445
             taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
402 446
         }
403 447
 
448
+        // 地图周边
449
+        JSONArray mapJson = object.getJSONArray("mapJson");
450
+        if (null != mapJson) {
451
+            List<TaBuildingMapRelation> taBuildingMapRelations = mapJson.toJavaList(TaBuildingMapRelation.class);
452
+            insertBuildingMapRelationBeach(taBuildingMapRelations, building.getBuildingId(), orgId);
453
+        }
454
+
455
+
404 456
         return ResponseBean.success(building);
405 457
     }
406 458
 
459
+    /**
460
+     * 批量插入 周边地图数据
461
+     * @param list
462
+     * @param buildingId
463
+     * @param orgId
464
+     * @return
465
+     */
466
+    private List<TaBuildingMapRelation> insertBuildingMapRelationBeach(List<TaBuildingMapRelation> list, String buildingId, Integer orgId) {
467
+        List<TaBuildingMapRelation> newList = list.stream().map(e -> {
468
+            e.setBuildingId(buildingId);
469
+            e.setOrgId(orgId);
470
+            e.setStatus(1);
471
+            e.setCreateDate(LocalDateTime.now());
472
+            return e;
473
+        }).collect(Collectors.toList());
474
+
475
+        iTaBuildingMapRelationService.saveBatch(newList);
476
+        return newList;
477
+    }
478
+
407 479
     @Override
408 480
     public ResponseBean buildingUpdateStatus(String parameter, Integer orgId) {
409 481
         TaBuilding  building = new TaBuilding();
@@ -449,6 +521,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
449 521
         }
450 522
 
451 523
         JSONObject jsonobject = JSONObject.parseObject(parameter);
524
+
452 525
         //图片数组
453 526
         String imgStr = jsonobject.getString("img");
454 527
         //转集合
@@ -476,6 +549,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
476 549
 
477 550
         QueryWrapper<TaBuildingApartment> buildingApartmentQueryWrapper = new QueryWrapper<>();
478 551
         buildingApartmentQueryWrapper.eq("apartment_id", building.getApartmentId());
552
+        building.setInsideArea(building.getInsideArea() == null ? 0d : building.getInsideArea());
479 553
         taBuildingApartmentMapper.update(building,buildingApartmentQueryWrapper);
480 554
 
481 555
         JSONObject jsonobject = JSONObject.parseObject(parameter);
@@ -559,6 +633,19 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
559 633
         if (CollectionUtils.isNotEmpty(buildingList)) {
560 634
             for (TaBuilding build:buildingList) {
561 635
                 getBuildingAttaches(build);
636
+
637
+                // 兼容 3.0/3.5 版本(3.0/3.5 封面取的全是 buildingListImg 的第一张),因为在3.5.1新增了封面图
638
+
639
+                // 获取封面图
640
+                List<TaBuildingImg> buildingListImg = build.getBuildingListImg();
641
+                if (CollectionUtils.isNotEmpty(buildingListImg)) {
642
+                    // 把封面图写入到 BuildingImg 的第一张
643
+                    if (CollectionUtils.isNotEmpty(build.getBuildingImg())) {
644
+                        build.getBuildingImg().add(0, buildingListImg.get(0));
645
+                    }
646
+                }
647
+
648
+
562 649
             }
563 650
         }
564 651
 
@@ -673,6 +760,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
673 760
                 QueryWrapper<TaBuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
674 761
                 buildingImgQueryWrapper.eq("img_id", img.getImgId());
675 762
                 buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
763
+                buildingImgQueryWrapper.orderByAsc("order_no");
676 764
                 return taBuildingImgMapper.selectOne(buildingImgQueryWrapper);
677 765
             }).collect(Collectors.toList());
678 766
 
@@ -689,14 +777,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
689 777
         buildingApartmentQueryWrapper.eq("apartment_id", id);
690 778
         TaBuildingApartment buildingApartment = taBuildingApartmentMapper.selectOne(buildingApartmentQueryWrapper);
691 779
 
692
-        TaBuilding  building= new TaBuilding();
780
+//        TaBuilding  building= new TaBuilding();
693 781
         QueryWrapper<TaBuilding> buildingtWrapper = new QueryWrapper<>();
694 782
         buildingtWrapper.lambda().eq(TaBuilding::getBuildingId,buildingApartment.getBuildingId());
695
-        TaBuilding bui= taBuildingMapper.selectOne(buildingtWrapper);
696
-
697
-        if (bui.getStatus().equals(1)){
698
-            return ResponseBean.error("楼盘已发布不可以删除", ResponseBean.ERROR_UNAVAILABLE);
699
-        }
783
+//        TaBuilding bui= taBuildingMapper.selectOne(buildingtWrapper);
784
+//        if (bui.getStatus().equals(1)){
785
+//            return ResponseBean.error("楼盘已发布不可以删除", ResponseBean.ERROR_UNAVAILABLE);
786
+//        }
700 787
 
701 788
         buildingApartment.setStatus(-1);
702 789
        taBuildingApartmentMapper.update(buildingApartment,buildingApartmentQueryWrapper);
@@ -727,8 +814,8 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
727 814
     }
728 815
 
729 816
     @Override
730
-    public int countNumByHeavy(Integer heavy) {
731
-        return taBuildingMapper.countNumByHeavy(heavy);
817
+    public int countNumByHeavy(Integer heavy, String dynamicId) {
818
+        return taBuildingMapper.countNumByHeavy(heavy, dynamicId);
732 819
     }
733 820
 
734 821
 

+ 2
- 2
src/main/java/com/huiju/estateagents/service/impl/TaGoodsServiceImpl.java 查看文件

@@ -64,11 +64,11 @@ public class TaGoodsServiceImpl extends ServiceImpl<TaGoodsMapper, TaGoods> impl
64 64
 		}
65 65
 
66 66
 		//判断积分是否足够
67
-		if (taPerson.getPoints() < taGoods.getPointPrice()){
67
+		if (null == taPerson.getPoints() || taPerson.getPoints().intValue() < taGoods.getPointPrice()){
68 68
 			return "积分不足,请先获取积分";
69 69
 		}
70 70
 		//判断商品是否够兑换
71
-		if (taGoods.getInventory() < 1){
71
+		if (null == taGoods.getInventory()|| taGoods.getInventory().intValue() < 1){
72 72
 			return "此商品无库存";
73 73
 		}
74 74
 

+ 10
- 2
src/main/java/com/huiju/estateagents/service/impl/TaPersonServiceImpl.java 查看文件

@@ -86,6 +86,9 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
86 86
 
87 87
     @Autowired
88 88
     private TaShareContentService taShareContentService;
89
+    
90
+    @Autowired
91
+    private TaBuildingMapper taBuildingMapper;
89 92
 
90 93
 
91 94
     @Resource
@@ -232,10 +235,13 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
232 235
         // 获取关联项目
233 236
         List<TaPersonBuilding> buildingList = getPersonBuildings(user.getUserId().toString());
234 237
         List<String> buildings = new ArrayList<>();
238
+        TaBuilding taBuilding = new TaBuilding();
235 239
         if (null != buildingList && buildingList.size() > 0) {
236 240
             for(TaPersonBuilding b: buildingList) {
237 241
                 buildings.add(b.getBuildingId());
238 242
             }
243
+            //获取楼盘信息
244
+            taBuilding = taBuildingMapper.selectById(buildingList.get(0).getBuildingId());
239 245
         }
240 246
 
241 247
         Map<String, Object> result = new HashMap<>();
@@ -255,7 +261,8 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
255 261
         result.put("liked", false);
256 262
         result.put("unReadNum", 0);
257 263
         result.put("projects", buildings);
258
-        result.put("address", user.getAddress());
264
+        result.put("address", taBuilding.getAddress());
265
+        result.put("coordinate", taBuilding.getCoordinate());
259 266
         result.put("personTags",person.getPersonTags());
260 267
         result.put("posters",taPosterService.getPostersForTarget(user.getUserId().toString(),CommConstant.POSTER_CONTENT_TYPE_PERSON));
261 268
         result.put("shareContent",taShareContentService.getPostersForTarget(user.getUserId().toString(),CommConstant.POSTER_CONTENT_TYPE_PERSON));
@@ -383,7 +390,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
383 390
         boolean yestodaySigned = null != taPersonSign && DateUtils.sameDay(LocalDateTime.now().minusDays(1), taPersonSign.getSignDate());
384 391
 
385 392
         if (todaySigned) {
386
-            return ResponseBean.error("请不要重复getPersonId(request);", ResponseBean.ERROR_ILLEGAL_PARAMS);
393
+            return ResponseBean.error("请不要重复签到", ResponseBean.ERROR_ILLEGAL_PARAMS);
387 394
         }
388 395
 
389 396
         int durationDays = !yestodaySigned ? 1 : taPersonSign.getDurationDays() + 1;
@@ -447,6 +454,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
447 454
             QueryWrapper<TaUser> userQueryWrapper = new QueryWrapper<>();
448 455
             userQueryWrapper.in("user_id",idLists);
449 456
             userQueryWrapper.eq("is_consultant", true);
457
+            userQueryWrapper.eq("status",CommConstant.STATUS_NORMAL);
450 458
             data = taUserService.page(page,userQueryWrapper);
451 459
         }
452 460
 

+ 55
- 0
src/main/java/com/huiju/estateagents/service/impl/TaPersonVisitRecordServiceImpl.java 查看文件

@@ -2,12 +2,20 @@ package com.huiju.estateagents.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5
+import com.huiju.estateagents.entity.HelpActivity;
6
+import com.huiju.estateagents.entity.TaBuildingDynamic;
7
+import com.huiju.estateagents.entity.TaNews;
5 8
 import com.huiju.estateagents.entity.TaPerson;
6 9
 import com.huiju.estateagents.entity.TaPersonVisitRecord;
7 10
 import com.huiju.estateagents.entity.TaRecommendCustomer;
11
+import com.huiju.estateagents.entity.TaShareActivity;
12
+import com.huiju.estateagents.mapper.HelpActivityMapper;
13
+import com.huiju.estateagents.mapper.TaBuildingDynamicMapper;
14
+import com.huiju.estateagents.mapper.TaNewsMapper;
8 15
 import com.huiju.estateagents.mapper.TaPersonMapper;
9 16
 import com.huiju.estateagents.mapper.TaPersonVisitRecordMapper;
10 17
 import com.huiju.estateagents.mapper.TaRecommendCustomerMapper;
18
+import com.huiju.estateagents.mapper.TaShareActivityMapper;
11 19
 import com.huiju.estateagents.service.ITaPersonVisitRecordService;
12 20
 import org.springframework.beans.factory.annotation.Autowired;
13 21
 import org.springframework.stereotype.Service;
@@ -31,6 +39,18 @@ public class TaPersonVisitRecordServiceImpl extends ServiceImpl<TaPersonVisitRec
31 39
 	@Autowired
32 40
 	private TaPersonVisitRecordMapper personVisitRecordMapper;
33 41
 	
42
+	@Autowired
43
+	private TaBuildingDynamicMapper taBuildingDynamicMapper;
44
+	
45
+	@Autowired
46
+	private TaShareActivityMapper taShareActivityMapper;
47
+	
48
+	@Autowired
49
+	private HelpActivityMapper helpActivityMapper;
50
+	
51
+	@Autowired
52
+	private TaNewsMapper taNewsMapper;
53
+	
34 54
 	/**
35 55
 	 * 分页获取客户访问记录
36 56
 	 *
@@ -42,6 +62,41 @@ public class TaPersonVisitRecordServiceImpl extends ServiceImpl<TaPersonVisitRec
42 62
 	public IPage<TaPersonVisitRecord> getPersonVisitRecordList(IPage<TaPersonVisitRecord> pg, String customerId) {
43 63
 		TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(customerId);
44 64
 		IPage<TaPersonVisitRecord> result = personVisitRecordMapper.getPersonVisitRecordList(pg,taRecommendCustomer.getPersonId());
65
+		List<TaPersonVisitRecord> records = result.getRecords();
66
+		records.forEach(e -> {
67
+			//获取活动标题
68
+			if ("activity".equals(e.getEventType()) && null != e.getTargetId()){
69
+				TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectById(e.getTargetId());
70
+				if (null != taBuildingDynamic){
71
+					e.setActivityName(taBuildingDynamic.getTitle());
72
+				}
73
+				
74
+			}
75
+			//获取拼团标题
76
+			if ("group".equals(e.getEventType()) && null != e.getTargetId()){
77
+				TaShareActivity taShareActivity = taShareActivityMapper.selectById(e.getTargetId());
78
+				if (null != taShareActivity){
79
+					e.setActivityName(taShareActivity.getActivityName());
80
+				}
81
+			}
82
+			//获取助力标题
83
+			if ("help".equals(e.getEventType()) && null != e.getTargetId()){
84
+				HelpActivity helpActivity = helpActivityMapper.selectById(e.getTargetId());
85
+				if (null != helpActivity){
86
+					e.setActivityName(helpActivity.getTitle());
87
+				}
88
+				
89
+			}
90
+			//获取咨询标题
91
+			if ("news".equals(e.getEventType()) && null != e.getTargetId()){
92
+				TaNews taNews = taNewsMapper.selectById(e.getTargetId());
93
+				if (null != taNews){
94
+					e.setActivityName(taNews.getNewsName());
95
+				}
96
+				
97
+			}
98
+		});
99
+		result.setRecords(records);
45 100
 		return result;
46 101
 	}
47 102
 //    @Autowired

+ 46
- 9
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java 查看文件

@@ -179,13 +179,20 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
179 179
         taRecommendCustomer.setSex(params.getInteger("sex"));
180 180
         taRecommendCustomer.setDescribe(params.getString("describe"));
181 181
         taRecommendCustomer.setRecommendPerson(params.getString("recommendPerson"));
182
-        taRecommendCustomer.setBuildingId(params.getString("buildingId"));
182
+        taRecommendCustomer.setBuildingId(params.getString("intention"));
183 183
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
184 184
         taRecommendCustomer.setReportRecommendStatus(CommConstant.RECOMMENDED);
185 185
         taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_READY);
186 186
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
187 187
         taRecommendCustomer.setReportDate(LocalDateTime.now());
188 188
         taRecommendCustomer.setOrgId(orgId);
189
+       QueryWrapper<TaPerson> personQueryWrapper = new QueryWrapper<>();
190
+       personQueryWrapper.eq("org_id",orgId);
191
+       personQueryWrapper.eq("phone",params.getString("phone"));
192
+        TaPerson currentPerson = taPersonMapper.selectOne(personQueryWrapper);
193
+        if(null != currentPerson){
194
+            taRecommendCustomer.setPersonId(currentPerson.getPersonId());
195
+        }
189 196
 
190 197
         // 时间格式 yyyy-MM-dd
191 198
         String at = params.getString("appointmentTime");
@@ -220,6 +227,7 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
220 227
         QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
221 228
         queryWrapper.eq("phone", taRecommendCustomer.getPhone());
222 229
         queryWrapper.eq("building_id",taRecommendCustomer.getBuildingId());
230
+        queryWrapper.in("verify_status",CommConstant.VERIFY_AGREE,CommConstant.VERIFY_READY);
223 231
         List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
224 232
         if (null != result && result.size() > 0) {
225 233
             return ResponseBean.error("当前客户已被推荐, 不能再次推荐", ResponseBean.ERROR_ILLEGAL_PARAMS);
@@ -268,6 +276,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
268 276
 //        taRecommendCustomer.setDescribe(params.getString("describe"));
269 277
         taRecommendCustomer.setRealtyConsultant(params.getString("realtyConsultant"));
270 278
         taRecommendCustomer.setBuildingId(params.getString("buildingId"));
279
+        TaBuilding building = taBuildingMapper.selectById(params.getString("buildingId"));
280
+        taRecommendCustomer.setIntention(building.getBuildingName());
271 281
         taRecommendCustomer.setReportRecommendStatus(CommConstant.VERIFY_AGREE);
272 282
         taRecommendCustomer.setCreateDate(LocalDateTime.now());
273 283
         taRecommendCustomer.setReportDate(LocalDateTime.now());
@@ -288,6 +298,13 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
288 298
         taRecommendCustomer.setEntryType(CommConstant.ENTRY_VERIFY);
289 299
         taRecommendCustomer.setVerifyStatus(CommConstant.VERIFY_AGREE);
290 300
         taRecommendCustomer.setStatus(CommConstant.CUSTOMER_REPORT);
301
+        QueryWrapper<TaPerson> personQueryWrapper = new QueryWrapper<>();
302
+        personQueryWrapper.eq("org_id",orgId);
303
+        personQueryWrapper.eq("phone",params.getString("phone"));
304
+        TaPerson currentPerson = taPersonMapper.selectOne(personQueryWrapper);
305
+        if(null != currentPerson){
306
+            taRecommendCustomer.setPersonId(currentPerson.getPersonId());
307
+        }
291 308
 
292 309
 
293 310
 //        String status = params.getString("status");
@@ -298,12 +315,29 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
298 315
 
299 316
         // 报备有 10 天有效期
300 317
         QueryWrapper<TaRecommendCustomer> queryWrapper = new QueryWrapper<>();
301
-        queryWrapper.eq("name", taRecommendCustomer.getName());
302 318
         queryWrapper.eq("phone", taRecommendCustomer.getPhone());
303 319
         queryWrapper.eq("building_id",taRecommendCustomer.getBuildingId());
320
+        queryWrapper.in("verify_status",CommConstant.VERIFY_AGREE,CommConstant.VERIFY_READY);
304 321
         List<TaRecommendCustomer> result = taRecommendCustomerMapper.selectList(queryWrapper);
305 322
         if (null != result && result.size() > 0) {
306
-            return ResponseBean.error("当前客户已被报备, 不能再次报备", ResponseBean.ERROR_ILLEGAL_PARAMS);
323
+            String conName = "";
324
+            TaPerson conPerson = taPersonMapper.selectById(result.get(0).getRealtyConsultant());
325
+            if (null != conPerson){
326
+                if(params.getString("realtyConsultant").equals(conPerson.getPersonId())){
327
+                   return  ResponseBean.success("bound");
328
+                }
329
+                conName = conPerson.getName();
330
+            }else {
331
+                TaUser conUser = userService.getById(result.get(0).getRealtyConsultant());
332
+                if(null != conUser){
333
+                    if(params.getString("realtyConsultant").equals(conUser.getUserId().toString())){
334
+                        return ResponseBean.success("bound");
335
+                    }
336
+                    conName = conUser.getUserName();
337
+
338
+                }
339
+            }
340
+            return ResponseBean.error("您在当前项目的置业顾问是:"+conName, ResponseBean.ERROR_ILLEGAL_PARAMS);
307 341
         }
308 342
 
309 343
         int row = taRecommendCustomerMapper.insert(taRecommendCustomer);
@@ -463,7 +497,10 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
463 497
             }else {
464 498
                 user = userService.getById(consultant.getUserId());
465 499
             }
466
-            user.setProjects(taPersonMapper.getUserProjects(user.getUserId()));
500
+            List<String> projects = taPersonMapper.getUserProjects(user.getUserId());
501
+            if (projects.size()>0){
502
+                user.setProjects(projects);
503
+            }
467 504
             taRecommendCustomer.setConsultant(user);
468 505
         }
469 506
         return taRecommendCustomer;
@@ -493,12 +530,12 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
493 530
         QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
494 531
         // todo
495 532
         // 此处可能不是 person_id 而是 recommend_person
496
-        queryWrapper.eq("recommend_person",customerId);
497
-//        queryWrapper.eq("building_id",building);
498
-        queryWrapper.eq("status", CommConstant.VERIFY_AGREE);
499
-        queryWrapper.eq("org_id", orgId);
500 533
         IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
501
-        return taRecommendCustomerMapper.selectPage(page,queryWrapper);
534
+//        queryWrapper.eq("recommend_person",customerId);
535
+////        queryWrapper.eq("building_id",building);
536
+//        queryWrapper.eq("status", CommConstant.VERIFY_AGREE);
537
+//        queryWrapper.eq("org_id", orgId);
538
+        return taRecommendCustomerMapper.getCustomersIRecommended(page,customerId,CommConstant.STATUS_NORMAL,orgId);
502 539
     }
503 540
 
504 541
     @Override

+ 3
- 0
src/main/java/com/huiju/estateagents/service/impl/TaUvServiceImpl.java 查看文件

@@ -54,6 +54,9 @@ public class TaUvServiceImpl extends ServiceImpl<TaUvMapper, TaUv> implements IT
54 54
         if (null != uvs && uvs.size() > 0) {
55 55
             for(int i=0;i<uvs.size();i++){
56 56
                 uvs.get(i).setCreateDate(LocalDateTime.now());
57
+                uvs.get(i).setNameOrnick(taPerson.getNickname());
58
+                uvs.get(i).setPersonId(taPerson.getPersonId());
59
+                uvs.get(i).setPhotoOravatar(taPerson.getAvatarurl());
57 60
             }
58 61
             if(this.updateBatchById(uvs)){
59 62
                 return ResponseBean.success("");

+ 41
- 0
src/main/java/com/huiju/estateagents/service/impl/TdCityServiceImpl.java 查看文件

@@ -1,11 +1,16 @@
1 1
 package com.huiju.estateagents.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
3 5
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.huiju.estateagents.common.CommConstant;
4 7
 import com.huiju.estateagents.entity.TdCity;
8
+import com.huiju.estateagents.mapper.TaOrgCityMapper;
5 9
 import com.huiju.estateagents.mapper.TdCityMapper;
6 10
 import com.huiju.estateagents.service.ITdCityService;
7 11
 import org.springframework.beans.factory.annotation.Autowired;
8 12
 import org.springframework.stereotype.Service;
13
+import org.springframework.web.client.RestTemplate;
9 14
 
10 15
 import java.util.List;
11 16
 
@@ -26,4 +31,40 @@ public class TdCityServiceImpl extends ServiceImpl<TdCityMapper, TdCity> impleme
26 31
         return tdCityMapper.selectCity(leveltype, status);
27 32
     }
28 33
 
34
+
35
+    @Override
36
+    public List<TdCity> selectWxCity(String leveltype, Integer orgId) {
37
+        List<TdCity>  tdCityList= tdCityMapper.selectWxCity(orgId);
38
+        return tdCityList;
39
+    }
40
+    
41
+    /**
42
+     * 根据经纬度获取城市详情信息
43
+     *
44
+     * @param location
45
+     * @return
46
+     */
47
+    @Override
48
+    public TdCity getLocationCity(String location) {
49
+        //获取高德地图的坐标
50
+        String amapString = CommConstant.AMAP_HTTP + "?location="+location+"&key=" + CommConstant.AMAP_KEY;
51
+        RestTemplate restTemplate = new RestTemplate();
52
+        String forObject = restTemplate.getForObject(amapString, String.class);
53
+        JSONObject jsonObject = JSONObject.parseObject(forObject);
54
+        //返回城市信息
55
+        if (jsonObject.getString("status").equals("1")){
56
+            JSONObject addressComponent = jsonObject.getJSONObject("regeocode").getJSONObject("addressComponent");
57
+            String citycode = addressComponent.getString("citycode");
58
+            QueryWrapper<TdCity> queryWrapper = new QueryWrapper<>();
59
+            queryWrapper.eq("citycode",citycode);
60
+            queryWrapper.eq("leveltype",2);
61
+            List<TdCity> tdCities = tdCityMapper.selectList(queryWrapper);
62
+            if (tdCities.size() > 0){
63
+                return tdCities.get(0);
64
+            }
65
+            return null;
66
+        }
67
+        return null;
68
+    }
69
+    
29 70
 }

+ 8
- 4
src/main/java/com/huiju/estateagents/statistic/controller/TaCustomerFollowUpRecordController.java 查看文件

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
21 21
 import org.springframework.web.bind.annotation.RestController;
22 22
 
23 23
 import javax.servlet.http.HttpServletRequest;
24
+import java.time.LocalDateTime;
24 25
 import java.util.List;
25 26
 
26 27
 /**
@@ -171,6 +172,8 @@ public class TaCustomerFollowUpRecordController extends BaseController {
171 172
         TaPerson person = taPersons.get(0);
172 173
         try {
173 174
             taCustomerFollowUpRecord.setFollowerId(person.getPersonId());
175
+            taCustomerFollowUpRecord.setCreateDate(LocalDateTime.now());
176
+            taCustomerFollowUpRecord.setOrgId(orgId);
174 177
             if (iTaCustomerFollowUpRecordService.save(taCustomerFollowUpRecord)){
175 178
                 responseBean.addSuccess(taCustomerFollowUpRecord);
176 179
             }else {
@@ -186,14 +189,14 @@ public class TaCustomerFollowUpRecordController extends BaseController {
186 189
     
187 190
     /**
188 191
      * 分页查询跟进记录列表
189
-     * @param pageNum
192
+     * @param pageNumber
190 193
      * @param pageSize
191 194
      * @return
192 195
      */
193 196
     @RequestMapping(value="/wx/taCustomerFollowUpRecord",method= RequestMethod.GET)
194
-    public ResponseBean wxCustomerFollowUpRecordList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
197
+    public ResponseBean wxCustomerFollowUpRecordList(@RequestParam(value ="pageNumber",defaultValue = "1") Integer pageNumber,
195 198
                                                      @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
196
-                                                     @RequestParam(value ="customerId",required = true) Integer customerId,
199
+                                                     @RequestParam(value ="customerId",required = true) String customerId,
197 200
                                                      HttpServletRequest request){
198 201
         ResponseBean responseBean = new ResponseBean();
199 202
         String openid = getOpenId(request);
@@ -205,7 +208,7 @@ public class TaCustomerFollowUpRecordController extends BaseController {
205 208
         TaPerson person = taPersons.get(0);
206 209
         try {
207 210
             //使用分页插件
208
-            IPage<TaCustomerFollowUpRecord> pg = new Page<>(pageNum, pageSize);
211
+            IPage<TaCustomerFollowUpRecord> pg = new Page<>(pageNumber, pageSize);
209 212
             QueryWrapper<TaCustomerFollowUpRecord> queryWrapper = new QueryWrapper<>();
210 213
             queryWrapper.eq("follower_id",person.getPersonId());
211 214
             queryWrapper.eq("org_id",orgId);
@@ -222,3 +225,4 @@ public class TaCustomerFollowUpRecordController extends BaseController {
222 225
         return responseBean;
223 226
     }
224 227
 }
228
+

src/main/java/com/huiju/estateagents/statistic/controller/TaCustomerGenderStatisticController.java → src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerGenderStatisticController.java 查看文件

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
-import com.huiju.estateagents.statistic.entity.TaCustomerGenderStatistic;
9
-import com.huiju.estateagents.statistic.service.ITaCustomerGenderStatisticService;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
10
+import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
11
+import com.huiju.estateagents.statistic.service.ITsCustomerGenderStatisticService;
10 12
 import org.slf4j.Logger;
11 13
 import org.slf4j.LoggerFactory;
12 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,12 +33,15 @@ import java.util.List;
31 33
  */
32 34
 @RestController
33 35
 @RequestMapping("/api")
34
-public class TaCustomerGenderStatisticController extends BaseController {
36
+public class TsCustomerGenderStatisticController extends BaseController {
35 37
 
36
-    private final Logger logger = LoggerFactory.getLogger(TaCustomerGenderStatisticController.class);
38
+    private final Logger logger = LoggerFactory.getLogger(TsCustomerGenderStatisticController.class);
37 39
 
38 40
     @Autowired
39
-    public ITaCustomerGenderStatisticService iTaCustomerGenderStatisticService;
41
+    public ITsCustomerGenderStatisticService iTaCustomerGenderStatisticService;
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
40 45
 
41 46
 
42 47
     /**
@@ -51,11 +56,11 @@ public class TaCustomerGenderStatisticController extends BaseController {
51 56
         ResponseBean responseBean = new ResponseBean();
52 57
         try {
53 58
             //使用分页插件
54
-		    IPage<TaCustomerGenderStatistic> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
59
+		    IPage<TsCustomerGenderStatistic> pg = new Page<>(pageNum, pageSize);
60
+            QueryWrapper<TsCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
56 61
             queryWrapper.orderByDesc("create_date");
57 62
 
58
-            IPage<TaCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.page(pg, queryWrapper);
63
+            IPage<TsCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.page(pg, queryWrapper);
59 64
             responseBean.addSuccess(result);
60 65
         }catch (Exception e){
61 66
             e.printStackTrace();
@@ -71,7 +76,7 @@ public class TaCustomerGenderStatisticController extends BaseController {
71 76
      * @return
72 77
      */
73 78
     @RequestMapping(value="/taCustomerGenderStatistic",method= RequestMethod.POST)
74
-    public ResponseBean taCustomerGenderStatisticAdd(@RequestBody TaCustomerGenderStatistic taCustomerGenderStatistic){
79
+    public ResponseBean taCustomerGenderStatisticAdd(@RequestBody TsCustomerGenderStatistic taCustomerGenderStatistic){
75 80
         ResponseBean responseBean = new ResponseBean();
76 81
         try {
77 82
             if (iTaCustomerGenderStatisticService.save(taCustomerGenderStatistic)){
@@ -117,7 +122,7 @@ public class TaCustomerGenderStatisticController extends BaseController {
117 122
      */
118 123
     @RequestMapping(value="/taCustomerGenderStatistic/{id}",method= RequestMethod.PUT)
119 124
     public ResponseBean taCustomerGenderStatisticUpdate(@PathVariable Integer id,
120
-                                        @RequestBody TaCustomerGenderStatistic taCustomerGenderStatistic){
125
+                                        @RequestBody TsCustomerGenderStatistic taCustomerGenderStatistic){
121 126
         ResponseBean responseBean = new ResponseBean();
122 127
         try {
123 128
             if (iTaCustomerGenderStatisticService.updateById(taCustomerGenderStatistic)){
@@ -158,13 +163,20 @@ public class TaCustomerGenderStatisticController extends BaseController {
158 163
     public ResponseBean wxCustomerGenderStatisticList(@PathVariable(value = "customerType") String customerType, HttpServletRequest request){
159 164
         ResponseBean responseBean = new ResponseBean();
160 165
         try {
161
-            //查询当前小程序的男女比统计
162
-            QueryWrapper<TaCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
166
+            String openid = getOpenId(request);
167
+            List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
168
+            if (null == taPersons || taPersons.size() != 1) {
169
+                return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
170
+            }
171
+            TaPerson person = taPersons.get(0);
172
+            //查询当前小程序的当前置业顾问男女比统计
173
+            QueryWrapper<TsCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
163 174
             queryWrapper.eq("org_id",getOrgId(request));
164 175
             queryWrapper.eq("customer_type",customerType);
176
+            queryWrapper.eq("realty_consultant",person.getPersonId());
165 177
             queryWrapper.orderByDesc("create_date");
166 178
      
167
-            List<TaCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.list(queryWrapper);
179
+            List<TsCustomerGenderStatistic> result = iTaCustomerGenderStatisticService.list(queryWrapper);
168 180
             responseBean.addSuccess(result);
169 181
         }catch (Exception e){
170 182
             e.printStackTrace();

src/main/java/com/huiju/estateagents/statistic/controller/TaCustomerStatisticDailyController.java → src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticDailyController.java 查看文件

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily;
9
-import com.huiju.estateagents.statistic.service.ITaCustomerStatisticDailyService;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
10
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
11
+import com.huiju.estateagents.statistic.service.ITsCustomerStatisticDailyService;
10 12
 import org.slf4j.Logger;
11 13
 import org.slf4j.LoggerFactory;
12 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,13 +33,15 @@ import java.util.List;
31 33
  */
32 34
 @RestController
33 35
 @RequestMapping("/api")
34
-public class TaCustomerStatisticDailyController extends BaseController {
36
+public class TsCustomerStatisticDailyController extends BaseController {
35 37
 
36
-    private final Logger logger = LoggerFactory.getLogger(TaCustomerStatisticDailyController.class);
38
+    private final Logger logger = LoggerFactory.getLogger(TsCustomerStatisticDailyController.class);
37 39
 
38 40
     @Autowired
39
-    public ITaCustomerStatisticDailyService iTaCustomerStatisticDailyService;
40
-
41
+    public ITsCustomerStatisticDailyService iTaCustomerStatisticDailyService;
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
41 45
 
42 46
     /**
43 47
      * 分页查询列表
@@ -51,11 +55,11 @@ public class TaCustomerStatisticDailyController extends BaseController {
51 55
         ResponseBean responseBean = new ResponseBean();
52 56
         try {
53 57
             //使用分页插件
54
-		    IPage<TaCustomerStatisticDaily> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaCustomerStatisticDaily> queryWrapper = new QueryWrapper<>();
58
+		    IPage<TsCustomerStatisticDaily> pg = new Page<>(pageNum, pageSize);
59
+            QueryWrapper<TsCustomerStatisticDaily> queryWrapper = new QueryWrapper<>();
56 60
             queryWrapper.orderByDesc("create_date");
57 61
 
58
-            IPage<TaCustomerStatisticDaily> result = iTaCustomerStatisticDailyService.page(pg, queryWrapper);
62
+            IPage<TsCustomerStatisticDaily> result = iTaCustomerStatisticDailyService.page(pg, queryWrapper);
59 63
             responseBean.addSuccess(result);
60 64
         }catch (Exception e){
61 65
             e.printStackTrace();
@@ -71,7 +75,7 @@ public class TaCustomerStatisticDailyController extends BaseController {
71 75
      * @return
72 76
      */
73 77
     @RequestMapping(value="/taCustomerStatisticDaily",method= RequestMethod.POST)
74
-    public ResponseBean taCustomerStatisticDailyAdd(@RequestBody TaCustomerStatisticDaily taCustomerStatisticDaily){
78
+    public ResponseBean taCustomerStatisticDailyAdd(@RequestBody TsCustomerStatisticDaily taCustomerStatisticDaily){
75 79
         ResponseBean responseBean = new ResponseBean();
76 80
         try {
77 81
             if (iTaCustomerStatisticDailyService.save(taCustomerStatisticDaily)){
@@ -117,7 +121,7 @@ public class TaCustomerStatisticDailyController extends BaseController {
117 121
      */
118 122
     @RequestMapping(value="/taCustomerStatisticDaily/{id}",method= RequestMethod.PUT)
119 123
     public ResponseBean taCustomerStatisticDailyUpdate(@PathVariable Integer id,
120
-                                        @RequestBody TaCustomerStatisticDaily taCustomerStatisticDaily){
124
+                                        @RequestBody TsCustomerStatisticDaily taCustomerStatisticDaily){
121 125
         ResponseBean responseBean = new ResponseBean();
122 126
         try {
123 127
             if (iTaCustomerStatisticDailyService.updateById(taCustomerStatisticDaily)){
@@ -159,8 +163,14 @@ public class TaCustomerStatisticDailyController extends BaseController {
159 163
     public ResponseBean wxCustomerStatisticDailyList(@PathVariable(value = "customerType") String customerType,
160 164
                                                      HttpServletRequest request){
161 165
         ResponseBean responseBean = new ResponseBean();
166
+        String openid = getOpenId(request);
167
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
168
+        if (null == taPersons || taPersons.size() != 1) {
169
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
170
+        }
171
+        TaPerson person = taPersons.get(0);
162 172
         try {
163
-            List<TaCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request));
173
+            List<TsCustomerStatisticDaily> list = iTaCustomerStatisticDailyService.getDailyList(customerType,getOrgId(request),person.getPersonId(),person.getUserId());
164 174
             responseBean.addSuccess(list);
165 175
         }catch (Exception e){
166 176
             e.printStackTrace();

src/main/java/com/huiju/estateagents/statistic/controller/TaCustomerStatisticMonthlyController.java → src/main/java/com/huiju/estateagents/statistic/controller/TsCustomerStatisticMonthlyController.java 查看文件

@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.huiju.estateagents.base.BaseController;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly;
9
-import com.huiju.estateagents.statistic.service.ITaCustomerStatisticMonthlyService;
8
+import com.huiju.estateagents.entity.TaPerson;
9
+import com.huiju.estateagents.service.ITaPersonService;
10
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
11
+import com.huiju.estateagents.statistic.service.ITsCustomerStatisticMonthlyService;
10 12
 import org.slf4j.Logger;
11 13
 import org.slf4j.LoggerFactory;
12 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,14 +33,16 @@ import java.util.List;
31 33
  */
32 34
 @RestController
33 35
 @RequestMapping("/api")
34
-public class TaCustomerStatisticMonthlyController extends BaseController {
36
+public class TsCustomerStatisticMonthlyController extends BaseController {
35 37
 
36
-    private final Logger logger = LoggerFactory.getLogger(TaCustomerStatisticMonthlyController.class);
38
+    private final Logger logger = LoggerFactory.getLogger(TsCustomerStatisticMonthlyController.class);
37 39
 
38 40
     @Autowired
39
-    public ITaCustomerStatisticMonthlyService iTaCustomerStatisticMonthlyService;
40
-
41
-
41
+    public ITsCustomerStatisticMonthlyService iTaCustomerStatisticMonthlyService;
42
+    
43
+    @Autowired
44
+    private ITaPersonService taPersonService;
45
+    
42 46
     /**
43 47
      * 分页查询列表
44 48
      * @param pageNum
@@ -51,11 +55,11 @@ public class TaCustomerStatisticMonthlyController extends BaseController {
51 55
         ResponseBean responseBean = new ResponseBean();
52 56
         try {
53 57
             //使用分页插件
54
-		    IPage<TaCustomerStatisticMonthly> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaCustomerStatisticMonthly> queryWrapper = new QueryWrapper<>();
58
+		    IPage<TsCustomerStatisticMonthly> pg = new Page<>(pageNum, pageSize);
59
+            QueryWrapper<TsCustomerStatisticMonthly> queryWrapper = new QueryWrapper<>();
56 60
             queryWrapper.orderByDesc("create_date");
57 61
 
58
-            IPage<TaCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.page(pg, queryWrapper);
62
+            IPage<TsCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.page(pg, queryWrapper);
59 63
             responseBean.addSuccess(result);
60 64
         }catch (Exception e){
61 65
             e.printStackTrace();
@@ -71,7 +75,7 @@ public class TaCustomerStatisticMonthlyController extends BaseController {
71 75
      * @return
72 76
      */
73 77
     @RequestMapping(value="/taCustomerStatisticMonthly",method= RequestMethod.POST)
74
-    public ResponseBean taCustomerStatisticMonthlyAdd(@RequestBody TaCustomerStatisticMonthly taCustomerStatisticMonthly){
78
+    public ResponseBean taCustomerStatisticMonthlyAdd(@RequestBody TsCustomerStatisticMonthly taCustomerStatisticMonthly){
75 79
         ResponseBean responseBean = new ResponseBean();
76 80
         try {
77 81
             if (iTaCustomerStatisticMonthlyService.save(taCustomerStatisticMonthly)){
@@ -117,7 +121,7 @@ public class TaCustomerStatisticMonthlyController extends BaseController {
117 121
      */
118 122
     @RequestMapping(value="/taCustomerStatisticMonthly/{id}",method= RequestMethod.PUT)
119 123
     public ResponseBean taCustomerStatisticMonthlyUpdate(@PathVariable Integer id,
120
-                                        @RequestBody TaCustomerStatisticMonthly taCustomerStatisticMonthly){
124
+                                        @RequestBody TsCustomerStatisticMonthly taCustomerStatisticMonthly){
121 125
         ResponseBean responseBean = new ResponseBean();
122 126
         try {
123 127
             if (iTaCustomerStatisticMonthlyService.updateById(taCustomerStatisticMonthly)){
@@ -159,9 +163,15 @@ public class TaCustomerStatisticMonthlyController extends BaseController {
159 163
     public ResponseBean taCustomerStatisticMonthlyList(@PathVariable(value = "customerType") String customerType,
160 164
                                                        HttpServletRequest request){
161 165
         ResponseBean responseBean = new ResponseBean();
166
+        String openid = getOpenId(request);
167
+        List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
168
+        if (null == taPersons || taPersons.size() != 1) {
169
+            return ResponseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
170
+        }
171
+        TaPerson person = taPersons.get(0);
162 172
         try {
163 173
             //查询月客户分析数据
164
-            List<TaCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.getCustomerMonthlyList(customerType, getOrgId(request));
174
+            List<TsCustomerStatisticMonthly> result = iTaCustomerStatisticMonthlyService.getCustomerMonthlyList(customerType, getOrgId(request),person.getPersonId(),person.getUserId());
165 175
             responseBean.addSuccess(result);
166 176
         }catch (Exception e){
167 177
             e.printStackTrace();

+ 2
- 0
src/main/java/com/huiju/estateagents/statistic/entity/GenderStatistic.java 查看文件

@@ -24,4 +24,6 @@ public class GenderStatistic {
24 24
 	private Integer unknownSum;
25 25
 	
26 26
 	private BigDecimal unknownPct;
27
+	
28
+	private String realtyConsultant;
27 29
 }

src/main/java/com/huiju/estateagents/statistic/entity/TaCustomerGenderStatistic.java → src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerGenderStatistic.java 查看文件

@@ -21,7 +21,7 @@ import java.time.LocalDateTime;
21 21
 @Data
22 22
 @EqualsAndHashCode(callSuper = false)
23 23
 @Accessors(chain = true)
24
-public class TaCustomerGenderStatistic implements Serializable {
24
+public class TsCustomerGenderStatistic implements Serializable {
25 25
 
26 26
     private static final long serialVersionUID = 1L;
27 27
 
@@ -65,4 +65,9 @@ public class TaCustomerGenderStatistic implements Serializable {
65 65
      * 客户类型 visite 到访客户, new 新增客户 ,follow跟进客户
66 66
      */
67 67
     private String customerType;
68
+    
69
+    /**
70
+     * 置业顾问ID
71
+     */
72
+    private String realtyConsultant;
68 73
 }

src/main/java/com/huiju/estateagents/statistic/entity/TaCustomerStatisticDaily.java → src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticDaily.java 查看文件

@@ -21,8 +21,8 @@ import java.time.LocalDateTime;
21 21
 @Data
22 22
 @EqualsAndHashCode(callSuper = false)
23 23
 @Accessors(chain = true)
24
-@TableName("ta_customer_statistic_daily")
25
-public class TaCustomerStatisticDaily implements Serializable {
24
+@TableName("ts_customer_statistic_daily")
25
+public class TsCustomerStatisticDaily implements Serializable {
26 26
 
27 27
     private static final long serialVersionUID = 1L;
28 28
 
@@ -51,6 +51,14 @@ public class TaCustomerStatisticDaily implements Serializable {
51 51
      * 创建时间
52 52
      */
53 53
     private LocalDateTime createDate;
54
-
55
-
54
+    
55
+    /**
56
+     * 日期 格式yyyymmdd例20191111
57
+     */
58
+    private String day;
59
+    
60
+    /**
61
+     * 置业顾问ID
62
+     */
63
+    private String realtyConsultant;
56 64
 }

src/main/java/com/huiju/estateagents/statistic/entity/TaCustomerStatisticMonthly.java → src/main/java/com/huiju/estateagents/statistic/entity/TsCustomerStatisticMonthly.java 查看文件

@@ -21,8 +21,8 @@ import java.time.LocalDateTime;
21 21
 @Data
22 22
 @EqualsAndHashCode(callSuper = false)
23 23
 @Accessors(chain = true)
24
-@TableName("ta_customer_statistic_monthly")
25
-public class TaCustomerStatisticMonthly implements Serializable {
24
+@TableName("ts_customer_statistic_monthly")
25
+public class TsCustomerStatisticMonthly implements Serializable {
26 26
 
27 27
     private static final long serialVersionUID = 1L;
28 28
 
@@ -61,6 +61,9 @@ public class TaCustomerStatisticMonthly implements Serializable {
61 61
      * 更新时间
62 62
      */
63 63
     private LocalDateTime updateDate;
64
-
65
-
64
+    
65
+    /**
66
+     * 置业顾问ID
67
+     */
68
+    private String realtyConsultant;
66 69
 }

src/main/java/com/huiju/estateagents/statistic/mapper/TaCustomerGenderStatisticMapper.java → src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerGenderStatisticMapper.java 查看文件

@@ -2,11 +2,12 @@ package com.huiju.estateagents.statistic.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.huiju.estateagents.statistic.entity.GenderStatistic;
5
-import com.huiju.estateagents.statistic.entity.TaCustomerGenderStatistic;
5
+import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
6 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
7 8
 
9
+import java.time.LocalDateTime;
8 10
 import java.util.List;
9
-import java.util.Map;
10 11
 
11 12
 /**
12 13
  * <p>
@@ -17,13 +18,14 @@ import java.util.Map;
17 18
  * @since 2019-11-08
18 19
  */
19 20
 @Mapper
20
-public interface TaCustomerGenderStatisticMapper extends BaseMapper<TaCustomerGenderStatistic> {
21
+public interface TsCustomerGenderStatisticMapper extends BaseMapper<TsCustomerGenderStatistic> {
21 22
 	
22 23
 	/**
23 24
 	 * 获取新增客户的男女性别比
24 25
 	 * @return
26
+	 * @param nowDate
25 27
 	 */
26
-	List<GenderStatistic> getNewCustomerSexCount();
28
+	List<GenderStatistic> getNewCustomerSexCount(@Param("nowDate") LocalDateTime nowDate);
27 29
 	
28 30
 	/**
29 31
 	 * 获取跟进客户的男女性别比

src/main/java/com/huiju/estateagents/statistic/mapper/TaCustomerStatisticDailyMapper.java → src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticDailyMapper.java 查看文件

@@ -1,13 +1,12 @@
1 1
 package com.huiju.estateagents.statistic.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily;
4
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8 8
 import java.time.LocalDateTime;
9 9
 import java.util.List;
10
-import java.util.Map;
11 10
 
12 11
 /**
13 12
  * <p>
@@ -18,14 +17,14 @@ import java.util.Map;
18 17
  * @since 2019-11-08
19 18
  */
20 19
 @Mapper
21
-public interface TaCustomerStatisticDailyMapper extends BaseMapper<TaCustomerStatisticDaily> {
20
+public interface TsCustomerStatisticDailyMapper extends BaseMapper<TsCustomerStatisticDaily> {
22 21
 	
23 22
 	/**
24 23
 	 * 获取当天跟进客户数
25 24
 	 * @param nowDate
26 25
 	 * @return
27 26
 	 */
28
-	List<TaCustomerStatisticDaily> getFollowUpData(@Param("nowDate") LocalDateTime nowDate);
27
+	List<TsCustomerStatisticDaily> getFollowUpData(@Param("nowDate") LocalDateTime nowDate);
29 28
 	
30 29
 	/**
31 30
 	 * 获取当天新增客户数
@@ -33,7 +32,7 @@ public interface TaCustomerStatisticDailyMapper extends BaseMapper<TaCustomerSta
33 32
 	 * @param status
34 33
 	 * @return
35 34
 	 */
36
-	List<TaCustomerStatisticDaily> getNewCustomerData(@Param("nowDate") LocalDateTime nowDate,@Param("status") int status);
35
+	List<TsCustomerStatisticDaily> getNewCustomerData(@Param("nowDate") LocalDateTime nowDate, @Param("status") int status);
37 36
 	
38 37
 	/**
39 38
 	 * 获取当天到访客户数
@@ -41,7 +40,7 @@ public interface TaCustomerStatisticDailyMapper extends BaseMapper<TaCustomerSta
41 40
 	 * @param checkin
42 41
 	 * @return
43 42
 	 */
44
-	List<TaCustomerStatisticDaily> getVisiteCustomerData(@Param("nowDate") LocalDateTime nowDate,@Param("checkin") int checkin);
43
+	List<TsCustomerStatisticDaily> getVisiteCustomerData(@Param("nowDate") LocalDateTime nowDate, @Param("checkin") int checkin);
45 44
 	
46 45
 	/**
47 46
 	 * 获取31天的统计数据
@@ -49,9 +48,11 @@ public interface TaCustomerStatisticDailyMapper extends BaseMapper<TaCustomerSta
49 48
 	 * @param orgId
50 49
 	 * @param nowDate
51 50
 	 * @param beforeDate
51
+	 * @param personId
52
+	 * @param userId
52 53
 	 * @return
53 54
 	 */
54
-	List<TaCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType,@Param("orgId")  Integer orgId,@Param("nowDate")  LocalDateTime nowDate,@Param("beforeDate")  LocalDateTime beforeDate);
55
+	List<TsCustomerStatisticDaily> getDailyList(@Param("customerType") String customerType, @Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate, @Param("beforeDate") LocalDateTime beforeDate, @Param("personId") String personId,@Param("userId") Integer userId);
55 56
 	
56 57
 	int deleteNowDate(@Param("nowDate") LocalDateTime nowDate,@Param("customerType") String customerType);
57 58
 }

src/main/java/com/huiju/estateagents/statistic/mapper/TaCustomerStatisticMonthlyMapper.java → src/main/java/com/huiju/estateagents/statistic/mapper/TsCustomerStatisticMonthlyMapper.java 查看文件

@@ -1,7 +1,7 @@
1 1
 package com.huiju.estateagents.statistic.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly;
4
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
@@ -17,7 +17,7 @@ import java.util.List;
17 17
  * @since 2019-11-08
18 18
  */
19 19
 @Mapper
20
-public interface TaCustomerStatisticMonthlyMapper extends BaseMapper<TaCustomerStatisticMonthly> {
20
+public interface TsCustomerStatisticMonthlyMapper extends BaseMapper<TsCustomerStatisticMonthly> {
21 21
 	
22 22
 	/**
23 23
 	 * 获取一个月新增客户的数据插入
@@ -25,14 +25,14 @@ public interface TaCustomerStatisticMonthlyMapper extends BaseMapper<TaCustomerS
25 25
 	 * @param status
26 26
 	 * @return
27 27
 	 */
28
-	List<TaCustomerStatisticMonthly> getNewCustomerStatisticMonthly(@Param("nowDate") LocalDateTime nowDate,@Param("status") int status);
28
+	List<TsCustomerStatisticMonthly> getNewCustomerStatisticMonthly(@Param("nowDate") LocalDateTime nowDate, @Param("status") int status);
29 29
 	
30 30
 	/**
31 31
 	 * 获取一个月跟进客户数据插入
32 32
 	 * @param nowDate
33 33
 	 * @return
34 34
 	 */
35
-	List<TaCustomerStatisticMonthly> getFollowUpStatisticMonthly(@Param("nowDate") LocalDateTime nowDate);
35
+	List<TsCustomerStatisticMonthly> getFollowUpStatisticMonthly(@Param("nowDate") LocalDateTime nowDate);
36 36
 	
37 37
 	/**
38 38
 	 * 获取一个月访问客户数据插入
@@ -40,7 +40,7 @@ public interface TaCustomerStatisticMonthlyMapper extends BaseMapper<TaCustomerS
40 40
 	 * @param checkin
41 41
 	 * @return
42 42
 	 */
43
-	List<TaCustomerStatisticMonthly> getVisiteStatisticMonthly(@Param("nowDate") LocalDateTime nowDate,@Param("checkin") int checkin);
43
+	List<TsCustomerStatisticMonthly> getVisiteStatisticMonthly(@Param("nowDate") LocalDateTime nowDate, @Param("checkin") int checkin);
44 44
 	
45 45
 	/**
46 46
 	 * 获取12个月的统计数据
@@ -48,7 +48,9 @@ public interface TaCustomerStatisticMonthlyMapper extends BaseMapper<TaCustomerS
48 48
 	 * @param orgId
49 49
 	 * @param nowDate
50 50
 	 * @param beforeDate
51
+	 * @param personId
52
+	 * @param userId
51 53
 	 * @return
52 54
 	 */
53
-	List<TaCustomerStatisticMonthly> getMonthlyList(@Param("customerType") String customerType,@Param("orgId") Integer orgId,@Param("nowDate") LocalDateTime nowDate,@Param("beforeDate") LocalDateTime beforeDate);
55
+	List<TsCustomerStatisticMonthly> getMonthlyList(@Param("customerType") String customerType, @Param("orgId") Integer orgId, @Param("nowDate") LocalDateTime nowDate, @Param("beforeDate") LocalDateTime beforeDate, @Param("personId") String personId,@Param("userId") Integer userId);
54 56
 }

src/main/java/com/huiju/estateagents/statistic/service/ITaCustomerGenderStatisticService.java → src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerGenderStatisticService.java 查看文件

@@ -1,7 +1,7 @@
1 1
 package com.huiju.estateagents.statistic.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
-import com.huiju.estateagents.statistic.entity.TaCustomerGenderStatistic;
4
+import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
5 5
 
6 6
 import java.time.LocalDateTime;
7 7
 
@@ -13,7 +13,7 @@ import java.time.LocalDateTime;
13 13
  * @author jobob
14 14
  * @since 2019-11-08
15 15
  */
16
-public interface ITaCustomerGenderStatisticService extends IService<TaCustomerGenderStatistic> {
16
+public interface ITsCustomerGenderStatisticService extends IService<TsCustomerGenderStatistic> {
17 17
 	
18 18
 	/**
19 19
 	 * 每天的新增客户性别统计

src/main/java/com/huiju/estateagents/statistic/service/ITaCustomerStatisticDailyService.java → src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticDailyService.java 查看文件

@@ -1,7 +1,7 @@
1 1
 package com.huiju.estateagents.statistic.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily;
4
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
5 5
 
6 6
 import java.time.LocalDateTime;
7 7
 import java.util.List;
@@ -14,7 +14,7 @@ import java.util.List;
14 14
  * @author jobob
15 15
  * @since 2019-11-08
16 16
  */
17
-public interface ITaCustomerStatisticDailyService extends IService<TaCustomerStatisticDaily> {
17
+public interface ITsCustomerStatisticDailyService extends IService<TsCustomerStatisticDaily> {
18 18
 	
19 19
 	/**
20 20
 	 * 每天的跟进客户统计
@@ -38,7 +38,9 @@ public interface ITaCustomerStatisticDailyService extends IService<TaCustomerSta
38 38
 	 * 获取日统计数据
39 39
 	 * @param customerType
40 40
 	 * @param orgId
41
+	 * @param personId
42
+	 * @param userId
41 43
 	 * @return
42 44
 	 */
43
-	List<TaCustomerStatisticDaily> getDailyList(String customerType, Integer orgId);
45
+	List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId, Integer userId);
44 46
 }

src/main/java/com/huiju/estateagents/statistic/service/ITaCustomerStatisticMonthlyService.java → src/main/java/com/huiju/estateagents/statistic/service/ITsCustomerStatisticMonthlyService.java 查看文件

@@ -1,7 +1,7 @@
1 1
 package com.huiju.estateagents.statistic.service;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly;
4
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
5 5
 
6 6
 import java.time.LocalDateTime;
7 7
 import java.util.List;
@@ -14,7 +14,7 @@ import java.util.List;
14 14
  * @author jobob
15 15
  * @since 2019-11-08
16 16
  */
17
-public interface ITaCustomerStatisticMonthlyService extends IService<TaCustomerStatisticMonthly> {
17
+public interface ITsCustomerStatisticMonthlyService extends IService<TsCustomerStatisticMonthly> {
18 18
 	
19 19
 	/**
20 20
 	 * 每月新增客户统计,每天都更新
@@ -38,7 +38,9 @@ public interface ITaCustomerStatisticMonthlyService extends IService<TaCustomerS
38 38
 	 * 查询12个月的客户统计分析数据
39 39
 	 * @param customerType
40 40
 	 * @param orgId
41
+	 * @param personId
42
+	 * @param userId
41 43
 	 * @return
42 44
 	 */
43
-	List<TaCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId);
45
+	List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId, Integer userId);
44 46
 }

src/main/java/com/huiju/estateagents/statistic/service/impl/TaCustomerGenderStatisticServiceImpl.java → src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerGenderStatisticServiceImpl.java 查看文件

@@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 5
 import com.huiju.estateagents.common.CommConstant;
6 6
 import com.huiju.estateagents.statistic.entity.GenderStatistic;
7
-import com.huiju.estateagents.statistic.entity.TaCustomerGenderStatistic;
8
-import com.huiju.estateagents.statistic.mapper.TaCustomerGenderStatisticMapper;
9
-import com.huiju.estateagents.statistic.service.ITaCustomerGenderStatisticService;
7
+import com.huiju.estateagents.statistic.entity.TsCustomerGenderStatistic;
8
+import com.huiju.estateagents.statistic.mapper.TsCustomerGenderStatisticMapper;
9
+import com.huiju.estateagents.statistic.service.ITsCustomerGenderStatisticService;
10 10
 import org.springframework.beans.factory.annotation.Autowired;
11 11
 import org.springframework.stereotype.Service;
12 12
 
@@ -23,10 +23,10 @@ import java.util.List;
23 23
  * @since 2019-11-08
24 24
  */
25 25
 @Service
26
-public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomerGenderStatisticMapper, TaCustomerGenderStatistic> implements ITaCustomerGenderStatisticService {
26
+public class TsCustomerGenderStatisticServiceImpl extends ServiceImpl<TsCustomerGenderStatisticMapper, TsCustomerGenderStatistic> implements ITsCustomerGenderStatisticService {
27 27
 	
28 28
 	@Autowired
29
-	private TaCustomerGenderStatisticMapper customerGenderStatisticMapper;
29
+	private TsCustomerGenderStatisticMapper customerGenderStatisticMapper;
30 30
 	
31 31
 	/**
32 32
 	 * 每天的新增客户性别统计
@@ -36,7 +36,7 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
36 36
 	@Override
37 37
 	public void newCustomerSexStatisticDaily(LocalDateTime nowDate) {
38 38
 		//获取新增客户的男女性别比和性别数
39
-		List<GenderStatistic> newCustomerSexList = customerGenderStatisticMapper.getNewCustomerSexCount();
39
+		List<GenderStatistic> newCustomerSexList = customerGenderStatisticMapper.getNewCustomerSexCount(nowDate);
40 40
 		//批量保存
41 41
 		saveBatchCustomerSexData(newCustomerSexList,nowDate,CommConstant.CUSTOMER_TYPE_NEW);
42 42
 	}
@@ -80,38 +80,41 @@ public class TaCustomerGenderStatisticServiceImpl extends ServiceImpl<TaCustomer
80 80
 	 */
81 81
 	private void saveBatchCustomerSexData(List<GenderStatistic> customerSexList, LocalDateTime nowDate,String customerType) {
82 82
 		//先删除在添加
83
-		QueryWrapper<TaCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
83
+		QueryWrapper<TsCustomerGenderStatistic> queryWrapper = new QueryWrapper<>();
84 84
 		queryWrapper.eq("customer_type",customerType);
85 85
 		customerGenderStatisticMapper.delete(queryWrapper);
86 86
 		
87
-		List<TaCustomerGenderStatistic> list = new ArrayList<>();
87
+		List<TsCustomerGenderStatistic> list = new ArrayList<>();
88 88
 		//划分男女未知三条数据
89 89
 		customerSexList.forEach(e -> {
90
-			TaCustomerGenderStatistic maleCustomer = new TaCustomerGenderStatistic();
90
+			TsCustomerGenderStatistic maleCustomer = new TsCustomerGenderStatistic();
91 91
 			maleCustomer.setCreateDate(nowDate);
92 92
 			maleCustomer.setGenderType(CommConstant.SEX_MALE);
93 93
 			maleCustomer.setCustomerType(customerType);
94 94
 			maleCustomer.setCustomerNum(e.getManSum());
95 95
 			maleCustomer.setPercentage(e.getManPct());
96 96
 			maleCustomer.setOrgId(e.getOrgId());
97
+			maleCustomer.setRealtyConsultant(e.getRealtyConsultant());
97 98
 			list.add(maleCustomer);
98 99
 			
99
-			TaCustomerGenderStatistic femaleCustomer = new TaCustomerGenderStatistic();
100
+			TsCustomerGenderStatistic femaleCustomer = new TsCustomerGenderStatistic();
100 101
 			femaleCustomer.setCreateDate(nowDate);
101 102
 			femaleCustomer.setGenderType(CommConstant.SEX_FEMALE);
102 103
 			femaleCustomer.setCustomerType(customerType);
103 104
 			femaleCustomer.setCustomerNum(e.getWomanSum());
104 105
 			femaleCustomer.setPercentage(e.getWomanPct());
105 106
 			femaleCustomer.setOrgId(e.getOrgId());
107
+			femaleCustomer.setRealtyConsultant(e.getRealtyConsultant());
106 108
 			list.add(femaleCustomer);
107 109
 			
108
-			TaCustomerGenderStatistic unknownCustomer = new TaCustomerGenderStatistic();
110
+			TsCustomerGenderStatistic unknownCustomer = new TsCustomerGenderStatistic();
109 111
 			unknownCustomer.setCreateDate(nowDate);
110 112
 			unknownCustomer.setGenderType(CommConstant.SEX_UNKNOWN);
111 113
 			unknownCustomer.setCustomerType(customerType);
112 114
 			unknownCustomer.setCustomerNum(e.getUnknownSum());
113 115
 			unknownCustomer.setPercentage(e.getUnknownPct());
114 116
 			unknownCustomer.setOrgId(e.getOrgId());
117
+			unknownCustomer.setRealtyConsultant(e.getRealtyConsultant());
115 118
 			list.add(unknownCustomer);
116 119
 		});
117 120
 		//批量插入

src/main/java/com/huiju/estateagents/statistic/service/impl/TaCustomerStatisticDailyServiceImpl.java → src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java 查看文件

@@ -2,17 +2,16 @@ package com.huiju.estateagents.statistic.service.impl;
2 2
 
3 3
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 4
 import com.huiju.estateagents.common.CommConstant;
5
-import com.huiju.estateagents.common.StringUtils;
6
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily;
7
-import com.huiju.estateagents.statistic.mapper.TaCustomerStatisticDailyMapper;
8
-import com.huiju.estateagents.statistic.service.ITaCustomerStatisticDailyService;
5
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily;
6
+import com.huiju.estateagents.statistic.mapper.TsCustomerStatisticDailyMapper;
7
+import com.huiju.estateagents.statistic.service.ITsCustomerStatisticDailyService;
9 8
 import org.springframework.beans.factory.annotation.Autowired;
10 9
 import org.springframework.stereotype.Service;
11 10
 
12 11
 import java.time.LocalDateTime;
12
+import java.time.format.DateTimeFormatter;
13 13
 import java.util.ArrayList;
14 14
 import java.util.List;
15
-import java.util.Map;
16 15
 
17 16
 /**
18 17
  * <p>
@@ -23,10 +22,10 @@ import java.util.Map;
23 22
  * @since 2019-11-08
24 23
  */
25 24
 @Service
26
-public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerStatisticDailyMapper, TaCustomerStatisticDaily> implements ITaCustomerStatisticDailyService {
25
+public class TsCustomerStatisticDailyServiceImpl extends ServiceImpl<TsCustomerStatisticDailyMapper, TsCustomerStatisticDaily> implements ITsCustomerStatisticDailyService {
27 26
 	
28 27
 	@Autowired
29
-	private TaCustomerStatisticDailyMapper customerStatisticDailyMapper;
28
+	private TsCustomerStatisticDailyMapper customerStatisticDailyMapper;
30 29
 	
31 30
 	/**
32 31
 	 * 每天的跟进客户统计
@@ -36,7 +35,7 @@ public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerS
36 35
 	@Override
37 36
 	public void followUpStatisticDaily(LocalDateTime nowDate) {
38 37
 		//按当前时间获取当天的跟进客户的数量,多一个客户进行多次跟进行为,只记录一次
39
-		List<TaCustomerStatisticDaily> list = customerStatisticDailyMapper.getFollowUpData(nowDate);
38
+		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getFollowUpData(nowDate);
40 39
 		//批量保存
41 40
 		statisticDailySaveBatch(list,nowDate,CommConstant.CUSTOMER_TYPE_FOLLOW);
42 41
 	}
@@ -49,7 +48,7 @@ public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerS
49 48
 	@Override
50 49
 	public void newCustomerStatisticDaily(LocalDateTime nowDate) {
51 50
 		//按当前时间获取当天的新增客户的数量,ta_recommend_customer 表的status 为1 的就是新增客户
52
-		List<TaCustomerStatisticDaily> list = customerStatisticDailyMapper.getNewCustomerData(nowDate,CommConstant.STATUS_NORMAL);
51
+		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getNewCustomerData(nowDate,CommConstant.STATUS_NORMAL);
53 52
 		//批量保存
54 53
 		statisticDailySaveBatch(list,nowDate,CommConstant.CUSTOMER_TYPE_NEW);
55 54
 	}
@@ -62,8 +61,8 @@ public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerS
62 61
 	@Override
63 62
 	public void visiteStatisticDaily(LocalDateTime nowDate) {
64 63
 		//按当前时间获取当天的到访客户的数量,同一天同一个项目只记录一次
65
-		List<TaCustomerStatisticDaily> list = customerStatisticDailyMapper.getVisiteCustomerData(nowDate,CommConstant.STATUS_NORMAL);
66
-		List<TaCustomerStatisticDaily> saveList = new ArrayList<>();
64
+		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getVisiteCustomerData(nowDate,CommConstant.STATUS_NORMAL);
65
+		List<TsCustomerStatisticDaily> saveList = new ArrayList<>();
67 66
 		list.forEach(e -> {
68 67
 			if (null != e.getOrgId() && !e.getOrgId().equals("null")){
69 68
 				saveList.add(e);
@@ -78,17 +77,40 @@ public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerS
78 77
 	 *
79 78
 	 * @param customerType
80 79
 	 * @param orgId
80
+	 * @param personId
81
+	 * @param userId
81 82
 	 * @return
82 83
 	 */
83 84
 	@Override
84
-	public List<TaCustomerStatisticDaily> getDailyList(String customerType, Integer orgId) {
85
+	public List<TsCustomerStatisticDaily> getDailyList(String customerType, Integer orgId, String personId, Integer userId) {
85 86
 		//当前日期
86 87
 		LocalDateTime nowDate = LocalDateTime.now();
87 88
 		//31天前的日期
88 89
 		LocalDateTime beforeDate = nowDate.plusDays(-31);
89 90
 		//获取31天的日期数据
90
-		List<TaCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate);
91
-		return list;
91
+		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate,personId,userId);
92
+		//构造31天的数据
93
+		List<TsCustomerStatisticDaily> newList = new ArrayList<>();
94
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
95
+		for (int i = 0; i < 31;i++){
96
+			String newDate = nowDate.plusDays(-i).format(formatter);
97
+			TsCustomerStatisticDaily tsCustomerStatisticDaily = new TsCustomerStatisticDaily();
98
+			tsCustomerStatisticDaily.setOrgId(orgId);
99
+			tsCustomerStatisticDaily.setCustomerNum(0);
100
+			tsCustomerStatisticDaily.setDay(newDate);
101
+			tsCustomerStatisticDaily.setCustomerType(customerType);
102
+			tsCustomerStatisticDaily.setRealtyConsultant(personId);
103
+			
104
+			//合并数据
105
+			list.forEach(l -> {
106
+				if (newDate.equals(l.getDay())){
107
+					tsCustomerStatisticDaily.setCustomerNum(tsCustomerStatisticDaily.getCustomerNum() + l.getCustomerNum());
108
+				}
109
+			});
110
+			newList.add(tsCustomerStatisticDaily);
111
+		}
112
+		
113
+		return newList;
92 114
 	}
93 115
 	
94 116
 	/**
@@ -97,13 +119,18 @@ public class TaCustomerStatisticDailyServiceImpl extends ServiceImpl<TaCustomerS
97 119
 	 * @param nowDate
98 120
 	 * @param customerType
99 121
 	 */
100
-	private void statisticDailySaveBatch(List<TaCustomerStatisticDaily> list, LocalDateTime nowDate, String customerType) {
122
+	private void statisticDailySaveBatch(List<TsCustomerStatisticDaily> list, LocalDateTime nowDate, String customerType) {
123
+		//格式化年月日
124
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
125
+		String todayDate = nowDate.format(formatter);
126
+		
101 127
 		//先删除当天数据在添加防止有脏数据
102 128
 		customerStatisticDailyMapper.deleteNowDate(nowDate,customerType);
103 129
 		
104 130
 		list.forEach(e -> {
105 131
 			e.setCreateDate(nowDate);
106 132
 			e.setCustomerType(customerType);
133
+			e.setDay(todayDate);
107 134
 		});
108 135
 		//批量保存
109 136
 		this.saveBatch(list);

src/main/java/com/huiju/estateagents/statistic/service/impl/TaCustomerStatisticMonthlyServiceImpl.java → src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticMonthlyServiceImpl.java 查看文件

@@ -3,10 +3,9 @@ package com.huiju.estateagents.statistic.service.impl;
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 5
 import com.huiju.estateagents.common.CommConstant;
6
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily;
7
-import com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly;
8
-import com.huiju.estateagents.statistic.mapper.TaCustomerStatisticMonthlyMapper;
9
-import com.huiju.estateagents.statistic.service.ITaCustomerStatisticMonthlyService;
6
+import com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly;
7
+import com.huiju.estateagents.statistic.mapper.TsCustomerStatisticMonthlyMapper;
8
+import com.huiju.estateagents.statistic.service.ITsCustomerStatisticMonthlyService;
10 9
 import org.springframework.beans.factory.annotation.Autowired;
11 10
 import org.springframework.stereotype.Service;
12 11
 
@@ -24,10 +23,10 @@ import java.util.List;
24 23
  * @since 2019-11-08
25 24
  */
26 25
 @Service
27
-public class TaCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TaCustomerStatisticMonthlyMapper, TaCustomerStatisticMonthly> implements ITaCustomerStatisticMonthlyService {
26
+public class TsCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TsCustomerStatisticMonthlyMapper, TsCustomerStatisticMonthly> implements ITsCustomerStatisticMonthlyService {
28 27
 	
29 28
 	@Autowired
30
-	private TaCustomerStatisticMonthlyMapper customerStatisticMonthlyMapper;
29
+	private TsCustomerStatisticMonthlyMapper customerStatisticMonthlyMapper;
31 30
 	
32 31
 	/**
33 32
 	 * 每月新增客户统计,每天都更新
@@ -37,7 +36,7 @@ public class TaCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TaCustome
37 36
 	@Override
38 37
 	public void newCustomerStatisticMonthly(LocalDateTime nowDate) {
39 38
 		//获取当月新增客户总数
40
-		List<TaCustomerStatisticMonthly> newCustomerMonthList = customerStatisticMonthlyMapper.getNewCustomerStatisticMonthly(nowDate,CommConstant.STATUS_NORMAL);
39
+		List<TsCustomerStatisticMonthly> newCustomerMonthList = customerStatisticMonthlyMapper.getNewCustomerStatisticMonthly(nowDate,CommConstant.STATUS_NORMAL);
41 40
 		//批量插入
42 41
 		statisticMonthlySaveBatch(newCustomerMonthList,nowDate, CommConstant.CUSTOMER_TYPE_NEW);
43 42
 	}
@@ -50,7 +49,7 @@ public class TaCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TaCustome
50 49
 	@Override
51 50
 	public void followUpStatisticMonthly(LocalDateTime nowDate) {
52 51
 		//获取当月跟进客户总数
53
-		List<TaCustomerStatisticMonthly> followUpMonthList = customerStatisticMonthlyMapper.getFollowUpStatisticMonthly(nowDate);
52
+		List<TsCustomerStatisticMonthly> followUpMonthList = customerStatisticMonthlyMapper.getFollowUpStatisticMonthly(nowDate);
54 53
 		statisticMonthlySaveBatch(followUpMonthList,nowDate, CommConstant.CUSTOMER_TYPE_FOLLOW);
55 54
 	}
56 55
 	
@@ -62,14 +61,14 @@ public class TaCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TaCustome
62 61
 	@Override
63 62
 	public void visiteStatisticMonthly(LocalDateTime nowDate) {
64 63
 		//获取当月访问客户总数
65
-		List<TaCustomerStatisticMonthly> visiteMonthList = customerStatisticMonthlyMapper.getVisiteStatisticMonthly(nowDate,CommConstant.STATUS_NORMAL);
66
-		List<TaCustomerStatisticMonthly> newVisiteMonthList = new ArrayList<>();
64
+		List<TsCustomerStatisticMonthly> visiteMonthList = customerStatisticMonthlyMapper.getVisiteStatisticMonthly(nowDate,CommConstant.STATUS_NORMAL);
65
+		List<TsCustomerStatisticMonthly> newVisiteMonthList = new ArrayList<>();
67 66
 		visiteMonthList.forEach(e -> {
68 67
 			if (null != e.getOrgId() && !e.getOrgId().equals("null")){
69 68
 				newVisiteMonthList.add(e);
70 69
 			}
71 70
 		});
72
-		statisticMonthlySaveBatch(newVisiteMonthList,nowDate, CommConstant.CUSTOMER_TYPE_FOLLOW);
71
+		statisticMonthlySaveBatch(newVisiteMonthList,nowDate, CommConstant.CUSTOMER_TYPE_VISITE);
73 72
 	}
74 73
 	
75 74
 	/**
@@ -77,17 +76,38 @@ public class TaCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TaCustome
77 76
 	 *
78 77
 	 * @param customerType
79 78
 	 * @param orgId
79
+	 * @param personId
80
+	 * @param userId
80 81
 	 * @return
81 82
 	 */
82 83
 	@Override
83
-	public List<TaCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId) {
84
+	public List<TsCustomerStatisticMonthly> getCustomerMonthlyList(String customerType, Integer orgId, String personId, Integer userId) {
84 85
 		//当前日期
85 86
 		LocalDateTime nowDate = LocalDateTime.now();
86 87
 		//12个月前的日期
87 88
 		LocalDateTime beforeDate = nowDate.plusMonths(-12);
88
-		//获取31天的日期数据
89
-		List<TaCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate);
90
-		return list;
89
+		//获取12个月数据
90
+		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate,personId,userId);
91
+		//构造12个月的数据
92
+		List<TsCustomerStatisticMonthly> newList = new ArrayList<>();
93
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
94
+		for (int i = 0; i < 12;i++){
95
+			String newDate = nowDate.plusMonths(-i).format(formatter);
96
+			TsCustomerStatisticMonthly tsCustomerStatisticMonthly = new TsCustomerStatisticMonthly();
97
+			tsCustomerStatisticMonthly.setCustomerType(customerType);
98
+			tsCustomerStatisticMonthly.setMonth(newDate);
99
+			tsCustomerStatisticMonthly.setCustomerNum(0);
100
+			tsCustomerStatisticMonthly.setOrgId(orgId);
101
+			tsCustomerStatisticMonthly.setRealtyConsultant(personId);
102
+			list.forEach(l -> {
103
+				if (newDate.equals(l.getMonth())){
104
+					tsCustomerStatisticMonthly.setCustomerNum(tsCustomerStatisticMonthly.getCustomerNum() + l.getCustomerNum());
105
+				}
106
+			});
107
+			newList.add(tsCustomerStatisticMonthly);
108
+		}
109
+		
110
+		return newList;
91 111
 	}
92 112
 	
93 113
 	/**
@@ -96,13 +116,13 @@ public class TaCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TaCustome
96 116
 	 * @param nowDate
97 117
 	 * @param customerType
98 118
 	 */
99
-	private void statisticMonthlySaveBatch(List<TaCustomerStatisticMonthly> list, LocalDateTime nowDate, String customerType) {
100
-		//格式化年月
119
+	private void statisticMonthlySaveBatch(List<TsCustomerStatisticMonthly> list, LocalDateTime nowDate, String customerType) {
120
+		//格式化年月
101 121
 		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
102 122
 		String todayDate = nowDate.format(formatter);
103 123
 		
104 124
 		//先删除在添加
105
-		QueryWrapper<TaCustomerStatisticMonthly> queryWrapper = new QueryWrapper<>();
125
+		QueryWrapper<TsCustomerStatisticMonthly> queryWrapper = new QueryWrapper<>();
106 126
 		queryWrapper.eq("customer_type",customerType);
107 127
 		queryWrapper.eq("month",todayDate);
108 128
 		customerStatisticMonthlyMapper.delete(queryWrapper);

+ 56
- 1
src/main/resources/application-gzysd.yml 查看文件

@@ -1,3 +1,4 @@
1
+<<<<<<< HEAD
1 2
 server:
2 3
   port: 8009
3 4
 spring:
@@ -71,4 +72,58 @@ sms:
71 72
     sign: AI智慧案场
72 73
 
73 74
   visitor:
74
-    code: "0501"
75
+    code: "0501"
76
+=======
77
+server:
78
+  port: 8009
79
+spring:
80
+  application:
81
+    name: estateagents
82
+  datasource:
83
+    username: estateagents
84
+    password: DQ@0lW##kBb2+-jPZ
85
+    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents_gzysd?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
86
+    driver-class-name: com.mysql.cj.jdbc.Driver
87
+    initial-size: 10 # 初始化连接数
88
+    max-active: 20 # 最大连接数
89
+    min-idle: 8 # 最小空闲数
90
+    max-idle: 8 # 最大空闲数
91
+  servlet:
92
+    multipart:
93
+      max-file-size: 10MB
94
+      max-request-size: 50MB
95
+
96
+##mybatis-plus
97
+mybatis-plus:
98
+  configuration:
99
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
100
+    call-setters-on-nulls: true
101
+  mapper-locations: classpath:mapper/*.xml
102
+wx:
103
+  miniapp:
104
+    appid: wxe3b1e683853800b5
105
+    secret: 207dd6d0f807b2dd0d41b57a8184365f
106
+    token:
107
+    aesKey:
108
+    msgDataFormat: JSON
109
+  tpls:
110
+    - name: notice
111
+      id: IVWM-wpzSNV6CyXeSBGBgRku2lRrZ-3x4vXRILQpHM0
112
+      keywords: 4
113
+    - name: newCustomer
114
+      id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
115
+      keywords: 4
116
+    - name: mainbiz
117
+      id: IywdSfNPegeg5GB3Q-TVieSYD9DA0im8eI-hF_u0i-4
118
+
119
+      keywords: 6
120
+ali:
121
+  accessKeyId: LTAIkc75dpkJw8Lb
122
+  accessKeySecret: v4bvXCaix6vSDTCFfwSAdqV53iFEQw
123
+  oss:
124
+    endpoint: oss-cn-shanghai.aliyuncs.com
125
+    bucketName: estateagents
126
+    bucketURL: https://estateagents.oss-cn-shanghai.aliyuncs.com
127
+
128
+
129
+>>>>>>> ac499f2ddc4d4469098e59fff8bbe310779f7be3

+ 15
- 15
src/main/resources/application-test.yml 查看文件

@@ -1,12 +1,12 @@
1 1
 server:
2
-  port: 8566
2
+  port: 8080
3 3
 spring:
4 4
   application:
5 5
     name: estateagents
6 6
   datasource:
7 7
     username: estateagents
8
-    password: DQ@0lW##kBb2+-jPZ
9
-    url: jdbc:mysql://rm-uf6z3z6jq11x653d77o.mysql.rds.aliyuncs.com:3306/estateagents_t?useUnicode=true&serverTimezone=CTT&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
8
+    password: estateagents
9
+    url: jdbc:mysql://47.101.36.130:3306/estateagents_3.5.1_test?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10 10
     driver-class-name: com.mysql.cj.jdbc.Driver
11 11
     initial-size: 10 # 初始化连接数
12 12
     max-active: 20 # 最大连接数
@@ -25,21 +25,21 @@ mybatis-plus:
25 25
   mapper-locations: classpath:mapper/**/*.xml
26 26
 wx:
27 27
   miniapp:
28
-    appid: wxc56decdcbc64d8de
29
-    secret: 80864fa371a8db79e719c07df52d59d0
28
+    appid: wxd6f47a9bb3052175
29
+    secret: 28f33b6bbc0f778c11a0bb234a7d6d4e
30 30
     token:
31 31
     aesKey:
32 32
     msgDataFormat: JSON
33 33
   tpls:
34
-    - name: notice
35
-      id: 6hWKexNlaVpAOvrcWxHHQ_Duz1gRIkg2-Clsktp2-Os
36
-      keywords: 4
37
-    - name: newCustomer
38
-      id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
39
-      keywords: 4
40
-    - name: mainbiz
41
-      id: WiBYjqkE9KvwDv1WSq5vniGU4P0gvwlat-5ENYKpfxg
42
-      keywords: 6
34
+  - name: notice
35
+    id: 6hWKexNlaVpAOvrcWxHHQ_Duz1gRIkg2-Clsktp2-Os
36
+    keywords: 4
37
+  - name: newCustomer
38
+    id: WiBYjqkE9KvwDv1WSq5vnuv5A6FSaOB8ETFcrVmtCEI
39
+    keywords: 4
40
+  - name: mainbiz
41
+    id: WiBYjqkE9KvwDv1WSq5vniGU4P0gvwlat-5ENYKpfxg
42
+    keywords: 6
43 43
 ali:
44 44
   accessKeyId: LTAIkc75dpkJw8Lb
45 45
   accessKeySecret: v4bvXCaix6vSDTCFfwSAdqV53iFEQw
@@ -68,7 +68,7 @@ sms:
68 68
     # 验证码长度
69 69
     size: 4
70 70
     # 短信签名
71
-    sign: AI智慧案场
71
+    sign: 营销云
72 72
 
73 73
   visitor:
74 74
     code: "0501"

+ 39
- 7
src/main/resources/mapper/Activity.xml 查看文件

@@ -3,36 +3,37 @@
3 3
 <mapper namespace="com.huiju.estateagents.activity.mapper.ActivityMapper">
4 4
 
5 5
     <select id="getActivityList" resultType="com.huiju.estateagents.activity.entity.Activity">
6
-        SELECT dynamic_id as id,list_img_url as main_img,title,start_date as start_date,enlist_end as end_date,weight,activity_status,'dynamic' as type
6
+        SELECT dynamic_id as id,list_img_url as main_img,title,start_date as start_date,enlist_end as end_date,heavy, weight,activity_status,'dynamic' as type
7 7
         FROM ta_building_dynamic
8 8
         WHERE org_id = #{orgId}  and `status` = #{status}
9 9
         <if test="cityId != null and cityId != ''">
10 10
           and city_id = #{cityId}
11 11
         </if>
12 12
         UNION  all
13
-        SELECT group_activity_id as id,list_img as main_img,activity_name as title,start_time as start_date,end_time as end_date,weight,activity_status,'group' as type
13
+        SELECT group_activity_id as id,list_img as main_img,activity_name as title,start_time as start_date,end_time as end_date,heavy,weight,activity_status,'group' as type
14 14
         from ta_share_activity
15 15
         WHERE org_id = #{orgId} and `status` = #{status}
16 16
         <if test="cityId != null and cityId != ''">
17 17
             and city_id = #{cityId}
18 18
         </if>
19 19
         UNION  all
20
-        SELECT help_activity_id as id,list_img as main_img,title,start_date,end_date,weight,activity_status,'help' as type
20
+        SELECT help_activity_id as id,list_img as main_img,title,start_date,end_date,heavy,weight,activity_status,'help' as type
21 21
         from ta_help_activity
22 22
         WHERE org_id = #{orgId} and `status` = #{status}
23 23
         <if test="cityId != null and cityId != ''">
24 24
             and city_id = #{cityId}
25 25
         </if>
26
-        ORDER BY weight desc,activity_status,start_date
26
+        ORDER BY heavy desc,activity_status,start_date
27 27
     </select>
28 28
     <select id="getCustomerActivityList" resultType="java.util.Map">
29 29
         SELECT
30 30
             t.enlist_id AS id,
31 31
             t.dynamic_id AS activityId,
32 32
             t.create_date AS createDate,
33
-            IF( t.is_checkin = 1, "已签到", "未签到" ) AS `status`,
33
+            IF( t.is_checkin = 1, "已签到", "未签到" ) AS `joinStatus`,
34 34
             d.list_img_url AS mainImg,
35 35
             d.title,
36
+            d.status,
36 37
             d.start_date AS startDate,
37 38
             d.enlist_end AS endDate,
38 39
             'dynamic' AS type
@@ -58,9 +59,10 @@
58 59
         "成功未核销"
59 60
         WHEN t.STATUS = 2 THEN
60 61
         "失败"
61
-        END `status`,
62
+        END `joinStatus`,
62 63
             d.list_img AS mainImg,
63 64
             d.activity_name AS title,
65
+            d.status,
64 66
             d.start_time AS startDate,
65 67
             d.end_time AS endDate,
66 68
             'group' AS type
@@ -70,6 +72,35 @@
70 72
         WHERE
71 73
             t.org_id = #{orgId}
72 74
             AND t.person_id = #{personId}
75
+      UNION ALL
76
+        SELECT
77
+            t.record_id AS id,
78
+            t.group_activity_id AS activityId,
79
+            t.create_time AS createDate,
80
+        CASE
81
+            WHEN t.STATUS = 1 THEN
82
+            "进行中"
83
+            WHEN t.STATUS = 0
84
+            AND t.verification_status = 1 THEN
85
+            "成功已核销"
86
+        WHEN t.STATUS = 0
87
+        AND t.verification_status != 1 THEN
88
+        "成功未核销"
89
+        WHEN t.STATUS = 2 THEN
90
+        "失败"
91
+        END `joinStatus`,
92
+            d.list_img AS mainImg,
93
+            d.activity_name AS title,
94
+            d.status,
95
+            d.start_time AS startDate,
96
+            d.end_time AS endDate,
97
+            'group' AS type
98
+        FROM
99
+            ta_share_child_record t
100
+            LEFT JOIN ta_share_activity d ON t.group_activity_id = d.group_activity_id
101
+        WHERE
102
+            t.org_id = #{orgId}
103
+            AND t.person_id = #{personId}
73 104
       UNION ALL
74 105
         SELECT
75 106
             t.help_record_initiate_id AS id,
@@ -86,9 +117,10 @@
86 117
                         "成功未核销"
87 118
                         WHEN t.STATUS = 2 THEN
88 119
                         "失败"
89
-                    END `status`,
120
+                    END `joinStatus`,
90 121
             d.list_img AS mainImg,
91 122
             d.title,
123
+            d.status,
92 124
             d.start_date AS startDate,
93 125
             d.end_date AS endDate,
94 126
             'help' AS type

+ 2
- 2
src/main/resources/mapper/HelpActivityMapper.xml 查看文件

@@ -66,7 +66,7 @@
66 66
 			FROM
67 67
 				ta_help_activity a
68 68
 				WHERE
69
-                    a.org_id =#{orgId}
69
+                    a.org_id =#{orgId} and a.`status` = 1
70 70
                 <if test="buildingId  == null or  buildingId ==''">
71 71
                   and  a.is_main = 1
72 72
                 </if>
@@ -88,7 +88,7 @@
88 88
 				FROM
89 89
 					ta_share_activity s
90 90
 					WHERE
91
-                    s.org_id =#{orgId}
91
+                    s.org_id =#{orgId} and s.`status` = 1
92 92
                 <if test="buildingId  == null or  buildingId =='' ">
93 93
                     and  s.sort = 1
94 94
                 </if>

+ 12
- 8
src/main/resources/mapper/TaActivityDynamicEnlistMapper.xml 查看文件

@@ -3,14 +3,18 @@
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaActivityDynamicEnlistMapper">
4 4
         <select id="signList" resultType="com.huiju.estateagents.entity.TaActivityDynamicEnlist">
5 5
 
6
-                SELECT
7
-                    tade.*,
8
-                    tp.NAME AS sharePersonName,
9
-                    tp.company AS orgName
10
-                FROM
11
-                    ta_activity_dynamic_enlist tade
12
-                    LEFT JOIN ta_share_person_from tspf ON tade.dynamic_id = tspf.target_id AND tspf.target_type = 'dynamic_share' and tspf.status = 1 and tade.person_id = tspf.person_id
13
-                    LEFT JOIN ta_person tp ON tspf.share_person = tp.person_id
6
+            SELECT
7
+            tade.*,
8
+            IFNULL(tp.nickname,tu.user_name) AS sharePersonName,
9
+            IFNULL(tp.company,tu.org_name)AS orgName
10
+            FROM
11
+            ta_activity_dynamic_enlist tade
12
+            LEFT JOIN ta_share_person_from tspf ON tade.dynamic_id = tspf.target_id
13
+            AND tspf.target_type = 'dynamic_share'
14
+            AND tspf.STATUS = 1
15
+            AND tade.person_id = tspf.person_id
16
+            LEFT JOIN ta_person tp ON tspf.share_person = tp.person_id AND tspf.share_person_type != 'Realty Consultant'
17
+            LEFT JOIN ta_user tu ON tspf.share_person = tu.user_id AND tspf.share_person_type = 'Realty Consultant'
14 18
                 <where>
15 19
                     tade.dynamic_id = #{dynamicId}
16 20
                     AND tade.org_id = #{orgId}

+ 1
- 1
src/main/resources/mapper/TaBuildingImgMapper.xml 查看文件

@@ -3,7 +3,7 @@
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaBuildingImgMapper">
4 4
     <select id="getBuildingImgByApartment" resultType="com.huiju.estateagents.entity.TaBuildingImg" >
5 5
       select a.* from ta_building_img a inner join ta_apartment_img b on a.img_id = b.img_id
6
-      where a.status = 1 and b.status= 1 and b.apartment_id = #{id}
6
+      where a.status = 1 and b.status= 1 and b.apartment_id = #{id} order by a.order_no asc
7 7
     </select>
8 8
 
9 9
     <delete id="delBuildingImgByApartment" >

+ 5
- 0
src/main/resources/mapper/TaBuildingMapRelationMapper.xml 查看文件

@@ -0,0 +1,5 @@
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.ta.mapper.TaBuildingMapRelationMapper">
4
+
5
+</mapper>

+ 4
- 1
src/main/resources/mapper/TaBuildingMapper.xml 查看文件

@@ -196,12 +196,15 @@
196 196
 
197 197
     <select id="getBuildingListById" resultType="com.huiju.estateagents.entity.TaBuilding">
198 198
       select * from ta_building t where t.building_id in (
199
-	    select t.building_id from ta_goods t where t.org_id = #{orgId} and t.city_id = #{cityId} group by t.building_id
199
+	    select t.building_id from ta_goods t where t.org_id = #{orgId} and t.city_id = #{cityId} and `status`=1 group by t.building_id
200 200
       )
201 201
     </select>
202 202
 
203 203
     <select id="countNumByHeavy" resultType="java.lang.Integer">
204 204
       select COUNT(1) from ta_building_dynamic t where t.heavy = #{heavy}
205
+      <if test="dynamicId != null and dynamicId != ''">
206
+          and t.dynamic_id != #{dynamicId}
207
+      </if>
205 208
     </select>
206 209
 
207 210
 </mapper>

+ 1
- 1
src/main/resources/mapper/TaMiniFormidsMapper.xml 查看文件

@@ -8,7 +8,7 @@
8 8
             ta_mini_formids t
9 9
         WHERE
10 10
             t.openid = #{openid}
11
-        AND ADDDATE(t.create_date, INTERVAL 7 DAY) >= now()
11
+        AND ADDDATE(t.create_date, INTERVAL 6 DAY) >= now()
12 12
         ORDER BY t.create_date ASC
13 13
         LIMIT 1
14 14
     </select>

+ 22
- 0
src/main/resources/mapper/TaOrgCity.xml 查看文件

@@ -1,4 +1,26 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.huiju.estateagents.mapper.TaOrgCityMapper">
4
+    <select id="selectByIdCity"  resultType="string">
5
+        select city_id from ta_org_city where  parentid != 100000 and  org_id = #{orgId}
6
+    </select>
7
+
8
+    <select id="selectAdminTdCityList" resultType="com.huiju.estateagents.entity.TaOrgCity">
9
+                SELECT
10
+                    oc.city_id AS id,
11
+                    oc.`name` AS name,
12
+                    oc.org_id,
13
+                    oc.`status`,
14
+                    oc.parentid,
15
+                LEFT (c.pinyin, 1) AS initial
16
+                FROM
17
+                ta_org_city oc
18
+                LEFT JOIN td_city c ON oc.city_id = c.id
19
+                WHERE
20
+                oc.org_id = #{orgId}
21
+                and  oc.parentid  !=100000
22
+                and  oc.status = 1
23
+                ORDER BY
24
+                c.pinyin
25
+    </select>
4 26
 </mapper>

+ 1
- 0
src/main/resources/mapper/TaPersonMapper.xml 查看文件

@@ -49,6 +49,7 @@
49 49
         AND t. STATUS = #{status}
50 50
         and t.org_id = #{orgId}
51 51
         and u.org_id = #{orgId}
52
+        and u.status = 1
52 53
         ORDER BY
53 54
             t.create_date DESC
54 55
     </select>

+ 20
- 10
src/main/resources/mapper/TaRecommendCustomerMapper.xml 查看文件

@@ -22,7 +22,7 @@ WHERE
22 22
     <select id="getCustomerDetail" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
23 23
       SELECT
24 24
 	a.*,
25
-	(select c.visit_time FROM ta_person_visit_record c where c.person_id = #{personId} ORDER BY c.visit_time desc LIMIT 1) as visitTime,
25
+	(select c.visit_time FROM ta_person_visit_record c where c.person_id = #{personId} ORDER BY c.visit_time asc LIMIT 1) as visitTime,
26 26
 	(SELECT SUM(d.visit_duration) FROM ta_person_visit_record d WHERE d.person_id= #{personId}) as duration
27 27
 FROM
28 28
 	ta_recommend_customer a
@@ -164,6 +164,7 @@ FROM
164 164
             a.status > 0
165 165
             and a.verify_status = 1
166 166
             and a.realty_consultant is not null
167
+            and a.realty_consultant != ''
167 168
             <if test="orgId != null">
168 169
                 and a.org_id = #{orgId}
169 170
             </if>
@@ -607,8 +608,8 @@ FROM
607 608
 
608 609
     <select id="getMyCustStatistics" resultType="java.util.Map">
609 610
         SELECT
610
-            sum( IF ( STATUS = 4, 1, 0 ) ) AS followSum,
611
-            sum( IF ( STATUS != 4 AND STATUS != 4, 1, 0 ) ) AS clinchSum
611
+            sum( IF ( STATUS = 4 AND verify_status = 1, 1, 0 ) ) AS clinchSum,
612
+            sum( IF ( STATUS != 4 AND verify_status = 1, 1, 0 ) ) AS followSum
612 613
         FROM
613 614
             ta_recommend_customer
614 615
         WHERE
@@ -630,8 +631,9 @@ FROM
630 631
         AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
631 632
         <if test="type == 'follow'">
632 633
           AND STATUS != 4
634
+          AND verify_status = 1
633 635
             <if test="name != null and name !=''">
634
-                and `name` like CONCAT('%',#{name}, '%')
636
+                and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
635 637
             </if>
636 638
             <if test="phone != null and phone !=''">
637 639
                 and phone like CONCAT('%',#{phone}, '%')
@@ -667,17 +669,25 @@ FROM
667 669
 
668 670
     <select id="getCustomerIntentions" resultType="com.huiju.estateagents.entity.PersonIntention">
669 671
         SELECT
670
-            SUM( intention ) AS intention,
671
-            building_id,
672
-            building_name
672
+            SUM( a.intention ) AS intention,
673
+            a.building_id,
674
+            b.building_name
673 675
         FROM
674
-            `ta_person_intention_record`
676
+            ta_person_intention_record a
677
+            left join ta_building b on a.building_id = b.building_id
675 678
         WHERE
676
-            person_id = #{personId}
679
+           a.person_id = #{personId}
677 680
         GROUP BY
678
-            building_id
681
+            a.building_id
679 682
         ORDER BY
680 683
             intention DESC
681 684
     </select>
682 685
 
686
+    <select id="getCustomersIRecommended" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
687
+        select a.*,b.avatarurl from ta_recommend_customer a left join ta_person b on a.person_id = b.person_id
688
+        where a.recommend_person = #{customerId}
689
+        and a.status = #{status}
690
+        and a.org_id = #{orgId}
691
+    </select>
692
+
683 693
 </mapper>

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

@@ -39,4 +39,15 @@
39 39
         WHERE
40 40
             u.user_id = #{userId}
41 41
     </select>
42
+
43
+    <select id="getUserList" resultType="com.huiju.estateagents.center.taUser.entity.TaUser">
44
+    SELECT
45
+        *
46
+    FROM
47
+        ta_user
48
+    WHERE
49
+          org_id = #{orgId}
50
+        and (phone = #{phone}
51
+        OR login_Name = #{loginName})
52
+    </select>
42 53
 </mapper>

+ 28
- 1
src/main/resources/mapper/TdCityMapper.xml 查看文件

@@ -19,6 +19,33 @@ FROM
19 19
 ORDER BY
20 20
 	pinyin
21 21
     </select>
22
-    
22
+
23
+
24
+    <select id="selectWxCity" resultType="com.huiju.estateagents.entity.TdCity">
25
+
26
+        SELECT
27
+                    c.id,
28
+                    c.name,
29
+                    c.parentid,
30
+                    c.shortname,
31
+                    c.leveltype,
32
+                    c.citycode,
33
+                    c.zipcode,
34
+                    c.lng,
35
+                    c.lat,
36
+                    c.pinyin,
37
+                    oc.org_id,
38
+                    oc.`status`,
39
+                    LEFT (c.pinyin, 1) AS initial
40
+                FROM
41
+                ta_org_city oc
42
+                INNER JOIN td_city c ON oc.city_id = c.id
43
+                WHERE
44
+                oc.org_id = #{orgId}
45
+                and  oc.parentid  !=100000
46
+                and  oc.status = 1
47
+                ORDER BY
48
+                c.pinyin
49
+    </select>
23 50
 
24 51
 </mapper>

src/main/resources/mapper/statistic/TaCustomerGenderStatisticMapper.xml → src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml 查看文件

@@ -1,10 +1,10 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 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.statistic.mapper.TaCustomerGenderStatisticMapper">
3
+<mapper namespace="com.huiju.estateagents.statistic.mapper.TsCustomerGenderStatisticMapper">
4 4
 
5 5
     <select id="getNewCustomerSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
6 6
         SELECT
7
-            org_id,
7
+            org_id,realty_consultant,
8 8
             sum(if(sex = 1,1,0)) as man_sum,
9 9
             sum(if(sex = 1,1,0))/count(*) as man_pct,
10 10
             sum(if(sex = 2,1,0)) as woman_sum,
@@ -14,12 +14,13 @@
14 14
         FROM
15 15
             ta_recommend_customer
16 16
         WHERE
17
-            `STATUS` = 1
18
-            GROUP BY org_id
17
+            verify_status = 1
18
+            GROUP BY org_id,realty_consultant
19 19
     </select>
20 20
     <select id="getFollowUpSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
21 21
         SELECT
22 22
             t.org_id,
23
+            t.follower_id as realty_consultant,
23 24
             sum( IF ( t.customer_sex = 1, 1, 0 ) ) AS manSum,
24 25
             sum( IF ( t.customer_sex = 1, 1, 0 ) ) / count( * ) AS manPct,
25 26
             sum( IF ( t.customer_sex = 2, 1, 0 ) ) AS womanSum,
@@ -29,11 +30,12 @@
29 30
         FROM
30 31
             ( SELECT * FROM ta_customer_follow_up_record GROUP BY customer_id ) t
31 32
         GROUP BY
32
-            t.org_id
33
+            t.org_id,t.follower_id
33 34
     </select>
34 35
     <select id="getVisiteSexCount" resultType="com.huiju.estateagents.statistic.entity.GenderStatistic">
35 36
         SELECT
36 37
             d.org_id,
38
+            d.realty_consultant,
37 39
             sum( IF ( d.sex = 1, 1, 0 ) ) AS manSum,
38 40
             sum( IF ( d.sex = 1, 1, 0 ) ) / count( * ) AS manPct,
39 41
             sum( IF ( d.sex = 2, 1, 0 ) ) AS womanSum,
@@ -50,12 +52,13 @@
50 52
                     LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
51 53
                     AND t.building_id = c.building_id
52 54
                     AND t.org_id = c.org_id
55
+                    AND c.verify_status = 1
53 56
                 WHERE
54 57
                     t.is_checkin = 1
55 58
                 GROUP BY
56 59
                     c.customer_id
57 60
             ) d
58 61
         GROUP BY
59
-            d.org_id
62
+            d.org_id,d.realty_consultant
60 63
     </select>
61 64
 </mapper>

src/main/resources/mapper/statistic/TaCustomerStatisticDailyMapper.xml → src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml 查看文件

@@ -1,62 +1,68 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 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.statistic.mapper.TaCustomerStatisticDailyMapper">
3
+<mapper namespace="com.huiju.estateagents.statistic.mapper.TsCustomerStatisticDailyMapper">
4 4
 
5 5
     <delete id="deleteNowDate">
6
-        delete from ta_customer_statistic_daily
6
+        delete from ts_customer_statistic_daily
7 7
         where customer_type = #{customerType}
8 8
         AND date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
9 9
     </delete>
10 10
 
11
-    <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
11
+    <select id="getFollowUpData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
12 12
         SELECT
13 13
             org_id,
14
-            count( DISTINCT ( customer_id ) ) as customer_num
14
+            count( DISTINCT ( customer_id ) ) as customer_num,
15
+            follower_id AS realty_consultant
15 16
         FROM
16 17
             ta_customer_follow_up_record
17 18
         WHERE
18 19
             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
19 20
         GROUP BY
20
-            org_id
21
+            org_id,follower_id
21 22
     </select>
22 23
 
23
-    <select id="getNewCustomerData" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
24
+    <select id="getNewCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
24 25
         SELECT
25 26
             org_id,
26
-            count( customer_id ) as customer_num
27
+            count( customer_id ) as customer_num,
28
+			realty_consultant
27 29
         FROM
28 30
             ta_recommend_customer
29 31
         WHERE
30
-            `STATUS` = #{status}
31
-            AND date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
32
+             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
33
+             AND verify_status = 1
32 34
         GROUP BY
33
-            org_id
35
+            org_id,realty_consultant
34 36
     </select>
35
-    <select id="getVisiteCustomerData" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
37
+    <select id="getVisiteCustomerData" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
36 38
         SELECT
37 39
             count( DISTINCT ( c.customer_id ) ) as customer_num,
38
-            c.org_id
40
+            c.org_id,
41
+			c.realty_consultant
39 42
         FROM
40 43
             ta_activity_dynamic_enlist t
41 44
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
42 45
             AND t.building_id = c.building_id
43 46
             AND t.org_id = c.org_id
47
+            AND c.verify_status = 1
44 48
         WHERE
45 49
             t.is_checkin = #{checkin}
46 50
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
47 51
         GROUP BY
48
-            c.org_id
52
+            c.org_id,c.realty_consultant
49 53
     </select>
50
-
51
-    <select id="getDailyList" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticDaily">
54
+    <select id="getDailyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticDaily">
52 55
         SELECT
53 56
           *
54 57
         FROM
55
-          ta_customer_statistic_daily
58
+          ts_customer_statistic_daily
56 59
         WHERE
57 60
           org_id = #{orgId}
58 61
         AND customer_type = #{customerType}
62
+        AND (realty_consultant = #{personId} or realty_consultant = #{userId})
59 63
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
60 64
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
65
+        order by `day`
61 66
     </select>
67
+
62 68
 </mapper>

src/main/resources/mapper/statistic/TaCustomerStatisticMonthlyMapper.xml → src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml 查看文件

@@ -1,58 +1,64 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 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.statistic.mapper.TaCustomerStatisticMonthlyMapper">
3
+<mapper namespace="com.huiju.estateagents.statistic.mapper.TsCustomerStatisticMonthlyMapper">
4 4
 
5 5
     <select id="getNewCustomerStatisticMonthly"
6
-            resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly">
6
+            resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
7 7
         SELECT
8 8
             org_id,
9
-            count( customer_id ) as customer_num
9
+            count( customer_id ) as customer_num,
10
+            realty_consultant
10 11
         FROM
11 12
             ta_recommend_customer
12 13
         WHERE
13
-            `STATUS` = #{status}
14
-            AND date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
14
+            date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
15
+            AND verify_status = 1
15 16
         GROUP BY
16
-            org_id
17
+            org_id,realty_consultant
17 18
     </select>
18 19
 
19 20
     <select id="getFollowUpStatisticMonthly"
20
-            resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly">
21
+            resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
21 22
         SELECT
22 23
             org_id,
23
-            count( DISTINCT ( customer_id ) ) as customer_num
24
+            count( DISTINCT ( customer_id ) ) as customer_num,
25
+            follower_id AS realty_consultant
24 26
         FROM
25 27
             ta_customer_follow_up_record
26 28
         WHERE
27 29
             date_format( create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
28 30
         GROUP BY
29
-            org_id
31
+            org_id,follower_id
30 32
     </select>
31 33
     <select id="getVisiteStatisticMonthly"
32
-            resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly">
34
+            resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
33 35
         SELECT
34 36
             count( DISTINCT ( c.customer_id ) ) as customer_num,
35
-            c.org_id
37
+            c.org_id,
38
+            c.realty_consultant
36 39
         FROM
37 40
             ta_activity_dynamic_enlist t
38 41
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
39 42
             AND t.building_id = c.building_id
40 43
             AND t.org_id = c.org_id
44
+            AND c.verify_status = 1
41 45
         WHERE
42 46
             t.is_checkin = #{checkin}
43 47
             AND date_format( t.create_date, '%Y-%m' ) = date_format( #{nowDate}, '%Y-%m' )
44 48
         GROUP BY
45
-            c.org_id
49
+            c.org_id,c.realty_consultant
46 50
     </select>
47
-    <select id="getMonthlyList" resultType="com.huiju.estateagents.statistic.entity.TaCustomerStatisticMonthly">
51
+    <select id="getMonthlyList" resultType="com.huiju.estateagents.statistic.entity.TsCustomerStatisticMonthly">
48 52
         SELECT
49 53
           *
50 54
         FROM
51
-          ta_customer_statistic_monthly
55
+          ts_customer_statistic_monthly
52 56
         WHERE
53 57
           org_id = #{orgId}
54 58
         AND customer_type = #{customerType}
55
-        AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
56
-        AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
59
+        AND (realty_consultant = #{personId} or realty_consultant = #{userId})
60
+        AND date_format( create_date, '%Y-%m' ) >= date_format( #{beforeDate}, '%Y-%m' )
61
+        AND date_format( create_date, '%Y-%m' ) &lt;= date_format( #{nowDate}, '%Y-%m' )
62
+         order by `month`
57 63
     </select>
58 64
 </mapper>

+ 30
- 0
src/test/java/com/huiju/estateagents/TdCityServiceImplTest.java 查看文件

@@ -0,0 +1,30 @@
1
+package com.huiju.estateagents;
2
+
3
+import com.huiju.estateagents.entity.TdCity;
4
+import com.huiju.estateagents.service.ITdCityService;
5
+import org.junit.Assert;
6
+import org.junit.Test;
7
+import org.junit.runner.RunWith;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.boot.test.context.SpringBootTest;
10
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
11
+import org.springframework.transaction.annotation.Transactional;
12
+
13
+
14
+@RunWith(SpringJUnit4ClassRunner.class)
15
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
16
+@Transactional
17
+public class TdCityServiceImplTest {
18
+	
19
+	@Autowired
20
+	private ITdCityService iTdCityService;
21
+	
22
+	@Test
23
+	public void getLocationCity() {
24
+		TdCity locationCity = iTdCityService.getLocationCity("116.310003,39.991957");
25
+		//断言 对象不为null
26
+		Assert.assertNotNull(locationCity);
27
+		//断言获取的是北京市
28
+		Assert.assertEquals("北京市",locationCity.getName());
29
+	}
30
+}