Ver código fonte

debug 用户id

tags/24080901
PoffyZhang 1 ano atrás
pai
commit
1220173a66
2 arquivos alterados com 19 adições e 20 exclusões
  1. +15
    -15
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  2. +4
    -5
      pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java

+ 15
- 15
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Ver arquivo

@@ -316,10 +316,6 @@ public class TodoCenterManage {
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId)
.singleResult();
// 获取流程发起人信息
String startUserId = instance.getStartUserId();
UserInfo startUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, startUserId));
// 获取流程定义名称
String processDefinitionName = instance.getProcessDefinitionName();

@@ -339,15 +335,15 @@ public class TodoCenterManage {
// 获取流程通过后当前审核人信息,向其发送工作通知
List<ProgressNode> newProgressInfo = newInstanceDetail.getProgressInfo();
ProgressNode currentNode = newProgressInfo.get(newProgressInfo.size() - 1);
UserInfo auditUserInfo;
String currentEmployeeCode;
// 说明当前节点是子流程节点
if (currentNode.getNodeType().name().equals(NodeTypeEnum.SUB.name())) {
List<ProgressNode> children = currentNode.getChildren();
// 获取子流程当前审核人节点
ProgressNode subCurrentNode = children.get(children.size() - 1);
auditUserInfo = userInfoService.getById(Long.valueOf(subCurrentNode.getUserId()));
currentEmployeeCode = subCurrentNode.getUserId();
} else {
auditUserInfo = userInfoService.getById(Long.valueOf(currentNode.getUserId()));
currentEmployeeCode = currentNode.getUserId();
}

// 流程通过后,判断当前登录用户是不是最后一个审核人
@@ -376,7 +372,7 @@ public class TodoCenterManage {
throw new IllegalStateException("Unexpected value: " + projectStatus);
}
// 获取发送浙政钉工作通知必要信息
WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(startUserInfo);
WorkNoticeInfo passWorkNoticeInfo2 = getSendWorkNoticeInfo(currentEmployeeCode);
String passMsg2 = String.format(PASS_MSG_TEMPLATE2, projectName, processDefinitionName);
passWorkNoticeInfo2.setMsg(passMsg2);
// 放入系统通知表中,保存记录
@@ -387,10 +383,10 @@ public class TodoCenterManage {
// 若有下一个审核人(当前节点的用户),
// 向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。
// 获取发送浙政钉工作通知必要信息
if (Objects.isNull(auditUserInfo)) {
if (Objects.isNull(currentEmployeeCode)) {
throw new BizException("审核人信息不存在!");
}
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(auditUserInfo);
WorkNoticeInfo sendWorkNoticeInfo = getSendWorkNoticeInfo(currentEmployeeCode);
String msg = String.format(PASS_MSG_TEMPLATE, sendWorkNoticeInfo.getOrganizationName(), projectName);
sendWorkNoticeInfo.setMsg(msg);
// 放入系统通知表中,保存记录
@@ -407,7 +403,7 @@ public class TodoCenterManage {
// 更新项目状态和流程状态
updateRejectProjectStatus(userId, declaredProject);
// 获取发送浙政钉工作通知必要信息
WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo);
WorkNoticeInfo rejectWorkNoticeInfo = getSendWorkNoticeInfo(instance.getStartUserId());
String rejectMsg = String.format(REJECT_MSG_TEMPLATE, projectName, processDefinitionName);
rejectWorkNoticeInfo.setMsg(rejectMsg);
// 放入系统通知表中,保存记录
@@ -421,7 +417,7 @@ public class TodoCenterManage {
processTaskService.handleTask(param, employeeCode);
// 给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被退回,请及时处理。
// 获取发送浙政钉工作通知必要信息
WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(startUserInfo);
WorkNoticeInfo backWorkNoticeInfo = getSendWorkNoticeInfo(instance.getStartUserId());
String backMsg = String.format(BACK_MSG_TEMPLATE, projectName, processDefinitionName);
backWorkNoticeInfo.setMsg(backMsg);
// 放入系统通知表中,保存记录
@@ -432,7 +428,7 @@ public class TodoCenterManage {
// 撤回(流程发起人和当前流程审核人的前一个审核人操作)
case WITHDRAW:
// 登录用户是流程发起人,且是流程发起人撤回
if (employeeCode.equals(startUserId)
if (employeeCode.equals(instance.getStartUserId())
&& ProcessConstant.Field.ROOT.equals(param.getTaskId())) {
processTaskService.handleTask(param, employeeCode);
// 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态,流程状态更新为审核通过
@@ -589,12 +585,16 @@ public class TodoCenterManage {
/**
* 获取发送浙政钉工作通知的信息
*
* @param auditUserInfo
* @param currentEmployeeCode
* @return com.ningdatech.pmapi.todocenter.bean.entity.WorkNoticeInfo
* @author CMM
* @since 2023/02/15 14:04
*/
public WorkNoticeInfo getSendWorkNoticeInfo(UserInfo auditUserInfo) {
public WorkNoticeInfo getSendWorkNoticeInfo(String currentEmployeeCode) {
UserInfo auditUserInfo = userInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class).eq(UserInfo::getEmployeeCode,currentEmployeeCode).last("limit 1"));
if (Objects.isNull(auditUserInfo)) {
throw new BizException("该用户不存在!");
}
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo();
Long accountId = auditUserInfo.getAccountId();
if (Objects.isNull(accountId)) {


+ 4
- 5
pmapi/src/test/java/com/ningdatech/pmapi/todocenter/TodoCenterTest.java Ver arquivo

@@ -85,10 +85,9 @@ public class TodoCenterTest extends AppTests {
////若没有指定属性名,则默认为方法名
//TaskExecutor taskExecutor = (TaskExecutor) ac.getBean("executor");

Long userId = 4L;
UserInfo auditUserInfo = userInfoService.getById(userId);
String userId = "4";
// 获取发送浙政钉工作通知必要信息
WorkNoticeInfo workNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(auditUserInfo);
WorkNoticeInfo workNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(userId);
// workNoticeInfo.setBizMsgId("1");
String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-02-测试项目");

@@ -125,9 +124,9 @@ public class TodoCenterTest extends AppTests {

@Test
public void sendWorkNoticeTest2(){
UserInfo userInfo = userInfoService.getById(4L);
String userId = "2";
// 获取发送浙政钉工作通知必要信息
WorkNoticeInfo passWorkNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(userInfo);
WorkNoticeInfo passWorkNoticeInfo = todoCenterManage.getSendWorkNoticeInfo(userId);
String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1");
passWorkNoticeInfo.setMsg(passMsg);
// 放入工作通知暂存表中,通过扫表异步发送


Carregando…
Cancelar
Salvar