diff --git a/mallinkAdmin/src/main/resources/db/migration/V201908161540__POS_CHANGED.sql b/mallinkAdmin/src/main/resources/db/migration/V201908161540__POS_CHANGED.sql new file mode 100644 index 000000000..d60201912 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V201908161540__POS_CHANGED.sql @@ -0,0 +1,2 @@ +alter table wx_coupon_order +add `verify_type` tinyint(6) NULL COMMENT '核销类型(0:B端核销, 1:POS独立核销 2:POS交易核销)'; \ No newline at end of file diff --git a/mallinkPosApi/src/main/java/com/iformall/controller/PosController.java b/mallinkPosApi/src/main/java/com/iformall/controller/PosController.java index 2597a52a6..750116d81 100644 --- a/mallinkPosApi/src/main/java/com/iformall/controller/PosController.java +++ b/mallinkPosApi/src/main/java/com/iformall/controller/PosController.java @@ -611,6 +611,36 @@ public class PosController extends BaseController { } } + @ApiOperation(value = "POS订单同步", notes = "支付成功/支付取消后订单同步") + @PostMapping("/posOrderSync") + @SystemControllerLog(description = "POS订单同步") + public Map posOrderSync(@RequestBody Map params) { + logger.info(params.toString()); + JSONObject payContent = new JSONObject(); + + // 1. check sign + Map retMap = checkSign(params, payContent); + if (retMap != null) { + // 签名相关异常返回 + return retMap; + } + String resKey = payContent.getString("resKey"); + logger.info("resKey: " + 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,无签名, 有错误 diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index a25538cb6..1f10ba630 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -915,6 +915,7 @@ public class PosServiceImpl implements PosService { couponOrder.setTenantId(couponOrderCVo.getTenantId()); couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()); couponOrder.setBUserId(buUserId); + couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_POS_PAY.getCode()); couponOrder.setUpdateDate(new Date()); num = couponOrderMapper.updateVerifyCouponOrder(couponOrder); } catch (Exception e) { @@ -1016,6 +1017,11 @@ public class PosServiceImpl implements PosService { couponOrder.setId(couponOrderCVo.getId()); couponOrder.setTenantId(couponOrderCVo.getTenantId()); couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 + if (actionType.equals(EnumVerifyActionType.VERIFY_INDEPENT)) { + couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_POS_INDEPENDENT.getCode()); + } else { + couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_POS_PAY.getCode()); + } if (couponOrderCVo.getCouponOrderStatus().equals(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()) && actionType.equals(EnumVerifyActionType.VERIFY_PAY)) { couponOrder.setBUserId(buUserId); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java index 1eb5985f5..fe3db4917 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java @@ -51,6 +51,9 @@ public class WxCouponOrder extends BaseEntity{ @io.swagger.annotations.ApiModelProperty(value="过期退款(0:正常,1不退)",name="autoRefund") private Integer autoRefund; + @io.swagger.annotations.ApiModelProperty(value="核销类型(0:B端核销, 1:POS独立核销 2:POS交易核销)",name="verifyType") + private Integer verifyType; + @Transient private String couponName; @Transient diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index f29c5bef7..6594c3129 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -344,6 +344,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { try { couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 couponOrder.setBUserId(bUser.getId()); + couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_B.getCode()); couponOrder.setUpdateDate(new Date()); num = wxCouponOrderMapper.updateVerifyCouponOrder(couponOrder); } catch (Exception e) { diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index 7b1440384..3b777097b 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -16,10 +16,11 @@ + - `id`,`tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund` + `id`,`tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`, `verify_type` @@ -99,7 +100,8 @@ update wx_coupon_order set `coupon_order_status` = #{couponOrderStatus}, `b_user_id` = #{bUserId}, - `update_date` = #{updateDate} + `update_date` = #{updateDate}, + `verify_type` = #{verifyType} where `tenant_id`=#{tenantId} and id=#{id} and `b_user_id` is null @@ -107,7 +109,8 @@ update wx_coupon_order set `coupon_order_status` = #{couponOrderStatus}, `b_user_id` = #{bUserId}, - `update_date` = #{updateDate} + `update_date` = #{updateDate}, + `verify_type` = #{verifyType} where 1=1 and `tenant_id`=#{tenantId} and id=#{id} @@ -124,7 +127,8 @@ update wx_coupon_order set `coupon_order_status` = #{couponOrderStatus}, `b_user_id` = null, - `update_date` = #{updateDate} + `update_date` = #{updateDate}, + `verify_type` = null where `tenant_id`=#{tenantId} and id=#{id} @@ -788,13 +792,13 @@ - co.id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, + co.id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type, c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.valid_start_date,c.valid_end_date,c.auto_refund, cal.channel_type as send_channel_type - co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, + co.id,co.tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type, c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark,c.valid_start_date,c.valid_end_date,c.auto_refund @@ -812,6 +816,7 @@ + @@ -872,7 +877,7 @@ - co.id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, + co.id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type, c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit, json_extract(car.vendor_params,'$.id') as coupon_free_id @@ -892,6 +897,7 @@ +