|
|
|
@@ -42,6 +42,8 @@ import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@@ -99,13 +101,16 @@ public class WxPressBatchController extends BaseController { |
|
|
|
@ApiOperation("砍价券接口") |
|
|
|
@GetMapping("itemList") |
|
|
|
@ApiImplicitParams({ |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true)}) |
|
|
|
public ResultData itemList(Long id) { |
|
|
|
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), |
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) |
|
|
|
public ResultData itemList(Long id, Integer pageNum, Integer pageSize) { |
|
|
|
if (null == id) { |
|
|
|
return new ResultData(Result.ERROR,"参数错误"); |
|
|
|
} |
|
|
|
TenantEntity tenantEntity = getTenantInfo(); |
|
|
|
List<WxPressBatchItem> items = wxPressBatchService.getItemList(id, tenantEntity.getTenantId()); |
|
|
|
PageInfo<WxPressBatchItem> itemPage = wxPressBatchService.getItemPage(id, tenantEntity.getTenantId(),pageNum,pageSize); |
|
|
|
List<WxPressBatchItem> items = itemPage.getList(); |
|
|
|
if (null != items && items.size() > 0 ) { |
|
|
|
List<Long> couponIdList = wxPressBatchService.getItemCouponIdList(id, tenantEntity.getTenantId()); |
|
|
|
WxCoupon record = new WxCoupon(); |
|
|
|
@@ -127,7 +132,7 @@ public class WxPressBatchController extends BaseController { |
|
|
|
pbi.setCoupon(coupon); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(items); |
|
|
|
return new ResultData(itemPage); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation("删除接口") |
|
|
|
@@ -180,7 +185,17 @@ public class WxPressBatchController extends BaseController { |
|
|
|
} |
|
|
|
String[] cids = cidstr.split(","); |
|
|
|
WxPressBatch order = wxPressBatchService.getById(record.getId(), tenantEntity.getTenantId()); |
|
|
|
wxPressBatchService.saveItems(order, cids); |
|
|
|
List<Long> existsCids = wxPressBatchService.getItemCouponIdList(record.getId(), tenantEntity.getTenantId()); |
|
|
|
if (null != cids && cids.length > 0 ) { |
|
|
|
List<Long> rcids = new ArrayList<Long>(); |
|
|
|
for (String cid: cids) { |
|
|
|
rcids.add(Long.parseLong(cid)); |
|
|
|
} |
|
|
|
if (null != existsCids && existsCids.size() > 0 ) { |
|
|
|
rcids.removeAll(existsCids); |
|
|
|
} |
|
|
|
wxPressBatchService.saveItems(order, rcids); |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
|