Selaa lähdekoodia

Merge branch 'v3.5.1' of http://git.ycjcjy.com/zhiyuxing/estateagents into v3.5.1

weiximei 5 vuotta sitten
vanhempi
commit
5adfc7aef4

+ 10
- 0
src/main/java/com/huiju/estateagents/common/CommConstant.java Näytä tiedosto

@@ -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
 }

+ 7
- 1
src/main/java/com/huiju/estateagents/controller/TaShareActivityController.java Näytä tiedosto

@@ -245,11 +245,17 @@ public class TaShareActivityController extends BaseController {
245 245
         try{
246 246
             Integer orgId = getOrgId(request);
247 247
             Integer sumPoints = taPersonService.sumPointsByOrgId(orgId);
248
+            sumPoints = sumPoints == null ? 0 : sumPoints;
248 249
             QueryWrapper<TaPerson> taPersonWrapper = new QueryWrapper<>();
249 250
             taPersonWrapper.eq("org_id", orgId);
250 251
             Integer personNum = taPersonService.count(taPersonWrapper);
251 252
             TaShareActivity taShareActivity = new TaShareActivity();
252
-            taShareActivity.setAverageScore(sumPoints/personNum);
253
+            if (personNum == 0){
254
+                taShareActivity.setAverageScore(0);
255
+            }else{
256
+                taShareActivity.setAverageScore(sumPoints/personNum);
257
+            }
258
+
253 259
             responseBean.addSuccess(taShareActivity);
254 260
         }catch (Exception e){
255 261
             e.printStackTrace();

+ 18
- 0
src/main/java/com/huiju/estateagents/controller/TdCityController.java Näytä tiedosto

@@ -171,4 +171,22 @@ public class TdCityController extends BaseController {
171 171
         }
172 172
         return responseBean;
173 173
     }
174
+    
175
+    /**
176
+     * 根据经纬度查询城市ID
177
+     * 经度在前,纬度在后,经纬度间以“,”分割,经纬度小数点后不要超过 6 位
178
+     * @return
179
+     */
180
+    @RequestMapping(value="/wx/location/city",method= RequestMethod.GET)
181
+    public ResponseBean wxLocationCityDetail(@RequestParam(value = "location") String location,HttpServletRequest request){
182
+        ResponseBean responseBean = new ResponseBean();
183
+        try {
184
+            TdCity tdCity = iTdCityService.getLocationCity(location);
185
+            responseBean.addSuccess(tdCity);
186
+        }catch (Exception e){
187
+            logger.error("tdCityList -=- {}",e.toString());
188
+            responseBean.addError(e.getMessage());
189
+        }
190
+        return responseBean;
191
+    }
174 192
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/job/CustomerStatisticTimeJob.java Näytä tiedosto

@@ -42,7 +42,8 @@ public class CustomerStatisticTimeJob extends BaseController {
42 42
      *
43 43
      * 开启定时任务,每天23:50执行
44 44
      */
45
-    @Scheduled(cron = "00 50 23 * * ?")
45
+    //@Scheduled(cron = "00 50 23 * * ?")
46
+    @Scheduled(cron = "* 0/2 * * * ?")
46 47
     private void configureTasks() {
47 48
         LocalDateTime nowDate = LocalDateTime.now();
48 49
     

+ 7
- 0
src/main/java/com/huiju/estateagents/service/ITdCityService.java Näytä tiedosto

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

+ 1
- 1
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Näytä tiedosto

@@ -378,7 +378,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
378 378
         taBuildingQuery.gt("status",-1);
379 379
         int orgNum= taBuildingMapper.selectCount(taBuildingQuery);
380 380
         if (orgNum >= taOrg.getBuildingNum()){
381
-            return ResponseBean.error("楼盘已超过最大限制", ResponseBean.ERROR_UNAVAILABLE);
381
+            return ResponseBean.error("当前系统仅供维护"+taOrg.getBuildingNum()+"个项目,需要维护更多项目,请联系相关管理人员", ResponseBean.ERROR_UNAVAILABLE);
382 382
         }
383 383
 
384 384
         TaBuilding building = object.toJavaObject(TaBuilding.class);

+ 31
- 1
src/main/java/com/huiju/estateagents/service/impl/TdCityServiceImpl.java Näytä tiedosto

@@ -1,12 +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;
5 8
 import com.huiju.estateagents.mapper.TaOrgCityMapper;
6 9
 import com.huiju.estateagents.mapper.TdCityMapper;
7 10
 import com.huiju.estateagents.service.ITdCityService;
8 11
 import org.springframework.beans.factory.annotation.Autowired;
9 12
 import org.springframework.stereotype.Service;
13
+import org.springframework.web.client.RestTemplate;
10 14
 
11 15
 import java.util.List;
12 16
 
@@ -33,5 +37,31 @@ public class TdCityServiceImpl extends ServiceImpl<TdCityMapper, TdCity> impleme
33 37
         List<TdCity>  tdCityList= tdCityMapper.selectWxCity(orgId);
34 38
         return tdCityList;
35 39
     }
36
-
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
+            TdCity tdCity = tdCityMapper.selectOne(queryWrapper);
62
+            return tdCity;
63
+        }
64
+        return null;
65
+    }
66
+    
37 67
 }

+ 1
- 0
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml Näytä tiedosto

@@ -58,5 +58,6 @@
58 58
         AND customer_type = #{customerType}
59 59
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
60 60
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
61
+        order by `day`
61 62
     </select>
62 63
 </mapper>

+ 1
- 0
src/main/resources/mapper/statistic/TsCustomerStatisticMonthlyMapper.xml Näytä tiedosto

@@ -54,5 +54,6 @@
54 54
         AND customer_type = #{customerType}
55 55
         AND date_format( create_date, '%Y-%m-%d' ) >= date_format( #{beforeDate}, '%Y-%m-%d' )
56 56
         AND date_format( create_date, '%Y-%m-%d' ) &lt;= date_format( #{nowDate}, '%Y-%m-%d' )
57
+         order by `month`
57 58
     </select>
58 59
 </mapper>

+ 30
- 0
src/test/java/com/huiju/estateagents/TdCityServiceImplTest.java Näytä tiedosto

@@ -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
+}