hanfucheng пре 1 година
родитељ
комит
f204b7a4e2

+ 87 - 19
src/main/java/com/sooka/sponest/data/housingconstruction/controller/CenterdataTHousingconstructionViewController.java

@@ -1,5 +1,6 @@
 package com.sooka.sponest.data.housingconstruction.controller;
 
+import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.sooka.sponest.data.housingconstruction.domain.*;
@@ -29,8 +30,19 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午3:03
     */
     @GetMapping("/getGasCylinderList")
-    public AjaxResult getGasCylinderList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
-        return AjaxResult.success(housingconstructionViewService.getGasCylinderList(steelcylinder));
+    public R getGasCylinderList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        return R.ok(housingconstructionViewService.getGasCylinderList(steelcylinder));
+    }
+
+    /*
+     * 从业人员岗位统计
+     *
+     * @author 韩福成
+     * @date 2024/8/2 上午8:46
+     */
+    @GetMapping("/getPractitionerPostList")
+    public R getPractitionerPostList(CenterdataTHousingconstructionPractitioner practitioner) {
+        return R.ok(housingconstructionViewService.getPractitionerPostList(practitioner));
     }
 
     /*
@@ -40,8 +52,8 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午3:28
     */
     @GetMapping("/getOrderList")
-    public AjaxResult getOrderList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
-        return AjaxResult.success(housingconstructionViewService.getOrderList(steelcylinder));
+    public R getOrderList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        return R.ok(housingconstructionViewService.getOrderList(steelcylinder));
     }
 
     /*
@@ -51,8 +63,8 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午4:18
     */
     @GetMapping("/getCarList")
-    public AjaxResult getCarList(CenterdataTHousingconstructionCar car) {
-        return AjaxResult.success(housingconstructionViewService.getCarList(car));
+    public R getCarList(CenterdataTHousingconstructionCar car) {
+        return R.ok(housingconstructionViewService.getCarList(car));
     }
 
     /*
@@ -62,8 +74,8 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午4:34
     */
     @GetMapping("/getUserList")
-    public AjaxResult getUserList(CenterdataTHousingconstructionRealnameuser realnameuser) {
-        return AjaxResult.success(housingconstructionViewService.getUserList(realnameuser));
+    public R getUserList(CenterdataTHousingconstructionRealnameuser realnameuser) {
+        return R.ok(housingconstructionViewService.getUserList(realnameuser));
     }
 
     /*
@@ -73,8 +85,8 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午4:49
     */
     @GetMapping("/getSteelcylinderList")
-    public AjaxResult getSteelcylinderList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
-        return AjaxResult.success(housingconstructionViewService.getSteelcylinderList(steelcylinder));
+    public R getSteelcylinderList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        return R.ok(housingconstructionViewService.getSteelcylinderList(steelcylinder));
     }
 
     /*
@@ -84,19 +96,19 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午6:31
     */
     @GetMapping("/getThreeUserList")
-    public AjaxResult getThreeUserList(CenterdataTHousingconstructionRealnameuser realnameuser) {
-        return AjaxResult.success(housingconstructionViewService.getThreeUserList(realnameuser));
+    public R getThreeUserList(CenterdataTHousingconstructionRealnameuser realnameuser) {
+        return R.ok(housingconstructionViewService.getThreeUserList(realnameuser));
     }
 
     /*
-    * 实名用户
+    * 实名用户(个体、商户)
     *
     * @author 韩福成
     * @date 2024/8/1 下午5:08
     */
     @GetMapping("/getRealnameuserList")
-    public AjaxResult getRealnameuserList(CenterdataTHousingconstructionRealnameuser realnameuser) {
-        return AjaxResult.success(housingconstructionViewService.getRealnameuserList(realnameuser));
+    public R getRealnameuserList(CenterdataTHousingconstructionRealnameuser realnameuser) {
+        return R.ok(housingconstructionViewService.getRealnameuserList(realnameuser));
     }
 
     /*
@@ -106,8 +118,8 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午5:31
     */
     @GetMapping("/getDeliverymanList")
-    public AjaxResult getDeliverymanList(CenterdataTHousingconstructionDeliveryPersonnel deliveryPersonnel) {
-        return AjaxResult.success(housingconstructionViewService.getDeliverymanList(deliveryPersonnel));
+    public R getDeliverymanList(CenterdataTHousingconstructionDeliveryPersonnel deliveryPersonnel) {
+        return R.ok(housingconstructionViewService.getDeliverymanList(deliveryPersonnel));
     }
 
     /*
@@ -117,7 +129,63 @@ public class CenterdataTHousingconstructionViewController extends BaseController
     * @date 2024/8/1 下午7:24
     */
     @GetMapping("/getEnterpriseList")
-    public AjaxResult getEnterpriseList(CenterdataTHousingconstructionEnterprise enterprise) {
-        return AjaxResult.success(housingconstructionViewService.getEnterpriseList(enterprise));
+    public R getEnterpriseList(CenterdataTHousingconstructionEnterprise enterprise) {
+        return R.ok(housingconstructionViewService.getEnterpriseList(enterprise));
+    }
+
+    /*
+    * 储罐列表
+    *
+    * @author 韩福成
+    * @date 2024/8/2 上午10:59
+    */
+    @GetMapping("/getStoragetankList")
+    public R getStoragetankList(CenterdataTHousingconstructionStoragetank storagetank) {
+        return R.ok(housingconstructionViewService.getStoragetankList(storagetank));
+    }
+
+    /*
+    * 钢瓶当日状态统计
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午2:10
+    */
+    @GetMapping("/getSteelcylinderStateList")
+    public R getSteelcylinderStateList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        return R.ok(housingconstructionViewService.getSteelcylinderStateList(steelcylinder));
+    }
+
+    /*
+    * 入户用户列表
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午3:46
+    */
+    @GetMapping("/getJoinHouseUserList")
+    public R getJoinHouseUserList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        return R.ok(housingconstructionViewService.getJoinHouseUserList(steelcylinder));
     }
+
+    /*
+    * 入库记录
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午4:36
+    */
+//    @GetMapping("/getJoinHouseUserList")
+//    public R getJoinHouseUserList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+//        return R.ok(housingconstructionViewService.getJoinHouseUserList(steelcylinder));
+//    }
+
+    /*
+    * 今日派送订单
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午4:48
+    */
+//    @GetMapping("/getJoinHouseUserList")
+//    public R getJoinHouseUserList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+//        return R.ok(housingconstructionViewService.getJoinHouseUserList(steelcylinder));
+//    }
+
 }

+ 2 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/domain/CenterdataTHousingconstructionStoragetank.java

@@ -92,6 +92,8 @@ public class CenterdataTHousingconstructionStoragetank extends BaseBusinessEntit
     @Excel(name = "周边可燃性气体泄漏")
     private Integer gasLeak;
 
+    private String state;
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 8 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/mapper/CenterdataTHousingconstructionViewMapper.java

@@ -32,4 +32,12 @@ public interface CenterdataTHousingconstructionViewMapper {
 
     public List<Map<String,Object>> getEnterpriseList(CenterdataTHousingconstructionEnterprise enterprise);
 
+    public List<Map<String,Object>> getPractitionerPostList(CenterdataTHousingconstructionPractitioner practitioner);
+
+    public List<Map<String,Object>> getStoragetankList(CenterdataTHousingconstructionStoragetank storagetank);
+
+    public List<Map<String,Object>> getSteelcylinderStateList(CenterdataTHousingconstructionSteelcylinder steelcylinder);
+
+    public List<Map<String,Object>> getJoinHouseUserList(CenterdataTHousingconstructionSteelcylinder steelcylinder);
+
 }

+ 8 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/service/ICenterdataTHousingconstructionViewService.java

@@ -32,4 +32,12 @@ public interface ICenterdataTHousingconstructionViewService {
 
     public List<Map<String,Object>> getEnterpriseList(CenterdataTHousingconstructionEnterprise enterprise);
 
+    public List<Map<String,Object>> getPractitionerPostList(CenterdataTHousingconstructionPractitioner practitioner);
+
+    public List<Map<String,Object>> getStoragetankList(CenterdataTHousingconstructionStoragetank storagetank);
+
+    public List<Map<String,Object>> getSteelcylinderStateList(CenterdataTHousingconstructionSteelcylinder steelcylinder);
+
+    public List<Map<String,Object>> getJoinHouseUserList(CenterdataTHousingconstructionSteelcylinder steelcylinder);
+
 }

+ 51 - 0
src/main/java/com/sooka/sponest/data/housingconstruction/service/impl/CenterdataTHousingconstructionViewServiceImpl.java

@@ -139,4 +139,55 @@ public class CenterdataTHousingconstructionViewServiceImpl extends BaseServiceIm
         return centerdataTHousingconstructionViewMapper.getEnterpriseList(enterprise);
     }
 
+    /*
+    * 从业人员岗位统计
+    *
+    * @author 韩福成
+    * @date 2024/8/2 上午8:57
+    */
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String,Object>> getPractitionerPostList(CenterdataTHousingconstructionPractitioner practitioner) {
+        setSookaDataBase(practitioner);
+        return centerdataTHousingconstructionViewMapper.getPractitionerPostList(practitioner);
+    }
+
+    /*
+    * 储罐列表
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午1:29
+    */
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String,Object>> getStoragetankList(CenterdataTHousingconstructionStoragetank storagetank) {
+        setSookaDataBase(storagetank);
+        return centerdataTHousingconstructionViewMapper.getStoragetankList(storagetank);
+    }
+
+    /*
+    * 钢瓶当日状态统计
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午2:12
+    */
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String,Object>> getSteelcylinderStateList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        setSookaDataBase(steelcylinder);
+        return centerdataTHousingconstructionViewMapper.getSteelcylinderStateList(steelcylinder);
+    }
+
+    /*
+    * 入户用户列表
+    *
+    * @author 韩福成
+    * @date 2024/8/2 下午4:11
+    */
+    @DataScopeMutiDept(deptAlias = "d")
+    @Override
+    public List<Map<String,Object>> getJoinHouseUserList(CenterdataTHousingconstructionSteelcylinder steelcylinder) {
+        setSookaDataBase(steelcylinder);
+        return centerdataTHousingconstructionViewMapper.getJoinHouseUserList(steelcylinder);
+    }
 }

+ 115 - 6
src/main/resources/mapper/housingconstruction/CenterdataTHousingconstructionViewMapper.xml

@@ -44,10 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="getCarList" parameterType="CenterdataTHousingconstructionCar" resultType="map">
         SELECT
             a.car_number carNumber,
-            a.manager_name managerName,
+            a.driver_name driverName,
+            b.phone,
             a.speed
         FROM
             centerdata_t_housingconstruction_car a
+            left join centerdata_t_housingconstruction_delivery_personnel b on a.driver_id = b.id
             left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
         <where>
             <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
@@ -175,17 +177,124 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="getEnterpriseList" parameterType="CenterdataTHousingconstructionEnterprise" resultType="map">
         SELECT
-            a.id enterpriseId,
+            a.id,
             a.enterprise_name enterpriseName,
-            count( b.id ) num
+            count(DISTINCT b.id) cgNum,
+            count(DISTINCT c.id) gpNum,
+            count(DISTINCT e.id) aqNum,
+            count(DISTINCT f.id) yxNum,
+            sum(b.storage_capacity) storageCapacity
         FROM
             centerdata_t_housingconstruction_enterprise a
+            LEFT JOIN centerdata_t_housingconstruction_storagetank b ON a.id = b.enterprise_id
+            left join centerdata_t_housingconstruction_steelcylinder c on a.id = c.enterprise_id
+            left join  (SELECT id,storagetank_id, security_state FROM centerdata_t_housingconstruction_storagetank_log
+                    WHERE create_time = (SELECT MAX(create_time) FROM centerdata_t_housingconstruction_storagetank_log) and security_state is null) e on b.id = e.storagetank_id and security_state is null
+            left join  centerdata_t_housingconstruction_storagetank_log f on b.id = f.storagetank_id and run_state = 1
                 LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
-                LEFT JOIN centerdata_t_housingconstruction_steelcylinder b ON a.id = b.enterprise_id
         <where>
             ${params.dataScope}
         </where>
-        GROUP BY
-            a.id
+        group by a.id
+    </select>
+
+    <select id="getPractitionerPostList" parameterType="CenterdataTHousingconstructionPractitioner" resultType="map">
+        SELECT
+            a.dict_label type,
+            IFNULL(b.num ,0) num
+        FROM
+            ${database_system}.sys_dict_data a
+            LEFT JOIN (
+            SELECT
+                a.post,
+                count( a.id ) num
+            FROM
+                centerdata_t_housingconstruction_practitioner a
+                    LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
+        <where>
+            ${params.dataScope}
+        </where>
+            GROUP BY a.post
+            ) b ON a.dict_value = b.post
+        WHERE a.dict_type = 'practitioner_post'
+    </select>
+
+    <select id="getStoragetankList" parameterType="CenterdataTHousingconstructionStoragetank" resultType="map">
+        SELECT
+            a.storagetank_id storagetankId,
+            a.storagetank_name storagetankName,
+            a.level,
+            a.heat,
+            a.pressure,
+            a.gas_leak gasLeak,
+            a.security_state securityState,
+            a.run_state runState
+        FROM
+            centerdata_t_housingconstruction_storagetank_log a
+                left join centerdata_t_housingconstruction_storagetank b on a.storagetank_id = b.id
+                left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+                JOIN (
+                SELECT storagetank_id,MAX(create_time) AS max_time
+                FROM centerdata_t_housingconstruction_storagetank_log
+                GROUP BY storagetank_id
+            ) b ON a.storagetank_id = b.storagetank_id AND a.create_time = b.max_time
+        <where>
+            <if test="enterpriseId != null  and enterpriseId != ''"> and b.enterprise_id = #{enterpriseId}</if>
+            <if test="state != null  and state != ''"> and a.security_state is not null</if>
+            ${params.dataScope}
+        </where>
+    </select>
+
+    <select id="getSteelcylinderStateList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
+        SELECT
+            '今日入库' type,
+            count( b.id ) num
+        FROM
+            centerdata_t_housingconstruction_steelcylinder a
+                left join centerdata_t_housingconstruction_steelcylinder_log b on a.id = b.steelcylinder_id
+                left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        WHERE DATE( join_warehouse_time ) = DATE( NOW( ) )
+        <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
+                ${params.dataScope}
+        UNION ALL
+        SELECT
+            '今日派送' type,
+            count( b.id ) num
+        FROM
+            centerdata_t_housingconstruction_steelcylinder a
+                left join centerdata_t_housingconstruction_steelcylinder_log b on a.id = b.steelcylinder_id
+                left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        WHERE DATE( delivery_time ) = DATE( NOW( ) )
+        <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
+                ${params.dataScope}
+        UNION ALL
+        SELECT
+            '空罐回收' type,
+            count( b.id ) num
+        FROM
+            centerdata_t_housingconstruction_steelcylinder a
+                left join centerdata_t_housingconstruction_steelcylinder_log b on a.id = b.steelcylinder_id
+                left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        WHERE DATE( recycling_time ) = DATE( NOW( ) )
+        <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
+                ${params.dataScope}
+    </select>
+
+    <select id="getJoinHouseUserList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
+        SELECT
+            a.id,
+            a.`name`,
+            b.join_house_id joinHouseId,
+            b.join_house_name joinHouseName,
+            c.gas_address gasAddress
+        FROM
+            centerdata_t_housingconstruction_steelcylinder a
+            left join centerdata_t_housingconstruction_steelcylinder_log b on a.id = b.steelcylinder_id and recycling_time is null
+            left join centerdata_t_housingconstruction_realnameuser c on b.join_house_id = c.id
+            left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
+        WHERE
+            a.state = 'state_4'
+        <if test="enterpriseId != null  and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
+            ${params.dataScope}
     </select>
 </mapper>