新增快电对账单,仅核对电量、总订单金额、总服务费、总电费

This commit is contained in:
panshuling321 2021-12-29 11:44:16 +08:00
parent c5fab8d7f4
commit 38402762ea
3 changed files with 94 additions and 10 deletions

View File

@ -22,7 +22,6 @@ public interface InternetBillService {
/**
* 获取对账列表
* @param uploadId 上传文件ID
* @return 对账数据
*/
List<XhpcTradebillInternetCheckRecordDomain> getInternetCheckList(Map<String, Object> params);

View File

@ -1,9 +1,12 @@
package com.xhpc.tradebill.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.text.csv.CsvReader;
import cn.hutool.core.text.csv.CsvUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.poi.ExcelUtil;
@ -337,39 +340,64 @@ public class InternetBillServiceImpl implements InternetBillService {
return checkRecordDomainList;
}
/**
* 获取快电对账数据
* @param dataFile 对账单文件,格式为xlsx
* @return 对账数据
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile) throws Exception {
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile) throws Exception {
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<KDTradebillVo> kdTradebillVoList = new ArrayList<>();
List<Map<String, Object>> dataList = new ArrayList<>();
List<String> serialNumberList = new ArrayList<>();
switch (suffix.toUpperCase()){
case "XLS":
case "XLSX":
ExcelUtil<KDTradebillVo> util = new ExcelUtil<KDTradebillVo>(KDTradebillVo.class);
kdTradebillVoList = util.importExcel(new FileInputStream(dataFile));
break;
case "CSV":
CsvReader reader = CsvUtil.getReader();
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
kdTradebillVoList = reader.read(fileReader.readString(), KDTradebillVo.class);
kdTradebillVoList = util.importExcel(new FileInputStream(dataFile), 1);
break;
default: break;
}
for(KDTradebillVo vo: kdTradebillVoList){
if (vo.getOrderNo().equals("交易订单号") || StrUtil.hasBlank(vo.getOrderNo())) {
continue;
}
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
domain.setSource("快电");
domain.setInternetName("快电");
serialNumberList.add(domain.getInternetSerialNumber());
domain.setInternetSerialNumber(vo.getOrderNo());
domain.setPlatformInternetSerialNumber(vo.getOrderNo());
Date startTime = StrUtil.hasBlank(vo.getStartTime()) ? null: DateUtil.parse(vo.getStartTime());
domain.setInternetStartTime(startTime);
Date endTime = StrUtil.hasBlank(vo.getEndTime()) ? null: DateUtil.parse(vo.getEndTime());
domain.setInternetEndTime(endTime);
domain.setInternetChargeStation(vo.getStationName());
BigDecimal chargingDegree = vo.getChargingDegree() == null ? BigDecimal.ZERO: BigDecimal.valueOf(vo.getChargingDegree());
domain.setInternetChargingDegree(chargingDegree);
BigDecimal powerAmount= vo.getTotalPowerAmount() == null? BigDecimal.ZERO: BigDecimal.valueOf(vo.getTotalPowerAmount());
domain.setInternetPowerAmount(powerAmount);
BigDecimal serverAmount = vo.getServerAmount() == null ? BigDecimal.ZERO : BigDecimal.valueOf(vo.getServerAmount());
domain.setInternetServerAmount(serverAmount);
domain.setInternetDiscountAmount(BigDecimal.ZERO);
String orderAmount = vo.getOrderAmount() == null? "0": vo.getOrderAmount().toString();
domain.setInternetOrderAmount(new BigDecimal(orderAmount));
domain.setInternetPayAmount(domain.getInternetOrderAmount());
serialNumberList.add(domain.getInternetSerialNumber());
checkRecordDomainList.add(domain);
}
getHistoryOrderList(checkRecordDomainList, serialNumberList);

View File

@ -1,9 +1,66 @@
package com.xhpc.tradebill.vo;
import com.xhpc.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class KDTradebillVo {
@Excel(name = "交易订单号")
private String orderNo;
@Excel(name = "业务类型")
private String businessType;
@Excel(name = "交易类型")
private String TradeType;
@Excel(name = "运营公司名称-ID")
private String operatorName;
@Excel(name = "充电站名称")
private String stationName;
@Excel(name = "开始充电时间")
private String startTime;
@Excel(name = "结束充电时间")
private String endTime;
@Excel(name = "对账时间")
private Date billDate;
@Excel(name = "原价总额(元)")
private Double orderAmount;
@Excel(name = "总电量(度)")
private Double chargingDegree;
@Excel(name = "总电费(元)")
private Double totalPowerAmount;
@Excel(name = "原价服务费(元)")
private Double serverAmount;
@Excel(name = "折扣服务费(元)")
private Double serverDiscountAmount;
@Excel(name = "占桩费(元)")
private Double pileUsedAmount;
@Excel(name = "平台服务费(元)")
private Double platformServerAmount;
@Excel(name = "应结服务费(元)")
private Double serverChargeAmount;
@Excel(name = "应结金额(元)")
private Double orderChargeAmount;
@Excel(name = "让利金额(元)")
private Double discountAmount;
}