Merge #85 into master from cc_20260331_material_blacklist
fix:小程序门店物料黑名单接口 * cc_20260331_material_blacklist: (1 commits squashed) - fix:小程序门店物料黑名单接口 Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com> Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com> CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/85
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.cool.store.service.store;
|
||||
|
||||
import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest;
|
||||
import com.cool.store.vo.store.StoreMaterialBlacklistVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单服务
|
||||
* @author wangff
|
||||
* @date 2026-03-30
|
||||
*/
|
||||
public interface StoreMaterialBlacklistService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param request 查询请求
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageInfo<StoreMaterialBlacklistVO> pageByStoreId(StoreMaterialBlacklistQueryRequest request);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cool.store.service.store.impl;
|
||||
|
||||
import com.cool.store.dao.RegionDao;
|
||||
import com.cool.store.dao.StoreDao;
|
||||
import com.cool.store.dao.store.StoreMaterialBlacklistDAO;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.entity.store.StoreMaterialBlacklistDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest;
|
||||
import com.cool.store.service.dict.impl.DictService;
|
||||
import com.cool.store.service.store.StoreMaterialBlacklistService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.vo.store.StoreMaterialBlacklistVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单服务实现
|
||||
* @author wangff
|
||||
* @date 2026-03-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class StoreMaterialBlacklistServiceImpl implements StoreMaterialBlacklistService {
|
||||
|
||||
private final StoreMaterialBlacklistDAO storeMaterialBlacklistDAO;
|
||||
private final StoreDao storeDao;
|
||||
private final RegionDao regionDao;
|
||||
private final DictService dictService;
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<StoreMaterialBlacklistVO> pageByStoreId(StoreMaterialBlacklistQueryRequest request) {
|
||||
StoreDO storeDO = storeDao.getByStoreId(request.getStoreId());
|
||||
if (Objects.isNull(storeDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.STORE_NOT_FIND);
|
||||
}
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<StoreMaterialBlacklistDO> list = storeMaterialBlacklistDAO.getByStoreId(request.getStoreId());
|
||||
PageInfo<StoreMaterialBlacklistDO> page = new PageInfo<>(list);
|
||||
|
||||
PageInfo<StoreMaterialBlacklistVO> result = BeanUtil.toPage(page, StoreMaterialBlacklistVO.class);
|
||||
RegionDO branch = regionDao.getRegionById(storeDO.getBranch());
|
||||
for (StoreMaterialBlacklistVO vo : result.getList()) {
|
||||
vo.setStoreNum(storeDO.getStoreNum());
|
||||
vo.setStoreName(storeDO.getStoreName());
|
||||
if (Objects.nonNull(branch)) {
|
||||
vo.setBranchName(branch.getName());
|
||||
}
|
||||
}
|
||||
dictService.fillDictField(result.getList());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user