Commit 7ebf0065 authored by KeYong's avatar KeYong

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

parents c9b6b3a7 a4334727
...@@ -671,8 +671,11 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -671,8 +671,11 @@ public class FireFightingSystemController extends AbstractBaseController {
@PostMapping(value = "/getMonitoringUnitList") @PostMapping(value = "/getMonitoringUnitList")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "查询监测部件列表", notes = "查询监测部件列表") @ApiOperation(httpMethod = "POST", value = "查询监测部件列表", notes = "查询监测部件列表")
public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(@RequestBody EquipTypeAmountPageDTO equipTypeAmountPage) { public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(
return equipmentSpecificSerivce.getMonitoringUnitList(equipTypeAmountPage); @RequestBody EquipTypeAmountPageDTO equipTypeAmountPage,
@RequestParam(value = "useSource", required = false) String useSource
) {
return equipmentSpecificSerivce.getMonitoringUnitList(equipTypeAmountPage, useSource);
} }
@GetMapping(value = "/getMonitoringCount") @GetMapping(value = "/getMonitoringCount")
......
...@@ -143,7 +143,14 @@ public interface JcsFeign { ...@@ -143,7 +143,14 @@ public interface JcsFeign {
* @return ResponseModel<OrgUsrDto> * @return ResponseModel<OrgUsrDto>
*/ */
@GetMapping(value = "/org-usr/{authKey}/listWithAuth") @GetMapping(value = "/org-usr/{authKey}/listWithAuth")
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuth(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes, @RequestParam(value = "type", required = false) String type); FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuth(
@RequestHeader(value = "Appkey") String appKey,
@RequestHeader(value = "Product") String product,
@RequestHeader(value = "Token") String token,
@PathVariable(value = "authKey") String authKey,
@RequestParam(value = "orgTypes", required = false) String orgTypes,
@RequestParam(value = "type", required = false) String type
);
@GetMapping(value = "/org-usr/{authKey}/listWithAuthToPartol") @GetMapping(value = "/org-usr/{authKey}/listWithAuthToPartol")
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuthToPartol(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes); FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuthToPartol(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes);
......
...@@ -308,7 +308,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -308,7 +308,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> getListByCode(@Param("code") String code, @Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getListByCode(@Param("code") String code, @Param("bizOrgCode") String bizOrgCode);
IPage<EquipTypeImgAmountVO> getMonitoringUnitList(@Param("page") IPage page,@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage); IPage<EquipTypeImgAmountVO> getMonitoringUnitList(
@Param("page") IPage page,
@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage,
@Param("useSource") String useSource
);
List<Map<String, Object >> getMonitoringCount(String bizOrgCode); List<Map<String, Object >> getMonitoringCount(String bizOrgCode);
......
...@@ -305,7 +305,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -305,7 +305,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
String updateEquipSpecificStatusByCheckInput( String id); String updateEquipSpecificStatusByCheckInput( String id);
IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage); IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage, String useSource);
List<Map<String, Object >> getMonitoringCount(String bizOrgCode); List<Map<String, Object >> getMonitoringCount(String bizOrgCode);
......
...@@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
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;
...@@ -64,6 +65,7 @@ import java.io.IOException; ...@@ -64,6 +65,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -541,12 +543,14 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -541,12 +543,14 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode, String bizOrgCode) { private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode, String bizOrgCode) {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode()); CompletableFuture<FormGroup> formGroupFuture = CompletableFuture.supplyAsync(() -> iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode()));
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, bizOrgCode); CompletableFuture<List<Map<String, Object>> > allListFuture = CompletableFuture.supplyAsync(() -> iFormInstanceService.getSpecialChildrenList(null, bizOrgCode));
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, isContainRootNode); return CompletableFuture.allOf(formGroupFuture, allListFuture).thenApply(v -> {
Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo); List<BuildingTreeVo> allListVo = buildBuildingData(formGroupFuture.join(), allListFuture.join(), isContainRootNode);
allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId()))); Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo);
return allListVo; allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId())));
return allListVo;
}).join();
} }
...@@ -1309,10 +1313,16 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1309,10 +1313,16 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public Map<Long, String> getBuildingAbsolutePosition() { public Map<Long, String> getBuildingAbsolutePosition() {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode()); CompletableFuture<FormGroup> formGroupCompletableFuture = CompletableFuture.supplyAsync(() ->
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, null); iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode())
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, true); );
return getBuildingAbsolutePosition(allListVo); CompletableFuture<List<Map<String, Object>>> allListCompletableFuture = CompletableFuture.supplyAsync(() ->
iFormInstanceService.getSpecialChildrenList(null, null)
);
return formGroupCompletableFuture.thenCombine(allListCompletableFuture, (formGroup, allList) -> {
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, true);
return getBuildingAbsolutePosition(allListVo);
}).join();
} }
@Override @Override
...@@ -1418,23 +1428,25 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1418,23 +1428,25 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
//1.组装数据 //1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type,"building"); List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type,"building");
//2.list to tree //2.list to tree
List<BuildingTreeVo> buildingTreeVos = companyBuildingList.stream().filter(a -> companyBuildingList.stream().noneMatch(c -> c.getId().toString().equals(a.getParentId()))).peek(b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyBuildingList))).collect(Collectors.toList()); List<BuildingTreeVo> buildingTreeVos = companyBuildingList.parallelStream()
.filter(
a -> companyBuildingList.parallelStream().noneMatch(c -> c.getId().toString().equals(a.getParentId()))
).peek(
b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyBuildingList))
).collect(Collectors.toList());
// 任务 7481 // 任务 7481
if(buildingTreeVos.size() == 1 && buildingTreeVos.get(0).getChildren().size() > 0) { if(buildingTreeVos.size() == 1 && !CollectionUtils.isEmpty(buildingTreeVos.get(0).getChildren())) {
List<BuildingTreeVo> buildingTreeVosNew = buildingTreeVos.get(0).getChildren().stream().sorted(new Comparator<BuildingTreeVo>() { List<BuildingTreeVo> buildingTreeVosNew = buildingTreeVos.get(0).getChildren().parallelStream().sorted((o1, o2) -> {
@Override if(o1.getGroupType().equals(o2.getGroupType())) {
public int compare(BuildingTreeVo o1, BuildingTreeVo o2) {
if(o1.getGroupType().equals(o2.getGroupType())) {
return 0;
}
if(o1.getGroupType().equals("building") ) {
return -1;
}
if(o2.getGroupType().equals("building") ) {
return 1;
}
return 0; return 0;
} }
if(o1.getGroupType().equals("building") ) {
return -1;
}
if(o2.getGroupType().equals("building") ) {
return 1;
}
return 0;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
buildingTreeVos.get(0).setChildren(buildingTreeVosNew); buildingTreeVos.get(0).setChildren(buildingTreeVosNew);
} }
...@@ -1480,9 +1492,24 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1480,9 +1492,24 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
if (StringUtils.isEmpty(authKey)) { if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey; authKey = this.authKey;
} }
List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false, null); // List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false, null);
// 1.获取公司list // 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY", type); // List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY", type);
CompletableFuture<List<BuildingTreeVo>> companyListFuture = CompletableFuture.supplyAsync(() -> getBuildingTreeVos(false, null));
String finalAuthKey = authKey;
String appKey = RequestContext.getAppKey();
String product = RequestContext.getProduct();
String token = RequestContext.getToken();
CompletableFuture<List<OrgUsrDto>> orgUsrListFuture = CompletableFuture.supplyAsync(() -> {
RequestContext.setAppKey(appKey);
RequestContext.setProduct(product);
RequestContext.setToken(token);
return jcsRemoteService.getCompanyDeptListWithAuth(finalAuthKey, "COMPANY", type);
});
CompletableFuture.allOf(companyListFuture, orgUsrListFuture).join();
List<BuildingTreeVo> buildingTreeVos = companyListFuture.join();
List<OrgUsrDto> orgUsrLists = orgUsrListFuture.join();
if(orgUsrLists.isEmpty()){ if(orgUsrLists.isEmpty()){
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -1676,7 +1703,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1676,7 +1703,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
private List<BuildingTreeVo> getCompanyBuildingChildrenTree(String parentId, List<BuildingTreeVo> all) { private List<BuildingTreeVo> getCompanyBuildingChildrenTree(String parentId, List<BuildingTreeVo> all) {
return all.stream().filter(a -> parentId.equals(a.getParentId())).peek(a -> { return all.parallelStream().filter(a -> parentId.equals(a.getParentId())).peek(a -> {
a.setChildren(getCompanyBuildingChildrenTree(a.getId().toString(), all)); a.setChildren(getCompanyBuildingChildrenTree(a.getId().toString(), all));
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
......
...@@ -2169,8 +2169,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2169,8 +2169,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage) { public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage, String useSource) {
IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(), equipTypeAmountPage); IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(), equipTypeAmountPage, useSource);
record.getRecords().forEach(e -> { record.getRecords().forEach(e -> {
e.setEquip(equipmentSpecificMapper.getMonitoringEquip(String.valueOf(e.getId())).get("num").toString()); e.setEquip(equipmentSpecificMapper.getMonitoringEquip(String.valueOf(e.getId())).get("num").toString());
e.setOther(equipmentSpecificMapper.getMonitoringOther(String.valueOf(e.getId())).get("num").toString()); e.setOther(equipmentSpecificMapper.getMonitoringOther(String.valueOf(e.getId())).get("num").toString());
......
...@@ -451,7 +451,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -451,7 +451,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// }); // });
// List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList()); // List<PointTreeVo> regionList = responses.stream().filter(r -> "TRUE".equals(r.getIsRegion())).collect(Collectors.toList());
if ("dl".equals(type)) { if ("dl".equals(type)) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, "COMPANY", "dl"); FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), authKey, "COMPANY", "dl");
orgCode = feignClientResult.getResult().get(0).getBizOrgCode(); orgCode = feignClientResult.getResult().get(0).getBizOrgCode();
} }
List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode, null); List<PointTreeVo> buildList = buildingMapper.getBuildList(orgCode, null);
...@@ -2412,7 +2412,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2412,7 +2412,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode() { public List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode() {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, "COMPANY", "dl"); FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), authKey, "COMPANY", "dl");
String bizOrgCode = feignClientResult.getResult().get(0).getBizOrgCode(); String bizOrgCode = feignClientResult.getResult().get(0).getBizOrgCode();
List<Map<String, Object>> list = fireFightingSystemMapper.systemAndEquipment(bizOrgCode); List<Map<String, Object>> list = fireFightingSystemMapper.systemAndEquipment(bizOrgCode);
return systemAndEquipmentTree(list); return systemAndEquipmentTree(list);
......
...@@ -6,6 +6,7 @@ import com.yeejoin.equipmanage.common.dto.OrgUsrDto; ...@@ -6,6 +6,7 @@ import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.fegin.JcsFeign; import com.yeejoin.equipmanage.fegin.JcsFeign;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List; import java.util.List;
...@@ -37,7 +38,7 @@ public class JCSRemoteService { ...@@ -37,7 +38,7 @@ public class JCSRemoteService {
* @return List<OrgUsrDto> * @return List<OrgUsrDto>
*/ */
public List<OrgUsrDto> getCompanyDeptListWithAuth(String authKey, String orgTypes,String type) { public List<OrgUsrDto> getCompanyDeptListWithAuth(String authKey, String orgTypes,String type) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, orgTypes, type); FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), authKey, orgTypes, type);
return feignClientResult.getResult(); return feignClientResult.getResult();
} }
......
...@@ -2673,7 +2673,12 @@ ...@@ -2673,7 +2673,12 @@
</if> </if>
AND wed.equipment_name is not null AND wed.equipment_name is not null
</where> </where>
ORDER BY CONVERT(bizOrgName USING gbk) ASC, equipStatus DESC , wes.create_date DESC <if test="useSource == null or useSource == ''">
ORDER BY CONVERT(bizOrgName USING gbk) ASC, equipStatus DESC , wes.create_date DESC
</if>
<if test="useSource == 'cardscreen'">
ORDER BY equipStatus DESC , wes.create_date DESC
</if>
</select> </select>
<select id="getMonitoringCount" resultType="java.util.Map"> <select id="getMonitoringCount" resultType="java.util.Map">
SELECT SELECT
...@@ -2691,10 +2696,10 @@ ...@@ -2691,10 +2696,10 @@
</select> </select>
<select id="getMonitoringEquip" resultType="java.util.Map"> <select id="getMonitoringEquip" resultType="java.util.Map">
SELECT IFNULL(SUM(IF(aqr.SOURCE = 'equip', 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id} SELECT IFNULL(SUM(IF(aqr.SOURCE = 'equip' AND aqr.TYPE = 'equipment' AND CLEAN_TIME IS NULL, 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id}
</select> </select>
<select id="getMonitoringOther" resultType="java.util.Map"> <select id="getMonitoringOther" resultType="java.util.Map">
SELECT IFNULL(SUM(IF(aqr.SOURCE != 'equip', 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id} SELECT IFNULL(SUM(IF(aqr.SOURCE != 'equip' AND aqr.TYPE = 'equipment' AND CLEAN_TIME IS NULL, 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id}
</select> </select>
<update id="updateEquipQrCode" parameterType="list"> <update id="updateEquipQrCode" parameterType="list">
......
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