Commit fe6a4e27 authored by 韩桐桐's avatar 韩桐桐

fix(jg):jg数据更新至es

parent 89d4591a
......@@ -189,63 +189,78 @@
</select>
<select id="selectData" resultType="java.lang.String">
SELECT DISTINCT
equ_id
SELECT
distinct equ_id
FROM
(
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_name_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_reform_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_transfer_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_unit_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_enable_disable_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_equip_transfer_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_installation_notice_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_maintain_notice_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_maintenance_contract_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_reform_notice_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_scrap_cancel_eq" UNION ALL
SELECT
equ_id
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_transfer_notice_eq" UNION ALL
SELECT
equ_id
equ_id ,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_use_registration_eq" UNION ALL
( SELECT "RECORD" AS equ_id FROM "amos_tzs_biz"."idx_biz_jg_other_info" WHERE "CLAIM_STATUS" IS NULL AND "REC_DATE" >= '2024-02-26 00:00:00' AND "RECORD" LIKE'________-____-____-____-____________' )
( SELECT "RECORD" AS equ_id, rec_date FROM "amos_tzs_biz"."idx_biz_jg_other_info" WHERE ( "CLAIM_STATUS" IS NULL OR "CLAIM_STATUS" = '' ) AND "RECORD" LIKE'________-____-____-____-____________' )
)
WHERE
"REC_DATE" >= '2024-02-26 00:00:00'
</select>
</mapper>
package com.yeejoin.amos.boot.module.ymt.biz.dao;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -10,10 +11,13 @@ import lombok.ToString;
* @author LiuLin
* @date 2023年10月11日 09:31
*/
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class JgAll {
@JSONField(name = "DATA_SOURCE")
private String DATA_SOURCE;
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
......@@ -1980,10 +1981,17 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
public void updateEs() {
List<String> list = categoryOtherInfoMapper.selectData();
List<EsEntity<JgAll>> batchList = new ArrayList<>(list.size());
list.forEach(item -> batchList.add(new EsEntity<>(item, new JgAll("jg"))));
elasticSearchUtil.updateBatch("idx_biz_view_jg_all_bak20240315", batchList);
log.info("idx_biz_view_jg_all_bak20240315 旧数据:"+list);
List<List<String>> allDataList = Lists.partition(list, 100);
for (List<String> tempDataList : allDataList) {
if (CollectionUtils.isNotEmpty(tempDataList)) {
List<EsEntity<JgAll>> batchList = new ArrayList<>(tempDataList.size());
tempDataList.forEach(item -> batchList.add(new EsEntity<>(item, new JgAll("jg"))));
elasticSearchUtil.updateBatch("idx_biz_view_jg_all", batchList);
}
}
log.info("idx_biz_view_jg_all 旧数据:"+list);
log.info("idx_biz_view_jg_all 旧数据size:"+list.size());
}
public void saveBatchEquipment2Es(List<Map<String, Object>> equipList) {
......
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