Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 yıl önce
ebeveyn
işleme
9c870670d4
8 değiştirilmiş dosya ile 182 ekleme ve 74 silme
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  2. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java
  3. +14
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java
  4. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java
  5. +91
    -64
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  6. +3
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java
  7. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java
  8. +47
    -0
      pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java

+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java Dosyayı Görüntüle

@@ -46,8 +46,8 @@ public class UserInfoHelperImpl implements UserInfoHelper {
UserFullInfoDTO userFullInfo = userAuthLoginManage.getUserFullInfo(userId);
if(CollUtil.isNotEmpty(userFullInfo.getUserRoleList())){
for(Role role : userFullInfo.getUserRoleList()){
if(RoleEnum.SUPER_ADMIN.equals(role.getCode()) ||
RoleEnum.REGION_ADMIN.equals(role.getCode()) ){
if(RoleEnum.SUPER_ADMIN.name().equals(role.getCode()) ||
RoleEnum.REGION_ADMIN.name().equals(role.getCode()) ){
return Boolean.TRUE;
}
}


+ 2
- 2
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/req/ProjectRenewalListReq.java Dosyayı Görüntüle

@@ -41,11 +41,11 @@ public class ProjectRenewalListReq extends PagePo {
private Integer status;

@ApiModelProperty("创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime createOnMin;

@ApiModelProperty("创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime createOnMax;

@ApiModelProperty("用户ID")


+ 14
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java Dosyayı Görüntüle

@@ -21,7 +21,8 @@ public enum NoticeTypeEnum {
* 公告类型枚举
*/
ANNOUNCEMENT(1, "公告"),
HELP_DOCUMENTS(2, "帮助文档");
HELP_DOCUMENTS(2, "帮助文档"),
POLICY_DOCUMENTS(3, "政策文件");

private Integer code;
private String desc;
@@ -37,4 +38,16 @@ public enum NoticeTypeEnum {
}
return StringUtils.EMPTY;
}

public static String getNameByCode(Integer code) {
if (Objects.isNull(code)) {
return StringUtils.EMPTY;
}
for (NoticeTypeEnum t : NoticeTypeEnum.values()) {
if (code.equals(t.getCode())) {
return t.name();
}
}
return StringUtils.EMPTY;
}
}

+ 21
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java Dosyayı Görüntüle

@@ -11,6 +11,7 @@ import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.file.entity.vo.result.AttachFileVo;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.sys.enumeration.NoticeTypeEnum;
import com.ningdatech.pmapi.sys.model.entity.Notice;
import com.ningdatech.pmapi.sys.model.req.NoticeListReq;
import com.ningdatech.pmapi.sys.model.req.NoticeSaveReq;
@@ -24,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* <p>
@@ -103,6 +106,24 @@ public class NoticeManage {
return PageVo.of(tempDataList, page.getTotal());
}

public Map<String,List<NoticeListItemVO>> listToMapByManager(NoticeListReq req) {
LambdaQueryWrapper<Notice> wrapper = Wrappers.lambdaQuery(Notice.class)
.eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled())
.like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle())
.eq(req.getType() != null, Notice::getType, req.getType())
.orderByDesc(Notice::getToppedTime, Notice::getUpdateOn);
List<Notice> records = noticeService.list(wrapper);
return CollUtils.convert(records, w -> NoticeListItemVO
.builder()
.id(w.getId())
.type(w.getType())
.title(w.getTitle())
.enabled(w.getEnabled())
.createOn(w.getCreateOn())
.topped(w.getToppedTime() != null)
.build()).stream().collect(Collectors.groupingBy(v -> NoticeTypeEnum.getNameByCode(v.getType())));
}

public void delNotice(Long id) {
noticeService.removeById(id);
}


+ 91
- 64
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Dosyayı Görüntüle

@@ -9,6 +9,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
@@ -146,9 +147,6 @@ public class TodoCenterManage {

private final StatisticsService statisticsService;

@Autowired
private TaskService taskService;

/**
* 待办中心待我处理项目列表查询
*
@@ -160,12 +158,6 @@ public class TodoCenterManage {
// 获取登录用户ID
Long userId = LoginUserUtil.getUserId();

//测试 有多少个
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.active()
.taskCandidateOrAssigned(String.valueOf(userId));
List<Task> taskList = taskQuery.list();

// 查出项目库项目
ProjectListReq projectListReq = new ProjectListReq();
BeanUtils.copyProperties(param, projectListReq);
@@ -173,13 +165,17 @@ public class TodoCenterManage {
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
if(CollUtil.isEmpty(projectIdList)){
return PageVo.empty();
}
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());


if(CollUtil.isEmpty(instCodes)){
return PageVo.empty();
}
// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setInstCodes(instCodes);
@@ -247,14 +243,16 @@ public class TodoCenterManage {
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());


// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setInstCodes(instCodes);
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
BeanUtils.copyProperties(param,req);
List<ProcessTaskVo> userTodoList = processTaskService.getUserTodoList(req);
List<ProcessTaskVo> userTodoList = Lists.newArrayList();
if (CollUtil.isNotEmpty(instCodes)) {
// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setInstCodes(instCodes);
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
BeanUtils.copyProperties(param,req);
userTodoList = processTaskService.getUserTodoList(req);
}

ExcelExportWriter excelExportWriter = new ExcelExportWriter();
String fileName = null;
@@ -733,6 +731,9 @@ public class TodoCenterManage {
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
if (CollUtil.isEmpty(projectIdList)) {
return PageVo.empty();
}
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
@@ -789,22 +790,26 @@ public class TodoCenterManage {
ProjectListReq projectListReq = new ProjectListReq();
BeanUtils.copyProperties(param, projectListReq);
List<Project> projects = projectLibManage.projectList(projectListReq);
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setInstCodes(instCodes);
List<ProcessTaskVo> userIdoList = processTaskService.getUserIdoList(req);

List<ProcessTaskVo> userIdoList = Lists.newArrayList();
Map<String, Project> projectInfoMap = Maps.newHashMap();
if (CollUtil.isEmpty(projects)) {
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());

List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setInstCodes(instCodes);
userIdoList = processTaskService.getUserIdoList(req);
}

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -852,6 +857,11 @@ public class TodoCenterManage {
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());

if (CollUtil.isEmpty(projectIdList)) {
return PageVo.empty();
}

List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
@@ -909,21 +919,26 @@ public class TodoCenterManage {
ProjectListReq projectListReq = new ProjectListReq();
BeanUtils.copyProperties(param, projectListReq);
List<Project> projects = projectLibManage.projectList(projectListReq);
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setInstCodes(instCodes);
List<ProcessInstanceVo> userSubmittedList = processInstanceService.getUserSubmittedList(req);
List<ProcessInstanceVo> userSubmittedList = Lists.newArrayList();
Map<String, Project> projectInfoMap = Maps.newHashMap();
if (CollUtil.isEmpty(projects)) {
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setInstCodes(instCodes);
userSubmittedList = processInstanceService.getUserSubmittedList(req);
}

ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -968,6 +983,11 @@ public class TodoCenterManage {
ProjectListReq projectListReq = new ProjectListReq();
BeanUtils.copyProperties(param, projectListReq);
List<Project> projects = projectLibManage.projectList(projectListReq);

if (CollUtil.isEmpty(projects)) {
return PageVo.empty();
}

Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
@@ -1029,22 +1049,29 @@ public class TodoCenterManage {
ProjectListReq projectListReq = new ProjectListReq();
BeanUtils.copyProperties(param, projectListReq);
List<Project> projects = projectLibManage.projectList(projectListReq);
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
Map<String, Project> projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 分页查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setInstCodes(instCodes);
BeanUtils.copyProperties(param,req);
List<ProcessInstanceVo> ccMeList = processInstanceService.getCcMeList(req);
List<ProcessInstanceVo> ccMeList = Lists.newArrayList();
Map<String, Project> projectInfoMap = Maps.newHashMap();
if (CollUtil.isEmpty(projects)) {
Map<Long, Project> projectsMap = projects.stream().collect(Collectors.toMap(Project::getId, v -> v));
// 再查出项目关联的流程实例ID
List<Long> projectIdList = projects.stream().map(Project::getId).collect(Collectors.toList());
List<ProjectInst> projectInstList = projectInstService.list(Wrappers.lambdaQuery(ProjectInst.class)
.in(ProjectInst::getProjectId, projectIdList)
.orderByDesc(ProjectInst::getProjectId));
projectInfoMap = projectInstList.stream().collect(Collectors.toMap(ProjectInst::getInstCode, p-> projectsMap.get(p.getProjectId())));
List<String> instCodes = projectInstList.stream().map(ProjectInst::getInstCode).collect(Collectors.toList());

// 分页查出用户工作流
TodoCenterListReqDTO req = new TodoCenterListReqDTO();
req.setProcessDefId(param.getProcessDefId());
req.setUserId(String.valueOf(userId));
req.setInstCodes(instCodes);
BeanUtils.copyProperties(param,req);
ccMeList = processInstanceService.getCcMeList(req);
}



ExcelExportWriter excelExportWriter = new ExcelExportWriter();



+ 3
- 4
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java Dosyayı Görüntüle

@@ -71,12 +71,11 @@ public class WorkbenchManage {
projectListReq.setProjectYear(year);
res.setProjects(declaredProjectManage.projectLibList(projectListReq).getRecords().stream().collect(Collectors.toList()));

//3.政策文件
//3.所有公告按类型分
NoticeListReq noticeListReq = new NoticeListReq();
noticeListReq.setType(NoticeTypeEnum.HELP_DOCUMENTS.getCode());
noticeListReq.setPageNumber(1);
noticeListReq.setPageSize(5);
res.setNoticeList(noticeManage.listByManager(noticeListReq).getRecords().stream().collect(Collectors.toList()));
noticeListReq.setPageSize(100);
res.setNoticeList(noticeManage.listToMapByManager(noticeListReq));

return res;
}


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java Dosyayı Görüntüle

@@ -9,6 +9,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
* @Classname WorkbenchVO
@@ -32,7 +33,7 @@ public class WorkbenchVO implements Serializable {
public List<ProjectLibListItemVO> projects;

@ApiModelProperty("公告列表")
public List<NoticeListItemVO> noticeList;
public Map<String,List<NoticeListItemVO>> noticeList;

@Data
public static class DeclaredStatistics {


+ 47
- 0
pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java Dosyayı Görüntüle

@@ -21,7 +21,14 @@ import com.ningdatech.pmapi.todocenter.utils.PdfUtils;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.zwdd.client.ZwddClient;
import com.wflow.contants.ProcessConstant;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +37,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.*;
import static com.ningdatech.pmapi.todocenter.constant.WorkNotice.PASS_MSG_TEMPLATE;

@@ -57,6 +65,13 @@ public class TodoCenterTest extends AppTests {
private IProjectService projectService;
@Autowired
private PdfUtils pdfUtils;

@Autowired
private TaskService taskService;

@Autowired
private HistoryService historyService;

@Test
public void sendWorkNoticeTest() throws ExecutionException, InterruptedException {
//String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目");
@@ -173,4 +188,36 @@ public class TodoCenterTest extends AppTests {
e.printStackTrace();
}
}

@Test
public void todo(){
//测试 有多少个
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.active()
.taskCandidateOrAssigned(String.valueOf(2));
List<Task> taskList = taskQuery.list();

System.out.println(taskList.size());
}

public void ido(){
String userId = "2";
// 自定义sql查询所有已办的任务实例
String nativeSql = "SELECT\n" +
"\taht.*\n" +
"FROM\n" +
"\tACT_HI_TASKINST AS aht\n" +
"LEFT JOIN ACT_HI_VARINST AS ahv ON\n" +
"\tSUBSTRING(ahv.NAME_, 9) = aht.ID_\n" +
"\tAND ahv.NAME_ LIKE 'approve_%'\n" +
"WHERE\n" +
"\taht.ASSIGNEE_ = '" + userId +
"'AND ahv.NAME_ IS NOT NULL\n" +
"\tOR aht.DELETE_REASON_ = '" + ProcessConstant.Field.CANCEL + "'";
NativeHistoricTaskInstanceQuery taskInstanceQuery =
historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql);
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list();

System.out.println(taskInstances.size());
}
}

Yükleniyor…
İptal
Kaydet