Commit 43526442 authored by luben's avatar luben

Merge branch 'refs/heads/dev' into dev-lb

parents 78cf6847 b5075374
package com.ruoyi.web.controller.house;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.BusinessEntitySell;
import com.ruoyi.system.domain.house.ContrastIncome;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
import com.ruoyi.system.mapper.house.BusinessEntitySellMapper;
import com.ruoyi.system.mapper.house.ContrastIncomeMapper;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
@RestController
@RequestMapping("/api/contrastIncome")
public class ContrastIncomeController extends BaseController {
private final ContrastIncomeMapper contrastIncomeMapper;
private final BusinessEntityInfoMapper businessEntityInfoMapper;
private final BusinessEntitySellMapper businessEntitySellMapper;
public ContrastIncomeController(ContrastIncomeMapper contrastIncomeMapper, BusinessEntityInfoMapper businessEntityInfoMapper, BusinessEntitySellMapper businessEntitySellMapper) {
this.contrastIncomeMapper = contrastIncomeMapper;
this.businessEntityInfoMapper = businessEntityInfoMapper;
this.businessEntitySellMapper = businessEntitySellMapper;
}
@PutMapping("/start")
@Transactional(rollbackFor = Exception.class)
public AjaxResult start() {
List<ContrastIncome> contrastIncomes = contrastIncomeMapper.selectAll();
for (ContrastIncome contrastIncome : contrastIncomes) {
contrastIncome.setWgName(contrastIncome.getWgName().replaceAll(" ", ""));
contrastIncome.setName(contrastIncome.getName().replaceAll(" ", ""));
contrastIncome.setPrincipal(contrastIncome.getPrincipal().replaceAll(" ", ""));
}
for (ContrastIncome contrastIncome : contrastIncomes) {
System.out.println("当前处理id: " + contrastIncome.getId());
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByName(contrastIncome.getName());
if (CollectionUtils.isEmpty(businessEntityInfos)) {
System.out.println("当前名字: " + contrastIncome.getName() + " 下没有找到对应的经营主体");
} else if (businessEntityInfos.size() != 1) {
System.out.println("当前名字: " + contrastIncome.getName() + " 有多个对应的经营主体");
} else {
BusinessEntityInfo businessEntityInfo = businessEntityInfos.get(0);
BusinessEntitySell businessEntitySell = businessEntitySellMapper.selectBusinessEntitySellByBusinessEntityInfoId(businessEntityInfo.getId(), 2024);
if (Objects.nonNull(businessEntitySell)) {
businessEntitySell.setYearTax(new BigDecimal(contrastIncome.getIncome()));
System.out.println("为businessEntityInfo.getName() = " + businessEntityInfo.getName() + "更新了税收");
businessEntitySellMapper.updateBusinessEntitySell(businessEntitySell);
} else {
BusinessEntitySell entitySell = new BusinessEntitySell();
entitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
entitySell.setBusinessEntityInfoId(businessEntityInfo.getId());
entitySell.setYear(2024);
entitySell.setYearTax(new BigDecimal(contrastIncome.getIncome()));
System.out.println("为businessEntityInfo.getName() = " + businessEntityInfo.getName() + " 创建了新的BusinessEntitySell: " + entitySell);
businessEntitySellMapper.insertBusinessEntitySell(entitySell);
}
}
}
System.out.println("处理完成");
return AjaxResult.success();
}
}
package com.ruoyi.web.controller.house;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
import com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/houseResourceBusinessEntityInfoMapping")
public class HouseResourceBusinessEntityInfoMappingController {
private final HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper;
private final BusinessEntityInfoMapper businessEntityInfoMapper;
public HouseResourceBusinessEntityInfoMappingController(HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper, BusinessEntityInfoMapper businessEntityInfoMapper) {
this.houseResourceBusinessEntityInfoMappingMapper = houseResourceBusinessEntityInfoMappingMapper;
this.businessEntityInfoMapper = businessEntityInfoMapper;
}
@PostMapping("/start")
@Transactional(rollbackFor = Exception.class)
public AjaxResult start() {
// List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfos();
// Map<String, List<BusinessEntityInfo>> group = businessEntityInfos.stream().collect(Collectors.groupingBy(BusinessEntityInfo::getHouseResourceId));
// group.forEach((houseResourceId, businessEntityInfoList) -> {
// System.out.println("当前处理houseId = " + houseResourceId);
// if (!CollectionUtils.isEmpty(businessEntityInfoList)) {
// for (BusinessEntityInfo businessEntityInfo : businessEntityInfoList) {
// HouseResourceBusinessEntityInfoMapping houseResourceBusinessEntityInfoMapping = new HouseResourceBusinessEntityInfoMapping();
// houseResourceBusinessEntityInfoMapping.setId(UUID.randomUUID().toString().replaceAll("-", ""));
// houseResourceBusinessEntityInfoMapping.setHouseResourceId(houseResourceId);
// houseResourceBusinessEntityInfoMapping.setBusinessEntityInfoId(businessEntityInfo.getId());
// houseResourceBusinessEntityInfoMappingMapper.insert(houseResourceBusinessEntityInfoMapping);
// }
// }
// });
System.out.println("数据处理完成");
return AjaxResult.success();
}
}
...@@ -31,8 +31,8 @@ public class HouseResourceController { ...@@ -31,8 +31,8 @@ public class HouseResourceController {
} }
@GetMapping @GetMapping
public AjaxResult queryHouseResourceById(@RequestParam String id) { public AjaxResult getHouseResourceById(@RequestParam String id) {
return AjaxResult.success(houseResourceService.queryHouseResourceById(id)); return AjaxResult.success(houseResourceService.detail(id));
} }
// @PreAuthorize("@ss.hasPermi('system:house:edit')") // @PreAuthorize("@ss.hasPermi('system:house:edit')")
...@@ -63,8 +63,8 @@ public class HouseResourceController { ...@@ -63,8 +63,8 @@ public class HouseResourceController {
return AjaxResult.success(houseResourceService.pageHouseResources(query)); return AjaxResult.success(houseResourceService.pageHouseResources(query));
} }
@GetMapping("/profileGraph") @PostMapping("/profileGraph")
public AjaxResult getProfileGraphHouseResources(HouseResourcePageQuery query) { public AjaxResult getProfileGraphHouseResources(@RequestBody HouseResourcePageQuery query) {
return AjaxResult.success(houseResourceService.profileGraphHouseResources(query)); return AjaxResult.success(houseResourceService.profileGraphHouseResources(query));
} }
...@@ -78,8 +78,8 @@ public class HouseResourceController { ...@@ -78,8 +78,8 @@ public class HouseResourceController {
return AjaxResult.success(houseResourceService.listHouseResources(query)); return AjaxResult.success(houseResourceService.listHouseResources(query));
} }
@GetMapping("/businessEntityStatistics") @PostMapping("/businessEntityStatistics")
public AjaxResult getBusinessEntityStatistics(HouseResourcePageQuery query) { public AjaxResult getBusinessEntityStatistics(@RequestBody HouseResourcePageQuery query) {
return AjaxResult.success(houseResourceService.businessEntityStatistics(query)); return AjaxResult.success(houseResourceService.businessEntityStatistics(query));
} }
...@@ -106,4 +106,9 @@ public class HouseResourceController { ...@@ -106,4 +106,9 @@ public class HouseResourceController {
ExcelUtil<HouseResourceExport> util = new ExcelUtil<>(HouseResourceExport.class); ExcelUtil<HouseResourceExport> util = new ExcelUtil<>(HouseResourceExport.class);
util.exportExcel(response, exportList, "房源数据"); util.exportExcel(response, exportList, "房源数据");
} }
@GetMapping("/businessEntityInfo")
public AjaxResult getBusinessEntityInfo(@RequestParam("name") String name) {
return AjaxResult.success(houseResourceService.listByBusinessEntityInfoName(name));
}
} }
...@@ -9,8 +9,6 @@ public class BusinessEntityInfo implements Serializable { ...@@ -9,8 +9,6 @@ public class BusinessEntityInfo implements Serializable {
private String id; private String id;
private String houseResourceId;
private String name; private String name;
private String nature; private String nature;
...@@ -32,4 +30,6 @@ public class BusinessEntityInfo implements Serializable { ...@@ -32,4 +30,6 @@ public class BusinessEntityInfo implements Serializable {
private Boolean gs; private Boolean gs;
private Boolean registrationPlaceFlag; private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
} }
...@@ -18,4 +18,16 @@ public class BusinessEntitySell { ...@@ -18,4 +18,16 @@ public class BusinessEntitySell {
private BigDecimal yearTax; private BigDecimal yearTax;
private String compare; private String compare;
@Override
public String toString() {
return "BusinessEntitySell{" +
"id='" + id + '\'' +
", businessEntityInfoId='" + businessEntityInfoId + '\'' +
", year=" + year +
", yearSell=" + yearSell +
", yearTax=" + yearTax +
", compare='" + compare + '\'' +
'}';
}
} }
package com.ruoyi.system.domain.house;
import lombok.Data;
import java.io.Serializable;
@Data
public class ContrastIncome implements Serializable {
private Long id;
private String wgName;
private String name;
private String principal;
private String income;
}
package com.ruoyi.system.domain.house;
import lombok.Data;
@Data
public class HouseResourceBusinessEntityInfoMapping {
private String id;
private String houseResourceId;
private String businessEntityInfoId;
}
...@@ -32,7 +32,11 @@ public class BusinessEntityDto { ...@@ -32,7 +32,11 @@ public class BusinessEntityDto {
private Boolean gs; private Boolean gs;
private List<BusinessEntitySell> businessEntitySells;
private Boolean registrationPlaceFlag; private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
private List<HouseResourcePage> houseResources;
private List<BusinessEntitySell> businessEntitySells;
} }
...@@ -83,4 +83,10 @@ public class HouseResourceExport { ...@@ -83,4 +83,10 @@ public class HouseResourceExport {
@Excel(name = "2025营收") @Excel(name = "2025营收")
private BigDecimal YearSell2025; private BigDecimal YearSell2025;
@Excel(name = "经营(办公)场所图片")
private String houseResourceUrl;
@Excel(name = "营业执照图片")
private String businessLicenseUrl;
} }
...@@ -114,6 +114,8 @@ public class HouseResourcePage { ...@@ -114,6 +114,8 @@ public class HouseResourcePage {
private String businessEntityInfoName; private String businessEntityInfoName;
private String name;
private String principal; private String principal;
private String principalTel; private String principalTel;
......
...@@ -24,13 +24,15 @@ public class HouseResourcePageQuery extends PageDomain { ...@@ -24,13 +24,15 @@ public class HouseResourcePageQuery extends PageDomain {
private Integer wgType; private Integer wgType;
private List<Integer> wgTypes;
private Integer hireStatus; private Integer hireStatus;
private String houseNumber; private String houseNumber;
private BigDecimal houseAreaMin = BigDecimal.ZERO; private BigDecimal houseAreaMin;
private BigDecimal houseAreaMax = new BigDecimal(9999999); private BigDecimal houseAreaMax;
private Integer houseResourceType; private Integer houseResourceType;
...@@ -56,6 +58,8 @@ public class HouseResourcePageQuery extends PageDomain { ...@@ -56,6 +58,8 @@ public class HouseResourcePageQuery extends PageDomain {
private boolean zyzyFlag; private boolean zyzyFlag;
private boolean sbFlag;
private String fourOrHouseNumber; private String fourOrHouseNumber;
private BigDecimal dayPriceMin; private BigDecimal dayPriceMin;
...@@ -70,7 +74,7 @@ public class HouseResourcePageQuery extends PageDomain { ...@@ -70,7 +74,7 @@ public class HouseResourcePageQuery extends PageDomain {
private BigDecimal unitPriceMax; private BigDecimal unitPriceMax;
private Boolean gsFlag; private Integer gsFlag;
private String industryClassification; private String industryClassification;
...@@ -80,6 +84,26 @@ public class HouseResourcePageQuery extends PageDomain { ...@@ -80,6 +84,26 @@ public class HouseResourcePageQuery extends PageDomain {
private Integer registrationPlaceFlag; private Integer registrationPlaceFlag;
private String address;
private String ownership;
private String houseResourceEquityTel;
private String principal;
private String principalTel;
private String business;
private Integer workerNumberMin;
private Integer workerNumberMax;
private String registeredAddress;
private String nature;
private List<AiQuery> aiQueries; private List<AiQuery> aiQueries;
@Data @Data
......
...@@ -23,11 +23,7 @@ public interface BusinessEntityInfoMapper { ...@@ -23,11 +23,7 @@ public interface BusinessEntityInfoMapper {
// 查询所有业务实体信息 // 查询所有业务实体信息
List<BusinessEntityInfo> selectAllBusinessEntityInfos(); List<BusinessEntityInfo> selectAllBusinessEntityInfos();
void deleteByHouseResourceId(@Param("houseResourceId") String houseResourceId); List<BusinessEntityInfo> selectByName(@Param("name") String name);
List<BusinessEntityInfo> selectAllBusinessEntityInfosByHouseResourceId(@Param("houseResourceId") String houseResourceId); List<BusinessEntityInfo> selectByIdList(@Param("idList") List<String> idList);
List<BusinessEntityInfo> selectAllBusinessEntityInfosByHouseResourceIds(@Param("houseResourceIds") List<String> houseResourceIds);
BigDecimal selectYearSellByHouseResourceId(@Param("houseResourceId") String houseResourceId);
} }
package com.ruoyi.system.mapper.house;
import com.ruoyi.system.domain.house.ContrastIncome;
import java.util.List;
public interface ContrastIncomeMapper {
List<ContrastIncome> selectAll();
void updateById(ContrastIncome contrastIncome);
}
package com.ruoyi.system.mapper.house;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface HouseResourceBusinessEntityInfoMappingMapper {
void insert(HouseResourceBusinessEntityInfoMapping houseResourceBusinessEntityInfoMapping);
void deleteByHouseResourceIdBusinessEntityInfoId(String houseResourceId, String businessEntityInfoId);
void deleteByHouseResourceId(String houseResourceId);
List<HouseResourceBusinessEntityInfoMapping> selectByBusinessEntityInfoId(String businessEntityInfoId);
List<HouseResourceBusinessEntityInfoMapping> selectByHouseResourceId(String houseResourceId);
List<HouseResourceBusinessEntityInfoMapping> selectByHouseResourceIds(@Param("houseResourceIds") List<String> houseResourceIds);
}
...@@ -33,4 +33,6 @@ public interface HouseResourceMapper { ...@@ -33,4 +33,6 @@ public interface HouseResourceMapper {
List<HouseResource> selectPageBusinessEntityStatistics(); List<HouseResource> selectPageBusinessEntityStatistics();
List<HouseResourcePage> selectForContrast(@Param("two") String two, @Param("name") String name); List<HouseResourcePage> selectForContrast(@Param("two") String two, @Param("name") String name);
List<HouseResourcePage> selectByIdList(@Param("idList") List<String> idList);
} }
...@@ -10,7 +10,7 @@ public interface HouseResourceService { ...@@ -10,7 +10,7 @@ public interface HouseResourceService {
void saveHouseResource(HouseResourceSaveUpdateDto dto); void saveHouseResource(HouseResourceSaveUpdateDto dto);
HouseResourceDetail queryHouseResourceById(String id); HouseResourceDetail detail(String id);
void updateHouseResource(HouseResourceSaveUpdateDto dto); void updateHouseResource(HouseResourceSaveUpdateDto dto);
...@@ -33,4 +33,6 @@ public interface HouseResourceService { ...@@ -33,4 +33,6 @@ public interface HouseResourceService {
PageBusinessEntityStatisticsDetail pageBusinessEntityStatistics(PageBusinessEntityStatisticsQuery query); PageBusinessEntityStatisticsDetail pageBusinessEntityStatistics(PageBusinessEntityStatisticsQuery query);
void saveYearTax(YearTaxSaveUpdateDto dto); void saveYearTax(YearTaxSaveUpdateDto dto);
List<BusinessEntityDto> listByBusinessEntityInfoName(String name);
} }
...@@ -10,12 +10,14 @@ import com.ruoyi.system.domain.grid.GridRegionUserExample; ...@@ -10,12 +10,14 @@ import com.ruoyi.system.domain.grid.GridRegionUserExample;
import com.ruoyi.system.domain.house.BusinessEntityInfo; import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.BusinessEntitySell; import com.ruoyi.system.domain.house.BusinessEntitySell;
import com.ruoyi.system.domain.house.HouseResource; import com.ruoyi.system.domain.house.HouseResource;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
import com.ruoyi.system.domain.house.enums.HouseEnums; import com.ruoyi.system.domain.house.enums.HouseEnums;
import com.ruoyi.system.domain.house.vo.*; import com.ruoyi.system.domain.house.vo.*;
import com.ruoyi.system.mapper.grid.GridRegionMapper; import com.ruoyi.system.mapper.grid.GridRegionMapper;
import com.ruoyi.system.mapper.grid.GridRegionUserMapper; import com.ruoyi.system.mapper.grid.GridRegionUserMapper;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper; import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
import com.ruoyi.system.mapper.house.BusinessEntitySellMapper; import com.ruoyi.system.mapper.house.BusinessEntitySellMapper;
import com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper;
import com.ruoyi.system.mapper.house.HouseResourceMapper; import com.ruoyi.system.mapper.house.HouseResourceMapper;
import com.ruoyi.system.service.house.HouseResourceService; import com.ruoyi.system.service.house.HouseResourceService;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -37,14 +39,17 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -37,14 +39,17 @@ public class HouseResourceServiceImpl implements HouseResourceService {
private final BusinessEntitySellMapper businessEntitySellMapper; private final BusinessEntitySellMapper businessEntitySellMapper;
private final HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper;
private final GridRegionMapper gridRegionMapper; private final GridRegionMapper gridRegionMapper;
private final GridRegionUserMapper gridRegionUserMapper; private final GridRegionUserMapper gridRegionUserMapper;
public HouseResourceServiceImpl(HouseResourceMapper houseResourceMapper, BusinessEntityInfoMapper businessEntityInfoMapper, BusinessEntitySellMapper businessEntitySellMapper, GridRegionMapper gridRegionMapper, GridRegionUserMapper gridRegionUserMapper) { public HouseResourceServiceImpl(HouseResourceMapper houseResourceMapper, BusinessEntityInfoMapper businessEntityInfoMapper, BusinessEntitySellMapper businessEntitySellMapper, HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper, GridRegionMapper gridRegionMapper, GridRegionUserMapper gridRegionUserMapper) {
this.houseResourceMapper = houseResourceMapper; this.houseResourceMapper = houseResourceMapper;
this.businessEntityInfoMapper = businessEntityInfoMapper; this.businessEntityInfoMapper = businessEntityInfoMapper;
this.businessEntitySellMapper = businessEntitySellMapper; this.businessEntitySellMapper = businessEntitySellMapper;
this.houseResourceBusinessEntityInfoMappingMapper = houseResourceBusinessEntityInfoMappingMapper;
this.gridRegionMapper = gridRegionMapper; this.gridRegionMapper = gridRegionMapper;
this.gridRegionUserMapper = gridRegionUserMapper; this.gridRegionUserMapper = gridRegionUserMapper;
} }
...@@ -57,13 +62,34 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -57,13 +62,34 @@ public class HouseResourceServiceImpl implements HouseResourceService {
houseResourceMapper.insertHouseResource(dto.getHouseResource()); houseResourceMapper.insertHouseResource(dto.getHouseResource());
for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) { for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) {
BusinessEntityInfo businessEntityInfo = new BusinessEntityInfo(); String businessEntityInfoId;
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo); if (StringUtils.hasText(businessEntityDto.getId())) {
String businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", ""); businessEntityInfoId = businessEntityDto.getId();
businessEntityInfo.setId(businessEntityInfoId); BusinessEntityInfo existingInfo = businessEntityInfoMapper.selectBusinessEntityInfoById(businessEntityDto.getId());
businessEntityInfo.setHouseResourceId(houseResourceId); BeanUtils.copyProperties(businessEntityDto, existingInfo);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo); businessEntityInfoMapper.updateBusinessEntityInfo(existingInfo);
} else {
BusinessEntityInfo businessEntityInfo = new BusinessEntityInfo();
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
}
HouseResourceBusinessEntityInfoMapping houseResourceBusinessEntityInfoMapping = new HouseResourceBusinessEntityInfoMapping();
houseResourceBusinessEntityInfoMapping.setId(UUID.randomUUID().toString().replaceAll("-", ""));
houseResourceBusinessEntityInfoMapping.setHouseResourceId(houseResourceId);
houseResourceBusinessEntityInfoMapping.setBusinessEntityInfoId(businessEntityInfoId);
houseResourceBusinessEntityInfoMappingMapper.insert(houseResourceBusinessEntityInfoMapping);
Map<Integer, List<BusinessEntitySell>> sellGroup = businessEntityDto.getBusinessEntitySells().stream().collect(Collectors.groupingBy(BusinessEntitySell::getYear));
for (Map.Entry<Integer, List<BusinessEntitySell>> entry : sellGroup.entrySet()) {
if (entry.getValue().size() > 1) {
throw new RuntimeException("年份 " + entry.getKey() + " 只能有一条销售数据");
}
}
businessEntitySellMapper.deleteBusinessEntitySellByEntityId(businessEntityInfoId);
for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) { for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", "")); businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId); businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
...@@ -73,7 +99,7 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -73,7 +99,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
} }
@Override @Override
public HouseResourceDetail queryHouseResourceById(String id) { public HouseResourceDetail detail(String id) {
HouseResource houseResource = houseResourceMapper.selectHouseResourceById(id); HouseResource houseResource = houseResourceMapper.selectHouseResourceById(id);
if (houseResource == null) { if (houseResource == null) {
return null; return null;
...@@ -105,16 +131,27 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -105,16 +131,27 @@ public class HouseResourceServiceImpl implements HouseResourceService {
houseResourceDetail.setRentalUnitText(HouseEnums.RentalUnitEnum.getDescByCode(houseResourceDetail.getRentalUnit())); houseResourceDetail.setRentalUnitText(HouseEnums.RentalUnitEnum.getDescByCode(houseResourceDetail.getRentalUnit()));
houseResourceDetail.setHireStatusText(HouseEnums.hireStatusTextEnum.getDescByCode(houseResourceDetail.getHireStatus())); houseResourceDetail.setHireStatusText(HouseEnums.hireStatusTextEnum.getDescByCode(houseResourceDetail.getHireStatus()));
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfosByHouseResourceId(houseResourceDetail.getId()); List<HouseResourceBusinessEntityInfoMapping> houseResourceMappings = houseResourceBusinessEntityInfoMappingMapper.selectByHouseResourceId(id);
List<BusinessEntityDto> businessEntityDtoList = new ArrayList<>(); if (!CollectionUtils.isEmpty(houseResourceMappings)) {
for (BusinessEntityInfo businessEntityInfo : businessEntityInfos) { List<BusinessEntityDto> result = new ArrayList<>();
BusinessEntityDto businessEntityDto = new BusinessEntityDto(); List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByIdList(houseResourceMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getBusinessEntityInfoId).collect(Collectors.toList()));
BeanUtils.copyProperties(businessEntityInfo, businessEntityDto); businessEntityInfos.forEach(x -> {
List<BusinessEntitySell> businessEntitySells = businessEntitySellMapper.selectBusinessEntitySellByEntityId(businessEntityInfo.getId()); BusinessEntityDto businessEntityDto = new BusinessEntityDto();
businessEntityDto.setBusinessEntitySells(businessEntitySells); BeanUtils.copyProperties(x, businessEntityDto);
businessEntityDtoList.add(businessEntityDto); List<HouseResourceBusinessEntityInfoMapping> businessEntityInfoMappings = houseResourceBusinessEntityInfoMappingMapper.selectByBusinessEntityInfoId(x.getId());
if (!CollectionUtils.isEmpty(businessEntityInfoMappings)) {
List<HouseResourcePage> list = houseResourceMapper.selectByIdList(businessEntityInfoMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getHouseResourceId).collect(Collectors.toList()));
List<HouseResourcePage> handleList = handleHouseList(list, false);
businessEntityDto.setHouseResources(handleList);
}
List<BusinessEntitySell> businessEntitySells = businessEntitySellMapper.selectBusinessEntitySellByEntityId(x.getId());
if (!CollectionUtils.isEmpty(businessEntitySells)) {
businessEntityDto.setBusinessEntitySells(businessEntitySells);
}
result.add(businessEntityDto);
});
houseResourceDetail.setBusinessEntityDtoList(result);
} }
houseResourceDetail.setBusinessEntityDtoList(businessEntityDtoList);
return houseResourceDetail; return houseResourceDetail;
} }
...@@ -125,19 +162,44 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -125,19 +162,44 @@ public class HouseResourceServiceImpl implements HouseResourceService {
throw new RuntimeException("房源id不能为空"); throw new RuntimeException("房源id不能为空");
} }
houseResourceMapper.updateHouseResource(dto.getHouseResource()); houseResourceMapper.updateHouseResource(dto.getHouseResource());
String houseResourceId = dto.getHouseResource().getId();
houseResourceBusinessEntityInfoMappingMapper.deleteByHouseResourceId(houseResourceId);
businessEntityInfoMapper.deleteByHouseResourceId(dto.getHouseResource().getId());
for (String s : dto.getBusinessEntityDtoList().stream().map(BusinessEntityDto::getId).collect(Collectors.toList())) {
businessEntitySellMapper.deleteBusinessEntitySellById(s);
}
for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) { for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) {
BusinessEntityInfo businessEntityInfo = new BusinessEntityInfo(); String businessEntityInfoId;
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo); BusinessEntityInfo businessEntityInfo;
String businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", ""); if (StringUtils.hasText(businessEntityDto.getId())) {
businessEntityInfo.setId(businessEntityInfoId); businessEntityInfoId = businessEntityDto.getId();
businessEntityInfo.setHouseResourceId(dto.getHouseResource().getId()); businessEntityInfo = businessEntityInfoMapper.selectBusinessEntityInfoById(businessEntityInfoId);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo); if (businessEntityInfo == null) {
throw new RuntimeException("未找到对应的企业信息: " + businessEntityInfoId);
}
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
businessEntityInfoMapper.updateBusinessEntityInfo(businessEntityInfo);
} else {
businessEntityInfo = new BusinessEntityInfo();
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
}
HouseResourceBusinessEntityInfoMapping mapping = new HouseResourceBusinessEntityInfoMapping();
mapping.setId(UUID.randomUUID().toString().replaceAll("-", ""));
mapping.setHouseResourceId(houseResourceId);
mapping.setBusinessEntityInfoId(businessEntityInfoId);
houseResourceBusinessEntityInfoMappingMapper.insert(mapping);
Map<Integer, List<BusinessEntitySell>> sellGroup = businessEntityDto.getBusinessEntitySells()
.stream().collect(Collectors.groupingBy(BusinessEntitySell::getYear));
for (Map.Entry<Integer, List<BusinessEntitySell>> entry : sellGroup.entrySet()) {
if (entry.getValue().size() > 1) {
throw new RuntimeException("年份 " + entry.getKey() + " 只能有一条销售数据");
}
}
businessEntitySellMapper.deleteBusinessEntitySellByEntityId(businessEntityInfoId);
for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) { for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", "")); businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId); businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
...@@ -150,6 +212,7 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -150,6 +212,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteHouseResourceById(String id) { public void deleteHouseResourceById(String id) {
houseResourceMapper.deleteHouseResourceById(id); houseResourceMapper.deleteHouseResourceById(id);
houseResourceBusinessEntityInfoMappingMapper.deleteByHouseResourceId(id);
} }
@Override @Override
...@@ -178,23 +241,7 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -178,23 +241,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
@Override @Override
public List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query) { public List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query) {
List<HouseResourcePage> list = houseResourceMapper.selectProfileGraph(query); List<HouseResourcePage> list = houseResourceMapper.selectProfileGraph(query);
list.forEach(x -> x.setIncome(businessEntityInfoMapper.selectYearSellByHouseResourceId(x.getId())));
List<HouseResourcePage> houseResourcePages = handleHouseList(list, true); List<HouseResourcePage> houseResourcePages = handleHouseList(list, true);
if (StringUtils.hasText(query.getName())) {
houseResourcePages = houseResourcePages.stream().filter(x -> !CollectionUtils.isEmpty(x.getBusinessEntityInfoNames())).filter(x -> x.getBusinessEntityInfoNames().contains(query.getName())).collect(Collectors.toList());
}
if (Objects.nonNull(query.getHouseAreaMin())) {
houseResourcePages = houseResourcePages.stream().filter(x -> Objects.nonNull(x.getHouseArea())).filter(x -> x.getHouseArea().compareTo(query.getHouseAreaMin()) >= 0).collect(Collectors.toList());
}
if (Objects.nonNull(query.getHouseAreaMax())) {
houseResourcePages = houseResourcePages.stream().filter(x -> Objects.nonNull(x.getHouseArea())).filter(x -> x.getHouseArea().compareTo(query.getHouseAreaMax()) <= 0).collect(Collectors.toList());
}
if (Objects.nonNull(query.getYearSellMin())) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getIncome().compareTo(query.getYearSellMin()) >= 0).collect(Collectors.toList());
}
if (Objects.nonNull(query.getYearSellMax())) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getIncome().compareTo(query.getYearSellMax()) <= 0).collect(Collectors.toList());
}
if (query.isZlFlag()) { if (query.isZlFlag()) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceAttribute() == 0).collect(Collectors.toList()); houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceAttribute() == 0).collect(Collectors.toList());
} }
...@@ -213,6 +260,9 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -213,6 +260,9 @@ public class HouseResourceServiceImpl implements HouseResourceService {
if (query.isGkFlag()) { if (query.isGkFlag()) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceType() == 2).collect(Collectors.toList()); houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceType() == 2).collect(Collectors.toList());
} }
if (query.isSbFlag()) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceType() == 3).collect(Collectors.toList());
}
if (query.isZyzyFlag()) { if (query.isZyzyFlag()) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceType() == 4).collect(Collectors.toList()); houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceType() == 4).collect(Collectors.toList());
} }
...@@ -311,6 +361,12 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -311,6 +361,12 @@ public class HouseResourceServiceImpl implements HouseResourceService {
x.setYearSell2024(businessEntitySell2024.getYearSell()); x.setYearSell2024(businessEntitySell2024.getYearSell());
} }
} }
BusinessEntitySell businessEntitySell2025 = businessEntitySellMapper.selectBusinessEntitySellByBusinessEntityInfoId(x.getBusinessEntityInfoId(), 2025);
if (Objects.nonNull(businessEntitySell2025)) {
if (Objects.nonNull(businessEntitySell2025.getYearSell())) {
x.setYearSell2025(businessEntitySell2025.getYearSell());
}
}
}); });
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList(); return Collections.emptyList();
...@@ -322,39 +378,11 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -322,39 +378,11 @@ public class HouseResourceServiceImpl implements HouseResourceService {
@Override @Override
public BusinessEntityStatisticsDetail businessEntityStatistics(HouseResourcePageQuery query) { public BusinessEntityStatisticsDetail businessEntityStatistics(HouseResourcePageQuery query) {
List<HouseResourcePage> listPages = houseResourceMapper.selectProfileGraph(query); List<HouseResourcePage> listPages = houseResourceMapper.selectProfileGraph(query);
listPages.forEach(x -> x.setIncome(businessEntityInfoMapper.selectYearSellByHouseResourceId(x.getId())));
if (CollectionUtils.isEmpty(listPages)) { if (CollectionUtils.isEmpty(listPages)) {
return new BusinessEntityStatisticsDetail(); return new BusinessEntityStatisticsDetail();
} }
List<HouseResourcePage> list = handleHouseList(listPages, true); List<HouseResourcePage> list = handleHouseList(listPages, true);
BusinessEntityStatisticsDetail businessEntityStatisticsDetail = new BusinessEntityStatisticsDetail(); BusinessEntityStatisticsDetail businessEntityStatisticsDetail = new BusinessEntityStatisticsDetail();
if (StringUtils.hasText(query.getTwo())) {
list = list.stream().filter(x -> x.getTwo().equals(query.getTwo())).collect(Collectors.toList());
}
if (StringUtils.hasText(query.getThree())) {
list = list.stream().filter(x -> x.getThree().equals(query.getThree())).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(list)) {
return businessEntityStatisticsDetail;
}
if (StringUtils.hasText(query.getName())) {
list = list.stream().filter(x -> !CollectionUtils.isEmpty(x.getBusinessEntityInfoNames())).filter(x -> x.getBusinessEntityInfoNames().contains(query.getName())).collect(Collectors.toList());
}
if (Objects.nonNull(query.getHouseAreaMin())) {
list = list.stream().filter(x -> Objects.nonNull(x.getHouseArea())).filter(x -> x.getHouseArea().compareTo(query.getHouseAreaMin()) >= 0).collect(Collectors.toList());
}
if (Objects.nonNull(query.getHouseAreaMax())) {
list = list.stream().filter(x -> Objects.nonNull(x.getHouseArea())).filter(x -> x.getHouseArea().compareTo(query.getHouseAreaMax()) <= 0).collect(Collectors.toList());
}
if (Objects.nonNull(query.getYearSellMin())) {
list = list.stream().filter(x -> x.getIncome().compareTo(query.getYearSellMin()) >= 0).collect(Collectors.toList());
}
if (Objects.nonNull(query.getYearSellMax())) {
list = list.stream().filter(x -> x.getIncome().compareTo(query.getYearSellMax()) <= 0).collect(Collectors.toList());
}
if (CollectionUtils.isEmpty(list)) {
return businessEntityStatisticsDetail;
}
businessEntityStatisticsDetail.setLyCount(list.stream().filter(x -> x.getType() == 1).count()); businessEntityStatisticsDetail.setLyCount(list.stream().filter(x -> x.getType() == 1).count());
businessEntityStatisticsDetail.setJdCount(list.stream().filter(x -> x.getType() == 4).count()); businessEntityStatisticsDetail.setJdCount(list.stream().filter(x -> x.getType() == 4).count());
businessEntityStatisticsDetail.setJqCount(list.stream().filter(x -> x.getType() == 5).count()); businessEntityStatisticsDetail.setJqCount(list.stream().filter(x -> x.getType() == 5).count());
...@@ -378,7 +406,11 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -378,7 +406,11 @@ public class HouseResourceServiceImpl implements HouseResourceService {
businessEntityStatisticsDetail.setZyzyCount(list.stream().filter(x -> x.getHouseResourceType() == 4).count()); businessEntityStatisticsDetail.setZyzyCount(list.stream().filter(x -> x.getHouseResourceType() == 4).count());
List<String> houseResourceIds = list.stream().map(HouseResourcePage::getId).collect(Collectors.toList()); List<String> houseResourceIds = list.stream().map(HouseResourcePage::getId).collect(Collectors.toList());
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfosByHouseResourceIds(houseResourceIds); List<HouseResourceBusinessEntityInfoMapping> houseResourceMappings = houseResourceBusinessEntityInfoMappingMapper.selectByHouseResourceIds(houseResourceIds);
if (CollectionUtils.isEmpty(houseResourceMappings)) {
return businessEntityStatisticsDetail;
}
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByIdList(houseResourceMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getBusinessEntityInfoId).collect(Collectors.toList()));
if (CollectionUtils.isEmpty(businessEntityInfos)) { if (CollectionUtils.isEmpty(businessEntityInfos)) {
return businessEntityStatisticsDetail; return businessEntityStatisticsDetail;
} }
...@@ -481,6 +513,31 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -481,6 +513,31 @@ public class HouseResourceServiceImpl implements HouseResourceService {
} }
} }
@Override
public List<BusinessEntityDto> listByBusinessEntityInfoName(String name) {
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByName(name);
if (CollectionUtils.isEmpty(businessEntityInfos)) {
return Collections.emptyList();
}
List<BusinessEntityDto> result = new ArrayList<>();
businessEntityInfos.forEach(x -> {
BusinessEntityDto businessEntityDto = new BusinessEntityDto();
BeanUtils.copyProperties(x, businessEntityDto);
List<HouseResourceBusinessEntityInfoMapping> houseResourceBusinessEntityInfoMappings = houseResourceBusinessEntityInfoMappingMapper.selectByBusinessEntityInfoId(x.getId());
if (!CollectionUtils.isEmpty(houseResourceBusinessEntityInfoMappings)) {
List<HouseResourcePage> list = houseResourceMapper.selectByIdList(houseResourceBusinessEntityInfoMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getHouseResourceId).collect(Collectors.toList()));
List<HouseResourcePage> handleList = handleHouseList(list, false);
businessEntityDto.setHouseResources(handleList);
}
List<BusinessEntitySell> businessEntitySells = businessEntitySellMapper.selectBusinessEntitySellByEntityId(x.getId());
if (!CollectionUtils.isEmpty(businessEntitySells)) {
businessEntityDto.setBusinessEntitySells(businessEntitySells);
}
result.add(businessEntityDto);
});
return result ;
}
private List<HouseResourcePage> handleHouseList(List<HouseResourcePage> list, boolean houseNumberSortFlag) { private List<HouseResourcePage> handleHouseList(List<HouseResourcePage> list, boolean houseNumberSortFlag) {
list.forEach(x -> { list.forEach(x -> {
GridRegionExample twoExample = new GridRegionExample(); GridRegionExample twoExample = new GridRegionExample();
...@@ -495,15 +552,26 @@ public class HouseResourceServiceImpl implements HouseResourceService { ...@@ -495,15 +552,26 @@ public class HouseResourceServiceImpl implements HouseResourceService {
if (!CollectionUtils.isEmpty(three)) { if (!CollectionUtils.isEmpty(three)) {
x.setWgName3(three.get(0).getWgName()); x.setWgName3(three.get(0).getWgName());
} }
if (!StringUtils.hasText(x.getWgName4())) {
GridRegionExample fourExample = new GridRegionExample();
fourExample.createCriteria().andWgTypeEqualTo(String.valueOf(x.getType())).andWgCodeEqualTo(x.getFour());
List<GridRegion> four = gridRegionMapper.selectByExample(fourExample);
if (!CollectionUtils.isEmpty(four)) {
x.setWgName4(four.get(0).getWgName());
}
}
x.setHouseResourceAttributeText(HouseEnums.HouseResourceAttributeEnum.getDescByCode(x.getHouseResourceAttribute())); x.setHouseResourceAttributeText(HouseEnums.HouseResourceAttributeEnum.getDescByCode(x.getHouseResourceAttribute()));
x.setHouseResourceTypeText(HouseEnums.HouseResourceTypeEnum.getDescByCode(x.getHouseResourceType())); x.setHouseResourceTypeText(HouseEnums.HouseResourceTypeEnum.getDescByCode(x.getHouseResourceType()));
x.setOrientationText(HouseEnums.OrientationEnum.getDescByCode(x.getOrientation())); x.setOrientationText(HouseEnums.OrientationEnum.getDescByCode(x.getOrientation()));
x.setDecorationConditionText(HouseEnums.DecorationConditionEnum.getDescByCode(x.getDecorationCondition())); x.setDecorationConditionText(HouseEnums.DecorationConditionEnum.getDescByCode(x.getDecorationCondition()));
x.setRentalUnitText(HouseEnums.RentalUnitEnum.getDescByCode(x.getRentalUnit())); x.setRentalUnitText(HouseEnums.RentalUnitEnum.getDescByCode(x.getRentalUnit()));
x.setHireStatusText(HouseEnums.hireStatusTextEnum.getDescByCode(x.getHireStatus())); x.setHireStatusText(HouseEnums.hireStatusTextEnum.getDescByCode(x.getHireStatus()));
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfosByHouseResourceId(x.getId()); List<HouseResourceBusinessEntityInfoMapping> houseResourceBusinessEntityInfoMappings = houseResourceBusinessEntityInfoMappingMapper.selectByHouseResourceId(x.getId());
if (!CollectionUtils.isEmpty(businessEntityInfos)) { if (!CollectionUtils.isEmpty(houseResourceBusinessEntityInfoMappings)) {
x.setBusinessEntityInfoNames(businessEntityInfos.stream().map(BusinessEntityInfo::getName).collect(Collectors.toList())); List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByIdList(houseResourceBusinessEntityInfoMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getBusinessEntityInfoId).collect(Collectors.toList()));
if (!CollectionUtils.isEmpty(businessEntityInfos)) {
x.setBusinessEntityInfoNames(businessEntityInfos.stream().map(BusinessEntityInfo::getName).collect(Collectors.toList()));
}
} }
}); });
if (houseNumberSortFlag) { if (houseNumberSortFlag) {
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<mapper namespace="com.ruoyi.system.mapper.house.BusinessEntityInfoMapper"> <mapper namespace="com.ruoyi.system.mapper.house.BusinessEntityInfoMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.BusinessEntityInfo"> <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.BusinessEntityInfo">
<id column="id" property="id" jdbcType="VARCHAR"/> <id column="id" property="id" jdbcType="VARCHAR"/>
<result column="house_resource_id" property="houseResourceId" jdbcType="VARCHAR"/>
<result column="name" property="name" jdbcType="VARCHAR"/> <result column="name" property="name" jdbcType="VARCHAR"/>
<result column="nature" property="nature" jdbcType="VARCHAR"/> <result column="nature" property="nature" jdbcType="VARCHAR"/>
<result column="social_credit_code" property="socialCreditCode" jdbcType="VARCHAR"/> <result column="social_credit_code" property="socialCreditCode" jdbcType="VARCHAR"/>
...@@ -15,15 +14,16 @@ ...@@ -15,15 +14,16 @@
<result column="industry_classification" property="industryClassification" jdbcType="VARCHAR"/> <result column="industry_classification" property="industryClassification" jdbcType="VARCHAR"/>
<result property="gs" column="gs" jdbcType="BIT"/> <result property="gs" column="gs" jdbcType="BIT"/>
<result property="registrationPlaceFlag" column="registration_place_flag" jdbcType="INTEGER"/> <result property="registrationPlaceFlag" column="registration_place_flag" jdbcType="INTEGER"/>
<result property="associationBusinessEntityFlag" column="association_business_entity_flag" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<insert id="insertBusinessEntityInfo" parameterType="com.ruoyi.system.domain.house.BusinessEntityInfo"> <insert id="insertBusinessEntityInfo" parameterType="com.ruoyi.system.domain.house.BusinessEntityInfo">
INSERT INTO business_entity_info ( INSERT INTO business_entity_info (
id, house_resource_id, name, nature, social_credit_code, id, name, nature, social_credit_code,
principal, principal_tel, business, worker_number, registered_address, industry_classification, gs, registration_place_flag principal, principal_tel, business, worker_number, registered_address, industry_classification, gs, registration_place_flag, association_business_entity_flag
) VALUES ( ) VALUES (
#{id}, #{houseResourceId}, #{name}, #{nature}, #{socialCreditCode}, #{id}, #{name}, #{nature}, #{socialCreditCode},
#{principal}, #{principalTel}, #{business}, #{workerNumber}, #{registeredAddress}, #{industryClassification}, #{gs}, #{registrationPlaceFlag} #{principal}, #{principalTel}, #{business}, #{workerNumber}, #{registeredAddress}, #{industryClassification}, #{gs}, #{registrationPlaceFlag}, #{associationBusinessEntityFlag}
) )
</insert> </insert>
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
<update id="updateBusinessEntityInfo" parameterType="com.ruoyi.system.domain.house.BusinessEntityInfo"> <update id="updateBusinessEntityInfo" parameterType="com.ruoyi.system.domain.house.BusinessEntityInfo">
UPDATE business_entity_info UPDATE business_entity_info
<set> <set>
<if test="houseResourceId != null">house_resource_id=#{houseResourceId},</if>
<if test="name != null">name=#{name},</if> <if test="name != null">name=#{name},</if>
<if test="nature != null">nature=#{nature},</if> <if test="nature != null">nature=#{nature},</if>
<if test="socialCreditCode != null">social_credit_code=#{socialCreditCode},</if> <if test="socialCreditCode != null">social_credit_code=#{socialCreditCode},</if>
...@@ -46,6 +45,7 @@ ...@@ -46,6 +45,7 @@
<if test="industryClassification != null">industry_classification=#{industryClassification},</if> <if test="industryClassification != null">industry_classification=#{industryClassification},</if>
<if test="gs != null">gs=#{gs},</if> <if test="gs != null">gs=#{gs},</if>
<if test="registrationPlaceFlag != null">registration_place_flag=#{registrationPlaceFlag},</if> <if test="registrationPlaceFlag != null">registration_place_flag=#{registrationPlaceFlag},</if>
<if test="associationBusinessEntityFlag != null">association_business_entity_flag=#{associationBusinessEntityFlag},</if>
</set> </set>
WHERE id=#{id} WHERE id=#{id}
</update> </update>
...@@ -57,26 +57,19 @@ ...@@ -57,26 +57,19 @@
<select id="selectAllBusinessEntityInfos" resultMap="BaseResultMap"> <select id="selectAllBusinessEntityInfos" resultMap="BaseResultMap">
SELECT * FROM business_entity_info SELECT * FROM business_entity_info
</select> </select>
<select id="selectByName" resultType="com.ruoyi.system.domain.house.BusinessEntityInfo">
<delete id="deleteByHouseResourceId">
DELETE FROM business_entity_info WHERE house_resource_id = #{houseResourceId}
</delete>
<select id="selectAllBusinessEntityInfosByHouseResourceId"
resultType="com.ruoyi.system.domain.house.BusinessEntityInfo">
SELECT * FROM business_entity_info WHERE house_resource_id = #{houseResourceId}
</select>
<select id="selectAllBusinessEntityInfosByHouseResourceIds"
resultType="com.ruoyi.system.domain.house.BusinessEntityInfo">
SELECT * FROM business_entity_info WHERE house_resource_id in <foreach collection="houseResourceIds" item="houseResourceId" open="(" close=")" separator=",">#{houseResourceId}</foreach>
</select>
<select id="selectYearSellByHouseResourceId" resultType="java.math.BigDecimal">
SELECT SELECT
IFNULL(SUM(t2.year_sell), 0) t3.*
FROM FROM
business_entity_info t1 house_resource t1
LEFT JOIN business_entity_sell t2 ON t1.id = t2.business_entity_info_id LEFT JOIN house_resource_business_entity_info_mapping t2 ON t1.id = t2.house_resource_id
WHERE LEFT JOIN business_entity_info t3 ON t2.business_entity_info_id = t3.id
t1.house_resource_id = #{houseResourceId} WHERE t3.name like concat('%', #{name}, '%')
</select>
<select id="selectByIdList" resultType="com.ruoyi.system.domain.house.BusinessEntityInfo">
SELECT * FROM business_entity_info WHERE id IN
<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
#{item}
</foreach>
</select> </select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.house.ContrastIncomeMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.ContrastIncome">
<id property="id" column="id" jdbcType="NUMERIC"/>
<result property="wgName" column="wg_name" jdbcType="VARCHAR"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="principal" column="principal" jdbcType="VARCHAR"/>
<result property="income" column="flag" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectAll" resultType="com.ruoyi.system.domain.house.ContrastIncome">
SELECT * FROM contrast_income
</select>
<update id="updateById">
UPDATE contrast_income
SET wg_name = #{wgName,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
income = #{income,jdbcType=VARCHAR}
WHERE id = #{id,jdbcType=NUMERIC}
</update>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping">
<id property="houseResourceId" column="house_resource_id" jdbcType="VARCHAR"/>
<id property="businessEntityInfoId" column="business_entity_info_id" jdbcType="VARCHAR"/>
</resultMap>
<insert id="insert">
INSERT INTO house_resource_business_entity_info_mapping
(id, house_resource_id, business_entity_info_id)
VALUES
(#{id,jdbcType=VARCHAR}, #{houseResourceId,jdbcType=VARCHAR}, #{businessEntityInfoId,jdbcType=VARCHAR})
</insert>
<delete id="deleteByHouseResourceIdBusinessEntityInfoId">
DELETE FROM house_resource_business_entity_info_mapping
WHERE house_resource_id = #{houseResourceId,jdbcType=VARCHAR}
AND business_entity_info_id = #{businessEntityInfoId,jdbcType=VARCHAR}
</delete>
<delete id="deleteByHouseResourceId">
DELETE FROM house_resource_business_entity_info_mapping
WHERE house_resource_id = #{houseResourceId,jdbcType=VARCHAR}
</delete>
<select id="selectByBusinessEntityInfoId"
resultType="com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping">
SELECT * FROM house_resource_business_entity_info_mapping WHERE business_entity_info_id = #{businessEntityInfoId,jdbcType=VARCHAR}
</select>
<select id="selectByHouseResourceId"
resultType="com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping">
SELECT * FROM house_resource_business_entity_info_mapping WHERE house_resource_id = #{houseResourceId,jdbcType=VARCHAR}
</select>
<select id="selectByHouseResourceIds"
resultType="com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping">
SELECT * FROM house_resource_business_entity_info_mapping WHERE house_resource_id IN
<foreach item="item" index="index" collection="houseResourceIds" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
...@@ -125,20 +125,28 @@ ...@@ -125,20 +125,28 @@
SELECT SELECT
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.*, t1.*,
SUM(t4.year_sell) AS income, SUM(t5.year_sell) AS income,
t3.nature, t4.nature,
t3.industry_classification, t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice, ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t4.year t4.name,
t5.year
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
</if> </if>
<if test="query.wgTypes != null and query.wgTypes.size() > 0">
and t1.type in
<foreach item="item" index="index" collection="query.wgTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.two != null and query.two != ''"> <if test="query.two != null and query.two != ''">
and t1.two = #{query.two} and t1.two = #{query.two}
</if> </if>
...@@ -167,25 +175,67 @@ ...@@ -167,25 +175,67 @@
and t1.house_resource_type = #{query.houseResourceType} and t1.house_resource_type = #{query.houseResourceType}
</if> </if>
<if test="query.name != null and query.name != ''"> <if test="query.name != null and query.name != ''">
and t3.name like concat('%', #{query.name}, '%') and t4.name like concat('%', #{query.name}, '%')
</if> </if>
<if test="query.yearSellMin != null and query.yearSellMin != ''"> <if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin} and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if> </if>
<if test="query.yearSellMax != null and query.yearSellMax != ''"> <if test="query.yearSellMax != null and query.yearSellMax != ''">
and t4.year_sell <![CDATA[ <= ]]> #{query.yearSellMax} and t5.year_sell <![CDATA[ <= ]]> #{query.yearSellMax}
</if>
<if test="query.yearTaxMin != null and query.yearTaxMin != ''">
and t5.year_tax <![CDATA[ >= ]]> #{query.yearTaxMin}
</if>
<if test="query.yearTaxMax != null and query.yearTaxMax != ''">
and t5.year_tax <![CDATA[ <= ]]> #{query.yearTaxMax}
</if>
<if test="query.unitPriceMin != null and query.unitPriceMin != ''">
and t1.unit_price <![CDATA[ >= ]]> #{query.unitPriceMin}
</if> </if>
<if test="query.gsFlag != null and query.gsFlag != ''"> <if test="query.unitPriceMax != null and query.unitPriceMax != ''">
and t3.gs = ${query.gsFlag} and t1.unit_price <![CDATA[ <= ]]> #{query.unitPriceMax}
</if>
<if test="query.gsFlag != null">
and t4.gs = ${query.gsFlag}
</if> </if>
<if test="query.industryClassification != null and query.industryClassification != ''"> <if test="query.industryClassification != null and query.industryClassification != ''">
and t3.industry_classification like concat('%', #{query.industryClassification}, '%') and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if> </if>
<if test="query.year != null"> <if test="query.year != null">
and t4.`year` = #{query.year} and t5.`year` = #{query.year}
</if> </if>
<if test="query.registrationPlaceFlag != null"> <if test="query.registrationPlaceFlag != null">
and t3.registration_place_flag = #{query.registrationPlaceFlag} and t4.registration_place_flag = #{query.registrationPlaceFlag}
</if>
<if test="query.address != null and query.address != ''">
and t1.address like concat('%', #{query.address}, '%')
</if>
<if test="query.ownership != null and query.ownership != ''">
and t1.ownership like concat('%', #{query.ownership}, '%')
</if>
<if test="query.houseResourceEquityTel != null and query.houseResourceEquityTel != ''">
and t1.house_resource_equity_tel like concat('%', #{query.houseResourceEquityTel}, '%')
</if>
<if test="query.principal != null and query.principal != ''">
and t4.principal like concat('%', #{query.principal}, '%')
</if>
<if test="query.principalTel != null and query.principalTel != ''">
and t4.principalTel like concat('%', #{query.principalTel}, '%')
</if>
<if test="query.business != null and query.business != ''">
and t4.business like concat('%', #{query.business}, '%')
</if>
<if test="query.workerNumberMin != null">
and t4.worker_number <![CDATA[ >= ]]> #{query.workerNumberMin}
</if>
<if test="query.workerNumberMax != null">
and t4.worker_number <![CDATA[ <= ]]> #{query.workerNumberMax}
</if>
<if test="query.registeredAddress != null and query.registeredAddress != ''">
and t4.registered_address like concat('%', #{query.registeredAddress}, '%')
</if>
<if test="query.nature != null and query.nature != ''">
and t4.nature = #{query.nature}
</if> </if>
<if test="query.wgCodes != null and query.wgCodes.size() > 0"> <if test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in and t1.two in
...@@ -223,19 +273,15 @@ ...@@ -223,19 +273,15 @@
) )
</if> </if>
</where> </where>
GROUP BY t1.id GROUP BY t1.id, t3.id
<if test="query.dayPriceMin != null and query.dayPriceMin != ''"> <trim prefix="having" prefixOverrides="and">
having dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin}
<if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</if>
</if>
<if test="query.dayPriceMax != null and query.dayPriceMax != ''">
having dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
<if test="query.dayPriceMin != null and query.dayPriceMin != ''"> <if test="query.dayPriceMin != null and query.dayPriceMin != ''">
and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin} and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin}
</if> </if>
</if> <if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</if>
</trim>
<if test="query.incomeSort != null and query.incomeSort != ''"> <if test="query.incomeSort != null and query.incomeSort != ''">
ORDER BY income ${query.incomeSort} ORDER BY income ${query.incomeSort}
</if> </if>
...@@ -243,14 +289,29 @@ ...@@ -243,14 +289,29 @@
<select id="selectProfileGraph" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage"> <select id="selectProfileGraph" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT SELECT
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.* t1.*,
SUM(t5.year_sell) AS income,
t4.nature,
t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t4.name,
t5.year
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
</if> </if>
<if test="query.wgTypes != null and query.wgTypes.size() > 0">
and t1.type in
<foreach item="item" index="index" collection="query.wgTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.two != null and query.two != ''"> <if test="query.two != null and query.two != ''">
and t1.two = #{query.two} and t1.two = #{query.two}
</if> </if>
...@@ -269,24 +330,150 @@ ...@@ -269,24 +330,150 @@
<if test="query.houseNumber != null and query.houseNumber != ''"> <if test="query.houseNumber != null and query.houseNumber != ''">
and t1.house_number like concat('%', #{query.houseNumber}, '%') and t1.house_number like concat('%', #{query.houseNumber}, '%')
</if> </if>
<if test="query.houseAreaMin != null and query.houseAreaMin != ''">
and t1.house_area <![CDATA[ >= ]]> #{query.houseAreaMin}
</if>
<if test="query.houseAreaMax != null and query.houseAreaMax != ''">
and t1.house_area <![CDATA[ <= ]]> #{query.houseAreaMax}
</if>
<if test="query.houseResourceType != null">
and t1.house_resource_type = #{query.houseResourceType}
</if>
<if test="query.name != null and query.name != ''">
and t4.name like concat('%', #{query.name}, '%')
</if>
<if test="query.yearSellMin != null and query.yearSellMin != ''">
and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if>
<if test="query.yearSellMax != null and query.yearSellMax != ''">
and t5.year_sell <![CDATA[ <= ]]> #{query.yearSellMax}
</if>
<if test="query.yearTaxMin != null and query.yearTaxMin != ''">
and t5.year_tax <![CDATA[ >= ]]> #{query.yearTaxMin}
</if>
<if test="query.yearTaxMax != null and query.yearTaxMax != ''">
and t5.year_tax <![CDATA[ <= ]]> #{query.yearTaxMax}
</if>
<if test="query.unitPriceMin != null and query.unitPriceMin != ''">
and t1.unit_price <![CDATA[ >= ]]> #{query.unitPriceMin}
</if>
<if test="query.unitPriceMax != null and query.unitPriceMax != ''">
and t1.unit_price <![CDATA[ <= ]]> #{query.unitPriceMax}
</if>
<if test="query.gsFlag != null">
and t4.gs = ${query.gsFlag}
</if>
<if test="query.industryClassification != null and query.industryClassification != ''">
and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if>
<if test="query.year != null">
and t5.`year` = #{query.year}
</if>
<if test="query.registrationPlaceFlag != null">
and t4.registration_place_flag = #{query.registrationPlaceFlag}
</if>
<if test="query.address != null and query.address != ''">
and t1.address like concat('%', #{query.address}, '%')
</if>
<if test="query.ownership != null and query.ownership != ''">
and t1.ownership like concat('%', #{query.ownership}, '%')
</if>
<if test="query.houseResourceEquityTel != null and query.houseResourceEquityTel != ''">
and t1.house_resource_equity_tel like concat('%', #{query.houseResourceEquityTel}, '%')
</if>
<if test="query.principal != null and query.principal != ''">
and t4.principal like concat('%', #{query.principal}, '%')
</if>
<if test="query.principalTel != null and query.principalTel != ''">
and t4.principalTel like concat('%', #{query.principalTel}, '%')
</if>
<if test="query.business != null and query.business != ''">
and t4.business like concat('%', #{query.business}, '%')
</if>
<if test="query.workerNumberMin != null">
and t4.worker_number <![CDATA[ >= ]]> #{query.workerNumberMin}
</if>
<if test="query.workerNumberMax != null">
and t4.worker_number <![CDATA[ <= ]]> #{query.workerNumberMax}
</if>
<if test="query.registeredAddress != null and query.registeredAddress != ''">
and t4.registered_address like concat('%', #{query.registeredAddress}, '%')
</if>
<if test="query.nature != null and query.nature != ''">
and t4.nature = #{query.nature}
</if>
<if test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in
<foreach item="item" index="index" collection="query.wgCodes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.aiQueries != null and query.aiQueries.size() > 0">
and (
<foreach collection="query.aiQueries" item="ai" separator=" or ">
(
<if test="ai.two != null and ai.two != ''">
t1.two = #{ai.two}
</if>
<if test="ai.three != null and ai.three != ''">
<if test="ai.two != null and ai.two != ''">
and
</if>
t1.three = #{ai.three}
</if>
<if test="ai.four != null and ai.four != ''">
<if test="(ai.two != null and ai.two != '') or (ai.three != null and ai.three != '')">
and
</if>
t1.four = #{ai.four}
</if>
<if test="ai.wgType != null">
<if test="(ai.two != null and ai.two != '') or (ai.three != null and ai.three != '') or (ai.four != null and ai.four != '')">
and
</if>
t1.type = #{ai.wgType}
</if>
)
</foreach>
)
</if>
</where> </where>
order by t1.four DESC GROUP BY t1.id, t3.id
<trim prefix="having" prefixOverrides="and">
<if test="query.dayPriceMin != null and query.dayPriceMin != ''">
and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin}
</if>
<if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</if>
</trim>
</select> </select>
<select id="selectList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage"> <select id="selectList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT SELECT
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.*, t1.*,
t4.year_sell, SUM(t5.year_sell) AS income,
t3.nature t4.nature,
t4.industry_classification,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t4.name,
t5.year
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
</if> </if>
<if test="query.wgTypes != null and query.wgTypes.size() > 0">
and t1.type in
<foreach item="item" index="index" collection="query.wgTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.two != null and query.two != ''"> <if test="query.two != null and query.two != ''">
and t1.two = #{query.two} and t1.two = #{query.two}
</if> </if>
...@@ -315,25 +502,67 @@ ...@@ -315,25 +502,67 @@
and t1.house_resource_type = #{query.houseResourceType} and t1.house_resource_type = #{query.houseResourceType}
</if> </if>
<if test="query.name != null and query.name != ''"> <if test="query.name != null and query.name != ''">
and t3.name like concat('%', #{query.name}, '%') and t4.name like concat('%', #{query.name}, '%')
</if> </if>
<if test="query.yearSellMin != null and query.yearSellMin != ''"> <if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin} and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if> </if>
<if test="query.yearSellMax != null and query.yearSellMax != ''"> <if test="query.yearSellMax != null and query.yearSellMax != ''">
and t4.year_sell <![CDATA[ <= ]]> #{query.yearSellMax} and t5.year_sell <![CDATA[ <= ]]> #{query.yearSellMax}
</if>
<if test="query.yearTaxMin != null and query.yearTaxMin != ''">
and t5.year_tax <![CDATA[ >= ]]> #{query.yearTaxMin}
</if>
<if test="query.yearTaxMax != null and query.yearTaxMax != ''">
and t5.year_tax <![CDATA[ <= ]]> #{query.yearTaxMax}
</if> </if>
<if test="query.gsFlag != null and query.gsFlag != ''"> <if test="query.unitPriceMin != null and query.unitPriceMin != ''">
and t3.gs = ${query.gsFlag} and t1.unit_price <![CDATA[ >= ]]> #{query.unitPriceMin}
</if>
<if test="query.unitPriceMax != null and query.unitPriceMax != ''">
and t1.unit_price <![CDATA[ <= ]]> #{query.unitPriceMax}
</if>
<if test="query.gsFlag != null">
and t4.gs = ${query.gsFlag}
</if> </if>
<if test="query.industryClassification != null and query.industryClassification != ''"> <if test="query.industryClassification != null and query.industryClassification != ''">
and t3.industry_classification like concat('%', #{query.industryClassification}, '%') and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if> </if>
<if test="query.year != null"> <if test="query.year != null">
and t4.`year` = #{query.year} and t5.`year` = #{query.year}
</if> </if>
<if test="query.registrationPlaceFlag != null"> <if test="query.registrationPlaceFlag != null">
and t3.registration_place_flag = #{query.registrationPlaceFlag} and t4.registration_place_flag = #{query.registrationPlaceFlag}
</if>
<if test="query.address != null and query.address != ''">
and t1.address like concat('%', #{query.address}, '%')
</if>
<if test="query.ownership != null and query.ownership != ''">
and t1.ownership like concat('%', #{query.ownership}, '%')
</if>
<if test="query.houseResourceEquityTel != null and query.houseResourceEquityTel != ''">
and t1.house_resource_equity_tel like concat('%', #{query.houseResourceEquityTel}, '%')
</if>
<if test="query.principal != null and query.principal != ''">
and t4.principal like concat('%', #{query.principal}, '%')
</if>
<if test="query.principalTel != null and query.principalTel != ''">
and t4.principalTel like concat('%', #{query.principalTel}, '%')
</if>
<if test="query.business != null and query.business != ''">
and t4.business like concat('%', #{query.business}, '%')
</if>
<if test="query.workerNumberMin != null">
and t4.worker_number <![CDATA[ >= ]]> #{query.workerNumberMin}
</if>
<if test="query.workerNumberMax != null">
and t4.worker_number <![CDATA[ <= ]]> #{query.workerNumberMax}
</if>
<if test="query.registeredAddress != null and query.registeredAddress != ''">
and t4.registered_address like concat('%', #{query.registeredAddress}, '%')
</if>
<if test="query.nature != null and query.nature != ''">
and t4.nature = #{query.nature}
</if> </if>
<if test="query.wgCodes != null and query.wgCodes.size() > 0"> <if test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in and t1.two in
...@@ -371,7 +600,7 @@ ...@@ -371,7 +600,7 @@
) )
</if> </if>
</where> </where>
GROUP BY t1.id GROUP BY t1.id, t3.id
<trim prefix="having" prefixOverrides="and"> <trim prefix="having" prefixOverrides="and">
<if test="query.dayPriceMin != null and query.dayPriceMin != ''"> <if test="query.dayPriceMin != null and query.dayPriceMin != ''">
and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin} and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin}
...@@ -379,12 +608,6 @@ ...@@ -379,12 +608,6 @@
<if test="query.dayPriceMax != null and query.dayPriceMax != ''"> <if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax} and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</if> </if>
<if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if>
<if test="query.yearSellMax != null and query.yearSellMax != ''">
and t4.year_sell <![CDATA[ <= ]]> #{query.yearSellMax}
</if>
</trim> </trim>
</select> </select>
<select id="exportList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage"> <select id="exportList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
...@@ -393,6 +616,7 @@ ...@@ -393,6 +616,7 @@
t3.id AS businessEntityInfoId, t3.id AS businessEntityInfoId,
t1.two, t1.two,
t1.three, t1.three,
t1.four,
t2.wg_name AS wgName4, t2.wg_name AS wgName4,
t1.type, t1.type,
t1.house_number, t1.house_number,
...@@ -403,26 +627,37 @@ ...@@ -403,26 +627,37 @@
t1.ownership, t1.ownership,
t1.house_resource_equity_tel, t1.house_resource_equity_tel,
t1.unit_price, t1.unit_price,
t3.nature, t4.nature,
t3.NAME, t4.NAME,
t3.principal_tel, t4.principal_tel,
t3.business, t4.business,
t3.worker_number, t4.worker_number,
t3.registration_place_flag, t4.registration_place_flag,
t3.registered_address, t4.registered_address,
t3.industry_classification, t4.industry_classification,
t3.gs, t4.gs,
t1.remark, t1.remark,
t3.name AS businessEntityInfoName, t4.name AS businessEntityInfoName,
t3.principal t4.principal,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t1.house_resource_url,
t1.business_license_url
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
<where> <where>
<if test="query.wgType != null"> <if test="query.wgType != null">
and t1.type = #{query.wgType} and t1.type = #{query.wgType}
</if> </if>
<if test="query.wgTypes != null and query.wgTypes.size() > 0">
and t1.type in
<foreach item="item" index="index" collection="query.wgTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.two != null and query.two != ''"> <if test="query.two != null and query.two != ''">
and t1.two = #{query.two} and t1.two = #{query.two}
</if> </if>
...@@ -451,25 +686,67 @@ ...@@ -451,25 +686,67 @@
and t1.house_resource_type = #{query.houseResourceType} and t1.house_resource_type = #{query.houseResourceType}
</if> </if>
<if test="query.name != null and query.name != ''"> <if test="query.name != null and query.name != ''">
and t3.name like concat('%', #{query.name}, '%') and t4.name like concat('%', #{query.name}, '%')
</if> </if>
<if test="query.yearSellMin != null and query.yearSellMin != ''"> <if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin} and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if> </if>
<if test="query.yearSellMax != null and query.yearSellMax != ''"> <if test="query.yearSellMax != null and query.yearSellMax != ''">
and t4.year_sell <![CDATA[ <= ]]> #{query.yearSellMax} and t5.year_sell <![CDATA[ <= ]]> #{query.yearSellMax}
</if> </if>
<if test="query.gsFlag != null and query.gsFlag != ''"> <if test="query.yearTaxMin != null and query.yearTaxMin != ''">
and t3.gs = ${query.gsFlag} and t5.year_tax <![CDATA[ >= ]]> #{query.yearTaxMin}
</if>
<if test="query.yearTaxMax != null and query.yearTaxMax != ''">
and t5.year_tax <![CDATA[ <= ]]> #{query.yearTaxMax}
</if>
<if test="query.unitPriceMin != null and query.unitPriceMin != ''">
and t1.unit_price <![CDATA[ >= ]]> #{query.unitPriceMin}
</if>
<if test="query.unitPriceMax != null and query.unitPriceMax != ''">
and t1.unit_price <![CDATA[ <= ]]> #{query.unitPriceMax}
</if>
<if test="query.gsFlag != null">
and t4.gs = ${query.gsFlag}
</if> </if>
<if test="query.industryClassification != null and query.industryClassification != ''"> <if test="query.industryClassification != null and query.industryClassification != ''">
and t3.industry_classification like concat('%', #{query.industryClassification}, '%') and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if> </if>
<if test="query.year != null"> <if test="query.year != null">
and t4.`year` = #{query.year} and t5.`year` = #{query.year}
</if> </if>
<if test="query.registrationPlaceFlag != null"> <if test="query.registrationPlaceFlag != null">
and t3.registration_place_flag = #{query.registrationPlaceFlag} and t4.registration_place_flag = #{query.registrationPlaceFlag}
</if>
<if test="query.address != null and query.address != ''">
and t1.address like concat('%', #{query.address}, '%')
</if>
<if test="query.ownership != null and query.ownership != ''">
and t1.ownership like concat('%', #{query.ownership}, '%')
</if>
<if test="query.houseResourceEquityTel != null and query.houseResourceEquityTel != ''">
and t1.house_resource_equity_tel like concat('%', #{query.houseResourceEquityTel}, '%')
</if>
<if test="query.principal != null and query.principal != ''">
and t4.principal like concat('%', #{query.principal}, '%')
</if>
<if test="query.principalTel != null and query.principalTel != ''">
and t4.principalTel like concat('%', #{query.principalTel}, '%')
</if>
<if test="query.business != null and query.business != ''">
and t4.business like concat('%', #{query.business}, '%')
</if>
<if test="query.workerNumberMin != null">
and t4.worker_number <![CDATA[ >= ]]> #{query.workerNumberMin}
</if>
<if test="query.workerNumberMax != null">
and t4.worker_number <![CDATA[ <= ]]> #{query.workerNumberMax}
</if>
<if test="query.registeredAddress != null and query.registeredAddress != ''">
and t4.registered_address like concat('%', #{query.registeredAddress}, '%')
</if>
<if test="query.nature != null and query.nature != ''">
and t4.nature = #{query.nature}
</if> </if>
<if test="query.wgCodes != null and query.wgCodes.size() > 0"> <if test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in and t1.two in
...@@ -478,21 +755,29 @@ ...@@ -478,21 +755,29 @@
</foreach> </foreach>
</if> </if>
</where> </where>
GROUP BY t1.id, t3.id
<trim prefix="having" prefixOverrides="and">
<if test="query.dayPriceMin != null and query.dayPriceMin != ''">
and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin}
</if>
<if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</if>
</trim>
</select> </select>
<select id="selectAll" resultType="com.ruoyi.system.domain.house.HouseResource"> <select id="selectAll" resultType="com.ruoyi.system.domain.house.HouseResource">
SELECT * FROM house_resource SELECT * FROM house_resource
</select> </select>
<select id="selectPageBusinessEntityStatistics" resultType="com.ruoyi.system.domain.house.HouseResource"> <select id="selectPageBusinessEntityStatistics" resultType="com.ruoyi.system.domain.house.HouseResource">
SELECT SELECT
t2.wg_name AS wgName4, t1.*
t1.*,
t4.year_sell
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
LEFT JOIN business_entity_sell t4 ON t4.business_entity_info_id = t3.id LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
GROUP BY t1.id LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
GROUP BY t1.id, t3.id
</select> </select>
<select id="selectForContrast" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage"> <select id="selectForContrast" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT SELECT
...@@ -509,22 +794,30 @@ ...@@ -509,22 +794,30 @@
t1.ownership, t1.ownership,
t1.house_resource_equity_tel, t1.house_resource_equity_tel,
t1.unit_price, t1.unit_price,
t3.nature, t4.nature,
t3.NAME, t4.NAME,
t3.principal_tel, t4.principal_tel,
t3.business, t4.business,
t3.worker_number, t4.worker_number,
t3.registration_place_flag, t4.registration_place_flag,
t3.registered_address, t4.registered_address,
t3.industry_classification, t4.industry_classification,
t3.gs, t4.gs,
t1.remark, t1.remark,
t3.name AS businessEntityInfoName, t4.name AS businessEntityInfoName,
t3.principal t4.principal
FROM FROM
house_resource t1 house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id LEFT JOIN house_resource_business_entity_info_mapping t3 ON t3.house_resource_id = t1.id
WHERE t1.two = #{two} AND t3.NAME = #{name} LEFT JOIN business_entity_info t4 ON t3.business_entity_info_id = t4.id
LEFT JOIN business_entity_sell t5 ON t5.business_entity_info_id = t4.id
WHERE t1.two = #{two} AND t4.NAME = #{name}
</select>
<select id="selectByIdList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT * FROM house_resource WHERE id IN
<foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
#{item}
</foreach>
</select> </select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment