增加页面存储当前用户对象
This commit is contained in:
parent
9b948b4b5a
commit
71b80b57e1
@ -0,0 +1,44 @@
|
|||||||
|
package ink.wgink.module.activiti.pojo.vos.oa.page;
|
||||||
|
|
||||||
|
import ink.wgink.pojo.dtos.department.DepartmentSimpleDTO;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: CurrentUserVO
|
||||||
|
* @Description: 当前用户
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2022/4/27 23:17
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class CurrentUserVO {
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
private String userName;
|
||||||
|
private List<DepartmentSimpleDTO> departments;
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId == null ? "" : userId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName == null ? "" : userName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DepartmentSimpleDTO> getDepartments() {
|
||||||
|
return departments == null ? new ArrayList() : departments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartments(List<DepartmentSimpleDTO> departments) {
|
||||||
|
this.departments = departments;
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ public class FieldVO {
|
|||||||
private Integer isEditable;
|
private Integer isEditable;
|
||||||
private Integer isVisible;
|
private Integer isVisible;
|
||||||
private String editHistory;
|
private String editHistory;
|
||||||
|
private String autoBackFill;
|
||||||
|
|
||||||
public String getFieldName() {
|
public String getFieldName() {
|
||||||
return fieldName == null ? "" : fieldName.trim();
|
return fieldName == null ? "" : fieldName.trim();
|
||||||
@ -45,4 +46,12 @@ public class FieldVO {
|
|||||||
public void setEditHistory(String editHistory) {
|
public void setEditHistory(String editHistory) {
|
||||||
this.editHistory = editHistory;
|
this.editHistory = editHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAutoBackFill() {
|
||||||
|
return autoBackFill == null ? "" : autoBackFill.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAutoBackFill(String autoBackFill) {
|
||||||
|
this.autoBackFill = autoBackFill;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,15 +8,13 @@ import ink.wgink.interfaces.user.IUserBaseService;
|
|||||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO;
|
import ink.wgink.module.activiti.pojo.dtos.oa.NodeButtonDTO;
|
||||||
import ink.wgink.module.activiti.pojo.dtos.oa.NodeFieldDTO;
|
import ink.wgink.module.activiti.pojo.dtos.oa.NodeFieldDTO;
|
||||||
import ink.wgink.module.activiti.pojo.pos.oa.OaNodeAssigneePO;
|
import ink.wgink.module.activiti.pojo.pos.oa.OaNodeAssigneePO;
|
||||||
import ink.wgink.module.activiti.pojo.vos.oa.page.FormButtonVO;
|
import ink.wgink.module.activiti.pojo.vos.oa.page.*;
|
||||||
import ink.wgink.module.activiti.pojo.vos.oa.page.ConfirmAssigneeVO;
|
|
||||||
import ink.wgink.module.activiti.pojo.vos.oa.page.FieldVO;
|
|
||||||
import ink.wgink.module.activiti.pojo.vos.oa.page.GoBackUserTaskVO;
|
|
||||||
import ink.wgink.module.activiti.service.activiti.IActivitiModelService;
|
import ink.wgink.module.activiti.service.activiti.IActivitiModelService;
|
||||||
import ink.wgink.module.activiti.service.oa.*;
|
import ink.wgink.module.activiti.service.oa.*;
|
||||||
import ink.wgink.module.form.enums.design.FormTypeEnum;
|
import ink.wgink.module.form.enums.design.FormTypeEnum;
|
||||||
import ink.wgink.module.form.service.design.IFormFieldService;
|
import ink.wgink.module.form.service.design.IFormFieldService;
|
||||||
import ink.wgink.module.form.service.report.IFormReportRouteService;
|
import ink.wgink.module.form.service.report.IFormReportRouteService;
|
||||||
|
import ink.wgink.pojo.bos.UserInfoBO;
|
||||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
import org.activiti.bpmn.model.FlowNode;
|
import org.activiti.bpmn.model.FlowNode;
|
||||||
import org.activiti.bpmn.model.SequenceFlow;
|
import org.activiti.bpmn.model.SequenceFlow;
|
||||||
@ -89,6 +87,7 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
|||||||
|
|
||||||
setPageFields(deploymentId, firstUserTask, model);
|
setPageFields(deploymentId, firstUserTask, model);
|
||||||
setPageFormButtonsAndHistoryUserTasks(deploymentId, null, firstUserTask, model);
|
setPageFormButtonsAndHistoryUserTasks(deploymentId, null, firstUserTask, model);
|
||||||
|
setPageCurrentUser(model);
|
||||||
formReportRouteService.save(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse, model);
|
formReportRouteService.save(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,10 +118,25 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
|||||||
|
|
||||||
setPageFields(deploymentId, currentUserTask, model);
|
setPageFields(deploymentId, currentUserTask, model);
|
||||||
setPageFormButtonsAndHistoryUserTasks(deploymentId, null, currentUserTask, model);
|
setPageFormButtonsAndHistoryUserTasks(deploymentId, null, currentUserTask, model);
|
||||||
|
setPageCurrentUser(model);
|
||||||
// 设置代理人
|
// 设置代理人
|
||||||
formReportRouteService.update(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse, model);
|
formReportRouteService.update(formCode, formVersion, httpSession, httpServletRequest, httpServletResponse, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置页面当前用户
|
||||||
|
*
|
||||||
|
* @param model
|
||||||
|
*/
|
||||||
|
private void setPageCurrentUser(Map<String, Object> model) {
|
||||||
|
CurrentUserVO currentUserVO = new CurrentUserVO();
|
||||||
|
UserInfoBO currentUser = securityComponent.getCurrentUser();
|
||||||
|
currentUserVO.setUserId(currentUser.getUserId());
|
||||||
|
currentUserVO.setUserName(currentUser.getUserName());
|
||||||
|
currentUserVO.setDepartments(currentUser.getDepartments());
|
||||||
|
model.put("currentUser", JSONObject.toJSONString(currentUserVO));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void show(String formCode, Integer formVersion, HttpSession httpSession, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
|
public void show(String formCode, Integer formVersion, HttpSession httpSession, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
|
||||||
Map<String, Object> model = getHashMap(10);
|
Map<String, Object> model = getHashMap(10);
|
||||||
@ -166,6 +180,7 @@ public class OaFormReportRouteServiceImpl extends DefaultBaseService implements
|
|||||||
fieldVO.setIsEditable(nodeFieldDTO.getIsEditable());
|
fieldVO.setIsEditable(nodeFieldDTO.getIsEditable());
|
||||||
fieldVO.setIsVisible(nodeFieldDTO.getIsVisible());
|
fieldVO.setIsVisible(nodeFieldDTO.getIsVisible());
|
||||||
fieldVO.setEditHistory(nodeFieldDTO.getEditHistory());
|
fieldVO.setEditHistory(nodeFieldDTO.getEditHistory());
|
||||||
|
nodeFieldDTO.getAutoBackFill();
|
||||||
return fieldVO;
|
return fieldVO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
model.put("fields", JSONObject.toJSONString(fieldVOs));
|
model.put("fields", JSONObject.toJSONString(fieldVOs));
|
||||||
|
@ -100,6 +100,8 @@ public class OaFormReportServiceImpl extends DefaultBaseService implements IOaFo
|
|||||||
setFormReportAssignee(oaFormReportUnWantedValueBO.getSelectType(), oaFormReportUnWantedValueBO.getAssignees(), params);
|
setFormReportAssignee(oaFormReportUnWantedValueBO.getSelectType(), oaFormReportUnWantedValueBO.getAssignees(), params);
|
||||||
}
|
}
|
||||||
setRecordFields(task.getId(), oaFormReportUnWantedValueBO.getRecordFields(), userId, userName, params);
|
setRecordFields(task.getId(), oaFormReportUnWantedValueBO.getRecordFields(), userId, userName, params);
|
||||||
|
// 保存代理人昵称
|
||||||
|
params.put(KEY_ASSIGNEE_USER_NAME, userName);
|
||||||
taskService.setVariablesLocal(task.getId(), params);
|
taskService.setVariablesLocal(task.getId(), params);
|
||||||
taskService.complete(task.getId(), params);
|
taskService.complete(task.getId(), params);
|
||||||
}
|
}
|
||||||
@ -132,6 +134,8 @@ public class OaFormReportServiceImpl extends DefaultBaseService implements IOaFo
|
|||||||
setFormReportAssignee(oaFormReportUnWantedValueBO.getSelectType(), oaFormReportUnWantedValueBO.getAssignees(), params);
|
setFormReportAssignee(oaFormReportUnWantedValueBO.getSelectType(), oaFormReportUnWantedValueBO.getAssignees(), params);
|
||||||
}
|
}
|
||||||
setRecordFields(taskId, oaFormReportUnWantedValueBO.getRecordFields(), userId, userName, params);
|
setRecordFields(taskId, oaFormReportUnWantedValueBO.getRecordFields(), userId, userName, params);
|
||||||
|
// 保存代理人昵称
|
||||||
|
params.put(KEY_ASSIGNEE_USER_NAME, userName);
|
||||||
taskService.setVariablesLocal(taskId, params);
|
taskService.setVariablesLocal(taskId, params);
|
||||||
taskService.complete(taskId, params);
|
taskService.complete(taskId, params);
|
||||||
}
|
}
|
||||||
@ -164,7 +168,8 @@ public class OaFormReportServiceImpl extends DefaultBaseService implements IOaFo
|
|||||||
taskSignJsonObject.put("time", currentTime);
|
taskSignJsonObject.put("time", currentTime);
|
||||||
reportParams.put(taskVariableKey, taskSignJsonObject.toJSONString());
|
reportParams.put(taskVariableKey, taskSignJsonObject.toJSONString());
|
||||||
if (StringUtils.equals(oaFormReportRecordFieldVO.getEditHistory(), FieldEditRecordEnum.LATEST.getValue())) {
|
if (StringUtils.equals(oaFormReportRecordFieldVO.getEditHistory(), FieldEditRecordEnum.LATEST.getValue())) {
|
||||||
// 审批存储在流程变量中
|
// 内容变更为 [签批人:XX。 内容:XXXXXX。 时间:XXXX-XX-XX XX:XX:XX]
|
||||||
|
reportParams.put(oaFormReportRecordFieldVO.getFieldName(), String.format("签批人:%s。 内容:%s。 时间:%s。", userName, reportRecordValue, currentTime));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (StringUtils.equals(oaFormReportRecordFieldVO.getEditHistory(), FieldEditRecordEnum.ALL.getValue())) {
|
if (StringUtils.equals(oaFormReportRecordFieldVO.getEditHistory(), FieldEditRecordEnum.ALL.getValue())) {
|
||||||
|
@ -225,12 +225,14 @@ public class OaServiceImpl extends DefaultBaseService implements IOaService {
|
|||||||
oaProcessLogDTO.setTaskName(historicTaskInstance.getName());
|
oaProcessLogDTO.setTaskName(historicTaskInstance.getName());
|
||||||
oaProcessLogDTO.setTaskStatus(ProcessTaskStatusEnum.ALREADY_DONE.getValue());
|
oaProcessLogDTO.setTaskStatus(ProcessTaskStatusEnum.ALREADY_DONE.getValue());
|
||||||
|
|
||||||
|
Map<String, Object> taskLocalVariables = historicTaskInstance.getTaskLocalVariables();
|
||||||
|
Object assigneeUserNameObj = taskLocalVariables.get(IOaFormReportService.KEY_ASSIGNEE_USER_NAME);
|
||||||
|
|
||||||
oaProcessLogDTO.setUserIds(userIds);
|
oaProcessLogDTO.setUserIds(userIds);
|
||||||
oaProcessLogDTO.setUserNames(userIds);
|
oaProcessLogDTO.setUserNames(assigneeUserNameObj == null ? "" : assigneeUserNameObj.toString());
|
||||||
oaProcessLogDTO.setStartTime(DateUtil.getDateTime(historicTaskInstance.getCreateTime()));
|
oaProcessLogDTO.setStartTime(DateUtil.getDateTime(historicTaskInstance.getCreateTime()));
|
||||||
oaProcessLogDTO.setEndTime(DateUtil.getDateTime(historicTaskInstance.getEndTime()));
|
oaProcessLogDTO.setEndTime(DateUtil.getDateTime(historicTaskInstance.getEndTime()));
|
||||||
oaProcessLogDTO.setUsedTime(DateUtil.getUsedTime(historicTaskInstance.getDurationInMillis()));
|
oaProcessLogDTO.setUsedTime(DateUtil.getUsedTime(historicTaskInstance.getDurationInMillis()));
|
||||||
oaProcessLogDTO.setTaskVariables(historicTaskInstance.getTaskLocalVariables());
|
|
||||||
oaProcessLogDTOs.add(oaProcessLogDTO);
|
oaProcessLogDTOs.add(oaProcessLogDTO);
|
||||||
});
|
});
|
||||||
// 待办
|
// 待办
|
||||||
@ -244,23 +246,24 @@ public class OaServiceImpl extends DefaultBaseService implements IOaService {
|
|||||||
oaProcessLogDTO.setTaskName(task.getName());
|
oaProcessLogDTO.setTaskName(task.getName());
|
||||||
oaProcessLogDTO.setTaskStatus(ProcessTaskStatusEnum.NEED_TO_BE_DEALT_WITH.getValue());
|
oaProcessLogDTO.setTaskStatus(ProcessTaskStatusEnum.NEED_TO_BE_DEALT_WITH.getValue());
|
||||||
|
|
||||||
|
Map<String, Object> taskLocalVariables = task.getTaskLocalVariables();
|
||||||
|
Object assigneeUserNameObj = taskLocalVariables.get(IOaFormReportService.KEY_ASSIGNEE_USER_NAME);
|
||||||
|
|
||||||
String userIdString = WStringUtil.listToStr(userIds, ",");
|
String userIdString = WStringUtil.listToStr(userIds, ",");
|
||||||
oaProcessLogDTO.setUserIds(userIdString);
|
oaProcessLogDTO.setUserIds(userIdString);
|
||||||
oaProcessLogDTO.setUserNames(userIdString);
|
oaProcessLogDTO.setUserNames(assigneeUserNameObj == null ? "" : assigneeUserNameObj.toString());
|
||||||
oaProcessLogDTO.setStartTime(DateUtil.getDateTime(task.getCreateTime()));
|
oaProcessLogDTO.setStartTime(DateUtil.getDateTime(task.getCreateTime()));
|
||||||
oaProcessLogDTO.setTaskVariables(task.getTaskLocalVariables());
|
|
||||||
oaProcessLogDTOs.add(oaProcessLogDTO);
|
oaProcessLogDTOs.add(oaProcessLogDTO);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 查询用户
|
// 查询用户
|
||||||
List<UserDTO> userDTOs = userBaseService.listByUserIds(userIdSet.stream().collect(Collectors.toList()));
|
// List<UserDTO> userDTOs = userBaseService.listByUserIds(userIdSet.stream().collect(Collectors.toList()));
|
||||||
oaProcessLogDTOs.forEach(oaProcessLogDTO -> {
|
// oaProcessLogDTOs.forEach(oaProcessLogDTO -> {
|
||||||
userDTOs.forEach(userDTO -> {
|
// userDTOs.forEach(userDTO -> {
|
||||||
if (StringUtils.contains(oaProcessLogDTO.getUserNames(), userDTO.getUserId())) {
|
// if (StringUtils.contains(oaProcessLogDTO.getUserNames(), userDTO.getUserId())) {
|
||||||
oaProcessLogDTO.setUserNames(oaProcessLogDTO.getUserNames().replaceAll(userDTO.getUserId(), userDTO.getUserName()));
|
// oaProcessLogDTO.setUserNames(oaProcessLogDTO.getUserNames().replaceAll(userDTO.getUserId(), userDTO.getUserName()));
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
return oaProcessLogDTOs;
|
return oaProcessLogDTOs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user