Selaa lähdekoodia

专有钉 配置文件修改

tags/24080901
liuxinxin 1 vuosi sitten
vanhempi
commit
138d3d9692
6 muutettua tiedostoa jossa 211 lisäystä ja 338 poistoa
  1. +0
    -45
      pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java
  2. +0
    -65
      pmapi/src/main/java/com/ningdatech/pmapi/common/config/GovDingProperties.java
  3. +142
    -143
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  4. +61
    -65
      pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java
  5. +1
    -13
      pmapi/src/main/resources/application-dev.yml
  6. +7
    -7
      pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java

+ 0
- 45
pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java Näytä tiedosto

@@ -1,45 +0,0 @@
package com.ningdatech.pmapi.common.config;

import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
import com.ningdatech.pmapi.common.util.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

/**
* @author CMM
* @since 2023/02/03 09:24
*/
@Configuration
@Slf4j
public class BeanConfig {
@Bean
public SpringContextHolder springContextHolder() {
return new SpringContextHolder();
}

@Bean("authExecutableClient")
@DependsOn(value = "govDingProperties")
public ExecutableClient executableAuthClientInit() {
ExecutableClient executableClient = ExecutableClient.getInstance();
executableClient.setAccessKey(GovDingProperties.appAuthkey);
executableClient.setSecretKey(GovDingProperties.appAuthsecret);
executableClient.setDomainName(GovDingProperties.domain);
executableClient.setProtocal("https");
executableClient.init();
return executableClient;
}

@Bean("executableClient")
@DependsOn(value = "govDingProperties")
public ExecutableClient executableClientInit() {
ExecutableClient executableClient = new ExecutableClient();
executableClient.setAccessKey(GovDingProperties.appkey);
executableClient.setSecretKey(GovDingProperties.appsecret);
executableClient.setDomainName(GovDingProperties.domain);
executableClient.setProtocal("https");
executableClient.init();
return executableClient;
}
}

+ 0
- 65
pmapi/src/main/java/com/ningdatech/pmapi/common/config/GovDingProperties.java Näytä tiedosto

@@ -1,65 +0,0 @@
package com.ningdatech.pmapi.common.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import lombok.Data;

/**
* @description: 浙政钉配置
* @author: liushuai
* @date: 2022/5/5 15:10
*/
@Data
@Component
public class GovDingProperties {
public static String appkey;
public static String appsecret;
public static String appAuthkey;
public static String appAuthsecret;

public static String appSsoAuthkey;
public static String appSsoAuthsecret;
public static Long tenantId;

public static String domain;

@Value("${ding.app-key}")
public void setPrivateKey(String appkey) {
GovDingProperties.appkey = appkey;
}

@Value("${ding.app-secret}")
public void setAppsecret(String appsecret) {
GovDingProperties.appsecret = appsecret;
}

@Value("${ding.app-auth-key}")
public void setAppAuthKey(String appAuthkey) {
GovDingProperties.appAuthkey = appAuthkey;
}

@Value("${ding.app-auth-secret}")
public void setAppAuthsecret(String appAuthsecret) {
GovDingProperties.appAuthsecret = appAuthsecret;
}

// @Value("${ding.app-sso-auth-key}")
// public void setAppSsoAuthKey(String appSsoAuthkey) {
// GovDingProperties.appSsoAuthkey = appSsoAuthkey;
// }
//
// @Value("${ding.app-sso-auth-secret}")
// public void setAppSsoAuthsecret(String appSsoAuthsecret) {
// GovDingProperties.appSsoAuthsecret = appSsoAuthsecret;
// }

@Value("${ding.tenantId}")
public void setTenantId(Long tenantId) {
GovDingProperties.tenantId = tenantId;
}
@Value("${ding.domain}")
public void setDomain(String domain) {
GovDingProperties.domain = domain;
}
}

+ 142
- 143
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java Näytä tiedosto

@@ -1,145 +1,144 @@
package com.ningdatech.pmapi.ding.task;

import cn.hutool.core.collection.CollUtil;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.pmapi.common.config.GovDingProperties;
import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.Page;
import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO;
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition;
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
* @author liuxinxin
* @date 2023/2/10 上午9:52
*/

@Component
public class EmployeeBatchGetTask {

private final static Integer PAGE_SIZE = 20;

private final static Integer GROUP_SIZE = 100;

@Autowired
private ZwddClient zwddClient;

@Autowired
private IDingOrganizationService iDingOrganizationService;

@Autowired
private IDingEmployeeInfoService iDingEmployeeInfoService;

@Transactional(rollbackFor = Exception.class)
public void batchGetEmployeeTask() {

// 获取所有的组织列表
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list();
if (CollUtil.isNotEmpty(dingOrganizationList)) {
for (DingOrganization dingOrganization : dingOrganizationList) {
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();
String organizationCode = dingOrganization.getOrganizationCode();
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery();
query.setEmployeeStatus("A");
query.setOrganizationCode(organizationCode);
query.setReturnTotalSize(true);
query.setTenantId(GovDingProperties.tenantId);

int pageNo = 1;
query.setPageNo(pageNo);
query.setPageSize(PAGE_SIZE);

GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
if (CollUtil.isNotEmpty(data.getData())) {
allOrganizationEmployeePositionList.addAll(data.getData());
}
Long totalSize = data.getTotalSize();
if (totalSize > PAGE_SIZE) {
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE);
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) {
query.setPageNo(maxPageNo);
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) {
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData());
}
}
}

List<DingEmployeeInfo> dingEmployeeInfoList = new ArrayList<>();
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) {
List<String> employeeCodes = allOrganizationEmployeePositionList.stream().map(OrganizationEmployeePosition::getEmployeeCode).collect(Collectors.toList());
GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes);
// List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData();
} else {
// iDingEmployeeInfoService.saveBatch();
}
// 批量保存用户信息
saveBatch(allOrganizationEmployeePositionList);
}

}


}

private List<DingEmployeeInfo> buildDingEmployeeInfoRecord(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {
List<DingEmployeeInfo> saveRecordList = new ArrayList<>();
for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) {
List<GovEmployeePosition> govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions();
if (CollUtil.isNotEmpty(govEmployeePositions)) {
List<DingEmployeeInfo> segmentSaveRecordList = new ArrayList<>();
for (GovEmployeePosition govEmployeePosition : govEmployeePositions) {
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob());
dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode());
dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode());
dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode());
dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode());
dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode());
dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode());
dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode());
dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus());
segmentSaveRecordList.add(dingEmployeeInfo);
}
saveRecordList.addAll(segmentSaveRecordList);
} else {
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
saveRecordList.add(dingEmployeeInfo);
}


}
return null;
}

private void saveBatch(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {


// // 批量保存
// if (saveRecordList.size() <= GROUP_SIZE) {
// iDingOrganizationService.saveBatch(saveRecordList);
// } else {
// List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE);
// for (List<DingOrganization> segment : split) {
// iDingOrganizationService.saveBatch(segment);
//package com.ningdatech.pmapi.ding.task;
//
//import cn.hutool.core.collection.CollUtil;
//import com.ningdatech.basic.model.GenericResult;
//import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo;
//import com.ningdatech.pmapi.organization.entity.DingOrganization;
//import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
//import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
//import com.ningdatech.zwdd.client.ZwddClient;
//import com.ningdatech.zwdd.model.Page;
//import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO;
//import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery;
//import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition;
//import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition;
//import org.springframework.beans.BeanUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * @author liuxinxin
// * @date 2023/2/10 上午9:52
// */
//
//@Component
//public class EmployeeBatchGetTask {
//
// private final static Integer PAGE_SIZE = 20;
//
// private final static Integer GROUP_SIZE = 100;
//
// @Autowired
// private ZwddClient zwddClient;
//
// @Autowired
// private IDingOrganizationService iDingOrganizationService;
//
// @Autowired
// private IDingEmployeeInfoService iDingEmployeeInfoService;
//
// @Transactional(rollbackFor = Exception.class)
// public void batchGetEmployeeTask() {
//
// // 获取所有的组织列表用户获取组织下的 用户信息
// List<DingOrganization> dingOrganizationList = iDingOrganizationService.list();
// if (CollUtil.isNotEmpty(dingOrganizationList)) {
// for (DingOrganization dingOrganization : dingOrganizationList) {
// List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>();
// String organizationCode = dingOrganization.getOrganizationCode();
// PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery();
// query.setEmployeeStatus("A");
// query.setOrganizationCode(organizationCode);
// query.setReturnTotalSize(true);
//// query.setTenantId(GovDingProperties.tenantId);
// int pageNo = 1;
// query.setPageNo(pageNo);
// query.setPageSize(PAGE_SIZE);
//
// // 查询组织下 用户信息
// GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
// Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData();
// if (CollUtil.isNotEmpty(data.getData())) {
//
// allOrganizationEmployeePositionList.addAll(data.getData());
// }
// Long totalSize = data.getTotalSize();
// if (totalSize > PAGE_SIZE) {
// int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE);
// for (pageNo = 2; pageNo <= maxPageNo; pageNo++) {
// query.setPageNo(maxPageNo);
// GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query);
// if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) {
// allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData());
// }
// }
// }
//
// List<DingEmployeeInfo> dingEmployeeInfoList = new ArrayList<>();
// if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) {
// List<String> employeeCodes = allOrganizationEmployeePositionList.stream().map(OrganizationEmployeePosition::getEmployeeCode).collect(Collectors.toList());
// GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes);
//// List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData();
// } else {
//// iDingEmployeeInfoService.saveBatch();
// }
// // 批量保存用户信息
// saveBatch(allOrganizationEmployeePositionList);
// }
//
// }

}
}
//
//
// }
//
// private List<DingEmployeeInfo> buildDingEmployeeInfoRecord(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {
// List<DingEmployeeInfo> saveRecordList = new ArrayList<>();
// for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) {
// List<GovEmployeePosition> govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions();
// if (CollUtil.isNotEmpty(govEmployeePositions)) {
// List<DingEmployeeInfo> segmentSaveRecordList = new ArrayList<>();
// for (GovEmployeePosition govEmployeePosition : govEmployeePositions) {
// DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
// BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
// dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob());
// dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode());
// dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode());
// dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode());
// dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode());
// dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode());
// dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode());
// dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode());
// dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus());
// segmentSaveRecordList.add(dingEmployeeInfo);
// }
// saveRecordList.addAll(segmentSaveRecordList);
// } else {
// DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo();
// BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo);
// saveRecordList.add(dingEmployeeInfo);
// }
//
//
// }
// return null;
// }
//
// private void saveBatch(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {
//
//// // 批量保存
//// if (saveRecordList.size() <= GROUP_SIZE) {
//// iDingOrganizationService.saveBatch(saveRecordList);
//// } else {
//// List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE);
//// for (List<DingOrganization> segment : split) {
//// iDingOrganizationService.saveBatch(segment);
//// }
//// }
//
// }
//}

+ 61
- 65
pmapi/src/main/java/com/ningdatech/pmapi/todocenter/manage/TodoCenterManage.java Näytä tiedosto

@@ -1,20 +1,13 @@
package com.ningdatech.pmapi.todocenter.manage;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.xxpt.gateway.shared.api.request.OapiMessageWorkNotificationRequest;
import com.alibaba.xxpt.gateway.shared.api.response.OapiMessageWorkNotificationResponse;
import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient;
import com.alibaba.xxpt.gateway.shared.client.http.IntelligentGetClient;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.enumeration.Status;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
@@ -66,18 +59,18 @@ import com.wflow.workflow.bean.vo.ProcessTaskVo;
import com.wflow.workflow.config.WflowGlobalVarDef;
import com.wflow.workflow.enums.ProcessHandlerEnum;
import com.wflow.workflow.service.FormService;
import com.wflow.workflow.service.*;
import com.wflow.workflow.service.ProcessModelService;
import com.wflow.workflow.service.ProcessNodeCatchService;
import com.wflow.workflow.service.UserDeptOrLeaderService;
import com.wflow.workflow.utils.Executor;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.assertj.core.util.Maps;
import org.flowable.bpmn.model.Process;
import org.flowable.bpmn.model.*;
import org.flowable.engine.*;
import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.history.HistoricProcessInstance;
import org.flowable.engine.history.HistoricProcessInstanceQuery;
import org.flowable.engine.impl.util.ProcessDefinitionUtil;
import org.flowable.engine.runtime.ActivityInstance;
import org.flowable.engine.runtime.Execution;
import org.flowable.engine.task.Comment;
@@ -87,7 +80,6 @@ import org.flowable.task.api.TaskQuery;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery;
import org.flowable.variable.api.history.HistoricVariableInstance;
import org.flowable.variable.api.history.HistoricVariableInstanceQuery;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

@@ -126,8 +118,8 @@ public class TodoCenterManage {
private final IUserInfoService userInfoService;
private final IProjectService projectService;
private final StateMachineUtils stateMachineUtils;
@Resource(name = "executableClient")
private ExecutableClient client;
// @Resource(name = "executableClient")
// private ExecutableClient client;

/**
* 待办中心待我处理项目列表查询
@@ -142,7 +134,7 @@ public class TodoCenterManage {
// long userId = LoginUserUtil.getUserId();

// Long userId = 381496L;
Long userId = 6418616L;
Long userId = 6418616L;
// Long userId = 61769799L;
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc();
@@ -207,7 +199,7 @@ public class TodoCenterManage {
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId)))
// .collect(Collectors.toList());
}
if (isEmpty(resVos)){
if (isEmpty(resVos)) {
return PageVo.empty();
}
return PageVo.of(resVos, total);
@@ -234,7 +226,7 @@ public class TodoCenterManage {
taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc();
List<Task> taskList = taskQuery.list();
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO();
BeanUtils.copyProperties(param,reqToBeProcessedDTO);
BeanUtils.copyProperties(param, reqToBeProcessedDTO);
List<Project> records = getToBeProcessedProjects(reqToBeProcessedDTO, taskList);
ExcelExportWriter excelExportWriter = new ExcelExportWriter();

@@ -322,7 +314,7 @@ public class TodoCenterManage {
Long userId = 61769799L;

// 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作)
if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)){
if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)) {
HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(param.getTaskId()).singleResult();
doWithDrawProcess(handledTaskInstance, userId);
return;
@@ -392,12 +384,13 @@ public class TodoCenterManage {
// sendWorkNoticeToStartUser(task, projectName, rootNode);

// 更新项目状态和流程状态
updateRejectProjectStatus(userId,declaredProject);
updateRejectProjectStatus(userId, declaredProject);
taskService.complete(param.getTaskId(), var);
}

/**
* 当为驳回操作时,更新项目表中的项目状态
*
* @param userId
* @param declaredProject
* @return void
@@ -486,7 +479,7 @@ public class TodoCenterManage {
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo())));
}
// 如果流程状态是被退回状态,流程通过后,当前审核人一定不是最后一个审核人(至多是最后一个),更新流程状态为审核中
if (ProcessStatusEnum.BE_BACKED.getCode().equals(declaredProject.getProcessStatus())){
if (ProcessStatusEnum.BE_BACKED.getCode().equals(declaredProject.getProcessStatus())) {
// 通过该任务,流程到下一审核人处
taskService.complete(param.getTaskId(), var);
// 更新流程状态为审核中
@@ -526,13 +519,13 @@ public class TodoCenterManage {
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) {
// 当前项目状态是单位内部审核中
case UNDER_INTERNAL_AUDIT:
// 当前项目状态是预审中
// 当前项目状态是预审中
case PRE_APPLYING:
// 当前项目状态是部门联审中
// 当前项目状态是部门联审中
case DEPARTMENT_JOINT_REVIEW:
// 当前项目状态是方案评审中
// 当前项目状态是方案评审中
case SCHEME_UNDER_REVIEW:
// 当前项目状态是终验审核中
// 当前项目状态是终验审核中
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW:
updatePassProjectStatus(userId, declaredProject);
break;
@@ -557,6 +550,7 @@ public class TodoCenterManage {

/**
* 当为通过操作时,更新项目表中项目状态
*
* @param userId
* @param declaredProject
* @return void
@@ -605,7 +599,7 @@ public class TodoCenterManage {
/**
* 获取流程发起节点的用户ID
*
* @param rootNode 根节点
* @param rootNode 根节点
* @param processInstanceId
* @return java.lang.String
* @author CMM
@@ -637,7 +631,7 @@ public class TodoCenterManage {
/**
* 获取当前节点的下一个节点的审核用户ID
*
* @param currentNode 当前节点
* @param currentNode 当前节点
* @param processInstanceId
* @return java.lang.String 下一个节点的审核用户ID
* @author CMM
@@ -693,38 +687,38 @@ public class TodoCenterManage {
*/
private void sendWorkNotice(UserInfo auditUserInfo, String msg) {
// TODO 获取浙政钉唯一标识
String dingKey = null;
IntelligentGetClient intelligentGetClient = client.newIntelligentGetClient(DingConstant.WORKING_NOTICE);
OapiMessageWorkNotificationRequest request = new OapiMessageWorkNotificationRequest();
// 消息体(参考下文示例消息格式)
MessageText messageText = new MessageText();
messageText.setMsgType("text");
MessageContent messageContent = new MessageContent();
messageContent.setContent(msg);
messageText.setText(messageContent);
request.setMsg(JSONUtil.toJsonStr(messageText));
// 构建唯一的消息ID
// String bizMsgId = "ZB_URGE_NOTICE_" + "_" + auditUserInfo.getDeptId() + "_" + auditUserInfo.getUserId();
// request.setBizMsgId(bizMsgId);
request.setBizMsgId(null);
// 租户id
// request.setTenantId(GovDingProperties.tenantId.toString());
request.setReceiverIds(dingKey);
// 获取结果
OapiMessageWorkNotificationResponse apiResult = intelligentGetClient.get(request);
if (!apiResult.getSuccess() || !JSONUtil.parseObj(apiResult.getContent()).getBool("success")) {
log.warn("发送工作通知失败: {}", apiResult.getContent());
throw new BizException(Status.BAD_REQUEST.toString());
}
// String dingKey = null;
// IntelligentGetClient intelligentGetClient = client.newIntelligentGetClient(DingConstant.WORKING_NOTICE);
// OapiMessageWorkNotificationRequest request = new OapiMessageWorkNotificationRequest();
// // 消息体(参考下文示例消息格式)
// MessageText messageText = new MessageText();
// messageText.setMsgType("text");
// MessageContent messageContent = new MessageContent();
//
// messageContent.setContent(msg);
// messageText.setText(messageContent);
// request.setMsg(JSONUtil.toJsonStr(messageText));
// // 构建唯一的消息ID
// // String bizMsgId = "ZB_URGE_NOTICE_" + "_" + auditUserInfo.getDeptId() + "_" + auditUserInfo.getUserId();
// // request.setBizMsgId(bizMsgId);
// request.setBizMsgId(null);
// // 租户id
// // request.setTenantId(GovDingProperties.tenantId.toString());
// request.setReceiverIds(dingKey);
// // 获取结果
// OapiMessageWorkNotificationResponse apiResult = intelligentGetClient.get(request);
// if (!apiResult.getSuccess() || !JSONUtil.parseObj(apiResult.getContent()).getBool("success")) {
// log.warn("发送工作通知失败: {}", apiResult.getContent());
// throw new BizException(Status.BAD_REQUEST.toString());
// }

}

/**
* 撤销流程处理
*
* @param handledTaskInstance 已处理的历史任务实例
* @param userId 当前登录用户ID
* @param handledTaskInstance 已处理的历史任务实例
* @param userId 当前登录用户ID
*/
private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId) {
String processInstanceId = handledTaskInstance.getProcessInstanceId();
@@ -757,13 +751,13 @@ public class TodoCenterManage {
switch (Objects.requireNonNull(ProjectStatusEnum.getValue(status))) {
// 当前项目状态是单位内部审核中
case UNDER_INTERNAL_AUDIT:
// 当前项目状态是预审中
// 当前项目状态是预审中
case PRE_APPLYING:
// 当前项目状态是部门联审中
// 当前项目状态是部门联审中
case DEPARTMENT_JOINT_REVIEW:
// 当前项目状态是方案评审中
// 当前项目状态是方案评审中
case SCHEME_UNDER_REVIEW:
// 当前项目状态是终验审核中
// 当前项目状态是终验审核中
case FINAL_ACCEPTANCE_IS_UNDER_REVIEW:
updateWithdrawProjectStatus(userId, declaredProject);
break;
@@ -798,7 +792,7 @@ public class TodoCenterManage {

// TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常
Boolean orgFlag = true;
if (orgFlag){
if (orgFlag) {
// 注意:是前一个审核人,说明此时仍在一个审核流程中,项目状态不需要改变,流程状态也不要改变,仍为审核中
// 在审核记录中移除前一个审核人提交过的审核意见
Comment comment = taskService.getProcessInstanceComments(processInstanceId).stream()
@@ -819,7 +813,7 @@ public class TodoCenterManage {
.map(Execution::getActivityId)
.collect(Collectors.toList()), handledNode.getId())
.changeState();
}else {
} else {
throw new BizException("下一个审核人和您不是同一个部门,无法撤回!");
}

@@ -829,6 +823,7 @@ public class TodoCenterManage {

/**
* 当为撤回操作时,更新项目表中的项目状态为前一个状态
*
* @param userId
* @param declaredProject
* @return void
@@ -882,7 +877,7 @@ public class TodoCenterManage {
// TODO 流程变成【被退回】状态,待我处理中,为流程发起人增加一条待办记录,
// 执行自定义回退逻辑,回退到流程发起人
// 注意:因为审核人有执行退回的权限,且是退回到流程发起人,说明是在同一个流程实例中,所以项目状态不需要更新
managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService,bpmnModel,param.getTaskId(), rootNode.getId()));
managementService.executeCommand(new BackToHisApprovalNodeCmd(runtimeService, bpmnModel, param.getTaskId(), rootNode.getId()));
runtimeService.setVariables(param.getInstanceId(),
Maps.newHashMap("approve_" + param.getTaskId(), param.getAction()));
log.info("用户[{}] 退回流程[{}] [{} -> {}]", userId, param.getInstanceId(),
@@ -900,6 +895,7 @@ public class TodoCenterManage {

/**
* 给流程发起人发送流程退回工作通知
*
* @param task
* @param projectName
* @param rootNode
@@ -940,7 +936,7 @@ public class TodoCenterManage {
.executionIds(historicTaskInstances.stream().map(HistoricTaskInstance::getExecutionId).collect(Collectors.toSet()))
.processInstanceId(instanceId)
.list();
}else {
} else {
formDatas = historyService
.createHistoricVariableInstanceQuery()
.processInstanceId(instanceId)
@@ -1103,7 +1099,7 @@ public class TodoCenterManage {
// 获取登录用户ID
// long userId = LoginUserUtil.getUserId();

Long userId = 381496L;
Long userId = 381496L;
// Long userId = 6418616L;
// Long userId = 61769799L;

@@ -1184,10 +1180,10 @@ public class TodoCenterManage {
// result = resVos.stream().peek(v -> v.setOwner(userMap.get(userId)))
// .collect(Collectors.toList());
}
if (isEmpty(resVos)){
if (isEmpty(resVos)) {
return PageVo.empty();
}
return PageVo.of(resVos,total);
return PageVo.of(resVos, total);
}

/**
@@ -1244,7 +1240,7 @@ public class TodoCenterManage {
.map(HistoricTaskInstance::getProcessInstanceId)
.collect(Collectors.toSet());
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO();
BeanUtils.copyProperties(param,reqToBeProcessedDTO);
BeanUtils.copyProperties(param, reqToBeProcessedDTO);
List<Project> records = getHandledProjects(reqToBeProcessedDTO, taskProcessInsIds);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();
@@ -1462,7 +1458,7 @@ public class TodoCenterManage {
.map(h -> h.getId())
.collect(Collectors.toSet());
ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO();
BeanUtils.copyProperties(param,reqToBeProcessedDTO);
BeanUtils.copyProperties(param, reqToBeProcessedDTO);
List<Project> records = getMySubmittedProjects(reqToBeProcessedDTO, historicProcessInstanceIds);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();
@@ -1626,7 +1622,7 @@ public class TodoCenterManage {
.collect(Collectors.toList());

ReqToBeProcessedDTO reqToBeProcessedDTO = new ReqToBeProcessedDTO();
BeanUtils.copyProperties(param,reqToBeProcessedDTO);
BeanUtils.copyProperties(param, reqToBeProcessedDTO);
List<Project> records = getCcMeProjects(reqToBeProcessedDTO, processInsIds);

ExcelExportWriter excelExportWriter = new ExcelExportWriter();


+ 1
- 13
pmapi/src/main/resources/application-dev.yml Näytä tiedosto

@@ -153,16 +153,4 @@ sa-token:
# token风格
token-style: uuid
# 是否输出操作日志
is-log: false

#专有钉钉
ding:
#扫码
app-auth-key: expert-base_dingoa-c5nnefYVnie
app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L
# #免登/获取信息
app-key: file-manage-4Mjx9358wuxjyYFjY3
app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O
#专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729
tenantId: 31141
domain: openplatform.dg-work.cn
is-log: false

+ 7
- 7
pmapi/src/test/java/com/ningdatech/pmapi/organization/OrganizationTest.java Näytä tiedosto

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

import com.ningdatech.pmapi.AppTests;
import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
//import com.ningdatech.pmapi.ding.task.EmployeeBatchGetTask;
import com.ningdatech.pmapi.ding.task.OrganizationBatchGetTask;
import com.ningdatech.zwdd.client.ZwddAuthClient;
import com.ningdatech.zwdd.client.ZwddClient;
@@ -24,17 +24,17 @@ class OrganizationTest extends AppTests {
@Autowired
private OrganizationBatchGetTask organizationBatchGetTask;

@Autowired
private EmployeeBatchGetTask employeeBatchGetTask;
// @Autowired
// private EmployeeBatchGetTask employeeBatchGetTask;

@Test
public void testBatchGetOrganization() {
organizationBatchGetTask.batchGetOrganizationTask();
}

@Test
public void testEmployeeBatchGetTask(){
employeeBatchGetTask.batchGetEmployeeTask();
}
// @Test
// public void testEmployeeBatchGetTask(){
// employeeBatchGetTask.batchGetEmployeeTask();
// }

}

Loading…
Peruuta
Tallenna