diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java index 32887e74..49f0ed7e 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/controller/TAbilityApplicationController.java @@ -29,6 +29,7 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; @@ -82,6 +83,28 @@ public class TAbilityApplicationController { params.put("abilityprocess_v2", Boolean.TRUE); // 是否根据流程 abilityprocess_v2 来分页 params.put("user_id", user == null ? null : user.getId()); PageData page = tAbilityApplicationService.page(params); + List list = + page.getList().stream().map(index -> { + List dtos = + tAbilityApplicationService.getByInstanceId(index.getInstanceId()); + if (!dtos.isEmpty()) { + dtos.stream() + .limit(1l) + .forEach(dto -> { + BeanUtils.copyProperties(dto, index); + if (StringUtils.isNotEmpty(index.getCameraList())) { + if (dtos.size() > 1) { + index.setSystem("视频资源申请:(" + index.getSystem() + " 等" + dtos.size() + "个摄像头)"); + } else { + index.setSystem("视频资源申请:" + index.getSystem()); + } + return; + } + }); + } + return index; + }).collect(Collectors.toList()); + page.setList(list); return new Result>().ok(page); } @@ -139,7 +162,6 @@ public class TAbilityApplicationController { break; case TSINGTAO: { // 大数据局 camera = (List) resourceService.getApplyCameraList(Long.valueOf(tAbilityApplicationDTOList.get(0).getInstanceId())); -// camera = tAbilityApplicationDTOList.stream().filter(tAbilityApplicationDTO -> StringUtils.isNotEmpty(tAbilityApplicationDTO.getCameraList())).map(index_ -> jdbcTemplate.queryForObject("SELECT * FROM t_camera_channel WHERE idt_camera_channel = " + index_.getResourceId(), Map.class)).filter(index_ -> !index_.isEmpty()).collect(Collectors.toList()); } break; case BAOTOU: diff --git a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java index 9508fbd6..5af12153 100644 --- a/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/processForm/service/impl/TAbilityApplicationServiceImpl.java @@ -32,11 +32,11 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl null != params.get(index)).forEach(index -> { switch (index) { // case "abilityprocess_v2": - wrapper.select("DISTINCT apply_flag ,id ,`user` ,phone ,unit ,area ,system ,scene ,basis ,attachment ,instance_id ,user_id ,enclosure ,title ,application_system ,application_scene ,application_background ,effect_wish ,apply_number ,resource_owner_dept ,del_flag"); + wrapper.select("DISTINCT apply_flag ,instance_id"); wrapper.isNotNull(Boolean.valueOf(params.get("abilityprocess_v2").toString()), "apply_flag"); wrapper.isNotNull(Boolean.valueOf(params.get("abilityprocess_v2").toString()), "instance_id"); wrapper.groupBy(Boolean.valueOf(params.get("abilityprocess_v2").toString()), "apply_flag") - .groupBy("id"); + .groupBy("instance_id"); break; case "user_id": wrapper.eq(params.get("user_id") != null, "user_id", Long.valueOf(params.get("user_id").toString())); @@ -46,7 +46,7 @@ public class TAbilityApplicationServiceImpl extends CrudServiceImpl imp private final static int EXPIRE = 3600 * 12; @Override - @Cacheable(value = getByTokenKey, key = "#p1") + @Cacheable(value = getByTokenKey, key = "#p0") public TokenEntity getByToken(String token) { return baseDao.getByToken(token); }