Commit 03b7857a authored by 韩桐桐's avatar 韩桐桐

fix(ymt):删除冗余方法

parent fe6a4e27
...@@ -58,5 +58,4 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> { ...@@ -58,5 +58,4 @@ public interface CategoryOtherInfoMapper extends BaseMapper<CategoryOtherInfo> {
*/ */
List<KV> selectSupervisorCodeMaxValue(); List<KV> selectSupervisorCodeMaxValue();
List<String> selectData();
} }
...@@ -188,79 +188,4 @@ ...@@ -188,79 +188,4 @@
LIMIT 1 LIMIT 1
</select> </select>
<select id="selectData" resultType="java.lang.String">
SELECT
distinct equ_id
FROM
(
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_name_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_reform_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_transfer_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_change_registration_unit_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_enable_disable_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_equip_transfer_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_installation_notice_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_maintain_notice_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_maintenance_contract_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_reform_notice_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_scrap_cancel_eq" UNION ALL
SELECT
equ_id,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_transfer_notice_eq" UNION ALL
SELECT
equ_id ,
rec_date
FROM
"amos_tzs_biz"."tzs_jg_use_registration_eq" UNION ALL
( 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> </mapper>
...@@ -422,14 +422,6 @@ public class EquipmentCategoryController extends BaseController { ...@@ -422,14 +422,6 @@ public class EquipmentCategoryController extends BaseController {
return ResponseHelper.buildResponse("success"); return ResponseHelper.buildResponse("success");
} }
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "updateEquipmentCategoryToEs")
@ApiOperation(httpMethod = "GET", value = "jg数据更新至es", notes = "jg数据更新至es")
public ResponseModel<String> updateEquipmentCategoryToEs() {
equipmentCategoryServiceImpl.updateEs();
return ResponseHelper.buildResponse("success");
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON; ...@@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSON;
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.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
...@@ -26,9 +25,6 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IGenerateCodeService; ...@@ -26,9 +25,6 @@ import com.yeejoin.amos.boot.module.ymt.api.service.IGenerateCodeService;
import com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo; import com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo;
import com.yeejoin.amos.boot.module.ymt.biz.dao.ESElavtorRepository; import com.yeejoin.amos.boot.module.ymt.biz.dao.ESElavtorRepository;
import com.yeejoin.amos.boot.module.ymt.biz.dao.ESEquipmentCategory; import com.yeejoin.amos.boot.module.ymt.biz.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.ymt.biz.dao.EsEntity;
import com.yeejoin.amos.boot.module.ymt.biz.dao.JgAll;
import com.yeejoin.amos.boot.module.ymt.biz.utils.ElasticSearchUtil;
import com.yeejoin.amos.boot.module.ymt.biz.utils.JsonUtils; import com.yeejoin.amos.boot.module.ymt.biz.utils.JsonUtils;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.IdxFeignService; import com.yeejoin.amos.boot.module.ymt.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService; import com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService;
...@@ -94,242 +90,221 @@ import static com.alibaba.fastjson.JSON.toJSONString; ...@@ -94,242 +90,221 @@ import static com.alibaba.fastjson.JSON.toJSONString;
@Slf4j @Slf4j
public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryDto, EquipmentCategory, EquipmentCategoryMapper> implements IEquipmentCategoryService { public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryDto, EquipmentCategory, EquipmentCategoryMapper> implements IEquipmentCategoryService {
// 一码通码自动生成
final static String CREATE = "1";
// 一码通码手动输入
final static String NOT_CREATE = "0";
@Autowired @Autowired
ESEquipmentCategory esEquipmentCategory; private static final String TABLENAME = "tableName";
// 管辖机构redis缓存key
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
// 行政区划redis缓存key
private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY";
private static final String REGION = "REGION";
private static final String STREET = "STREET";
// 行政区划level
private static final String PROVINCE_LEVEL = "1";
private static final String CITY_LEVEL = "2";
private static final String REGION_LEVEL = "3";
private static final String STREET_LEVEL = "4";
// 西安行政区划code
private static final String XIAN = "610100";
// 咸阳行政区划code
private static final String XIAN_YANG = "610400";
// 判断行政区划查询市还是区
private static final String END_CODE = "0000";
// 判断行政区划查询街道
private static final String STREET_END_CODE = "00";
// 一码通使用信息表单id
private static final String use_info_form_id = "1627903393253056514";
// 一码通监督管理表单id
private static final String supervision_form_id = "1627903532906602497";
// 一码通设计制造表单页id
private static final String design_from_id = "1627897116087050241";
// 一码通检验检测表单页id
private static final String inspection_form_id = "1636282043618848769";
// 一码通施工信息表单页id
private static final String construction_form_id = "1636347672031948801";
// 一码通维保信息表单页id
private static final String maintenance_form_id = "1636347684057018369";
// 一码通注册登记表单页-电梯id
private static final String dt_register_from_id = "1637431088563384322";
// 一码通注册登记表单页-起重机械id
private static final String qzjx_register_from_id = "1635115308320583681";
// 一码通注册登记表单页-锅炉id
private static final String gl_register_from_id = "1631125178945662977";
// 一码通注册登记表单页-游乐设施id
private static final String ylss_register_from_id = "1631125167914643457";
// 一码通注册登记表单页-客运索道id
private static final String kysd_register_from_id = "1631125158229995521";
// 一码通注册登记表单页-压力管道id
private static final String ylgd_register_from_id = "1631125206695178241";
// 一码通注册登记表单页-压力容器id
private static final String ylrq_register_from_id = "1631125198260432897";
// 一码通注册登记表单页-厂车id
private static final String cc_register_from_id = "1631125079347720193";
// 主要零部件
private static final String main_parts = "mainParts";
// 主要零部件
private static final String protection_devices = "ProtectionDevices";
// 一码通复制功能url参数key
private static final String COPY_KEY = "stashType";
// 一码通判断是否复制
private static final String IS_COPY = "isCopy";
// 一码通生成码分布式锁key
private final static String LOCK_KEY = "RESOURCE_KEY";
// 一码通checkCode分布式锁key
private final static String CHECK_CODE_LOCK_KEY = "CHECK_CODE_KEY";
// 一码通checkCode中96333码redis key
private final static String CHECK_CODE_CODE96333 = "CODE96333_";
// 一码通checkCode中设备代码redis key
private final static String CHECK_CODE_EQU_CODE = "EQU_CODE_";
// 一码通checkCode中使用登记证编号redis key
private final static String CHECK_CODE_USE_ORG_CODE = "USE_ORG_CODE_";
// 管辖机构
private static final String REGULATOR_UNIT = "监管机构";
/**
* levlel=company,是企业,如果不是都是监管单位,
* * 在接口中查询当前登录人所属单位是监管单位还是企业。
* * 如果为监管单位添加监管机构查询参数(ORG_BRANCH_CODE);
* * 如果为企业添加使用单位查询参数(USE_UNIT_CREDIT_CODE)
*/
private static final String LEVEL = "company";
private static final String EQUSTATE = "EQU_STATE";
private static final String USEPLACE = "USE_PLACE";
@Autowired @Autowired
private SuperviseInfoMapper superviseInfoMapper; ESEquipmentCategory esEquipmentCategory;
@Autowired @Autowired
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
@Autowired
private JdbcTemplate bizJdbcTemplate;
@Autowired @Autowired
CategoryOtherInfoMapper categoryOtherInfoMapper; CategoryOtherInfoMapper categoryOtherInfoMapper;
@Autowired @Autowired
SupervisoryCodeInfoMapper supervisoryCodeInfoMapper; SupervisoryCodeInfoMapper supervisoryCodeInfoMapper;
@Autowired @Autowired
SuperviseInfoService superviseInfoService; SuperviseInfoService superviseInfoService;
@Autowired @Autowired
EquipmentCategoryDataMapper equipmentCategoryDataMapper; EquipmentCategoryDataMapper equipmentCategoryDataMapper;
@Autowired @Autowired
EquipmentCategoryDataServiceImpl equipmentCategoryDataService; EquipmentCategoryDataServiceImpl equipmentCategoryDataService;
@Autowired @Autowired
IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService; IdxBizJgUseInfoServiceImpl idxBizJgUseInfoService;
@Autowired @Autowired
IdxBizJgSupervisionInfoServiceImpl idxBizJgSupervisionInfoService; IdxBizJgSupervisionInfoServiceImpl idxBizJgSupervisionInfoService;
@Autowired @Autowired
IdxBizJgOtherInfoServiceImpl idxBizJgOtherInfoService; IdxBizJgOtherInfoServiceImpl idxBizJgOtherInfoService;
@Autowired @Autowired
IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper; IdxBizJgOtherInfoMapper idxBizJgOtherInfoMapper;
@Autowired @Autowired
IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService; IdxBizJgDesignInfoServiceImpl idxBizJgDesignInfoService;
@Autowired @Autowired
IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService; IdxBizJgFactoryInfoServiceImpl idxBizJgFactoryInfoService;
@Autowired @Autowired
IdxBizJgFactoryInfoMapper idxBizJgFactoryInfoMapper; IdxBizJgFactoryInfoMapper idxBizJgFactoryInfoMapper;
@Autowired @Autowired
IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService; IdxBizJgInspectionDetectionInfoServiceImpl idxBizJgInspectionDetectionInfoService;
@Autowired @Autowired
IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService; IdxBizJgConstructionInfoServiceImpl idxBizJgConstructionInfoService;
@Autowired @Autowired
IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService; IdxBizJgMaintenanceRecordInfoServiceImpl idxBizJgMaintenanceRecordInfoService;
@Autowired @Autowired
IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService; IdxBizJgRegisterInfoServiceImpl idxBizJgRegisterInfoService;
@Autowired @Autowired
IdxBizJgTechParamsElevatorServiceImpl idxBizJgTechParamsElevatorService; IdxBizJgTechParamsElevatorServiceImpl idxBizJgTechParamsElevatorService;
@Autowired @Autowired
IdxBizJgTechParamsElevatorMapper idxBizJgTechParamsElevatorMapper; IdxBizJgTechParamsElevatorMapper idxBizJgTechParamsElevatorMapper;
@Autowired @Autowired
IdxBizJgTechParamsVehicleServiceImpl idxBizJgTechParamsVehicleService; IdxBizJgTechParamsVehicleServiceImpl idxBizJgTechParamsVehicleService;
@Autowired @Autowired
IdxBizJgTechParamsVehicleMapper idxBizJgTechParamsVehicleMapper; IdxBizJgTechParamsVehicleMapper idxBizJgTechParamsVehicleMapper;
@Autowired @Autowired
IdxBizJgTechParamsRopewayServiceImpl idxBizJgTechParamsRopewayService; IdxBizJgTechParamsRopewayServiceImpl idxBizJgTechParamsRopewayService;
@Autowired @Autowired
IdxBizJgTechParamsRopewayMapper idxBizJgTechParamsRopewayMapper; IdxBizJgTechParamsRopewayMapper idxBizJgTechParamsRopewayMapper;
@Autowired @Autowired
IdxBizJgTechParamsRidesServiceImpl idxBizJgTechParamsRidesService; IdxBizJgTechParamsRidesServiceImpl idxBizJgTechParamsRidesService;
@Autowired @Autowired
IdxBizJgTechParamsRidesMapper idxBizJgTechParamsRidesMapper; IdxBizJgTechParamsRidesMapper idxBizJgTechParamsRidesMapper;
@Autowired @Autowired
IdxBizJgTechParamsBoilerServiceImpl idxBizJgTechParamsBoilerService; IdxBizJgTechParamsBoilerServiceImpl idxBizJgTechParamsBoilerService;
@Autowired @Autowired
IdxBizJgTechParamsBoilerMapper idxBizJgTechParamsBoilerMapper; IdxBizJgTechParamsBoilerMapper idxBizJgTechParamsBoilerMapper;
@Autowired @Autowired
IdxBizJgTechParamsVesselServiceImpl idxBizJgTechParamsVesselService; IdxBizJgTechParamsVesselServiceImpl idxBizJgTechParamsVesselService;
@Autowired @Autowired
IdxBizJgTechParamsVesselMapper idxBizJgTechParamsVesselMapper; IdxBizJgTechParamsVesselMapper idxBizJgTechParamsVesselMapper;
@Autowired @Autowired
IdxBizJgTechParamsPipelineServiceImpl idxBizJgTechParamsPipelineService; IdxBizJgTechParamsPipelineServiceImpl idxBizJgTechParamsPipelineService;
@Autowired @Autowired
IdxBizJgTechParamsPipelineMapper idxBizJgTechParamsPipelineMapper; IdxBizJgTechParamsPipelineMapper idxBizJgTechParamsPipelineMapper;
@Autowired @Autowired
IdxBizJgTechParamsLiftingServiceImpl idxBizJgTechParamsLiftingService; IdxBizJgTechParamsLiftingServiceImpl idxBizJgTechParamsLiftingService;
@Autowired @Autowired
IdxBizJgTechParamsLiftingMapper idxBizJgTechParamsLiftingMapper; IdxBizJgTechParamsLiftingMapper idxBizJgTechParamsLiftingMapper;
@Autowired @Autowired
IdxBizJgMainPartsServiceImpl idxBizJgMainPartsService; IdxBizJgMainPartsServiceImpl idxBizJgMainPartsService;
@Autowired @Autowired
IdxBizJgMainPartsMapper idxBizJgMainPartsMapper; IdxBizJgMainPartsMapper idxBizJgMainPartsMapper;
@Autowired @Autowired
IdxBizJgProtectionDevicesServiceImpl idxBizJgProtectionDevicesService; IdxBizJgProtectionDevicesServiceImpl idxBizJgProtectionDevicesService;
@Autowired @Autowired
IdxBizJgProtectionDevicesMapper idxBizJgProtectionDevicesMapper; IdxBizJgProtectionDevicesMapper idxBizJgProtectionDevicesMapper;
@Autowired @Autowired
PrivilegeFeginService privilegeFeginService; PrivilegeFeginService privilegeFeginService;
@Autowired @Autowired
IdxFeignService idxFeignService; IdxFeignService idxFeignService;
@Autowired @Autowired
IGenerateCodeService generateCodeService; IGenerateCodeService generateCodeService;
@Autowired @Autowired
private ElasticSearchUtil elasticSearchUtil; RestHighLevelClient restHighLevelClient;
@Autowired @Autowired
private static final String TABLENAME = "tableName"; RedissonClient redissonClient;
@Autowired
private SuperviseInfoMapper superviseInfoMapper;
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
@Autowired
private JdbcTemplate bizJdbcTemplate;
@Autowired @Autowired
private ESElavtorRepository esElavtorRepository; private ESElavtorRepository esElavtorRepository;
@Value("${regulator.unit.code}") @Value("${regulator.unit.code}")
private String code; private String code;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
//管辖机构redis缓存key // 一码通checkCode中redis key过期时间
private static final String REGULATOR_UNIT_TREE = "REGULATOR_UNIT_TREE";
//行政区划redis缓存key
private static final String PROVINCE = "PROVINCE";
private static final String CITY = "CITY";
private static final String REGION = "REGION";
private static final String STREET = "STREET";
//行政区划level
private static final String PROVINCE_LEVEL = "1";
private static final String CITY_LEVEL = "2";
private static final String REGION_LEVEL = "3";
private static final String STREET_LEVEL = "4";
//西安行政区划code
private static final String XIAN = "610100";
//咸阳行政区划code
private static final String XIAN_YANG = "610400";
//判断行政区划查询市还是区
private static final String END_CODE = "0000";
//判断行政区划查询街道
private static final String STREET_END_CODE = "00";
// 一码通使用信息表单id
private static final String use_info_form_id = "1627903393253056514";
// 一码通监督管理表单id
private static final String supervision_form_id = "1627903532906602497";
// 一码通设计制造表单页id
private static final String design_from_id = "1627897116087050241";
// 一码通检验检测表单页id
private static final String inspection_form_id = "1636282043618848769";
// 一码通施工信息表单页id
private static final String construction_form_id = "1636347672031948801";
// 一码通维保信息表单页id
private static final String maintenance_form_id = "1636347684057018369";
// 一码通注册登记表单页-电梯id
private static final String dt_register_from_id = "1637431088563384322";
// 一码通注册登记表单页-起重机械id
private static final String qzjx_register_from_id = "1635115308320583681";
// 一码通注册登记表单页-锅炉id
private static final String gl_register_from_id = "1631125178945662977";
// 一码通注册登记表单页-游乐设施id
private static final String ylss_register_from_id = "1631125167914643457";
// 一码通注册登记表单页-客运索道id
private static final String kysd_register_from_id = "1631125158229995521";
// 一码通注册登记表单页-压力管道id
private static final String ylgd_register_from_id = "1631125206695178241";
// 一码通注册登记表单页-压力容器id
private static final String ylrq_register_from_id = "1631125198260432897";
// 一码通注册登记表单页-厂车id
private static final String cc_register_from_id = "1631125079347720193";
// 主要零部件
private static final String main_parts = "mainParts";
// 主要零部件
private static final String protection_devices = "ProtectionDevices";
//一码通码自动生成
final static String CREATE = "1";
//一码通码手动输入
final static String NOT_CREATE = "0";
//一码通复制功能url参数key
private static final String COPY_KEY = "stashType";
//一码通判断是否复制
private static final String IS_COPY = "isCopy";
@Autowired
RestHighLevelClient restHighLevelClient;
@Autowired
RedissonClient redissonClient;
//一码通生成码分布式锁key
private final static String LOCK_KEY = "RESOURCE_KEY";
//一码通checkCode分布式锁key
private final static String CHECK_CODE_LOCK_KEY = "CHECK_CODE_KEY";
//一码通checkCode中96333码redis key
private final static String CHECK_CODE_CODE96333 = "CODE96333_";
//一码通checkCode中设备代码redis key
private final static String CHECK_CODE_EQU_CODE = "EQU_CODE_";
//一码通checkCode中使用登记证编号redis key
private final static String CHECK_CODE_USE_ORG_CODE = "USE_ORG_CODE_";
//管辖机构
private static final String REGULATOR_UNIT = "监管机构";
//一码通checkCode中redis key过期时间
private long time = 300l; private long time = 300l;
private ExecutorService threadPool = Executors.newCachedThreadPool(); private ExecutorService threadPool = Executors.newCachedThreadPool();
/** /**
* 获取两个List的不同元素
*
* @param list1
* @param list2
* @return
*/
private static List<Integer> getDiffrent(List<Integer> list1, List<Integer> list2) {
List<Integer> diff = new ArrayList<Integer>();
Map<Integer, Integer> map = new HashMap<Integer, Integer>(list1.size());
for (Integer integer : list1) {
map.put(integer, 1);
}
for (Integer integer : list2) {
if (map.get(integer) != null) {
map.put(integer, 2);
continue;
}
}
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
if (entry.getValue() == 1) {
diff.add(entry.getKey());
}
}
// 对集合进行排序
Collections.sort(diff);
return diff;
}
/**
* 分页查询 * 分页查询
*/ */
public Page<EquipmentCategoryDto> queryForEquipmentCategoryPage(Page<EquipmentCategoryDto> page) { public Page<EquipmentCategoryDto> queryForEquipmentCategoryPage(Page<EquipmentCategoryDto> page) {
...@@ -454,16 +429,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -454,16 +429,16 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override @Override
public Map<String, String> createSupervisorCode(Map<String, Object> map) { public Map<String, String> createSupervisorCode(Map<String, Object> map) {
String city, county, equipCategory, isNotXiXian; String city, county, equipCategory, isNotXiXian;
//获取对应行政区划 // 获取对应行政区划
city = String.valueOf(map.get("cityCode")); city = String.valueOf(map.get("cityCode"));
county = String.valueOf(map.get("countyCode")); county = String.valueOf(map.get("countyCode"));
//获取对应设备分类 // 获取对应设备分类
equipCategory = String.valueOf(map.get("equCategory")); equipCategory = String.valueOf(map.get("equCategory"));
if ("null".equals(equipCategory) || "null".equals(city) || "null".equals(county)) { if ("null".equals(equipCategory) || "null".equals(city) || "null".equals(county)) {
throw new BadRequest("请求参数不全,请查看参数中是否携带 cityCode、countyCode、equCategory 三个参数及对应值"); throw new BadRequest("请求参数不全,请查看参数中是否携带 cityCode、countyCode、equCategory 三个参数及对应值");
} }
isNotXiXian = "null".equals(String.valueOf(map.get("isXiXian"))) ? "0" : "1"; isNotXiXian = "null".equals(String.valueOf(map.get("isXiXian"))) ? "0" : "1";
//生成码 // 生成码
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy(); EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
Map<String, String> codeMap = creatCode(isNotXiXian, city, county, equipCategory, "null", "null"); Map<String, String> codeMap = creatCode(isNotXiXian, city, county, equipCategory, "null", "null");
if (ObjectUtils.isEmpty(codeMap)) { if (ObjectUtils.isEmpty(codeMap)) {
...@@ -475,7 +450,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -475,7 +450,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override @Override
public List<LinkedHashMap> getTree() { public List<LinkedHashMap> getTree() {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE); List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
//判断redis是否存在管辖机构树 // 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree(); return !ObjectUtils.isEmpty(result) ? result : creatTree();
} }
...@@ -483,14 +458,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -483,14 +458,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
public List<LinkedHashMap> creatTree() { public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct()); FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult(); List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteTreeData(result,REGULATOR_UNIT); List<LinkedHashMap> treeData = deleteTreeData(result, REGULATOR_UNIT);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList()); List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree); List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE, resultTree); redisUtils.set(REGULATOR_UNIT_TREE, resultTree);
return resultTree; return resultTree;
} }
private List<LinkedHashMap> deleteTreeData(List<LinkedHashMap> result,String companyType) { private List<LinkedHashMap> deleteTreeData(List<LinkedHashMap> result, String companyType) {
Iterator it = result.iterator(); Iterator it = result.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next(); LinkedHashMap e = (LinkedHashMap) it.next();
...@@ -499,7 +474,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -499,7 +474,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
it.remove(); it.remove();
} }
if (!ObjectUtils.isEmpty(e.get("children"))) { if (!ObjectUtils.isEmpty(e.get("children"))) {
deleteTreeData((List<LinkedHashMap>) e.get("children"),companyType); deleteTreeData((List<LinkedHashMap>) e.get("children"), companyType);
} }
} }
return result; return result;
...@@ -515,7 +490,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -515,7 +490,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Iterator it = result.iterator(); Iterator it = result.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next(); LinkedHashMap e = (LinkedHashMap) it.next();
//将管辖机构树中children为[]的修改为null // 将管辖机构树中children为[]的修改为null
if (e.get("children") != null) { if (e.get("children") != null) {
if (((List<LinkedHashMap>) e.get("children")).size() == 0) { if (((List<LinkedHashMap>) e.get("children")).size() == 0) {
e.put("children", null); e.put("children", null);
...@@ -538,7 +513,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -538,7 +513,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Iterator it = result.iterator(); Iterator it = result.iterator();
while (it.hasNext()) { while (it.hasNext()) {
LinkedHashMap e = (LinkedHashMap) it.next(); LinkedHashMap e = (LinkedHashMap) it.next();
//删除使用单位 // 删除使用单位
if ("company".equals(e.get("level"))) { if ("company".equals(e.get("level"))) {
it.remove(); it.remove();
} }
...@@ -556,7 +531,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -556,7 +531,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return result; return result;
} }
@Override @Override
public List<LinkedHashMap> getRegion(String level, String parentId) { public List<LinkedHashMap> getRegion(String level, String parentId) {
List<LinkedHashMap> list = new ArrayList<>(); List<LinkedHashMap> list = new ArrayList<>();
...@@ -565,7 +539,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -565,7 +539,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return ObjectUtils.isEmpty(list) ? getProvinceList(level) : list; return ObjectUtils.isEmpty(list) ? getProvinceList(level) : list;
} else if (!ObjectUtils.isEmpty(parentId)) { } else if (!ObjectUtils.isEmpty(parentId)) {
String regionCode = parentId.split("_")[0]; String regionCode = parentId.split("_")[0];
//regionCode不是以00结尾查询街道,以0000结果查询市、否则查询区 // regionCode不是以00结尾查询街道,以0000结果查询市、否则查询区
if (!regionCode.endsWith(STREET_END_CODE)) { if (!regionCode.endsWith(STREET_END_CODE)) {
list = ObjectUtils.isEmpty(redisUtils.get(STREET)) ? getProvinceList(STREET_LEVEL) : (List<LinkedHashMap>) redisUtils.get(STREET); list = ObjectUtils.isEmpty(redisUtils.get(STREET)) ? getProvinceList(STREET_LEVEL) : (List<LinkedHashMap>) redisUtils.get(STREET);
} else if (regionCode.endsWith(END_CODE)) { } else if (regionCode.endsWith(END_CODE)) {
...@@ -690,7 +664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -690,7 +664,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* 具体生成监管码和电梯96333识别码逻辑 * 具体生成监管码和电梯96333识别码逻辑
*/ */
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public synchronized Map<String, String> creatCode(String isNotXiXian, String city, String county, String equipCategory, String code96333, String supervisionCode) { public synchronized Map<String, String> creatCode(String isNotXiXian, String city, String county, String equipCategory, String code96333, String supervisionCode) {
RLock lock = redissonClient.getLock(LOCK_KEY); RLock lock = redissonClient.getLock(LOCK_KEY);
Map<String, String> resultMap = null; Map<String, String> resultMap = null;
try { try {
...@@ -701,9 +675,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -701,9 +675,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
StringBuilder elevatorCode = new StringBuilder(); StringBuilder elevatorCode = new StringBuilder();
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo(); CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
String prefix; String prefix;
//判断是否需要生成96333电梯码 // 判断是否需要生成96333电梯码
if (equipCategory.startsWith("3") && (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian)) || !XIAN.equals(city))) { if (equipCategory.startsWith("3") && (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian)) || !XIAN.equals(city))) {
//判断数据是否携带96333电梯码,携带则使用,不携带则生成 // 判断数据是否携带96333电梯码,携带则使用,不携带则生成
if ("null".equals(code96333)) { if ("null".equals(code96333)) {
if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) { if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) {
prefix = EquipmentCategoryEnum.XXCSM.getValue(); prefix = EquipmentCategoryEnum.XXCSM.getValue();
...@@ -711,9 +685,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -711,9 +685,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county); Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString(); prefix = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
} }
//查询未使用的电梯码 // 查询未使用的电梯码
categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode()); categoryOtherInfo = categoryOtherInfoMapper.selectElevatorCode(prefix, EquipmentCategoryEnum.WSY.getCode());
//如果存在未使用的电梯码则启用未使用的否则创建 // 如果存在未使用的电梯码则启用未使用的否则创建
String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? generateCodeService.createElevatorCode("96333_" + prefix) : categoryOtherInfo.getCode(); String elevator = ObjectUtils.isEmpty(categoryOtherInfo) ? generateCodeService.createElevatorCode("96333_" + prefix) : categoryOtherInfo.getCode();
if (!ObjectUtils.isEmpty(categoryOtherInfo)) { if (!ObjectUtils.isEmpty(categoryOtherInfo)) {
supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333", categoryOtherInfo.getCode())); supervisoryCodeInfoMapper.delete(new QueryWrapper<SupervisoryCodeInfo>().eq("code96333", categoryOtherInfo.getCode()));
...@@ -725,7 +699,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -725,7 +699,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
resultMap.put("creatStatus", NOT_CREATE); resultMap.put("creatStatus", NOT_CREATE);
} }
} }
//判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成 // 判断原数据是否存在监管码,存在则用原监管码即可,不存在则生成
if ("null".equals(supervisionCode)) { if ("null".equals(supervisionCode)) {
String supervisor = createSupervisorCode(isNotXiXian, city, county, equipCategory); String supervisor = createSupervisorCode(isNotXiXian, city, county, equipCategory);
supervisorCode.append(supervisor); supervisorCode.append(supervisor);
...@@ -739,7 +713,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -739,7 +713,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
log.info("生成码成功"); log.info("生成码成功");
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo(); SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
SupervisoryCodeInfo selectOne = supervisoryCodeInfoMapper.selectOne(new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionCode)); SupervisoryCodeInfo selectOne = supervisoryCodeInfoMapper.selectOne(new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisionCode));
//将生成的码添加到码表中,码的使用状态为初始状态 // 将生成的码添加到码表中,码的使用状态为初始状态
String equState = EquipmentCategoryEnum.CSZT.getCode(); String equState = EquipmentCategoryEnum.CSZT.getCode();
supervisoryCodeInfo.setCode96333(String.valueOf(elevatorCode)); supervisoryCodeInfo.setCode96333(String.valueOf(elevatorCode));
supervisoryCodeInfo.setCreateStatus(resultMap.get("creatStatus")); supervisoryCodeInfo.setCreateStatus(resultMap.get("creatStatus"));
...@@ -752,14 +726,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -752,14 +726,13 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisoryCodeInfoMapper.update(selectOne, supervisoryCodeInfoMapper.update(selectOne,
new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", selectOne.getSupervisoryCode())); new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", selectOne.getSupervisoryCode()));
} }
//使用UUID生成一个record,多表关联关系用 // 使用UUID生成一个record,多表关联关系用
resultMap.put("superviseCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString()); resultMap.put("superviseCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString());
resultMap.put("code96333", ObjectUtils.isEmpty(elevatorCode) ? null : elevatorCode.toString()); resultMap.put("code96333", ObjectUtils.isEmpty(elevatorCode) ? null : elevatorCode.toString());
resultMap.put("qrCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString()); resultMap.put("qrCode", ObjectUtils.isEmpty(supervisorCode) ? null : supervisorCode.toString());
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} } finally {
finally {
lock.unlock(); // 释放锁 lock.unlock(); // 释放锁
log.info("释放锁"); log.info("释放锁");
} }
...@@ -783,18 +756,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -783,18 +756,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) { if (((XIAN.equals(city) || XIAN_YANG.equals(city)) && "1".equals(isNotXiXian))) {
division = "X"; division = "X";
} else { } else {
//生成监管码前缀 // 生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county); Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString(); division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString();
} }
//supervisorCode.append(division).append(equipCategory).append("-"); // supervisorCode.append(division).append(equipCategory).append("-");
supervisorCode.append(division).append(equipCategory); supervisorCode.append(division).append(equipCategory);
return generateCodeService.createSupervisoryCode(String.valueOf(supervisorCode)); return generateCodeService.createSupervisoryCode(String.valueOf(supervisorCode));
//获取行政区划区县、市是否存在历史监管码 // 获取行政区划区县、市是否存在历史监管码
//CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString()); // CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString());
//生成对应监管码 // 生成对应监管码
//if (!ObjectUtils.isEmpty(supervisor) && supervisor.getSupervisoryCode() != null) { // if (!ObjectUtils.isEmpty(supervisor) && supervisor.getSupervisoryCode() != null) {
// //获取补零位长度 // //获取补零位长度
// String supervisoryCode = supervisor.getSupervisoryCode().substring(6); // String supervisoryCode = supervisor.getSupervisoryCode().substring(6);
// long num = Long.valueOf(supervisoryCode) + 1; // long num = Long.valueOf(supervisoryCode) + 1;
...@@ -809,7 +782,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -809,7 +782,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//} else { //} else {
// supervisorCode.append(EquipmentCategoryEnum.JGM.getCode()); // supervisorCode.append(EquipmentCategoryEnum.JGM.getCode());
//} //}
//return supervisorCode.toString(); // return supervisorCode.toString();
} }
/** /**
...@@ -821,14 +794,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -821,14 +794,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Deprecated @Deprecated
public String createElevatorCode(String prefix) { public String createElevatorCode(String prefix) {
StringBuilder elevatorCode = new StringBuilder(); StringBuilder elevatorCode = new StringBuilder();
//生成生成96333电梯码前缀 // 生成生成96333电梯码前缀
elevatorCode.append(prefix); elevatorCode.append(prefix);
String initCode = elevatorCode + EquipmentCategoryEnum.getValue.get(elevatorCode.toString()); String initCode = elevatorCode + EquipmentCategoryEnum.getValue.get(elevatorCode.toString());
CategoryOtherInfo initSupervisoryCode = categoryOtherInfoMapper.queryInitCode(initCode); // 查询是否已经生成过初始值 CategoryOtherInfo initSupervisoryCode = categoryOtherInfoMapper.queryInitCode(initCode); // 查询是否已经生成过初始值
if (ValidationUtil.isEmpty(initSupervisoryCode)) { if (ValidationUtil.isEmpty(initSupervisoryCode)) {
elevatorCode.append(EquipmentCategoryEnum.getValue.get(prefix)); elevatorCode.append(EquipmentCategoryEnum.getValue.get(prefix));
} else { } else {
//获取行政区划区县、市是否存在历史96333电梯码 // 获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null); CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString(), null);
if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) { if (!ObjectUtils.isEmpty(elevatorOtherInfo) && elevatorOtherInfo.getCode() != null) {
StopWatch stopWatch = new StopWatch(); StopWatch stopWatch = new StopWatch();
...@@ -844,7 +817,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -844,7 +817,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
elevatorCode.setLength(0); elevatorCode.setLength(0);
elevatorCode.append(resultList.get(0)); elevatorCode.append(resultList.get(0));
} else { } else {
//获取补零位长度 // 获取补零位长度
String elevatorCode1 = elevatorOtherInfo.getCode().substring(2); String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
long num = Long.parseLong(elevatorCode1) + 1; long num = Long.parseLong(elevatorCode1) + 1;
int numLength = String.valueOf(num).length(); int numLength = String.valueOf(num).length();
...@@ -864,36 +837,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -864,36 +837,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
/** /**
* 获取两个List的不同元素
*
* @param list1
* @param list2
* @return
*/
private static List<Integer> getDiffrent(List<Integer> list1, List<Integer> list2) {
List<Integer> diff = new ArrayList<Integer>();
Map<Integer, Integer> map = new HashMap<Integer, Integer>(list1.size());
for (Integer integer : list1) {
map.put(integer, 1);
}
for (Integer integer : list2) {
if (map.get(integer) != null) {
map.put(integer, 2);
continue;
}
}
for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
if (entry.getValue() == 1) {
diff.add(entry.getKey());
}
}
// 对集合进行排序
Collections.sort(diff);
return diff;
}
/**
* 获取当前登录人单位类型 * 获取当前登录人单位类型
* *
* @return * @return
...@@ -916,7 +859,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -916,7 +859,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return objectList; return objectList;
} }
@Override @Override
public Map<String, Map<String, Object>> getFormRecordById(Map<String, Object> map) { public Map<String, Map<String, Object>> getFormRecordById(Map<String, Object> map) {
// ResponseModel<Map<String, Map<String, Object>>> responseModel = idxFeignService.getFormRecordById(map); // ResponseModel<Map<String, Map<String, Object>>> responseModel = idxFeignService.getFormRecordById(map);
...@@ -1235,16 +1177,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1235,16 +1177,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return page; return page;
} }
/**
* levlel=company,是企业,如果不是都是监管单位,
* * 在接口中查询当前登录人所属单位是监管单位还是企业。
* * 如果为监管单位添加监管机构查询参数(ORG_BRANCH_CODE);
* * 如果为企业添加使用单位查询参数(USE_UNIT_CREDIT_CODE)
*/
private static final String LEVEL = "company";
private static final String EQUSTATE = "EQU_STATE";
private static final String USEPLACE = "USE_PLACE";
public Page<Map<String, Object>> getTable(Map<String, Object> map) { public Page<Map<String, Object>> getTable(Map<String, Object> map) {
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) { if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
...@@ -1267,12 +1199,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1267,12 +1199,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ValidationUtil.isEmpty(level)) { if (!ValidationUtil.isEmpty(level)) {
Page<Map<String, Object>> m = new Page<>(); Page<Map<String, Object>> m = new Page<>();
if (LEVEL.equals(level)) { if (LEVEL.equals(level)) {
//企业 // 企业
map.put("USE_UNIT_CREDIT_CODE", companyCode); map.put("USE_UNIT_CREDIT_CODE", companyCode);
m = this.getPage(map); m = this.getPage(map);
map.remove("USE_UNIT_CREDIT_CODE"); map.remove("USE_UNIT_CREDIT_CODE");
} else { } else {
//监管单位 // 监管单位
map.put("ORG_BRANCH_CODE", code); map.put("ORG_BRANCH_CODE", code);
m = this.getPage(map); m = this.getPage(map);
map.remove("ORG_BRANCH_CODE"); map.remove("ORG_BRANCH_CODE");
...@@ -1290,7 +1222,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1290,7 +1222,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
objectPage.setSize(Long.valueOf(map.get("size").toString())); objectPage.setSize(Long.valueOf(map.get("size").toString()));
objectPage.setCurrent(Long.valueOf(map.get("number").toString())); objectPage.setCurrent(Long.valueOf(map.get("number").toString()));
model.setResult(objectPage); model.setResult(objectPage);
//设备状态码对应枚举值 // 设备状态码对应枚举值
List<Map<String, Object>> records = model.getResult().getRecords(); List<Map<String, Object>> records = model.getResult().getRecords();
List<Map<String, Object>> result = new ArrayList<>(); List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> record : records) { for (Map<String, Object> record : records) {
...@@ -1343,10 +1275,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1343,10 +1275,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String companyCode = object.getString("companyCode"); String companyCode = object.getString("companyCode");
if (!ValidationUtil.isEmpty(level)) { if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) { if (LEVEL.equals(level)) {
//企业 // 企业
dto.setUSE_UNIT_CREDIT_CODE(companyCode); dto.setUSE_UNIT_CREDIT_CODE(companyCode);
} else { } else {
//监管单位 // 监管单位
dto.setORG_BRANCH_CODE(orgCode); dto.setORG_BRANCH_CODE(orgCode);
} }
List<EquipExportVo> equipExportData = equipmentCategoryMapper.getEquipExportData(dto); List<EquipExportVo> equipExportData = equipmentCategoryMapper.getEquipExportData(dto);
...@@ -1371,10 +1303,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1371,10 +1303,10 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ValidationUtil.isEmpty(level)) { if (!ValidationUtil.isEmpty(level)) {
Page<EquipExportVo> equipExportVoPage = new Page<>(pageNum, size); Page<EquipExportVo> equipExportVoPage = new Page<>(pageNum, size);
if (LEVEL.equals(level)) { if (LEVEL.equals(level)) {
//企业 // 企业
dto.setUSE_UNIT_CREDIT_CODE(companyCode); dto.setUSE_UNIT_CREDIT_CODE(companyCode);
} else { } else {
//监管单位 // 监管单位
dto.setORG_BRANCH_CODE(orgCode); dto.setORG_BRANCH_CODE(orgCode);
} }
Page<EquipExportVo> equipExportData = equipmentCategoryMapper.exportImageZip(equipExportVoPage, dto); Page<EquipExportVo> equipExportData = equipmentCategoryMapper.exportImageZip(equipExportVoPage, dto);
...@@ -1442,7 +1374,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1442,7 +1374,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
esElevator.setSequenceNbr(recordList.toString()); esElevator.setSequenceNbr(recordList.toString());
esElevatorList.add(esElevator); esElevatorList.add(esElevator);
} }
//删除监管码表数据 // 删除监管码表数据
List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records); List<String> superviseCodeList = superviseInfoMapper.selectSuperviseCodeList(records);
List<Map<String, Object>> unitCodeAndOrgBranchCodeList = superviseInfoMapper.selectUnitCodeList(records); List<Map<String, Object>> unitCodeAndOrgBranchCodeList = superviseInfoMapper.selectUnitCodeList(records);
List<String> unitCodeList = new ArrayList<>(); List<String> unitCodeList = new ArrayList<>();
...@@ -1455,11 +1387,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1455,11 +1387,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if (!ObjectUtils.isEmpty(superviseCodeList)) { if (!ObjectUtils.isEmpty(superviseCodeList)) {
supervisoryCodeInfoMapper.updateStatus(superviseCodeList); supervisoryCodeInfoMapper.updateStatus(superviseCodeList);
} }
//删除es中elev中的相关数据 // 删除es中elev中的相关数据
esElavtorRepository.deleteAll(esElevatorList); esElavtorRepository.deleteAll(esElevatorList);
//删除涉及的19张表的数据 // 删除涉及的19张表的数据
superviseInfoMapper.deleteDataAll(records); superviseInfoMapper.deleteDataAll(records);
//删除es中的数据 // 删除es中的数据
esEquipmentCategory.deleteAll(list); esEquipmentCategory.deleteAll(list);
return records; return records;
} }
...@@ -1509,7 +1441,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1509,7 +1441,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String claimStatus = String.valueOf(superviseMap.get("claimStatus")); String claimStatus = String.valueOf(superviseMap.get("claimStatus"));
String operateType = String.valueOf(superviseMap.get("operateType")); String operateType = String.valueOf(superviseMap.get("operateType"));
String isCopy = String.valueOf(useInfoFrom.get("isCopy")); String isCopy = String.valueOf(useInfoFrom.get("isCopy"));
//生成码 // 生成码
Map<String, String> codeMap = new HashMap<>(); Map<String, String> codeMap = new HashMap<>();
if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) { if (EquipmentCategoryEnum.YRL.getName().equals(claimStatus)) {
log.info("准备生成监管码或96333电梯识别码"); log.info("准备生成监管码或96333电梯识别码");
...@@ -1517,9 +1449,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1517,9 +1449,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String county = String.valueOf(superviseMap.get("county")); String county = String.valueOf(superviseMap.get("county"));
String supervisionCode = String.valueOf(superviseMap.get("supervisionCode")); String supervisionCode = String.valueOf(superviseMap.get("supervisionCode"));
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy(); EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
//生成码 // 生成码
codeMap = categoryService.creatCode(isNotXiXian, city, county, equCategory, code96333, supervisionCode); codeMap = categoryService.creatCode(isNotXiXian, city, county, equCategory, code96333, supervisionCode);
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据 // 删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map.remove("data"); map.remove("data");
supervisionMap.put("CODE96333", codeMap.get("code96333")); supervisionMap.put("CODE96333", codeMap.get("code96333"));
supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode")); supervisionMap.put("SUPERVISORY_CODE", codeMap.get("superviseCode"));
...@@ -1535,7 +1467,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1535,7 +1467,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333); supervisionMap.put("CODE96333", "null".equals(code96333) ? null : code96333);
map.put(supervision_form_id, supervisionMap); map.put(supervision_form_id, supervisionMap);
supervisoryCodeInfo.setCode96333("null".equals(code96333) ? null : code96333); supervisoryCodeInfo.setCode96333("null".equals(code96333) ? null : code96333);
//根据操作状态判断是调用新增还是修改接口 // 根据操作状态判断是调用新增还是修改接口
record = batchSubmitOrUpdate(map, registerForm, alias, isCopy, operateType, claimStatus); record = batchSubmitOrUpdate(map, registerForm, alias, isCopy, operateType, claimStatus);
} else { } else {
record = batchSubmitOrUpdate(map, registerForm, alias, isCopy, operateType, claimStatus); record = batchSubmitOrUpdate(map, registerForm, alias, isCopy, operateType, claimStatus);
...@@ -1610,7 +1542,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1610,7 +1542,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode()); supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
if (category.startsWith("3")) { if (category.startsWith("3")) {
if ("null".equals(map.get("code"))) { if ("null".equals(map.get("code"))) {
//code96333 = createElevatorCode("31"); // code96333 = createElevatorCode("31");
code96333 = generateCodeService.createElevatorCode("96333_31"); code96333 = generateCodeService.createElevatorCode("96333_31");
supervisoryCodeInfo.setCreateStatus(CREATE); supervisoryCodeInfo.setCreateStatus(CREATE);
} else { } else {
...@@ -1619,7 +1551,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1619,7 +1551,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
} }
supervisoryCodeInfo.setCode96333(code96333); supervisoryCodeInfo.setCode96333(code96333);
//更新至码表 // 更新至码表
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo); supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo(); CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
categoryOtherInfo.setCode(code96333); categoryOtherInfo.setCode(code96333);
...@@ -1678,7 +1610,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1678,7 +1610,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
idxBizJgUseInfoService.saveOrUpdate(useInfo); idxBizJgUseInfoService.saveOrUpdate(useInfo);
//监督管理信息 // 监督管理信息
LinkedHashMap supervisionForm = (LinkedHashMap) map.get(supervision_form_id); LinkedHashMap supervisionForm = (LinkedHashMap) map.get(supervision_form_id);
IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(JSON.toJSONString(supervisionForm), IdxBizJgSupervisionInfo.class); IdxBizJgSupervisionInfo supervisionInfo = JSON.parseObject(JSON.toJSONString(supervisionForm), IdxBizJgSupervisionInfo.class);
supervisionInfo.setRecord(record); supervisionInfo.setRecord(record);
...@@ -1696,7 +1628,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1696,7 +1628,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
idxBizJgOtherInfoService.saveOrUpdate(idxBizJgOtherInfo); idxBizJgOtherInfoService.saveOrUpdate(idxBizJgOtherInfo);
} }
//设计制造信息 // 设计制造信息
LinkedHashMap designForm = (LinkedHashMap) map.get(design_from_id); LinkedHashMap designForm = (LinkedHashMap) map.get(design_from_id);
IdxBizJgDesignInfo designInfo = JSON.parseObject(JSON.toJSONString(designForm), IdxBizJgDesignInfo.class); IdxBizJgDesignInfo designInfo = JSON.parseObject(JSON.toJSONString(designForm), IdxBizJgDesignInfo.class);
designInfo.setRecord(record); designInfo.setRecord(record);
...@@ -1712,7 +1644,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1712,7 +1644,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
idxBizJgFactoryInfoService.saveOrUpdate(factoryInfo); idxBizJgFactoryInfoService.saveOrUpdate(factoryInfo);
} }
//检验检测信息 // 检验检测信息
LinkedHashMap inspectionForm = (LinkedHashMap) map.get(inspection_form_id); LinkedHashMap inspectionForm = (LinkedHashMap) map.get(inspection_form_id);
List inspectionList = (ArrayList) inspectionForm.get("subForm_pbim1pfid8"); List inspectionList = (ArrayList) inspectionForm.get("subForm_pbim1pfid8");
List<IdxBizJgInspectionDetectionInfo> detectionInfoList = new ArrayList<>(); List<IdxBizJgInspectionDetectionInfo> detectionInfoList = new ArrayList<>();
...@@ -1727,7 +1659,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1727,7 +1659,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
idxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(detectionInfoList); idxBizJgInspectionDetectionInfoService.saveOrUpdateBatch(detectionInfoList);
} }
//施工信息 // 施工信息
LinkedHashMap constructionForm = (LinkedHashMap) map.get(construction_form_id); LinkedHashMap constructionForm = (LinkedHashMap) map.get(construction_form_id);
List constructionlist = (ArrayList) constructionForm.get("subForm_b2x2wmcy2s"); List constructionlist = (ArrayList) constructionForm.get("subForm_b2x2wmcy2s");
if (!ObjectUtils.isEmpty(constructionlist)) { if (!ObjectUtils.isEmpty(constructionlist)) {
...@@ -1742,11 +1674,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1742,11 +1674,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
idxBizJgConstructionInfoService.saveOrUpdateBatch(constructionInfoList); idxBizJgConstructionInfoService.saveOrUpdateBatch(constructionInfoList);
} }
//八大类技术参数实体填充 // 八大类技术参数实体填充
List<IdxBizJgMainParts> mainPartsList = new ArrayList<>(); List<IdxBizJgMainParts> mainPartsList = new ArrayList<>();
List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>(); List<IdxBizJgProtectionDevices> protectionDevicesList = new ArrayList<>();
if (EquipmentTypeEnum.DT.getCode().equals(alias)) { if (EquipmentTypeEnum.DT.getCode().equals(alias)) {
//维保备案信息 // 维保备案信息
LinkedHashMap maintenanceForm = (LinkedHashMap) map.get(maintenance_form_id); LinkedHashMap maintenanceForm = (LinkedHashMap) map.get(maintenance_form_id);
List subFormMaintenanceList = (ArrayList) maintenanceForm.get("subForm_6i16fox27e"); List subFormMaintenanceList = (ArrayList) maintenanceForm.get("subForm_6i16fox27e");
if (!ObjectUtils.isEmpty(subFormMaintenanceList)) { if (!ObjectUtils.isEmpty(subFormMaintenanceList)) {
...@@ -1760,7 +1692,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1760,7 +1692,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
idxBizJgMaintenanceRecordInfoService.saveOrUpdateBatch(maintenanceList); idxBizJgMaintenanceRecordInfoService.saveOrUpdateBatch(maintenanceList);
} }
//技术参数 // 技术参数
IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(registerForm), IdxBizJgTechParamsElevator.class); IdxBizJgTechParamsElevator elevator = JSON.parseObject(JSON.toJSONString(registerForm), IdxBizJgTechParamsElevator.class);
if (!ObjectUtils.isEmpty(elevator)) { if (!ObjectUtils.isEmpty(elevator)) {
elevator.setRecord(record); elevator.setRecord(record);
...@@ -1942,7 +1874,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1942,7 +1874,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return page; return page;
} }
//查询总条数 // 查询总条数
public Long counts(Map<String, Object> map) { public Long counts(Map<String, Object> map) {
String tableName = map.get(TABLENAME).toString(); String tableName = map.get(TABLENAME).toString();
Assert.hasText(tableName, "表名不能为空"); Assert.hasText(tableName, "表名不能为空");
...@@ -1979,21 +1911,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1979,21 +1911,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
log.info("本次一码通同步设备数据:【" + total + "】条,耗时:" + (end - start) + " 毫秒"); log.info("本次一码通同步设备数据:【" + total + "】条,耗时:" + (end - start) + " 毫秒");
} }
public void updateEs() {
List<String> list = categoryOtherInfoMapper.selectData();
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) { public void saveBatchEquipment2Es(List<Map<String, Object>> equipList) {
List<ESEquipmentCategoryDto> esEquipDtoList = Lists.newArrayList(); List<ESEquipmentCategoryDto> esEquipDtoList = Lists.newArrayList();
List<String> recordList = Lists.newArrayList(); List<String> recordList = Lists.newArrayList();
...@@ -2048,11 +1965,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -2048,11 +1965,11 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
SearchSourceBuilder builder = new SearchSourceBuilder(); SearchSourceBuilder builder = new SearchSourceBuilder();
builder.trackTotalHits(true); builder.trackTotalHits(true);
BoolQueryBuilder boolMust = QueryBuilders.boolQuery(); BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
//通用匹配规则,条件构建 // 通用匹配规则,条件构建
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数 // 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if (!ValidationUtil.isEmpty(level)) { if (!ValidationUtil.isEmpty(level)) {
if (LEVEL.equals(level)) { if (LEVEL.equals(level)) {
//企业 // 企业
map.put("USE_UNIT_CREDIT_CODE", companyCode); map.put("USE_UNIT_CREDIT_CODE", companyCode);
if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) { if (!ObjectUtils.isEmpty(map.getString("ORG_BRANCH_CODE"))) {
BoolQueryBuilder query = QueryBuilders.boolQuery(); BoolQueryBuilder query = QueryBuilders.boolQuery();
...@@ -2072,12 +1989,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -2072,12 +1989,12 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return result; return result;
} }
} else { } else {
//监管单位 // 监管单位
map.put("ORG_BRANCH_CODE", code); map.put("ORG_BRANCH_CODE", code);
} }
} }
} }
//SEQUENCE_NBR // SEQUENCE_NBR
if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) { if (!ObjectUtils.isEmpty(map.getString("SEQUENCE_NBR"))) {
BoolQueryBuilder meBuilder = QueryBuilders.boolQuery(); BoolQueryBuilder meBuilder = QueryBuilders.boolQuery();
String test = QueryParser.escape(map.getString("SEQUENCE_NBR")); String test = QueryParser.escape(map.getString("SEQUENCE_NBR"));
...@@ -2204,7 +2121,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -2204,7 +2121,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return result; return result;
} }
//es统计总记录数 // es统计总记录数
public Long getCount(String indexs, RestHighLevelClient esClient) { public Long getCount(String indexs, RestHighLevelClient esClient) {
Long totle = 0L; Long totle = 0L;
SearchRequest searchRequest = new SearchRequest(indexs); SearchRequest searchRequest = new SearchRequest(indexs);
...@@ -2476,31 +2393,31 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -2476,31 +2393,31 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Map<String, Object> childMap = entry.getValue(); Map<String, Object> childMap = entry.getValue();
if (!childMap.isEmpty()) { if (!childMap.isEmpty()) {
ESEquipmentCategoryDto oldData = null; ESEquipmentCategoryDto oldData = null;
//获取Es中旧的数据 // 获取Es中旧的数据
Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record); Optional<ESEquipmentCategoryDto> optional = esEquipmentCategory.findById(record);
if (!ObjectUtils.isEmpty(optional)) { if (!ObjectUtils.isEmpty(optional)) {
oldData = optional.get(); oldData = optional.get();
oldUscUnitCreditCode = oldData.getUSC_UNIT_CREDIT_CODE(); oldUscUnitCreditCode = oldData.getUSC_UNIT_CREDIT_CODE();
oldUscUnitName = oldData.getUSC_UNIT_NAME(); oldUscUnitName = oldData.getUSC_UNIT_NAME();
} }
//获取Es中新的参数 // 获取Es中新的参数
ESEquipmentCategoryDto newData = JSON.parseObject(toJSONString(childMap), ESEquipmentCategoryDto.class); ESEquipmentCategoryDto newData = JSON.parseObject(toJSONString(childMap), ESEquipmentCategoryDto.class);
String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE(); String newUscUnitCreditCode = newData.getUSC_UNIT_CREDIT_CODE();
String newUscUnitName = newData.getUSC_UNIT_NAME(); String newUscUnitName = newData.getUSC_UNIT_NAME();
//删除Es中旧的数据 // 删除Es中旧的数据
if (!ObjectUtils.isEmpty(oldData)) { if (!ObjectUtils.isEmpty(oldData)) {
esEquipmentCategory.deleteById(record); esEquipmentCategory.deleteById(record);
//整合新旧数据 // 整合新旧数据
Bean.copyExistPropertis(newData, oldData); Bean.copyExistPropertis(newData, oldData);
//处理施工单位信息[去重] // 处理施工单位信息[去重]
if(!ValidationUtil.isEmpty(newUscUnitCreditCode)){ if (!ValidationUtil.isEmpty(newUscUnitCreditCode)) {
if (!ValidationUtil.isEmpty(oldUscUnitCreditCode)) { if (!ValidationUtil.isEmpty(oldUscUnitCreditCode)) {
if(!oldUscUnitCreditCode.contains(newUscUnitCreditCode)){ if (!oldUscUnitCreditCode.contains(newUscUnitCreditCode)) {
oldData.setUSC_UNIT_CREDIT_CODE(oldUscUnitCreditCode + "," + newUscUnitCreditCode); oldData.setUSC_UNIT_CREDIT_CODE(oldUscUnitCreditCode + "," + newUscUnitCreditCode);
oldData.setUSC_UNIT_NAME(oldUscUnitName + "," + newUscUnitName); oldData.setUSC_UNIT_NAME(oldUscUnitName + "," + newUscUnitName);
} }
}else { } else {
oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode); oldData.setUSC_UNIT_CREDIT_CODE(newUscUnitCreditCode);
oldData.setUSC_UNIT_NAME(newUscUnitName); oldData.setUSC_UNIT_NAME(newUscUnitName);
} }
...@@ -2511,7 +2428,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -2511,7 +2428,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
oldData.setREC_DATE(System.currentTimeMillis()); oldData.setREC_DATE(System.currentTimeMillis());
ESEquipmentCategoryDto saveData = esEquipmentCategory.save(oldData); ESEquipmentCategoryDto saveData = esEquipmentCategory.save(oldData);
//组装返回数据 // 组装返回数据
resultMap.put(record, saveData); resultMap.put(record, saveData);
} }
} }
......
package com.yeejoin.amos.boot.module.ymt.biz.utils;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.ymt.biz.dao.EsEntity;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author LiuLin
* @date 2023年08月08日 16:30
*/
@Slf4j
@Component
public class ElasticSearchUtil {
private static final long SCROLL_TIMEOUT = 180000;
private static final int SIZE = 1000;
@Autowired
private RestHighLevelClient restHighLevelClient;
/**
* Description: 批量修改数据
*
* @param index index
* @param list 更新列表
* @author LiuLin
*/
public <T> void updateBatch(String index, List<EsEntity<T>> list) {
BulkRequest request = new BulkRequest();
list.forEach(item -> request.add(new UpdateRequest(index, item.getId())
.doc(JSON.toJSONString(item.getData()), XContentType.JSON)));
try {
restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
list.forEach(s -> log.info("===========索引:【{}】,主键:【{}】修改成功", index, s.getId()));
} catch (Exception e) {
log.error("索引:[{}]", index, e);
}
}
}
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