Commit 2979a0b3 authored by chenzhao's avatar chenzhao

规则配置 查询接口

parent f15e4593
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import org.apache.ibatis.annotations.Param;
......@@ -132,4 +133,6 @@ public interface DutyPersonShiftMapper extends BaseMapper<DutyPersonShift> {
Map<String, Object> getFireTeamBySequenceNbr (long sequenceNbr);
List<Map<String, Object>> getFirstAidForTypeCodeAndCompanyId(long company);
List<Map<String, Object>> queryByCompanyId(Long companyId);
}
......@@ -36,4 +36,6 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<FirefightersExcelDto> exportToExcel(Boolean isDelete, String name, String postQualification, String fireTeamId,
String state, String areasExpertise, String jobTitle);
List<FirefightersDto> queryById(Long teamId,String[] gw);
}
......@@ -91,4 +91,6 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List< Map<String,String>> getPersonSimpleDetail();
List<Map<String, Long>> countDeptByCompanyId(@Param("companyIdList") List<String> companyIdList);
List<Map<String,Object>> queryCompanyId(Long id);
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.api.service;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import java.util.List;
import java.util.Map;
/**
* @author DELL
......@@ -32,4 +33,6 @@ public interface IDutyPersonService extends IDutyCommonService {
* @return
*/
List<DutyPersonDto> findByDutyAreaId(Long dutyAreaId);
List<Map<String, Object>> queryByCompanyId(Long companyId);
}
......@@ -20,7 +20,7 @@
and s.duty_date >= #{beginDate}
and s.duty_date <![CDATA[<=]]>
#{endDate}
AND s.shift_id is not null <!--// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。
AND s.shift_id is not null <!--// BUG 2807 更新人员车辆排版值班的保存逻辑 如果没有填写数据则保存空数据 。
同步修改 查询 导出相关逻辑 by kongfm 2021-09-14 -->
and s.app_Key = #{appKey}
GROUP BY s.duty_date,s.shift_id <!--增添分组条件 根据班次分组技术 -->
......@@ -127,7 +127,7 @@
<if test="params != null and params!='' ">
and cd.field_value !='消防车驾驶员'
</if>
AND cd.instance_id IN
AND cd.instance_id IN
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
#{instanceId}
</foreach>
......@@ -150,7 +150,7 @@
cd.FIELD_VALUE
END
) AS #{equipmentName},
MAX(
CASE
WHEN cd.FIELD_CODE = #{teamName} THEN
......@@ -174,7 +174,7 @@
cd.is_delete=0
group by cd.instance_id
) result group by ${groupByName}
</select>
<select id='getInstanceIdForSpecifyDateAndEquipment'
resultType='map'>
......@@ -201,7 +201,7 @@
</select>
<select id='getEquipmentOperator' resultType='map'>
SELECT
result.userName
result.userName
FROM
(
SELECT
......@@ -235,7 +235,7 @@ FROM
cd.group_code = #{groupCode}
AND cds.instance_id IS NOT NULL
AND cd.is_delete = 0
AND cd.instance_id IN
AND cd.instance_id IN
<foreach collection ='instanceIds' item='instanceId' index='index' open="(" close= ")" separator=",">
#{instanceId}
</foreach>
......@@ -243,8 +243,8 @@ FROM
WHERE
result.postTypeName = #{operator} and result.name =#{duty}
</select>
<select id ='getPositionStaffDutyForSpecifyDate' resultType="map">
SELECT
GROUP_CONCAT(ss.userName) AS userName,
......@@ -294,7 +294,7 @@ WHERE
GROUP BY
ss.postTypeName
</select>
<select id='getDutyForSpecifyDate' resultType="map">
SELECT
ds.`name`
......@@ -307,7 +307,7 @@ AND dp.is_delete = 0
AND NAME IS NOT NULL
GROUP BY
NAME
</select>
</select>
<select id='getFireTeamBySequenceNbr' resultType="map">
......@@ -341,4 +341,26 @@ AND cft.type_code = (
AND cft.company = #{company}
</select>
<select id='queryByCompanyId' resultType="map">
SELECT
e.field_code,
e.field_name,
e.field_value
FROM
cb_dynamic_form_instance e,
(SELECT
i.*
FROM
cb_dynamic_form_instance i
,
(SELECT * FROM `cb_duty_person_shift` where to_days(duty_date) = to_days(now())) b
WHERE
i.instance_id = b.instance_id
AND
i.field_code = 'deptId'
AND
i.field_value = #{companyId}) c
WHERE
e. instance_id = c.instance_id
</select>
</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.common.api.mapper.FirefightersMapper">
namespace="com.yeejoin.amos.boot.module.common.api.mapper.FirefightersMapper">
<select id="getFirefightersJobTitleCount"
resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto">
select COUNT(a.sequence_nbr) num, a.job_title_code
jobTitleCode
from cb_firefighters a
where a.is_delete = 0
GROUP BY
a.job_title_code
</select>
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefighters"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto">
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code
areasExpertiseCode from cb_firefighters a LEFT JOIN
cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date desc limit #{pageNum},#{pageSize}
</select>
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefightersCount" resultType="Map">
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code =#{par.areasExpertiseCode}</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
<select id="getFirefightersJobTitleCount"
resultType="com.yeejoin.amos.boot.biz.common.utils.FirefightersTreeDto">
select COUNT(a.sequence_nbr) num,
a.job_title_code
jobTitleCode
from cb_firefighters a
where a.is_delete = 0
GROUP BY a.job_title_code
</select>
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefighters"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto">
select a.*,b.areas_expertise areasExpertise ,b.areas_expertise_code
areasExpertiseCode from cb_firefighters a LEFT JOIN
cb_firefighters_post b on
a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code
=#{par.areasExpertiseCode}
</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date desc limit #{pageNum},#{pageSize}
</select>
<!--消防队员列表按时间倒叙排列add desc 2021-09-08 by kongfm -->
<select id="getFirefightersCount" resultType="Map">
select COUNT(a.sequence_nbr) num from cb_firefighters a LEFT JOIN
cb_firefighters_post b on a.sequence_nbr=b.firefighters_id where
a.is_delete=0
<if test='par.postQualification!=null'>and b.post_qualification_code = #{par.postQualification}</if>
<if test='par.areasExpertise!=null'>and b.areas_expertise_code= #{par.areasExpertise}</if>
<if test='par.name!=null'>and a.name like concat ('%',#{par.name},'%')</if>
<if test='par.state!=null'>and a.state_code= #{par.state}</if>
<if test='par.fireTeamId!=null'>and a.fire_team_id= #{par.fireTeamId}</if>
<if test='par.jobTitle!=null'>and a.job_title_code =#{par.jobTitle}</if>
<if
test='par.areasExpertiseCode!=null and par.areasExpertiseCode!="0"'>and b.areas_expertise_code
=#{par.areasExpertiseCode}
</if>
<if test='par.areasExpertiseCode=="0"'>and b.areas_expertise_code is not null</if>
ORDER BY a.rec_date desc
</select>
ORDER BY a.rec_date desc
</select>
<select id="listToSelectById" resultType="Map">
SELECT
IFNULL(a.personnel_photos, '') personnelPhotos,
a.sequence_nbr
sequenceNbr,
IFNULL(a.`name`, '无') `name`,
IFNULL(a.job_title, '无')
jobTitle,
IFNULL(b.administrative_position, '无')
administrativePosition,
IFNULL(c.`name`, '无') fireTeamName,
IFNULL(a.state, '无') state,
IFNULL(b.employee_hierarchy, '无')
employeeHierarchy,
IFNULL(b.areas_expertise, '无') areasExpertise,
IFNULL(a.gender, '无') gender,
IFNULL(b.post_qualification, '无')
postQualification, year ( from_days( datediff( now( ),
a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN
cb_firefighters_post b
ON a.sequence_nbr
= b.firefighters_id LEFT JOIN
cb_fire_team c on
c.sequence_nbr=a.fire_team_id
WHERE a.is_delete =0
and
a.sequence_nbr=#{id}
</select>
<select id="listToSelectById" resultType="Map">
SELECT IFNULL(a.personnel_photos, '') personnelPhotos,
a.sequence_nbr
sequenceNbr,
IFNULL(a.`name`, '无') `name`,
IFNULL(a.job_title, '无')
jobTitle,
IFNULL(b.administrative_position, '无')
administrativePosition,
IFNULL(c.`name`, '无') fireTeamName,
IFNULL(a.state, '无') state,
IFNULL(b.employee_hierarchy, '无')
employeeHierarchy,
IFNULL(b.areas_expertise, '无') areasExpertise,
IFNULL(a.gender, '无') gender,
IFNULL(b.post_qualification, '无')
postQualification, year ( from_days( datediff( now( ),
a.birthday_time))) age
FROM cb_firefighters a LEFT JOIN
cb_firefighters_post b
ON a.sequence_nbr
= b.firefighters_id LEFT JOIN
cb_fire_team c on
c.sequence_nbr=a.fire_team_id
WHERE a.is_delete =0
and
a.sequence_nbr=#{id}
</select>
<!-- BUG3553 BY kongfm 人员关系显示汉字 -->
<!---陈浩修改导出的数据量 2021-09-13-->
<select id="exportToExcel"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto">
<!-- SELECT f.*, ( SELECT cb_fire_team.NAME FROM cb_fire_team WHERE cb_fire_team.sequence_nbr
= f.fire_team_id ) fireTeam, emergency_contact, da.NAME AS relationship,
emergency_contact_phone FROM cb_firefighters f LEFT JOIN cb_firefighters_contacts
fc ON f.sequence_nbr = fc.firefighters_id left join cb_data_dictionary da
on da.CODE = fc.relationship where f.is_delete = #{isDelete} -->
SELECT
f.*,
(
SELECT
cb_fire_team. NAME
FROM
cb_fire_team
WHERE
cb_fire_team.sequence_nbr = f.fire_team_id
) fireTeam,
emergency_contact,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fc.relationship
AND type = 'RJGX'
) AS relationship,
emergency_contact_phone,
fw.working_hours,
fw.fire_working_hours,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fe.first_degree
AND type = 'XLLX'
) AS first_degree,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fe.highest_education
AND type = 'XLLX'
) AS highest_education,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fe.academic_degree
AND type = 'XWLX'
) AS academic_degree,
fe.school,
fe.professional_name,
fp.*
FROM
cb_firefighters f
LEFT JOIN cb_firefighters_contacts fc ON f.sequence_nbr = fc.firefighters_id
LEFT JOIN cb_firefighters_workexperience fw ON f.sequence_nbr = fw.firefighters_id
LEFT JOIN cb_firefighters_education fe ON f.sequence_nbr = fe.firefighters_id
LEFT JOIN cb_firefighters_post fp ON f.sequence_nbr = fp.firefighters_id
WHERE
f.is_delete = 0
<if test="name!=null and name !='-1' and name !=''">and f.`name` like concat('%',#{name},'%')</if>
<if test='postQualification!=null'>and fp.post_qualification_code = #{postQualification}</if>
<if test='fireTeamId !=null'>and f.fire_team_id = #{fireTeamId}</if>
<if test='state !=null'>and f.state_code = #{state}</if>
<if test='areasExpertise!=null'>and fp.areas_expertise_code = #{areasExpertise}</if>
<if test='jobTitle!=null'>and f.job_title_code = #{jobTitle}</if>
</select>
<!-- BUG3553 BY kongfm 人员关系显示汉字 -->
<!---陈浩修改导出的数据量 2021-09-13-->
<select id="exportToExcel"
resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto">
<!-- SELECT f.*, ( SELECT cb_fire_team.NAME FROM cb_fire_team WHERE cb_fire_team.sequence_nbr
= f.fire_team_id ) fireTeam, emergency_contact, da.NAME AS relationship,
emergency_contact_phone FROM cb_firefighters f LEFT JOIN cb_firefighters_contacts
fc ON f.sequence_nbr = fc.firefighters_id left join cb_data_dictionary da
on da.CODE = fc.relationship where f.is_delete = #{isDelete} -->
SELECT
f.*,
(
SELECT
cb_fire_team. NAME
FROM
cb_fire_team
WHERE
cb_fire_team.sequence_nbr = f.fire_team_id
) fireTeam,
emergency_contact,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fc.relationship
AND type = 'RJGX'
) AS relationship,
emergency_contact_phone,
fw.working_hours,
fw.fire_working_hours,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fe.first_degree
AND type = 'XLLX'
) AS first_degree,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fe.highest_education
AND type = 'XLLX'
) AS highest_education,
(
SELECT
NAME
FROM
cb_data_dictionary
WHERE
CODE = fe.academic_degree
AND type = 'XWLX'
) AS academic_degree,
fe.school,
fe.professional_name,
fp.*
FROM
cb_firefighters f
LEFT JOIN cb_firefighters_contacts fc ON f.sequence_nbr = fc.firefighters_id
LEFT JOIN cb_firefighters_workexperience fw ON f.sequence_nbr = fw.firefighters_id
LEFT JOIN cb_firefighters_education fe ON f.sequence_nbr = fe.firefighters_id
LEFT JOIN cb_firefighters_post fp ON f.sequence_nbr = fp.firefighters_id
WHERE
f.is_delete = 0
<if test="name!=null and name !='-1' and name !=''">and f.`name` like concat('%',#{name},'%')</if>
<if test='postQualification!=null'>and fp.post_qualification_code = #{postQualification}</if>
<if test='fireTeamId !=null'>and f.fire_team_id = #{fireTeamId}</if>
<if test='state !=null'>and f.state_code = #{state}</if>
<if test='areasExpertise!=null'>and fp.areas_expertise_code = #{areasExpertise}</if>
<if test='jobTitle!=null'>and f.job_title_code = #{jobTitle}</if>
</select>
<select id="getFirefightersName" resultType="Map">
SELECT
cb_firefighters.name AS name,
IFNULL(cb_firefighters.mobile_phone, '') AS phone
FROM
cb_firefighters
WHERE
cb_firefighters.is_delete = 0 AND
cb_firefighters.name IS NOT NULL AND
cb_firefighters.name != ''
group by cb_firefighters.name
</select>
<select id="getFirefightersName" resultType="Map">
SELECT cb_firefighters.name AS name,
IFNULL(cb_firefighters.mobile_phone, '') AS phone
FROM cb_firefighters
WHERE cb_firefighters.is_delete = 0
AND cb_firefighters.name IS NOT NULL
AND cb_firefighters.name != ''
group by cb_firefighters.name
</select>
<select id="queryById" resultType="com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto">
SELECT
*
FROM
cb_firefighters
WHERE
fire_team_id = #{teamId}
<if test="gw != null">
And job_title_code In
<foreach item="item" collection="gw" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
</mapper>
......@@ -685,4 +685,37 @@ LEFT JOIN (
#{companyId}
</foreach>
</select>
<select id="queryCompanyId" resultType="map">
SELECT
d.field_code ,
d.field_name ,
d.field_value ,
s.sequence_nbr,
s.biz_org_name,
s.parent_id
FROM
cb_dynamic_form_instance d ,
( SELECT
u.*
FROM
cb_org_usr u,
cb_dynamic_form_instance i
where
u.parent_id = #{id}
AND
u.is_delete = 0
AND
u.biz_org_type = 'PERSON'
AND
i.instance_id = u.sequence_nbr
AND
i.field_code = 'administrativePositionCode'
AND
i.field_value is not NULL ) s
WHERE
d.instance_id = s.sequence_nbr
AND
d.field_code = 'telephone'
</select>
</mapper>
......@@ -191,4 +191,18 @@ public class DutyPersonController extends BaseController {
return ResponseHelper.buildResponse(iDutyPersonService.findByDutyAreaId(dutyAreaId));
}
/**
*
*
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/companyId/{companyId}")
@ApiOperation(httpMethod = "GET", value = "查询当日值班人员", notes = "查询当日值班人员")
public ResponseModel<List<Map<String, Object>>> queryByCompanyId(
@PathVariable Long companyId) throws Exception {
return ResponseHelper.buildResponse(iDutyPersonService.queryByCompanyId(companyId));
}
}
......@@ -267,4 +267,18 @@ public class OrgPersonController {
throw new RuntimeException("系统异常!");
}
}
/**
* 机场单位下 各单位下人员岗位不为空的人员
*
* @param id
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyId/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取人员岗位不为空的人员详情", notes = "获取人员岗位不为空的人员详情")
public ResponseModel<Object> queryCompanyId(HttpServletRequest request,
@PathVariable Long id) throws Exception {
return ResponseHelper.buildResponse(iOrgUsrService.queryCompanyId(id));
}
}
......@@ -10,6 +10,7 @@ import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -37,6 +38,8 @@ public class DutyPersonServiceImpl extends DutyCommonServiceImpl implements IDut
@Autowired
EquipFeignClient equipFeign;
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
@Override
......@@ -289,26 +292,29 @@ public Object BuildScheduleDetails(String dutyDay, Long shiftId, String postType
System.out.println("ssssssssss");
});
}
public List<Map<String, Object>> queryByCompanyId(Long companyId){
return dutyPersonShiftMapper.queryByCompanyId(companyId);
}
......
......@@ -129,7 +129,11 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
public List<Map<String,String>> getFirefightersName() {
return firefightersMapper.getFirefightersName();
}
public List<FirefightersDto> queryById(Long teamId,String[] gw){
return firefightersMapper.queryById(teamId,gw);
}
}
......@@ -1859,4 +1859,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return resultMap;
}
public List<Map<String,Object>> queryCompanyId(Long id) {
return orgUsrMapper.queryCompanyId(id);
}
}
......@@ -94,6 +94,7 @@ public class FirefightersController extends BaseController {
@Value("${redis.cache.failure.time}")
private long time;
/**
* 新增消防队员
*
......@@ -332,4 +333,22 @@ public class FirefightersController extends BaseController {
return ResponseHelper.buildResponse(menus);
}
/**
*查询
*
* @param
* @return
* @throws Exception
*/
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/gw/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<Object> queryById( @PathVariable Long teamId) throws Exception {
//规则提供岗位名称
String[] gw =new String[]{"1202","1203","1204","1205","1206","1207","1209","1208","1210","1211"};
return ResponseHelper.buildResponse(iFirefightersService.queryById(teamId,gw));
}
}
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