Merge branch 'develop_master' into FOTON

This commit is contained in:
396572590@qq.com
2022-07-28 13:06:26 +08:00
16 changed files with 351 additions and 200 deletions
@@ -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{
@@ -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 "";
}
@@ -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<String> 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<String> 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<String> 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<String> 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("<span class='highlight-Es-class'>");
hiBuilder.postTags("</span>");
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);
@@ -47,89 +47,93 @@ public class DataSyncServiceImpl implements IDataSyncService {
try{
SyncUserService syncUserService = new SyncUserService();
List<String> res = syncUserService.syncFotonUser();
//存放岗位信息
Map<String, String> positionMap = new HashMap<>();
TsPosition position = new TsPosition();
position.setCurrent(1);
position.setPageSize(100000);
IPage<TsPosition> iPage = tsPositionService.getPosition(position);
List<TsPosition> positions=iPage.getRecords();
if (!positions.isEmpty()) {
positions.forEach(tsPosition -> {
positionMap.put(tsPosition.getName(), tsPosition.getId());
});
}
List<TsUser> addUserList = new ArrayList<>();
List<TsUser> 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<String, String> positionMap = new HashMap<>();
TsPosition position = new TsPosition();
position.setCurrent(1);
position.setPageSize(100000);
IPage<TsPosition> iPage = tsPositionService.getPosition(position);
List<TsPosition> 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<TsUser> addUserList = new ArrayList<>();
List<TsUser> 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<String> res = syncUserService.syncFotonOrg();
//获取到所有用户数据
List<String> 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<TsInstitution> allTsInstitutionList = tsInstitutionService.list();
List<TsInstitution> addTsInstitutionList = new ArrayList<>();
List<TsInstitution> updateTsInstitutionList = new ArrayList<>();
List<TsInstitution> delTsInstitutionList = new ArrayList<>();
Set<String> 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<String> 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<TsInstitution> allTsInstitutionList = tsInstitutionService.list();
List<TsInstitution> addTsInstitutionList = new ArrayList<>();
List<TsInstitution> updateTsInstitutionList = new ArrayList<>();
List<TsInstitution> delTsInstitutionList = new ArrayList<>();
Set<String> 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<String> 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<String> 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);
@@ -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<SarBussionessStand>
boolean checkIsShow(SarBussionessStandEOPage page) throws Exception;
List<SarBussionessStand> getSarBussionStandPageQd(SarBussionessStandEOPage page) throws Exception;
void convertDocAllQB(List<SarBussStandFile> list);
}
@@ -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<SarBussionessStan
// writeWarnings(sarBussionessStandEO);
// 处理属性表信息
if (StringUtils.isNotBlank(sarBussionessStandEO.getSarStandAttrEOStr())) {
createStandAttrInfo(sarBussionessStandEO);
createStandAttrInfo(sarBussionessStandEO,false);
}
// 增加关联事件
String sortName = sysInfoEOService.getDicNamesByCodes(sarBussionessStandEO.getStandSort(),"JKSADFH564S");
@@ -599,8 +600,8 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
sarBussStandValEODao.deleteDataByStandId(standId);
//删除文件详情表数据
sarBussStandFileEODao.deleteByStandId(standId);
// //删除文件详情表数据
// sarBussStandFileEODao.deleteByStandId(standId);
SarBussStandFile sarBussStandFileEO = new SarBussStandFile();
sarBussStandFileEO.setStandId(standId);
sarBussStandFileEO.setIdList(null);
@@ -615,7 +616,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
}
}
}
createStandAttrInfo(sarBussionessStandEO);
createStandAttrInfo(sarBussionessStandEO,true);
//修改收藏分享编号名称
updateCollectAndShare(sarBussionessStandEO);
@@ -989,7 +990,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
* @Param: [sarStandardsInfoEO]
* @Return: void
*/
public void createStandAttrInfo (SarBussionessStand sarBussionessStandEO) throws Exception {
public void createStandAttrInfo (SarBussionessStand sarBussionessStandEO,boolean upFlag) throws Exception {
String sarStandAttrEOStr = sarBussionessStandEO.getSarStandAttrEOStr();
String mustFields = FieldConvertUtil.mustFields;
String mustValues = FieldConvertUtil.mustValues(sarBussionessStandEO.getId());
@@ -1038,7 +1039,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
// 多选项处理
createStandVal(sarBussionessStandEO.getId(),selectionMap);
// 文件处理
createStandFile(sarBussionessStandEO.getId(),fileMap);
createStandFile(sarBussionessStandEO.getId(),fileMap,upFlag);
// 多时间处理
// createStandPutTime(sarBussionessStandEO.getId(),multiTimeMap);
}
@@ -1085,7 +1086,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
* @Param: [standId, fileMap]
* @Return: void
*/
public void createStandFile (String standId,Map<String,String> fileMap) throws Exception {
public void createStandFile (String standId,Map<String,String> fileMap,boolean upFlag) throws Exception {
if (fileMap != null && fileMap.size() > 0) {
List<SarBussStandFile> standFileList = new ArrayList<>();
for (Map.Entry<String,String> entry : fileMap.entrySet()) {
@@ -1094,7 +1095,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
if (StringUtils.isNotBlank(value)) {
List<AttFileEO> 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<SarBussionessStan
}
}
public void createStandFileAppend (String standId,String field,List<AttFileEO> fileList,List<SarBussStandFile> standFileList) throws Exception {
public void createStandFileAppend (String standId,String field,List<AttFileEO> fileList,List<SarBussStandFile> standFileList,boolean upFlag) throws Exception {
for (AttFileEO fileInfo : fileList) {
//TODO 20220727 此处为兼容老系统数据 将编辑去掉了先删除再添加的操作
if(upFlag){
QueryWrapper<SarBussStandFile> 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<SarBussionessStan
public List<SarBussionessStand> queryByList(SarBussionessStandEOPage sarBussionessStandEOPage){
return this.baseMapper.queryByList(sarBussionessStandEOPage);
}
@Override
public void convertDocAllQB(List<SarBussStandFile> 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);
}
}
}
@@ -35,6 +35,13 @@ public class SarMenuStandardNewController extends BaseController<SarMenuStandard
@Autowired
private ITsUserService tsUserService;
@ApiOperation("查询当前节点所有关联上级")
@GetMapping("/getTopMenu")
public ResponseMessage<String> getTopMenu(SarMenuStandardNew sarMenuStandardNew){
String tsResources= iSarMenuStandardNewService.getTopMenu(sarMenuStandardNew);
return Result.success(tsResources);
}
@ApiOperation("查询有权限资源")
@GetMapping("/getListStandLimit")
public ResponseMessage<List<SarMenuStandard>> getListStandLimit(SarMenuStandardNew sarMenuStandardNew){
@@ -19,5 +19,7 @@ public interface ISarMenuStandardNewService extends IService<SarMenuStandardNew>
List<SarMenuStandard> getListStandLimit(SarMenuStandardNew sarMenuStandardNew, List<String> access);
String getTopMenu(SarMenuStandardNew sarMenuStandardNew);
}
@@ -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<SarMenuStandar
private SarMenuStandardDao dao;
@Override
public String getTopMenu(SarMenuStandardNew sarMenuStandardNew){
QueryWrapper qw = new QueryWrapper();
if(StringUtils.isNotBlank(sarMenuStandardNew.getId())){
qw.eq("ID",sarMenuStandardNew.getId());
}
if(StringUtils.isNotBlank(sarMenuStandardNew.getMenuName())){
qw.eq("MENU_NAME",sarMenuStandardNew.getMenuName());
}
List<SarMenuStandard> list = dao.selectList(qw);
if(!list.isEmpty()){
if(StringUtils.isNotBlank(list.get(0).getParentIds())){
List<String> topIdList = Arrays.stream(list.get(0).getParentIds().split(",")).map(String::trim).collect(Collectors.toList());
QueryWrapper wrapper = new QueryWrapper();
wrapper.in("ID",topIdList);
List<SarMenuStandard> topList = dao.selectTopList(wrapper,list.get(0).getParentIds());
List<String> 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 "";
}
/**
* 查询有权限菜单
@@ -50,7 +50,9 @@ public class SarStandardComplianceAssessResultController {
@ApiOperation(value = "条件查询标准清单")
@GetMapping("/standard")
public ResponseMessage<Object> 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<SarStandardComplianceProductAssess> queryWrapper = new QueryWrapper<>();
IPage<SarStandardComplianceProductAssess> iPage = new Page<>(eo.getCurrent(), eo.getSize());
@@ -895,7 +895,7 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
}
List<SarBussStandFile> list = sarBussStandFileService.list(qw);
logger.error("doc轉換共多少:"+list.size());
sarStandardsInfoEOService.convertDocAllQB(list);
iSarBussionessStandService.convertDocAllQB(list);
return "1";
}
@@ -69,5 +69,5 @@ public interface ISarStandardsInfoService extends IService<SarStandardsInfo> {
void convertDocAll(List<SarStandFile> list);
void convertDocAllQB(List<SarBussStandFile> list);
}
@@ -530,36 +530,17 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
AttFileEO attFileEO = new AttFileEO();
attFileEO.setId(sarStandFile.getAttId());
AttFileEO temp = attFileEODao.selectFileInfoById(attFileEO);
createStandFileAppend(sarStandFile.getStandId(), sarStandFile.getStandFileClassify(), Arrays.asList(temp), new ArrayList<>());
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<SarBussStandFile> 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<SarStandardsInfoDao
// writeWarnings(sarStandardsInfoEO);
// 处理属性表信息
if (StringUtils.isNotBlank(sarStandardsInfoEO.getSarStandAttrEOStr())) {
createStandAttrInfo(sarStandardsInfoEO);
createStandAttrInfo(sarStandardsInfoEO,false);
}
// 根据引用标准修改其他被引用标准
@@ -1302,7 +1283,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
* @Param: [sarStandardsInfoEO]
* @Return: void
*/
public void createStandAttrInfo(SarStandardsInfo sarStandardsInfoEO) throws Exception {
public void createStandAttrInfo(SarStandardsInfo sarStandardsInfoEO,boolean upFlag) throws Exception {
String sarStandAttrEOStr = sarStandardsInfoEO.getSarStandAttrEOStr();
String mustFields = FieldConvertUtil.mustFields;
String mustValues = FieldConvertUtil.mustValues(sarStandardsInfoEO.getId());
@@ -1370,7 +1351,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
// 多选项处理
createStandVal(sarStandardsInfoEO.getId(), selectionMap);
// 文件处理
createStandFile(sarStandardsInfoEO.getId(), fileMap);
createStandFile(sarStandardsInfoEO.getId(), fileMap,upFlag);
// 多时间处理
createStandPutTime(sarStandardsInfoEO.getId(), multiTimeMap);
}
@@ -1417,7 +1398,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
* @Param: [standId, fileMap]
* @Return: void
*/
public void createStandFile(String standId, Map<String, String> fileMap) throws Exception {
public void createStandFile(String standId, Map<String, String> fileMap,boolean upFlag) throws Exception {
if (fileMap != null && fileMap.size() > 0) {
List<SarStandFile> standFileList = new ArrayList<>();
List<AttFileEO> fileList = new ArrayList<>();
@@ -1427,7 +1408,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
if (StringUtils.isNotBlank(value)) {
fileList = attFileEOService.getMultiFileInfos(value);
if (fileList != null && !fileList.isEmpty()) {
createStandFileAppend(standId, field, fileList, standFileList);
createStandFileAppend(standId, field, fileList, standFileList,upFlag);
}
}
}
@@ -1437,8 +1418,20 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
}
}
public void createStandFileAppend(String standId, String field, List<AttFileEO> fileList, List<SarStandFile> standFileList) throws Exception {
public void createStandFileAppend(String standId, String field, List<AttFileEO> fileList, List<SarStandFile> standFileList,boolean upFlag) throws Exception {
for (AttFileEO fileInfo : fileList) {
//TODO 20220727 此处为兼容老系统数据 将编辑去掉了先删除再添加的操作
if(upFlag){
QueryWrapper<SarStandFile> 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<SarStandardsInfoDao
int result = dao.updateById(sarStandardsInfoEO);
//先删除标准关联表,然后插入数据
sarStandValEODao.deleteDataByStandid(standId);
//删除文件详情表数据
sarStandFileEODao.deleteByStandId(standId);
// //删除文件详情表数据
// sarStandFileEODao.deleteByStandId(standId);
SarStandFile sarStandFileEO = new SarStandFile();
sarStandFileEO.setStandId(sarStandardsInfoEO.getId());
Map map = (Map) JSONObject.fromObject(sarStandardsInfoEO.getSarStandAttrEOStr());
@@ -1929,7 +1922,7 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
sarStandPutTimeEODao.deleteByStandId(standId);
// 修改属性表数据
sarStandAttrInfoEODao.deleteStandAttrByStandId(standId);
createStandAttrInfo(sarStandardsInfoEO);
createStandAttrInfo(sarStandardsInfoEO,true);
/**
* 编辑体系目录 当代替的标准号在我的收藏中时,此条标准也需要在我的收藏中
*/
@@ -1,7 +1,13 @@
package com.adc.da.sys.sarMenuStandard.dao;
import com.adc.da.sys.sarMenuStandard.entity.SarMenuStandard;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
@@ -11,6 +17,19 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author super_liu
* @since 2021-07-07
*/
@Repository
public interface SarMenuStandardDao extends BaseMapper<SarMenuStandard> {
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<SarMenuStandard> selectTopList(@Param("ew") QueryWrapper queryWrapper,@Param("topIds") String topIds);
}
@@ -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';
@@ -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);