This commit is contained in:
wangliwen 2022-04-27 20:29:34 +08:00
parent c7c5f52b1e
commit 85931f3e0e
2 changed files with 14 additions and 4 deletions

View File

@ -8,6 +8,8 @@ import io.renren.modules.activiti.dto.ProcessActivityDTO;
import io.renren.modules.activiti.dto.ProcessInstanceDTO;
import io.renren.modules.activiti.service.ActHistoryService;
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.service.TAbilityApplicationService;
import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO;
@ -50,6 +52,8 @@ public class HistoryController {
private TAbilityApplicationService abilityApplicationService;
@Autowired
private TResourceMountApplyService tResourceMountApplyService;
@Autowired
private TDemandDataService tDemandDataService;
@GetMapping("getInstImage")
@ApiOperation(value = "获取流程活动图", produces = "application/octet-stream")
@ -125,10 +129,13 @@ public class HistoryController {
TAbilityApplicationDTO abilityApplicationDTO =
abilityApplicationService.get(Long.valueOf(activityDTO.getBusinessKey()));
TResourceMountApplyDTO tResourceMountApplyDTO = tResourceMountApplyService.get(Long.valueOf(activityDTO.getBusinessKey()));
TDemandDataDTO tDemandDataDTO = tDemandDataService.get(Long.valueOf(activityDTO.getBusinessKey()));
if (abilityApplicationDTO != null) {
activityDTO.setResourceName(abilityApplicationDTO.getSystem());
} else if (tResourceMountApplyDTO != null) {
activityDTO.setResourceName(tResourceMountApplyDTO.getResourceDTO().getName());
} else if (tDemandDataDTO != null) {
activityDTO.setResourceName(tDemandDataDTO.getDemandSubject());
}
}
return new Result().ok(page);

View File

@ -123,12 +123,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public ResourceDTO selectWithAttrs(Long id) {
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<>();
wrapper.eq("data_resource_id", id)
.eq("del_flag", 0);
List<AttrEntity> attrEntities = attrDao.selectList(wrapper);
resourceDTO.setInfoList(attrEntities);
resourceDTO.setInfoList(attrEntities == null ? new ArrayList<>() : attrEntities); // npe?
return resourceDTO;
}
@ -143,14 +146,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
String orderType = StringUtils.isBlank(jsonObject.getString("orderType")) ? "DESC" : jsonObject.getString("orderType");
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
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 -> {
item.setInfoList(this.selectAttrsByResourceId(item.getId()));
});
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 1, 100000, orderField, orderType).size());
} 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());
if (resourceDTOS.isEmpty()) {
resultPage.setRecords(null);