Commit 66e5d377 authored by KeYong's avatar KeYong

Merge branch 'develop_dl_plan6' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6

parents 0138e702 3db65a66
...@@ -149,6 +149,9 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc ...@@ -149,6 +149,9 @@ public interface DynamicFormInstanceMapper extends BaseMapper<DynamicFormInstanc
* @return * @return
*/ */
Page<Map<String, Object>> getPersonInfoByPage(Page page, @Param("bizOrgCode") String bizOrgCode); Page<Map<String, Object>> getPersonInfoByPage(Page page, @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardCount( @Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> dutyCardList (@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -28,6 +28,14 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -28,6 +28,14 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
//BUG 2880 by litw start 2021年9月16日 //BUG 2880 by litw start 2021年9月16日
List<OrgUsr> selectAllChildrenList(@Param("map")Map<String, Object> map); List<OrgUsr> selectAllChildrenList(@Param("map")Map<String, Object> map);
int getUserByPeopleTypeCount(@Param("map")Map<String, Object> map);
List<Map<String, Object>> getUserByPeopleType(@Param("map")Map<String, Object> map);
List<OrgUsr> selectCompanyDepartmentMsg(); List<OrgUsr> selectCompanyDepartmentMsg();
List<Map<String, Object>> selectPersonAllList(Map<String, Object> map); List<Map<String, Object>> selectPersonAllList(Map<String, Object> map);
......
...@@ -34,6 +34,11 @@ public interface IDutyCommonService { ...@@ -34,6 +34,11 @@ public interface IDutyCommonService {
*/ */
IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate, String bizOrgCode) throws ParseException; IPage<Map<String, Object>> pageListDetail(int current, int size, String beginDate, String endDate, String bizOrgCode) throws ParseException;
List<Map<String, Object>> dutyCardCount(String bizOrgCode)throws ParseException;
List<Map<String, Object>> dutyCardList(String bizOrgCode)throws ParseException;
/** /**
* 值班明细 * 值班明细
* *
...@@ -47,7 +52,6 @@ public interface IDutyCommonService { ...@@ -47,7 +52,6 @@ public interface IDutyCommonService {
* *
* @param beginDate * @param beginDate
* @param endDate * @param endDate
* @param dutyType
* @return * @return
* @throws ParseException * @throws ParseException
*/ */
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersPost;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr; import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -376,4 +377,7 @@ public interface IOrgUsrService { ...@@ -376,4 +377,7 @@ public interface IOrgUsrService {
List<OrgMenuDto> companyUserTreeByUserAndTypeAll(String bizorgcode); List<OrgMenuDto> companyUserTreeByUserAndTypeAll(String bizorgcode);
List<DynamicFormInstance> selectTelById(List<String> ids, String type); List<DynamicFormInstance> selectTelById(List<String> ids, String type);
List<FirefightersPost> selectPostById(List<String> ids);
} }
...@@ -623,4 +623,131 @@ WHERE ...@@ -623,4 +623,131 @@ WHERE
HAVING HAVING
peopleType = 1602 peopleType = 1602
</select> </select>
<select id="dutyCardCount" resultType="java.util.Map">
SELECT
'1601' as peopleType,
count(*) as total
from
(SELECT
c.sequence_nbr as id,
c.biz_org_name as userName,
IFNULL( cf.mobile_phone, '' ) telephone,
'驻站消防员' as peopleType
FROM
cb_org_usr c
RIGHT JOIN cb_sign cs ON c.sequence_nbr = cs.USER_ID
LEFT JOIN cb_firefighters cf ON CONCAT( c.sequence_nbr, '' ) = cf.org_usr_id
AND cf.is_delete = 0
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = c.sequence_nbr
AND cfp.is_delete = 0
WHERE
c.sequence_nbr IS NOT NULL
AND cs.sign_time LIKE concat( CURRENT_DATE ( ), '%' )
AND c.biz_org_code LIKE concat(#{bizOrgCode},'%')
GROUP BY
cs.USER_ID
ORDER BY
cs.sign_time DESC) d
union all
SELECT
b.peopleType,
count( * ) as total
FROM
(
SELECT
ou.sequence_nbr AS id,
ou.biz_org_name AS userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IF
(
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ) = '',
NULL,
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END )
) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
) b WHERE b.peopleType != '1601'
GROUP BY
peopleType
</select>
<select id="dutyCardList" resultType="java.util.Map">
(SELECT
c.sequence_nbr as id,
c.biz_org_name as userName,
IFNULL( cf.mobile_phone, '' ) telephone,
'驻站消防员' as peopleType
FROM
cb_org_usr c
RIGHT JOIN cb_sign cs ON c.sequence_nbr = cs.USER_ID
LEFT JOIN cb_firefighters cf ON CONCAT( c.sequence_nbr, '' ) = cf.org_usr_id
AND cf.is_delete = 0
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = c.sequence_nbr
AND cfp.is_delete = 0
WHERE
c.sequence_nbr IS NOT NULL
AND cs.sign_time LIKE concat( CURRENT_DATE ( ), '%' )
AND c.biz_org_code LIKE concat(#{bizOrgCode},'%')
GROUP BY
cs.USER_ID
ORDER BY
cs.sign_time DESC)
UNION all
(SELECT
id,
userName,
telephone,
(select name from cb_data_dictionary WHERE code = b.peopleType ) as peopleType
FROM
(
SELECT
ou.sequence_nbr AS id,
ou.biz_org_name AS userName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'telephone' THEN field_value END ), '' ) AS telephone,
IF
(
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END ) = '',
NULL,
MAX( CASE WHEN cfi.field_code = 'positionType' THEN field_value_label END )
) AS postTypeName,
IFNULL( MAX( CASE WHEN cfi.field_code = 'personImg' THEN field_value END ), '' ) AS personImg,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
(
SELECT
IFNULL( max( CASE WHEN fi.field_code = 'userId' THEN fi.field_value END ), ps.instance_id ) AS id
FROM
cb_duty_person_shift ps
LEFT JOIN cb_dynamic_form_instance fi ON fi.instance_id = ps.instance_id
WHERE
ps.duty_date = CURRENT_DATE
GROUP BY
fi.instance_id
) a
LEFT JOIN cb_org_usr ou ON ou.sequence_nbr = a.id
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
where ou.biz_org_code like concat(#{bizOrgCode}, '%')
GROUP BY
a.id
) b WHERE b.peopleType != '1601')
</select>
</mapper> </mapper>
...@@ -1163,4 +1163,88 @@ LEFT JOIN ( ...@@ -1163,4 +1163,88 @@ LEFT JOIN (
and usr.biz_org_code like CONCAT(#{bizorgcode},'%') and usr.biz_org_code like CONCAT(#{bizorgcode},'%')
GROUP BY biz_org_name GROUP BY biz_org_name
</select> </select>
<select id="getUserByPeopleTypeCount" resultType="Integer">
select
count(*)
from (
SELECT
DISTINCT
u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
g.telephone,
g.positionType
FROM
cb_org_usr u
LEFT JOIN
( SELECT
v.`instance_id`,
max(case v.field_code when 'telephone' then IFNULL(v.field_value,'') end) telephone,
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,'') end) positionType,
max(case v.field_code when 'peopleType' then IFNULL(v.field_value,'') end) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
) g
on u.sequence_nbr = g.instance_id
where
u.biz_org_type = 'person'
AND
u.is_delete = 0
and g.peopleType=1601
GROUP BY
u.sequence_nbr
order by u.rec_date desc
)a where a.sequenceNbr is not null
</select>
<select id="getUserByPeopleType" resultType="Map">
SET @rownum = #{map.pageNum};
select
@rownum := @rownum + 1 AS rownum,
a.* from (
SELECT
DISTINCT
u.sequence_nbr sequenceNbr,
u.biz_org_name bizOrgName,
g.telephone,
g.positionType
FROM
cb_org_usr u
LEFT JOIN
( SELECT
v.`instance_id`,
max(case v.field_code when 'telephone' then IFNULL(v.field_value,'') end) telephone,
max(case v.field_code when 'positionType' then IFNULL(v.field_value_label,'') end) positionType,
max(case v.field_code when 'peopleType' then IFNULL(v.field_value,'') end) peopleType
FROM
`cb_dynamic_form_instance` v
WHERE
v.group_code = 246
GROUP BY
v.`instance_id`
) g
on u.sequence_nbr = g.instance_id
where
u.biz_org_type = 'person'
AND
u.is_delete = 0
and g.peopleType=1601
GROUP BY
u.sequence_nbr
order by u.rec_date desc
)a where a.sequenceNbr is not null
LIMIT #{map.pageNum}, #{map.pageSize}
</select>
</mapper> </mapper>
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
AND cdfi.field_code = 'userId' AND cdfi.field_code = 'userId'
) temp ) temp
LEFT JOIN cb_org_usr cou ON cou.sequence_nbr = temp.userId LEFT JOIN cb_org_usr cou ON cou.sequence_nbr = temp.userId
WHERE cou.is_delete = 0
) AS ) AS
value value
, ,
...@@ -64,7 +65,7 @@ ...@@ -64,7 +65,7 @@
cb_organization co cb_organization co
WHERE co.is_delete = 0 WHERE co.is_delete = 0
ORDER BY ORDER BY
co.sort co.sort desc
LIMIT 4 LIMIT 4
) )
</select> </select>
......
...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -5,6 +5,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto; import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService; import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -24,6 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -24,6 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -79,6 +81,38 @@ public class DutyPersonController extends BaseController { ...@@ -79,6 +81,38 @@ public class DutyPersonController extends BaseController {
return ResponseHelper.buildResponse(iDutyPersonService.pageListDetail(current, size, beginDate, endDate, bizOrgCode)); return ResponseHelper.buildResponse(iDutyPersonService.pageListDetail(current, size, beginDate, endDate, bizOrgCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/cardDetailCount")
@ApiOperation(httpMethod = "GET", value = "值班管理卡片人员统计", notes = "值班管理卡片人员统计")
public ResponseModel<Map<String, Object>> cardDetail() throws ParseException {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
Map<String, Object> map = new HashMap<>();
List<Map<String, Object>> maps = iDutyPersonService.dutyCardCount(bizOrgCode);
maps.forEach(e->map.put(e.get("peopleType").toString(),e.get("total")));
return ResponseHelper.buildResponse(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/cardList")
@ApiOperation(httpMethod = "GET", value = "值班管理卡片人员统计", notes = "值班管理卡片人员统计")
public ResponseModel<List<Map<String, Object>>> cardList() throws ParseException {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String bizOrgCode = ObjectUtils.isEmpty(selectedOrgInfo) || ObjectUtils.isEmpty(selectedOrgInfo.getPersonIdentity()) ? "" : selectedOrgInfo.getPersonIdentity().getBizOrgCode();
if (StringUtils.isEmpty(bizOrgCode)) {
return ResponseHelper.buildResponse(null);
}
return ResponseHelper.buildResponse(iDutyPersonService.dutyCardList(bizOrgCode));
}
/** /**
* 值班列表视图--不分页 * 值班列表视图--不分页
* *
......
...@@ -254,6 +254,19 @@ public class OrgPersonController extends BaseController { ...@@ -254,6 +254,19 @@ public class OrgPersonController extends BaseController {
return ResponseHelper.buildResponse(orgUsr); return ResponseHelper.buildResponse(orgUsr);
} }
//驻站消防人员
@TycloudOperation( ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUserByPeopleType/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "消防人员列表分页查询", notes = "消防人员列表分页查询")
public ResponseModel<IPage<Map<String, Object>>> getUserByPeopleType(@RequestParam Map<String, Object> requestBody) {
Map<String, Object> map = new HashMap<>();
IPage<Map<String, Object>> mapIPage = iOrgUsrService.getUserByPeopleType(
requestBody.containsKey("pageNum") ? requestBody.get("pageNum").toString() : null ,
requestBody.containsKey("pageSize") ? requestBody.get("pageSize").toString() : null,map );
return ResponseHelper.buildResponse(mapIPage);
}
/** /**
...@@ -451,7 +464,7 @@ public class OrgPersonController extends BaseController { ...@@ -451,7 +464,7 @@ public class OrgPersonController extends BaseController {
* **/ * **/
/** /**
* 根据bizOrgCode查询 * 根据bizOrgCode查询
* @param bizOrgCode * @param
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -10,7 +10,7 @@ import java.util.stream.Collectors; ...@@ -10,7 +10,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance; import com.yeejoin.amos.boot.module.common.api.entity.*;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -55,9 +55,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto; ...@@ -55,9 +55,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserDto; import com.yeejoin.amos.boot.module.common.api.dto.UserDto;
import com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto; import com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto;
import com.yeejoin.amos.boot.module.common.api.entity.CompanyInfo;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper; import com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper; import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
...@@ -1066,4 +1063,17 @@ public class OrgUsrController extends BaseController { ...@@ -1066,4 +1063,17 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(menus); return ResponseHelper.buildResponse(menus);
} }
/**
* 获取人员电话
* @param
* @returnP
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/selectPostById", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id获取用户岗位", notes = "根据id获取用户岗位")
public ResponseModel<List<FirefightersPost>> selectPostById(@RequestParam List<String> ids) {
List<FirefightersPost> menus = iOrgUsrService.selectPostById(ids);
return ResponseHelper.buildResponse(menus);
}
} }
\ No newline at end of file
...@@ -149,6 +149,17 @@ public class DutyCommonServiceImpl implements IDutyCommonService { ...@@ -149,6 +149,17 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
return dynamicFormInstanceMapper.getPersonInfoByPage(new Page(current, size), bizOrgCode); return dynamicFormInstanceMapper.getPersonInfoByPage(new Page(current, size), bizOrgCode);
} }
public List<Map<String, Object>> dutyCardCount(String bizOrgCode)
throws ParseException {
return dynamicFormInstanceMapper.dutyCardCount( bizOrgCode);
}
public List<Map<String, Object>> dutyCardList( String bizOrgCode)
throws ParseException {
return dynamicFormInstanceMapper.dutyCardList(bizOrgCode);
}
private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException { private void fillDutyShiftData(String beginDate, String endDate, Map<String, Object> m) throws ParseException {
// 获取值班的实例id // 获取值班的实例id
String instanceId = m.get("instanceId").toString(); String instanceId = m.get("instanceId").toString();
......
...@@ -3116,7 +3116,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3116,7 +3116,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
dynamicFormInstance.setFieldValueLabel(dataDictionaryService.getById(dynamicFormInstance.getFieldValue()).getName()); dynamicFormInstance.setFieldValueLabel(dataDictionaryService.getById(dynamicFormInstance.getFieldValue()).getName());
} }
if ("positionType".equals(dynamicFormInstance.getFieldCode()) && peopleInfoDto.getFirefighters().getJobTitleCode() != null){ if ("positionType".equals(dynamicFormInstance.getFieldCode()) && peopleInfoDto.getFirefighters().getJobTitleCode() != null){
dynamicFormInstance.setFieldValueLabel(dataDictionaryService.getById(peopleInfoDto.getFirefighters().getJobTitleCode()).getName()); dynamicFormInstance.setFieldValueLabel(peopleInfoDto.getFirefighters().getJobTitle());
} }
if ("administrativePositionCode".equals(dynamicFormInstance.getFieldCode()) && firefightersPost.getAdministrativePositionCode() != null){ if ("administrativePositionCode".equals(dynamicFormInstance.getFieldCode()) && firefightersPost.getAdministrativePositionCode() != null){
dynamicFormInstance.setFieldValueLabel(dataDictionaryService.getById(map1.get("administrativePositionCode").toString()).getName()); dynamicFormInstance.setFieldValueLabel(dataDictionaryService.getById(map1.get("administrativePositionCode").toString()).getName());
...@@ -3486,4 +3486,30 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3486,4 +3486,30 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return dynamicFormInstanceService.list(wrapper); return dynamicFormInstanceService.list(wrapper);
} }
@Override
public List<FirefightersPost> selectPostById(List<String> ids) {
LambdaQueryWrapper<FirefightersPost> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(FirefightersPost::getOrgUsrId, ids);
return iFirefightersPostService.list(queryWrapper);
}
public IPage<Map<String, Object>> getUserByPeopleType(String pageNum, String pageSize, Map<String, Object> map) {
IPage<Map<String, Object>> pageBean = null;
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
pageBean.setTotal(orgUsrMapper.getUserByPeopleTypeCount(map));
map.put("pageNum", (pageBean.getCurrent() - 1) * pageBean.getSize());
map.put("pageSize", pageBean.getSize());
List<Map<String, Object>> list = orgUsrMapper.getUserByPeopleType(map);
pageBean.setRecords(list);
return pageBean;
}
} }
\ No newline at end of file
...@@ -17,6 +17,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -17,6 +17,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -141,4 +142,17 @@ public class EmergencyController extends AbstractBaseController { ...@@ -141,4 +142,17 @@ public class EmergencyController extends AbstractBaseController {
return iEmergencyService.selectPressureFlow(page, bizOrgCode); return iEmergencyService.selectPressureFlow(page, bizOrgCode);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("火灾自动报警系统告警分析")
@GetMapping(value = "/selectAlarmAnalysis")
public List<Map<String, Object>> selectPressureFlow(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate) {
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectAlarmAnalysis(bizOrgCode, startDate, endDate);
}
} }
...@@ -165,6 +165,16 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -165,6 +165,16 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getDetailByCode(systemCode); return fireFightingSystemService.getDetailByCode(systemCode);
} }
//查询系统下设备状态
@RequestMapping(value = "/getEquip", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过id查询消防系统信息")
public List<Map<String,Object>> getEquip(Long id) {
return fireFightingSystemService.getEquip(id);
}
/** /**
* 生产厂商列表(不分页) * 生产厂商列表(不分页)
* *
......
...@@ -381,13 +381,7 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -381,13 +381,7 @@ public class SupervisionConfigureController extends AbstractBaseController {
} catch (ParseException e) { } catch (ParseException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
long res = 0; long res = Math.abs(start - end);
if (start > end){
res = start - end;
}else {
res = end - start;
}
diffMinute = res / 1000 / 60; diffMinute = res / 1000 / 60;
} }
long finalDiffMinute = diffMinute; long finalDiffMinute = diffMinute;
...@@ -460,4 +454,73 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -460,4 +454,73 @@ public class SupervisionConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(supervisionVideoService.queryVideoAllId(bizOrgCode)); return CommonResponseUtil.success(supervisionVideoService.queryVideoAllId(bizOrgCode));
} }
@PersonIdentify
@RequestMapping(value = "/selectPressureMonth", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "统计当月稳压泵启停", produces = "application/json;charset=UTF-8", notes = "统计当月稳压泵启停")
public ResponseModel selectPressureMonth(@RequestParam("bizOrgCode") String bizOrgCode) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String startDay = df.format(new Date());
Calendar calendar = Calendar.getInstance();
calendar.set(Integer.parseInt(startDay.substring(0, 4)), Integer.parseInt(startDay.substring(5, 7)) - 1, 1);
String firstDayOfMonth = new SimpleDateFormat("yyyy-MM-dd ").format(calendar.getTime());
System.out.println("第一天:" + firstDayOfMonth + "00:00:00");
//这里先设置要获取月份的下月的第一天
calendar.set(Integer.parseInt(startDay.substring(0, 4)), Integer.parseInt(startDay.substring(5, 7)), 1);
//这里将日期值减去一天,从而获取到要求的月份最后一天
calendar.add(Calendar.DATE, -1);
String lastDayOfMonth = new SimpleDateFormat("yyyy-MM-dd ").format(calendar.getTime());
System.out.println("最后一天:" + lastDayOfMonth + "23:59:59");
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
if (bizOrgCode == null) {
return CommonResponseUtil.success(null);
}
}
}
// 稳压泵信息
List<Map<String, Object>> pressurePumps = fireFightingSystemMapper.selectAllPressurePumpInfo(bizOrgCode);
// x轴数据
List<Map<String, Object>> data = fireFightingSystemMapper.selectAllDays();
for (Map<String, Object> pressurePump : pressurePumps) {
String prefix = null;
String suffix = null;
String iotCode = pressurePump.get("iot_code").toString();
if (iotCode.length() > 8) {
prefix = iotCode.substring(0, 8);
suffix = iotCode.substring(8);
} else {
throw new BadRequest("装备物联编码错误,请确认!");
}
ResponseModel mounthEntity = null;
try {
mounthEntity = iotFeign.selectList(getAppKey(), getProduct(), getToken(), firstDayOfMonth + "00:00:00", lastDayOfMonth + "23:59:59", prefix, suffix, null);
} catch (Exception e) {
e.printStackTrace();
}
if (!ObjectUtils.isEmpty(mounthEntity) && "200".equals(String.valueOf(mounthEntity.getStatus()))) {
for (Map<String, Object> item : data) {
HashMap<String, Object> map = new HashMap<>();
map.put("name", pressurePump.get("name"));
String json1 = JSON.toJSONString(mounthEntity.getResult());
List<Map<String, String>> list = (List<Map<String, String>>) JSONArray.parse(json1);
List<Map<String, String>> collect = list.stream().filter(t -> (t.containsKey("time") && t.get("time").substring(0, 10).equals(item.get("date")))).collect(Collectors.toList());
map.put("value", collect.size());
if (item.containsKey("yData")) {
List<Map<String, Object>> yData1 = (List<Map<String, Object>>) item.get("yData");
yData1.add(map);
} else {
ArrayList<Map<String, Object>> maps = new ArrayList<>();
maps.add(map);
item.put("yData", maps);
}
}
}
}
return CommonResponseUtil.success(data);
}
} }
...@@ -61,4 +61,6 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -61,4 +61,6 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getCAFSWaterTankInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate);
} }
...@@ -638,4 +638,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -638,4 +638,9 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getStationStatusStatistics(); List<Map<String, Object>> getStationStatusStatistics();
List<Map<String, Object>> selectAllPressurePumpInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectAllDays();
List<Map<String, Object>> getEquip(@Param("id") Long id);
} }
...@@ -33,4 +33,6 @@ public interface IEmergencyService { ...@@ -33,4 +33,6 @@ public interface IEmergencyService {
Page<Map<String, Object>> selectOilDrainage(Page<Map<String, Object>> page, String bizOrgCode, String code); Page<Map<String, Object>> selectOilDrainage(Page<Map<String, Object>> page, String bizOrgCode, String code);
Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode); Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode);
List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate);
} }
...@@ -170,7 +170,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -170,7 +170,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @return FireFightingSystemEntity * @return FireFightingSystemEntity
*/ */
FireFightingSystemEntity getDetailByCode(String systemCode); FireFightingSystemEntity getDetailByCode(String systemCode);
List<Map<String,Object>> getEquip(Long id);
/** /**
* 集成页面系统数据 * 集成页面系统数据
* *
......
...@@ -87,4 +87,9 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -87,4 +87,9 @@ public class EmergencyServiceImpl implements IEmergencyService {
public Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode) { public Page<Map<String, Object>> selectPressureFlow(Page<Map<String, Object>> page, String bizOrgCode) {
return emergencyMapper.selectPressureFlow(page, bizOrgCode); return emergencyMapper.selectPressureFlow(page, bizOrgCode);
} }
@Override
public List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate) {
return emergencyMapper.selectAlarmAnalysis(bizOrgCode, startDate, endDate);
}
} }
...@@ -977,6 +977,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -977,6 +977,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
@Override @Override
public List<Map<String, Object>> getEquip(Long id) {
return fireFightingSystemMapper.getEquip(id);
}
@Override
public List<AlarmDataVO> getSystemById(Long id) { public List<AlarmDataVO> getSystemById(Long id) {
return this.baseMapper.getSystemById(id); return this.baseMapper.getSystemById(id);
} }
......
...@@ -186,6 +186,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -186,6 +186,9 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
@Value("${state.code:code}") @Value("${state.code:code}")
private String stationCode; private String stationCode;
@Value("${system.type}")
private String system;
@Value("${state.name:name}") @Value("${state.name:name}")
private String stationName; private String stationName;
...@@ -474,27 +477,30 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -474,27 +477,30 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
// 直流中心消息推送刷新 // 直流中心消息推送刷新
publishDataToDCCenterPage(equipmentSpecificIndexList); publishDataToDCCenterPage(equipmentSpecificIndexList);
if("zd".equals(system)){
System.out.println("站端系统----------------");
// 向预控系统发送消息 // 向预控系统发送消息
sendEquipSpecIndexToAutosysTopic(equipmentSpecificIndexList); sendEquipSpecIndexToAutosysTopic(equipmentSpecificIndexList);
// 首页性能指标数据订阅 // 首页性能指标数据订阅
mqttSendGateway.sendToMqtt(indexTopic, JSON.toJSONString(indexStateList)); mqttSendGateway.sendToMqtt(indexTopic, JSON.toJSONString(indexStateList));
// 组态大屏消息推送,设备表实时指标修改 // 组态大屏消息推送,设备表实时指标修改
intePageSysDataRefresh(equipmentSpecificIndexList, topicEntity); intePageSysDataRefresh(equipmentSpecificIndexList, topicEntity);
// 数字换流站同步指标修改 // 数字换流站同步指标修改
syncSpecificIndexsToGS(equipmentSpecificIndexList); syncSpecificIndexsToGS(equipmentSpecificIndexList);
// 则更新拓扑节点数据及告警状态 // 则更新拓扑节点数据及告警状态
updateNodeDateByEquipId(equipmentSpecificIndexList); updateNodeDateByEquipId(equipmentSpecificIndexList);
// 向画布推送 // 向画布推送
publishDataToCanvas(equipmentSpecificIndexList); publishDataToCanvas(equipmentSpecificIndexList);
// 向其他系统推送报警 // 向其他系统推送报警
equipmentAlarmLogsToOtherSystems(alarmLogs); equipmentAlarmLogsToOtherSystems(alarmLogs);
}
} }
}); });
} }
......
...@@ -116,5 +116,8 @@ equipment.pressurepump.stop=FHS_PressurePump_Stop ...@@ -116,5 +116,8 @@ equipment.pressurepump.stop=FHS_PressurePump_Stop
state.code=GW190301 state.code=GW190301
state.name=锦屏换流站 state.name=锦屏换流站
#?????????????
system.type=zd
# 是否开启遥测数据上报 # 是否开启遥测数据上报
is.open.telemetering=false is.open.telemetering=false
\ No newline at end of file
...@@ -147,9 +147,11 @@ ...@@ -147,9 +147,11 @@
concat( wesi.equipment_index_name, '(是)' ) concat( wesi.equipment_index_name, '(是)' )
WHEN 'false' THEN WHEN 'false' THEN
concat( wesi.equipment_index_name, '(否)' ) concat( wesi.equipment_index_name, '(否)' )
ELSE
wesi.equipment_index_name
END) ELSE wesi.value_label END FROM wl_equipment_specific_index wesi END) ELSE wesi.value_label END FROM wl_equipment_specific_index wesi
LEFT JOIN wl_equipment_index wei on wesi.equipment_index_id = wei.id LEFT JOIN wl_equipment_index wei on wesi.equipment_index_id = wei.id
WHERE wesi.equipment_specific_id = temp.id AND wesi.is_alarm = 1 WHERE wesi.equipment_specific_id = temp.id AND wei.is_trend = 0
ORDER BY wesi.update_date desc LIMIT 1),'--') AS status, ORDER BY wesi.update_date desc LIMIT 1),'--') AS status,
'0' AS flow '0' AS flow
FROM( FROM(
...@@ -229,7 +231,7 @@ ...@@ -229,7 +231,7 @@
wes.equipment_code as code , wes.equipment_code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'--' '暂无信号'
) AS status, ) AS status,
CASE CASE
...@@ -253,7 +255,7 @@ ...@@ -253,7 +255,7 @@
wes.equipment_code as code , wes.equipment_code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'--' '暂无信号'
) AS status, ) AS status,
CASE CASE
...@@ -278,7 +280,7 @@ ...@@ -278,7 +280,7 @@
wes.equipment_code as code , wes.equipment_code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'--' '暂无信号'
) AS status, ) AS status,
CASE CASE
...@@ -303,7 +305,7 @@ ...@@ -303,7 +305,7 @@
wes.equipment_code as code , wes.equipment_code as code ,
wes.name, wes.name,
IFNULL(wes.realtime_iot_index_name, IFNULL(wes.realtime_iot_index_name,
'--' '暂无信号'
) AS status, ) AS status,
CASE CASE
...@@ -400,5 +402,68 @@ ...@@ -400,5 +402,68 @@
wes.equipment_code LIKE concat( '92010700', '%' ) AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' ) wes.equipment_code LIKE concat( '92010700', '%' ) AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) temp ) temp
</select> </select>
<select id="selectAlarmAnalysis" resultType="java.util.Map">
SELECT
temp.date,
(
SELECT
COUNT(
DISTINCT (
wespa.equipment_specific_id
)
)
FROM
wl_equipment_specific_alarm_log wespa
WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Fault')
AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%')
) AS faultNum,
(
SELECT
COUNT(
DISTINCT (
wespa.equipment_specific_id
)
)
FROM
wl_equipment_specific_alarm_log wespa
WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'FireAlarm')
AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%')
) AS alarmNum,
(
SELECT
COUNT(
DISTINCT (
wespa.equipment_specific_id
)
)
FROM
wl_equipment_specific_alarm_log wespa
WHERE
wespa.equipment_specific_index_key LIKE concat('%', 'Shield')
AND wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_specific_index_value = 'true'
AND wespa.biz_org_code like concat(#{bizOrgCode}, '%')
) AS shieldNum
FROM
(
SELECT temp.selected_date as date FROM
(SELECT ADDDATE('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) selected_date FROM
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t0,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t1,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t2,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t3,
(SELECT 0 i UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9) t4)
temp
WHERE selected_date BETWEEN #{startDate} AND #{endDate}
) temp
ORDER BY
temp.date
</select>
</mapper> </mapper>
...@@ -5508,5 +5508,119 @@ ...@@ -5508,5 +5508,119 @@
GROUP BY GROUP BY
s.id s.id
</select> </select>
<select id="selectAllPressurePumpInfo" resultType="java.util.Map">
SELECT
ed.`name`,
concat_ws( '-', ws.full_name, ed.area ) area,
es.iot_code,
es.id,
IFNULL( sum( `status` ), 0 ) AS isAlarm
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON es.equipment_detail_id = ed.id
LEFT JOIN wl_warehouse_structure ws ON ws.id = es.warehouse_structure_id
LEFT JOIN wl_equipment_specific_alarm esa ON esa.equipment_specific_id = es.id
WHERE
ed.`code` LIKE '92010800%'
AND es.iot_code IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''" >
AND es.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
es.id
</select>
<select id="selectAllDays" resultType="java.util.Map">
select temp.date from (
SELECT
date
FROM
(
SELECT
DATE_FORMAT(
DATE_SUB(
last_day(curdate()),
INTERVAL xc - 1 DAY
),
'%Y-%m-%d'
) AS date
FROM
(
SELECT
@xi :=@xi + 1 AS xc
FROM
(
SELECT
1
UNION
SELECT
2
UNION
SELECT
3
UNION
SELECT
4
UNION
SELECT
5
UNION
SELECT
6
) xc1,
(
SELECT
1
UNION
SELECT
2
UNION
SELECT
3
UNION
SELECT
4
UNION
SELECT
5
UNION
SELECT
6
) xc2,
(SELECT @xi := 0) xc0
) xcxc
) x0
WHERE
x0.date >= (
SELECT
date_add(
curdate(),
INTERVAL - DAY (curdate()) + 1 DAY
)
)
)temp
order by temp.date
</select>
<select id="getEquip" resultType="java.util.Map">
SELECT spe.id,
det.`name` equipment_name,
spe.`code`,
( CASE (select count(*) from wl_equipment_specific_alarm where wl_equipment_specific_alarm.equipment_specific_id=spe.id and status=1)
WHEN 0 THEN
'正常'
ELSE
'异常'
END ) flag
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_stock_detail AS wlsd on wlsd.equipment_detail_id = det.id
WHERE
find_in_set(#{id},spe.system_id) and spe.single = true and wlsd.`status` = 1
</select>
</mapper> </mapper>
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