浏览代码

大屏统计sql

Mr.Yang 11 月之前
父节点
当前提交
dd61d8a34b

+ 23 - 0
zfjg-api/zfjg-api-manage/src/main/java/com/zfjg/manage/api/dto/statistics/CommonQueryDto.java

@@ -0,0 +1,23 @@
+package com.zfjg.manage.api.dto.statistics;
+
+import lombok.Data;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-27
+ * @Description:
+ */
+@Data
+public class CommonQueryDto {
+
+    /**
+     * 开始时间
+     */
+    private String startTime;
+
+    /**
+     * 结束时间
+     */
+    private String endTime;
+
+}

+ 16 - 0
zfjg-api/zfjg-api-manage/src/main/java/com/zfjg/manage/api/vo/DeptVo.java

@@ -0,0 +1,16 @@
+package com.zfjg.manage.api.vo;
+
+import lombok.Data;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-27
+ * @Description:
+ */
+@Data
+public class DeptVo {
+
+    private String enforceOrgId;
+    private String deptName;
+
+}

+ 85 - 0
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/controller/statistics/StatisticsController.java

@@ -0,0 +1,85 @@
+package com.zfjg.manage.controller.statistics;
+
+import com.zfjg.common.core.domain.R;
+import com.zfjg.manage.api.dto.statistics.CommonQueryDto;
+import com.zfjg.manage.api.vo.DeptVo;
+import com.zfjg.manage.service.statistics.StatisticsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-27
+ * @Description:
+ */
+@RestController
+@RequestMapping("/statistics")
+@Api(tags = "大屏统计")
+@Slf4j
+public class StatisticsController {
+
+
+    @Autowired
+    private StatisticsService statisticsServiceImpl;
+
+    @ApiOperation(value = "部门列表")
+    @PostMapping("/deptList")
+    public R<List<DeptVo>> deptList() {
+        List<DeptVo> list = statisticsServiceImpl.deptList();
+        return R.ok(list);
+    }
+
+    @ApiOperation(value = "检查总数(家)")
+    @PostMapping("/jczs")
+    public R<Integer> jczs(@RequestBody CommonQueryDto commonQueryDto) {
+        int count = statisticsServiceImpl.jczs(commonQueryDto);
+        return R.ok(count);
+    }
+
+    /**
+     * 监督抽查(专项、日常)
+     * @param commonQueryDto
+     * @return
+     */
+    @ApiOperation(value = "监督抽查(家)")
+    @PostMapping("/jdcc")
+    public R<Integer> jdcc(@RequestBody CommonQueryDto commonQueryDto) {
+        int count = statisticsServiceImpl.jdcc(commonQueryDto);
+        return R.ok(count);
+    }
+
+
+
+
+    /**
+     * 限改通知(份)
+     * @param commonQueryDto
+     * @return
+     */
+    @ApiOperation(value = "限改通知(份)")
+    @PostMapping("/xgtz")
+    public R<Integer> xgtz(@RequestBody CommonQueryDto commonQueryDto) {
+        int count = statisticsServiceImpl.xgtz(commonQueryDto);
+        return R.ok(count);
+    }
+
+    /**
+     * 执法人员
+     * @param commonQueryDto
+     * @return
+     */
+    @ApiOperation(value = "执法人员")
+    @PostMapping("/zfry")
+    public R<Integer> zfry(@RequestBody CommonQueryDto commonQueryDto) {
+        int count = statisticsServiceImpl.zfry(commonQueryDto);
+        return R.ok(count);
+    }
+}

+ 67 - 0
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/mapper/StatisticsMapper.java

@@ -0,0 +1,67 @@
+package com.zfjg.manage.mapper;
+
+import com.zfjg.manage.api.dto.statistics.CommonQueryDto;
+import com.zfjg.manage.api.vo.DeptVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-27
+ * @Description:
+ */
+@Mapper
+public interface StatisticsMapper {
+
+    /**
+     * 部门列表
+     *
+     * @return {@link List}<{@link DeptVo}>
+     */
+    List<DeptVo> deptList();
+
+    /**
+     * 监督抽查(专项、日常)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int selectJdcc(CommonQueryDto commonQueryDto);
+
+    /**
+     * 检查总数(家)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int selectJczs(CommonQueryDto commonQueryDto);
+
+
+    /**
+     * 举报投诉核查(次)
+     * @param commonQueryDto
+     * @return int
+     */
+    int selectJbtsjc(CommonQueryDto commonQueryDto);
+
+
+    /**
+     * 限改通知(份)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int selectXgtz(CommonQueryDto commonQueryDto);
+
+
+    /**
+     * 执法人员
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int selectZfry(CommonQueryDto commonQueryDto);
+
+
+}

+ 87 - 0
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/service/impl/statistics/StatisticsServiceImpl.java

@@ -0,0 +1,87 @@
+package com.zfjg.manage.service.impl.statistics;
+
+
+import com.zfjg.manage.api.dto.statistics.CommonQueryDto;
+import com.zfjg.manage.api.vo.DeptVo;
+import com.zfjg.manage.mapper.StatisticsMapper;
+import com.zfjg.manage.service.statistics.StatisticsService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-27
+ * @Description:
+ */
+@Service
+public class StatisticsServiceImpl implements StatisticsService {
+
+    @Resource
+    private StatisticsMapper statisticsMapper;
+    /**
+     * @return {@link List}<{@link DeptVo}>
+     */
+    @Override
+    public List<DeptVo> deptList() {
+        return statisticsMapper.deptList();
+    }
+
+
+    /**
+     * 检查总数
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    @Override
+    public int jczs(CommonQueryDto commonQueryDto) {
+        return statisticsMapper.selectJczs(commonQueryDto);
+    }
+    /**
+     * 监督抽查(专项、日常)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    @Override
+    public int jdcc(CommonQueryDto commonQueryDto) {
+        return statisticsMapper.selectJdcc(commonQueryDto);
+    }
+
+    /**
+     * 举报投诉核查(次)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    @Override
+    public int jbtsjc(CommonQueryDto commonQueryDto) {
+        return statisticsMapper.selectJbtsjc(commonQueryDto);
+    }
+
+
+    /**
+     * 限改通知(份)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    @Override
+    public int xgtz(CommonQueryDto commonQueryDto) {
+        return statisticsMapper.selectXgtz(commonQueryDto);
+    }
+
+    /**
+     * 执法人员
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    @Override
+    public int zfry(CommonQueryDto commonQueryDto) {
+        return statisticsMapper.selectZfry(commonQueryDto);
+    }
+
+}

+ 63 - 0
zfjg-modules/zfjg-manage/src/main/java/com/zfjg/manage/service/statistics/StatisticsService.java

@@ -0,0 +1,63 @@
+package com.zfjg.manage.service.statistics;
+
+import com.zfjg.common.core.domain.R;
+import com.zfjg.manage.api.dto.statistics.CommonQueryDto;
+import com.zfjg.manage.api.vo.DeptVo;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+/**
+ * @Author: Mr.Yang
+ * @CreateTime: 2024-02-27
+ * @Description:
+ */
+public interface StatisticsService {
+
+    /**
+     * @return {@link List}<{@link DeptVo}>
+     */
+    List<DeptVo> deptList();
+
+    /**
+     * 检查总数
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int jczs(@RequestBody CommonQueryDto commonQueryDto);
+
+    /**
+     * 监督抽查(专项、日常)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int jdcc(CommonQueryDto commonQueryDto);
+
+    /**
+     * 举报投诉核查(次)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int jbtsjc(CommonQueryDto commonQueryDto);
+
+    /**
+     * 限改通知(份)
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int xgtz(CommonQueryDto commonQueryDto);
+
+
+    /**
+     * 执法人员
+     *
+     * @param commonQueryDto
+     * @return int
+     */
+    int zfry(CommonQueryDto commonQueryDto);
+
+}

+ 51 - 0
zfjg-modules/zfjg-manage/src/main/resources/mapper/StatisticsMapper.xml

@@ -0,0 +1,51 @@
+<?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.zfjg.manage.mapper.StatisticsMapper">
+
+
+    <select id="deptList" resultType="com.zfjg.manage.api.vo.DeptVo">
+        SELECT enforce_org_id, dept_name FROM sys_dept WHERE dept_name!='测试支队'
+    </select>
+
+
+    <select id="selectJdcc" resultType="int" parameterType="com.zfjg.manage.api.dto.statistics.CommonQueryDto">
+        SELECT COUNT(DISTINCT enforce_obj_id ) countObj FROM enforce_job  WHERE is_deleted = 0 AND job_type IN ('NORMAL','SPECIAL')
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') between #{startTime} and #{endTime}
+        </if>
+    </select>
+
+
+    <select id="selectJczs" resultType="int" parameterType="com.zfjg.manage.api.dto.statistics.CommonQueryDto">
+        SELECT COUNT(DISTINCT enforce_obj_id ) countObj FROM enforce_job WHERE is_deleted = 0 AND job_type != 'BRIGADE'
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') between #{startTime} and #{endTime}
+        </if>
+    </select>
+
+<!--    举报投诉核查(次)-->
+    <select id="selectJbtsjc" resultType="int">
+        SELECT COUNT(id) countObj FROM enforce_job  WHERE is_deleted = 0 AND job_type IN ('REPORT')
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') between #{startTime} and #{endTime}
+        </if>
+    </select>
+
+
+
+
+
+
+
+
+    <select id="selectXgtz" resultType="int">
+            SELECT COUNT(id) FROM enforce_job WHERE immediately_file_id IS NOT NULL AND is_deleted = 0
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and DATE_FORMAT(create_time,'%Y-%m-%d %H:%i:%s') between #{startTime} and #{endTime}
+        </if>
+    </select>
+
+    <select id="selectZfry" resultType="int">
+        SELECT COUNT(user_id) FROM sys_user WHERE `status` = 0 AND del_flag = 0
+    </select>
+</mapper>