Commit ba8f34c9 authored by xixinzhao's avatar xixinzhao

建筑修改

parent f9e6a44e
......@@ -30,4 +30,6 @@ public class BuildSearchDTO {
* 分组类型
*/
private String groupType;
private String bizOrgCode;
}
......@@ -281,4 +281,12 @@ public class BuildingController extends AbstractBaseController {
public Map<String, String> getBuildingToLongitudeAndLatitude(@RequestParam String instanceId){
return buildService.getBuildingToLongitudeAndLatitude(instanceId);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("公司消防建筑树")
@GetMapping(value = "/companyBuildingTree")
public List<BuildingTreeVo> getCompanyBuildingTree() {
return buildService.getCompanyBuildingTree();
}
}
......@@ -308,4 +308,11 @@ public interface IBuilldService extends IService<Building> {
*/
Map<String, String> getBuildingToLongitudeAndLatitude(String instanceId);
/**
* 根据登陆人获取公司部门树
* @return list
*/
List<BuildingTreeVo> getCompanyBuildingTree();
}
......@@ -50,6 +50,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
......@@ -1195,4 +1196,47 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
// TODO Auto-generated method stub
return formInstanceMapper.getBuildingToLongitudeAndLatitude(instanceId);
}
@Override
public List<BuildingTreeVo> getCompanyBuildingTree() {
List<BuildingTreeVo> allListVo = getBuildingTreeVos();
// 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey,"COMPANY");
AtomicReference<Boolean> flag = new AtomicReference<>(false);
List<BuildingTreeVo> collect = orgUsrLists.stream().map(orgUsrDto -> {
BuildingTreeVo vo = new BuildingTreeVo();
vo.setGroupType("allBuilding");
vo.setGroupCode("allBuilding");
vo.setInstanceName(orgUsrDto.getBizOrgName());
vo.setBizOrgCode(orgUsrDto.getBizOrgCode());
vo.setInstanceId(orgUsrDto.getSequenceNbr());
vo.setParentId(orgUsrDto.getParentId());
vo.setName(orgUsrDto.getBizOrgName());
vo.setId(orgUsrDto.getSequenceNbr());
if ("".equals(orgUsrDto.getParentId()) || "-1".equals(orgUsrDto.getParentId()) || null == orgUsrDto.getParentId()) {
flag.set(true);
}
return vo;
}).collect(Collectors.toList());
allListVo.addAll(collect);
return allListVo.stream().filter(s -> flag.get() ? "allBuilding".equals(s.getGroupType()) && s.getBizOrgCode() != null && ("".equals(s.getParentId()) || "-1".equals(s.getParentId()) || null == s.getParentId())
: "allBuilding".equals(s.getGroupType()) && s.getBizOrgCode() != null)
.peek(m -> m.setChildren(this.getCompanyBuildingChildrenTree(m, allListVo)))
.collect(Collectors.toList());
}
private List<BuildingTreeVo> getCompanyBuildingChildrenTree(BuildingTreeVo root , List<BuildingTreeVo> all) {
return all.stream().filter(b ->
(root.getId() != null && StringUtil.isNotEmpty(b.getParentId()) && b.getParentId().equals(root.getId().toString())) ||
("allBuilding".equals(root.getGroupType())
&& "building".equals(b.getGroupType())
&& StringUtil.isNotEmpty(root.getBizOrgCode())
&& root.getBizOrgCode().equals(b.getBizOrgCode())
&& !b.getId().equals(root.getId())))
.peek(m -> {m.setChildren(getCompanyBuildingChildrenTree(m, all));
m.setDetailPaneApi(address);
m.setApiUrl(apiUrl);})
.collect(Collectors.toList());
}
}
......@@ -87,7 +87,8 @@
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 = 'address' THEN a.field_value END ) AS address,
MAX( CASE WHEN a.field_name = 'bizOrgCode' THEN a.field_value END ) AS bizOrgCode
FROM
`wl_form_instance` a
LEFT JOIN wl_source_scene wlss ON wlss.source_id = a.instance_id
......@@ -116,7 +117,9 @@
MAX(CASE WHEN a.field_name = 'hasFirePlan' THEN a.field_value END)AS hasFirePlan,
MAX(CASE WHEN a.field_name = 'installLoc' THEN a.field_value END)AS installLoc,
MAX(CASE WHEN a.field_name = 'inwhichBuild' THEN a.field_value END)AS inwhichBuild,
MAX(CASE WHEN a.field_name = 'maintenanceUnit' THEN a.field_value END)AS maintenanceUnit
MAX(CASE WHEN a.field_name = 'maintenanceUnit' THEN a.field_value END)AS maintenanceUnit,
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
GROUP BY
......@@ -129,6 +132,9 @@
<if test="query.fieldValue != null and query.fieldValue !=''">
AND sa.fieldValue = #{query.fieldValue}
</if>
<if test="query.bizOrgCode != null and query.bizOrgCode !=''">
AND sa.bizOrgCode LIKE CONCAT(#{query.bizOrgCode},'%')
</if>
</where>
ORDER BY sa.instanceId DESC
</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