| @@ -2,9 +2,12 @@ package com.iformall.controller.sys; | |||
| import com.iformall.annotation.SystemControllerLog; | |||
| import com.iformall.common.ErrorCode; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.controller.base.BaseController; | |||
| import com.iformall.domain.po.MallUserInfo; | |||
| import com.iformall.domain.po.WxUserDataRule; | |||
| import com.iformall.enums.EnumUserAdmin; | |||
| import com.iformall.service.WxUserDataRuleService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| @@ -31,6 +34,11 @@ public class WxUserDataRuleController extends BaseController { | |||
| @SystemControllerLog(description = "用户数据权限-新增") | |||
| public ResultData modify(@RequestBody WxUserDataRule wxUserDataRule) { | |||
| logger.debug("[" + getIpAddr() + "] wxDataRuleTarget::modify"); | |||
| MallUserInfo currentUser = getUser(); | |||
| // 系统管理员才能修改信息 | |||
| if (!currentUser.getIsAdmin().equals(EnumUserAdmin.ADMIN.getCode())) { | |||
| return new ResultData(ErrorCode.USER_NO_PERMISSION.getCode(), "系统管理员才能修改信息"); | |||
| } | |||
| wxUserDataRuleService.modify(wxUserDataRule); | |||
| return new ResultData(); | |||
| } | |||
| @@ -62,7 +62,7 @@ public class UserDataRuleAspect { | |||
| buildingFloor = StringUtils.join(data, ","); | |||
| } | |||
| String businessForRule = byUserId.getBusinessForRule(); | |||
| String businessForRule = byUserId.getBusiness(); | |||
| if (StringUtils.isNotEmpty(businessForRule)) { | |||
| Object[] data = JSONArray.parseArray(businessForRule).toArray(); | |||
| businessForRule = StringUtils.join(data, ","); | |||
| @@ -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,59 @@ 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\":\"string单位(分)(选填)\"}") | |||
| @PostMapping("/checkCouponOrder") | |||
| @SystemControllerLog(description = "券检查是否可用-场景(核销/支付)") | |||
| public Map<String, String> checkCouponOrder(@RequestBody Map<String, String> params) { | |||
| 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.couponOrderVerifyDo(params, EnumPosActionType.CHECK); | |||
| 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()); | |||
| } | |||
| } | |||
| @ApiOperation(value = "支付计算接口", notes = "{" + | |||
| "\"dev_id\":\"string(必填)\"," + | |||
| "\"nonce_str\":\"string(必填)\"," + | |||
| "\"tenant_id\":\"string(必填)\"," + | |||
| "\"merchant_id\":\"string(必填)\"," + | |||
| "\"bu_user_id\":\"string(必填)\"," + | |||
| "\"mem_id\":\"string(选填)\"," + | |||
| "\"mem_phone\":\"string(选填)\"," + | |||
| "\"sel_co_list\":\"json array[券包ID list](必填),例[\"1\",\"2\",\"3\"]\"" + | |||
| "\"pos_order_id\":\"string(选填)\"," + | |||
| "\"pos_amount\":\"单位(分)(选填)\"}") | |||
| @PostMapping("/checkCouponOrderForVerify") | |||
| @SystemControllerLog(description = "券核销检查") | |||
| public Map<String, String> checkCouponOrderVerify(@RequestBody Map<String, String> params) { | |||
| "\"pos_amount\":\"string单位(分)(必填)\"}") | |||
| @PostMapping("/calcMem") | |||
| @SystemControllerLog(description = "支付计算接口") | |||
| public Map<String, String> calcForMem(@RequestBody Map<String, String> params) { | |||
| JSONObject payContent = new JSONObject(); | |||
| // 1. check sign | |||
| @@ -192,11 +262,11 @@ 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); | |||
| retMap = posService.calcMem(params); | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_SUCCESS, null); | |||
| } catch (MallinkException e) { | |||
| @@ -230,11 +300,11 @@ 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); | |||
| retMap = posService.couponOrderVerifyDo(params, EnumPosActionType.PRE_VERIFY); | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_SUCCESS, null); | |||
| } catch (MallinkException e) { | |||
| @@ -267,11 +337,11 @@ 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); | |||
| retMap = posService.couponOrderVerifyCancel(params, EnumPosActionType.PRE_VERIFY_CANCEL); | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_SUCCESS, null); | |||
| } catch (MallinkException e) { | |||
| @@ -304,11 +374,11 @@ 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); | |||
| retMap = posService.couponOrderVerifyDo(params, EnumPosActionType.VERIFY_INDEPENT); | |||
| } catch (MallinkException e) { | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_FAIL, | |||
| @@ -363,11 +433,11 @@ 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); | |||
| retMap = posService.couponOrderVerifyDo(params, EnumPosActionType.VERIFY_PAY); | |||
| } catch (MallinkException e) { | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_FAIL, | |||
| @@ -403,11 +473,11 @@ 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); | |||
| retMap = posService.couponOrderVerifyListDo(params, EnumPosActionType.VERIFY_PAY); | |||
| } catch (MallinkException e) { | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_FAIL, | |||
| @@ -444,7 +514,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,11 +543,11 @@ 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); | |||
| retMap = posService.couponOrderVerifyCancel(params, EnumPosActionType.VERIFY_CANCEL); | |||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", | |||
| WxPayConstant.RET_SUCCESS, null); | |||
| } catch (MallinkException e) { | |||
| @@ -511,8 +581,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 +620,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 +658,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 +697,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 +728,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 +824,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; | |||
| @@ -1,8 +1,7 @@ | |||
| package com.iformall.service; | |||
| import com.iformall.enums.EnumVerifyActionType; | |||
| import com.iformall.enums.EnumPosActionType; | |||
| import com.iformall.exception.MallinkException; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import java.util.Map; | |||
| @@ -35,6 +34,13 @@ public interface PosService { | |||
| */ | |||
| Map<String, String> checkMember(Map<String, String> params) throws MallinkException; | |||
| /** | |||
| * 支付计算 | |||
| * @param params | |||
| * @return | |||
| */ | |||
| Map<String, String> calcMem(Map<String, String> params) throws MallinkException; | |||
| /** | |||
| * 核销动作(check, pre_verify, verify) | |||
| * @param params | |||
| @@ -42,7 +48,7 @@ public interface PosService { | |||
| * @return | |||
| * @throws MallinkException | |||
| */ | |||
| Map<String, String> couponOrderVerifyDo(Map<String, String> params, EnumVerifyActionType actionType) throws MallinkException; | |||
| Map<String, String> couponOrderVerifyDo(Map<String, String> params, EnumPosActionType actionType) throws MallinkException; | |||
| /** | |||
| * 核销取消(check, pre_verify, verify) for selected_coupon_list | |||
| @@ -51,7 +57,7 @@ public interface PosService { | |||
| * @return | |||
| * @throws MallinkException | |||
| */ | |||
| Map<String, String> couponOrderVerifyCancel(Map<String, String> params, EnumVerifyActionType actionType) throws MallinkException; | |||
| Map<String, String> couponOrderVerifyCancel(Map<String, String> params, EnumPosActionType actionType) throws MallinkException; | |||
| /** | |||
| * 核销动作(check, pre_verify, verify) for selected_coupon_list | |||
| @@ -60,7 +66,7 @@ public interface PosService { | |||
| * @return | |||
| * @throws MallinkException | |||
| */ | |||
| Map<String, String> couponOrderVerifyListDo(Map<String, String> params, EnumVerifyActionType actionType) throws MallinkException; | |||
| Map<String, String> couponOrderVerifyListDo(Map<String, String> params, EnumPosActionType actionType) throws MallinkException; | |||
| /** | |||
| * 消费卡POS预支付 | |||
| @@ -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()) | |||
| @@ -175,6 +176,15 @@ public class PosAppTest { | |||
| doCheckMem(memId, phone, posOrderId, posAmount); | |||
| } | |||
| @Test | |||
| public void checkCalcTest() throws Exception { | |||
| String memId = "321178010928119808"; | |||
| String phone = "13910154397"; | |||
| String posAmount = "20000"; | |||
| String selCoList = "[\"321877927162249216\"]"; | |||
| doCalcMem(memId, phone, posAmount, selCoList); | |||
| } | |||
| @Test | |||
| public void checkCouponOrderForIndeepdentVerifyTest() throws Exception { | |||
| String couponOrderId = "321877927162249216"; | |||
| @@ -256,10 +266,11 @@ public class PosAppTest { | |||
| 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.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); | |||
| } | |||
| @@ -284,6 +295,37 @@ public class PosAppTest { | |||
| 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 doCheckVerify(String couponOrderId, String verifyType, String posOrderId, String posAmount) throws Exception { | |||
| Map<String, String> reqObj = new HashMap<>(); | |||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | |||
| @@ -292,13 +334,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()) { | |||
| @@ -3,20 +3,21 @@ package com.iformall.enums; | |||
| /** | |||
| * Created by Stormeye on 2018/08/09. | |||
| */ | |||
| public enum EnumVerifyActionType { | |||
| public enum EnumPosActionType { | |||
| // 0: 检查, 1: 预核销 2: 预核销撤销 3:独立核销 4: 交易核销 5:核销撤销 | |||
| CHECK(0, "检查"), | |||
| PRE_VERIFY(1, "预核销"), | |||
| PRE_VERIFY_CANCEL(2, "预核销撤销"), | |||
| VERIFY_INDEPENT(3,"独立核销"), | |||
| VERIFY_PAY(4,"交易核销"), | |||
| VERIFY_CANCEL(5,"核销撤销") | |||
| CALC(1, "计算"), | |||
| PRE_VERIFY(2, "预核销"), | |||
| PRE_VERIFY_CANCEL(3, "预核销撤销"), | |||
| VERIFY_INDEPENT(4,"独立核销"), | |||
| VERIFY_PAY(5,"交易核销"), | |||
| VERIFY_CANCEL(6,"核销撤销") | |||
| ; | |||
| public static EnumVerifyActionType getEnum(Integer code) { | |||
| for (EnumVerifyActionType value : values()) { | |||
| public static EnumPosActionType getEnum(Integer code) { | |||
| for (EnumPosActionType value : values()) { | |||
| if (value.getCode().equals(code)) { | |||
| return value; | |||
| } | |||
| @@ -27,7 +28,7 @@ public enum EnumVerifyActionType { | |||
| private Integer code; | |||
| private String message; | |||
| EnumVerifyActionType(Integer code, String message) { | |||
| EnumPosActionType(Integer code, String message) { | |||
| this.code = code; | |||
| this.message = message; | |||
| } | |||
| @@ -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"; | |||
| @@ -56,7 +59,10 @@ public class WxPayConstant { | |||
| public final static String MEM_DISCOUNT = "discount"; | |||
| public final static String MEM_DISCOUNT_RATE = "discount_rate"; | |||
| public final static String MEM_COUPON = "coupon"; | |||
| public final static String MEM_COUPONS = "coupons"; | |||
| 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"; | |||
| @@ -74,6 +80,7 @@ public class WxPayConstant { | |||
| public final static String SALE_FEE = "sale_fee"; | |||
| public final static String ORG_AMOUNT = "org_amount"; | |||
| public final static String DISCOUNT_AMOUNT = "discount_amount"; | |||
| public final static String ORG_REMAIN_AMOUNT = "org_remain_amount"; | |||
| public final static String RET = "ret"; | |||
| @@ -82,6 +89,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 +123,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"; // 取消 | |||
| } | |||
| @@ -1607,7 +1607,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { | |||
| oweMerchantVo.setBalance(map.get("balance")==null?"0":map.get("balance").toString()); | |||
| list.add(oweMerchantVo); | |||
| } | |||
| String name = "商户列表"; | |||
| String name = "商户账单列表"; | |||
| excelService.exportExcel(list, null, name, ReceivedAndPayVo.class, name + ".xlsx", response, false); | |||
| } | |||
| @@ -321,6 +321,7 @@ public class WxBillRentServiceImpl implements WxBillRentService { | |||
| long newReceivePay; | |||
| if(ratioVo != null){ | |||
| newReceivePay = ratioVo.getPrice(); | |||
| ratio = ratioVo.getRatio(); | |||
| }else{ | |||
| BigDecimal hundred = new BigDecimal(100); | |||
| BigDecimal revenue = new BigDecimal(record.getRevenue() == null ? 0 : record.getRevenue()).divide(hundred); | |||
| @@ -1250,11 +1250,22 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||
| double needpayD = WxRentContractServiceImpl.getNeedPay(0,priceD,startDate,endDate); | |||
| needpay = new Double(needpayD).longValue(); | |||
| }else{ | |||
| //年 需要除12 | |||
| Double priceD = new Double(price); | |||
| //年或者设置跳点率为年周期 除12 | |||
| if(EnumPriceUnit.Y.getCode().equals(wxRentContract.getPriceUnit())){ | |||
| priceD = new Double(price)/12; | |||
| } | |||
| if (wxRentContract.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { | |||
| //设置跳点率为年周期 price不变 | |||
| if(EnumMissTimeType.PERIOD.getCode().equals(wxRentContract.getBusDiscountTime())){ | |||
| return priceD.longValue(); | |||
| } | |||
| //年或者设置跳点率为年周期 除12 | |||
| if(EnumMissTimeType.YEAR.getCode().equals(wxRentContract.getBusDiscountTime())){ | |||
| priceD = new Double(price)/12; | |||
| } | |||
| } | |||
| //生成金额直接计算 | |||
| if(!saveDb){ | |||
| @@ -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> | |||
| @@ -238,10 +238,10 @@ | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule "> | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule "> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| @@ -150,10 +150,10 @@ | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule "> | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule "> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| @@ -149,10 +149,10 @@ | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule "> | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule "> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| @@ -177,10 +177,10 @@ | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule "> | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule "> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| @@ -382,6 +382,22 @@ | |||
| <if test=" null != rentShopType ">and rc.`rent_shop_type` = #{rentShopType}</if> | |||
| <if test=" null != applyStatus ">and rc.`apply_status` = #{applyStatus}</if> | |||
| <if test=" null != operationType ">and rc.`operation_type` = #{operationType}</if> | |||
| <if test="(null != floorForRule and '' != floorForRule) or (null != businessForRule and '' != businessForRule)"> | |||
| and rc.merchant_id in( | |||
| select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms | |||
| inner join wx_merchant m on ms.merchant_id = m.id | |||
| inner join wx_shop s on s.id=ms.shop_id | |||
| where m.tenant_id=#{tenantId} and s.is_del=0 | |||
| <if test=" null != businessForRule and '' != businessForRule "> | |||
| and m.business_id in (${businessForRule}) | |||
| </if> | |||
| <if test=" null != floorForRule and '' != floorForRule "> | |||
| and s.`floor` in (${floorForRule}) | |||
| </if> | |||
| ) | |||
| </if> | |||
| </where> | |||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||
| <if test=" null == sortColumns">order by rc.createtime desc,rc.id desc</if> | |||