浏览代码

工作台 debug

tags/24080901
PoffyZhang 1年前
父节点
当前提交
9ac50d07e5
共有 7 个文件被更改,包括 89 次插入17 次删除
  1. +2
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/UserInfoHelperImpl.java
  2. +14
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java
  3. +21
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NoticeManage.java
  4. +0
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  5. +3
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java
  6. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/workbench/model/vo/WorkbenchVO.java
  7. +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 查看文件

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


+ 14
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/enumeration/NoticeTypeEnum.java 查看文件

@@ -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 查看文件

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


+ 0
- 9
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java 查看文件

@@ -146,9 +146,6 @@ public class TodoCenterManage {

private final StatisticsService statisticsService;

@Autowired
private TaskService taskService;

/**
* 待办中心待我处理项目列表查询
*
@@ -160,12 +157,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);


+ 3
- 4
pmapi/src/main/java/com/ningdatech/pmapi/workbench/manage/WorkbenchManage.java 查看文件

@@ -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 查看文件

@@ -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 查看文件

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

正在加载...
取消
保存