|
@@ -15,9 +15,12 @@ import com.yami.shop.bean.model.Sku;
|
|
|
import com.yami.shop.bean.po.FreightStatisticsPo;
|
|
import com.yami.shop.bean.po.FreightStatisticsPo;
|
|
|
import com.yami.shop.bean.po.SkuStatisticsPo;
|
|
import com.yami.shop.bean.po.SkuStatisticsPo;
|
|
|
import com.yami.shop.bean.vo.FreightStatisticsVo;
|
|
import com.yami.shop.bean.vo.FreightStatisticsVo;
|
|
|
|
|
+import com.yami.shop.bean.vo.IdNameVo;
|
|
|
import com.yami.shop.bean.vo.SkuStatisticsVo;
|
|
import com.yami.shop.bean.vo.SkuStatisticsVo;
|
|
|
import com.yami.shop.common.util.PageParam;
|
|
import com.yami.shop.common.util.PageParam;
|
|
|
import com.yami.shop.common.util.R;
|
|
import com.yami.shop.common.util.R;
|
|
|
|
|
+import com.yami.shop.security.platform.util.SecurityUtils;
|
|
|
|
|
+import com.yami.shop.service.ChannelService;
|
|
|
import com.yami.shop.service.SkuService;
|
|
import com.yami.shop.service.SkuService;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
@@ -29,6 +32,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 商品SKU管理实现
|
|
* 商品SKU管理实现
|
|
|
*
|
|
*
|
|
@@ -42,6 +47,7 @@ import java.util.List;
|
|
|
public class SkuController {
|
|
public class SkuController {
|
|
|
|
|
|
|
|
private final SkuService skuService;
|
|
private final SkuService skuService;
|
|
|
|
|
+ private final ChannelService channelService;
|
|
|
|
|
|
|
|
@GetMapping("/getAllSkuList")
|
|
@GetMapping("/getAllSkuList")
|
|
|
@PreAuthorize("@pms.hasPermission('plateform:sku:list')")
|
|
@PreAuthorize("@pms.hasPermission('plateform:sku:list')")
|
|
@@ -53,24 +59,52 @@ public class SkuController {
|
|
|
@GetMapping("/skuStatisticsList")
|
|
@GetMapping("/skuStatisticsList")
|
|
|
@ApiOperation(value = "对账单汇总表(商品)-列表")
|
|
@ApiOperation(value = "对账单汇总表(商品)-列表")
|
|
|
public R<IPage<SkuStatisticsVo>> skuStatisticsList(PageParam<SkuStatisticsPo> page, SkuStatisticsPo po) {
|
|
public R<IPage<SkuStatisticsVo>> skuStatisticsList(PageParam<SkuStatisticsPo> page, SkuStatisticsPo po) {
|
|
|
|
|
+ if (po.getChannelIds().contains(0L)){
|
|
|
|
|
+ List<IdNameVo> idNameVos = channelService.queryMyChannel(SecurityUtils.getSysUser().getUserId());
|
|
|
|
|
+ if (!idNameVos.isEmpty()){
|
|
|
|
|
+ List<Long> ids = idNameVos.stream().map(IdNameVo::getId).collect(Collectors.toList());
|
|
|
|
|
+ po.setChannelIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return R.SUCCESS(skuService.skuStatisticsList(page,po));
|
|
return R.SUCCESS(skuService.skuStatisticsList(page,po));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping(value = "/skuStatisticsExcel",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
@GetMapping(value = "/skuStatisticsExcel",produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
|
|
@ApiOperation("对账单汇总表(商品)-导出")
|
|
@ApiOperation("对账单汇总表(商品)-导出")
|
|
|
public void skuStatisticsExcel(HttpServletResponse response, SkuStatisticsPo po) {
|
|
public void skuStatisticsExcel(HttpServletResponse response, SkuStatisticsPo po) {
|
|
|
|
|
+ if (po.getChannelIds().contains(0L)){
|
|
|
|
|
+ List<IdNameVo> idNameVos = channelService.queryMyChannel(SecurityUtils.getSysUser().getUserId());
|
|
|
|
|
+ if (!idNameVos.isEmpty()){
|
|
|
|
|
+ List<Long> ids = idNameVos.stream().map(IdNameVo::getId).collect(Collectors.toList());
|
|
|
|
|
+ po.setChannelIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
skuService.skuStatisticsExcel(response,po);
|
|
skuService.skuStatisticsExcel(response,po);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/freightStatisticsList")
|
|
@GetMapping("/freightStatisticsList")
|
|
|
@ApiOperation(value = "运费明细表-列表")
|
|
@ApiOperation(value = "运费明细表-列表")
|
|
|
public R<IPage<FreightStatisticsVo>> freightStatisticsList(PageParam<FreightStatisticsPo> page, FreightStatisticsPo po) {
|
|
public R<IPage<FreightStatisticsVo>> freightStatisticsList(PageParam<FreightStatisticsPo> page, FreightStatisticsPo po) {
|
|
|
|
|
+ if (po.getChannelIds().contains(0L)){
|
|
|
|
|
+ List<IdNameVo> idNameVos = channelService.queryMyChannel(SecurityUtils.getSysUser().getUserId());
|
|
|
|
|
+ if (!idNameVos.isEmpty()){
|
|
|
|
|
+ List<Long> ids = idNameVos.stream().map(IdNameVo::getId).collect(Collectors.toList());
|
|
|
|
|
+ po.setChannelIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return R.SUCCESS(skuService.freightStatisticsList(page,po));
|
|
return R.SUCCESS(skuService.freightStatisticsList(page,po));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/freightStatisticsExcel")
|
|
@GetMapping("/freightStatisticsExcel")
|
|
|
@ApiOperation("运费明细表-导出")
|
|
@ApiOperation("运费明细表-导出")
|
|
|
public R<Void> freightStatisticsExcel(HttpServletResponse response, FreightStatisticsPo po) {
|
|
public R<Void> freightStatisticsExcel(HttpServletResponse response, FreightStatisticsPo po) {
|
|
|
|
|
+ if (po.getChannelIds().contains(0L)){
|
|
|
|
|
+ List<IdNameVo> idNameVos = channelService.queryMyChannel(SecurityUtils.getSysUser().getUserId());
|
|
|
|
|
+ if (!idNameVos.isEmpty()){
|
|
|
|
|
+ List<Long> ids = idNameVos.stream().map(IdNameVo::getId).collect(Collectors.toList());
|
|
|
|
|
+ po.setChannelIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
skuService.freightStatisticsExcel(response,po);
|
|
skuService.freightStatisticsExcel(response,po);
|
|
|
return R.SUCCESS();
|
|
return R.SUCCESS();
|
|
|
}
|
|
}
|