陈昶聿
12 小时以前 0d10bc99eec75672b049339399e4f762fbd9746e
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -21,6 +21,7 @@
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@@ -163,8 +164,19 @@
        return serviceSubtaskAnswerMapper.deleteServiceSubtaskAnswerById(id);
    }
    /**
     * 保存问卷答案 (异步处理,快速返回)
     *
     * @param serviceSubTaskAnswerReq 答案请求
     * @param flag 标志位
     * @return 结果
     */
    @Override
    @Async("threadPoolTaskExecutor")
    public Integer saveQuestionAnswer(ServiceSubTaskAnswerReq serviceSubTaskAnswerReq, Long flag) {
        String threadName = Thread.currentThread().getName();
        log.info("[{}] 开始异步处理保存问卷答案", threadName);
        try {
        //参数解密
        Long tid = null;
        Long pid = null;
@@ -365,16 +377,6 @@
            log.error("将该key和value从redis中,serviceSubtask的值为--------:{}", serviceSubtask);
            if (score != null && !score.isEmpty()) serviceSubtask.setScore(score);
            serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
            //修改住院满意度状态(避免重复查询)
            if (serviceSubtask.getServiceType() != null && "6".equals(serviceSubtask.getServiceType())) {
                Long inhospid = serviceSubtask.getInhospid();
                if (inhospid != null) {
                    PatMedInhosp patMedInhosp = new PatMedInhosp();
                    patMedInhosp.setInhospMydFlag("1");
                    patMedInhosp.setInhospid(inhospid);
                    patMedInhospMapper.updatePatMedInhosp(patMedInhosp);
                }
            }
            //将当前发送状态改成 9 完成(缓存 preachform 查询)
            String currentPreachform = serviceSubtask.getCurrentPreachform();
@@ -401,9 +403,13 @@
            }
        }
        log.info("[{}] 完成异步处理保存问卷答案", Thread.currentThread().getName());
        return 1;
    } catch (Exception e) {
        log.error("[{}] 异步处理保存问卷答案发生异常 : {},请求的对象为:{}", Thread.currentThread().getName(), e.getMessage(), e,serviceSubTaskAnswerReq);
        throw new RuntimeException("保存问卷答案失败", e);
    }
}
    @Override
    public Integer saveQuestionDetail(ServiceSubTaskCacheReq serviceSubTaskCacheReq, Long flag) {
        Long tid = Long.valueOf(serviceSubTaskCacheReq.getParam1());
@@ -922,7 +928,6 @@
    }
    private Map<String, String> setWJInfo(SvyTaskTemplateScriptVO svyTaskTemplateScriptVO, Long taskid, Long patid, Long subid) {
        log.error("-----svyTaskTemplateScriptVO的值为:{}", svyTaskTemplateScriptVO);
        ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
        serviceSubtaskVO.setTaskid(taskid);
        serviceSubtaskVO.setPatid(patid);
@@ -971,7 +976,6 @@
    }
    private Map<String, String> setWJInfo(SvyTaskTemplateScriptVO svyTaskTemplateScriptVO, Long taskid, Long patid, Long subid, List<ServiceSubtask> selectServiceSubtaskList, ServiceTask serviceTask, Map<Long, Long> existingDetailIdMap, Map<Long, Long> existingTraceIdMap) {
        log.error("-----svyTaskTemplateScriptVO的值为:{}", svyTaskTemplateScriptVO);
        String score = "0";
        //下题跳转
        String nextScriptNo = null;
@@ -1057,7 +1061,6 @@
                //去除两端空白并处理特殊字符进行比较
                if (optionContent.trim().replaceAll("\\s+", "").equals(scriptResult.replaceAll("\\s+", ""))) {
                    stt = svyTaskTemplateTargetoption;
                    log.error("找到匹配的选项");
                    break; // 找到匹配项后跳出循环
                }
            }
@@ -1110,6 +1113,8 @@
            subtaskDetailTrace.setDutyDeptPersonName(svyTaskTemplateScriptVO.getDutyDeptPersonName());
            subtaskDetailTrace.setReportDeptPersonCode(svyTaskTemplateScriptVO.getReportDeptPersonCode());
            subtaskDetailTrace.setReportDeptPersonName(svyTaskTemplateScriptVO.getReportDeptPersonName());
            subtaskDetailTrace.setCirculationDeptPersonCode(svyTaskTemplateScriptVO.getCirculationDeptPersonCode());
            subtaskDetailTrace.setCirculationDeptPersonName(svyTaskTemplateScriptVO.getCirculationDeptPersonName());
            Long existTraceId = existingTraceIdMap.get(subtaskDetailTrace.getScriptid());
            if (existTraceId != null) {