npe
This commit is contained in:
parent
c7c5f52b1e
commit
85931f3e0e
|
@ -8,6 +8,8 @@ import io.renren.modules.activiti.dto.ProcessActivityDTO;
|
||||||
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
|
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
|
||||||
import io.renren.modules.activiti.service.ActHistoryService;
|
import io.renren.modules.activiti.service.ActHistoryService;
|
||||||
import io.renren.modules.activiti.service.ActivitiService;
|
import io.renren.modules.activiti.service.ActivitiService;
|
||||||
|
import io.renren.modules.demanData.dto.TDemandDataDTO;
|
||||||
|
import io.renren.modules.demanData.service.TDemandDataService;
|
||||||
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
|
||||||
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
import io.renren.modules.processForm.service.TAbilityApplicationService;
|
||||||
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
|
||||||
|
@ -50,6 +52,8 @@ public class HistoryController {
|
||||||
private TAbilityApplicationService abilityApplicationService;
|
private TAbilityApplicationService abilityApplicationService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TResourceMountApplyService tResourceMountApplyService;
|
private TResourceMountApplyService tResourceMountApplyService;
|
||||||
|
@Autowired
|
||||||
|
private TDemandDataService tDemandDataService;
|
||||||
|
|
||||||
@GetMapping("getInstImage")
|
@GetMapping("getInstImage")
|
||||||
@ApiOperation(value = "获取流程活动图", produces = "application/octet-stream")
|
@ApiOperation(value = "获取流程活动图", produces = "application/octet-stream")
|
||||||
|
@ -125,10 +129,13 @@ public class HistoryController {
|
||||||
TAbilityApplicationDTO abilityApplicationDTO =
|
TAbilityApplicationDTO abilityApplicationDTO =
|
||||||
abilityApplicationService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
abilityApplicationService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||||
TResourceMountApplyDTO tResourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
TResourceMountApplyDTO tResourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||||
|
TDemandDataDTO tDemandDataDTO = tDemandDataService.get(Long.valueOf(activityDTO.getBusinessKey()));
|
||||||
if (abilityApplicationDTO != null) {
|
if (abilityApplicationDTO != null) {
|
||||||
activityDTO.setResourceName(abilityApplicationDTO.getSystem());
|
activityDTO.setResourceName(abilityApplicationDTO.getSystem());
|
||||||
} else if (tResourceMountApplyDTO != null) {
|
} else if (tResourceMountApplyDTO != null) {
|
||||||
activityDTO.setResourceName(tResourceMountApplyDTO.getResourceDTO().getName());
|
activityDTO.setResourceName(tResourceMountApplyDTO.getResourceDTO().getName());
|
||||||
|
} else if (tDemandDataDTO != null) {
|
||||||
|
activityDTO.setResourceName(tDemandDataDTO.getDemandSubject());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Result().ok(page);
|
return new Result().ok(page);
|
||||||
|
|
|
@ -123,12 +123,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
@Override
|
@Override
|
||||||
public ResourceDTO selectWithAttrs(Long id) {
|
public ResourceDTO selectWithAttrs(Long id) {
|
||||||
Long userId = SecurityUser.getUser().getId();
|
Long userId = SecurityUser.getUser().getId();
|
||||||
ResourceDTO resourceDTO = resourceDao.selectDTOById(id, userId);
|
ResourceDTO resourceDTO = baseDao.selectDTOById(id, userId);
|
||||||
|
if (resourceDTO == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
QueryWrapper<AttrEntity> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("data_resource_id", id)
|
wrapper.eq("data_resource_id", id)
|
||||||
.eq("del_flag", 0);
|
.eq("del_flag", 0);
|
||||||
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
|
||||||
resourceDTO.setInfoList(attrEntities);
|
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
|
||||||
return resourceDTO;
|
return resourceDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,14 +146,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
String orderType = StringUtils.isBlank(jsonObject.getString("orderType")) ? "DESC" : jsonObject.getString("orderType");
|
String orderType = StringUtils.isBlank(jsonObject.getString("orderType")) ? "DESC" : jsonObject.getString("orderType");
|
||||||
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
|
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
|
||||||
if (resourceDTO.getInfoList().isEmpty()) {
|
if (resourceDTO.getInfoList().isEmpty()) {
|
||||||
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1)* pageSize, pageSize, orderField, orderType);
|
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
|
||||||
resourceDTOS.forEach(item -> {
|
resourceDTOS.forEach(item -> {
|
||||||
item.setInfoList(this.selectAttrsByResourceId(item.getId()));
|
item.setInfoList(this.selectAttrsByResourceId(item.getId()));
|
||||||
});
|
});
|
||||||
resultPage.setRecords(resourceDTOS);
|
resultPage.setRecords(resourceDTOS);
|
||||||
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 1, 100000, orderField, orderType).size());
|
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 1, 100000, orderField, orderType).size());
|
||||||
} else {
|
} else {
|
||||||
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO , orderField, orderType);
|
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
|
||||||
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
|
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
|
||||||
if (resourceDTOS.isEmpty()) {
|
if (resourceDTOS.isEmpty()) {
|
||||||
resultPage.setRecords(null);
|
resultPage.setRecords(null);
|
||||||
|
|
Loading…
Reference in New Issue