Merge remote-tracking branch 'origin/main'

This commit is contained in:
haozq 2025-10-29 09:57:22 +08:00
commit e6b36012f1
5 changed files with 76 additions and 45 deletions

View File

@ -34,4 +34,9 @@ public class ProductScreenController {
return service.getProductDetails(product) ; return service.getProductDetails(product) ;
} }
@PostMapping("/getProductDetailsById")
public AjaxResult getProductDetailsById(@RequestBody TbProduct product ){
return service.getProductDetailsById(product) ;
}
} }

View File

@ -121,4 +121,6 @@ public interface ProductMapper {
* @return * @return
*/ */
Integer getProductOnCz(TbProduct product); Integer getProductOnCz(TbProduct product);
TbProductCase getProductDetailsById(String id);
} }

View File

@ -17,4 +17,6 @@ public interface ProductScreenService {
* @return * @return
*/ */
AjaxResult getProductDetails(TbProduct product); AjaxResult getProductDetails(TbProduct product);
AjaxResult getProductDetailsById(TbProduct product);
} }

View File

@ -38,22 +38,22 @@ public class ProductScreenImpl implements ProductScreenService {
@Autowired @Autowired
public FileServiceUtils fileServiceUtils; public FileServiceUtils fileServiceUtils;
@Override @Override
public AjaxResult getProductList(TbProduct product) { public AjaxResult getProductList(TbProduct product) {
try{ try {
List<TbProduct> list=mapper.getProductList(product); List<TbProduct> list = mapper.getProductList(product);
if(StringUtils.isNotEmpty(list)){ if (StringUtils.isNotEmpty(list)) {
list.forEach(vo->{ list.forEach(vo -> {
String url = fileServiceUtils.getFileUrl(vo.getLinkImage(),null); String url = fileServiceUtils.getFileUrl(vo.getLinkImage(), null);
// String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES); // String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
vo.setLinkImage(url); vo.setLinkImage(url);
}); });
} }
return AjaxResult.success(list); return AjaxResult.success(list);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
} }
return AjaxResult.success(new ArrayList<TbProduct>()); return AjaxResult.success(new ArrayList<TbProduct>());
@ -61,59 +61,76 @@ public class ProductScreenImpl implements ProductScreenService {
/** /**
* 查看宣传物料信息 * 查看宣传物料信息
*
* @param product * @param product
* @return * @return
*/ */
@Override @Override
public AjaxResult getProductDetails(TbProduct product) { public AjaxResult getProductDetails(TbProduct product) {
try{ try {
//详情 //详情
TbProduct vo=mapper.getProductDetails(product); TbProduct vo = mapper.getProductDetails(product);
if(vo!=null){ if (vo != null) {
//封面图 //封面图
String url = fileServiceUtils.getFileUrl(vo.getLinkImage(),null); String url = fileServiceUtils.getFileUrl(vo.getLinkImage(), null);
// String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES); // String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
vo.setLinkImage(url); vo.setLinkImage(url);
// vo.setLinkImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getLinkImage()); // vo.setLinkImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getLinkImage());
getProductDetails(product, vo, productMapper, minioUtil); getProductDetails(product, vo, productMapper, minioUtil);
//查询 宣传手册和宣传视频 //查询 宣传手册和宣传视频
List<ProductScreenVo> list=mapper.getMaterialList(vo); List<ProductScreenVo> list = mapper.getMaterialList(vo);
List<ProductScreenVo> videoList=new ArrayList<>(); List<ProductScreenVo> videoList = new ArrayList<>();
List<ProductScreenVo> fileList=new ArrayList<>(); List<ProductScreenVo> fileList = new ArrayList<>();
if(StringUtils.isNotEmpty(list)){ if (StringUtils.isNotEmpty(list)) {
list.forEach(vo1->{ list.forEach(vo1 -> {
String imageUlr = fileServiceUtils.getFileUrl(vo1.getImage(),null); String imageUlr = fileServiceUtils.getFileUrl(vo1.getImage(), null);
String path = fileServiceUtils.getFileUrl(vo1.getFilePath(),null); String path = fileServiceUtils.getFileUrl(vo1.getFilePath(), null);
// String imageUlr = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getImage(), GlobalUtils.FILE_TIMES); // String imageUlr = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getImage(), GlobalUtils.FILE_TIMES);
// String path = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getFilePath(), GlobalUtils.FILE_TIMES); // String path = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getFilePath(), GlobalUtils.FILE_TIMES);
vo1.setImage(imageUlr); vo1.setImage(imageUlr);
vo1.setUrl(path); vo1.setUrl(path);
if("0".equals(vo1.getFileType())){ if ("0".equals(vo1.getFileType())) {
videoList.add(vo1); videoList.add(vo1);
}else { } else {
fileList.add(vo1); fileList.add(vo1);
} }
}); });
vo.setVideoList(videoList); vo.setVideoList(videoList);
vo.setFileList(fileList); vo.setFileList(fileList);
} }
} }
return AjaxResult.success(vo); return AjaxResult.success(vo);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString()); log.error(e.toString());
} }
return AjaxResult.success(product); return AjaxResult.success(product);
} }
public void getProductDetails(TbProduct product, TbProduct vo, ProductMapper productMapper, MinioUtil minioUtil) { @Override
List<TbProductCase> productCases= productMapper.getProductCaseList(product.getId()); public AjaxResult getProductDetailsById(TbProduct product) {
for (TbProductCase productCase:productCases) { TbProductCase productCase = productMapper.getProductDetailsById(product.getId());
//产品案例
List<ProductCaseImage> caseImages = productMapper.getCaseImageByTable(productCase.getId(), "tb_product_case");
if (StringUtils.isNotEmpty(caseImages)) {
caseImages.forEach(image -> {
String path = fileServiceUtils.getFileUrl(image.getFilePath(), image.getBucketName());
// String path = minioUtil.getFileUrl(image.getBucketName(),image.getFilePath(), GlobalUtils.FILE_TIMES);
image.setUrl(path);
});
productCase.setImageList(caseImages);
}
return AjaxResult.success(productCase);
}
public void getProductDetails(TbProduct product, TbProduct vo, ProductMapper productMapper, MinioUtil minioUtil) {
List<TbProductCase> productCases = productMapper.getProductCaseList(product.getId());
for (TbProductCase productCase : productCases) {
//产品案例 //产品案例
List<ProductCaseImage> caseImages= productMapper.getCaseImageByTable(productCase.getId(),"tb_product_case"); List<ProductCaseImage> caseImages = productMapper.getCaseImageByTable(productCase.getId(), "tb_product_case");
if(StringUtils.isNotEmpty(caseImages)){ if (StringUtils.isNotEmpty(caseImages)) {
caseImages.forEach(image->{ caseImages.forEach(image -> {
String path = fileServiceUtils.getFileUrl(image.getFilePath(),image.getBucketName()); String path = fileServiceUtils.getFileUrl(image.getFilePath(), image.getBucketName());
// String path = minioUtil.getFileUrl(image.getBucketName(),image.getFilePath(), GlobalUtils.FILE_TIMES); // String path = minioUtil.getFileUrl(image.getBucketName(),image.getFilePath(), GlobalUtils.FILE_TIMES);
image.setUrl(path); image.setUrl(path);
}); });
productCase.setImageList(caseImages); productCase.setImageList(caseImages);

View File

@ -76,6 +76,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where product_id=#{id} where product_id=#{id}
</select> </select>
<select id="getProductDetailsById" resultType="com.bonus.business.domain.TbProductCase">
SELECT id,product_id productId,case_company caseCompany,case_introduction caseIntroduction,case_sort caseSort
from tb_product_case
where del_flag=0 and id=#{id}
</select>
<insert id="addProduct" parameterType="com.bonus.business.domain.TbProduct" keyProperty="id" useGeneratedKeys="true" > <insert id="addProduct" parameterType="com.bonus.business.domain.TbProduct" keyProperty="id" useGeneratedKeys="true" >
insert into tb_product insert into tb_product
@ -158,7 +163,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteTbProductByIds" parameterType="String"> <delete id="deleteTbProductByIds" parameterType="String">
delete from tb_product where id in delete from tb_product where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
@ -177,4 +182,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</update> </update>
</mapper> </mapper>