|
@@ -3,6 +3,7 @@ package com.nokia.financeapi.service.house;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.nokia.financeapi.common.R;
|
|
|
+import com.nokia.financeapi.config.HousePages;
|
|
|
import com.nokia.financeapi.dao.house.AreaDao;
|
|
|
import com.nokia.financeapi.dao.house.HouseResourceMapMapper;
|
|
|
import com.nokia.financeapi.pojo.dto.GetBuildingAreaStatDto;
|
|
@@ -38,11 +39,14 @@ public class HouseResourceMapService {
|
|
|
private final HouseResourceMapMapper houseResourceMapMapper;
|
|
|
private final AreaDao areaDao;
|
|
|
private final FileService fileService;
|
|
|
+ private final HousePages housePages;
|
|
|
|
|
|
- public HouseResourceMapService(HouseResourceMapMapper houseResourceMapMapper, AreaDao areaDao, FileService fileService) {
|
|
|
+ public HouseResourceMapService(HouseResourceMapMapper houseResourceMapMapper, AreaDao areaDao, FileService fileService,
|
|
|
+ HousePages housePages) {
|
|
|
this.houseResourceMapMapper = houseResourceMapMapper;
|
|
|
this.areaDao = areaDao;
|
|
|
this.fileService = fileService;
|
|
|
+ this.housePages = housePages;
|
|
|
}
|
|
|
|
|
|
public R<GetBuildingAreaStatVo> getBuildingAreaStat(GetBuildingAreaStatDto dto) {
|
|
@@ -107,7 +111,7 @@ public class HouseResourceMapService {
|
|
|
return parentMap;
|
|
|
}
|
|
|
|
|
|
- public R<List<GetBuildingMapVo>> getBuildingMap(GetBuildingMapDto dto) {
|
|
|
+ public R<List<GetBuildingMapVo>> getBuildingMap(GetBuildingMapDto dto, String token) {
|
|
|
Integer endDate = dto.getEndDate();
|
|
|
// 账期为空则取最新的账期
|
|
|
if (dto.getEndDate() == null) {
|
|
@@ -126,26 +130,29 @@ public class HouseResourceMapService {
|
|
|
if ("省本部".equals(dto.getCity())) {
|
|
|
List<GetBuildingMapVo> vo = houseResourceMapMapper.getSbbBuildings(dto);
|
|
|
vo.forEach(t -> {
|
|
|
- String buildingImg = fileService.getBucket()
|
|
|
- + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
|
|
|
+ String buildingImg = getBuildingImg(t.getBuildingImg());
|
|
|
t.setBuildingImg(buildingImg);
|
|
|
+ String siteUrl = getSiteUrl(token, t.getSiteNum());
|
|
|
+ t.setSiteUrl(siteUrl);
|
|
|
});
|
|
|
return R.ok(vo);
|
|
|
}
|
|
|
List<GetBuildingMapVo> vo = houseResourceMapMapper.getBuildingByDistrict(dto);
|
|
|
vo.forEach(t -> {
|
|
|
- String buildingImg = fileService.getBucket()
|
|
|
- + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
|
|
|
+ String buildingImg = getBuildingImg(t.getBuildingImg());
|
|
|
t.setBuildingImg(buildingImg);
|
|
|
+ String siteUrl = getSiteUrl(token, t.getSiteNum());
|
|
|
+ t.setSiteUrl(siteUrl);
|
|
|
});
|
|
|
return R.ok(vo);
|
|
|
}
|
|
|
// 查询坐标范围内的建筑
|
|
|
List<GetBuildingMapVo> vo = houseResourceMapMapper.getBuildingByCoordinate(dto);
|
|
|
vo.forEach(t -> {
|
|
|
- String buildingImg = fileService.getBucket()
|
|
|
- + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
|
|
|
+ String buildingImg = getBuildingImg(t.getBuildingImg());
|
|
|
t.setBuildingImg(buildingImg);
|
|
|
+ String siteUrl = getSiteUrl(token, t.getSiteNum());
|
|
|
+ t.setSiteUrl(siteUrl);
|
|
|
});
|
|
|
return R.ok(vo);
|
|
|
}
|
|
@@ -246,7 +253,7 @@ public class HouseResourceMapService {
|
|
|
}.getType()));
|
|
|
}
|
|
|
|
|
|
- public R<List<GetBuildingOptionsVo>> getBuildingOptions(GetBuildingOptionsDto dto) {
|
|
|
+ public R<List<GetBuildingOptionsVo>> getBuildingOptions(GetBuildingOptionsDto dto, String token) {
|
|
|
Integer endDate = dto.getEndDate();
|
|
|
// 账期为空则取最新的账期
|
|
|
if (dto.getEndDate() == null) {
|
|
@@ -263,18 +270,28 @@ public class HouseResourceMapService {
|
|
|
if ("省本部".equals(dto.getCity())) {
|
|
|
List<GetBuildingOptionsVo> vo = houseResourceMapMapper.getSbbBuildingOptions(dto);
|
|
|
vo.forEach(t -> {
|
|
|
- String buildingImg = fileService.getBucket()
|
|
|
- + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
|
|
|
+ String buildingImg = getBuildingImg(t.getBuildingImg());
|
|
|
t.setBuildingImg(buildingImg);
|
|
|
+ String siteUrl = getSiteUrl(token, t.getSiteNum());
|
|
|
+ t.setSiteUrl(siteUrl);
|
|
|
});
|
|
|
return R.ok(vo);
|
|
|
}
|
|
|
List<GetBuildingOptionsVo> vo = houseResourceMapMapper.getBuildingOptions(dto);
|
|
|
vo.forEach(t -> {
|
|
|
- String buildingImg = fileService.getBucket()
|
|
|
- + (StringUtils.hasText(t.getBuildingImg()) ? t.getBuildingImg() : DEFAULT_BUILDING_IMG);
|
|
|
+ String buildingImg = getBuildingImg(t.getBuildingImg());
|
|
|
t.setBuildingImg(buildingImg);
|
|
|
+ String siteUrl = getSiteUrl(token, t.getSiteNum());
|
|
|
+ t.setSiteUrl(siteUrl);
|
|
|
});
|
|
|
return R.ok(vo);
|
|
|
}
|
|
|
+
|
|
|
+ private String getSiteUrl(String token, String siteNum) {
|
|
|
+ return housePages.getSiteUrl() + "?data=" + token + "&building_address_number=" + siteNum;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String getBuildingImg(String buildingImg) {
|
|
|
+ return fileService.getBucket() + (StringUtils.hasText(buildingImg) ? buildingImg : DEFAULT_BUILDING_IMG);
|
|
|
+ }
|
|
|
}
|