mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-16 07:48:34 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -1,13 +1,5 @@
|
|||||||
package com.jsowell.common.enums.weixin;
|
package com.jsowell.common.enums.weixin;
|
||||||
|
|
||||||
/**
|
|
||||||
* 微信支付交易状态
|
|
||||||
* WeiXinPayTradeStatus<BR>
|
|
||||||
* 创建人:小威 <BR>
|
|
||||||
* 时间:2015年12月1日-下午4:37:55 <BR>
|
|
||||||
*
|
|
||||||
* @version 1.0.0
|
|
||||||
*/
|
|
||||||
public enum WeiXinPayTradeStatus {
|
public enum WeiXinPayTradeStatus {
|
||||||
SUCCESS("SUCCESS", "交易成功"),
|
SUCCESS("SUCCESS", "交易成功"),
|
||||||
FAIL("FAIL", "交易失败");
|
FAIL("FAIL", "交易失败");
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算相差天数 (会显示负值)
|
* 计算相差天数 (会显示负值)
|
||||||
|
*
|
||||||
* @param endDate
|
* @param endDate
|
||||||
* @param nowDate
|
* @param nowDate
|
||||||
* @return
|
* @return
|
||||||
@@ -574,6 +575,14 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
return simpleDateFormat.format(date);
|
return simpleDateFormat.format(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String formatDateTime(LocalDateTime localDateTime) {
|
||||||
|
if (localDateTime == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
|
||||||
|
return formatDateTime(date);
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@@ -788,11 +797,12 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 秒 转 天时分秒
|
* 秒 转 天时分秒
|
||||||
|
* 时分秒HoursMinutesSeconds
|
||||||
*
|
*
|
||||||
* @param mss 秒数
|
* @param mss 秒数
|
||||||
* @return xx天xx小时xx分钟xx秒
|
* @return xx天xx小时xx分钟xx秒
|
||||||
*/
|
*/
|
||||||
public static String formatDateTime(long mss) {
|
public static String formatHoursMinutesSeconds(long mss) {
|
||||||
String DateTimes = null;
|
String DateTimes = null;
|
||||||
long days = mss / (60 * 60 * 24);
|
long days = mss / (60 * 60 * 24);
|
||||||
long hours = (mss % (60 * 60 * 24)) / (60 * 60);
|
long hours = (mss % (60 * 60 * 24)) / (60 * 60);
|
||||||
@@ -828,7 +838,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
|||||||
if (time.compareTo(beginTime) == 0 || time.compareTo(endTime) == 0) {
|
if (time.compareTo(beginTime) == 0 || time.compareTo(endTime) == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (beginTime.isBefore(time) && endTime.isAfter(time)){
|
if (beginTime.isBefore(time) && endTime.isAfter(time)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,37 +1,8 @@
|
|||||||
package com.jsowell.adapay.service;
|
package com.jsowell.adapay.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|
||||||
import com.huifu.adapay.model.Payment;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class AdapayService {
|
public class AdapayService {
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建交易对象
|
|
||||||
* createTransactionObject
|
|
||||||
*/
|
|
||||||
public void createTransactionObject() {
|
|
||||||
// 请求参数
|
|
||||||
Map<String, Object> paymentParams = Maps.newHashMap();
|
|
||||||
paymentParams.put("app_id", "app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa");
|
|
||||||
paymentParams.put("order_no", "2023050911410199622174123");
|
|
||||||
paymentParams.put("pay_channel", "wx_lite");
|
|
||||||
paymentParams.put("pay_amt", "0.01");
|
|
||||||
paymentParams.put("currency", "cny");
|
|
||||||
paymentParams.put("goods_title", "测试商品");
|
|
||||||
paymentParams.put("goods_desc", "用于支付流程测试的商品");
|
|
||||||
// paymentParams.put("div_members", [{"amount":"0.05", "fee_flag":"Y", "member_id":"member_id_test"}]);
|
|
||||||
// 调用创建方法,获取 Payment对象_
|
|
||||||
try {
|
|
||||||
Map<String, Object> response = Payment.create(paymentParams);
|
|
||||||
System.out.println("response:" + JSON.toJSONString(response));
|
|
||||||
} catch (BaseAdaPayException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,233 @@
|
|||||||
|
package com.jsowell.pile.domain;
|
||||||
|
|
||||||
|
import com.jsowell.common.annotation.Excel;
|
||||||
|
import com.jsowell.common.core.domain.BaseEntity;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算订单报对象 settle_order_report
|
||||||
|
*
|
||||||
|
* @author jsowell
|
||||||
|
* @date 2023-06-05
|
||||||
|
*/
|
||||||
|
public class SettleOrderReport extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运营商id
|
||||||
|
*/
|
||||||
|
@Excel(name = "运营商id")
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
@Excel(name = "站点id")
|
||||||
|
private String stationId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用电度数
|
||||||
|
*/
|
||||||
|
@Excel(name = "用电度数")
|
||||||
|
private BigDecimal useElectricity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电次数
|
||||||
|
*/
|
||||||
|
@Excel(name = "充电次数")
|
||||||
|
private String chargeNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充电时长
|
||||||
|
*/
|
||||||
|
@Excel(name = "充电时长")
|
||||||
|
private String chargeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电费金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "电费金额")
|
||||||
|
private BigDecimal electricityAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "服务费金额")
|
||||||
|
private BigDecimal serviceAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收入金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "收入金额")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "虚拟金额")
|
||||||
|
private BigDecimal virtualAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易日期
|
||||||
|
*/
|
||||||
|
@Excel(name = "交易日期")
|
||||||
|
private String tradeDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易金额
|
||||||
|
*/
|
||||||
|
@Excel(name = "交易金额")
|
||||||
|
private BigDecimal tradeAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易手续费
|
||||||
|
*/
|
||||||
|
@Excel(name = "交易手续费")
|
||||||
|
private BigDecimal tradeFee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标识(0-正常;1-删除)
|
||||||
|
*/
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMerchantId(String merchantId) {
|
||||||
|
this.merchantId = merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMerchantId() {
|
||||||
|
return merchantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStationId(String stationId) {
|
||||||
|
this.stationId = stationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStationId() {
|
||||||
|
return stationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseElectricity(BigDecimal useElectricity) {
|
||||||
|
this.useElectricity = useElectricity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getUseElectricity() {
|
||||||
|
return useElectricity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargeNum(String chargeNum) {
|
||||||
|
this.chargeNum = chargeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChargeNum() {
|
||||||
|
return chargeNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargeTime(String chargeTime) {
|
||||||
|
this.chargeTime = chargeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getChargeTime() {
|
||||||
|
return chargeTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setElectricityAmount(BigDecimal electricityAmount) {
|
||||||
|
this.electricityAmount = electricityAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getElectricityAmount() {
|
||||||
|
return electricityAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setServiceAmount(BigDecimal serviceAmount) {
|
||||||
|
this.serviceAmount = serviceAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getServiceAmount() {
|
||||||
|
return serviceAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalAmount(BigDecimal totalAmount) {
|
||||||
|
this.totalAmount = totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotalAmount() {
|
||||||
|
return totalAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVirtualAmount(BigDecimal virtualAmount) {
|
||||||
|
this.virtualAmount = virtualAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getVirtualAmount() {
|
||||||
|
return virtualAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTradeDate(String tradeDate) {
|
||||||
|
this.tradeDate = tradeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTradeDate() {
|
||||||
|
return tradeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTradeAmount(BigDecimal tradeAmount) {
|
||||||
|
this.tradeAmount = tradeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTradeAmount() {
|
||||||
|
return tradeAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTradeFee(BigDecimal tradeFee) {
|
||||||
|
this.tradeFee = tradeFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTradeFee() {
|
||||||
|
return tradeFee;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDelFlag(String delFlag) {
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDelFlag() {
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("merchantId", getMerchantId())
|
||||||
|
.append("stationId", getStationId())
|
||||||
|
.append("useElectricity", getUseElectricity())
|
||||||
|
.append("chargeNum", getChargeNum())
|
||||||
|
.append("chargeTime", getChargeTime())
|
||||||
|
.append("electricityAmount", getElectricityAmount())
|
||||||
|
.append("serviceAmount", getServiceAmount())
|
||||||
|
.append("totalAmount", getTotalAmount())
|
||||||
|
.append("virtualAmount", getVirtualAmount())
|
||||||
|
.append("tradeDate", getTradeDate())
|
||||||
|
.append("tradeAmount", getTradeAmount())
|
||||||
|
.append("tradeFee", getTradeFee())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.jsowell.pile.mapper;
|
||||||
|
|
||||||
|
import com.jsowell.pile.domain.SettleOrderReport;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算订单报Mapper接口
|
||||||
|
*
|
||||||
|
* @author jsowell
|
||||||
|
* @date 2023-06-05
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface SettleOrderReportMapper {
|
||||||
|
/**
|
||||||
|
* 查询结算订单报
|
||||||
|
*
|
||||||
|
* @param id 结算订单报主键
|
||||||
|
* @return 结算订单报
|
||||||
|
*/
|
||||||
|
public SettleOrderReport selectSettleOrderReportById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算订单报列表
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结算订单报集合
|
||||||
|
*/
|
||||||
|
public List<SettleOrderReport> selectSettleOrderReportList(SettleOrderReport settleOrderReport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算订单报
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSettleOrderReport(SettleOrderReport settleOrderReport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算订单报
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSettleOrderReport(SettleOrderReport settleOrderReport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算订单报
|
||||||
|
*
|
||||||
|
* @param id 结算订单报主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSettleOrderReportById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算订单报
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSettleOrderReportByIds(Long[] ids);
|
||||||
|
}
|
||||||
@@ -265,4 +265,9 @@ public interface IOrderBasicInfoService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
void refundForBalanceWithAdapay(WeChatRefundDTO dto);
|
void refundForBalanceWithAdapay(WeChatRefundDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成订单日报
|
||||||
|
*/
|
||||||
|
void generateDailyOrderReports(String stationId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.jsowell.pile.service;
|
||||||
|
|
||||||
|
import com.jsowell.pile.domain.SettleOrderReport;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算订单报Service接口
|
||||||
|
*
|
||||||
|
* @author jsowell
|
||||||
|
* @date 2023-06-05
|
||||||
|
*/
|
||||||
|
public interface ISettleOrderReportService {
|
||||||
|
/**
|
||||||
|
* 查询结算订单报
|
||||||
|
*
|
||||||
|
* @param id 结算订单报主键
|
||||||
|
* @return 结算订单报
|
||||||
|
*/
|
||||||
|
public SettleOrderReport selectSettleOrderReportById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算订单报列表
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结算订单报集合
|
||||||
|
*/
|
||||||
|
public List<SettleOrderReport> selectSettleOrderReportList(SettleOrderReport settleOrderReport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算订单报
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertSettleOrderReport(SettleOrderReport settleOrderReport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算订单报
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateSettleOrderReport(SettleOrderReport settleOrderReport);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算订单报
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的结算订单报主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSettleOrderReportByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算订单报信息
|
||||||
|
*
|
||||||
|
* @param id 结算订单报主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteSettleOrderReportById(Long id);
|
||||||
|
}
|
||||||
@@ -56,7 +56,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -137,6 +139,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMemberTransactionRecordService memberTransactionRecordService;
|
private IMemberTransactionRecordService memberTransactionRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISettleOrderReportService settleOrderReportService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 条件查询订单基本信息
|
* 条件查询订单基本信息
|
||||||
*
|
*
|
||||||
@@ -1835,4 +1840,68 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
|||||||
|
|
||||||
// 也许需要多笔支付订单才够退款
|
// 也许需要多笔支付订单才够退款
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void generateDailyOrderReports(String stationId) {
|
||||||
|
// 查询站点前一天完成的订单
|
||||||
|
QueryOrderDTO dto = new QueryOrderDTO();
|
||||||
|
dto.setStationId(stationId);
|
||||||
|
LocalDate yesterday = LocalDate.now().plusDays(-1);
|
||||||
|
dto.setStartTime(DateUtils.formatDateTime(LocalDateTime.of(yesterday, LocalTime.MIN)));
|
||||||
|
dto.setEndTime(DateUtils.formatDateTime(LocalDateTime.of(yesterday, LocalTime.MAX)));
|
||||||
|
List<OrderListVO> orderListVOS = orderBasicInfoMapper.selectOrderBasicInfoList(dto);
|
||||||
|
if (CollectionUtils.isEmpty(orderListVOS)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 统计出日报信息
|
||||||
|
BigDecimal useElectricity = BigDecimal.ZERO;
|
||||||
|
int chargeNum = 0;
|
||||||
|
long chargeTime = 0L;
|
||||||
|
BigDecimal totalElectricityAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalServiceAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalOrderAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalVirtualAmount = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalSettleAmount = BigDecimal.ZERO;
|
||||||
|
for (OrderListVO vo : orderListVOS) {
|
||||||
|
BigDecimal chargingDegree = new BigDecimal(vo.getChargingDegree());
|
||||||
|
if (chargingDegree.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
// 只统计用电量大于0的
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 充电度数
|
||||||
|
useElectricity = useElectricity.add(chargingDegree);
|
||||||
|
// 充电次数
|
||||||
|
chargeNum += chargeNum;
|
||||||
|
// 充电时间
|
||||||
|
long l = DateUtils.intervalTime(vo.getChargeStartTime(), vo.getChargeEndTime());
|
||||||
|
chargeTime += l;
|
||||||
|
// 电费金额
|
||||||
|
totalElectricityAmount = totalElectricityAmount.add(vo.getTotalElectricityAmount());
|
||||||
|
// 服务费金额
|
||||||
|
totalServiceAmount = totalServiceAmount.add(vo.getTotalServiceAmount());
|
||||||
|
// 订单金额
|
||||||
|
totalOrderAmount = totalOrderAmount.add(new BigDecimal(vo.getOrderAmount()));
|
||||||
|
// 虚拟金额
|
||||||
|
totalVirtualAmount = totalVirtualAmount.add(new BigDecimal(vo.getVirtualAmount()));
|
||||||
|
// 结算金额
|
||||||
|
totalSettleAmount = totalSettleAmount.add(new BigDecimal(vo.getSettleAmount()));
|
||||||
|
}
|
||||||
|
// 保存到数据库
|
||||||
|
SettleOrderReport settleOrderReport = new SettleOrderReport();
|
||||||
|
settleOrderReport.setMerchantId("");
|
||||||
|
settleOrderReport.setStationId(stationId);
|
||||||
|
settleOrderReport.setUseElectricity(useElectricity);
|
||||||
|
settleOrderReport.setChargeNum(chargeNum + "");
|
||||||
|
settleOrderReport.setChargeTime(chargeTime + "");
|
||||||
|
settleOrderReport.setElectricityAmount(totalElectricityAmount);
|
||||||
|
settleOrderReport.setServiceAmount(totalServiceAmount);
|
||||||
|
settleOrderReport.setTotalAmount(totalOrderAmount);
|
||||||
|
settleOrderReport.setVirtualAmount(totalVirtualAmount);
|
||||||
|
settleOrderReport.setTradeDate(yesterday.toString());
|
||||||
|
// 计算手续费 = 结算金额 * 0.55%
|
||||||
|
BigDecimal tradeFee = totalSettleAmount.multiply(new BigDecimal("0.0055"));
|
||||||
|
settleOrderReport.setTradeFee(tradeFee);
|
||||||
|
settleOrderReport.setTradeAmount(totalSettleAmount.subtract(tradeFee));
|
||||||
|
settleOrderReportService.insertSettleOrderReport(settleOrderReport);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.jsowell.pile.service.impl;
|
||||||
|
|
||||||
|
import com.jsowell.common.util.DateUtils;
|
||||||
|
import com.jsowell.pile.domain.SettleOrderReport;
|
||||||
|
import com.jsowell.pile.mapper.SettleOrderReportMapper;
|
||||||
|
import com.jsowell.pile.service.ISettleOrderReportService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算订单报Service业务层处理
|
||||||
|
*
|
||||||
|
* @author jsowell
|
||||||
|
* @date 2023-06-05
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SettleOrderReportServiceImpl implements ISettleOrderReportService {
|
||||||
|
@Autowired
|
||||||
|
private SettleOrderReportMapper settleOrderReportMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算订单报
|
||||||
|
*
|
||||||
|
* @param id 结算订单报主键
|
||||||
|
* @return 结算订单报
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public SettleOrderReport selectSettleOrderReportById(Long id) {
|
||||||
|
return settleOrderReportMapper.selectSettleOrderReportById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结算订单报列表
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结算订单报
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SettleOrderReport> selectSettleOrderReportList(SettleOrderReport settleOrderReport) {
|
||||||
|
return settleOrderReportMapper.selectSettleOrderReportList(settleOrderReport);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增结算订单报
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertSettleOrderReport(SettleOrderReport settleOrderReport) {
|
||||||
|
settleOrderReport.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return settleOrderReportMapper.insertSettleOrderReport(settleOrderReport);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改结算订单报
|
||||||
|
*
|
||||||
|
* @param settleOrderReport 结算订单报
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateSettleOrderReport(SettleOrderReport settleOrderReport) {
|
||||||
|
return settleOrderReportMapper.updateSettleOrderReport(settleOrderReport);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除结算订单报
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的结算订单报主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSettleOrderReportByIds(Long[] ids) {
|
||||||
|
return settleOrderReportMapper.deleteSettleOrderReportByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除结算订单报信息
|
||||||
|
*
|
||||||
|
* @param id 结算订单报主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteSettleOrderReportById(Long id) {
|
||||||
|
return settleOrderReportMapper.deleteSettleOrderReportById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.jsowell.common.enums.MemberWalletEnum;
|
import com.jsowell.common.enums.MemberWalletEnum;
|
||||||
|
import com.jsowell.common.enums.weixin.WeiXinPayTradeStatus;
|
||||||
import com.jsowell.common.enums.ykc.ActionTypeEnum;
|
import com.jsowell.common.enums.ykc.ActionTypeEnum;
|
||||||
import com.jsowell.common.enums.ykc.PayModeEnum;
|
import com.jsowell.common.enums.ykc.PayModeEnum;
|
||||||
import com.jsowell.common.enums.ykc.PaymentInstitutionsEnum;
|
import com.jsowell.common.enums.ykc.PaymentInstitutionsEnum;
|
||||||
@@ -144,6 +145,32 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
return amLong.toString();
|
return amLong.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String s = "{\n" +
|
||||||
|
" \"mchid\": \"1632405339\",\n" +
|
||||||
|
" \"appid\": \"wxbb3e0d474569481d\",\n" +
|
||||||
|
" \"out_trade_no\": \"823422832569454592\",\n" +
|
||||||
|
" \"transaction_id\": \"4200001841202305301676160680\",\n" +
|
||||||
|
" \"trade_type\": \"JSAPI\",\n" +
|
||||||
|
" \"trade_state\": \"SUCCESS\",\n" +
|
||||||
|
" \"trade_state_desc\": \"支付成功\",\n" +
|
||||||
|
" \"bank_type\": \"OTHERS\",\n" +
|
||||||
|
" \"attach\": \"{\\\"memberId\\\":\\\"82507801\\\",\\\"orderCode\\\":\\\"C27473779928\\\",\\\"type\\\":\\\"order\\\"}\",\n" +
|
||||||
|
" \"success_time\": \"2023-05-30T15:15:20+08:00\",\n" +
|
||||||
|
" \"payer\": {\n" +
|
||||||
|
" \"openid\": \"o4REX5FPLsLOxM2x9ig2MHuuHPqU\"\n" +
|
||||||
|
" },\n" +
|
||||||
|
" \"amount\": {\n" +
|
||||||
|
" \"total\": 5000,\n" +
|
||||||
|
" \"payer_total\": 5000,\n" +
|
||||||
|
" \"currency\": \"CNY\",\n" +
|
||||||
|
" \"payer_currency\": \"CNY\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}";
|
||||||
|
WechatPayNotifyResource wechatPayNotifyResource = JSON.parseObject(s, WechatPayNotifyResource.class);
|
||||||
|
System.out.println(wechatPayNotifyResource);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信支付回调
|
* 微信支付回调
|
||||||
* @param request
|
* @param request
|
||||||
@@ -186,7 +213,7 @@ public class WechatPayServiceImpl implements WechatPayService {
|
|||||||
//6:获取微信支付返回的信息
|
//6:获取微信支付返回的信息
|
||||||
WechatPayNotifyResource wechatPayNotifyResource = JSON.parseObject(decryptToString, WechatPayNotifyResource.class);
|
WechatPayNotifyResource wechatPayNotifyResource = JSON.parseObject(decryptToString, WechatPayNotifyResource.class);
|
||||||
//7: 支付状态的判断 如果是success就代表支付成功
|
//7: 支付状态的判断 如果是success就代表支付成功
|
||||||
if (StringUtils.equals(wechatPayNotifyResource.getTrade_state(), "SUCCESS")) {
|
if (StringUtils.equals(wechatPayNotifyResource.getTrade_state(), WeiXinPayTradeStatus.SUCCESS.getValue())) {
|
||||||
// 8:获取支付的交易单号,流水号,和附属参数
|
// 8:获取支付的交易单号,流水号,和附属参数
|
||||||
String out_trade_no = wechatPayNotifyResource.getOut_trade_no();
|
String out_trade_no = wechatPayNotifyResource.getOut_trade_no();
|
||||||
// 微信支付单号
|
// 微信支付单号
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import lombok.Builder;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 后管订单列表页面
|
* 后管订单列表页面
|
||||||
*
|
*
|
||||||
@@ -184,4 +186,14 @@ public class OrderListVO {
|
|||||||
* 支付机构
|
* 支付机构
|
||||||
*/
|
*/
|
||||||
private String paymentInstitutions;
|
private String paymentInstitutions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电费金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalElectricityAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务费金额
|
||||||
|
*/
|
||||||
|
private BigDecimal totalServiceAmount;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,7 +178,11 @@
|
|||||||
t1.charge_start_time as chargeStartTime,
|
t1.charge_start_time as chargeStartTime,
|
||||||
t1.charge_end_time as chargeEndTime,
|
t1.charge_end_time as chargeEndTime,
|
||||||
t1.create_time as createTime,
|
t1.create_time as createTime,
|
||||||
|
t1.virtual_amount as virtualAmount,
|
||||||
|
t1.settle_amount as settleAmount,
|
||||||
t4.total_used_electricity as chargingDegree,
|
t4.total_used_electricity as chargingDegree,
|
||||||
|
t4.total_electricity_amount as totalElectricityAmount,
|
||||||
|
t4.total_service_amount as totalServiceAmount,
|
||||||
t5.payment_institutions as paymentInstitutions
|
t5.payment_institutions as paymentInstitutions
|
||||||
from order_basic_info t1
|
from order_basic_info t1
|
||||||
left join member_basic_info t2 on t1.member_id = t2.member_id
|
left join member_basic_info t2 on t1.member_id = t2.member_id
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.jsowell.pile.mapper.SettleOrderReportMapper">
|
||||||
|
|
||||||
|
<resultMap type="SettleOrderReport" id="SettleOrderReportResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="merchantId" column="merchant_id" />
|
||||||
|
<result property="stationId" column="station_id" />
|
||||||
|
<result property="useElectricity" column="use_electricity" />
|
||||||
|
<result property="chargeNum" column="charge_num" />
|
||||||
|
<result property="chargeTime" column="charge_time" />
|
||||||
|
<result property="electricityAmount" column="electricity_amount" />
|
||||||
|
<result property="serviceAmount" column="service_amount" />
|
||||||
|
<result property="totalAmount" column="total_amount" />
|
||||||
|
<result property="virtualAmount" column="virtual_amount" />
|
||||||
|
<result property="tradeDate" column="trade_date" />
|
||||||
|
<result property="tradeAmount" column="trade_amount" />
|
||||||
|
<result property="tradeFee" column="trade_fee" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectSettleOrderReportVo">
|
||||||
|
select id, merchant_id, station_id, use_electricity, charge_num, charge_time, electricity_amount, service_amount, total_amount, virtual_amount, trade_date, trade_amount, trade_fee, create_time, del_flag from settle_order_report
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectSettleOrderReportList" parameterType="SettleOrderReport" resultMap="SettleOrderReportResult">
|
||||||
|
<include refid="selectSettleOrderReportVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="merchantId != null and merchantId != ''"> and merchant_id = #{merchantId}</if>
|
||||||
|
<if test="stationId != null and stationId != ''"> and station_id = #{stationId}</if>
|
||||||
|
<if test="useElectricity != null "> and use_electricity = #{useElectricity}</if>
|
||||||
|
<if test="chargeNum != null and chargeNum != ''"> and charge_num = #{chargeNum}</if>
|
||||||
|
<if test="chargeTime != null and chargeTime != ''"> and charge_time = #{chargeTime}</if>
|
||||||
|
<if test="electricityAmount != null "> and electricity_amount = #{electricityAmount}</if>
|
||||||
|
<if test="serviceAmount != null "> and service_amount = #{serviceAmount}</if>
|
||||||
|
<if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
|
||||||
|
<if test="virtualAmount != null "> and virtual_amount = #{virtualAmount}</if>
|
||||||
|
<if test="tradeDate != null and tradeDate != ''"> and trade_date = #{tradeDate}</if>
|
||||||
|
<if test="tradeAmount != null "> and trade_amount = #{tradeAmount}</if>
|
||||||
|
<if test="tradeFee != null "> and trade_fee = #{tradeFee}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSettleOrderReportById" parameterType="Long" resultMap="SettleOrderReportResult">
|
||||||
|
<include refid="selectSettleOrderReportVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSettleOrderReport" parameterType="SettleOrderReport">
|
||||||
|
insert into settle_order_report
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="merchantId != null">merchant_id,</if>
|
||||||
|
<if test="stationId != null">station_id,</if>
|
||||||
|
<if test="useElectricity != null">use_electricity,</if>
|
||||||
|
<if test="chargeNum != null">charge_num,</if>
|
||||||
|
<if test="chargeTime != null">charge_time,</if>
|
||||||
|
<if test="electricityAmount != null">electricity_amount,</if>
|
||||||
|
<if test="serviceAmount != null">service_amount,</if>
|
||||||
|
<if test="totalAmount != null">total_amount,</if>
|
||||||
|
<if test="virtualAmount != null">virtual_amount,</if>
|
||||||
|
<if test="tradeDate != null">trade_date,</if>
|
||||||
|
<if test="tradeAmount != null">trade_amount,</if>
|
||||||
|
<if test="tradeFee != null">trade_fee,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="delFlag != null">del_flag,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="merchantId != null">#{merchantId},</if>
|
||||||
|
<if test="stationId != null">#{stationId},</if>
|
||||||
|
<if test="useElectricity != null">#{useElectricity},</if>
|
||||||
|
<if test="chargeNum != null">#{chargeNum},</if>
|
||||||
|
<if test="chargeTime != null">#{chargeTime},</if>
|
||||||
|
<if test="electricityAmount != null">#{electricityAmount},</if>
|
||||||
|
<if test="serviceAmount != null">#{serviceAmount},</if>
|
||||||
|
<if test="totalAmount != null">#{totalAmount},</if>
|
||||||
|
<if test="virtualAmount != null">#{virtualAmount},</if>
|
||||||
|
<if test="tradeDate != null">#{tradeDate},</if>
|
||||||
|
<if test="tradeAmount != null">#{tradeAmount},</if>
|
||||||
|
<if test="tradeFee != null">#{tradeFee},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateSettleOrderReport" parameterType="SettleOrderReport">
|
||||||
|
update settle_order_report
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="merchantId != null">merchant_id = #{merchantId},</if>
|
||||||
|
<if test="stationId != null">station_id = #{stationId},</if>
|
||||||
|
<if test="useElectricity != null">use_electricity = #{useElectricity},</if>
|
||||||
|
<if test="chargeNum != null">charge_num = #{chargeNum},</if>
|
||||||
|
<if test="chargeTime != null">charge_time = #{chargeTime},</if>
|
||||||
|
<if test="electricityAmount != null">electricity_amount = #{electricityAmount},</if>
|
||||||
|
<if test="serviceAmount != null">service_amount = #{serviceAmount},</if>
|
||||||
|
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
|
||||||
|
<if test="virtualAmount != null">virtual_amount = #{virtualAmount},</if>
|
||||||
|
<if test="tradeDate != null">trade_date = #{tradeDate},</if>
|
||||||
|
<if test="tradeAmount != null">trade_amount = #{tradeAmount},</if>
|
||||||
|
<if test="tradeFee != null">trade_fee = #{tradeFee},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteSettleOrderReportById" parameterType="Long">
|
||||||
|
delete from settle_order_report where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteSettleOrderReportByIds" parameterType="String">
|
||||||
|
delete from settle_order_report where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user