Commit 387fa00f authored by 李秀明's avatar 李秀明

消防员出勤接口

parent f632bbad
...@@ -30,5 +30,23 @@ public interface SignMapper extends BaseMapper<Sign> { ...@@ -30,5 +30,23 @@ public interface SignMapper extends BaseMapper<Sign> {
int queryPersonNum(String bizOgrCode); int queryPersonNum(String bizOgrCode);
// Map<String, Object> getSignStatistic(@Param("bizOrgCode") String bizOgrCode, @Param("userId") String userId); List<Map<String, Object>> selectCenterSignStats(
@Param("bizOrgCode") String bizOrgCode,
@Param("date") String date,
@Param("targetPassNum") Integer targetPassNum,
@Param("stationType") String stationType
);
List<Map<String, Object>> selectStationSignStats(@Param("bizOrgCode") String bizOrgCode);
IPage<Map<String, Object>> selectStationAttendanceStatsPage(
@Param("page") IPage<?> page,
@Param("date") String date,
@Param("stationType") String stationType,
@Param("bizOrgCode") String bizOrgCode,
@Param("attendanceStatus") String attendanceStatus,
@Param("targetPassNum") Integer targetPassNum,
@Param("sortField") String sortField,
@Param("sortOrder") String sortOrder
);
} }
package com.yeejoin.amos.boot.module.jcs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
public interface StationInfoMapper extends BaseMapper {
Long count(@Param("stationType") String stationType);
}
...@@ -148,7 +148,93 @@ ...@@ -148,7 +148,93 @@
GROUP BY biz_org_code GROUP BY biz_org_code
</select> </select>
<!-- <select id="getSignStatistic" resultType="Map">--> <select id="selectCenterSignStats" resultType="Map">
SELECT
t.BIZ_ORG_CODE AS bizOrgCode,
t.BIZ_ORG_NAME AS bizOrgName,
COUNT(DISTINCT t.user_id) AS num,
IF(COUNT(DISTINCT t.user_id) >= #{targetPassNum}, 'pass', 'fail') AS status
FROM
cb_sign t
RIGHT JOIN idx_biz_station_info s ON s.biz_ORG_CODE = t.biz_ORG_CODE
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="date != null and date != ''">
AND t.DATE = #{date}
</if>
<if test="stationType != null and stationType != ''">
AND s.STATION_TYPE = #{stationType}
</if>
</where>
GROUP BY
t.BIZ_ORG_CODE
</select>
<select id="selectStationSignStats" resultType="Map">
SELECT
t.DATE AS date,
IFNULL(COUNT(DISTINCT t.user_id), 0) AS num
FROM
cb_sign t
WHERE
t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
AND t.DATE &gt;= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
GROUP BY
t.DATE
</select>
<!-- </select>--> <select id="selectStationAttendanceStatsPage" resultType="Map">
SELECT
t2.BIZ_ORG_CODE AS bizOrgCode,
t2.NAME AS bizOrgName,
CONCAT(t2.STATION_TYPE, '换流站') AS stationType,
#{date} AS date,
IFNULL(t1.num, 0) AS signNum,
(SELECT COUNT(1) FROM cb_firefighters t WHERE t.BIZ_ORG_CODE LIKE CONCAT(t2.BIZ_ORG_CODE, '%') AND t.PEOPLE_TYPE = 1601 AND t.IS_DELETE = false) AS firefighterNum,
ROUND(ROUND(IFNULL(t1.num, 0) / (SELECT COUNT(1) FROM cb_firefighters t WHERE t.BIZ_ORG_CODE LIKE CONCAT(t2.BIZ_ORG_CODE, '%') AND t.PEOPLE_TYPE = 1601 AND t.IS_DELETE = false), 4) * 100, 2) AS attendanceRate,
IF(IFNULL(t1.num, 0) >= #{targetPassNum}, '合格', '不合格') AS attendanceStatus
FROM (
SELECT
t.BIZ_ORG_CODE AS bizOrgCode,
COUNT( DISTINCT t.user_id ) AS num
FROM
cb_sign t
<where>
t.DATE = #{date}
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
t.BIZ_ORG_CODE
) t1
RIGHT JOIN idx_biz_station_info t2 ON t2.BIZ_ORG_CODE = t1.bizOrgCode
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t2.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="stationType != null and stationType != ''">
AND t2.STATION_TYPE = #{stationType}
</if>
<if test="attendanceStatus != null and attendanceStatus != ''">
AND IF(IFNULL(t1.num, 0) >= #{targetPassNum}, 'pass', 'fail') = #{attendanceStatus}
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != ''">
<choose>
<when test="sortOrder == 'ascend'">
${sortField} ASC
</when>
<otherwise>
${sortField} DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
signNum DESC
</if>
</select>
</mapper> </mapper>
<?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.yeejoin.amos.boot.module.jcs.api.mapper.StationInfoMapper">
<select id="count" resultType="long">
SELECT
COUNT(1)
FROM idx_biz_station_info t
<where>
<if test="stationType != null and stationType != ''">
AND t.STATION_TYPE = #{stationType}
</if>
</where>
</select>
</mapper>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-08-31-chenhao-1"> <changeSet author="chenhao" id="2021-08-31-chenhao-1">
<comment>modify table cb_firefighters_thought add one columns</comment> <comment>modify table cb_firefighters_thought add one columns</comment>
<sql> <sql>
ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间'; ALTER TABLE `cb_firefighters_thought` modify talking_time datetime COMMENT '谈话时间';
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1169', '1169', '环支状管网', 'XFJSGW', NULL, NULL, NULL, NULL, NULL, '\0', '1'); INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1169', '1169', '环支状管网', 'XFJSGW', NULL, NULL, NULL, NULL, NULL, '\0', '1');
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1170', '1170', '可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1'); INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1170', '1170', '可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1');
INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1171', '1171', '不可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1'); INSERT INTO cb_data_dictionary (`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES ('1171', '1171', '不可用', 'SYZT', NULL, NULL, NULL, NULL, NULL, '\0', '1');
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="guowubin" id="1629430730658-1"> <changeSet author="guowubin" id="1629430730658-1">
<comment>alter table jc_controller</comment> <comment>alter table jc_controller</comment>
...@@ -561,7 +561,7 @@ ...@@ -561,7 +561,7 @@
'调派任务状态(执行中:executing,已完成:finished)'; '调派任务状态(执行中:executing,已完成:finished)';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-09-13-chenhao-1"> <changeSet author="chenhao" id="2021-09-13-chenhao-1">
<comment>update data cb_firefighters_workexperience</comment> <comment>update data cb_firefighters_workexperience</comment>
<sql> <sql>
...@@ -1583,7 +1583,7 @@ ...@@ -1583,7 +1583,7 @@
INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674815', '值班消防', 'dutyFireFighting', '0', NULL, '10', '1', NULL, NULL, '2021-09-28 10:34:05', '\0'); INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674815', '值班消防', 'dutyFireFighting', '0', NULL, '10', '1', NULL, NULL, '2021-09-28 10:34:05', '\0');
</sql> </sql>
</changeSet> </changeSet>
<changeSet id="2021-10-13" author="chenhao-2"> <changeSet id="2021-10-13" author="chenhao-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column" /> <tableExists tableName="cb_dynamic_form_column" />
...@@ -1775,7 +1775,7 @@ ...@@ -1775,7 +1775,7 @@
INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674816', '值班120急救站', 'dutyFirstAid', '0', NULL, '10', '1', NULL, NULL, '2021-10-14 16:48:41', '\0'); INSERT INTO cb_dynamic_form_group (`sequence_nbr`, `group_name`, `group_code`, `parent_id`, `group_config`, `org_code`, `sort`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`) VALUES ('132828674816', '值班120急救站', 'dutyFirstAid', '0', NULL, '10', '1', NULL, NULL, '2021-10-14 16:48:41', '\0');
</sql> </sql>
</changeSet> </changeSet>
<changeSet id="2021-10-14" author="chenhao-2"> <changeSet id="2021-10-14" author="chenhao-2">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="cb_dynamic_form_column" /> <tableExists tableName="cb_dynamic_form_column" />
...@@ -2032,8 +2032,8 @@ ...@@ -2032,8 +2032,8 @@
<sql> <sql>
ALTER TABLE cb_firefighters ADD fire_team_name varchar(100) NULL COMMENT '消防队伍名称' ALTER TABLE cb_firefighters ADD fire_team_name varchar(100) NULL COMMENT '消防队伍名称'
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-02-3"> <changeSet author="chenhao" id="2021-11-02-3">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2044,8 +2044,8 @@ ...@@ -2044,8 +2044,8 @@
<sql> <sql>
ALTER TABLE cb_key_site ADD belong_name varchar(100) NULL COMMENT '所属单位/部门名称'; ALTER TABLE cb_key_site ADD belong_name varchar(100) NULL COMMENT '所属单位/部门名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-02-4"> <changeSet author="chenhao" id="2021-11-02-4">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2056,8 +2056,8 @@ ...@@ -2056,8 +2056,8 @@
<sql> <sql>
ALTER TABLE cb_org_usr ADD parent_name varchar(100) NULL COMMENT '归属机构/部门/人员名称'; ALTER TABLE cb_org_usr ADD parent_name varchar(100) NULL COMMENT '归属机构/部门/人员名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-04-1"> <changeSet author="chenhao" id="2021-11-04-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2068,8 +2068,8 @@ ...@@ -2068,8 +2068,8 @@
<sql> <sql>
ALTER TABLE cb_fire_team ADD parent_name varchar(100) NULL COMMENT '父级队伍名称'; ALTER TABLE cb_fire_team ADD parent_name varchar(100) NULL COMMENT '父级队伍名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litw" id="2021-11-03-01"> <changeSet author="litw" id="2021-11-03-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2093,7 +2093,7 @@ ...@@ -2093,7 +2093,7 @@
) COMMENT = '消防水源物联参数' ; ) COMMENT = '消防水源物联参数' ;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="chenhao" id="2021-11-05-1"> <changeSet author="chenhao" id="2021-11-05-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
...@@ -2104,7 +2104,7 @@ ...@@ -2104,7 +2104,7 @@
<sql> <sql>
ALTER TABLE cb_maintenance_company ADD parent_name varchar(100) NULL COMMENT '所属单位/部门名称'; ALTER TABLE cb_maintenance_company ADD parent_name varchar(100) NULL COMMENT '所属单位/部门名称';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litw" id="2021-11-05-01"> <changeSet author="litw" id="2021-11-05-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
...@@ -2745,7 +2745,7 @@ ...@@ -2745,7 +2745,7 @@
ALTER TABLE cb_fire_station ADD parent_building_id varchar(1000) NULL COMMENT '所属建筑节点的所有父节点id集合'; ALTER TABLE cb_fire_station ADD parent_building_id varchar(1000) NULL COMMENT '所属建筑节点的所有父节点id集合';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20220207-1" runAlways="true"> <changeSet author="tw" id="20220207-1" runAlways="true">
<comment>`getParentList`</comment> <comment>`getParentList`</comment>
<sql endDelimiter="#"> <sql endDelimiter="#">
...@@ -3971,15 +3971,27 @@ ...@@ -3971,15 +3971,27 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20240801"> <changeSet author="ky" id="20240801">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="idx_biz_station_info" columnName="warehouse_id"/> <columnExists tableName="idx_biz_station_info" columnName="station_type"/>
</not> </not>
</preConditions> </preConditions>
<comment>新增属性字段 warehouse_id</comment> <comment>新增属性字段 station_type</comment>
<sql> <sql>
alter table `idx_biz_station_info` add column `station_type` varchar(20) DEFAULT NULL COMMENT '换流站类型'; alter table `idx_biz_station_info` add column `station_type` varchar(20) DEFAULT NULL COMMENT '换流站类型';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="lixm" id="20240801">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="idx_biz_station_info" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>新增属性字段 biz_org_code</comment>
<sql>
alter table `idx_biz_station_info` add column `biz_org_code` varchar(50) DEFAULT NULL COMMENT 'BIZ_ORG_CODE';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
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