陈昶聿
5 天以前 5ef44ce6297e223faecc3819911d2891a3c582c7
【市一】随访满意度明细调整
已修改5个文件
58 ■■■■■ 文件已修改
ruoyi-admin/src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskScriptCount.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml
@@ -74,7 +74,7 @@
    # 国际化资源文件路径
    basename: i18n/messages
  profiles:
    active: ls
    active: druid
  # 文件上传
  servlet:
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>
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;
    /**
     * 明细
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);
        }
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"