Merge #146 into master from cc_20260520_declare_goods
fix:新增获取门店报货信息接口 * cc_20260520_declare_goods: (2 commits squashed) - fix:新增根据门店编码列表获取门店报货信息接口 - 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/146
This commit is contained in:
@@ -7,6 +7,7 @@ import com.cool.store.dto.store.StoreUserDTO;
|
||||
import com.cool.store.dto.store.StoreUserPositionDTO;
|
||||
import com.cool.store.request.store.StoreListRequest;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.vo.store.StoreDeclareGoodsVO;
|
||||
import com.cool.store.vo.store.StoreListVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
@@ -62,4 +63,9 @@ public interface StoreService {
|
||||
*/
|
||||
List<StoreUserDTO> getStoreUserPositionList(String storeId, String userName);
|
||||
|
||||
/**
|
||||
* 根据门店编码列表获取门店报货信息
|
||||
*/
|
||||
List<StoreDeclareGoodsVO> getStoreDeclareGoodsByStoreNums(List<String> storeNumList);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.cool.store.dao.SysRoleDao;
|
||||
import com.cool.store.dto.StoreDTO;
|
||||
import com.cool.store.dto.UserSimpleDTO;
|
||||
import com.cool.store.entity.*;
|
||||
import com.cool.store.entity.store.StoreExtendInfoDO;
|
||||
import com.cool.store.entity.store.StoreMasterSignerInfoDO;
|
||||
import com.cool.store.enums.*;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
@@ -24,10 +25,12 @@ import com.cool.store.request.store.StoreListRequest;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.cool.store.service.StoreService;
|
||||
import com.cool.store.service.UserAuthMappingService;
|
||||
import com.cool.store.service.dict.impl.DictService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.utils.GeoMapUtil;
|
||||
import com.cool.store.utils.poi.constant.Constants;
|
||||
import com.cool.store.vo.SysRoleVO;
|
||||
import com.cool.store.vo.store.StoreDeclareGoodsVO;
|
||||
import com.cool.store.vo.store.StoreListVO;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
@@ -81,6 +84,8 @@ public class StoreServiceImpl implements StoreService {
|
||||
StoreMasterSignerInfoDAO storeMasterSignerInfoDAO;
|
||||
@Resource
|
||||
EnterpriseUserRoleMapper enterpriseUserRoleMapper;
|
||||
@Resource
|
||||
DictService dictService;
|
||||
|
||||
@Override
|
||||
public PageInfo<StoreDTO> getStoreExtendFieldInfo(Integer pageSize, Integer pageNum, Boolean queryOperations) {
|
||||
@@ -689,4 +694,49 @@ public class StoreServiceImpl implements StoreService {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoreDeclareGoodsVO> getStoreDeclareGoodsByStoreNums(List<String> storeNumList) {
|
||||
if (CollectionUtils.isEmpty(storeNumList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (storeNumList.size() > 100) {
|
||||
throw new ServiceException(ErrorCodeEnum.ERROR_MESSAGE, "单次最多查询100条门店数据");
|
||||
}
|
||||
List<StoreDO> storeList = storeDao.getStoreNumByStoreCodes(storeNumList);
|
||||
if (CollectionUtils.isEmpty(storeList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> storeIds = CollStreamUtil.toList(storeList, StoreDO::getStoreId);
|
||||
Map<String, StoreExtendInfoDO> extendInfoMap = storeDao.getExtendInfoMap(storeIds);
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
List<StoreDeclareGoodsVO> list = storeList.stream().map(store -> {
|
||||
StoreDeclareGoodsVO vo = new StoreDeclareGoodsVO();
|
||||
vo.setStoreNum(store.getStoreNum());
|
||||
vo.setStoreName(store.getStoreName());
|
||||
vo.setDeclareGoodsType(store.getDeclareGoodsType());
|
||||
// 将 JSON 字符串转换为 List 对象
|
||||
if (StringUtils.isNotBlank(store.getDeclareGoodsDate())) {
|
||||
try {
|
||||
List<DeclareGoodsDateDTO> dateList = objectMapper.readValue(
|
||||
store.getDeclareGoodsDate(),
|
||||
new TypeReference<List<DeclareGoodsDateDTO>>() {}
|
||||
);
|
||||
vo.setDeclareGoodsDateList(dateList);
|
||||
} catch (Exception e) {
|
||||
log.warn("解析报送货日期JSON失败, storeNum={}, declareGoodsDate={}", store.getStoreNum(), store.getDeclareGoodsDate(), e);
|
||||
vo.setDeclareGoodsDateList(new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
vo.setDeclareGoodsDateList(Collections.emptyList());
|
||||
}
|
||||
StoreExtendInfoDO extendInfoDO = extendInfoMap.get(store.getStoreId());
|
||||
if (Objects.nonNull(extendInfoDO)) {
|
||||
vo.setBusinessTypeCode(extendInfoDO.getBusinessType());
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
dictService.fillDictField(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user