Search in sources :

Example 1 with OrderPayDo

use of com.ikoori.vip.common.dto.OrderPayDo in project vip by guangdada.

the class WebOrderController method pay.

@ApiOperation("会员优惠券、积分结算接口")
@RequestMapping(value = "pay", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> pay(@ApiParam(value = "店铺编号", required = true) @RequestParam(required = true) String storeNo, @ApiParam(value = "手机号", required = true) @RequestParam(required = true) String mobile, @ApiParam(value = "订单号", required = true) @RequestParam(required = true) String orderNo, @ApiParam(value = "订单总额", required = true) @RequestParam(required = true) String balanceDue, @ApiParam(value = "支付金额", required = true) @RequestParam(required = true) String payment, @ApiParam(value = "使用积分", required = true) @RequestParam(required = true) String point, @ApiParam(value = "优惠金额", required = true) @RequestParam(required = true) String discount, @ApiParam(value = "优惠券明细", required = true) @RequestParam(required = true) String coupons, @ApiParam(value = "订单明细", required = true) @RequestParam(required = true) String orderItems, @ApiParam(value = "签名", required = true) @RequestParam(required = true) String sign) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("code", "200");
    result.put("msg", "请求成功");
    try {
        log.info(">>>>>>>>>>>>>>>>>>>>>>>会员优惠券、积分结算接口>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        boolean isSign = true;
        if (gunsProperties.isCheckSign()) {
            Map<String, String> data = new HashMap<String, String>();
            data.put("storeNo", storeNo);
            data.put("mobile", mobile);
            data.put("mobile", orderNo);
            data.put("balanceDue", balanceDue);
            data.put("payment", payment);
            data.put("point", point);
            data.put("discount", discount);
            data.put("coupons", coupons);
            data.put("orderItems", orderItems);
            data.put("sign", sign);
            log.info("请求参数:" + data.toString());
            isSign = WXPayUtil.isSignatureValid(data, gunsProperties.getSignKey());
            if (!isSign) {
                log.info("签名失败");
                result.put("code", "500");
                result.put("msg", "签名失败");
            }
        }
        if (isSign) {
            OrderPayDo orderPayDo = new OrderPayDo();
            orderPayDo.setStoreNo(storeNo);
            orderPayDo.setMobile(mobile);
            orderPayDo.setOrderNo(orderNo);
            orderPayDo.setBalanceDue(Integer.valueOf(balanceDue));
            orderPayDo.setPayment(Integer.valueOf(payment));
            orderPayDo.setDiscount(Integer.valueOf(discount));
            orderPayDo.setPoint(Integer.valueOf(point));
            orderPayDo.setCoupons(JSONArray.parseArray(coupons, CouponPayDo.class));
            orderPayDo.setOrderItems(JSONArray.parseArray(orderItems, OrderItemPayDo.class));
            orderPayDo.setOrderSource(OrderSource.offline.getCode());
            orderService.saveOrder(orderPayDo);
        }
    } catch (BussinessException e) {
        log.error("", e);
        result.put("code", e.getCode());
        result.put("msg", e.getMessage());
    } catch (Exception e) {
        log.error("", e);
        result.put("code", "500");
        result.put("msg", "请求失败");
    }
    log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<会员优惠券、积分结算接口<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
    return result;
}
Also used : HashMap(java.util.HashMap) CouponPayDo(com.ikoori.vip.common.dto.CouponPayDo) OrderItemPayDo(com.ikoori.vip.common.dto.OrderItemPayDo) OrderPayDo(com.ikoori.vip.common.dto.OrderPayDo) BussinessException(com.ikoori.vip.common.exception.BussinessException) BussinessException(com.ikoori.vip.common.exception.BussinessException) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 2 with OrderPayDo

use of com.ikoori.vip.common.dto.OrderPayDo in project vip by guangdada.

the class GwOrderController method pay.

@ApiOperation("会员优惠券、积分结算接口")
@RequestMapping(value = "pay", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> pay(@ApiParam(value = "店铺编号", required = true) @RequestParam(required = true) String storeNo, @ApiParam(value = "openid", required = true) @RequestParam(required = true) String openid, @ApiParam(value = "订单号", required = true) @RequestParam(required = true) String orderNo, @ApiParam(value = "订单总额", required = true) @RequestParam(required = true) String balanceDue, @ApiParam(value = "支付金额", required = true) @RequestParam(required = true) String payment, @ApiParam(value = "使用积分", required = true) @RequestParam(required = true) String point, @ApiParam(value = "优惠金额", required = true) @RequestParam(required = true) String discount, @ApiParam(value = "优惠券明细", required = true) @RequestParam(required = true) String coupons, @ApiParam(value = "订单明细", required = true) @RequestParam(required = true) String orderItems, @ApiParam(value = "签名", required = true) @RequestParam(required = true) String sign) {
    Map<String, Object> result = new HashMap<String, Object>();
    result.put("code", "200");
    result.put("msg", "请求成功");
    try {
        log.info(">>>>>>>>>>>>>>>>>>>>>>>会员优惠券、积分结算接口>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        boolean isSign = true;
        if (gunsProperties.isCheckSign()) {
            Map<String, String> data = new HashMap<String, String>();
            data.put("storeNo", storeNo);
            data.put("openid", openid);
            data.put("mobile", orderNo);
            data.put("balanceDue", balanceDue);
            data.put("payment", payment);
            data.put("point", point);
            data.put("discount", discount);
            data.put("coupons", coupons);
            data.put("orderItems", orderItems);
            data.put("sign", sign);
            log.info("请求参数:" + data.toString());
            isSign = WXPayUtil.isSignatureValid(data, gunsProperties.getSignKey());
            if (isSign) {
                log.info("签名失败");
                result.put("code", "500");
                result.put("msg", "签名失败");
            }
        }
        if (isSign) {
            OrderPayDo orderPayDo = new OrderPayDo();
            orderPayDo.setStoreNo(storeNo);
            orderPayDo.setOpenid(openid);
            orderPayDo.setOrderNo(orderNo);
            orderPayDo.setBalanceDue(Integer.valueOf(balanceDue));
            orderPayDo.setPayment(Integer.valueOf(payment));
            orderPayDo.setDiscount(StringUtils.isBlank(discount) ? null : Integer.valueOf(discount));
            orderPayDo.setPoint(StringUtils.isBlank(point) ? null : Integer.valueOf(point));
            orderPayDo.setCoupons(StringUtils.isBlank(coupons) ? null : JSONArray.parseArray(coupons, CouponPayDo.class));
            orderPayDo.setOrderItems(JSONArray.parseArray(orderItems, OrderItemPayDo.class));
            orderPayDo.setOrderSource(OrderSource.gw.getCode());
            orderService.saveOrder(orderPayDo);
        }
    } catch (BussinessException e) {
        log.error("", e);
        result.put("code", e.getCode());
        result.put("msg", e.getMessage());
    } catch (Exception e) {
        log.error("", e);
        result.put("code", "500");
        result.put("msg", "请求失败");
    }
    log.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<会员优惠券、积分结算接口<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
    return result;
}
Also used : HashMap(java.util.HashMap) OrderItemPayDo(com.ikoori.vip.common.dto.OrderItemPayDo) OrderPayDo(com.ikoori.vip.common.dto.OrderPayDo) BussinessException(com.ikoori.vip.common.exception.BussinessException) BussinessException(com.ikoori.vip.common.exception.BussinessException) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

OrderItemPayDo (com.ikoori.vip.common.dto.OrderItemPayDo)2 OrderPayDo (com.ikoori.vip.common.dto.OrderPayDo)2 BussinessException (com.ikoori.vip.common.exception.BussinessException)2 ApiOperation (io.swagger.annotations.ApiOperation)2 HashMap (java.util.HashMap)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 CouponPayDo (com.ikoori.vip.common.dto.CouponPayDo)1