Merge branch 'tradebill'

This commit is contained in:
ZZ 2021-12-28 11:31:13 +08:00
commit 7bcfd208f4
8 changed files with 229 additions and 84 deletions

View File

@ -2,6 +2,9 @@ package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcHistoryOrderDomain; import com.xhpc.tradebill.domain.XhpcHistoryOrderDomain;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper @Mapper
public interface XhpcHistoryOrderMapper { public interface XhpcHistoryOrderMapper {
@ -11,4 +14,6 @@ public interface XhpcHistoryOrderMapper {
XhpcHistoryOrderDomain findOneByInternetSerialNumber(String internetSerialNumber); XhpcHistoryOrderDomain findOneByInternetSerialNumber(String internetSerialNumber);
List<XhpcHistoryOrderDomain> findListByInternetSerialNumbers(@Param("orderNumbers") List<String> internetSerialNumbers);
} }

View File

@ -2,10 +2,16 @@ package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcRechargeOrderDomain; import com.xhpc.tradebill.domain.XhpcRechargeOrderDomain;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface XhpcRechargeOrderMapper { public interface XhpcRechargeOrderMapper {
XhpcRechargeOrderDomain findOneByOrderNumber(String orderNumber); XhpcRechargeOrderDomain findOneByOrderNumber(String orderNumber);
List<Map<String, Object>> findListByOrderNumbers(@Param("orderNumbers") List<String> orderNumbers);
} }

View File

@ -2,10 +2,16 @@ package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcRefundOrderDomain; import com.xhpc.tradebill.domain.XhpcRefundOrderDomain;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface XhpcRefundOrderMapper { public interface XhpcRefundOrderMapper {
XhpcRefundOrderDomain findByOrderNumber(String orderNumber); XhpcRefundOrderDomain findByOrderNumber(String orderNumber);
List<Map<String, Object>> findListByOrderNumbers(@Param("orderNumbers") List<String> orderNumbers);
} }

View File

@ -165,6 +165,7 @@ public class InternetBillServiceImpl implements InternetBillService {
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1); String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
List<HDTradebillVo> hdTradebillVoList = new ArrayList<>(); List<HDTradebillVo> hdTradebillVoList = new ArrayList<>();
List<String> serialNumberList = new ArrayList<>();
switch (suffix.toUpperCase()){ switch (suffix.toUpperCase()){
case "XLS": case "XLS":
case "XLSX": case "XLSX":
@ -202,10 +203,13 @@ public class InternetBillServiceImpl implements InternetBillService {
BigDecimal payAmount = vo.getOrderTotalAmount()!=null ? BigDecimal.valueOf(vo.getOrderTotalAmount()): BigDecimal.ZERO; BigDecimal payAmount = vo.getOrderTotalAmount()!=null ? BigDecimal.valueOf(vo.getOrderTotalAmount()): BigDecimal.ZERO;
domain.setInternetPayAmount(payAmount); domain.setInternetPayAmount(payAmount);
getHistoryOrderInfo(domain); serialNumberList.add(domain.getInternetSerialNumber());
// getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain); checkRecordDomainList.add(domain);
} }
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus)); getHistoryOrderList(checkRecordDomainList, serialNumberList);
return checkRecordDomainList; return checkRecordDomainList;
} }
@ -222,6 +226,7 @@ public class InternetBillServiceImpl implements InternetBillService {
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>(); List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<XJTradeBillVo> xjTradeBillVoList = new ArrayList<>(); List<XJTradeBillVo> xjTradeBillVoList = new ArrayList<>();
List<String> serialNumberList = new ArrayList<>();
switch (suffix.toUpperCase()){ switch (suffix.toUpperCase()){
case "XLS": case "XLS":
case "XLSX": case "XLSX":
@ -264,11 +269,12 @@ public class InternetBillServiceImpl implements InternetBillService {
BigDecimal payAmount = vo.getOrderTotalAmount()!=null ? BigDecimal.valueOf(vo.getOrderTotalAmount()): BigDecimal.ZERO; BigDecimal payAmount = vo.getOrderTotalAmount()!=null ? BigDecimal.valueOf(vo.getOrderTotalAmount()): BigDecimal.ZERO;
domain.setInternetPayAmount(payAmount); domain.setInternetPayAmount(payAmount);
getHistoryOrderInfo(domain); serialNumberList.add(domain.getInternetSerialNumber());
// getHistoryOrderInfo(domain);
//
checkRecordDomainList.add(domain); checkRecordDomainList.add(domain);
} }
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus)); getHistoryOrderList(checkRecordDomainList, serialNumberList);
return checkRecordDomainList; return checkRecordDomainList;
} }
@ -284,6 +290,7 @@ public class InternetBillServiceImpl implements InternetBillService {
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>(); List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<XDTTradebillVo> xdtTradebillVoList = new ArrayList<>(); List<XDTTradebillVo> xdtTradebillVoList = new ArrayList<>();
List<String> serialNumberList = new ArrayList<>();
switch (suffix.toUpperCase()){ switch (suffix.toUpperCase()){
case "XLS": case "XLS":
case "XLSX": case "XLSX":
@ -321,10 +328,12 @@ public class InternetBillServiceImpl implements InternetBillService {
BigDecimal payAmount = vo.getPayAmount()!=null ? BigDecimal.valueOf(vo.getPayAmount()): BigDecimal.ZERO; BigDecimal payAmount = vo.getPayAmount()!=null ? BigDecimal.valueOf(vo.getPayAmount()): BigDecimal.ZERO;
domain.setInternetPayAmount(payAmount); domain.setInternetPayAmount(payAmount);
getHistoryOrderInfo(domain);
serialNumberList.add(domain.getInternetSerialNumber());
// getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain); checkRecordDomainList.add(domain);
} }
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus)); getHistoryOrderList(checkRecordDomainList, serialNumberList);
return checkRecordDomainList; return checkRecordDomainList;
} }
@ -340,6 +349,7 @@ public class InternetBillServiceImpl implements InternetBillService {
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>(); List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<KDTradebillVo> kdTradebillVoList = new ArrayList<>(); List<KDTradebillVo> kdTradebillVoList = new ArrayList<>();
List<String> serialNumberList = new ArrayList<>();
switch (suffix.toUpperCase()){ switch (suffix.toUpperCase()){
case "XLS": case "XLS":
case "XLSX": case "XLSX":
@ -358,11 +368,11 @@ public class InternetBillServiceImpl implements InternetBillService {
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain(); XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
domain.setSource("快电"); domain.setSource("快电");
domain.setInternetName("快电"); domain.setInternetName("快电");
serialNumberList.add(domain.getInternetSerialNumber());
getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain); checkRecordDomainList.add(domain);
} }
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus)); getHistoryOrderList(checkRecordDomainList, serialNumberList);
return checkRecordDomainList; return checkRecordDomainList;
} }
@ -450,6 +460,41 @@ public class InternetBillServiceImpl implements InternetBillService {
} }
private List<XhpcTradebillInternetCheckRecordDomain> getHistoryOrderList(List<XhpcTradebillInternetCheckRecordDomain> domainList, List<String> serialNumberList){
List<XhpcHistoryOrderDomain> orderDomainList = historyOrderMapper.findListByInternetSerialNumbers(serialNumberList);
Map<String, XhpcHistoryOrderDomain> orderDomainMap = new HashMap<>();
for(XhpcHistoryOrderDomain orderDomain: orderDomainList){
orderDomainMap.put(orderDomain.getInternetSerialNumber(), orderDomain);
}
for(XhpcTradebillInternetCheckRecordDomain domain: domainList){
XhpcHistoryOrderDomain orderDomain = orderDomainMap.get(domain.getInternetSerialNumber());
if(orderDomain != null){
domain.setHistoryOrderNo(orderDomain.getHistoryOrderId());
domain.setPlatformInternetSerialNumber(orderDomain.getInternetSerialNumber());
domain.setPlatformSerialNumber(orderDomain.getSerialNumber());
domain.setPlatformChargeStation(orderDomain.getChargingStationName());
domain.setPlatformStartSoc(orderDomain.getStartSoc());
domain.setPlatformEndSoc(orderDomain.getEndSoc());
BigDecimal chargingDegree = orderDomain.getChargingDegree() != null?
BigDecimal.valueOf(orderDomain.getChargingDegree()): BigDecimal.ZERO;
domain.setPlatformChargingDegree(chargingDegree);
domain.setPlatformChargingTime(orderDomain.getChargingTime());
domain.setPlatformStartTime(orderDomain.getStartTime());
domain.setPlatformEndTime(orderDomain.getEndTime());
domain.setPlatformOrderAmount(orderDomain.getTotalPrice());
domain.setPlatformPowerAmount(orderDomain.getPowerPriceTotal());
domain.setPlatformServerAmount(orderDomain.getServicePriceTotal());
domain.setPlatformDiscountAmount(orderDomain.getPromotionDiscount());
domain.setPlatformPayAmount(orderDomain.getActPrice());
}
checkoutOrderResult(domain);
}
domainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus));
return domainList;
}
private void checkoutOrderResult(XhpcTradebillInternetCheckRecordDomain domain){ private void checkoutOrderResult(XhpcTradebillInternetCheckRecordDomain domain){
int checkoutStatus = 0; int checkoutStatus = 0;
// 流量方的订单金额大于本平台的历史订单的订单金额就可以判断成功 // 流量方的订单金额大于本平台的历史订单的订单金额就可以判断成功

View File

@ -67,11 +67,13 @@ public class PaymentBillServiceImpl implements PaymentBillService {
@Override @Override
public XhpcTradebillPaymentCheckRecordDomain getInfoByPk(int pk) { public XhpcTradebillPaymentCheckRecordDomain getInfoByPk(int pk) {
return paymentCheckRecordMapper.selectByPrimaryKey(pk); return paymentCheckRecordMapper.selectByPrimaryKey(pk);
} }
@Override @Override
public boolean updateInfoByDomain(XhpcTradebillPaymentCheckRecordDomain domain) { public boolean updateInfoByDomain(XhpcTradebillPaymentCheckRecordDomain domain) {
domain.setUpdateBy(SecurityUtils.getUserId()); domain.setUpdateBy(SecurityUtils.getUserId());
return paymentCheckRecordMapper.updateStatusByPk(domain); return paymentCheckRecordMapper.updateStatusByPk(domain);
} }
@ -79,6 +81,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
@Override @Override
public Integer insertPaymentCheckList(int uploadId, List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList) { public Integer insertPaymentCheckList(int uploadId, List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList) {
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
for (XhpcTradebillPaymentCheckRecordDomain domain : paymentCheckList) { for (XhpcTradebillPaymentCheckRecordDomain domain : paymentCheckList) {
domain.setUploadId(uploadId); domain.setUploadId(uploadId);
@ -90,6 +93,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
@Override @Override
public Map<String, Object> getStatusTotal(Map<String, Object> params) { public Map<String, Object> getStatusTotal(Map<String, Object> params) {
List<Map<String, Object>> resultList = paymentCheckRecordMapper.selectTotalGroupbyStatus(params); List<Map<String, Object>> resultList = paymentCheckRecordMapper.selectTotalGroupbyStatus(params);
int successCount = 0; int successCount = 0;
int failCount = 0; int failCount = 0;
@ -98,12 +102,16 @@ public class PaymentBillServiceImpl implements PaymentBillService {
for (Map<String, Object> res : resultList) { for (Map<String, Object> res : resultList) {
switch (res.get("status").toString()) { switch (res.get("status").toString()) {
case "0": case "0":
uncheckCount = Integer.parseInt(res.get("total").toString()); break; uncheckCount = Integer.parseInt(res.get("total").toString());
break;
case "1": case "1":
failCount = Integer.parseInt(res.get("total").toString()); break; failCount = Integer.parseInt(res.get("total").toString());
break;
case "2": case "2":
successCount = Integer.parseInt(res.get("total").toString()); break; successCount = Integer.parseInt(res.get("total").toString());
default: break; break;
default:
break;
} }
} }
checkCount = successCount + failCount; checkCount = successCount + failCount;
@ -117,6 +125,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
@Override @Override
public List<XhpcTradebillPaymentCheckRecordDomain> getPaymentCheckList(Map<String, Object> params) { public List<XhpcTradebillPaymentCheckRecordDomain> getPaymentCheckList(Map<String, Object> params) {
return paymentCheckRecordMapper.selectListByParams(params); return paymentCheckRecordMapper.selectListByParams(params);
} }
@ -128,6 +137,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
* @return 对账完成的数据列表 * @return 对账完成的数据列表
*/ */
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl) throws Exception { public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl); File dataFile = DownloadUtil.downloadFile(fileUrl);
return getAliPayDataList(dataFile); return getAliPayDataList(dataFile);
} }
@ -152,6 +162,10 @@ public class PaymentBillServiceImpl implements PaymentBillService {
CsvReader csvReader = CsvUtil.getReader(); CsvReader csvReader = CsvUtil.getReader();
CsvData data = csvReader.read(dataFile, CharsetUtil.CHARSET_GBK); CsvData data = csvReader.read(dataFile, CharsetUtil.CHARSET_GBK);
List<CsvRow> rows = data.getRows(); List<CsvRow> rows = data.getRows();
List<String> serialNumberList = new ArrayList<>();
int orderType = 0;
for (CsvRow row : rows) { for (CsvRow row : rows) {
// 列数是22则是正文内容 // 列数是22则是正文内容
if (row.getRawList().size() != 22) { if (row.getRawList().size() != 22) {
@ -169,40 +183,35 @@ public class PaymentBillServiceImpl implements PaymentBillService {
domain.setPaymentPayTime(DateUtil.parse(row.get(1))); domain.setPaymentPayTime(DateUtil.parse(row.get(1)));
BigDecimal paymentAmount = BigDecimal.ZERO; BigDecimal paymentAmount = BigDecimal.ZERO;
String serialNumber = "";
if (row.get(5).equals("在线支付")) { if (row.get(5).equals("在线支付")) {
// 充值订单 // 充值订单
domain.setPaymentPayNumber(row.get(4).trim().replaceAll("`", "").replaceAll("'", "")); serialNumber = row.get(4).trim().replaceAll("`", "").replaceAll("'", "");
domain.setOrderType(1); orderType = 1;
domain.setPaymentPayNumber(serialNumber);
domain.setOrderType(orderType);
System.out.println(row); System.out.println(row);
paymentAmount = row.get(6) != null && !"".equals(row.get(6).trim()) ? new BigDecimal(row.get(6)) : BigDecimal.ZERO; paymentAmount = row.get(6) != null && !"".equals(row.get(6).trim()) ? new BigDecimal(row.get(6)) : BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount); domain.setPaymentAmount(paymentAmount);
XhpcRechargeOrderDomain rechargeOrderDomain = rechargeOrderMapper.findOneByOrderNumber(row.get(4));
if (rechargeOrderDomain != null) { serialNumberList.add(serialNumber);
domain.setPlatformOrderNumber(rechargeOrderDomain.getRechargeOrderNumber());
domain.setPlatformUserId(rechargeOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(rechargeOrderDomain.getRechargeOrderId().toString());
domain.setPlatformAmount(rechargeOrderDomain.getAmount());
domain.setPlatformPayTime(rechargeOrderDomain.getUpdateTime());
}
} else if (row.get(5).equals("转账")) { } else if (row.get(5).equals("转账")) {
// 退款订单 // 退款订单
domain.setPaymentPayNumber(row.get(16).trim().replaceAll("`", "").replaceAll("'", "").replaceAll("单笔转账--", "")); serialNumber = row.get(16).trim().replaceAll("`", "").replaceAll("'", "").replaceAll("单笔转账--", "");
domain.setOrderType(2); domain.setPaymentPayNumber(serialNumber);
orderType = 2;
domain.setOrderType(orderType);
paymentAmount = row.get(7) != null && !"".equals(row.get(7).trim()) ? new BigDecimal(row.get(7)) : BigDecimal.ZERO; paymentAmount = row.get(7) != null && !"".equals(row.get(7).trim()) ? new BigDecimal(row.get(7)) : BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount); domain.setPaymentAmount(paymentAmount);
XhpcRefundOrderDomain refundOrderDomain = refundOrderMapper.findByOrderNumber(row.get(4));
if (refundOrderDomain != null) {
domain.setPlatformOrderNumber(refundOrderDomain.getRefundOrderNumber());
domain.setPlatformUserId(refundOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(refundOrderDomain.getRefundOrderId().toString());
domain.setPlatformAmount(refundOrderDomain.getAmount());
domain.setPlatformPayTime(refundOrderDomain.getUpdateTime());
}
}
paymentCheckRecordDomainList.add(computeTradebillData(domain)); serialNumberList.add(serialNumber);
} }
paymentCheckRecordDomainList.add(domain);
}
getPlatOrderData(paymentCheckRecordDomainList, orderType, serialNumberList);
break; break;
case "ZIP": case "ZIP":
ZipFile zip = new ZipFile(dataFile); ZipFile zip = new ZipFile(dataFile);
@ -243,12 +252,12 @@ public class PaymentBillServiceImpl implements PaymentBillService {
* @return 对账完成的数据列表 * @return 对账完成的数据列表
*/ */
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl) throws Exception { public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl); File dataFile = DownloadUtil.downloadFile(fileUrl);
return getWechatDataList(dataFile); return getWechatDataList(dataFile);
} }
/** /**
* 微信订单对账 * 微信订单对账
* *
@ -265,6 +274,9 @@ public class PaymentBillServiceImpl implements PaymentBillService {
CsvReader csvReader = CsvUtil.getReader(); CsvReader csvReader = CsvUtil.getReader();
CsvData data = csvReader.read(dataFile); CsvData data = csvReader.read(dataFile);
List<CsvRow> rows = data.getRows(); List<CsvRow> rows = data.getRows();
List<String> serialNumberList = new ArrayList<>();
int orderType = 0;
for (CsvRow row : rows) { for (CsvRow row : rows) {
// 列数是6则是充值订单 // 列数是6则是充值订单
// 列数是13则是退款订单 // 列数是13则是退款订单
@ -275,34 +287,32 @@ public class PaymentBillServiceImpl implements PaymentBillService {
domain.setPaymentChannel(1); domain.setPaymentChannel(1);
domain.setCreateBy(userId); domain.setCreateBy(userId);
domain.setUpdateBy(userId); domain.setUpdateBy(userId);
String serialNumber = "";
if (row.getRawList().size() == 6) { if (row.getRawList().size() == 6) {
if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) { if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) {
continue; continue;
} }
domain.setOrderType(1); orderType = 1;
domain.setPaymentPayNumber(StringFormat(row.get(2))); serialNumber = StringFormat(row.get(2));
domain.setOrderType(orderType);
domain.setPaymentPayNumber(serialNumber);
BigDecimal paymentAmount = row.get(5) != null && !"".equals(row.get(5).trim()) ? new BigDecimal(StringFormat(row.get(5))) : BigDecimal.ZERO; BigDecimal paymentAmount = row.get(5) != null && !"".equals(row.get(5).trim()) ? new BigDecimal(StringFormat(row.get(5))) : BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount); domain.setPaymentAmount(paymentAmount);
domain.setPaymentPayTime(DateUtil.parse(row.get(0))); domain.setPaymentPayTime(DateUtil.parse(row.get(0)));
XhpcRechargeOrderDomain rechargeOrderDomain = rechargeOrderMapper.findOneByOrderNumber(StringFormat(row.get(2))); serialNumberList.add(serialNumber);
if(rechargeOrderDomain != null){
domain.setPlatformOrderNumber(rechargeOrderDomain.getRechargeOrderNumber());
domain.setPlatformUserId(rechargeOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(rechargeOrderDomain.getRechargeOrderId().toString());
domain.setPlatformAmount(rechargeOrderDomain.getAmount());
domain.setPlatformPayTime(rechargeOrderDomain.getUpdateTime());
}
} else if (row.getRawList().size() == 13) { } else if (row.getRawList().size() == 13) {
// 微信退款订单 // 微信退款订单
if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) { if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) {
continue; continue;
} }
domain.setOrderType(2); orderType = 2;
domain.setPaymentPayNumber(StringFormat(row.get(2))); serialNumber = StringFormat(row.get(2));
domain.setOrderType(orderType);
domain.setPaymentPayNumber(serialNumber);
BigDecimal paymentAmount = row.get(10) != null && !"".equals(row.get(10).trim()) ? BigDecimal paymentAmount = row.get(10) != null && !"".equals(row.get(10).trim()) ?
new BigDecimal(StringFormat(row.get(10))) new BigDecimal(StringFormat(row.get(10)))
@ -312,19 +322,13 @@ public class PaymentBillServiceImpl implements PaymentBillService {
domain.setPaymentUserId(StringFormat(row.get(4))); domain.setPaymentUserId(StringFormat(row.get(4)));
domain.setPaymentPayTime(DateUtil.parse(row.get(6))); domain.setPaymentPayTime(DateUtil.parse(row.get(6)));
XhpcRefundOrderDomain refundOrderDomain = refundOrderMapper.findByOrderNumber(StringFormat(row.get(2))); serialNumberList.add(serialNumber);
if (refundOrderDomain!=null){
domain.setPlatformOrderNumber(refundOrderDomain.getRefundOrderNumber());
domain.setPlatformUserId(refundOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(refundOrderDomain.getRefundOrderId().toString());
domain.setPlatformAmount(refundOrderDomain.getAmount());
domain.setPlatformPayTime(refundOrderDomain.getUpdateTime());
}
} }
paymentCheckRecordDomainList.add(computeTradebillData(domain)); paymentCheckRecordDomainList.add(computeTradebillData(domain));
} }
getPlatOrderData(paymentCheckRecordDomainList, orderType, serialNumberList);
} else { } else {
throw new Exception("暂不支持的文件格式"); throw new Exception("暂不支持的文件格式");
} }
@ -333,6 +337,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
} }
private String StringFormat(String dataStr) { private String StringFormat(String dataStr) {
return dataStr.replaceAll("'", "").replaceAll("`", ""); return dataStr.replaceAll("'", "").replaceAll("`", "");
} }
@ -411,6 +416,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
@Override @Override
public void export(HttpServletResponse response, Map<String, Object> params) throws Exception { public void export(HttpServletResponse response, Map<String, Object> params) throws Exception {
List<Map<String, Object>> list = paymentCheckRecordMapper.selectByParams(params); List<Map<String, Object>> list = paymentCheckRecordMapper.selectByParams(params);
ExcelWriter writer = ExcelUtil.getWriter(true); ExcelWriter writer = ExcelUtil.getWriter(true);
@ -440,4 +446,36 @@ public class PaymentBillServiceImpl implements PaymentBillService {
writer.close(); writer.close();
IoUtil.close(out); IoUtil.close(out);
} }
private List<XhpcTradebillPaymentCheckRecordDomain> getPlatOrderData(List<XhpcTradebillPaymentCheckRecordDomain> domainList, int orderType, List<String> serialNumberList){
List<Map<String, Object>> orderMapList = null;
if (orderType == 1) {
orderMapList = rechargeOrderMapper.findListByOrderNumbers(serialNumberList);
} else if (orderType == 2) {
orderMapList = refundOrderMapper.findListByOrderNumbers(serialNumberList);
}
Map<String, Map<String, Object>> orderList = new HashMap<>();
for (Map<String, Object> orderMap : orderMapList) {
orderList.put(orderMap.get("orderNumber").toString().trim(), orderMap);
}
for (XhpcTradebillPaymentCheckRecordDomain domain : domainList) {
Map<String, Object> orderMap = orderList.get(domain.getPaymentPayNumber());
if (orderMap != null) {
domain.setPlatformOrderNumber(orderMap.get("orderNumber").toString().trim());
domain.setPlatformUserId(orderMap.get("userId").toString());
domain.setPlatformPayNumber(orderMap.get("id").toString());
domain.setPlatformAmount(new BigDecimal(orderMap.get("amount").toString()));
domain.setPlatformPayTime(DateUtil.parse(orderMap.get("updateTime").toString(), "yyyy-MM-dd'T'HH:mm"));
}
computeTradebillData(domain);
}
return domainList;
}
} }

View File

@ -23,4 +23,19 @@
left join xhpc_charge_order c on o.charge_order_id=c.charge_order_id left join xhpc_charge_order c on o.charge_order_id=c.charge_order_id
where o.internet_serial_number=#{internetSerialNumber} where o.internet_serial_number=#{internetSerialNumber}
</select> </select>
<select id="findListByInternetSerialNumbers" resultType="com.xhpc.tradebill.domain.XhpcHistoryOrderDomain">
select
o.*,
s.name as 'charging_station_name',
c.charging_degree as 'charging_degree',
c.charging_time as 'charging_time'
from xhpc_history_order o
left join xhpc_charging_station s on o.charging_station_id=s.charging_station_id
left join xhpc_charge_order c on o.charge_order_id=c.charge_order_id
where o.internet_serial_number in
<foreach collection="orderNumbers" item="orderNumber" open="(" close=")" separator=",">
#{orderNumber}
</foreach>
</select>
</mapper> </mapper>

View File

@ -27,4 +27,20 @@
from xhpc_recharge_order from xhpc_recharge_order
where recharge_order_number=#{orderNumber} where recharge_order_number=#{orderNumber}
</select> </select>
<select id="findListByOrderNumbers" resultType="map">
select
recharge_order_id as 'id',
recharge_order_number as 'orderNumber',
user_id as 'userId',
amount as 'amount',
create_time as 'createTime',
update_time as 'updateTime'
from xhpc_recharge_order
where recharge_order_number in
<foreach collection="orderNumbers" item="orderNumber" separator="," open="(" close=")">
#{orderNumber}
</foreach>
</select>
</mapper> </mapper>

View File

@ -25,4 +25,18 @@
select * from xhpc_refund_order where refund_order_number=#{orderNumber} select * from xhpc_refund_order where refund_order_number=#{orderNumber}
</select> </select>
<select id="findListByOrderNumbers" resultType="map">
select
refund_order_id as 'id',
refund_order_number as 'orderNumber',
user_id as 'userId',
amount as 'amount',
create_time as 'createTime',
update_time as 'updateTime'
from xhpc_refund_order
where refund_order_number in
<foreach collection="orderNumbers" item="orderNumber" separator="," open="(" close=")">
#{orderNumber}
</foreach>
</select>
</mapper> </mapper>