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

[卡券][修改]:现实抢购增加预告环节

release_toaliyun_real
hupeng 7 лет назад
Родитель
Сommit
a41d46b3f0
8 измененных файлов: 88 добавлений и 39 удалений
  1. +23
    -12
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponChannelController.java
  2. +18
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxOrderController.java
  3. +4
    -4
      mallinkService/src/main/java/com/iformall/common/ErrorCode.java
  4. +5
    -5
      mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java
  5. +38
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelActivityStatus.java
  6. +0
    -6
      mallinkService/src/main/java/com/iformall/service/WxCouponChannelService.java
  7. +0
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponChannelServiceImpl.java
  8. +0
    -5
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml

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

@@ -1,6 +1,10 @@
package com.iformall.controller;

import com.github.pagehelper.PageInfo;
import com.iformall.domain.vo.WxCouponChannelVo;
import com.iformall.enums.EnumCouponChannelActivityStatus;
import com.iformall.enums.EnumCouponChannelStatus;
import com.iformall.enums.EnumCouponChannelType;
import io.swagger.annotations.Api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -15,6 +19,8 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import java.util.Date;

@RestController
@RequestMapping("/api/wxCouponChannel")
@Api(description = "发券渠道相关接口")
@@ -34,20 +40,25 @@ public class WxCouponChannelController extends BaseController {
wxCouponChannel.setTenantId(getTenantId());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannel.setSortColumns(WxCouponChannel.Field.CreateDate_DESC);
wxCouponChannel.setIsCRequest(0);//标记为C端调用
return new ResultData(wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize));
}

@ApiOperation("分页列表接口")
@GetMapping("getCouponChannel")
public ResultData getCouponChannel(@ModelAttribute WxCouponChannel wxCouponChannel) {
if (null == wxCouponChannel) wxCouponChannel = new WxCouponChannel();
wxCouponChannel.setTenantId(getTenantId());
wxCouponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode());
wxCouponChannel.setIsCRequest(0);//标记为C端调用
return new ResultData(wxCouponChannelService.findCouponChannelVo(wxCouponChannel));
}

PageInfo<WxCouponChannelVo> page = wxCouponChannelService.listPageCVo(wxCouponChannel, pageNum, pageSize);

if (wxCouponChannel.getTargetAd()!= null &&
wxCouponChannel.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) {
Date now = new Date();
page.getList().stream().forEach(cc->{
if (cc.getBeginTime().getTime() > now.getTime()) {
cc.setActivityStatus(EnumCouponChannelActivityStatus.PREPARED.getCode());
} else if (cc.getEndTime().getTime() < now.getTime()) {
cc.setActivityStatus(EnumCouponChannelActivityStatus.ENDED.getCode());
} else {
cc.setActivityStatus(EnumCouponChannelActivityStatus.STARTED.getCode());
}
});
}

return new ResultData();
}

}

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

@@ -10,10 +10,12 @@ import com.iformall.domain.po.WxOrder;
import com.iformall.domain.vo.WxOrderCouponPressVo;
import com.iformall.domain.vo.WxOrderCouponVo;
import com.iformall.enums.EnumCouponChannelStatus;
import com.iformall.enums.EnumCouponChannelType;
import com.iformall.enums.EnumOrderStatus;
import com.iformall.exception.MallinkException;
import com.iformall.service.WxCouponChannelService;
import com.iformall.service.WxOrderService;
import com.iformall.utils.DateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -24,6 +26,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

@RestController
@@ -111,11 +114,24 @@ public class WxOrderController extends BaseController {
WxCouponChannel wxCouponChannel = wxCouponChannelService.getById(couponChannelId);
if (wxCouponChannel == null) {
logger.error("couponChannelId convert error, " + couponChannelIdStr);
return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR.getCode(), "找不到发布的频道");
return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR);
}

if (wxCouponChannel.getTargetAd().equals(EnumCouponChannelType.COUPON_CHANNEL_ID_TIMED.getCode())) {
Date now = new Date();
if (wxCouponChannel.getBeginTime().getTime() > now.getTime()) {
logger.error("此券活动未开始:" + couponChannelIdStr);
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_NOT_STARTED);
}
if (wxCouponChannel.getEndTime().getTime() < now.getTime()) {
logger.error("此券活动已结束:" + couponChannelIdStr);
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_END);
}
}

if (wxCouponChannel.getStatus() == EnumCouponChannelStatus.STATUS_TAKE_OFFF.getCode()) {
logger.error("此券已下架:" + couponChannelIdStr);
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF.getCode(), "此券已下架");
return new ResultData(ErrorCode.COUPON_CHANNEL_IS_TAKE_OFF);
}
if (StringUtils.isBlank(couponIdStr)) {
couponId = wxCouponChannel.getCouponId();


+ 4
- 4
mallinkService/src/main/java/com/iformall/common/ErrorCode.java Просмотреть файл

@@ -88,13 +88,13 @@ public enum ErrorCode{
COUPON_TYPE_IS_NOT_ACTIVE(2025, "此券不能用于主动领取"),
COUPON_TYPE_IS_NOT_PASSIVE(2026, "此券不能用于定向投放"),
COUPON_CHANNEL_IS_EXISTED(2027, "此券已投放过"),
COUPON_CHANNEL_IS_TAKE_OFF(2031, "此券已下架"),
COUPON_SEND_IS_EXISTED(2028, "此券已经添加到该渠道"),
COUPON_SEND_IS_INVALID(2029, "此发券渠道不存在"),
COUPON_SEND_IS_INVALID_TIME(2030, "发放时间不能晚于使用时间"),

COUPON_MERCHANT_NOT_FOUND(2031, "卡券关联商户未发现"),

COUPON_CHANNEL_IS_TAKE_OFF(2031, "此券已下架"),
COUPON_MERCHANT_NOT_FOUND(2032, "卡券关联商户未发现"),
COUPON_CHANNEL_IS_NOT_STARTED(2033, "此券活动未开始"),
COUPON_CHANNEL_IS_END(2033, "此券活动已结束"),

PUSH_LIMIT_UP_TO_1DAYLIMIT(2040, "此用户一天内发券到达疲劳度限制"),
PUSH_LIMIT_UP_TO_COUPONLIMIT(2041, "此用户发此券到达疲劳度限制"),


+ 5
- 5
mallinkService/src/main/java/com/iformall/domain/po/WxCouponChannel.java Просмотреть файл

@@ -41,7 +41,7 @@ public class WxCouponChannel implements Serializable {
}

@Transient
private Integer isCRequest;
private Integer activityStatus;

@Transient
private Date startdate;
@@ -100,12 +100,12 @@ public class WxCouponChannel implements Serializable {
@io.swagger.annotations.ApiModelProperty(value="子频道ID",name="subTargetId")
private Long subTargetId;

public Integer getIsCRequest() {
return isCRequest;
public Integer getActivityStatus() {
return activityStatus;
}

public void setIsCRequest(Integer isCRequest) {
this.isCRequest = isCRequest;
public void setActivityStatus(Integer activityStatus) {
this.activityStatus = activityStatus;
}

public String getTenantId() {


+ 38
- 0
mallinkService/src/main/java/com/iformall/enums/EnumCouponChannelActivityStatus.java Просмотреть файл

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

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


PREPARED(0, "预告中"),
STARTED(1, "已开启"),
ENDED(1, "已结束"),
;

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

private Integer code;
private String message;

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

public Integer getCode() {
return code;
}

public String getMessage() {
return message;
}
}

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

@@ -31,12 +31,6 @@ public interface WxCouponChannelService {
*/
PageInfo<WxCouponChannelVo> listPageCVo(WxCouponChannel record, Integer pageIndex, Integer pageSize);

/**
* 根据实体查询couponChannelVo列表
* @param record
* @return
*/
List<WxCouponChannelVo> findCouponChannelVo(WxCouponChannel record);

WxCouponCVo findDetailVo(Long id);



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

@@ -231,11 +231,6 @@ public class WxCouponChannelServiceImpl implements WxCouponChannelService {
return new PageInfo<>(wxCouponChannelMapper.findVoList(record));
}

@Override
public List<WxCouponChannelVo> findCouponChannelVo(WxCouponChannel record) {
return wxCouponChannelMapper.findVoList(record);
}

@Override
public WxCouponCVo findDetailVo(Long id) {
return wxCouponChannelMapper.findVoDetail(id);


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

@@ -56,11 +56,6 @@
and cc.`create_date` between #{startdate} and #{enddate}
</if>

<if test="null !=isCRequest and null != targetAd and 2 == targetAd">
and cc.`begin_time` &lt; now()
and cc.`end_time` &gt; now()
</if>

<if test=" null != status ">
and cc.`status` = #{status}
</if>


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