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 | 2 | |
| 3 | 3 | import java.io.BufferedReader; |
| 4 | 4 | import java.io.IOException; |
| 5 | +import java.math.BigDecimal; | |
| 5 | 6 | |
| 6 | 7 | import javax.servlet.http.HttpServletRequest; |
| 7 | 8 | import javax.servlet.http.HttpServletResponse; |
| ... | ... | @@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject; |
| 10 | 11 | |
| 11 | 12 | import com.clouds.common.utils.EBoChongAESUtil; |
| 12 | 13 | import com.clouds.common.utils.ResultUtils; |
| 14 | +import com.xiaoleilu.hutool.date.DateUnit; | |
| 13 | 15 | import com.xiaoleilu.hutool.date.DateUtil; |
| 14 | 16 | import com.zteits.clouds.api.apibase.bean.BaseInfo; |
| 15 | 17 | import com.zteits.clouds.api.apibase.bean.BizResult; |
| ... | ... | @@ -23,6 +25,7 @@ import com.zteits.clouds.api.service.park.IInOutParkingService; |
| 23 | 25 | import com.zteits.clouds.api.service.park.InterfaceLogService; |
| 24 | 26 | import com.zteits.clouds.api.service.park.ParkFreeBerthService; |
| 25 | 27 | import com.zteits.clouds.api.service.park.ParkingLotQueryService; |
| 28 | +import com.zteits.clouds.api.service.pay.ParkOrderService; | |
| 26 | 29 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog; |
| 27 | 30 | import com.zteits.irain.portal.constant.ParkConstant.InterfaceLog.Type; |
| 28 | 31 | import com.zteits.irain.portal.vo.ebochong.EBoChongEnum; |
| ... | ... | @@ -79,6 +82,12 @@ public class EBoChongReceiveController { |
| 79 | 82 | @Autowired |
| 80 | 83 | private InterfaceLogService interfaceLogService; |
| 81 | 84 | |
| 85 | + /** | |
| 86 | + * 停车场订单service | |
| 87 | + */ | |
| 88 | + @Autowired | |
| 89 | + private ParkOrderService parkOrderService; | |
| 90 | + | |
| 82 | 91 | @Value("${ebochong.key}") |
| 83 | 92 | private String key; |
| 84 | 93 | |
| ... | ... | @@ -145,6 +154,18 @@ public class EBoChongReceiveController { |
| 145 | 154 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(inParkingRequest)); |
| 146 | 155 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainInParking(inParkingRequest); |
| 147 | 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 | 169 | } else { |
| 149 | 170 | logSaveRequest.setType(Type.TYPE_OUT_PARKING); |
| 150 | 171 | //出场 |
| ... | ... | @@ -154,6 +175,7 @@ public class EBoChongReceiveController { |
| 154 | 175 | outParkingRequest.setFreeBerths(req.getRemaining()); |
| 155 | 176 | outParkingRequest.setFromType(4); |
| 156 | 177 | outParkingRequest.setInTime(DateUtil.parse(req.getInTime())); |
| 178 | + outParkingRequest.setOutTime(DateUtil.parse(req.getPassTime())); | |
| 157 | 179 | outParkingRequest.setParkCode(req.getParkIndex()); |
| 158 | 180 | outParkingRequest.setRecordId(req.getUuid()); |
| 159 | 181 | outParkingRequest.setPlNo(req.getParkIndex()); |
| ... | ... | @@ -162,6 +184,23 @@ public class EBoChongReceiveController { |
| 162 | 184 | logger.info("===调用dubbo服务停车记录保存 dubboReq={}", JSONObject.toJSONString(outParkingRequest)); |
| 163 | 185 | BizResult<Long> bizResult = iInOutParkingService.SaveIRainOutParking(outParkingRequest); |
| 164 | 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 | 206 | HandledVehicleInfoRes res = new HandledVehicleInfoRes(); | ... | ... |