liusheng
2024-10-08 195190571e567602d5e4e8ae3c7c490a515719ef
smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -147,7 +147,7 @@
    }
    @Override
    public Map<String, Object> getScriptInfoByCondition(Long taskid, Long patid) {
    public Map<String, Object> getScriptInfoByCondition(Long taskid, Long patid, Boolean isFinish) {
        Map<String, Object> map = new HashMap<>();
        ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
        serviceSubtaskVO.setPatid(patid);
@@ -169,19 +169,22 @@
            info = sfInfo(serviceTask, patid);
        } else if (serviceTask.getType().equals("2")) {
            //问卷
            info = wjInfo(serviceTask, patid);
            info = wjInfo(serviceTask, patid, isFinish);
        } else {
            //宣教
            info = xjInfo(Long.valueOf(serviceTask.getLibtemplateid()), taskid, patid);
            info = xjInfo(Long.valueOf(serviceTask.getLibtemplateid()), taskid, patid, isFinish);
        }
        //只要打开了页面,就算成功
        ServiceSubtask ServiceTaskSingle = new ServiceSubtask();
        ServiceTaskSingle.setTaskid(taskid);
        ServiceTaskSingle.setPatid(patid);
        ServiceTaskSingle.setResult("success");
        ServiceTaskSingle.setFinishtime(new Date());
        serviceSubtaskMapper.updateServiceSubtaskByCondition(ServiceTaskSingle);
        if (isFinish) {
            ServiceSubtask ss = new ServiceSubtask();
            ss.setTaskid(taskid);
            ss.setPatid(patid);
            ss.setSendstate(1L);
            ss.setResult("success");
            ss.setFinishtime(new Date());
            serviceSubtaskMapper.updateServiceSubtaskByCondition(ss);
        }
        SvyTaskTemplate svyTaskTemplate = svyTaskTemplateMapper.selectSvyTaskTemplateBySvyid(serviceTask.getTemplateid());
        if (StringUtils.isNotEmpty(serviceTask.getKcb())) map.put("kcb", serviceTask.getKcb());
        map.put("script", info);
@@ -262,14 +265,15 @@
     * @param patid
     * @return
     */
    private List wjInfo(ServiceTask serviceTask, Long patid) {
    private List wjInfo(ServiceTask serviceTask, Long patid, Boolean isFinish) {
        //用户点击了外链,就算他领取了
        ServiceSubtask serviceSubtask = new ServiceSubtask();
        serviceSubtask.setSendstate(1L);
        serviceSubtask.setPatid(patid);
        serviceSubtask.setTaskid(serviceTask.getTaskid());
        serviceSubtaskMapper.updateServiceSubtaskByPatId(serviceSubtask);
        if (isFinish == true) {
            ServiceSubtask serviceSubtask = new ServiceSubtask();
            serviceSubtask.setSendstate(1L);
            serviceSubtask.setPatid(patid);
            serviceSubtask.setTaskid(serviceTask.getTaskid());
            serviceSubtaskMapper.updateServiceSubtaskByPatId(serviceSubtask);
        }
        //通过模板ID获取问题信息
        SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript();
        svyLibTemplateScript.setSvyid(Long.valueOf(serviceTask.getLibtemplateid()));
@@ -325,13 +329,15 @@
        return svyLibTemplateScriptVOS;
    }
    private List xjInfo(Long templateId, Long taskid, Long patid) {
        ServiceSubtask serviceSubtask = new ServiceSubtask();
        serviceSubtask.setTaskid(taskid);
        serviceSubtask.setPatid(patid);
        serviceSubtask.setResult("完成");
        serviceSubtask.setFinishtime(new Date());
        serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
    private List xjInfo(Long templateId, Long taskid, Long patid, Boolean isFinish) {
        if (isFinish == true) {
            ServiceSubtask serviceSubtask = new ServiceSubtask();
            serviceSubtask.setTaskid(taskid);
            serviceSubtask.setPatid(patid);
            serviceSubtask.setResult("完成");
            serviceSubtask.setFinishtime(new Date());
            serviceSubtaskMapper.updateServiceSubtaskByCondition(serviceSubtask);
        }
        HeLibrary heLibrary = heLibraryMapper.selectHeLibraryById(Long.valueOf(templateId));
        List list = new ArrayList();
        list.add(heLibrary);