diff --git a/common/service-util/src/main/java/com/atguigu/common/config/mp/MybatisPlusConfig.java b/common/service-util/src/main/java/com/atguigu/common/config/mp/MybatisPlusConfig.java index a506151..27e47a6 100644 --- a/common/service-util/src/main/java/com/atguigu/common/config/mp/MybatisPlusConfig.java +++ b/common/service-util/src/main/java/com/atguigu/common/config/mp/MybatisPlusConfig.java @@ -17,7 +17,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration -@MapperScan("com.atguigu.auth.mapper") +@MapperScan(basePackages = {"com.atguigu.auth.mapper","com.atguigu.process.mapper"}) public class MybatisPlusConfig { /** diff --git a/model/src/main/java/com/atguigu/vo/system/AssginMenuVo.java b/model/src/main/java/com/atguigu/vo/system/AssginMenuVo.java index e9e91c8..fadb1c4 100644 --- a/model/src/main/java/com/atguigu/vo/system/AssginMenuVo.java +++ b/model/src/main/java/com/atguigu/vo/system/AssginMenuVo.java @@ -1,6 +1,5 @@ package com.atguigu.vo.system; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/service-oa/src/main/java/com/atguigu/auth/ServiceAuthApplication.java b/service-oa/src/main/java/com/atguigu/ServiceAuthApplication.java similarity index 89% rename from service-oa/src/main/java/com/atguigu/auth/ServiceAuthApplication.java rename to service-oa/src/main/java/com/atguigu/ServiceAuthApplication.java index 9d86453..faad331 100644 --- a/service-oa/src/main/java/com/atguigu/auth/ServiceAuthApplication.java +++ b/service-oa/src/main/java/com/atguigu/ServiceAuthApplication.java @@ -1,4 +1,4 @@ -package com.atguigu.auth; +package com.atguigu; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -12,7 +12,6 @@ import org.springframework.context.annotation.ComponentScan; * @Create 2023/6/1 23:03 */ @SpringBootApplication -@ComponentScan("com.atguigu") public class ServiceAuthApplication { public static void main(String[] args) { SpringApplication.run(ServiceAuthApplication.class, args); diff --git a/service-oa/src/main/java/com/atguigu/process/controller/OaProcessTemplateController.java b/service-oa/src/main/java/com/atguigu/process/controller/OaProcessTemplateController.java new file mode 100644 index 0000000..507beeb --- /dev/null +++ b/service-oa/src/main/java/com/atguigu/process/controller/OaProcessTemplateController.java @@ -0,0 +1,165 @@ +package com.atguigu.process.controller; + + +import com.atguigu.common.result.Result; +import com.atguigu.model.process.ProcessTemplate; +import com.atguigu.process.service.OaProcessTemplateService; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.ResourceUtils; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + *
+ * 审批模板 前端控制器 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +@Api(value = "审批模板管理", tags = "审批模板管理") +@RestController +@RequestMapping(value = "/admin/process/processTemplate") +public class OaProcessTemplateController { + + @Autowired + private OaProcessTemplateService processTemplateService; + + /** + * 测试文件上传 + * + * @param args + */ + public static void main(String[] args) { + try { + String path = new File(ResourceUtils.getURL("classpath:").getPath()).getAbsolutePath(); + System.out.println("path = " + path); //E:\CodeLife\IdeaProject\guigu-oa\guigu-oa-parent\service-oa\target\classes + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } + } + + /** + * 上传文件流程 + * + * @param file + * @return + * @throws FileNotFoundException + */ + @PreAuthorize("hasAuthority('bnt.processTemplate.templateSet')") + @ApiOperation(value = "上传流程定义") + @PostMapping("/uploadProcessDefinition") + public Result uploadProcessDefinition(MultipartFile file) throws FileNotFoundException { + + // 获取classes目录位置 + String path = new File(ResourceUtils.getURL("classpath:").getPath()).getAbsolutePath(); + // 设置上传文件夹 + File tempFile = new File(path + "/processes/"); + if (!tempFile.exists()) { + tempFile.mkdirs(); + } + // 创建空文件,实现文件写入 + String filename = file.getOriginalFilename(); + File zipFile = new File(path + "/processes/" + filename); + + // 保存文件 + try { + file.transferTo(zipFile); + } catch (IOException e) { + return Result.fail(); + } + + Map+ * 审批模板 Mapper 接口 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +public interface OaProcessTemplateMapper extends BaseMapper+ * 审批类型 Mapper 接口 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +public interface OaProcessTypeMapper extends BaseMapper+ * 审批模板 服务类 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +public interface OaProcessTemplateService extends IService+ * 审批类型 服务类 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +public interface OaProcessTypeService extends IService+ * 审批模板 服务实现类 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +@Service +public class OaProcessTemplateServiceImpl extends ServiceImpl+ * 审批类型 服务实现类 + *
+ * + * @author yovinchen + * @since 2023-06-15 + */ +@Service +public class OaProcessTypeServiceImpl extends ServiceImpl
+ * 流程实例id:245a58e7-0923-11ee-8637-b60fbe4e0138
+ * 任务id:29c9f30a-0923-11ee-abdf-b60fbe4e0138
+ * 任务负责人:zhao
+ * 任务名称:Personnel approval
+ */
+ @Test
+ public void findPendingTaskList03() {
+ //任务负责人
+ String assignee = "zhao";
+ List