Просмотр исходного кода

[POS][修改]:券核销同步

release_toaliyun_real
Stormeye Wu 6 лет назад
Родитель
Сommit
5f4dad11c1
10 измененных файлов: 203 добавлений и 344 удалений
  1. +2
    -0
      mallinkAdmin/src/main/resources/db/migration/V201908291430__POS_CHANGED.sql
  2. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java
  3. +42
    -35
      mallinkPosApi/src/main/java/com/iformall/controller/PosController.java
  4. +29
    -14
      mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java
  5. +118
    -273
      mallinkPosApi/src/test/java/com/iformall/pos/test/PosAppTest.java
  6. +0
    -2
      mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCouponVerifyMsg.java
  7. +2
    -0
      mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java
  8. +2
    -2
      mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java
  9. +6
    -11
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java
  10. +1
    -6
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCouponVerifyMsgServiceImpl.java

+ 2
- 0
mallinkAdmin/src/main/resources/db/migration/V201908291430__POS_CHANGED.sql Просмотреть файл

@@ -0,0 +1,2 @@
alter table wx_pay_order
change column `pos_pay_id` `pos_pay_order_id` bigint(20) NULL COMMENT 'POS支付订单ID';

+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCouponOrderController.java Просмотреть файл

@@ -164,7 +164,7 @@ public class WxCouponOrderController extends BaseController {
}

if(couponOrder != null) {
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder.getTenantId(), couponOrderId, wxMerchantBUser.getId(), EnumCouponVerifyType.VERIFY_B.getCode());
wxCouponOrderService.sendInsideCouponVerifyMsg(couponOrder.getTenantId(), couponOrderId, wxMerchantBUser.getId());
}

return new ResultData(couponOrder);


+ 42
- 35
mallinkPosApi/src/main/java/com/iformall/controller/PosController.java Просмотреть файл

@@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.*;

@RestController
@@ -30,6 +31,8 @@ public class PosController extends BaseController {

private final Logger logger = LoggerFactory.getLogger(this.getClass());

private final SimpleDateFormat neuDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");

private final PosService posService;
private final ThDevInfoService thDevInfoService;
private final WxCouponOrderService couponOrderService;
@@ -313,12 +316,11 @@ public class PosController extends BaseController {
WxPayConstant.RET_FAIL,
500, e.getMessage());
}
doActionAfterVerify(params, retMap, EnumCouponVerifyType.VERIFY_POS_INDEPENDENT);
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_SUCCESS, null);
}

private void doActionAfterVerify(@RequestBody Map<String, String> params, Map<String, String> retMap, EnumCouponVerifyType verifyType) {
private void doActionAfterVerify(Map<String, String> params, Map<String, String> retMap) {
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
@@ -334,7 +336,7 @@ public class PosController extends BaseController {
String errCode = retMap.get(WxPayConstant.ERR_CODE);
if(StringUtils.isBlank(errCode)) {
// 无异常信息,核销成功
couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId, verifyType.getCode());
couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId);
}
}

@@ -450,6 +452,37 @@ public class PosController extends BaseController {
}
}

@ApiOperation(value = "POS订单同步", notes = "支付成功/支付取消后订单同步")
@PostMapping("/posOrderSync")
@SystemControllerLog(description = "POS订单同步")
public Map<String, String> posOrderSync(@RequestBody Map<String, String> params) {
logger.info(params.toString());
JSONObject payContent = new JSONObject();

// 1. check sign
Map<String, String> retMap = checkSign(params, payContent);
if (retMap != null) {
// 签名相关异常返回
return retMap;
}
String resKey = payContent.getString(WxPayConstant.RES_KEY);
logger.info(WxPayConstant.RES_KEY + ": " + resKey);

try {
retMap = posService.posOrderSync(params);
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_SUCCESS, null);
} catch (MallinkException e) {
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_FAIL,
e.getErrorCode(), e.getMessage());
} catch (Exception e) {
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_FAIL,
500, e.getMessage());
}
}

private Map<String, String> couponOrderPayVerify(@RequestBody Map<String, String> params) {
JSONObject payContent = new JSONObject();

@@ -474,7 +507,7 @@ public class PosController extends BaseController {
500, e.getMessage());
}

doActionAfterVerify(params, retMap, EnumCouponVerifyType.VERIFY_POS_PAY);
doActionAfterVerify(params, retMap);
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_SUCCESS, null);
}
@@ -531,7 +564,7 @@ public class PosController extends BaseController {
String errCode = retMap.get(WxPayConstant.VERIFY);
if(errCode.equalsIgnoreCase(WxPayConstant.TRUE)) {
// 核销成功
couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId, EnumCouponVerifyType.VERIFY_POS_PAY.getCode());
couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId);
}
}

@@ -670,36 +703,6 @@ public class PosController extends BaseController {
}
}

@ApiOperation(value = "POS订单同步", notes = "支付成功/支付取消后订单同步")
@PostMapping("/posOrderSync")
@SystemControllerLog(description = "POS订单同步")
public Map<String, String> posOrderSync(@RequestBody Map<String, String> params) {
logger.info(params.toString());
JSONObject payContent = new JSONObject();

// 1. check sign
Map<String, String> retMap = checkSign(params, payContent);
if (retMap != null) {
// 签名相关异常返回
return retMap;
}
String resKey = payContent.getString(WxPayConstant.RES_KEY);
logger.info(WxPayConstant.RES_KEY + ": " + resKey);

try {

} catch (MallinkException e) {
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_FAIL,
e.getErrorCode(), e.getMessage());
} catch (Exception e) {
return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",
WxPayConstant.RET_FAIL,
500, e.getMessage());
}
return null;
}


/**
* 构造返回map,无签名, 有错误
@@ -717,6 +720,7 @@ public class PosController extends BaseController {
retMap.put(WxPayConstant.RESULT_CODE, resCode);
retMap.put(WxPayConstant.ERR_CODE, "" + errCode);
retMap.put(WxPayConstant.ERR_CODE_DES, errMsg);
retMap.put(WxPayConstant.TIMESTAMP, neuDateFormat.format(new Date()));
return retMap;
}

@@ -737,6 +741,8 @@ public class PosController extends BaseController {
retMap.put(WxPayConstant.RETURN_CODE, retCode);
retMap.put(WxPayConstant.RETURN_MSG, retMsg);
retMap.put(WxPayConstant.RESULT_CODE, resCode);
retMap.put(WxPayConstant.TIMESTAMP, neuDateFormat.format(new Date()));

if (err != null) {
retMap.put(WxPayConstant.ERR_CODE, "" + err.getCode());
retMap.put(WxPayConstant.ERR_CODE_DES, err.getMessage());
@@ -764,6 +770,7 @@ public class PosController extends BaseController {
retMap.put(WxPayConstant.RESULT_CODE, resCode);
retMap.put(WxPayConstant.ERR_CODE, "" + errCode);
retMap.put(WxPayConstant.ERR_CODE_DES, errMsg);
retMap.put(WxPayConstant.TIMESTAMP, neuDateFormat.format(new Date()));
return WxPayment.buildSignAfterParasMapForHMAC(retMap, resKey);
}



+ 29
- 14
mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java Просмотреть файл

@@ -1104,7 +1104,6 @@ public class PosServiceImpl implements PosService {
if (couponOrderCVo.getCouponOrderStatus().equals(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()) &&
actionType.equals(EnumPosActionType.VERIFY_CANCEL)) {
// 检查是否有发放的券, 有则无法退券
/*
try {
cancelVerify(couponOrderCVo, buUserId, posOrderId);
retMap.put(WxPayConstant.CANCEL, WxPayConstant.TRUE);
@@ -1113,7 +1112,7 @@ public class PosServiceImpl implements PosService {
logger.error(e.getMessage());
throw new MallinkException(e.getErrorCode(), e.getMessage());
}
*/
/*
logger.info("券已被核销无法取消: " + couponOrderIdStr);
retMap.put(WxPayConstant.CANCEL, WxPayConstant.FALSE);
Map cancelMap = new HashMap();
@@ -1124,6 +1123,7 @@ public class PosServiceImpl implements PosService {
// TODO 系统发放的券, 也加入核销信息中
retMap.put(WxPayConstant.CANCEL_DES, errMessage);
return retMap;
*/
}
String errMessage = "取消异常:未知的核销状态-" + couponOrderCVo.getCouponOrderStatus()+ ", 核销action-" + actionType.getCode();
logger.error(errMessage);
@@ -1258,6 +1258,7 @@ public class PosServiceImpl implements PosService {

}
// 2. update couponOrder
Date curDate = new Date();
try {
WxCouponOrder couponOrder = new WxCouponOrder();
couponOrder.setId(couponOrderCVo.getId());
@@ -1272,7 +1273,7 @@ public class PosServiceImpl implements PosService {
actionType.equals(EnumPosActionType.VERIFY_PAY)) {
couponOrder.setBUserId(buUserId);
}
couponOrder.setUpdateDate(new Date());
couponOrder.setUpdateDate(curDate);
if (couponOrder.getBUserId() == null) {
num = couponOrderMapper.updateVerifyCouponOrder(couponOrder);
} else {
@@ -1770,6 +1771,7 @@ public class PosServiceImpl implements PosService {
String merchantIdStr = params.get(WxPayConstant.NEU_MERCHANT_ID); // 商户ID
String buUserIdStr = params.get(WxPayConstant.NEU_BU_USER_ID); // POS操作员ID
String cuUserIdStr = params.get(WxPayConstant.NEU_MEM_ID); // 富茂系统会员ID
String sceneTypeStr = params.get(WxPayConstant.NEU_ORDER_SCENE_TYPE); // 场景类型
String posOrderIdStr = params.get(WxPayConstant.NEU_ORDER_ID); // POS订单ID
String posOrderTimeStr = params.get(WxPayConstant.NEU_ORDER_TIME); // POS订单时间
String posAmountStr = params.get(WxPayConstant.NEU_ORDER_AMOUNT); // POS订单总额
@@ -1793,6 +1795,9 @@ public class PosServiceImpl implements PosService {
if (StringUtils.isBlank(cuUserIdStr)) {
errParam(WxPayConstant.NEU_MEM_ID);
}
if (StringUtils.isBlank(sceneTypeStr)) {
errParam(WxPayConstant.NEU_ORDER_SCENE_TYPE);
}
if (StringUtils.isBlank(posOrderIdStr)) {
errParam(WxPayConstant.NEU_ORDER_ID);
}
@@ -1807,14 +1812,16 @@ public class PosServiceImpl implements PosService {
}

Long merchantId, buUserId, posOrderId, memId;
Integer posAmount = 0;
Long posAmount = 0L;
Integer sceneType;
Date orderTime = null;
try {
merchantId = Long.valueOf(merchantIdStr);
buUserId = Long.valueOf(buUserIdStr);
memId = Long.valueOf(cuUserIdStr);
sceneType = Integer.valueOf(sceneTypeStr);
posOrderId = Long.valueOf(posOrderIdStr);
posAmount = Integer.valueOf(posAmountStr);
posAmount = Long.valueOf(posAmountStr);
} catch (NumberFormatException e) {
logger.error(e.getMessage());
throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage());
@@ -1828,9 +1835,9 @@ public class PosServiceImpl implements PosService {
// 2. check merchant
WxMerchant merchant = checkAndGetMerchant(merchantId);
// 3. check buUser
final WxMerchantBUser merchantBUser = checkAndGetMerchantUser(merchantId, buUserId);
WxMerchantBUser merchantBUser = checkAndGetMerchantUser(buUserId, merchantId);
if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_PAY)) {
WxOrder order = createOrderByPos(merchantBUser, memId, posOrderId, posAmount, orderTime);
WxOrder order = createOrderByPos(merchantBUser, memId, posOrderId, posAmount.intValue(), orderTime);
String payDetail = params.get(WxPayConstant.NEU_PAY_DETAIL);
JSONObject payDetailObj = JSON.parseObject(payDetail);
JSONArray payDetailList = payDetailObj.getJSONArray(WxPayConstant.NEU_PAY_DETAIL_LIST);
@@ -1856,13 +1863,14 @@ public class PosServiceImpl implements PosService {
logger.error(e.getMessage());
throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage());
}
if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()))) {
if (neuPayOrderType.equals(String.valueOf(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()))) {
// 会员折扣
WxPayOrder payOrder = payOrderFromMemDiscount(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime);
} else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_COUPON.getCode()))) {
// 优惠券, 交易核销
WxPayOrder payOrder = payOrderFromCouponVerify(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo);
} else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_CARD.getCode()))) {
} else if (neuPayOrderType.equals(String.valueOf(EnumNeuPosPamentType.MEM_COUPON.getCode()))) {
// 优惠券
WxPayOrder payOrder = payOrderFromCouponVerify(merchantBUser, order, memId, sceneType,
neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo);
} else if (neuPayOrderType.equals(String.valueOf(EnumNeuPosPamentType.MEM_CARD.getCode()))) {
// 预付卡, 不能退
WxPayOrder payOrder = payOrderFromCard(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo);
} else {
@@ -1954,6 +1962,7 @@ public class PosServiceImpl implements PosService {
WxMerchantBUser merchantBUser,
WxOrder order,
Long memId,
Integer sceneType,
Long posPayOrderId, String neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) {
// 1. insert into PayOrder
WxPayOrder payOrder = new WxPayOrder() {{
@@ -1975,7 +1984,7 @@ public class PosServiceImpl implements PosService {
setShare(EnumPayShare.NO.getCode());
setPosPayOrderId(posPayOrderId);
setPosPayOrderTime(neuPosPayOrderTime.getTime());
setPosPaymentType(EnumNeuPosPamentType.MEM_DISCOUNT.getCode());
setPosPaymentType(EnumNeuPosPamentType.MEM_COUPON.getCode());
setPosPayDes("POS优惠券支付");
setPosPayOrderNo(posPayOrderNo);
}};
@@ -1984,7 +1993,13 @@ public class PosServiceImpl implements PosService {
logger.error("pay order insert error: " + payOrder.toString());
throw new MallinkException(ErrorCode.DB_FAIL);
}
// 2. 核销
Long couponOrderId = Long.valueOf(posPayOrderNo);
// 2. 预核销->核销
if (sceneType.equals(EnumPosSceneType.PAY.getCode())) {
// TODO
}
// 3. 核销后处理
couponOrderService.sendInsideCouponVerifyMsg(merchantBUser.getTenantId(), couponOrderId, merchantBUser.getId());
return payOrder;
}



+ 118
- 273
mallinkPosApi/src/test/java/com/iformall/pos/test/PosAppTest.java Просмотреть файл

@@ -1,5 +1,7 @@
package com.iformall.pos.test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.iformall.PosApplication;
@@ -23,6 +25,8 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@@ -41,6 +45,8 @@ public class PosAppTest {
@Autowired
private MockMvc mockMvc;

private static final SimpleDateFormat neuDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");

private static final String devId = "neupos";
private static final String devReqKey = "qVH2YDmXJ$ok4a95";
private static final String devResKey = "VE#1fB2PhUe@&3Of";
@@ -51,6 +57,8 @@ public class PosAppTest {
private static final String phone = "13120223636";
private static final String password = "drpos345";

private static final String posSN = "1";

/*
可用的交易券, 支付可用(1, 2, 6), 核销可用(4, 6, 8, 9)
coupon_order_id, coupon_type, 售价, 面额, cancellable
@@ -106,20 +114,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.PHONE, phone);
reqObj.put(WxPayConstant.PASSWORD, password);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/checkUserPassword")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
System.out.println("response sign: " + resSigned);
boolean resSigned = sendAndRes("/checkUserPassword", reqObj);
Assert.assertEquals(resSigned, true);
}
@Test
@@ -128,20 +123,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/getPosMemConfig")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
System.out.println("response sign: " + resSigned);
boolean resSigned = sendAndRes("/getPosMemConfig", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -151,19 +133,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/getQrCode")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/getQrCode", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -173,7 +143,22 @@ public class PosAppTest {
String phone = "13910154397";
String posOrderId = "1";
String posAmount = "200";
doCheckMem(memId, phone, posOrderId, posAmount);
Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
if (StringUtils.isNotBlank(memId)) {
reqObj.put(WxPayConstant.MEM_ID, memId);
}
if (StringUtils.isNotBlank(phone)) {
reqObj.put(WxPayConstant.MEM_PHONE, phone);
}
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
boolean resSigned = sendAndRes("/checkMem", reqObj);
Assert.assertEquals(resSigned, true);
}

@Test
@@ -182,7 +167,22 @@ public class PosAppTest {
String phone = "13910154397";
String posAmount = "20000";
String selCoList = "[\"321877927162249216\"]";
doCalcMem(memId, phone, posAmount, selCoList);
Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
if (StringUtils.isNotBlank(memId)) {
reqObj.put(WxPayConstant.MEM_ID, memId);
}
if (StringUtils.isNotBlank(phone)) {
reqObj.put(WxPayConstant.MEM_PHONE, phone);
}
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, selCoList);
boolean resSigned = sendAndRes("/calcMem", reqObj);
Assert.assertEquals(resSigned, true);
}

@Test
@@ -217,6 +217,57 @@ public class PosAppTest {
doCouponOrderVerifyCancel(couponOrderId, posOrderId);
}

@Test
public void verifySyncTest() throws Exception {
String memId = "321178010928119808";
String memPhone = "13910154397";
String sceneType = "2"; // 核销
String posOrderId = "1";
String posAmount = "20000";
String posPayOrderId = "1";
String posPaymentType = "4";
String posPaymentTypeDes = "优惠券";
String posPaymentStatus = "0";

String couponOrderId = "321878223800205312";

Date curDate = new Date();

Map<String, String> payDetailOne = new HashMap<>();
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_ID, posPayOrderId);
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_TIME, neuDateFormat.format(curDate));
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_TYPE, posPaymentType);
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_TYPE_DES, posPaymentTypeDes);
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_PARAM, "{}");
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_STATUS, posPaymentStatus);
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_OUT_NO, couponOrderId);
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_AMOUNT, posAmount);
payDetailOne.put(WxPayConstant.NEU_PAY_ORDER_OUT_TIME, neuDateFormat.format(curDate));

JSONArray payDetailList = new JSONArray();
payDetailList.add(payDetailOne);

Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.NEU_TENANT_ID, tenantId);
reqObj.put(WxPayConstant.NEU_MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.NEU_BU_USER_ID, buUserId);
reqObj.put(WxPayConstant.NEU_MEM_ID, memId);
reqObj.put(WxPayConstant.NEU_MEM_PHONE, memPhone);
reqObj.put(WxPayConstant.NEU_ORDER_SCENE_TYPE, sceneType);
reqObj.put(WxPayConstant.NEU_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.NEU_ORDER_TIME, neuDateFormat.format(curDate));
reqObj.put(WxPayConstant.NEU_ORDER_AMOUNT, posAmount);
reqObj.put(WxPayConstant.NEU_ORDER_CREATE_SN, posSN);
reqObj.put(WxPayConstant.NEU_ORDER_STATUS, "0");
JSONObject payDetail = new JSONObject();
payDetail.put(WxPayConstant.NEU_PAY_DETAIL_LIST, JSON.toJSONString(payDetailList));
reqObj.put(WxPayConstant.NEU_PAY_DETAIL, JSON.toJSONString(payDetail));
boolean resSigned = sendAndRes("/posOrderSync", reqObj);
Assert.assertEquals(resSigned, true);
}

@Test
public void couponOrderPreVerifyTest() throws Exception {
String couponOrderId = "321877927162249216";
@@ -264,67 +315,7 @@ public class PosAppTest {
doCardPayPreCancel(cardId, cardSpendId, posOrderId);
}

private void doCheckMem(String memId, String phone, String posOrderId, String posAmount) throws Exception {
Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
if (StringUtils.isNotBlank(memId)) {
reqObj.put(WxPayConstant.MEM_ID, memId);
}
if (StringUtils.isNotBlank(phone)) {
reqObj.put(WxPayConstant.MEM_PHONE, phone);
}
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/checkMem")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
Assert.assertEquals(resSigned, true);
}

private void doCalcMem(String memId, String phone, String posAmount, String selCoList) throws Exception {
Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
if (StringUtils.isNotBlank(memId)) {
reqObj.put(WxPayConstant.MEM_ID, memId);
}
if (StringUtils.isNotBlank(phone)) {
reqObj.put(WxPayConstant.MEM_PHONE, phone);
}
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, selCoList);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/calcMem")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
Assert.assertEquals(resSigned, true);
}

private void doCheckCouponOrder(String couponOrderId, String sceneType, String posOrderId, String posAmount) throws Exception {
Map<String, String> reqObj = new HashMap<>();
@@ -337,19 +328,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.SCENE_TYPE, sceneType);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/checkCouponOrder")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String, String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/checkCouponOrder", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -362,20 +341,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/couponOrderVerify")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();

ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/couponOrderVerify", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -388,19 +354,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/couponOrderVerifyCancel")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/couponOrderVerifyCancel", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -414,19 +368,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/couponOrderPreVerify")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/couponOrderPreVerify", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -440,19 +382,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/couponOrderPreVerifyCancel")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/couponOrderPreVerifyCancel", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -466,19 +396,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/couponOrderPayVerifyOne")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/couponOrderPayVerifyOne", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -492,19 +410,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.SELECTED_COUPON_ORDER_LIST, couponOrderIdList);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/couponOrderPayVerifyList")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/couponOrderPayVerifyList", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -518,19 +424,7 @@ public class PosAppTest {
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.CARD_ID, cardId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/cardPayPre")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/cardPayPre", reqObj);
Assert.assertEquals(resSigned, true);
}

@@ -545,72 +439,23 @@ public class PosAppTest {
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.CARD_ID, cardId);
reqObj.put(WxPayConstant.CARD_SPEND_ID, cardSpendId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/cardPayPreCancel")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
Assert.assertEquals(resSigned, true);
}

private void doCardPay(String cardId, String posOrderId, String posAmount) throws Exception {
Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.POS_AMOUNT, posAmount);
reqObj.put(WxPayConstant.CARD_ID, cardId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/cardPay")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
boolean resSigned = sendAndRes("/cardPayPreCancel", reqObj);
Assert.assertEquals(resSigned, true);
}


private void doCardPayCancel(String cardId, String cardSpendId, String posOrderId) throws Exception {
Map<String, String> reqObj = new HashMap<>();
reqObj.put(WxPayConstant.NONCE_STR, "1");
reqObj.put(WxPayConstant.DEV_ID, devId);
reqObj.put(WxPayConstant.TENANT_ID, tenantId);
reqObj.put(WxPayConstant.MERCHANT_ID, merchantId);
reqObj.put(WxPayConstant.BUSER_ID, buUserId);
reqObj.put(WxPayConstant.POS_ORDER_ID, posOrderId);
reqObj.put(WxPayConstant.CARD_ID, cardId);
reqObj.put(WxPayConstant.CARD_SPEND_ID, cardSpendId);
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post("/cardPayCancel")
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
boolean resSigned = WxPayment.verifyNotifyHMAC(respMap, devResKey);
Assert.assertEquals(resSigned, true);
}
private boolean sendAndRes(String url, Map<String, String> reqObj) throws Exception {
reqObj.put(WxPayConstant.SIGN, WxPayment.createSignHMAC(reqObj, devReqKey));
String reqJsonStr = JSONObject.toJSONString(reqObj);
MvcResult result = mockMvc.perform(
MockMvcRequestBuilders.post(url)
.contentType(MediaType.APPLICATION_JSON)
.content(reqJsonStr))
.andExpect(MockMvcResultMatchers.status().isOk())
.andDo(MockMvcResultHandlers.print())
.andReturn();
String responseStr = result.getResponse().getContentAsString();
ObjectMapper mapper = new ObjectMapper();
Map<String,String> respMap = mapper.readValue(responseStr, Map.class);
return WxPayment.verifyNotifyHMAC(respMap, devResKey);
}
}

+ 0
- 2
mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideCouponVerifyMsg.java Просмотреть файл

@@ -16,6 +16,4 @@ public class FmInsideCouponVerifyMsg extends BaseMsg{
private Long couponOrderId;
@io.swagger.annotations.ApiModelProperty(value = "B端用户ID", name = "bUserId")
private Long bUserId;
@io.swagger.annotations.ApiModelProperty(value = "核销类型()", name = "verifyType")
private Integer verifyType;
}

+ 2
- 0
mallinkService/src/main/java/com/iformall/pay/WxPayConstant.java Просмотреть файл

@@ -10,6 +10,7 @@ public class WxPayConstant {
public final static String RETURN_CODE = "return_code";
public final static String RETURN_MSG = "return_msg";
public final static String RESULT_CODE = "result_code";
public final static String TIMESTAMP = "timestamp";
public final static String ERR_CODE = "err_code";
public final static String ERR_CODE_DES = "err_code_des";
public final static String NONCE_STR = "nonce_str";
@@ -102,6 +103,7 @@ public class WxPayConstant {
public final static String NEU_ORDER_TIME = "OrderTimeOfPlatform"; // 平台订单创建时间, 格式:4位年2位月2位日2位24小时制时2位分2位秒3位毫秒
public final static String NEU_ORDER_AMOUNT = "OrderAmount"; // 订单价格
public final static String NEU_ORDER_CREATE_SN = "OrderCreateSN"; // 创建订单的POS SN号
public final static String NEU_ORDER_SCENE_TYPE = "SceneType"; // 订单场景 1:订单支付 2:核销
public final static String NEU_ORDER_STATUS = "OrderStatus"; // 必要,订单状态: 0有效,1取消,根据订单状态处理优惠券;有效:优惠券从预核销处理为核销;
public final static String NEU_PAY_DETAIL = "PaymentDetail";
public final static String NEU_PAY_DETAIL_LIST = "PaymentDetailList";


+ 2
- 2
mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java Просмотреть файл

@@ -57,7 +57,7 @@ public interface WxCouponOrderService {
/**
* 核销后发送消息
*/
void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId, Integer verifyType);
void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId);

/**
* 核销后处理
@@ -65,7 +65,7 @@ public interface WxCouponOrderService {
* @param couponOrder
* @param bUser 核销人(登录用户)
*/
void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser, Integer verifyType);
void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser);

/**
* 核销发券


+ 6
- 11
mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java Просмотреть файл

@@ -388,18 +388,17 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
}

@Override
public void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId, Integer verifyType) {
public void sendInsideCouponVerifyMsg(String tenantId, Long couponOrderId, Long buUserId) {
FmInsideCouponVerifyMsg verifyMsg = new FmInsideCouponVerifyMsg();
verifyMsg.setMsgType(EnumMsgRecordType.INSIDE_COUPON_VERIFY.getCode());
verifyMsg.setTenantId(tenantId);
verifyMsg.setCouponOrderId(couponOrderId);
verifyMsg.setBUserId(buUserId);
verifyMsg.setVerifyType(verifyType);
mqBaseProducer.sendMessage(verifyMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode());
}

@Override
public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser, Integer verifyType) {
public void actionAfterVerify(WxCouponOrder couponOrder, WxMerchantBUser bUser) {
try {
// 核销分账
shareAfterVerify(couponOrder, bUser.getMerchantId());
@@ -417,14 +416,10 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService {
boolean bSentCoupon = false;

// 核销发券
// POS交易核销暂不发券
if (verifyType.equals(EnumCouponVerifyType.VERIFY_B.getCode()) ||
verifyType.equals(EnumCouponVerifyType.VERIFY_POS_INDEPENDENT.getCode())) {
try {
bSentCoupon = sendCouponAfterVerify(couponOrder, bUser);
} catch (Exception e) {
logger.error(e.getMessage());
}
try {
bSentCoupon = sendCouponAfterVerify(couponOrder, bUser);
} catch (Exception e) {
logger.error(e.getMessage());
}

// 核销发模板消息


+ 1
- 6
mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideCouponVerifyMsgServiceImpl.java Просмотреть файл

@@ -44,11 +44,6 @@ public class FmInsideCouponVerifyMsgServiceImpl implements MsgSendService {
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getBUserId());
}

Integer verifyType = msg.getVerifyType();
if (verifyType == null) {
verifyType = EnumCouponVerifyType.VERIFY_B.getCode();
}

couponOrderService.actionAfterVerify(couponOrder, user, verifyType);
couponOrderService.actionAfterVerify(couponOrder, user);
}
}

Загрузка…
Отмена
Сохранить