| | |
| | | import com.doumee.core.haikang.model.param.respose.*; |
| | | import com.doumee.core.haikang.service.HKCarOpenService; |
| | | import com.doumee.core.haikang.service.HKService; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | |
| | | data.setYesterdayElectricity(getDefaultData());//昨日用电 |
| | | getMonthElectricityData(data.getMonthElectricity());//通过安防平获取本月用电量数据 |
| | | carbonElec = new BigDecimal(StringUtils.defaultString(data.getMonthElectricity().getTotal(), "0")); |
| | | |
| | | getLastMonthElectricityData(data.getElectricityQuantity());//通过安防平获取上月用电量数据 |
| | | getCurrentDateElectircityData(data.getTodayElectricity(),0);//通过安防平获取今日用电量数据 |
| | | getCurrentDateElectircityData(data.getYesterdayElectricity(),-1);//通过安防平获取昨日用电量数据 |
| | |
| | | } |
| | | if(data == null){ |
| | | data = new RegionEnergyListResponse(); |
| | | data.setSecondRegionDataList(new ArrayList<>()); |
| | | data.setRootValue("0"); |
| | | data.setSamePercent("0"); |
| | | data.setRingPercent("0"); |
| | |
| | | return data; |
| | | } |
| | | |
| | | /** |
| | | * 查询能耗用电信息 1=今日;2=本月;3=昨日 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<RegionDataRankingDataResponse> getRegionDataRanking(Integer type){ |
| | | RegionDataRankingDataRequest request = new RegionDataRankingDataRequest(); |
| | | request.setMeterType(1); |
| | | if(Constants.equalsInteger(type,Constants.ONE)){ |
| | | request.setDate(DateUtil.getFomartDate(new Date(),"yyyy-MM-dd")); |
| | | request.setPeriodType("day"); |
| | | }else if(Constants.equalsInteger(type,Constants.TWO)){ |
| | | request.setDate(DateUtil.getFomartDate(new Date(),"yyyy-MM")); |
| | | request.setPeriodType("month"); |
| | | }else{ |
| | | request.setDate(DateUtil.getBeforDay(new Date(),1)); |
| | | request.setPeriodType("day"); |
| | | } |
| | | BaseResponse<List<RegionDataRankingDataResponse>> response = HKService.regionDataRanking(request); |
| | | if(response != null && StringUtils.equals(response.getCode(), HKConstants.RESPONSE_SUCCEE) && response.getData()!=null ){ |
| | | return response.getData(); |
| | | }else{ |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |