From 5ef44ce6297e223faecc3819911d2891a3c582c7 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期二, 06 一月 2026 10:16:07 +0800
Subject: [PATCH] 【市一】随访满意度明细调整
---
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml | 2 +-
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java | 26 ++++++++++++++++++++++++--
smartor/src/main/java/com/smartor/domain/ServiceSubtaskScriptCount.java | 11 +++++++++++
ruoyi-admin/src/main/resources/application.yml | 2 +-
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml | 17 +++++++++++++++++
5 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 0f69eba..79bbd46 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -74,7 +74,7 @@
# 鍥介檯鍖栬祫婧愭枃浠惰矾寰�
basename: i18n/messages
profiles:
- active: ls
+ active: druid
# 鏂囦欢涓婁紶
servlet:
diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
index f97eebc..e4ac783 100644
--- a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
+++ b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
@@ -12,7 +12,7 @@
<!-- 閰嶇疆榛樿鐨勬墽琛屽櫒.SIMPLE灏辨槸鏅�氭墽琛屽櫒;REUSE鎵ц鍣ㄤ細閲嶇敤棰勫鐞嗚鍙�(prepared statements);BATCH鎵ц鍣ㄥ皢閲嶇敤璇彞骞舵墽琛屾壒閲忔洿鏂� -->
<setting name="defaultExecutorType" value="SIMPLE"/>
<!-- 鎸囧畾 MyBatis 鎵�鐢ㄦ棩蹇楃殑鍏蜂綋瀹炵幇(鏄惁鎵撳嵃SQL) -->
-<!-- <setting name="logImpl" value="STDOUT_LOGGING"/>-->
+ <setting name="logImpl" value="STDOUT_LOGGING"/>
<!-- 浣跨敤椹煎嘲鍛藉悕娉曡浆鎹㈠瓧娈� -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
</settings>
diff --git a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskScriptCount.java b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskScriptCount.java
index 0bdd682..728ed32 100644
--- a/smartor/src/main/java/com/smartor/domain/ServiceSubtaskScriptCount.java
+++ b/smartor/src/main/java/com/smartor/domain/ServiceSubtaskScriptCount.java
@@ -31,6 +31,12 @@
private String scriptContent;
/**
+ * 棰樼洰绫诲瀷;鏋氫妇 1.鍗曢�� 2澶氶�� 3濉┖ 4鍏跺畠
+ */
+ @ApiModelProperty(value = "棰樼洰绫诲瀷;鏋氫妇 1.鍗曢�� 2澶氶�� 3濉┖ 4鍏跺畠")
+ private String scriptType;
+
+ /**
* 宸插~鍐欐暟閲�
*/
@ApiModelProperty(value = "宸插~鍐欐暟閲�")
@@ -66,6 +72,11 @@
@ApiModelProperty(value = "閫夋嫨姣斾緥")
private String chosenPercentage;
+ /**
+ * 闂閫夐」闆嗗悎锛岄�楀彿鍒嗗壊
+ */
+ @ApiModelProperty(value = "闂閫夐」闆嗗悎")
+ private String options;
/**
* 鏄庣粏
diff --git a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
index 8982e03..34be16f 100644
--- a/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -17,6 +17,7 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -3027,7 +3028,8 @@
Map<String, ServiceSubtaskScriptCount> result = new HashMap<>();
List<ServiceSubtaskScriptCount> allCounts = new ArrayList<>();
List<ServiceSubtaskScriptCount> allItemCounts = new ArrayList<>();
- if(ObjectUtils.isEmpty(serviceSubtaskCountReq.getType())){
+ String type = serviceSubtaskCountReq.getType();
+ if(ObjectUtils.isEmpty(type)){
//鏌ヨ璇煶缁熻鏄庣粏
serviceSubtaskCountReq.setType("1");
List<ServiceSubtaskScriptCount> ivyCounts = serviceSubtaskMapper.getSfStatisticsScriptDetails(serviceSubtaskCountReq);
@@ -3049,12 +3051,31 @@
for(ServiceSubtaskScriptCount count : allCounts){
+ Map<String, ServiceSubtaskScriptCount> itemCountMap = new HashMap<>();
+ if(ObjectUtils.isNotEmpty(count.getOptions())){
+ String[] optionsArray = count.getOptions().split(",");
+ List<String> optionsList = Arrays.stream(optionsArray).map(String::valueOf).collect(Collectors.toList());
+ if(ObjectUtils.isNotEmpty(optionsList)){
+ //濉叆绌虹櫧淇℃伅
+ optionsList.forEach(option ->{
+ ServiceSubtaskScriptCount emptyCount = new ServiceSubtaskScriptCount();
+ emptyCount.setScriptContent(count.getScriptContent());
+ emptyCount.setScriptType(count.getScriptType());
+ emptyCount.setCompletedQuantity(count.getCompletedQuantity());
+ emptyCount.setAllQuantity(count.getAllQuantity());
+ emptyCount.setChosenQuantity(0);
+ emptyCount.setChosenPercentage("0.0");
+ itemCountMap.put(option,emptyCount);
+ });
+ }
+ }
List<ServiceSubtaskScriptCount> itemCounts = new ArrayList<>();
allItemCounts.forEach(itemCount ->{
if(ObjectUtils.isNotEmpty(count.getScriptid()) && ObjectUtils.isNotEmpty(itemCount.getScriptid())){
if(count.getScriptid().equals(itemCount.getScriptid())){
//鏀惧叆缁熻淇℃伅
itemCount.setScriptContent(count.getScriptContent());
+ itemCount.setScriptType(count.getScriptType());
itemCount.setCompletedQuantity(count.getCompletedQuantity());
itemCount.setAllQuantity(count.getAllQuantity());
//璁$畻閫夋嫨姣斾緥
@@ -3064,10 +3085,11 @@
BigDecimal chosenPercentage = (new BigDecimal(chosenQuantity)).divide(new BigDecimal(completedQuantity), 2, RoundingMode.HALF_UP);
itemCount.setChosenPercentage(chosenPercentage.toString());
}
- itemCounts.add(itemCount);
+ itemCountMap.put(count.getOptionText(), itemCount);
}
}
});
+ itemCounts = new ArrayList<>(itemCountMap.values());
count.setDetails(itemCounts);
result.put(count.getScriptid().toString(),count);
}
diff --git a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
index 82214bc..fb3ad76 100644
--- a/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -102,6 +102,7 @@
<resultMap type="com.smartor.domain.ServiceSubtaskScriptCount" id="ServiceSubtaskScriptCountResult">
<result property="scriptid" column="scriptid"/>
+ <result property="templateid" column="templateid"/>
<result property="scriptContent" column="script_content"/>
<result property="completedQuantity" column="completed_quantity"/>
<result property="allQuantity" column="all_quantity"/>
@@ -109,6 +110,7 @@
<result property="optionText" column="option_text"/>
<result property="chosenQuantity" column="chosen_quantity"/>
<result property="chosenPercentage" column="chosen_percentage"/>
+ <result property="options" column="options"/>
</resultMap>
<sql id="selectServiceSubtaskVo">
@@ -1355,9 +1357,16 @@
resultMap="ServiceSubtaskScriptCountResult">
SELECT
a.id as scriptid,
+ a.templateid as templateid,
a.script_content,
b.completed_quantity,
b.all_quantity,
+ <if test="type == 1">
+ '' as options,
+ </if>
+ <if test="type == 2">
+ c.options,
+ </if>
ROUND(b.completed_quantity/b.all_quantity,2) as completed_percentage
FROM
<if test="type == 1">
@@ -1416,6 +1425,14 @@
</if>
group by ssd.scriptid) b
ON a.id = b.scriptid
+ <!-- 缁熻闂嵎 -->
+ <if test="type == 2">
+ LEFT JOIN (
+ SELECT target.scriptid,GROUP_CONCAT(optioncontent) as options
+ FROM svy_task_template_targetoption target
+ group by target.scriptid
+ ) c ON a.scriptid = c.scriptid
+ </if>
</select>
<select id="getSfStatisticsScriptItemDetails" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
--
Gitblit v1.9.3