diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OALeaveController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OALeaveController.java new file mode 100644 index 000000000..8210f01e7 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OALeaveController.java @@ -0,0 +1,114 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa; + +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; +import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OALeaveConvert; +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; +import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OALeaveService; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + + +@Api(tags = "请假申请") +@RestController +@RequestMapping("/oa/leave") +@Validated +public class OALeaveController { + + @Resource + private OALeaveService leaveService; + + @PostMapping("/create") + @ApiOperation("创建请假申请") + @PreAuthorize("@ss.hasPermission('oa:leave:create')") + public CommonResult createLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) { + // TODO @芋艿:processKey 自己去理解下。不过得把 leave 变成枚举 + createReqVO.setProcessKey("leave"); + return success(leaveService.createLeave(createReqVO)); + } + + @PostMapping("/form-key/create") + @ApiOperation("创建外置请假申请") + public CommonResult createFormKeyLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) { + // TODO @芋艿:processKey 自己去理解下。不过得把 formkey 变成枚举 + createReqVO.setProcessKey("leave-formkey"); + return success(leaveService.createLeave(createReqVO)); + } + + @PutMapping("/update") + @ApiOperation("更新请假申请") + @PreAuthorize("@ss.hasPermission('oa:leave:update')") + public CommonResult updateLeave(@Valid @RequestBody OALeaveUpdateReqVO updateReqVO) { + leaveService.updateLeave(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @ApiOperation("删除请假申请") + @ApiImplicitParam(name = "id", value = "编号", required = true) + @PreAuthorize("@ss.hasPermission('oa:leave:delete')") + public CommonResult deleteLeave(@RequestParam("id") Long id) { + leaveService.deleteLeave(id); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得请假申请") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('oa:leave:query')") + public CommonResult getLeave(@RequestParam("id") Long id) { + OALeaveDO leave = leaveService.getLeave(id); + return success(OALeaveConvert.INSTANCE.convert(leave)); + } + + @GetMapping("/list") + @ApiOperation("获得请假申请列表") + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) + @PreAuthorize("@ss.hasPermission('oa:leave:query')") + public CommonResult> getLeaveList(@RequestParam("ids") Collection ids) { + List list = leaveService.getLeaveList(ids); + return success(OALeaveConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @ApiOperation("获得请假申请分页") + @PreAuthorize("@ss.hasPermission('oa:leave:query')") + public CommonResult> getLeavePage(@Valid OALeavePageReqVO pageVO) { + //值查询自己申请请假 + // TODO @芋艿:这里的传值,到底前端搞,还是后端搞。 + pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); + PageResult pageResult = leaveService.getLeavePage(pageVO); + return success(OALeaveConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @ApiOperation("导出请假申请 Excel") + @PreAuthorize("@ss.hasPermission('oa:leave:export')") + @OperateLog(type = EXPORT) + public void exportLeaveExcel(@Valid OALeaveExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = leaveService.getLeaveList(exportReqVO); + // 导出 Excel + List datas = OALeaveConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "请假申请.xls", "数据", OALeaveExcelVO.class, datas); + } + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveBaseVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveBaseVO.java new file mode 100644 index 000000000..bf88ec76c --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveBaseVO.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** +* 请假申请 Base VO,提供给添加、修改、详细的子 VO 使用 +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 +*/ +@Data +public class OALeaveBaseVO { + + @ApiModelProperty(value = "流程id") + private String processInstanceId; + + @ApiModelProperty(value = "状态", required = true) + private Integer status; + + @ApiModelProperty(value = "申请人id", required = true) + private String userId; + + @ApiModelProperty(value = "开始时间", required = true) + @NotNull(message = "开始时间不能为空") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date startTime; + + @ApiModelProperty(value = "结束时间", required = true) + @NotNull(message = "结束时间不能为空") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date endTime; + + @ApiModelProperty(value = "请假类型") + private String leaveType; + + @ApiModelProperty(value = "原因") + private String reason; + + @ApiModelProperty(value = "申请时间", required = true) + @NotNull(message = "申请时间不能为空") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private Date applyTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveCreateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveCreateReqVO.java new file mode 100644 index 000000000..956100f5a --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveCreateReqVO.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import lombok.*; +import io.swagger.annotations.*; + +@ApiModel("请假申请创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OALeaveCreateReqVO extends OALeaveBaseVO { + + private String processKey; +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveExcelVO.java new file mode 100644 index 000000000..d305ef6e5 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveExcelVO.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 请假申请 Excel VO + * + * @author 芋艿 + */ +@Data +public class OALeaveExcelVO { + + @ExcelProperty("请假表单主键") + private Long id; + + @ExcelProperty("流程id") + private String processInstanceId; + + @ExcelProperty("状态") + private Integer status; + + @ExcelProperty("申请人id") + private String userId; + + @ExcelProperty("开始时间") + private Date startTime; + + @ExcelProperty("结束时间") + private Date endTime; + + @ExcelProperty("请假类型") + private String leaveType; + + @ExcelProperty("原因") + private String reason; + + @ExcelProperty("申请时间") + private Date applyTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveExportReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveExportReqVO.java new file mode 100644 index 000000000..92d0f43a6 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveExportReqVO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel(value = "请假申请 Excel 导出 Request VO", description = "参数和 OaLeavePageReqVO 是一致的") +@Data +public class OALeaveExportReqVO { + + @ApiModelProperty(value = "流程id") + private String processInstanceId; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "申请人id") + private String userId; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始开始时间") + private Date beginStartTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束开始时间") + private Date endStartTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始结束时间") + private Date beginEndTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束结束时间") + private Date endEndTime; + + @ApiModelProperty(value = "请假类型") + private String leaveType; + + @ApiModelProperty(value = "原因") + private String reason; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始申请时间") + private Date beginApplyTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束申请时间") + private Date endApplyTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeavePageReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeavePageReqVO.java new file mode 100644 index 000000000..5c3306dcd --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeavePageReqVO.java @@ -0,0 +1,56 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import lombok.*; +import java.util.*; +import io.swagger.annotations.*; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@ApiModel("请假申请分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OALeavePageReqVO extends PageParam { + + @ApiModelProperty(value = "流程id") + private String processInstanceId; + + @ApiModelProperty(value = "状态") + private Integer status; + + @ApiModelProperty(value = "申请人id") + private String userId; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始开始时间") + private Date beginStartTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束开始时间") + private Date endStartTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始结束时间") + private Date beginEndTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束结束时间") + private Date endEndTime; + + @ApiModelProperty(value = "请假类型") + private String leaveType; + + @ApiModelProperty(value = "原因") + private String reason; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "开始申请时间") + private Date beginApplyTime; + + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + @ApiModelProperty(value = "结束申请时间") + private Date endApplyTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveRespVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveRespVO.java new file mode 100644 index 000000000..fe9c8d35e --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveRespVO.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import lombok.*; +import io.swagger.annotations.*; + +@ApiModel("请假申请 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OALeaveRespVO extends OALeaveBaseVO { + + @ApiModelProperty(value = "请假表单主键", required = true) + private Long id; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveUpdateReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveUpdateReqVO.java new file mode 100644 index 000000000..649e56dd4 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OALeaveUpdateReqVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import javax.validation.constraints.NotNull; +import java.util.Map; + +@ApiModel("请假申请更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class OALeaveUpdateReqVO extends OALeaveBaseVO { + + @ApiModelProperty(value = "请假表单主键", required = true) + @NotNull(message = "请假表单主键不能为空") + private Long id; + + // TODO @json:swagger 和 validator 的注解要加哈。 + + private String taskId; + + private String comment; + + private Map variables; + + // TODO @芋艿:variables 的作用是啥。 + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/oa/OALeaveConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/oa/OALeaveConvert.java new file mode 100644 index 000000000..48151383c --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/oa/OALeaveConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.convert.oa; + +import java.util.*; + +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; + +/** + * 请假申请 Convert + * + * @author 芋艿 + */ +@Mapper +public interface OALeaveConvert { + + OALeaveConvert INSTANCE = Mappers.getMapper(OALeaveConvert.class); + + OALeaveDO convert(OALeaveCreateReqVO bean); + + OALeaveDO convert(OALeaveUpdateReqVO bean); + + OALeaveRespVO convert(OALeaveDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/workflow/TaskConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/workflow/TaskConvert.java new file mode 100644 index 000000000..d461eb992 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/workflow/TaskConvert.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.convert.workflow; + +import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.TaskStepVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.TodoTaskRespVO; +import org.activiti.api.task.model.Task; +import org.activiti.engine.history.HistoricActivityInstance; +import org.activiti.engine.repository.ProcessDefinition; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.Mappings; +import org.mapstruct.Named; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface TaskConvert { + TaskConvert INSTANCE = Mappers.getMapper(TaskConvert.class); + + @Mappings(value = { + @Mapping(source = "task.id", target = "id"), + @Mapping(source = "task.businessKey", target = "businessKey"), + @Mapping(source = "task.assignee", target = "status",qualifiedByName = "convertAssigneeToStatus"), + @Mapping(source = "definition.name", target = "processName"), + @Mapping(source = "definition.key", target = "processKey") + }) + TodoTaskRespVO convert(Task task, ProcessDefinition definition); + + + @Named("convertAssigneeToStatus") + default Integer convertAssigneeToStatus(String assignee) { + //TODO 不应该通过 assignee 定义状态 需要定义更多的状态 + return assignee == null ? 1 : 2; + } + + @Mappings(value = { + @Mapping(source = "activityName", target = "stepName"), + @Mapping(source = "assignee", target = "assignee") + }) + TaskStepVO convert(HistoricActivityInstance instance); +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/workflow/TodoTaskConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/workflow/TodoTaskConvert.java deleted file mode 100644 index 787cbadd3..000000000 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/workflow/TodoTaskConvert.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.iocoder.yudao.adminserver.modules.activiti.convert.workflow; - -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface TodoTaskConvert { - TodoTaskConvert INSTANCE = Mappers.getMapper(TodoTaskConvert.class); -} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/oa/OALeaveDO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/oa/OALeaveDO.java new file mode 100644 index 000000000..c3d760c44 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/oa/OALeaveDO.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa; + +import lombok.*; +import java.util.*; +import com.baomidou.mybatisplus.annotation.*; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; + +/** + * 请假申请 DO + * + * @author 芋艿 + */ +@TableName("oa_leave") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class OALeaveDO extends BaseDO { + + /** + * 请假表单主键 + */ + @TableId + private Long id; + /** + * 流程id + */ + private String processInstanceId; + /** + * 状态 + */ + private Integer status; + /** + * 申请人id + */ + private String userId; + /** + * 开始时间 + */ + private Date startTime; + /** + * 结束时间 + */ + private Date endTime; + /** + * 请假类型 + */ + private String leaveType; + /** + * 原因 + */ + private String reason; + /** + * 申请时间 + */ + private Date applyTime; + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/oa/OaLeaveMapper.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/oa/OaLeaveMapper.java index 6a641c6c0..3254a16d6 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/oa/OaLeaveMapper.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/mysql/oa/OaLeaveMapper.java @@ -2,10 +2,10 @@ package cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa; import java.util.*; +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; @@ -15,10 +15,10 @@ import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; * @author 芋艿 */ @Mapper -public interface OaLeaveMapper extends BaseMapperX { +public interface OaLeaveMapper extends BaseMapperX { - default PageResult selectPage(OaLeavePageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(OALeavePageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .eqIfPresent("process_instance_id", reqVO.getProcessInstanceId()) .eqIfPresent("status", reqVO.getStatus()) .eqIfPresent("user_id", reqVO.getUserId()) @@ -30,8 +30,8 @@ public interface OaLeaveMapper extends BaseMapperX { .orderByDesc("id") ); } - default List selectList(OaLeaveExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(OALeaveExportReqVO reqVO) { + return selectList(new QueryWrapperX() .eqIfPresent("process_instance_id", reqVO.getProcessInstanceId()) .eqIfPresent("status", reqVO.getStatus()) .eqIfPresent("user_id", reqVO.getUserId()) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/OaErrorCodeConstants.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/OAErrorCodeConstants.java similarity index 89% rename from yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/OaErrorCodeConstants.java rename to yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/OAErrorCodeConstants.java index 78a946112..9a042fcb7 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/OaErrorCodeConstants.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/enums/OAErrorCodeConstants.java @@ -8,6 +8,6 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; * 001 oa * activiti 系统,使用 1-003-000-000 段 */ -public interface OaErrorCodeConstants { +public interface OAErrorCodeConstants { ErrorCode LEAVE_NOT_EXISTS = new ErrorCode(1003001001, "请假申请不存在"); } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/OALeaveService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/OALeaveService.java new file mode 100644 index 000000000..6d3ae3613 --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/OALeaveService.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.service.oa; + + +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveCreateReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveUpdateReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveExportReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeavePageReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + +/** + * 请假申请 Service 接口 + * + * @author 芋艿 + */ +public interface OALeaveService { + + /** + * 创建请假申请 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createLeave(@Valid OALeaveCreateReqVO createReqVO); + + /** + * 更新请假申请 + * + * @param updateReqVO 更新信息 + */ + void updateLeave(@Valid OALeaveUpdateReqVO updateReqVO); + + /** + * 删除请假申请 + * + * @param id 编号 + */ + void deleteLeave(Long id); + + /** + * 获得请假申请 + * + * @param id 编号 + * @return 请假申请 + */ + OALeaveDO getLeave(Long id); + + /** + * 获得请假申请列表 + * + * @param ids 编号 + * @return 请假申请列表 + */ + List getLeaveList(Collection ids); + + /** + * 获得请假申请分页 + * + * @param pageReqVO 分页查询 + * @return 请假申请分页 + */ + PageResult getLeavePage(OALeavePageReqVO pageReqVO); + + /** + * 获得请假申请列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 请假申请列表 + */ + List getLeaveList(OALeaveExportReqVO exportReqVO); + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java index c27ba2325..ad361d7e0 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/ReportBackEndProcessor.java @@ -1,8 +1,7 @@ package cn.iocoder.yudao.adminserver.modules.activiti.service.oa; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import org.activiti.engine.delegate.DelegateExecution; import org.activiti.engine.delegate.ExecutionListener; import org.springframework.stereotype.Component; @@ -17,27 +16,15 @@ public class ReportBackEndProcessor implements ExecutionListener { private OaLeaveMapper leaveMapper; -// @Override -// @Transactional(rollbackFor = Exception.class) -// public void notify(DelegateTask delegateTask) { -// final String businessKey = delegateTask.getExecution().getProcessInstanceBusinessKey(); -// UpdateWrapper updateWrapper = new UpdateWrapper<>(); -// updateWrapper.eq("id", Long.valueOf(businessKey)); -// OaLeaveDO updateDo = new OaLeaveDO(); -// updateDo.setStatus(2); -// leaveMapper.update(updateDo, updateWrapper); -// } - @Override @Transactional(rollbackFor = Exception.class) public void notify(DelegateExecution delegateExecution) { final String businessKey = delegateExecution.getProcessInstanceBusinessKey(); - // TODO @json:service 不要出现 dao 的元素,例如说 UpdateWrapper。这里,我们可以调用 updateById 方法 - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("id", Long.valueOf(businessKey)); - OaLeaveDO updateDo = new OaLeaveDO(); - updateDo.setStatus(2); // TODO @json:status 要枚举起来,不要出现 magic number - leaveMapper.update(updateDo, updateWrapper); + OALeaveDO updateDo = new OALeaveDO(); + updateDo.setId(Long.valueOf(businessKey)); + // TODO @json:status 要枚举起来,不要出现 magic number + updateDo.setStatus(2); + leaveMapper.updateById(updateDo); } } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OALeaveServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OALeaveServiceImpl.java new file mode 100644 index 000000000..694e8044b --- /dev/null +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OALeaveServiceImpl.java @@ -0,0 +1,137 @@ +package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl; + +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveCreateReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveUpdateReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveExportReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeavePageReqVO; +import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OALeaveConvert; +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; +import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; +import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OALeaveService; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import org.activiti.api.task.model.Task; +import org.activiti.api.task.model.builders.TaskPayloadBuilder; +import org.activiti.api.task.runtime.TaskRuntime; +import org.activiti.engine.RuntimeService; +import org.activiti.engine.runtime.ProcessInstance; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.*; + +import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OAErrorCodeConstants.LEAVE_NOT_EXISTS; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 请假申请 Service 实现类 + * + * @author 芋艿 + */ +@Service +@Validated +public class OALeaveServiceImpl implements OALeaveService { + + @Resource + private OaLeaveMapper leaveMapper; + + @Resource + private RuntimeService runtimeService; + + @Resource + private org.activiti.engine.TaskService activitiTaskService; + + @Resource + private TaskRuntime taskRuntime; + + @Override + @Transactional(rollbackFor = Exception.class) + public Long createLeave(OALeaveCreateReqVO createReqVO) { + // 插入 OA 请假单 + OALeaveDO leave = OALeaveConvert.INSTANCE.convert(createReqVO); + leave.setStatus(1); + leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); + leaveMapper.insert(leave); + + // 创建工作流 + Map variables = new HashMap<>(); + // 如何得到部门领导人,暂时写死 + variables.put("deptLeader", "admin"); // TODO @芋艿:需要部门的负责人 + Long id = leave.getId(); + String businessKey = String.valueOf(id); + ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables); + String processInstanceId = processInstance.getProcessInstanceId(); + + // 将工作流的编号,更新到 OA 请假单中 + OALeaveDO updateDo = new OALeaveDO(); + updateDo.setProcessInstanceId(processInstanceId); + updateDo.setId(id); + leaveMapper.updateById(updateDo); + return id; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateLeave(OALeaveUpdateReqVO updateReqVO) { + // 校验存在 + this.validateLeaveExists(updateReqVO.getId()); + + final Task task = taskRuntime.task(updateReqVO.getTaskId()); + activitiTaskService.addComment(task.getId(), task.getProcessInstanceId(), updateReqVO.getComment()); + Map variables = updateReqVO.getVariables(); + + //如何得到部门领导人, 暂时写死 + variables.put("deptLeader", "admin"); + taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()) + .withVariables(variables) + .build()); + + // TOTO @芋道源码 貌似 IDEA 会自动加上final(不需要加 final 哈。虽然是不变,但是代码比较少这么去写) + Object reApply = variables.get("reApply"); + if(Objects.equals(reApply, true)){ + // 更新 表单 + OALeaveDO updateObj = OALeaveConvert.INSTANCE.convert(updateReqVO); + leaveMapper.updateById(updateObj); + } + } + + @Override + public void deleteLeave(Long id) { + // 校验存在 + this.validateLeaveExists(id); + // 删除 + leaveMapper.deleteById(id); + // TODO @jason:需要调用 runtimeService 的 delete 方法,删除??? + // TOTO @芋道源码 目前页面暂时没有实现基于业务表单的删除, 该代码自动生成的。 + // TODO @芋道源码 我理解提交流程后,是不允许删除的? , 只能在流程处理中作废流程 + } + + private void validateLeaveExists(Long id) { + if (leaveMapper.selectById(id) == null) { + throw exception(LEAVE_NOT_EXISTS); + } + } + + @Override + public OALeaveDO getLeave(Long id) { + return leaveMapper.selectById(id); + } + + @Override + public List getLeaveList(Collection ids) { + return leaveMapper.selectBatchIds(ids); + } + + @Override + public PageResult getLeavePage(OALeavePageReqVO pageReqVO) { + return leaveMapper.selectPage(pageReqVO); + } + + @Override + public List getLeaveList(OALeaveExportReqVO exportReqVO) { + return leaveMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java index d03186416..f49a31166 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/TaskService.java @@ -12,7 +12,6 @@ public interface TaskService { void claimTask(String taskId); - void getTaskHistory(String taskId); void completeTask(TaskReqVO taskReq); diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java index a12447e74..bf7ba2cde 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/workflow/impl/TaskServiceImpl.java @@ -1,12 +1,12 @@ package cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.impl; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.adminserver.modules.activiti.controller.workflow.vo.*; -import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; +import cn.iocoder.yudao.adminserver.modules.activiti.convert.workflow.TaskConvert; import cn.iocoder.yudao.adminserver.modules.activiti.service.workflow.TaskService; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; -import com.google.common.collect.ImmutableMap; import org.activiti.api.runtime.shared.query.Page; import org.activiti.api.runtime.shared.query.Pageable; import org.activiti.api.task.model.Task; @@ -16,7 +16,6 @@ import org.activiti.api.task.runtime.TaskRuntime; import org.activiti.engine.HistoryService; import org.activiti.engine.RepositoryService; import org.activiti.engine.history.HistoricActivityInstance; -import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.repository.ProcessDefinition; import org.activiti.engine.task.Comment; import org.springframework.stereotype.Service; @@ -25,7 +24,6 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; @@ -44,13 +42,6 @@ public class TaskServiceImpl implements TaskService { @Resource private RepositoryService repositoryService; - @Resource - private OaLeaveMapper leaveMapper; - - private static Map taskVariable = ImmutableMap.builder() - .put("deptLeaderVerify","deptLeaderApproved") - .put("hrVerify","hrApproved") - .build(); public TaskServiceImpl() { @@ -58,25 +49,16 @@ public class TaskServiceImpl implements TaskService { @Override public PageResult getTodoTaskPage(TodoTaskPageReqVO pageReqVO) { - final LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); // TODO @jason:封装一个方法,用于转换成 activiti 的分页对象 final Pageable pageable = Pageable.of((pageReqVO.getPageNo() - 1) * pageReqVO.getPageSize(), pageReqVO.getPageSize()); Page pageTasks = taskRuntime.tasks(pageable); - // TODO @jason:convert 里转换 - List tasks = pageTasks.getContent(); int totalItems = pageTasks.getTotalItems(); + List tasks = pageTasks.getContent(); final List respVOList = tasks.stream().map(task -> { - TodoTaskRespVO respVO = new TodoTaskRespVO(); - respVO.setId(task.getId()); - final ProcessDefinition definition = repositoryService.getProcessDefinition(task.getProcessDefinitionId()); - respVO.setProcessName(definition.getName()); - respVO.setProcessKey(definition.getKey()); - respVO.setBusinessKey(task.getBusinessKey()); - respVO.setStatus(task.getAssignee() == null ? 1 : 2); - return respVO; + ProcessDefinition definition = repositoryService.getProcessDefinition(task.getProcessDefinitionId()); + return TaskConvert.INSTANCE.convert(task, definition); }).collect(Collectors.toList()); - // TODO @jason:要注意泛型哈。 - return new PageResult(respVOList, Long.valueOf(totalItems)); // TODO @jason:(long) 转换即可 + return new PageResult<>(respVOList, (long)totalItems); } @@ -88,35 +70,22 @@ public class TaskServiceImpl implements TaskService { .build()); } - @Override - public void getTaskHistory(String taskId) { - final List list = historyService.createHistoricProcessInstanceQuery(). - processInstanceId("8e2801fc-1a38-11ec-98ce-74867a13730f").list(); - } - // TODO @jason:一个方法里,会有多个方法的调用,最好写下对应的注释。这样容易理解 + /** + * 工作流,完成 userTask, 完成用户任务 一般传入参数 1。是否同意(variables). 2. 评论(comment) + * variables 变量名 和 评论 由前台传入 + * @param taskReq + */ @Override @Transactional public void completeTask(TaskReqVO taskReq) { final Task task = taskRuntime.task(taskReq.getTaskId()); - final Map variables = taskReq.getVariables(); - activitiTaskService.addComment(taskReq.getTaskId(), task.getProcessInstanceId(), taskReq.getComment()); taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(taskReq.getTaskId()) .withVariables(taskReq.getVariables()) .build()); - -// if(variables.containsValue(Boolean.FALSE)){ -// final String businessKey = task.getBusinessKey(); -// UpdateWrapper updateWrapper = new UpdateWrapper<>(); -// updateWrapper.eq("id", Long.valueOf(businessKey)); -// OaLeaveDO updateDo = new OaLeaveDO(); -// updateDo.setStatus(2); -// leaveMapper.update(updateDo, updateWrapper); -// } - } // @Override @@ -142,22 +111,8 @@ public class TaskServiceImpl implements TaskService { @Override public TaskHandleVO getTaskSteps(TaskQueryReqVO taskQuery) { TaskHandleVO handleVO = new TaskHandleVO(); - -// String processKey = taskQuery.getProcessKey(); -// if ("leave".equals(processKey)) { -// String businessKey = taskQuery.getBusinessKey(); -// final OaLeaveDO leave = leaveMapper.selectById(Long.valueOf(businessKey)); -// handleVO.setFormObject( OaLeaveConvert.INSTANCE.convert(leave)); -// } - -// -// final String taskDefKey = task.getTaskDefinitionKey(); -// final String variableName = Optional.ofNullable(taskVariable.get(taskDefKey)).orElse(""); -// handleVO.setTaskVariable(variableName); final Task task = taskRuntime.task(taskQuery.getTaskId()); - List steps = getTaskSteps(task.getProcessInstanceId()); - handleVO.setHistoryTask(steps); return handleVO; } @@ -173,21 +128,13 @@ public class TaskServiceImpl implements TaskService { // 获得对应的步骤 List steps = new ArrayList<>(); finished.forEach(instance -> { - // TODO @jason:放到 convert 里 - TaskStepVO step = new TaskStepVO(); - step.setStepName(instance.getActivityName()); - step.setStartTime(instance.getStartTime()); - step.setEndTime(instance.getEndTime()); - step.setAssignee(instance.getAssignee()); - step.setStatus(1); - // TODO @jason:一般判数组为空,使用 CollUtil.isEmpty 会好点哈。另外,null 时候,不用填写 "" 的哈 + TaskStepVO stepVO = TaskConvert.INSTANCE.convert(instance); + stepVO.setStatus(1); List comments = activitiTaskService.getTaskComments(instance.getTaskId()); - if (comments.size() > 0) { - step.setComment(comments.get(0).getFullMessage()); - } else { - step.setComment(""); + if (!CollUtil.isEmpty(comments)) { + stepVO.setComment(Optional.ofNullable(comments.get(0)).map(t->t.getFullMessage()).orElse("")); } - steps.add(step); + steps.add(stepVO); }); // 获得未完成的活动 @@ -197,16 +144,11 @@ public class TaskServiceImpl implements TaskService { .activityType("userTask") .unfinished().list(); // 获得对应的步骤 - // TODO @json:其实已完成和未完成,它们的 convert 的逻辑,是一致的 for (HistoricActivityInstance instance : unfinished) { - TaskStepVO step = new TaskStepVO(); - step.setStepName(instance.getActivityName()); - step.setStartTime(instance.getStartTime()); - step.setEndTime(instance.getEndTime()); - step.setAssignee(Optional.ofNullable(instance.getAssignee()).orElse("")); - step.setComment(""); - step.setStatus(0); - steps.add(step); + TaskStepVO stepVO = TaskConvert.INSTANCE.convert(instance); + stepVO.setComment(""); + stepVO.setStatus(0); + steps.add(stepVO); } return steps; } diff --git a/yudao-admin-ui/src/views/oa/leave/index.vue b/yudao-admin-ui/src/views/oa/leave/index.vue index f0998a00a..04a0eb6d0 100644 --- a/yudao-admin-ui/src/views/oa/leave/index.vue +++ b/yudao-admin-ui/src/views/oa/leave/index.vue @@ -139,7 +139,7 @@ - +
@@ -253,6 +253,17 @@ export default { } return desc; } + }, + stepAssignee() { + return function (assignee) { + let desc = ""; + if(assignee){ + desc += "办理人:[" + assignee + "]"; + }else{ + desc += "办理人未签收"; + } + return desc; + } } }, methods: { diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java index ba81dca34..7fe9d95e7 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java @@ -100,6 +100,7 @@ public class SecurityFrameworkUtils { WebFrameworkUtils.setLoginUserId(request, loginUser.getId()); WebFrameworkUtils.setLoginUserType(request, loginUser.getUserType()); // TODO @jason:使用 userId 会不会更合适哈? + // TODO @芋道源码 该值被赋值给 user task 中assignee , username 显示更直白一点 org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(loginUser.getUsername()); }