From 92167f7a9909e0b25acc5bfb8e302bcbd41e875b Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 07 三月 2025 00:31:57 +0800
Subject: [PATCH] 优化欠费工鞥你

---
 java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml              |   17 ++++
 service-report/src/main/java/com/java110/report/cmd/fee/QueryAdminOweFeeDetailCmd.java           |   24 ++++++
 service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityFloorTreeCmd.java    |  138 ++++++++++++++++++++++++++++++++++
 service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java |   11 ++
 service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java      |    9 ++
 java110-bean/src/main/java/com/java110/dto/floor/FloorDto.java                                   |   10 ++
 service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java              |    2 
 java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java     |    4 +
 8 files changed, 215 insertions(+), 0 deletions(-)

diff --git a/java110-bean/src/main/java/com/java110/dto/floor/FloorDto.java b/java110-bean/src/main/java/com/java110/dto/floor/FloorDto.java
index e449772..692bae6 100644
--- a/java110-bean/src/main/java/com/java110/dto/floor/FloorDto.java
+++ b/java110-bean/src/main/java/com/java110/dto/floor/FloorDto.java
@@ -27,6 +27,8 @@
 
     private String communityId;
 
+    private String communityName;
+
     /**
      * 缂栧彿
      */
@@ -156,4 +158,12 @@
     public void setSeq(int seq) {
         this.seq = seq;
     }
+
+    public String getCommunityName() {
+        return communityName;
+    }
+
+    public void setCommunityName(String communityName) {
+        this.communityName = communityName;
+    }
 }
diff --git a/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
index e535fca..562eda8 100755
--- a/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
+++ b/java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml
@@ -277,6 +277,23 @@
         order by CONVERT(t.layer, SIGNED), CONVERT(t.room_num, SIGNED)
     </select>
 
+
+    <!-- 鏌ヨ鏃犳晥璐圭敤 add by wuxw 2018-07-03 -->
+    <select id="queryCommunityFloorTree" parameterType="Map" resultType="Map">
+        select s.community_id communityId,s.name communityName,t.floor_num floorNum,t.`name`,t.floor_id floorId
+        from  f_floor t
+        left join s_community s on t.community_id = s.community_id and s.status_cd = '0'
+        where t.status_cd = '0'
+        and s.status_cd = '0'
+        <if test="communityIds !=null ">
+            and s.community_id in
+            <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        order by t.seq
+    </select>
+
     <!-- 鏌ヨ鏃犳晥璐圭敤 add by wuxw 2018-07-03 -->
     <select id="queryCommunityUnitTree" parameterType="Map" resultType="Map">
         select s.community_id communityId,s.name communityName,f.floor_num floorNum,f.`name`,f.floor_id floorId,
diff --git a/java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java b/java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java
index b991ac0..59df91d 100644
--- a/java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java
+++ b/java110-interface/src/main/java/com/java110/intf/report/IReportCommunityInnerServiceSMO.java
@@ -2,6 +2,7 @@
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.floor.FloorDto;
 import com.java110.dto.inspection.InspectionPlanDto;
 import com.java110.dto.parking.ParkingAreaDto;
 import com.java110.dto.repair.RepairSettingDto;
@@ -117,4 +118,7 @@
 
     @RequestMapping(value = "/queryCommunityInspectionTree", method = RequestMethod.POST)
     List<InspectionPlanDto> queryCommunityInspectionTree(@RequestBody InspectionPlanDto inspectionPlanDto);
+
+    @RequestMapping(value = "/queryCommunityFloorTree", method = RequestMethod.POST)
+    List<FloorDto> queryCommunityFloorTree(@RequestBody FloorDto floorDto);
 }
diff --git a/service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityFloorTreeCmd.java b/service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityFloorTreeCmd.java
new file mode 100644
index 0000000..43282da
--- /dev/null
+++ b/service-report/src/main/java/com/java110/report/cmd/community/QueryCommunityFloorTreeCmd.java
@@ -0,0 +1,138 @@
+package com.java110.report.cmd.community;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.floor.FloorDto;
+import com.java110.intf.report.IReportCommunityInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * 鏌ヨ灏忓尯妤兼爧鏍戝舰缁撴瀯
+ */
+@Java110Cmd(serviceCode = "community.queryCommunityFloorTree")
+public class QueryCommunityFloorTreeCmd extends Cmd {
+
+    @Autowired
+    private IReportCommunityInnerServiceSMO reportCommunityInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        // must be administrator
+        super.validateAdmin(context);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+        List<FloorDto> floorDtos = null;
+
+        FloorDto floorDto = new FloorDto();
+
+
+        floorDtos = reportCommunityInnerServiceSMOImpl.queryCommunityFloorTree(floorDto);
+        JSONArray communitys = new JSONArray();
+        if (ListUtil.isNull(floorDtos)) {
+            context.setResponseEntity(ResultVo.createResponseEntity(communitys));
+            return;
+        }
+
+        JSONObject communityInfo = null;
+        for (FloorDto tmpFloorDto : floorDtos) {
+            if (!hasInCommunity(tmpFloorDto, communitys)) {
+                communityInfo = new JSONObject();
+                communityInfo.put("id", "c_" + tmpFloorDto.getCommunityId());
+                communityInfo.put("communityId", tmpFloorDto.getCommunityId());
+                communityInfo.put("text", tmpFloorDto.getCommunityName());
+                communityInfo.put("icon", "/img/org.png");
+                communityInfo.put("children", new JSONArray());
+                communitys.add(communityInfo);
+            }
+        }
+
+        JSONObject community = null;
+        for (int cIndex = 0; cIndex < communitys.size(); cIndex++) {
+            community = communitys.getJSONObject(cIndex);
+            // find floor data in unitDtos
+            findFloor(community, floorDtos);
+        }
+        context.setResponseEntity(ResultVo.createResponseEntity(communitys));
+
+
+    }
+
+    /**
+     * find community floor data
+     *
+     * @param community current community
+     * @param unitDtos  all units data
+     */
+    private void findFloor(JSONObject community, List<FloorDto> unitDtos) {
+        JSONArray floors = community.getJSONArray("children");
+        JSONObject floorInfo = null;
+        for (FloorDto tmpFloorDto : unitDtos) {
+            if(!community.getString("communityId").equals(tmpFloorDto.getCommunityId())){
+                continue;
+            }
+            if (!hasInFloor(tmpFloorDto, floors)) {
+                floorInfo = new JSONObject();
+                floorInfo.put("id", "f_" + tmpFloorDto.getFloorId());
+                floorInfo.put("floorId", tmpFloorDto.getFloorId());
+                floorInfo.put("communityId", community.getString("communityId"));
+                floorInfo.put("text", tmpFloorDto.getFloorNum()+"鏍�");
+                floorInfo.put("icon", "/img/floor.png");
+                floorInfo.put("children", new JSONArray());
+                floors.add(floorInfo);
+            }
+        }
+    }
+
+
+
+    private boolean hasInFloor(FloorDto tmpFloorDto, JSONArray floors) {
+        JSONObject floor = null;
+        for (int cIndex = 0; cIndex < floors.size(); cIndex++) {
+            floor = floors.getJSONObject(cIndex);
+            if (!floor.containsKey("floorId")) {
+                continue;
+            }
+            if (StringUtil.isEmpty(floor.getString("floorId"))) {
+                continue;
+            }
+            if (floor.getString("floorId").equals(tmpFloorDto.getFloorId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+    private boolean hasInCommunity(FloorDto tmpFloorDto, JSONArray communitys) {
+        JSONObject community = null;
+        for (int cIndex = 0; cIndex < communitys.size(); cIndex++) {
+            community = communitys.getJSONObject(cIndex);
+            if (!community.containsKey("communityId")) {
+                continue;
+            }
+            if (StringUtil.isEmpty(community.getString("communityId"))) {
+                continue;
+            }
+            if (community.getString("communityId").equals(tmpFloorDto.getCommunityId())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+}
diff --git a/service-report/src/main/java/com/java110/report/cmd/fee/QueryAdminOweFeeDetailCmd.java b/service-report/src/main/java/com/java110/report/cmd/fee/QueryAdminOweFeeDetailCmd.java
new file mode 100644
index 0000000..5d79e2f
--- /dev/null
+++ b/service-report/src/main/java/com/java110/report/cmd/fee/QueryAdminOweFeeDetailCmd.java
@@ -0,0 +1,24 @@
+package com.java110.report.cmd.fee;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.utils.exception.CmdException;
+
+import java.text.ParseException;
+
+@Java110Cmd(serviceCode = "fee.queryAdminOweFeeDetail")
+public class QueryAdminOweFeeDetailCmd extends Cmd {
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        super.validateAdmin(context);
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+
+    }
+}
diff --git a/service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java b/service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java
index ca709c9..1f4a332 100755
--- a/service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java
+++ b/service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java
@@ -120,4 +120,6 @@
     List<Map> queryCommunityRepairTree(Map info);
 
     List<Map> queryCommunityInspectionTree(Map info);
+
+    List<Map> queryCommunityFloorTree(Map info);
 }
diff --git a/service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java b/service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java
index 6655da9..93ffcee 100755
--- a/service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java
+++ b/service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java
@@ -165,6 +165,15 @@
     }
 
     @Override
+    public List<Map> queryCommunityFloorTree(Map info) {
+        logger.debug("鏌ヨqueryCommunityFloorTree淇℃伅 鍏ュ弬 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryCommunityFloorTree", info);
+
+        return infos;
+    }
+
+    @Override
     public int queryHisOwnerCarCount(Map info) {
         logger.debug("鏌ヨ杞﹁締绠$悊鏁版嵁 鍏ュ弬 info : {}", info);
 
diff --git a/service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java b/service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java
index 5b591bf..fb5f774 100644
--- a/service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/smo/impl/ReportCommunityInnerServiceSMOImpl.java
@@ -4,6 +4,7 @@
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.floor.FloorDto;
 import com.java110.dto.inspection.InspectionPlanDto;
 import com.java110.dto.parking.ParkingAreaDto;
 import com.java110.dto.repair.RepairSettingDto;
@@ -113,6 +114,16 @@
     }
 
     @Override
+    public List<FloorDto> queryCommunityFloorTree(@RequestBody FloorDto floorDto) {
+        //鏍¢獙鏄惁浼犱簡 鍒嗛〉淇℃伅
+        List<FloorDto> floorDtos = BeanConvertUtil.covertBeanList(
+                reportCommunityServiceDaoImpl.queryCommunityFloorTree(BeanConvertUtil.beanCovertMap(floorDto)),
+                FloorDto.class);
+
+        return floorDtos;
+    }
+
+    @Override
     public int queryHisOwnerCarCount(@RequestBody OwnerCarDto ownerCarDto) {
         return reportCommunityServiceDaoImpl.queryHisOwnerCarCount(BeanConvertUtil.beanCovertMap(ownerCarDto));
     }

--
Gitblit v1.8.0