From 78b6f03bb3214a8aafea2710e36411303e3c7433 Mon Sep 17 00:00:00 2001 From: syruan <321359594@qq.com> Date: Mon, 18 Mar 2024 15:30:37 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E5=AE=A1=E6=89=B9=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bonus/sgzb/base/api/domain/BmFlow.java | 56 +++ .../sgzb/base/api/domain/BmFlowRecord.java | 63 ++++ .../sgzb/base/api/domain/BmFlowRelation.java | 64 ++++ .../sgzb/app/controller/TmTaskController.java | 134 ++++++- .../bonus/sgzb/app/mapper/BmFlowMapper.java | 75 ++++ .../sgzb/app/mapper/BmFlowRecordMapper.java | 69 ++++ .../sgzb/app/mapper/BmFlowRelationMapper.java | 76 ++++ .../sgzb/app/service/BmFlowRecordService.java | 37 ++ .../app/service/BmFlowRelationService.java | 40 +++ .../bonus/sgzb/app/service/BmFlowService.java | 40 +++ .../bonus/sgzb/app/service/TmTaskService.java | 7 + .../service/impl/BmFlowRecordServiceImpl.java | 78 ++++ .../impl/BmFlowRelationServiceImpl.java | 83 +++++ .../app/service/impl/BmFlowServiceImpl.java | 78 ++++ .../app/service/impl/TmTaskServiceImpl.java | 187 +++++++++- .../resources/mapper/app/BmFlowMapper.xml | 318 +++++++++++++++++ .../mapper/app/BmFlowRecordMapper.xml | 332 ++++++++++++++++++ .../mapper/app/BmFlowRelationMapper.xml | 328 +++++++++++++++++ 18 files changed, 2051 insertions(+), 14 deletions(-) create mode 100644 sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlow.java create mode 100644 sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRecord.java create mode 100644 sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRelation.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowMapper.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRecordMapper.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRelationMapper.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRecordService.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRelationService.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowService.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRecordServiceImpl.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRelationServiceImpl.java create mode 100644 sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowServiceImpl.java create mode 100644 sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowMapper.xml create mode 100644 sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRecordMapper.xml create mode 100644 sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRelationMapper.xml diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlow.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlow.java new file mode 100644 index 00000000..8edc51ba --- /dev/null +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlow.java @@ -0,0 +1,56 @@ +package com.bonus.sgzb.base.api.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * 流程实体类 + * @author syruan + */ +@ApiModel(description="bm_flow") +@Data +public class BmFlow implements Serializable { + + private static final long serialVersionUID = -5222289413162493784L; + + /** + * 主键 + */ + @ApiModelProperty(value = "id") + private Integer id; + + /** + * 父节点 + */ + @ApiModelProperty(value = "父节点") + private Integer pId; + + /** + * 子流程名称 + */ + @ApiModelProperty(value = "子流程名称") + private String name; + + /** + * 子流程标识 + */ + @ApiModelProperty(value = "子流程标识") + private String tag; + + /** + * 是否开启 0:关闭 1:开启 + */ + @ApiModelProperty(value = "是否开启") + private String status; + + /** + * 任务类型 + */ + @ApiModelProperty(value = "任务类型") + private String taskType; + +} \ No newline at end of file diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRecord.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRecord.java new file mode 100644 index 00000000..1930a51e --- /dev/null +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRecord.java @@ -0,0 +1,63 @@ +package com.bonus.sgzb.base.api.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 流程记录 + * @author syruan + */ +@Data +@ApiModel(description="bm_flow_record") +public class BmFlowRecord implements Serializable { + + private static final long serialVersionUID = 1897734004905597207L; + + /** + * + */ + @ApiModelProperty(value = "主键") + private Integer id; + + /** + * 任务id + */ + @ApiModelProperty(value = "任务id") + private Integer taskId; + + /** + * 实例id + */ + @ApiModelProperty(value = "实例id") + private Integer flowId; + + /** + * 上个流程 + */ + @ApiModelProperty(value = "上个流程") + private Integer preFlowId; + + /** + * 下个流程 + */ + @ApiModelProperty(value = "下个流程") + private Integer nextFlowId; + + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + private String creator; + + /** + * 创建时间 + */ + @ApiModelProperty(value = "创建时间") + private Date createTime; + +} \ No newline at end of file diff --git a/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRelation.java b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRelation.java new file mode 100644 index 00000000..7328c5f2 --- /dev/null +++ b/sgzb-api/sgzb-api-system/src/main/java/com/bonus/sgzb/base/api/domain/BmFlowRelation.java @@ -0,0 +1,64 @@ +package com.bonus.sgzb.base.api.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + + +/** + * Description: 流程配置 + * @Author 阮世耀 + * @Create 2024/3/16 13:03 + * @Version 1.0 + */ +@Data +@ApiModel(description="bm_flow_relation") +public class BmFlowRelation implements Serializable { + + private static final long serialVersionUID = 3306826714431115622L; + + /** + * + */ + @ApiModelProperty(value = "主键") + private Integer id; + + /** + * 父节点 + */ + @ApiModelProperty(value = "父节点") + private Integer flowId; + + /** + * 组织机构 + */ + @ApiModelProperty(value = "组织机构") + private Integer companyId; + + /** + * 是否开启 + */ + @ApiModelProperty(value = "是否开启") + private String status; + + /** + * 流执行顺序 + */ + @ApiModelProperty(value = "流执行顺序") + private Integer order; + + /** + * 任务类型 + */ + @ApiModelProperty(value = "任务类型") + private Integer taskType; + + /** + * 任务状态 + */ + @ApiModelProperty(value = "任务状态") + private String taskStatus; + +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java index f6a4d829..7c70b019 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/controller/TmTaskController.java @@ -6,10 +6,9 @@ import com.bonus.sgzb.app.domain.LeaseApplyDetails; import com.bonus.sgzb.app.domain.LeaseApplyInfo; import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.domain.TmTaskDto; -import com.bonus.sgzb.app.service.LeaseApplyDetailsService; -import com.bonus.sgzb.app.service.LeaseApplyInfoService; -import com.bonus.sgzb.app.service.LeaseUserBookService; -import com.bonus.sgzb.app.service.TmTaskService; +import com.bonus.sgzb.app.service.*; +import com.bonus.sgzb.base.api.domain.BmFlowRecord; +import com.bonus.sgzb.base.api.domain.BmFlowRelation; import com.bonus.sgzb.common.core.utils.ListPagingUtil; import com.bonus.sgzb.common.core.utils.ServletUtils; import com.bonus.sgzb.common.core.utils.StringUtils; @@ -28,6 +27,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Set; @@ -58,12 +58,17 @@ public class TmTaskController extends BaseController { @Resource private LeaseApplyDetailsService leaseApplyDetailsService; + @Resource + private BmFlowRelationService bmFlowRelationService; + + @Resource + private BmFlowRecordService bmFlowRecordService; + @Autowired private LeaseUserBookService leaseUserBookService; private final static String STRING_ADMIN = "admin"; - /** * 领料审核通过,分公司,分管,机具分公司统一接口 * @@ -137,9 +142,125 @@ public class TmTaskController extends BaseController { } + /** + * 创建领料申请任务 --- New 审批流 + */ + @Log(title = "创建领料申请任务", businessType = BusinessType.INSERT) + @PostMapping("createFlowLeaseApply") + public AjaxResult createFlowLeaseApply(@RequestBody TmTask task) { + // ------参数校验--------- + if (StringUtils.isNull(task) || StringUtils.isNull(task.getCompanyId())) { + return AjaxResult.error("参数错误,请求参数为空或申请人组织ID为空,请重试"); + } + if (StringUtils.isNull(task.getLeaseApplyInfo())) { + return AjaxResult.error("领料任务信息为空,请重试"); + } + if (CollUtil.isEmpty(task.getLeaseApplyDetails())) { + return AjaxResult.error("领料设备明细为空,请重新选择后上传!"); + } + + // ---------审批流校验--------- + // 查询当前任务类型的审批流配置 + BmFlowRelation bmFlowRelation = new BmFlowRelation(); + // 赋值任务类型 + bmFlowRelation.setTaskType(29); + // 赋值组织机构 + bmFlowRelation.setCompanyId(task.getCompanyId()); + List bmFlowRelationList = bmFlowRelationService.selectAllByPrimaryKey(bmFlowRelation); + // 校验审批流配置 + if (CollUtil.isEmpty(bmFlowRelationList)) { + return AjaxResult.error("当前任务类型审批流配置为空,请联系管理员"); + } + + // -----------开始处理审批流 ------------- + + // 使用lambda表达式 按order字段从小到大进行排序 + try { + bmFlowRelationList.sort(Comparator.comparingInt(BmFlowRelation::getOrder)); + } catch (Exception e) { + return AjaxResult.error("处理审批流排序失败,请联系运维人员:" + e.getMessage()); + } + + // 获取起始节点状态 + String flowStartTaskStatus = bmFlowRelationList.get(0).getTaskStatus(); + // 设置任务状态为审批流的起点状态 + task.setTaskStatus(Integer.valueOf(flowStartTaskStatus)); + // -----------审批流处理结束 ------------- + + // 生成领料编码 + String code = tmTaskService.genderLeaseCode(); + if (StringUtils.isEmpty(code)) { return AjaxResult.error("后台生成CODE编号异常,请重试!"); } + task.setCode(code); + + // 创建任务 + if (tmTaskService.insertSelective(task) < 1) { return AjaxResult.error("创建领料任务失败,请重试!"); } + //任务与协议建立关联关系 + if (tmTaskService.insertAgreement(task) < 1) { return AjaxResult.error("领料任务与协议建立关联关系失败,请重试!"); } + + // 获取任务编号 + String taskId = task.getId(); + if (StringUtils.isEmpty(taskId)) {return AjaxResult.error("任务编号为空,创建失败");} + + // -----------数据处理开始start --------------- + + // 根据设备所属分公司拆分集合 + List> deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId"); + + // 对拆分后的集合进行each遍历 + for (List leaseApplyDetailsList : deviceByCompanyList) { + // 判断拆分后的集合内是否有数据 + if (CollUtil.isNotEmpty(leaseApplyDetailsList)) { + // 对领料任务表的对象做数据处理 + LeaseApplyInfo leaseApplyInfo = task.getLeaseApplyInfo(); + leaseApplyInfo.setCode(code); + leaseApplyInfo.setTaskId(Integer.valueOf(taskId)); + // 设置设备所属分公司,用于交给哪家审核 + leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); + // 设置审批层级,根据已启用的审批流进行赋值层数 + leaseApplyInfo.setType(String.valueOf(bmFlowRelationList.size())); + + // 创建领料任务,返回领料任务编号 + if (leaseApplyInfoService.genderLeaseCode(leaseApplyInfo) < 1) { return AjaxResult.error("创建领料任务失败,或领料明细为空"); } + + // 领料任务创建完成,进行领料任务明细插入 + ArrayList ids = new ArrayList<>(); + if (StringUtils.isNotNull(leaseApplyInfo.getId())) { + for (LeaseApplyDetails leaseApplyDetails : leaseApplyDetailsList) { + // 设置领料任务ID + leaseApplyDetails.setParenntId(leaseApplyInfo.getId()); + ids.add(leaseApplyDetails.getId()); + } + // 插入领料任务明细 + if (leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0) { + leaseUserBookService.batchDel(ids); + } else { + System.out.println(("领料任务明细插入失败,请重试")); + } + } else { + return AjaxResult.error("领料任务编号为空"); + } + } + } + // -----------数据处理结束end --------------- + + // 数据处理成功后增加审批流记录 + BmFlowRecord bmFlowRecord = new BmFlowRecord(); + try { + bmFlowRecord.setTaskId(Integer.valueOf(taskId)); + bmFlowRecord.setFlowId(bmFlowRelationList.get(0).getFlowId()); + if (bmFlowRelationList.size() > 1) { bmFlowRecord.setNextFlowId(bmFlowRelationList.get(1).getFlowId());} + // String loginUserName = SecurityUtils.getLoginUser().getSysUser().getUserName(); + // bmFlowRecord.setCreator(loginUserName == null ? "" : loginUserName); + bmFlowRecordService.insertSelective(bmFlowRecord); + } catch (Exception e) { + return AjaxResult.error("数据处理完成,但审批流记录失败,请联系运维人员:" + e.getMessage()); + } + + return AjaxResult.success("任务创建成功,已完成"); + } + /** * 往来单位提交工程领用机具信息 - * * @return 结果 */ @Log(title = "往来单位提交领料申请", businessType = BusinessType.INSERT) @@ -161,7 +282,6 @@ public class TmTaskController extends BaseController { //任务与协议建立关联关系 boolean i = tmTaskService.insertAgreement(task) > 0; - if (addTaskResult && task.getLeaseApplyInfo() != null) { if (CollUtil.isEmpty(task.getLeaseApplyDetails())) { return AjaxResult.error("领料设备明细为空,请重新选择后上传!"); diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowMapper.java new file mode 100644 index 00000000..acb96a74 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowMapper.java @@ -0,0 +1,75 @@ +package com.bonus.sgzb.app.mapper; + +import com.bonus.sgzb.base.api.domain.BmFlow; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 12:43 +* @Version 1.0 +*/ + +@Mapper +public interface BmFlowMapper { + /** + * delete by primary key + * @param id primaryKey + * @return deleteCount + */ + int deleteByPrimaryKey(Integer id); + + /** + * insert record to table + * @param record the record + * @return insert count + */ + int insert(BmFlow record); + + int insertOrUpdate(BmFlow record); + + int insertOrUpdateSelective(BmFlow record); + + /** + * insert record to table selective + * @param record the record + * @return insert count + */ + int insertSelective(BmFlow record); + + /** + * select by primary key + * @param id primary key + * @return object by primary key + */ + BmFlow selectByPrimaryKey(Integer id); + + /** + * 查询全部 + * @return 集合 + */ + List selectAll(); + + /** + * update record selective + * @param record the updated record + * @return update count + */ + int updateByPrimaryKeySelective(BmFlow record); + + /** + * update record + * @param record the updated record + * @return update count + */ + int updateByPrimaryKey(BmFlow record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRecordMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRecordMapper.java new file mode 100644 index 00000000..a02e4b03 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRecordMapper.java @@ -0,0 +1,69 @@ +package com.bonus.sgzb.app.mapper; + +import com.bonus.sgzb.base.api.domain.BmFlowRecord; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 12:59 +* @Version 1.0 +*/ + +@Mapper +public interface BmFlowRecordMapper { + /** + * delete by primary key + * @param id primaryKey + * @return deleteCount + */ + int deleteByPrimaryKey(Integer id); + + /** + * insert record to table + * @param record the record + * @return insert count + */ + int insert(BmFlowRecord record); + + int insertOrUpdate(BmFlowRecord record); + + int insertOrUpdateSelective(BmFlowRecord record); + + /** + * insert record to table selective + * @param record the record + * @return insert count + */ + int insertSelective(BmFlowRecord record); + + /** + * select by primary key + * @param id primary key + * @return object by primary key + */ + BmFlowRecord selectByPrimaryKey(Integer id); + + /** + * update record selective + * @param record the updated record + * @return update count + */ + int updateByPrimaryKeySelective(BmFlowRecord record); + + /** + * update record + * @param record the updated record + * @return update count + */ + int updateByPrimaryKey(BmFlowRecord record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRelationMapper.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRelationMapper.java new file mode 100644 index 00000000..a6e7c4a3 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/mapper/BmFlowRelationMapper.java @@ -0,0 +1,76 @@ +package com.bonus.sgzb.app.mapper; + +import com.bonus.sgzb.base.api.domain.BmFlowRelation; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 13:03 +* @Version 1.0 +*/ + +@Mapper +public interface BmFlowRelationMapper { + /** + * delete by primary key + * @param id primaryKey + * @return deleteCount + */ + int deleteByPrimaryKey(Integer id); + + /** + * insert record to table + * @param record the record + * @return insert count + */ + int insert(BmFlowRelation record); + + int insertOrUpdate(BmFlowRelation record); + + int insertOrUpdateSelective(BmFlowRelation record); + + /** + * insert record to table selective + * @param record the record + * @return insert count + */ + int insertSelective(BmFlowRelation record); + + /** + * select by primary key + * @param id primary key + * @return object by primary key + */ + BmFlowRelation selectByPrimaryKey(Integer id); + + /** + * 自动注入参数筛选查询 + * @param record 注入参数 + * @return 集合 + */ + List selectAllByPrimaryKeys(BmFlowRelation record); + + /** + * update record selective + * @param record the updated record + * @return update count + */ + int updateByPrimaryKeySelective(BmFlowRelation record); + + /** + * update record + * @param record the updated record + * @return update count + */ + int updateByPrimaryKey(BmFlowRelation record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(@Param("list") List list); +} \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRecordService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRecordService.java new file mode 100644 index 00000000..7e750629 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRecordService.java @@ -0,0 +1,37 @@ +package com.bonus.sgzb.app.service; + +import com.bonus.sgzb.base.api.domain.BmFlowRecord; + +import java.util.List; + /** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 12:59 +* @Version 1.0 +*/ + +public interface BmFlowRecordService{ + + int deleteByPrimaryKey(Integer id); + + int insert(BmFlowRecord record); + + int insertOrUpdate(BmFlowRecord record); + + int insertOrUpdateSelective(BmFlowRecord record); + + int insertSelective(BmFlowRecord record); + + BmFlowRecord selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(BmFlowRecord record); + + int updateByPrimaryKey(BmFlowRecord record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(List list); + +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRelationService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRelationService.java new file mode 100644 index 00000000..2ca6eff4 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowRelationService.java @@ -0,0 +1,40 @@ +package com.bonus.sgzb.app.service; + +import com.bonus.sgzb.base.api.domain.BmFlowRelation; + +import java.util.List; + +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 13:03 +* @Version 1.0 +*/ + +public interface BmFlowRelationService{ + + int deleteByPrimaryKey(Integer id); + + int insert(BmFlowRelation record); + + int insertOrUpdate(BmFlowRelation record); + + int insertOrUpdateSelective(BmFlowRelation record); + + int insertSelective(BmFlowRelation record); + + BmFlowRelation selectByPrimaryKey(Integer id); + + List selectAllByPrimaryKey(BmFlowRelation record); + + int updateByPrimaryKeySelective(BmFlowRelation record); + + int updateByPrimaryKey(BmFlowRelation record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(List list); + +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowService.java new file mode 100644 index 00000000..0a6fc5ce --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/BmFlowService.java @@ -0,0 +1,40 @@ +package com.bonus.sgzb.app.service; + + + +import com.bonus.sgzb.base.api.domain.BmFlow; + +import java.util.List; + +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 12:43 +* @Version 1.0 +*/ + +public interface BmFlowService{ + + int deleteByPrimaryKey(Integer id); + + int insert(BmFlow record); + + int insertOrUpdate(BmFlow record); + + int insertOrUpdateSelective(BmFlow record); + + int insertSelective(BmFlow record); + + BmFlow selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(BmFlow record); + + int updateByPrimaryKey(BmFlow record); + + int updateBatch(List list); + + int updateBatchSelective(List list); + + int batchInsert(List list); + +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/TmTaskService.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/TmTaskService.java index d4cbf2cd..bd871cf8 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/TmTaskService.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/TmTaskService.java @@ -17,6 +17,13 @@ import java.util.List; public interface TmTaskService{ + /** + * 审批流领料申请 + * @param task + * @return + */ + AjaxResult createFlowLeaseApply(TmTask task); + List getLeaseAuditList(TmTask record); List getLeaseAuditListByOne(TmTask record); diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRecordServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRecordServiceImpl.java new file mode 100644 index 00000000..f6813b9a --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRecordServiceImpl.java @@ -0,0 +1,78 @@ +package com.bonus.sgzb.app.service.impl; + +import com.bonus.sgzb.app.mapper.BmFlowRecordMapper; +import com.bonus.sgzb.app.service.BmFlowRecordService; +import com.bonus.sgzb.base.api.domain.BmFlowRecord; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 12:59 +* @Version 1.0 +*/ + +@Service +public class BmFlowRecordServiceImpl implements BmFlowRecordService{ + + @Autowired + private BmFlowRecordMapper bmFlowRecordMapper; + + @Override + public int deleteByPrimaryKey(Integer id) { + return bmFlowRecordMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(BmFlowRecord record) { + return bmFlowRecordMapper.insert(record); + } + + @Override + public int insertOrUpdate(BmFlowRecord record) { + return bmFlowRecordMapper.insertOrUpdate(record); + } + + @Override + public int insertOrUpdateSelective(BmFlowRecord record) { + return bmFlowRecordMapper.insertOrUpdateSelective(record); + } + + @Override + public int insertSelective(BmFlowRecord record) { + return bmFlowRecordMapper.insertSelective(record); + } + + @Override + public BmFlowRecord selectByPrimaryKey(Integer id) { + return bmFlowRecordMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(BmFlowRecord record) { + return bmFlowRecordMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(BmFlowRecord record) { + return bmFlowRecordMapper.updateByPrimaryKey(record); + } + + @Override + public int updateBatch(List list) { + return bmFlowRecordMapper.updateBatch(list); + } + + @Override + public int updateBatchSelective(List list) { + return bmFlowRecordMapper.updateBatchSelective(list); + } + + @Override + public int batchInsert(List list) { + return bmFlowRecordMapper.batchInsert(list); + } + +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRelationServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRelationServiceImpl.java new file mode 100644 index 00000000..7ddc416a --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowRelationServiceImpl.java @@ -0,0 +1,83 @@ +package com.bonus.sgzb.app.service.impl; + +import com.bonus.sgzb.app.mapper.BmFlowRelationMapper; +import com.bonus.sgzb.app.service.BmFlowRelationService; +import com.bonus.sgzb.base.api.domain.BmFlowRelation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 13:03 +* @Version 1.0 +*/ + +@Service +public class BmFlowRelationServiceImpl implements BmFlowRelationService{ + + @Autowired + private BmFlowRelationMapper bmFlowRelationMapper; + + @Override + public int deleteByPrimaryKey(Integer id) { + return bmFlowRelationMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(BmFlowRelation record) { + return bmFlowRelationMapper.insert(record); + } + + @Override + public int insertOrUpdate(BmFlowRelation record) { + return bmFlowRelationMapper.insertOrUpdate(record); + } + + @Override + public int insertOrUpdateSelective(BmFlowRelation record) { + return bmFlowRelationMapper.insertOrUpdateSelective(record); + } + + @Override + public int insertSelective(BmFlowRelation record) { + return bmFlowRelationMapper.insertSelective(record); + } + + @Override + public BmFlowRelation selectByPrimaryKey(Integer id) { + return bmFlowRelationMapper.selectByPrimaryKey(id); + } + + @Override + public List selectAllByPrimaryKey(BmFlowRelation record) { + return bmFlowRelationMapper.selectAllByPrimaryKeys(record); + } + + @Override + public int updateByPrimaryKeySelective(BmFlowRelation record) { + return bmFlowRelationMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(BmFlowRelation record) { + return bmFlowRelationMapper.updateByPrimaryKey(record); + } + + @Override + public int updateBatch(List list) { + return bmFlowRelationMapper.updateBatch(list); + } + + @Override + public int updateBatchSelective(List list) { + return bmFlowRelationMapper.updateBatchSelective(list); + } + + @Override + public int batchInsert(List list) { + return bmFlowRelationMapper.batchInsert(list); + } + +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowServiceImpl.java new file mode 100644 index 00000000..01149a31 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/BmFlowServiceImpl.java @@ -0,0 +1,78 @@ +package com.bonus.sgzb.app.service.impl; + +import com.bonus.sgzb.app.mapper.BmFlowMapper; +import com.bonus.sgzb.app.service.BmFlowService; +import com.bonus.sgzb.base.api.domain.BmFlow; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +/** +* Description: +* @Author 阮世耀 +* @Create 2024/3/16 12:43 +* @Version 1.0 +*/ + +@Service +public class BmFlowServiceImpl implements BmFlowService{ + + @Autowired + private BmFlowMapper bmFlowMapper; + + @Override + public int deleteByPrimaryKey(Integer id) { + return bmFlowMapper.deleteByPrimaryKey(id); + } + + @Override + public int insert(BmFlow record) { + return bmFlowMapper.insert(record); + } + + @Override + public int insertOrUpdate(BmFlow record) { + return bmFlowMapper.insertOrUpdate(record); + } + + @Override + public int insertOrUpdateSelective(BmFlow record) { + return bmFlowMapper.insertOrUpdateSelective(record); + } + + @Override + public int insertSelective(BmFlow record) { + return bmFlowMapper.insertSelective(record); + } + + @Override + public BmFlow selectByPrimaryKey(Integer id) { + return bmFlowMapper.selectByPrimaryKey(id); + } + + @Override + public int updateByPrimaryKeySelective(BmFlow record) { + return bmFlowMapper.updateByPrimaryKeySelective(record); + } + + @Override + public int updateByPrimaryKey(BmFlow record) { + return bmFlowMapper.updateByPrimaryKey(record); + } + + @Override + public int updateBatch(List list) { + return bmFlowMapper.updateBatch(list); + } + + @Override + public int updateBatchSelective(List list) { + return bmFlowMapper.updateBatchSelective(list); + } + + @Override + public int batchInsert(List list) { + return bmFlowMapper.batchInsert(list); + } + +} diff --git a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java index 67b2e8bf..c9f80e38 100644 --- a/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java +++ b/sgzb-modules/sgzb-base/src/main/java/com/bonus/sgzb/app/service/impl/TmTaskServiceImpl.java @@ -7,7 +7,11 @@ import com.bonus.sgzb.app.domain.TmTask; import com.bonus.sgzb.app.mapper.LeaseApplyDetailsMapper; import com.bonus.sgzb.app.mapper.LeaseApplyInfoMapper; import com.bonus.sgzb.app.mapper.TmTaskMapper; -import com.bonus.sgzb.app.service.TmTaskService; +import com.bonus.sgzb.app.service.*; +import com.bonus.sgzb.base.api.domain.BmFlowRecord; +import com.bonus.sgzb.base.api.domain.BmFlowRelation; +import com.bonus.sgzb.common.core.constant.Constants; +import com.bonus.sgzb.common.core.domain.R; import com.bonus.sgzb.common.core.utils.DateUtils; import com.bonus.sgzb.common.core.utils.StringUtils; import com.bonus.sgzb.common.core.web.domain.AjaxResult; @@ -18,10 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; /** @@ -45,13 +46,33 @@ public class TmTaskServiceImpl implements TmTaskService { @Resource private LeaseApplyDetailsMapper leaseApplyDetailsMapper; + @Resource + private BmFlowRelationService bmFlowRelationService; + + @Resource + private TmTaskService tmTaskService; + + // 领料申请表Service + @Resource + private LeaseApplyInfoService leaseApplyInfoService; + + // 领料申请明细表Service + @Resource + private LeaseApplyDetailsService leaseApplyDetailsService; + + @Resource + private LeaseUserBookService leaseUserBookService; + + @Resource + private BmFlowRecordService bmFlowRecordService; + /** * 领料任务审核状态 * * @param record 审核数据及信息 */ @Override - @Transactional + @Transactional(rollbackFor = Exception.class) public int updateLeaseTaskAuditInfo(TmTask record) { int result = 0; int taskId = 0; @@ -210,6 +231,158 @@ public class TmTaskServiceImpl implements TmTaskService { return tmTaskList; } + /** + * 创建审批流领料申请 + * @param task 任务信息 + * @return 执行结果 + */ + @Override + public AjaxResult createFlowLeaseApply(TmTask task) { + // ---------审批流校验--------- + List bmFlowRelationList = leaseExamFlowParamCheck(task); + // 校验审批流配置 + if (CollUtil.isEmpty(bmFlowRelationList)) { + return AjaxResult.error("当前任务类型审批流配置为空,请联系管理员"); + } + // 审批流排序 + if (!copeOrderByField(bmFlowRelationList)) { return AjaxResult.error("审批流排序失败,请联系管理员"); } + // 获取起始节点状态 + String flowStartTaskStatus = bmFlowRelationList.get(0).getTaskStatus(); + // 设置任务状态为审批流的起点状态 + task.setTaskStatus(Integer.valueOf(flowStartTaskStatus)); + // -----------审批流处理结束 ------------- + + // 生成领料编码 + String code = tmTaskService.genderLeaseCode(); + if (StringUtils.isEmpty(code)) { return AjaxResult.error("后台生成CODE编号异常,请重试!"); } + task.setCode(code); + + // 创建任务 + if (tmTaskService.insertSelective(task) < 1) { return AjaxResult.error("创建领料任务失败,请重试!"); } + //任务与协议建立关联关系 + if (tmTaskService.insertAgreement(task) < 1) { return AjaxResult.error("领料任务与协议建立关联关系失败,请重试!"); } + + // 获取任务编号 + String taskId = task.getId(); + if (StringUtils.isEmpty(taskId)) {return AjaxResult.error("任务编号为空,创建失败");} + + // 处理任务数据,实例化至DB + R taskDataCopeResult = leaseTaskDataCope(task, code, taskId, bmFlowRelationList.size()); + if (taskDataCopeResult.getCode() != Constants.SUCCESS) { + return AjaxResult.error(taskDataCopeResult.getMsg()); + } + + // 数据处理成功后增加审批流记录 + R addLeaseTaskFlowRecordResult = addLeaseTaskFlowRecord(taskId, bmFlowRelationList); + if (addLeaseTaskFlowRecordResult.getCode() != Constants.SUCCESS) { + return AjaxResult.error(addLeaseTaskFlowRecordResult.getMsg()); + } + + return AjaxResult.success("执行成功,领料任务已添加"); + } + + private R addLeaseTaskFlowRecord(String taskId, List bmFlowRelationList) { + BmFlowRecord bmFlowRecord = new BmFlowRecord(); + try { + bmFlowRecord.setTaskId(Integer.valueOf(taskId)); + bmFlowRecord.setFlowId(bmFlowRelationList.get(0).getFlowId()); + if (bmFlowRelationList.size() > 1) { bmFlowRecord.setNextFlowId(bmFlowRelationList.get(1).getFlowId());} + // String loginUserName = SecurityUtils.getLoginUser().getSysUser().getUserName(); + // bmFlowRecord.setCreator(loginUserName == null ? "" : loginUserName); + bmFlowRecordService.insertSelective(bmFlowRecord); + } catch (Exception e) { + return R.fail("数据处理完成,但审批流记录失败,请联系运维人员:{}", e.getMessage()); + } + return R.ok(Constants.LOGIN_SUCCESS); + } + + private R leaseTaskDataCope(TmTask task, String code, String taskId, Integer bmFlowRelationListSize) { + // -----------数据处理开始start --------------- + // 根据设备所属分公司--拆分集合 + List> deviceByCompanyList; + try { + deviceByCompanyList = CollUtil.groupByField(task.getLeaseApplyDetails(), "companyId"); + } catch (RuntimeException e) { + log.error("领料任务数据拆分集合处理异常,请重试:{}", e.getMessage()); + return R.fail("领料任务数据拆分集合处理异常,请重试"); + } + + ArrayList ids = new ArrayList<>(); + // 对拆分后的集合进行each遍历 + for (List leaseApplyDetailsList : deviceByCompanyList) { + // 判断拆分后的集合内是否有数据 + if (CollUtil.isNotEmpty(leaseApplyDetailsList)) { + // 对领料任务表的对象做数据处理 + LeaseApplyInfo leaseApplyInfo = task.getLeaseApplyInfo(); + leaseApplyInfo.setCode(code); + leaseApplyInfo.setTaskId(Integer.valueOf(taskId)); + // 设置设备所属分公司,用于交给哪家审核 + leaseApplyInfo.setCompanyId(leaseApplyDetailsList.get(0).getCompanyId()); + // 设置审批层级,根据已启用的审批流进行赋值层数 + leaseApplyInfo.setType(String.valueOf(bmFlowRelationListSize)); + + // 创建领料任务,返回领料任务编号 + if (leaseApplyInfoService.genderLeaseCode(leaseApplyInfo) < 1) { + return R.fail("创建领料任务失败,或领料明细为空"); + } + + // 领料任务创建完成,进行领料任务明细插入 + ids.clear(); + if (StringUtils.isNotNull(leaseApplyInfo.getId())) { + for (LeaseApplyDetails leaseApplyDetails : leaseApplyDetailsList) { + // 设置领料任务ID + leaseApplyDetails.setParenntId(leaseApplyInfo.getId()); + ids.add(leaseApplyDetails.getId()); + } + // 插入领料任务明细 + if (leaseApplyDetailsService.batchInsert(leaseApplyDetailsList) > 0) { + leaseUserBookService.batchDel(ids); + } else { + log.error("领料任务明细插入失败:{}", task.getTaskId()); + System.out.println(("领料任务明细插入失败,请重试")); + } + } else { + return R.fail("领料任务编号为空"); + } + } + } + // -----------数据处理结束end --------------- + return R.ok(null, "领料任务数据插入成功"); + } + + /** + * 审批流排序 + * @param bmFlowRelationList 审批流数据集合 + * @return 排序结果 + */ + public static boolean copeOrderByField(List bmFlowRelationList) { + // 使用lambda表达式 按order字段从小到大进行排序 + try { + bmFlowRelationList.sort(Comparator.comparingInt(BmFlowRelation::getOrder)); + } catch (Exception e) { + log.error("审批流排序处理异常:{}", e.getMessage()); + return false; + } + return true; + } + + /** + * 根据任务入参查询审批流信息 + * @param task 任务 + * @return 审批流数据集合 + */ + private List leaseExamFlowParamCheck(TmTask task) { + // ---------审批流校验--------- + // 查询当前任务类型的审批流配置 + BmFlowRelation bmFlowRelation = new BmFlowRelation(); + // 赋值任务类型 + bmFlowRelation.setTaskType(29); + // 赋值组织机构 + bmFlowRelation.setCompanyId(task.getCompanyId()); + return bmFlowRelationService.selectAllByPrimaryKey(bmFlowRelation); + } + + /** * 获取单个申请列表 */ @@ -705,7 +878,7 @@ public class TmTaskServiceImpl implements TmTaskService { String result = format.replace("-", ""); int num = tmTaskMapper.selectNumByMonth(nowDate); num = num + 1; - String code = ""; + String code; if (num > 9 && num < 100) { code = "L" + result + "-00" + num; } else if (num > 99 && num < 1000) { diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowMapper.xml new file mode 100644 index 00000000..b9b09b03 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowMapper.xml @@ -0,0 +1,318 @@ + + + + + + + + + + + + + + + + id, p_id, `name`, tag, `status`, task_type + + + + + + + + + delete from bm_flow + where id = #{id,jdbcType=INTEGER} + + + + + insert into bm_flow (p_id, `name`, tag, + `status`, task_type) + values (#{pId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{tag,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}) + + + + + insert into bm_flow + + + p_id, + + + `name`, + + + tag, + + + `status`, + + + task_type, + + + + + #{pId,jdbcType=INTEGER}, + + + #{name,jdbcType=VARCHAR}, + + + #{tag,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{taskType,jdbcType=VARCHAR}, + + + + + + + update bm_flow + + + p_id = #{pId,jdbcType=INTEGER}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + tag = #{tag,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + task_type = #{taskType,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + + update bm_flow + set p_id = #{pId,jdbcType=INTEGER}, + `name` = #{name,jdbcType=VARCHAR}, + tag = #{tag,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + + update bm_flow + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.pId,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.tag,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.taskType,jdbcType=VARCHAR} + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + + update bm_flow + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.pId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.tag,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.taskType,jdbcType=VARCHAR} + + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + + insert into bm_flow + (p_id, `name`, tag, `status`, task_type) + values + + (#{item.pId,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR}, #{item.tag,jdbcType=VARCHAR}, + #{item.status,jdbcType=VARCHAR}, #{item.taskType,jdbcType=VARCHAR}) + + + + + + insert into bm_flow + + + id, + + p_id, + `name`, + tag, + `status`, + task_type, + + values + + + #{id,jdbcType=INTEGER}, + + #{pId,jdbcType=INTEGER}, + #{name,jdbcType=VARCHAR}, + #{tag,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, + #{taskType,jdbcType=VARCHAR}, + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + p_id = #{pId,jdbcType=INTEGER}, + `name` = #{name,jdbcType=VARCHAR}, + tag = #{tag,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR}, + + + + + + insert into bm_flow + + + id, + + + p_id, + + + `name`, + + + tag, + + + `status`, + + + task_type, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{pId,jdbcType=INTEGER}, + + + #{name,jdbcType=VARCHAR}, + + + #{tag,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{taskType,jdbcType=VARCHAR}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + p_id = #{pId,jdbcType=INTEGER}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + tag = #{tag,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + task_type = #{taskType,jdbcType=VARCHAR}, + + + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRecordMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRecordMapper.xml new file mode 100644 index 00000000..90384b95 --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRecordMapper.xml @@ -0,0 +1,332 @@ + + + + + + + + + + + + + + + + + id, task_id, flow_id, pre_flow_id, next_flow_id, creator, create_time + + + + + delete from bm_flow_record + where id = #{id,jdbcType=INTEGER} + + + + insert into bm_flow_record (task_id, flow_id, pre_flow_id, + next_flow_id, creator, create_time + ) + values (#{taskId,jdbcType=INTEGER}, #{flowId,jdbcType=INTEGER}, #{preFlowId,jdbcType=INTEGER}, + #{nextFlowId,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP} + ) + + + + insert into bm_flow_record + + + task_id, + + + flow_id, + + + pre_flow_id, + + + next_flow_id, + + + creator, + + + + + #{taskId,jdbcType=INTEGER}, + + + #{flowId,jdbcType=INTEGER}, + + + #{preFlowId,jdbcType=INTEGER}, + + + #{nextFlowId,jdbcType=INTEGER}, + + + #{creator,jdbcType=VARCHAR} + + + + + + + update bm_flow_record + + + task_id = #{taskId,jdbcType=INTEGER}, + + + flow_id = #{flowId,jdbcType=INTEGER}, + + + pre_flow_id = #{preFlowId,jdbcType=INTEGER}, + + + next_flow_id = #{nextFlowId,jdbcType=INTEGER}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + + update bm_flow_record + set task_id = #{taskId,jdbcType=INTEGER}, + flow_id = #{flowId,jdbcType=INTEGER}, + pre_flow_id = #{preFlowId,jdbcType=INTEGER}, + next_flow_id = #{nextFlowId,jdbcType=INTEGER}, + creator = #{creator,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + + + update bm_flow_record + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.taskId,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.flowId,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.preFlowId,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.nextFlowId,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.creator,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + update bm_flow_record + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.taskId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.flowId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.preFlowId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.nextFlowId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.creator,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP} + + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + insert into bm_flow_record + (task_id, flow_id, pre_flow_id, next_flow_id, creator, create_time) + values + + (#{item.taskId,jdbcType=INTEGER}, #{item.flowId,jdbcType=INTEGER}, #{item.preFlowId,jdbcType=INTEGER}, + #{item.nextFlowId,jdbcType=INTEGER}, #{item.creator,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP} + ) + + + + + insert into bm_flow_record + + + id, + + task_id, + flow_id, + pre_flow_id, + next_flow_id, + creator, + create_time, + + values + + + #{id,jdbcType=INTEGER}, + + #{taskId,jdbcType=INTEGER}, + #{flowId,jdbcType=INTEGER}, + #{preFlowId,jdbcType=INTEGER}, + #{nextFlowId,jdbcType=INTEGER}, + #{creator,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + task_id = #{taskId,jdbcType=INTEGER}, + flow_id = #{flowId,jdbcType=INTEGER}, + pre_flow_id = #{preFlowId,jdbcType=INTEGER}, + next_flow_id = #{nextFlowId,jdbcType=INTEGER}, + creator = #{creator,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + + + insert into bm_flow_record + + + id, + + + task_id, + + + flow_id, + + + pre_flow_id, + + + next_flow_id, + + + creator, + + + create_time, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{taskId,jdbcType=INTEGER}, + + + #{flowId,jdbcType=INTEGER}, + + + #{preFlowId,jdbcType=INTEGER}, + + + #{nextFlowId,jdbcType=INTEGER}, + + + #{creator,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + task_id = #{taskId,jdbcType=INTEGER}, + + + flow_id = #{flowId,jdbcType=INTEGER}, + + + pre_flow_id = #{preFlowId,jdbcType=INTEGER}, + + + next_flow_id = #{nextFlowId,jdbcType=INTEGER}, + + + creator = #{creator,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + + \ No newline at end of file diff --git a/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRelationMapper.xml b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRelationMapper.xml new file mode 100644 index 00000000..c0e885ac --- /dev/null +++ b/sgzb-modules/sgzb-base/src/main/resources/mapper/app/BmFlowRelationMapper.xml @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + id, flow_id, company_id, `status`, `order`, task_type, task_status + + + + + + + + + delete from bm_flow_relation + where id = #{id,jdbcType=INTEGER} + + + + + insert into bm_flow_relation (flow_id, company_id, `status`, + `order`, task_type) + values (#{flowId,jdbcType=INTEGER}, #{companyId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, + #{order,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}) + + + + + insert into bm_flow_relation + + + flow_id, + + + company_id, + + + `status`, + + + `order`, + + + task_type, + + + + + #{flowId,jdbcType=INTEGER}, + + + #{companyId,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{order,jdbcType=VARCHAR}, + + + #{taskType,jdbcType=VARCHAR}, + + + + + + + update bm_flow_relation + + + flow_id = #{flowId,jdbcType=INTEGER}, + + + company_id = #{companyId,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + `order` = #{order,jdbcType=VARCHAR}, + + + task_type = #{taskType,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + + update bm_flow_relation + set flow_id = #{flowId,jdbcType=INTEGER}, + company_id = #{companyId,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + `order` = #{order,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + + update bm_flow_relation + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.flowId,jdbcType=INTEGER} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.companyId,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.order,jdbcType=VARCHAR} + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.taskType,jdbcType=VARCHAR} + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + + update bm_flow_relation + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.flowId,jdbcType=INTEGER} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.companyId,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.status,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.order,jdbcType=VARCHAR} + + + + + + + when id = #{item.id,jdbcType=INTEGER} then #{item.taskType,jdbcType=VARCHAR} + + + + + where id in + + #{item.id,jdbcType=INTEGER} + + + + + insert into bm_flow_relation + (flow_id, company_id, `status`, `order`, task_type) + values + + (#{item.flowId,jdbcType=INTEGER}, #{item.companyId,jdbcType=VARCHAR}, #{item.status,jdbcType=VARCHAR}, + #{item.order,jdbcType=VARCHAR}, #{item.taskType,jdbcType=VARCHAR}) + + + + + insert into bm_flow_relation + + + id, + + flow_id, + company_id, + `status`, + `order`, + task_type, + + values + + + #{id,jdbcType=INTEGER}, + + #{flowId,jdbcType=INTEGER}, + #{companyId,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, + #{order,jdbcType=VARCHAR}, + #{taskType,jdbcType=VARCHAR}, + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + flow_id = #{flowId,jdbcType=INTEGER}, + company_id = #{companyId,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + `order` = #{order,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR}, + + + + + + insert into bm_flow_relation + + + id, + + + flow_id, + + + company_id, + + + `status`, + + + `order`, + + + task_type, + + + values + + + #{id,jdbcType=INTEGER}, + + + #{flowId,jdbcType=INTEGER}, + + + #{companyId,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{order,jdbcType=VARCHAR}, + + + #{taskType,jdbcType=VARCHAR}, + + + on duplicate key update + + + id = #{id,jdbcType=INTEGER}, + + + flow_id = #{flowId,jdbcType=INTEGER}, + + + company_id = #{companyId,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + `order` = #{order,jdbcType=VARCHAR}, + + + task_type = #{taskType,jdbcType=VARCHAR}, + + + + + \ No newline at end of file