|
@ -15,6 +15,7 @@ import com.epmet.commons.tools.utils.*; |
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
import com.epmet.constants.ImportTaskConstants; |
|
|
import com.epmet.dao.IcNeighborHoodPropertyDao; |
|
|
import com.epmet.dao.IcNeighborHoodPropertyDao; |
|
|
import com.epmet.dao.IcPropertyManagementDao; |
|
|
import com.epmet.dao.IcPropertyManagementDao; |
|
|
|
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
import com.epmet.dto.IcNeighborHoodDTO; |
|
|
import com.epmet.dto.IcNeighborHoodDTO; |
|
|
import com.epmet.dto.IcPropertyManagementDTO; |
|
|
import com.epmet.dto.IcPropertyManagementDTO; |
|
|
import com.epmet.dto.form.IcPropertyManagementFormDTO; |
|
|
import com.epmet.dto.form.IcPropertyManagementFormDTO; |
|
@ -27,6 +28,7 @@ import com.epmet.excel.handler.IcPropertyManagementImportListener; |
|
|
import com.epmet.excel.yt.IcPropertyManagementImportExcelData; |
|
|
import com.epmet.excel.yt.IcPropertyManagementImportExcelData; |
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; |
|
|
import com.epmet.feign.OssFeignClient; |
|
|
import com.epmet.feign.OssFeignClient; |
|
|
|
|
|
import com.epmet.service.CustomerAgencyService; |
|
|
import com.epmet.service.PropertyManagementService; |
|
|
import com.epmet.service.PropertyManagementService; |
|
|
import com.epmet.utils.ImportTaskUtils; |
|
|
import com.epmet.utils.ImportTaskUtils; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
@ -66,6 +68,9 @@ public class PropertyManagementServiceImpl implements PropertyManagementService |
|
|
private IcPropertyManagementDao icPropertyManagementDao; |
|
|
private IcPropertyManagementDao icPropertyManagementDao; |
|
|
@Resource |
|
|
@Resource |
|
|
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; |
|
|
private IcNeighborHoodPropertyDao icNeighborHoodPropertyDao; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private CustomerAgencyService customerAgencyService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -103,11 +108,25 @@ public class PropertyManagementServiceImpl implements PropertyManagementService |
|
|
// 物业名字平台内唯一
|
|
|
// 物业名字平台内唯一
|
|
|
// 如果输入的物业名字已经存在,直接返回物业id
|
|
|
// 如果输入的物业名字已经存在,直接返回物业id
|
|
|
formDTO.setName(formDTO.getName().trim()); |
|
|
formDTO.setName(formDTO.getName().trim()); |
|
|
IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(formDTO.getCustomerId(), formDTO.getName(), null); |
|
|
|
|
|
if (null != entity) { |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "物业名称已存在", "物业名称已存在"); |
|
|
|
|
|
} |
|
|
// IcPropertyManagementEntity entity = icPropertyManagementDao.selectByName(formDTO.getCustomerId(), formDTO.getName(), null);
|
|
|
|
|
|
// if (null != entity) {
|
|
|
|
|
|
// throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "物业名称已存在", "物业名称已存在");
|
|
|
|
|
|
// }
|
|
|
IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); |
|
|
IcPropertyManagementEntity icPropertyManagementEntity = ConvertUtils.sourceToTarget(formDTO, IcPropertyManagementEntity.class); |
|
|
|
|
|
|
|
|
|
|
|
if(StringUtils.isNotEmpty(formDTO.getAgencyId())) { |
|
|
|
|
|
CustomerAgencyDTO agency = customerAgencyService.get(formDTO.getAgencyId()); |
|
|
|
|
|
if(agency != null) { |
|
|
|
|
|
icPropertyManagementEntity.setLevel(agency.getLevel()); |
|
|
|
|
|
icPropertyManagementEntity.setAgencyName(agency.getOrganizationName()); |
|
|
|
|
|
icPropertyManagementEntity.setAgencyPid(agency.getPid()); |
|
|
|
|
|
icPropertyManagementEntity.setAgencyPids(agency.getPids()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
icPropertyManagementDao.insert(icPropertyManagementEntity); |
|
|
icPropertyManagementDao.insert(icPropertyManagementEntity); |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getNeighborHoodIdList())) { |
|
|
if (CollectionUtils.isNotEmpty(formDTO.getNeighborHoodIdList())) { |
|
|
formDTO.getNeighborHoodIdList().forEach(neighborHoodId -> { |
|
|
formDTO.getNeighborHoodIdList().forEach(neighborHoodId -> { |
|
@ -255,6 +274,10 @@ public class PropertyManagementServiceImpl implements PropertyManagementService |
|
|
result.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR); |
|
|
result.setNeighborHoodNames(CollectionUtils.isNotEmpty(neighborHoodList) ? StringUtils.join(neighborHoodNames, StrConstant.COMMA_ZH) : StrConstant.EPMETY_STR); |
|
|
result.setNeighborHoodList(neighborHoodList); |
|
|
result.setNeighborHoodList(neighborHoodList); |
|
|
result.setTotalNeighborHood(CollectionUtils.isNotEmpty(neighborHoodList)?neighborHoodList.size():NumConstant.ZERO); |
|
|
result.setTotalNeighborHood(CollectionUtils.isNotEmpty(neighborHoodList)?neighborHoodList.size():NumConstant.ZERO); |
|
|
|
|
|
|
|
|
|
|
|
if(!"community".equals(staffInfoCacheResult.getLevel()) && StringUtils.isNotEmpty(result.getAgencyName())) { |
|
|
|
|
|
result.setName(result.getName() + "("+ result.getAgencyName() +")"); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
return new PageData<>(list, pageInfo.getTotal(), pageSize); |
|
|
return new PageData<>(list, pageInfo.getTotal(), pageSize); |
|
|
} |
|
|
} |
|
|