Просмотр исходного кода

wx_coupon_channel加分表

release_toaliyun_real
xiaohanzi 5 лет назад
Родитель
Сommit
908433fe2d
17 измененных файлов: 97 добавлений и 62 удалений
  1. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/device/WxScreenAdController.java
  2. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java
  3. +1
    -1
      mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java
  4. +2
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java
  5. +1
    -1
      mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
  6. +10
    -10
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  7. +2
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  8. +1
    -1
      mallinkCallback/src/main/java/com/iformall/controller/device/WxDeviceScreenAdController.java
  9. +39
    -11
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java
  10. +9
    -7
      mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java
  11. +3
    -3
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  12. +9
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  13. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  14. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java
  15. +1
    -1
      mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java
  16. +1
    -1
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java
  17. +14
    -10
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml

+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/device/WxScreenAdController.java Просмотреть файл

@@ -84,7 +84,7 @@ public class WxScreenAdController extends BaseController {

Object target = null;
if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode()))
target = wxCouponChannelService.findDetailVo(wxScreenAd.getTargetId());
target = wxCouponChannelService.findDetailVo(wxScreenAd.getTargetId(),wxScreenAd.getTenantId());
if (wxScreenAd.getType().equals(EnumScreenAdType.COUPON.getCode()))
target = wxCampaignService.getById(wxScreenAd.getTargetId());



+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxCouponChannelController.java Просмотреть файл

@@ -114,7 +114,7 @@ public class WxCouponChannelController extends BaseController {
@SystemControllerLog(description = "券投放-查询")
public ResultData findById(Long id) {
logger.debug("[" + getIpAddr() + "] WxCouponChannelController::findById");
return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id));
return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id,getTenantInfo().getTenantId()));
}

@ApiOperation("批量新增")


+ 1
- 1
mallinkAdmin/src/main/java/com/iformall/controller/market/WxOrderController.java Просмотреть файл

@@ -158,7 +158,7 @@ public class WxOrderController extends BaseController {
if (orderSaveDto.getCouponChannelId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空");
}
WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId());
WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId(),getTenantInfo().getTenantId());
ResultData resultData = couponChannelCheck(orderSaveDto, wxCouponChannel);
if (resultData != null) {
return resultData;


+ 2
- 2
mallinkAdmin/src/main/java/com/iformall/controller/mem/MemCouponController.java Просмотреть файл

@@ -96,7 +96,7 @@ public class MemCouponController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId必填");
}
memCouponFromDsp.updateTenantInfo(getTenantInfo());
WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId());
WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId(),getTenantInfo().getTenantId());
if (memCouponFromDsp.getCouponId() == null) {
memCouponFromDsp.setCouponId(couponChannel.getCouponId());
}
@@ -139,7 +139,7 @@ public class MemCouponController extends BaseController {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId必填");
}
memCouponFromDsp.updateTenantInfo(getTenantInfo());
WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId());
WxCouponChannel couponChannel = couponChannelService.getById(memCouponFromDsp.getCouponChannelId(),getTenantInfo().getTenantId());
if (memCouponFromDsp.getCouponId() == null) {
memCouponFromDsp.setCouponId(couponChannel.getCouponId());
}


+ 1
- 1
mallinkBApi/src/main/java/com/iformall/controller/WxCouponChannelController.java Просмотреть файл

@@ -101,7 +101,7 @@ public class WxCouponChannelController extends BaseController {
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)
public ResultData findById(Long id) {
logger.debug("[" + getIpAddr() + "] WxCouponChannelController::findById");
return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id));
return new ResultData(Result.SUCCESS, "查询成功", wxCouponChannelService.getById(id,getTenantInfo().getTenantId()));
}

@ApiOperation("批量新增")


+ 10
- 10
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -86,7 +86,7 @@ public class WxCouponController extends BaseController {
// 库存
if (couponIdL > 0L) {
// 更新状态
WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL,wxCouponCVo.getTenantId());
WxCouponCVo couponCVo = couponService.getVoStatusById(couponIdL,getTenantInfo().getTenantId());
if (wxCouponCVo == null) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY);
}
@@ -95,7 +95,7 @@ public class WxCouponController extends BaseController {
} else {
// 更新状态
// WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelIdL);
WxCouponCVo couponCVo = generateWxCouponCVo(couponChannelIdL);
WxCouponCVo couponCVo = generateWxCouponCVo(couponChannelIdL,getTenantInfo().getTenantId());
if (wxCouponCVo == null) {
return new ResultData(ErrorCode.COUPON_IS_EMPTY);
}
@@ -111,7 +111,7 @@ public class WxCouponController extends BaseController {
//WxCouponCVo wxCouponCVo = wxCouponChannelService.findDetailVo(couponChannelIdL);
WxCouponCVo wxCouponCVo = null;
try {
wxCouponCVo = generateWxCouponCVoex(couponChannelIdL);
wxCouponCVo = generateWxCouponCVoex(couponChannelIdL,getTenantInfo().getTenantId());
} catch (IllegalAccessException e) {
logger.error("coupon detail fail,copyproperties error" + couponChannelId,e);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon detail fail,copyproperties error" + couponChannelId);
@@ -163,7 +163,7 @@ public class WxCouponController extends BaseController {
}
WxCouponCVo wxCouponCVo = null;
try {
wxCouponCVo = generateWxCouponCVoForHtml(couponChannelIdL, couponIdL);
wxCouponCVo = generateWxCouponCVoForHtml(couponChannelIdL, couponIdL,getTenantInfo().getTenantId());
} catch (Exception e) {
logger.error("coupon html fail: " + couponChannelId,e);
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "coupon html fail: " + couponChannelId);
@@ -178,8 +178,8 @@ public class WxCouponController extends BaseController {
return new ResultData(wxCouponCVo);
}
private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL) {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL);
private WxCouponCVo generateWxCouponCVo(Long couponChannelIdL,String tenantId) {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId);
if (cc == null) {
return null;
}
@@ -197,8 +197,8 @@ public class WxCouponController extends BaseController {
return couponCVo;
}

private WxCouponCVo generateWxCouponCVoForHtml(Long couponChannelIdL, Long couponIdL) {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL);
private WxCouponCVo generateWxCouponCVoForHtml(Long couponChannelIdL, Long couponIdL,String tenantId) {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId);
if (cc == null) {
return null;
}
@@ -216,8 +216,8 @@ public class WxCouponController extends BaseController {
}

private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL) throws IllegalAccessException, InvocationTargetException {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL);
private WxCouponCVo generateWxCouponCVoex(Long couponChannelIdL,String tenantId) throws IllegalAccessException, InvocationTargetException {
WxCouponChannel cc = wxCouponChannelService.getById(couponChannelIdL,tenantId);
if (cc == null) {
return null;
}


+ 2
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java Просмотреть файл

@@ -79,7 +79,7 @@ public class WxOrderController extends BaseController {
if (orderSaveDto.getCouponChannelId() == null) {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "couponChannelId不能为空");
}
WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId());
WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(orderSaveDto.getCouponChannelId(),getTenantInfo().getTenantId());
if (wxCouponChannel == null) {
logger.error("couponChannelId find error, " + orderSaveDto.getCouponChannelId());
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF);
@@ -119,7 +119,7 @@ public class WxOrderController extends BaseController {
wxCouponCVo = operations.get(key);
} else {
// 游戏没有入缓存,需要从数据库中读取
wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId());
wxCouponCVo = wxCouponChannelService.findDetailVo(orderSaveDto.getCouponChannelId(),wxCouponChannel.getTenantId());
if (wxCouponCVo != null) {
// 游戏优化,进缓存
cdRedisTemplate.opsForValue().set(key, wxCouponCVo, 3600, TimeUnit.SECONDS);


+ 1
- 1
mallinkCallback/src/main/java/com/iformall/controller/device/WxDeviceScreenAdController.java Просмотреть файл

@@ -82,7 +82,7 @@ public class WxDeviceScreenAdController extends BaseController {
page.getList().stream().forEach(s->{
Object target = null;
if (s.getType().equals(EnumScreenAdType.COUPON.getCode()))
target = wxCouponChannelService.findDetailVo(s.getTargetId());
target = wxCouponChannelService.findDetailVo(s.getTargetId(),wxScreenAd.getTenantId());
else if (s.getType().equals(EnumScreenAdType.CAMPAIGN.getCode()))
target = wxCampaignService.getById(s.getTargetId());
else if (s.getType().equals(EnumScreenAdType.MERCHANT.getCode()))


+ 39
- 11
mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java Просмотреть файл

@@ -2,6 +2,7 @@ package com.iformall.schedule;

import com.iformall.domain.po.WxCouponChannel;
import com.iformall.domain.po.WxGame;
import com.iformall.domain.po.WxMall;
import com.iformall.enums.EnumCouponChannelStatus;
import com.iformall.enums.EnumCouponChannelType;
import com.iformall.enums.EnumGameStatus;
@@ -35,17 +36,31 @@ public class CouponExpiringSchedule {

@Autowired
private WxGameMapper wxGameMapper;
@Autowired
private WxMallMapper wxMallMapper;

private List<WxMall> getMalls() {
WxMall wxMall = new WxMall();
return wxMallMapper.findList(wxMall);
}

@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void couponExpiringSchedule() {

wxCouponMapper.offExpiriedCouponByValidDate();
wxCouponMapper.offExpiriedCouponByMerchantStatus();

wxCouponSendMapper.offExpiriedCouponSendByCouponStatus();
wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus();
List<WxMall> malls = getMalls();
for (WxMall mall : malls) {
try {
wxCouponMapper.offExpiriedCouponByValidDate();
wxCouponMapper.offExpiriedCouponByMerchantStatus();
wxCouponSendMapper.offExpiriedCouponSendByCouponStatus();
wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId());
}catch(Exception e) {
logger.error("couponExpiringSchedule error.mall:"+mall.getTenantId(),e);
}
}
}

@Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架定向发放
@@ -57,10 +72,16 @@ public class CouponExpiringSchedule {
@Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架主动领取
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void couponChannelExpiringSchedule() {

wxCouponChannelMapper.offExpiriedCouponChannelByEndTime();
wxCouponChannelMapper.offExpiriedCouponChannelByValidDate();
wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus();
List<WxMall> malls = getMalls();
for (WxMall mall : malls) {
try {
wxCouponChannelMapper.offExpiriedCouponChannelByEndTime(mall.getTenantId());
wxCouponChannelMapper.offExpiriedCouponChannelByValidDate(mall.getTenantId());
wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId());
}catch(Exception e) {
logger.error("couponChannelExpiringSchedule error.mall:"+mall.getTenantId(),e);
}
}
}

@Scheduled(cron = "0 15 0 * * ?") // 每天凌晨00:15 下架券广告
@@ -72,7 +93,14 @@ public class CouponExpiringSchedule {
@Scheduled(cron = "0 0,1,2,3 0/1 * * ?") // 每小时 0, 1 ,2 ,3 分钟(整点)执行//限时抢购
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
public void couponChannel2ExpiringSchedule() {
wxCouponChannelMapper.offExpiriedCouponChannel2ByEndTime();
List<WxMall> malls = getMalls();
for (WxMall mall : malls) {
try {
wxCouponChannelMapper.offExpiriedCouponChannel2ByEndTime(mall.getTenantId());
}catch(Exception e) {
logger.error("couponChannel2ExpiringSchedule error.mall:"+mall.getTenantId(),e);
}
}
}

@Scheduled(cron = "0 20 0 * * ?") // 每天凌晨00:20 下架游戏


+ 9
- 7
mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java Просмотреть файл

@@ -11,6 +11,8 @@ import org.apache.ibatis.annotations.Param;

public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, String> {

WxCouponChannel selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
List<WxCouponChannel> findList(WxCouponChannel wxCouponChannel);

int countCoupon(WxCouponChannel wxCouponChannel);
@@ -21,25 +23,25 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str

List<WxCouponChannelVo> findVoListByMerchant(WxCouponChannel wxCouponChannel);

WxCouponCVo findVoDetail(@Param("id")Long id);
WxCouponCVo findVoDetail(@Param("id")Long id,@Param("tenantId")String tenantId);

WxCouponCVo findVoStatusDetail(@Param("id")Long id);
WxCouponCVo findVoStatusDetail(@Param("id")Long id,@Param("tenantId")String tenantId);

void updateStatusByCouponId(WxCouponChannel wxCouponChannel);

int updateEndTimeByCouponId(WxCouponChannel wxCouponChannel);

void offExpiriedCouponChannelByEndTime();
void offExpiriedCouponChannelByEndTime(@Param("tenantId")String tenantId);

void offExpiriedCouponChannelByValidDate();
void offExpiriedCouponChannelByValidDate(@Param("tenantId")String tenantId);

void offExpiriedCouponChannelByCouponStatus();
void offExpiriedCouponChannelByCouponStatus(@Param("tenantId")String tenantId);

void offExpiriedCouponChannel2ByEndTime();
void offExpiriedCouponChannel2ByEndTime(@Param("tenantId")String tenantId);

void delByTopic(WxTopic wxTopic);

List<WxCouponChannel> findQrcodeEmptyList();
void cardDefer(@Param("couponId")Long couponId,@Param("endTime")Date endTime);
void cardDefer(@Param("couponId")Long couponId,@Param("tenantId")String tenantId,@Param("endTime")Date endTime);
}

+ 3
- 3
mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java Просмотреть файл

@@ -43,9 +43,9 @@ public interface WxCouponChannelService {
*/
PageInfo<WxCouponChannelVo> listByMerchant(WxCouponChannel record, Integer pageIndex, Integer pageSize);

WxCouponCVo findDetailVo(Long id);
WxCouponCVo findDetailVo(Long id,String tenantId);

WxCouponCVo findVoStatusDetail(Long id);
WxCouponCVo findVoStatusDetail(Long id,String tenantId);

/**
* 根据实体查询Vo分页列表
@@ -61,7 +61,7 @@ public interface WxCouponChannelService {
* @param id
* @return
*/
WxCouponChannel getById(Long id);
WxCouponChannel getById(Long id,String tenantId);
/**
* 保存或更新实体


+ 9
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java Просмотреть файл

@@ -71,8 +71,8 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}

@Override
public WxCouponChannel getById(Long id) {
return wxCouponChannelMapper.selectById(id);
public WxCouponChannel getById(Long id,String tenantId) {
return wxCouponChannelMapper.selectById(id,tenantId);
}

@Override
@@ -85,7 +85,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
return new ResultData(record);
} else {
if (record.getCouponId() != null && record.getStatus() != null) {
WxCouponChannel orignal = getById(record.getId());
WxCouponChannel orignal = getById(record.getId(),record.getTenantId());
if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())
&& record.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())) {

@@ -108,7 +108,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}
}
if (record.getStatus() != null) {
WxCouponChannel orignal = getById(record.getId());
WxCouponChannel orignal = getById(record.getId(),record.getTenantId());
if (orignal.getStatus().equals(EnumCouponChannelStatus.STATUS_THROW_IN.getCode())
&& record.getStatus().equals(EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode())) {
wxScreenAdService.updateStatusByCouponChannelId(record.getId(),record,EnumScreenAdStatus.INVALID.getCode());
@@ -294,6 +294,7 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
WxCouponChannel couponChannel = new WxCouponChannel();
couponChannel.setId(vo.getId());
couponChannel.setType(vo.getType());
couponChannel.updateTenantInfo(tenantEntity);
String param = couponChannel.getWeappScene();
//此处只有微信二维码
@@ -342,13 +343,13 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
}

@Override
public WxCouponCVo findDetailVo(Long id) {
return wxCouponChannelMapper.findVoDetail(id);
public WxCouponCVo findDetailVo(Long id,String tenantId) {
return wxCouponChannelMapper.findVoDetail(id,tenantId);
}

@Override
public WxCouponCVo findVoStatusDetail(Long id) {
return wxCouponChannelMapper.findVoStatusDetail(id);
public WxCouponCVo findVoStatusDetail(Long id,String tenantId) {
return wxCouponChannelMapper.findVoStatusDetail(id,tenantId);
}

@Override


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -764,7 +764,7 @@ public class WxCouponServiceImpl implements WxCouponService {
wxCouponMapper.updateValidEndDate(coupon);
//更新coupon_channel
wxCouponChannelMapper.cardDefer(id, validEndDate);
wxCouponChannelMapper.cardDefer(id,tenantId, validEndDate);
//更新coupon_order的状态,已过期的变为使用中 5-->4
List<Long> couponOrderIds = wxCouponOrderMapper.cardDeferCouponOrderId(id);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxGameServiceImpl.java Просмотреть файл

@@ -198,7 +198,7 @@ public class WxGameServiceImpl implements WxGameService {
couponIdsList.add(couponChannelVo);
String key = "cc:" + couponChannelVo.getId();
if (!cdRedisTemplate.hasKey(key)) {
WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId());
WxCouponCVo couponCVo = wxCouponChannelService.findVoStatusDetail(couponChannelVo.getId(),couponChannelQ.getTenantId());
if(Objects.nonNull(couponCVo)) {
// 插入缓存
operations.set(key, couponCVo, 3600, TimeUnit.SECONDS);


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/impl/WxScreenAdServiceImpl.java Просмотреть файл

@@ -68,7 +68,7 @@ public class WxScreenAdServiceImpl implements WxScreenAdService {
if (record.getType().equals(EnumScreenAdType.COUPON.getCode())) {
if (record.getTargetId() == null)
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR);
WxCouponCVo wxCouponCVo = wxCouponChannelMapper.findVoDetail(record.getTargetId());
WxCouponCVo wxCouponCVo = wxCouponChannelMapper.findVoDetail(record.getTargetId(),record.getTenantId());
if (wxCouponCVo == null)
return new ResultData(ErrorCode.COUPON_ORDER_IS_NULL);
record.setCoverImg(wxCouponCVo.getCoverImg());


+ 1
- 1
mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideOrderSuccessMsgServiceImpl.java Просмотреть файл

@@ -53,7 +53,7 @@ public class FmInsideOrderSuccessMsgServiceImpl implements MsgSendService {
logger.error("订单用户不一致: " + msg.getOrderId());
throw new MallinkException(ErrorCode.ORDER_USER_NOT_MATCH.getCode(), "订单用户不一致" + msg.getOrderId());
}
WxCouponChannel couponChannel = couponChannelService.getById(record.getCouponChannelId());
WxCouponChannel couponChannel = couponChannelService.getById(record.getCouponChannelId(),record.getTenantId());
if(couponChannel == null) {
logger.error("投放渠道未找到: " + record.getCouponChannelId());
throw new MallinkException(ErrorCode.ORDER_COUPON_CHANNEL_NOT_MATCH.getCode(), "投放渠道未找到" + record.getCouponChannelId());


+ 14
- 10
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Просмотреть файл

@@ -126,6 +126,10 @@
<if test=" null != sortColumns"> order by ${sortColumns} </if>
</sql>

<select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_channel cc where id = #{id} and tenant_id = #{tenantId}
</select>

<select id="findList" parameterType="com.iformall.domain.po.WxCouponChannel" resultMap="BaseResultMap">
select <include refid="allColumns" /> from wx_coupon_channel cc
<include refid="dynamicWhereConditions" />
@@ -349,19 +353,19 @@
<result column="content_type" jdbcType="INTEGER" property="contentType"/>
</resultMap>

<select id="findVoDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMap">
<select id="findVoDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMap">
select
<include refid="WxCouponCVoColumn"/>
from wx_coupon_channel cc
left join wx_coupon c on cc.coupon_id = c.id
where cc.id = #{id}
where cc.id = #{id} and cc.tenant_id = #{tenantId}
</select>

<select id="findVoStatusDetail" parameterType="java.lang.Long" resultMap="WxCouponCVoMapL">
<select id="findVoStatusDetail" parameterType="java.util.HashMap" resultMap="WxCouponCVoMapL">
select
<include refid="CVoStatusColumn"/>
from wx_coupon c, wx_coupon_channel cc
where cc.coupon_id = c.id and cc.id = #{id}
where cc.coupon_id = c.id and cc.id = #{id} and cc.tenant_id = #{tenantId}
</select>


@@ -375,24 +379,24 @@
<include refid="dynamicWhereConditions" />
</select>

<update id="offExpiriedCouponChannelByEndTime">
<update id="offExpiriedCouponChannelByEndTime" parameterType="String">
update wx_coupon_channel SET status = 1, update_date = now()
where status = 0 and end_time &lt; now()
where status = 0 and tenant_id = #{tenantId} and end_time &lt; now()
</update>

<update id="offExpiriedCouponChannelByValidDate">
update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now()
where cc.status = 0 and cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date &lt; now()
where cc.status = 0 and cc.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.valid_type = 1 and c.valid_end_date &lt; now()
</update>

<update id="offExpiriedCouponChannelByCouponStatus">
update wx_coupon_channel cc, wx_coupon c SET cc.status = 1, cc.update_date = now()
where cc.status = 0 and cc.coupon_id = c.id and c.status = 1
where cc.status = 0 and cc.tenant_id = #{tenantId} and cc.coupon_id = c.id and c.status = 1
</update>

<update id="offExpiriedCouponChannel2ByEndTime">
update wx_coupon_channel SET status = 1, update_date = now()
where status = 0 and target_ad = 2 and end_time &lt; now()
where status = 0 and tenant_id = #{tenantId} and target_ad = 2 and end_time &lt; now()
</update>

<delete id="delByTopic" parameterType="com.iformall.domain.po.WxTopic">
@@ -404,7 +408,7 @@
</select>
<update id="cardDefer">
update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and target_ad = 5 and type = 100
update wx_coupon_channel set end_time = #{endTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and target_ad = 5 and type = 100
</update>




Загрузка…
Отмена
Сохранить