|
|
|
@ -1,25 +1,30 @@
|
|
|
|
package cn.iocoder.yudao.module.system.service.dustcompanyinfo;
|
|
|
|
package cn.iocoder.yudao.module.system.service.dustcompanyinfo;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dustdustinfo.vo.DustDustinfoRespVO;
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dustdustinfo.vo.DustDustinfoSaveReqVO;
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dustdustinfo.vo.DustDustinfoSaveReqVO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dustdustinfo.DustDustinfoDO;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dusttype.DustTypeDO;
|
|
|
|
import cn.iocoder.yudao.module.system.service.dustdustinfo.DustDustinfoService;
|
|
|
|
import cn.iocoder.yudao.module.system.service.dustdustinfo.DustDustinfoService;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.service.dusttype.DustTypeService;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
import jakarta.annotation.Resource;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dustcompanyinfo.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dustcompanyinfo.vo.*;
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dustcompanyinfo.DustCompanyinfoDO;
|
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dustcompanyinfo.DustCompanyinfoDO;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.dal.mysql.dustcompanyinfo.DustCompanyinfoMapper;
|
|
|
|
import cn.iocoder.yudao.module.system.dal.mysql.dustcompanyinfo.DustCompanyinfoMapper;
|
|
|
|
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
|
|
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -36,6 +41,8 @@ public class DustCompanyinfoServiceImpl implements DustCompanyinfoService {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DustDustinfoService dustDustinfoService;
|
|
|
|
private DustDustinfoService dustDustinfoService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private DustTypeService dustTypeService;
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public String createDustCompanyinfo(DustCompanyinfoSaveReqVO createReqVO) {
|
|
|
|
public String createDustCompanyinfo(DustCompanyinfoSaveReqVO createReqVO) {
|
|
|
|
@ -104,11 +111,44 @@ public class DustCompanyinfoServiceImpl implements DustCompanyinfoService {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public String getDataIdByTenantId(Long tenantId) {
|
|
|
|
public String getDataIdByTenantId(Long tenantId) {
|
|
|
|
DustCompanyinfoDO selectedOne = dustCompanyinfoMapper.selectOne("tenantId", tenantId);
|
|
|
|
AtomicReference<DustCompanyinfoDO> selectedOne = new AtomicReference<>();
|
|
|
|
if (selectedOne == null || selectedOne.getDeleted()) {
|
|
|
|
return TenantUtils.executeIgnore(() -> {
|
|
|
|
return null;
|
|
|
|
selectedOne.set(dustCompanyinfoMapper.selectOne("tenant_id", tenantId));
|
|
|
|
}
|
|
|
|
if (selectedOne.get() == null || selectedOne.get().getDeleted()) {
|
|
|
|
return selectedOne.getDataId();
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return selectedOne.get().getDataId();
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public DustCompanyinfoRespVO getCompanyinfoByTenantId(Long tenantId){
|
|
|
|
|
|
|
|
return TenantUtils.executeIgnore(() -> {
|
|
|
|
|
|
|
|
//查询企业基础信息
|
|
|
|
|
|
|
|
DustCompanyinfoDO dustCompanyinfo = dustCompanyinfoMapper.selectOne("tenant_id",tenantId);
|
|
|
|
|
|
|
|
if (ObjectUtil.isNull(dustCompanyinfo)) return null;
|
|
|
|
|
|
|
|
DustCompanyinfoRespVO respVO = BeanUtils.toBean(dustCompanyinfo, DustCompanyinfoRespVO.class);
|
|
|
|
|
|
|
|
//根据id查询企业涉尘信息
|
|
|
|
|
|
|
|
DustDustinfoDO dustDustinfo = dustDustinfoService.getDustDustinfo(dustCompanyinfo.getId());
|
|
|
|
|
|
|
|
List<String> list = Arrays.stream(dustDustinfo.getDustTechnology().split(",")).toList();
|
|
|
|
|
|
|
|
DustDustinfoRespVO dustinfoRespVO = BeanUtils.toBean(dustDustinfo, DustDustinfoRespVO.class);
|
|
|
|
|
|
|
|
dustinfoRespVO.setDustTechnology(list);
|
|
|
|
|
|
|
|
String fullDustName="";
|
|
|
|
|
|
|
|
if (dustDustinfo.getDustType() != null ){
|
|
|
|
|
|
|
|
DustTypeDO dustType = dustTypeService.getDustType(dustDustinfo.getDustType());
|
|
|
|
|
|
|
|
if (dustType != null && dustType.getName()!=null){
|
|
|
|
|
|
|
|
fullDustName = dustType.getName();
|
|
|
|
|
|
|
|
DustTypeDO dustType1 = dustTypeService.getDustType(dustType.getParentId());
|
|
|
|
|
|
|
|
if (dustType1!=null && dustType1.getName()!=null){
|
|
|
|
|
|
|
|
fullDustName = dustType1.getName()+"/"+fullDustName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
dustinfoRespVO.setDustTypeName(fullDustName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
respVO.setDustDustinfo(dustinfoRespVO);
|
|
|
|
|
|
|
|
return respVO;
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|