| | |
| | | package com.moral.api.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.moral.api.config.Interceptor.UserHelper; |
| | | import com.moral.api.entity.SecondCruiserSort; |
| | | import com.moral.api.entity.SysDictData; |
| | | import com.moral.api.exception.BusinessException; |
| | | import com.moral.api.mapper.*; |
| | |
| | | |
| | | @Autowired |
| | | private DustldMapper dustldMapper; |
| | | |
| | | @Autowired |
| | | private SecondCruiserSortMapper secondCruiserSortMapper; |
| | | |
| | | /** |
| | | * 保存日报信息 |
| | |
| | | return dustlds; |
| | | } |
| | | |
| | | /** |
| | | * 路段排序 |
| | | * @param mac |
| | | * @param startTime |
| | | * @param endTime |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<SecondCruiserSort> sort(String mac, String startTime, String endTime) { |
| | | SysDictData list = sysDictTypeService.listOne(SysDictTypeEnum.SYS_SECOND_CRUISER.getValue(),"dustld"); |
| | | List<SecondCruiserSort> secondCruiserSorts = secondCruiserSortMapper.getSort(mac, startTime, endTime); |
| | | |
| | | //校准尘负荷 |
| | | if (!ObjectUtils.isEmpty(secondCruiserSorts)){ |
| | | for (SecondCruiserSort secondCruiserSort : secondCruiserSorts) { |
| | | if(list.getDataValue().contains(",")){ |
| | | List<String> resultStr = Arrays.asList(list.getDataValue().split(",")); |
| | | if(resultStr.size() % 2 ==0){ |
| | | // secondCruiserSort.setAvg(numAvg(resultStr,BigDecimal.valueOf(secondCruiserSort.getAvg())).doubleValue()); |
| | | secondCruiserSort.setAvg((double) Math.round(numAvg(resultStr, BigDecimal.valueOf(secondCruiserSort.getAvg())).doubleValue())); |
| | | } |
| | | }else { |
| | | BigDecimal dataValue = Objects.nonNull(list.getDataValue())?BigDecimal.valueOf(Double.parseDouble(list.getDataValue())):BigDecimal.ZERO; |
| | | // secondCruiserSort.setAvg(BigDecimal.valueOf(secondCruiserSort.getAvg()).add(dataValue).doubleValue()); |
| | | secondCruiserSort.setAvg((double) Math.round(BigDecimal.valueOf(secondCruiserSort.getAvg()).add(dataValue).doubleValue())); |
| | | } |
| | | } |
| | | } |
| | | return secondCruiserSorts; |
| | | } |
| | | |
| | | |
| | | //获取图片地址 |
| | | private String getList(String path, List<MultipartFile> files1) { |