| | |
| | | package com.xinquan.order.controller.client; |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.order.api.domain.Order; |
| | | import com.xinquan.order.domain.TChargingOrder; |
| | | import com.xinquan.order.service.TChargingOrderService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 支付回调控制器 |
| | |
| | | @RestController |
| | | @RequestMapping("/client/order/notify") |
| | | public class NotifyController { |
| | | @Autowired |
| | | private TChargingOrderService chargingOrderService; |
| | | @ResponseBody |
| | | @PostMapping("/testOrder") |
| | | |
| | | public R refund() throws Exception { |
| | | TChargingOrder temp = chargingOrderService.lambdaQuery().eq(TChargingOrder::getCode, "CD4720250105235842946").one(); |
| | | temp.setPayTime(LocalDateTime.now().withDayOfMonth(5).withMonth(1).withHour(23).withSecond(54).withMinute(58)); |
| | | chargingOrderService.updateById(temp); |
| | | // TChargingOrder tChargingOrder = new TChargingOrder(); |
| | | // tChargingOrder.setCode("CD61020250103155826263"); |
| | | // tChargingOrder.setOrderType(1); |
| | | // tChargingOrder.setOrderSource(0); |
| | | // tChargingOrder.setSourceName("平台"); |
| | | // tChargingOrder.setCommissionAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setSharingAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setOrderClassification(1); |
| | | // tChargingOrder.setAppUserId(1873654120440303618L); |
| | | // tChargingOrder.setSiteId(19); |
| | | // tChargingOrder.setChargingPileId(27); |
| | | // tChargingOrder.setChargingGunId(65); |
| | | // tChargingOrder.setChargingCapacity(new BigDecimal(0)); |
| | | // tChargingOrder.setStatus(-1); |
| | | // tChargingOrder.setRechargeAmount(new BigDecimal(3)); |
| | | // tChargingOrder.setRechargePaymentType(1); |
| | | // tChargingOrder.setRechargePaymentStatus(2); |
| | | // tChargingOrder.setRechargeSerialNumber("4200002536202501034420431689"); |
| | | // tChargingOrder.setChargeAmount(new BigDecimal(3)); |
| | | // tChargingOrder.setResidualAmount(new BigDecimal(3)); |
| | | // tChargingOrder.setTitle("【充电桩充电】4号桩/01号枪"); |
| | | // tChargingOrder.setOrderAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setCouponDiscountAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setVipDiscountAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setPaymentAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setRefundAmount(new BigDecimal(0)); |
| | | // tChargingOrder.setPayTime(LocalDateTime.now().withMonth(1).withDayOfMonth(3).withHour(15).withMinute(58).withSecond(34)); |
| | | // chargingOrderService.save(tChargingOrder); |
| | | // List<Long> longs = new ArrayList<>(); |
| | | // longs.add(1875077819308580866L); |
| | | // longs.add(1875082793723764737L); |
| | | // longs.add(1875089952062709761L); |
| | | // longs.add(1875097990047866882L); |
| | | // longs.add(1875106862531747841L); |
| | | // longs.add(1875120972262678529L); |
| | | // longs.add(1875128500300161025L); |
| | | // longs.add(1875520877594562562L); |
| | | // longs.add(1875933615747698689L); |
| | | // longs.add(1875934962798759937L); |
| | | // longs.add(1889570549749432321L); |
| | | // List<TChargingOrder> list1 = chargingOrderService.lambdaQuery().in(TChargingOrder::getId, longs).list(); |
| | | // for (TChargingOrder tChargingOrder : list1) { |
| | | // |
| | | // } |
| | | // List<TChargingOrder> list1 = chargingOrderService.lambdaQuery() |
| | | // .eq(TChargingOrder::getRechargePaymentType,1) |
| | | // .between(TChargingOrder::getPayTime, LocalDateTime.now().withMonth(1).withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0), LocalDateTime.now().withMonth(1).withDayOfMonth(31).withHour(23).withMinute(59).withSecond(59)).list(); |
| | | // BigDecimal bigDecimal = new BigDecimal(0); |
| | | // BigDecimal recharge = new BigDecimal(0); |
| | | // BigDecimal commission = new BigDecimal(0); |
| | | // BigDecimal refund = new BigDecimal(0); |
| | | // int a = 0; |
| | | // for (TChargingOrder tChargingOrder : list1) { |
| | | // if (tChargingOrder.getPaymentAmount()!=null){ |
| | | // bigDecimal = bigDecimal.add(tChargingOrder.getPaymentAmount()); |
| | | // commission = commission.add(tChargingOrder.getPaymentAmount().multiply(new BigDecimal("0.006")).setScale(2, BigDecimal.ROUND_DOWN)); |
| | | // a++; |
| | | // refund = refund.add(tChargingOrder.getRefundAmount()); |
| | | // } |
| | | // else{ |
| | | // refund = refund.add(tChargingOrder.getRechargeAmount()); |
| | | // } |
| | | // recharge = recharge.add(tChargingOrder.getRechargeAmount()); |
| | | // } |
| | | // System.err.println(bigDecimal); |
| | | // System.err.println(recharge); |
| | | // System.err.println(commission); |
| | | // System.err.println(refund); |
| | | // System.err.println(a); |
| | | // chargingOrderService.updateBatchById(list1); |
| | | // TChargingOrder byId = chargingOrderService.getById(1889570549749432321L); |
| | | //// byId.setCreateTime(LocalDateTime.now().withMonth(1).withDayOfMonth(3).withHour(15).withMinute(58).withSecond(34)); |
| | | //// chargingOrderService.updateById(byId); |
| | | |
| | | return R.ok(); |
| | | |
| | | } |
| | | } |