releaserelease_toaliyun_real
| @@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.*; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| import java.util.concurrent.TimeUnit; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/order/") | @RequestMapping("/api/order/") | ||||
| @@ -87,6 +88,13 @@ public class WxOrderController extends BaseController { | |||||
| if (hasKey) { | if (hasKey) { | ||||
| // 从缓存获取用户信息 | // 从缓存获取用户信息 | ||||
| wxCouponCVo = operations.get(key); | wxCouponCVo = operations.get(key); | ||||
| } else { | |||||
| // 游戏没有入缓存,需要从数据库中读取 | |||||
| wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId()); | |||||
| if (wxCouponCVo != null) { | |||||
| // 游戏优化,进缓存 | |||||
| cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS); | |||||
| } | |||||
| } | } | ||||
| if (wxCouponCVo == null) { | if (wxCouponCVo == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| @@ -298,6 +298,10 @@ public class PosController extends BaseController { | |||||
| "\"order_amount\":\"string单位(分)(必填)\"," + | "\"order_amount\":\"string单位(分)(必填)\"," + | ||||
| "\"order_amount_left\":\"string单位(分)(选填)\"," + | "\"order_amount_left\":\"string单位(分)(选填)\"," + | ||||
| "\"order_create_sn\":\"string单位(分)(必填)\"," + | "\"order_create_sn\":\"string单位(分)(必填)\"," + | ||||
| "\"payment_detail\":{支付时必填...." + | |||||
| "}" + | |||||
| "\"refund_detail\":{退款时必填...." + | |||||
| "}" + | |||||
| "\"payment_info\":{" + | "\"payment_info\":{" + | ||||
| "\"card_id\":\"string(必填)\"," + | "\"card_id\":\"string(必填)\"," + | ||||
| "\"card_spend_id\":\"string(必填)\"," + | "\"card_spend_id\":\"string(必填)\"," + | ||||
| @@ -1784,7 +1784,7 @@ public class PosServiceImpl implements PosService { | |||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | ||||
| String cuUserIdStr = params.get(WxPayConstant.MEM_ID); // 富茂系统会员ID | String cuUserIdStr = params.get(WxPayConstant.MEM_ID); // 富茂系统会员ID | ||||
| String cuPhoneStr = params.get(WxPayConstant.MEM_PHONE); // 富茂系统会员手机号 | String cuPhoneStr = params.get(WxPayConstant.MEM_PHONE); // 富茂系统会员手机号 | ||||
| String sceneTypeStr = params.get(WxPayConstant.SCENE_TYPE); // 场景类型 | |||||
| String sceneTypeStr = params.get(WxPayConstant.SCENE_TYPE); // 场景类型 | |||||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | ||||
| String posOrderTimeStr = params.get(WxPayConstant.POS_ORDER_TIME); // POS订单时间 | String posOrderTimeStr = params.get(WxPayConstant.POS_ORDER_TIME); // POS订单时间 | ||||
| String posAmountStr = params.get(WxPayConstant.ORDER_AMOUNT); // POS订单总额 | String posAmountStr = params.get(WxPayConstant.ORDER_AMOUNT); // POS订单总额 | ||||
| @@ -1855,9 +1855,17 @@ public class PosServiceImpl implements PosService { | |||||
| WxMerchantBUser merchantBUser = checkAndGetMerchantUser(buUserId, merchantId); | WxMerchantBUser merchantBUser = checkAndGetMerchantUser(buUserId, merchantId); | ||||
| // 4. 同步 | // 4. 同步 | ||||
| if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_PAY)) { | if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_PAY)) { | ||||
| String payDetail = params.get(WxPayConstant.PAY_DETAIL); | |||||
| if (StringUtils.isBlank(posStatusStr)) { | |||||
| errParam(WxPayConstant.PAYMENT_DETAIL); | |||||
| } | |||||
| // 4.1 支付同步 | // 4.1 支付同步 | ||||
| syncOrder(params, merchant, merchantBUser, iSceneType, posOrderId, memId, posAmount, orderTime, orderCreateSN); | syncOrder(params, merchant, merchantBUser, iSceneType, posOrderId, memId, posAmount, orderTime, orderCreateSN); | ||||
| } else if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_REFUND)) { | } else if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_REFUND)) { | ||||
| String payDetail = params.get(WxPayConstant.NEU_REFUND_DETAIL); | |||||
| if (StringUtils.isBlank(posStatusStr)) { | |||||
| errParam(WxPayConstant.REFUND_DETAIL); | |||||
| } | |||||
| // 退款同步 | // 退款同步 | ||||
| syncRefundOrder(params, merchantBUser, iSceneType, posOrderId, memId, posAmount, orderTime, orderCreateSN); | syncRefundOrder(params, merchantBUser, iSceneType, posOrderId, memId, posAmount, orderTime, orderCreateSN); | ||||
| } | } | ||||
| @@ -58,9 +58,5 @@ public class WxCardInfo extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | @io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer") | ||||
| private Integer supportTransfer; | private Integer supportTransfer; | ||||
| public boolean isBuyed() { | |||||
| return saleAmount > 0; | |||||
| } | |||||
| } | } | ||||
| @@ -114,6 +114,9 @@ public class WxPayConstant { | |||||
| public final static String REMAIN_AMOUNT = "remain_amount"; | public final static String REMAIN_AMOUNT = "remain_amount"; | ||||
| public final static String ORDER_STATUS = "order_status"; | public final static String ORDER_STATUS = "order_status"; | ||||
| public final static String PAYMENT_DETAIL = "payment_detail"; | |||||
| public final static String REFUND_DETAIL = "refund_detail"; | |||||
| public final static String POINT = "point"; | public final static String POINT = "point"; | ||||
| public final static String CREDIT = "credit"; | public final static String CREDIT = "credit"; | ||||
| @@ -38,7 +38,15 @@ public class WxBuserServiceImpl implements WxBuserService { | |||||
| @Override | @Override | ||||
| public WxBuser getByOpenId(WxBuser record) { | public WxBuser getByOpenId(WxBuser record) { | ||||
| return wxBuserMapper.findByOpenId(record); | |||||
| try { | |||||
| List<WxBuser> list = wxBuserMapper.selectList(new QueryWrapper(record)); | |||||
| if (list.size() > 0) { | |||||
| return list.get(0); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| logger.error("NOT found: " + e.getMessage()); | |||||
| } | |||||
| return null; | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -247,7 +247,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| if (payAccount.checkShare()) { | if (payAccount.checkShare()) { | ||||
| // 分账 | // 分账 | ||||
| if (cardInfo.isBuyed()) { | |||||
| if (cardInfo.getSaleAmount() > 0) { | |||||
| // 9. 只有有价卡才能分账 | // 9. 只有有价卡才能分账 | ||||
| try { | try { | ||||
| shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); | shareForCardPay(record, record.getCardId(), record.getOrderId(), record.getId()); | ||||
| @@ -270,7 +270,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| } | } | ||||
| } else { | } else { | ||||
| // 有价储值卡消费时,如果未启用分账,金额也记入补贴表,可能会导致查询错误, TODO | // 有价储值卡消费时,如果未启用分账,金额也记入补贴表,可能会导致查询错误, TODO | ||||
| if (cardInfo.isBuyed() && payment > 0) { | |||||
| if (cardInfo.getSaleAmount() > 0 && payment > 0) { | |||||
| try { | try { | ||||
| creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | creteMerchantSubsidy(record, curDate, idWorker, coupon, payment); | ||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||