From b37c20938b9d1d44d1ae220403df27ab1414b876 Mon Sep 17 00:00:00 2001
From: dongdingding <207595406@qq.com>
Date: Wed, 11 Dec 2024 11:18:10 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E4=BA=A7=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../tc/controller/AssetTaskController.java | 10 +-
.../tc/entity/response/AssetdwHcResponse.java | 10 +-
.../main/resources/mapper/AssetTaskDao.xml | 184 +++++++++++-------
3 files changed, 135 insertions(+), 69 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java
index 8351cde..e87fd78 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java
@@ -747,12 +747,18 @@ public class AssetTaskController extends BaseController {
/**
* 管理端-关闭
*
- * @param
+ * @param taskName 任务名称
+ * @param taskId 任务id
* @return
*/
@ApiOperation(value = "管理端-关闭")
@GetMapping("/close")
- public AjaxResult close(@RequestParam(value = "taskId", required = false) Integer taskId) {
+ public AjaxResult close(@RequestParam(value = "taskName") String taskName, @RequestParam(value = "taskId") Integer taskId) {
+ AssetLc assetLc = new AssetLc();
+ assetLc.setAssetName("管理员关闭" + taskName + "任务");
+ assetLc.setTaskId(taskId);
+ assetLc.setXfTime(LocalDateTime.now());
+ assetLcService.insert(assetLc);
assetTaskService.close(taskId);
return AjaxResult.success();
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java
index 7c5e485..0486e68 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/entity/response/AssetdwHcResponse.java
@@ -1,5 +1,6 @@
package com.ruoyi.tc.entity.response;
+import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -16,6 +17,7 @@ public class AssetdwHcResponse {
/**
* 单位名称
*/
+ @Excel(name = "单位名称")
@ApiModelProperty("单位名称")
private String dwmc;
@@ -25,6 +27,7 @@ public class AssetdwHcResponse {
/**
* 核查资产数量
*/
+ @Excel(name = "单位名称")
@ApiModelProperty("核查资产数量")
private Integer total;
@@ -32,13 +35,14 @@ public class AssetdwHcResponse {
/**
* 完成数量
*/
+ @Excel(name = "完成数量")
@ApiModelProperty("完成数量")
private Integer checked;
/**
- * 完成数量
+ * 完成状态
*/
- @ApiModelProperty("完成状态")
+ @Excel(name = "完成状态")
private Integer taskStatus;
@@ -46,6 +50,7 @@ public class AssetdwHcResponse {
/**
* 审核退回次数
*/
+ @Excel(name = "审核退回次数")
@ApiModelProperty("审核退回次数")
private Integer shthcs;
@@ -53,6 +58,7 @@ public class AssetdwHcResponse {
/**
* 百分比
*/
+ @Excel(name = "百分比")
@ApiModelProperty("百分比")
private double checkedRatio;
diff --git a/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml b/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml
index 16fd675..926338d 100644
--- a/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml
+++ b/ruoyi-admin/src/main/resources/mapper/AssetTaskDao.xml
@@ -246,32 +246,42 @@
SELECT
s.dwmc,
s.task_id,
- latest_create_time,
+ CURRENT_TIMESTAMP AS latest_create_time, -- 使用当前时间
b.task_deadline,
- SUM(total) AS total,
- SUM(checked) AS checked,
+ SUM(s.total) AS total,
+ SUM(s.checked) AS checked,
+ COALESCE(SUM(s.returned), 0) AS shthcs,
+ ROUND(
CASE
- WHEN SUM(returned) IS NULL OR SUM(returned) = 0 THEN 0
- ELSE SUM(returned)
- END AS shthcs,
- ROUND(CASE
- WHEN SUM(total) > 0 THEN SUM(checked) * 100 / SUM(total)
+ WHEN SUM(s.total) > 0 THEN
+ SUM(s.checked) * 100.0 / SUM(s.total)
ELSE 0
- END, 2) AS checkedRatio,
+ END,
+ 2
+ ) AS checkedRatio,
CASE
- WHEN ROUND(CASE
- WHEN SUM(total) > 0 THEN SUM(checked) * 100 / SUM(total)
+ WHEN ROUND(
+ CASE
+ WHEN SUM(s.total) > 0 THEN
+ SUM(s.checked) * 100.0 / SUM(s.total)
ELSE 0
- END, 2) = 100
- AND MAX(latest_create_time) < b.task_deadline THEN 2
- WHEN ROUND(CASE
- WHEN SUM(total) > 0 THEN SUM(checked) * 100 / SUM(total)
+ END,
+ 2
+ ) = 100
+ AND CURRENT_TIMESTAMP < b.task_deadline THEN 2
+ WHEN ROUND(
+ CASE
+ WHEN SUM(s.total) > 0 THEN
+ SUM(s.checked) * 100.0 / SUM(s.total)
ELSE 0
- END, 2) = 100
- AND MAX(latest_create_time) >= b.task_deadline THEN 3
+ END,
+ 2
+ ) = 100
+ AND CURRENT_TIMESTAMP >= b.task_deadline THEN 3
ELSE 1
END AS taskStatus
- FROM (
+ FROM
+ (
SELECT
dwmc,
COUNT(*) AS total,
@@ -392,8 +402,8 @@
GROUP BY
s.dwmc ,
- s.task_id,
- s.latest_create_time
+ s.task_id
+