Browse Source

基础信息排序优化、基础信息来源户数计算、统计分析sql拼接更换、小区注释核算行政区与所属包

wang_xy 1 year ago
parent
commit
b21ef39980

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysDictDataMapper.xml

@@ -80,7 +80,7 @@
         FROM
         sys_dict_data
         WHERE
-        dict_type = 'new_built_courtyard_engin' UNION ALL
+        dict_type = 'new_built_courtyard' UNION ALL
         SELECT
         dict_label as label,
         dict_value as value,

+ 2 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/domain/bo/ZAreaBo.java

@@ -66,13 +66,13 @@ public class ZAreaBo extends BaseEntity {
     /**
      * 核算行政区
      */
-    @NotBlank(message = "核算行政区不能为空", groups = { AddGroup.class, EditGroup.class })
+//    @NotBlank(message = "核算行政区不能为空", groups = { AddGroup.class, EditGroup.class })
     private String calculateDistrict;
 
     /**
      * 所属包
      */
-    @NotBlank(message = "所属包不能为空", groups = { AddGroup.class, EditGroup.class })
+//    @NotBlank(message = "所属包不能为空", groups = { AddGroup.class, EditGroup.class })
     private String belongingPack;
 
     /**

+ 2 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/mapper/ZHouseMapper.java

@@ -24,4 +24,6 @@ public interface ZHouseMapper extends BaseMapperPlus<ZHouseMapper, ZHouse, ZHous
     List<ZHouseVo> selectListByunitId(String unitId);
     List<ZHouse> selectHouseId(@Param("p") ZEngineeringCivilBo bo);
     ZHouseVo getHousesByIdCard(String idCard);
+
+    String getAreaSourceString(@Param("table")String table,@Param("id")String id);
 }

+ 35 - 4
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZAreaServiceImpl.java

@@ -94,16 +94,12 @@ public class ZAreaServiceImpl implements IZAreaService {
                 if (StringUtils.isNotEmpty(vo.getAreaName())) {
                     ZArea area = baseMapper.getByName(vo.getAreaName());
                     ZBuilding building = new ZBuilding();
-                    building.setSource("1");
                     ZUnit unit = new ZUnit();
-                    unit.setSource("1");
                     ZHouse house = new ZHouse();
-                    house.setSource("1");
                     if (ObjectUtils.isEmpty(area)) {
                         area = new ZArea();
                         //小区zDsZ1a2b3c4d%1234!
                         area.setName(vo.getAreaName());
-                        area.setSource("1");
                         area.setCreateBy(operName);
                         area.setCreateTime(new Date());
                         area.setDistrict(districtValue);
@@ -152,6 +148,14 @@ public class ZAreaServiceImpl implements IZAreaService {
                             throw new ServiceException("" + "第" + (n + 1) + "行格式错误,导入失败!");
                         }
                     } else if (isUpdateSupport) {
+                        //小区zDsZ1a2b3c4d%1234!
+                        area.setCreateBy(operName);
+                        area.setCreateTime(new Date());
+                        area.setDistrict(districtValue);
+                        area.setSource(sourceValue);
+                        area.setAdministrative(vo.getAdministrative());
+                        area.setRenovationColumn("Y");
+                        baseMapper.updateById(area);
                         if (StringUtils.isNotEmpty(vo.getBuildName())) {
                             building = zBuildingMapper.getByName(vo.getBuildName(), area.getId());
                             if (ObjectUtils.isEmpty(building)) {
@@ -193,6 +197,11 @@ public class ZAreaServiceImpl implements IZAreaService {
                                     throw new ServiceException("" + "第" + (n + 1) + "行格式错误,导入失败!");
                                 }
                             } else {
+                                building.setAreaId(area.getId());
+                                building.setUpdateBy(operName);
+                                building.setUpdateTime(new Date());
+                                building.setSource(sourceValue);
+                                zBuildingMapper.updateById(building);
                                 if (StringUtils.isNotEmpty(vo.getUnitName())) {
                                     unit = zUnitMapper.getByName(vo.getUnitName(), building.getId());
                                     if (ObjectUtils.isEmpty(unit)) {
@@ -223,6 +232,13 @@ public class ZAreaServiceImpl implements IZAreaService {
                                             throw new ServiceException("" + "第" + (n + 1) + "行格式错误,导入失败!");
                                         }
                                     } else {
+                                        //单元
+                                        unit.setAreaId(area.getId());
+                                        unit.setBuildingId(building.getId());
+                                        unit.setUpdateBy(operName);
+                                        unit.setUpdateTime(new Date());
+                                        unit.setSource(sourceValue);
+                                        zUnitMapper.updateById(unit);
                                         if (StringUtils.isNotEmpty(vo.getHouseName())) {
                                             house = zHouseMapper.getByName(vo.getHouseName(), unit.getId());
                                             if (ObjectUtils.isEmpty(house)) {
@@ -240,6 +256,18 @@ public class ZAreaServiceImpl implements IZAreaService {
                                                 house.setPhone(vo.getPhone());
                                                 zHouseMapper.insert(house);
                                                 successNum++;
+                                            }else{
+                                                //房屋
+                                                house.setAreaId(area.getId());
+                                                house.setBuildingId(building.getId());
+                                                house.setUnitId(unit.getId());
+                                                house.setUpdateBy(operName);
+                                                house.setUpdateTime(new Date());
+                                                house.setSource(sourceValue);
+                                                house.setHouseUserName(vo.getHouseUserName());
+                                                house.setIdCard(vo.getIdCard());
+                                                house.setPhone(vo.getPhone());
+                                                zHouseMapper.updateById(house);
                                             }
                                         } else {
                                             throw new ServiceException("" + "第" + (n + 1) + "行格式错误,导入失败!");
@@ -297,6 +325,9 @@ public class ZAreaServiceImpl implements IZAreaService {
     public TableDataInfo<ZAreaVo> queryPageList(ZAreaBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<ZArea> lqw = buildQueryWrapper(bo);
         Page<ZAreaVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        for (ZAreaVo vo:result.getRecords()) {
+            vo.setSource(zHouseMapper.getAreaSourceString("area_id",vo.getId()));
+        }
         return TableDataInfo.build(result);
     }
 

+ 8 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZBuildingServiceImpl.java

@@ -10,6 +10,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.zdsz.domain.ZArea;
+import com.ruoyi.zdsz.domain.vo.ZAreaVo;
+import com.ruoyi.zdsz.mapper.ZHouseMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import com.ruoyi.zdsz.domain.bo.ZBuildingBo;
@@ -19,6 +21,7 @@ import com.ruoyi.zdsz.mapper.ZBuildingMapper;
 import com.ruoyi.zdsz.service.IZBuildingService;
 import org.springframework.util.ObjectUtils;
 
+import javax.annotation.Resource;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -35,6 +38,8 @@ import java.util.Collection;
 public class ZBuildingServiceImpl implements IZBuildingService {
 
     private final ZBuildingMapper baseMapper;
+    @Resource
+    private ZHouseMapper zHouseMapper;
 
     /**
      * 楼宇下拉
@@ -59,6 +64,9 @@ public class ZBuildingServiceImpl implements IZBuildingService {
     public TableDataInfo<ZBuildingVo> getPageList(ZBuildingBo bo, PageQuery pageQuery) {
         Page<ZBuildingBo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
         Page<ZBuildingVo> list = baseMapper.getPageList(bo,page);
+        for (ZBuildingVo vo:list.getRecords()) {
+            vo.setSource(zHouseMapper.getAreaSourceString("building_id",vo.getId()));
+        }
         return TableDataInfo.build(list);
     }
 

+ 8 - 0
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZUnitServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.zdsz.domain.ZHouse;
 import com.ruoyi.zdsz.domain.bo.ZBuildingBo;
 import com.ruoyi.zdsz.domain.vo.ZBuildingVo;
+import com.ruoyi.zdsz.mapper.ZHouseMapper;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import com.ruoyi.zdsz.domain.bo.ZUnitBo;
@@ -19,6 +20,7 @@ import com.ruoyi.zdsz.mapper.ZUnitMapper;
 import com.ruoyi.zdsz.service.IZUnitService;
 import org.springframework.util.ObjectUtils;
 
+import javax.annotation.Resource;
 import java.util.List;
 import java.util.Map;
 import java.util.Collection;
@@ -35,6 +37,9 @@ public class ZUnitServiceImpl implements IZUnitService {
 
     private final ZUnitMapper baseMapper;
 
+    @Resource
+    private ZHouseMapper zHouseMapper;
+
     @Override
     public List<ZUnitVo> getUnitList(String buildingId) {
         return baseMapper.getUnitList(buildingId);
@@ -55,6 +60,9 @@ public class ZUnitServiceImpl implements IZUnitService {
     public TableDataInfo<ZUnitVo> getPageList(ZUnitBo bo, PageQuery pageQuery) {
         Page<ZUnitBo> page = new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize());
         Page<ZUnitVo> result = baseMapper.getPageList(bo,page);
+        for (ZUnitVo vo:result.getRecords()) {
+            vo.setSource(zHouseMapper.getAreaSourceString("unit_id",vo.getId()));
+        }
         return TableDataInfo.build(result);
     }
 

+ 2 - 1
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZAreaMapper.xml

@@ -45,7 +45,8 @@
                sd.dict_label AS district,
                zb.name AS buildName,
                zn.name AS unitName,
-               zh.name AS houseName
+               zh.name AS houseName,
+               za.administrative
         FROM z_area za
                  LEFT JOIN sys_dict_data sd on sd.dict_type = 'district' and za.district = sd.dict_value
                  LEFT JOIN z_building zb on zb.area_id = za.id and zb.del_flag = 0

+ 1 - 1
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZBuildingMapper.xml

@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="areaId != null and areaId != ''">
             and a.area_id = #{areaId}
         </if>
-        order by a.name desc
+        order by a.name asc
     </select>
 
     <select id="getPageList" resultType="com.ruoyi.zdsz.domain.vo.ZBuildingVo">

+ 1 - 1
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZEngineeringCivilMapper.xml

@@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     a.area_id,
     a.building_id,
     a.unit_id ,
-    CONCAT(bd.name,'栋',c.name,'单元') AS unitName,
+    CONCAT(bd.name,'-',c.name) AS unitName,
     a.NAME AS roomName,
     a.id AS roomId,
     b.engin_type AS enginCycle,

+ 22 - 1
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZHouseMapper.xml

@@ -72,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="p.newPhone != null  and p.newPhone != ''">
                 and a.new_phone LIKE CONCAT('%',#{p.newPhone},'%')
             </if>
+            <if test="p.source != null  and p.source != ''">
+                and a.source = #{p.source}
+            </if>
         </where>
         order by b.name,c.name,d.name,a.name asc
     </select>
@@ -90,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="unitId != null  and unitId != ''">
             and a.unit_id = #{unitId}
         </if>
-        order by a.name desc
+        order by a.name asc
     </select>
     <select id="selectHouseId" resultType="com.ruoyi.zdsz.domain.ZHouse">
         select
@@ -149,4 +152,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             id_card = #{idCard}
             LIMIT 1
     </select>
+    <select id="getAreaSourceString" resultType="java.lang.String" parameterType="java.lang.String">
+        SELECT
+            GROUP_CONCAT( z.cou SEPARATOR ';' )
+        FROM
+            (
+                SELECT
+                    CONCAT(dict_label,':',count( b.id )) AS cou
+                FROM
+                    z_house b
+                        LEFT JOIN sys_dict_data dd ON b.source = dd.dict_value
+                WHERE
+                    dd.dict_type = 'community_source'
+                  AND b.del_flag = '0'
+                  AND b.${table} = #{id}
+                GROUP BY
+                    source
+            ) z
+    </select>
 </mapper>

+ 1 - 1
ruoyi-zdsz/src/main/resources/mapper/zdsz/ZUnitMapper.xml

@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="buildingId != null and buildingId != ''">
             and a.building_id = #{buildingId}
         </if>
-        order by a.name desc
+        order by a.name asc
     </select>
 
     <select id="getPageList" resultType="com.ruoyi.zdsz.domain.vo.ZUnitVo">