对账增加时间段设置
This commit is contained in:
parent
aa391e89bc
commit
62bc906011
@ -6,12 +6,16 @@ import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain;
|
||||
import com.xhpc.tradebill.service.CommonService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -23,19 +27,24 @@ public class CommonController extends BaseController {
|
||||
@Resource
|
||||
CommonService commonService;
|
||||
|
||||
@Resource
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
@Log(title = "上传对账单(OSS方式)", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/oss/upload")
|
||||
public AjaxResult OssUpload(@RequestBody XhpcTradebillUploadRecordDomain domain) throws Exception{
|
||||
public AjaxResult OssUpload(HttpServletRequest request, @RequestBody XhpcTradebillUploadRecordDomain domain) throws Exception{
|
||||
LoginUser logUser = logUserUtils.getLogUser(request);
|
||||
domain.setTenantId(logUser.getTenantId());
|
||||
return AjaxResult.success(commonService.ossUpload(domain));
|
||||
}
|
||||
|
||||
@Log(title = "上传对账单(文件方式)", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/file/upload")
|
||||
public AjaxResult fileUpload(MultipartFile file, int type) throws Exception {
|
||||
public AjaxResult fileUpload(MultipartFile file, int type, String startTime, String endTime) throws Exception {
|
||||
if (file ==null || type < 1){
|
||||
return AjaxResult.error("文件或者对账类型为空");
|
||||
}
|
||||
return AjaxResult.success(commonService.fileUpload(file, type));
|
||||
return AjaxResult.success(commonService.fileUpload(file, type, startTime, endTime));
|
||||
}
|
||||
|
||||
@GetMapping("/file/getPage")
|
||||
|
||||
@ -44,5 +44,10 @@ public class XhpcTradebillUploadRecordDomain implements Serializable {
|
||||
private String tenantId;
|
||||
|
||||
|
||||
// === 时间区段内的订单,仅参数使用
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -16,4 +16,9 @@ public interface XhpcHistoryOrderMapper {
|
||||
XhpcHistoryOrderDomain findOneByInternetSerialNumber(String internetSerialNumber);
|
||||
|
||||
List<XhpcHistoryOrderDomain> findListByInternetSerialNumbers(@Param("orderNumbers") List<String> internetSerialNumbers);
|
||||
|
||||
|
||||
List<XhpcHistoryOrderDomain> findListByTimeBetween(@Param("startTime") String startTime,
|
||||
@Param("endTime")String endTime,
|
||||
@Param("tenantId")String tenantId);
|
||||
}
|
||||
@ -14,4 +14,10 @@ public interface XhpcRechargeOrderMapper {
|
||||
|
||||
|
||||
List<Map<String, Object>> findListByOrderNumbers(@Param("orderNumbers") List<String> orderNumbers);
|
||||
|
||||
|
||||
List<Map<String, Object>> findListByTimeBetween(@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("tenantId") String tenantId);
|
||||
|
||||
}
|
||||
@ -12,6 +12,12 @@ public interface XhpcRefundOrderMapper {
|
||||
|
||||
XhpcRefundOrderDomain findByOrderNumber(String orderNumber);
|
||||
|
||||
|
||||
List<Map<String, Object>> findListByOrderNumbers(@Param("orderNumbers") List<String> orderNumbers);
|
||||
|
||||
|
||||
List<Map<String, Object>> findListByTimeBetween(@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("tenantId") String tenantId);
|
||||
|
||||
}
|
||||
@ -11,7 +11,7 @@ public interface CommonService {
|
||||
|
||||
XhpcTradebillUploadRecordDomain ossUpload(XhpcTradebillUploadRecordDomain domain) throws Exception;
|
||||
|
||||
XhpcTradebillUploadRecordDomain fileUpload(MultipartFile file, int type) throws Exception;
|
||||
XhpcTradebillUploadRecordDomain fileUpload(MultipartFile file, int type, String startTime, String endTime) throws Exception;
|
||||
|
||||
List<XhpcTradebillUploadRecordDomain> getFilePage(Map<String, Object> params);
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(String fileUrl) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,7 +44,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(File dataFile) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(String fileUrl) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(File dataFile) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(String fileUrl) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
@ -81,7 +81,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(File dataFile) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(String fileUrl) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
@ -100,7 +100,7 @@ public interface InternetBillService {
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile) throws Exception;
|
||||
List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -37,7 +37,7 @@ public interface PaymentBillService {
|
||||
* @param fileUrl 数据文件存放地址
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl) throws Exception ;
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception ;
|
||||
|
||||
|
||||
/**
|
||||
@ -46,7 +46,7 @@ public interface PaymentBillService {
|
||||
* @param dataFile 数据文件
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(File dataFile) throws Exception ;
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception ;
|
||||
|
||||
|
||||
/**
|
||||
@ -55,7 +55,7 @@ public interface PaymentBillService {
|
||||
* @param fileUrl 数据文件存放地址
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl) throws Exception ;
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception ;
|
||||
|
||||
|
||||
/**
|
||||
@ -64,7 +64,7 @@ public interface PaymentBillService {
|
||||
* @param dataFile 数据文件
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(File dataFile) throws Exception ;
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception ;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -39,6 +39,7 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
@Override
|
||||
public XhpcTradebillUploadRecordDomain ossUpload(XhpcTradebillUploadRecordDomain domain) throws Exception {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
domain.setCreateBy(userId);
|
||||
domain.setUpdateBy(userId);
|
||||
@ -62,38 +63,38 @@ public class CommonServiceImpl implements CommonService {
|
||||
case 1:
|
||||
case 2:
|
||||
// 微信支付
|
||||
paymentCheckRecordDomainList = paymentBillService.getWechatDataList(domain.getUrl());
|
||||
paymentCheckRecordDomainList = paymentBillService.getWechatDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId());
|
||||
insertCount = paymentBillService.insertPaymentCheckList(resDomain.getId(), paymentCheckRecordDomainList);
|
||||
totalMap = computePaymentRecord(paymentCheckRecordDomainList);
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
// 支付宝支付
|
||||
paymentCheckRecordDomainList = paymentBillService.getAliPayDataList(domain.getUrl());
|
||||
paymentCheckRecordDomainList = paymentBillService.getAliPayDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId());
|
||||
insertCount = paymentBillService.insertPaymentCheckList(resDomain.getId(), paymentCheckRecordDomainList);
|
||||
totalMap = computePaymentRecord(paymentCheckRecordDomainList);
|
||||
break;
|
||||
case 5:
|
||||
// 恒大
|
||||
recordDomainList = internetBillService.getHdInternetDataList(domain.getUrl());
|
||||
recordDomainList = internetBillService.getHdInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId());
|
||||
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
|
||||
totalMap = computeInternetRecord(recordDomainList);
|
||||
break;
|
||||
case 6:
|
||||
// 小桔
|
||||
recordDomainList = internetBillService.getXjInternetDataList(domain.getUrl());
|
||||
recordDomainList = internetBillService.getXjInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId());
|
||||
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
|
||||
totalMap = computeInternetRecord(recordDomainList);
|
||||
break;
|
||||
case 7:
|
||||
// 新电途
|
||||
recordDomainList = internetBillService.getXDTInternetDataList(domain.getUrl());
|
||||
recordDomainList = internetBillService.getXDTInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId());
|
||||
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
|
||||
totalMap = computeInternetRecord(recordDomainList);
|
||||
break;
|
||||
case 8:
|
||||
// 快电
|
||||
recordDomainList = internetBillService.getKDInternetDataList(domain.getUrl());
|
||||
recordDomainList = internetBillService.getKDInternetDataList(domain.getUrl(), domain.getStartTime(), domain.getEndTime(), domain.getTenantId());
|
||||
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
|
||||
totalMap = computeInternetRecord(recordDomainList);
|
||||
break;
|
||||
@ -115,9 +116,9 @@ public class CommonServiceImpl implements CommonService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public XhpcTradebillUploadRecordDomain fileUpload(MultipartFile file, int type) throws Exception{
|
||||
public XhpcTradebillUploadRecordDomain fileUpload(MultipartFile file, int type, String startTime, String endTime) throws Exception {
|
||||
|
||||
XhpcTradebillUploadRecordDomain domain = new XhpcTradebillUploadRecordDomain();
|
||||
// 创建OSSClient实例
|
||||
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||
@ -133,6 +134,8 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
domain.setFileName(file.getOriginalFilename());
|
||||
domain.setUrl(ossProperties.getDomain() + ossPath);
|
||||
domain.setStartTime(startTime);
|
||||
domain.setEndTime(endTime);
|
||||
domain.setType(type);
|
||||
|
||||
return ossUpload(domain);
|
||||
@ -146,6 +149,7 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
private Map<String, Integer> computePaymentRecord(List<XhpcTradebillPaymentCheckRecordDomain> domainList) {
|
||||
|
||||
Integer successCount = 0;
|
||||
Integer failCount = 0;
|
||||
Integer checkCount = 0;
|
||||
@ -153,9 +157,11 @@ public class CommonServiceImpl implements CommonService {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
for (XhpcTradebillPaymentCheckRecordDomain domain : domainList) {
|
||||
if (domain.getStatus() == 2) {
|
||||
successCount++; checkCount++;
|
||||
successCount++;
|
||||
checkCount++;
|
||||
} else if (domain.getStatus() == 1 || domain.getStatus() == 0) {
|
||||
failCount++; checkCount++;
|
||||
failCount++;
|
||||
checkCount++;
|
||||
} else {
|
||||
uncheckCount++;
|
||||
}
|
||||
@ -169,6 +175,7 @@ public class CommonServiceImpl implements CommonService {
|
||||
|
||||
|
||||
private Map<String, Integer> computeInternetRecord(List<XhpcTradebillInternetCheckRecordDomain> domainList) {
|
||||
|
||||
Integer successCount = 0;
|
||||
Integer failCount = 0;
|
||||
Integer checkCount = 0;
|
||||
@ -176,9 +183,11 @@ public class CommonServiceImpl implements CommonService {
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain : domainList) {
|
||||
if (domain.getStatus() == 2) {
|
||||
successCount++; checkCount++;
|
||||
successCount++;
|
||||
checkCount++;
|
||||
} else if (domain.getStatus() == 1 || domain.getStatus() == 0) {
|
||||
failCount++; checkCount++;
|
||||
failCount++;
|
||||
checkCount++;
|
||||
} else {
|
||||
uncheckCount++;
|
||||
}
|
||||
@ -189,4 +198,5 @@ public class CommonServiceImpl implements CommonService {
|
||||
result.put("uncheckCount", uncheckCount);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,6 @@ 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;
|
||||
@ -48,14 +47,15 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
EtOrderMappingMapper orderMappingMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public XhpcTradebillInternetCheckRecordDomain getInfoByPk(int pk) {
|
||||
|
||||
return internetCheckRecordMapper.selectByPrimaryKey(pk);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInfoByDomain(XhpcTradebillInternetCheckRecordDomain domain) {
|
||||
|
||||
domain.setUpdateBy(SecurityUtils.getUserId());
|
||||
return internetCheckRecordMapper.updateStatusByPk(domain);
|
||||
}
|
||||
@ -63,6 +63,7 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
@Override
|
||||
public Integer insertInternetCheckList(int uploadId, List<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList) {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain : internetCheckRecordDomainList) {
|
||||
domain.setUploadId(uploadId);
|
||||
@ -75,11 +76,13 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getInternetCheckList(Map<String, Object> params) {
|
||||
|
||||
return internetCheckRecordMapper.selectListByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getStatusTotal(Map<String, Object> params) {
|
||||
|
||||
List<Map<String, Object>> resultList = internetCheckRecordMapper.selectTotalGroupbyStatus(params);
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
@ -88,12 +91,16 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
for (Map<String, Object> res : resultList) {
|
||||
switch (res.get("status").toString()) {
|
||||
case "0":
|
||||
uncheckCount = Integer.parseInt(res.get("total").toString()); break;
|
||||
uncheckCount = Integer.parseInt(res.get("total").toString());
|
||||
break;
|
||||
case "1":
|
||||
failCount = Integer.parseInt(res.get("total").toString()); break;
|
||||
failCount = Integer.parseInt(res.get("total").toString());
|
||||
break;
|
||||
case "2":
|
||||
successCount = Integer.parseInt(res.get("total").toString()); break;
|
||||
default: break;
|
||||
successCount = Integer.parseInt(res.get("total").toString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
checkCount = successCount + failCount;
|
||||
@ -108,62 +115,72 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
/**
|
||||
* 获取恒大对账数据
|
||||
*
|
||||
* @param fileUrl 文件访问地址
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(String fileUrl) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
File dataFile = DownloadUtil.downloadFile(fileUrl);
|
||||
return getHdInternetDataList(dataFile);
|
||||
return getHdInternetDataList(dataFile, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取小桔对账数据
|
||||
*
|
||||
* @param fileUrl 文件访问地址
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(String fileUrl) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
File dataFile = DownloadUtil.downloadFile(fileUrl);
|
||||
return getXjInternetDataList(dataFile);
|
||||
return getXjInternetDataList(dataFile, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取新电途对账数据
|
||||
*
|
||||
* @param fileUrl 文件访问地址
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(String fileUrl) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
File dataFile = DownloadUtil.downloadFile(fileUrl);
|
||||
return getXDTInternetDataList(dataFile);
|
||||
return getXDTInternetDataList(dataFile, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取快电对账数据
|
||||
*
|
||||
* @param fileUrl 文件访问地址
|
||||
* @return 对账数据
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(String fileUrl) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
File dataFile = DownloadUtil.downloadFile(fileUrl);
|
||||
return getKDInternetDataList(dataFile);
|
||||
return getKDInternetDataList(dataFile, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取恒大对账数据
|
||||
*
|
||||
* @param dataFile 对账单文件,格式为xlsx
|
||||
* @return 对账数据
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(File dataFile) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
|
||||
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
|
||||
List<HDTradebillVo> hdTradebillVoList = new ArrayList<>();
|
||||
@ -180,7 +197,8 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
|
||||
hdTradebillVoList = reader.read(fileReader.readString(), HDTradebillVo.class);
|
||||
break;
|
||||
default:break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (HDTradebillVo vo : hdTradebillVoList) {
|
||||
@ -211,7 +229,7 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
// getHistoryOrderInfo(domain);
|
||||
checkRecordDomainList.add(domain);
|
||||
}
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList);
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList, startTime, endTime, tenantId);
|
||||
|
||||
return checkRecordDomainList;
|
||||
}
|
||||
@ -219,11 +237,12 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
/**
|
||||
* 获取小桔对账数据
|
||||
*
|
||||
* @param dataFile 对账单文件,格式为xlsx
|
||||
* @return 对账数据
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(File dataFile) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
|
||||
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
|
||||
@ -241,7 +260,8 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
|
||||
xjTradeBillVoList = reader.read(fileReader.readString(), XJTradeBillVo.class);
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (XJTradeBillVo vo : xjTradeBillVoList) {
|
||||
@ -277,18 +297,20 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
//
|
||||
checkRecordDomainList.add(domain);
|
||||
}
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList);
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList, startTime, endTime, tenantId);
|
||||
return checkRecordDomainList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取新电途对账数据
|
||||
*
|
||||
* @param dataFile 对账单文件,格式为xlsx
|
||||
* @return 对账数据
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(File dataFile) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
|
||||
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
|
||||
List<XDTTradebillVo> xdtTradebillVoList = new ArrayList<>();
|
||||
@ -305,7 +327,8 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
|
||||
xdtTradebillVoList = reader.read(fileReader.readString(), XDTTradebillVo.class);
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (XDTTradebillVo vo : xdtTradebillVoList) {
|
||||
@ -336,17 +359,19 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
// getHistoryOrderInfo(domain);
|
||||
checkRecordDomainList.add(domain);
|
||||
}
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList);
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList, startTime, endTime, tenantId);
|
||||
return checkRecordDomainList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取快电对账数据
|
||||
*
|
||||
* @param dataFile 对账单文件,格式为xlsx
|
||||
* @return 对账数据
|
||||
*/
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile) throws Exception {
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
|
||||
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
|
||||
List<KDTradebillVo> kdTradebillVoList = new ArrayList<>();
|
||||
@ -360,7 +385,8 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
kdTradebillVoList = util.importExcel(new FileInputStream(dataFile), 1);
|
||||
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -374,11 +400,11 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
domain.setInternetSerialNumber(vo.getOrderNo());
|
||||
domain.setPlatformInternetSerialNumber(vo.getOrderNo());
|
||||
|
||||
Date startTime = StrUtil.hasBlank(vo.getStartTime()) ? null: DateUtil.parse(vo.getStartTime());
|
||||
domain.setInternetStartTime(startTime);
|
||||
Date startTime1 = StrUtil.hasBlank(vo.getStartTime()) ? null : DateUtil.parse(vo.getStartTime());
|
||||
domain.setInternetStartTime(startTime1);
|
||||
|
||||
Date endTime = StrUtil.hasBlank(vo.getEndTime()) ? null: DateUtil.parse(vo.getEndTime());
|
||||
domain.setInternetEndTime(endTime);
|
||||
Date endTime1 = StrUtil.hasBlank(vo.getEndTime()) ? null : DateUtil.parse(vo.getEndTime());
|
||||
domain.setInternetEndTime(endTime1);
|
||||
|
||||
domain.setInternetChargeStation(vo.getStationName());
|
||||
|
||||
@ -400,18 +426,20 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
serialNumberList.add(domain.getInternetSerialNumber());
|
||||
checkRecordDomainList.add(domain);
|
||||
}
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList);
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList, startTime, endTime, tenantId);
|
||||
return checkRecordDomainList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出对账单
|
||||
*
|
||||
* @param response 返回体
|
||||
* @param params 查询参数
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@Override
|
||||
public void export(HttpServletResponse response, Map<String, Object> params) throws Exception {
|
||||
|
||||
List<Map<String, Object>> list = internetCheckRecordMapper.selectByParams(params);
|
||||
|
||||
// 通过工具类创建writer,默认创建xls格式
|
||||
@ -462,8 +490,8 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void getHistoryOrderInfo(XhpcTradebillInternetCheckRecordDomain domain) {
|
||||
|
||||
XhpcHistoryOrderDomain orderDomain = historyOrderMapper.findOneByInternetSerialNumber(domain.getInternetSerialNumber());
|
||||
if (orderDomain != null) {
|
||||
domain.setHistoryOrderNo(orderDomain.getHistoryOrderId());
|
||||
@ -488,8 +516,11 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
}
|
||||
|
||||
|
||||
private List<XhpcTradebillInternetCheckRecordDomain> getHistoryOrderList(List<XhpcTradebillInternetCheckRecordDomain> domainList, List<String> serialNumberList){
|
||||
List<XhpcHistoryOrderDomain> orderDomainList = historyOrderMapper.findListByInternetSerialNumbers(serialNumberList);
|
||||
private List<XhpcTradebillInternetCheckRecordDomain> getHistoryOrderList(List<XhpcTradebillInternetCheckRecordDomain> domainList,
|
||||
List<String> serialNumberList,
|
||||
String startTime, String endTime, String tenantId) {
|
||||
|
||||
List<XhpcHistoryOrderDomain> orderDomainList = historyOrderMapper.findListByTimeBetween(startTime, endTime, tenantId);
|
||||
Map<String, XhpcHistoryOrderDomain> orderDomainMap = new HashMap<>();
|
||||
for (XhpcHistoryOrderDomain orderDomain : orderDomainList) {
|
||||
orderDomainMap.put(orderDomain.getInternetSerialNumber(), orderDomain);
|
||||
@ -516,14 +547,41 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
domain.setPlatformDiscountAmount(orderDomain.getPromotionDiscount());
|
||||
domain.setPlatformPayAmount(orderDomain.getActPrice());
|
||||
}
|
||||
orderDomainMap.remove(domain.getInternetSerialNumber());
|
||||
checkoutOrderResult(domain);
|
||||
}
|
||||
|
||||
if (orderDomainMap.size() > 0){
|
||||
for(XhpcHistoryOrderDomain orderDomain: orderDomainMap.values()){
|
||||
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
|
||||
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.add(domain);
|
||||
}
|
||||
}
|
||||
|
||||
domainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus));
|
||||
return domainList;
|
||||
}
|
||||
|
||||
private void checkoutOrderResult(XhpcTradebillInternetCheckRecordDomain domain) {
|
||||
|
||||
int checkoutStatus = 0;
|
||||
// 流量方的订单金额大于本平台的历史订单的订单金额,就可以判断成功
|
||||
if (domain.getPlatformOrderAmount() != null && domain.getPlatformOrderAmount().compareTo(domain.getInternetOrderAmount()) == 0
|
||||
@ -536,5 +594,4 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import com.xhpc.tradebill.config.AliPayProperties;
|
||||
import com.xhpc.tradebill.constant.WeixinPayConstant;
|
||||
import com.xhpc.tradebill.domain.XhpcRechargeOrderDomain;
|
||||
import com.xhpc.tradebill.domain.XhpcRefundOrderDomain;
|
||||
import com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain;
|
||||
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
|
||||
import com.xhpc.tradebill.mapper.XhpcRechargeOrderMapper;
|
||||
import com.xhpc.tradebill.mapper.XhpcRefundOrderMapper;
|
||||
@ -136,10 +137,10 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
* @param fileUrl 数据文件存放地址
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl) throws Exception {
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
File dataFile = DownloadUtil.downloadFile(fileUrl);
|
||||
return getAliPayDataList(dataFile);
|
||||
return getAliPayDataList(dataFile, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
|
||||
@ -149,7 +150,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
* @param dataFile 数据文件
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(File dataFile) throws
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(File dataFile, String startTime, String endTime, String tenantId) throws
|
||||
Exception {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
@ -210,7 +211,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
}
|
||||
paymentCheckRecordDomainList.add(domain);
|
||||
}
|
||||
getPlatOrderData(paymentCheckRecordDomainList, orderType, serialNumberList);
|
||||
getPlatOrderData(paymentCheckRecordDomainList, orderType, serialNumberList, startTime, endTime, tenantId);
|
||||
|
||||
break;
|
||||
case "ZIP":
|
||||
@ -233,7 +234,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
outputStream.close();
|
||||
}
|
||||
if (file != null) {
|
||||
paymentCheckRecordDomainList = getAliPayDataList(file);
|
||||
paymentCheckRecordDomainList = getAliPayDataList(file, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -251,10 +252,10 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
* @param fileUrl 数据文件存放地址
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl) throws Exception {
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
File dataFile = DownloadUtil.downloadFile(fileUrl);
|
||||
return getWechatDataList(dataFile);
|
||||
return getWechatDataList(dataFile, startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
|
||||
@ -264,7 +265,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
* @param dataFile 数据文件
|
||||
* @return 对账完成的数据列表
|
||||
*/
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(File dataFile) throws Exception {
|
||||
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(File dataFile, String startTime, String endTime, String tenantId) throws Exception {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckRecordDomainList = new ArrayList<>();
|
||||
@ -327,7 +328,7 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
|
||||
paymentCheckRecordDomainList.add(computeTradebillData(domain));
|
||||
}
|
||||
getPlatOrderData(paymentCheckRecordDomainList, orderType, serialNumberList);
|
||||
getPlatOrderData(paymentCheckRecordDomainList, orderType, serialNumberList, startTime, endTime, tenantId);
|
||||
|
||||
} else {
|
||||
throw new Exception("暂不支持的文件格式");
|
||||
@ -449,13 +450,18 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
|
||||
|
||||
|
||||
private List<XhpcTradebillPaymentCheckRecordDomain> getPlatOrderData(List<XhpcTradebillPaymentCheckRecordDomain> domainList, int orderType, List<String> serialNumberList){
|
||||
private List<XhpcTradebillPaymentCheckRecordDomain> getPlatOrderData(List<XhpcTradebillPaymentCheckRecordDomain> domainList,
|
||||
int orderType,
|
||||
List<String> serialNumberList,
|
||||
String startTime,
|
||||
String endTime,
|
||||
String tenantId){
|
||||
|
||||
List<Map<String, Object>> orderMapList = null;
|
||||
if (orderType == 1) {
|
||||
orderMapList = rechargeOrderMapper.findListByOrderNumbers(serialNumberList);
|
||||
orderMapList = rechargeOrderMapper.findListByTimeBetween(startTime, endTime, tenantId);
|
||||
} else if (orderType == 2) {
|
||||
orderMapList = refundOrderMapper.findListByOrderNumbers(serialNumberList);
|
||||
orderMapList = refundOrderMapper.findListByTimeBetween(startTime, endTime, tenantId);
|
||||
}
|
||||
|
||||
Map<String, Map<String, Object>> orderList = new HashMap<>();
|
||||
@ -472,9 +478,23 @@ public class PaymentBillServiceImpl implements PaymentBillService {
|
||||
domain.setPlatformAmount(new BigDecimal(orderMap.get("amount").toString()));
|
||||
domain.setPlatformPayTime(DateUtil.parse(orderMap.get("updateTime").toString(), "yyyy-MM-dd'T'HH:mm"));
|
||||
}
|
||||
orderList.remove(domain.getPaymentPayNumber());
|
||||
computeTradebillData(domain);
|
||||
}
|
||||
|
||||
if(orderList.size() > 0){
|
||||
for(Map<String, Object> orderMap: orderList.values()){
|
||||
XhpcTradebillPaymentCheckRecordDomain domain = new XhpcTradebillPaymentCheckRecordDomain();
|
||||
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);
|
||||
domainList.add(domain);
|
||||
}
|
||||
}
|
||||
domainList.sort(Comparator.comparing(XhpcTradebillPaymentCheckRecordDomain::getStatus));
|
||||
return domainList;
|
||||
}
|
||||
|
||||
|
||||
@ -38,4 +38,17 @@
|
||||
#{orderNumber}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="findListByTimeBetween" 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 tenant_id=#{tenantId} and create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -43,4 +43,18 @@
|
||||
#{orderNumber}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findListByTimeBetween" 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 tenant_id=#{tenantId} and create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -39,4 +39,17 @@
|
||||
#{orderNumber}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findListByTimeBetween" 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 tenant_id=#{tenantId} and create_time BETWEEN #{startTime} AND #{endTime}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user