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 {
}
@GetMapping
public AjaxResult queryHouseResourceById(@RequestParam String id) {
return AjaxResult.success(houseResourceService.queryHouseResourceById(id));
public AjaxResult getHouseResourceById(@RequestParam String id) {
return AjaxResult.success(houseResourceService.detail(id));
}
// @PreAuthorize("@ss.hasPermi('system:house:edit')")
......@@ -63,8 +63,8 @@ public class HouseResourceController {
return AjaxResult.success(houseResourceService.pageHouseResources(query));
}
@GetMapping("/profileGraph")
public AjaxResult getProfileGraphHouseResources(HouseResourcePageQuery query) {
@PostMapping("/profileGraph")
public AjaxResult getProfileGraphHouseResources(@RequestBody HouseResourcePageQuery query) {
return AjaxResult.success(houseResourceService.profileGraphHouseResources(query));
}
......@@ -78,8 +78,8 @@ public class HouseResourceController {
return AjaxResult.success(houseResourceService.listHouseResources(query));
}
@GetMapping("/businessEntityStatistics")
public AjaxResult getBusinessEntityStatistics(HouseResourcePageQuery query) {
@PostMapping("/businessEntityStatistics")
public AjaxResult getBusinessEntityStatistics(@RequestBody HouseResourcePageQuery query) {
return AjaxResult.success(houseResourceService.businessEntityStatistics(query));
}
......@@ -106,4 +106,9 @@ public class HouseResourceController {
ExcelUtil<HouseResourceExport> util = new ExcelUtil<>(HouseResourceExport.class);
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 {
private String id;
private String houseResourceId;
private String name;
private String nature;
......@@ -32,4 +30,6 @@ public class BusinessEntityInfo implements Serializable {
private Boolean gs;
private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
}
......@@ -18,4 +18,16 @@ public class BusinessEntitySell {
private BigDecimal yearTax;
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 {
private Boolean gs;
private List<BusinessEntitySell> businessEntitySells;
private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
private List<HouseResourcePage> houseResources;
private List<BusinessEntitySell> businessEntitySells;
}
......@@ -83,4 +83,10 @@ public class HouseResourceExport {
@Excel(name = "2025营收")
private BigDecimal YearSell2025;
@Excel(name = "经营(办公)场所图片")
private String houseResourceUrl;
@Excel(name = "营业执照图片")
private String businessLicenseUrl;
}
......@@ -114,6 +114,8 @@ public class HouseResourcePage {
private String businessEntityInfoName;
private String name;
private String principal;
private String principalTel;
......
......@@ -24,13 +24,15 @@ public class HouseResourcePageQuery extends PageDomain {
private Integer wgType;
private List<Integer> wgTypes;
private Integer hireStatus;
private String houseNumber;
private BigDecimal houseAreaMin = BigDecimal.ZERO;
private BigDecimal houseAreaMin;
private BigDecimal houseAreaMax = new BigDecimal(9999999);
private BigDecimal houseAreaMax;
private Integer houseResourceType;
......@@ -56,6 +58,8 @@ public class HouseResourcePageQuery extends PageDomain {
private boolean zyzyFlag;
private boolean sbFlag;
private String fourOrHouseNumber;
private BigDecimal dayPriceMin;
......@@ -70,7 +74,7 @@ public class HouseResourcePageQuery extends PageDomain {
private BigDecimal unitPriceMax;
private Boolean gsFlag;
private Integer gsFlag;
private String industryClassification;
......@@ -80,6 +84,26 @@ public class HouseResourcePageQuery extends PageDomain {
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;
@Data
......
......@@ -23,11 +23,7 @@ public interface BusinessEntityInfoMapper {
// 查询所有业务实体信息
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> selectAllBusinessEntityInfosByHouseResourceIds(@Param("houseResourceIds") List<String> houseResourceIds);
BigDecimal selectYearSellByHouseResourceId(@Param("houseResourceId") String houseResourceId);
List<BusinessEntityInfo> selectByIdList(@Param("idList") List<String> idList);
}
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 {
List<HouseResource> selectPageBusinessEntityStatistics();
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 {
void saveHouseResource(HouseResourceSaveUpdateDto dto);
HouseResourceDetail queryHouseResourceById(String id);
HouseResourceDetail detail(String id);
void updateHouseResource(HouseResourceSaveUpdateDto dto);
......@@ -33,4 +33,6 @@ public interface HouseResourceService {
PageBusinessEntityStatisticsDetail pageBusinessEntityStatistics(PageBusinessEntityStatisticsQuery query);
void saveYearTax(YearTaxSaveUpdateDto dto);
List<BusinessEntityDto> listByBusinessEntityInfoName(String name);
}
......@@ -10,12 +10,14 @@ import com.ruoyi.system.domain.grid.GridRegionUserExample;
import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.BusinessEntitySell;
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.vo.*;
import com.ruoyi.system.mapper.grid.GridRegionMapper;
import com.ruoyi.system.mapper.grid.GridRegionUserMapper;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
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.service.house.HouseResourceService;
import org.springframework.beans.BeanUtils;
......@@ -37,14 +39,17 @@ public class HouseResourceServiceImpl implements HouseResourceService {
private final BusinessEntitySellMapper businessEntitySellMapper;
private final HouseResourceBusinessEntityInfoMappingMapper houseResourceBusinessEntityInfoMappingMapper;
private final GridRegionMapper gridRegionMapper;
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.businessEntityInfoMapper = businessEntityInfoMapper;
this.businessEntitySellMapper = businessEntitySellMapper;
this.houseResourceBusinessEntityInfoMappingMapper = houseResourceBusinessEntityInfoMappingMapper;
this.gridRegionMapper = gridRegionMapper;
this.gridRegionUserMapper = gridRegionUserMapper;
}
......@@ -57,13 +62,34 @@ public class HouseResourceServiceImpl implements HouseResourceService {
houseResourceMapper.insertHouseResource(dto.getHouseResource());
for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) {
BusinessEntityInfo businessEntityInfo = new BusinessEntityInfo();
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
String businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfo.setHouseResourceId(houseResourceId);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
String businessEntityInfoId;
if (StringUtils.hasText(businessEntityDto.getId())) {
businessEntityInfoId = businessEntityDto.getId();
BusinessEntityInfo existingInfo = businessEntityInfoMapper.selectBusinessEntityInfoById(businessEntityDto.getId());
BeanUtils.copyProperties(businessEntityDto, existingInfo);
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()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
......@@ -73,7 +99,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
}
@Override
public HouseResourceDetail queryHouseResourceById(String id) {
public HouseResourceDetail detail(String id) {
HouseResource houseResource = houseResourceMapper.selectHouseResourceById(id);
if (houseResource == null) {
return null;
......@@ -105,16 +131,27 @@ public class HouseResourceServiceImpl implements HouseResourceService {
houseResourceDetail.setRentalUnitText(HouseEnums.RentalUnitEnum.getDescByCode(houseResourceDetail.getRentalUnit()));
houseResourceDetail.setHireStatusText(HouseEnums.hireStatusTextEnum.getDescByCode(houseResourceDetail.getHireStatus()));
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfosByHouseResourceId(houseResourceDetail.getId());
List<BusinessEntityDto> businessEntityDtoList = new ArrayList<>();
for (BusinessEntityInfo businessEntityInfo : businessEntityInfos) {
BusinessEntityDto businessEntityDto = new BusinessEntityDto();
BeanUtils.copyProperties(businessEntityInfo, businessEntityDto);
List<BusinessEntitySell> businessEntitySells = businessEntitySellMapper.selectBusinessEntitySellByEntityId(businessEntityInfo.getId());
businessEntityDto.setBusinessEntitySells(businessEntitySells);
businessEntityDtoList.add(businessEntityDto);
List<HouseResourceBusinessEntityInfoMapping> houseResourceMappings = houseResourceBusinessEntityInfoMappingMapper.selectByHouseResourceId(id);
if (!CollectionUtils.isEmpty(houseResourceMappings)) {
List<BusinessEntityDto> result = new ArrayList<>();
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByIdList(houseResourceMappings.stream().map(HouseResourceBusinessEntityInfoMapping::getBusinessEntityInfoId).collect(Collectors.toList()));
businessEntityInfos.forEach(x -> {
BusinessEntityDto businessEntityDto = new BusinessEntityDto();
BeanUtils.copyProperties(x, 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;
}
......@@ -125,19 +162,44 @@ public class HouseResourceServiceImpl implements HouseResourceService {
throw new RuntimeException("房源id不能为空");
}
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()) {
BusinessEntityInfo businessEntityInfo = new BusinessEntityInfo();
BeanUtils.copyProperties(businessEntityDto, businessEntityInfo);
String businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfo.setHouseResourceId(dto.getHouseResource().getId());
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
String businessEntityInfoId;
BusinessEntityInfo businessEntityInfo;
if (StringUtils.hasText(businessEntityDto.getId())) {
businessEntityInfoId = businessEntityDto.getId();
businessEntityInfo = businessEntityInfoMapper.selectBusinessEntityInfoById(businessEntityInfoId);
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()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
......@@ -150,6 +212,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
@Transactional(rollbackFor = Exception.class)
public void deleteHouseResourceById(String id) {
houseResourceMapper.deleteHouseResourceById(id);
houseResourceBusinessEntityInfoMappingMapper.deleteByHouseResourceId(id);
}
@Override
......@@ -178,23 +241,7 @@ public class HouseResourceServiceImpl implements HouseResourceService {
@Override
public List<HouseResourceProfileGraph> profileGraphHouseResources(HouseResourcePageQuery query) {
List<HouseResourcePage> list = houseResourceMapper.selectProfileGraph(query);
list.forEach(x -> x.setIncome(businessEntityInfoMapper.selectYearSellByHouseResourceId(x.getId())));
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()) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceAttribute() == 0).collect(Collectors.toList());
}
......@@ -213,6 +260,9 @@ public class HouseResourceServiceImpl implements HouseResourceService {
if (query.isGkFlag()) {
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()) {
houseResourcePages = houseResourcePages.stream().filter(x -> x.getHouseResourceType() == 4).collect(Collectors.toList());
}
......@@ -311,6 +361,12 @@ public class HouseResourceServiceImpl implements HouseResourceService {
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)) {
return Collections.emptyList();
......@@ -322,39 +378,11 @@ public class HouseResourceServiceImpl implements HouseResourceService {
@Override
public BusinessEntityStatisticsDetail businessEntityStatistics(HouseResourcePageQuery query) {
List<HouseResourcePage> listPages = houseResourceMapper.selectProfileGraph(query);
listPages.forEach(x -> x.setIncome(businessEntityInfoMapper.selectYearSellByHouseResourceId(x.getId())));
if (CollectionUtils.isEmpty(listPages)) {
return new BusinessEntityStatisticsDetail();
}
List<HouseResourcePage> list = handleHouseList(listPages, true);
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.setJdCount(list.stream().filter(x -> x.getType() == 4).count());
businessEntityStatisticsDetail.setJqCount(list.stream().filter(x -> x.getType() == 5).count());
......@@ -378,7 +406,11 @@ public class HouseResourceServiceImpl implements HouseResourceService {
businessEntityStatisticsDetail.setZyzyCount(list.stream().filter(x -> x.getHouseResourceType() == 4).count());
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)) {
return businessEntityStatisticsDetail;
}
......@@ -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) {
list.forEach(x -> {
GridRegionExample twoExample = new GridRegionExample();
......@@ -495,15 +552,26 @@ public class HouseResourceServiceImpl implements HouseResourceService {
if (!CollectionUtils.isEmpty(three)) {
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.setHouseResourceTypeText(HouseEnums.HouseResourceTypeEnum.getDescByCode(x.getHouseResourceType()));
x.setOrientationText(HouseEnums.OrientationEnum.getDescByCode(x.getOrientation()));
x.setDecorationConditionText(HouseEnums.DecorationConditionEnum.getDescByCode(x.getDecorationCondition()));
x.setRentalUnitText(HouseEnums.RentalUnitEnum.getDescByCode(x.getRentalUnit()));
x.setHireStatusText(HouseEnums.hireStatusTextEnum.getDescByCode(x.getHireStatus()));
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectAllBusinessEntityInfosByHouseResourceId(x.getId());
if (!CollectionUtils.isEmpty(businessEntityInfos)) {
x.setBusinessEntityInfoNames(businessEntityInfos.stream().map(BusinessEntityInfo::getName).collect(Collectors.toList()));
List<HouseResourceBusinessEntityInfoMapping> houseResourceBusinessEntityInfoMappings = houseResourceBusinessEntityInfoMappingMapper.selectByHouseResourceId(x.getId());
if (!CollectionUtils.isEmpty(houseResourceBusinessEntityInfoMappings)) {
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) {
......
......@@ -3,7 +3,6 @@
<mapper namespace="com.ruoyi.system.mapper.house.BusinessEntityInfoMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.system.domain.house.BusinessEntityInfo">
<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="nature" property="nature" jdbcType="VARCHAR"/>
<result column="social_credit_code" property="socialCreditCode" jdbcType="VARCHAR"/>
......@@ -15,15 +14,16 @@
<result column="industry_classification" property="industryClassification" jdbcType="VARCHAR"/>
<result property="gs" column="gs" jdbcType="BIT"/>
<result property="registrationPlaceFlag" column="registration_place_flag" jdbcType="INTEGER"/>
<result property="associationBusinessEntityFlag" column="association_business_entity_flag" jdbcType="INTEGER"/>
</resultMap>
<insert id="insertBusinessEntityInfo" parameterType="com.ruoyi.system.domain.house.BusinessEntityInfo">
INSERT INTO business_entity_info (
id, house_resource_id, name, nature, social_credit_code,
principal, principal_tel, business, worker_number, registered_address, industry_classification, gs, registration_place_flag
id, name, nature, social_credit_code,
principal, principal_tel, business, worker_number, registered_address, industry_classification, gs, registration_place_flag, association_business_entity_flag
) VALUES (
#{id}, #{houseResourceId}, #{name}, #{nature}, #{socialCreditCode},
#{principal}, #{principalTel}, #{business}, #{workerNumber}, #{registeredAddress}, #{industryClassification}, #{gs}, #{registrationPlaceFlag}
#{id}, #{name}, #{nature}, #{socialCreditCode},
#{principal}, #{principalTel}, #{business}, #{workerNumber}, #{registeredAddress}, #{industryClassification}, #{gs}, #{registrationPlaceFlag}, #{associationBusinessEntityFlag}
)
</insert>
......@@ -34,7 +34,6 @@
<update id="updateBusinessEntityInfo" parameterType="com.ruoyi.system.domain.house.BusinessEntityInfo">
UPDATE business_entity_info
<set>
<if test="houseResourceId != null">house_resource_id=#{houseResourceId},</if>
<if test="name != null">name=#{name},</if>
<if test="nature != null">nature=#{nature},</if>
<if test="socialCreditCode != null">social_credit_code=#{socialCreditCode},</if>
......@@ -46,6 +45,7 @@
<if test="industryClassification != null">industry_classification=#{industryClassification},</if>
<if test="gs != null">gs=#{gs},</if>
<if test="registrationPlaceFlag != null">registration_place_flag=#{registrationPlaceFlag},</if>
<if test="associationBusinessEntityFlag != null">association_business_entity_flag=#{associationBusinessEntityFlag},</if>
</set>
WHERE id=#{id}
</update>
......@@ -57,26 +57,19 @@
<select id="selectAllBusinessEntityInfos" resultMap="BaseResultMap">
SELECT * FROM business_entity_info
</select>
<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 id="selectByName" resultType="com.ruoyi.system.domain.house.BusinessEntityInfo">
SELECT
IFNULL(SUM(t2.year_sell), 0)
t3.*
FROM
business_entity_info t1
LEFT JOIN business_entity_sell t2 ON t1.id = t2.business_entity_info_id
WHERE
t1.house_resource_id = #{houseResourceId}
house_resource t1
LEFT JOIN house_resource_business_entity_info_mapping t2 ON t1.id = t2.house_resource_id
LEFT JOIN business_entity_info t3 ON t2.business_entity_info_id = t3.id
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>
</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 @@
SELECT
t2.wg_name AS wgName4,
t1.*,
SUM(t4.year_sell) AS income,
t3.nature,
t3.industry_classification,
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.year
t4.name,
t5.year
FROM
house_resource t1
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 business_entity_sell t4 ON t4.business_entity_info_id = t3.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>
<if test="query.wgType != null">
and t1.type = #{query.wgType}
</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 != ''">
and t1.two = #{query.two}
</if>
......@@ -167,25 +175,67 @@
and t1.house_resource_type = #{query.houseResourceType}
</if>
<if test="query.name != null and query.name != ''">
and t3.name like concat('%', #{query.name}, '%')
and t4.name like concat('%', #{query.name}, '%')
</if>
<if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if>
<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 test="query.gsFlag != null and query.gsFlag != ''">
and t3.gs = ${query.gsFlag}
<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 t3.industry_classification like concat('%', #{query.industryClassification}, '%')
and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if>
<if test="query.year != null">
and t4.`year` = #{query.year}
and t5.`year` = #{query.year}
</if>
<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 test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in
......@@ -223,19 +273,15 @@
)
</if>
</where>
GROUP BY t1.id
<if test="query.dayPriceMin != null and query.dayPriceMin != ''">
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}
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>
<if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</if>
</trim>
<if test="query.incomeSort != null and query.incomeSort != ''">
ORDER BY income ${query.incomeSort}
</if>
......@@ -243,14 +289,29 @@
<select id="selectProfileGraph" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT
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
house_resource t1
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>
<if test="query.wgType != null">
and t1.type = #{query.wgType}
</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 != ''">
and t1.two = #{query.two}
</if>
......@@ -269,24 +330,150 @@
<if test="query.houseNumber != null and query.houseNumber != ''">
and t1.house_number like concat('%', #{query.houseNumber}, '%')
</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>
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 id="selectList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT
t2.wg_name AS wgName4,
t1.*,
t4.year_sell,
t3.nature
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
house_resource t1
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 business_entity_sell t4 ON t4.business_entity_info_id = t3.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>
<if test="query.wgType != null">
and t1.type = #{query.wgType}
</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 != ''">
and t1.two = #{query.two}
</if>
......@@ -315,25 +502,67 @@
and t1.house_resource_type = #{query.houseResourceType}
</if>
<if test="query.name != null and query.name != ''">
and t3.name like concat('%', #{query.name}, '%')
and t4.name like concat('%', #{query.name}, '%')
</if>
<if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if>
<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.gsFlag != null and query.gsFlag != ''">
and t3.gs = ${query.gsFlag}
<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 t3.industry_classification like concat('%', #{query.industryClassification}, '%')
and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if>
<if test="query.year != null">
and t4.`year` = #{query.year}
and t5.`year` = #{query.year}
</if>
<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 test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in
......@@ -371,7 +600,7 @@
)
</if>
</where>
GROUP BY t1.id
GROUP BY t1.id, t3.id
<trim prefix="having" prefixOverrides="and">
<if test="query.dayPriceMin != null and query.dayPriceMin != ''">
and dayPrice <![CDATA[ >= ]]> #{query.dayPriceMin}
......@@ -379,12 +608,6 @@
<if test="query.dayPriceMax != null and query.dayPriceMax != ''">
and dayPrice <![CDATA[ <= ]]> #{query.dayPriceMax}
</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>
</select>
<select id="exportList" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
......@@ -393,6 +616,7 @@
t3.id AS businessEntityInfoId,
t1.two,
t1.three,
t1.four,
t2.wg_name AS wgName4,
t1.type,
t1.house_number,
......@@ -403,26 +627,37 @@
t1.ownership,
t1.house_resource_equity_tel,
t1.unit_price,
t3.nature,
t3.NAME,
t3.principal_tel,
t3.business,
t3.worker_number,
t3.registration_place_flag,
t3.registered_address,
t3.industry_classification,
t3.gs,
t4.nature,
t4.NAME,
t4.principal_tel,
t4.business,
t4.worker_number,
t4.registration_place_flag,
t4.registered_address,
t4.industry_classification,
t4.gs,
t1.remark,
t3.name AS businessEntityInfoName,
t3.principal
t4.name AS businessEntityInfoName,
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
house_resource t1
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>
<if test="query.wgType != null">
and t1.type = #{query.wgType}
</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 != ''">
and t1.two = #{query.two}
</if>
......@@ -451,25 +686,67 @@
and t1.house_resource_type = #{query.houseResourceType}
</if>
<if test="query.name != null and query.name != ''">
and t3.name like concat('%', #{query.name}, '%')
and t4.name like concat('%', #{query.name}, '%')
</if>
<if test="query.yearSellMin != null and query.yearSellMin != ''">
and t4.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
and t5.year_sell <![CDATA[ >= ]]> #{query.yearSellMin}
</if>
<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.gsFlag != null and query.gsFlag != ''">
and t3.gs = ${query.gsFlag}
<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 t3.industry_classification like concat('%', #{query.industryClassification}, '%')
and t4.industry_classification like concat('%', #{query.industryClassification}, '%')
</if>
<if test="query.year != null">
and t4.`year` = #{query.year}
and t5.`year` = #{query.year}
</if>
<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 test="query.wgCodes != null and query.wgCodes.size() > 0">
and t1.two in
......@@ -478,21 +755,29 @@
</foreach>
</if>
</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 id="selectAll" resultType="com.ruoyi.system.domain.house.HouseResource">
SELECT * FROM house_resource
</select>
<select id="selectPageBusinessEntityStatistics" resultType="com.ruoyi.system.domain.house.HouseResource">
SELECT
t2.wg_name AS wgName4,
t1.*,
t4.year_sell
t1.*
FROM
house_resource t1
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 business_entity_sell t4 ON t4.business_entity_info_id = t3.id
GROUP BY t1.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
GROUP BY t1.id, t3.id
</select>
<select id="selectForContrast" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT
......@@ -509,22 +794,30 @@
t1.ownership,
t1.house_resource_equity_tel,
t1.unit_price,
t3.nature,
t3.NAME,
t3.principal_tel,
t3.business,
t3.worker_number,
t3.registration_place_flag,
t3.registered_address,
t3.industry_classification,
t3.gs,
t4.nature,
t4.NAME,
t4.principal_tel,
t4.business,
t4.worker_number,
t4.registration_place_flag,
t4.registered_address,
t4.industry_classification,
t4.gs,
t1.remark,
t3.name AS businessEntityInfoName,
t3.principal
t4.name AS businessEntityInfoName,
t4.principal
FROM
house_resource t1
LEFT JOIN grid_region t2 ON t2.wg_code = t1.four
LEFT JOIN business_entity_info t3 ON t1.id = t3.house_resource_id
WHERE t1.two = #{two} AND t3.NAME = #{name}
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 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>
</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