|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
+import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
@@ -91,10 +92,10 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
public Boolean insertByBo(SupplierAuthorizeBo bo) {
|
|
|
// 1. 校验入参
|
|
|
if (bo.getCategoryIds() == null || bo.getCategoryIds().isEmpty()) {
|
|
|
- throw new RuntimeException("品类ID列表不能为空");
|
|
|
+ throw new ServiceException("品类ID列表不能为空");
|
|
|
}
|
|
|
if (bo.getQualificationFiles() == null) {
|
|
|
- throw new RuntimeException("资质文件不能为空");
|
|
|
+ throw new ServiceException("资质文件不能为空");
|
|
|
}
|
|
|
Date endDate = bo.getQualificationFiles().stream()
|
|
|
.filter(file -> file.getEndTime() != null)
|
|
|
@@ -107,11 +108,11 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
for (Long categoryId : categoryIds) {
|
|
|
// 核心变更:从Redis生成唯一授权单号(替代数据库查询)
|
|
|
String authorizeNo =generateAuthorizeNo();
|
|
|
-
|
|
|
// 构建主表数据
|
|
|
SupplierAuthorize save = new SupplierAuthorize();
|
|
|
BeanUtils.copyProperties(bo, save);
|
|
|
save.setAuthorizeNo(authorizeNo);
|
|
|
+ save.setBrandRegistrant(bo.getBrandRegistrant());
|
|
|
save.setCategoryId(categoryId);
|
|
|
save.setAuthorizationEndTime(endDate);
|
|
|
save.setAuthorizedStatus("0");
|
|
|
@@ -569,7 +570,7 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<SupplierAuthorizeVo> srmgetAuthorizeDetailList(SupplierAuthorizeBo bo) {
|
|
|
+ public TableDataInfo<SupplierAuthorizeVo> srmgetAuthorizeDetailList(SupplierAuthorizeBo bo, PageQuery pageQuery) {
|
|
|
LambdaQueryWrapper<SupplierAuthorize> lqw = new LambdaQueryWrapper<>();
|
|
|
lqw.eq(SupplierAuthorize::getSupplierId, bo.getSupplierId());
|
|
|
|
|
|
@@ -578,30 +579,28 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
lqw.and(wrapper -> {
|
|
|
// 1. 省份查询
|
|
|
if (ObjectUtil.isNotEmpty(bo.getProvince())) {
|
|
|
- Long provinceId = remoteAddressAreaService.getIdsByName(bo.getProvince());
|
|
|
- if (provinceId != null) {
|
|
|
- wrapper.like(SupplierAuthorize::getAuthorizedArea, provinceId);
|
|
|
- }
|
|
|
+ wrapper.apply("FIND_IN_SET({0}, authorized_area)", bo.getProvince());
|
|
|
}
|
|
|
// 2. 城市查询(和省份用AND关联,必须同时满足)
|
|
|
if (ObjectUtil.isNotEmpty(bo.getCity())) {
|
|
|
- Long cityId = remoteAddressAreaService.getIdsByName(bo.getCity());
|
|
|
- if (cityId != null) {
|
|
|
- wrapper.like(SupplierAuthorize::getAuthorizedArea, cityId);
|
|
|
- }
|
|
|
+ wrapper.apply("FIND_IN_SET({0}, authorized_area)", bo.getCity());
|
|
|
+ }
|
|
|
+ //3.品牌名称
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getBrandName())) {
|
|
|
+ wrapper.eq(SupplierAuthorize::getBrandName,bo.getBrandName());
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- List<SupplierAuthorizeVo> supplierAuthorizeVos = baseMapper.selectVoList(lqw);
|
|
|
- setSupplierNames(supplierAuthorizeVos);
|
|
|
+ Page<SupplierAuthorizeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ List<SupplierAuthorizeVo> records = result.getRecords();
|
|
|
+ setSupplierNames(records);
|
|
|
|
|
|
// 使用AddressAreaService查询地区信息
|
|
|
- setSupplyAreaInfo(supplierAuthorizeVos);
|
|
|
+ setSupplyAreaInfo(records);
|
|
|
|
|
|
//一级 二级 三级 品目
|
|
|
- Map<Long,Long> categoryMap = supplierAuthorizeVos.stream()
|
|
|
+ Map<Long,Long> categoryMap = records.stream()
|
|
|
.filter(item -> item.getId() != null && item.getCategoryId() != null)
|
|
|
.collect(Collectors.toMap(
|
|
|
SupplierAuthorizeVo::getId,
|
|
|
@@ -610,12 +609,12 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
|
|
|
Map<Long, Map<String, String>> categorysMap = remoteCategoryService.getallCategoryNameById(categoryMap);
|
|
|
|
|
|
- supplierAuthorizeVos.forEach(item -> {
|
|
|
+ records.forEach(item -> {
|
|
|
Map<String, String> stringStringMap = categorysMap.get(item.getId());
|
|
|
item.setCategorysMap(stringStringMap);
|
|
|
});
|
|
|
|
|
|
- return supplierAuthorizeVos;
|
|
|
+ return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
/**
|