Commit 0ef4d2aa authored by lisong's avatar lisong

一码通数据操作关联ES

parent 49f117e0
package com.yeejoin.amos.boot.module.tzs.api.mapper; package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.EquInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.CategoryOtherInfo; import com.yeejoin.amos.boot.module.tzs.api.entity.CategoryOtherInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Map;
/** /**
* 装备分类 Mapper 接口 * 装备分类 Mapper 接口
* *
...@@ -24,4 +27,6 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> { ...@@ -24,4 +27,6 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
int updateCode(String supervisorCode, String equState); int updateCode(String supervisorCode, String equState);
int updateOtherInfo(String supervisorCode, String editStatus); int updateOtherInfo(String supervisorCode, String editStatus);
Map<String, Object> selectDataById(String id);
} }
...@@ -34,4 +34,6 @@ public interface IEquipmentCategoryService { ...@@ -34,4 +34,6 @@ public interface IEquipmentCategoryService {
List<String> updateOtherInfo(Map<String, Object> map); List<String> updateOtherInfo(Map<String, Object> map);
Map<String,Map<String,Object>> getFormRecordById(Map<String, Object> map); Map<String,Map<String,Object>> getFormRecordById(Map<String, Object> map);
void checkEsData(String id);
} }
...@@ -51,6 +51,27 @@ ...@@ -51,6 +51,27 @@
LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD LEFT JOIN idx_biz_jg_use_info ibjui ON ibjoi.RECORD = ibjui.RECORD
WHERE ibjoi."RECORD" = #{record} WHERE ibjoi."RECORD" = #{record}
</select> </select>
<select id="selectDataById" resultType="java.util.Map">
SELECT SEQUENCE_NBR,
ORG_BRANCH_NAME,
ORG_BRANCH_CODE,
USE_UNIT_NAME,
USE_UNIT_CREDIT_CODE,
EQU_LIST_CODE,
EQU_LIST,
EQU_CATEGORY,
USE_ORG_CODE,
CODE96333,
EQU_CODE,
SUPERVISORY_CODE,
USE_PLACE ,
ADDRESS,
EQU_STATE,
STATUS
from idx_biz_view_jg_all
WHERE SEQUENCE_NBR = #{id}
</select>
<update id="updateCode"> <update id="updateCode">
UPDATE biz_jg_supervisory_code bjsc UPDATE biz_jg_supervisory_code bjsc
......
...@@ -28,5 +28,7 @@ public class AmosMqttListener extends EmqxListener { ...@@ -28,5 +28,7 @@ public class AmosMqttListener extends EmqxListener {
JSONObject jsonObject = JSONObject.parseObject(msg); JSONObject jsonObject = JSONObject.parseObject(msg);
String id = jsonObject.get("id").toString(); String id = jsonObject.get("id").toString();
equipmentCategoryService.createSupervisorCode(null, id); equipmentCategoryService.createSupervisorCode(null, id);
// 更新ES
equipmentCategoryService.checkEsData(id);
} }
} }
...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquInfoDto; import com.yeejoin.amos.boot.module.tzs.api.dto.EquInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.*; import com.yeejoin.amos.boot.module.tzs.api.entity.*;
...@@ -18,17 +19,22 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper; ...@@ -18,17 +19,22 @@ import com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper;
import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.tzs.api.mapper.SupervisoryCodeInfoMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.SupervisoryCodeInfoMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService; import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderFillingRecordRepository;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService; import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.PrivilegeFeginService; import com.yeejoin.amos.boot.module.tzs.flc.api.feign.PrivilegeFeginService;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import io.netty.util.internal.ObjectUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -51,6 +57,9 @@ import java.util.stream.Collectors; ...@@ -51,6 +57,9 @@ import java.util.stream.Collectors;
public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryDto, EquipmentCategory, EquipmentCategoryMapper> implements IEquipmentCategoryService { public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryDto, EquipmentCategory, EquipmentCategoryMapper> implements IEquipmentCategoryService {
@Autowired @Autowired
ESEquipmentCategory esEquipmentCategory;
@Autowired
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Value("classpath:/json/equipCategory.json") @Value("classpath:/json/equipCategory.json")
...@@ -721,4 +730,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -721,4 +730,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<EquipmentCategory> equipmentCategories = baseMapper.selectList(wrapper2); List<EquipmentCategory> equipmentCategories = baseMapper.selectList(wrapper2);
return equipmentCategories; return equipmentCategories;
} }
@Override
public void checkEsData(String id) {
Map<String, Object> map = categoryOtherInfoMapper.selectDataById(id);
ESEquipmentCategoryDto dto = JSON.parseObject(JSONObject.toJSONString(map), ESEquipmentCategoryDto.class);
Optional<ESEquipmentCategoryDto> data = esEquipmentCategory.findById(id);
if (!ObjectUtils.isEmpty(data)) {
esEquipmentCategory.deleteById(id);
}
if (!ObjectUtils.isEmpty(dto)){
esEquipmentCategory.save(dto);
}
}
} }
\ No newline at end of file
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