From 1bb347b003850f643b4fdf6ff5bda6372204df44 Mon Sep 17 00:00:00 2001
From: sxu <602087911@qq.com>
Date: Thu, 17 Oct 2024 12:27:34 +0800
Subject: [PATCH 1/2] add script
---
scripts_244/deploy_material.sh | 47 ++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 scripts_244/deploy_material.sh
diff --git a/scripts_244/deploy_material.sh b/scripts_244/deploy_material.sh
new file mode 100644
index 00000000..e60518d5
--- /dev/null
+++ b/scripts_244/deploy_material.sh
@@ -0,0 +1,47 @@
+#!/bin/bash
+#jar_version="24.10.0-SNAPSHOT"
+
+export deploy_path=/opt/webapps/bonus-material
+#export app_workspace=/opt/builds/releases/Bonus-Cloud/${jar_version}
+#export biz_workspace=/opt/install/jenkins_home/workspace/Bonus-Cloud-Material
+
+#cp -f ${biz_workspace}/"bonus-modules/bonus-material/target/bonus-material.jar" $deploy_path
+#echo "copied ${app_workspace}/${source_jar} to $deploy_path"
+
+# Define an array of JAR files to run
+jars=("bonus-material.jar --spring.config.location=file:material_bootstrap.yml")
+
+# 遍历数组并检查每个JAR文件的进程
+for jar_with_args in "${jars[@]}"; do
+ # 提取JAR文件名(不包括参数)
+ jar=$(echo $jar_with_args | awk '{print $1}')
+
+ # 检查进程是否启动
+ echo "原应用程序1 $jar "
+ pids=$(pgrep -f $jar || true)
+ echo "原应用程序2 $jar "
+ if [ -n "$pids" ]; then
+ echo "$jar is running with PID(s): $pids"
+ # 杀死进程
+ for pid in $pids; do
+ kill -9 $pid
+ if [ $? -eq 0 ]; then
+ echo "Process $pid for $jar killed successfully"
+ else
+ echo "Failed to kill process $pid for $jar"
+ fi
+ done
+ else
+ echo "$jar is not running"
+ fi
+done
+
+cd $deploy_path || { echo "Failed to change directory to $deploy_path"; exit 1; }
+# Iterate over the JAR files array
+for jar in "${jars[@]}"; do
+ echo "Starting $jar"
+ nohup /usr/local/jdk1.8.0/bin/java -jar $jar >/dev/null 2>&1 &
+done
+
+echo "All JARs have been run successfully."
+
From f779b8b0febf21a4953f052a16e198b02759be36 Mon Sep 17 00:00:00 2001
From: sxu <602087911@qq.com>
Date: Fri, 18 Oct 2024 12:07:48 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=BB=E5=8A=A1?=
=?UTF-8?q?=E5=AE=A1=E6=A0=B8=E6=A8=A1=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/biz/constant/BmConfigItems.java | 2 +-
.../biz/constant/MaterialConstants.java | 4 +
bonus-modules/bonus-material/pom.xml | 5 +
.../basic/service/IBmConfigService.java | 2 +-
.../service/impl/BmConfigServiceImpl.java | 16 +-
.../material/common/utils/AuditTool.java | 50 ++++++
.../controller/TmTaskAuditLogController.java | 137 ++++++++++++++++
.../material/task/domain/TmTaskAuditLog.java | 40 +++++
.../task/domain/TmTaskAuditResult.java | 22 +++
.../task/mapper/TmTaskAuditLogMapper.java | 68 ++++++++
.../task/service/ITmTaskAuditLogService.java | 71 +++++++++
.../impl/TmTaskAuditLogServiceImpl.java | 147 ++++++++++++++++++
.../mapper/material/basic/BmConfigMapper.xml | 2 +-
.../material/task/TmTaskAuditLogMapper.xml | 94 +++++++++++
.../material/common/utils/AuditToolTest.java | 15 ++
15 files changed, 669 insertions(+), 6 deletions(-)
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/common/utils/AuditTool.java
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskAuditLogController.java
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditResult.java
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java
create mode 100644 bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java
create mode 100644 bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml
create mode 100644 bonus-modules/bonus-material/src/test/java/com/bonus/material/common/utils/AuditToolTest.java
diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java
index 97992165..b7ad19e7 100644
--- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java
+++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/BmConfigItems.java
@@ -5,6 +5,6 @@ package com.bonus.common.biz.constant;
* @author bonus
*/
public class BmConfigItems {
- public static final String LEASE_AUDIT_ROLE_KEYS = "LeaseAuditRoleKeys";
+ public static final String LEASE_TASK_AUDIT_ROLE_KEYS = "LeaseTaskAuditRoleKeys";
}
diff --git a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java
index 27b49a68..ea6a8873 100644
--- a/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java
+++ b/bonus-common-biz/src/main/java/com/bonus/common/biz/constant/MaterialConstants.java
@@ -13,5 +13,9 @@ public class MaterialConstants
*/
public static final String UTF8 = "UTF-8";
+ /**
+ * 领料任务类型
+ */
+ public static final Long LEASE_TASK_TYPE = 2L;
}
diff --git a/bonus-modules/bonus-material/pom.xml b/bonus-modules/bonus-material/pom.xml
index 908da249..7b41cdb9 100644
--- a/bonus-modules/bonus-material/pom.xml
+++ b/bonus-modules/bonus-material/pom.xml
@@ -100,6 +100,11 @@
24.10.0-SNAPSHOT
compile
+
+ junit
+ junit
+ test
+
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java
index 75840819..08ebcb88 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/IBmConfigService.java
@@ -68,5 +68,5 @@ public interface IBmConfigService
*/
public int deleteBmConfigById(Long id);
- public String getLeaseAuditRoleKeys();
+ public List getLeaseTaskAuditRoleKeys();
}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java
index 3f02ce43..625dcf7e 100644
--- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/basic/service/impl/BmConfigServiceImpl.java
@@ -1,6 +1,9 @@
package com.bonus.material.basic.service.impl;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
import com.bonus.common.biz.constant.BmConfigItems;
import com.bonus.common.core.utils.DateUtils;
@@ -117,8 +120,15 @@ public class BmConfigServiceImpl implements IBmConfigService
}
}
- public String getLeaseAuditRoleKeys() {
- String value = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.LEASE_AUDIT_ROLE_KEYS).getItemValue();
- return getValueWithDefault(value, "");
+ public List getLeaseTaskAuditRoleKeys() {
+ List list = new ArrayList();
+ BmConfig bmConfig = bmConfigMapper.selectBmConfigByItemName(BmConfigItems.LEASE_TASK_AUDIT_ROLE_KEYS);
+ if (Objects.nonNull(bmConfig)) {
+ String value = getValueWithDefault(bmConfig.getItemValue(), "");
+ if (StringUtils.isNotEmpty(value)) {
+ list = Arrays.asList(value.split(","));
+ }
+ }
+ return list;
}
}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/utils/AuditTool.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/utils/AuditTool.java
new file mode 100644
index 00000000..33b7780b
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/common/utils/AuditTool.java
@@ -0,0 +1,50 @@
+//package com.bonus.material.common.utils;
+//
+//import com.bonus.common.biz.constant.MaterialConstants;
+//import com.bonus.material.basic.service.IBmConfigService;
+//import com.bonus.material.task.domain.TmTaskAuditLogs;
+//import com.bonus.material.task.domain.TmTaskAuditResult;
+//import com.bonus.material.task.service.ITmTaskAuditLogsService;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.util.CollectionUtils;
+//import java.util.ArrayList;
+//import java.util.List;
+//
+//public class AuditTool {
+//
+// @Autowired
+// private IBmConfigService bmConfigService;
+//
+// @Autowired
+// private ITmTaskAuditLogsService tmTaskAuditLogsService;
+//
+// public TmTaskAuditResult getAuditResult(Long taskId, Long taskType) {
+// List needRoles = new ArrayList<>();
+// if (MaterialConstants.LEASE_TASK.equals(taskType)) {
+// needRoles = bmConfigService.getLeaseTaskAuditRoleKeys();
+// }
+// //TODO, add more tasks logic to get needRoles
+// if (CollectionUtils.isEmpty(needRoles)) {
+// return new TmTaskAuditResult(true);
+// } else {
+// List auditRoleKeys = tmTaskAuditLogsService.selectTmTaskAuditRoleKeyList(new TmTaskAuditLogs(taskId, taskType));
+// String nextRole = needRoles.get(0);
+// boolean isFinished = false;
+// for (int i = 0; i < needRoles.size(); i++) {
+// if (i < needRoles.size() - 1) {
+// // 遍历,还没到最后一个
+// if (auditRoleKeys.contains(needRoles.get(i))) {
+// nextRole = needRoles.get(i + 1);
+// }
+// } else {
+// // 遍历,已经到最后一个了
+// if (auditRoleKeys.contains(needRoles.get(i))) {
+// nextRole = "";
+// isFinished = true;
+// }
+// }
+// }
+// return new TmTaskAuditResult(isFinished, needRoles, nextRole);
+// }
+// }
+//}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskAuditLogController.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskAuditLogController.java
new file mode 100644
index 00000000..5de3121d
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/controller/TmTaskAuditLogController.java
@@ -0,0 +1,137 @@
+package com.bonus.material.task.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import com.bonus.common.log.enums.OperaType;
+import com.bonus.material.common.annotation.PreventRepeatSubmit;
+import com.bonus.material.task.domain.TmTaskAuditResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.bonus.common.log.annotation.SysLog;
+import com.bonus.common.security.annotation.RequiresPermissions;
+import com.bonus.material.task.domain.TmTaskAuditLog;
+import com.bonus.material.task.service.ITmTaskAuditLogService;
+import com.bonus.common.core.web.controller.BaseController;
+import com.bonus.common.core.web.domain.AjaxResult;
+import com.bonus.common.core.utils.poi.ExcelUtil;
+import com.bonus.common.core.web.page.TableDataInfo;
+
+/**
+ * 任务Controller
+ *
+ * @author xsheng
+ * @date 2024-10-18
+ */
+@Api(tags = "任务接口")
+@RestController
+@RequestMapping("/tm_task_audit_log")
+public class TmTaskAuditLogController extends BaseController {
+ @Autowired
+ private ITmTaskAuditLogService tmTaskAuditLogsService;
+
+ /**
+ * 查询任务列表
+ */
+ @ApiOperation(value = "查询任务列表")
+ @RequiresPermissions("task:logs:list")
+ @GetMapping("/list")
+ public TableDataInfo list(TmTaskAuditLog tmTaskAuditLog) {
+ startPage();
+ List list = tmTaskAuditLogsService.selectTmTaskAuditLogsList(tmTaskAuditLog);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出任务列表
+ */
+ @ApiOperation(value = "导出任务列表")
+ @PreventRepeatSubmit
+ @RequiresPermissions("task:logs:export")
+ @SysLog(title = "任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出任务")
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, TmTaskAuditLog tmTaskAuditLog) {
+ List list = tmTaskAuditLogsService.selectTmTaskAuditLogsList(tmTaskAuditLog);
+ ExcelUtil util = new ExcelUtil(TmTaskAuditLog.class);
+ util.exportExcel(response, list, "任务数据");
+ }
+
+ /**
+ * 获取任务详细信息
+ */
+ @ApiOperation(value = "获取任务详细信息")
+ @RequiresPermissions("task:logs:query")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return success(tmTaskAuditLogsService.selectTmTaskAuditLogsById(id));
+ }
+
+ /**
+ * 新增任务
+ */
+ @ApiOperation(value = "新增任务")
+ @PreventRepeatSubmit
+ @RequiresPermissions("task:logs:add")
+ @SysLog(title = "任务", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增任务")
+ @PostMapping
+ public AjaxResult add(@RequestBody TmTaskAuditLog tmTaskAuditLog) {
+ try {
+ return toAjax(tmTaskAuditLogsService.insertTmTaskAuditLogs(tmTaskAuditLog));
+ } catch (Exception e) {
+ return error("系统错误, " + e.getMessage());
+ }
+ }
+
+ /**
+ * 修改任务
+ */
+ @ApiOperation(value = "修改任务")
+ @PreventRepeatSubmit
+ @RequiresPermissions("task:logs:edit")
+ @SysLog(title = "任务", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改任务")
+ @PutMapping
+ public AjaxResult edit(@RequestBody TmTaskAuditLog tmTaskAuditLog) {
+ try {
+ return toAjax(tmTaskAuditLogsService.updateTmTaskAuditLogs(tmTaskAuditLog));
+ } catch (Exception e) {
+ return error("系统错误, " + e.getMessage());
+ }
+ }
+
+ /**
+ * 删除任务
+ */
+ @ApiOperation(value = "删除任务")
+ @PreventRepeatSubmit
+ @RequiresPermissions("task:logs:remove")
+ @SysLog(title = "任务", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除任务")
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ return toAjax(tmTaskAuditLogsService.deleteTmTaskAuditLogsByIds(ids));
+ }
+
+ /**
+ * 新增任务
+ */
+ @ApiOperation(value = "任务审核结果")
+ @PreventRepeatSubmit
+ @RequiresPermissions("task:logs:audits")
+ @SysLog(title = "任务审核结果", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->任务审核结果")
+ @PostMapping("/audits")
+ public AjaxResult queryTaskAudits(@RequestBody TmTaskAuditLog tmTaskAuditLog) {
+ try {
+ TmTaskAuditResult tmTaskAuditResult = tmTaskAuditLogsService.getAuditResult(tmTaskAuditLog);
+ return success(tmTaskAuditResult);
+ } catch (Exception e) {
+ return error("系统错误, " + e.getMessage());
+ }
+ }
+}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java
new file mode 100644
index 00000000..234fe66d
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditLog.java
@@ -0,0 +1,40 @@
+package com.bonus.material.task.domain;
+
+import com.bonus.common.core.annotation.Excel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.ToString;
+import com.bonus.common.core.web.domain.BaseEntity;
+
+/**
+ * 任务对象 tm_task_audit_log
+ *
+ * @author xsheng
+ * @date 2024-10-18
+ */
+
+
+@Data
+@ToString
+public class TmTaskAuditLog extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /** 主键ID */
+ private Long id;
+
+ /** 任务ID */
+ @Excel(name = "任务ID")
+ @ApiModelProperty(value = "任务ID")
+ private Long taskId;
+
+ /** 任务类型(定义数据字典) */
+ @Excel(name = "任务类型(定义数据字典)")
+ @ApiModelProperty(value = "任务类型(定义数据字典)")
+ private Long taskType;
+
+ /** 角色权限字符串 */
+ @Excel(name = "角色权限字符串")
+ @ApiModelProperty(value = "角色权限字符串")
+ private String roleKey;
+
+}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditResult.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditResult.java
new file mode 100644
index 00000000..4b45eb37
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/domain/TmTaskAuditResult.java
@@ -0,0 +1,22 @@
+package com.bonus.material.task.domain;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class TmTaskAuditResult {
+ private boolean finished;
+ private List auditRoles;
+ private String nextRole;
+
+ public TmTaskAuditResult(boolean finished) {
+ this.finished = finished;
+ }
+
+ public TmTaskAuditResult(boolean finished, List auditRoles, String nextRole) {
+ this.finished = finished;
+ this.auditRoles = auditRoles;
+ this.nextRole = nextRole;
+ }
+}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java
new file mode 100644
index 00000000..9068cf04
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/mapper/TmTaskAuditLogMapper.java
@@ -0,0 +1,68 @@
+package com.bonus.material.task.mapper;
+
+import java.util.List;
+import com.bonus.material.task.domain.TmTaskAuditLog;
+
+/**
+ * 任务Mapper接口
+ *
+ * @author xsheng
+ * @date 2024-10-18
+ */
+public interface TmTaskAuditLogMapper {
+ /**
+ * 查询任务
+ *
+ * @param id 任务主键
+ * @return 任务
+ */
+ public TmTaskAuditLog selectTmTaskAuditLogById(Long id);
+
+ /**
+ * 查询任务列表
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 任务集合
+ */
+ public List selectTmTaskAuditLogList(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 查询任务列表已审核roleKeys
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 任务集合
+ */
+ public List selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 新增任务
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 结果
+ */
+ public int insertTmTaskAuditLog(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 修改任务
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 结果
+ */
+ public int updateTmTaskAuditLog(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 删除任务
+ *
+ * @param id 任务主键
+ * @return 结果
+ */
+ public int deleteTmTaskAuditLogById(Long id);
+
+ /**
+ * 批量删除任务
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ public int deleteTmTaskAuditLogsByIds(Long[] ids);
+}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java
new file mode 100644
index 00000000..d85aa08f
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/ITmTaskAuditLogService.java
@@ -0,0 +1,71 @@
+package com.bonus.material.task.service;
+
+import java.util.List;
+import com.bonus.material.task.domain.TmTaskAuditLog;
+import com.bonus.material.task.domain.TmTaskAuditResult;
+
+/**
+ * 任务Service接口
+ *
+ * @author xsheng
+ * @date 2024-10-18
+ */
+public interface ITmTaskAuditLogService {
+ /**
+ * 查询任务
+ *
+ * @param id 任务主键
+ * @return 任务
+ */
+ public TmTaskAuditLog selectTmTaskAuditLogsById(Long id);
+
+ /**
+ * 查询任务列表
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 任务集合
+ */
+ public List selectTmTaskAuditLogsList(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 查询任务列表已审核的RoleKeys
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 任务集合
+ */
+ public List selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 新增任务
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 结果
+ */
+ public int insertTmTaskAuditLogs(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 修改任务
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 结果
+ */
+ public int updateTmTaskAuditLogs(TmTaskAuditLog tmTaskAuditLog);
+
+ /**
+ * 批量删除任务
+ *
+ * @param ids 需要删除的任务主键集合
+ * @return 结果
+ */
+ public int deleteTmTaskAuditLogsByIds(Long[] ids);
+
+ /**
+ * 删除任务信息
+ *
+ * @param id 任务主键
+ * @return 结果
+ */
+ public int deleteTmTaskAuditLogsById(Long id);
+
+ public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog);
+}
diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java
new file mode 100644
index 00000000..3efa54c7
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/task/service/impl/TmTaskAuditLogServiceImpl.java
@@ -0,0 +1,147 @@
+package com.bonus.material.task.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.bonus.common.biz.constant.MaterialConstants;
+import com.bonus.common.core.exception.ServiceException;
+import com.bonus.common.core.utils.DateUtils;
+import com.bonus.material.basic.service.IBmConfigService;
+import com.bonus.material.task.domain.TmTaskAuditResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.bonus.material.task.mapper.TmTaskAuditLogMapper;
+import com.bonus.material.task.domain.TmTaskAuditLog;
+import com.bonus.material.task.service.ITmTaskAuditLogService;
+import org.springframework.util.CollectionUtils;
+
+/**
+ * 任务Service业务层处理
+ *
+ * @author xsheng
+ * @date 2024-10-18
+ */
+@Service
+public class TmTaskAuditLogServiceImpl implements ITmTaskAuditLogService {
+ @Autowired
+ private TmTaskAuditLogMapper tmTaskAuditLogsMapper;
+
+ @Autowired
+ private IBmConfigService bmConfigService;
+
+ /**
+ * 查询任务
+ *
+ * @param id 任务主键
+ * @return 任务
+ */
+ @Override
+ public TmTaskAuditLog selectTmTaskAuditLogsById(Long id) {
+ return tmTaskAuditLogsMapper.selectTmTaskAuditLogById(id);
+ }
+
+ /**
+ * 查询任务列表
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 任务
+ */
+ @Override
+ public List selectTmTaskAuditLogsList(TmTaskAuditLog tmTaskAuditLog) {
+ return tmTaskAuditLogsMapper.selectTmTaskAuditLogList(tmTaskAuditLog);
+ }
+
+ /**
+ * 查询任务列表已审核的RoleKey
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 任务集合
+ */
+ public List selectTmTaskAuditRoleKeyList(TmTaskAuditLog tmTaskAuditLog) {
+ return tmTaskAuditLogsMapper.selectTmTaskAuditRoleKeyList(tmTaskAuditLog);
+ }
+
+ /**
+ * 新增任务
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 结果
+ */
+ @Override
+ public int insertTmTaskAuditLogs(TmTaskAuditLog tmTaskAuditLog) {
+ tmTaskAuditLog.setCreateTime(DateUtils.getNowDate());
+ try {
+ return tmTaskAuditLogsMapper.insertTmTaskAuditLog(tmTaskAuditLog);
+ } catch (Exception e) {
+ throw new ServiceException("错误信息描述");
+ }
+ }
+
+ /**
+ * 修改任务
+ *
+ * @param tmTaskAuditLog 任务
+ * @return 结果
+ */
+ @Override
+ public int updateTmTaskAuditLogs(TmTaskAuditLog tmTaskAuditLog) {
+ tmTaskAuditLog.setUpdateTime(DateUtils.getNowDate());
+ try {
+ return tmTaskAuditLogsMapper.updateTmTaskAuditLog(tmTaskAuditLog);
+ } catch (Exception e) {
+ throw new ServiceException("错误信息描述");
+ }
+ }
+
+ /**
+ * 批量删除任务
+ *
+ * @param ids 需要删除的任务主键
+ * @return 结果
+ */
+ @Override
+ public int deleteTmTaskAuditLogsByIds(Long[] ids) {
+ return tmTaskAuditLogsMapper.deleteTmTaskAuditLogsByIds(ids);
+ }
+
+ /**
+ * 删除任务信息
+ *
+ * @param id 任务主键
+ * @return 结果
+ */
+ @Override
+ public int deleteTmTaskAuditLogsById(Long id) {
+ return tmTaskAuditLogsMapper.deleteTmTaskAuditLogById(id);
+ }
+
+ public TmTaskAuditResult getAuditResult(TmTaskAuditLog tmTaskAuditLog) {
+ List needRoles = new ArrayList<>();
+ if (MaterialConstants.LEASE_TASK_TYPE.equals(tmTaskAuditLog.getTaskType())) {
+ needRoles = bmConfigService.getLeaseTaskAuditRoleKeys();
+ }
+ //TODO, add more tasks logic to get needRoles
+ if (CollectionUtils.isEmpty(needRoles)) {
+ return new TmTaskAuditResult(true);
+ } else {
+ List auditRoleKeys = selectTmTaskAuditRoleKeyList(tmTaskAuditLog);
+ String nextRole = needRoles.get(0);
+ boolean finished = false;
+ for (int i = 0; i < needRoles.size(); i++) {
+ if (i < needRoles.size() - 1) {
+ // 遍历,还没到最后一个
+ if (auditRoleKeys.contains(needRoles.get(i))) {
+ nextRole = needRoles.get(i + 1);
+ }
+ } else {
+ // 遍历,已经到最后一个了
+ if (auditRoleKeys.contains(needRoles.get(i))) {
+ nextRole = "";
+ finished = true;
+ }
+ }
+ }
+ return new TmTaskAuditResult(finished, needRoles, nextRole);
+ }
+ }
+}
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmConfigMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmConfigMapper.xml
index 6a80353c..c22a6be1 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmConfigMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/basic/BmConfigMapper.xml
@@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml
new file mode 100644
index 00000000..787d9295
--- /dev/null
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/task/TmTaskAuditLogMapper.xml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, task_id, task_type, role_key, create_by, create_time, update_by, update_time, remark from tm_task_audit_log
+
+
+
+
+
+
+
+
+
+ insert into tm_task_audit_log
+
+ task_id,
+ task_type,
+ role_key,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ remark,
+
+
+ #{taskId},
+ #{taskType},
+ #{roleKey},
+ #{createBy},
+ #{createTime},
+ #{updateBy},
+ #{updateTime},
+ #{remark},
+
+
+
+
+ update tm_task_audit_log
+
+ task_id = #{taskId},
+ task_type = #{taskType},
+ role_key = #{roleKey},
+ create_by = #{createBy},
+ create_time = #{createTime},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ remark = #{remark},
+
+ where id = #{id}
+
+
+
+ delete from tm_task_audit_log where id = #{id}
+
+
+
+ delete from tm_task_audit_log where id in
+
+ #{id}
+
+
+
\ No newline at end of file
diff --git a/bonus-modules/bonus-material/src/test/java/com/bonus/material/common/utils/AuditToolTest.java b/bonus-modules/bonus-material/src/test/java/com/bonus/material/common/utils/AuditToolTest.java
new file mode 100644
index 00000000..2675305d
--- /dev/null
+++ b/bonus-modules/bonus-material/src/test/java/com/bonus/material/common/utils/AuditToolTest.java
@@ -0,0 +1,15 @@
+//package com.bonus.material.common.utils;
+//
+//import com.bonus.material.task.domain.TmTaskAuditResult;
+//import org.junit.Test;
+//import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
+//
+//public class AuditToolTest {
+//
+// @Test
+// public void testGetDatesBefore1(){
+// TmTaskAuditResult result = AuditTool.getAuditResult(1L,1L);
+// assertNotNull(result);
+// }
+//
+//}