物料后端和大屏接口

This commit is contained in:
方亮 2025-09-11 13:48:11 +08:00
parent 6680145c44
commit e1b8b00748
3 changed files with 29 additions and 21 deletions

View File

@ -1,21 +1,24 @@
package com.bonus.business.controller; package com.bonus.business.controller;
import com.bonus.business.domain.TbProduct;
import com.bonus.business.domain.TbPromotionMaterial; import com.bonus.business.domain.TbPromotionMaterial;
import com.bonus.business.service.MaterialScreenService; import com.bonus.business.service.MaterialScreenService;
import com.bonus.business.service.ProductScreenService; import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
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;
import java.util.ArrayList;
import java.util.List;
/** /**
* 产品大屏 * 物料大屏
*/ */
@RestController @RestController
@RequestMapping("/screen/material/") @RequestMapping("/screen/material/")
public class MaterialScreenController { public class MaterialScreenController extends BaseController {
@Autowired @Autowired
private MaterialScreenService service; private MaterialScreenService service;
@ -26,8 +29,15 @@ public class MaterialScreenController {
*/ */
@PostMapping("/getMaterialList") @PostMapping("/getMaterialList")
public AjaxResult getMaterialList(TbPromotionMaterial o ){ public TableDataInfo getMaterialList(TbPromotionMaterial o){
return service.getMaterialList(o) ; try {
startPage();
List<TbPromotionMaterial> list = service.getMaterialList(o);
return getDataTable(list);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return getDataTable(new ArrayList<>());
}
} }
} }

View File

@ -4,12 +4,14 @@ import com.bonus.business.domain.TbProduct;
import com.bonus.business.domain.TbPromotionMaterial; import com.bonus.business.domain.TbPromotionMaterial;
import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.core.domain.AjaxResult;
import java.util.List;
public interface MaterialScreenService { public interface MaterialScreenService {
/** /**
* 查询展示中心 * 查询展示中心
* @param o * @param o
* @return * @return
*/ */
AjaxResult getMaterialList(TbPromotionMaterial o); List<TbPromotionMaterial> getMaterialList(TbPromotionMaterial o);
} }

View File

@ -32,21 +32,17 @@ public class MaterialScreenServiceImpl implements MaterialScreenService {
@Override @Override
public AjaxResult getMaterialList(TbPromotionMaterial o) { public List<TbPromotionMaterial> getMaterialList(TbPromotionMaterial o) {
try{
List<TbPromotionMaterial> list = mapper.getMaterialList(o); List<TbPromotionMaterial> list = mapper.getMaterialList(o);
if(StringUtils.isNotEmpty(list)){ if (StringUtils.isNotEmpty(list)) {
list.forEach(vo->{ list.forEach(vo -> {
vo.setImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getImage()); vo.setImage(minioConfig.getUrl() + "/" + minioConfig.getBucketName() + vo.getImage());
vo.setFilePath(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getFilePath()); vo.setFilePath(minioConfig.getUrl() + "/" + minioConfig.getBucketName() + vo.getFilePath());
}); });
}
return AjaxResult.success(list);
}catch (Exception e){
log.error(e.toString());
} }
return AjaxResult.success(new ArrayList<TbPromotionMaterial>()); return list;
} }
} }