| | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.common.bmo.machine.IMachineOpenDoorBMO; |
| | | import com.java110.common.dao.ICarBlackWhiteServiceDao; |
| | | import com.java110.common.dao.ICarInoutV1ServiceDao; |
| | | import com.java110.core.annotation.Java110Cmd; |
| | | import com.java110.core.context.ICmdDataFlowContext; |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.machine.CarBlackWhiteDto; |
| | | import com.java110.dto.machine.CarInoutDto; |
| | | import com.java110.dto.parkingBoxArea.ParkingBoxAreaDto; |
| | | import com.java110.dto.tempCarFeeConfig.TempCarPayOrderDto; |
| | | import com.java110.intf.common.ICarInoutV1InnerServiceSMO; |
| | | import com.java110.intf.community.IParkingBoxAreaV1InnerServiceSMO; |
| | | import com.java110.intf.job.IDataBusInnerServiceSMO; |
| | | import com.java110.intf.user.ICarBlackWhiteV1InnerServiceSMO; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.DateUtil; |
| | |
| | | @Autowired |
| | | private IParkingBoxAreaV1InnerServiceSMO parkingBoxAreaV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICarInoutV1InnerServiceSMO carInoutV1InnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICarBlackWhiteV1InnerServiceSMO carBlackWhiteV1InnerServiceSMOImpl; |
| | | |
| | | @Override |
| | | public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { |
| | | Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息"); |
| | | Assert.hasKeyAndValue(reqJson, "machineId", "请求报文中未包含设备信息"); |
| | | Assert.hasKeyAndValue(reqJson, "carNum", "请求报文中未包含车牌号"); |
| | | Assert.hasKeyAndValue(reqJson, "type", "请求报文中未包含类型"); |
| | | |
| | | CarInoutDto carInoutDto = new CarInoutDto(); |
| | | carInoutDto.setCarNum(reqJson.getString("carNum")); |
| | | carInoutDto.setStates(new String[]{ |
| | | CarInoutDto.STATE_IN, |
| | | CarInoutDto.STATE_REPAY |
| | | }); |
| | | int count = carInoutV1InnerServiceSMOImpl.queryCarInoutsCount(carInoutDto); |
| | | |
| | | //出场 |
| | | if(!"1101".equals(reqJson.getString("type"))) { |
| | | Assert.hasKeyAndValue(reqJson,"payType","未包含支付方式"); |
| | | Assert.hasKeyAndValue(reqJson,"amount","未包含支付金额"); |
| | | if(count < 1){ |
| | | throw new CmdException("车辆未入场"); |
| | | } |
| | | }else{ |
| | | if(count > 0){ |
| | | throw new CmdException("车辆已经在场,请先出场"); |
| | | } |
| | | //进场时 判断是否为黑名单 |
| | | CarBlackWhiteDto carBlackWhiteDto = new CarBlackWhiteDto(); |
| | | carBlackWhiteDto.setCarNum(reqJson.getString("carNum")); |
| | | count = carBlackWhiteV1InnerServiceSMOImpl.queryCarBlackWhitesCount(carBlackWhiteDto); |
| | | if(count > 0){ |
| | | throw new CmdException("黑名单车辆禁止入场"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | if(parkingBoxAreaDtos == null || parkingBoxAreaDtos.size()< 1){ |
| | | throw new CmdException("未包含停车场信息"); |
| | | } |
| | | |
| | | TempCarPayOrderDto tempCarPayOrderDto = new TempCarPayOrderDto(); |
| | | tempCarPayOrderDto.setCarNum(reqJson.getString("carNum")); |
| | | tempCarPayOrderDto.setPaId(parkingBoxAreaDtos.get(0).getPaId()); |
| | | tempCarPayOrderDto.setOrderId(reqJson.getString("inoutId")); |
| | | tempCarPayOrderDto.setAmount(Double.parseDouble(reqJson.getString("payCharge"))); |
| | | ResultVo resultVo = dataBusInnerServiceSMOImpl.getTempCarFeeOrder(tempCarPayOrderDto); |
| | | if(resultVo.getCode() != ResultVo.CODE_OK){ |
| | | throw new CmdException(resultVo.getMsg()); |
| | | } |
| | | String data = JSONObject.toJSONString(resultVo.getData()); |
| | | JSONObject orderInfo = JSONObject.parseObject(data); |
| | | //JSONObject orderInfo = JSONObject.parseObject(resultVo.getData().toString()); |
| | | |
| | | tempCarPayOrderDto = new TempCarPayOrderDto(); |
| | | tempCarPayOrderDto.setCarNum(reqJson.getString("carNum")); |
| | | tempCarPayOrderDto.setPaId(parkingBoxAreaDtos.get(0).getPaId()); |
| | | tempCarPayOrderDto.setOrderId(orderInfo.getString("orderId")); |
| | | tempCarPayOrderDto.setAmount(Double.parseDouble(reqJson.getString("amount"))); |
| | | tempCarPayOrderDto.setPayCharge(Double.parseDouble(reqJson.getString("payCharge"))); |
| | | tempCarPayOrderDto.setPayType(reqJson.getString("payType")); |
| | | //tempCarPayOrderDto.setMachineId(reqJson.getString("machineId")); |
| | | ResultVo resultVo = dataBusInnerServiceSMOImpl.notifyTempCarFeeOrder(tempCarPayOrderDto); |
| | | resultVo = dataBusInnerServiceSMOImpl.notifyTempCarFeeOrder(tempCarPayOrderDto); |
| | | if(resultVo.getCode() != ResultVo.CODE_OK){ |
| | | throw new CmdException(resultVo.getMsg()); |
| | | } |
| | | } |
| | | ResponseEntity<String> responseEntity = machineOpenDoorBMOImpl.customCarInOut(reqJson); |
| | | cmdDataFlowContext.setResponseEntity(responseEntity); |