Commit 8d3a985c authored by zhangsen's avatar zhangsen

消防系统树和消防建筑树接口修改、新加单位部门树API接口

parent 22ce226c
......@@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentHashMap;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.utils.SpringUtils;
import com.yeejoin.equipmanage.fegin.JcsFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -28,6 +29,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -112,6 +114,11 @@ public class FireFightingSystemController extends AbstractBaseController {
@Value("${firefightingsystem.equip.alarms.url}")
private String ffsEquipAlarmsUrl;
@Autowired
private JcsFeign jcsFeign;
@Value("${auth-key-fire-system}")
private String systemAuthKey;
@Autowired
EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
......@@ -585,11 +592,12 @@ public class FireFightingSystemController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统树和消防建筑树", notes = "树菜单")
@GetMapping(value = "/getBuildingTreeAndSystemTree")
public Map<String, List> getBuildingTreeAndSystemTree() {
public Map<String, List> getBuildingTreeAndSystemTree(@RequestParam String bizOrgCode) {
Map<String, List> map = new HashMap<>();
List<BuildingTreeVo> buildingTrees = buildService.getBuildingTree();
List<BuildingTreeVo> buildingTrees = buildService.getBuildingTreeByBizOrgCode(bizOrgCode);
LambdaQueryWrapper<FireFightingSystemEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByAsc(FireFightingSystemEntity::getRecDate);
lambdaQueryWrapper.likeRight(StringUtil.isNotEmpty(bizOrgCode), FireFightingSystemEntity::getBizOrgCode, bizOrgCode);
List<FireFightingSystemEntity> systemTree = fireFightingSystemService.list(lambdaQueryWrapper);
systemTree.forEach(action -> {
action.setDetailListPaneApi(ffsEquipAlarmsUrl);
......@@ -601,6 +609,20 @@ public class FireFightingSystemController extends AbstractBaseController {
}
/**
* 消防装备单位部门树
*
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/companyTreeBySystem")
@ApiOperation(httpMethod = "GET", value = "消防系统单位部门树", notes = "消防系统单位部门树")
public ResponseModel<List<OrgMenuDto>> companyTreeByUserAndType() {
return ResponseHelper.buildResponse(jcsFeign.getCompanyDeptTreeWithAuth(systemAuthKey, null).getResult());
}
/**
* 装备卡片删除
*
* @return
......
......@@ -48,6 +48,14 @@ public interface FormInstanceMapper extends BaseMapper<FormInstance> {
* @return
*/
List<Map<String,Object>> querySpecialChildrenList(String parentId);
/**
* 查询指定节点的子
* @param parentId
* @return
*/
List<Map<String,Object>> querySpecialChildrenListByBizOrgCode(@Param("parentId") String parentId, @Param("bizOrgCode") String bizOrgCode);
/**
* @Description 分页查询
* @param dto 查询参数
......
......@@ -77,6 +77,13 @@ public interface IBuilldService extends IService<Building> {
List<BuildingTreeVo> getBuildingTree();
/**
* 消防建筑树查询接口(带条件bizOrgCode)
*
* @return List<BuildingTreeVo>
*/
List<BuildingTreeVo> getBuildingTreeByBizOrgCode(String bizOrgCode);
/**
* 消防建筑层级树查询接口
*
* @return List<BuildingTreeVo>
......
......@@ -71,6 +71,15 @@ public interface IFormInstanceService extends IService<FormInstance> {
* @return List<Map < String, Object>>
*/
List<Map<String, Object>> getSpecialChildrenList(String parentId);
/**
* 查询指定节点的下降
*
* @param parentId 父节点
* @return List<Map < String, Object>>
*/
List<Map<String, Object>> getSpecialChildrenListByBizOrgCode(String parentId, String bizOrgCode);
/**
* @Description 分页查询
* @param dto 查询参数
......
......@@ -464,6 +464,28 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
@Override
public List<BuildingTreeVo> getBuildingTreeByBizOrgCode(String bizOrgCode) {
List<BuildingTreeVo> allListVo = getBuildingTreeVosByBizOrgCode(true, bizOrgCode);
return allListVo.stream().filter(s -> "-1".equals(s.getParentId())).map(s -> {
BuildingTreeVo t = new BuildingTreeVo();
Bean.copyExistPropertis(s, t);
t.setChildren(this.getChildren(t.getInstanceId(), allListVo));
t.setDetailPaneApi(address);
t.setApiUrl(apiUrl);
return t;
}).collect(Collectors.toList());
}
private List<BuildingTreeVo> getBuildingTreeVosByBizOrgCode(Boolean isContainRootNode, String bizOrgCode) {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode());
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenListByBizOrgCode(null, bizOrgCode);
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, isContainRootNode);
Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo);
allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId())));
return allListVo;
}
@Override
public List<Map<String, Object>> getBuildingDetaiList() {
return iFormInstanceService.getSpecialChildrenList(null);
}
......
......@@ -436,6 +436,11 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
return this.baseMapper.querySpecialChildrenList(parentId);
}
@Override
public List<Map<String, Object>> getSpecialChildrenListByBizOrgCode(String parentId, String bizOrgCode) {
return this.baseMapper.querySpecialChildrenListByBizOrgCode(parentId, bizOrgCode);
}
private String fillCode(String groupCode, String fieldName, String value, String companyCode) {
if (CODE.equals(fieldName) && StringUtils.isEmpty(value)) {
return RandomUtil.buildNo(GroupCodeEnum.getInstance(groupCode).getSequenceType(), companyCode);
......
......@@ -562,4 +562,39 @@ AND field_name =#{name}
WHERE c.field_value = #{id})
</select>
<select id="querySpecialChildrenListByBizOrgCode" resultType="java.util.Map">
SELECT
*
FROM
(
SELECT
a.instance_id as id,
a.instance_id AS instanceId,
a.group_code AS groupCode,
a.group_type AS groupType,
wlss.scene_id as sceneId,
MAX( CASE WHEN a.field_name = 'parentId' THEN a.field_value END ) AS parentId,
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS instanceName,
MAX( CASE WHEN a.field_name = 'name' THEN a.field_value END ) AS name,
MAX( CASE WHEN a.field_name = 'code' THEN a.field_value END ) AS code,
MAX( CASE WHEN a.field_name = 'isRisk' THEN a.field_value END ) AS isRisk,
MAX( CASE WHEN a.field_name = 'address' THEN a.field_value END ) AS address,
MAX( CASE WHEN a.field_name = 'bizOrgCode' THEN a.field_value END ) AS bizOrgCode,
MAX( CASE WHEN a.field_name = 'bizOrgName' THEN a.field_value END ) AS bizOrgName
FROM
`wl_form_instance` a
LEFT JOIN wl_source_scene wlss ON wlss.source_id = a.instance_id
GROUP BY
a.instance_id
) sa
<where>
<if test="parentId != null and parentId !=''">
sa.parentId = #{parentId}
</if>
<if test="bizOrgCode != null and bizOrgCode !=''">
and sa.bizOrgCode LIKE CONCAT(#{bizOrgCode},'%')
</if>
</where>
</select>
</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