Commit f463835a authored by tianyiming's avatar tianyiming

信息化字段刷到es

parent 6aa5044e
package com.yeejoin.amos.boot.module.statistics.api.feign;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@FeignClient(name = "TZS-YMT", path = "/ymt", configuration =
{FeignConfiguration.class})
public interface TzsServiceFeignClient {
/**
* 创建监管码及96333
*
* @param map 请求体
* @return
*/
@RequestMapping(value = "/equipment-category/createSupervisorCode", method = RequestMethod.POST)
ResponseModel<Map<String, Object>> createCode(@RequestBody Map<String, Object> map);
/**
* 创建监管码及96333
*
* @param paramMap 请求体
* @return
*/
@RequestMapping(value = "/equipment-category/commonUpdateEsData", method = RequestMethod.POST)
ResponseModel<Map<String, Object>> commonUpdateEsDataByIds(@RequestBody Map<String, Map<String, Object>> paramMap);
/**
* 申请单编号生成
* @param type 参考ApplicationFormTypeEnum中的枚举
* @param batchSize batchSize
* @return List
*/
@RequestMapping(value = "/generate-code/applicationFormCode", method = RequestMethod.POST)
ResponseModel<List<String>> applicationFormCode(@RequestParam("type") String type,
@RequestParam("batchSize") int batchSize);
/**
* 生成设备注册编码
* @param key 16位
* @return 生成设备注册编码(20位)
*/
@RequestMapping(value = "/generate-code/deviceRegistrationCode", method = RequestMethod.POST)
ResponseModel<String> deviceRegistrationCode(@RequestParam("key") String key);
/**
* 使用登记证生成
* @param key 起11陕C
* @return 生成使用登记证编号(13位,起11陕C00001(23))
*/
@RequestMapping(value = "/generate-code/useRegistrationCode", method = RequestMethod.POST)
ResponseModel<String> useRegistrationCode(@RequestParam("key") String key);
}
package com.yeejoin.amos.boot.module.statistics.api.mapper; package com.yeejoin.amos.boot.module.statistics.api.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto; import com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -39,4 +41,7 @@ public interface ZLStatisticsMapper { ...@@ -39,4 +41,7 @@ public interface ZLStatisticsMapper {
Page<Map<String, Object>> getPersonPage(Page page, @Param("paramDto") DPFilterParamDto paramDto, @Param("orgCode") String orgCode, @Param("unitTypeList") List<String> unitTypeList); Page<Map<String, Object>> getPersonPage(Page page, @Param("paramDto") DPFilterParamDto paramDto, @Param("orgCode") String orgCode, @Param("unitTypeList") List<String> unitTypeList);
Integer count();
IPage<IdxBizJgOtherInfo> getEquipInfoPage(IPage<IdxBizJgOtherInfo> idxBizJgOtherInfoPage);
} }
...@@ -145,6 +145,12 @@ ...@@ -145,6 +145,12 @@
AND tui.unit_name LIKE concat ( '%', #{paramDto.unitName}, '%' ) AND tui.unit_name LIKE concat ( '%', #{paramDto.unitName}, '%' )
</if> </if>
</select> </select>
<select id="count" resultType="java.lang.Integer">
select count(1) from idx_biz_jg_other_info where INFORMATION_SITUATION NOTNULL
</select>
<select id="getEquipInfoPage" resultType="com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo">
select * from idx_biz_jg_other_info where INFORMATION_SITUATION NOTNULL
</select>
</mapper> </mapper>
...@@ -124,6 +124,14 @@ public class ZLDPStatisticsController { ...@@ -124,6 +124,14 @@ public class ZLDPStatisticsController {
return ResponseHelper.buildResponse(statisticsService.viewEquipPage(paramDto)); return ResponseHelper.buildResponse(statisticsService.viewEquipPage(paramDto));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/updateEquipInfo")
@ApiOperation(httpMethod = "POST", value = "更新es设备信息化字段", notes = "更新es设备信息化字段")
public ResponseModel<Object> updateEquipInfo() {
return ResponseHelper.buildResponse(statisticsService.updateEquipInfo());
}
/** /**
* 根据设备种类code获取设备类别下拉 * 根据设备种类code获取设备类别下拉
* *
......
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.statistcs.biz.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.dto.CountDto; import com.yeejoin.amos.boot.biz.common.dto.CountDto;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary; import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
...@@ -13,11 +14,13 @@ import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics; ...@@ -13,11 +14,13 @@ import com.yeejoin.amos.boot.module.common.api.entity.AlertStatistics;
import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.UnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum; import com.yeejoin.amos.boot.module.common.api.enums.UserPostEnum;
import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.statistcs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.statistics.api.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.AlertStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper; import com.yeejoin.amos.boot.module.statistics.api.mapper.ZLStatisticsMapper;
import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo; import com.yeejoin.amos.boot.module.statistics.api.vo.EquCategoryVo;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory; import com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum; import com.yeejoin.amos.boot.module.ymt.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper;
...@@ -39,6 +42,7 @@ import org.elasticsearch.search.aggregations.Aggregations; ...@@ -39,6 +42,7 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -58,6 +62,7 @@ import java.util.stream.Collectors; ...@@ -58,6 +62,7 @@ import java.util.stream.Collectors;
@Service @Service
public class ZLDPStatisticsServiceImpl { public class ZLDPStatisticsServiceImpl {
private static final String EQU_STATE = "EQU_STATE"; private static final String EQU_STATE = "EQU_STATE";
private final ZLStatisticsMapper screenMapper; private final ZLStatisticsMapper screenMapper;
...@@ -78,6 +83,9 @@ public class ZLDPStatisticsServiceImpl { ...@@ -78,6 +83,9 @@ public class ZLDPStatisticsServiceImpl {
@Value("classpath:/json/equipCategory.json") @Value("classpath:/json/equipCategory.json")
private Resource equipCategory; private Resource equipCategory;
@Autowired
private TzsServiceFeignClient tzsServiceFeignClient;
public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, EquipmentCategoryMapper equipmentCategoryMapper) { public ZLDPStatisticsServiceImpl(ZLStatisticsMapper screenMapper, DataDictionaryServiceImpl iDataDictionaryService, AlertStatisticsMapper alertStatisticsMapper, RestHighLevelClient restHighLevelClient, StCommonServiceImpl stCommonService, EquipmentCategoryMapper equipmentCategoryMapper) {
this.screenMapper = screenMapper; this.screenMapper = screenMapper;
this.iDataDictionaryService = iDataDictionaryService; this.iDataDictionaryService = iDataDictionaryService;
...@@ -876,6 +884,13 @@ public class ZLDPStatisticsServiceImpl { ...@@ -876,6 +884,13 @@ public class ZLDPStatisticsServiceImpl {
boolMust.must(meBuilder); boolMust.must(meBuilder);
} }
if (!ObjectUtils.isEmpty(map.getString("INFORMATION_SITUATION"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("INFORMATION_SITUATION"));
meBuilder.must(QueryBuilders.matchPhraseQuery("INFORMATION_SITUATION", "*" + test + "*"));
boolMust.must(meBuilder);
}
if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("EQU_CODE"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("EQU_CODE")); String test = QueryParser.escape(map.getString("EQU_CODE"));
...@@ -1078,4 +1093,34 @@ public class ZLDPStatisticsServiceImpl { ...@@ -1078,4 +1093,34 @@ public class ZLDPStatisticsServiceImpl {
public List<Map<String, String>> getPersonType(String companyType) { public List<Map<String, String>> getPersonType(String companyType) {
return UserPostEnum.getEnumListByType(companyType); return UserPostEnum.getEnumListByType(companyType);
} }
public Object updateEquipInfo() {
IPage<IdxBizJgOtherInfo> idxBizJgOtherInfoPage = new Page<>();
Integer count = screenMapper.count();
Integer times = 0;
if (ValidationUtil.isEmpty(count) && count != 0) {
times = count / 500;
int last = count % 500;
if (last > 0) {
times++;
}
} else if (count == 0) {
return "不存在需要更新信息化字段的数据";
}
for(int i = 0; i <= times ; i ++ ) {
idxBizJgOtherInfoPage.setCurrent(i);
idxBizJgOtherInfoPage.setSize(500);
idxBizJgOtherInfoPage = screenMapper.getEquipInfoPage(idxBizJgOtherInfoPage);
Map<String,Map<String,Object>> updataMap = new HashMap<>();
if (idxBizJgOtherInfoPage.getTotal() > 0) {
idxBizJgOtherInfoPage.getRecords().forEach(e->{
Map<String,Object> map = new HashMap<>();
map.put("INFORMATION_SITUATION", e.getInformationSituation());
updataMap.put(e.getRecord(), map);
});
}
tzsServiceFeignClient.commonUpdateEsDataByIds(updataMap);
}
return "信息化字段更新完成";
}
} }
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