Commit cc03b90b by songyinghui

feat: 素材分享 短链和二维码生成

parent fc8d5933
...@@ -215,6 +215,12 @@ ...@@ -215,6 +215,12 @@
<artifactId>haoban-app-aggregation-api</artifactId> <artifactId>haoban-app-aggregation-api</artifactId>
<version>${haoban-app-aggregation-api}</version> <version>${haoban-app-aggregation-api}</version>
</dependency> </dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-store-goods-api</artifactId>
<version>${gic-store-goods-api}</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
...@@ -15,12 +15,11 @@ import com.gic.content.api.qdto.material.ContentMaterialShareQDTO; ...@@ -15,12 +15,11 @@ import com.gic.content.api.qdto.material.ContentMaterialShareQDTO;
import com.gic.content.api.service.ContentColumnApiService; import com.gic.content.api.service.ContentColumnApiService;
import com.gic.content.api.service.ContentMaterialApiService; import com.gic.content.api.service.ContentMaterialApiService;
import com.gic.content.api.service.ContentMaterialShareApiService; 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.common.utils.EntityUtil;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO; import com.gic.haoban.manage.web.controller.goods.GoodsInfoAdaptor;
import com.gic.haoban.manage.web.qo.content.ContentColumnClerkViewQO; import com.gic.haoban.manage.web.qo.content.ContentColumnClerkViewQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialBaseQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialQO; import com.gic.haoban.manage.web.qo.content.ContentMaterialQO;
import com.gic.haoban.manage.web.qo.content.ContentMaterialShareQO; import com.gic.haoban.manage.web.qo.content.ContentMaterialShareQO;
import com.gic.haoban.manage.web.qo.goods.GoodsSimpleSearchQO; import com.gic.haoban.manage.web.qo.goods.GoodsSimpleSearchQO;
...@@ -35,6 +34,7 @@ import org.slf4j.Logger; ...@@ -35,6 +34,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -62,7 +62,7 @@ public class ContentMaterialController { ...@@ -62,7 +62,7 @@ public class ContentMaterialController {
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired @Autowired
private SettingApiService settingApiService; private GoodsInfoAdaptor goodsInfoAdaptor;
/** /**
...@@ -102,7 +102,7 @@ public class ContentMaterialController { ...@@ -102,7 +102,7 @@ public class ContentMaterialController {
log.info("企业id未传 {}", JSON.toJSONString(contentMaterialQO)); log.info("企业id未传 {}", JSON.toJSONString(contentMaterialQO));
return RestResponse.failure("-777", "参数异常"); return RestResponse.failure("-777", "参数异常");
} }
List<Integer> goodsShowStatus = this.getGoodsShowStatus(contentMaterialQO); List<Integer> goodsShowStatus = goodsInfoAdaptor.getGoodsShowStatus(contentMaterialQO.getEnterpriseId());
ContentMaterialPageFrontQDTO contentMaterialPageFrontQDTO = new ContentMaterialPageFrontQDTO(); ContentMaterialPageFrontQDTO contentMaterialPageFrontQDTO = new ContentMaterialPageFrontQDTO();
contentMaterialPageFrontQDTO.setEnterpriseId(contentMaterialQO.getEnterpriseId()); contentMaterialPageFrontQDTO.setEnterpriseId(contentMaterialQO.getEnterpriseId());
contentMaterialPageFrontQDTO.setKeyWord(contentMaterialQO.getSearch()); contentMaterialPageFrontQDTO.setKeyWord(contentMaterialQO.getSearch());
...@@ -121,6 +121,12 @@ public class ContentMaterialController { ...@@ -121,6 +121,12 @@ public class ContentMaterialController {
} else { } else {
contentMaterialPageFrontQDTO.setStoreIdList(Collections.singletonList(contentMaterialQO.getStoreId())); contentMaterialPageFrontQDTO.setStoreIdList(Collections.singletonList(contentMaterialQO.getStoreId()));
} }
if (contentMaterialQO.getSearchType() != null && contentMaterialQO.getSearchType().equals(1)) {
if (StringUtils.isNotBlank(contentMaterialQO.getSearch())) {
List<String> goodsIds = goodsInfoAdaptor.queryGoodsIdWithSearch(contentMaterialQO.getEnterpriseId(), contentMaterialQO.getSearch());
contentMaterialPageFrontQDTO.setGoodsIdList(goodsIds);
}
}
BasePageInfo pageInfo = new BasePageInfo(); BasePageInfo pageInfo = new BasePageInfo();
pageInfo.setPageNum(contentMaterialQO.getPageNum()); pageInfo.setPageNum(contentMaterialQO.getPageNum());
pageInfo.setPageSize(contentMaterialQO.getPageSize()); pageInfo.setPageSize(contentMaterialQO.getPageSize());
...@@ -132,7 +138,21 @@ public class ContentMaterialController { ...@@ -132,7 +138,21 @@ public class ContentMaterialController {
Page<ContentMaterialInfoVO> result = new Page<>(); Page<ContentMaterialInfoVO> result = new Page<>();
result.setTotalCount(responseResult.getTotalCount()); result.setTotalCount(responseResult.getTotalCount());
List<ContentMaterialInfoVO> contentMaterialInfos = responseResult.getResult().stream() List<ContentMaterialInfoVO> contentMaterialInfos = responseResult.getResult().stream()
.map(item -> { .map(item -> getContentMaterialInfoVO(goodsShowStatus, item))
.collect(Collectors.toList());
result.setResult(contentMaterialInfos);
result.setCurrentPage(contentMaterialQO.getPageNum());
result.setPageSize(contentMaterialQO.getPageSize());
return RestResponse.successResult(result);
}
/**
* 对象转换
* @param goodsShowStatus
* @param item
* @return
*/
private ContentMaterialInfoVO getContentMaterialInfoVO(List<Integer> goodsShowStatus, ContentMaterialFrontDTO item) {
ContentMaterialInfoVO contentMaterialInfoVO = new ContentMaterialInfoVO(); ContentMaterialInfoVO contentMaterialInfoVO = new ContentMaterialInfoVO();
BeanUtils.copyProperties(item, contentMaterialInfoVO); BeanUtils.copyProperties(item, contentMaterialInfoVO);
if (CollectionUtils.isNotEmpty(item.getContentGoodsList())) { if (CollectionUtils.isNotEmpty(item.getContentGoodsList())) {
...@@ -161,39 +181,6 @@ public class ContentMaterialController { ...@@ -161,39 +181,6 @@ public class ContentMaterialController {
contentMaterialInfoVO.setMaterialThumbnailImageUrls(imageUrls); contentMaterialInfoVO.setMaterialThumbnailImageUrls(imageUrls);
} }
return contentMaterialInfoVO; return contentMaterialInfoVO;
}).collect(Collectors.toList());
result.setResult(contentMaterialInfos);
result.setCurrentPage(contentMaterialQO.getPageNum());
result.setPageSize(contentMaterialQO.getPageSize());
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;
} }
/** /**
...@@ -205,20 +192,15 @@ public class ContentMaterialController { ...@@ -205,20 +192,15 @@ public class ContentMaterialController {
@RequestMapping(path = "/share-content-material") @RequestMapping(path = "/share-content-material")
public RestResponse<ContentMaterialShareInfoVO> shareContentMaterial(ContentMaterialShareQO contentMaterialShareQO) { public RestResponse<ContentMaterialShareInfoVO> shareContentMaterial(ContentMaterialShareQO contentMaterialShareQO) {
if (StringUtils.isBlank(contentMaterialShareQO.getEnterpriseId())) { if (StringUtils.isBlank(contentMaterialShareQO.getEnterpriseId())) {
return RestResponse.failure("-777", "企业参数异常"); return RestResponse.failure("-777", "企业参数异常");
} }
if (StringUtils.isBlank(contentMaterialShareQO.getGoodsId())) { if (contentMaterialShareQO.getContentMaterialId() == null) {
// 无商品id 不生成参数 // 无商品id 不生成参数
return RestResponse.successResult(); return RestResponse.successResult();
} }
ContentMaterialShareQDTO contentMaterialShareQDTO = new ContentMaterialShareQDTO(); ContentMaterialShareQDTO contentMaterialShareQDTO = new ContentMaterialShareQDTO();
contentMaterialShareQDTO.setEnterpriseId(contentMaterialShareQO.getEnterpriseId()); BeanUtils.copyProperties(contentMaterialShareQO, contentMaterialShareQDTO);
contentMaterialShareQDTO.setGoodsId(contentMaterialShareQO.getGoodsId());
contentMaterialShareQDTO.setContentMaterialId(contentMaterialShareQO.getContentMaterialId());
contentMaterialShareQDTO.setClerkId(contentMaterialShareQO.getClerkId());
contentMaterialShareQDTO.setStoreId(contentMaterialShareQO.getStoreId());
ServiceResponse<ContentMaterialShareInfoDTO> serviceResponse = contentMaterialShareApiService.shareContentMaterial(contentMaterialShareQDTO); ServiceResponse<ContentMaterialShareInfoDTO> serviceResponse = contentMaterialShareApiService.shareContentMaterial(contentMaterialShareQDTO);
if (!serviceResponse.isSuccess()) { if (!serviceResponse.isSuccess()) {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage()); return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
......
package com.gic.haoban.manage.web.controller.goods;
import com.gic.haoban.app.aggregation.api.dto.GoodsSettingDTO;
import com.gic.haoban.app.aggregation.api.service.SettingApiService;
import com.gic.haoban.manage.web.qo.content.ContentMaterialQO;
import com.gic.store.goods.service.GoodsInfoOutApiService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @Author MUSI
* @Date 2023/3/16 10:19 PM
* @Description
* @Version
**/
@Component
public class GoodsInfoAdaptor {
@Autowired
private SettingApiService settingApiService;
@Autowired
private GoodsInfoOutApiService goodsInfoOutApiService;
public List<String> queryGoodsIdWithSearch(String enterpriseId, String search) {
// 根据关键字查询1000个商品
return Collections.emptyList();
}
/**
* 查询好办商品展示的商品状态
*
* @param enterpriseId
* @return
*/
public List<Integer> getGoodsShowStatus(String enterpriseId) {
if (StringUtils.isBlank(enterpriseId)) {
return Collections.emptyList();
}
GoodsSettingDTO goodsSettingDTO = settingApiService.getSetting(enterpriseId);
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;
}
}
...@@ -52,9 +52,11 @@ public class ContentMaterialQO extends PageQo { ...@@ -52,9 +52,11 @@ public class ContentMaterialQO extends PageQo {
private Long contentColumnId; private Long contentColumnId;
/** /**
* 商品id * 搜索类型
* 0 搜索素材内容
* 1 搜索商品
*/ */
private String goodsId; private Integer searchType;
public Integer getSortType() { public Integer getSortType() {
...@@ -121,11 +123,11 @@ public class ContentMaterialQO extends PageQo { ...@@ -121,11 +123,11 @@ public class ContentMaterialQO extends PageQo {
this.materialType = materialType; this.materialType = materialType;
} }
public String getGoodsId() { public Integer getSearchType() {
return goodsId; return searchType;
} }
public void setGoodsId(String goodsId) { public void setSearchType(Integer searchType) {
this.goodsId = goodsId; this.searchType = searchType;
} }
} }
...@@ -18,11 +18,6 @@ public class ContentMaterialShareQO implements Serializable { ...@@ -18,11 +18,6 @@ public class ContentMaterialShareQO implements Serializable {
private String enterpriseId; private String enterpriseId;
/** /**
* 商品id
*/
private String goodsId;
/**
* 商品货号 * 商品货号
*/ */
private String goodsCode; private String goodsCode;
...@@ -47,6 +42,11 @@ public class ContentMaterialShareQO implements Serializable { ...@@ -47,6 +42,11 @@ public class ContentMaterialShareQO implements Serializable {
*/ */
private String storeCode; private String storeCode;
/**
* 1朋友圈; 2客户群; 3 对话框; 0其他
*/
private String channelSource;
public String getEnterpriseId() { public String getEnterpriseId() {
return enterpriseId; return enterpriseId;
} }
...@@ -55,14 +55,6 @@ public class ContentMaterialShareQO implements Serializable { ...@@ -55,14 +55,6 @@ public class ContentMaterialShareQO implements Serializable {
this.enterpriseId = enterpriseId; this.enterpriseId = enterpriseId;
} }
public String getGoodsId() {
return goodsId;
}
public void setGoodsId(String goodsId) {
this.goodsId = goodsId;
}
public Long getContentMaterialId() { public Long getContentMaterialId() {
return contentMaterialId; return contentMaterialId;
} }
...@@ -102,4 +94,12 @@ public class ContentMaterialShareQO implements Serializable { ...@@ -102,4 +94,12 @@ public class ContentMaterialShareQO implements Serializable {
public void setGoodsCode(String goodsCode) { public void setGoodsCode(String goodsCode) {
this.goodsCode = goodsCode; this.goodsCode = goodsCode;
} }
public String getChannelSource() {
return channelSource;
}
public void setChannelSource(String channelSource) {
this.channelSource = channelSource;
}
} }
...@@ -125,5 +125,6 @@ ...@@ -125,5 +125,6 @@
<dubbo:reference id="newDataTargetConfigApiService" interface="com.gic.enterprise.api.service.target.NewDataTargetConfigApiService" timeout="100000" retries="0" check="false" /> <dubbo:reference id="newDataTargetConfigApiService" interface="com.gic.enterprise.api.service.target.NewDataTargetConfigApiService" timeout="100000" retries="0" check="false" />
<dubbo:reference interface="com.gic.store.goods.service.GoodsInfoOutApiService" id="goodsInfoOutApiService" timeout="100000" retries="0" check="false" />
</beans> </beans>
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