Commit 40b5d967 by tangzhaoqian Committed by chenzg

审批管理-流程节点解析

parent fafc973f
...@@ -32,8 +32,13 @@ public class Swagger2Config { ...@@ -32,8 +32,13 @@ public class Swagger2Config {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@Bean @Bean
public ApiInfo apiInfo() { public ApiInfo apiInfo() {
return new ApiInfoBuilder().title("8小时-Api接口文档").description("快速进行Api接口调试").termsOfServiceUrl("127.0.0.1:8080") return new ApiInfoBuilder()
.contact("TangZhaoQian").version("1.0").build(); .title("8小时-Api接口文档")
.description("快速进行Api接口调试")
.termsOfServiceUrl("127.0.0.1:8080")
.contact("TangZhaoQian")
.version("1.0")
.build();
} }
/** /**
......
package cn.timer.api.controller.spmk; package cn.timer.api.controller.spmk;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -21,9 +22,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -21,9 +22,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.bean.spmk.SpmkIcon; import cn.timer.api.bean.spmk.SpmkIcon;
import cn.timer.api.bean.spmk.SpmkJqgz; import cn.timer.api.bean.spmk.SpmkJqgz;
import cn.timer.api.bean.spmk.SpmkLcjd; import cn.timer.api.bean.spmk.SpmkLcjd;
...@@ -33,12 +37,15 @@ import cn.timer.api.bean.spmk.SpmkSpcz; ...@@ -33,12 +37,15 @@ import cn.timer.api.bean.spmk.SpmkSpcz;
import cn.timer.api.bean.spmk.SpmkSpgl; import cn.timer.api.bean.spmk.SpmkSpgl;
import cn.timer.api.bean.spmk.SpmkSpz; import cn.timer.api.bean.spmk.SpmkSpz;
import cn.timer.api.bean.spmk.SpmkSxpz; import cn.timer.api.bean.spmk.SpmkSxpz;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.annotation.CurrentUser; import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean; import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enums.CommonEnum; import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.dao.spmk.SpmkSpglMapper; import cn.timer.api.dao.spmk.SpmkSpglMapper;
import cn.timer.api.dao.spmk.SpmkSpzMapper; import cn.timer.api.dao.spmk.SpmkSpzMapper;
import cn.timer.api.dto.spmk.SpmkMbKjDto; import cn.timer.api.dto.spmk.SpmkMbKjDto;
import cn.timer.api.dto.spmk.Router;
import cn.timer.api.dto.spmk.Spmk;
import cn.timer.api.dto.spmk.SpmkSpglDto; import cn.timer.api.dto.spmk.SpmkSpglDto;
import cn.timer.api.dto.spmk.SpmkSpglMoveDto; import cn.timer.api.dto.spmk.SpmkSpglMoveDto;
import cn.timer.api.dto.spmk.SpmkSpglSortDto; import cn.timer.api.dto.spmk.SpmkSpglSortDto;
...@@ -47,6 +54,7 @@ import cn.timer.api.dto.spmk.SpmkSpzSortDto; ...@@ -47,6 +54,7 @@ import cn.timer.api.dto.spmk.SpmkSpzSortDto;
import cn.timer.api.dto.spmk.SpmkSpzSpglDto; import cn.timer.api.dto.spmk.SpmkSpzSpglDto;
import cn.timer.api.utils.Result; import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil; import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.RouterUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -392,12 +400,104 @@ public class SpmkServiceImpl { ...@@ -392,12 +400,104 @@ public class SpmkServiceImpl {
Integer orgCode = userBean.getOrgCode(); Integer orgCode = userBean.getOrgCode();
IPage<SpmkJqgz> sPage = SpmkJqgz.builder().build().selectPage(p, new QueryWrapper<SpmkJqgz>().eq("org_code",orgCode)); IPage<SpmkJqgz> sPage = SpmkJqgz.builder().build().selectPage(p, new QueryWrapper<SpmkJqgz>().eq("org_code",orgCode));
List<SpmkJqgz> spmkJqgzs = sPage.getRecords(); List<SpmkJqgz> spmkJqgzs = sPage.getRecords();
sPage.getCurrent();
sPage.getPages();
sPage.getTotal();
sPage.getSize();
return ResultUtil.data(sPage, spmkJqgzs, "获取假期规则列表成功"); return ResultUtil.data(sPage, spmkJqgzs, "获取假期规则列表成功");
} }
/**
* 流程节点解析
*/
@PostMapping(value = "/jsonparse")
@ApiOperation(value = "流程节点解析", httpMethod = "POST", notes = "流程节点解析")
@ApiOperationSupport(order = 1)
public Result<Object> jsonToObj(@RequestBody Object jsonObj){
JSONObject obj = JSONUtil.parseObj(jsonObj, false, true);
Router Router = obj.get("router", Router.class);
Console.log("obj:" + obj.toStringPretty());
Console.log("Router:" + Router.toPrettyString());
Console.log("Router:" + Router.toJSONString());
return ResultUtil.success("解析成功!");
}
/**
* 流程节点解析
*/
@PostMapping(value = "/jsonparse_plus")
@ApiOperation(value = "流程节点解析_plus", httpMethod = "POST", notes = "流程节点解析_plus")
@ApiOperationSupport(order = 1)
public Result<Object> jsonToObj2(@RequestBody Router jsonObj){
Console.log("jsonObj:" + jsonObj);
Console.log("jsonObj:" + jsonObj.getChildren());
return ResultUtil.data(jsonObj, "解析成功!");
}
/**
* 流程节点解析
*/
@PostMapping(value = "/jsonparse_plusx")
@ApiOperation(value = "流程节点解析_plus", httpMethod = "POST", notes = "流程节点解析_plus")
@ApiOperationSupport(order = 1)
public Result<Object> jsonToObj3(@RequestBody Object jsonObj){
JSONObject obj = JSONUtil.parseObj(jsonObj, false, true);
obj.put("orgCode", 4);
Console.log("jsonObj:" + obj.get("name"));
Console.log("jsonObj:" + obj.get("id"));
Console.log("jsonObj:" + obj.get("aaa"));
return ResultUtil.data(jsonObj, "解析成功!");
}
/**
* 部门id 查询 员工
*/
@PostMapping(value = "/deptSelectEmp")
@ApiOperation(value = "部门id 查询 员工", httpMethod = "POST", notes = "流程节点解析_plus")
@ApiOperationSupport(order = 1)
public Result<Object> selectEmpBydept(@RequestParam Integer id){
List<YgglMainEmp> ygglMainEmp = RouterUtils.selectOtherlistent(4,id);
return ResultUtil.data(ygglMainEmp, "解析成功!");
}
/**
* 流程节点解析123
*/
@PostMapping(value = "/jsonparse_plus_plus")
@ApiOperation(value = "流程节点解析_plus", httpMethod = "POST", notes = "流程节点解析_plus")
@ApiOperationSupport(order = 1)
public Result<Object> jsonToObj123(@RequestBody Spmk spmk){
List<Router> listRouter = new ArrayList<Router>();
listRouter.add(spmk.getRouter());
return ResultUtil.data(RouterUtils.NextNode(listRouter, spmk.getData()), "解析成功!");
}
} }
package cn.timer.api.dto.spmk;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Condition {
private String key;
private String format;
private String value;
}
package cn.timer.api.dto.spmk;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Relation {
/**
* 类型
*/
private String type;
/**
* 名称
*/
private String name;
/**
* 部门ID
*/
private String departmentId;
/**
* 用户
*/
private List<User> users;
}
package cn.timer.api.dto.spmk;
import java.util.List;
import cn.hutool.json.JSONSupport;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Router extends JSONSupport {
/**
* 节点类型
* 1.creator-发起
* 2.audit-审批
* 3.copy-抄送
* 4.rules-规则
*/
private String className;
/**
* 执行
*/
private String execute;
/**
* 通过
*/
private Boolean flow;
/**
* 关系
*/
private List<Relation> relation;
/**
* 条件
*/
private List<Condition> condition;
/**
* 下一级
*/
private List<Router> children;
}
package cn.timer.api.dto.spmk;
import cn.hutool.json.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Spmk {
private Router router;
private JSONObject data;
}
package cn.timer.api.dto.spmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class User{
private String name;
private String id;
private String execute;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment