Commit bb7f6fa6b488b658b14e1cfd3b048595bfb9c954

Authored by atao
2 parents 6ed716f2 3bb0e89d

Merge remote-tracking branch 'origin/branch_0808' into branch_0808

src/main/java/com/zteits/irain/portal/web/irain/UpdateFreeBerthController.java
@@ -2,11 +2,13 @@ package com.zteits.irain.portal.web.irain; @@ -2,11 +2,13 @@ package com.zteits.irain.portal.web.irain;
2 2
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map; 4 import java.util.Map;
  5 +import java.util.Map.Entry;
5 6
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.beans.factory.annotation.Value; 10 import org.springframework.beans.factory.annotation.Value;
  11 +import org.springframework.util.CollectionUtils;
10 import org.springframework.web.bind.annotation.GetMapping; 12 import org.springframework.web.bind.annotation.GetMapping;
11 import org.springframework.web.bind.annotation.PostMapping; 13 import org.springframework.web.bind.annotation.PostMapping;
12 import org.springframework.web.bind.annotation.RequestBody; 14 import org.springframework.web.bind.annotation.RequestBody;
@@ -18,6 +20,8 @@ import com.alibaba.fastjson.JSONObject; @@ -18,6 +20,8 @@ import com.alibaba.fastjson.JSONObject;
18 import com.clouds.common.cache.park.ParkingLotCacheUtil; 20 import com.clouds.common.cache.park.ParkingLotCacheUtil;
19 import com.clouds.common.cache.sys.SysCodeValueCacheUtil; 21 import com.clouds.common.cache.sys.SysCodeValueCacheUtil;
20 import com.clouds.common.constants.CodeValKindEnum; 22 import com.clouds.common.constants.CodeValKindEnum;
  23 +import com.clouds.common.constants.RedisKeyEnum;
  24 +import com.clouds.common.redis.RedisCacheUtil;
21 import com.clouds.common.utils.ResultUtils; 25 import com.clouds.common.utils.ResultUtils;
22 import com.clouds.common.web.vo.BizResultVO; 26 import com.clouds.common.web.vo.BizResultVO;
23 import com.google.common.collect.Lists; 27 import com.google.common.collect.Lists;
@@ -60,6 +64,8 @@ public class UpdateFreeBerthController { @@ -60,6 +64,8 @@ public class UpdateFreeBerthController {
60 private ParkLotIdleBerthsService parkLotIdleBerthsService; 64 private ParkLotIdleBerthsService parkLotIdleBerthsService;
61 @Autowired 65 @Autowired
62 private ParkingLotQueryService parkingLotQueryService; 66 private ParkingLotQueryService parkingLotQueryService;
  67 + @Autowired
  68 + private RedisCacheUtil redisCacheUtil;
63 69
64 70
65 @ApiOperation("更新空闲车位总数") 71 @ApiOperation("更新空闲车位总数")
@@ -80,11 +86,40 @@ public class UpdateFreeBerthController { @@ -80,11 +86,40 @@ public class UpdateFreeBerthController {
80 updaterequest.setPlNo(plNo); 86 updaterequest.setPlNo(plNo);
81 updaterequest.setFromType(fromType); 87 updaterequest.setFromType(fromType);
82 updaterequest.setSysCode(sysCode); 88 updaterequest.setSysCode(sysCode);
83 - logger.info("请求参数:"+JSONObject.toJSONString(request)); 89 + logger.info("请求参数:"+JSONObject.toJSONString(updaterequest));
84 int freeBerths = parkLotIdleBerthsService.updateAndGetIdleBerthByParkNo(updaterequest.getInoutTime(), updaterequest.getPlNo(), updaterequest.getType(), updaterequest.getFromType(), updaterequest.getFreeBerths()); 90 int freeBerths = parkLotIdleBerthsService.updateAndGetIdleBerthByParkNo(updaterequest.getInoutTime(), updaterequest.getPlNo(), updaterequest.getType(), updaterequest.getFromType(), updaterequest.getFreeBerths());
85 logger.info("调用后场服务:更新车位总数", freeBerths); 91 logger.info("调用后场服务:更新车位总数", freeBerths);
86 return new BizResultVO<Boolean>().setData(true); 92 return new BizResultVO<Boolean>().setData(true);
87 } 93 }
88 94
  95 + @ApiOperation("特殊处理-针对水岸天街左右更新空闲车位总数")
  96 + @PostMapping("updateFreeBerthForSpecial")
  97 + public BizResultVO<Boolean> updateFreeBerthForSpecial(@RequestBody Map<String,Object> freeBerthsMap){
  98 + //通过上报停车场编号查询对应的自己内部停车场编号
  99 + logger.info("特殊处理-针对水岸天街左右更新空闲车位总数请求参数:"+JSONObject.toJSONString(freeBerthsMap));
  100 + if(freeBerthsMap==null||freeBerthsMap.isEmpty()){
  101 + return new BizResultVO<Boolean>().setData(true);
  102 + }
  103 + for (Entry<String, Object> entry : freeBerthsMap.entrySet()) {
  104 + //更新空闲车位数
  105 + UpdateFreeBerthRequest updaterequest=new UpdateFreeBerthRequest();
  106 + updaterequest.setFreeBerths((Integer)entry.getValue());
  107 + updaterequest.setPlNo(entry.getKey());
  108 + updaterequest.setFromType(2);
  109 + updaterequest.setSysCode(sysCode);
  110 + int freeBerths = parkLotIdleBerthsService.updateAndGetIdleBerthByParkNo(updaterequest.getInoutTime(), updaterequest.getPlNo(), updaterequest.getType(), updaterequest.getFromType(), updaterequest.getFreeBerths());
  111 + logger.info("调用后场服务:更新车位总数", freeBerths);
  112 + //消息队列
  113 + JSONObject jsonObject = new JSONObject();
  114 + //空闲车位数
  115 + jsonObject.put("freeBerths", (Integer)entry.getValue());
  116 + //停车场编号
  117 + jsonObject.put("plNo", entry.getKey());
  118 + redisCacheUtil.convertAndSend(RedisKeyEnum.PARK_FREEBERTH_PLNO_FREEBERTH_TOPIC.key(),jsonObject);
  119 + }
  120 + logger.info("特殊处理-针对水岸天街左右更新空闲车位总数结束");
  121 + return new BizResultVO<Boolean>().setData(true);
  122 + }
  123 +
89 124
90 } 125 }
src/main/java/com/zteits/irain/portal/web/parkinglotcloudplatform/datastatistic/ParkLotStatisticController.java
@@ -114,9 +114,9 @@ public class ParkLotStatisticController { @@ -114,9 +114,9 @@ public class ParkLotStatisticController {
114 logger.info("根据登录人权限获取停车场列表"); 114 logger.info("根据登录人权限获取停车场列表");
115 List<String> plNos = Lists.newArrayList(); 115 List<String> plNos = Lists.newArrayList();
116 //2.调用接口查询当前登录人管辖的停车场名称 116 //2.调用接口查询当前登录人管辖的停车场名称
117 - plNos.add("A320211000");  
118 - plNos.add("B1504020C7");  
119 - /*UserInfo userInfo = sessionCommUtil.getUserInfo(); 117 + /*plNos.add("A320211000");
  118 + plNos.add("B1504020C7");*/
  119 + UserInfo userInfo = sessionCommUtil.getUserInfo();
120 if(userInfo!=null){ 120 if(userInfo!=null){
121 TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest(); 121 TdCompanyParkQueryRequest tdCompanyParkQueryRequest = new TdCompanyParkQueryRequest();
122 tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds()); 122 tdCompanyParkQueryRequest.setCustIdList(userInfo.getOrgIds());
@@ -126,7 +126,7 @@ public class ParkLotStatisticController { @@ -126,7 +126,7 @@ public class ParkLotStatisticController {
126 plNos = ResultUtils.getBizResultData(bizResult); 126 plNos = ResultUtils.getBizResultData(bizResult);
127 }else{ 127 }else{
128 throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS); 128 throw new BizException(ErrorType.AUTH_TOKEN_NOT_EXISTS);
129 - }*/ 129 + }
130 return plNos; 130 return plNos;
131 } 131 }
132 } 132 }