|
@@ -22,6 +22,7 @@ import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -297,6 +298,36 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getOwnerRelateCompany(CompanyVO companyVO) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", companyVO.getToken()));
|
|
|
+ List<Integer> ides = new ArrayList<>();
|
|
|
+ ides.add(-1);
|
|
|
+ if(null == currentUser){
|
|
|
+ msg.setError("当前用户不存在或者不存在");
|
|
|
+ return msg;
|
|
|
+ }else{
|
|
|
+ Company company = companyMapper.selectById(companyVO.getId());
|
|
|
+ if(Constant.PRODUCER_COMPANY == company.getCompanyType()){
|
|
|
+ //生产方公司,返回关联的资产方公司列表
|
|
|
+ ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("custom_id", company.getId()))
|
|
|
+ .stream()
|
|
|
+ .map(AssetCustomCompany::getAssertId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ msg.data = companyMapper.selectList(new QueryWrapper<Company>().in("id",ides));
|
|
|
+ }else if(Constant.ASSETS_COMPANY == company.getCompanyType()){
|
|
|
+ //资产方公司,返回关联的生产方公司列表
|
|
|
+ ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()))
|
|
|
+ .stream()
|
|
|
+ .map(AssetCustomCompany::getCustomId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ msg.data = companyMapper.selectList(new QueryWrapper<Company>().in("id",ides));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public HttpRespMsg deleteById(Integer id) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|