Commit 9abd0bfc authored by KeYong's avatar KeYong

Merge remote-tracking branch 'origin/develop_dl_bugfix_0723' into develop_dl_bugfix_0723

parents 0190ab80 3b6f2b34
...@@ -28,6 +28,7 @@ public class OrgMenuDto { ...@@ -28,6 +28,7 @@ public class OrgMenuDto {
private String bizOrgCode; private String bizOrgCode;
private Long total; private Long total;
private String code; private String code;
private Boolean isOnline = true;
public Boolean getLeaf() { public Boolean getLeaf() {
return ObjectUtils.isEmpty(children); return ObjectUtils.isEmpty(children);
...@@ -56,6 +57,18 @@ public class OrgMenuDto { ...@@ -56,6 +57,18 @@ public class OrgMenuDto {
this.code = code; this.code = code;
} }
public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType, boolean leaf, String bizOrgCode, String code, Boolean isOnline) {
super();
this.key = key;
this.title = title;
this.parentId = parentId;
this.bizOrgType = bizOrgType;
this.leaf = leaf;
this.bizOrgCode = bizOrgCode;
this.code = code;
this.isOnline = isOnline;
}
public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType, boolean leaf, String bizOrgCode) { public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType, boolean leaf, String bizOrgCode) {
super(); super();
this.key = key; this.key = key;
......
...@@ -123,6 +123,8 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> { ...@@ -123,6 +123,8 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> companyDeptListWithPersonCount(Map<String, Object> param); List<OrgUsr> companyDeptListWithPersonCount(Map<String, Object> param);
List<OrgUsr> companyListWithPersonCount(Map<String, Object> param);
List<OrgUsr> companyDeptListWithPersonCountNew(Map<String, Object> param); List<OrgUsr> companyDeptListWithPersonCountNew(Map<String, Object> param);
List<OrgUsr> companyTreeByUser(String bizOrgCode); List<OrgUsr> companyTreeByUser(String bizOrgCode);
......
...@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.common.api.mapper; ...@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map; import java.util.Map;
public interface StationInfoMapper extends BaseMapper { public interface StationInfoMapper extends BaseMapper {
Long count(@Param("stationType") String stationType); Long count(@Param("bizOrgCode") String bizOrgCode, @Param("stationType") String stationType);
Map<String, String> selectStationInfo(@Param("bizOrgCode") String bizOrgCode); Map<String, String> selectStationInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectStationInfoList();
} }
...@@ -1038,6 +1038,19 @@ ...@@ -1038,6 +1038,19 @@
and usr.is_delete = false and usr.is_delete = false
</select> </select>
<select id="companyListWithPersonCount"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT usr.*,
(select count(1)
from cb_org_usr u
where u.biz_org_type = 'PERSON'
and u.is_delete = false
and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
FROM cb_org_usr usr
where usr.biz_org_type = 'COMPANY'
and usr.is_delete = false
</select>
<select id="companyDeptListWithPersonCountNew" <select id="companyDeptListWithPersonCountNew"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr"> resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT usr.*, SELECT usr.*,
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
COUNT(1) COUNT(1)
FROM idx_biz_station_info t FROM idx_biz_station_info t
<where> <where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND t.BIZ_ORG_CODE LIKE CONCAT(#{bizOrgCode}, '%')
</if>
<if test="stationType != null and stationType != ''"> <if test="stationType != null and stationType != ''">
AND t.STATION_TYPE = #{stationType} AND t.STATION_TYPE = #{stationType}
</if> </if>
...@@ -23,4 +26,11 @@ ...@@ -23,4 +26,11 @@
</where> </where>
LIMIT 1 LIMIT 1
</select> </select>
<select id="selectStationInfoList" resultType="java.util.Map">
SELECT
*
FROM
idx_biz_station_info
</select>
</mapper> </mapper>
...@@ -562,6 +562,17 @@ public class OrgUsrController extends BaseController { ...@@ -562,6 +562,17 @@ public class OrgUsrController extends BaseController {
@PersonIdentify @PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeIsOnline", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司树", notes = "根据登录人及类型获取公司树")
public ResponseModel<List<OrgMenuDto>> companyTreeIsOnline() {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserNumber2(reginParams);
return ResponseHelper.buildResponse(menus);
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeByUserToPatrolRoute", method = RequestMethod.GET) @RequestMapping(value = "/companyTreeByUserToPatrolRoute", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人获取公司部门树【部门账号登录可查看上级单位】", notes = "根据登录人获取公司部门树") @ApiOperation(httpMethod = "GET", value = "根据登录人获取公司部门树【部门账号登录可查看上级单位】", notes = "根据登录人获取公司部门树")
public ResponseModel<List<OrgMenuDto>> companyTreeByUserToPatrolRoute() { public ResponseModel<List<OrgMenuDto>> companyTreeByUserToPatrolRoute() {
......
...@@ -55,6 +55,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext; ...@@ -55,6 +55,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.Serializable; import java.io.Serializable;
...@@ -227,6 +228,63 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -227,6 +228,63 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return result; return result;
} }
public List<OrgMenuDto> buildTreeParallel2(List<OrgUsr> list) {
List<Map<String, Object>> stationInfoOnline = stationInfoMapper.selectStationInfoList();
List<String> bizOrgCodeList = stationInfoOnline.stream().map(item -> item.get("biz_org_code").toString()).collect(Collectors.toList());
List<OrgMenuDto> menuList = list.stream()
.map(o -> new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName(),
ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.parseLong(o.getParentId()), o.getBizOrgType(),
false, o.getBizOrgCode(), o.getCode(), o.getBizOrgCode().length() == 18 && bizOrgCodeList.contains(o.getBizOrgCode()) ? Boolean.TRUE : Boolean.FALSE).setTotal(o.getTotal()))
.collect(Collectors.toList());
List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getKey(), e));
Set<? extends Map.Entry<Long, ? extends OrgMenuDto>> entries = map.entrySet();
// 此处多线程,会value 出现null 的情况
entries.forEach(entry -> {
OrgMenuDto value = entry.getValue();
if (value != null) {
OrgMenuDto treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<OrgMenuDto> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
result.add(value);
}
}
});
List<OrgMenuDto> orgMenuDtos = doIsOnlineData(result);
return orgMenuDtos;
}
private List<OrgMenuDto> doIsOnlineData(List<OrgMenuDto> list) {
if (CollectionUtils.isNotEmpty(list)) {
for (OrgMenuDto orgMenuDto : list) {
if (orgMenuDto.getBizOrgCode().length() == 12) {
orgMenuDto.setIsOnline(Boolean.TRUE);
if (CollectionUtils.isNotEmpty(orgMenuDto.getChildren())) {
Set<Boolean> collect = orgMenuDto.getChildren().stream().map(OrgMenuDto::getIsOnline).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(collect) || (collect.contains(Boolean.FALSE) && !collect.contains(Boolean.TRUE))) {
orgMenuDto.setIsOnline(Boolean.FALSE);
}
} else if (CollectionUtils.isEmpty(orgMenuDto.getChildren())) {
orgMenuDto.setIsOnline(Boolean.FALSE);
}
} else if (orgMenuDto.getBizOrgCode().length() == 6) {
orgMenuDto.setIsOnline(Boolean.TRUE);
}
doIsOnlineData(orgMenuDto.getChildren());
}
}
return list;
}
public static String getOrgCodeStr() { public static String getOrgCodeStr() {
return TreeParser.genTreeCode(); return TreeParser.genTreeCode();
} }
...@@ -2939,6 +2997,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2939,6 +2997,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return buildTreeParallel(list); return buildTreeParallel(list);
} }
public List<OrgMenuDto> companyTreeByUserNumber2(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
// 权限处理
if (!logic){
OrgUsr orgUsr = orgUsrMapper.selectById(reginParams.getPersonIdentity().getCompanyId());
//判断登陆人是否已经是顶级节点单位
if (!ObjectUtils.isEmpty(orgUsr) && orgUsr.getParentId() != null) {
orgUsr = this.selectParentOrgUsr(orgUsr);
bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode():bizOrgCode;
}
}
PermissionInterceptorContext.setDataAuthRule(authKey);
param.put("bizOrgCode",bizOrgCode);
List<OrgUsr> list = orgUsrMapper.companyListWithPersonCount(param);
return buildTreeParallel2(list);
}
public List<OrgMenuDto> companyTreeByUserNumberNew(ReginParams reginParams) { public List<OrgMenuDto> companyTreeByUserNumberNew(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
// 权限处理 // 权限处理
......
...@@ -223,7 +223,7 @@ public class SignServiceImpl extends BaseService<SignDto, Sign, SignMapper> impl ...@@ -223,7 +223,7 @@ public class SignServiceImpl extends BaseService<SignDto, Sign, SignMapper> impl
public Map<String, Object> getCenterSignStats(String bizOrgCode, String date, Integer targetPassNum, String stationType) { public Map<String, Object> getCenterSignStats(String bizOrgCode, String date, Integer targetPassNum, String stationType) {
List<Map<String, Object>> queryMaps = baseMapper.selectCenterSignStats(bizOrgCode, date, targetPassNum, stationType); List<Map<String, Object>> queryMaps = baseMapper.selectCenterSignStats(bizOrgCode, date, targetPassNum, stationType);
int passedStationNum = 0; int passedStationNum = 0;
long allStationNum = stationInfoMapper.count(stationType); long allStationNum = stationInfoMapper.count(bizOrgCode, stationType);
for (Map<String, Object> queryMap : queryMaps) { for (Map<String, Object> queryMap : queryMaps) {
String status = queryMap.get("status").toString(); String status = queryMap.get("status").toString();
......
...@@ -5119,7 +5119,6 @@ ...@@ -5119,7 +5119,6 @@
from from
wl_equipment_specific_index ei wl_equipment_specific_index ei
where where
-- or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' 此处由于单位会出现多个,所以无法确定选择哪一个,所以此处默认用一个指标的单位进行单位换算
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel') (ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit', and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit',
IFNULL( rp.volume, 0 ) AS volume, IFNULL( rp.volume, 0 ) AS volume,
...@@ -5279,7 +5278,7 @@ ...@@ -5279,7 +5278,7 @@
c.`status` = #{status} c.`status` = #{status}
</if> </if>
</where> </where>
<if test="sortFlag != null and sortFlag != '' and sortFlag = '1'"> <if test="sortFlag != null and sortFlag == '1'">
<choose> <choose>
<when test="sortOrder == 'ascend'"> <when test="sortOrder == 'ascend'">
ORDER BY CONVERT(c.bizOrgName USING gbk) ASC ORDER BY CONVERT(c.bizOrgName USING gbk) ASC
...@@ -5289,7 +5288,7 @@ ...@@ -5289,7 +5288,7 @@
</otherwise> </otherwise>
</choose> </choose>
</if> </if>
<if test="sortFlag != null and sortFlag != '' and sortFlag = '2'"> <if test="sortFlag != null and sortFlag == '2'">
<choose> <choose>
<when test="sortOrder == 'ascend'"> <when test="sortOrder == 'ascend'">
ORDER BY d.eligibility ASC ORDER BY d.eligibility ASC
...@@ -5394,7 +5393,6 @@ ...@@ -5394,7 +5393,6 @@
from from
wl_equipment_specific_index ei wl_equipment_specific_index ei
where where
-- or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel' 此处由于单位会出现多个,所以无法确定选择哪一个,所以此处默认用一个指标的单位进行单位换算
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = (ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key =
'FHS_WirelessliquidDetector_WaterLevel') 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit', and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit',
...@@ -7158,28 +7156,31 @@ ...@@ -7158,28 +7156,31 @@
* *
FROM FROM
( (
(SELECT count( 1 ) AS indexNum FROM wl_equipment_specific_index a LEFT JOIN wl_equipment_index b ON a.equipment_index_id = b.id WHERE b.is_iot = 1
and equipment_specific_id IN
(SELECT (SELECT
id sum( n.num )
FROM
(
SELECT
a.id,
count( 1 ) AS num
FROM FROM
wl_equipment_specific wl_equipment_specific a
LEFT JOIN (select m.* from wl_equipment_specific_index m left join wl_equipment_index e on e.id = m.equipment_index_id where e.is_iot = 1) b ON a.id = b.equipment_specific_id
<where> <where>
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
AND biz_org_code LIKE CONCAT(#{bizOrgCode},'%') AND a.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if> </if>
</where>) </where>
GROUP BY
a.id
) n
)
) AS indexNum, ) AS indexNum,
(SELECT count( 1 ) AS equipNum FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1 (SELECT count( 1 ) AS equipNum FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
AND es.biz_org_code LIKE CONCAT(#{bizOrgCode},'%') AND es.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if> </if>
) AS equipNum, ) AS equipNum
(SELECT count(1) AS indexMonitorNum FROM wl_equipment_specific_index wesi LEFT JOIN wl_equipment_specific wes on wesi.equipment_specific_id = wes.id WHERE DATE_FORMAT(wesi.update_date, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND wes.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) AS indexMonitorNum
) )
</select> </select>
......
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