Commit 0a171ddc by songyinghui

feat: 素材关联商品过滤后台配置的状态

parent 930ab9cf
......@@ -13,6 +13,7 @@ import com.gic.content.api.qdto.material.ContentMaterialShareQDTO;
import com.gic.content.api.service.ContentColumnApiService;
import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.content.api.service.ContentMaterialShareApiService;
import com.gic.haoban.app.aggregation.api.dto.GoodsSettingDTO;
import com.gic.haoban.app.aggregation.api.service.SettingApiService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.manage.api.service.StaffApiService;
......@@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
......@@ -89,6 +91,7 @@ public class ContentMaterialController {
log.info("企业id未传 {}", JSON.toJSONString(contentMaterialQO));
return RestResponse.failure("-777", "参数异常");
}
List<Integer> goodsShowStatus = this.getGoodsShowStatus(contentMaterialQO);
ContentMaterialPageFrontQDTO contentMaterialPageFrontQDTO = new ContentMaterialPageFrontQDTO();
contentMaterialPageFrontQDTO.setEnterpriseId(contentMaterialQO.getEnterpriseId());
contentMaterialPageFrontQDTO.setKeyWord(contentMaterialQO.getSearch());
......@@ -123,6 +126,7 @@ public class ContentMaterialController {
if (CollectionUtils.isNotEmpty(item.getContentGoodsList())){
List<SimpleGoodsInfoVO> goodsInfoVOS = item.getContentGoodsList()
.stream()
.filter(temp -> goodsShowStatus.contains(temp.getStatus()))
.map(temp -> {
SimpleGoodsInfoVO simpleGoodsInfoVO = new SimpleGoodsInfoVO();
BeanUtils.copyProperties(temp, simpleGoodsInfoVO);
......@@ -148,6 +152,34 @@ public class ContentMaterialController {
return RestResponse.successResult(result);
}
private List<Integer> getGoodsShowStatus(ContentMaterialQO contentMaterialQO) {
GoodsSettingDTO goodsSettingDTO = settingApiService.getSetting(contentMaterialQO.getEnterpriseId());
List<Integer> showStatus = new ArrayList<>();
if (goodsSettingDTO != null){
int salesGoodsFlag = goodsSettingDTO.getSalesGoodsFlag();
int notSalesGoodsFlag = goodsSettingDTO.getNotSalesGoodsFlag();
if (salesGoodsFlag == 1 && notSalesGoodsFlag == 1) {
//已上架和未上架
showStatus.add(1);
showStatus.add(2);
} else if (salesGoodsFlag == 1) {
//已上架
showStatus.add(1);
} else if (notSalesGoodsFlag == 1) {
//未上架
showStatus.add(2);
} else {
//啥都未打开
showStatus.add(-99);
}
}else {
// 默认展示已上架和未上架的数据
showStatus.add(1);
showStatus.add(2);
}
return showStatus;
}
/**
* 分享商品素材
* @param contentMaterialShareQO
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment