|
|
|
@@ -9,14 +9,20 @@ import com.iformall.controller.base.BaseController; |
|
|
|
import com.iformall.domain.po.AliBusinessCircleOrder; |
|
|
|
import com.iformall.domain.po.WxBusinessCircleOrder; |
|
|
|
import com.iformall.domain.po.WxCoupon; |
|
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
|
import com.iformall.domain.po.WxPressBatch; |
|
|
|
import com.iformall.domain.po.WxPressBatchItem; |
|
|
|
import com.iformall.domain.po.base.BaseEntity; |
|
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
|
import com.iformall.enums.EnumCouponChannelStatus; |
|
|
|
import com.iformall.enums.EnumCouponChannelType; |
|
|
|
import com.iformall.enums.EnumCouponContentType; |
|
|
|
import com.iformall.enums.EnumCouponSourceType; |
|
|
|
import com.iformall.enums.EnumCouponType; |
|
|
|
import com.iformall.enums.EnumRentContractAppStatus; |
|
|
|
import com.iformall.service.AliBusinessCircleOrderService; |
|
|
|
import com.iformall.service.WxCouponChannelService; |
|
|
|
import com.iformall.service.WxCouponService; |
|
|
|
import com.iformall.service.WxPressBatchService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@@ -46,7 +52,13 @@ public class WxPressBatchController extends BaseController { |
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxPressBatchService wxPressBatchService; |
|
|
|
WxPressBatchService wxPressBatchService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponService wxCouponService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
WxCouponChannelService wxCouponChannelService; |
|
|
|
|
|
|
|
@ApiOperation("分页列表接口") |
|
|
|
@GetMapping("list") |
|
|
|
@@ -84,7 +96,7 @@ public class WxPressBatchController extends BaseController { |
|
|
|
return new ResultData(order); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("详情接口") |
|
|
|
@ApiOperation("砍价券接口") |
|
|
|
@GetMapping("itemList") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)}) |
|
|
|
@@ -92,11 +104,33 @@ public class WxPressBatchController extends BaseController { |
|
|
|
if (null == id) { |
|
|
|
return new ResultData(Result.ERROR,"参数错误"); |
|
|
|
} |
|
|
|
List<WxPressBatchItem> list = wxPressBatchService.getItemList(id, getTenantInfo().getTenantId()); |
|
|
|
return new ResultData(list); |
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
List<WxPressBatchItem> items = wxPressBatchService.getItemList(id, tenantEntity.getTenantId()); |
|
|
|
if (null != items && items.size() > 0 ) { |
|
|
|
List<Long> couponIdList = wxPressBatchService.getItemCouponIdList(id, tenantEntity.getTenantId()); |
|
|
|
WxCoupon record = new WxCoupon(); |
|
|
|
record.updateTenantInfo(getTenantInfo()); |
|
|
|
if (null != couponIdList && couponIdList.size() > 0 ) { |
|
|
|
record.setIds(couponIdList); |
|
|
|
}else { |
|
|
|
record.setId(0L); |
|
|
|
} |
|
|
|
List<WxCoupon> list = wxCouponService.list(record); |
|
|
|
Map<Long,WxCoupon> couponMap = new HashMap<Long,WxCoupon>(); |
|
|
|
if (null != list && list.size() > 0 ) { |
|
|
|
for (WxCoupon c : list) { |
|
|
|
couponMap.put(c.getId(), c); |
|
|
|
} |
|
|
|
} |
|
|
|
for (WxPressBatchItem pbi : items) { |
|
|
|
WxCoupon coupon = couponMap.get(pbi.getCouponId()); |
|
|
|
pbi.setCoupon(coupon); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(items); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("详情接口") |
|
|
|
@ApiOperation("删除接口") |
|
|
|
@PostMapping("delete") |
|
|
|
public ResultData delete(@RequestBody WxPressBatch record) { |
|
|
|
if (null == record.getId()) { |
|
|
|
@@ -105,6 +139,31 @@ public class WxPressBatchController extends BaseController { |
|
|
|
wxPressBatchService.deleteBatch(record.getId(), getTenantInfo().getTenantId()); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("已投放砍价券列表接口") |
|
|
|
@GetMapping("couponList") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true),}) |
|
|
|
public ResultData couponList(@ModelAttribute WxCoupon record, Integer pageNum, Integer pageSize) { |
|
|
|
WxCouponChannel couponChannelQ = new WxCouponChannel(); |
|
|
|
couponChannelQ.updateTenantInfo(getTenantInfo()); |
|
|
|
couponChannelQ.setType(EnumCouponType.COUPON_PRESS.getCode()); |
|
|
|
couponChannelQ.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_PRESS.getCode()); |
|
|
|
couponChannelQ.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
List<Long> couponIds = wxCouponChannelService.findCouponIdList(couponChannelQ); |
|
|
|
if (null == record) { |
|
|
|
record = new WxCoupon(); |
|
|
|
} |
|
|
|
record.updateTenantInfo(couponChannelQ); |
|
|
|
if (null != couponIds && couponIds.size() > 0 ) { |
|
|
|
record.setIds(couponIds); |
|
|
|
}else { |
|
|
|
record.setId(0L); |
|
|
|
} |
|
|
|
PageInfo<WxCoupon> page = wxCouponService.simplelistAsPage(record, pageNum, pageSize); |
|
|
|
return new ResultData(page); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("新增items") |
|
|
|
@@ -145,6 +204,21 @@ public class WxPressBatchController extends BaseController { |
|
|
|
wxPressBatchService.updateStatus(record); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("详情接口") |
|
|
|
@PostMapping("setRules") |
|
|
|
public ResultData setRules(@RequestBody WxPressBatch record) { |
|
|
|
if (null == record.getId()) { |
|
|
|
return new ResultData(Result.ERROR,"参数错误"); |
|
|
|
} |
|
|
|
WxPressBatch record1 = wxPressBatchService.getById(record.getId(), getTenantInfo().getTenantId()); |
|
|
|
record1.setPromoterLimitRule(record.getPromoterLimitRule()); |
|
|
|
record1.setPromoterAllowCount(record.getPromoterAllowCount()); |
|
|
|
record1.setBargainerAllowCount(record.getBargainerAllowCount()); |
|
|
|
record1.setBargainerAllowSame(record.getBargainerAllowSame()); |
|
|
|
wxPressBatchService.saveOrUpdate(record1); |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|