| @@ -0,0 +1,3 @@ | |||||
| ALTER TABLE `wx_card_spend` | |||||
| change `from` `pay_from` tinyint(6) NOT NULL DEFAULT '0' COMMENT '来源(0:C端小程序扫一扫, 1:POS)', | |||||
| drop column `pos_refund_status`; | |||||
| @@ -229,82 +229,6 @@ public class PosController extends BaseController { | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | ||||
| } | } | ||||
| /* | |||||
| private Map<String, String> couponOrderPayVerify(@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.VERIFY_PAY); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| doActionAfterVerify(params, retMap); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } | |||||
| private Map<String, String> couponOrderPayVerifyList(@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.couponOrderVerifyListDo(params, EnumPosActionType.VERIFY_PAY); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | |||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | |||||
| String arrString = retMap.get(WxPayConstant.RET); | |||||
| Long buUserId; | |||||
| try { | |||||
| buUserId = Long.valueOf(buUserIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||||
| } | |||||
| JSONArray couponArr = JSON.parseArray(arrString); | |||||
| for (int i = 0;i < couponArr.size(); i++) { | |||||
| String id = retMap.get(WxPayConstant.ID); | |||||
| Long couponOrderId; | |||||
| try { | |||||
| couponOrderId = Long.valueOf(id); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", ErrorCode.SYS_PARAMETER_CAST_ERROR); | |||||
| } | |||||
| String errCode = retMap.get(WxPayConstant.VERIFY); | |||||
| if(errCode.equalsIgnoreCase(WxPayConstant.TRUE)) { | |||||
| // 核销成功 | |||||
| couponOrderService.sendInsideCouponVerifyMsg(tenantId, couponOrderId, buUserId); | |||||
| } | |||||
| } | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } | |||||
| @ApiOperation(value = "消费卡预支付", notes = "{" + | @ApiOperation(value = "消费卡预支付", notes = "{" + | ||||
| "\"dev_id\":\"string(必填)\"," + | "\"dev_id\":\"string(必填)\"," + | ||||
| "\"nonce_str\":\"string(必填)\"," + | "\"nonce_str\":\"string(必填)\"," + | ||||
| @@ -318,6 +242,7 @@ public class PosController extends BaseController { | |||||
| @SystemControllerLog(description = "消费卡预支付") | @SystemControllerLog(description = "消费卡预支付") | ||||
| public Map<String, String> cardPayPre(@RequestBody Map<String, String> params) { | public Map<String, String> cardPayPre(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | JSONObject payContent = new JSONObject(); | ||||
| JSONObject retObj = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -329,12 +254,12 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.cardPayPre(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| retObj = posService.cardPayPre(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -352,52 +277,7 @@ public class PosController extends BaseController { | |||||
| @SystemControllerLog(description = "消费卡预支付取消") | @SystemControllerLog(description = "消费卡预支付取消") | ||||
| public Map<String, String> cardPayPreCancel(@RequestBody Map<String, String> params) { | public Map<String, String> cardPayPreCancel(@RequestBody Map<String, String> params) { | ||||
| JSONObject payContent = new JSONObject(); | 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.cardPayPreCancel(params); | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retMap, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| private Map<String, String> cardPay(@RequestBody Map<String, String> params) { | |||||
| JSONObject retObj = new JSONObject(); | |||||
| 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 { | |||||
| retObj = posService.cardPay(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", null); | |||||
| } catch (MallinkException e) { | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| } | |||||
| } | |||||
| private Map<String, String> cardPayCancel(@RequestBody Map<String, String> params) { | |||||
| JSONObject retObj = new JSONObject(); | JSONObject retObj = new JSONObject(); | ||||
| JSONObject payContent = new JSONObject(); | |||||
| // 1. check sign | // 1. check sign | ||||
| Map<String, String> retMap = checkSign(params, payContent); | Map<String, String> retMap = checkSign(params, payContent); | ||||
| @@ -409,15 +289,14 @@ public class PosController extends BaseController { | |||||
| logger.info(WxPayConstant.RES_KEY + ": " + resKey); | logger.info(WxPayConstant.RES_KEY + ": " + resKey); | ||||
| try { | try { | ||||
| retMap = posService.cardPayCancel(params); | |||||
| retObj = posService.cardPayPreCancel(params); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",null); | ||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", e.getErrorCode(), e.getMessage()); | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "", 500, e.getMessage()); | |||||
| return buildReturnMap(retObj, resKey, WxPayConstant.RET_SUCCESS, "",500, e.getMessage()); | |||||
| } | } | ||||
| } | } | ||||
| */ | |||||
| /** | /** | ||||
| * 构造返回map,无签名, 有错误 | * 构造返回map,无签名, 有错误 | ||||
| @@ -44,7 +44,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| //Map<String, String> cardPayPre(Map<String, String> params) throws MallinkException; | |||||
| JSONObject cardPayPre(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 消费卡POS预支付取消 | * 消费卡POS预支付取消 | ||||
| @@ -52,7 +52,7 @@ public interface PosService { | |||||
| * @return | * @return | ||||
| * @throws MallinkException | * @throws MallinkException | ||||
| */ | */ | ||||
| //Map<String, String> cardPayPreCancel(Map<String, String> params) throws MallinkException; | |||||
| JSONObject cardPayPreCancel(Map<String, String> params) throws MallinkException; | |||||
| /** | /** | ||||
| * 订单同步-Neusoft-支付或者退款成功后通知富茂 | * 订单同步-Neusoft-支付或者退款成功后通知富茂 | ||||
| @@ -348,18 +348,6 @@ public class PosServiceImpl implements PosService { | |||||
| return dataMap; | return dataMap; | ||||
| } | } | ||||
| private boolean isSelCoupon(JSONArray selCoArr, Long couponOrderId) { | |||||
| boolean selCoupon = false; | |||||
| for (int j=0;j<selCoArr.size();j++) { | |||||
| String selCouponOrderStr = selCoArr.getString(j); | |||||
| if (couponOrderId.toString().equals(selCouponOrderStr)) { | |||||
| selCoupon = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return selCoupon; | |||||
| } | |||||
| /** | /** | ||||
| * 单券核销计算 | * 单券核销计算 | ||||
| * @param promotionCalc | * @param promotionCalc | ||||
| @@ -1702,16 +1690,16 @@ public class PosServiceImpl implements PosService { | |||||
| logger.info("核销已取消: " + couponOrderCVo.getId()); | logger.info("核销已取消: " + couponOrderCVo.getId()); | ||||
| } | } | ||||
| //@Override | |||||
| @Override | |||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| public Map<String, String> cardPayPre(Map<String, String> params) throws MallinkException { | |||||
| Map<String, String> retMap = new HashMap<>(); | |||||
| public JSONObject cardPayPre(Map<String, String> params) throws MallinkException { | |||||
| JSONObject retMap = new JSONObject(); | |||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | ||||
| String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | ||||
| String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | String buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | ||||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | ||||
| String posAmountStr = params.get(WxPayConstant.ORDER_AMOUNT); // POS订单总额(单位:分) | |||||
| String posAmountStr = params.get(WxPayConstant.ORDER_AMOUNT); // POS订单总额(单位:分) | |||||
| String cardIdStr = params.get(WxPayConstant.CARD_ID); // 消费卡ID | String cardIdStr = params.get(WxPayConstant.CARD_ID); // 消费卡ID | ||||
| if (StringUtils.isBlank(tenantId)) { | if (StringUtils.isBlank(tenantId)) { | ||||
| @@ -1798,7 +1786,7 @@ public class PosServiceImpl implements PosService { | |||||
| throw new MallinkException(ErrorCode.CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH); | throw new MallinkException(ErrorCode.CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH); | ||||
| } | } | ||||
| WxCardSpend record = new WxCardSpend(); | WxCardSpend record = new WxCardSpend(); | ||||
| record.setFrom(EnumCardSpendFrom.POS.getCode()); | |||||
| record.setPayFrom(EnumCardSpendFrom.POS.getCode()); | |||||
| record.setTenantId(merchant.getTenantId()); | record.setTenantId(merchant.getTenantId()); | ||||
| record.setCardId(cardId); | record.setCardId(cardId); | ||||
| record.setOwnerId(couponOrder.getOwnerId()); | record.setOwnerId(couponOrder.getOwnerId()); | ||||
| @@ -1825,10 +1813,10 @@ public class PosServiceImpl implements PosService { | |||||
| return retMap; | return retMap; | ||||
| } | } | ||||
| //@Override | |||||
| @Override | |||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| public Map<String, String> cardPayPreCancel(@RequestBody Map<String, String> params) throws MallinkException { | |||||
| Map<String, String> retMap = new HashMap<>(); | |||||
| public JSONObject cardPayPreCancel(@RequestBody Map<String, String> params) throws MallinkException { | |||||
| JSONObject retMap = new JSONObject(); | |||||
| String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | String tenantId = params.get(WxPayConstant.TENANT_ID); // 租户ID | ||||
| String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | String merchantIdStr = params.get(WxPayConstant.MERCHANT_ID); // 商户ID | ||||
| @@ -1934,129 +1922,6 @@ public class PosServiceImpl implements PosService { | |||||
| return retMap; | return retMap; | ||||
| } | } | ||||
| //@Override | |||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public Map<String, String> cardPay(Map<String, String> params) throws MallinkException { | |||||
| return null; | |||||
| } | |||||
| //@Override | |||||
| @Transactional(rollbackFor = Exception.class) | |||||
| public Map<String, String> cardPayCancel(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 buUserIdStr = params.get(WxPayConstant.BUSER_ID); // POS操作员ID | |||||
| String posOrderIdStr = params.get(WxPayConstant.POS_ORDER_ID); // POS订单ID | |||||
| String posAmountStr = params.get(WxPayConstant.ORDER_AMOUNT); // POS订单总额(单位:分) | |||||
| String cardIdStr = params.get(WxPayConstant.CARD_ID); // 消费卡ID | |||||
| String cardSpendIdStr = params.get(WxPayConstant.CARD_SPEND_ID); // 消费卡花费ID | |||||
| if (StringUtils.isBlank(tenantId)) { | |||||
| errParam(WxPayConstant.TENANT_ID); | |||||
| } | |||||
| PosMallConfig config = posMallConfigService.getByTenantId(tenantId); | |||||
| if (config == null) { | |||||
| logger.error(ErrorCode.POS_CONFIG_NOT_FOUND.getMessage()); | |||||
| throw new MallinkException(ErrorCode.POS_CONFIG_NOT_FOUND); | |||||
| } | |||||
| if (!config.getCard().equals(EnumEnableType.Enable.getCode())) { | |||||
| logger.error(ErrorCode.POS_CONFIG_MEM_COUPON_DISABLE.getMessage()); | |||||
| throw new MallinkException(ErrorCode.POS_CONFIG_MEM_COUPON_DISABLE); | |||||
| } | |||||
| if (StringUtils.isBlank(merchantIdStr)) { | |||||
| errParam(WxPayConstant.MERCHANT_ID); | |||||
| } | |||||
| if (StringUtils.isBlank(buUserIdStr)) { | |||||
| errParam(WxPayConstant.BUSER_ID); | |||||
| } | |||||
| if (StringUtils.isBlank(posOrderIdStr)) { | |||||
| errParam(WxPayConstant.POS_ORDER_ID); | |||||
| } | |||||
| if (StringUtils.isBlank(posAmountStr)) { | |||||
| errParam(WxPayConstant.ORDER_AMOUNT); | |||||
| } | |||||
| if (StringUtils.isBlank(cardIdStr)) { | |||||
| errParam(WxPayConstant.CARD_ID); | |||||
| } | |||||
| if (StringUtils.isBlank(cardSpendIdStr)) { | |||||
| errParam(WxPayConstant.CARD_SPEND_ID); | |||||
| } | |||||
| Long merchantId, buUserId, posOrderId, cardId, cardSpendId; | |||||
| Integer posAmount = 0; | |||||
| try { | |||||
| merchantId = Long.valueOf(merchantIdStr); | |||||
| buUserId = Long.valueOf(buUserIdStr); | |||||
| posOrderId = Long.valueOf(posOrderIdStr); | |||||
| posAmount = Integer.valueOf(posAmountStr); | |||||
| cardId = Long.valueOf(cardIdStr); | |||||
| cardSpendId = Long.valueOf(cardSpendIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error(e.getMessage()); | |||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), e.getMessage()); | |||||
| } | |||||
| WxCardInfo cardInfo = cardInfoService.getById(cardId); | |||||
| if(cardInfo == null) { | |||||
| String errMessage = "卡不存在: " + cardIdStr; | |||||
| logger.error(errMessage); | |||||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND.getCode(), errMessage); | |||||
| } | |||||
| WxCouponMerchant couponMerchant = cardSpendService.checkMerchantInCoupon(cardInfo, merchantId); | |||||
| if(couponMerchant == null) { | |||||
| String errMessage = "商户不支持此卡 " + cardIdStr; | |||||
| logger.error(errMessage); | |||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_MERANT_IS_NULL.getCode(), errMessage); | |||||
| } | |||||
| // 2. check merchant | |||||
| WxMerchant merchant = merchantService.getById(merchantId); | |||||
| if (merchant == null) { | |||||
| logger.error(ErrorCode.MERCHANT_INFO_NOT_FOUND.getMessage() + ": " + merchantIdStr); | |||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_FOUND); | |||||
| } | |||||
| if (merchant.getIsDel().equals(EnumDelStatus.DEL.getCode()) || merchant.getStatus().equals(EnumMerchantStatus.NOT_VALID.getCode())) { | |||||
| logger.error(ErrorCode.MERCHANT_INFO_NOT_VALID.getMessage() + ": " + merchantIdStr); | |||||
| throw new MallinkException(ErrorCode.MERCHANT_INFO_NOT_VALID); | |||||
| } | |||||
| // 3. check buUser | |||||
| WxMerchantBUser buUser = checkAndGetMerchantUser(buUserId, merchantId); | |||||
| WxCouponOrder couponOrder = couponOrderService.getById(cardId); | |||||
| if(couponOrder == null) { | |||||
| logger.error("卡不存在: " + cardIdStr); | |||||
| throw new MallinkException(ErrorCode.CARD_IS_NOT_FOUND); | |||||
| } | |||||
| WxCardSpend record = cardSpendService.getById(cardSpendId); | |||||
| if (record == null) { | |||||
| logger.error(ErrorCode.CARD_SPEND_IS_NOT_FOUND.getMessage() + ": " + cardSpendIdStr); | |||||
| throw new MallinkException(ErrorCode.CARD_SPEND_IS_NOT_FOUND); | |||||
| } | |||||
| if (!record.getPayStatus().equals(EnumCardSpendStatus.PREV_PAY.getCode())) { | |||||
| logger.error(ErrorCode.POS_CAR_PAY_NOT_CANCEL.getMessage()); | |||||
| throw new MallinkException(ErrorCode.POS_CAR_PAY_NOT_CANCEL); | |||||
| } | |||||
| try { | |||||
| WxCardInfo updateCardInfo = cardSpendService.cardSpendForPosPrePayCancel(cardInfo, record); | |||||
| JSONObject retObj = new JSONObject(); | |||||
| retObj.put(WxPayConstant.CARD_ID, cardId); | |||||
| retObj.put(WxPayConstant.ORG_REMAIN_AMOUNT, cardInfo.getRemainingAmount()); | |||||
| retObj.put(WxPayConstant.REMAIN_AMOUNT, updateCardInfo.getRemainingAmount()); | |||||
| retObj.put(WxPayConstant.CANCEL, WxPayConstant.TRUE); | |||||
| retMap.put(WxPayConstant.RET, JSON.toJSONString(retObj)); | |||||
| } catch (MallinkException e) { | |||||
| logger.error("card spend error, req 2: " + record.toString() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(e.getErrorCode(), e.getMessage()); | |||||
| } catch (Exception e) { | |||||
| logger.error("card spend error, req 3: " + record.toString() + ", e:" + e.getMessage()); | |||||
| throw new MallinkException(500, e.getMessage()); | |||||
| } | |||||
| return retMap; | |||||
| } | |||||
| @Override | @Override | ||||
| @Transactional(rollbackFor = Exception.class) | @Transactional(rollbackFor = Exception.class) | ||||
| public JSONObject posOrderSync(Map<String, String> params) throws MallinkException { | public JSONObject posOrderSync(Map<String, String> params) throws MallinkException { | ||||
| @@ -2461,6 +2326,24 @@ public class PosServiceImpl implements PosService { | |||||
| return buUser; | return buUser; | ||||
| } | } | ||||
| /** | |||||
| * 券是否在选择列表中 | |||||
| * @param selCoArr | |||||
| * @param couponOrderId | |||||
| * @return | |||||
| */ | |||||
| private boolean isSelCoupon(JSONArray selCoArr, Long couponOrderId) { | |||||
| boolean selCoupon = false; | |||||
| for (int j=0;j<selCoArr.size();j++) { | |||||
| String selCouponOrderStr = selCoArr.getString(j); | |||||
| if (couponOrderId.toString().equals(selCouponOrderStr)) { | |||||
| selCoupon = true; | |||||
| break; | |||||
| } | |||||
| } | |||||
| return selCoupon; | |||||
| } | |||||
| /** | /** | ||||
| * 输入参数错误 | * 输入参数错误 | ||||
| * @param paramStr | * @param paramStr | ||||
| @@ -2494,39 +2377,4 @@ public class PosServiceImpl implements PosService { | |||||
| logger.error(errMessage); | logger.error(errMessage); | ||||
| throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), errMessage); | throw new MallinkException(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), errMessage); | ||||
| } | } | ||||
| /** | |||||
| * POS订单添加 | |||||
| * @return | |||||
| * @throws MallinkException | |||||
| */ | |||||
| private WxOrder addToWxOrder(String tenantId, String merchantNo, String buUserNo, String memNo, String memPhone, | |||||
| String posOrderNo, String posOrderTimeStr, String posOrderAmount, String posOrderStatus) throws MallinkException { | |||||
| // 1. 根据posOrderNo查找 | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * POS支付订单 | |||||
| * @return | |||||
| * @throws MallinkException | |||||
| */ | |||||
| private WxPayOrder addToWxPayOrder(WxOrder orderRecord, | |||||
| String posPayOrderNo, String posPayOrderTime, | |||||
| String paymentType, String thirdParam, String payOrderNo, String payAmount, String payTime) throws MallinkException { | |||||
| return null; | |||||
| } | |||||
| /** | |||||
| * POS支付退款订单 | |||||
| * @return | |||||
| * @throws MallinkException | |||||
| */ | |||||
| private WxPayOrder addToWxRefundOrder(WxOrder orderRecord, | |||||
| String posPayOrderNo, String posRefundOrderNo, String posRefundOrderTime, | |||||
| String refundType, String thirdParam, String refundStatusStr, | |||||
| String refundOrderNo, String refundAmount, String refundTime) throws MallinkException { | |||||
| return null; | |||||
| } | |||||
| } | } | ||||
| @@ -65,11 +65,8 @@ public class WxCardSpend extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="支付状态(0:未分帐, 1:已分账, 2:已人工分账, 10:预支付(POS))",name="payStatus") | @io.swagger.annotations.ApiModelProperty(value="支付状态(0:未分帐, 1:已分账, 2:已人工分账, 10:预支付(POS))",name="payStatus") | ||||
| private Integer payStatus; | private Integer payStatus; | ||||
| @io.swagger.annotations.ApiModelProperty(value="来源(0:C端小程序扫一扫, 1:POS支付)",name="from") | |||||
| private Integer from; | |||||
| @io.swagger.annotations.ApiModelProperty(value="pos状态(1:POS线下退款开始, 2:POS线下退款成功)",name="posRefundStatus") | |||||
| private Integer posRefundStatus; | |||||
| @io.swagger.annotations.ApiModelProperty(value="来源(0:C端小程序扫一扫, 1:POS支付)",name="payFrom") | |||||
| private Integer payFrom; | |||||
| @Transient | @Transient | ||||
| @Excel(name = "消费金额(元)", width = 20, orderNum = "7") | @Excel(name = "消费金额(元)", width = 20, orderNum = "7") | ||||
| @@ -137,7 +137,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { | |||||
| // 5 insert card_spend | // 5 insert card_spend | ||||
| record.setId(idWorker.nextId()); | record.setId(idWorker.nextId()); | ||||
| record.setTenantId(cardInfo.getTenantId()); | record.setTenantId(cardInfo.getTenantId()); | ||||
| record.setFrom(EnumCardSpendFrom.C.getCode()); | |||||
| record.setPayFrom(EnumCardSpendFrom.C.getCode()); | |||||
| record.setPayment(payment); | record.setPayment(payment); | ||||
| record.setRealPayment(real_payment); | record.setRealPayment(real_payment); | ||||
| record.setCardBeforeAmount(cardInfo.getRemainingAmount()); | record.setCardBeforeAmount(cardInfo.getRemainingAmount()); | ||||
| @@ -19,14 +19,14 @@ | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | ||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | ||||
| <result column="pay_status" jdbcType="INTEGER" property="payStatus"/> | <result column="pay_status" jdbcType="INTEGER" property="payStatus"/> | ||||
| <result column="from" jdbcType="INTEGER" property="from"/> | |||||
| <result column="pos_refund_status" jdbcType="INTEGER" property="posRefundStatus"/> | |||||
| <result column="pay_from" jdbcType="INTEGER" property="payFrom"/> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`pos_order_id`,``deduction_amount`,`payment`,`real_payment`, | |||||
| `card_remain_amount`,`card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`, | |||||
| `create_date`,`update_date`, `pay_status`, `from`, `pos_refund_status` | |||||
| `id`,`tenant_id`,`card_id`,`owner_id`,`merchant_id`,`order_id`,`pos_order_id`, | |||||
| `deduction_amount`,`payment`,`real_payment`, `card_remain_amount`, | |||||
| `card_before_amount`,`card_remain_real_amount`,`card_before_real_amount`, | |||||
| `create_date`, `update_date`, `pay_status`, `pay_from` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -82,11 +82,8 @@ | |||||
| <if test=" null != payStatus "> | <if test=" null != payStatus "> | ||||
| and `pay_status` = #{payStatus} | and `pay_status` = #{payStatus} | ||||
| </if> | </if> | ||||
| <if test=" null != from "> | |||||
| and `from` = #{from} | |||||
| </if> | |||||
| <if test=" null != posRefundStatus "> | |||||
| and `pos_refund_status` = #{posRefundStatus} | |||||
| <if test=" null != payFrom "> | |||||
| and `pay_from` = #{payFrom} | |||||
| </if> | </if> | ||||
| <if test=" null != startdate and null!=enddate"> | <if test=" null != startdate and null!=enddate"> | ||||
| and `create_date` between #{startdate} and #{enddate} | and `create_date` between #{startdate} and #{enddate} | ||||