| | |
| | | package com.ruoyi.order.controller; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | |
| | | import java.math.BigDecimal; |
| | |
| | | import com.ruoyi.common.core.dto.ChargingOrderGroup; |
| | | import com.ruoyi.common.core.dto.ChargingPercentProvinceDto; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.web.domain.BasePojo; |
| | | import com.ruoyi.common.log.annotation.Log; |
| | | import com.ruoyi.common.log.enums.BusinessType; |
| | | import com.ruoyi.common.log.enums.OperatorType; |
| | |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.integration.api.model.PageChargingOrderAndUploadRealTimeMonitoringDataDto; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringData; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.integration.api.feignClient.UploadRealTimeMonitoringDataClient; |
| | | import com.ruoyi.integration.api.model.ChargingOrderAndUploadRealTimeMonitoringDataDto; |
| | | import com.ruoyi.integration.api.model.UploadRealTimeMonitoringPageData; |
| | | import com.ruoyi.order.api.dto.ChargingStatisticeDTO; |
| | | import com.ruoyi.order.api.model.*; |
| | | import com.ruoyi.order.api.query.ChargingOrderQuery; |
| | |
| | | import com.ruoyi.order.util.mongodb.service.UploadRealTimeMonitoringDataService; |
| | | import com.ruoyi.order.vo.EndOfChargePageInfo; |
| | | import com.ruoyi.order.vo.StatisticsOfBatteryVO; |
| | | import com.ruoyi.order.vo.UpdateOrderPaymentAmountDto; |
| | | 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.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.vo.AliQueryOrder; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import com.ruoyi.system.api.feignClient.SysUserRoleClient; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | @ApiOperation(value = "列表", tags = {"管理后台-支付订单-订单信息"}) |
| | | public R<PageInfo<PayOrderDto>> payOrderList(@RequestBody PayOrderQueryDto payOrderQueryDto) { |
| | | return chargingOrderService.payOrderQuery(payOrderQueryDto); |
| | | |
| | | // List<TChargingOrder> list = chargingOrderService.list(); |
| | | // List<TParkingRecord> parkingRecord = parkingLotClient.getSiteIdAll().getData(); |
| | | // for (PayOrderDto record : data.getRecords()) { |
| | | // if (record.getType() == 1){ |
| | | // TChargingOrder chargingOrder = list.stream().filter(e -> e.getId().equals(Long.valueOf(record.getId()))).findFirst().orElse(null); |
| | | // if (chargingOrder!=null){ |
| | | // record.setSiteId(chargingOrder.getSiteId()); |
| | | // } |
| | | // } |
| | | // if (record.getType()==4){ |
| | | // TParkingRecord tParkingRecord = parkingRecord.stream().filter(e -> e.getId().equals(Long.valueOf(record.getId()))).findFirst().orElse(null); |
| | | // if (tParkingRecord!=null){ |
| | | // record.setSiteId(tParkingRecord.getSiteId()); |
| | | // } |
| | | // } |
| | | // if (roleType==1||(record.getType()!=1&&record.getType()!=4)){ |
| | | // res.add(record); |
| | | // continue; |
| | | // } |
| | | // if (roleType==2 && (record.getType()==1||record.getType()==4) && siteIds.contains(record.getSiteId())){ |
| | | // res.add(record); |
| | | // } |
| | | // |
| | | // } |
| | | // List<PayOrderDto> res1 = testing5(res.size(), pageCurr, pageSize, res); |
| | | // data.setTotal(res.size()); |
| | | // data.setRecords(res1); |
| | | // return R.ok(data); |
| | | } |
| | | |
| | | |
| | |
| | | payOrderInfoDto.setRefundAmount(byId.getRefundAmount()); |
| | | payOrderInfoDto.setRechargeAmount(byId.getRechargeAmount()); |
| | | payOrderInfoDto.setFinalAmount(byId.getRechargeAmount().subtract(byId.getRefundAmount())); |
| | | payOrderInfoDto.setPayMethod(byId.getPayMethod()); |
| | | payOrderInfoDto.setBalancePayAmount(byId.getBalancePayAmount()); |
| | | payOrderInfoDto.setThirdPayAmount(byId.getThirdPayAmount()); |
| | | payOrderInfoDto.setBalanceRefundAmount(byId.getBalanceRefundAmount()); |
| | | payOrderInfoDto.setThirdRefundAmount(byId.getThirdRefundAmount()); |
| | | return R.ok(payOrderInfoDto); |
| | | case 2: |
| | | TShoppingOrder byId1 = shoppingOrderService.getById(orderId); |
| | |
| | | payOrderChargingInfo.setChargingName(data1.getName()); |
| | | TChargingGun data2 = chargingGunClient.getChargingGunById(byId.getChargingGunId()).getData(); |
| | | payOrderChargingInfo.setGunName(data2.getName()); |
| | | if (byId.getAppUserCarId()!=null) { |
| | | List<TAppUserCar> data3 = appUserCarClient.getCarByIds(Collections.singletonList(byId.getAppUserCarId())).getData(); |
| | | payOrderChargingInfo.setCarNum(data3.get(0).getLicensePlate()); |
| | | }else{ |
| | | payOrderChargingInfo.setCarNum(byId.getPlateNum()); |
| | | } |
| | | payOrderChargingInfo.setCarNum(byId.getPlateNum()); |
| | | payOrderChargingInfo.setTChargingOrder(byId); |
| | | |
| | | Long count = chargingOrderAccountingStrategyService.lambdaQuery().eq(TChargingOrderAccountingStrategy::getChargingOrderId, orderId).count(); |
| | | payOrderChargingInfo.setPeriodCount(count); |
| | | if (byId.getAppUserCarId()!=null) { |
| | | if (byId.getAppUserCarId()!=null && 0 != byId.getAppUserCarId()) { |
| | | List<Long> carid = new ArrayList<>(); |
| | | carid.add(byId.getAppUserCarId()); |
| | | R<List<TAppUserCar>> carByIds = appUserCarClient.getCarByIds(carid); |
| | |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPileOrder"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @PostMapping(value = "/balanceIncomeDetail") |
| | | @ApiOperation(value = "充电桩订单余额收入明细", tags = {"管理后台-订单管理"}) |
| | | public AjaxResult<List<ChargingOrderBalanceIncomeDetailVO>> balanceIncomeDetail(@RequestBody ChargingOrderQuery dto) { |
| | | List<ChargingOrderBalanceIncomeDetailVO> res = chargingOrderService.balanceIncomeDetail(dto); |
| | | return AjaxResult.success(res); |
| | | } |
| | | |
| | | |
| | | @RequiresPermissions(value = {"/chargingPileOrder/monitoring_record"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/chargingOrderInfo") |
| | |
| | | } |
| | | tChargingOrderAccountingStrategy.setStartTime(format+" "+tChargingOrderAccountingStrategy.getStartTime()); |
| | | tChargingOrderAccountingStrategy.setEndTime(format+" "+tChargingOrderAccountingStrategy.getEndTime()); |
| | | if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setVipDiscount(multiply); |
| | | } |
| | | if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | tChargingOrderAccountingStrategy.setCouponDiscount(multiply); |
| | | // if (byId.getVipDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | // BigDecimal multiply = byId.getVipDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | // .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | // tChargingOrderAccountingStrategy.setVipDiscount(multiply); |
| | | // } |
| | | // if (byId.getCouponDiscountAmount()!=null && byId.getServiceCharge().compareTo(BigDecimal.ZERO) != 0){ |
| | | // BigDecimal multiply = byId.getCouponDiscountAmount().divide(byId.getServiceCharge(), 2) |
| | | // .multiply(tChargingOrderAccountingStrategy.getPeriodOriginalServicePrice()); |
| | | // tChargingOrderAccountingStrategy.setCouponDiscount(multiply); |
| | | // } |
| | | if(null == tChargingOrderAccountingStrategy.getCouponDiscount()){ |
| | | tChargingOrderAccountingStrategy.setCouponDiscount(BigDecimal.ZERO); |
| | | } |
| | | } |
| | | //从新排序 |
| | |
| | | @ResponseBody |
| | | @PostMapping(value = "/refund") |
| | | public R refund(@RequestParam(value = "code") String code){ |
| | | List<UploadRealTimeMonitoringData> dataByOrderCode = uploadRealTimeMonitoringDataService.getDataByOrderCode(code); |
| | | if(!dataByOrderCode.isEmpty()){ |
| | | return R.fail("订单有充电数据,无法全额退款"); |
| | | } |
| | | chargingOrderService.refund(code); |
| | | return R.ok(); |
| | | } |
| | |
| | | }) |
| | | public AjaxResult<PreChargeCheck> preChargeCheck(@PathVariable Integer id) { |
| | | String key = "AQJC_" + id; |
| | | Object cacheObject = redisService.getCacheObject(key); |
| | | PreChargeCheck cacheObject = redisService.getCacheObject(key); |
| | | if(null != cacheObject){ |
| | | if(LocalDateTime.now().minusMinutes(1).isAfter(cacheObject.getAddTime())){ |
| | | redisService.deleteObject(key); |
| | | cacheObject = null; |
| | | } |
| | | } |
| | | return AjaxResult.success(cacheObject); |
| | | } |
| | | |
| | |
| | | ChargingDetails chargingDetails = chargingOrderService.getChargingDetails(id); |
| | | return AjaxResult.success(chargingDetails); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Log(title = "【扫一扫】手动停止充电", businessType = BusinessType.STOP,operatorType = OperatorType.MOBILE) |
| | | @ResponseBody |
| | | @PutMapping(value = "/stopCharging/{id}") |
| | |
| | | @ApiOperation(value = "电站收入分析", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<List<SixChargingDto>> charge(Integer siteId) { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //如果没传siteId,获取当前登陆人所有的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (siteId==null){ |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | }else { |
| | | siteIds.add(siteId); |
| | | } |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | List<Integer> siteIds = resolvePlatformRevenueSiteIds(userId, sysUser, siteId); |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | //通过siteIds进行sql查询统计 |
| | | List<SixChargingDto> sixChargingDtos = generateLastSixMonths(); |
| | |
| | | @ApiOperation(value = "电站收入占比", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<List<SixCircleDto>> circle() { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | //获取当前登录的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | //进行统计groupBySiteId |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | List<Integer> siteIds = resolvePlatformRevenueSiteIds(userId, sysUser, null); |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | List<SixCircleDto> sixCircleDtos = chargingOrderService.circle(siteIds,sixBefore); |
| | | for (SixCircleDto sixCircleDto : sixCircleDtos) { |
| | | Site site = siteClient.getSiteByIds(Arrays.asList(sixCircleDto.getSiteId())).getData().get(0); |
| | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询平台收入分析底部数据分类,充电订单金额由数据库聚合,避免全量订单和计费明细加载超时。 |
| | | */ |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/total") |
| | |
| | | //count近6个月的数据 |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | //获取当前登录的siteIds |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | List<GetSiteListDTO> data9 = siteClient.getSiteListByUserId(userId).getData(); |
| | | for (GetSiteListDTO datum : data9) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | //进行统计groupBySiteId |
| | | if (siteIds.isEmpty()){ |
| | | siteIds.add(-1); |
| | | } |
| | | List<Integer> siteIds = resolvePlatformRevenueSiteIds(userId, sysUser, null); |
| | | Map<String,Object> map = chargingOrderService.countAll(siteIds); |
| | | if(1 == sysUser.getObjectId()){ |
| | | boolean platformVisible = 1 == sysUser.getObjectId(); |
| | | if(platformVisible){ |
| | | BigDecimal data = parkingLotClient.getRecordAmount().getData(); |
| | | if (map ==null){ |
| | | map = new HashMap<String,Object>(); |
| | |
| | | map.put("shopAmount",0); |
| | | map.put("vipAmount",0); |
| | | } |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().eq(TChargingOrder::getStatus, 5).eq(TChargingOrder::getDelFlag, 0) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2).in(TChargingOrder::getSiteId, siteIds).list(); |
| | | BigDecimal sharingAmount = BigDecimal.ZERO; |
| | | BigDecimal commissionAmount = BigDecimal.ZERO; |
| | | //计算list中electrovalence的总和 |
| | | BigDecimal totalElectrovalence = BigDecimal.ZERO; |
| | | //计算list中serviceCharge的总和 |
| | | BigDecimal totalServiceCharge = BigDecimal.ZERO; |
| | | List<TChargingOrderAccountingStrategy> accountingStrategyList = chargingOrderAccountingStrategyService.list(); |
| | | for (TChargingOrder order : list) { |
| | | List<TChargingOrderAccountingStrategy> collect = accountingStrategyList.stream().filter(s -> s.getChargingOrderId().equals(order.getId())).collect(Collectors.toList()); |
| | | BigDecimal periodElectricPrice = collect.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal periodServicePrice = collect.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | totalElectrovalence = totalElectrovalence.add(periodElectricPrice); |
| | | if(2 != order.getOrderSource()){ |
| | | totalServiceCharge = totalServiceCharge.add(periodServicePrice); |
| | | commissionAmount = commissionAmount.add((periodElectricPrice.add(periodServicePrice)).multiply(new BigDecimal("0.006"))); |
| | | }else{ |
| | | totalServiceCharge = totalServiceCharge.add(periodServicePrice.multiply(new BigDecimal("0.8"))); |
| | | sharingAmount = sharingAmount.add(periodServicePrice.multiply(new BigDecimal("0.2"))); |
| | | map.put("platformIncomeVisible", platformVisible); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | @RequiresPermissions(value = {"/platformRevenueAnalysis"}, logical = Logical.OR) |
| | | @ResponseBody |
| | | @GetMapping(value = "/six/pay-type-circle") |
| | | @ApiOperation(value = "收入类型占比", tags = {"后台-数据分析-平台收入分析"}) |
| | | public R<List<SixIncomeCircleDto>> payTypeCircle() { |
| | | Long userId = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userId).getData(); |
| | | List<Integer> siteIds = resolvePlatformRevenueSiteIds(userId, sysUser, null); |
| | | LocalDate sixBefore = PreviousSixMonths.get(); |
| | | return R.ok(chargingOrderService.payTypeCircle(sixBefore, siteIds)); |
| | | } |
| | | |
| | | /** |
| | | * 解析平台收入分析页面允许查看的站点范围。 |
| | | * 合作商使用授权站点,其他后台账号沿用用户站点列表;传入站点时需做授权校验。 |
| | | */ |
| | | private List<Integer> resolvePlatformRevenueSiteIds(Long userId, SysUser sysUser, Integer siteId) { |
| | | List<Integer> siteIds = new ArrayList<>(); |
| | | if (sysUser != null && Integer.valueOf(2).equals(sysUser.getRoleType())) { |
| | | Set<Integer> authSiteIds = partnerClient.authSite(sysUser.getObjectId(), SiteMenu.SITE_LIST.getValue()).getData(); |
| | | if (authSiteIds != null) { |
| | | siteIds.addAll(authSiteIds); |
| | | } |
| | | } else { |
| | | List<GetSiteListDTO> data = siteClient.getSiteListByUserId(userId).getData(); |
| | | if (data != null) { |
| | | for (GetSiteListDTO datum : data) { |
| | | siteIds.add(datum.getId()); |
| | | } |
| | | } |
| | | } |
| | | map.put("service_charge",totalServiceCharge.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | map.put("electrovalence",totalElectrovalence.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | map.put("commission_amount",commissionAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | map.put("sharing_amount",sharingAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN)); |
| | | return R.ok(map); |
| | | if (siteId != null) { |
| | | return siteIds.contains(siteId) ? Collections.singletonList(siteId) : Collections.singletonList(-1); |
| | | } |
| | | if (siteIds.isEmpty()) { |
| | | siteIds.add(-1); |
| | | } |
| | | return siteIds; |
| | | } |
| | | |
| | | |
| | |
| | | } else { |
| | | siteIds.add(statisticsQueryDto.getSiteId()); |
| | | } |
| | | LocalDateTime selectDate = statisticsQueryDto.getSelectDate(); |
| | | LocalDateTime min = selectDate.with(LocalTime.MIN); |
| | | LocalDateTime max = selectDate.with(LocalTime.MAX); |
| | | |
| | | List<TChargingOrder> list = chargingOrderService.lambdaQuery().in(!siteIds.isEmpty(), TChargingOrder::getSiteId, siteIds) |
| | | .between(TChargingOrder::getCreateTime, min, max).eq(TChargingOrder::getStatus,5).eq(TChargingOrder::getDelFlag, 0) |
| | | .eq(TChargingOrder::getRechargePaymentStatus, 2) |
| | | .eq(statisticsQueryDto.getSiteId() != null, TChargingOrder::getSiteId, statisticsQueryDto.getSiteId()).list(); |
| | | String format = statisticsQueryDto.getSelectDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | Map<String, Object> stringObjectMap = chargingOrderService.getChargingOrderCount(siteIds, format); |
| | | //当日的订单总数 |
| | | int size = list.size(); |
| | | int size = 0; |
| | | //计算list中paymentAmount的总和 |
| | | BigDecimal totalPaymentAmount = BigDecimal.ZERO; |
| | | //计算list中electrovalence的总和 |
| | |
| | | BigDecimal totalServiceCharge = BigDecimal.ZERO; |
| | | //计算list中charging_capacity的总和 |
| | | BigDecimal totalChargingCapacity = BigDecimal.ZERO; |
| | | List<TChargingOrderAccountingStrategy> accountingStrategyList = chargingOrderAccountingStrategyService.list(); |
| | | for (TChargingOrder order : list) { |
| | | List<TChargingOrderAccountingStrategy> collect = accountingStrategyList.stream().filter(s -> s.getChargingOrderId().equals(order.getId())).collect(Collectors.toList()); |
| | | BigDecimal periodElectricPrice = collect.stream().map(TChargingOrderAccountingStrategy::getPeriodElectricPrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal periodServicePrice = collect.stream().map(TChargingOrderAccountingStrategy::getPeriodServicePrice).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal chargingCapacity = collect.stream().map(TChargingOrderAccountingStrategy::getChargingCapacity).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | totalElectrovalence = totalElectrovalence.add(periodElectricPrice); |
| | | totalChargingCapacity = totalChargingCapacity.add(chargingCapacity); |
| | | if(2 != order.getOrderSource()){ |
| | | totalServiceCharge = totalServiceCharge.add(periodServicePrice); |
| | | totalPaymentAmount = totalPaymentAmount.add(periodElectricPrice).add(periodServicePrice); |
| | | }else{ |
| | | totalServiceCharge = totalServiceCharge.add(periodServicePrice.multiply(new BigDecimal("0.8"))); |
| | | totalPaymentAmount = totalPaymentAmount.add(periodElectricPrice).add(periodServicePrice.multiply(new BigDecimal("0.8"))); |
| | | } |
| | | if(null != stringObjectMap){ |
| | | size = Integer.parseInt(stringObjectMap.get("num").toString()); |
| | | totalElectrovalence = new BigDecimal(stringObjectMap.get("electrovalence").toString()); |
| | | totalServiceCharge = new BigDecimal(stringObjectMap.get("servicecharge").toString()); |
| | | totalChargingCapacity = new BigDecimal(stringObjectMap.get("electricity").toString()); |
| | | totalPaymentAmount = totalElectrovalence.add(totalServiceCharge); |
| | | } |
| | | |
| | | TCharingWorkVO tCharingWorkVO = new TCharingWorkVO(); |
| | |
| | | |
| | | return R.ok(new BigDecimal(sumDegreeBySiteIds)); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/addChargingOrder") |
| | | public R<Long> addChargingOrder(@RequestBody TChargingOrder chargingOrder){ |
| | | chargingOrderService.save(chargingOrder); |
| | | return R.ok(chargingOrder.getId()); |
| | | } |
| | | |
| | | |
| | | @GetMapping(value = "/getOrderIdByUserId") |
| | |
| | | return R.ok(String.valueOf(chargingOrder.getId())); |
| | | } |
| | | |
| | | // @GetMapping(value = "/getOrderByCode") |
| | | // @ApiOperation(value = "H5通过编号查询订单", tags = {"H5-首页-用户充电订单信息"}) |
| | | // public R<String> getOrderByCode(@RequestParam("code") String code) { |
| | | // Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | // TChargingOrder chargingOrder = chargingOrderService.getOne(Wrappers.lambdaQuery(TChargingOrder.class) |
| | | // .eq(TChargingOrder::getAppUserId, userId) |
| | | // .in(TChargingOrder::getStatus, Arrays.asList(1,2,3,4)) |
| | | // .orderByDesc(TChargingOrder::getCreateTime) |
| | | // .last("LIMIT 1")); |
| | | // if(Objects.isNull(chargingOrder)){ |
| | | // return R.ok(); |
| | | // } |
| | | // return R.ok(String.valueOf(chargingOrder.getId())); |
| | | // } |
| | | |
| | | /** |
| | | * 手动查询订单和退款数据,完善退款记录 |
| | | * @param orderId |
| | | * @param refund_out_trade_no |
| | | * @return |
| | | */ |
| | | @PostMapping("/orderQueryRefund") |
| | | public R<?> orderQueryRefund(@RequestParam("orderId") Long orderId, @RequestParam("refund_out_trade_no") String refund_out_trade_no){ |
| | | chargingOrderService.orderQueryRefund(orderId, refund_out_trade_no); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 手动查询订单和退款数据,批量完善退款记录 |
| | | * @return |
| | | */ |
| | | @PostMapping("/orderQueryRefundList") |
| | | public R<?> orderQueryRefundList(@RequestBody List<String> dto){ |
| | | for (String s : dto) { |
| | | String[] split = s.split(","); |
| | | chargingOrderService.orderQueryRefund(Long.valueOf(split[0]), split[1]); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动添加完善订单费用明细 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | @PostMapping("/addOrderExpenseBreakdown") |
| | | public R<?> addOrderExpenseBreakdown(@RequestParam("orderId") Long orderId){ |
| | | chargingOrderService.addOrderExpenseBreakdown(orderId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手动批量修改订单支付金额 |
| | | * @param dtos |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateOrderPaymentAmount") |
| | | public R<?> updateOrderPaymentAmount(@RequestBody List<UpdateOrderPaymentAmountDto> dtos){ |
| | | for (UpdateOrderPaymentAmountDto dto : dtos) { |
| | | chargingOrderService.update(new UpdateWrapper<TChargingOrder>().eq("id", dto.getOrderId()) |
| | | .set("payment_amount", dto.getPaymentAmount())); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | } |