|
@@ -351,10 +351,7 @@ public class KwsEnterpriseService {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_026);
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_026);
|
|
|
}
|
|
}
|
|
|
//校验统一社会信用代码
|
|
//校验统一社会信用代码
|
|
|
- KwsEnterprise kwsEnterprise1 = kwsEnterpriseDao.selectOne(new LambdaQueryWrapper<KwsEnterprise>()
|
|
|
|
|
- .eq(KwsEnterprise::getCreditCode, reqVo.getOrgCode())
|
|
|
|
|
- .eq(KwsEnterprise::getStatus, 0)
|
|
|
|
|
- .eq(KwsEnterprise::getDelFlag, Global.UN_DELETED));
|
|
|
|
|
|
|
+ KwsEnterprise kwsEnterprise1 = kwsEnterpriseDao.selectOne(new LambdaQueryWrapper<KwsEnterprise>().eq(KwsEnterprise::getCreditCode, reqVo.getOrgCode()).eq(KwsEnterprise::getStatus, 0).eq(KwsEnterprise::getDelFlag, Global.UN_DELETED));
|
|
|
if (Objects.nonNull(kwsEnterprise1) && !Objects.equals(kwsEnterprise1.getId(), reqVo.getEntId())) {
|
|
if (Objects.nonNull(kwsEnterprise1) && !Objects.equals(kwsEnterprise1.getId(), reqVo.getEntId())) {
|
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.ENT_CODE);
|
|
throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.ENT_CODE);
|
|
|
}
|
|
}
|
|
@@ -442,27 +439,23 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
/*2、存企业类型,一个企业可以有多个类型*/
|
|
/*2、存企业类型,一个企业可以有多个类型*/
|
|
|
List<KwsEntType> listByEntId = kwsEntTypeDao.findListByEntId(entId);
|
|
List<KwsEntType> listByEntId = kwsEntTypeDao.findListByEntId(entId);
|
|
|
- List<Integer> currentTypeList = new ArrayList<>();
|
|
|
|
|
if (CollectionUtils.isNotEmpty(listByEntId)) {
|
|
if (CollectionUtils.isNotEmpty(listByEntId)) {
|
|
|
- currentTypeList.addAll(listByEntId.stream().map(KwsEntType::getType).toList());
|
|
|
|
|
|
|
+ kwsEntTypeDao.deleteBatchIds(listByEntId.stream().map(KwsEntType::getId).collect(Collectors.toList()));
|
|
|
}
|
|
}
|
|
|
- Integer type = Integer.parseInt(reqVo.getEntTypes());//只能单选
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- if (!currentTypeList.contains(type)) {
|
|
|
|
|
- KwsEntType kwsEntType = new KwsEntType();
|
|
|
|
|
- kwsEntType.setEntId(entId);
|
|
|
|
|
- kwsEntType.setType(type);
|
|
|
|
|
- kwsEntType.setId(new IdWorker(1).nextId());
|
|
|
|
|
- kwsEntType.setStatus(ApprovalEnum.PROCESS.getCode());
|
|
|
|
|
- kwsEntType.setCreateBy(userId);
|
|
|
|
|
- kwsEntType.setCreateTime(date);
|
|
|
|
|
- kwsEntType.setUpdateBy(userId);
|
|
|
|
|
- kwsEntType.setUpdateTime(date);
|
|
|
|
|
- kwsEntType.setDelFlag(Global.NO);
|
|
|
|
|
- if (kwsEntTypeDao.insert(kwsEntType) <= 0) {
|
|
|
|
|
- throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ Integer type = Integer.parseInt(reqVo.getEntTypes());//只能单选
|
|
|
|
|
+ KwsEntType kwsEntType = new KwsEntType();
|
|
|
|
|
+ kwsEntType.setEntId(entId);
|
|
|
|
|
+ kwsEntType.setType(type);
|
|
|
|
|
+ kwsEntType.setId(new IdWorker(1).nextId());
|
|
|
|
|
+ kwsEntType.setStatus(ApprovalEnum.PROCESS.getCode());
|
|
|
|
|
+ kwsEntType.setCreateBy(userId);
|
|
|
|
|
+ kwsEntType.setCreateTime(date);
|
|
|
|
|
+ kwsEntType.setUpdateBy(userId);
|
|
|
|
|
+ kwsEntType.setUpdateTime(date);
|
|
|
|
|
+ kwsEntType.setDelFlag(Global.NO);
|
|
|
|
|
+ if (kwsEntTypeDao.insert(kwsEntType) <= 0) {
|
|
|
|
|
+ throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*3、存企业证书*/
|
|
/*3、存企业证书*/
|
|
@@ -1117,17 +1110,13 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
}
|
|
|
// kwsEnterprises = kwsEnterprises.stream().filter(item -> !entIds.contains(item.getId())).collect(Collectors.toList());
|
|
// kwsEnterprises = kwsEnterprises.stream().filter(item -> !entIds.contains(item.getId())).collect(Collectors.toList());
|
|
|
List<Long> longList = kwsEnterprises.stream().map(KwsEnterprise::getId).distinct().collect(Collectors.toList());
|
|
List<Long> longList = kwsEnterprises.stream().map(KwsEnterprise::getId).distinct().collect(Collectors.toList());
|
|
|
- List<Long> intersection = longList.stream()
|
|
|
|
|
- .filter(entIds::contains)
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<Long> intersection = longList.stream().filter(entIds::contains).collect(Collectors.toList());
|
|
|
kwsEnterprises = kwsEnterpriseDao.selectByKeys(intersection);
|
|
kwsEnterprises = kwsEnterpriseDao.selectByKeys(intersection);
|
|
|
} else {
|
|
} else {
|
|
|
//求交集数据
|
|
//求交集数据
|
|
|
List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, null);
|
|
List<Long> entIds = remoteSystemService.queryEntIdsByCode(accessSpecial, null);
|
|
|
List<Long> longList = kwsEnterprises.stream().map(KwsEnterprise::getId).distinct().collect(Collectors.toList());
|
|
List<Long> longList = kwsEnterprises.stream().map(KwsEnterprise::getId).distinct().collect(Collectors.toList());
|
|
|
- List<Long> intersection = longList.stream()
|
|
|
|
|
- .filter(entIds::contains)
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<Long> intersection = longList.stream().filter(entIds::contains).collect(Collectors.toList());
|
|
|
kwsEnterprises = kwsEnterpriseDao.selectByKeys(intersection);
|
|
kwsEnterprises = kwsEnterpriseDao.selectByKeys(intersection);
|
|
|
}
|
|
}
|
|
|
if (kwsEnterprises.size() < 1) {
|
|
if (kwsEnterprises.size() < 1) {
|
|
@@ -1473,8 +1462,8 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
}
|
|
|
Set<Long> entIds = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
Set<Long> entIds = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
|
//根据企业id查询企业信息
|
|
//根据企业id查询企业信息
|
|
|
- List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIds(entIds,req.getEntName());
|
|
|
|
|
- if (CollectionUtils.isEmpty(kwsEnterprises)){
|
|
|
|
|
|
|
+ List<KwsEnterprise> kwsEnterprises = kwsEnterpriseRepository.queryByEntIds(entIds, req.getEntName());
|
|
|
|
|
+ if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
|
return new EntInfoResp();
|
|
return new EntInfoResp();
|
|
|
}
|
|
}
|
|
|
//组装返回对象
|
|
//组装返回对象
|
|
@@ -1498,33 +1487,26 @@ public class KwsEnterpriseService {
|
|
|
if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
if (CollectionUtils.isEmpty(kwsEnterprises)) {
|
|
|
return new EntInfoResp();
|
|
return new EntInfoResp();
|
|
|
}
|
|
}
|
|
|
- Set<Long> entIds = kwsEnterprises.stream()
|
|
|
|
|
- .map(BaseModel::getId)
|
|
|
|
|
- .collect(Collectors.toSet());
|
|
|
|
|
|
|
+ Set<Long> entIds = kwsEnterprises.stream().map(BaseModel::getId).collect(Collectors.toSet());
|
|
|
//根据类型进行过滤
|
|
//根据类型进行过滤
|
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByEntIdsAndType(entIds, req.getEntType());
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeRepository.queryByEntIdsAndType(entIds, req.getEntType());
|
|
|
if (CollectionUtils.isEmpty(kwsEntTypes)) {
|
|
if (CollectionUtils.isEmpty(kwsEntTypes)) {
|
|
|
return new EntInfoResp();
|
|
return new EntInfoResp();
|
|
|
}
|
|
}
|
|
|
- Set<Long> entIdList = kwsEntTypes.stream()
|
|
|
|
|
- .map(KwsEntType::getEntId)
|
|
|
|
|
- .collect(Collectors.toSet());
|
|
|
|
|
|
|
+ Set<Long> entIdList = kwsEntTypes.stream().map(KwsEntType::getEntId).collect(Collectors.toSet());
|
|
|
//过滤类型表中包含的数据
|
|
//过滤类型表中包含的数据
|
|
|
- List<EntInfoResp.EntInfo> entInfos = kwsEnterprises.stream()
|
|
|
|
|
- .filter(x -> entIdList.contains(x.getId()))
|
|
|
|
|
- .map(k -> {
|
|
|
|
|
- EntInfoResp.EntInfo entInfoResp = new EntInfoResp.EntInfo();
|
|
|
|
|
- entInfoResp.setEntId(String.valueOf(k.getId()));
|
|
|
|
|
- entInfoResp.setEntName(k.getFirmName());
|
|
|
|
|
- return entInfoResp;
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<EntInfoResp.EntInfo> entInfos = kwsEnterprises.stream().filter(x -> entIdList.contains(x.getId())).map(k -> {
|
|
|
|
|
+ EntInfoResp.EntInfo entInfoResp = new EntInfoResp.EntInfo();
|
|
|
|
|
+ entInfoResp.setEntId(String.valueOf(k.getId()));
|
|
|
|
|
+ entInfoResp.setEntName(k.getFirmName());
|
|
|
|
|
+ return entInfoResp;
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
EntInfoResp entInfoResp = new EntInfoResp();
|
|
EntInfoResp entInfoResp = new EntInfoResp();
|
|
|
entInfoResp.setEntInfos(entInfos);
|
|
entInfoResp.setEntInfos(entInfos);
|
|
|
return entInfoResp;
|
|
return entInfoResp;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- *
|
|
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public EntFindInfoResp querySupOrProEnt() {
|
|
public EntFindInfoResp querySupOrProEnt() {
|
|
@@ -1542,7 +1524,7 @@ public class KwsEnterpriseService {
|
|
|
|
|
|
|
|
//查询当前供应商的子级企业
|
|
//查询当前供应商的子级企业
|
|
|
List<KwsEntDeptDto> subEntList = remoteSystemService.queryEntDeptByPid(entCacheResDto.getParentId());
|
|
List<KwsEntDeptDto> subEntList = remoteSystemService.queryEntDeptByPid(entCacheResDto.getParentId());
|
|
|
- if (CollectionUtils.isEmpty(subEntList)){
|
|
|
|
|
|
|
+ if (CollectionUtils.isEmpty(subEntList)) {
|
|
|
EntFindInfoVO entFindInfoVO = EntFindInfoVO.toPageResp(entCacheResDto);
|
|
EntFindInfoVO entFindInfoVO = EntFindInfoVO.toPageResp(entCacheResDto);
|
|
|
//子级为空,只返回父级供应商
|
|
//子级为空,只返回父级供应商
|
|
|
entFindInfoResp.setSupEntInfo(Lists.newArrayList(entFindInfoVO));
|
|
entFindInfoResp.setSupEntInfo(Lists.newArrayList(entFindInfoVO));
|
|
@@ -1562,7 +1544,6 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
-
|
|
|
|
|
* @return KwsEnterprise
|
|
* @return KwsEnterprise
|
|
|
* @desc: 放开接口
|
|
* @desc: 放开接口
|
|
|
* @author: czh
|
|
* @author: czh
|
|
@@ -1570,9 +1551,7 @@ public class KwsEnterpriseService {
|
|
|
*/
|
|
*/
|
|
|
public List<EntCacheResDto> queryKwsEnterpriseById() {
|
|
public List<EntCacheResDto> queryKwsEnterpriseById() {
|
|
|
//查询采购商企业信息
|
|
//查询采购商企业信息
|
|
|
- LambdaQueryWrapper<KwsEntType> queryWrapper = Wrappers.<KwsEntType>lambdaQuery()
|
|
|
|
|
- .eq(KwsEntType::getType, 2)
|
|
|
|
|
- .eq(KwsEntType::getDelFlag, 0);
|
|
|
|
|
|
|
+ LambdaQueryWrapper<KwsEntType> queryWrapper = Wrappers.<KwsEntType>lambdaQuery().eq(KwsEntType::getType, 2).eq(KwsEntType::getDelFlag, 0);
|
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeDao.selectList(queryWrapper);
|
|
List<KwsEntType> kwsEntTypes = kwsEntTypeDao.selectList(queryWrapper);
|
|
|
if (kwsEntTypes.isEmpty()) {
|
|
if (kwsEntTypes.isEmpty()) {
|
|
|
return new ArrayList<>();
|
|
return new ArrayList<>();
|
|
@@ -1583,7 +1562,7 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public EntInfoResp queryKwsEnterprise(EntInfoReq req) {
|
|
public EntInfoResp queryKwsEnterprise(EntInfoReq req) {
|
|
|
- log.info("查询企业信息请求参数:{}", JSON.toJSONString( req));
|
|
|
|
|
|
|
+ log.info("查询企业信息请求参数:{}", JSON.toJSONString(req));
|
|
|
return getInfoResp(req);
|
|
return getInfoResp(req);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1597,7 +1576,7 @@ public class KwsEnterpriseService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public List<EntBaseInfo> list() {
|
|
public List<EntBaseInfo> list() {
|
|
|
- List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectList(new LambdaQueryWrapper<KwsEnterprise>().eq(KwsEnterprise::getApproval, 1).eq(KwsEnterprise::getStatus, 0));
|
|
|
|
|
|
|
+ List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectList(new LambdaQueryWrapper<KwsEnterprise>().eq(KwsEnterprise::getPid, 0).eq(KwsEnterprise::getApproval, 1).eq(KwsEnterprise::getStatus, 0));
|
|
|
return kwsEnterprises.stream().map(d -> BeanUtils.toBean(d, EntBaseInfo.class)).collect(Collectors.toList());
|
|
return kwsEnterprises.stream().map(d -> BeanUtils.toBean(d, EntBaseInfo.class)).collect(Collectors.toList());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|