Commit c5bb4b6a authored by chenzhao's avatar chenzhao

修改代码

parent b8696252
......@@ -47,7 +47,7 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> {
*/
Page<WaterResourceDto> getWaterResourcePageByParams(Page<WaterResourceDto> page, String name, String resourceType,
ArrayList<Long> belongBuildingId, Long belongFightingSystemId,
Long sequenceNbr, String equipId,String bizOrgCode, String equipCateGoryCode);
Long sequenceNbr, String equipId,String bizOrgCode, String equipCateGoryCode,List<String> ids);
List<Map<String, Object>> getWaterTypeByBizOrgCode(String bizOrgCode);
}
......@@ -151,6 +151,12 @@
<if test="belongBuildingId != null and belongBuildingId.size() > 0">
and find_in_set(belong_building_id, #{belongBuildingId}) > 0
</if>
<if test="ids != null and ids.size()>0">
AND sequence_nbr NOT IN
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">and biz_org_code like concat( #{bizOrgCode}, '%')</if>
order by cb_water_resource.rec_date desc
</select>
......
......@@ -433,14 +433,15 @@ public class WaterResourceController extends BaseController {
String resourceType,
String classifyId,
String bizOrgCode,
String equipCateGoryCode) {
String equipCateGoryCode,
List<String> ids) {
Page<WaterResourceDto> page = new Page<>();
page.setCurrent(pageNum);
page.setSize(pageSize);
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
Page<WaterResourceDto> waterResourceDtoPage = waterResourceServiceImpl.queryForWaterResourcePage(page, name, resourceType,
belongBuildingId, belongFightingSystemId, sequenceNbr, classifyId, bizOrgCode, equipCateGoryCode);
belongBuildingId, belongFightingSystemId, sequenceNbr, classifyId, bizOrgCode, equipCateGoryCode,ids);
List<WaterResourceDto> records = waterResourceDtoPage.getRecords();
records.forEach(i -> {
Map<String, List<AttachmentDto>> attachments = sourceFileService.getAttachments(i.getSequenceNbr());
......
......@@ -87,9 +87,9 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
@Condition(Operator.eq) Long sequenceNbr,
String equipId,
String bizOrgCode,
String equipCateGoryCode) {
String equipCateGoryCode,List<String> ids) {
return this.waterResourceMapper.getWaterResourcePageByParams(page, name, resourceType, belongBuildingId,
belongFightingSystemId, sequenceNbr, equipId, bizOrgCode, equipCateGoryCode);
belongFightingSystemId, sequenceNbr, equipId, bizOrgCode, equipCateGoryCode,ids);
}
/**
......
......@@ -139,6 +139,7 @@ public class MaintenanceResourceController extends AbstractBaseController {
@RequestParam(required = false) String fireFacilityName,
@RequestParam(required = false) List<Long> buildingId,
@RequestParam(required = false) Long fireFacilityId,
@RequestParam(required = false) String maintenanceCompanyId,
@RequestParam(required = false) String classifyId) {
Page page = new Page();
page.setCurrent(current);
......@@ -147,7 +148,7 @@ public class MaintenanceResourceController extends AbstractBaseController {
} else {
page.setSize(size);
}
return maintenanceResourceService.combineDataPage(page, fireFightSysId, fireFacilityId, fireFacilityName, classifyId, buildingId, getAppKey(), getProduct(), getToken());
return maintenanceResourceService.combineDataPage(page, fireFightSysId, fireFacilityId, fireFacilityName, classifyId, buildingId,maintenanceCompanyId, getAppKey(), getProduct(), getToken());
}
/**
......
......@@ -155,7 +155,6 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
public IPage<MaintenanceResourceData> listPage(Integer pageNum, Integer pageSize, MaintenanceResourceDataVo resourceData) {
MaintenanceResourceData data = new MaintenanceResourceData();
List<Long> buildingIds = resourceData.getBuildingIds();
Long fireFacilityId = resourceData.getFireFacilityId();
BeanUtils.copyProperties(resourceData, data);
Page<MaintenanceResourceData> pageBean;
QueryWrapper<MaintenanceResourceData> queryWrapper = new QueryWrapper<>();
......@@ -187,6 +186,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
} catch (Exception e) {
}
});
if (!CollectionUtils.isEmpty(buildingIds)) {
queryWrapper.in("building_id", buildingIds);
}
......@@ -197,6 +197,7 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
pageBean = new Page<>(0, Long.MAX_VALUE);
}
page = maintenanceResourceDataService.page(pageBean, queryWrapper);
page.getRecords().stream().forEach(e->e.setLocation(e.getBuildingName() == null ? "" : e.getBuildingName()+e.getLocation() == null ? "" : e.getLocation()) );
return page;
}
......
......@@ -42,7 +42,8 @@ public interface JcsFeign {
@RequestParam(value = "belongBuildingId") List<Long> belongBuildingId,
@RequestParam(value = "belongFightingSystemId") Long belongFightingSystemId,
@RequestParam(value = "sequenceNbr") Long sequenceNbr,
@RequestParam(value = "classifyId") String classifyId
@RequestParam(value = "classifyId") String classifyId,
@RequestParam(value = "classifyId") List<String> ids
);
@RequestMapping(value = "/equip/fireSystem_waterResource/list", method = RequestMethod.GET, consumes = "application/json")
......
......@@ -166,9 +166,9 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<MaintenanceResourceData> getSysEquipClassifyDataList();
IPage<MaintenanceResourceDataVo> getSysEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId);
IPage<MaintenanceResourceDataVo> getSysEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId,List<String> bandWbCompany);
IPage<MaintenanceResourceDataVo> getEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId);
IPage<MaintenanceResourceDataVo> getEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId,List<String> bandWbCompany);
List<UserDto> getEquipSpecificLocationInfo(Long equipmentSpecificId, String[] fieldName);
......
......@@ -76,6 +76,8 @@ public interface MaintenanceResourceDataMapper extends BaseMapper<MaintenanceRes
*/
List<String> getRelationKey(@Param("list") List<String> keyList);
List<String> getBandWbCompany(String maintenanceCompanyId);
IPage<MaintenanceResourceDataDto> getClassifyPage(Page page, Long maintenanceCompanyId, Long ownerUnitId, Long fireFightSysId, String expirationTimeSort);
IPage<MaintenanceResourceDataDto> getFireFacilityPage(Page page, Long maintenanceCompanyId, Long ownerUnitId, Long fireFightSysId, Long classifyId, List<Long> buildingId, String status);
......
......@@ -74,7 +74,7 @@ public interface IMaintenanceResourceService extends IService<MaintenanceResourc
List<MaintenanceResourceData> combineData(String appKey, String product, String token);
IPage<MaintenanceResourceDataVo> combineDataPage(Page page, Long fireFightSysId, Long fireFacilityId, String fireFacilityName, String classifyId, List<Long> buildingId, String appKey, String product, String token);
IPage<MaintenanceResourceDataVo> combineDataPage(Page page, Long fireFightSysId, Long fireFacilityId, String fireFacilityName, String classifyId, List<Long> buildingId,String maintenanceCompanyId , String appKey, String product, String token);
List<MaintenanceResourceDto> selectCompanyList(String appKey, String product, String token);
......
......@@ -304,14 +304,16 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
}
@Override
public IPage<MaintenanceResourceDataVo> combineDataPage(Page page, Long fireFightSysId, Long fireFacilityId, String fireFacilityName, String classifyId, List<Long> buildingId, String appKey, String product, String token) {
public IPage<MaintenanceResourceDataVo> combineDataPage(Page page, Long fireFightSysId, Long fireFacilityId, String fireFacilityName, String classifyId, List<Long> buildingId,String maintenanceCompanyId, String appKey, String product, String token) {
// 存放组合键,ID+type,数据库查看是否已关联
List<String> keyList = new ArrayList<>();
int current = Integer.parseInt(String.valueOf(page.getCurrent()));
long pageSize = page.getSize();
int size = Integer.parseInt(String.valueOf(pageSize / 2));
page.setSize(size);
ResponseModel<Page<WaterResourceDto>> pageResponseModel = jcsFeign.queryForPage(appKey, product, token, current, size, fireFacilityName, buildingId, fireFightSysId, fireFacilityId, classifyId);
//查询非本维保单位下所有的设备id
List<String> noMyCompanyEquipId = maintenanceResourceDataMapper.getBandWbCompany(maintenanceCompanyId);
ResponseModel<Page<WaterResourceDto>> pageResponseModel = jcsFeign.queryForPage(appKey, product, token, current, size, fireFacilityName, buildingId, fireFightSysId, fireFacilityId, classifyId,noMyCompanyEquipId);
Page<WaterResourceDto> result = pageResponseModel.getResult();
long pages = result.getPages();
long total = result.getTotal();
......@@ -352,9 +354,9 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
}
IPage<MaintenanceResourceDataVo> dataPage = null;
if (fireFightSysId != null && fireFightSysId == -2) {
dataPage = equipmentSpecificMapper.getEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId);
dataPage = equipmentSpecificMapper.getEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId,noMyCompanyEquipId);
} else {
dataPage = equipmentSpecificMapper.getSysEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId);
dataPage = equipmentSpecificMapper.getSysEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId,noMyCompanyEquipId);
}
List<MaintenanceResourceDataVo> dataPageRecords = dataPage.getRecords();
long total1 = dataPage.getTotal();
......@@ -388,15 +390,18 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
} else if (!CollectionUtils.isEmpty(dataPageRecords)) {
dataPage.setRecords(dataPageRecords);
}
// List<MaintenanceResourceDataVo> resultList = dataPage.getRecords();
// List<MaintenanceResourceDataVo> collect = resultList.stream().filter(e -> !bandWbCompany.contains(e.getFireFacilityId().toString())).collect(toList());
return dataPage;
} else {
page.setSize(pageSize);
page.setCurrent(Math.abs(current - (int) Math.ceil(total / 10.0)));
IPage<MaintenanceResourceDataVo> dataPage = null;
if (fireFightSysId != null && fireFightSysId == -2) {
dataPage = equipmentSpecificMapper.getEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId);
dataPage = equipmentSpecificMapper.getEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId,noMyCompanyEquipId);
} else {
dataPage = equipmentSpecificMapper.getSysEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId);
dataPage = equipmentSpecificMapper.getSysEquipClassifyDataPage(page, fireFightSysId, fireFacilityName, classifyId, fireFacilityId, buildingId,noMyCompanyEquipId);
}
List<MaintenanceResourceDataVo> records = dataPage.getRecords();
records.stream().forEach(x -> {
......
......@@ -2,7 +2,12 @@ package com.yeejoin.amos.boot.module.jcs.biz.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
......@@ -16,17 +21,33 @@ public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() {
try {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
String url = uris.replace("http://", "");
final String[] parts = StringUtils.split(url, ":");
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http");
RestClientBuilder builder = RestClient.builder(httpHost);
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
});
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
......@@ -35,8 +56,9 @@ public class ElasticSearchClientConfig {
return requestConfigBuilder.setConnectTimeout(5000 * 1000) // 连接超时(默认为1秒)
.setSocketTimeout(6000 * 1000);// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
return new RestHighLevelClient(builder);
} catch (Exception e) {
......
......@@ -1215,6 +1215,12 @@
#{item}
</foreach>
</if>
<if test="bandWbCompany != null and bandWbCompany.size() > 0">
AND es.id NOT IN
<foreach collection="bandWbCompany" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY
es.id
......@@ -1260,6 +1266,12 @@
#{item}
</foreach>
</if>
<if test="bandWbCompany != null and bandWbCompany.size() > 0">
AND es.id NOT IN
<foreach collection="bandWbCompany" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY
es.id
......
......@@ -59,7 +59,7 @@
create_date
FROM
mt_maintenance_resource_data
GROUP BY classify_id
GROUP BY maintenance_company_id,classify_id
</select>
<select id="selectMaintenanceResourceDataList"
......@@ -235,6 +235,17 @@
</choose>
</where>
</select>
<select id="getBandWbCompany" resultType="java.lang.String">
SELECT
m.fire_facility_id
FROM
mt_maintenance_resource_data m
<where>
<if test="maintenanceCompanyId != null and maintenanceCompanyId != '' ">
m.maintenance_company_id != #{maintenanceCompanyId}
</if>
</where>
</select>
<select id="getClassifyPage" resultType="com.yeejoin.equipmanage.common.dto.MaintenanceResourceDataDto">
SELECT
m.maintenance_company_id,
......
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