| | |
| | | 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; |
| | |
| | | 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); |
| | |
| | | |
| | | |
| | | 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()); |
| | | //计算选择比例 |
| | |
| | | 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); |
| | | } |