Commit 4c1793e0 authored by zhangsen's avatar zhangsen

大屏API提供

parent 62e61d7b
package com.yeejoin.amos.boot.module.common.api.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class BigScreen1VO {
private Map<String, Object> firefightersInfo;
private Integer teamNum;
}
......@@ -42,4 +42,8 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<Firefighters> getPersonByCodes(@Param("list") List<String> list);
List<OrgUsrFireExcelDto> exportToExcelNew(Boolean isDelete, String name, String postQualification, String fireTeamId, String state, String areasExpertise, String jobTitle, String bizOrgCode);
Integer getTeamCountByCode(@Param("companyCode") String companyCode);
Map<String, Object> getFireForceInfoByCode(@Param("companyCode") String companyCode);
}
......@@ -4,10 +4,7 @@ import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.PeopleInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
......@@ -37,4 +34,6 @@ public interface IFirefightersService {
Firefighters getFirefightersByUserId(String sequenceNbr);
void saveFirefightersByUser(PeopleInfoDto firefighters);
BigScreen1VO getFireForceInfoByCode(String companyCode);
}
......@@ -451,4 +451,56 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
<if test='jobTitle!=null'>and f.job_title_code = #{jobTitle}</if>
<if test='bizOrgCode!=null'>and f.biz_org_code like concat ('%',#{bizOrgCode},'%') </if>
</select>
<select id="getTeamCountByCode" resultType="java.lang.Integer">
SELECT
count( cft.sequence_nbr ) as teamNum
FROM
cb_fire_team cft
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = cft.biz_org_code
WHERE
cft.is_delete = 0
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
</select>
<select id="getFireForceInfoByCode" resultType="java.util.Map">
SELECT
b.*,
( b.firefightersNum - b.fireCer ) AS unfireCer,
( b.opertNum - b.operCer ) AS unoperCer,
TRUNCATE ( abs(( b.fireCer ) / IF (( b.firefightersNum ) = 0, 1, b.firefightersNum )), 2 ) * 100 AS fireAbs,
TRUNCATE ( abs(( b.operCer ) / IF (( b.opertNum ) = 0, 1, b.opertNum )), 2 ) * 100 AS operAbs
FROM
(
SELECT
count( a.is_firefighters = 1 OR NULL ) AS firefightersNum,
count( a.is_firefighters = 0 OR NULL ) AS opertNum,
COUNT(( a.is_firefighters = 1 AND a.certificate_type IS NOT NULL ) OR NULL ) AS fireCer,
COUNT(( a.is_firefighters = 0 AND a.certificate_type IS NOT NULL ) OR NULL ) AS operCer
FROM
(
SELECT
u.sequence_nbr,
cfp.fire_management_post,
( CASE WHEN cf.fire_team_id IS NULL THEN 0 ELSE 1 END ) AS is_firefighters,
cfp.certificate_type
FROM
cb_org_usr u
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = u.sequence_nbr
AND cfp.is_delete = 0
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr
AND cf.is_delete = 0
WHERE
u.is_delete = 0
AND u.biz_org_type = 'PERSON'
<if test="companyCode != null and companyCode != ''">
AND u.`code` = #{companyCode}
</if>
GROUP BY
u.sequence_nbr
) a
) b
</select>
</mapper>
......@@ -273,4 +273,14 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
}
return personGenderMap;
}
@Override
public BigScreen1VO getFireForceInfoByCode(String companyCode) {
BigScreen1VO bigScreen1VO = new BigScreen1VO();
Integer teamCount = firefightersMapper.getTeamCountByCode(companyCode);
Map<String, Object> fireForceInfoByCode = firefightersMapper.getFireForceInfoByCode(companyCode);
bigScreen1VO.setTeamNum(teamCount);
bigScreen1VO.setFirefightersInfo(fireForceInfoByCode);
return bigScreen1VO;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "一张图大屏Api")
@RequestMapping(value = "/bigScreen")
public class BigScreenController {
@Autowired
private IFirefightersService iFirefightersService;
@GetMapping(value = "/getFireForceInfoByCode")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防车、消防力量信息(专职消防队、运维人员)", notes = "消防车、消防力量信息(专职消防队、运维人员)")
public ResponseModel getFireForceInfoByCode(@RequestParam(required = false, value = "companyCode") String companyCode) {
return CommonResponseUtil.success(iFirefightersService.getFireForceInfoByCode(companyCode));
}
}
......@@ -2667,7 +2667,7 @@
count( a.id ) - count( a.alarmNum > 0 OR NULL )) /
IF
(( count( a.id ) = 0 ), 1, count( a.id ) ))),
0
2
) * 100
) AS normalAbs
FROM
......@@ -2700,7 +2700,7 @@
count( a.nowLevel &gt;= a.minLevel OR NULL )) /
IF
(( count( 1 ) = 0 ), 1, count( 1 ) ))),
0
2
) * 100
) AS normalAbs
FROM
......
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