| @@ -125,7 +125,7 @@ public class WxCampaignController extends BaseController { | |||||
| for (String couponIdStr : ids) { | for (String couponIdStr : ids) { | ||||
| Long couponId = Long.parseLong(couponIdStr); | Long couponId = Long.parseLong(couponIdStr); | ||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId,campaign.getTenantId()); | |||||
| if (wxCoupon == null) { | if (wxCoupon == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -147,7 +147,7 @@ public class WxCouponController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | |||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); | |||||
| if (null == coupon) { | if (null == coupon) { | ||||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | ||||
| } | } | ||||
| @@ -289,7 +289,7 @@ public class WxCouponController extends BaseController { | |||||
| @SystemControllerLog(description = "券投放-删除") | @SystemControllerLog(description = "券投放-删除") | ||||
| public ResultData delete(Long id) { | public ResultData delete(Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | ||||
| wxCouponService.deleteById(id); | |||||
| wxCouponService.deleteById(id,getTenantInfo().getTenantId()); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -299,7 +299,7 @@ public class WxCouponController extends BaseController { | |||||
| @SystemControllerLog(description = "券投放-查询") | @SystemControllerLog(description = "券投放-查询") | ||||
| public ResultData findById(@RequestParam Long id) { | public ResultData findById(@RequestParam Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); | logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); | ||||
| return new ResultData(wxCouponService.getVoById(id)); | |||||
| return new ResultData(wxCouponService.getVoById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @@ -395,7 +395,7 @@ public class WxCouponController extends BaseController { | |||||
| @SystemControllerLog(description = "券投放-富文本获取") | @SystemControllerLog(description = "券投放-富文本获取") | ||||
| public ResultData getHtml(@RequestParam Long id) { | public ResultData getHtml(@RequestParam Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); | logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); | ||||
| return new ResultData(wxCouponService.getHtmlById(id)); | |||||
| return new ResultData(wxCouponService.getHtmlById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @ApiOperation("卡延期") | @ApiOperation("卡延期") | ||||
| @@ -409,7 +409,7 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(ResultData.ERROR, "缺少validEndDate"); | return new ResultData(ResultData.ERROR, "缺少validEndDate"); | ||||
| } | } | ||||
| return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),wxCoupon.getValidEndDate())); | |||||
| return new ResultData(wxCouponService.cardDefer(wxCoupon.getId(),getTenantInfo().getTenantId(),wxCoupon.getValidEndDate())); | |||||
| } | } | ||||
| } | } | ||||
| @@ -97,7 +97,7 @@ public class WxCouponPresentController extends BaseController { | |||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponPresent.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponPresent.getCouponId(),wxCouponPresent.getTenantId()); | |||||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围 | if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { //时间范围 | ||||
| if (new Date().after(wxCoupon.getValidEndDate())) { | if (new Date().after(wxCoupon.getValidEndDate())) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | ||||
| @@ -106,7 +106,7 @@ public class WxCouponSendController extends BaseController { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | ||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(wxCouponSend.getCouponId(),getTenantInfo().getTenantId()); | |||||
| if (!EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode().equals(wxCoupon.getStatus())) { | if (!EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode().equals(wxCoupon.getStatus())) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF); | ||||
| } | } | ||||
| @@ -180,7 +180,7 @@ public class WxOrderController extends BaseController { | |||||
| user.setOperatorType(EnumUserType.MALLUSER.getCode()); | user.setOperatorType(EnumUserType.MALLUSER.getCode()); | ||||
| user.setOperatorId(getUserId()); | user.setOperatorId(getUserId()); | ||||
| WxOrder order = null; | WxOrder order = null; | ||||
| WxCoupon coupon = wxCouponService.getById(couponId); | |||||
| WxCoupon coupon = wxCouponService.getById(couponId,wxCouponChannel.getTenantId()); | |||||
| if (coupon == null) { | if (coupon == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -101,7 +101,7 @@ public class MemCouponController extends BaseController { | |||||
| memCouponFromDsp.setCouponId(couponChannel.getCouponId()); | memCouponFromDsp.setCouponId(couponChannel.getCouponId()); | ||||
| } | } | ||||
| // 1. 检查券是否已超限, 无剩余库存 | // 1. 检查券是否已超限, 无剩余库存 | ||||
| WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId()); | |||||
| WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId(),memCouponFromDsp.getTenantId()); | |||||
| if (coupon == null) { | if (coupon == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券不存在:" + memCouponFromDsp.getCouponId()); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券不存在:" + memCouponFromDsp.getCouponId()); | ||||
| } | } | ||||
| @@ -144,7 +144,7 @@ public class MemCouponController extends BaseController { | |||||
| memCouponFromDsp.setCouponId(couponChannel.getCouponId()); | memCouponFromDsp.setCouponId(couponChannel.getCouponId()); | ||||
| } | } | ||||
| // 1. 检查券是否已超限, 无剩余库存 | // 1. 检查券是否已超限, 无剩余库存 | ||||
| WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId()); | |||||
| WxCoupon coupon = couponService.getById(memCouponFromDsp.getCouponId(),couponChannel.getTenantId()); | |||||
| if (coupon == null) { | if (coupon == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券不存在:" + memCouponFromDsp.getCouponId()); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券不存在:" + memCouponFromDsp.getCouponId()); | ||||
| } | } | ||||
| @@ -246,7 +246,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| if (page.getSize() > 0) { | if (page.getSize() > 0) { | ||||
| List<WxCouponOrder> list = page.getList(); | List<WxCouponOrder> list = page.getList(); | ||||
| for (WxCouponOrder c : list) { | for (WxCouponOrder c : list) { | ||||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId()); | |||||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId(),c.getTenantId()); | |||||
| c.setCouponName(coupon.getTitle()); | c.setCouponName(coupon.getTitle()); | ||||
| c.setSalePrice(coupon.getPrice()); | c.setSalePrice(coupon.getPrice()); | ||||
| @@ -276,7 +276,7 @@ public class WxCUserBasicInfoController extends BaseController { | |||||
| //if (page.getSize() > 0) { | //if (page.getSize() > 0) { | ||||
| List<WxCouponOrder> list = page.getList(); | List<WxCouponOrder> list = page.getList(); | ||||
| for (WxCouponOrder c : list) { | for (WxCouponOrder c : list) { | ||||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId()); | |||||
| WxCoupon coupon = wxCouponService.getById(c.getCouponId(),c.getTenantId()); | |||||
| c.setCouponName(coupon.getTitle()); | c.setCouponName(coupon.getTitle()); | ||||
| c.setSalePrice(coupon.getPrice()); | c.setSalePrice(coupon.getPrice()); | ||||
| } | } | ||||
| @@ -164,7 +164,7 @@ public class WxCouponController extends BaseController { | |||||
| if (wxCoupon.getId() == null) { | if (wxCoupon.getId() == null) { | ||||
| return new ResultData(ResultData.ERROR, "缺少id"); | return new ResultData(ResultData.ERROR, "缺少id"); | ||||
| } | } | ||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | |||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),getTenantInfo().getTenantId()); | |||||
| if(coupon.getSourceType().intValue() != EnumCouponSourceType.COUPONSource_Bapi.getCode().intValue()){ | if(coupon.getSourceType().intValue() != EnumCouponSourceType.COUPONSource_Bapi.getCode().intValue()){ | ||||
| return new ResultData(Result.ERROR,"非B端券,不能进行此操作"); | return new ResultData(Result.ERROR,"非B端券,不能进行此操作"); | ||||
| @@ -241,7 +241,7 @@ public class WxCouponController extends BaseController { | |||||
| wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | wxCoupon.setMerchantParams(JSONObject.toJSONString(merchantList)); | ||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId()); | |||||
| WxCoupon coupon = wxCouponService.getById(wxCoupon.getId(),wxCoupon.getTenantId()); | |||||
| if (null == coupon) { | if (null == coupon) { | ||||
| return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId()); | ||||
| } | } | ||||
| @@ -328,7 +328,7 @@ public class WxCouponController extends BaseController { | |||||
| return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | return new ResultData(Result.ERROR,EnumFlowKey.B_COUPON_MERCHANT_CREATE.getMessage()+"未配置审批流程"); | ||||
| } | } | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | logger.debug("[" + getIpAddr() + "] WxCouponController::delete"); | ||||
| wxCouponService.deleteById(id); | |||||
| wxCouponService.deleteById(id,getTenantInfo().getTenantId()); | |||||
| return new ResultData(Result.SUCCESS, "删除成功", null); | return new ResultData(Result.SUCCESS, "删除成功", null); | ||||
| } | } | ||||
| @@ -337,7 +337,7 @@ public class WxCouponController extends BaseController { | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData findById(@RequestParam Long id) { | public ResultData findById(@RequestParam Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); | logger.debug("[" + getIpAddr() + "] WxCouponController::findById"); | ||||
| return new ResultData(wxCouponService.getVoById(id)); | |||||
| return new ResultData(wxCouponService.getVoById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @@ -428,7 +428,7 @@ public class WxCouponController extends BaseController { | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| public ResultData getHtml(@RequestParam Long id) { | public ResultData getHtml(@RequestParam Long id) { | ||||
| logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); | logger.debug("[" + getIpAddr() + "] WxCouponController::getHtmlById"); | ||||
| return new ResultData(wxCouponService.getHtmlById(id)); | |||||
| return new ResultData(wxCouponService.getHtmlById(id,getTenantInfo().getTenantId())); | |||||
| } | } | ||||
| @@ -157,7 +157,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| } else { | } else { | ||||
| wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId()); | |||||
| wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId(),wxMerchantBUser.getTenantId()); | |||||
| if (wxCouponCVo == null) { | if (wxCouponCVo == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -214,7 +214,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| } | } | ||||
| wxCouponOrderCVo.setHtml(wxCouponCVo.getHtml()); | wxCouponOrderCVo.setHtml(wxCouponCVo.getHtml()); | ||||
| } else { | } else { | ||||
| WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId(),wxCouponOrderCVo.getTenantId()); | |||||
| if (wxCoupon == null) { | if (wxCoupon == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -341,7 +341,7 @@ public class WxCarController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); | return new ResultData(Result.SUCCESS,"已经使用过优惠券, 不能重复使用."); | ||||
| } else { | } else { | ||||
| WxCoupon coupon = couponService.getById(userCar.getCouponId()); | |||||
| WxCoupon coupon = couponService.getById(userCar.getCouponId(),park.getFinalTenantId()); | |||||
| if (coupon == null) { | if (coupon == null) { | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "券为空"); | ||||
| } | } | ||||
| @@ -86,7 +86,7 @@ public class WxCouponController extends BaseController { | |||||
| // 库存 | // 库存 | ||||
| if (couponIdL > 0L) { | if (couponIdL > 0L) { | ||||
| // 更新状态 | // 更新状态 | ||||
| WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL); | |||||
| WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL,wxCouponCVo.getTenantId()); | |||||
| if (wxCouponCVo == null) { | if (wxCouponCVo == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -184,7 +184,7 @@ public class WxCouponController extends BaseController { | |||||
| return null; | return null; | ||||
| } | } | ||||
| WxCoupon c = couponService.getById(cc.getCouponId()); | |||||
| WxCoupon c = couponService.getById(cc.getCouponId(),cc.getTenantId()); | |||||
| if (c == null) { | if (c == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -203,7 +203,7 @@ public class WxCouponController extends BaseController { | |||||
| return null; | return null; | ||||
| } | } | ||||
| WxCoupon c = couponService.getHtmlById(cc.getCouponId()); | |||||
| WxCoupon c = couponService.getHtmlById(cc.getCouponId(),cc.getTenantId()); | |||||
| if (c == null) { | if (c == null) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| @@ -222,7 +222,7 @@ public class WxCouponController extends BaseController { | |||||
| return null; | return null; | ||||
| } | } | ||||
| WxCoupon c = couponService.getById(cc.getCouponId()); | |||||
| WxCoupon c = couponService.getById(cc.getCouponId(),cc.getTenantId()); | |||||
| if (c == null) { | if (c == null) { | ||||
| c = new WxCoupon(); | c = new WxCoupon(); | ||||
| } | } | ||||
| @@ -140,7 +140,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| } else { | } else { | ||||
| wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId()); | |||||
| wxCouponCVo = wxCouponService.getVoById(wxCouponOrderCVo.getCouponId(),wxCouponOrderCVo.getTenantId()); | |||||
| if (wxCouponCVo == null) { | if (wxCouponCVo == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -209,7 +209,7 @@ public class WxCouponOrderController extends BaseController { | |||||
| wxCouponOrderCVo.setContentType(wxCouponCVo.getContentType()); | wxCouponOrderCVo.setContentType(wxCouponCVo.getContentType()); | ||||
| wxCouponOrderCVo.setHtml(wxCouponCVo.getHtml()); | wxCouponOrderCVo.setHtml(wxCouponCVo.getHtml()); | ||||
| } else { | } else { | ||||
| WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getHtmlById(wxCouponOrderCVo.getCouponId(),wxCouponOrderCVo.getTenantId()); | |||||
| if (wxCoupon == null) { | if (wxCoupon == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -80,7 +80,7 @@ public class WxCouponPasswordController extends BaseController { | |||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + memberId); | throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "会员用户未找到" + memberId); | ||||
| } | } | ||||
| WxCoupon coupon = couponService.getById(couponPassword.getCouponId()); | |||||
| WxCoupon coupon = couponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId()); | |||||
| if (coupon == null) { | if (coupon == null) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -93,7 +93,7 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | return new ResultData(ErrorCode.MEMBER_IS_LOCKED); | ||||
| } | } | ||||
| WxCoupon coupon = wxCouponService.getById(wxCouponChannel.getCouponId()); | |||||
| WxCoupon coupon = wxCouponService.getById(wxCouponChannel.getCouponId(),wxCouponChannel.getTenantId()); | |||||
| if (null == coupon) { | if (null == coupon) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -415,7 +415,7 @@ public class WxOrderController extends BaseController { | |||||
| } | } | ||||
| WxCoupon wxCoupon = null; | WxCoupon wxCoupon = null; | ||||
| try { | try { | ||||
| wxCoupon = wxCouponService.getById(id); | |||||
| wxCoupon = wxCouponService.getById(id,getTenantInfo().getTenantId()); | |||||
| } catch (Exception e) { | } catch (Exception e) { | ||||
| logger.error("券ID获取券信息失败, couponId: " + couponId); | logger.error("券ID获取券信息失败, couponId: " + couponId); | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| @@ -186,7 +186,7 @@ public class WxPayOrderController extends BaseController { | |||||
| if (null == order) { | if (null == order) { | ||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到Order["+orderId+"]."); | return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到Order["+orderId+"]."); | ||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponService.getById(order.getProductId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(order.getProductId(),order.getTenantId()); | |||||
| if (null == wxCoupon) { | if (null == wxCoupon) { | ||||
| return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到优惠券[orderId:"+orderId+"]."); | return new ResultData(ErrorCode.PAY_ORDER_ERROR, "未查询到优惠券[orderId:"+orderId+"]."); | ||||
| } | } | ||||
| @@ -113,7 +113,7 @@ public class WxPressOrderController extends BaseController { | |||||
| wxCouponCVo = cdOperations.get(cdKey); | wxCouponCVo = cdOperations.get(cdKey); | ||||
| } else { | } else { | ||||
| // 券信息没有入缓存,需要从数据库中读取 | // 券信息没有入缓存,需要从数据库中读取 | ||||
| wxCouponCVo = wxCouponService.getVoById(order.getProductId()); | |||||
| wxCouponCVo = wxCouponService.getVoById(order.getProductId(),order.getTenantId()); | |||||
| if (wxCouponCVo != null) { | if (wxCouponCVo != null) { | ||||
| // 券详情优化,进缓存 | // 券详情优化,进缓存 | ||||
| couponCVoRedisTemplate.opsForValue().set(cdKey, wxCouponCVo, 3600, TimeUnit.SECONDS); | couponCVoRedisTemplate.opsForValue().set(cdKey, wxCouponCVo, 3600, TimeUnit.SECONDS); | ||||
| @@ -1,31 +0,0 @@ | |||||
| package com.iformall.domain.po.msg; | |||||
| import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.List; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * 更新券库存消息 | |||||
| * @author Stormeye | |||||
| * @date 2019/4/9 13:55 | |||||
| */ | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class UpdateCouponStockMsg extends BaseMsg { | |||||
| private static final long serialVersionUID = 223232132183760321L; | |||||
| public static final String OPERATE_TYPE_INCREASE = "increase"; | |||||
| public static final String OPERATE_TYPE_DECREASE = "decrease"; | |||||
| @io.swagger.annotations.ApiModelProperty(value="券Id",name="couponId") | |||||
| private Long couponId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新数量",name="number") | |||||
| private long number; | |||||
| @io.swagger.annotations.ApiModelProperty(value="操作类型 1-增加库存 ,2-减少库存",name="operateType") | |||||
| private String operateType; | |||||
| } | |||||
| @@ -16,13 +16,17 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| List<WxCoupon> findList(WxCoupon wxCoupon); | List<WxCoupon> findList(WxCoupon wxCoupon); | ||||
| List<WxCoupon> findCouponList(WxCoupon wxCoupon); | List<WxCoupon> findCouponList(WxCoupon wxCoupon); | ||||
| WxCoupon selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| WxCouponCVo findVoDetail(@Param("id")Long id); | |||||
| WxCouponCVo findVoStatusDetail(@Param("id")Long id); | |||||
| WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| Integer reduceInventory(@Param("id")Long id,@Param("number")Integer number); | |||||
| Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number); | |||||
| Integer backInventory(@Param("id")Long id, @Param("number")Integer number,@Param("remainInventory")Integer remainInventory); | |||||
| Integer backInventory(@Param("id")Long id,@Param("tenantId")String tenantId, @Param("number")Integer number,@Param("remainInventory")Integer remainInventory); | |||||
| void offExpiriedCouponByValidDate(); | void offExpiriedCouponByValidDate(); | ||||
| @@ -52,14 +52,14 @@ public interface WxCouponService { | |||||
| * @param id | * @param id | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| WxCoupon getById(Long id); | |||||
| WxCoupon getById(Long id,String tenantId); | |||||
| WxCoupon getHtmlById(Long id); | |||||
| WxCoupon getHtmlById(Long id,String tenantId); | |||||
| WxCouponCVo getVoById(Long id); | |||||
| WxCouponCVo getVoById(Long id,String tenantId); | |||||
| WxCouponCVo getVoStatusById(Long id); | |||||
| WxCouponCVo getVoStatusById(Long id,String tenantId); | |||||
| /** | /** | ||||
| * 保存或更新实体 | * 保存或更新实体 | ||||
| * | * | ||||
| @@ -77,7 +77,7 @@ public interface WxCouponService { | |||||
| * | * | ||||
| * @param id | * @param id | ||||
| */ | */ | ||||
| void deleteById(Long id); | |||||
| void deleteById(Long id,String tenantId); | |||||
| /** | /** | ||||
| @@ -214,7 +214,7 @@ public interface WxCouponService { | |||||
| * @param number 减少数量 | * @param number 减少数量 | ||||
| * @param remainInventory 当前库存 | * @param remainInventory 当前库存 | ||||
| */ | */ | ||||
| void reduceRemainInventory(Long id, Integer number); | |||||
| void reduceRemainInventory(Long id,String tenantId, Integer number); | |||||
| /** | /** | ||||
| * 库存退回 | * 库存退回 | ||||
| @@ -223,12 +223,12 @@ public interface WxCouponService { | |||||
| * @param number 回退数量 | * @param number 回退数量 | ||||
| * @param remainInventory 当前库存 | * @param remainInventory 当前库存 | ||||
| */ | */ | ||||
| void backRemainInventory(Long id, Integer number, Integer remainInventory); | |||||
| void backRemainInventory(Long id,String tenantId, Integer number, Integer remainInventory); | |||||
| /** | /** | ||||
| * 卡延期 | * 卡延期 | ||||
| * @param wxCoupon | * @param wxCoupon | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData cardDefer(Long id,Date validEndDate); | |||||
| ResultData cardDefer(Long id,String tenantId,Date validEndDate); | |||||
| } | } | ||||
| @@ -228,7 +228,7 @@ public class WxCampaignServiceImpl implements WxCampaignService { | |||||
| public void saveOrUpdateCouponChannel(Long couponId, Map<Long, WxCouponChannel> wxCouponChannelsMap, WxCampaign record){ | public void saveOrUpdateCouponChannel(Long couponId, Map<Long, WxCouponChannel> wxCouponChannelsMap, WxCampaign record){ | ||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId,record.getTenantId()); | |||||
| if (wxCoupon == null) { | if (wxCoupon == null) { | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -89,7 +89,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) | if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) | ||||
| && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { | && record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) { | ||||
| WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(orignal.getCouponId(),orignal.getTenantId()); | |||||
| if (wxCoupon == null) | if (wxCoupon == null) | ||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY); | return new ResultData(ErrorCode.COUPON_IS_EMPTY); | ||||
| if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) | if (wxCoupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF)) | ||||
| @@ -214,7 +214,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService { | |||||
| WxCouponChannelAddVo vo = new WxCouponChannelAddVo(); | WxCouponChannelAddVo vo = new WxCouponChannelAddVo(); | ||||
| WxCoupon wxCoupon = wxCouponService.getById(couponid); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(couponid,tenantEntity.getTenantId()); | |||||
| if(wxCoupon==null){ | if(wxCoupon==null){ | ||||
| logger.debug(couponid+ErrorCode.COUPON_IS_EMPTY.getMessage()); | logger.debug(couponid+ErrorCode.COUPON_IS_EMPTY.getMessage()); | ||||
| vo.toCouponChannnelVo(null,channelId); | vo.toCouponChannnelVo(null,channelId); | ||||
| @@ -101,7 +101,7 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService { | |||||
| return new ResultData(e.getErrorCode(),e.getMessage()); | return new ResultData(e.getErrorCode(),e.getMessage()); | ||||
| } | } | ||||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId()); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(record.getCouponId(),record.getTenantId()); | |||||
| if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) ) { //时间范围 | if (wxCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode()) ) { //时间范围 | ||||
| if (new Date().after(wxCoupon.getValidEndDate())) { | if (new Date().after(wxCoupon.getValidEndDate())) { | ||||
| return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | return new ResultData(ErrorCode.COUPON_IS_EXPIRED); | ||||
| @@ -181,7 +181,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| } | } | ||||
| //更新库存 | //更新库存 | ||||
| wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(), merchantLnventory); | |||||
| wxCouponService.reduceRemainInventory(wxCouponOfDb.getId(),wxCouponOfDb.getTenantId(), merchantLnventory); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -210,7 +210,7 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { | |||||
| } | } | ||||
| //退回coupon库存 | //退回coupon库存 | ||||
| if(merchantRemain!=0) { | if(merchantRemain!=0) { | ||||
| wxCouponService.backRemainInventory(queryById.getId(), merchantRemain, wxCouponOfDb.getRemainInventory()); | |||||
| wxCouponService.backRemainInventory(queryById.getId(),wxCouponOfDb.getTenantId(), merchantRemain, wxCouponOfDb.getRemainInventory()); | |||||
| } | } | ||||
| } | } | ||||
| wxCouponSendMapper.updateById(record); | wxCouponSendMapper.updateById(record); | ||||
| @@ -178,19 +178,18 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCoupon getById(Long id) { | |||||
| // TODO 富文本优化 | |||||
| return wxCouponMapper.selectById(id); | |||||
| public WxCoupon getById(Long id,String tenantId) { | |||||
| return wxCouponMapper.selectById(id,tenantId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCoupon getHtmlById(Long id) { | |||||
| return wxCouponMapper.selectById(id); | |||||
| public WxCoupon getHtmlById(Long id,String tenantId) { | |||||
| return wxCouponMapper.selectById(id,tenantId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCouponCVo getVoById(Long id) { | |||||
| WxCouponCVo wxCouponCVo = wxCouponMapper.findVoDetail(id); | |||||
| public WxCouponCVo getVoById(Long id,String tenantId) { | |||||
| WxCouponCVo wxCouponCVo = wxCouponMapper.findVoDetail(id,tenantId); | |||||
| List<WxMerchantVo> merchantList = wxCouponCVo.getMerchantVoList(); | List<WxMerchantVo> merchantList = wxCouponCVo.getMerchantVoList(); | ||||
| if (merchantList != null) { | if (merchantList != null) { | ||||
| merchantList = merchantList.stream().filter( | merchantList = merchantList.stream().filter( | ||||
| @@ -202,8 +201,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public WxCouponCVo getVoStatusById(Long id) { | |||||
| WxCouponCVo wxCouponCVo = wxCouponMapper.findVoStatusDetail(id); | |||||
| public WxCouponCVo getVoStatusById(Long id,String tenantId) { | |||||
| WxCouponCVo wxCouponCVo = wxCouponMapper.findVoStatusDetail(id,tenantId); | |||||
| return wxCouponCVo; | return wxCouponCVo; | ||||
| } | } | ||||
| @@ -493,8 +492,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void deleteById(Long id) { | |||||
| wxCouponMapper.deleteById(id); | |||||
| public void deleteById(Long id,String tenantId) { | |||||
| wxCouponMapper.deleteById(id,tenantId); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -733,8 +732,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public void reduceRemainInventory(Long id, Integer number) { | |||||
| int num = wxCouponMapper.reduceInventory(id, number); | |||||
| public void reduceRemainInventory(Long id,String tenantId, Integer number) { | |||||
| int num = wxCouponMapper.reduceInventory(id,tenantId, number); | |||||
| if (num == 0) { | if (num == 0) { | ||||
| throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | throw new MallinkException(ErrorCode.ORDER_SAVE_ERR); | ||||
| } | } | ||||
| @@ -742,8 +741,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public void backRemainInventory(Long id, Integer number, Integer remainInventory) { | |||||
| int num = wxCouponMapper.backInventory(id, number, remainInventory); | |||||
| public void backRemainInventory(Long id,String tenantId, Integer number, Integer remainInventory) { | |||||
| int num = wxCouponMapper.backInventory(id,tenantId, number, remainInventory); | |||||
| if (num == 0) { | if (num == 0) { | ||||
| throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); | throw new MallinkException(ErrorCode.REMAIN_BACK_FAIL); | ||||
| } | } | ||||
| @@ -751,8 +750,8 @@ public class WxCouponServiceImpl implements WxCouponService { | |||||
| @Override | @Override | ||||
| @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | @Transactional(isolation= Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class}) | ||||
| public ResultData cardDefer(Long id,Date validEndDate) { | |||||
| WxCoupon coupon = wxCouponMapper.selectById(id); | |||||
| public ResultData cardDefer(Long id,String tenantId,Date validEndDate) { | |||||
| WxCoupon coupon = wxCouponMapper.selectById(id,tenantId); | |||||
| if (null == coupon) { | if (null == coupon) { | ||||
| return new ResultData(Result.ERROR,id+"未查询到券信息."); | return new ResultData(Result.ERROR,id+"未查询到券信息."); | ||||
| } | } | ||||
| @@ -294,7 +294,7 @@ public class WxGameServiceImpl implements WxGameService { | |||||
| public void saveOrUpdateCouponChannel(Long couponId, Map<Long, WxCouponChannel> wxCouponChannelsMap, WxGame record){ | public void saveOrUpdateCouponChannel(Long couponId, Map<Long, WxCouponChannel> wxCouponChannelsMap, WxGame record){ | ||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId); | |||||
| WxCoupon wxCoupon = wxCouponService.getById(couponId,record.getTenantId()); | |||||
| if (wxCoupon == null) { | if (wxCoupon == null) { | ||||
| throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | throw new MallinkException(ErrorCode.COUPON_IS_EMPTY); | ||||
| } | } | ||||
| @@ -56,7 +56,6 @@ import com.iformall.domain.po.WxPayAccount; | |||||
| import com.iformall.domain.po.WxPayOrder; | import com.iformall.domain.po.WxPayOrder; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.msg.FmInsideOrderSuccessMsg; | import com.iformall.domain.po.msg.FmInsideOrderSuccessMsg; | ||||
| import com.iformall.domain.po.msg.UpdateCouponStockMsg; | |||||
| import com.iformall.domain.vo.WxCouponSendVo; | import com.iformall.domain.vo.WxCouponSendVo; | ||||
| import com.iformall.domain.vo.WxMerchantVo; | import com.iformall.domain.vo.WxMerchantVo; | ||||
| import com.iformall.domain.vo.WxOrderCouponPressVo; | import com.iformall.domain.vo.WxOrderCouponPressVo; | ||||
| @@ -660,7 +659,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| try { | try { | ||||
| //减库存,从redis中取,然后发mq消息同步到数据库 | //减库存,从redis中取,然后发mq消息同步到数据库 | ||||
| wxCouponService.reduceRemainInventory(coupon.getId(), 1); | |||||
| wxCouponService.reduceRemainInventory(coupon.getId(),coupon.getTenantId(), 1); | |||||
| long stock = redisLock.decrease(EnumCacheKey.COUPON_STOCK.getMessage()+coupon.getId(), 1); | long stock = redisLock.decrease(EnumCacheKey.COUPON_STOCK.getMessage()+coupon.getId(), 1); | ||||
| if (stock < 0 ) { | if (stock < 0 ) { | ||||
| @@ -797,7 +796,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| } | } | ||||
| try { | try { | ||||
| int num = wxCouponMapper.backInventory(coupon.getId(), 1, coupon.getRemainInventory()); | |||||
| int num = wxCouponMapper.backInventory(coupon.getId(),coupon.getTenantId(), 1, coupon.getRemainInventory()); | |||||
| if (num <= 0) { | if (num <= 0) { | ||||
| logger.error("此券加库存失败, couponId: " + couponIdStr); | logger.error("此券加库存失败, couponId: " + couponIdStr); | ||||
| throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"券couponId:["+couponIdStr+"]库存回滚失败,更新记录条数小于等于0."); | throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"券couponId:["+couponIdStr+"]库存回滚失败,更新记录条数小于等于0."); | ||||
| @@ -68,7 +68,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService { | |||||
| logger.error("用户未找到: " + msg.getCUserId()); | logger.error("用户未找到: " + msg.getCUserId()); | ||||
| throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getCUserId()); | throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "用户未找到" + msg.getCUserId()); | ||||
| } | } | ||||
| WxCoupon coupon = couponService.getById(msg.getCouponId()); | |||||
| WxCoupon coupon = couponService.getById(msg.getCouponId(),couponChannel.getTenantId()); | |||||
| if(coupon == null) { | if(coupon == null) { | ||||
| logger.error("券未找到" + msg.getCouponId()); | logger.error("券未找到" + msg.getCouponId()); | ||||
| throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL.getCode(), "券未找到" + msg.getCouponId()); | throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL.getCode(), "券未找到" + msg.getCouponId()); | ||||
| @@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import com.iformall.domain.po.msg.BaseMsg; | import com.iformall.domain.po.msg.BaseMsg; | ||||
| import com.iformall.domain.po.msg.UpdateCouponStockMsg; | |||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.service.WxCouponService; | import com.iformall.service.WxCouponService; | ||||
| import com.iformall.service.msg.MsgSendService; | import com.iformall.service.msg.MsgSendService; | ||||
| @@ -25,11 +24,11 @@ public class UpdateCouponStockMsgServiceImpl implements MsgSendService { | |||||
| @Override | @Override | ||||
| public void send(BaseMsg baseMsg) throws Exception { | public void send(BaseMsg baseMsg) throws Exception { | ||||
| UpdateCouponStockMsg msg = (UpdateCouponStockMsg)baseMsg; | |||||
| if (null != msg ) { | |||||
| if (msg.getOperateType().equals(UpdateCouponStockMsg.OPERATE_TYPE_DECREASE)) { | |||||
| wxCouponService.reduceRemainInventory(msg.getCouponId(), (int)msg.getNumber()); | |||||
| } | |||||
| } | |||||
| // UpdateCouponStockMsg msg = (UpdateCouponStockMsg)baseMsg; | |||||
| // if (null != msg ) { | |||||
| // if (msg.getOperateType().equals(UpdateCouponStockMsg.OPERATE_TYPE_DECREASE)) { | |||||
| // wxCouponService.reduceRemainInventory(msg.getCouponId(), (int)msg.getNumber()); | |||||
| // } | |||||
| // } | |||||
| } | } | ||||
| } | } | ||||
| @@ -292,6 +292,15 @@ | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | <if test=" null != sortColumns">order by ${sortColumns}</if> | ||||
| </sql> | </sql> | ||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from wx_coupon c where id = #{id} and tenant_id = #{tenantId} | |||||
| </select> | |||||
| <delete id="deleteById" parameterType="java.util.HashMap"> | |||||
| update wx_coupon set is_del = 1 where id = #{id} and tenant_id = #{tenantId} | |||||
| </delete> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | <select id="findList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap"> | ||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| @@ -654,25 +663,25 @@ | |||||
| <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | <result column="source_type" jdbcType="INTEGER" property="sourceType"/> | ||||
| </resultMap> | </resultMap> | ||||
| <select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap"> | |||||
| <select id="findVoDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMap"> | |||||
| select | select | ||||
| <include refid="allColumns"/> | <include refid="allColumns"/> | ||||
| from wx_coupon c | from wx_coupon c | ||||
| where id = #{id} | |||||
| where id = #{id} and tenant_id =#{tenantId} | |||||
| </select> | </select> | ||||
| <select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMapL"> | |||||
| <select id="findVoStatusDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMapL"> | |||||
| select id, remain_inventory, status | select id, remain_inventory, status | ||||
| from wx_coupon | from wx_coupon | ||||
| where id = #{id} | |||||
| where id = #{id} and tenant_id =#{tenantId} | |||||
| </select> | </select> | ||||
| <update id="reduceInventory"> | <update id="reduceInventory"> | ||||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory - #{number} >= 0 | |||||
| update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and tenant_id =#{tenantId} and remain_inventory - #{number} >= 0 | |||||
| </update> | </update> | ||||
| <update id="backInventory"> | <update id="backInventory"> | ||||
| update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and remain_inventory + #{number} <= inventory | |||||
| update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and tenant_id =#{tenantId} and remain_inventory + #{number} <= inventory | |||||
| </update> | </update> | ||||
| <update id="offExpiriedCouponByValidDate"> | <update id="offExpiriedCouponByValidDate"> | ||||