Commit e752ea69 authored by lixuan's avatar lixuan

feat: 房源

parent f3ba8231
Pipeline #145501 failed with stages
package com.ruoyi.web.controller.house;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.house.BusinessEntityInfo;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
import com.ruoyi.system.mapper.house.BusinessEntityInfoMapper;
import com.ruoyi.system.mapper.house.HouseResourceBusinessEntityInfoMappingMapper;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
@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')")
......
package com.ruoyi.system.domain.house;
import lombok.Data;
@Data
public class HouseResourceBusinessEntityInfoMapping {
private String id;
private String houseResourceId;
private String businessEntityInfoId;
}
...@@ -36,7 +36,7 @@ public class AssociationBusinessEntityHouseResourceDto { ...@@ -36,7 +36,7 @@ public class AssociationBusinessEntityHouseResourceDto {
private boolean associationBusinessEntityFlag; private boolean associationBusinessEntityFlag;
private HouseResourcePage houseResource; private List<HouseResourcePage> houseResources;
private List<BusinessEntitySell> businessEntitySells; private List<BusinessEntitySell> businessEntitySells;
} }
package com.ruoyi.system.mapper.house;
import com.ruoyi.system.domain.house.HouseResourceBusinessEntityInfoMapping;
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);
}
...@@ -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(List<String> idList);
} }
package com.ruoyi.system.service.house; package com.ruoyi.system.service.house;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.HouseResource;
import com.ruoyi.system.domain.house.vo.*; import com.ruoyi.system.domain.house.vo.*;
...@@ -11,7 +10,7 @@ public interface HouseResourceService { ...@@ -11,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);
......
<?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>
</mapper>
...@@ -125,17 +125,18 @@ ...@@ -125,17 +125,18 @@
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,
t3.name, t4.name,
t4.year 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}
...@@ -292,17 +293,18 @@ ...@@ -292,17 +293,18 @@
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,
t3.name, t4.name,
t4.year 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}
...@@ -456,14 +458,18 @@ ...@@ -456,14 +458,18 @@
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,
ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice 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}
...@@ -629,26 +635,27 @@ ...@@ -629,26 +635,27 @@
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, ROUND(IFNULL(t1.unit_price,0) * 10000 / 365 / t1.house_area, 1) AS dayPrice,
t1.house_resource_url, t1.house_resource_url,
t1.business_license_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_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}
...@@ -778,8 +785,9 @@ ...@@ -778,8 +785,9 @@
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
GROUP BY t1.id, t3.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">
...@@ -797,22 +805,30 @@ ...@@ -797,22 +805,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
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 t3.NAME = #{name} WHERE t1.two = #{two} AND t3.NAME = #{name}
</select> </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> </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