update 首页汇总数据更换查询表

This commit is contained in:
Lemon
2023-07-20 16:03:55 +08:00
parent a3aaef384e
commit d99faaad46
6 changed files with 70 additions and 21 deletions

View File

@@ -137,6 +137,7 @@ public interface PileBasicInfoMapper {
*/
public IndexGeneralSituationVO getGeneralSituation(@Param("IndexQueryDTO")IndexQueryDTO dto);
public IndexGeneralSituationVO getGeneralSituationInfo(@Param("IndexQueryDTO")IndexQueryDTO dto);
/**
* 通过会员id查询个人桩列表

View File

@@ -23,6 +23,7 @@ import com.jsowell.pile.dto.IndexQueryDTO;
import com.jsowell.pile.dto.QueryPileDTO;
import com.jsowell.pile.dto.ReplaceMerchantStationDTO;
import com.jsowell.pile.mapper.PileBasicInfoMapper;
import com.jsowell.pile.mapper.PileMerchantInfoMapper;
import com.jsowell.pile.service.IPileBasicInfoService;
import com.jsowell.pile.service.IPileConnectorInfoService;
import com.jsowell.pile.service.IPileMerchantInfoService;
@@ -47,9 +48,7 @@ import org.springframework.util.StopWatch;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -83,6 +82,9 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
@Autowired
private SimCardService simCardService;
@Autowired
private PileMerchantInfoMapper pileMerchantInfoMapper;
@Autowired
private RedisCache redisCache;
@@ -600,18 +602,40 @@ public class PileBasicInfoServiceImpl implements IPileBasicInfoService {
stationIdList.addAll(list);
}
}
if (CollectionUtils.isEmpty(stationDeptIds) && CollectionUtils.isEmpty(merchantDeptIds)) {
// 都为空说明为平台管理员
List<String> list = pileMerchantInfoService.queryByMerchantDeptIds(null);
// 对list去空
List<String> stationList = list.stream()
.filter(Objects::nonNull)
.collect(Collectors.toList());
stationIdList.addAll(stationList);
}
log.info("后管首页基本信息查询 authorizedMap:{}, dto:{}", JSONObject.toJSONString(authorizedMap), JSONObject.toJSONString(dto));
dto.setStationIdList(stationIdList);
IndexGeneralSituationVO generalSituation = pileBasicInfoMapper.getGeneralSituation(dto);
// IndexGeneralSituationVO generalSituation = pileBasicInfoMapper.getGeneralSituation(dto);
IndexGeneralSituationVO generalInfo = pileBasicInfoMapper.getGeneralSituationInfo(dto);
List<PileInfoVO> pileInfoVOS = queryPileDetailList(stationIdList);
// 对集合根据pileSn进行去重
ArrayList<PileInfoVO> pileInfoList = pileInfoVOS.stream()
.collect(Collectors.collectingAndThen(Collectors.toCollection(()
-> new TreeSet<>(Comparator.comparing(PileInfoVO::getPileSn))), ArrayList::new));
// 桩总数
generalInfo.setTotalPileQuantity(String.valueOf(pileInfoList.size()));
// 总充电订单数 3.0 --> 3
generalInfo.setTotalChargingQuantity(generalInfo.getTotalChargingQuantity().replaceAll("[.](.*)",""));
// 会员总余额
// demo账号
if (SecurityUtils.getUsername().equals("demo")) {
generalSituation.setTotalChargingAmount(new BigDecimal(generalSituation.getTotalChargingAmount()).multiply(new BigDecimal("20")).toString());
generalSituation.setTotalPileQuantity(new BigDecimal(generalSituation.getTotalPileQuantity()).multiply(new BigDecimal("20")).toString());
generalSituation.setTotalChargingDegree(new BigDecimal(generalSituation.getTotalChargingDegree()).multiply(new BigDecimal("20")).toString());
generalSituation.setTotalChargingQuantity(new BigDecimal(generalSituation.getTotalChargingQuantity()).multiply(new BigDecimal("20")).toString());
generalSituation.setTotalMemberAmount(new BigDecimal(generalSituation.getTotalMemberAmount()).multiply(new BigDecimal("20")).toString());
generalInfo.setTotalChargingAmount(new BigDecimal(generalInfo.getTotalChargingAmount()).multiply(new BigDecimal("20")).toString());
generalInfo.setTotalPileQuantity(new BigDecimal(generalInfo.getTotalPileQuantity()).multiply(new BigDecimal("20")).toString());
generalInfo.setTotalChargingDegree(new BigDecimal(generalInfo.getTotalChargingDegree()).multiply(new BigDecimal("20")).toString());
generalInfo.setTotalChargingQuantity(new BigDecimal(generalInfo.getTotalChargingQuantity()).multiply(new BigDecimal("20")).toString());
// generalInfo.setTotalMemberAmount(new BigDecimal(generalInfo.getTotalMemberAmount()).multiply(new BigDecimal("20")).toString());
}
return generalSituation;
return generalInfo;
}
/**