Commit 0d2ae6be5633b082a42ee560c6b8cb275de27a69
1 parent
f26c17cf
修改code review
Showing
12 changed files
with
78 additions
and
85 deletions
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/OaLeaveController.java
| 1 | package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa; | 1 | package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; | 3 | import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; |
| 4 | -import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert; | ||
| 5 | -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; | ||
| 6 | -import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService; | 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OALeaveConvert; |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; | ||
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OALeaveService; | ||
| 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| @@ -26,20 +26,20 @@ import java.util.List; | @@ -26,20 +26,20 @@ import java.util.List; | ||
| 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 26 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 27 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 27 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| 28 | 28 | ||
| 29 | -// TODO @jason:Oa=》OA 会不会好点,名词缩写哈 | 29 | + |
| 30 | @Api(tags = "请假申请") | 30 | @Api(tags = "请假申请") |
| 31 | @RestController | 31 | @RestController |
| 32 | @RequestMapping("/oa/leave") | 32 | @RequestMapping("/oa/leave") |
| 33 | @Validated | 33 | @Validated |
| 34 | -public class OaLeaveController { | 34 | +public class OALeaveController { |
| 35 | 35 | ||
| 36 | @Resource | 36 | @Resource |
| 37 | - private OaLeaveService leaveService; | 37 | + private OALeaveService leaveService; |
| 38 | 38 | ||
| 39 | @PostMapping("/create") | 39 | @PostMapping("/create") |
| 40 | @ApiOperation("创建请假申请") | 40 | @ApiOperation("创建请假申请") |
| 41 | @PreAuthorize("@ss.hasPermission('oa:leave:create')") | 41 | @PreAuthorize("@ss.hasPermission('oa:leave:create')") |
| 42 | - public CommonResult<Long> createLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) { | 42 | + public CommonResult<Long> createLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) { |
| 43 | // TODO @芋艿:processKey 自己去理解下。不过得把 leave 变成枚举 | 43 | // TODO @芋艿:processKey 自己去理解下。不过得把 leave 变成枚举 |
| 44 | createReqVO.setProcessKey("leave"); | 44 | createReqVO.setProcessKey("leave"); |
| 45 | return success(leaveService.createLeave(createReqVO)); | 45 | return success(leaveService.createLeave(createReqVO)); |
| @@ -47,7 +47,7 @@ public class OaLeaveController { | @@ -47,7 +47,7 @@ public class OaLeaveController { | ||
| 47 | 47 | ||
| 48 | @PostMapping("/form-key/create") | 48 | @PostMapping("/form-key/create") |
| 49 | @ApiOperation("创建外置请假申请") | 49 | @ApiOperation("创建外置请假申请") |
| 50 | - public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) { | 50 | + public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) { |
| 51 | // TODO @芋艿:processKey 自己去理解下。不过得把 formkey 变成枚举 | 51 | // TODO @芋艿:processKey 自己去理解下。不过得把 formkey 变成枚举 |
| 52 | createReqVO.setProcessKey("leave-formkey"); | 52 | createReqVO.setProcessKey("leave-formkey"); |
| 53 | return success(leaveService.createLeave(createReqVO)); | 53 | return success(leaveService.createLeave(createReqVO)); |
| @@ -56,7 +56,7 @@ public class OaLeaveController { | @@ -56,7 +56,7 @@ public class OaLeaveController { | ||
| 56 | @PutMapping("/update") | 56 | @PutMapping("/update") |
| 57 | @ApiOperation("更新请假申请") | 57 | @ApiOperation("更新请假申请") |
| 58 | @PreAuthorize("@ss.hasPermission('oa:leave:update')") | 58 | @PreAuthorize("@ss.hasPermission('oa:leave:update')") |
| 59 | - public CommonResult<Boolean> updateLeave(@Valid @RequestBody OaLeaveUpdateReqVO updateReqVO) { | 59 | + public CommonResult<Boolean> updateLeave(@Valid @RequestBody OALeaveUpdateReqVO updateReqVO) { |
| 60 | leaveService.updateLeave(updateReqVO); | 60 | leaveService.updateLeave(updateReqVO); |
| 61 | return success(true); | 61 | return success(true); |
| 62 | } | 62 | } |
| @@ -74,41 +74,41 @@ public class OaLeaveController { | @@ -74,41 +74,41 @@ public class OaLeaveController { | ||
| 74 | @ApiOperation("获得请假申请") | 74 | @ApiOperation("获得请假申请") |
| 75 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | 75 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 76 | @PreAuthorize("@ss.hasPermission('oa:leave:query')") | 76 | @PreAuthorize("@ss.hasPermission('oa:leave:query')") |
| 77 | - public CommonResult<OaLeaveRespVO> getLeave(@RequestParam("id") Long id) { | ||
| 78 | - OaLeaveDO leave = leaveService.getLeave(id); | ||
| 79 | - return success(OaLeaveConvert.INSTANCE.convert(leave)); | 77 | + public CommonResult<OALeaveRespVO> getLeave(@RequestParam("id") Long id) { |
| 78 | + OALeaveDO leave = leaveService.getLeave(id); | ||
| 79 | + return success(OALeaveConvert.INSTANCE.convert(leave)); | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | @GetMapping("/list") | 82 | @GetMapping("/list") |
| 83 | @ApiOperation("获得请假申请列表") | 83 | @ApiOperation("获得请假申请列表") |
| 84 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | 84 | @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) |
| 85 | @PreAuthorize("@ss.hasPermission('oa:leave:query')") | 85 | @PreAuthorize("@ss.hasPermission('oa:leave:query')") |
| 86 | - public CommonResult<List<OaLeaveRespVO>> getLeaveList(@RequestParam("ids") Collection<Long> ids) { | ||
| 87 | - List<OaLeaveDO> list = leaveService.getLeaveList(ids); | ||
| 88 | - return success(OaLeaveConvert.INSTANCE.convertList(list)); | 86 | + public CommonResult<List<OALeaveRespVO>> getLeaveList(@RequestParam("ids") Collection<Long> ids) { |
| 87 | + List<OALeaveDO> list = leaveService.getLeaveList(ids); | ||
| 88 | + return success(OALeaveConvert.INSTANCE.convertList(list)); | ||
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | @GetMapping("/page") | 91 | @GetMapping("/page") |
| 92 | @ApiOperation("获得请假申请分页") | 92 | @ApiOperation("获得请假申请分页") |
| 93 | @PreAuthorize("@ss.hasPermission('oa:leave:query')") | 93 | @PreAuthorize("@ss.hasPermission('oa:leave:query')") |
| 94 | - public CommonResult<PageResult<OaLeaveRespVO>> getLeavePage(@Valid OaLeavePageReqVO pageVO) { | 94 | + public CommonResult<PageResult<OALeaveRespVO>> getLeavePage(@Valid OALeavePageReqVO pageVO) { |
| 95 | //值查询自己申请请假 | 95 | //值查询自己申请请假 |
| 96 | // TODO @芋艿:这里的传值,到底前端搞,还是后端搞。 | 96 | // TODO @芋艿:这里的传值,到底前端搞,还是后端搞。 |
| 97 | pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); | 97 | pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); |
| 98 | - PageResult<OaLeaveDO> pageResult = leaveService.getLeavePage(pageVO); | ||
| 99 | - return success(OaLeaveConvert.INSTANCE.convertPage(pageResult)); | 98 | + PageResult<OALeaveDO> pageResult = leaveService.getLeavePage(pageVO); |
| 99 | + return success(OALeaveConvert.INSTANCE.convertPage(pageResult)); | ||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | @GetMapping("/export-excel") | 102 | @GetMapping("/export-excel") |
| 103 | @ApiOperation("导出请假申请 Excel") | 103 | @ApiOperation("导出请假申请 Excel") |
| 104 | @PreAuthorize("@ss.hasPermission('oa:leave:export')") | 104 | @PreAuthorize("@ss.hasPermission('oa:leave:export')") |
| 105 | @OperateLog(type = EXPORT) | 105 | @OperateLog(type = EXPORT) |
| 106 | - public void exportLeaveExcel(@Valid OaLeaveExportReqVO exportReqVO, | 106 | + public void exportLeaveExcel(@Valid OALeaveExportReqVO exportReqVO, |
| 107 | HttpServletResponse response) throws IOException { | 107 | HttpServletResponse response) throws IOException { |
| 108 | - List<OaLeaveDO> list = leaveService.getLeaveList(exportReqVO); | 108 | + List<OALeaveDO> list = leaveService.getLeaveList(exportReqVO); |
| 109 | // 导出 Excel | 109 | // 导出 Excel |
| 110 | - List<OaLeaveExcelVO> datas = OaLeaveConvert.INSTANCE.convertList02(list); | ||
| 111 | - ExcelUtils.write(response, "请假申请.xls", "数据", OaLeaveExcelVO.class, datas); | 110 | + List<OALeaveExcelVO> datas = OALeaveConvert.INSTANCE.convertList02(list); |
| 111 | + ExcelUtils.write(response, "请假申请.xls", "数据", OALeaveExcelVO.class, datas); | ||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | } | 114 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveBaseVO.java
| @@ -13,7 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -13,7 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 13 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | 13 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 14 | */ | 14 | */ |
| 15 | @Data | 15 | @Data |
| 16 | -public class OaLeaveBaseVO { | 16 | +public class OALeaveBaseVO { |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "流程id") | 18 | @ApiModelProperty(value = "流程id") |
| 19 | private String processInstanceId; | 19 | private String processInstanceId; |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveCreateReqVO.java
| 1 | package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; | 1 | package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; |
| 2 | 2 | ||
| 3 | import lombok.*; | 3 | import lombok.*; |
| 4 | -import java.util.*; | ||
| 5 | import io.swagger.annotations.*; | 4 | import io.swagger.annotations.*; |
| 6 | -import javax.validation.constraints.*; | ||
| 7 | 5 | ||
| 8 | @ApiModel("请假申请创建 Request VO") | 6 | @ApiModel("请假申请创建 Request VO") |
| 9 | @Data | 7 | @Data |
| 10 | @EqualsAndHashCode(callSuper = true) | 8 | @EqualsAndHashCode(callSuper = true) |
| 11 | @ToString(callSuper = true) | 9 | @ToString(callSuper = true) |
| 12 | -public class OaLeaveCreateReqVO extends OaLeaveBaseVO { | 10 | +public class OALeaveCreateReqVO extends OALeaveBaseVO { |
| 13 | 11 | ||
| 14 | private String processKey; | 12 | private String processKey; |
| 15 | } | 13 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveExcelVO.java
| @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty; | @@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty; | ||
| 12 | * @author 芋艿 | 12 | * @author 芋艿 |
| 13 | */ | 13 | */ |
| 14 | @Data | 14 | @Data |
| 15 | -public class OaLeaveExcelVO { | 15 | +public class OALeaveExcelVO { |
| 16 | 16 | ||
| 17 | @ExcelProperty("请假表单主键") | 17 | @ExcelProperty("请假表单主键") |
| 18 | private Long id; | 18 | private Long id; |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveExportReqVO.java
| @@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 10 | 10 | ||
| 11 | @ApiModel(value = "请假申请 Excel 导出 Request VO", description = "参数和 OaLeavePageReqVO 是一致的") | 11 | @ApiModel(value = "请假申请 Excel 导出 Request VO", description = "参数和 OaLeavePageReqVO 是一致的") |
| 12 | @Data | 12 | @Data |
| 13 | -public class OaLeaveExportReqVO { | 13 | +public class OALeaveExportReqVO { |
| 14 | 14 | ||
| 15 | @ApiModelProperty(value = "流程id") | 15 | @ApiModelProperty(value = "流程id") |
| 16 | private String processInstanceId; | 16 | private String processInstanceId; |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeavePageReqVO.java
| @@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | @@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ | ||
| 12 | @Data | 12 | @Data |
| 13 | @EqualsAndHashCode(callSuper = true) | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | @ToString(callSuper = true) | 14 | @ToString(callSuper = true) |
| 15 | -public class OaLeavePageReqVO extends PageParam { | 15 | +public class OALeavePageReqVO extends PageParam { |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "流程id") | 17 | @ApiModelProperty(value = "流程id") |
| 18 | private String processInstanceId; | 18 | private String processInstanceId; |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveRespVO.java
| 1 | package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; | 1 | package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo; |
| 2 | 2 | ||
| 3 | import lombok.*; | 3 | import lombok.*; |
| 4 | -import java.util.*; | ||
| 5 | import io.swagger.annotations.*; | 4 | import io.swagger.annotations.*; |
| 6 | 5 | ||
| 7 | @ApiModel("请假申请 Response VO") | 6 | @ApiModel("请假申请 Response VO") |
| 8 | @Data | 7 | @Data |
| 9 | @EqualsAndHashCode(callSuper = true) | 8 | @EqualsAndHashCode(callSuper = true) |
| 10 | @ToString(callSuper = true) | 9 | @ToString(callSuper = true) |
| 11 | -public class OaLeaveRespVO extends OaLeaveBaseVO { | 10 | +public class OALeaveRespVO extends OALeaveBaseVO { |
| 12 | 11 | ||
| 13 | @ApiModelProperty(value = "请假表单主键", required = true) | 12 | @ApiModelProperty(value = "请假表单主键", required = true) |
| 14 | private Long id; | 13 | private Long id; |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/controller/oa/vo/OaLeaveUpdateReqVO.java
| @@ -13,7 +13,7 @@ import java.util.Map; | @@ -13,7 +13,7 @@ import java.util.Map; | ||
| 13 | @Data | 13 | @Data |
| 14 | @EqualsAndHashCode(callSuper = true) | 14 | @EqualsAndHashCode(callSuper = true) |
| 15 | @ToString(callSuper = true) | 15 | @ToString(callSuper = true) |
| 16 | -public class OaLeaveUpdateReqVO extends OaLeaveBaseVO { | 16 | +public class OALeaveUpdateReqVO extends OALeaveBaseVO { |
| 17 | 17 | ||
| 18 | @ApiModelProperty(value = "请假表单主键", required = true) | 18 | @ApiModelProperty(value = "请假表单主键", required = true) |
| 19 | @NotNull(message = "请假表单主键不能为空") | 19 | @NotNull(message = "请假表单主键不能为空") |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/convert/oa/OaLeaveConvert.java
| @@ -2,12 +2,12 @@ package cn.iocoder.yudao.adminserver.modules.activiti.convert.oa; | @@ -2,12 +2,12 @@ package cn.iocoder.yudao.adminserver.modules.activiti.convert.oa; | ||
| 2 | 2 | ||
| 3 | import java.util.*; | 3 | import java.util.*; |
| 4 | 4 | ||
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 7 | ||
| 7 | import org.mapstruct.Mapper; | 8 | import org.mapstruct.Mapper; |
| 8 | import org.mapstruct.factory.Mappers; | 9 | import org.mapstruct.factory.Mappers; |
| 9 | import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; | 10 | import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*; |
| 10 | -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; | ||
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | * 请假申请 Convert | 13 | * 请假申请 Convert |
| @@ -15,20 +15,20 @@ import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO | @@ -15,20 +15,20 @@ import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO | ||
| 15 | * @author 芋艿 | 15 | * @author 芋艿 |
| 16 | */ | 16 | */ |
| 17 | @Mapper | 17 | @Mapper |
| 18 | -public interface OaLeaveConvert { | 18 | +public interface OALeaveConvert { |
| 19 | 19 | ||
| 20 | - OaLeaveConvert INSTANCE = Mappers.getMapper(OaLeaveConvert.class); | 20 | + OALeaveConvert INSTANCE = Mappers.getMapper(OALeaveConvert.class); |
| 21 | 21 | ||
| 22 | - OaLeaveDO convert(OaLeaveCreateReqVO bean); | 22 | + OALeaveDO convert(OALeaveCreateReqVO bean); |
| 23 | 23 | ||
| 24 | - OaLeaveDO convert(OaLeaveUpdateReqVO bean); | 24 | + OALeaveDO convert(OALeaveUpdateReqVO bean); |
| 25 | 25 | ||
| 26 | - OaLeaveRespVO convert(OaLeaveDO bean); | 26 | + OALeaveRespVO convert(OALeaveDO bean); |
| 27 | 27 | ||
| 28 | - List<OaLeaveRespVO> convertList(List<OaLeaveDO> list); | 28 | + List<OALeaveRespVO> convertList(List<OALeaveDO> list); |
| 29 | 29 | ||
| 30 | - PageResult<OaLeaveRespVO> convertPage(PageResult<OaLeaveDO> page); | 30 | + PageResult<OALeaveRespVO> convertPage(PageResult<OALeaveDO> page); |
| 31 | 31 | ||
| 32 | - List<OaLeaveExcelVO> convertList02(List<OaLeaveDO> list); | 32 | + List<OALeaveExcelVO> convertList02(List<OALeaveDO> list); |
| 33 | 33 | ||
| 34 | } | 34 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/dal/dataobject/oa/OaLeaveDO.java
| @@ -17,7 +17,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | @@ -17,7 +17,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 17 | @Builder | 17 | @Builder |
| 18 | @NoArgsConstructor | 18 | @NoArgsConstructor |
| 19 | @AllArgsConstructor | 19 | @AllArgsConstructor |
| 20 | -public class OaLeaveDO extends BaseDO { | 20 | +public class OALeaveDO extends BaseDO { |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | * 请假表单主键 | 23 | * 请假表单主键 |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/OaLeaveService.java
| 1 | package cn.iocoder.yudao.adminserver.modules.activiti.service.oa; | 1 | package cn.iocoder.yudao.adminserver.modules.activiti.service.oa; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveCreateReqVO; | ||
| 5 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveExportReqVO; | ||
| 6 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeavePageReqVO; | ||
| 7 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveUpdateReqVO; | ||
| 8 | -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; | 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveCreateReqVO; |
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveUpdateReqVO; | ||
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveExportReqVO; | ||
| 7 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeavePageReqVO; | ||
| 8 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; | ||
| 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 9 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 10 | 10 | ||
| 11 | import javax.validation.Valid; | 11 | import javax.validation.Valid; |
| @@ -17,7 +17,7 @@ import java.util.List; | @@ -17,7 +17,7 @@ import java.util.List; | ||
| 17 | * | 17 | * |
| 18 | * @author 芋艿 | 18 | * @author 芋艿 |
| 19 | */ | 19 | */ |
| 20 | -public interface OaLeaveService { | 20 | +public interface OALeaveService { |
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | * 创建请假申请 | 23 | * 创建请假申请 |
| @@ -25,14 +25,14 @@ public interface OaLeaveService { | @@ -25,14 +25,14 @@ public interface OaLeaveService { | ||
| 25 | * @param createReqVO 创建信息 | 25 | * @param createReqVO 创建信息 |
| 26 | * @return 编号 | 26 | * @return 编号 |
| 27 | */ | 27 | */ |
| 28 | - Long createLeave(@Valid OaLeaveCreateReqVO createReqVO); | 28 | + Long createLeave(@Valid OALeaveCreateReqVO createReqVO); |
| 29 | 29 | ||
| 30 | /** | 30 | /** |
| 31 | * 更新请假申请 | 31 | * 更新请假申请 |
| 32 | * | 32 | * |
| 33 | * @param updateReqVO 更新信息 | 33 | * @param updateReqVO 更新信息 |
| 34 | */ | 34 | */ |
| 35 | - void updateLeave(@Valid OaLeaveUpdateReqVO updateReqVO); | 35 | + void updateLeave(@Valid OALeaveUpdateReqVO updateReqVO); |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * 删除请假申请 | 38 | * 删除请假申请 |
| @@ -47,7 +47,7 @@ public interface OaLeaveService { | @@ -47,7 +47,7 @@ public interface OaLeaveService { | ||
| 47 | * @param id 编号 | 47 | * @param id 编号 |
| 48 | * @return 请假申请 | 48 | * @return 请假申请 |
| 49 | */ | 49 | */ |
| 50 | - OaLeaveDO getLeave(Long id); | 50 | + OALeaveDO getLeave(Long id); |
| 51 | 51 | ||
| 52 | /** | 52 | /** |
| 53 | * 获得请假申请列表 | 53 | * 获得请假申请列表 |
| @@ -55,7 +55,7 @@ public interface OaLeaveService { | @@ -55,7 +55,7 @@ public interface OaLeaveService { | ||
| 55 | * @param ids 编号 | 55 | * @param ids 编号 |
| 56 | * @return 请假申请列表 | 56 | * @return 请假申请列表 |
| 57 | */ | 57 | */ |
| 58 | - List<OaLeaveDO> getLeaveList(Collection<Long> ids); | 58 | + List<OALeaveDO> getLeaveList(Collection<Long> ids); |
| 59 | 59 | ||
| 60 | /** | 60 | /** |
| 61 | * 获得请假申请分页 | 61 | * 获得请假申请分页 |
| @@ -63,7 +63,7 @@ public interface OaLeaveService { | @@ -63,7 +63,7 @@ public interface OaLeaveService { | ||
| 63 | * @param pageReqVO 分页查询 | 63 | * @param pageReqVO 分页查询 |
| 64 | * @return 请假申请分页 | 64 | * @return 请假申请分页 |
| 65 | */ | 65 | */ |
| 66 | - PageResult<OaLeaveDO> getLeavePage(OaLeavePageReqVO pageReqVO); | 66 | + PageResult<OALeaveDO> getLeavePage(OALeavePageReqVO pageReqVO); |
| 67 | 67 | ||
| 68 | /** | 68 | /** |
| 69 | * 获得请假申请列表, 用于 Excel 导出 | 69 | * 获得请假申请列表, 用于 Excel 导出 |
| @@ -71,6 +71,6 @@ public interface OaLeaveService { | @@ -71,6 +71,6 @@ public interface OaLeaveService { | ||
| 71 | * @param exportReqVO 查询条件 | 71 | * @param exportReqVO 查询条件 |
| 72 | * @return 请假申请列表 | 72 | * @return 请假申请列表 |
| 73 | */ | 73 | */ |
| 74 | - List<OaLeaveDO> getLeaveList(OaLeaveExportReqVO exportReqVO); | 74 | + List<OALeaveDO> getLeaveList(OALeaveExportReqVO exportReqVO); |
| 75 | 75 | ||
| 76 | } | 76 | } |
yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/activiti/service/oa/impl/OaLeaveServiceImpl.java
| 1 | package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl; | 1 | package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveCreateReqVO; | ||
| 4 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveExportReqVO; | ||
| 5 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeavePageReqVO; | ||
| 6 | -import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveUpdateReqVO; | ||
| 7 | -import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert; | ||
| 8 | -import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO; | 3 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveCreateReqVO; |
| 4 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveUpdateReqVO; | ||
| 5 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveExportReqVO; | ||
| 6 | +import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeavePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OALeaveConvert; | ||
| 8 | +import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO; | ||
| 9 | import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; | 9 | import cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper; |
| 10 | -import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService; | 10 | +import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OALeaveService; |
| 11 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 11 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 12 | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; | 12 | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |
| 13 | -import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | ||
| 14 | import org.activiti.api.task.model.Task; | 13 | import org.activiti.api.task.model.Task; |
| 15 | import org.activiti.api.task.model.builders.TaskPayloadBuilder; | 14 | import org.activiti.api.task.model.builders.TaskPayloadBuilder; |
| 16 | import org.activiti.api.task.runtime.TaskRuntime; | 15 | import org.activiti.api.task.runtime.TaskRuntime; |
| @@ -21,12 +20,9 @@ import org.springframework.transaction.annotation.Transactional; | @@ -21,12 +20,9 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 21 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
| 22 | 21 | ||
| 23 | import javax.annotation.Resource; | 22 | import javax.annotation.Resource; |
| 24 | -import java.util.Collection; | ||
| 25 | -import java.util.HashMap; | ||
| 26 | -import java.util.List; | ||
| 27 | -import java.util.Map; | 23 | +import java.util.*; |
| 28 | 24 | ||
| 29 | -import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OaErrorCodeConstants.LEAVE_NOT_EXISTS; | 25 | +import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OAErrorCodeConstants.LEAVE_NOT_EXISTS; |
| 30 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 26 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 31 | 27 | ||
| 32 | /** | 28 | /** |
| @@ -36,7 +32,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU | @@ -36,7 +32,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU | ||
| 36 | */ | 32 | */ |
| 37 | @Service | 33 | @Service |
| 38 | @Validated | 34 | @Validated |
| 39 | -public class OaLeaveServiceImpl implements OaLeaveService { | 35 | +public class OALeaveServiceImpl implements OALeaveService { |
| 40 | 36 | ||
| 41 | @Resource | 37 | @Resource |
| 42 | private OaLeaveMapper leaveMapper; | 38 | private OaLeaveMapper leaveMapper; |
| @@ -52,9 +48,9 @@ public class OaLeaveServiceImpl implements OaLeaveService { | @@ -52,9 +48,9 @@ public class OaLeaveServiceImpl implements OaLeaveService { | ||
| 52 | 48 | ||
| 53 | @Override | 49 | @Override |
| 54 | @Transactional(rollbackFor = Exception.class) | 50 | @Transactional(rollbackFor = Exception.class) |
| 55 | - public Long createLeave(OaLeaveCreateReqVO createReqVO) { | 51 | + public Long createLeave(OALeaveCreateReqVO createReqVO) { |
| 56 | // 插入 OA 请假单 | 52 | // 插入 OA 请假单 |
| 57 | - OaLeaveDO leave = OaLeaveConvert.INSTANCE.convert(createReqVO); | 53 | + OALeaveDO leave = OALeaveConvert.INSTANCE.convert(createReqVO); |
| 58 | leave.setStatus(1); | 54 | leave.setStatus(1); |
| 59 | leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); | 55 | leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername()); |
| 60 | leaveMapper.insert(leave); | 56 | leaveMapper.insert(leave); |
| @@ -68,19 +64,17 @@ public class OaLeaveServiceImpl implements OaLeaveService { | @@ -68,19 +64,17 @@ public class OaLeaveServiceImpl implements OaLeaveService { | ||
| 68 | ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables); | 64 | ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables); |
| 69 | String processInstanceId = processInstance.getProcessInstanceId(); | 65 | String processInstanceId = processInstance.getProcessInstanceId(); |
| 70 | 66 | ||
| 71 | - // TODO @json:service 不要出现 dao 的元素,例如说 UpdateWrapper。这里,我们可以调用 updateById 方法 | ||
| 72 | // 将工作流的编号,更新到 OA 请假单中 | 67 | // 将工作流的编号,更新到 OA 请假单中 |
| 73 | - UpdateWrapper<OaLeaveDO> updateWrapper = new UpdateWrapper<>(); | ||
| 74 | - updateWrapper.eq("id", id); | ||
| 75 | - OaLeaveDO updateDo = new OaLeaveDO(); | 68 | + OALeaveDO updateDo = new OALeaveDO(); |
| 76 | updateDo.setProcessInstanceId(processInstanceId); | 69 | updateDo.setProcessInstanceId(processInstanceId); |
| 77 | - leaveMapper.update(updateDo, updateWrapper); | 70 | + updateDo.setId(id); |
| 71 | + leaveMapper.updateById(updateDo); | ||
| 78 | return id; | 72 | return id; |
| 79 | } | 73 | } |
| 80 | 74 | ||
| 81 | @Override | 75 | @Override |
| 82 | @Transactional(rollbackFor = Exception.class) | 76 | @Transactional(rollbackFor = Exception.class) |
| 83 | - public void updateLeave(OaLeaveUpdateReqVO updateReqVO) { | 77 | + public void updateLeave(OALeaveUpdateReqVO updateReqVO) { |
| 84 | // 校验存在 | 78 | // 校验存在 |
| 85 | this.validateLeaveExists(updateReqVO.getId()); | 79 | this.validateLeaveExists(updateReqVO.getId()); |
| 86 | 80 | ||
| @@ -93,12 +87,12 @@ public class OaLeaveServiceImpl implements OaLeaveService { | @@ -93,12 +87,12 @@ public class OaLeaveServiceImpl implements OaLeaveService { | ||
| 93 | taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()) | 87 | taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId()) |
| 94 | .withVariables(variables) | 88 | .withVariables(variables) |
| 95 | .build()); | 89 | .build()); |
| 96 | - // TODO @jason:不需要加 final 哈。虽然是不变,但是代码比较少这么去写 | ||
| 97 | - final Object reApply = variables.get("reApply"); | ||
| 98 | - // TODO @jason:直接使用 Objects.equals(reApply, true) 就可以 | ||
| 99 | - if((reApply instanceof Boolean) && (Boolean)reApply){ | 90 | + |
| 91 | + // TOTO @芋道源码 貌似 IDEA 会自动加上final(不需要加 final 哈。虽然是不变,但是代码比较少这么去写) | ||
| 92 | + Object reApply = variables.get("reApply"); | ||
| 93 | + if(Objects.equals(reApply, true)){ | ||
| 100 | // 更新 表单 | 94 | // 更新 表单 |
| 101 | - OaLeaveDO updateObj = OaLeaveConvert.INSTANCE.convert(updateReqVO); | 95 | + OALeaveDO updateObj = OALeaveConvert.INSTANCE.convert(updateReqVO); |
| 102 | leaveMapper.updateById(updateObj); | 96 | leaveMapper.updateById(updateObj); |
| 103 | } | 97 | } |
| 104 | } | 98 | } |
| @@ -110,6 +104,8 @@ public class OaLeaveServiceImpl implements OaLeaveService { | @@ -110,6 +104,8 @@ public class OaLeaveServiceImpl implements OaLeaveService { | ||
| 110 | // 删除 | 104 | // 删除 |
| 111 | leaveMapper.deleteById(id); | 105 | leaveMapper.deleteById(id); |
| 112 | // TODO @jason:需要调用 runtimeService 的 delete 方法,删除??? | 106 | // TODO @jason:需要调用 runtimeService 的 delete 方法,删除??? |
| 107 | + // TOTO @芋道源码 目前页面暂时没有实现基于业务表单的删除, 该代码自动生成的。 | ||
| 108 | + // TODO @芋道源码 我理解提交流程后,是不允许删除的? , 只能在流程处理中作废流程 | ||
| 113 | } | 109 | } |
| 114 | 110 | ||
| 115 | private void validateLeaveExists(Long id) { | 111 | private void validateLeaveExists(Long id) { |
| @@ -119,22 +115,22 @@ public class OaLeaveServiceImpl implements OaLeaveService { | @@ -119,22 +115,22 @@ public class OaLeaveServiceImpl implements OaLeaveService { | ||
| 119 | } | 115 | } |
| 120 | 116 | ||
| 121 | @Override | 117 | @Override |
| 122 | - public OaLeaveDO getLeave(Long id) { | 118 | + public OALeaveDO getLeave(Long id) { |
| 123 | return leaveMapper.selectById(id); | 119 | return leaveMapper.selectById(id); |
| 124 | } | 120 | } |
| 125 | 121 | ||
| 126 | @Override | 122 | @Override |
| 127 | - public List<OaLeaveDO> getLeaveList(Collection<Long> ids) { | 123 | + public List<OALeaveDO> getLeaveList(Collection<Long> ids) { |
| 128 | return leaveMapper.selectBatchIds(ids); | 124 | return leaveMapper.selectBatchIds(ids); |
| 129 | } | 125 | } |
| 130 | 126 | ||
| 131 | @Override | 127 | @Override |
| 132 | - public PageResult<OaLeaveDO> getLeavePage(OaLeavePageReqVO pageReqVO) { | 128 | + public PageResult<OALeaveDO> getLeavePage(OALeavePageReqVO pageReqVO) { |
| 133 | return leaveMapper.selectPage(pageReqVO); | 129 | return leaveMapper.selectPage(pageReqVO); |
| 134 | } | 130 | } |
| 135 | 131 | ||
| 136 | @Override | 132 | @Override |
| 137 | - public List<OaLeaveDO> getLeaveList(OaLeaveExportReqVO exportReqVO) { | 133 | + public List<OALeaveDO> getLeaveList(OALeaveExportReqVO exportReqVO) { |
| 138 | return leaveMapper.selectList(exportReqVO); | 134 | return leaveMapper.selectList(exportReqVO); |
| 139 | } | 135 | } |
| 140 | 136 |