|
@@ -0,0 +1,51 @@
|
|
|
+package org.king.modules.ad.service.impl;
|
|
|
+
|
|
|
+
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
+import org.king.modules.ad.entity.AdDevice;
|
|
|
+import org.king.modules.ad.entity.AdDeviceCount;
|
|
|
+import org.king.modules.ad.entity.ChargeCount;
|
|
|
+import org.king.modules.ad.mapper.AdChargingRecordMapper;
|
|
|
+import org.king.modules.ad.mapper.AdDeviceMapper;
|
|
|
+import org.king.modules.ad.service.StaticalService;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+@DS("multi-datasource1")
|
|
|
+public class StaticalServiceImpl implements StaticalService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AdDeviceMapper adDeviceMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private AdChargingRecordMapper adChargingRecordMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AdDeviceCount getDeviceCount(){
|
|
|
+ AdDeviceCount count = new AdDeviceCount();
|
|
|
+ List<AdDevice> countList = adDeviceMapper.getDeviceCount();
|
|
|
+ for(AdDevice adDevice:countList){
|
|
|
+ if(adDevice.getType().equals("100000")){
|
|
|
+ count.setZnCount(adDevice.getCount());
|
|
|
+ }else if(adDevice.getType().equals("300000")){
|
|
|
+ count.setFznCount(adDevice.getCount());
|
|
|
+ }else if(adDevice.getType().equals("200000")){
|
|
|
+ count.setBznCount(adDevice.getCount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ count.setTotal(count.getZnCount()+count.getBznCount()+count.getFznCount());
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<ChargeCount> getChargeData(){
|
|
|
+ List<ChargeCount> list = adChargingRecordMapper.getChargeByFive();
|
|
|
+ ChargeCount chargeCount = adChargingRecordMapper.getChargeData();
|
|
|
+ chargeCount.setStartTime("合计");
|
|
|
+ list.add(chargeCount);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+}
|