|
|
|
@@ -0,0 +1,52 @@ |
|
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.BaseEntity; |
|
|
|
import com.iformall.domain.po.WxCouponSend; |
|
|
|
import com.iformall.domain.vo.WxCouponSendVo; |
|
|
|
import com.iformall.enums.EnumCouponSendStatus; |
|
|
|
import com.iformall.service.WxCouponActionLogService; |
|
|
|
import com.iformall.service.WxCouponSendService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping("/api/couponSend") |
|
|
|
@Api(description = "商户卡券相关接口") |
|
|
|
public class WxCouponSendController extends BaseController { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponSendService wxCouponSendService; |
|
|
|
@Autowired |
|
|
|
private WxCouponActionLogService wxCouponActionLogService; |
|
|
|
|
|
|
|
@ApiOperation("查询商户卡券列表") |
|
|
|
@GetMapping("/list") |
|
|
|
@ApiImplicitParam(name = "sendType", value = "sendType", dataType = "Long", paramType = "query", required = true) |
|
|
|
public ResultData list(Integer sendType, Integer pageNum, Integer pageSize) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxCouponSendController::list"); |
|
|
|
WxCouponSend wxCouponSend = new WxCouponSend(); |
|
|
|
wxCouponSend.setSendType(sendType); |
|
|
|
wxCouponSend.setTenantId(getTenantId()); |
|
|
|
wxCouponSend.setStatus(EnumCouponSendStatus.VALID.getCode()); |
|
|
|
//库存大于0 |
|
|
|
wxCouponSend.setInventory(0); |
|
|
|
wxCouponSend.setSortColumns(BaseEntity.SortField.CreateDate_DESC); |
|
|
|
final PageInfo<WxCouponSendVo> page = wxCouponSendService.listAsPage(wxCouponSend, pageNum, pageSize); |
|
|
|
|
|
|
|
for (WxCouponSendVo cs : page.getList()) { |
|
|
|
cs.setSendCount(wxCouponActionLogService.getCountByChannelId(getTenantId(), cs.getSendType(), cs.getId())); |
|
|
|
} |
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
} |