diff --git a/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/InternetBillService.java b/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/InternetBillService.java index b70073a9..c0ba9315 100644 --- a/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/InternetBillService.java +++ b/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/InternetBillService.java @@ -22,7 +22,6 @@ public interface InternetBillService { /** * 获取对账列表 - * @param uploadId 上传文件ID * @return 对账数据 */ List getInternetCheckList(Map params); diff --git a/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/impl/InternetBillServiceImpl.java b/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/impl/InternetBillServiceImpl.java index 683b3bac..76238d99 100644 --- a/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/impl/InternetBillServiceImpl.java +++ b/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/service/impl/InternetBillServiceImpl.java @@ -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 getKDInternetDataList(File dataFile) throws Exception { + public List getKDInternetDataList(File dataFile) throws Exception { String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1); List checkRecordDomainList = new ArrayList<>(); List kdTradebillVoList = new ArrayList<>(); + List> dataList = new ArrayList<>(); List serialNumberList = new ArrayList<>(); switch (suffix.toUpperCase()){ case "XLS": case "XLSX": ExcelUtil util = new ExcelUtil(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); diff --git a/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/vo/KDTradebillVo.java b/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/vo/KDTradebillVo.java index 6ebf5c26..3ad83025 100644 --- a/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/vo/KDTradebillVo.java +++ b/xhpc-modules/xhpc-tradebill/src/main/java/com/xhpc/tradebill/vo/KDTradebillVo.java @@ -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; + }