修改code review
parent
f26c17cff0
commit
0d2ae6be56
|
@ -1,9 +1,9 @@
|
||||||
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa;
|
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.controller.oa.vo.*;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.convert.oa.OaLeaveConvert;
|
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.dataobject.oa.OALeaveDO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService;
|
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.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
@ -26,20 +26,20 @@ import java.util.List;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
|
||||||
// TODO @jason:Oa=》OA 会不会好点,名词缩写哈
|
|
||||||
@Api(tags = "请假申请")
|
@Api(tags = "请假申请")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/oa/leave")
|
@RequestMapping("/oa/leave")
|
||||||
@Validated
|
@Validated
|
||||||
public class OaLeaveController {
|
public class OALeaveController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OaLeaveService leaveService;
|
private OALeaveService leaveService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@ApiOperation("创建请假申请")
|
@ApiOperation("创建请假申请")
|
||||||
@PreAuthorize("@ss.hasPermission('oa:leave:create')")
|
@PreAuthorize("@ss.hasPermission('oa:leave:create')")
|
||||||
public CommonResult<Long> createLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) {
|
public CommonResult<Long> createLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) {
|
||||||
// TODO @芋艿:processKey 自己去理解下。不过得把 leave 变成枚举
|
// TODO @芋艿:processKey 自己去理解下。不过得把 leave 变成枚举
|
||||||
createReqVO.setProcessKey("leave");
|
createReqVO.setProcessKey("leave");
|
||||||
return success(leaveService.createLeave(createReqVO));
|
return success(leaveService.createLeave(createReqVO));
|
||||||
|
@ -47,7 +47,7 @@ public class OaLeaveController {
|
||||||
|
|
||||||
@PostMapping("/form-key/create")
|
@PostMapping("/form-key/create")
|
||||||
@ApiOperation("创建外置请假申请")
|
@ApiOperation("创建外置请假申请")
|
||||||
public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OaLeaveCreateReqVO createReqVO) {
|
public CommonResult<Long> createFormKeyLeave(@Valid @RequestBody OALeaveCreateReqVO createReqVO) {
|
||||||
// TODO @芋艿:processKey 自己去理解下。不过得把 formkey 变成枚举
|
// TODO @芋艿:processKey 自己去理解下。不过得把 formkey 变成枚举
|
||||||
createReqVO.setProcessKey("leave-formkey");
|
createReqVO.setProcessKey("leave-formkey");
|
||||||
return success(leaveService.createLeave(createReqVO));
|
return success(leaveService.createLeave(createReqVO));
|
||||||
|
@ -56,7 +56,7 @@ public class OaLeaveController {
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@ApiOperation("更新请假申请")
|
@ApiOperation("更新请假申请")
|
||||||
@PreAuthorize("@ss.hasPermission('oa:leave:update')")
|
@PreAuthorize("@ss.hasPermission('oa:leave:update')")
|
||||||
public CommonResult<Boolean> updateLeave(@Valid @RequestBody OaLeaveUpdateReqVO updateReqVO) {
|
public CommonResult<Boolean> updateLeave(@Valid @RequestBody OALeaveUpdateReqVO updateReqVO) {
|
||||||
leaveService.updateLeave(updateReqVO);
|
leaveService.updateLeave(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
@ -74,41 +74,41 @@ public class OaLeaveController {
|
||||||
@ApiOperation("获得请假申请")
|
@ApiOperation("获得请假申请")
|
||||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||||
@PreAuthorize("@ss.hasPermission('oa:leave:query')")
|
@PreAuthorize("@ss.hasPermission('oa:leave:query')")
|
||||||
public CommonResult<OaLeaveRespVO> getLeave(@RequestParam("id") Long id) {
|
public CommonResult<OALeaveRespVO> getLeave(@RequestParam("id") Long id) {
|
||||||
OaLeaveDO leave = leaveService.getLeave(id);
|
OALeaveDO leave = leaveService.getLeave(id);
|
||||||
return success(OaLeaveConvert.INSTANCE.convert(leave));
|
return success(OALeaveConvert.INSTANCE.convert(leave));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperation("获得请假申请列表")
|
@ApiOperation("获得请假申请列表")
|
||||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||||
@PreAuthorize("@ss.hasPermission('oa:leave:query')")
|
@PreAuthorize("@ss.hasPermission('oa:leave:query')")
|
||||||
public CommonResult<List<OaLeaveRespVO>> getLeaveList(@RequestParam("ids") Collection<Long> ids) {
|
public CommonResult<List<OALeaveRespVO>> getLeaveList(@RequestParam("ids") Collection<Long> ids) {
|
||||||
List<OaLeaveDO> list = leaveService.getLeaveList(ids);
|
List<OALeaveDO> list = leaveService.getLeaveList(ids);
|
||||||
return success(OaLeaveConvert.INSTANCE.convertList(list));
|
return success(OALeaveConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@ApiOperation("获得请假申请分页")
|
@ApiOperation("获得请假申请分页")
|
||||||
@PreAuthorize("@ss.hasPermission('oa:leave:query')")
|
@PreAuthorize("@ss.hasPermission('oa:leave:query')")
|
||||||
public CommonResult<PageResult<OaLeaveRespVO>> getLeavePage(@Valid OaLeavePageReqVO pageVO) {
|
public CommonResult<PageResult<OALeaveRespVO>> getLeavePage(@Valid OALeavePageReqVO pageVO) {
|
||||||
//值查询自己申请请假
|
//值查询自己申请请假
|
||||||
// TODO @芋艿:这里的传值,到底前端搞,还是后端搞。
|
// TODO @芋艿:这里的传值,到底前端搞,还是后端搞。
|
||||||
pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
|
pageVO.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
|
||||||
PageResult<OaLeaveDO> pageResult = leaveService.getLeavePage(pageVO);
|
PageResult<OALeaveDO> pageResult = leaveService.getLeavePage(pageVO);
|
||||||
return success(OaLeaveConvert.INSTANCE.convertPage(pageResult));
|
return success(OALeaveConvert.INSTANCE.convertPage(pageResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ApiOperation("导出请假申请 Excel")
|
@ApiOperation("导出请假申请 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('oa:leave:export')")
|
@PreAuthorize("@ss.hasPermission('oa:leave:export')")
|
||||||
@OperateLog(type = EXPORT)
|
@OperateLog(type = EXPORT)
|
||||||
public void exportLeaveExcel(@Valid OaLeaveExportReqVO exportReqVO,
|
public void exportLeaveExcel(@Valid OALeaveExportReqVO exportReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
List<OaLeaveDO> list = leaveService.getLeaveList(exportReqVO);
|
List<OALeaveDO> list = leaveService.getLeaveList(exportReqVO);
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
List<OaLeaveExcelVO> datas = OaLeaveConvert.INSTANCE.convertList02(list);
|
List<OALeaveExcelVO> datas = OALeaveConvert.INSTANCE.convertList02(list);
|
||||||
ExcelUtils.write(response, "请假申请.xls", "数据", OaLeaveExcelVO.class, datas);
|
ExcelUtils.write(response, "请假申请.xls", "数据", OALeaveExcelVO.class, datas);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class OaLeaveBaseVO {
|
public class OALeaveBaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "流程id")
|
@ApiModelProperty(value = "流程id")
|
||||||
private String processInstanceId;
|
private String processInstanceId;
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo;
|
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
@ApiModel("请假申请创建 Request VO")
|
@ApiModel("请假申请创建 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class OaLeaveCreateReqVO extends OaLeaveBaseVO {
|
public class OALeaveCreateReqVO extends OALeaveBaseVO {
|
||||||
|
|
||||||
private String processKey;
|
private String processKey;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
* @author 芋艿
|
* @author 芋艿
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class OaLeaveExcelVO {
|
public class OALeaveExcelVO {
|
||||||
|
|
||||||
@ExcelProperty("请假表单主键")
|
@ExcelProperty("请假表单主键")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||||
|
|
||||||
@ApiModel(value = "请假申请 Excel 导出 Request VO", description = "参数和 OaLeavePageReqVO 是一致的")
|
@ApiModel(value = "请假申请 Excel 导出 Request VO", description = "参数和 OaLeavePageReqVO 是一致的")
|
||||||
@Data
|
@Data
|
||||||
public class OaLeaveExportReqVO {
|
public class OALeaveExportReqVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "流程id")
|
@ApiModelProperty(value = "流程id")
|
||||||
private String processInstanceId;
|
private String processInstanceId;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class OaLeavePageReqVO extends PageParam {
|
public class OALeavePageReqVO extends PageParam {
|
||||||
|
|
||||||
@ApiModelProperty(value = "流程id")
|
@ApiModelProperty(value = "流程id")
|
||||||
private String processInstanceId;
|
private String processInstanceId;
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo;
|
package cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
@ApiModel("请假申请 Response VO")
|
@ApiModel("请假申请 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class OaLeaveRespVO extends OaLeaveBaseVO {
|
public class OALeaveRespVO extends OALeaveBaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "请假表单主键", required = true)
|
@ApiModelProperty(value = "请假表单主键", required = true)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.util.Map;
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class OaLeaveUpdateReqVO extends OaLeaveBaseVO {
|
public class OALeaveUpdateReqVO extends OALeaveBaseVO {
|
||||||
|
|
||||||
@ApiModelProperty(value = "请假表单主键", required = true)
|
@ApiModelProperty(value = "请假表单主键", required = true)
|
||||||
@NotNull(message = "请假表单主键不能为空")
|
@NotNull(message = "请假表单主键不能为空")
|
||||||
|
|
|
@ -2,12 +2,12 @@ package cn.iocoder.yudao.adminserver.modules.activiti.convert.oa;
|
||||||
|
|
||||||
import java.util.*;
|
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.common.pojo.PageResult;
|
||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*;
|
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.*;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请假申请 Convert
|
* 请假申请 Convert
|
||||||
|
@ -15,20 +15,20 @@ import cn.iocoder.yudao.adminserver.modules.activiti.dal.dataobject.oa.OaLeaveDO
|
||||||
* @author 芋艿
|
* @author 芋艿
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface OaLeaveConvert {
|
public interface OALeaveConvert {
|
||||||
|
|
||||||
OaLeaveConvert INSTANCE = Mappers.getMapper(OaLeaveConvert.class);
|
OALeaveConvert INSTANCE = Mappers.getMapper(OALeaveConvert.class);
|
||||||
|
|
||||||
OaLeaveDO convert(OaLeaveCreateReqVO bean);
|
OALeaveDO convert(OALeaveCreateReqVO bean);
|
||||||
|
|
||||||
OaLeaveDO convert(OaLeaveUpdateReqVO bean);
|
OALeaveDO convert(OALeaveUpdateReqVO bean);
|
||||||
|
|
||||||
OaLeaveRespVO convert(OaLeaveDO bean);
|
OALeaveRespVO convert(OALeaveDO bean);
|
||||||
|
|
||||||
List<OaLeaveRespVO> convertList(List<OaLeaveDO> list);
|
List<OALeaveRespVO> convertList(List<OALeaveDO> list);
|
||||||
|
|
||||||
PageResult<OaLeaveRespVO> convertPage(PageResult<OaLeaveDO> page);
|
PageResult<OALeaveRespVO> convertPage(PageResult<OALeaveDO> page);
|
||||||
|
|
||||||
List<OaLeaveExcelVO> convertList02(List<OaLeaveDO> list);
|
List<OALeaveExcelVO> convertList02(List<OALeaveDO> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class OaLeaveDO extends BaseDO {
|
public class OALeaveDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请假表单主键
|
* 请假表单主键
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package cn.iocoder.yudao.adminserver.modules.activiti.service.oa;
|
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.OALeaveCreateReqVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveExportReqVO;
|
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveUpdateReqVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeavePageReqVO;
|
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveExportReqVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveUpdateReqVO;
|
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.adminserver.modules.activiti.dal.dataobject.oa.OALeaveDO;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
@ -17,7 +17,7 @@ import java.util.List;
|
||||||
*
|
*
|
||||||
* @author 芋艿
|
* @author 芋艿
|
||||||
*/
|
*/
|
||||||
public interface OaLeaveService {
|
public interface OALeaveService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建请假申请
|
* 创建请假申请
|
||||||
|
@ -25,14 +25,14 @@ public interface OaLeaveService {
|
||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
Long createLeave(@Valid OaLeaveCreateReqVO createReqVO);
|
Long createLeave(@Valid OALeaveCreateReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新请假申请
|
* 更新请假申请
|
||||||
*
|
*
|
||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updateLeave(@Valid OaLeaveUpdateReqVO updateReqVO);
|
void updateLeave(@Valid OALeaveUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除请假申请
|
* 删除请假申请
|
||||||
|
@ -47,7 +47,7 @@ public interface OaLeaveService {
|
||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return 请假申请
|
* @return 请假申请
|
||||||
*/
|
*/
|
||||||
OaLeaveDO getLeave(Long id);
|
OALeaveDO getLeave(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得请假申请列表
|
* 获得请假申请列表
|
||||||
|
@ -55,7 +55,7 @@ public interface OaLeaveService {
|
||||||
* @param ids 编号
|
* @param ids 编号
|
||||||
* @return 请假申请列表
|
* @return 请假申请列表
|
||||||
*/
|
*/
|
||||||
List<OaLeaveDO> getLeaveList(Collection<Long> ids);
|
List<OALeaveDO> getLeaveList(Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得请假申请分页
|
* 获得请假申请分页
|
||||||
|
@ -63,7 +63,7 @@ public interface OaLeaveService {
|
||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return 请假申请分页
|
* @return 请假申请分页
|
||||||
*/
|
*/
|
||||||
PageResult<OaLeaveDO> getLeavePage(OaLeavePageReqVO pageReqVO);
|
PageResult<OALeaveDO> getLeavePage(OALeavePageReqVO pageReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得请假申请列表, 用于 Excel 导出
|
* 获得请假申请列表, 用于 Excel 导出
|
||||||
|
@ -71,6 +71,6 @@ public interface OaLeaveService {
|
||||||
* @param exportReqVO 查询条件
|
* @param exportReqVO 查询条件
|
||||||
* @return 请假申请列表
|
* @return 请假申请列表
|
||||||
*/
|
*/
|
||||||
List<OaLeaveDO> getLeaveList(OaLeaveExportReqVO exportReqVO);
|
List<OALeaveDO> getLeaveList(OALeaveExportReqVO exportReqVO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package cn.iocoder.yudao.adminserver.modules.activiti.service.oa.impl;
|
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.OALeaveCreateReqVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveExportReqVO;
|
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveUpdateReqVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeavePageReqVO;
|
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OALeaveExportReqVO;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.controller.oa.vo.OaLeaveUpdateReqVO;
|
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.convert.oa.OALeaveConvert;
|
||||||
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 cn.iocoder.yudao.adminserver.modules.activiti.dal.mysql.oa.OaLeaveMapper;
|
||||||
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OaLeaveService;
|
import cn.iocoder.yudao.adminserver.modules.activiti.service.oa.OALeaveService;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
||||||
import org.activiti.api.task.model.Task;
|
import org.activiti.api.task.model.Task;
|
||||||
import org.activiti.api.task.model.builders.TaskPayloadBuilder;
|
import org.activiti.api.task.model.builders.TaskPayloadBuilder;
|
||||||
import org.activiti.api.task.runtime.TaskRuntime;
|
import org.activiti.api.task.runtime.TaskRuntime;
|
||||||
|
@ -21,12 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OaErrorCodeConstants.LEAVE_NOT_EXISTS;
|
import static cn.iocoder.yudao.adminserver.modules.activiti.enums.OAErrorCodeConstants.LEAVE_NOT_EXISTS;
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,7 +32,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Validated
|
@Validated
|
||||||
public class OaLeaveServiceImpl implements OaLeaveService {
|
public class OALeaveServiceImpl implements OALeaveService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OaLeaveMapper leaveMapper;
|
private OaLeaveMapper leaveMapper;
|
||||||
|
@ -52,9 +48,9 @@ public class OaLeaveServiceImpl implements OaLeaveService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createLeave(OaLeaveCreateReqVO createReqVO) {
|
public Long createLeave(OALeaveCreateReqVO createReqVO) {
|
||||||
// 插入 OA 请假单
|
// 插入 OA 请假单
|
||||||
OaLeaveDO leave = OaLeaveConvert.INSTANCE.convert(createReqVO);
|
OALeaveDO leave = OALeaveConvert.INSTANCE.convert(createReqVO);
|
||||||
leave.setStatus(1);
|
leave.setStatus(1);
|
||||||
leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
|
leave.setUserId(SecurityFrameworkUtils.getLoginUser().getUsername());
|
||||||
leaveMapper.insert(leave);
|
leaveMapper.insert(leave);
|
||||||
|
@ -68,19 +64,17 @@ public class OaLeaveServiceImpl implements OaLeaveService {
|
||||||
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables);
|
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(createReqVO.getProcessKey(), businessKey, variables);
|
||||||
String processInstanceId = processInstance.getProcessInstanceId();
|
String processInstanceId = processInstance.getProcessInstanceId();
|
||||||
|
|
||||||
// TODO @json:service 不要出现 dao 的元素,例如说 UpdateWrapper。这里,我们可以调用 updateById 方法
|
|
||||||
// 将工作流的编号,更新到 OA 请假单中
|
// 将工作流的编号,更新到 OA 请假单中
|
||||||
UpdateWrapper<OaLeaveDO> updateWrapper = new UpdateWrapper<>();
|
OALeaveDO updateDo = new OALeaveDO();
|
||||||
updateWrapper.eq("id", id);
|
|
||||||
OaLeaveDO updateDo = new OaLeaveDO();
|
|
||||||
updateDo.setProcessInstanceId(processInstanceId);
|
updateDo.setProcessInstanceId(processInstanceId);
|
||||||
leaveMapper.update(updateDo, updateWrapper);
|
updateDo.setId(id);
|
||||||
|
leaveMapper.updateById(updateDo);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void updateLeave(OaLeaveUpdateReqVO updateReqVO) {
|
public void updateLeave(OALeaveUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
this.validateLeaveExists(updateReqVO.getId());
|
this.validateLeaveExists(updateReqVO.getId());
|
||||||
|
|
||||||
|
@ -93,12 +87,12 @@ public class OaLeaveServiceImpl implements OaLeaveService {
|
||||||
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId())
|
taskRuntime.complete(TaskPayloadBuilder.complete().withTaskId(task.getId())
|
||||||
.withVariables(variables)
|
.withVariables(variables)
|
||||||
.build());
|
.build());
|
||||||
// TODO @jason:不需要加 final 哈。虽然是不变,但是代码比较少这么去写
|
|
||||||
final Object reApply = variables.get("reApply");
|
// TOTO @芋道源码 貌似 IDEA 会自动加上final(不需要加 final 哈。虽然是不变,但是代码比较少这么去写)
|
||||||
// TODO @jason:直接使用 Objects.equals(reApply, true) 就可以
|
Object reApply = variables.get("reApply");
|
||||||
if((reApply instanceof Boolean) && (Boolean)reApply){
|
if(Objects.equals(reApply, true)){
|
||||||
// 更新 表单
|
// 更新 表单
|
||||||
OaLeaveDO updateObj = OaLeaveConvert.INSTANCE.convert(updateReqVO);
|
OALeaveDO updateObj = OALeaveConvert.INSTANCE.convert(updateReqVO);
|
||||||
leaveMapper.updateById(updateObj);
|
leaveMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,6 +104,8 @@ public class OaLeaveServiceImpl implements OaLeaveService {
|
||||||
// 删除
|
// 删除
|
||||||
leaveMapper.deleteById(id);
|
leaveMapper.deleteById(id);
|
||||||
// TODO @jason:需要调用 runtimeService 的 delete 方法,删除???
|
// TODO @jason:需要调用 runtimeService 的 delete 方法,删除???
|
||||||
|
// TOTO @芋道源码 目前页面暂时没有实现基于业务表单的删除, 该代码自动生成的。
|
||||||
|
// TODO @芋道源码 我理解提交流程后,是不允许删除的? , 只能在流程处理中作废流程
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateLeaveExists(Long id) {
|
private void validateLeaveExists(Long id) {
|
||||||
|
@ -119,22 +115,22 @@ public class OaLeaveServiceImpl implements OaLeaveService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OaLeaveDO getLeave(Long id) {
|
public OALeaveDO getLeave(Long id) {
|
||||||
return leaveMapper.selectById(id);
|
return leaveMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OaLeaveDO> getLeaveList(Collection<Long> ids) {
|
public List<OALeaveDO> getLeaveList(Collection<Long> ids) {
|
||||||
return leaveMapper.selectBatchIds(ids);
|
return leaveMapper.selectBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<OaLeaveDO> getLeavePage(OaLeavePageReqVO pageReqVO) {
|
public PageResult<OALeaveDO> getLeavePage(OALeavePageReqVO pageReqVO) {
|
||||||
return leaveMapper.selectPage(pageReqVO);
|
return leaveMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<OaLeaveDO> getLeaveList(OaLeaveExportReqVO exportReqVO) {
|
public List<OALeaveDO> getLeaveList(OALeaveExportReqVO exportReqVO) {
|
||||||
return leaveMapper.selectList(exportReqVO);
|
return leaveMapper.selectList(exportReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue