| @@ -247,6 +247,7 @@ public class PosController extends BaseController { | |||
| "\"tenant_id\":\"string(必填)\"," + | |||
| "\"merchant_id\":\"string(必填)\"," + | |||
| "\"order_operation_id\":\"string(必填)\"," + | |||
| "\"business_type\":\"string(0:核销1支付(必填)\"," + | |||
| "\"order_number_of_platform\":\"string(必填)\"," + | |||
| "\"order_amount\":\"string单位(分)(选填)\"," + | |||
| "\"order_amount_left\":\"string单位(分)(选填)\"," + | |||
| @@ -289,6 +290,9 @@ public class PosController extends BaseController { | |||
| "\"tenant_id\":\"string(必填)\"," + | |||
| "\"merchant_id\":\"string(必填)\"," + | |||
| "\"order_operation_id\":\"string(必填)\"," + | |||
| "\"business_type\":\"string(0:核销1支付(必填)\"," + | |||
| "\"mem_id\":\"string(必填)\"," + | |||
| "\"mem_phone_number\":\"string(必填)\"," + | |||
| "\"order_number_of_platform\":\"string(必填)\"," + | |||
| "\"order_amount\":\"string单位(分)(选填)\"," + | |||
| "\"order_amount_left\":\"string单位(分)(选填)\"," + | |||
| @@ -1766,7 +1766,7 @@ public class PosServiceImpl implements PosService { | |||
| 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订单总额 | |||
| String orderCreateSN = params.get(WxPayConstant.ORDER_CREATE_SN); // POS SN号 | |||
| String orderCreateSN = params.get(WxPayConstant.NEU_ORDER_CREATE_SN); // POS SN号 | |||
| String posStatusStr = params.get(WxPayConstant.NEU_ORDER_STATUS); // 订单状态: 0有效,1取消,根据订单状态处理优惠券;有效:优惠券从预核销处理为核销; | |||
| // 1. check params | |||
| @@ -2053,7 +2053,8 @@ public class PosServiceImpl implements PosService { | |||
| PromotionCalc scoreCreditCalc, | |||
| WxMerchant merchant, WxMerchantBUser buUser, | |||
| WxOrder order, Long memId, | |||
| Long posPayOrderId, Integer neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) { | |||
| Long posPayOrderId, Integer neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) | |||
| { | |||
| // 1. insert into PayOrder | |||
| WxPayOrder payOrder = new WxPayOrder() {{ | |||
| Date curDate = new Date(); | |||
| @@ -2062,6 +2063,7 @@ public class PosServiceImpl implements PosService { | |||
| setId(id); | |||
| setTenantId(buUser.getTenantId()); | |||
| setCUserId(memId); | |||
| setBUserId(buUser.getId()); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| setUpdateTime(curDate); | |||
| @@ -2093,6 +2095,7 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| WxCardSpend cardSpend = cardSpendService.getById(cardSpendId); | |||
| cardSpend.setOrderId(order.getId()); | |||
| cardSpendService.cardSpendForPosPay(scoreCreditCalc, cardSpend, merchant, buUser); | |||
| return payOrder; | |||
| } | |||
| @@ -2182,12 +2185,29 @@ public class PosServiceImpl implements PosService { | |||
| final Long memId, | |||
| final Long posOrderId, final Integer posAmount, final Date posOrderTime | |||
| ) { | |||
| boolean isExist = true; | |||
| WxOrder orderQ = new WxOrder() {{ | |||
| setType(EnumOrderType.POSPAY.getCode()); | |||
| setProductId(merchantBUser.getId()); | |||
| setCUserId(memId); | |||
| setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| setPosOrderId(posOrderId); | |||
| }}; | |||
| try { | |||
| orderQ = orderMapper.selectOne(orderQ); | |||
| } catch (Exception e) { | |||
| isExist = false; | |||
| } | |||
| if (orderQ != null) { | |||
| logger.error(ErrorCode.POS_ORDER_HAD_SYNCED.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_ORDER_HAD_SYNCED); | |||
| } | |||
| WxOrder order = new WxOrder() {{ | |||
| Date curr = new Date(); | |||
| String bodyStr = "POS支付, 金额: " + posAmount; | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long orderId = idWorker.nextId(); | |||
| setId(orderId); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| setOrderNumber(orderId); | |||
| @@ -2203,6 +2223,7 @@ public class PosServiceImpl implements PosService { | |||
| setPosOrderId(posOrderId); | |||
| setPosOrderCreateTime(posOrderTime.getTime()); | |||
| }}; | |||
| try { | |||
| orderMapper.insertSelective(order); | |||
| } catch (Exception e) { | |||
| @@ -388,7 +388,7 @@ public class PosAppTest { | |||
| @Test | |||
| public void cardPayPreCancelTest() throws Exception { | |||
| String cardId = "321883878446825472"; | |||
| String cardSpendId = "328803369448411136"; | |||
| String cardSpendId = "329524779780829184"; | |||
| String sceneType = "1"; // 支付 | |||
| String posOrderId = "1"; | |||
| String orderAmount = "2000"; | |||
| @@ -417,6 +417,8 @@ public class PosAppTest { | |||
| @Test | |||
| public void cardPaySyncTest() throws Exception { | |||
| String memId = "321178010928119808"; | |||
| String memPhone = "13910154397"; | |||
| String sceneType = "1"; // 支付 | |||
| String posOrderId = "1"; | |||
| String orderAmount = "2000"; | |||
| @@ -424,7 +426,7 @@ public class PosAppTest { | |||
| String posPaymentType = String.valueOf(EnumNeuPosPamentType.MEM_CARD.getCode()); | |||
| String posPaymentTypeDes = EnumNeuPosPamentType.MEM_CARD.getMessage(); | |||
| String posPaymentStatus = "0"; | |||
| String cardSpendId = "328803369448411136"; | |||
| String cardSpendId = "329527235668242432"; | |||
| Date curDate = new Date(); | |||
| @@ -449,10 +451,12 @@ public class PosAppTest { | |||
| reqObj.put(WxPayConstant.NEU_MERCHANT_ID, merchantId); | |||
| reqObj.put(WxPayConstant.NEU_BU_USER_ID, buUserId); | |||
| reqObj.put(WxPayConstant.NEU_ORDER_SCENE_TYPE, sceneType); | |||
| reqObj.put(WxPayConstant.NEU_MEM_ID, memId); | |||
| reqObj.put(WxPayConstant.NEU_MEM_PHONE, memPhone); | |||
| reqObj.put(WxPayConstant.NEU_ORDER_ID, posOrderId); | |||
| reqObj.put(WxPayConstant.NEU_ORDER_TIME, neuDateFormat.format(curDate)); | |||
| reqObj.put(WxPayConstant.NEU_ORDER_AMOUNT, orderAmount); | |||
| reqObj.put(WxPayConstant.NEU_ORDER_CREATE_SN, posSN); | |||
| reqObj.put(WxPayConstant.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)); | |||
| @@ -250,6 +250,7 @@ public enum ErrorCode{ | |||
| POS_CARD_PAY_NOT_CANCEL(11108, "卡支付无法取消"), | |||
| POS_CARD_ONLY_SUPPORT_PAY(11109, "卡支付只支持支付"), | |||
| POS_CARD_OWNER_NOT_EQUAL(11110, "卡拥有者不对应"), | |||
| POS_ORDER_HAD_SYNCED(11111, "订单已同步"), | |||
| POS_CMD_FAIL(11200, "POS命令错误"), | |||
| @@ -725,6 +725,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||
| Date curDate = new Date(); | |||
| // 1. update card_spend | |||
| WxCardSpend updateCardSpend = new WxCardSpend(); | |||
| updateCardSpend.setOrderId(record.getOrderId()); | |||
| updateCardSpend.setPayStatus(EnumCardSpendStatus.NOT_PAY.getCode()); | |||
| updateCardSpend.setUpdateDate(curDate); | |||
| try { | |||