Commit 78facb8896414316cd949611259a35b8f0f50625
1 parent
fa587b83
更新 捷商 进出场接口, 生成订单
Showing
1 changed file
with
39 additions
and
0 deletions
src/main/java/com/zteits/irain/portal/web/ebochong/receive/EBoChongReceiveController.java
| @@ -2,6 +2,7 @@ package com.zteits.irain.portal.web.ebochong.receive; | @@ -2,6 +2,7 @@ package com.zteits.irain.portal.web.ebochong.receive; | ||
| 2 | 2 | ||
| 3 | import java.io.BufferedReader; | 3 | import java.io.BufferedReader; |
| 4 | import java.io.IOException; | 4 | import java.io.IOException; |
| 5 | +import java.math.BigDecimal; | ||
| 5 | 6 | ||
| 6 | import javax.servlet.http.HttpServletRequest; | 7 | import javax.servlet.http.HttpServletRequest; |
| 7 | import javax.servlet.http.HttpServletResponse; | 8 | import javax.servlet.http.HttpServletResponse; |
| @@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject; | ||
| 10 | 11 | ||
| 11 | import com.clouds.common.utils.EBoChongAESUtil; | 12 | import com.clouds.common.utils.EBoChongAESUtil; |
| 12 | import com.clouds.common.utils.ResultUtils; | 13 | import com.clouds.common.utils.ResultUtils; |
| 14 | +import com.xiaoleilu.hutool.date.DateUnit; | ||
| 13 | import com.xiaoleilu.hutool.date.DateUtil; | 15 | import com.xiaoleilu.hutool.date.DateUtil; |
| 14 | import com.zteits.clouds.api.apibase.bean.BaseInfo; | 16 | import com.zteits.clouds.api.apibase.bean.BaseInfo; |
| 15 | import com.zteits.clouds.api.apibase.bean.BizResult; | 17 | import com.zteits.clouds.api.apibase.bean.BizResult; |
| @@ -23,6 +25,7 @@ import com.zteits.clouds.api.service.park.IInOutParkingService; | @@ -23,6 +25,7 @@ import com.zteits.clouds.api.service.park.IInOutParkingService; | ||
| 23 | import com.zteits.clouds.api.service.park.InterfaceLogService; | 25 | import com.zteits.clouds.api.service.park.InterfaceLogService; |
| 24 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; | 26 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; |
| 25 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; | 27 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; |
| 28 | +import com.zteits.clouds.api.service.pay.ParkOrderService; | ||
| 26 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog; | 29 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog; |
| 27 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog.Type; | 30 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog.Type; |
| 28 | import com.zteits.irain.portal.vo.ebochong.EBoChongEnum; | 31 | import com.zteits.irain.portal.vo.ebochong.EBoChongEnum; |
| @@ -79,6 +82,12 @@ public class EBoChongReceiveController { | @@ -79,6 +82,12 @@ public class EBoChongReceiveController { | ||
| 79 | @Autowired | 82 | @Autowired |
| 80 | private InterfaceLogService interfaceLogService; | 83 | private InterfaceLogService interfaceLogService; |
| 81 | 84 | ||
| 85 | + /** | ||
| 86 | + * 停车场订单service | ||
| 87 | + */ | ||
| 88 | + @Autowired | ||
| 89 | + private ParkOrderService parkOrderService; | ||
| 90 | + | ||
| 82 | @Value("${ebochong.key}") | 91 | @Value("${ebochong.key}") |
| 83 | private String key; | 92 | private String key; |
| 84 | 93 | ||
| @@ -145,6 +154,18 @@ public class EBoChongReceiveController { | @@ -145,6 +154,18 @@ public class EBoChongReceiveController { | ||
| 145 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(inParkingRequest)); | 154 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(inParkingRequest)); |
| 146 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainInParking(inParkingRequest); | 155 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainInParking(inParkingRequest); |
| 147 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); | 156 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); |
| 157 | + | ||
| 158 | + try { | ||
| 159 | + logger.info("插入停车订单--begin----"); | ||
| 160 | + inParkingRequest.setSourceType(3); | ||
| 161 | + inParkingRequest.setFromType(2); | ||
| 162 | + BizResult<String> orderResult = parkOrderService.insertParkingOrder(inParkingRequest); | ||
| 163 | + logger.info("插入停车订单--end----结果=[errorMsg={},orderId={}]", orderResult.getErrMsg(), | ||
| 164 | + orderResult.getData()); | ||
| 165 | + } catch (Exception e) { | ||
| 166 | + logger.info("插入停车订单捕获异常:", e); | ||
| 167 | + } | ||
| 168 | + | ||
| 148 | } else { | 169 | } else { |
| 149 | logSaveRequest.setType(Type.TYPE_OUT_PARKING); | 170 | logSaveRequest.setType(Type.TYPE_OUT_PARKING); |
| 150 | //出场 | 171 | //出场 |
| @@ -154,6 +175,7 @@ public class EBoChongReceiveController { | @@ -154,6 +175,7 @@ public class EBoChongReceiveController { | ||
| 154 | outParkingRequest.setFreeBerths(req.getRemaining()); | 175 | outParkingRequest.setFreeBerths(req.getRemaining()); |
| 155 | outParkingRequest.setFromType(4); | 176 | outParkingRequest.setFromType(4); |
| 156 | outParkingRequest.setInTime(DateUtil.parse(req.getInTime())); | 177 | outParkingRequest.setInTime(DateUtil.parse(req.getInTime())); |
| 178 | + outParkingRequest.setOutTime(DateUtil.parse(req.getPassTime())); | ||
| 157 | outParkingRequest.setParkCode(req.getParkIndex()); | 179 | outParkingRequest.setParkCode(req.getParkIndex()); |
| 158 | outParkingRequest.setRecordId(req.getUuid()); | 180 | outParkingRequest.setRecordId(req.getUuid()); |
| 159 | outParkingRequest.setPlNo(req.getParkIndex()); | 181 | outParkingRequest.setPlNo(req.getParkIndex()); |
| @@ -162,6 +184,23 @@ public class EBoChongReceiveController { | @@ -162,6 +184,23 @@ public class EBoChongReceiveController { | ||
| 162 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(outParkingRequest)); | 184 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(outParkingRequest)); |
| 163 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainOutParking(outParkingRequest); | 185 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainOutParking(outParkingRequest); |
| 164 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); | 186 | logger.info("===调用dubbo服务停车记录保存 dubboRes={}", JSONObject.toJSONString(bizResult)); |
| 187 | + | ||
| 188 | + try { | ||
| 189 | + logger.info("更新停车订单--begin----"); | ||
| 190 | + outParkingRequest.setSourceType(3); | ||
| 191 | + outParkingRequest.setFromType(2); | ||
| 192 | + outParkingRequest.setPayType("1"); | ||
| 193 | + outParkingRequest.setCalcCharge(new BigDecimal(req.getReceivable())); | ||
| 194 | + outParkingRequest.setTotalCharge(new BigDecimal(req.getReceivable())); | ||
| 195 | + outParkingRequest.setParkingDuration( | ||
| 196 | + DateUtil.between(outParkingRequest.getInTime(), outParkingRequest.getOutTime(), | ||
| 197 | + DateUnit.SECOND)); | ||
| 198 | + BizResult<String> orderResult = parkOrderService.updateParkingOrder(outParkingRequest); | ||
| 199 | + logger.info("更新停车订单--end----结果=[errorMsg={},orderId={}]", orderResult.getErrMsg(), | ||
| 200 | + orderResult.getData()); | ||
| 201 | + } catch (Exception e) { | ||
| 202 | + logger.info("更新停车订单捕获异常:", e); | ||
| 203 | + } | ||
| 165 | } | 204 | } |
| 166 | 205 | ||
| 167 | HandledVehicleInfoRes res = new HandledVehicleInfoRes(); | 206 | HandledVehicleInfoRes res = new HandledVehicleInfoRes(); |