| | |
| | | import com.java110.po.fee.PayFeePo; |
| | | import com.java110.po.owner.OwnerPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.lock.DistributedLock; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.DateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | //将状态更新为 出场状态 |
| | | |
| | | CarInoutPo carInoutPo = new CarInoutPo(); |
| | | carInoutPo.setPaId(carInoutDtos.get(0).getPaId()); |
| | | carInoutPo.setOutTime(reqJson.getString("outTime")); |
| | | carInoutPo.setInoutId(carInoutDtos.get(0).getInoutId()); |
| | | carInoutPo.setCommunityId(carInoutDtos.get(0).getCommunityId()); |
| | | carInoutPo.setState(CarInoutDto.STATE_OUT); |
| | | flag = carInoutV1InnerServiceSMOImpl.updateCarInout(carInoutPo); |
| | | |
| | | if (flag < 1) { |
| | | throw new CmdException("更新出场时间失败"); |
| | | } |
| | | updateCarInoutState(reqJson, carInoutDtos.get(0)); |
| | | |
| | | //写支付记录 |
| | | // CarInoutPaymentPo carInoutPaymentPo = new CarInoutPaymentPo(); |
| | |
| | | // hasFeeAndPayFee(carInoutDtos.get(0), reqJson, carInoutPo, carInoutPaymentPo); |
| | | } |
| | | |
| | | private void updateCarInoutState(JSONObject reqJson, CarInoutDto carInoutDto) { |
| | | int flag; |
| | | String requestId = DistributedLock.getLockUUID(); |
| | | String key = "updateInoutState_" + carInoutDto.getInoutId(); |
| | | try { |
| | | DistributedLock.waitGetDistributedLock(key, requestId); |
| | | |
| | | |
| | | CarInoutDto newCarInoutDto = new CarInoutDto(); |
| | | newCarInoutDto.setCommunityId(reqJson.getString("communityId")); |
| | | newCarInoutDto.setCarNum(reqJson.getString("carNum")); |
| | | newCarInoutDto.setPaId(carInoutDto.getPaId()); |
| | | newCarInoutDto.setStates(new String[]{ |
| | | CarInoutDto.STATE_IN, |
| | | CarInoutDto.STATE_PAY, |
| | | CarInoutDto.STATE_REPAY |
| | | }); |
| | | List<CarInoutDto> carInoutDtos = carInoutV1InnerServiceSMOImpl.queryCarInouts(newCarInoutDto); |
| | | |
| | | if(carInoutDtos == null || carInoutDtos.size()<1){ |
| | | return ; |
| | | } |
| | | |
| | | CarInoutPo carInoutPo = new CarInoutPo(); |
| | | carInoutPo.setPaId(carInoutDto.getPaId()); |
| | | carInoutPo.setOutTime(reqJson.getString("outTime")); |
| | | carInoutPo.setInoutId(carInoutDto.getInoutId()); |
| | | carInoutPo.setCommunityId(carInoutDto.getCommunityId()); |
| | | carInoutPo.setState(CarInoutDto.STATE_OUT); |
| | | flag = carInoutV1InnerServiceSMOImpl.updateCarInout(carInoutPo); |
| | | |
| | | if (flag < 1) { |
| | | throw new CmdException("更新出场时间失败"); |
| | | } |
| | | } finally { |
| | | DistributedLock.releaseDistributedLock(requestId, key); |
| | | } |
| | | } |
| | | |
| | | private boolean hasFeeAndPayFee(CarInoutDto carInoutDto, JSONObject reqJson, CarInoutPo carInoutPo, CarInoutPaymentPo carInoutPaymentPo) { |
| | | |
| | | FeeAttrDto feeAttrDto = new FeeAttrDto(); |