Commit 1c88526e authored by lixuan's avatar lixuan

feat: 房源

parent ade2f0e9
Pipeline #145470 failed with stages
......@@ -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));
}
}
......@@ -32,4 +32,6 @@ public class BusinessEntityInfo implements Serializable {
private Boolean gs;
private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
}
package com.ruoyi.system.domain.house.vo;
import lombok.Data;
import java.util.List;
@Data
public class AssociationBusinessEntityHouseResourceDto {
private String id;
private String houseResourceId;
private String name;
private String nature;
private String socialCreditCode;
private String principal;
private String principalTel;
private String business;
private Integer workerNumber;
private String registeredAddress;
private String industryClassification;
private Boolean gs;
private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
private HouseResourcePage houseResource;
}
......@@ -35,4 +35,6 @@ public class BusinessEntityDto {
private List<BusinessEntitySell> businessEntitySells;
private Boolean registrationPlaceFlag;
private boolean associationBusinessEntityFlag;
}
package com.ruoyi.system.service.house;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.HouseResource;
import com.ruoyi.system.domain.house.vo.*;
......@@ -33,4 +34,6 @@ public interface HouseResourceService {
PageBusinessEntityStatisticsDetail pageBusinessEntityStatistics(PageBusinessEntityStatisticsQuery query);
void saveYearTax(YearTaxSaveUpdateDto dto);
List<AssociationBusinessEntityHouseResourceDto> listByBusinessEntityInfoName(String name);
}
......@@ -57,13 +57,20 @@ public class HouseResourceServiceImpl implements HouseResourceService {
houseResourceMapper.insertHouseResource(dto.getHouseResource());
for (BusinessEntityDto businessEntityDto : dto.getBusinessEntityDtoList()) {
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);
String businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfo.setHouseResourceId(houseResourceId);
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
}
for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
......@@ -126,18 +133,21 @@ public class HouseResourceServiceImpl implements HouseResourceService {
}
houseResourceMapper.updateHouseResource(dto.getHouseResource());
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()) {
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);
String businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfoId = UUID.randomUUID().toString().replaceAll("-", "");
businessEntityInfo.setId(businessEntityInfoId);
businessEntityInfo.setHouseResourceId(dto.getHouseResource().getId());
businessEntityInfoMapper.insertBusinessEntityInfo(businessEntityInfo);
}
for (BusinessEntitySell businessEntitySell : businessEntityDto.getBusinessEntitySells()) {
businessEntitySell.setId(UUID.randomUUID().toString().replaceAll("-", ""));
businessEntitySell.setBusinessEntityInfoId(businessEntityInfoId);
......@@ -487,6 +497,27 @@ public class HouseResourceServiceImpl implements HouseResourceService {
}
}
@Override
public List<AssociationBusinessEntityHouseResourceDto> listByBusinessEntityInfoName(String name) {
List<BusinessEntityInfo> businessEntityInfos = businessEntityInfoMapper.selectByName(name);
if (CollectionUtils.isEmpty(businessEntityInfos)) {
return Collections.emptyList();
}
List<AssociationBusinessEntityHouseResourceDto> result = new ArrayList<>();
businessEntityInfos.forEach(x -> {
AssociationBusinessEntityHouseResourceDto associationBusinessEntityHouseResourceDto = new AssociationBusinessEntityHouseResourceDto();
BeanUtils.copyProperties(x, associationBusinessEntityHouseResourceDto);
if (StringUtils.hasText(x.getHouseResourceId())) {
HouseResource houseResource = houseResourceMapper.selectHouseResourceById(x.getHouseResourceId());
HouseResourcePage houseResourcePage = new HouseResourcePage();
BeanUtils.copyProperties(houseResource, houseResourcePage);
List<HouseResourcePage> list = handleHouseList(Collections.singletonList(houseResourcePage), false);
associationBusinessEntityHouseResourceDto.setHouseResource(list.get(0));
}
});
return result ;
}
private List<HouseResourcePage> handleHouseList(List<HouseResourcePage> list, boolean houseNumberSortFlag) {
list.forEach(x -> {
GridRegionExample twoExample = new GridRegionExample();
......
......@@ -15,15 +15,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
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}
#{principal}, #{principalTel}, #{business}, #{workerNumber}, #{registeredAddress}, #{industryClassification}, #{gs}, #{registrationPlaceFlag}, #{associationBusinessEntityFlag}
)
</insert>
......@@ -46,6 +47,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>
......@@ -80,6 +82,6 @@
t1.house_resource_id = #{houseResourceId}
</select>
<select id="selectByName" resultType="com.ruoyi.system.domain.house.BusinessEntityInfo">
SELECT t2.* FROM house_resource t1 LEFT JOIN business_entity_info t2 ON t1.id = t2.house_resource_id WHERE t2.name = #{name}
SELECT t2.* FROM house_resource t1 LEFT JOIN business_entity_info t2 ON t1.id = t2.house_resource_id WHERE t2.name like concat('%', #{name}, '%')
</select>
</mapper>
......@@ -543,15 +543,13 @@
</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
GROUP BY t1.id, t3.id
</select>
<select id="selectForContrast" resultType="com.ruoyi.system.domain.house.vo.HouseResourcePage">
SELECT
......
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