@@ -92,11 +92,6 @@ public class ProjectDeclareStateMachineBuilder { | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION_CHOICE) | |||
.first(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS,projectDeclareGuardFactory.new PendingPreQualificationChoiceGuard(),projectDeclareAction.new ProjectDeclareChoiceAction()) | |||
.last(ProjectStatusEnum.PRE_APPLYING,projectDeclareAction.new ProjectDeclareChoiceAction()).and() | |||
// 待预审撤回,从待预审到单位内部审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PENDING_PREQUALIFICATION) | |||
.target(ProjectStatusEnum.UNDER_INTERNAL_AUDIT) | |||
.event(ProjectStatusChangeEvent.PENDING_PREQUALIFICATION_WITHDRAW).and() | |||
// 省级部门联审通过,从省级部门联审中到预审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS) | |||
@@ -157,21 +152,11 @@ public class ProjectDeclareStateMachineBuilder { | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.BE_SUSPENDED) | |||
.event(ProjectStatusChangeEvent.ANNUAL_PLAN_SUSPEND).and() | |||
// 年度计划中撤回,从年度计划中到部门联审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.target(ProjectStatusEnum.DEPARTMENT_JOINT_REVIEW) | |||
.event(ProjectStatusChangeEvent.IN_THE_ANNUAL_PLAN_WITHDRAW).and() | |||
// 方案待申报申报方案,从方案待申报到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.DECLARE_PLAN).and() | |||
// 方案待申报撤回,从方案待申报到年度计划中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.PLAN_TO_BE_DECLARED) | |||
.target(ProjectStatusEnum.IN_THE_ANNUAL_PLAN) | |||
.event(ProjectStatusChangeEvent.PLAN_TO_DECLARE_WITHDRAW).and() | |||
// 方案评审通过,从方案评审中到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
@@ -192,41 +177,21 @@ public class ProjectDeclareStateMachineBuilder { | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.PROJECT_APPROVAL).and() | |||
// 待立项批复撤回,从待立项批复到方案评审中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_APPROVED) | |||
.target(ProjectStatusEnum.SCHEME_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.TO_BE_APPROVED_WITHDRAW).and() | |||
// 待采购采购备案,从待采购到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.PURCHASE_PUT_ON_RECORD).and() | |||
// 待采购撤回,从待采购到待立项批复 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.target(ProjectStatusEnum.TO_BE_APPROVED) | |||
.event(ProjectStatusChangeEvent.TO_BE_PURCHASED_WITHDRAW).and() | |||
// 建设中初验备案,从建设中到待终验 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.event(ProjectStatusChangeEvent.PRELIMINARY_ACCEPTANCE_PUT_ON_RECORD).and() | |||
// 建设中撤回,从建设中到待采购 | |||
.withExternal() | |||
.source(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.target(ProjectStatusEnum.TO_BE_PURCHASED) | |||
.event(ProjectStatusChangeEvent.UNDER_CONSTRUCTION_WITHDRAW).and() | |||
// 待终验终验申请,从待终验到终验审核中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
.event(ProjectStatusChangeEvent.FINAL_ACCEPTANCE_APPLICATION).and() | |||
// 待终验撤回,从待终验到建设中 | |||
.withExternal() | |||
.source(ProjectStatusEnum.TO_BE_FINALLY_INSPECTED) | |||
.target(ProjectStatusEnum.UNDER_CONSTRUCTION) | |||
.event(ProjectStatusChangeEvent.TO_BE_FINALLY_INSPECTED_WITHDRAW).and() | |||
// 终审审核通过,从终审审核中到已归档 | |||
.withExternal() | |||
.source(ProjectStatusEnum.FINAL_ACCEPTANCE_IS_UNDER_REVIEW) | |||
@@ -114,10 +114,6 @@ public enum ProjectStatusChangeEvent { | |||
*/ | |||
UNDER_INTERNAL_WITHDRAW(null, null, 10001), | |||
/** | |||
* 待预审时被撤回(项目状态进入:单位内部审核中) | |||
*/ | |||
PENDING_PREQUALIFICATION_WITHDRAW(null, null, 10003), | |||
/** | |||
* 省级部门联审中时被撤回(项目状态进入:待预审) | |||
*/ | |||
JOINT_REVIEW_BY_PROVINCIAL_DEPARTMENTS_WITHDRAW(null, null, 10004), | |||
@@ -130,34 +126,10 @@ public enum ProjectStatusChangeEvent { | |||
*/ | |||
DEPARTMENT_JOINT_REVIEW_WITHDRAW(null, null, 10008), | |||
/** | |||
* 年度计划中时被撤回(项目状态进入:部门联审中) | |||
*/ | |||
IN_THE_ANNUAL_PLAN_WITHDRAW(null, null, 10010), | |||
/** | |||
* 方案待申报时被撤回(项目状态进入:年度计划中) | |||
*/ | |||
PLAN_TO_DECLARE_WITHDRAW(null, null, 10016), | |||
/** | |||
* 方案评审中时被撤回(项目状态进入:方案待申报) | |||
*/ | |||
SCHEME_UNDER_REVIEW_WITHDRAW(null, null, 10012), | |||
/** | |||
* 待立项批复时被撤回(项目状态进入:方案评审中) | |||
*/ | |||
TO_BE_APPROVED_WITHDRAW(null, null, 10014), | |||
/** | |||
* 待采购时被撤回(项目状态进入:待立项批复) | |||
*/ | |||
TO_BE_PURCHASED_WITHDRAW(null, null, 20001), | |||
/** | |||
* 建设中时被撤回(项目状态进入:待采购) | |||
*/ | |||
UNDER_CONSTRUCTION_WITHDRAW(null, null, 20002), | |||
/** | |||
* 待终验时被撤回(项目状态进入:建设中) | |||
*/ | |||
TO_BE_FINALLY_INSPECTED_WITHDRAW(null, null, 20003), | |||
/** | |||
* 终验审核中时被撤回(项目状态进入:待终验) | |||
*/ | |||
FINAL_ACCEPTANCE_IS_UNDER_REVIEW_WITHDRAW(null, null, 20004); | |||
@@ -66,7 +66,6 @@ public class EmployeeBatchGetTask { | |||
} | |||
} | |||
// zwddClient.pageOrganizationEmployeePositions(query); | |||
@@ -33,5 +33,4 @@ public class CompanyFiscalCodeController { | |||
companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); | |||
} | |||
} |
@@ -1,13 +1,14 @@ | |||
package com.ningdatech.pmapi.organization.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
@@ -17,4 +18,10 @@ import org.springframework.stereotype.Controller; | |||
@RequestMapping("/api/v1/organization") | |||
public class DingOrganizationController { | |||
@ApiModelProperty("单位成员配置") | |||
@PostMapping("/member/config") | |||
public void organizationManage() { | |||
} | |||
} |
@@ -2,15 +2,13 @@ package com.ningdatech.pmapi.projectdeclared.entity.dto; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
import java.io.Serializable; | |||
import java.util.Map; | |||
@@ -28,7 +26,7 @@ import java.util.Map; | |||
public class DeclaredProjectDto implements Serializable { | |||
@NotNull | |||
private ProjectDto projectInfo; | |||
private ProjectDTO projectInfo; | |||
private Map<String,Object> formData; | |||
@@ -2,7 +2,6 @@ package com.ningdatech.pmapi.projectdeclared.entity.dto; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.google.common.collect.Maps; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
@@ -1,6 +1,6 @@ | |||
package com.ningdatech.pmapi.projectdeclared.entity.dto; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.*; | |||
@@ -26,7 +26,7 @@ public class ProjectDraftSaveDto implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@NotNull | |||
private ProjectDto projectInfo; | |||
private ProjectDTO projectInfo; | |||
@NotNull | |||
private ProcessInstanceUserDto user; | |||
@@ -16,7 +16,7 @@ import com.ningdatech.pmapi.projectdeclared.entity.dto.ProjectDraftSaveDto; | |||
import com.ningdatech.pmapi.projectdeclared.entity.vo.ProjectDraftVo; | |||
import com.ningdatech.pmapi.projectdeclared.service.IProjectDraftService; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDto; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectApplicationService; | |||
@@ -104,7 +104,7 @@ public class DeclaredProjectManage { | |||
* @return | |||
*/ | |||
public String startTheProcess(DeclaredProjectDto dto) { | |||
ProjectDto projectInfo = dto.getProjectInfo(); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
String regionCode = projectInfo.getAreaCode(); | |||
WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class) | |||
@@ -145,7 +145,7 @@ public class DeclaredProjectManage { | |||
* @param projectDto | |||
* @param instanceId | |||
*/ | |||
private void saveProject(ProjectDto projectDto, String instanceId, String regionCode) { | |||
private void saveProject(ProjectDTO projectDto, String instanceId, String regionCode) { | |||
//流程启动之后 入库项目 重要业务信息 用于列表查询 展示 | |||
try { | |||
//保存项目表信息 | |||
@@ -181,7 +181,7 @@ public class DeclaredProjectManage { | |||
* @return | |||
*/ | |||
public Long saveToDraft(ProjectDraftSaveDto dto) { | |||
ProjectDto projectInfo = dto.getProjectInfo(); | |||
ProjectDTO projectInfo = dto.getProjectInfo(); | |||
ProjectDraft draft = new ProjectDraft(); | |||
BeanUtils.copyProperties(projectInfo, draft); | |||
draft.setUserId(dto.getUser().getUserId()); | |||
@@ -3,6 +3,7 @@ package com.ningdatech.pmapi.projectlib.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.log.annotation.WebLog; | |||
import com.ningdatech.pmapi.projectlib.manage.AnnualPlanLibManage; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq; | |||
@@ -73,4 +74,11 @@ public class AnnualPlanController { | |||
annualPlanLibManage.exportAnnualPlanEditTable(response); | |||
} | |||
@GetMapping("/modify") | |||
@ApiOperation("年度计划编辑") | |||
@WebLog("年度计划编辑") | |||
public void modify(@RequestBody ProjectDTO req) { | |||
annualPlanLibManage.updateAnnualPlan(req); | |||
} | |||
} |
@@ -40,6 +40,7 @@ public class ProjectHelper { | |||
query.le(req.getApproveAmountMax() != null, Project::getApprovalAmount, req.getApproveAmountMax()); | |||
query.like(req.getBuildOrg() != null, Project::getBuildOrgName, req.getBuildOrg()); | |||
query.eq(req.getIsTemporaryAugment() != null, Project::getIsTemporaryAugment, req.getIsTemporaryAugment()); | |||
return query; | |||
} | |||
@@ -1,5 +1,6 @@ | |||
package com.ningdatech.pmapi.projectlib.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import com.alibaba.excel.EasyExcel; | |||
import com.alibaba.excel.context.AnalysisContext; | |||
import com.alibaba.excel.event.AnalysisEventListener; | |||
@@ -16,6 +17,7 @@ import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.helper.ProjectHelper; | |||
import com.ningdatech.pmapi.projectlib.model.dto.AnnualLibImportDTO; | |||
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectApprovedReq; | |||
import com.ningdatech.pmapi.projectlib.model.req.ProjectIdReq; | |||
@@ -204,4 +206,9 @@ public class AnnualPlanLibManage { | |||
// TODO | |||
} | |||
public void updateAnnualPlan(ProjectDTO req) { | |||
Project project = BeanUtil.copyProperties(req, Project.class); | |||
projectService.updateById(project); | |||
} | |||
} |
@@ -17,7 +17,7 @@ import java.time.LocalDateTime; | |||
*/ | |||
@ApiModel(value = "NdProjectApplication对象", description = "") | |||
@Data | |||
public class ProjectApplicationDto implements Serializable { | |||
public class ProjectApplicationDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@@ -21,7 +21,7 @@ import java.util.Map; | |||
*/ | |||
@Data | |||
@ApiModel(value = "NdProjectDto", description = "") | |||
public class ProjectDto implements Serializable { | |||
public class ProjectDTO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@@ -281,7 +281,7 @@ public class ProjectDto implements Serializable { | |||
private String formId; | |||
@ApiModelProperty("项目应用实例") | |||
private List<ProjectApplicationDto> applicationList; | |||
private List<ProjectApplicationDTO> applicationList; | |||
@ApiModelProperty("流程状态") | |||
private Integer processStatus; |
@@ -1,8 +1,6 @@ | |||
package com.ningdatech.pmapi.projectlib.model.entity; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.*; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
@@ -233,8 +231,10 @@ public class Project implements Serializable { | |||
@ApiModelProperty("一地创新全省共享项目-是否开启 false:关闭 true:开启") | |||
private Boolean isInnovateWholeProvinceShare; | |||
@TableField(fill = FieldFill.INSERT) | |||
private LocalDateTime createOn; | |||
@TableField(fill = FieldFill.INSERT_UPDATE) | |||
private LocalDateTime updateOn; | |||
@ApiModelProperty("流程实例编号") | |||
@@ -285,8 +285,10 @@ public class Project implements Serializable { | |||
@ApiModelProperty("动态表单 json") | |||
private String dynamicForm; | |||
@TableField(fill = FieldFill.INSERT) | |||
private Long createBy; | |||
@TableField(fill = FieldFill.INSERT_UPDATE) | |||
private Long updateBy; | |||
} |
@@ -66,4 +66,8 @@ public class ProjectListReq extends PagePo { | |||
@ApiModelProperty("用户ID") | |||
private Long userId; | |||
@ApiModelProperty("是否临时增补 0:否 1:是") | |||
private Integer isTemporaryAugment; | |||
} |
@@ -24,6 +24,7 @@ import com.ningdatech.pmapi.common.model.entity.ExcelExportWriter; | |||
import com.ningdatech.pmapi.common.statemachine.event.ProjectStatusChangeEvent; | |||
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils; | |||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | |||
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum; | |||
import com.ningdatech.pmapi.projectlib.model.entity.Project; | |||
import com.ningdatech.pmapi.projectlib.service.IProjectService; | |||
import com.ningdatech.pmapi.todocenter.bean.entity.ProcessComment; | |||
@@ -42,7 +43,6 @@ import com.ningdatech.pmapi.todocenter.zwdd.model.MessageContent; | |||
import com.ningdatech.pmapi.todocenter.zwdd.model.MessageText; | |||
import com.ningdatech.pmapi.user.entity.UserInfo; | |||
import com.ningdatech.pmapi.user.service.IUserInfoService; | |||
import com.ningdatech.pmapi.user.util.LoginUserUtil; | |||
import com.wflow.bean.do_.UserDo; | |||
import com.wflow.bean.entity.WflowCcTasks; | |||
import com.wflow.bean.entity.WflowModelHistorys; | |||
@@ -78,6 +78,7 @@ 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; | |||
import org.flowable.task.api.Task; | |||
import org.flowable.task.api.TaskInfo; | |||
import org.flowable.task.api.TaskQuery; | |||
@@ -110,7 +111,6 @@ public class TodoCenterManage { | |||
private final RepositoryService repositoryService; | |||
private final RuntimeService runtimeService; | |||
private final UserDeptOrLeaderService userDeptOrLeaderService; | |||
private final ProcessInstanceService processService; | |||
private final FormService formService; | |||
private final ManagementService managementService; | |||
private final HistoryService historyService; | |||
@@ -137,8 +137,9 @@ public class TodoCenterManage { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
Long userId = 381496L; | |||
// Long userId = 6418616L; | |||
// Long userId = 381496L; | |||
Long userId = 6418616L; | |||
// Long userId = 61769799L; | |||
TaskQuery taskQuery = taskService.createTaskQuery(); | |||
taskQuery.active().taskCandidateOrAssigned(String.valueOf(userId)).orderByTaskCreateTime().desc(); | |||
List<Task> taskList = taskQuery.list(); | |||
@@ -300,10 +301,16 @@ public class TodoCenterManage { | |||
// Long userId = LoginUserUtil.getUserId(); | |||
// Long userId = 381496L; | |||
Long userId = 381496L; | |||
Long userId = 6418616L; | |||
// Long userId = 6418616L; | |||
// 若进行的是撤回操作(流程发起人和当前流程审核人的前一个审核人操作) | |||
if (param.getAction().equals(ProcessHandlerEnum.WITHDRAW)){ | |||
HistoricTaskInstance handledTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(param.getTaskId()).singleResult(); | |||
doWithDrawProcess(handledTaskInstance, userId); | |||
return; | |||
} | |||
Task task = taskService.createTaskQuery().taskId(param.getTaskId()).active().singleResult(); | |||
HashMap<String, Object> formData = new HashMap<>(32); | |||
if (Objects.isNull(task)) { | |||
@@ -330,10 +337,6 @@ public class TodoCenterManage { | |||
formService.updateInstanceFormData(param.getInstanceId(), formData); | |||
doBackTask(task, userId, param); | |||
break; | |||
// 撤回 | |||
case WITHDRAW: | |||
doWithDrawProcess(task, userId); | |||
break; | |||
default: | |||
throw new IllegalStateException("Unexpected value: " + param.getAction()); | |||
} | |||
@@ -354,33 +357,38 @@ public class TodoCenterManage { | |||
Map<String, Object> var = new HashMap<>(16); | |||
var.put("approve_" + task.getId(), param.getAction()); | |||
// 保存审核意见 | |||
if (hasComment(param.getAuditInfo())) { | |||
// 执行自定义的保存评论的功能 | |||
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | |||
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | |||
} | |||
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 | |||
// 获取流程定义 | |||
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); | |||
// 获取bpm对象 | |||
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | |||
// 获取根节点即流程发起节点 | |||
FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); | |||
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | |||
// TODO 中止流程并使项目进入对应状态,给项目创建人、流程发起人发送浙政钉工作通知:【项目名称】的【流程名称】被驳回,请及时处理。 | |||
sendWorkNoticeToStartUser(task, projectName, rootNode); | |||
// sendWorkNoticeToStartUser(task, projectName, rootNode); | |||
// 更新项目状态 | |||
updateRejectProjectStatus(task); | |||
updateRejectProjectStatus(userId,declaredProject); | |||
taskService.complete(param.getTaskId(), var); | |||
} | |||
/** | |||
* 当为驳回操作时,更新项目表中的项目状态 | |||
* | |||
* @param task 当前任务 | |||
* @param userId | |||
* @param declaredProject | |||
* @return void | |||
* @author CMM | |||
* @since 2023/02/08 | |||
*/ | |||
private void updateRejectProjectStatus(Task task) { | |||
// 获取当前登录用户 | |||
Long userId = LoginUserUtil.getUserId(); | |||
// 获取当前申报项目 | |||
Project declaredProject = projectService | |||
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | |||
private void updateRejectProjectStatus(Long userId, Project declaredProject) { | |||
// 获取当前流程项目状态 | |||
Integer projectStatusSecond = declaredProject.getStatus(); | |||
// 根据当前状态获取对应的通过事件 | |||
@@ -432,7 +440,7 @@ public class TodoCenterManage { | |||
Project declaredProject = projectService | |||
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | |||
// 更新项目状态到下一个状态 | |||
updatePassProjectStatus(task, userId, declaredProject); | |||
updatePassProjectStatus(userId, declaredProject); | |||
taskService.complete(param.getTaskId(), var); | |||
} | |||
@@ -458,19 +466,48 @@ public class TodoCenterManage { | |||
managementService.executeCommand(new SaveCommentCmd(param.getTaskId(), param.getInstanceId(), | |||
String.valueOf(userId), JSONObject.toJSONString(param.getAuditInfo()))); | |||
} | |||
updatePassProjectStatus(task, userId, declaredProject); | |||
taskService.complete(param.getTaskId(), var); | |||
// 获取bpm对象 | |||
BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId()); | |||
// 传节点定义key 获取当前节点 | |||
FlowNode currentNode = (FlowNode) bpmnModel.getFlowElement(task.getTaskDefinitionKey()); | |||
// TODO 若当前流程是预审流程,需要在提交预审申报的时候,调用状态机判断申报后的项目状态, | |||
// 若是省级部门联审中,要对接外部接口,获取省级部门联审的结果,更新项目状态(预审申报提交的时候处理) | |||
// 需要先通过后才能有下一个节点的信息 | |||
taskService.complete(param.getTaskId(), var); | |||
// 获取流程下一个节点的审核用户ID | |||
String nextUserId = getNextUserId(currentNode, processInstanceId); | |||
// 若有下一个审核人,向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 | |||
// 获取当前流程状态 | |||
Integer status = declaredProject.getStatus(); | |||
// 若当前登录用户是最后一个审批人 | |||
HistoricProcessInstance instance = historyService | |||
.createHistoricProcessInstanceQuery() | |||
.processInstanceId(processInstanceId) | |||
.singleResult(); | |||
if (HisProInsEndActId.END.equals(instance.getEndActivityId())) { | |||
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; | |||
default: | |||
throw new IllegalStateException("Unexpected value: " + status); | |||
} | |||
} | |||
// 若有下一个审核人(当前节点的用户),向其发送浙政钉工作通知:标题:审核任务 内容:【单位名称】的【项目名称】需要您审核。 | |||
if (Objects.nonNull(nextUserId)) { | |||
UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); | |||
// UserInfo auditUserInfo = userInfoService.getById(Long.valueOf(nextUserId)); | |||
// TODO 获取浙政钉用户dingKey,向其发送浙政钉工作通知 | |||
String msg = String.format(PASS_MSG_TEMPLATE, null, projectName); | |||
// sendWorkNotice(auditUserInfo,msg); | |||
@@ -478,22 +515,20 @@ public class TodoCenterManage { | |||
// 若没有,向发起人发送浙政钉工作通知:【项目名称】已通过【流程名称】,请及时开始下一步操作。 | |||
// TODO 向其发送浙政钉工作通知 获取根节点的孩子节点(即发起人节点),向其发送浙政钉工作通知 | |||
// 获取根节点即流程发起节点 | |||
FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | |||
// FlowNode rootNode = (FlowNode) bpmnModel.getFlowElement("root"); | |||
// sendWorkNoticeToStartUser(task, projectName, rootNode); | |||
} | |||
} | |||
/** | |||
* 当为通过操作时,更新项目表中项目状态 | |||
* | |||
* @param task 当前任务 | |||
* @param userId | |||
* @param declaredProject | |||
* @return void | |||
* @author CMM | |||
* @since 2023/02/08 | |||
*/ | |||
private void updatePassProjectStatus(Task task, Long userId, Project declaredProject) { | |||
private void updatePassProjectStatus(Long userId, Project declaredProject) { | |||
// 获取当前流程项目状态 | |||
Integer projectStatusSecond = declaredProject.getStatus(); | |||
// 根据当前状态获取对应的通过事件 | |||
@@ -520,7 +555,7 @@ public class TodoCenterManage { | |||
* @since 2023/02/03 | |||
*/ | |||
private void sendWorkNoticeToStartUser(Task task, String projectName, FlowNode rootNode) { | |||
String startUserId = getRootUserId(rootNode); | |||
String startUserId = getRootUserId(rootNode, task.getProcessInstanceId()); | |||
UserInfo startUserInfo = userInfoService.getById(Long.valueOf(startUserId)); | |||
// 从历史表获取最新版本的流程 | |||
WflowModels wflowModels = getLastWflowModels(task); | |||
@@ -530,14 +565,15 @@ public class TodoCenterManage { | |||
} | |||
/** | |||
* 获取流程发起节点的浙政钉用户ID | |||
* 获取流程发起节点的用户ID | |||
* | |||
* @param rootNode 根节点 | |||
* @param processInstanceId | |||
* @return java.lang.String | |||
* @author CMM | |||
* @since 2023/02/02 | |||
*/ | |||
private String getRootUserId(FlowNode rootNode) { | |||
private String getRootUserId(FlowNode rootNode, String processInstanceId) { | |||
String rootUserId = null; | |||
// 输出连线 | |||
List<SequenceFlow> outgoingFlows = rootNode.getOutgoingFlows(); | |||
@@ -548,8 +584,11 @@ public class TodoCenterManage { | |||
// TODO 若要会签需判断候选人 | |||
// 发起事件 | |||
if (targetFlowElement instanceof StartEvent) { | |||
UserTask userTask = (UserTask) targetFlowElement; | |||
rootUserId = userTask.getAssignee(); | |||
String actId = targetFlowElement.getId(); | |||
ActivityInstance activityInstance = runtimeService.createActivityInstanceQuery() | |||
.processInstanceId(processInstanceId).activityId(actId).singleResult(); | |||
String executionId = activityInstance.getExecutionId(); | |||
rootUserId = runtimeService.getVariable(executionId, "initiator", String.class); | |||
break; | |||
} | |||
} | |||
@@ -560,7 +599,7 @@ public class TodoCenterManage { | |||
/** | |||
* 获取当前节点的下一个节点的审核用户ID | |||
* | |||
* @param currentNode 当前节点 | |||
* @param currentNode 当前节点 | |||
* @param processInstanceId | |||
* @return java.lang.String 下一个节点的浙政钉用户ID | |||
* @author CMM | |||
@@ -646,70 +685,106 @@ public class TodoCenterManage { | |||
/** | |||
* 撤销流程处理 | |||
* | |||
* @param task 当前任务 | |||
* @param userId | |||
* @param handledTaskInstance 已处理的历史任务实例 | |||
* @param userId 当前登录用户ID | |||
*/ | |||
private void doWithDrawProcess(Task task, Long userId) { | |||
// 获取流程定义 | |||
Process process = ProcessDefinitionUtil.getProcess(task.getProcessDefinitionId()); | |||
// 获取当前运行流程的发起人节点信息 | |||
FlowNode rootNode = (FlowNode) process.getFlowElement("root", true); | |||
// 获取当前节点 | |||
FlowNode currentNode = (FlowNode) process.getFlowElement(task.getTaskDefinitionKey(), true); | |||
String rootUserId = getRootUserId(rootNode); | |||
private void doWithDrawProcess(HistoricTaskInstance handledTaskInstance, Long userId) { | |||
String processInstanceId = handledTaskInstance.getProcessInstanceId(); | |||
// 获取当前流程实例待审核任务信息 | |||
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult(); | |||
// 获取当前流程实例信息 | |||
HistoricProcessInstance historicProcessInstance = historyService | |||
.createHistoricProcessInstanceQuery() | |||
.processInstanceId(processInstanceId) | |||
.singleResult(); | |||
// 流程发起人ID | |||
String startUserId = historicProcessInstance.getStartUserId(); | |||
// 获取当前申报项目 | |||
Project declaredProject = projectService.getOne(Wrappers.lambdaQuery(Project.class) | |||
.eq(Project::getInstCode, processInstanceId)); | |||
String projectName = declaredProject.getProjectName(); | |||
// 获取bpm对象 | |||
BpmnModel bpmnModel = repositoryService.getBpmnModel(handledTaskInstance.getProcessDefinitionId()); | |||
// 传节点定义key 获取传入节点(撤回操作人在流程配置中所在的节点) | |||
FlowNode handledNode = (FlowNode) bpmnModel.getFlowElement(handledTaskInstance.getTaskDefinitionKey()); | |||
// 获取当前流程状态 | |||
Integer status = declaredProject.getStatus(); | |||
// 判断当前登录用户是否是流程发起人 | |||
if (rootUserId.equals(String.valueOf(userId))) { | |||
if (startUserId.equals(String.valueOf(userId))) { | |||
// TODO 若是流程发起人点击撤回,项目回到上一个状态,并删除当前审核人对应的待办记录 | |||
updateWithdrawProjectStatus(task, userId); | |||
// 若是流程发起人点击撤回,项目回到上一个状态,需调用状态机更新项目状态 | |||
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; | |||
default: | |||
throw new IllegalStateException("Unexpected value: " + status); | |||
} | |||
List<Execution> executions = runtimeService.createExecutionQuery() | |||
.processInstanceId(task.getProcessInstanceId()).onlyChildExecutions().list(); | |||
.processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); | |||
// 强制流程指向撤回 | |||
runtimeService.createChangeActivityStateBuilder().processInstanceId(task.getProcessInstanceId()) | |||
runtimeService.createChangeActivityStateBuilder() | |||
.processInstanceId(task.getProcessInstanceId()) | |||
.moveActivityIdTo(task.getTaskDefinitionKey(), HisProInsEndActId.WITHDRAW) | |||
.moveExecutionsToSingleActivityId( | |||
executions.stream().map(Execution::getId).collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) | |||
.moveExecutionsToSingleActivityId(executions.stream() | |||
.map(Execution::getId) | |||
.collect(Collectors.toList()), HisProInsEndActId.WITHDRAW) | |||
.changeState(); | |||
} else { | |||
FlowElementsContainer parentContainer = currentNode.getParentContainer(); | |||
for (FlowElement flowElement : parentContainer.getFlowElements()) { | |||
UserTask beforeUserTask = (UserTask) flowElement; | |||
if (beforeUserTask.getAssignee().equals(String.valueOf(userId))) { | |||
// TODO 若是前一个审核人点击撤回,在审核记录中移除自己提交过的审核意见、 | |||
// 待我处理中移除当前审核人的待办记录、 | |||
// 待我处理中增加自己的待办记录、 | |||
// 我已处理中去掉自己之前处理的记录 | |||
// 更新项目状态 | |||
updateWithdrawProjectStatus(task, userId); | |||
HistoricTaskInstance beforeTaskInstance = | |||
historyService.createHistoricTaskInstanceQuery().taskId(beforeUserTask.getId()).singleResult(); | |||
List<Execution> executions = runtimeService.createExecutionQuery() | |||
.processInstanceId(beforeTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); | |||
// 强制流程指向撤回 | |||
runtimeService.createChangeActivityStateBuilder().processInstanceId(task.getProcessInstanceId()) | |||
.moveActivityIdTo(flowElement.getId(), HisProInsEndActId.WITHDRAW) | |||
.moveExecutionsToSingleActivityId( | |||
executions.stream().map(Execution::getId).collect(Collectors.toList()), | |||
HisProInsEndActId.WITHDRAW) | |||
.changeState(); | |||
break; | |||
} | |||
// TODO 获取前一个审核节点审核人信息 | |||
// TODO 判断前一个审核人的部门和当前登录用户的部门是否是同一个,如果是同一个才可以撤回,否则抛出异常 | |||
Boolean orgFlag = true; | |||
if (orgFlag){ | |||
// 注意:是前一个审核人,说明此时仍在一个审核流程中,项目状态不需要改变 | |||
// 在审核记录中移除前一个审核人提交过的审核意见 | |||
Comment comment = taskService.getProcessInstanceComments(processInstanceId).stream() | |||
.filter(c -> c.getTaskId().equals(handledTaskInstance.getId())) | |||
.findFirst() | |||
.get(); | |||
taskService.deleteComment(comment.getId()); | |||
// 我已处理中去掉自己之前处理的记录 | |||
String taskInstanceId = handledTaskInstance.getId(); | |||
historyService.deleteHistoricTaskInstance(taskInstanceId); | |||
List<Execution> executions = runtimeService.createExecutionQuery() | |||
.processInstanceId(handledTaskInstance.getProcessInstanceId()).onlyChildExecutions().list(); | |||
// 强制流程指向前一个审核人节点 | |||
runtimeService.createChangeActivityStateBuilder() | |||
.processInstanceId(task.getProcessInstanceId()) | |||
.moveActivityIdsToSingleActivityId(executions.stream() | |||
.map(Execution::getActivityId) | |||
.collect(Collectors.toList()), handledNode.getId()) | |||
.changeState(); | |||
}else { | |||
throw new BizException("下一个审核人和您不是同一个部门,无法撤回!"); | |||
} | |||
} | |||
} | |||
/** | |||
* 当为撤回操作时,更新项目表中的项目状态为前一个状态 | |||
* | |||
* @param task 当前任务 | |||
* @param userId | |||
* @param declaredProject | |||
* @return void | |||
* @author CMM | |||
* @since 2023/02/08 | |||
*/ | |||
private void updateWithdrawProjectStatus(Task task, Long userId) { | |||
// 获取当前申报项目 | |||
Project declaredProject = projectService | |||
.getOne(Wrappers.lambdaQuery(Project.class).eq(Project::getInstCode, task.getProcessInstanceId())); | |||
private void updateWithdrawProjectStatus(Long userId, Project declaredProject) { | |||
// 获取当前流程项目状态 | |||
Integer projectStatusSecond = declaredProject.getStatus(); | |||
// 根据当前状态获取对应的撤回事件 | |||
@@ -923,7 +998,10 @@ public class TodoCenterManage { | |||
public PageVo<ResToBeProcessedDTO> queryHandledProjectList(ReqToBeProcessedDTO param) { | |||
// 获取登录用户ID | |||
// long userId = LoginUserUtil.getUserId(); | |||
Long userId = 381496L; | |||
// Long userId = 6418616L; | |||
// Long userId = 61769799L; | |||
// 自定义sql查询所有已办的任务实例 | |||
String nativeSql = "SELECT aht.* FROM ACT_HI_TASKINST AS aht \n" | |||
@@ -1,13 +1,12 @@ | |||
package com.ningdatech.pmapi.user.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
/** | |||
* <p> | |||
* 前端控制器 | |||
* 前端控制器 | |||
* </p> | |||
* | |||
* @author Lierbao | |||
@@ -17,4 +16,5 @@ import org.springframework.stereotype.Controller; | |||
@RequestMapping("/pmapi.user/nd-user-info") | |||
public class NdUserInfoController { | |||
} |
@@ -1,9 +1,23 @@ | |||
package com.ningdatech.pmapi.user.controller; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import com.fasterxml.jackson.databind.ObjectMapper; | |||
import com.ningdatech.basic.util.StrPool; | |||
import com.ningdatech.pmapi.common.constant.BizConst; | |||
import com.ningdatech.pmapi.user.security.auth.constants.SessionTimeConstant; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.http.MediaType; | |||
import org.springframework.web.bind.annotation.*; | |||
import org.springframework.stereotype.Controller; | |||
import javax.servlet.http.Cookie; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.IOException; | |||
/** | |||
* <p> | |||
@@ -13,8 +27,55 @@ import org.springframework.stereotype.Controller; | |||
* @author Liuxinxin | |||
* @since 2023-01-04 | |||
*/ | |||
@Controller | |||
@RequestMapping("/pmapi.user/user-auth") | |||
@RestController | |||
@RequestMapping("/api/v1/user/auth") | |||
@Api(tags = {"用户鉴权-相关接口"}) | |||
@RequiredArgsConstructor | |||
public class UserAuthController { | |||
private final ObjectMapper objectMapper; | |||
@PostMapping(value = "/login/password", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) | |||
@ApiOperation(value = "账号密码的登陆方式") | |||
@ApiImplicitParams({ | |||
@ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "form", dataType = "String"), | |||
@ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "form", dataType = "String")}) | |||
public void loginByUsernameAndPassword(@RequestParam("username") String username, | |||
@RequestParam("password") String password) { | |||
// 不实现任何内容,只是为了出api文档 | |||
} | |||
@PostMapping(value = "/logout") | |||
@ApiOperation(value = "退出登陆") | |||
public void logout() { | |||
// 不实现任何内容,具体实现交由Spring Security进行管理 | |||
} | |||
/** | |||
* 当需要身份认证时,跳转到这里 | |||
*/ | |||
@GetMapping("/auth-require") | |||
@CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) | |||
public void requireAuthentication(HttpServletResponse response) throws IOException { | |||
response.setContentType(StrPool.CONTENT_TYPE); | |||
response.setStatus(HttpStatus.UNAUTHORIZED.value()); | |||
response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); | |||
} | |||
/** | |||
* 设置session失效 | |||
*/ | |||
@GetMapping("/invalid-session") | |||
@CrossOrigin(originPatterns = "*", allowCredentials = "true", maxAge = 3600) | |||
public void invalidSession(HttpServletRequest request, HttpServletResponse response) throws IOException { | |||
response.setContentType(StrPool.CONTENT_TYPE); | |||
Cookie cookie = new Cookie(BizConst.COOKIE_KEY, null); | |||
cookie.setPath(request.getContextPath() + "/"); | |||
cookie.setMaxAge(SessionTimeConstant.SESSION_TIME_SECONDS); | |||
response.addCookie(cookie); | |||
response.setStatus(HttpStatus.UNAUTHORIZED.value()); | |||
response.getWriter().write(objectMapper.writeValueAsString(BizConst.UNAUTHENTICATED)); | |||
} | |||
} |
@@ -1,9 +1,21 @@ | |||
package com.ningdatech.pmapi.user.controller; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.user.manage.UserInfoManage; | |||
import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | |||
import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | |||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Controller; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import javax.validation.Valid; | |||
/** | |||
* <p> | |||
* 用户信息表 前端控制器 | |||
@@ -13,7 +25,23 @@ import org.springframework.web.bind.annotation.RequestMapping; | |||
* @since 2023-01-04 | |||
*/ | |||
@Controller | |||
@RequestMapping("/pmapi.user/user-info") | |||
@RequestMapping("/api/v1/user-info") | |||
@RequiredArgsConstructor | |||
@Api(value = "UserInfoController", tags = "用户管理") | |||
public class UserInfoController { | |||
private final UserInfoManage userInfoManage; | |||
@ApiOperation(value = "用户列表搜索", notes = "用户列表搜索") | |||
@PostMapping("/list") | |||
public PageVo<ResUserInfoListVO> userInfoList(@Valid @RequestBody ReqUserInfoListPO reqUserInfoListPO) { | |||
return userInfoManage.list(reqUserInfoListPO); | |||
} | |||
@ApiOperation(value = "用户禁用", notes = "用户禁用") | |||
@PostMapping("/disable") | |||
public void disable(@Valid @RequestBody ReqUserDisablePO reqUserDisablePO){ | |||
userInfoManage.disable(reqUserDisablePO); | |||
} | |||
} |
@@ -18,7 +18,13 @@ public class UserAuthLoginManage { | |||
private final IUserAuthService iUserAuthService; | |||
private final IUserInfoService iUserInfoService; | |||
public UserFullInfoDTO queryUserInfoInPasswordAuth(String username){ | |||
return null; | |||
public UserFullInfoDTO queryUserInfoInPasswordAuth(String username) { | |||
UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO(); | |||
userFullInfoDTO.setCompanyId(1L); | |||
userFullInfoDTO.setUserId(1L); | |||
userFullInfoDTO.setIdentifier("123456"); | |||
userFullInfoDTO.setRealName("测试账号"); | |||
userFullInfoDTO.setUsername("测试账号"); | |||
return userFullInfoDTO; | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.ningdatech.pmapi.user.manage; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.ningdatech.pmapi.user.mapper.UserInfoMapper; | |||
import com.ningdatech.pmapi.user.model.po.ReqUserDisablePO; | |||
import com.ningdatech.pmapi.user.model.po.ReqUserInfoListPO; | |||
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; | |||
import lombok.RequiredArgsConstructor; | |||
import org.springframework.stereotype.Component; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/13 上午9:09 | |||
*/ | |||
@Component | |||
@RequiredArgsConstructor | |||
public class UserInfoManage { | |||
private final UserInfoMapper userInfoMapper; | |||
public PageVo<ResUserInfoListVO> list(ReqUserInfoListPO reqUserInfoListPO) { | |||
return null; | |||
} | |||
public void disable(ReqUserDisablePO reqUserDisablePO) { | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
package com.ningdatech.pmapi.user.model.po; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/13 上午9:31 | |||
*/ | |||
@Data | |||
@ApiModel("用户禁用PO") | |||
public class ReqUserDisablePO { | |||
@NotBlank(message = "用户ID不能为空") | |||
@ApiModelProperty("用户id") | |||
private Long userId; | |||
} |
@@ -0,0 +1,37 @@ | |||
package com.ningdatech.pmapi.user.model.po; | |||
import com.ningdatech.basic.model.PagePo; | |||
import com.ningdatech.pmapi.sys.model.entity.Role; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/13 上午9:10 | |||
*/ | |||
@Data | |||
@ApiModel("用户管理查询 请求入参") | |||
public class ReqUserInfoListPO extends PagePo { | |||
@ApiModelProperty("姓名") | |||
private String name; | |||
@ApiModelProperty("手机号码") | |||
private String phoneNo; | |||
@ApiModelProperty("所在单位(主职)") | |||
private String orgName; | |||
@ApiModelProperty("所属区域") | |||
private Long regionId; | |||
@ApiModelProperty("用户角色") | |||
private List<Role> userRoleList; | |||
@ApiModelProperty("状态") | |||
private String status; | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.ningdatech.pmapi.user.model.vo; | |||
import com.ningdatech.pmapi.sys.model.entity.Role; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/13 上午9:10 | |||
*/ | |||
@Data | |||
@ApiModel("用户管理查询 请求response") | |||
public class ResUserInfoListVO { | |||
@ApiModelProperty("用户id") | |||
private Long userId; | |||
@ApiModelProperty("姓名") | |||
private String name; | |||
@ApiModelProperty("手机号码") | |||
private String phoneNo; | |||
@ApiModelProperty("所在单位(主职)") | |||
private String orgName; | |||
@ApiModelProperty("所在单位(主职)id") | |||
private Long orgId; | |||
@ApiModelProperty("所属区域") | |||
private Long regionId; | |||
@ApiModelProperty("用户角色") | |||
private List<Role> userRoleList; | |||
@ApiModelProperty("状态") | |||
private String status; | |||
@ApiModelProperty("更新时间") | |||
private LocalDateTime updateTime; | |||
} |
@@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollectionUtil; | |||
import com.ningdatech.basic.auth.AbstractLoginUser; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.security.core.GrantedAuthority; | |||
import org.springframework.security.core.authority.SimpleGrantedAuthority; | |||
import org.springframework.security.core.userdetails.UserDetails; | |||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
import java.util.List; | |||
@@ -41,8 +43,11 @@ public class UserInfoDetails extends AbstractLoginUser implements UserDetails { | |||
*/ | |||
@Override | |||
public Collection<? extends GrantedAuthority> getAuthorities() { | |||
SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(this.role); | |||
return CollectionUtil.toList(simpleGrantedAuthority); | |||
if (StringUtils.isNotBlank(role)) { | |||
SimpleGrantedAuthority simpleGrantedAuthority = new SimpleGrantedAuthority(this.role); | |||
return CollectionUtil.toList(simpleGrantedAuthority); | |||
} | |||
return new ArrayList<>(); | |||
} | |||
@Override | |||
@@ -31,7 +31,8 @@ public class UsernamePasswordAuthProvider implements AuthenticationProvider { | |||
if (user == null) { | |||
throw new InternalAuthenticationServiceException("can not get user info!"); | |||
} | |||
additionalAuthenticationChecks(user, authenticationToken); | |||
// TODO 开发使用暂时关闭账号密码验证 | |||
// additionalAuthenticationChecks(user, authenticationToken); | |||
// 校验用户是否有当前端的登陆权限 | |||
// 将用户定义的user放入token中,这样可以在session中查询到所有自定义的用户信息 | |||
return new UsernamePasswordAuthToken(user, user.getPassword(), user.getAuthorities()); | |||