diff --git a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PersonPileController.java b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PersonPileController.java index 8405a4ee5..896df89c1 100644 --- a/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PersonPileController.java +++ b/jsowell-admin/src/main/java/com/jsowell/api/uniapp/PersonPileController.java @@ -73,6 +73,7 @@ public class PersonPileController extends BaseController { /** * 用户解绑个人桩 + * http://localhost:8080/uniapp/personalPile/userUnbindPile * @return */ @RequestMapping("/userUnbindPile") diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java index ec8a49e6a..dd609db3f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileBasicInfoMapper.java @@ -137,6 +137,7 @@ public interface PileBasicInfoMapper { */ public IndexGeneralSituationVO getGeneralSituation(@Param("IndexQueryDTO")IndexQueryDTO dto); + public IndexGeneralSituationVO getGeneralSituationInfo(@Param("IndexQueryDTO")IndexQueryDTO dto); /** * 通过会员id查询个人桩列表 diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index 0c583a28c..29a035a75 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -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 list = pileMerchantInfoService.queryByMerchantDeptIds(null); + // 对list去空 + List 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 pileInfoVOS = queryPileDetailList(stationIdList); + // 对集合根据pileSn进行去重 + ArrayList 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; } /** diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml index 0d0735ce3..8ed715afd 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileBasicInfoMapper.xml @@ -408,4 +408,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml index 0e3aec0ae..9329eaa7b 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/PileMerchantInfoMapper.xml @@ -273,10 +273,12 @@ LEFT JOIN pile_station_info t2 ON t2.merchant_id = t1.id and t2.del_flag = '0' WHERE t1.del_flag = '0' + AND t1.dept_id IN #{item,jdbcType=VARCHAR} +