/** * 订单可否支付确认 * * @param request * @param orderCode * @return */ @RequestMapping(value = "/query/orderBePaidConfirm", method = RequestMethod.POST) @ResponseBody public RestResultDTO orderBePaidConfirm(String orderCode) { RestResultDTO restResultDTO = new RestResultDTO(); try { if (!CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) { throw new IllegalArgumentException("请输入正确的订单号"); } Order order = orderRelatedQueryService.getByOrderCode(orderCode); restResultDTO.initStatus(StatusCode.OK); if (order != null) { if (order.getOrderStatus() == OrderStatusEnum.CREATED.getValue()) { restResultDTO.setBody(JhjMoneyUtil.getInstance().getMoneyString(order.getTotalPrice())); } else { restResultDTO.initStatus(StatusCode.INTERNAL_SERVER_ERROR); restResultDTO.setMessage("订单已支付或已关闭,不能再支付"); } } else { restResultDTO.initStatus(StatusCode.NOT_FOUND); } } catch (Exception e) { exceptionDeal(restResultDTO, e, "orderBePaidConfirm", "订单可否支付确认失败"); } return restResultDTO; }
/** * 订单支付成功确认 * * @param orderCode * @param memberPin * @param payChannel * @param payCode * @param payTime * @return */ @RequestMapping(value = "/update/orderPaySuccessConfirm", method = RequestMethod.POST) @ResponseBody public RestResultDTO orderPaySuccessConfirm( String memberPin, String orderCode, Integer payMoney, Integer payChannel, String payCode, String payTime) { RestResultDTO restResultDTO = new RestResultDTO(); try { CommonValidateUtil.notEmpty(memberPin, "会员不能为空"); if (!CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) { throw new IllegalArgumentException("请输入正确的订单号"); } Validate.notNull(payMoney, "支付金额不能为空"); if (payMoney <= 0) { throw new IllegalArgumentException("请输入正确的支付金额"); } Validate.notNull(payChannel, "支付渠道不能为空"); Validate.notNull(OrderPayChannelEnum.get(payChannel), "支付渠道不能为空"); if (!CommonValidateUtil.validateRangeLengthStr(payCode, 1, 50)) { throw new IllegalArgumentException("支付编码不能为空"); } CommonValidateUtil.notEmpty(payTime, "支付时间不能为空"); restResultDTO = orderCreateAndPayService.orderPaySuccessConfirm( memberPin, orderCode, payMoney, payChannel, payCode, DateOperator.parse(payTime, "yyyyMMddHHmmss")); /*----- 校验订单上的产品副本是否已和保险公司对接成功 -----*/ Order order = orderRelatedQueryService.getByOrderCode(orderCode); if (order != null && order.getId() != null) { if (!order.getProductDocked()) restResultDTO.setBody(CustomCode.NO_CALL_AUTOMATIC_INS_ACCEPT_INTER); } } catch (Exception e) { exceptionDeal(restResultDTO, e, "orderPaySuccessConfirm", "订单支付成功确认失败"); } return restResultDTO; }
@RequestMapping(value = "/query/getOrderDetail", method = RequestMethod.POST) @ResponseBody public RestResultDTO getDetail(String orderCode, String memberPin) { RestResultDTO restResponse = new RestResultDTO(); try { CommonValidateUtil.notEmpty(memberPin, "会员不能为空"); if (CommonValidateUtil.validateFixedLengthDigital(orderCode, 20)) { // Order entity = orderRelatedQueryService.getByOrderCodeAndMemPin(orderCode, memberPin); Order entity = orderRelatedQueryService.getByOrderCode(orderCode); if (entity != null && entity.getMemberPin().equals(memberPin)) { restResponse.setBody(new OrderVO(entity)); } } restResponse.initStatus(StatusCode.OK); // logRequest(request.getRemoteAddr(), "查询订单[订单号]", orderCode, "成功"); } catch (Exception e) { exceptionDeal(restResponse, e, "getDetail", "查询订单失败[订单号]"); } return restResponse; }
public OrderVO(Order entity) { super(); if (entity != null) { this.orderCode = entity.getOrderCode(); this.orderScope = entity.getOrderScope(); // 数据来源 this.dataSource = SourceEnum.get(entity.getDataSource().intValue()).getDesc(); /*渠道来源相关*/ Integer channelSource = entity.getChannelSource(); ChannelSourceEnum channelSourceEnum = ChannelSourceEnum.get(channelSource); if (channelSourceEnum != null) { this.channelSource = channelSourceEnum.getValue(); this.channelSourceDesc = channelSourceEnum.getDesc(); } /*状态相关*/ this.orderStatus = entity.getOrderStatus(); this.orderStatusDesc = OrderStatusEnum.get(entity.getOrderStatus().intValue()).getDesc(); // 下单时间 this.createTime = JhjTimeUtil.getInstance() .getStringFromDate(entity.getCreateTime(), "yyyy-MM-dd HH:mm:ss"); /*下单会员相关*/ this.memberPin = entity.getMemberPin(); this.memberName = entity.getMemberName(); this.memberMobile = entity.getMemberMobile(); /*产品相关*/ // this.productOutsideCode = entity.getProductOutsideCode(); this.productCode = entity.getProductCode(); this.productName = entity.getProductName(); this.productDocked = entity.getProductDocked(); this.productNum = entity.getProductNum(); /*价格相关*/ this.productUnitPrice = JhjMoneyUtil.getInstance().getMoneyString(entity.getProductUnitPrice()); this.totalPrice = JhjMoneyUtil.getInstance().getMoneyString(entity.getTotalPrice()); // 投保人 this.holder = entity.getHolder(); // 被保险人 this.insured = entity.getInsured(); Byte payChannel = entity.getPayChannel(); if (payChannel != null) { OrderPayChannelEnum channelEnum = OrderPayChannelEnum.get(payChannel.intValue()); if (channelEnum != null) { this.payChannel = channelEnum.getDesc(); } } this.payCode = entity.getPayCode(); if (entity.getPayCompleteTime() != null) { this.payMoney = JhjMoneyUtil.getInstance().getMoneyString(entity.getPayMoney()); this.payCompleteTime = JhjTimeUtil.getInstance() .getStringFromDate(entity.getPayCompleteTime(), "yyyy-MM-dd HH:mm:ss"); } if (entity.getProdPromotionFeeRatio() != null) this.prodPromotionFeeRatio = entity.getProdPromotionFeeRatio() / 100.0 + "%"; if (entity.getMemPromotionFeeRatio() != null) this.memPromotionFeeRatio = entity.getMemPromotionFeeRatio() / 100.0 + "%"; if (entity.getPromotionFee() != null) this.promotionFee = JhjMoneyUtil.getInstance().getMoneyString(entity.getPromotionFee()); if (entity.getProdReferralFeeRatio() != null) this.prodReferralFeeRatio = entity.getProdReferralFeeRatio() / 100.0 + "%"; if (entity.getMemReferralFeeRatio() != null) this.memReferralFeeRatio = entity.getMemReferralFeeRatio() / 100.0 + "%"; if (entity.getReferralFee() != null) this.referralFee = JhjMoneyUtil.getInstance().getMoneyString(entity.getReferralFee()); if (entity.getCompleteTime() != null) this.completeTime = JhjTimeUtil.getInstance() .getStringFromDate(entity.getCompleteTime(), "yyyy-MM-dd HH:mm:ss"); } else { new OrderVO(); } }