Commit 838db471 by songyinghui

Merge branch 'xgh_内容中台' into developer

parents 6f82263d 609ca365
......@@ -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());
......@@ -99,13 +102,13 @@ public class ContentMaterialController {
contentMaterialPageFrontQDTO.setHotFlag(1);
}
}
// if (StringUtils.isBlank(contentMaterialQO.getStoreId())){
// // 区经 获取管辖的权限
// List<String> storeIds = this.queryClerkStoreIds(contentMaterialQO.getClerkId(), contentMaterialQO.getWxEnterpriseId());
// contentMaterialPageFrontQDTO.setStoreIdList(storeIds);
// }else {
// contentMaterialPageFrontQDTO.setStoreIdList(Collections.singletonList(contentMaterialQO.getStoreId()));
// }
if (StringUtils.isBlank(contentMaterialQO.getStoreId())){
// 区经 获取管辖的权限
List<String> storeIds = this.queryClerkStoreIds(contentMaterialQO.getClerkId(), contentMaterialQO.getWxEnterpriseId());
contentMaterialPageFrontQDTO.setStoreIdList(storeIds);
}else {
contentMaterialPageFrontQDTO.setStoreIdList(Collections.singletonList(contentMaterialQO.getStoreId()));
}
BasePageInfo pageInfo = new BasePageInfo();
pageInfo.setPageNum(contentMaterialQO.getPageNum());
pageInfo.setPageSize(contentMaterialQO.getPageSize());
......@@ -123,13 +126,16 @@ 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);
simpleGoodsInfoVO.setGoodsImg(temp.getGoodsImageUrl());
return simpleGoodsInfoVO;
}).collect(Collectors.toList());
contentMaterialInfoVO.setContentGoodsList(goodsInfoVOS);
if (CollectionUtils.isNotEmpty(goodsInfoVOS)) {
contentMaterialInfoVO.setContentGoodsList(goodsInfoVOS);
}
}
contentMaterialInfoVO.setPublishTime(item.getPublishBeginTime());
if (StringUtils.isNotBlank(item.getMaterialImageUrls())) {
......@@ -148,6 +154,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