Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-12-01 14:22:20 +08:00
commit 9aa06f6253
10 changed files with 177 additions and 35 deletions

View File

@ -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<Long, List<TAbilityApplicationDTO>> 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);

View File

@ -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;
}

View File

@ -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<ProcessInstanceDTO> list2 = list1.stream().skip((Integer.parseInt(page) - 1) * Integer.parseInt(limit)).limit(Integer.parseInt(limit)).collect(Collectors.toList());
List<ProcessInstanceDTO> 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<Task> 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;
}

View File

@ -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<TRemindersEntity> {
/**
* 获取该任务的最新催办记录时间
*
* @param taskId
* @return
*/
List<Map> selectRemindersTime(@Param("taskId") String taskId);
}

View File

@ -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<TRemindersEntity, TRemindersDTO> {
/**
* 获取该任务最近一次催办日期
*
* @param taskId
* @return
*/
LocalDate selectRemindersTime(String taskId);
}

View File

@ -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<TRemindersDao, TRemin
dto.setRecipient(assignee.get());
}
Map<String, Object> 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<TRemindersDao, TRemin
}
SysUserDTO creatorDto = sysUserService.get(Long.parseLong(creator));
String content = "【催办通知】" + creatorDto.getRealName() + "发起的流程 " + resourceName + dto.getProcessType() +
" 进入审核节点:" + task.getName() +
";当前审核人指派为您";
" 进入审核节点:" + task.getName() + "" + between + "" +
";当前审核人指派为您,请及时处理";
if (allowEntrust) {
content = "【催办通知】" + dto.getSponsor().getRealName() + "发起的流程 " + resourceName + dto.getProcessType() +
" 已进入审核节点:" + task.getName() +
";因无法分配到审核人,故当前审核人指派为您";
" 已进入审核节点:" + task.getName() + "" + between + "" +
";因无法分配到审核人,故当前审核人指派为您,请及时处理";
}
Integer type = 12;
if ("能力申请".equals(dto.getProcessType())) {
type = 1;
//待办通知通知的是流程当前审核人通知内容[待办通知]申请部门+申请人+提出资源名称+申请请进入UCS后台管理系统进行审核
content = "【催办通知】" + dto.getSponsor().getDeptName() + dto.getSponsor().getRealName() + "提出 ”" + resourceName + " ”申请请进入UCS后台管理系统进行审核。";
// 催办通知通知的是流程当前审核人通知内容[待办通知]申请部门+申请人+提出资源名称+申请请进入UCS后台管理系统进行审核
content = "【催办通知】" + dto.getSponsor().getDeptName() + dto.getSponsor().getRealName() + "提出 ”"
+ resourceName + " ”申请已过去" + between + "请进入UCS后台管理系统及时进行审核。";
if (allowEntrust) {
content = content + "(因无法分配到审核人,故当前审核人指派为您,您可进行委托他人转办)";
}
@ -161,4 +168,17 @@ public class TRemindersServiceImpl extends CrudServiceImpl<TRemindersDao, TRemin
super.save(dto);
}
/**
* 获取该任务最近一次催办日期
*
* @param taskId
* @return
*/
@Override
public LocalDate selectRemindersTime(String taskId) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
return baseDao.selectRemindersTime(taskId).stream().map(index ->
LocalDate.parse(index.get("reminders_time").toString(), formatter)
).findFirst().orElse(null);
}
}

View File

@ -1953,19 +1953,63 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectInfrastructureList() {
HashMap<String, Object> resultMap = new HashMap<>();
//云资源
CompletableFuture<Void> yzy = CompletableFuture.runAsync(() -> {
resultMap.put("云资源", resourceDao.selectYzyCount());
}, executor);
CompletableFuture<Void> yzy = CompletableFuture.runAsync(() -> resultMap.put("云资源", resourceDao.selectYzyCount()), executor);
//视频资源
CompletableFuture<Void> jcss = CompletableFuture.runAsync(() -> {
QueryWrapper<CameraChannel> 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<Long> 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<CameraChannel> 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<ResourceDao, ResourceEn
}, executor);
//视频会议
CompletableFuture<Void> sphy = CompletableFuture.runAsync(() -> {
resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal());
}, executor);
CompletableFuture<Void> all = CompletableFuture.allOf(jcss, hkt, sphy);
CompletableFuture<Void> sphy = CompletableFuture.runAsync(() -> resultMap.put("视频会议", enkeService.page(new HashMap<>()).getTotal()), executor);
CompletableFuture<Void> all = CompletableFuture.allOf(yzy, hkt, sphy);
all.join();
return resultMap;

View File

@ -38,7 +38,7 @@ public class SecurityUser {
logger.error("————————————————————————————user为null,返回空对象————————————————————————————");
return new UserDetail();
}
return user;
}

View File

@ -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<SysRoleUserDao, SysR
private static final Logger logger = LoggerFactory.getLogger(SysUserController.class);
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void saveOrUpdate(Long userId, List<Long> roleIdList) {
logger.error("------------------准备更新用户角色信息-------------------");
//先删除角色用户关系

View File

@ -21,4 +21,16 @@
<result property="additional3" column="additional3"/>
</resultMap>
<select id="selectRemindersTime" resultType="java.util.Map">
SELECT
DATE_FORMAT( reminders_time, '%Y-%m-%d' ) AS reminders_time
FROM
t_reminders
WHERE
process_task_id = #{taskId}
ORDER BY
create_date DESC
LIMIT 1;
</select>
</mapper>