Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

tags/24080901
PoffyZhang 1 anno fa
parent
commit
7c6ddb9dbd
3 ha cambiato i file con 59 aggiunte e 50 eliminazioni
  1. +55
    -50
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CommonLogTask.java
  2. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  3. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java

+ 55
- 50
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CommonLogTask.java Vedi File

@@ -1,7 +1,7 @@
package com.ningdatech.pmapi.scheduler.task;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.io.file.FileWriter;
@@ -46,7 +46,7 @@ public class CommonLogTask {
//获取记录ID文件
boolean idFileExist = FileUtil.exist(LOG_RECORD_ADDRESS + LOG_ID_FILE);
if (!idFileExist){
FileUtil.newFile(LOG_RECORD_ADDRESS + LOG_ID_FILE);
FileUtil.touch(LOG_RECORD_ADDRESS + LOG_ID_FILE);
}
FileReader fileReader = new FileReader(LOG_RECORD_ADDRESS + LOG_ID_FILE);
String result = fileReader.readString();
@@ -58,54 +58,59 @@ public class CommonLogTask {
//查询日志
List<OptLog> logList = optLogMapper.selectList(query);
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
if (CollUtil.isNotEmpty(logList)){
logList.forEach(optLog -> {
CommonLog commonLog = new CommonLog();
UserInfo userInfo = userInfoService.getById(optLog.getCreateBy());
String employeeCode = userInfo.getEmployeeCode();
if (StringUtils.isNotBlank(employeeCode)){
DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoMapper.selectOne(new LambdaQueryWrapper<DingEmployeeInfo>()
.eq(DingEmployeeInfo::getEmployeeCode,employeeCode));
if (dingEmployeeInfo != null){
commonLog.setUserId(String.valueOf(dingEmployeeInfo.getAccountId()));
}
}else {
commonLog.setUserId(String.valueOf(userInfo.getId()));
}
commonLog.setUserRole("政府工作人员");
commonLog.setAreaCode(userInfo.getRegionCode());
String description = optLog.getDescription();
if (description.equals("登录")){
commonLog.setActionType(1);
}else if (description.equals("退出登录")){
commonLog.setActionType(2);
}else {
commonLog.setActionType(3);
}
String actionId = UUID.randomUUID().toString();
commonLog.setActionId(actionId);
commonLog.setActionTime(df.format(optLog.getStartTime()));
commonLog.setActionDuration(optLog.getConsumingTime());
commonLog.setActionStatus(0);
commonLog.setAppCode("");
//判断当天日志文件是否存在
DateTimeFormatter dfNow = DateTimeFormatter.ofPattern("yyyyMMdd");
String fileName = LOG_RECORD_ADDRESS + LOG_FILE + dfNow.format(LocalDateTime.now()) + ".log";
boolean fileExist = FileUtil.exist(fileName);
if (!fileExist){
//不存在则创建当天日志文件
FileUtil.newFile(fileName);
}
//写入通用规则
FileWriter writer = new FileWriter(LOG_RECORD_ADDRESS + LOG_FILE);
writer.append(JSONUtil.toJsonStr(commonLog));
if (commonLog.getActionType() == 3){
CommonLog commonLogEnd = new CommonLog();
BeanUtil.copyProperties(commonLog,commonLogEnd);
commonLogEnd.setActionType(4);
writer.append(JSONUtil.toJsonStr(commonLogEnd));
}
});
if (CollectionUtil.isNotEmpty(logList)){
for (OptLog optLog : logList){
CommonLog commonLog = new CommonLog();
UserInfo userInfo = userInfoService.getById(optLog.getCreateBy());
if (userInfo == null){
continue;
}
String employeeCode = userInfo.getEmployeeCode();
if (StringUtils.isNotBlank(employeeCode)){
DingEmployeeInfo dingEmployeeInfo = dingEmployeeInfoMapper.selectOne(new LambdaQueryWrapper<DingEmployeeInfo>()
.eq(DingEmployeeInfo::getEmployeeCode,employeeCode));
if (dingEmployeeInfo != null){
commonLog.setUserId(String.valueOf(dingEmployeeInfo.getAccountId()));
}
}else {
commonLog.setUserId(String.valueOf(userInfo.getId()));
}
commonLog.setUserRole("政府工作人员");
commonLog.setAreaCode(userInfo.getRegionCode());
String description = optLog.getDescription();
if (description.equals("登录")){
commonLog.setActionType(1);
}else if (description.equals("退出登录")){
commonLog.setActionType(2);
}else {
commonLog.setActionType(3);
}
String actionId = UUID.randomUUID().toString();
commonLog.setActionId(actionId);
commonLog.setActionTime(df.format(optLog.getStartTime()));
commonLog.setActionDuration(optLog.getConsumingTime());
commonLog.setActionStatus(0);
commonLog.setAppCode("A331101453557202109017383");
//判断当天日志文件是否存在
DateTimeFormatter dfNow = DateTimeFormatter.ofPattern("yyyyMMdd");
String fileName = LOG_RECORD_ADDRESS + LOG_FILE + dfNow.format(LocalDateTime.now()) + ".log";
boolean fileExist = FileUtil.exist(fileName);
if (!fileExist){
//不存在则创建当天日志文件
FileUtil.touch(fileName);
}
//写入通用规则
FileWriter writer = new FileWriter(fileName);
writer.append(JSONUtil.toJsonStr(commonLog));
writer.append("\n");
if (commonLog.getActionType() == 3){
CommonLog commonLogEnd = new CommonLog();
BeanUtil.copyProperties(commonLog,commonLogEnd);
commonLogEnd.setActionType(4);
writer.append(JSONUtil.toJsonStr(commonLogEnd));
writer.append("\n");
}
}
//记录最后一个节点位置
FileWriter writer = new FileWriter(LOG_RECORD_ADDRESS + LOG_ID_FILE);
writer.write(String.valueOf(logList.get(logList.size() - 1).getId()));


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Vedi File

@@ -224,6 +224,7 @@ public class TodoCenterManage {
res.setProcessDefName(d.getProcessDefName());
res.setTaskId(d.getTaskId());
res.setNodeName(findSubProcessName(d));
res.setPretrialFileId(projectInfo.getPretrialFileId());
return res;
}).collect(Collectors.toList());
return PageVo.of(resVos, list.size());


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/model/vo/ResToBeProcessedVO.java Vedi File

@@ -69,4 +69,7 @@ public class ResToBeProcessedVO implements Serializable {

@ApiModelProperty("流程定义名称")
private String processDefName;

@ApiModelProperty("项目预审申请单文件ID")
private Long pretrialFileId;
}

Loading…
Annulla
Salva