| | |
| | | |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.ServiceSubtaskMapper; |
| | | import com.ruoyi.template.mapper.SvyLibTemplateScriptMapper; |
| | | import com.smartor.service.ISvyLibTemplateScriptService; |
| | | import com.ruoyi.template.service.ISvyLibTemplateTargetoptionService; |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import com.ruoyi.template.domain.SvyLibTemplateScript; |
| | | import com.ruoyi.template.domain.SvyLibTemplateTargetoption; |
| | | import static net.sf.jsqlparser.parser.feature.Feature.values; |
| | | import com.ruoyi.task.domain.ServiceSubtaskCountReq; |
| | | import com.ruoyi.task.domain.ServiceSubtaskScriptCount; |
| | | import com.ruoyi.task.mapper.ServiceSubtaskMapper; |
| | | |
| | | /** |
| | | * 模板问卷题目Service业务层处理 |
| | |
| | | return svyLibTemplateScriptMapper.deleteSvyLibTemplateScriptByTopicids(topicids); |
| | | } |
| | | |
| | | /** |
| | | * 删除模板问卷题目信息 |
| | | * |
| | | * @param topicid 模板问卷题目主键 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public int deleteSvyLibTemplateScriptByTopicid(Long topicid) |
| | | { |
| | | return svyLibTemplateScriptMapper.deleteSvyLibTemplateScriptByTopicid(topicid); |
| | | } |
| | | |
| | | public Map<Long, ServiceSubtaskScriptCount> countPatByScript(ServiceSubtaskCountReq serviceSubtaskCountReq) |
| | | { |
| | | Map<Long, ServiceSubtaskScriptCount> result = new HashMap<>(); |
| | |
| | | } |
| | | } |
| | | itemCounts.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.setSubtaskType(count.getSubtaskType()); |
| | | itemCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | itemCount.setAllQuantity(count.getAllQuantity()); |
| | | itemCount.setCompletedPercentage(count.getCompletedPercentage()); |
| | | itemCount.setTemplateid(count.getTemplateid()); |
| | | //计算选择比例 |
| | | int chosenQuantity = ObjectUtils.isNotEmpty(itemCount.getChosenQuantity())?itemCount.getChosenQuantity():0; |
| | | int completedQuantity = itemCount.getCompletedQuantity(); |
| | | if(ObjectUtils.isNotEmpty(completedQuantity) && completedQuantity != 0){ |
| | | BigDecimal chosenPercentage = (new BigDecimal(chosenQuantity)).divide(new BigDecimal(completedQuantity), 2, RoundingMode.HALF_UP); |
| | | itemCount.setChosenPercentage(chosenPercentage.toString()); |
| | | } |
| | | itemCountMap.put(itemCount.getOptionText(), itemCount); |
| | | //明细行已按“题目内容+任务类型”聚合,不能用 scriptid 匹配(同一道题在每个任务模板里的 scriptid 都不同) |
| | | boolean sameQuestion = ObjectUtils.isNotEmpty(count.getScriptContent()) |
| | | && ObjectUtils.isNotEmpty(itemCount.getScriptContent()) |
| | | && count.getScriptContent().equals(itemCount.getScriptContent()) |
| | | && Objects.equals(count.getSubtaskType(), itemCount.getSubtaskType()); |
| | | if(sameQuestion){ |
| | | //放入统计信息 |
| | | itemCount.setScriptContent(count.getScriptContent()); |
| | | itemCount.setScriptType(count.getScriptType()); |
| | | itemCount.setSubtaskType(count.getSubtaskType()); |
| | | itemCount.setCompletedQuantity(count.getCompletedQuantity()); |
| | | itemCount.setAllQuantity(count.getAllQuantity()); |
| | | itemCount.setCompletedPercentage(count.getCompletedPercentage()); |
| | | itemCount.setTemplateid(count.getTemplateid()); |
| | | //计算选择比例 |
| | | int chosenQuantity = ObjectUtils.isNotEmpty(itemCount.getChosenQuantity())?itemCount.getChosenQuantity():0; |
| | | int completedQuantity = itemCount.getCompletedQuantity(); |
| | | if(ObjectUtils.isNotEmpty(completedQuantity) && completedQuantity != 0){ |
| | | BigDecimal chosenPercentage = (new BigDecimal(chosenQuantity)).divide(new BigDecimal(completedQuantity), 2, RoundingMode.HALF_UP); |
| | | itemCount.setChosenPercentage(chosenPercentage.toString()); |
| | | } |
| | | itemCountMap.put(itemCount.getOptionText(), itemCount); |
| | | } |
| | | }); |
| | | List<ServiceSubtaskScriptCount> details = new ArrayList<>(itemCountMap.values()); |