소스 검색

小程序端流程数据获取接口

Gogs 4 년 전
부모
커밋
700df41e85

+ 30 - 2
boman-api/boman-api-jflow/src/main/java/com/boman/jflow/api/RemoteJflowService.java

@@ -1,7 +1,14 @@
 package com.boman.jflow.api;
 
+import com.alibaba.fastjson.JSONObject;
 import com.boman.domain.constant.ServiceNameConstants;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.dto.ProcessDto;
+import com.boman.domain.dto.TaskDto;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 
 /**
  * @author shiqian
@@ -10,6 +17,27 @@ import org.springframework.cloud.openfeign.FeignClient;
 @FeignClient(contextId = "remoteJflowService", name = ServiceNameConstants.JFLOW_SERVICE)
 public interface RemoteJflowService {
 
-//    @PostMapping(name = "/jflow/p/cs/process/launch")
-//    JSONObject createProcess(@RequestBody ProcessDto dto);
+//    @GetMapping("/jflow/p/cs/task/searchString")
+//    String createProcess();
+
+    /**
+     * 历史审批接口调用
+     *
+     * @param taskDto
+     * @return
+     */
+    @PostMapping("/jflow/p/cs/task/history/list")
+    AjaxResult historySearchInPage(@RequestBody(required = false) TaskDto taskDto);
+
+    /**
+     * 代办审批接口调用
+     *
+     * @param taskDto
+     * @return
+     */
+    @PostMapping("/jflow/p/cs/task/backlog/list")
+    AjaxResult pendingTaskSearch(@RequestBody TaskDto taskDto);
+
+    @GetMapping("/jflow/p/cs/task/count")
+    JSONObject approvalStatistics(@RequestBody TaskDto taskDto);
 }

+ 219 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/dto/BaseDto.java

@@ -0,0 +1,219 @@
+package com.boman.domain.dto;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import java.io.Serializable;
+
+public class BaseDto implements Serializable {
+    protected static final String PAGE_SIZE = "pageSize";
+    protected static final String PAGE = "page";
+    protected static final String LAST_END_ID = "lastEndId";
+    protected static final String DESCS = "descs";
+    protected static final String ASCS = "ascs";
+    private static final long serialVersionUID = -1L;
+    
+    @JSONField(
+            name = "page"
+    )
+    protected Long page;
+    
+    @JSONField(
+            name = "pageSize"
+    )
+    protected Long pageSize;
+    
+    @JSONField(
+            name = "lastEndId"
+    )
+    protected Long lastEndId;
+   
+    @JSONField(
+            name = "descs"
+    )
+    protected String descs;
+    
+    @JSONField(
+            name = "ascs"
+    )
+    protected String ascs;
+    @JSONField(
+            name = "chain_id",
+            serialize = false
+    )
+    protected String chainId;
+    @JSONField(
+            name = "event_id",
+            serialize = false
+    )
+    protected String eventId;
+
+    public BaseDto() {
+    }
+
+    public Long getPage() {
+        return this.page;
+    }
+
+    public Long getPageSize() {
+        return this.pageSize;
+    }
+
+    public Long getLastEndId() {
+        return this.lastEndId;
+    }
+
+    public String getDescs() {
+        return this.descs;
+    }
+
+    public String getAscs() {
+        return this.ascs;
+    }
+
+    public String getChainId() {
+        return this.chainId;
+    }
+
+    public String getEventId() {
+        return this.eventId;
+    }
+
+    public BaseDto setPage(Long page) {
+        this.page = page;
+        return this;
+    }
+
+    public BaseDto setPageSize(Long pageSize) {
+        this.pageSize = pageSize;
+        return this;
+    }
+
+    public BaseDto setLastEndId(Long lastEndId) {
+        this.lastEndId = lastEndId;
+        return this;
+    }
+
+    public BaseDto setDescs(String descs) {
+        this.descs = descs;
+        return this;
+    }
+
+    public BaseDto setAscs(String ascs) {
+        this.ascs = ascs;
+        return this;
+    }
+
+    public BaseDto setChainId(String chainId) {
+        this.chainId = chainId;
+        return this;
+    }
+
+    public BaseDto setEventId(String eventId) {
+        this.eventId = eventId;
+        return this;
+    }
+
+    public boolean equals(Object o) {
+        if (o == this) {
+            return true;
+        } else if (!(o instanceof BaseDto)) {
+            return false;
+        } else {
+            BaseDto other = (BaseDto)o;
+            if (!other.canEqual(this)) {
+                return false;
+            } else {
+                label95: {
+                    Object this$page = this.getPage();
+                    Object other$page = other.getPage();
+                    if (this$page == null) {
+                        if (other$page == null) {
+                            break label95;
+                        }
+                    } else if (this$page.equals(other$page)) {
+                        break label95;
+                    }
+
+                    return false;
+                }
+
+                Object this$pageSize = this.getPageSize();
+                Object other$pageSize = other.getPageSize();
+                if (this$pageSize == null) {
+                    if (other$pageSize != null) {
+                        return false;
+                    }
+                } else if (!this$pageSize.equals(other$pageSize)) {
+                    return false;
+                }
+
+                Object this$lastEndId = this.getLastEndId();
+                Object other$lastEndId = other.getLastEndId();
+                if (this$lastEndId == null) {
+                    if (other$lastEndId != null) {
+                        return false;
+                    }
+                } else if (!this$lastEndId.equals(other$lastEndId)) {
+                    return false;
+                }
+
+                label74: {
+                    Object this$descs = this.getDescs();
+                    Object other$descs = other.getDescs();
+                    if (this$descs == null) {
+                        if (other$descs == null) {
+                            break label74;
+                        }
+                    } else if (this$descs.equals(other$descs)) {
+                        break label74;
+                    }
+
+                    return false;
+                }
+
+                label67: {
+                    Object this$ascs = this.getAscs();
+                    Object other$ascs = other.getAscs();
+                    if (this$ascs == null) {
+                        if (other$ascs == null) {
+                            break label67;
+                        }
+                    } else if (this$ascs.equals(other$ascs)) {
+                        break label67;
+                    }
+
+                    return false;
+                }
+
+                Object this$chainId = this.getChainId();
+                Object other$chainId = other.getChainId();
+                if (this$chainId == null) {
+                    if (other$chainId != null) {
+                        return false;
+                    }
+                } else if (!this$chainId.equals(other$chainId)) {
+                    return false;
+                }
+
+                Object this$eventId = this.getEventId();
+                Object other$eventId = other.getEventId();
+                if (this$eventId == null) {
+                    if (other$eventId != null) {
+                        return false;
+                    }
+                } else if (!this$eventId.equals(other$eventId)) {
+                    return false;
+                }
+
+                return true;
+            }
+        }
+    }
+
+    protected boolean canEqual(Object other) {
+        return other instanceof BaseDto;
+    }
+
+    public String toString() {
+        return "BaseDto(page=" + this.getPage() + ", pageSize=" + this.getPageSize() + ", lastEndId=" + this.getLastEndId() + ", descs=" + this.getDescs() + ", ascs=" + this.getAscs() + ", chainId=" + this.getChainId() + ", eventId=" + this.getEventId() + ")";
+    }
+}

+ 13 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/dto/FormDataDto.java

@@ -82,6 +82,11 @@ public class FormDataDto implements Serializable {
     @JSONField(name = "isUi")
     private Boolean isUi;
 
+    /**
+     * 表单类型
+     */
+    private String other;
+
 
     public int getLimit() {
         try {
@@ -208,6 +213,14 @@ public class FormDataDto implements Serializable {
     public void setUsername(String username) {
         this.username = username;
     }
+
+    public String getOther() {
+        return other;
+    }
+
+    public void setOther(String other) {
+        this.other = other;
+    }
 }
 
 

+ 230 - 0
boman-api/boman-domain/src/main/java/com.boman.domain/dto/TaskDto.java

@@ -0,0 +1,230 @@
+package com.boman.domain.dto;
+
+
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author zhong.h
+ * createTime: 2021/6/17
+ * description:任务中心的DTO
+ */
+
+@Data
+@Accessors(chain = true)
+public class TaskDto extends BaseDto {
+    private static final long serialVersionUID = -1L;
+
+    /**
+     * 主键id
+     */
+    @JSONField
+    private Long id;
+
+    /**
+     * 上一次的任务id
+     */
+    private Long lastTaskId;
+
+    /**
+     * 批处理数据的id以","分隔
+     */
+    private String ids;
+
+    /**
+     * 任务所属节点id
+     */
+    private Long nodeId;
+
+    /**
+     * 流程实例id
+     */
+    @JSONField
+    private Long instanceId;
+
+    /**
+     * 任务所属动作
+     */
+    private Long actId;
+
+    /**
+     * 任务动作类别:定时任务设置的就算作自动
+     */
+    private Short actType;
+
+    /**
+     * 版本
+     */
+    private Integer rev;
+
+    /**
+     * 任务描述
+     */
+    private String description;
+
+    /**
+     * 任务创建时间
+     */
+    @JSONField(name = "startTime", format = "yyyy-MM-dd HH:mm")
+    private Date createTime;
+
+    /**
+     * 任务修改时间
+     */
+    @JSONField(format = "yyyy-MM-dd HH:mm")
+    private Date updateTime;
+
+    /**
+     * 上一步任务实例
+     */
+    private Long lastTask;
+
+    /**
+     * 任务执行状态
+     */
+    private Short excuStatus;
+
+    /**
+     * 审批人编号
+     */
+    private Long approver;
+
+    /**
+     * 转派人编号
+     */
+    private Long delegateId;
+
+
+    /**
+     * 详情查询类型:待办为0,历史为1
+     */
+    private Integer loadType;
+
+    /**
+     * 操作类型:同意,驳回,转派
+     */
+    private Short type;
+
+    /**
+     * 业务编号
+     */
+    private Long businessCode;
+
+    /**
+     * 业务类型
+     */
+    private Long businessType;
+
+    /**
+     * 业务单据
+     */
+    private String businessBody;
+
+    /**
+     * 发起人id
+     */
+    private Long initiator;
+
+    /**
+     * 发起人中文名
+     */
+    private String initiatorName;
+
+    /**
+     * 是否是本人
+     */
+    private Boolean isinitiator;
+
+    /**
+     * 当前用户id
+     */
+    private Long userId;
+
+    /**
+     * 列表查询类型
+     */
+    private String searchType;
+
+    /**
+     * 审批人类型
+     */
+    private Short approverType;
+
+    /**
+     * 用于时间段的截至时间
+     */
+    private String endTime;
+
+    /**
+     * 驳回节点
+     */
+    private Long backId;
+
+    /**
+     * 模板id
+     */
+    private Long moduleId;
+
+    /**
+     * 流程状态
+     */
+    private Short processStatus;
+
+    //业务数据编号
+    private String businessNumber;
+
+    /**
+     * 审批人中文名
+     */
+    private String approverName;
+
+    /**
+     * 单据类型中文名
+     */
+    private String businessTypeName;
+
+    /**
+     * 掌云或条件搜索字段
+     */
+    private String searchField;
+
+    /**
+     * 审批人id,和审批人中文名
+     */
+    private List<Map<String,String>> approverInfo;
+
+    /**
+     * 批次号
+     */
+    private Integer batch;
+
+    /**
+     * 人工干预驳回节点id
+     */
+    private Long backNodeId;
+
+    /**
+     * 人工干预同意节点id
+     */
+    private Long passNodeId;
+
+    /**
+     * 是否轮询
+     */
+    private Boolean isPoll;
+
+    /**
+     * 节点名称,代办列表的节点名称筛
+     */
+    private String nodeName;
+
+    /** 表名 */
+    private String tableName;
+
+    /***/
+    private String other;
+}

+ 43 - 0
boman-web-core/src/main/java/com/boman/web/core/controller/JFlowTaskController.java

@@ -0,0 +1,43 @@
+package com.boman.web.core.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.dto.TaskDto;
+import com.boman.jflow.api.RemoteJflowService;
+import com.boman.web.core.service.jflow.JFlowTaskService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ *  任务中心控制器
+ *
+ * @author zhong.h
+ * @date 2021-06-17
+ * description:任务中心的web层
+ */
+@RequestMapping("/jflow/task")
+@RestController
+public class JFlowTaskController {
+
+    @Autowired
+    private JFlowTaskService jFlowTaskService;
+
+    @ApiOperation(value = "历史详情查询")
+    @RequestMapping(value = "/cs/task/history/list", method = RequestMethod.POST)
+    public AjaxResult historyLoad(@RequestBody TaskDto taskDto) {
+        return jFlowTaskService.historyLoad(taskDto);
+    }
+
+    @ApiOperation(value = "代办详情查询")
+    @RequestMapping(value = "/cs/task/backlog/list", method = RequestMethod.POST)
+    public AjaxResult pendingTaskSearch(@RequestBody TaskDto taskDto) {
+        return jFlowTaskService.pendingTaskSearch(taskDto);
+    }
+
+    @ApiOperation(value = "审批数统计")
+    @RequestMapping(value = "/cs/task/approval/statistics", method = RequestMethod.POST)
+    public JSONObject approvalStatistics(@RequestBody TaskDto taskDto) {
+        return jFlowTaskService.approvalStatistics(taskDto);
+    }
+}

+ 23 - 2
boman-web-core/src/main/java/com/boman/web/core/mapper/StandardlyMapper.java

@@ -102,9 +102,10 @@ public interface StandardlyMapper {
      * @param id        主键值
      * @return com.alibaba.fastjson.JSONObject
      */
-    @Select("select * from ${tableName} where ${pkName} = #{id} limit 1")
+//    @Select("select * from ${tableName} where ${pkName} = #{id} limit 1")
+    @SelectProvider(type = SqlProvider.class, method = "selectById")
     JSONObject selectById(@Param("tableName") String tableName
-            , @Param("pkName") String pkName, @Param("id") Long id);
+            , @Param("pkName") String pkName, @Param("id") Long id,  @Param("other") String other);
 
     /**
      * 功能描述: 根据id查所有
@@ -619,6 +620,26 @@ public interface StandardlyMapper {
             return result;
         }
 
+        public String selectById(Map<String, Object> params) {
+            String tableName = (String) params.get("tableName");
+            String pkName = (String) params.get("pkName");
+            Long id = (Long) params.get("id");
+            String other = (String)params.get("other");
+            StringBuilder sqlBuilder = new StringBuilder();
+            if(StringUtils.isEmpty(other)) {
+                sqlBuilder.append("select * from ")
+                        .append(tableName).append(" where ")
+                        .append(pkName).append(" = ")
+                        .append(""+ id +"").append(" limit 1");
+            }else if(other.equals("leave")) {
+                sqlBuilder.append("select t.*,u.nick_name,d.dict_label  from ")
+                        .append(tableName).append(" t ").append(" JOIN sys_user u ON u.user_name = t.leavefrom_user_name ")
+                        .append(" LEFT JOIN sys_dict_data d ON d.dict_type='biz_leave_type' AND d.dict_value=t.leavefrom_leave_type where ")
+                        .append("t.").append(pkName).append(" = ").append(""+ id +"").append(" limit 1");;
+            }
+            return sqlBuilder.toString();
+        }
+
         /**
          * 功能描述: 判断传过来的值是否需要转义
          *

+ 18 - 3
boman-web-core/src/main/java/com/boman/web/core/service/TableServiceCmdService.java

@@ -400,10 +400,10 @@ public class TableServiceCmdService {
 
         GenTable genTable = getTableFromRedisByTableName(RedisKey.TABLE_INFO, dto.getTable());
 
-        JSONObject jsonObject = selectService.selectById(dto.getTable(), IdUtils.getPkName(genTable.getColumns()), dto.getObjId());
+        JSONObject jsonObject = selectService.selectById(dto.getTable(), IdUtils.getPkName(genTable.getColumns()), dto.getObjId(), dto.getOther());
         List<GenTableColumn> columns = genTable.getColumns();
         JSONArray addcolums = new JSONArray();
-
+        this.addOtherColumn(columns, dto.getOther());
         for (GenTableColumn column : columns) {
             JSONObject jo = new JSONObject();
 
@@ -433,7 +433,6 @@ public class TableServiceCmdService {
 
     }
 
-
     /**
      * 判断hr字段里面是否有值
      *
@@ -900,5 +899,21 @@ public class TableServiceCmdService {
             commitData.put(columnName, rule);
         }
     }
+
+    private void addOtherColumn(List<GenTableColumn> columns, String other) {
+        if(StringUtils.isEmpty(other)) {
+            return;
+        }
+
+        // 此为请假表单数据
+        if (other.equals("leave")) {
+            GenTableColumn userNameColum = new GenTableColumn();
+            userNameColum.setColumnName("nick_name");
+            columns.add(userNameColum);
+            GenTableColumn leaveTypeeColum = new GenTableColumn();
+            leaveTypeeColum.setColumnName("dict_label");
+            columns.add(leaveTypeeColum);
+        }
+    }
 }
 

+ 1 - 1
boman-web-core/src/main/java/com/boman/web/core/service/common/CommonServiceImpl.java

@@ -44,7 +44,7 @@ public class CommonServiceImpl implements ICommonService {
 
         GenTable genTable = cmdService.getTableFromRedisByTableName(RedisKey.TABLE_INFO, tableName);
         String pkName = IdUtils.getPkName(genTable.getColumns());
-        return selectService.selectById(tableName, pkName, id);
+        return selectService.selectById(tableName, pkName, id, "");
     }
 
     /**

+ 11 - 0
boman-web-core/src/main/java/com/boman/web/core/service/jflow/JFlowTaskService.java

@@ -0,0 +1,11 @@
+package com.boman.web.core.service.jflow;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.dto.TaskDto;
+
+public interface JFlowTaskService {
+    AjaxResult historyLoad(TaskDto taskDto);
+    AjaxResult pendingTaskSearch(TaskDto taskDto);
+    JSONObject approvalStatistics(TaskDto taskDto);
+}

+ 32 - 0
boman-web-core/src/main/java/com/boman/web/core/service/jflow/impl/JFlowTaskServiceImpl.java

@@ -0,0 +1,32 @@
+package com.boman.web.core.service.jflow.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.boman.domain.dto.AjaxResult;
+import com.boman.domain.dto.TaskDto;
+import com.boman.jflow.api.RemoteJflowService;
+import com.boman.web.core.service.jflow.JFlowTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class JFlowTaskServiceImpl implements JFlowTaskService {
+
+    @Autowired
+    private RemoteJflowService remoteJflowService;
+
+    @Override
+    public AjaxResult historyLoad(TaskDto taskDto) {
+        return remoteJflowService.historySearchInPage(taskDto);
+    }
+
+    @Override
+    public AjaxResult pendingTaskSearch(TaskDto taskDto) {
+        return remoteJflowService.pendingTaskSearch(taskDto);
+    }
+
+    @Override
+    public JSONObject approvalStatistics(TaskDto taskDto) {
+        return remoteJflowService.approvalStatistics(taskDto);
+    }
+
+}

+ 2 - 2
boman-web-core/src/main/java/com/boman/web/core/service/select/BaseSelectServiceImpl.java

@@ -117,11 +117,11 @@ public class BaseSelectServiceImpl implements IBaseSelectService {
      * @return com.alibaba.fastjson.JSONObject
      */
     @Override
-    public JSONObject selectById(String tableName, String pkName, Long id) {
+    public JSONObject selectById(String tableName, String pkName, Long id, String other) {
         requireNonNull(tableName, "表名为空");
         requireNonNull(pkName, "主键名称为空");;
         requireNonNull(id, "selectById id is empty");
-        return mapper.selectById(tableName, pkName, id);
+        return mapper.selectById(tableName, pkName, id, other);
     }
 
     /**

+ 2 - 1
boman-web-core/src/main/java/com/boman/web/core/service/select/IBaseSelectService.java

@@ -59,9 +59,10 @@ public interface IBaseSelectService {
      * @param tableName 表名
      * @param pkName    主键名称
      * @param id        主键值
+     * @param other     查询表单数据,添加表类型
      * @return com.alibaba.fastjson.JSONObject
      */
-    JSONObject selectById(String tableName, String pkName, Long id);
+    JSONObject selectById(String tableName, String pkName, Long id, String other);
 
     /**
      * 功能描述: 根据id查所有,不支持自定义查询列