|
|
|
@@ -7,11 +7,13 @@ import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.TtPoiTakeRate; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
import com.iformall.enums.EnumCpsPlanContentType; |
|
|
|
import com.iformall.enums.EnumCpsPlanStatus; |
|
|
|
import com.iformall.enums.EnumCpsPlanType; |
|
|
|
import com.iformall.service.TtCouponGoodsService; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@@ -22,7 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@@ -36,6 +40,9 @@ public class TtPoiPlanController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private TtCouponGoodsService ttCouponGoodsService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxCouponService wxCouponService; |
|
|
|
|
|
|
|
@ApiOperation("分页列表接口") |
|
|
|
@GetMapping("takeRateList") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@@ -48,9 +55,29 @@ public class TtPoiPlanController extends BaseController { |
|
|
|
record.updateTenantInfo(getTenantInfo()); |
|
|
|
record.setSortColumns(BaseEntity.SortField.UpdateDate_DESC); |
|
|
|
final PageInfo<TtPoiTakeRate> page = ttCouponGoodsService.takeRateListAsPage(record, pageNum, pageSize); |
|
|
|
if(page.getList() != null && !page.getList().isEmpty()){ |
|
|
|
List<Long> couponIds = page.getList().stream().map(cc -> cc.getCouponId()).collect(Collectors.toList()); |
|
|
|
Map<Long, WxCoupon> couponMap = wxCouponService.getCouponMap(couponIds, getTenantInfo()); |
|
|
|
for (TtPoiTakeRate takeRate:page.getList()) { |
|
|
|
takeRate.setCoupon(couponMap.get(takeRate.getCouponId())); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("通过id获取") |
|
|
|
@GetMapping("getTakeRate") |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) |
|
|
|
@SystemControllerLog(description = "列表") |
|
|
|
public ResultData getTakeRate(Long id) { |
|
|
|
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::getTakeRate"); |
|
|
|
if(id == null){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
TtPoiTakeRate takeRateById = ttCouponGoodsService.getTakeRateById(getTenantInfo(), id); |
|
|
|
return new ResultData(takeRateById); |
|
|
|
} |
|
|
|
|
|
|
|
// @TenantIgnore |
|
|
|
@ApiOperation("通用计划分页列表接口") |
|
|
|
@GetMapping("list") |
|
|
|
|