Browse Source

fix card

release_toaliyun_real
lin 3 years ago
parent
commit
9a22a08ae3
19 changed files with 531 additions and 62 deletions
  1. +0
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java
  2. +34
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java
  3. +105
    -0
      mallinkAdmin/src/main/resources/db/migration/V2023021400001__card.sql
  4. +186
    -2
      mallinkBApi/src/main/java/com/iformall/controller/WxCardPayController.java
  5. +6
    -8
      mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java
  6. +3
    -0
      mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java
  7. +36
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCardInfoType.java
  8. +3
    -2
      mallinkService/src/main/java/com/iformall/enums/EnumCouponPasswordStatus.java
  9. +1
    -1
      mallinkService/src/main/java/com/iformall/enums/EnumCouponSendType.java
  10. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java
  11. +4
    -0
      mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java
  12. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxCouponService.java
  13. +58
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java
  14. +32
    -30
      mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java
  15. +27
    -9
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  16. +1
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  17. +4
    -0
      mallinkService/src/main/java/com/iformall/utils/Constant.java
  18. +8
    -2
      mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml
  19. +19
    -6
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml

+ 0
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCardPayController.java View File

@@ -62,7 +62,6 @@ public class WxCardPayController extends BaseController {
@SystemControllerLog(description = "储值卡支付-售卡记录列表")
public ResultData cardOrderList(@ModelAttribute WxCardVo wxCardVo, Integer pageNum, Integer pageSize) {
String ipStr = getIpAddr();
logger.info("cardPay/cardOrderList: " + ipStr);
if (wxCardVo == null) {wxCardVo = new WxCardVo();}
else {
if(StringUtils.isBlank(wxCardVo.getOuPhone())) {


+ 34
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponController.java View File

@@ -194,7 +194,7 @@ public class WxCouponController extends BaseController {
return resultData;
}
@TenantIgnore
@ApiOperation("根据id更新接口")
@PostMapping("update")
@@ -402,6 +402,39 @@ public class WxCouponController extends BaseController {
CouponCacheUtils.removeCouponCache(redisTemplate, wxCoupon.getId());
return new ResultData();
}
@TenantIgnore
@ApiOperation("后置设置金额")
@PostMapping("setPrice")
public ResultData setPrice(@RequestBody WxCoupon wxCoupon) {
TenantEntity tenantEntity = getTenantInfo();
wxCoupon.updateTenantInfo(tenantEntity);
WxCoupon coupon = wxCouponService.findById(wxCoupon);
if (null == coupon ) {
return new ResultData(ResultData.ERROR, "券未查询到。"+wxCoupon.getId());
}
if (EnumYesOrNo.YES.getCode() != coupon.getIsAfterSetPrice()) {
return new ResultData(ResultData.ERROR, "当前不是后置类型,不能设置。"+wxCoupon.getId());
}
if (null != coupon.getPrice() && coupon.getPrice() > 0 ) {
return new ResultData(ResultData.ERROR, "当前已设置面额,不能设置。"+wxCoupon.getId());
}
if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(coupon.getSubsidyType())) {
// 微信 立减
if (coupon.getSubsidyNum() > coupon.getSalePrice()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价");
}
} else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(coupon.getSubsidyType())) {
// 线下补贴
int subsidy_num = wxCoupon.getPrice() - coupon.getSalePrice();
if (coupon.getSubsidyNum() > subsidy_num) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值");
}
}
ResultData resultData = wxCouponService.setPrice(wxCoupon);
return resultData;
}

@ApiOperation("根据id删除接口")
@GetMapping("/del")


+ 105
- 0
mallinkAdmin/src/main/resources/db/migration/V2023021400001__card.sql View File

@@ -0,0 +1,105 @@
alter table wx_coupon_0 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_1 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_2 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_3 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_4 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_5 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_6 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_7 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_8 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_9 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_10 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_11 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_12 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_13 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_14 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_15 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_16 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_17 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_18 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_19 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_20 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_21 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_22 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_23 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_24 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_25 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_26 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_27 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_28 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_29 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_30 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_31 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_32 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_33 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_34 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_35 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_36 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_37 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_38 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_39 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_40 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_41 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_42 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_43 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_44 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_45 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_46 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_47 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_48 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_49 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_50 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_51 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_52 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_53 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_54 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_55 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_56 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_57 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_58 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_59 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_60 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_61 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_62 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_63 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_64 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_65 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_66 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_67 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_68 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_69 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_70 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_71 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_72 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_73 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_74 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_75 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_76 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_77 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_78 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_79 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_80 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_81 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_82 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_83 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_84 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_85 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_86 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_87 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_88 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_89 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_90 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_91 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_92 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_93 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_94 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_95 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_96 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_97 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_98 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';
alter table wx_coupon_99 add column is_after_set_price int(1) not null default 0 comment '是否是后置卡面额';

alter table wx_card_info add column coupon_password_id bigint(20) comment '卡密编码';
alter table wx_card_info add column type int(1) not null default 0 comment '卡类型';



+ 186
- 2
mallinkBApi/src/main/java/com/iformall/controller/WxCardPayController.java View File

@@ -1,31 +1,46 @@
package com.iformall.controller;

import com.github.pagehelper.PageInfo;
import com.iformall.common.ErrorCode;
import com.iformall.common.Result;
import com.iformall.common.ResultData;
import com.iformall.domain.po.*;
import com.iformall.domain.vo.WxCardSpendVo;
import com.iformall.enums.EnumCouponStatus;
import com.iformall.enums.EnumCreditLockedStatus;
import com.iformall.enums.EnumMerchantStatus;
import com.iformall.enums.EnumMerchantSubsidySource;
import com.iformall.enums.EnumPayWay;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCUserBasicInfoService;
import com.iformall.service.WxCardInfoService;
import com.iformall.service.WxCardSpendService;
import com.iformall.service.WxCouponOrderService;
import com.iformall.service.WxCouponPasswordService;
import com.iformall.service.WxCouponService;
import com.iformall.service.WxMerchantService;
import com.iformall.service.WxOrderService;
import com.iformall.utils.Constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;

/**
* @author Stormeye Wu wuguoqiang@iformall.com
*/
@RestController
@Api(description = "C端扫B端商户码储值卡支付")
@Api(description = "储值卡支付")
@RequestMapping("/api/cardPay")
public class WxCardPayController extends BaseController {

@@ -39,6 +54,21 @@ public class WxCardPayController extends BaseController {

@Autowired
WxCardSpendService wxCardSpendService;
@Autowired
WxCUserBasicInfoService wxCUserBasicInfoService;
@Autowired
WxCardInfoService wxCardInfoService;
@Autowired
WxCouponOrderService wxCouponOrderService;
@Autowired
WxCouponPasswordService wxCouponPassword;
@Autowired
WxCouponService wxCouponService;

@ApiOperation("C端扫B端储值卡交易流水(消费记录 + 补贴)列表接口")
@GetMapping("list")
@@ -76,4 +106,158 @@ public class WxCardPayController extends BaseController {
final List<Map<String, Object>> mapList = wxCardSpendService.sumCardSpendForMerchant(wxCardSpend);
return new ResultData(mapList);
}
@ApiOperation(value = "微信B端扫C端电子储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"cUserId\":\"String\",\"totalFee\":\"String(元)\"}")
@PostMapping("order_create_ecard")
public ResultData saveECardCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) {
String cardIdStr = paramMap.get("cardId");
String cUserIdStr = paramMap.get("cUserId");
if (StringUtils.isBlank(cUserIdStr) || cUserIdStr.equalsIgnoreCase(Constant.UNDEFINED)) {
logger.error("cUserId不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cUserId不能为空");
}
if (StringUtils.isBlank(cardIdStr) || cardIdStr.equalsIgnoreCase(Constant.UNDEFINED)) {
logger.error("cardId不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空");
}
Long cUserId = null;
try {
cUserId = Long.valueOf(cUserIdStr);
} catch (Exception e) {
logger.error("cardId convert failed:" + cardIdStr);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败");
}
String totalFeeStr = paramMap.get("totalFee");
WxMerchantBUser merchantBUser = getLoginBUser();
Long cardId = null;
try {
cardId = Long.valueOf(cardIdStr);
} catch (Exception e) {
logger.error("cardId convert failed:" + cardIdStr);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败");
}
WxCardInfo cardInfo = wxCardInfoService.getById(cardId);
if(cardInfo == null) {
logger.error("卡不存在: " + cardIdStr);
return new ResultData(ErrorCode.CARD_IS_NOT_FOUND);
}
return saveCardPayOrder(cUserId,cardInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT);
}

private ResultData saveCardPayOrder(Long cUserId,WxCardInfo cardInfo,WxMerchantBUser merchantBUser,String totalFeeStr,EnumPayWay payWay) {
String ipStr = getIpAddr();
if (Constant.defaultCUserId != cUserId) {
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(cUserId,merchantBUser.getFinalTenantId());
if (null != wxCUserBasicInfo && EnumCreditLockedStatus.CLOSE.getCode().equals(wxCUserBasicInfo.getStatus())) {
logger.error(ErrorCode.MEMBER_IS_LOCKED.getMessage());
return new ResultData(ErrorCode.MEMBER_IS_LOCKED);
}
}
if (StringUtils.isBlank(totalFeeStr) || totalFeeStr.equalsIgnoreCase(Constant.UNDEFINED)) {
logger.error("totalFee不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "totalFee不能为空");
}

BigDecimal totalFee = new BigDecimal(totalFeeStr);
totalFee.setScale(2, BigDecimal.ROUND_HALF_UP); // 第一个变量是小数位数,第二个变量是取舍方法(四舍五入)
Integer payment = totalFee.multiply(new BigDecimal(100)).intValue();

Long merchantId = null;

if(payment > cardInfo.getRemainingAmount()) {
logger.error("卡余额不足: " + cardInfo.getId());
return new ResultData(ErrorCode.CARD_REMAIN_AMOUNT_IS_NOT_ENOUGH);
}

//查看所有者与扫码者是否为一致
WxCouponOrder couponOrder = wxCouponOrderService.getById(cardInfo.getId(),cardInfo.getTenantId());
if (!couponOrder.getOwnerId().equals(cUserId)) {
logger.error("卡已被领取: " + cardInfo.getId());
return new ResultData(ErrorCode.CARD_TRANSFERED);
}

WxCouponMerchant couponMerchant = wxCardSpendService.checkMerchantInCoupon(cardInfo, merchantId);
if(couponMerchant == null) {
logger.error("商户不支持此卡 " + cardInfo.getId());
return new ResultData(ErrorCode.COUPON_ORDER_MERANT_IS_NULL.getCode(), "商户不支持此卡");
}

WxMerchant merchant = wxMerchantService.getById(merchantId);
if (merchant.getStatus() == EnumMerchantStatus.NOT_VALID.getCode()) {
logger.error("商户已禁用, merchantId: " + merchant.getId());
return new ResultData(ErrorCode.MERCHANT_INFO_NOT_VALID);
}

WxOrder order = null;
try {
order = wxOrderService.saveCardPayOrder(merchant, cUserId, totalFeeStr, payment,payWay);
} catch (MallinkException e) {
logger.error("saveCardPayOrder 1" + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
logger.error("saveCardPayOrder 2" + e.getMessage());
return new ResultData(ErrorCode.ORDER_IS_FAIL, e.getMessage());
}

WxCardSpend record = new WxCardSpend();
record.updateTenantInfo(merchant);
record.setCardId(cardInfo.getId());
record.setOwnerId(cUserId);
record.setMerchantId(merchantId);
record.setOrderId(order.getId());
record.setIp(ipStr);
record.setDeductionAmount(payment);
record.setRemark("操作于["+payWay.getMessage()+"("+payWay.getCode()+")]");

try {
return wxCardSpendService.createCardSpend(record, order, couponMerchant,payWay);
} catch (MallinkException e) {
logger.error("card spend error, req 2: " + record.toString() + ", e:" + e.getMessage());
return new ResultData(e.getErrorCode(), e.getMessage());
} catch (Exception e) {
logger.error("card spend error, req 3: " + record.toString() + ", e:" + e.getMessage());
return new ResultData(ErrorCode.PAY_ORDER_ERROR, e.getMessage());
}
}
@ApiOperation(value = "微信B端扫C端实体储值卡支付订单", notes = "params:{\"cardId\":\"String\",\"totalFee\":\"String(元)\"}")
@PostMapping("order_create_card")
public ResultData saveCardPayOrder(@RequestBody Map<String, String> paramMap, HttpServletRequest request) {
String cardIdStr = paramMap.get("cardId");
String totalFeeStr = paramMap.get("totalFee");
if (StringUtils.isBlank(cardIdStr) || cardIdStr.equalsIgnoreCase(Constant.UNDEFINED)) {
logger.error("cardId不能为空");
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardId不能为空");
}
Long cardId = null;
try {
cardId = Long.valueOf(cardIdStr);
} catch (Exception e) {
logger.error("cardId convert failed:" + cardIdStr);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "cardIdStr转换失败");
}
WxMerchantBUser merchantBUser = getLoginBUser();
WxCouponPassword couponPassword = wxCouponPassword.getById(cardId);
if (null == couponPassword) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "卡未查询到");
}
WxCoupon coupon = wxCouponService.getById(couponPassword.getCouponId(),couponPassword.getTenantId());
if (coupon == null) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY);
}
if (coupon.getStatus().equals(EnumCouponStatus.COUPON_STATUS_TAKE_OFFF.getCode())) {
logger.error("此券已作废:" + coupon.getId());
return new ResultData(ErrorCode.COUPON_IS_TAKE_OFF);
}
WxCardInfo carInfo = wxCardInfoService.cardCreateByOffline(couponPassword, coupon);
return saveCardPayOrder(Constant.defaultCUserId,carInfo,merchantBUser,totalFeeStr,EnumPayWay.PAY_WAY_WECHAT);
}
}

+ 6
- 8
mallinkService/src/main/java/com/iformall/domain/po/WxCardInfo.java View File

@@ -22,7 +22,12 @@ public class WxCardInfo extends TenantEntity {
@Excel(name = "卡号", width = 20, orderNum = "1")
@io.swagger.annotations.ApiModelProperty(value="主键ID-与coupon_order_id一致",name="id")
protected Long id;

@io.swagger.annotations.ApiModelProperty(value="卡密编码",name="couponPasswordId")
protected Long couponPasswordId;
@TableField(exist = false)
protected Long couponPasswordIdLike;
@io.swagger.annotations.ApiModelProperty(value="卡类型EnumCardInfoType",name="type")
protected Integer type;
@io.swagger.annotations.ApiModelProperty(value = "券ID", name = "couponId")
private Long couponId;
@io.swagger.annotations.ApiModelProperty(value="微信订单号-购买类储值卡时的订单号",name="transactionId")
@@ -35,12 +40,10 @@ public class WxCardInfo extends TenantEntity {
public String getRemainingAmountStr() {
return new BigDecimal(remainingAmount == null ? 0 : remainingAmount).divide(new BigDecimal(100)).toPlainString();
}

@Excel(name = "余额(元)", width = 20, orderNum = "7")
@TableField(exist = false)
private String remainingAmountStr;


@io.swagger.annotations.ApiModelProperty(value="剩余面额",name="remainingAmount")
private Integer remainingAmount;
@io.swagger.annotations.ApiModelProperty(value="分账总手续费",name="serviceFeeAmount")
@@ -51,24 +54,19 @@ public class WxCardInfo extends TenantEntity {
private Integer remainingShareFeeAmount;
@io.swagger.annotations.ApiModelProperty(value="分账通道费差(购买时刻的通道费差,分账完结时使用)",name="rateAmount")
private Integer rateAmount;

@Excel(name = "购买时间 ", width = 20, orderNum = "10", format = "yyyy-MM-dd HH:mm:ss")
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
private Date createDate;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
private Date updateDate;

@io.swagger.annotations.ApiModelProperty(value = "是否支持转送(0:不支持,1支持)", name = "supportTransfer")
private Integer supportTransfer;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="查询-开始时间",name="startdate")
protected Date startdate;

@TableField(exist = false)
@io.swagger.annotations.ApiModelProperty(value="查询-结束时间",name="enddate")
protected Date enddate;
@TableField(exist = false)
private List<Long> couponIdList;
}

+ 3
- 0
mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java View File

@@ -395,6 +395,9 @@ public class WxCoupon extends TenantEntity {
@io.swagger.annotations.ApiModelProperty(value = "是否删除1是0否", name = "isDel")
private Integer isDel;
@io.swagger.annotations.ApiModelProperty(value = "是否后置面额1是0否,EnumYesOrNo", name = "isAfterSetPrice")
private Integer isAfterSetPrice;
@TableField(exist = false)
private Long[] merchantIds;


+ 36
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCardInfoType.java View File

@@ -0,0 +1,36 @@
package com.iformall.enums;

/**
* Created by Stormeye on 2018/08/09.
*/
public enum EnumCardInfoType {

ECARD(0, "电子卡"),
CARD(1, "实体卡")
;

public static EnumCardInfoType getEnum(Integer code) {
for (EnumCardInfoType value : values()) {
if (value.getCode().equals(code)) {
return value;
}
}
return null;
}
private Integer code;
private String message;

EnumCardInfoType(Integer code, String message) {
this.code = code;
this.message = message;
}

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

+ 3
- 2
mallinkService/src/main/java/com/iformall/enums/EnumCouponPasswordStatus.java View File

@@ -9,8 +9,9 @@ public enum EnumCouponPasswordStatus {
INIT(0, "初始"),
MSG_SENDING(1, "消息发送中"),
MSG_SENDED(2, "消息已发送"),
USED(3, "已使用"),
CANCEL(4, "已作废");
USED(3, "已兑换"),
CANCEL(4, "已作废"),
PAID(5, "已支付过"),;

public static EnumCouponPasswordStatus getEnum(Integer code) {
for (EnumCouponPasswordStatus value : values()) {


+ 1
- 1
mallinkService/src/main/java/com/iformall/enums/EnumCouponSendType.java View File

@@ -8,7 +8,7 @@ public enum EnumCouponSendType {
// 1:主动领取 2:定向投放
ACTIVE(1,"主动领取"),
PASSIVE(2, "定向投放"),
GIFT(3, "礼包券")
GIFT(3, "主券主动领取,子券自动发,如礼包券")
;

public static EnumCouponSendType getEnum(Integer code) {


+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponMapper.java View File

@@ -42,6 +42,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> {
void deleteById(@Param("id")Long id,@Param("tenantId")String tenantId);
Integer setPrice(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("price")Integer price);

Integer reduceInventory(@Param("id")Long id,@Param("tenantId")String tenantId,@Param("number")Integer number);



+ 4
- 0
mallinkService/src/main/java/com/iformall/service/WxCardInfoService.java View File

@@ -2,6 +2,8 @@ package com.iformall.service;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.WxCardInfo;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponPassword;
import com.iformall.domain.vo.WxCardVo;

import javax.servlet.http.HttpServletRequest;
@@ -33,6 +35,8 @@ public interface WxCardInfoService {
* @param record
*/
void saveOrUpdate(WxCardInfo record);
WxCardInfo cardCreateByOffline(WxCouponPassword couponPassword,WxCoupon coupon);

/**
* 根据Id删除实体


+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxCouponService.java View File

@@ -93,6 +93,8 @@ public interface WxCouponService {
* @param record
*/
ResultData saveOrUpdate(WxCoupon record);
ResultData setPrice(WxCoupon record);

ResultData updateTtProduct(WxCoupon wxCoupon);
/**


+ 58
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxCardInfoServiceImpl.java View File

@@ -4,17 +4,29 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.common.IdWorker;
import com.iformall.domain.po.WxCardInfo;
import com.iformall.domain.po.WxCoupon;
import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxCouponPassword;
import com.iformall.domain.vo.WxCardVo;
import com.iformall.enums.EnumCardInfoType;
import com.iformall.enums.EnumCouponPasswordStatus;
import com.iformall.enums.EnumCouponPasswordSupport;
import com.iformall.mapper.WxCardInfoMapper;
import com.iformall.mapper.WxCouponChannelMapper;
import com.iformall.mapper.WxCouponPasswordMapper;
import com.iformall.service.ExcelService;
import com.iformall.service.WxCardInfoService;
import com.iformall.utils.RedisLock;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.Date;
import java.util.List;

@Service
@@ -28,6 +40,12 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {
@Autowired
WxCouponChannelMapper wxCouponChannelMapper;
@Autowired
RedisLock redisLock;
@Autowired
WxCouponPasswordMapper couponPasswordMapper;

@Override
public PageInfo<WxCardVo> listAsPage(WxCardVo record, Integer pageIndex, Integer pageSize) {
@@ -80,4 +98,44 @@ public class WxCardInfoServiceImpl implements WxCardInfoService {
}
}

@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class})
@Override
public WxCardInfo cardCreateByOffline(WxCouponPassword couponPassword,WxCoupon coupon) {
//如果没有卡,则直接创建一个
WxCardInfo cardInfo = this.getById(couponPassword.getId());
if (null == cardInfo) {
long time = System.currentTimeMillis() + RedisLock.TIMEOUT;
String timeStr = String.valueOf(time);
boolean stocksetlock = redisLock.lock("cardInfoLockSet_"+couponPassword.getId(), timeStr);
if (stocksetlock) {
cardInfo = new WxCardInfo();
cardInfo.setId(couponPassword.getId());
cardInfo.updateTenantInfo(couponPassword);
cardInfo.setCouponId(couponPassword.getCouponId());
cardInfo.setAmount(coupon.getPrice());
cardInfo.setSaleAmount(coupon.getSalePrice());
cardInfo.setCouponPasswordId(couponPassword.getId());
cardInfo.setRemainingAmount(coupon.getPrice());
cardInfo.setShareFeeAmount(0);
cardInfo.setRemainingShareFeeAmount(0);
cardInfo.setRateAmount(0);
cardInfo.setType(EnumCardInfoType.CARD.getCode());
if (coupon.getPasswordSupport().equals(EnumCouponPasswordSupport.SUPPORTED.getCode())) {
WxCouponPassword updateCPwd = new WxCouponPassword();
updateCPwd.setId(couponPassword.getId());
updateCPwd.setCardId(cardInfo.getId());
updateCPwd.setStatus(EnumCouponPasswordStatus.USED.getCode());
couponPasswordMapper.updateById(updateCPwd);
}
cardInfo.setServiceFeeAmount(0);
cardInfo.setCreateDate(new Date());
cardInfo.setUpdateDate(new Date());
cardInfo.setSupportTransfer(coupon.getSupportTransfer());
wxCardInfoMapper.insert(cardInfo);
}
redisLock.unlock("cardInfoLockSet_"+couponPassword.getId(), timeStr);
}
return cardInfo;
}

}

+ 32
- 30
mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java View File

@@ -16,6 +16,7 @@ import com.iformall.enums.*;
import com.iformall.exception.MallinkException;
import com.iformall.mapper.*;
import com.iformall.service.*;
import com.iformall.utils.Constant;
import com.iformall.utils.PayUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -304,37 +305,38 @@ public class WxCardSpendServiceImpl implements WxCardSpendService {
}
// }

// 成长值
try {
orderUpdate.setPayment(real_payment);
wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness());
} catch (Exception e) {
logger.error("成长值:" + e.getMessage());
if (null != orderUpdate.getCUserId() && Constant.defaultCUserId != orderUpdate.getCUserId()) {
// 成长值
try {
orderUpdate.setPayment(real_payment);
wxScoreRulesService.addScore2(coupon,EnumScoreType.CONSUMPTION, orderUpdate, coupon.getBusiness());
} catch (Exception e) {
logger.error("成长值:" + e.getMessage());
}
// 积分
try {
//-------此处为【现金支付】记录增加积分操作-------
WxCreditHistory creditHistory = new WxCreditHistory();
creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
creditHistory.setOperatorId(record.getOwnerId());
creditHistory.setCUserId(record.getOwnerId());
creditHistory.setCreateDate(new Date());
// creditHistory.updateTenantInfo(record);
creditHistory.setTenantId(record.getFinalTenantId());
creditHistory.setFinalTenantId(record.getFinalTenantId());
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setBusinessId(coupon.getBusiness());
creditHistory.setSpend(real_payment);
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(record.getMerchantId());
WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId());
creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");
wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
}
}

// 积分
try {
//-------此处为【现金支付】记录增加积分操作-------
WxCreditHistory creditHistory = new WxCreditHistory();
creditHistory.setOperatorType(EnumUserType.CUSERBASIC.getCode());
creditHistory.setOperatorId(record.getOwnerId());
creditHistory.setCUserId(record.getOwnerId());
creditHistory.setCreateDate(new Date());
// creditHistory.updateTenantInfo(record);
creditHistory.setTenantId(record.getFinalTenantId());
creditHistory.setFinalTenantId(record.getFinalTenantId());
creditHistory.setCreditType(EnumScoreType.CONSUMPTION.getCode());
creditHistory.setBusinessId(coupon.getBusiness());
creditHistory.setSpend(real_payment);
//如果券与商户一对一 则直接将消费商户更新为此商户 若一对多 则消费商户显示多商户
creditHistory.setMerchantId(record.getMerchantId());
WxMerchant wxMerchant = wxMerchantMapper.selectById(record.getMerchantId());
creditHistory.setChangePurpose("卡消费:消费商户["+wxMerchant.getName()+"] 金额["+creditHistory.getSpendStr()+"元]");
wxCreditHistoryService.saveOrUpdate(creditHistory,record.getTenantId());
} catch (Exception e) {
logger.error("积分值:" + e.getMessage());
}

return new ResultData(record);
}



+ 27
- 9
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java View File

@@ -496,16 +496,20 @@ public class WxCouponServiceImpl implements WxCouponService {
record.setSubsidyNum(0);
}
if (EnumCouponSubsidyType.WECHAT_COUPON.getCode().equals(record.getSubsidyType())) {
// 微信 立减
if (record.getSubsidyNum() > record.getSalePrice()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价");
}
if (EnumYesOrNo.YES.getCode() != record.getIsAfterSetPrice()) {
// 微信 立减
if (record.getSubsidyNum() > record.getSalePrice()) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于售价");
}
}
} else if (EnumCouponSubsidyType.OFFLINE_SUBSIDY.getCode().equals(record.getSubsidyType())) {
// 线下补贴
int subsidy_num = record.getPrice() - record.getSalePrice();
if (record.getSubsidyNum() > subsidy_num) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值");
}
if (EnumYesOrNo.YES.getCode() != record.getIsAfterSetPrice()) {
// 线下补贴
int subsidy_num = record.getPrice() - record.getSalePrice();
if (record.getSubsidyNum() > subsidy_num) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "补贴额大于面额与售价的差值");
}
}
} else if (EnumCouponSubsidyType.WECHAT_MCHPAY.getCode().equals(record.getSubsidyType())) {
// TODO 微信转账到银行卡

@@ -1011,6 +1015,20 @@ public class WxCouponServiceImpl implements WxCouponService {
return false;
}

@Override
@Transactional(isolation=Isolation.SERIALIZABLE, propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public ResultData setPrice(WxCoupon record) {
Integer count = wxCouponMapper.setPrice(record.getId(), record.getTenantId(), record.getPrice());
if (null == count || count <= 0 ) {
return new ResultData(Result.ERROR,"设置失败");
}
//TODO 设置卡密金额
return new ResultData();
}
@Override
public ResultData updateTtProduct(WxCoupon record) {
if(EnumCouponType.getDouYinType().contains(record.getType())){


+ 1
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java View File

@@ -1455,6 +1455,7 @@ public class WxOrderServiceImpl implements WxOrderService {
cardInfo.setCouponId(order.getProductId());
cardInfo.setAmount(coupon.getPrice());
cardInfo.setSaleAmount(coupon.getSalePrice());
cardInfo.setCouponPasswordId(couponPasswordId);
cardInfo.setRemainingAmount(coupon.getPrice());
if (!coupon.checkIsFree()) {
//判断该transctionId是否已经存在,如果存在,则不添加


+ 4
- 0
mallinkService/src/main/java/com/iformall/utils/Constant.java View File

@@ -116,7 +116,11 @@ public class Constant {
public static final Integer wiwideOldPlat = 0;//老平台
public static final Integer wiwideNewPlat = 1;//新平台
//收款账号参数配置项key
public static final String paymentReceicerParamApiKey = "apiKey";
public static final String paymentReceiverParamIsv = "isvModel";
//默认c端虚拟会员编号
public static final Long defaultCUserId = 111111111111111111L;

}

+ 8
- 2
mallinkService/src/main/resources/mapper/WxCardInfoMapper.xml View File

@@ -17,11 +17,11 @@
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
<result column="support_transfer" jdbcType="INTEGER" property="supportTransfer"/>
<result column="coupon_password_id" jdbcType="BIGINT" property="couponPasswordId"/>
</resultMap>
<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`transaction_id`,
`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_password_id`,`transaction_id`,
`amount`,`sale_amount`,`remaining_amount`,`service_fee_amount`,
`share_fee_amount`,`remaining_share_fee_amount`, `rate_amount`,
`create_date`,`update_date`,`support_transfer`
@@ -71,6 +71,12 @@
<if test=" null != updateDate ">
and `update_date` = #{updateDate}
</if>
<if test=" null != couponPasswordId">
and `coupon_password_id` = #{couponPasswordId}
</if>
<if test=" null != couponPasswordIdLike">
and `coupon_password_id` like concat('%',#{couponPasswordIdLike},'%')
</if>
<if test=" null != startdate and null!=enddate">
and `create_date` between #{startdate} and #{enddate}
</if>


+ 19
- 6
mallinkService/src/main/resources/mapper/WxCouponMapper.xml View File

@@ -61,6 +61,7 @@
<result column="product_type" jdbcType="INTEGER" property="productType"/>
<result column="category_id" jdbcType="INTEGER" property="categoryId"/>
<result column="goods_id" jdbcType="VARCHAR" property="goodsId"/>
<result column="is_after_set_price" jdbcType="INTEGER" property="isAfterSetPrice"/>

<result column="spu_id" jdbcType="VARCHAR" property="spuId"/>
<result column="poi_status" jdbcType="INTEGER" property="poiStatus"/>
@@ -126,7 +127,7 @@
c.`id`,c.`tenant_id`,c.`parent_tenant_id`,c.`make_merchant_id`,c.`brand`,c.`type`,c.`cover_img`,c.`cover_picture`,c.`detail_picture`,
c.`title`,c.`sub_title`,c.`item_group`,c.`sale_price`,c.`freight_price`,c.`use_price`,c.`use_limit_rule`,c.`use_limit_quantity`,c.`send_type`,
c.`valid_type`,c.`valid_start_date`,c.`valid_end_date`,c.pick_start_date,c.pick_end_date,c.`valid_days`,c.`detail`,c.`price`,c.tail_price,c.orig_price,c.`unit`,c.`remain_inventory`,c.`inventory`,
c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`,
c.`remark`,c.`status`,c.`create_date`,c.`update_date`,c.`business`,c.`sub_business`,c.`support_transfer`,c.`subsidy_num`,c.`subsidy_type`,c.`is_after_set_price`,
c.`press_limit_num`, c.`press_limit_hours`, c.`auto_refund`,c.`credit_price`,c.`credit_refund`,c.`put_apply_status`,c.`stock_apply_status`,c.`cancle_apply_status`,
c.`conditions`,c.approval_type,c.content_type,c.source_type,c.merchant_type,c.password_support,c.gift_list,c.product_type,c.category_id,c.goods_id
</sql>
@@ -322,6 +323,10 @@
<if test=" null != giftList">
and JSON_CONTAINS(gift_list,json_array(#{giftList}))
</if>
<if test=" null != isAfterSetPrice">
and `is_after_set_price` = #{isAfterSetPrice}
</if>

<if test=" null != ids ">
and id in
@@ -379,7 +384,7 @@
<select id="findTenantSimpleList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select id,title,sale_price,use_price,price,tail_price,orig_price,auto_refund,business,subsidy_type,source_type,merchant_type,type,unit,cover_img,
sub_title,item_group,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date
sub_title,item_group,valid_type,valid_start_date,valid_end_date,pick_start_date,pick_end_date,is_after_set_price
from wx_coupon c where c.`tenant_id` = #{tenantId}
<if test=" null != ids ">
and id in
@@ -397,14 +402,14 @@
<select id="findSimpleDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date,
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type,c.gift_list,c.support_transfer,c.subsidy_num
from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId}
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type,c.gift_list,c.support_transfer,c.subsidy_num,
c.is_after_set_price from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId}
</select>
<select id="findCouponCVoDetail" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.cover_picture,c.detail_picture,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,
c.use_limit_rule,c.use_limit_quantity,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,
c.valid_days,c.detail,c.price,c.tail_price,c.orig_price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,
c.valid_days,c.detail,c.price,c.tail_price,c.orig_price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.is_after_set_price,
c.create_date,c.update_date,c.business,c.sub_business,c.support_transfer,c.press_limit_num, c.auto_refund,c.credit_price,c.conditions,c.content_type
from wx_coupon c where c.id = #{id} and c.`tenant_id` = #{tenantId}
</select>
@@ -413,7 +418,7 @@
<select id="findSimpleDetailList" parameterType="com.iformall.domain.po.WxCoupon" resultMap="BaseResultMap">
select c.id,c.type,c.cover_img,c.title,c.sub_title,c.item_group,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.detail,c.remark,c.valid_type,c.valid_start_date,
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type
c.valid_end_date,c.pick_start_date,c.pick_end_date,c.auto_refund,c.business,c.subsidy_type,c.source_type,c.merchant_type,c.content_type,c.is_after_set_price
from wx_coupon c
<include refid="dynamicWhereConditions"/>
</select>
@@ -661,6 +666,10 @@
and cc.status = 0
and cc.target_ad = #{targetAd})
</if>
<if test=" null != isAfterSetPrice ">
and c.`is_after_set_price` = #{isAfterSetPrice}
</if>

<if test=" null != ids ">
and c.id in
@@ -1514,5 +1523,9 @@
<update id="setMakeMerchantId" parameterType="com.iformall.domain.po.WxCoupon" >
update wx_coupon set make_merchant_id = #{makeMerchantId} where id = #{id} and tenant_id = #{tenantId}
</update>
<update id="setPrice" parameterType="HashMap" resultType="java.lang.Integer">
update wx_coupon set price = #{price} where id = #{id} and tenant_id = #{tenantId} and price = 0
</update>

</mapper>

Loading…
Cancel
Save