diff --git a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java index 0aa837a6..ac385e22 100644 --- a/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java +++ b/adc-da-convert/src/main/java/com/adc/da/convert/mq/SendConvertMQService.java @@ -71,10 +71,10 @@ public class SendConvertMQService { private static final Logger logger = LoggerFactory.getLogger(SendConvertMQService.class); - @RabbitListener(bindings = @QueueBinding( - value = @Queue(value = "createConvertStandMQ_SQ_GSAR_RELEASE", durable = "true"), - exchange = @Exchange(value = "convert-exchange_SQ_GSAR_RELEASE", ignoreDeclarationExceptions = "true"), - key = "convert-key_SQ_GSAR_RELEASE")) +// @RabbitListener(bindings = @QueueBinding( +// value = @Queue(value = "createConvertStandMQ_SQ_GSAR_RELEASE", durable = "true"), +// exchange = @Exchange(value = "convert-exchange_SQ_GSAR_RELEASE", ignoreDeclarationExceptions = "true"), +// key = "convert-key_SQ_GSAR_RELEASE")) public void createMQ(Message message, Channel channel) throws Exception{ try{ try{ diff --git a/adc-da-jwtLogin/src/main/java/com/adc/da/login/util/IDMUtil.java b/adc-da-jwtLogin/src/main/java/com/adc/da/login/util/IDMUtil.java index 73394161..d005404c 100644 --- a/adc-da-jwtLogin/src/main/java/com/adc/da/login/util/IDMUtil.java +++ b/adc-da-jwtLogin/src/main/java/com/adc/da/login/util/IDMUtil.java @@ -18,10 +18,10 @@ public class IDMUtil { private OkHttpUtil okHttpUtil; private final String app_key = "app_slrs"; - private final String app_secret = "Fxi5LHbI5yGbQQDpVp86GcCdXeC5Bjfe"; - private final String access_url = "http://sso.foton.com.cn/oauth2.0/accessTokenByJson"; - private final String profile_ur = "http://sso.foton.com.cn/oauth2.0/profileByJson"; - private final String redirect_url = "https://srms.foton.com.cn"; + private final String app_secret = "wj5iDTqyguQCxnsoo5VU21BoRSZqevhI"; + private final String access_url = "http://testsso1.foton.com.cn/oauth2.0/accessTokenByJson"; + private final String profile_ur = "http://testsso1.foton.com.cn/oauth2.0/profileByJson"; + private final String redirect_url = "http://127.0.0.1:9090"; public String idmLogin(String code){ try{ @@ -66,7 +66,6 @@ public class IDMUtil { } }catch(Exception e){ log.error("单点登录获取用户信息失败"); - e.printStackTrace(); } return ""; } diff --git a/adc-da-search/src/main/java/com/adc/da/search/service/impl/SearchCenterServiceImpl.java b/adc-da-search/src/main/java/com/adc/da/search/service/impl/SearchCenterServiceImpl.java index 35bf27db..76383ad6 100644 --- a/adc-da-search/src/main/java/com/adc/da/search/service/impl/SearchCenterServiceImpl.java +++ b/adc-da-search/src/main/java/com/adc/da/search/service/impl/SearchCenterServiceImpl.java @@ -237,7 +237,7 @@ public class SearchCenterServiceImpl implements SearchCenterService { .addSort("issue_time_data", SortOrder.DESC) .setSize(searchInfoEO.getPageSize()); - if(StringUtils.isNotEmpty(searchInfoEO.getSelectValue()) && StringUtils.isBlank(searchInfoEO.getIsHigh())){ + if(StringUtils.isNotEmpty(searchInfoEO.getSelectValue())){ QueryBuilder multiQueryBuilder; switch (searchInfoEO.getSelectIndex()){ case "stand": @@ -245,7 +245,7 @@ public class SearchCenterServiceImpl implements SearchCenterService { .should(QueryBuilders.wildcardQuery("standSort.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1005f)) .should(QueryBuilders.termQuery("standNumber", searchInfoEO.getSelectValue().toUpperCase()).boost(1004f)) .should(QueryBuilders.wildcardQuery("standYear.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1003f)) - .should(QueryBuilders.wildcardQuery("nameshow.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1002f)) + .should(QueryBuilders.wildcardQuery("nameshow.keyword", "*" +searchInfoEO.getSelectValue().toUpperCase()+ "*").boost(1002f)) .should(QueryBuilders.wildcardQuery("numbershow.keyword", "*" + searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1000f)) .should(QueryBuilders.wildcardQuery("numbershow.keyword", "*" + searchInfoEO.getSelectValue() + "*").boost(999f)); break; @@ -260,30 +260,68 @@ public class SearchCenterServiceImpl implements SearchCenterService { .should(QueryBuilders.wildcardQuery("standSort.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1005f)) .should(QueryBuilders.termQuery("standNumber", searchInfoEO.getSelectValue().toUpperCase()).boost(1004f)) .should(QueryBuilders.wildcardQuery("standYear.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1003f)) - .should(QueryBuilders.wildcardQuery("nameshow.keyword", searchInfoEO.getSelectValue().toUpperCase()).boost(1002f)) + .should(QueryBuilders.wildcardQuery("nameshow.keyword", "*" +searchInfoEO.getSelectValue().toUpperCase()+ "*").boost(1002f)) .should(QueryBuilders.wildcardQuery("stand_code.keyword", "*" + searchInfoEO.getSelectValue().toUpperCase() + "*").boost(1000f)) - .should(QueryBuilders.wildcardQuery("stand_code.keyword", "*" + searchInfoEO.getSelectValue() + "*").boost(999F)); + .should(QueryBuilders.wildcardQuery("stand_code.keyword", "*" + searchInfoEO.getSelectValue() + "*").boost(999f)); break; default: break; } } + switch (searchInfoEO.getSelectIndex()){ + case "stand": + case "bussstand": + if (StringUtils.isNotBlank(searchInfoEO.getStandSort())) { + if (StringUtils.isNotBlank(searchInfoEO.getStandSort())) { + List list = Arrays.asList(searchInfoEO.getStandSort().split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList()); + if(list.size() > 1){ + BoolQueryBuilder boolQueryBuilderShould = new BoolQueryBuilder(); + list.forEach(s -> { + boolQueryBuilderShould.should(QueryBuilders.termQuery("standSort.keyword", s)); + }); + boolQueryBuilder.must(boolQueryBuilderShould); + }else { + boolQueryBuilder.must(QueryBuilders.termQuery("standSort.keyword", searchInfoEO.getStandSort())); + } + } + } + break; +// case "laws": +// break; + default: break; + } + if(boolQueryShould!=null){ boolQueryBuilder.must(QueryBuilders.matchQuery("validFlag", 0)); + + if(searchInfoEO.getCLLX() != null && StringUtils.isNotBlank(searchInfoEO.getCLLX())){ + BoolQueryBuilder boolQueryBuilderShould = new BoolQueryBuilder(); + List fieldList = Arrays.asList(searchInfoEO.getCLLX() .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList()); + fieldList.forEach(s -> { + boolQueryBuilderShould.should(QueryBuilders.termQuery("CLLX", s)); + }); + boolQueryBuilder.must(boolQueryBuilderShould); + } + + if(searchInfoEO.getNYLXCLASS() != null && StringUtils.isNotBlank(searchInfoEO.getNYLXCLASS())){ + BoolQueryBuilder boolQueryBuilderShould = new BoolQueryBuilder(); + List fieldList = Arrays.asList(searchInfoEO.getNYLXCLASS() .split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList()); + fieldList.forEach(s -> { + boolQueryBuilderShould.should(QueryBuilders.termQuery("NYLXCLASS", s)); + }); + boolQueryBuilder.must(boolQueryBuilderShould); + } if(StringUtils.isNotEmpty(searchInfoEO.getSelectValue())){ if (StringUtils.isNotBlank(searchInfoEO.getType())) { boolQueryShould.must(QueryBuilders.wildcardQuery("type.keyword", "*"+searchInfoEO.getType()+"*")); } if (StringUtils.isNotBlank(searchInfoEO.getStandType()) && StringUtils.isNotBlank(searchInfoEO.getSelectIndex())) { if(searchInfoEO.getSelectIndex().equals("bussstand")){ - boolQueryShould.must(QueryBuilders.wildcardQuery("type.keyword", "*"+searchInfoEO.getStandType()+"*")); + boolQueryBuilder.must(QueryBuilders.wildcardQuery("type.keyword", "*"+searchInfoEO.getStandType()+"*")); }else { boolQueryBuilder.must(QueryBuilders.wildcardQuery("standType.keyword", "*"+searchInfoEO.getStandType()+"*")); } } - if (StringUtils.isNotBlank(searchInfoEO.getStandSort())) { - boolQueryBuilder.must(QueryBuilders.wildcardQuery("numbershow.keyword", "*"+searchInfoEO.getStandSort()+" "+"*")); - } if (StringUtils.isNotBlank(searchInfoEO.getTextStatus())) { boolQueryBuilder.must(QueryBuilders.wildcardQuery("textStatus.keyword", "*"+searchInfoEO.getTextStatus()+"*")); } @@ -420,9 +458,6 @@ public class SearchCenterServiceImpl implements SearchCenterService { boolQueryBuilder.must(QueryBuilders.wildcardQuery("standType.keyword", "*"+searchInfoEO.getStandType()+"*")); } } - if (StringUtils.isNotBlank(searchInfoEO.getStandSort())) { - boolQueryBuilder.must(QueryBuilders.wildcardQuery("numbershow.keyword", "*"+searchInfoEO.getStandSort()+" "+"*")); - } if (StringUtils.isNotBlank(searchInfoEO.getTextStatus())) { boolQueryBuilder.must(QueryBuilders.wildcardQuery("textStatus.keyword", "*"+searchInfoEO.getTextStatus()+"*")); } @@ -835,7 +870,18 @@ public class SearchCenterServiceImpl implements SearchCenterService { // 高级搜索项,只针对标准 if (StringUtils.isNotBlank(searchInfoEO.getStandSort())) { - boolQueryBuilder.must(QueryBuilders.wildcardQuery("numbershow.keyword", "*"+searchInfoEO.getStandSort()+"*")); + if (StringUtils.isNotBlank(searchInfoEO.getStandSort())) { + List list = Arrays.asList(searchInfoEO.getStandSort().split(",")).stream().map(s -> (s.trim())).collect(Collectors.toList()); + if(list.size() > 1){ + BoolQueryBuilder boolQueryBuilderShould = new BoolQueryBuilder(); + list.forEach(s -> { + boolQueryBuilderShould.should(QueryBuilders.termQuery("standSort.keyword", s)); + }); + boolQueryBuilder.must(boolQueryBuilderShould); + }else { + boolQueryBuilder.must(QueryBuilders.termQuery("standSort.keyword", searchInfoEO.getStandSort())); + } + } } if (StringUtils.isNotBlank(searchInfoEO.getStandCode())) { boolQueryBuilder.must(QueryBuilders.wildcardQuery("standNumber.keyword", "*"+searchInfoEO.getStandCode()+"*")); @@ -1448,6 +1494,7 @@ public class SearchCenterServiceImpl implements SearchCenterService { HighlightBuilder.Field highlightTitle = new HighlightBuilder.Field("title"); hiBuilder.field(highlightTitle); HighlightBuilder.Field highlightUser = new HighlightBuilder.Field("textContent"); + highlightUser.numOfFragments(3); hiBuilder.field(highlightUser); HighlightBuilder.Field highlightItem = new HighlightBuilder.Field("textItems"); hiBuilder.field(highlightItem); @@ -1601,6 +1648,10 @@ public class SearchCenterServiceImpl implements SearchCenterService { HighlightBuilder hiBuilder=new HighlightBuilder(); HighlightBuilder.Field highlightTitle = new HighlightBuilder.Field("title.keyword"); hiBuilder.field(highlightTitle); + HighlightBuilder.Field highlightUser = new HighlightBuilder.Field("textContent"); + highlightUser.numOfFragments(1); + highlightUser.fragmentSize(100); + hiBuilder.field(highlightUser); hiBuilder.preTags(""); hiBuilder.postTags(""); updateIndex("fulltextserch"); @@ -1959,6 +2010,7 @@ public class SearchCenterServiceImpl implements SearchCenterService { HighlightBuilder.Field highlightTitle = new HighlightBuilder.Field("title"); hiBuilder.field(highlightTitle); HighlightBuilder.Field highlightUser = new HighlightBuilder.Field("textContent"); + highlightUser.numOfFragments(3); hiBuilder.field(highlightUser); HighlightBuilder.Field highlightDate = new HighlightBuilder.Field("issue_time"); hiBuilder.field(highlightDate); diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/DataSync/service/impl/DataSyncServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/DataSync/service/impl/DataSyncServiceImpl.java index fd69cea1..b1e8cbd9 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/DataSync/service/impl/DataSyncServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/DataSync/service/impl/DataSyncServiceImpl.java @@ -47,89 +47,93 @@ public class DataSyncServiceImpl implements IDataSyncService { try{ SyncUserService syncUserService = new SyncUserService(); List res = syncUserService.syncFotonUser(); - //存放岗位信息 - Map positionMap = new HashMap<>(); - TsPosition position = new TsPosition(); - position.setCurrent(1); - position.setPageSize(100000); - IPage iPage = tsPositionService.getPosition(position); - List positions=iPage.getRecords(); - if (!positions.isEmpty()) { - positions.forEach(tsPosition -> { - positionMap.put(tsPosition.getName(), tsPosition.getId()); - }); - } - List addUserList = new ArrayList<>(); - List upUserList = new ArrayList<>(); - for (String s : res) { - JSONObject userData = JSONObject.parseObject(s); - if(userData.containsKey("results")){ - JSONArray jsonArray = userData.getJSONArray("results"); - jsonArray.forEach(object -> { - JSONObject jsonObject = JSONObject.parseObject(object.toString()); - String userid = jsonObject.getString("userid"); - TsUser userEO = tsUserService.getById(userid); - String userState = ""; - if(userEO != null){ - userState = "UPDATE"; - }else{ - userState = "ADD"; - userEO = new TsUser(); - } - //先获取岗位以及岗位id - //设置岗位 - if (null != jsonObject.getString("title")) { - //通过岗位名称查询系统表中是否有岗位,有则设定用户的岗位为系统中的岗位,否则新增 - if (null == positionMap.get(jsonObject.getString("title"))) { - TsPosition tsPosition = new TsPosition(); - tsPosition.setId(String.valueOf(UUID.randomUUID())); - tsPosition.setName(jsonObject.getString("title")); - tsPositionService.addPosition(tsPosition); - //放入岗位的map集合中 - positionMap.put(tsPosition.getName(), tsPosition.getId()); - //放入类中 - userEO.setPositionName(tsPosition.getName()); - userEO.setPositionId(tsPosition.getId()); - } else { - userEO.setPositionName(jsonObject.getString("title").trim()); - userEO.setPositionId(positionMap.get(jsonObject.getString("title").trim())); - } - }else{ - userEO.setPositionId(null); - userEO.setPositionName(null); - } - //设置其他数据 - Timestamp createTime = new Timestamp(new Date().getTime()); - userEO.setState(jsonObject.getString("userStatus")); - userEO.setUname(null!=jsonObject.getString("name")?jsonObject.getString("name"):""); - userEO.setCreationTime(createTime); - userEO.setUserId(jsonObject.getString("userid")); - userEO.setAccount(jsonObject.getString("userid")); - userEO.setInstitutionId(null!=jsonObject.getString("orgNumber")?jsonObject.getString("orgNumber"):"" ); - userEO.setInstitutionName(null!=jsonObject.getString("orgName")?jsonObject.getString("orgName"):"" ); - //2022-05-23:用户同步增加状态标识,将停用的用户过滤掉 - if("1".equals(jsonObject.getString("userStatus"))){ - userEO.setValidFlag(ValidFlagEnum.VALID_TRUE.getValue()+""); - userEO.setDisableFlag(ValidFlagEnum.VALID_TRUE.getValue()+""); - }else{ - userEO.setValidFlag(ValidFlagEnum.VALID_FALSE.getValue()+""); - userEO.setDisableFlag(ValidFlagEnum.VALID_FALSE.getValue()+""); - } - if("ADD".equals(userState)){ - addUserList.add(userEO); - }else { - upUserList.add(userEO); - } + if(res!=null && !res.isEmpty()){ + //存放岗位信息 + Map positionMap = new HashMap<>(); + TsPosition position = new TsPosition(); + position.setCurrent(1); + position.setPageSize(100000); + IPage iPage = tsPositionService.getPosition(position); + List positions=iPage.getRecords(); + if (!positions.isEmpty()) { + positions.forEach(tsPosition -> { + positionMap.put(tsPosition.getName(), tsPosition.getId()); }); } - } - if(!addUserList.isEmpty()){ - logger.debug("本次新增的用户为:"+JSONObject.toJSONString(addUserList)); - tsUserService.saveBatch(addUserList); - } - if(!upUserList.isEmpty()){ - logger.debug("本次更新的用户为:"+JSONObject.toJSONString(upUserList)); - tsUserService.updateBatchById(upUserList); + List addUserList = new ArrayList<>(); + List upUserList = new ArrayList<>(); + for (String s : res) { + JSONObject userData = JSONObject.parseObject(s); + if(userData.containsKey("results")){ + JSONArray jsonArray = userData.getJSONArray("results"); + jsonArray.forEach(object -> { + JSONObject jsonObject = JSONObject.parseObject(object.toString()); + String userid = jsonObject.getString("userid"); + TsUser userEO = tsUserService.getById(userid); + String userState = ""; + if(userEO != null){ + userState = "UPDATE"; + }else{ + userState = "ADD"; + userEO = new TsUser(); + } + //先获取岗位以及岗位id + //设置岗位 + if (null != jsonObject.getString("title")) { + //通过岗位名称查询系统表中是否有岗位,有则设定用户的岗位为系统中的岗位,否则新增 + if (null == positionMap.get(jsonObject.getString("title"))) { + TsPosition tsPosition = new TsPosition(); + tsPosition.setId(String.valueOf(UUID.randomUUID())); + tsPosition.setName(jsonObject.getString("title")); + tsPositionService.addPosition(tsPosition); + //放入岗位的map集合中 + positionMap.put(tsPosition.getName(), tsPosition.getId()); + //放入类中 + userEO.setPositionName(tsPosition.getName()); + userEO.setPositionId(tsPosition.getId()); + } else { + userEO.setPositionName(jsonObject.getString("title").trim()); + userEO.setPositionId(positionMap.get(jsonObject.getString("title").trim())); + } + }else{ + userEO.setPositionId(null); + userEO.setPositionName(null); + } + //设置其他数据 + Timestamp createTime = new Timestamp(new Date().getTime()); + userEO.setState(jsonObject.getString("userStatus")); + userEO.setUname(null!=jsonObject.getString("name")?jsonObject.getString("name"):""); + userEO.setCreationTime(createTime); + userEO.setUserId(jsonObject.getString("userid")); + userEO.setAccount(jsonObject.getString("userid")); + userEO.setInstitutionId(null!=jsonObject.getString("orgNumber")?jsonObject.getString("orgNumber"):"" ); + userEO.setInstitutionName(null!=jsonObject.getString("orgName")?jsonObject.getString("orgName"):"" ); + //2022-05-23:用户同步增加状态标识,将停用的用户过滤掉 + if("1".equals(jsonObject.getString("userStatus"))){ + userEO.setValidFlag(ValidFlagEnum.VALID_TRUE.getValue()+""); + userEO.setDisableFlag(ValidFlagEnum.VALID_TRUE.getValue()+""); + }else{ + userEO.setValidFlag(ValidFlagEnum.VALID_FALSE.getValue()+""); + userEO.setDisableFlag(ValidFlagEnum.VALID_FALSE.getValue()+""); + } + if("ADD".equals(userState)){ + addUserList.add(userEO); + }else { + upUserList.add(userEO); + } + }); + } + } + if(!addUserList.isEmpty()){ + logger.debug("本次新增的用户为:"+JSONObject.toJSONString(addUserList)); + tsUserService.saveBatch(addUserList); + } + if(!upUserList.isEmpty()){ + logger.debug("本次更新的用户为:"+JSONObject.toJSONString(upUserList)); + tsUserService.updateBatchById(upUserList); + } + }else{ + logger.info("本次获取用户的数据为空,原因有2种:1、没有同步数据 2、请求接口报错"); } }catch(Exception e){ logger.error(e.getMessage(),e); @@ -145,68 +149,72 @@ public class DataSyncServiceImpl implements IDataSyncService { try{ SyncUserService syncUserService = new SyncUserService(); List res = syncUserService.syncFotonOrg(); - //获取到所有用户数据 - List strings=new ArrayList<>(); - //tsInstitutionService.clearData(); - for (String s : res) { - JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results")); - jsonArray.forEach(object -> { - JSONObject jsonObject = JSONObject.parseObject(object.toString()); - strings.add(jsonObject.getString("parentOrgNumber")); - }); - } - List allTsInstitutionList = tsInstitutionService.list(); - List addTsInstitutionList = new ArrayList<>(); - List updateTsInstitutionList = new ArrayList<>(); - List delTsInstitutionList = new ArrayList<>(); - Set syncAllIdList = new HashSet<>(); - for (String s : res) { - JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results")); - if(jsonArray!=null){ + if(res!=null && !res.isEmpty()){ + //获取到所有用户数据 + List strings=new ArrayList<>(); + //tsInstitutionService.clearData(); + for (String s : res) { + JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results")); jsonArray.forEach(object -> { JSONObject jsonObject = JSONObject.parseObject(object.toString()); - TsInstitution tsInstitution=new TsInstitution(); - tsInstitution.setId(jsonObject.getString("orgNumber")); - tsInstitution.setName(jsonObject.getString("orgName")); - tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0"); - tsInstitution.setParentId(jsonObject.getString("parentOrgNumber")); - //部门为"null"的数据不保存 - if (!"null".equals(jsonObject.getString("orgName"))){ - TsInstitution institution = tsInstitutionService.getById(tsInstitution.getId()); - if(institution!=null){ - updateTsInstitutionList.add(tsInstitution); - }else{ - addTsInstitutionList.add(tsInstitution); - } - syncAllIdList.add(tsInstitution.getId()); - } + strings.add(jsonObject.getString("parentOrgNumber")); }); } - } - //遍历出来需要删除的数据 - for(TsInstitution data :allTsInstitutionList){ - if(!syncAllIdList.contains(data.getId())){ - delTsInstitutionList.add(data); + List allTsInstitutionList = tsInstitutionService.list(); + List addTsInstitutionList = new ArrayList<>(); + List updateTsInstitutionList = new ArrayList<>(); + List delTsInstitutionList = new ArrayList<>(); + Set syncAllIdList = new HashSet<>(); + for (String s : res) { + JSONArray jsonArray = JSONArray.parseArray(JSONObject.parseObject(s.toString()).getString("results")); + if(jsonArray!=null){ + jsonArray.forEach(object -> { + JSONObject jsonObject = JSONObject.parseObject(object.toString()); + TsInstitution tsInstitution=new TsInstitution(); + tsInstitution.setId(jsonObject.getString("orgNumber")); + tsInstitution.setName(jsonObject.getString("orgName")); + tsInstitution.setHasChild(strings.contains(jsonObject.getString("orgNumber"))?"1":"0"); + tsInstitution.setParentId(jsonObject.getString("parentOrgNumber")); + //部门为"null"的数据不保存 + if (!"null".equals(jsonObject.getString("orgName"))){ + TsInstitution institution = tsInstitutionService.getById(tsInstitution.getId()); + if(institution!=null){ + updateTsInstitutionList.add(tsInstitution); + }else{ + addTsInstitutionList.add(tsInstitution); + } + syncAllIdList.add(tsInstitution.getId()); + } + }); + } } - } - //需要新增的数据 - if(!addTsInstitutionList.isEmpty()){ - logger.debug("本次新增的组织机构为:"+JSONObject.toJSONString(addTsInstitutionList)); - tsInstitutionService.saveBatch(addTsInstitutionList); - } - //需要更新的数据 - if(!updateTsInstitutionList.isEmpty()){ - logger.debug("本次更新的组织机构为:"+JSONObject.toJSONString(updateTsInstitutionList)); - tsInstitutionService.updateBatchById(updateTsInstitutionList); - } - //需要删除的数据 - if(!delTsInstitutionList.isEmpty()){ - logger.debug("本次删除的组织机构为:"+JSONObject.toJSONString(delTsInstitutionList)); - List delIdList = new ArrayList<>(); - for(TsInstitution data : delTsInstitutionList){ - delIdList.add(data.getId()); + //遍历出来需要删除的数据 + for(TsInstitution data :allTsInstitutionList){ + if(!syncAllIdList.contains(data.getId())){ + delTsInstitutionList.add(data); + } } - tsInstitutionService.removeByIds(delIdList); + //需要新增的数据 + if(!addTsInstitutionList.isEmpty()){ + logger.debug("本次新增的组织机构为:"+JSONObject.toJSONString(addTsInstitutionList)); + tsInstitutionService.saveBatch(addTsInstitutionList); + } + //需要更新的数据 + if(!updateTsInstitutionList.isEmpty()){ + logger.debug("本次更新的组织机构为:"+JSONObject.toJSONString(updateTsInstitutionList)); + tsInstitutionService.updateBatchById(updateTsInstitutionList); + } + //需要删除的数据 + if(!delTsInstitutionList.isEmpty()){ + logger.debug("本次删除的组织机构为:"+JSONObject.toJSONString(delTsInstitutionList)); + List delIdList = new ArrayList<>(); + for(TsInstitution data : delTsInstitutionList){ + delIdList.add(data.getId()); + } + tsInstitutionService.removeByIds(delIdList); + } + }else{ + logger.info("本次获取组织机构的数据为空,原因有2种:1、没有同步数据 2、请求接口报错"); } }catch(Exception e){ logger.error(e.getMessage(),e); diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/ISarBussionessStandService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/ISarBussionessStandService.java index 516cca3f..1ab4392a 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/ISarBussionessStandService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/ISarBussionessStandService.java @@ -2,6 +2,7 @@ package com.adc.da.slrs.sarBussionessStand.service; import com.adc.da.http.ResponseMessage; import com.adc.da.search.entity.SarBussionessStandEO; +import com.adc.da.slrs.sarBussStandFile.entity.SarBussStandFile; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStand; import com.adc.da.slrs.sarBussionessStand.entity.SarBussionessStandExport; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; @@ -46,5 +47,7 @@ public interface ISarBussionessStandService extends IService boolean checkIsShow(SarBussionessStandEOPage page) throws Exception; List getSarBussionStandPageQd(SarBussionessStandEOPage page) throws Exception; + + void convertDocAllQB(List list); } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java index 1aa28ad0..d7b3b633 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarBussionessStand/service/impl/SarBussionessStandServiceImpl.java @@ -42,6 +42,7 @@ import com.adc.da.slrs.sarMenuStandard.service.ISarMenuStandardNewService; import com.adc.da.slrs.sarResource.entity.TsResource; import com.adc.da.slrs.sarResource.service.ITsResourceService; import com.adc.da.slrs.sarStandAttrInfo.dao.SarStandAttrInfoDao; +import com.adc.da.slrs.sarStandFile.entity.SarStandFile; import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao; import com.adc.da.slrs.sarStandardsInfo.entity.SarAdvanceSearchVO; import com.adc.da.slrs.sarStandardsInfo.entity.SarBussionessStandEOPage; @@ -299,7 +300,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl fileMap) throws Exception { + public void createStandFile (String standId,Map fileMap,boolean upFlag) throws Exception { if (fileMap != null && fileMap.size() > 0) { List standFileList = new ArrayList<>(); for (Map.Entry entry : fileMap.entrySet()) { @@ -1094,7 +1095,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl fileList = attFileEOService.getMultiFileInfos(value); if (fileList != null && !fileList.isEmpty()) { - createStandFileAppend(standId,field,fileList,standFileList); + createStandFileAppend(standId,field,fileList,standFileList,upFlag); } } } @@ -1104,8 +1105,20 @@ public class SarBussionessStandServiceImpl extends ServiceImpl fileList,List standFileList) throws Exception { + public void createStandFileAppend (String standId,String field,List fileList,List standFileList,boolean upFlag) throws Exception { for (AttFileEO fileInfo : fileList) { + //TODO 20220727 此处为兼容老系统数据 将编辑去掉了先删除再添加的操作 + if(upFlag){ + QueryWrapper fileQueryWrapper = new QueryWrapper<>(); + fileQueryWrapper.eq("STAND_ID",standId); + fileQueryWrapper.eq("VALID_FLAG",0); + fileQueryWrapper.eq("USE_MODEL","SOURCE_FILE"); + fileQueryWrapper.eq("ATT_ID",fileInfo.getId()); + int fileExist = sarBussStandFileEODao.selectCount(fileQueryWrapper); + if(fileExist>0){ + continue; + } + } SarBussStandFile sarStandFileEO = new SarBussStandFile(); sarStandFileEO.setCreationUser(LoginUserUtil.getUserId()); sarStandFileEO.setCreationTime(new Date()); @@ -1737,4 +1750,21 @@ public class SarBussionessStandServiceImpl extends ServiceImpl queryByList(SarBussionessStandEOPage sarBussionessStandEOPage){ return this.baseMapper.queryByList(sarBussionessStandEOPage); } + + @Override + public void convertDocAllQB(List list) { + try{ + for(SarBussStandFile sarStandFile : list){ + logger.error("QB++++++++++++++++:" + sarStandFile.getStandId()); + AttFileEO temp = attFileEOService.getFileInfo(sarStandFile.getAttId()); + createStandFileAppend(sarStandFile.getStandId(), sarStandFile.getStandFileClassify(), Arrays.asList(temp), new ArrayList<>(),true); + sarStandFile.setPassword("1"); + sarBussStandFileEODao.updateById(sarStandFile); + } + }catch(Exception e){ + logger.error(e.getMessage(),e); + } + } + + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/controller/SarMenuStandardNewController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/controller/SarMenuStandardNewController.java index d80b4e3c..633e8b51 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/controller/SarMenuStandardNewController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/controller/SarMenuStandardNewController.java @@ -35,6 +35,13 @@ public class SarMenuStandardNewController extends BaseController getTopMenu(SarMenuStandardNew sarMenuStandardNew){ + String tsResources= iSarMenuStandardNewService.getTopMenu(sarMenuStandardNew); + return Result.success(tsResources); + } + @ApiOperation("查询有权限资源") @GetMapping("/getListStandLimit") public ResponseMessage> getListStandLimit(SarMenuStandardNew sarMenuStandardNew){ diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/ISarMenuStandardNewService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/ISarMenuStandardNewService.java index f4fd3b16..8dec3378 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/ISarMenuStandardNewService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/ISarMenuStandardNewService.java @@ -19,5 +19,7 @@ public interface ISarMenuStandardNewService extends IService List getListStandLimit(SarMenuStandardNew sarMenuStandardNew, List access); + String getTopMenu(SarMenuStandardNew sarMenuStandardNew); + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/impl/SarMenuStandardNewServiceNewImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/impl/SarMenuStandardNewServiceNewImpl.java index 5b0b48f6..aab8a4a5 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/impl/SarMenuStandardNewServiceNewImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarMenuStandard/service/impl/SarMenuStandardNewServiceNewImpl.java @@ -7,10 +7,12 @@ import com.adc.da.sys.sarMenuStandard.dao.SarMenuStandardDao; import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -30,6 +32,36 @@ public class SarMenuStandardNewServiceNewImpl extends ServiceImpl list = dao.selectList(qw); + if(!list.isEmpty()){ + if(StringUtils.isNotBlank(list.get(0).getParentIds())){ + List topIdList = Arrays.stream(list.get(0).getParentIds().split(",")).map(String::trim).collect(Collectors.toList()); + QueryWrapper wrapper = new QueryWrapper(); + wrapper.in("ID",topIdList); + List topList = dao.selectTopList(wrapper,list.get(0).getParentIds()); + List filterList = topList.stream().map(SarMenuStandard::getMenuName).collect(Collectors.toList()); + if(!filterList.isEmpty()){ + return StringUtils.join(filterList, "/")+'/'+list.get(0).getMenuName(); + } + }else { + return list.get(0).getMenuName(); + } + + } + + + return ""; + } /** * 查询有权限菜单 diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java index 975fed7d..15a9d592 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java @@ -50,7 +50,9 @@ public class SarStandardComplianceAssessResultController { @ApiOperation(value = "条件查询标准清单") @GetMapping("/standard") public ResponseMessage selectStandard(SarStandardsInfoEO eo) throws Exception { - eo.setStandNumber(eo.getStandNumber().replace(" ","  ")); + if(StringUtils.isNotBlank(eo.getStandNumber())){ + eo.setStandNumber(eo.getStandNumber().replace(" ","  ")); + } if (eo.getStandApplicationType() == 1) { QueryWrapper queryWrapper = new QueryWrapper<>(); IPage iPage = new Page<>(eo.getCurrent(), eo.getSize()); diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/controller/SarStandardsInfoController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/controller/SarStandardsInfoController.java index 7c44c8c9..df295625 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/controller/SarStandardsInfoController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/controller/SarStandardsInfoController.java @@ -895,7 +895,7 @@ public class SarStandardsInfoController extends BaseController } List list = sarBussStandFileService.list(qw); logger.error("doc轉換共多少:"+list.size()); - sarStandardsInfoEOService.convertDocAllQB(list); + iSarBussionessStandService.convertDocAllQB(list); return "1"; } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/ISarStandardsInfoService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/ISarStandardsInfoService.java index 55985183..f8cdc983 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/ISarStandardsInfoService.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/ISarStandardsInfoService.java @@ -69,5 +69,5 @@ public interface ISarStandardsInfoService extends IService { void convertDocAll(List list); - void convertDocAllQB(List list); + } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java index 3dac3652..1cbb819b 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardsInfo/service/impl/SarStandardsInfoServiceImpl.java @@ -530,36 +530,17 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl()); + createStandFileAppend(sarStandFile.getStandId(), sarStandFile.getStandFileClassify(), Arrays.asList(temp), new ArrayList<>(),true); sarStandFile.setPassword("1"); sarStandFileService.updateById(sarStandFile); } }catch(Exception e){ - e.printStackTrace(); + logger.error(e.getMessage(),e); } } @Autowired private ISarStandFileService sarStandFileService; - @Autowired - private ISarBussStandFileService sarBussStandFileService; - - @Override - public void convertDocAllQB(List list) { - try{ - for(SarBussStandFile sarStandFile : list){ - logger.error("QB++++++++++++++++:" + sarStandFile.getStandId()); - AttFileEO attFileEO = new AttFileEO(); - attFileEO.setId(sarStandFile.getAttId()); - AttFileEO temp = attFileEODao.selectFileInfoById(attFileEO); - createStandFileAppend(sarStandFile.getStandId(), sarStandFile.getStandFileClassify(), Arrays.asList(temp), new ArrayList<>()); - sarStandFile.setPassword("1"); - sarBussStandFileService.updateById(sarStandFile); - } - }catch(Exception e){ - e.printStackTrace(); - } - } private String convertStandCodeHandle(String standCode) { if (StringUtils.isNotBlank(standCode)) { @@ -1248,7 +1229,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl fileMap) throws Exception { + public void createStandFile(String standId, Map fileMap,boolean upFlag) throws Exception { if (fileMap != null && fileMap.size() > 0) { List standFileList = new ArrayList<>(); List fileList = new ArrayList<>(); @@ -1427,7 +1408,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl fileList, List standFileList) throws Exception { + public void createStandFileAppend(String standId, String field, List fileList, List standFileList,boolean upFlag) throws Exception { for (AttFileEO fileInfo : fileList) { + //TODO 20220727 此处为兼容老系统数据 将编辑去掉了先删除再添加的操作 + if(upFlag){ + QueryWrapper fileQueryWrapper = new QueryWrapper<>(); + fileQueryWrapper.eq("STAND_ID",standId); + fileQueryWrapper.eq("VALID_FLAG","0"); + fileQueryWrapper.eq("USE_MODEL","SOURCE_FILE"); + fileQueryWrapper.eq("ATT_ID",fileInfo.getId()); + int fileExist = sarStandFileService.count(fileQueryWrapper); + if(fileExist>0){ + continue; + } + } SarStandFile sarStandFileEO = new SarStandFile(); sarStandFileEO.setCreationUser(LoginUserUtil.getUserId()); sarStandFileEO.setCreationTime(new Date()); @@ -1909,8 +1902,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl @@ -11,6 +17,19 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; * @author super_liu * @since 2021-07-07 */ +@Repository public interface SarMenuStandardDao extends BaseMapper { + String updateStateScheduledSql = "SELECT " + + "ID,DISPLAY_SEQ,SOR_DIVIDE,CREATION_TIME,VALID_FLAG,PARENT_IDS,MENU_NAME,DIC_ID,PARENT_ID,MODIFY_TIME,HREF,REMARKS " + + "FROM sar_menu_standard ${ew.customSqlSegment} order by find_in_set(ID,#{topIds})"; + + /** + * 自动更新文本状态通用查询 + * @param queryWrapper + * @return + */ + @Select(updateStateScheduledSql) + List selectTopList(@Param("ew") QueryWrapper queryWrapper,@Param("topIds") String topIds); + } diff --git a/doc/sql/20220726_数据库字段内容修改.SQL b/doc/sql/20220726_数据库字段内容修改.SQL new file mode 100644 index 00000000..c8edcd27 --- /dev/null +++ b/doc/sql/20220726_数据库字段内容修改.SQL @@ -0,0 +1,2 @@ +UPDATE `ts_resource` SET `SOR_DIVIDE` = 'FOREIGN_STAND', `MENU_NAME` = '海外标准', `PARENT_ID` = NULL, `PARENT_IDS` = NULL, `DISPLAY_SEQ` = 2, `VALID_FLAG` = 0, `CREATION_TIME` = NULL, `MODIFY_TIME` = NULL, `REMARKS` = NULL WHERE `ID` = '2'; +UPDATE `sar_stand_attr_details` SET `ATTR_FIELD` = 'FBGBJBD', `ATTR_NAME` = '发布稿(原文)', `ATTR_TYPE` = 'FILE', `ATTR_LEN` = 500, `ORDER_NUM` = 4, `IS_EDIT` = '1', `CREATION_USER` = 'WY8J26MH23', `VALID_FLAG` = '0', `CREATION_TIME` = '2020-10-22 16:00:00', `MODIFY_TIME` = '2021-12-17 05:26:10', `IS_MUST` = '1', `IS_SHOW_IMP` = '0', `SHOW_REGION_ID` = 'L378EYP5HL28KE7NSZ68', `SEL_VAL` = NULL, `SAR_TYPE` = 'STAND', `IS_SEARCH` = '1', `IS_WARN` = '1', `IS_JANSUO` = NULL WHERE `ID` = '5BDBGYXS442QCTY43AHB'; diff --git a/doc/sql/20220727_权限增加关联条款按钮.sql b/doc/sql/20220727_权限增加关联条款按钮.sql new file mode 100644 index 00000000..ba706045 --- /dev/null +++ b/doc/sql/20220727_权限增加关联条款按钮.sql @@ -0,0 +1,2 @@ +INSERT INTO `sar_menu`(`ID`, `SOR_DIVIDE`, `MENU_NAME`, `PARENT_ID`, `PARENT_IDS`, `LEVEL`, `DISPLAY_SEQ`, `HREF`, `VALID_FLAG`, `CREATION_TIME`, `MODIFY_TIME`, `REMARKS`) VALUES ('960a97045a6e47b0b8e33ebc347e5fd9', NULL, '关联条款', '18c1e5134ea0cf865e8960b26b81fd8c', NULL, 3, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `sar_menu`(`ID`, `SOR_DIVIDE`, `MENU_NAME`, `PARENT_ID`, `PARENT_IDS`, `LEVEL`, `DISPLAY_SEQ`, `HREF`, `VALID_FLAG`, `CREATION_TIME`, `MODIFY_TIME`, `REMARKS`) VALUES ('bd291146ac1e42c48968c5142ae55375', NULL, '关联条款', '3e3657498664beaa0dc1de1ecb3ae0da', NULL, 3, NULL, NULL, NULL, NULL, NULL, NULL);