| @@ -163,7 +163,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| } | } | ||||
| if(couponOrder != null) { | if(couponOrder != null) { | ||||
| wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder, wxMerchantBUser); | |||||
| wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder.getTenantId(), couponOrderId, wxMerchantBUser.getId()); | |||||
| } | } | ||||
| return new ResultData(couponOrder); | return new ResultData(couponOrder); | ||||
| @@ -30,6 +30,7 @@ public class PosController extends BaseController { | |||||
| private final PosService posService; | private final PosService posService; | ||||
| private final ThDevInfoService thDevInfoService; | private final ThDevInfoService thDevInfoService; | ||||
| private final WxCouponOrderService couponOrderService; | |||||
| @ApiOperation(value = "获取会员折扣/优惠券/消费卡是否启用", notes = "{" + | @ApiOperation(value = "获取会员折扣/优惠券/消费卡是否启用", notes = "{" + | ||||
| "\"dev_id\":\"string(必填)\"," + | "\"dev_id\":\"string(必填)\"," + | ||||
| @@ -106,7 +107,7 @@ public class PosController extends BaseController { | |||||
| "\"pos_amount\":\"string(单位:分)(必填)\"," + | "\"pos_amount\":\"string(单位:分)(必填)\"," + | ||||
| "\"nonce_str\":\"string(必填)\"}") | "\"nonce_str\":\"string(必填)\"}") | ||||
| @PostMapping("/checkMem") | @PostMapping("/checkMem") | ||||
| @SystemControllerLog(description = "获取会员折扣/优惠券/消费卡是否启用") | |||||
| @SystemControllerLog(description = "会员识别") | |||||
| public Map<String, String> checkMem(@RequestBody Map<String, String> params) { | public Map<String, String> checkMem(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -145,6 +146,7 @@ public class PosController extends BaseController { | |||||
| "\"pos_order_id\":\"string(选填)\"," + | "\"pos_order_id\":\"string(选填)\"," + | ||||
| "\"pos_amount\":\"单位(分)(选填)\"}") | "\"pos_amount\":\"单位(分)(选填)\"}") | ||||
| @PostMapping("/checkCouponOrderForVerify") | @PostMapping("/checkCouponOrderForVerify") | ||||
| @SystemControllerLog(description = "券核销检查") | |||||
| public Map<String, String> checkCouponOrderVerify(@RequestBody Map<String, String> params) { | public Map<String, String> checkCouponOrderVerify(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -182,6 +184,7 @@ public class PosController extends BaseController { | |||||
| "\"pos_order_id\":\"string(必填)\"," + | "\"pos_order_id\":\"string(必填)\"," + | ||||
| "\"pos_amount\":\"string(必填)\"}") | "\"pos_amount\":\"string(必填)\"}") | ||||
| @PostMapping("/couponOrderPreVerify") | @PostMapping("/couponOrderPreVerify") | ||||
| @SystemControllerLog(description = "券预核销") | |||||
| public Map<String, String> couponOrderPreVerify(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderPreVerify(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -218,6 +221,7 @@ public class PosController extends BaseController { | |||||
| "\"nonce_str\":\"string(必填)\" +" + | "\"nonce_str\":\"string(必填)\" +" + | ||||
| "\"pos_order_id\":\"string(必填)\" }") | "\"pos_order_id\":\"string(必填)\" }") | ||||
| @PostMapping("/couponOrderPreVerifyCancel") | @PostMapping("/couponOrderPreVerifyCancel") | ||||
| @SystemControllerLog(description = "券预核销取消") | |||||
| public Map<String, String> couponOrderPreVerifyCancel(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderPreVerifyCancel(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -254,6 +258,7 @@ public class PosController extends BaseController { | |||||
| "\"nonce_str\":\"string(必填)\" +" + | "\"nonce_str\":\"string(必填)\" +" + | ||||
| "\"pos_order_id\":\"string(必填)\" }") | "\"pos_order_id\":\"string(必填)\" }") | ||||
| @PostMapping("/couponOrderIndependentVerify") | @PostMapping("/couponOrderIndependentVerify") | ||||
| @SystemControllerLog(description = "券独立核销") | |||||
| public Map<String, String> couponOrderIndependentVerify(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderIndependentVerify(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -268,8 +273,6 @@ public class PosController extends BaseController { | |||||
| try { | try { | ||||
| retMap = posService.couponOrderVerifyDo(params, EnumVerifyActionType.VERIFY_INDEPENT); | retMap = posService.couponOrderVerifyDo(params, EnumVerifyActionType.VERIFY_INDEPENT); | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_SUCCESS, null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | ||||
| WxPayConstant.RET_FAIL, | WxPayConstant.RET_FAIL, | ||||
| @@ -279,6 +282,30 @@ public class PosController extends BaseController { | |||||
| WxPayConstant.RET_FAIL, | WxPayConstant.RET_FAIL, | ||||
| 500, e.getMessage()); | 500, e.getMessage()); | ||||
| } | } | ||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | |||||
| String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券ID | |||||
| Long buUserId, couponOrderId; | |||||
| try { | |||||
| buUserId = Long.valueOf(buUserIdStr); | |||||
| couponOrderId = Long.valueOf(couponOrderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||||
| } | |||||
| String returnCode = retMap.get(WxPayConstant.RETURN_CODE); | |||||
| String resultCode = retMap.get(WxPayConstant.RESULT_CODE); | |||||
| String errCode = retMap.get(WxPayConstant.ERR_CODE); | |||||
| if(returnCode.equalsIgnoreCase(WxPayConstant.RET_SUCCESS) && | |||||
| resultCode.equalsIgnoreCase(WxPayConstant.RET_SUCCESS) && | |||||
| StringUtils.isBlank(errCode)) { | |||||
| // 无异常信息,核销成功 | |||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId); | |||||
| } | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||||
| WxPayConstant.RET_SUCCESS, null); | |||||
| } | } | ||||
| @ApiOperation(value = "券交易核销-单个优惠券接口", notes = "{" + | @ApiOperation(value = "券交易核销-单个优惠券接口", notes = "{" + | ||||
| @@ -290,6 +317,7 @@ public class PosController extends BaseController { | |||||
| "\"nonce_str\":\"string(必填)\" +" + | "\"nonce_str\":\"string(必填)\" +" + | ||||
| "\"pos_order_id\":\"string(必填)\" }") | "\"pos_order_id\":\"string(必填)\" }") | ||||
| @PostMapping("/couponOrderPayVerifyOne") | @PostMapping("/couponOrderPayVerifyOne") | ||||
| @SystemControllerLog(description = "券交易核销-单个优惠券接口") | |||||
| public Map<String, String> couponOrderPayVerify(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderPayVerify(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -327,6 +355,7 @@ public class PosController extends BaseController { | |||||
| "\"pos_order_id\":\"string(必填)\"" + | "\"pos_order_id\":\"string(必填)\"" + | ||||
| "\"pay_amount\":\"单位(分)(必填)\" }") | "\"pay_amount\":\"单位(分)(必填)\" }") | ||||
| @PostMapping("/couponOrderPayVerifyList") | @PostMapping("/couponOrderPayVerifyList") | ||||
| @SystemControllerLog(description = "券交易核销-优惠券列表接口") | |||||
| public Map<String, String> couponOrderPayVerifyList(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderPayVerifyList(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -364,6 +393,7 @@ public class PosController extends BaseController { | |||||
| "\"pos_order_id\":\"string(必填)\"" + | "\"pos_order_id\":\"string(必填)\"" + | ||||
| "\"force\":\"string(选填true/false)\" }") | "\"force\":\"string(选填true/false)\" }") | ||||
| @PostMapping("/couponOrderVerifyCancel") | @PostMapping("/couponOrderVerifyCancel") | ||||
| @SystemControllerLog(description = "券核销取消") | |||||
| public Map<String, String> couponOrderIndependentVerifyCancel(@RequestBody Map<String, String> params) { | public Map<String, String> couponOrderIndependentVerifyCancel(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -391,7 +421,7 @@ public class PosController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation(value = "消费卡支付接口", notes = "{" + | |||||
| @ApiOperation(value = "消费卡预支付", notes = "{" + | |||||
| "\"dev_id\":\"string(必填)\"," + | "\"dev_id\":\"string(必填)\"," + | ||||
| "\"tenant_id\":\"string(必填)\"," + | "\"tenant_id\":\"string(必填)\"," + | ||||
| "\"merchant_id\":\"string(必填)\"," + | "\"merchant_id\":\"string(必填)\"," + | ||||
| @@ -400,7 +430,8 @@ public class PosController extends BaseController { | |||||
| "\"pos_order_id\":\"string(必填)\"," + | "\"pos_order_id\":\"string(必填)\"," + | ||||
| "\"pos_amount\":\"string(必填)\"," + | "\"pos_amount\":\"string(必填)\"," + | ||||
| "\"card_id\":\"string(必填)\" }") | "\"card_id\":\"string(必填)\" }") | ||||
| @PostMapping("/cardPay") | |||||
| @PostMapping("/cardPayPre") | |||||
| @SystemControllerLog(description = "消费卡预支付") | |||||
| public Map<String, String> cardPay(@RequestBody Map<String, String> params) { | public Map<String, String> cardPay(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -428,7 +459,7 @@ public class PosController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| @ApiOperation(value = "卡支付取消", notes = "{" + | |||||
| @ApiOperation(value = "消费卡支付取消", notes = "{" + | |||||
| "\"dev_id\":\"string(必填)\"," + | "\"dev_id\":\"string(必填)\"," + | ||||
| "\"tenant_id\":\"string(必填)\"," + | "\"tenant_id\":\"string(必填)\"," + | ||||
| "\"merchant_id\":\"string(必填)\"," + | "\"merchant_id\":\"string(必填)\"," + | ||||
| @@ -438,6 +469,7 @@ public class PosController extends BaseController { | |||||
| "\"nonce_str\":\"string(必填)\"," + | "\"nonce_str\":\"string(必填)\"," + | ||||
| "\"force\":\"string(选填true/false)\" }") | "\"force\":\"string(选填true/false)\" }") | ||||
| @PostMapping("/cardPayCancel") | @PostMapping("/cardPayCancel") | ||||
| @SystemControllerLog(description = "消费卡支付取消") | |||||
| public Map<String, String> cardPayCancel(@RequestBody Map<String, String> params) { | public Map<String, String> cardPayCancel(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| @@ -232,19 +232,12 @@ public class PosServiceImpl implements PosService { | |||||
| coQ.put("cUserId", user.getId()); | coQ.put("cUserId", user.getId()); | ||||
| coQ.put("merchantId", merchantId); | coQ.put("merchantId", merchantId); | ||||
| coQ.put("posOrderId", posOrderId); | coQ.put("posOrderId", posOrderId); | ||||
| coQ.put("posPayVerify", "1"); // 支付核销券需要 | |||||
| /// coQ.put("posIndepVerify", "1"); | |||||
| List<Map> couponOrderList = couponOrderService.findAvailCouponOrder(coQ); | List<Map> couponOrderList = couponOrderService.findAvailCouponOrder(coQ); | ||||
| if (couponOrderList.size() > 0) { | if (couponOrderList.size() > 0) { | ||||
| retMap.put(WxPayConstant.AVAIL_CO_LIST, | retMap.put(WxPayConstant.AVAIL_CO_LIST, | ||||
| JSONArray.toJSONString( | |||||
| couponOrderList | |||||
| .stream() | |||||
| .filter(co -> | |||||
| (co.get("type") == EnumCouponType.COUPON_MULTIMCH.getCode() || | |||||
| co.get("type") == EnumCouponType.COUPON_MANJIAN.getCode() || | |||||
| co.get("type") == EnumCouponType.COUPON_DAIJIN.getCode() | |||||
| )) | |||||
| .collect(Collectors.toList()) | |||||
| )); | |||||
| JSONArray.toJSONString(couponOrderList)); | |||||
| } else { | } else { | ||||
| retMap.put(WxPayConstant.AVAIL_CO_LIST, "[]"); | retMap.put(WxPayConstant.AVAIL_CO_LIST, "[]"); | ||||
| } | } | ||||
| @@ -827,6 +820,12 @@ public class PosServiceImpl implements PosService { | |||||
| logger.error(ErrorCode.COUPON_ORDER_IS_NULL.getMessage() + ": " + couponOrderIdStr); | logger.error(ErrorCode.COUPON_ORDER_IS_NULL.getMessage() + ": " + couponOrderIdStr); | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); | ||||
| } | } | ||||
| // 5. 有价券无法反向, 补贴券无法反向 | |||||
| WxCoupon coupon = couponMapper.selectByPrimaryKey(couponOrderCVo.getCouponId()); | |||||
| if (coupon.getSalePrice() > 0 || coupon.getSubsidyNum() > 0) { | |||||
| logger.error("券包ID: " + couponOrderCVo.getId() + "核销无法退回"); | |||||
| throw new MallinkException(ErrorCode.POS_COUPON_ORDER_VERIFY_NOT_CANCEL); | |||||
| } | |||||
| // 6. 检查适用门店 | // 6. 检查适用门店 | ||||
| WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | WxCouponMerchant wxCouponMerchant = new WxCouponMerchant(); | ||||
| wxCouponMerchant.setProductId(couponOrderCVo.getCouponId()); | wxCouponMerchant.setProductId(couponOrderCVo.getCouponId()); | ||||
| @@ -45,6 +45,20 @@ public class PosAppTest { | |||||
| private static final String devResKey = "VE#1fB2PhUe@&3Of"; | private static final String devResKey = "VE#1fB2PhUe@&3Of"; | ||||
| private static final String tenantId = "456"; | private static final String tenantId = "456"; | ||||
| private static final String merchantId = "320833942159982592"; // 东软专用 | |||||
| private static final String buUserId = "320834180694245376"; | |||||
| /* | |||||
| coupon_order_id, coupon_type, 售价, 面额 | |||||
| 321872988134408192, 4, 0, 2000, 免费券 | |||||
| 321877927162249216, 2, 0, 10000, 免费券 | |||||
| 321878123232591872, 2, 1, 10000, 有价券 | |||||
| 321878185355214848, 1, 0, 10000, 免费券 | |||||
| 321878223800205312, 6, 0, 1000, 免费券 | |||||
| 321878329906921472, 6, 1, 1000, 有价券 | |||||
| 321882224846667776, 8, 1, 1500, 有价券 | |||||
| 321883878446825472, 100, 1, 50000, 消费卡 | |||||
| */ | |||||
| @Test | @Test | ||||
| public void versionTest() throws Exception { | public void versionTest() throws Exception { | ||||
| @@ -60,8 +74,8 @@ public class PosAppTest { | |||||
| public void signErrorTest() throws Exception { | public void signErrorTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, ""); | reqObj.put(WxPayConstant.DEV_ID, ""); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, ""); | reqObj.put(WxPayConstant.BUSER_ID, ""); | ||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, ""); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, ""); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, ""); | reqObj.put(WxPayConstant.NONCE_STR, ""); | ||||
| @@ -127,7 +141,7 @@ public class PosAppTest { | |||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | reqObj.put(WxPayConstant.TENANT_ID, tenantId); | ||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "320833942159982592"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| // reqObj.put(WxPayConstant.MEM_ID, "321178010928119808"); | // reqObj.put(WxPayConstant.MEM_ID, "321178010928119808"); | ||||
| reqObj.put(WxPayConstant.MEM_PHONE, "13910154397"); | reqObj.put(WxPayConstant.MEM_PHONE, "13910154397"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -152,10 +166,10 @@ public class PosAppTest { | |||||
| public void checkCouponOrderForIndeepdentVerifyTest() throws Exception { | public void checkCouponOrderForIndeepdentVerifyTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "321872988134408192"); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.VERIFY_TYPE, "independent"); | reqObj.put(WxPayConstant.VERIFY_TYPE, "independent"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -180,9 +194,9 @@ public class PosAppTest { | |||||
| public void checkCouponOrderForPayVerifyTest() throws Exception { | public void checkCouponOrderForPayVerifyTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.VERIFY_TYPE, "pay"); | reqObj.put(WxPayConstant.VERIFY_TYPE, "pay"); | ||||
| @@ -208,10 +222,10 @@ public class PosAppTest { | |||||
| public void couponOrderIndependentVerifyTest() throws Exception { | public void couponOrderIndependentVerifyTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "321872988134408192"); | |||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey)); | ||||
| @@ -235,9 +249,9 @@ public class PosAppTest { | |||||
| public void couponOrderVerifyCancelTest() throws Exception { | public void couponOrderVerifyCancelTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -261,9 +275,9 @@ public class PosAppTest { | |||||
| public void couponOrderPreVerifyTest() throws Exception { | public void couponOrderPreVerifyTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -288,9 +302,9 @@ public class PosAppTest { | |||||
| public void couponOrderPreVerifyCancelTest() throws Exception { | public void couponOrderPreVerifyCancelTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -314,9 +328,9 @@ public class PosAppTest { | |||||
| public void couponOrderPayVerifyTest() throws Exception { | public void couponOrderPayVerifyTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | reqObj.put(WxPayConstant.COUPON_ORDER_ID, "318978990426783744"); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -341,9 +355,9 @@ public class PosAppTest { | |||||
| public void couponOrderPayVerifyListTest() throws Exception { | public void couponOrderPayVerifyListTest() throws Exception { | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.DEV_ID, devId); | reqObj.put(WxPayConstant.DEV_ID, devId); | ||||
| reqObj.put(WxPayConstant.TENANT_ID, "456"); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, "317109453987631104"); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, "317111133332426752"); | |||||
| reqObj.put(WxPayConstant.TENANT_ID, tenantId); | |||||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||||
| reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, "[\"318978990426783744\"]"); | reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, "[\"318978990426783744\"]"); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | reqObj.put(WxPayConstant.POS_ORDER_ID, "1"); | ||||
| @@ -238,6 +238,8 @@ public enum ErrorCode{ | |||||
| POS_CONFIG_NOT_FOUND(11100, "POS会员相关未设置"), | POS_CONFIG_NOT_FOUND(11100, "POS会员相关未设置"), | ||||
| POS_CONFIG_MEM_DISCOUNT_DISABLE(11101, "POS会员折扣未启用"), | POS_CONFIG_MEM_DISCOUNT_DISABLE(11101, "POS会员折扣未启用"), | ||||
| POS_CONFIG_MEM_COUPON_DISABLE(11102, "POS会员优惠券未启用"), | POS_CONFIG_MEM_COUPON_DISABLE(11102, "POS会员优惠券未启用"), | ||||
| POS_COUPON_ORDER_VERIFY_NOT_CANCEL(11103, "此券核销无法取消"), | |||||
| POS_CAR_PAY_NOT_CANCEL(11104, "卡支付无法取消"), | |||||
| /** | /** | ||||
| @@ -49,6 +49,10 @@ public class WxPayConstant { | |||||
| public final static String DEDUCT_AMOUNT = "deduct_amount"; | public final static String DEDUCT_AMOUNT = "deduct_amount"; | ||||
| public final static String REMAIN_AMOUNT = "remain_amount"; | public final static String REMAIN_AMOUNT = "remain_amount"; | ||||
| public final static String REAL_AMOUNT = "real_amount"; | |||||
| public final static String SALE_PRICE = "sale_price"; | |||||
| public final static String SALE_FEE = "sale_fee"; | |||||
| public final static String ORG_AMOUNT = "org_amount"; | public final static String ORG_AMOUNT = "org_amount"; | ||||
| public final static String RET = "ret"; | public final static String RET = "ret"; | ||||
| @@ -57,7 +57,7 @@ public interface WxCouponOrderService { | |||||
| /** | /** | ||||
| * 核销后发送消息 | * 核销后发送消息 | ||||
| */ | */ | ||||
| void sendInsideCouponVerifyMsg(WxCouponOrder couponOrder, WxMerchantBUser bUser); | |||||
| void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId); | |||||
| /** | /** | ||||
| * 核销后处理 | * 核销后处理 | ||||
| @@ -387,12 +387,12 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void sendInsideCouponVerifyMsg(WxCouponOrder couponOrder, WxMerchantBUser bUser) { | |||||
| public void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId) { | |||||
| FmInsideCouponVerifyMsg verifyMsg = new FmInsideCouponVerifyMsg(); | FmInsideCouponVerifyMsg verifyMsg = new FmInsideCouponVerifyMsg(); | ||||
| verifyMsg.setMsgType(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode()); | verifyMsg.setMsgType(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode()); | ||||
| verifyMsg.setTenantId(couponOrder.getTenantId()); | |||||
| verifyMsg.setCouponOrderId(couponOrder.getId()); | |||||
| verifyMsg.setBUserId(bUser.getId()); | |||||
| verifyMsg.setTenantId(tenantId); | |||||
| verifyMsg.setCouponOrderId(couponOrderId); | |||||
| verifyMsg.setBUserId(buUserId); | |||||
| mqBaseProducer.sendMessage(verifyMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | mqBaseProducer.sendMessage(verifyMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | ||||
| } | } | ||||
| @@ -1044,7 +1044,8 @@ | |||||
| </select> | </select> | ||||
| <select id="findAvailCouponOrder" parameterType="java.util.Map" resultType="hashmap"> | <select id="findAvailCouponOrder" parameterType="java.util.Map" resultType="hashmap"> | ||||
| select co.id, c.title, c.type, co.create_date, co.expired_time, c.price | |||||
| select co.id, c.title, c.type, co.create_date, co.expired_time, c.price, | |||||
| if((co.coupon_price > 0 or (c.subsidy_type>0 and c.subsidy_num >0)), 'NO', 'YES') as ava_cancel | |||||
| from wx_coupon_order co | from wx_coupon_order co | ||||
| left join wx_coupon_merchant cm on cm.product_id = co.coupon_id | left join wx_coupon_merchant cm on cm.product_id = co.coupon_id | ||||
| left join wx_coupon c on c.id = co.coupon_id | left join wx_coupon c on c.id = co.coupon_id | ||||
| @@ -1052,8 +1053,15 @@ | |||||
| and co.coupon_order_status = 0 | and co.coupon_order_status = 0 | ||||
| and cm.merchant_id = #{merchantId} | and cm.merchant_id = #{merchantId} | ||||
| and co.expired_time > now() | and co.expired_time > now() | ||||
| <if test="posPayVerify != null"> | |||||
| and c.type in (1, 2, 6) | |||||
| </if> | |||||
| <if test="posIndepVerify != null"> | |||||
| and c.type in (4, 6, 8, 9) | |||||
| </if> | |||||
| union | union | ||||
| select co.id,c.title, c.type, co.create_date, co.expired_time, c.price | |||||
| select co.id, c.title, c.type, co.create_date, co.expired_time, c.price, | |||||
| if((co.coupon_price > 0 or (c.subsidy_type>0 and c.subsidy_num >0)), 'NO', 'YES') as ava_cancel | |||||
| from wx_coupon_order co | from wx_coupon_order co | ||||
| left join wx_coupon_merchant cm on cm.product_id = co.coupon_id | left join wx_coupon_merchant cm on cm.product_id = co.coupon_id | ||||
| left join wx_coupon c on c.id = co.coupon_id | left join wx_coupon c on c.id = co.coupon_id | ||||
| @@ -1063,6 +1071,12 @@ | |||||
| and cm.merchant_id = #{merchantId} | and cm.merchant_id = #{merchantId} | ||||
| and co.expired_time > now() | and co.expired_time > now() | ||||
| and pco.pos_order_id = #{posOrderId} | and pco.pos_order_id = #{posOrderId} | ||||
| <if test="posPayVerify != null"> | |||||
| and c.type in (1, 2, 6) | |||||
| </if> | |||||
| <if test="posIndepVerify != null"> | |||||
| and c.type in (4, 6, 8, 9) | |||||
| </if> | |||||
| </select> | </select> | ||||