old mode 100644
new mode 100755
| | |
| | | import com.java110.api.bmo.ApiBaseBMO; |
| | | import com.java110.api.bmo.parkingSpace.IParkingSpaceBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.smo.fee.IFeeConfigInnerServiceSMO; |
| | | import com.java110.core.smo.fee.IFeeInnerServiceSMO; |
| | | import com.java110.core.smo.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.fee.FeeDto; |
| | | import com.java110.dto.owner.OwnerCarDto; |
| | | import com.java110.dto.parking.ParkingSpaceDto; |
| | | import com.java110.intf.community.IParkingSpaceInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeConfigInnerServiceSMO; |
| | | import com.java110.intf.fee.IFeeInnerServiceSMO; |
| | | import com.java110.po.car.OwnerCarPo; |
| | | import com.java110.po.fee.PayFeeDetailPo; |
| | | import com.java110.po.fee.PayFeePo; |
| | |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import com.java110.utils.util.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Service("parkingSpaceBMOImpl") |
| | | public class ParkingSpaceBMOImpl extends ApiBaseBMO implements IParkingSpaceBMO { |
| | | |
| | | |
| | | @Autowired |
| | | private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeInnerServiceSMO feeInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | |
| | |
| | | businessParkingSpace.putAll(paramInJson); |
| | | businessParkingSpace.put("state", parkingSpaceDto.getState()); |
| | | ParkingSpacePo parkingSpacePo = BeanConvertUtil.covertBean(businessParkingSpace, ParkingSpacePo.class); |
| | | //parkingSpaceInnerServiceSMOImpl.updateParkingSpace(parkingSpacePo); |
| | | super.update(dataFlowContext, parkingSpacePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE); |
| | | } |
| | | |
| | |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public void addParkingSpace(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | JSONObject businessParkingSpace = new JSONObject(); |
| | | businessParkingSpace.putAll(paramInJson); |
| | | businessParkingSpace.put("state", "F"); |
| | | businessParkingSpace.put("psId", "-1"); |
| | | businessParkingSpace.put("psId", GenerateCodeFactory.getPsId(GenerateCodeFactory.CODE_PREFIX_psId)); |
| | | businessParkingSpace.put("bId", "-1"); |
| | | businessParkingSpace.put("createTime", new Date()); |
| | | ParkingSpacePo parkingSpacePo = BeanConvertUtil.covertBean(businessParkingSpace, ParkingSpacePo.class); |
| | | super.delete(dataFlowContext, parkingSpacePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_PARKING_SPACE); |
| | | super.insert(dataFlowContext, parkingSpacePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_PARKING_SPACE); |
| | | |
| | | //parkingSpaceInnerServiceSMOImpl.saveParkingSpace(parkingSpacePo); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | JSONObject businessOwnerCar = new JSONObject(); |
| | | businessOwnerCar.putAll(paramInJson); |
| | | businessOwnerCar.put("carId", "-1"); |
| | | businessOwnerCar.put("memberId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_carId)); |
| | | if (!paramInJson.containsKey("carId") || paramInJson.getString("carId").startsWith("-")) { |
| | | businessOwnerCar.put("carId", businessOwnerCar.getString("memberId")); |
| | | } |
| | | OwnerCarPo ownerCarPo = BeanConvertUtil.covertBean(businessOwnerCar, OwnerCarPo.class); |
| | | super.delete(dataFlowContext, ownerCarPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_CAR); |
| | | ownerCarPo.setState(OwnerCarDto.STATE_NORMAL); |
| | | |
| | | //没有指定时为主要车辆 |
| | | if (!paramInJson.containsKey("carTypeCd") || StringUtil.isEmpty(paramInJson.getString("carTypeCd"))) { |
| | | ownerCarPo.setCarTypeCd(OwnerCarDto.CAR_TYPE_PRIMARY); |
| | | } |
| | | super.insert(dataFlowContext, ownerCarPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_OWNER_CAR); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); |
| | | |
| | | if (parkingSpaceDtos == null || parkingSpaceDtos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查询到停车位信息" + JSONObject.toJSONString(parkingSpaceDto)); |
| | | //throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查询到停车位信息" + JSONObject.toJSONString(parkingSpaceDto)); |
| | | return; |
| | | } |
| | | |
| | | parkingSpaceDto = parkingSpaceDtos.get(0); |
| | |
| | | JSONObject businessParkingSpace = new JSONObject(); |
| | | |
| | | businessParkingSpace.putAll(BeanConvertUtil.beanCovertMap(parkingSpaceDto)); |
| | | businessParkingSpace.put("state", this.isHireParkingSpace(paramInJson) ? "H" : "S"); |
| | | businessParkingSpace.put("state", paramInJson.getString("carNumType")); |
| | | ParkingSpacePo parkingSpacePo = BeanConvertUtil.covertBean(businessParkingSpace, ParkingSpacePo.class); |
| | | super.delete(dataFlowContext, parkingSpacePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE); |
| | | super.update(dataFlowContext, parkingSpacePo, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_PARKING_SPACE); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // 计算feeTypeCd |
| | | |
| | | String feeTypeCd = "1001".equals(parkingSpaceDto.getTypeCd()) |
| | | ? (this.isHireParkingSpace(paramInJson) |
| | | ? FeeTypeConstant.FEE_TYPE_HIRE_UP_PARKING_SPACE |
| | | : FeeTypeConstant.FEE_TYPE_SELL_UP_PARKING_SPACE) |
| | | : (this.isHireParkingSpace(paramInJson) |
| | | ? FeeTypeConstant.FEE_TYPE_HIRE_DOWN_PARKING_SPACE |
| | | : FeeTypeConstant.FEE_TYPE_SELL_DOWN_PARKING_SPACE); |
| | | |
| | | // String feeTypeCd = "1001".equals(parkingSpaceDto.getTypeCd()) |
| | | // ? (this.isHireParkingSpace(paramInJson) |
| | | // ? FeeTypeConstant.FEE_TYPE_HIRE_UP_PARKING_SPACE |
| | | // : FeeTypeConstant.FEE_TYPE_SELL_UP_PARKING_SPACE) |
| | | // : (this.isHireParkingSpace(paramInJson) |
| | | // ? FeeTypeConstant.FEE_TYPE_HIRE_DOWN_PARKING_SPACE |
| | | // : FeeTypeConstant.FEE_TYPE_SELL_DOWN_PARKING_SPACE); |
| | | String feeTypeCd = FeeTypeConstant.FEE_TYPE_CAR; |
| | | paramInJson.put("feeTypeCd", feeTypeCd); |
| | | |
| | | //计算 receivableAmount |
| | | |
| | | |
| | | FeeConfigDto feeConfigDto = new FeeConfigDto(); |
| | | feeConfigDto.setFeeTypeCd(feeTypeCd); |
| | | feeConfigDto.setIsDefault("T"); |
| | | feeConfigDto.setConfigId(paramInJson.getString("configId")); |
| | | feeConfigDto.setCommunityId(paramInJson.getString("communityId")); |
| | | List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); |
| | | if (feeConfigDtos == null || feeConfigDtos.size() != 1) { |
| | |
| | | |
| | | feeConfigDto = feeConfigDtos.get(0); |
| | | |
| | | double receivableAmount = isHireParkingSpace(paramInJson) ? Double.parseDouble(feeConfigDto.getAdditionalAmount()) |
| | | * Double.parseDouble(paramInJson.getString("cycles")) : Double.parseDouble(feeConfigDto.getAdditionalAmount()); |
| | | double receivableAmount = Double.parseDouble(feeConfigDto.getAdditionalAmount()) |
| | | * Double.parseDouble(paramInJson.getString("cycles")); |
| | | |
| | | paramInJson.put("receivableAmount", receivableAmount); |
| | | paramInJson.put("configId", feeConfigDto.getConfigId()); |
| | | |
| | | //计算 amount |
| | | String amount = isHireParkingSpace(paramInJson) ? "-1.00" : String.valueOf(receivableAmount); |
| | | String amount = "-1.00"; |
| | | paramInJson.put("amount", amount); |
| | | |
| | | //计算 cycles |
| | | String cycles = isHireParkingSpace(paramInJson) ? paramInJson.getString("cycles") : "1"; |
| | | String cycles = paramInJson.getString("cycles"); |
| | | paramInJson.put("cycles", cycles); |
| | | |
| | | //计算结束时间 |
| | | String endTime = "2038-01-01 00:00:00"; |
| | | if (isHireParkingSpace(paramInJson)) { |
| | | Date et = DateUtil.getCurrentDate(); |
| | | Calendar endCalender = Calendar.getInstance(); |
| | | endCalender.setTime(et); |
| | | endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles"))); |
| | | endTime = DateUtil.getFormatTimeString(endCalender.getTime(), DateUtil.DATE_FORMATE_STRING_A); |
| | | } |
| | | String endTime = ""; |
| | | |
| | | Date et = DateUtil.getCurrentDate(); |
| | | Calendar endCalender = Calendar.getInstance(); |
| | | endCalender.setTime(et); |
| | | endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles"))); |
| | | endTime = DateUtil.getFormatTimeString(endCalender.getTime(), DateUtil.DATE_FORMATE_STRING_A); |
| | | |
| | | |
| | | paramInJson.put("endTime", endTime); |
| | | |