diff --git a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java index 2ccf3a58..1d417e6a 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java +++ b/renren-admin/src/main/java/io/renren/common/controller/AbilityCenterControllerV2.java @@ -213,7 +213,7 @@ public class AbilityCenterControllerV2 { tAbilityApplicationDTO.setEnclosureName(abilityBatchApplicationDTO.getEnclosureName()); tAbilityApplicationDTO.setCreateDate(new Date()); tAbilityApplicationDTO.setExpireDate(abilityBatchApplicationDTO.getExpireDate()); - tAbilityApplicationDTO.setResourceOwnerDept(sysDeptService.getByName(index.get("managementUnitName"))); + //tAbilityApplicationDTO.setResourceOwnerDept(sysDeptService.getByName(index.get("managementUnitName"))); // 归为同一次申请 @@ -233,7 +233,6 @@ public class AbilityCenterControllerV2 { }).filter(ObjectUtil::isNotNull).collect(Collectors.toList()); // 申请入库 if (!tAbilityApplicationDTOList.isEmpty()) { codeGenerationUtils.setApplyNumber("NLSY", tAbilityApplicationDTOList.stream().map(TAbilityApplicationDTO::getId).collect(Collectors.toList()), jdbcTemplate); - Map> temp = tAbilityApplicationDTOList.stream() .filter(Objects::nonNull) .filter(index -> StringUtils.isNotEmpty(index.getResourceId())) @@ -262,7 +261,7 @@ public class AbilityCenterControllerV2 { CompletableFuture.runAsync(() -> { String[] sqls = dtoList.stream().map(index -> String.format("UPDATE t_ability_application SET resource_owner_dept = '%s' WHERE id = %s", JSON.toJSONString(sysDeptDTO), index.getId())).collect(Collectors.toList()).toArray(new String[dtoList.size()]); - jdbcTemplate.batchUpdate(sqls); // 批量更新资源所属部门信息 + jdbcTemplate.batchUpdate(sqls);// 批量更新资源所属部门信息 logger.info("批量更新申请的资源的部门信息完成"); }, executor); diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessInstanceDTO.java b/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessInstanceDTO.java index a6320d0a..33313931 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessInstanceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/dto/ProcessInstanceDTO.java @@ -91,4 +91,14 @@ public class ProcessInstanceDTO { @ApiModelProperty(value = "申请单号") private String applyNumber; + + /** + * 催办功能增加字段 + */ + @ApiModelProperty(value = "该流程的节点当前是否允许催办") + private Boolean allowReminders; + @ApiModelProperty(value = "该流程的节点当前是否已经进行过催办") + private Boolean doneReminders; + @ApiModelProperty(value = "该流程的节点需几天后进行催办") + private Integer nextRemindersDays; } diff --git a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java index 381f95d9..d5b1df4a 100644 --- a/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java +++ b/renren-admin/src/main/java/io/renren/modules/activiti/service/ActHistoryService.java @@ -12,6 +12,7 @@ import io.renren.modules.demandComment.entity.TDemandCommentEntityDelFlag; import io.renren.modules.demandComment.service.TDemandCommentService; import io.renren.modules.processForm.dto.TAbilityApplicationDTO; import io.renren.modules.processForm.service.TAbilityApplicationService; +import io.renren.modules.reminders.service.TRemindersService; import io.renren.modules.resource.dto.ResourceDTO; import io.renren.modules.resource.service.ResourceService; import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; @@ -37,12 +38,15 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.imageio.ImageIO; import javax.servlet.http.HttpServletResponse; import java.awt.image.BufferedImage; import java.io.InputStream; +import java.time.LocalDate; +import java.time.temporal.ChronoUnit; import java.util.*; import java.util.stream.Collectors; @@ -92,6 +96,11 @@ public class ActHistoryService { @Autowired private ProcessEngine processEngine_; + @Autowired + private TRemindersService tRemindersService; + @Value("${reminders.interval:7}") // 流程发起后多少天允许催办 + private Integer interval; + public void getProcessInstanceDiagram(String processInstanceId, HttpServletResponse response) throws Exception { if (StringUtils.isEmpty(processInstanceId)) { @@ -375,10 +384,42 @@ public class ActHistoryService { .filter(Objects::nonNull) .filter(index -> null != index.getName() && index.getName().contains(params.get("name").toString())) .collect(Collectors.toList()); - List list2 = list1.stream().skip((Integer.parseInt(page) - 1) * Integer.parseInt(limit)).limit(Integer.parseInt(limit)).collect(Collectors.toList()); + List list2 = list1.stream().skip((Integer.parseInt(page) - 1) * Integer.parseInt(limit)) + .limit(Integer.parseInt(limit)).collect(Collectors.toList()); pageData.setTotal(list1.size()); pageData.setList(list2); } + /** + * 处理催办相关条件、数据 + */ + pageData.setList(pageData.getList().stream().map(index -> { + Optional nowTask = taskService.createTaskQuery().processInstanceId(index.getProcessInstanceId()) + .orderByTaskCreateTime().desc().active().list().stream().findFirst(); // 尝试获取当前task + if (nowTask.isPresent()) { // 存在正在进行的任务 + LocalDate localDate = tRemindersService.selectRemindersTime(nowTask.get().getId()); + if (localDate == null) {// 未进行过催办 + index.setAllowReminders(Boolean.TRUE); // 允许催办 + index.setDoneReminders(Boolean.FALSE); // 不存在催办记录 + index.setNextRemindersDays(0); // 距离下次催办天数为0 + } else { // 进行过催办 + long between = ChronoUnit.DAYS.between(localDate, LocalDate.now()); // 上次催办距离今天已过天数 + if (between <= interval) { // 间隔天数小于限制天数 + index.setAllowReminders(Boolean.FALSE); // 不允许催办 + index.setDoneReminders(Boolean.TRUE); // 存在催办记录 + index.setNextRemindersDays((int) (interval - between)); // 距离下次催办天数为0 + } else { + index.setAllowReminders(Boolean.TRUE); // 不允许催办 + index.setDoneReminders(Boolean.TRUE); // 存在催办记录 + index.setNextRemindersDays(0); // 距离下次催办天数为0 + } + } + } else { + index.setAllowReminders(Boolean.FALSE); + index.setDoneReminders(Boolean.FALSE); + index.setNextRemindersDays(0); + } + return index; + }).collect(Collectors.toList())); return pageData; } diff --git a/renren-admin/src/main/java/io/renren/modules/reminders/dao/TRemindersDao.java b/renren-admin/src/main/java/io/renren/modules/reminders/dao/TRemindersDao.java index b5ca7961..cba3fa9f 100644 --- a/renren-admin/src/main/java/io/renren/modules/reminders/dao/TRemindersDao.java +++ b/renren-admin/src/main/java/io/renren/modules/reminders/dao/TRemindersDao.java @@ -3,14 +3,24 @@ package io.renren.modules.reminders.dao; import io.renren.common.dao.BaseDao; import io.renren.modules.reminders.entity.TRemindersEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; /** -* 催办信息 -* -* @author wangliwen wangliwen@hisense.com -* @since 1.0 2022-11-30 -*/ + * 催办信息 + * + * @author wangliwen wangliwen@hisense.com + * @since 1.0 2022-11-30 + */ @Mapper public interface TRemindersDao extends BaseDao { - + /** + * 获取该任务的最新催办记录时间 + * + * @param taskId + * @return + */ + List selectRemindersTime(@Param("taskId") String taskId); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/reminders/service/TRemindersService.java b/renren-admin/src/main/java/io/renren/modules/reminders/service/TRemindersService.java index 6afd759d..44c2b0bb 100644 --- a/renren-admin/src/main/java/io/renren/modules/reminders/service/TRemindersService.java +++ b/renren-admin/src/main/java/io/renren/modules/reminders/service/TRemindersService.java @@ -4,6 +4,8 @@ import io.renren.common.service.CrudService; import io.renren.modules.reminders.dto.TRemindersDTO; import io.renren.modules.reminders.entity.TRemindersEntity; +import java.time.LocalDate; + /** * 催办信息 * @@ -11,5 +13,11 @@ import io.renren.modules.reminders.entity.TRemindersEntity; * @since 1.0 2022-11-30 */ public interface TRemindersService extends CrudService { - + /** + * 获取该任务最近一次催办日期 + * + * @param taskId + * @return + */ + LocalDate selectRemindersTime(String taskId); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java index 02d735b4..dec619f6 100644 --- a/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/reminders/service/impl/TRemindersServiceImpl.java @@ -24,6 +24,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.time.temporal.ChronoUnit; import java.util.Date; import java.util.List; import java.util.Map; @@ -89,6 +93,8 @@ public class TRemindersServiceImpl extends CrudServiceImpl kv = task.getProcessVariables(); + LocalDate taskCreateDate = task.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + long between = ChronoUnit.DAYS.between(taskCreateDate, LocalDate.now()); Boolean allowEntrust = Boolean.valueOf(kv.get("allowEntrust") != null ? kv.get("allowEntrust").toString() : Boolean.FALSE.toString()); // 允许被委托他人(特殊通知) final StringBuilder resourceName = new StringBuilder(); if (kv.containsKey("resourceDTO")) { @@ -112,18 +118,19 @@ public class TRemindersServiceImpl extends CrudServiceImpl + LocalDate.parse(index.get("reminders_time").toString(), formatter) + ).findFirst().orElse(null); + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java index 2b919cfb..3daf1549 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/service/impl/ResourceServiceImpl.java @@ -1953,19 +1953,63 @@ public class ResourceServiceImpl extends CrudServiceImpl resultMap = new HashMap<>(); //云资源 - CompletableFuture yzy = CompletableFuture.runAsync(() -> { - resultMap.put("云资源", resourceDao.selectYzyCount()); - }, executor); + CompletableFuture yzy = CompletableFuture.runAsync(() -> resultMap.put("云资源", resourceDao.selectYzyCount()), executor); //视频资源 - CompletableFuture jcss = CompletableFuture.runAsync(() -> { - - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("check_status", 1).ne("gps_x", "").ne("gps_y", "").isNotNull("gps_x").isNotNull("gps_y"); - resultMap.put("视频资源", cameraChannelMapper.selectCount(queryWrapper)); - - - }, executor); + switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + case TSINGTAO_XHA: { // 青岛西海岸 + CompletableFuture allAmount = CompletableFuture.supplyAsync(() -> { // 获取平台总基础设施数目 + List result = new CopyOnWriteArrayList<>(); + CompletableFuture cloud = CompletableFuture.runAsync(() -> { // 云脑专网 + String url = tsingtao_xhaProperties.getCamCount(); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) { + result.add(jsonObject.getLongValue("body")); + } + } else { + logger.error("青岛西海岸获取失败"); + } + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } + }, executor); + CompletableFuture local = CompletableFuture.runAsync(() -> { // 金宏网 + String url = tsingtao_xhaProperties.getLocalcam(); + logger.info(url); + Request request = new Request.Builder().url(url).build(); + try (Response response = client.newCall(request).execute()) { + if (response.isSuccessful()) { + JSONObject jsonObject = JSON.parseObject(response.body().string()); + if (jsonObject.containsKey("errorNo") && jsonObject.getLongValue("errorNo") == 200) { + result.add(jsonObject.getLongValue("body")); + } + } else { + logger.error("青岛西海岸获取失败"); + } + } catch (Exception exception) { + logger.error("青岛西海岸失败", exception); + } + }, executor); + CompletableFuture all = CompletableFuture.allOf(cloud, local); + all.join(); + return result.stream().filter(Objects::nonNull).findAny().orElse(0L); + }).thenAccept(sum -> resultMap.put("视频资源", sum)); + allAmount.join(); + } + break; + case TSINGTAO: { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("check_status", 1).ne("gps_x", "").ne("gps_y", "").isNotNull("gps_x").isNotNull("gps_y"); + resultMap.put("视频资源", cameraChannelMapper.selectCount(queryWrapper)); + } + break; + default: + break; + } //新增会客厅和视频会议统计 //会客厅 @@ -1977,10 +2021,9 @@ public class ResourceServiceImpl extends CrudServiceImpl sphy = CompletableFuture.runAsync(() -> { - resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal()); - }, executor); - CompletableFuture all = CompletableFuture.allOf(jcss, hkt, sphy); + CompletableFuture sphy = CompletableFuture.runAsync(() -> resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal()), executor); + + CompletableFuture all = CompletableFuture.allOf(yzy, hkt, sphy); all.join(); return resultMap; diff --git a/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java b/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java index da5b6222..585fb824 100644 --- a/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java +++ b/renren-admin/src/main/java/io/renren/modules/security/user/SecurityUser.java @@ -38,7 +38,7 @@ public class SecurityUser { logger.error("————————————————————————————user为null,返回空对象————————————————————————————"); return new UserDetail(); } - + return user; } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java index 2af22b32..51a69a0f 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java @@ -1,6 +1,5 @@ package io.renren.modules.sys.service.impl; -import cn.hutool.core.collection.CollUtil; import io.renren.common.service.impl.BaseServiceImpl; import io.renren.modules.security.user.SecurityUser; import io.renren.modules.sys.controller.SysUserController; @@ -25,7 +24,7 @@ public class SysRoleUserServiceImpl extends BaseServiceImpl roleIdList) { logger.error("------------------准备更新用户角色信息-------------------"); //先删除角色用户关系 diff --git a/renren-admin/src/main/resources/mapper/reminders/TRemindersDao.xml b/renren-admin/src/main/resources/mapper/reminders/TRemindersDao.xml index 4e31f521..6a2fdcfb 100644 --- a/renren-admin/src/main/resources/mapper/reminders/TRemindersDao.xml +++ b/renren-admin/src/main/resources/mapper/reminders/TRemindersDao.xml @@ -21,4 +21,16 @@ + + \ No newline at end of file