|
|
@@ -113,6 +113,7 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
BeanUtils.copyProperties(bo, save);
|
|
|
save.setAuthorizeNo(authorizeNo);
|
|
|
save.setBrandRegistrant(bo.getBrandRegistrant());
|
|
|
+ save.setBrandNo(bo.getBrandNo());
|
|
|
save.setCategoryId(categoryId);
|
|
|
save.setAuthorizationEndTime(endDate);
|
|
|
save.setAuthorizedStatus("0");
|
|
|
@@ -146,6 +147,7 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
* @return 是否修改成功
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateByBo(SupplierAuthorizeBo bo) {
|
|
|
Date endDate = bo.getQualificationFiles().stream()
|
|
|
.filter(file -> file.getEndTime() != null)
|
|
|
@@ -360,7 +362,7 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
public SupplierAuthorizeVo getBrandAuthorizeDetail(Long id) {
|
|
|
SupplierAuthorizeVo supplierAuthorizeVo = baseMapper.selectVoById(id);
|
|
|
if (supplierAuthorizeVo == null){
|
|
|
- throw new RuntimeException("未找到授权信息");
|
|
|
+ throw new ServiceException("未找到授权信息");
|
|
|
}
|
|
|
|
|
|
setSupplyAreaInfoForSingle(supplierAuthorizeVo);
|
|
|
@@ -387,6 +389,31 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
return supplierAuthorizeVo;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean exam(SupplierAuthorizeBo bo) {
|
|
|
+ // 1. 参数校验
|
|
|
+ if (bo.getId() == null) {
|
|
|
+ throw new ServiceException("授权单 ID 不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(bo.getAuthorizedStatus())) {
|
|
|
+ throw new ServiceException("审核状态不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 检查授权单是否存在
|
|
|
+ SupplierAuthorize exist = baseMapper.selectById(bo.getId());
|
|
|
+ if (exist == null) {
|
|
|
+ throw new ServiceException("授权单不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 3. 执行更新
|
|
|
+ boolean update = lambdaUpdate()
|
|
|
+ .eq(SupplierAuthorize::getId, bo.getId())
|
|
|
+ .set(SupplierAuthorize::getAuthorizedStatus, bo.getAuthorizedStatus())
|
|
|
+ .set(SupplierAuthorize::getReviewFeedback, bo.getReviewFeedback())
|
|
|
+ .update();
|
|
|
+ return update;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private Map<Long, String> supplierBrandMap(List<Long> ids){
|
|
|
List<SupplierAuthorize> authorizeList = baseMapper.selectList(
|
|
|
@@ -617,6 +644,56 @@ public class SupplierAuthorizeServiceImpl extends ServiceImpl<SupplierAuthorize
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public TableDataInfo<SupplierAuthorizeVo> scmgetAuthorizeDetailList(SupplierAuthorizeBo bo, PageQuery pageQuery) {
|
|
|
+ LambdaQueryWrapper<SupplierAuthorize> lqw = new LambdaQueryWrapper<>();
|
|
|
+ // 核心:省/市查询条件(合并字段用AND匹配)
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getProvince()) || ObjectUtil.isNotEmpty(bo.getCity())) {
|
|
|
+ lqw.and(wrapper -> {
|
|
|
+ // 1. 省份查询
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getProvince())) {
|
|
|
+ wrapper.apply("FIND_IN_SET({0}, authorized_area)", bo.getProvince());
|
|
|
+ }
|
|
|
+ // 2. 城市查询(和省份用AND关联,必须同时满足)
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getCity())) {
|
|
|
+ wrapper.apply("FIND_IN_SET({0}, authorized_area)", bo.getCity());
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //3.品牌名称
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getBrandName())) {
|
|
|
+ lqw.eq(SupplierAuthorize::getBrandName,bo.getBrandName());
|
|
|
+ }
|
|
|
+ if (ObjectUtil.isNotEmpty(bo.getBrandNo())){
|
|
|
+ lqw.eq(SupplierAuthorize::getBrandNo,bo.getBrandNo());
|
|
|
+ }
|
|
|
+ lqw.orderByDesc(SupplierAuthorize::getCreateTime);
|
|
|
+ Page<SupplierAuthorizeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ List<SupplierAuthorizeVo> records = result.getRecords();
|
|
|
+ setSupplierNames(records);
|
|
|
+
|
|
|
+ // 使用AddressAreaService查询地区信息
|
|
|
+ setSupplyAreaInfo(records);
|
|
|
+
|
|
|
+ //一级 二级 三级 品目
|
|
|
+ Map<Long,Long> categoryMap = records.stream()
|
|
|
+ .filter(item -> item.getId() != null && item.getCategoryId() != null)
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ SupplierAuthorizeVo::getId,
|
|
|
+ item ->item.getCategoryId()
|
|
|
+ ));
|
|
|
+
|
|
|
+ Map<Long, Map<String, String>> categorysMap = remoteCategoryService.getallCategoryNameById(categoryMap);
|
|
|
+
|
|
|
+ records.forEach(item -> {
|
|
|
+ Map<String, String> stringStringMap = categorysMap.get(item.getId());
|
|
|
+ item.setCategorysMap(stringStringMap);
|
|
|
+ });
|
|
|
+
|
|
|
+ return TableDataInfo.build(result);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 使用AddressAreaService设置单个供应区域信息(省和市)- 优化版本
|
|
|
*
|