能力上架审核被拒绝时,能力状态不正确的bug fix

This commit is contained in:
wangliwen 2022-07-25 10:20:08 +08:00
parent afaa8cb26c
commit 0b2844e246
3 changed files with 46 additions and 24 deletions

View File

@ -32,10 +32,18 @@ public enum ResourceEntityDelFlag {
* 已下架
*/
UNDERCARRIAGE(5, "已下架"),
/**
* 上架被拒绝
*/
REJECT_REVIEW(6, "上架被拒绝"),
/**
* 其他
*/
OTHER(9, "其他"),
/**
* 未知
*/

View File

@ -15,7 +15,6 @@ import io.renren.common.domain.Tsingtao_xhaProperties;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.DateUtils;
import io.renren.common.utils.Result;
import io.renren.modules.monitor.dto.CameraChannelDto1;
import io.renren.modules.monitor.entity.CameraChannel;
import io.renren.modules.monitor.mapper.CameraChannelMapper;
@ -499,11 +498,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPageCount(resourceDTO));
} else {
logger.info("orderField:{} orderType:{}", orderField, orderType);
logger.info("排序要求 orderField:{} orderType:{}", orderField, orderType);
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
if (resourceDTOS.isEmpty()) {
resultPage.setRecords(null);
resultPage.setRecords(new ArrayList<>());
resultPage.setTotal(0);
} else {
List<ResourceDTO> recordLists = resourceDTOS.stream()
@ -971,10 +970,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (maxTypeCount[0] > 0) {
maxdeptMap.put("typeName", maxTypeString[0]);
if ("基础设施".equals(maxTypeString[0])) {
List <Map> resourceList = new ArrayList<>();
List<Map> resourceList = new ArrayList<>();
Map<String, Object> infrastructureList = (Map<String, Object>) this.selectInfrastructureList();
infrastructureList.forEach((k,v) -> {
resourceList.add(new HashMap(){{
infrastructureList.forEach((k, v) -> {
resourceList.add(new HashMap() {{
put("id", k + v + "");
put("name", k + v + "");
}});
@ -986,11 +985,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
dto.setPageSize(30);
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
if (factory.isPresent()) {
List <Map> resourceList = new ArrayList<>();
List<Map> resourceList = new ArrayList<>();
Map<String, Object> dataResource = (Map<String, Object>) factory.get().getDataResource(dto);
if (!dataResource.isEmpty()) {
List<Map<String, Object>> list = (List<Map<String, Object>>) dataResource.get("data");
list.forEach(map -> resourceList.add(new HashMap(){{
list.forEach(map -> resourceList.add(new HashMap() {{
if (map.containsKey("zyname")) {
put("id", map.get("guid"));
put("name", map.get("zyname"));
@ -1002,7 +1001,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
maxdeptMap.put("resourceList", resourceList);
}
}else {
} else {
List<Map> resourceList = resourceDao.selectByType(maxTypeString[0]);
maxdeptMap.put("resourceList", resourceList);
}
@ -1066,10 +1065,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public Object selectResourceListByType(String type) {
if ("基础设施".equals(type)) {
List <Map> resourceList = new ArrayList<>();
List<Map> resourceList = new ArrayList<>();
Map<String, Object> infrastructureList = (Map<String, Object>) this.selectInfrastructureList();
infrastructureList.forEach((k,v) -> {
resourceList.add(new HashMap(){{
infrastructureList.forEach((k, v) -> {
resourceList.add(new HashMap() {{
put("id", k + v + "");
put("name", k + v + "");
}});
@ -1081,11 +1080,11 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
dto.setPageSize(30);
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
if (factory.isPresent()) {
List <Map> resourceList = new ArrayList<>();
List<Map> resourceList = new ArrayList<>();
Map<String, Object> dataResource = (Map<String, Object>) factory.get().getDataResource(dto);
if ( dataResource != null && !dataResource.isEmpty()) {
if (dataResource != null && !dataResource.isEmpty()) {
List<Map<String, Object>> list = (List<Map<String, Object>>) dataResource.get("data");
list.forEach(map -> resourceList.add(new HashMap(){{
list.forEach(map -> resourceList.add(new HashMap() {{
if (map.containsKey("zyname")) {
put("id", map.get("guid"));
put("name", map.get("zyname"));
@ -1099,7 +1098,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} else {
return new ArrayList<>();
}
}else {
} else {
return resourceDao.selectByType(type);
}
}

View File

@ -130,16 +130,31 @@ public class ResourceOwnerListener implements TaskListener, ExecutionListener, A
JsonElement jsonElement = gson.toJsonTree(kv);
TResourceMountApplyDTO resourceMountApplyDTO = gson.fromJson(jsonElement, TResourceMountApplyDTO.class);
ResourceDTO re = resourceService.get(resourceMountApplyDTO.getResourceId());
if (re != null) {
re.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
resourceService.update(re);
logger.error("审批通过资源id:" + re.getId());
try {
apiGatewayService.registerApi2Gateway(String.valueOf(re.getId())); // 发布到应用网关
} catch (Exception exception) {
logger.error("发布到应用网关", exception);
if (resourceMountApplyDTO != null) {
if (resourceMountApplyDTO.getReject() != null && resourceMountApplyDTO.getReject() == Boolean.TRUE) { // 存在被拒绝的节点
if (re != null) {
re.setDelFlag(ResourceEntityDelFlag.REJECT_REVIEW.getFlag());
resourceService.update(re);
logger.error("审批未通过资源id:" + re.getId());
}
return;
}
if (resourceMountApplyDTO.getReject() == null || resourceMountApplyDTO.getReject() != Boolean.TRUE) { // 都是同意
if (re != null) {
re.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
resourceService.update(re);
logger.error("审批通过资源id:" + re.getId());
try {
apiGatewayService.registerApi2Gateway(String.valueOf(re.getId())); // 发布到应用网关
} catch (Exception exception) {
logger.error("发布到应用网关", exception);
}
}
return;
}
}
}
/**