| @@ -0,0 +1,13 @@ | |||
| alter table wx_order | |||
| add `pos_order_create_time` bigint(20) NULL COMMENT 'POS系统订单创建时间'; | |||
| alter table wx_pay_order | |||
| add `pos_pay_order_time` bigint(20) NULL COMMENT '支付订单创建时间,来源于POS', | |||
| add `pos_pay_order_no` varchar(20) NULL COMMENT '支付订单流水号, 来源于POS, 第三方(微信、支付宝、富茂预付卡)支付订单流水号,富茂优惠券ID,现金和富茂会员折扣时为空', | |||
| add `pos_pay_desc` varchar(100) NULL COMMENT 'POS支付描述', | |||
| modify `pos_pay_id` bigint(20) NULL COMMENT '支付订单号,来源于POS'; | |||
| alter table pos_mall_config | |||
| modify `discount` tinyint(6) NOT NULL DEFAULT '0' COMMENT '会员折扣是否开启,0-禁用,1-可用', | |||
| modify `coupon` tinyint(6) NOT NULL DEFAULT '0' COMMENT '会员优惠券是否开启,0-禁用,1-单选可用,2-多选可用', | |||
| modify `card` tinyint(6) NOT NULL DEFAULT '0' COMMENT '会员消费卡是否开启,0-禁用,1-可用' after `coupon`; | |||
| @@ -66,11 +66,9 @@ public class PosController extends BaseController { | |||
| String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券包ID | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| String errMessage = "request params[coupon_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.COUPON_ORDER_ID); | |||
| } | |||
| String verifyType = WxPayConstant.VERIFY_TYPE_INDEPENT; | |||
| String verifyType = WxPayConstant.SCENE_VERIFY; | |||
| return posService.checkCouponOrderForIndepentVerify(user, verifyType, couponOrderIdStr); | |||
| } | |||
| @@ -98,14 +96,10 @@ public class PosController extends BaseController { | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分) | |||
| if (StringUtils.isBlank(posOrderIdStr)) { | |||
| String errMessage = "request params[pos_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(posAmountStr)) { | |||
| String errMessage = "request params[pos_amount] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_AMOUNT); | |||
| } | |||
| if (StringUtils.isBlank(memIdStr) && StringUtils.isBlank(memPhoneStr)) { | |||
| @@ -125,21 +119,15 @@ public class PosController extends BaseController { | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额 | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| String errMessage = "request params[coupon_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.COUPON_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(posOrderIdStr)) { | |||
| String errMessage = "request params[pos_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(posAmountStr)) { | |||
| String errMessage = "request params[pos_amount] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_AMOUNT); | |||
| } | |||
| String verifyType = WxPayConstant.VERIFY_TYPE_PAY; | |||
| String verifyType = WxPayConstant.SCENE_PAY; | |||
| return posService.checkCouponOrderForPayVerify(user, verifyType, couponOrderIdStr, posOrderIdStr, posAmountStr); | |||
| } | |||
| @@ -153,24 +141,16 @@ public class PosController extends BaseController { | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分) | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| String errMessage = "request params[coupon_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.COUPON_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(deductAmountStr)) { | |||
| String errMessage = "request params[deduct_amount] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.DEDUCT_AMOUNT); | |||
| } | |||
| if (StringUtils.isBlank(posOrderIdStr)) { | |||
| String errMessage = "request params[pos_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(posAmountStr)) { | |||
| String errMessage = "request params[pos_amount] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_AMOUNT); | |||
| } | |||
| return posService.couponOrderPreVerify(user, couponOrderIdStr, deductAmountStr, posOrderIdStr, posAmountStr); | |||
| } | |||
| @@ -182,9 +162,7 @@ public class PosController extends BaseController { | |||
| WxMerchantBUser user = getUser(); | |||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | |||
| if (StringUtils.isBlank(posOrderIdStr)) { | |||
| String errMessage = "request params[pos_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_ORDER_ID); | |||
| } | |||
| // 1. 获取订单信息 | |||
| // 2. 获取所有的支付订单信息 | |||
| @@ -202,21 +180,21 @@ public class PosController extends BaseController { | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分) | |||
| if (StringUtils.isBlank(couponOrderIdStr)) { | |||
| String errMessage = "request params[coupon_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.COUPON_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(posOrderIdStr)) { | |||
| String errMessage = "request params[pos_order_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_ORDER_ID); | |||
| } | |||
| if (StringUtils.isBlank(posAmountStr)) { | |||
| String errMessage = "request params[pos_amount] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| return errParam(WxPayConstant.POS_AMOUNT); | |||
| } | |||
| return posService.couponOrderPreVerifyCancel(user, couponOrderIdStr, posOrderIdStr, posAmountStr); | |||
| } | |||
| private ResultData errParam(String paramStr) { | |||
| String errMessage = String.format("request params[%s] error.", paramStr); | |||
| logger.error(errMessage); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| } | |||
| } | |||
| @@ -269,7 +269,7 @@ public class PosUtil { | |||
| paramMap.put(WxPayConstant.TENANT_ID, tenantId); | |||
| paramMap.put(WxPayConstant.MERCHANT_ID, merchantId); | |||
| paramMap.put(WxPayConstant.BUSER_ID, buUserId); | |||
| paramMap.put(WxPayConstant.VERIFY_TYPE, verifyType); | |||
| paramMap.put(WxPayConstant.SCENE_TYPE, verifyType); | |||
| paramMap.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | |||
| if (StringUtils.isNotBlank(posOrderId)) { | |||
| paramMap.put(WxPayConstant.POS_ORDER_ID, posOrderId); | |||
| @@ -34,12 +34,25 @@ public class PosController extends BaseController { | |||
| private final ThDevInfoService thDevInfoService; | |||
| private final WxCouponOrderService couponOrderService; | |||
| @ApiOperation(value = "门店用户登录检查", notes = "{" + | |||
| @ApiOperation(value = "门店用户登录检查, 同时会返回会员折扣/优惠券/消费卡是否启用,mall信息及注册二维码及小票二维码规则", notes = "request: \n{" + | |||
| "\"dev_id\":\"string(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)," + | |||
| "\"tenant_id\":\"string(必填)\"," + | |||
| "\"phone\":\"string(必填)\"," + | |||
| "\"password\":\"string(必填)\"}") | |||
| "\"password\":\"string(必填)\"}\n" + | |||
| "response: \n{" + | |||
| "\"return_code\":\"SUCCESS\",\"return_msg\":\"\",\"result_code\":\"SUCCESS\"," + | |||
| "\"tenant_id\":\"456\",\"mall_name\":\"富茂中心\"," + | |||
| "\"merchant_id\":\"320833942159982592\",\"merchant_name\":\"东软合作\"," + | |||
| "\"merchant_img\":\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/234/WechatIMG5071.png\"," + | |||
| "\"bu_user_id\":\"320834180694245376\"," + | |||
| "\"qrcode_url\":\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/456/formall_c.png\"," + | |||
| "\"pos_qrcode_rule\":\"https://ctest.malls.iformall.com/order/(二维码规则: url + POS订单ID)\"," + | |||
| "\"discount\":\"false(是否支持会员折扣,false:禁用,true:可用)\"," + | |||
| "\"coupon\":\"0(会员优惠券是否开启,0-禁用,1-单选可用,2-多选可用)\",\"coupon_desc\":\"禁用(会员优惠券是否开启描述)\"," + | |||
| "\"card\":\"false(是否支持卡支付,false:禁用,true:可用)\"" + | |||
| "\"nonce_str\":\"2d8320f95e73419ebd42fcfded970d5b\"," + | |||
| "\"sign\":\"62139EE7897CF3BA44D9DBECA95AF6B116A9C49BBBB574BF3D2AF2939EE30423\"}") | |||
| @PostMapping("/checkUserPassword") | |||
| @SystemControllerLog(description = "门店用户登录检查") | |||
| public Map<String, String> checkUserPassword(@RequestBody Map<String, String> params) { | |||
| @@ -51,8 +64,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.checkUserPassword(params); | |||
| @@ -68,10 +81,20 @@ public class PosController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation(value = "获取会员折扣/优惠券/消费卡是否启用", notes = "{" + | |||
| @ApiOperation(value = "获取会员折扣/优惠券/消费卡是否启用, 同时返回注册二维码及小票二维码规则", notes = "request: \n{" + | |||
| "\"dev_id\":\"string(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)\"," + | |||
| "\"tenant_id\":\"string(必填)\"}") | |||
| "\"tenant_id\":\"string(必填)\"}\n" + | |||
| "\"response: \n{" + | |||
| "\"return_code\":\"SUCCESS\",\"return_msg\":\"\",\"result_code\":\"SUCCESS\"," + | |||
| "\"tenant_id\":\"456\",\"mall_name\":\"富茂中心\"," + | |||
| "\"qrcode_url\":\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/456/formall_c.png\"," + | |||
| "\"pos_qrcode_rule\":\"https://ctest.malls.iformall.com/order/(二维码规则: url + POS订单ID)\"," + | |||
| "\"discount\":\"false(是否支持会员折扣,false:禁用,true:可用)\"," + | |||
| "\"coupon\":\"0(会员优惠券是否开启,0-禁用,1-单选可用,2-多选可用)\",\"coupon_desc\":\"禁用(会员优惠券是否开启描述)\"," + | |||
| "\"card\":\"false(是否支持卡支付,false:禁用,true:可用)\"" + | |||
| "\"nonce_str\":\"eea09381622540868d22dee631054b30\"," + | |||
| "\"sign\":\"0EADC3B7D4B77D0AC923C095B6172955D462366FB4BF142467B4935FA7833A91\"}") | |||
| @PostMapping("/getPosMemConfig") | |||
| @SystemControllerLog(description = "获取会员折扣/优惠券/消费卡是否启用") | |||
| public Map<String, String> getMemStatus(@RequestBody Map<String, String> params) { | |||
| @@ -83,8 +106,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.getPosMemConfig(params); | |||
| @@ -100,10 +123,17 @@ public class PosController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation(value = "获取注册二维码及小票二维码规则", notes = "{" + | |||
| @ApiOperation(value = "获取注册二维码及小票二维码规则", notes = "request: \n{" + | |||
| "\"dev_id\":\"string(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)\"," + | |||
| "\"tenant_id\":\"string(必填)\"}") | |||
| "\"tenant_id\":\"string(必填)\"}\n" + | |||
| "\"response: \n{" + | |||
| "\"return_code\":\"SUCCESS\",\"return_msg\":\"\",\"result_code\":\"SUCCESS\"," + | |||
| "\"tenant_id\":\"456\",\"mall_name\":\"富茂中心\"," + | |||
| "\"qrcode_url\":\"https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/456/formall_c.png\"," + | |||
| "\"pos_qrcode_rule\":\"https://ctest.malls.iformall.com/order/(二维码规则: url + POS订单ID)\"," + | |||
| "\"nonce_str\":\"5604985305904f35bc9eeeda94346f8d\"," + | |||
| "\"sign\":\"5760C5989C3DD2F99CB3506EDBA0FB84A77BC60313F65206EB774A203108AA82\"}") | |||
| @PostMapping("/getQrCode") | |||
| @SystemControllerLog(description = "获取注册二维码及小票二维码规则") | |||
| public Map<String, String> getQrCode(@RequestBody Map<String, String> params) { | |||
| @@ -115,8 +145,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.doGetQrCode(params); | |||
| @@ -133,15 +163,15 @@ public class PosController extends BaseController { | |||
| } | |||
| @ApiOperation(value = "会员识别", notes = "{" + | |||
| @ApiOperation(value = "会员识别", notes = "request: \n{" + | |||
| "\"dev_id\":\"string(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)\"," + | |||
| "\"tenant_id\":\"string(必填)\"," + | |||
| "\"merchant_id\":\"string(必填)\"," + | |||
| "\"mem_id\":\"string(选填)\"," + | |||
| "\"mem_phone\":\"string(选填)\"," + | |||
| "\"pos_order_id\":\"string(必填)\"," + | |||
| "\"pos_amount\":\"string(单位:分)(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)\"}") | |||
| "\"pos_amount\":\"string(单位:分)(必填)\"}") | |||
| @PostMapping("/checkMem") | |||
| @SystemControllerLog(description = "会员识别") | |||
| public Map<String, String> checkMem(@RequestBody Map<String, String> params) { | |||
| @@ -153,8 +183,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.checkMember(params); | |||
| @@ -171,19 +201,19 @@ public class PosController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation(value = "券核销检查", notes = "{" + | |||
| @ApiOperation(value = "券检查是否可用-场景(核销/支付)", notes = "{" + | |||
| "\"dev_id\":\"string(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)\"," + | |||
| "\"tenant_id\":\"string(必填)\"," + | |||
| "\"merchant_id\":\"string(必填)\"," + | |||
| "\"bu_user_id\":\"string(必填)\"," + | |||
| "\"coupon_order_id\":\"string(必填)\"," + | |||
| "\"verify_type\":\"independent, pay(必填)\"," + | |||
| "\"scene_type\":\"string(1支付2:核销)(必填)\"," + | |||
| "\"pos_order_id\":\"string(选填)\"," + | |||
| "\"pos_amount\":\"单位(分)(选填)\"}") | |||
| @PostMapping("/checkCouponOrderForVerify") | |||
| @SystemControllerLog(description = "券核销检查") | |||
| public Map<String, String> checkCouponOrderVerify(@RequestBody Map<String, String> params) { | |||
| @PostMapping("/checkCouponOrder") | |||
| @SystemControllerLog(description = "券检查是否可用-场景(核销/支付)") | |||
| public Map<String, String> checkCouponOrder(@RequestBody Map<String, String> params) { | |||
| JSONObject payContent = new JSONObject(); | |||
| // 1. check sign | |||
| @@ -192,8 +222,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyDo(params, EnumVerifyActionType.CHECK); | |||
| @@ -230,8 +260,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyDo(params, EnumVerifyActionType.PRE_VERIFY); | |||
| @@ -267,8 +297,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyCancel(params, EnumVerifyActionType.PRE_VERIFY_CANCEL); | |||
| @@ -304,8 +334,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyDo(params, EnumVerifyActionType.VERIFY_INDEPENT); | |||
| @@ -363,8 +393,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyDo(params, EnumVerifyActionType.VERIFY_PAY); | |||
| @@ -403,8 +433,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyListDo(params, EnumVerifyActionType.VERIFY_PAY); | |||
| @@ -444,7 +474,7 @@ public class PosController extends BaseController { | |||
| ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||
| } | |||
| String errCode = retMap.get(WxPayConstant.VERIFY); | |||
| if(errCode.equalsIgnoreCase("true")) { | |||
| if(errCode.equalsIgnoreCase(WxPayConstant.TRUE)) { | |||
| // 核销成功 | |||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId, EnumCouponVerifyType.VERIFY_POS_PAY.getCode()); | |||
| } | |||
| @@ -473,8 +503,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.couponOrderVerifyCancel(params, EnumVerifyActionType.VERIFY_CANCEL); | |||
| @@ -511,8 +541,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.cardPayPre(params); | |||
| @@ -550,8 +580,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.cardPayPreCancel(params); | |||
| @@ -588,8 +618,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.cardPay(params); | |||
| @@ -627,8 +657,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| retMap = posService.cardPayCancel(params); | |||
| @@ -658,8 +688,8 @@ public class PosController extends BaseController { | |||
| // 签名相关异常返回 | |||
| return retMap; | |||
| } | |||
| String resKey = payContent.getString("resKey"); | |||
| logger.info("resKey: " + resKey); | |||
| String resKey = payContent.getString(WxPayConstant.RES_KEY); | |||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | |||
| try { | |||
| @@ -754,39 +784,39 @@ public class PosController extends BaseController { | |||
| String devId = params.get(WxPayConstant.DEV_ID); // 开发者ID | |||
| String sign = params.get(WxPayConstant.SIGN); // 签名 | |||
| if (StringUtils.isBlank(devId)) { | |||
| String errorMessage = "request params[dev_id] error."; | |||
| String errorMessage = String.format("request params[%s] error.", WxPayConstant.DEV_ID); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, "参数错误", WxPayConstant.RET_FAIL, ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errorMessage); | |||
| } | |||
| if (StringUtils.isBlank(sign)) { | |||
| String errorMessage = "request params[sign] error."; | |||
| String errorMessage = String.format("request params[%s] error.", WxPayConstant.SIGN); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, "参数错误", WxPayConstant.RET_FAIL, ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errorMessage); | |||
| } | |||
| // 查询开发者信息 | |||
| ThDevInfo devInfo = thDevInfoService.getByDevId(devId); | |||
| if (devInfo == null) { | |||
| String errorMessage = "Can't found devInfo[dev_id="+devId+"] record in db."; | |||
| String errorMessage = String.format("Can't found devInfo[%s=%s] record in db.", WxPayConstant.DEV_ID, devId); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, "参数错误", WxPayConstant.RET_FAIL, ErrorCode.DEV_ID_NOT_FOUND.getCode(), errorMessage); | |||
| } | |||
| if (devInfo.getState().equals(EnumEnableType.Disable.getCode())) { | |||
| String errorMessage = "devInfo not available [dev_id="+devId+"] record in db."; | |||
| String errorMessage = String.format("devInfo not available [%s=%s] record in db.", WxPayConstant.DEV_ID, devId); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, "参数错误", WxPayConstant.RET_FAIL, ErrorCode.DEV_ID_IS_DISABLED.getCode(), errorMessage); | |||
| } | |||
| if (StringUtils.isBlank(devInfo.getReqKey())) { | |||
| String errorMessage = "reqKey is null[dev_id="+devId+"] record in db."; | |||
| String errorMessage = String.format("%s is null[%s=%s] record in db.", WxPayConstant.REQ_KEY, WxPayConstant.DEV_ID, devId); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, "参数错误", WxPayConstant.RET_FAIL, ErrorCode.DEV_ID_REQ_KEY_IS_NULL.getCode(), errorMessage); | |||
| } | |||
| if (StringUtils.isBlank(devInfo.getResKey())) { | |||
| String errorMessage = "resKey is null[dev_id="+devId+"] record in db."; | |||
| String errorMessage = String.format("%s is null[%s=%s] record in db.", WxPayConstant.RES_KEY, WxPayConstant.DEV_ID, devId); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, "参数错误", WxPayConstant.RET_FAIL, ErrorCode.DEV_ID_RES_KEY_IS_NULL.getCode(), errorMessage); | |||
| } | |||
| payContent.put("resKey", devInfo.getResKey()); | |||
| payContent.put(WxPayConstant.RES_KEY, devInfo.getResKey()); | |||
| boolean signVerified = WxPayment.verifyNotifyHMAC(params, devInfo.getReqKey()); | |||
| if (!signVerified) { | |||
| String errorMessage = "签名错误"; | |||
| logger.error("checksign error, params: " + params.toString()); | |||
| logger.error(errorMessage + ": " + params.toString()); | |||
| return buildReturnMap(WxPayConstant.RET_FAIL, errorMessage, WxPayConstant.RET_FAIL, ErrorCode.DEV_ID_RES_KEY_IS_NULL.getCode(), errorMessage); | |||
| } | |||
| return null; | |||
| @@ -4,15 +4,13 @@ import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.vo.WxCouponOrderCVo; | |||
| import com.iformall.domain.vo.WxLevelMerchantCVo; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxCouponMapper; | |||
| import com.iformall.mapper.WxCouponMerchantMapper; | |||
| import com.iformall.mapper.WxCouponOrderMapper; | |||
| import com.iformall.mapper.WxOrderMapper; | |||
| import com.iformall.mapper.*; | |||
| import com.iformall.pay.WxPayConstant; | |||
| import com.iformall.service.*; | |||
| import lombok.AllArgsConstructor; | |||
| @@ -23,6 +21,7 @@ import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import java.text.ParseException; | |||
| import java.text.SimpleDateFormat; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| @@ -35,6 +34,10 @@ public class PosServiceImpl implements PosService { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| // neu时间格式, 4位年2位月2位日2位24小时制时2位分2位秒3位毫秒 | |||
| private final SimpleDateFormat neuDateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); | |||
| private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| private final WxMallService mallService; | |||
| private final PosMallConfigService posMallConfigService; | |||
| private final WxCUserService cUserService; | |||
| @@ -49,12 +52,13 @@ public class PosServiceImpl implements PosService { | |||
| private final WxCardSpendService cardSpendService; | |||
| private final WxOrderMapper orderMapper; | |||
| private final WxPayOrderMapper payOrderMapper; | |||
| private final WxCouponOrderMapper couponOrderMapper; | |||
| private final WxCouponMerchantMapper couponMerchantMapper; | |||
| private final WxCouponMapper couponMapper; | |||
| private final SimpleDateFormat mydateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
| /** | |||
| * 门店用户登录检查 | |||
| @@ -78,6 +82,18 @@ public class PosServiceImpl implements PosService { | |||
| if (StringUtils.isBlank(password)) { | |||
| errParam(WxPayConstant.PASSWORD); | |||
| } | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| WxMerchantBUser user = new WxMerchantBUser(); | |||
| user.setTenantId(tenantId); | |||
| user.setPhone(phone); | |||
| @@ -96,8 +112,19 @@ public class PosServiceImpl implements PosService { | |||
| // check password | |||
| if (user1.getUserPwd().equalsIgnoreCase(password)) { | |||
| retMap.put(WxPayConstant.TENANT_ID, user1.getTenantId()); | |||
| retMap.put(WxPayConstant.MALL_NAME, mall.getName()); | |||
| retMap.put(WxPayConstant.MERCHANT_ID, String.valueOf(user1.getMerchantId())); | |||
| retMap.put(WxPayConstant.MERCHANT_NAME, merchant.getName()); | |||
| retMap.put(WxPayConstant.MERCHANT_IMG, merchant.getImgUrl()); | |||
| retMap.put(WxPayConstant.BUSER_ID, String.valueOf(user1.getId())); | |||
| retMap.put(WxPayConstant.REG_QRCODE_URL, mall.getImgQrcodeWeapp()); | |||
| retMap.put(WxPayConstant.POS_QRCODE_RULE, mall.getPosQrcodeRule()); | |||
| retMap.put(WxPayConstant.MEM_DISCOUNT, String.valueOf(config.getDiscount().equals(EnumPosEnableType.Enable.getCode()))); | |||
| retMap.put(WxPayConstant.MEM_COUPON, String.valueOf(config.getCoupon())); | |||
| retMap.put(WxPayConstant.MEM_COUPON_DESC, EnumPosCouponEnableType.getEnum(config.getCoupon()).getMessage()); | |||
| retMap.put(WxPayConstant.MEM_CARD, String.valueOf(config.getCard().equals(EnumPosEnableType.Enable.getCode()))); | |||
| return retMap; | |||
| } else { | |||
| logger.error(ErrorCode.PASSWORD_ERROR.getMessage()); | |||
| @@ -123,14 +150,25 @@ public class PosServiceImpl implements PosService { | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| errParam(WxPayConstant.TENANT_ID); | |||
| } | |||
| WxMall mall = mallService.getByTenantId(tenantId); | |||
| if (mall == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| if (config == null) { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| retMap.put(WxPayConstant.MEM_DISCOUNT, String.valueOf(config.getDiscount().equals(EnumEnableType.Enable.getCode()))); | |||
| retMap.put(WxPayConstant.MEM_COUPON, String.valueOf(config.getCoupon().equals(EnumEnableType.Enable.getCode()))); | |||
| retMap.put(WxPayConstant.MEM_CARD, String.valueOf(config.getCard().equals(EnumEnableType.Enable.getCode()))); | |||
| retMap.put(WxPayConstant.TENANT_ID, mall.getTenantId()); | |||
| retMap.put(WxPayConstant.MALL_NAME, mall.getName()); | |||
| retMap.put(WxPayConstant.REG_QRCODE_URL, mall.getImgQrcodeWeapp()); | |||
| retMap.put(WxPayConstant.POS_QRCODE_RULE, mall.getPosQrcodeRule()); | |||
| retMap.put(WxPayConstant.MEM_DISCOUNT, String.valueOf(config.getDiscount().equals(EnumPosEnableType.Enable.getCode()))); | |||
| retMap.put(WxPayConstant.MEM_COUPON, String.valueOf(config.getCoupon())); | |||
| retMap.put(WxPayConstant.MEM_COUPON_DESC, EnumPosCouponEnableType.getEnum(config.getCoupon()).getMessage()); | |||
| retMap.put(WxPayConstant.MEM_CARD, String.valueOf(config.getCard().equals(EnumPosEnableType.Enable.getCode()))); | |||
| return retMap; | |||
| } | |||
| @@ -153,6 +191,8 @@ public class PosServiceImpl implements PosService { | |||
| logger.error(ErrorCode.MALL_INFO_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.MALL_INFO_NOT_FOUND); | |||
| } | |||
| retMap.put(WxPayConstant.TENANT_ID, mall.getTenantId()); | |||
| retMap.put(WxPayConstant.MALL_NAME, mall.getName()); | |||
| retMap.put(WxPayConstant.REG_QRCODE_URL, mall.getImgQrcodeWeapp()); | |||
| retMap.put(WxPayConstant.POS_QRCODE_RULE, mall.getPosQrcodeRule()); | |||
| return retMap; | |||
| @@ -167,11 +207,11 @@ public class PosServiceImpl implements PosService { | |||
| public Map<String, String> checkMember(Map<String, String> params) throws MallinkException { | |||
| Map<String, String> retMap = new HashMap<>(); | |||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||
| String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | |||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||
| String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | |||
| String memIdStr = params.get(WxPayConstant.MEM_ID); // 会员ID | |||
| String memPhoneStr = params.get(WxPayConstant.MEM_PHONE); // 会员手机 | |||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | |||
| String memPhoneStr = params.get(WxPayConstant.MEM_PHONE); // 会员手机 | |||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单金额(单位:分) | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| @@ -316,11 +356,12 @@ public class PosServiceImpl implements PosService { | |||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||
| String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | |||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | |||
| String verifyType = params.get(WxPayConstant.VERIFY_TYPE); // 核销类型 | |||
| String sceneTypeStr = params.get(WxPayConstant.SCENE_TYPE); // 场景类型 | |||
| String couponOrderIdStr = params.get(WxPayConstant.COUPON_ORDER_ID); // 券ID | |||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单总额(单位:分) | |||
| Integer sceneType = null; | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| errParam(WxPayConstant.TENANT_ID); | |||
| } | |||
| @@ -329,7 +370,7 @@ public class PosServiceImpl implements PosService { | |||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||
| } | |||
| if (!config.getCoupon().equals(EnumEnableType.Enable.getCode())) { | |||
| if (!config.getCoupon().equals(EnumPosEnableType.Disable.getCode())) { | |||
| logger.error(ErrorCode.POS_CONFIG_MEM_COUPON_DISABLE.getMessage()); | |||
| throw new MallinkException(ErrorCode.POS_CONFIG_MEM_COUPON_DISABLE); | |||
| } | |||
| @@ -343,17 +384,19 @@ public class PosServiceImpl implements PosService { | |||
| errParam(WxPayConstant.COUPON_ORDER_ID); | |||
| } | |||
| if (actionType.equals(EnumVerifyActionType.CHECK)) { | |||
| if (StringUtils.isBlank(verifyType)) { | |||
| errParam(WxPayConstant.VERIFY_TYPE); | |||
| if (StringUtils.isBlank(sceneTypeStr)) { | |||
| errParam(WxPayConstant.SCENE_TYPE); | |||
| } | |||
| if (!(verifyType.equalsIgnoreCase(WxPayConstant.VERIFY_TYPE_INDEPENT) || verifyType.equalsIgnoreCase(WxPayConstant.VERIFY_TYPE_PAY))) { | |||
| String errMessage = "request params[verify_type] only support independent or pay."; | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), errMessage); | |||
| try { | |||
| sceneType = Integer.valueOf(sceneTypeStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| } else if (actionType.equals(EnumVerifyActionType.VERIFY_INDEPENT)) { | |||
| verifyType = WxPayConstant.VERIFY_TYPE_INDEPENT; | |||
| sceneType = EnumPosSceneType.VERIFY.getCode(); | |||
| } else if (actionType.equals(EnumVerifyActionType.VERIFY_PAY)) { | |||
| verifyType = WxPayConstant.VERIFY_TYPE_PAY; | |||
| sceneType = EnumPosSceneType.PAY.getCode(); | |||
| } | |||
| if (actionType.equals(EnumVerifyActionType.PRE_VERIFY) || | |||
| actionType.equals(EnumVerifyActionType.VERIFY_INDEPENT) || | |||
| @@ -396,7 +439,7 @@ public class PosServiceImpl implements PosService { | |||
| if (couponOrderIdStr != null) { | |||
| try { | |||
| Map<String,String> oneRetMap = doVerifyActionForOneCouponOrder( | |||
| actionType, verifyType, | |||
| actionType, sceneType, | |||
| tenantId, merchantIdStr, merchantId, | |||
| buUserIdStr, buUserId, | |||
| posOrderIdStr, posOrderId, posAmount, | |||
| @@ -421,7 +464,7 @@ public class PosServiceImpl implements PosService { | |||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | |||
| String posAmountStr = params.get(WxPayConstant.POS_AMOUNT); // POS订单总额(单位:分) | |||
| String selCoListStr = params.get(WxPayConstant.SELECTED_COUPON_ORDER_LIST); // 选中的优惠券列表 | |||
| String verifyType = WxPayConstant.VERIFY_TYPE_PAY; // 此接口只有支付使用 | |||
| Integer sceneType = EnumPosSceneType.PAY.getCode(); // 此接口只有支付使用 | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| errParam(WxPayConstant.TENANT_ID); | |||
| @@ -485,7 +528,7 @@ public class PosServiceImpl implements PosService { | |||
| if (couponOrderIdStr != null) { | |||
| try { | |||
| Map<String,String> oneRetMap = doVerifyActionForOneCouponOrder( | |||
| actionType, verifyType, | |||
| actionType, sceneType, | |||
| tenantId, merchantIdStr, merchantId, | |||
| buUserIdStr, buUserId, | |||
| posOrderIdStr, posOrderId, posAmount, | |||
| @@ -504,7 +547,7 @@ public class PosServiceImpl implements PosService { | |||
| } | |||
| private Map<String, String> doVerifyActionForOneCouponOrder( | |||
| EnumVerifyActionType actionType, String verifyType, | |||
| EnumVerifyActionType actionType, Integer sceneType, | |||
| String tenantId, String merchantIdStr, Long merchantId, | |||
| String buUserIdStr, Long buUserId, | |||
| String posOrderIdStr, Long posOrderId, Integer posAmount, | |||
| @@ -518,7 +561,7 @@ public class PosServiceImpl implements PosService { | |||
| } | |||
| // 4.1 检查券类型 | |||
| if (actionType.equals(EnumVerifyActionType.CHECK)) { | |||
| if (verifyType.equalsIgnoreCase(WxPayConstant.VERIFY_TYPE_INDEPENT)) { | |||
| if (sceneType.equals(EnumPosSceneType.VERIFY.getCode())) { | |||
| if (!(couponOrderCVo.getCouponType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || | |||
| couponOrderCVo.getCouponType().equals(EnumCouponType.COUPON_LIPIN.getCode()) || | |||
| couponOrderCVo.getCouponType().equals(EnumCouponType.COUPON_PRESS.getCode()) || | |||
| @@ -528,7 +571,7 @@ public class PosServiceImpl implements PosService { | |||
| throw new MallinkException(ErrorCode.VERIFY_COUPON_TYPE_NOT_SUPPORT); | |||
| } | |||
| } | |||
| if (verifyType.equalsIgnoreCase(WxPayConstant.VERIFY_TYPE_PAY)) { | |||
| if (sceneType.equals(EnumPosSceneType.PAY.getCode())) { | |||
| if (!(couponOrderCVo.getCouponType().equals(EnumCouponType.COUPON_MULTIMCH.getCode()) || | |||
| couponOrderCVo.getCouponType().equals(EnumCouponType.COUPON_MANJIAN.getCode()) || | |||
| couponOrderCVo.getCouponType().equals(EnumCouponType.COUPON_DAIJIN.getCode()) | |||
| @@ -1181,9 +1224,7 @@ public class PosServiceImpl implements PosService { | |||
| String cardIdStr = params.get(WxPayConstant.CARD_ID); // 消费卡ID | |||
| if (StringUtils.isBlank(tenantId)) { | |||
| String errMessage = "request params[tenant_id] error."; | |||
| logger.error(errMessage); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), errMessage); | |||
| errParam(WxPayConstant.TENANT_ID); | |||
| } | |||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||
| if (config == null) { | |||
| @@ -1569,24 +1610,32 @@ public class PosServiceImpl implements PosService { | |||
| if (StringUtils.isBlank(posStatusStr)) { | |||
| errParam(WxPayConstant.NEU_ORDER_STATUS); | |||
| } | |||
| Long merchantId, buUserId, posOrderId, cardId; | |||
| Long merchantId, buUserId, posOrderId, memId; | |||
| Integer posAmount = 0; | |||
| Date orderTime = null; | |||
| try { | |||
| merchantId = Long.valueOf(merchantIdStr); | |||
| buUserId = Long.valueOf(buUserIdStr); | |||
| memId = Long.valueOf(cuUserIdStr); | |||
| posOrderId = Long.valueOf(posOrderIdStr); | |||
| posAmount = Integer.valueOf(posAmountStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| try { | |||
| orderTime = neuDateFormat.parse(posOrderTimeStr); | |||
| } catch (ParseException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| // 2. check merchant | |||
| WxMerchant merchant = checkAndGetMerchant(merchantId); | |||
| // 3. check buUser | |||
| WxMerchantBUser merchantBUser = checkAndGetMerchantUser(merchantId, buUserId); | |||
| if (posStatusStr.equalsIgnoreCase("0")) { | |||
| // TODO | |||
| // add to wx_order | |||
| final WxMerchantBUser merchantBUser = checkAndGetMerchantUser(merchantId, buUserId); | |||
| if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_PAY)) { | |||
| WxOrder order = createOrderByPos(merchantBUser, memId, posOrderId, posAmount, orderTime); | |||
| String payDetail = params.get(WxPayConstant.NEU_PAY_DETAIL); | |||
| JSONObject payDetailObj = JSON.parseObject(payDetail); | |||
| JSONArray payDetailList = payDetailObj.getJSONArray(WxPayConstant.NEU_PAY_DETAIL_LIST); | |||
| @@ -1594,17 +1643,38 @@ public class PosServiceImpl implements PosService { | |||
| JSONObject payOrderObj = payDetailList.getJSONObject(i); | |||
| // ADD to wx_pay_order | |||
| String neuPayOrderType = payOrderObj.getString(WxPayConstant.NEU_PAY_ORDER_TYPE); | |||
| if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumPosPamentType.MEM_DISCOUNT.getCode()))) { | |||
| String neuPayOrderIdStr = payOrderObj.getString(WxPayConstant.NEU_PAY_ORDER_ID); | |||
| String neuPaymentAmount = payOrderObj.getString(WxPayConstant.NEU_PAY_ORDER_AMOUNT); | |||
| String neuPayOrderTimeStr = payOrderObj.getString(WxPayConstant.NEU_PAY_ORDER_TIME); | |||
| String neuPayThirdNo = payOrderObj.getString(WxPayConstant.NEU_PAY_ORDER_OUT_NO); | |||
| Date neuPosPayOrderTime = null; | |||
| try { | |||
| neuPosPayOrderTime = neuDateFormat.parse(neuPayOrderTimeStr); | |||
| } catch (ParseException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| Long neuPayOrderId; | |||
| try { | |||
| neuPayOrderId = Long.valueOf(neuPayOrderIdStr); | |||
| } catch (NumberFormatException e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||
| } | |||
| if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()))) { | |||
| // 会员折扣 | |||
| } else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumPosPamentType.MEM_COUPON.getCode()))) { | |||
| WxPayOrder payOrder = payOrderFromMemDiscount(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime); | |||
| } else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_COUPON.getCode()))) { | |||
| // 优惠券, 交易核销 | |||
| String couponOrderIdStr = payOrderObj.getString(WxPayConstant.NEU_PAY_ORDER_OUT_NO); | |||
| } else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumPosPamentType.MEM_CARD.getCode()))) { | |||
| WxPayOrder payOrder = payOrderFromCouponVerify(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo); | |||
| } else if (neuPayOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosPamentType.MEM_CARD.getCode()))) { | |||
| // 预付卡, 不能退 | |||
| } | |||
| WxPayOrder payOrder = payOrderFromCard(merchantBUser, order, memId, neuPayOrderId, neuPaymentAmount, neuPosPayOrderTime, neuPayThirdNo); | |||
| } else { | |||
| } | |||
| } | |||
| } else if (posStatusStr.equalsIgnoreCase("1")) { | |||
| } else if (posStatusStr.equalsIgnoreCase(WxPayConstant.NEU_ORDER_REFUND)) { | |||
| // TODO | |||
| // add to wx_order | |||
| String refundDetail = params.get(WxPayConstant.NEU_REFUND_DETAIL); | |||
| @@ -1615,14 +1685,16 @@ public class PosServiceImpl implements PosService { | |||
| // TODO | |||
| // ADD to wx_pay_order | |||
| String neuRefundOrderType = refundOrderObj.getString(WxPayConstant.NEU_REFUND_ORDER_TYPE); | |||
| if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumPosRefundType.MEM_DISCOUNT.getCode()))) { | |||
| if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosRefundType.MEM_DISCOUNT.getCode()))) { | |||
| // 会员折扣, | |||
| } else if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumPosRefundType.MEM_COUPON.getCode()))) { | |||
| } else if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosRefundType.MEM_COUPON.getCode()))) { | |||
| // 优惠券, 退优惠券 | |||
| } else if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumPosRefundType.MEM_CARD.getCode()))) { | |||
| } else if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosRefundType.MEM_CARD.getCode()))) { | |||
| // 预付卡, 不能退 | |||
| } else if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumPosRefundType.BOOK.getCode()))) { | |||
| } else if (neuRefundOrderType.equalsIgnoreCase(String.valueOf(EnumNeuPosRefundType.BOOK.getCode()))) { | |||
| // 记账 | |||
| } else { | |||
| } | |||
| } | |||
| } | |||
| @@ -1630,6 +1702,191 @@ public class PosServiceImpl implements PosService { | |||
| return retMap; | |||
| } | |||
| /** | |||
| * 支付订单-会员折扣 | |||
| * @param merchantBUser | |||
| * @param order | |||
| * @param memId | |||
| * @param posPayOrderId | |||
| * @param neuPaymentAmount | |||
| * @param neuPosPayOrderTime | |||
| */ | |||
| public WxPayOrder payOrderFromMemDiscount( | |||
| WxMerchantBUser merchantBUser, | |||
| WxOrder order, | |||
| Long memId, | |||
| Long posPayOrderId, String neuPaymentAmount, Date neuPosPayOrderTime) { | |||
| WxPayOrder payOrder = new WxPayOrder() {{ | |||
| Date curDate = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| setUpdateTime(curDate); | |||
| setPayTimeStart(curDate); | |||
| setPayTimeEnd(curDate); | |||
| setPayOrderNo(String.valueOf(id)); | |||
| setPayAmount(Integer.valueOf(neuPaymentAmount)); | |||
| setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); | |||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| setPosPayOrderId(posPayOrderId); | |||
| setPosPayOrderTime(neuPosPayOrderTime.getTime()); | |||
| setPosPaymentType(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()); | |||
| setPosPayDesc("POS会员折扣支付"); | |||
| }}; | |||
| int sqlRow = payOrderMapper.insertSelective(payOrder); | |||
| if (sqlRow != 1) { | |||
| logger.error("pay order insert error: " + payOrder.toString()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| return payOrder; | |||
| } | |||
| /** | |||
| * 支付订单-优惠券 | |||
| * @param merchantBUser | |||
| * @param order | |||
| * @param memId | |||
| * @param posPayOrderId | |||
| * @param neuPaymentAmount | |||
| * @param neuPosPayOrderTime | |||
| */ | |||
| public WxPayOrder payOrderFromCouponVerify( | |||
| WxMerchantBUser merchantBUser, | |||
| WxOrder order, | |||
| Long memId, | |||
| Long posPayOrderId, String neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) { | |||
| // 1. insert into PayOrder | |||
| WxPayOrder payOrder = new WxPayOrder() {{ | |||
| Date curDate = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| setUpdateTime(curDate); | |||
| setPayTimeStart(curDate); | |||
| setPayTimeEnd(curDate); | |||
| setPayOrderNo(String.valueOf(id)); | |||
| setPayAmount(Integer.valueOf(neuPaymentAmount)); | |||
| setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); | |||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| setPosPayOrderId(posPayOrderId); | |||
| setPosPayOrderTime(neuPosPayOrderTime.getTime()); | |||
| setPosPaymentType(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()); | |||
| setPosPayDesc("POS优惠券支付"); | |||
| setPosPayOrderNo(posPayOrderNo); | |||
| }}; | |||
| int sqlRow = payOrderMapper.insertSelective(payOrder); | |||
| if (sqlRow != 1) { | |||
| logger.error("pay order insert error: " + payOrder.toString()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| // 2. 核销 | |||
| return payOrder; | |||
| } | |||
| /** | |||
| * 支付订单-预付卡 | |||
| * @param merchantBUser | |||
| * @param order | |||
| * @param memId | |||
| * @param posPayOrderId | |||
| * @param neuPaymentAmount | |||
| * @param neuPosPayOrderTime | |||
| * @param posPayOrderNo | |||
| */ | |||
| public WxPayOrder payOrderFromCard( | |||
| WxMerchantBUser merchantBUser, | |||
| WxOrder order, | |||
| Long memId, | |||
| Long posPayOrderId, String neuPaymentAmount, Date neuPosPayOrderTime, String posPayOrderNo) { | |||
| // 1. insert into PayOrder | |||
| WxPayOrder payOrder = new WxPayOrder() {{ | |||
| Date curDate = new Date(); | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| Long id = idWorker.nextId(); | |||
| setId(id); | |||
| setTenantId(merchantBUser.getTenantId()); | |||
| setCUserId(memId); | |||
| setOrderId(order.getId()); | |||
| setCreateTime(curDate); | |||
| setUpdateTime(curDate); | |||
| setPayTimeStart(curDate); | |||
| setPayTimeEnd(curDate); | |||
| setPayOrderNo(String.valueOf(id)); | |||
| setPayAmount(Integer.valueOf(neuPaymentAmount)); | |||
| setPayVendor(EnumPayWay.PAY_WAY_POS_NEU.getCode()); | |||
| setPayOrderStatus(EnumPayStatus.PAY_STATUS_SUCCESS.getCode()); | |||
| setShare(EnumPayShare.NO.getCode()); | |||
| setPosPayOrderId(posPayOrderId); | |||
| setPosPayOrderTime(neuPosPayOrderTime.getTime()); | |||
| setPosPaymentType(EnumNeuPosPamentType.MEM_DISCOUNT.getCode()); | |||
| setPosPayDesc("POS富茂卡支付"); | |||
| setPosPayOrderNo(posPayOrderNo); | |||
| }}; | |||
| int sqlRow = payOrderMapper.insertSelective(payOrder); | |||
| if (sqlRow != 1) { | |||
| logger.error("pay order insert error: " + payOrder.toString()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| // 2. 卡支付 card spend | |||
| // 3。卡支付 后续 | |||
| return payOrder; | |||
| } | |||
| /** | |||
| * 基于NEUPOS订单信息创建订单 | |||
| * @param merchantBUser | |||
| * @param memId | |||
| * @param posOrderId | |||
| * @param posAmount | |||
| * @param posOrderTime | |||
| * @return | |||
| */ | |||
| public WxOrder createOrderByPos( | |||
| final WxMerchantBUser merchantBUser, | |||
| final Long memId, | |||
| final Long posOrderId, final Integer posAmount, final Date posOrderTime | |||
| ) { | |||
| 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); | |||
| setType(EnumOrderType.POSPAY.getCode()); | |||
| setProductId(merchantBUser.getId()); | |||
| setCUserId(memId); | |||
| setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | |||
| setPayment(posAmount); | |||
| setOrderStatus(EnumOrderStatus.ORDER_STATUS_PAYMENT_SUCCESS.getCode()); | |||
| setDetail(bodyStr); | |||
| setCreateDate(curr); | |||
| setUpdateDate(curr); | |||
| setPosOrderId(posOrderId); | |||
| setPosOrderCreateTime(posOrderTime.getTime()); | |||
| }}; | |||
| try { | |||
| orderMapper.insertSelective(order); | |||
| } catch (Exception e) { | |||
| logger.error(e.getMessage()); | |||
| throw new MallinkException(ErrorCode.DB_FAIL); | |||
| } | |||
| return order; | |||
| } | |||
| /** | |||
| * 检查及获取商户信息 | |||
| @@ -105,10 +105,11 @@ public class PosAppTest { | |||
| reqObj.put(WxPayConstant.DEV_ID, devId); | |||
| 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("/getPosMemConfig") | |||
| MockMvcRequestBuilders.post("/checkUserPassword") | |||
| .contentType(MediaType.APPLICATION_JSON) | |||
| .content(reqJsonStr)) | |||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||
| @@ -292,13 +293,13 @@ public class PosAppTest { | |||
| reqObj.put(WxPayConstant.MERCHANT_ID, merchantId); | |||
| reqObj.put(WxPayConstant.BUSER_ID, buUserId); | |||
| reqObj.put(WxPayConstant.COUPON_ORDER_ID, couponOrderId); | |||
| reqObj.put(WxPayConstant.VERIFY_TYPE, verifyType); | |||
| reqObj.put(WxPayConstant.SCENE_TYPE, verifyType); | |||
| 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("/checkCouponOrderForVerify") | |||
| MockMvcRequestBuilders.post("/checkCouponOrder") | |||
| .contentType(MediaType.APPLICATION_JSON) | |||
| .content(reqJsonStr)) | |||
| .andExpect(MockMvcResultMatchers.status().isOk()) | |||
| @@ -23,11 +23,11 @@ public class PosMallConfig extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="会员折扣是否开启,0-使用中,1-禁用",name="discount") | |||
| @io.swagger.annotations.ApiModelProperty(value="会员折扣是否开启,0-禁用,1-可用",name="discount") | |||
| private Integer discount; | |||
| @io.swagger.annotations.ApiModelProperty(value="会员优惠券是否开启,0-使用中,1-禁用",name="coupon") | |||
| @io.swagger.annotations.ApiModelProperty(value="会员优惠券是否开启,0-禁用,1-单选可用,2-多选可用,",name="coupon") | |||
| private Integer coupon; | |||
| @io.swagger.annotations.ApiModelProperty(value="会员消费卡是否开启,0-使用中,1-禁用",name="card") | |||
| @io.swagger.annotations.ApiModelProperty(value="会员消费卡是否开启,0-禁用,1-可用",name="card") | |||
| private Integer card; | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| @@ -40,7 +40,7 @@ public class WxOrder extends BaseEntity { | |||
| private Long couponChannelId; | |||
| @io.swagger.annotations.ApiModelProperty(value="产品ID(type-0:couponId, 1:buserId, 3:merchantId)",name="productId") | |||
| private Long productId; | |||
| @io.swagger.annotations.ApiModelProperty(value="类型(0:券,1:B刷卡支付,2:C扫码支付,3:储值卡)",name="type") | |||
| @io.swagger.annotations.ApiModelProperty(value="类型(0:券,1:B刷卡支付,2:C扫码支付,3:储值卡, 10:POS支付)",name="type") | |||
| private Integer type; | |||
| @io.swagger.annotations.ApiModelProperty(value="0: 付款 1: 退款",name="paymentType") | |||
| private Integer paymentType; | |||
| @@ -70,6 +70,11 @@ public class WxOrder extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value = "formId", name = "formId") | |||
| private String formId; | |||
| @io.swagger.annotations.ApiModelProperty(value = "POS系统订单ID", name = "posOrderId") | |||
| private Long posOrderId; | |||
| @io.swagger.annotations.ApiModelProperty(value="POS系统订单创建时间",name="posOrderCreateTime") | |||
| private Long posOrderCreateTime; | |||
| @Transient | |||
| protected List<Integer> statusS; | |||
| @@ -64,5 +64,16 @@ public class WxPayOrder extends BaseEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="支付后结果来源(0:callback, 1:query)",name="payEndFrom") | |||
| private Integer payEndFrom; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付订单号,来源于POS",name="posPayOrderId") | |||
| private Long posPayOrderId; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付订单创建时间,来源于POS",name="posPayOrderTime") | |||
| private Long posPayOrderTime; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付方式: 0微信;1支付宝;2现金;3会员折扣;4优惠券;5预付卡;6银行卡,来源于POS",name="posPaymentType") | |||
| private Integer posPaymentType; | |||
| @io.swagger.annotations.ApiModelProperty(value="支付订单流水号, 来源于POS, 第三方(微信、支付宝、富茂预付卡)支付订单流水号,富茂优惠券ID,现金和富茂会员折扣时为空",name="posPayOrderNo") | |||
| private String posPayOrderNo; | |||
| @io.swagger.annotations.ApiModelProperty(value="POS支付描述",name="posPayDesc") | |||
| private String posPayDesc; | |||
| } | |||
| @@ -3,7 +3,7 @@ package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumPosPamentType { | |||
| public enum EnumNeuPosPamentType { | |||
| // 来源于Neusoft的定义 0微信;1支付宝;2现金;3会员折扣;4优惠券;5预付卡;6银行卡 | |||
| WECHAT(0, "微信"), | |||
| @@ -14,8 +14,8 @@ public enum EnumPosPamentType { | |||
| MEM_CARD(5, "预付卡"), | |||
| MEM_BANKCARD(6, "银行卡"), | |||
| ; | |||
| public static EnumPosPamentType getEnum(Integer code) { | |||
| for (EnumPosPamentType value : values()) { | |||
| public static EnumNeuPosPamentType getEnum(Integer code) { | |||
| for (EnumNeuPosPamentType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| @@ -26,7 +26,7 @@ public enum EnumPosPamentType { | |||
| private Integer code; | |||
| private String message; | |||
| EnumPosPamentType(Integer code, String message) { | |||
| EnumNeuPosPamentType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| @@ -3,7 +3,7 @@ package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumPosRefundType { | |||
| public enum EnumNeuPosRefundType { | |||
| // 来源于Neusoft的定义 0微信;1支付宝;2现金;3会员折扣;4优惠券;5预付卡;6银行卡;7记账 | |||
| WECHAT(0, "微信"), | |||
| @@ -15,8 +15,8 @@ public enum EnumPosRefundType { | |||
| MEM_BANKCARD(6, "银行卡"), | |||
| BOOK(7, "记账"), | |||
| ; | |||
| public static EnumPosRefundType getEnum(Integer code) { | |||
| for (EnumPosRefundType value : values()) { | |||
| public static EnumNeuPosRefundType getEnum(Integer code) { | |||
| for (EnumNeuPosRefundType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| @@ -27,7 +27,7 @@ public enum EnumPosRefundType { | |||
| private Integer code; | |||
| private String message; | |||
| EnumPosRefundType(Integer code, String message) { | |||
| EnumNeuPosRefundType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| @@ -11,7 +11,8 @@ public enum EnumOrderType { | |||
| MICROPAY(1,"B收款码支付"), | |||
| NATIVEPAY(2,"C扫码支付"), | |||
| PREPAIDCARD(3, "储值卡"), | |||
| CREDIT(4,"积分支付") | |||
| CREDIT(4,"积分支付"), | |||
| POSPAY(10, "POS支付") | |||
| ; | |||
| public static EnumOrderType getEnum(Integer code) { | |||
| @@ -9,7 +9,10 @@ public enum EnumPayWay { | |||
| PAY_WAY_WECHAT(1, "微信支付"), | |||
| PAY_WAY_WECHAT_WAP(2, "微信H5"), | |||
| PAY_WAY_ALIPAY(3, "支付宝"), | |||
| PAY_WAY_ALIPAY_WAP(4, "支付宝H5"); | |||
| PAY_WAY_ALIPAY_WAP(4, "支付宝H5"), | |||
| PAY_WAY_POS_B(10, "POS B端"), | |||
| PAY_WAY_POS_NEU(11, "POS 东软"), | |||
| ; | |||
| public static EnumPayWay getEnum(Integer code) { | |||
| for (EnumPayWay value : values()) { | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumPosCouponEnableType { | |||
| // 0:禁用 1:单选可用 | |||
| Disable(0, "禁用"), | |||
| SingleEnable(1, "单选可用"), | |||
| MultiEnable(2, "多选可用") | |||
| ; | |||
| public static EnumPosCouponEnableType getEnum(Integer code) { | |||
| for (EnumPosCouponEnableType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumPosCouponEnableType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumPosEnableType { | |||
| // 0:禁用 1:可用 | |||
| Disable(0, "禁用"), | |||
| Enable(1, "可用") | |||
| ; | |||
| public static EnumPosEnableType getEnum(Integer code) { | |||
| for (EnumPosEnableType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumPosEnableType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| package com.iformall.enums; | |||
| /** | |||
| * @author gongbiao | |||
| */ | |||
| public enum EnumPosSceneType { | |||
| PAY(1,"支付"), | |||
| VERIFY(2,"核销") | |||
| ; | |||
| public static EnumPosSceneType getEnum(Integer code) { | |||
| for (EnumPosSceneType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private String message; | |||
| EnumPosSceneType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| public Integer getCode() { | |||
| return code; | |||
| } | |||
| public String getMessage() { | |||
| return message; | |||
| } | |||
| } | |||
| @@ -19,7 +19,10 @@ public class WxPayConstant { | |||
| public final static String TENANT_ID = "tenant_id"; | |||
| public final static String MALL_NAME = "mall_name"; | |||
| public final static String MERCHANT_ID = "merchant_id"; | |||
| public final static String MERCHANT_NAME = "merchant_name"; | |||
| public final static String MERCHANT_IMG = "merchant_img"; | |||
| public final static String BUSER_ID = "bu_user_id"; | |||
| public final static String COUPON_ORDER_ID = "coupon_order_id"; | |||
| public final static String SELECTED_COUPON_ORDER_LIST = "sel_co_list"; | |||
| @@ -40,9 +43,9 @@ public class WxPayConstant { | |||
| public final static String PRICE = "price"; | |||
| public final static String STATUS = "status"; | |||
| public final static String VERIFY_TYPE = "verify_type"; | |||
| public final static String VERIFY_TYPE_INDEPENT = "independent"; | |||
| public final static String VERIFY_TYPE_PAY = "pay"; | |||
| public final static String SCENE_TYPE = "scene_type"; | |||
| public final static String SCENE_VERIFY = "2"; | |||
| public final static String SCENE_PAY = "1"; | |||
| public final static String CHECK = "check"; | |||
| public final static String PRE_VERIFY = "pre_verify"; | |||
| @@ -57,6 +60,7 @@ public class WxPayConstant { | |||
| public final static String MEM_DISCOUNT = "discount"; | |||
| public final static String MEM_COUPON = "coupon"; | |||
| public final static String MEM_COUPON_DESC = "coupon_desc"; | |||
| public final static String MEM_CARD = "card"; | |||
| public final static String MEM_LEVEL = "level"; | |||
| public final static String AVAIL_CO_LIST = "avail_co_list"; | |||
| @@ -82,6 +86,7 @@ public class WxPayConstant { | |||
| public final static String FALSE = "false"; | |||
| //// 东软相关定义 | |||
| public final static String NEU_TENANT_ID = "TenantID"; // 富茂系统商场ID | |||
| public final static String NEU_MERCHANT_ID = "MerchantID"; // 富茂系统商户ID | |||
| public final static String NEU_BU_USER_ID = "OrderOperatorID"; // 富茂系统登录操作员ID | |||
| @@ -115,4 +120,8 @@ public class WxPayConstant { | |||
| public final static String NEU_REFUND_ORDER_OUT_NO = "OuterRefundNumber"; // 第三方(微信、支付宝、富茂预付卡)支付订单流水号,富茂优惠券ID,现金和富茂会员折扣时为空 | |||
| public final static String NEU_REFUND_ORDER_AMOUNT = "RefundAmount"; // 退款金额 | |||
| public final static String NEU_REFUND_ORDER_OUT_TIME = "RefundTime"; // 第三方支付系统返回的支付时间,现金和富茂会员折扣时为空 | |||
| public final static String NEU_ORDER_PAY = "0"; // 有效, 优惠券从预核销处理为核销, 卡从预支付->支付 | |||
| public final static String NEU_ORDER_REFUND = "1"; // 取消 | |||
| } | |||
| @@ -21,8 +21,8 @@ | |||
| and `id` = #{id} | |||
| </if> | |||
| <if test=" null != tenantId "> | |||
| and `tenant_id` like concat('%', #{tenantId},'%') | |||
| </if> | |||
| and `tenant_id` = #{tenantId} | |||
| </if> | |||
| <if test=" null != discount "> | |||
| and `discount` = #{discount} | |||
| </if> | |||