| | |
| | | import com.ruoyi.order.service.*; |
| | | import com.ruoyi.order.util.PreviousSixMonths; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.WatchChargingOrderVo; |
| | | import com.ruoyi.other.api.feignClient.RoleSiteClient; |
| | | import com.ruoyi.other.api.feignClient.UserSiteClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | | import com.ruoyi.system.api.model.SysUserRoleVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | PageInfo<TChargingOrder> orderPageInfo = chargingOrderService.page(pageInfo, queryWrapper.orderByDesc(TChargingOrder::getCreateTime)); |
| | | List<Site> siteList = siteClient.getSiteAll().getData(); |
| | | |
| | | List<WatchChargingOrderVo> list = new ArrayList<>(); |
| | | for (TChargingOrder record : orderPageInfo.getRecords()) { |
| | | record.setIdStr(record.getId().toString()); |
| | | WatchChargingOrderVo vo = new WatchChargingOrderVo(); |
| | | BeanUtils.copyProperties(record, vo); |
| | | vo.setIdStr(record.getId().toString()); |
| | | Site site = siteList.stream().filter(s->s.getId().equals(record.getSiteId())).findFirst().get(); |
| | | record.setSiteName(site.getName()); |
| | | vo.setSiteName(site.getName()); |
| | | TChargingPile chargingPile = chargingPileClient.getChargingPileById(record.getChargingPileId()).getData(); |
| | | record.setTerminalName(chargingPile.getName()); |
| | | vo.setTerminalName(chargingPile.getName()); |
| | | TChargingGun chargingGun = chargingGunClient.getChargingGunById(record.getChargingGunId()).getData(); |
| | | record.setTerminalCode(chargingGun.getName()); |
| | | vo.setTerminalCode(chargingGun.getName()); |
| | | |
| | | if(null != record.getStartTime() && null != record.getEndTime()){ |
| | | long time = record.getEndTime().toEpochSecond(ZoneOffset.UTC) - record.getStartTime().toEpochSecond(ZoneOffset.UTC); |
| | | record.setChargingTime(time + ""); |
| | | vo.setChargingTime(time + ""); |
| | | } |
| | | long count = chargingOrderAccountingStrategyService.count(new LambdaQueryWrapper<TChargingOrderAccountingStrategy>().eq(TChargingOrderAccountingStrategy::getChargingOrderId, record.getId())); |
| | | record.setTimeFrame(count); |
| | | vo.setTimeFrame(count); |
| | | |
| | | vo.setAuthInfo(roleType == 1 ? true : partnerClient.authMenu(objectId, record.getSiteId(), SiteMenu.CHARGING_PILE_ORDER_MONITORING_RECORD_INFO.getValue())); |
| | | vo.setAuthDelete(roleType == 1 ? true : partnerClient.authMenu(objectId, record.getSiteId(), SiteMenu.CHARGING_PILE_ORDER_MONITORING_RECORD_DEL.getValue())); |
| | | list.add(vo); |
| | | } |
| | | return R.ok(orderPageInfo); |
| | | PageInfo<WatchChargingOrderVo> pageInfos = new PageInfo<>(query.getPageCurr(), query.getPageSize()); |
| | | pageInfos.setRecords(list); |
| | | pageInfos.setCurrent(pageInfo.getCurrent()); |
| | | pageInfos.setPages(pageInfo.getPages()); |
| | | pageInfos.setSize(pageInfo.getSize()); |
| | | pageInfos.setStartIndex(pageInfo.getStartIndex()); |
| | | pageInfos.setTotal(pageInfo.getTotal()); |
| | | return R.ok(pageInfos); |
| | | } |
| | | |
| | | |