对账增加时间段设置
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 ;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -38,7 +38,8 @@ public class CommonServiceImpl implements CommonService {
|
||||
AliOSSProperties ossProperties;
|
||||
|
||||
@Override
|
||||
public XhpcTradebillUploadRecordDomain ossUpload(XhpcTradebillUploadRecordDomain domain) throws Exception{
|
||||
public XhpcTradebillUploadRecordDomain ossUpload(XhpcTradebillUploadRecordDomain domain) throws Exception {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
domain.setCreateBy(userId);
|
||||
domain.setUpdateBy(userId);
|
||||
@ -58,42 +59,42 @@ public class CommonServiceImpl implements CommonService {
|
||||
Map<String, Integer> totalMap = new HashMap<>();
|
||||
int insertCount = 0;
|
||||
resDomain.setStatus(2);
|
||||
switch (domain.getType()){
|
||||
switch (domain.getType()) {
|
||||
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;
|
||||
@ -111,21 +112,21 @@ public class CommonServiceImpl implements CommonService {
|
||||
resDomain.setCheckedCount(totalMap.get("checkCount"));
|
||||
resDomain.setUncheckCount(totalMap.get("uncheckCount"));
|
||||
uploadRecordMapper.updateByPrimaryKey(resDomain);
|
||||
return resDomain;
|
||||
return resDomain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@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);
|
||||
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
|
||||
File dataFile = File.createTempFile("temp_", suffix);
|
||||
|
||||
file.transferTo(dataFile);
|
||||
|
||||
String ossPath = "bill/" + file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(".")) + "_" +System.currentTimeMillis() + "." + suffix;
|
||||
String ossPath = "bill/" + file.getOriginalFilename().substring(0, file.getOriginalFilename().lastIndexOf(".")) + "_" + System.currentTimeMillis() + "." + suffix;
|
||||
OSSClient ossClient = new OSSClient(ossProperties.getEndpoint(), ossProperties.getAccessKey(), ossProperties.getSecretKey());
|
||||
// 上传文件流
|
||||
ossClient.putObject(ossProperties.getBucketName(), ossPath, dataFile);
|
||||
@ -133,29 +134,34 @@ 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<XhpcTradebillUploadRecordDomain> getFilePage(Map<String, Object> params){
|
||||
public List<XhpcTradebillUploadRecordDomain> getFilePage(Map<String, Object> params) {
|
||||
|
||||
return uploadRecordMapper.selectByType(params);
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Integer> computePaymentRecord(List<XhpcTradebillPaymentCheckRecordDomain> domainList){
|
||||
private Map<String, Integer> computePaymentRecord(List<XhpcTradebillPaymentCheckRecordDomain> domainList) {
|
||||
|
||||
Integer successCount = 0;
|
||||
Integer failCount = 0;
|
||||
Integer checkCount = 0;
|
||||
Integer uncheckCount = 0;
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
for (XhpcTradebillPaymentCheckRecordDomain domain: domainList){
|
||||
if(domain.getStatus() == 2){
|
||||
successCount++; checkCount++;
|
||||
} else if(domain.getStatus() == 1 || domain.getStatus() == 0){
|
||||
failCount++; checkCount++;
|
||||
for (XhpcTradebillPaymentCheckRecordDomain domain : domainList) {
|
||||
if (domain.getStatus() == 2) {
|
||||
successCount++;
|
||||
checkCount++;
|
||||
} else if (domain.getStatus() == 1 || domain.getStatus() == 0) {
|
||||
failCount++;
|
||||
checkCount++;
|
||||
} else {
|
||||
uncheckCount++;
|
||||
}
|
||||
@ -168,17 +174,20 @@ public class CommonServiceImpl implements CommonService {
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Integer> computeInternetRecord(List<XhpcTradebillInternetCheckRecordDomain> domainList){
|
||||
private Map<String, Integer> computeInternetRecord(List<XhpcTradebillInternetCheckRecordDomain> domainList) {
|
||||
|
||||
Integer successCount = 0;
|
||||
Integer failCount = 0;
|
||||
Integer checkCount = 0;
|
||||
Integer uncheckCount = 0;
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain: domainList){
|
||||
if(domain.getStatus() == 2){
|
||||
successCount++; checkCount++;
|
||||
} else if(domain.getStatus() == 1 || domain.getStatus() == 0){
|
||||
failCount++; checkCount++;
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain : domainList) {
|
||||
if (domain.getStatus() == 2) {
|
||||
successCount++;
|
||||
checkCount++;
|
||||
} else if (domain.getStatus() == 1 || domain.getStatus() == 0) {
|
||||
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,23 +47,25 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
EtOrderMappingMapper orderMappingMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public XhpcTradebillInternetCheckRecordDomain getInfoByPk(int pk){
|
||||
public XhpcTradebillInternetCheckRecordDomain getInfoByPk(int pk) {
|
||||
|
||||
return internetCheckRecordMapper.selectByPrimaryKey(pk);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInfoByDomain(XhpcTradebillInternetCheckRecordDomain domain){
|
||||
public boolean updateInfoByDomain(XhpcTradebillInternetCheckRecordDomain domain) {
|
||||
|
||||
domain.setUpdateBy(SecurityUtils.getUserId());
|
||||
return internetCheckRecordMapper.updateStatusByPk(domain);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Integer insertInternetCheckList(int uploadId, List<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList){
|
||||
public Integer insertInternetCheckList(int uploadId, List<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList) {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
for(XhpcTradebillInternetCheckRecordDomain domain: internetCheckRecordDomainList){
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain : internetCheckRecordDomainList) {
|
||||
domain.setUploadId(uploadId);
|
||||
domain.setCreateBy(userId);
|
||||
domain.setUpdateBy(userId);
|
||||
@ -74,26 +75,32 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getInternetCheckList(Map<String, Object> params){
|
||||
public List<XhpcTradebillInternetCheckRecordDomain> getInternetCheckList(Map<String, Object> params) {
|
||||
|
||||
return internetCheckRecordMapper.selectListByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getStatusTotal(Map<String, Object> params){
|
||||
public Map<String, Object> getStatusTotal(Map<String, Object> params) {
|
||||
|
||||
List<Map<String, Object>> resultList = internetCheckRecordMapper.selectTotalGroupbyStatus(params);
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
int uncheckCount = 0;
|
||||
int checkCount = 0;
|
||||
for(Map<String, Object> res : resultList){
|
||||
switch (res.get("status").toString()){
|
||||
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,68 +115,78 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
|
||||
/**
|
||||
* 获取恒大对账数据
|
||||
*
|
||||
* @param fileUrl 文件访问地址
|
||||
* @return 对账数据
|
||||
* @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 对账数据
|
||||
* @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 对账数据
|
||||
* @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 对账数据
|
||||
* @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<>();
|
||||
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
switch (suffix.toUpperCase()){
|
||||
switch (suffix.toUpperCase()) {
|
||||
case "XLS":
|
||||
case "XLSX":
|
||||
ExcelUtil<HDTradebillVo> util = new ExcelUtil<HDTradebillVo>(HDTradebillVo.class);
|
||||
@ -180,30 +197,31 @@ 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){
|
||||
for (HDTradebillVo vo : hdTradebillVoList) {
|
||||
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
|
||||
domain.setPlatformInternetSerialNumber(vo.getOrderNo().trim());
|
||||
domain.setInternetSerialNumber(vo.getOrderNo().trim());
|
||||
domain.setSource("恒大");
|
||||
domain.setInternetName("恒大");
|
||||
domain.setInternetChargeStation(vo.getStationName());
|
||||
BigDecimal chargingDegree = vo.getChargeDegree()!=null ? BigDecimal.valueOf(vo.getChargeDegree()) : BigDecimal.ZERO;
|
||||
BigDecimal chargingDegree = vo.getChargeDegree() != null ? BigDecimal.valueOf(vo.getChargeDegree()) : BigDecimal.ZERO;
|
||||
domain.setInternetChargingDegree(chargingDegree);
|
||||
|
||||
BigDecimal orderAmount = vo.getOrderTotalAmount() !=null? BigDecimal.valueOf(vo.getOrderTotalAmount()): BigDecimal.ZERO;
|
||||
BigDecimal orderAmount = vo.getOrderTotalAmount() != null ? BigDecimal.valueOf(vo.getOrderTotalAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetOrderAmount(orderAmount);
|
||||
|
||||
BigDecimal powerAmount = vo.getPowerAmount()!=null? BigDecimal.valueOf(vo.getPowerAmount()): BigDecimal.ZERO;
|
||||
BigDecimal powerAmount = vo.getPowerAmount() != null ? BigDecimal.valueOf(vo.getPowerAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetPowerAmount(powerAmount);
|
||||
|
||||
BigDecimal serverAmount = vo.getServerAmount()!= null? BigDecimal.valueOf(vo.getServerAmount()): BigDecimal.ZERO;
|
||||
BigDecimal serverAmount = vo.getServerAmount() != null ? BigDecimal.valueOf(vo.getServerAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetServerAmount(serverAmount);
|
||||
domain.setInternetDiscountAmount(BigDecimal.ZERO);
|
||||
|
||||
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);
|
||||
|
||||
serialNumberList.add(domain.getInternetSerialNumber());
|
||||
@ -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,18 +237,19 @@ 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<>();
|
||||
List<XJTradeBillVo> xjTradeBillVoList = new ArrayList<>();
|
||||
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
switch (suffix.toUpperCase()){
|
||||
switch (suffix.toUpperCase()) {
|
||||
case "XLS":
|
||||
case "XLSX":
|
||||
ExcelUtil<XJTradeBillVo> util = new ExcelUtil<XJTradeBillVo>(XJTradeBillVo.class);
|
||||
@ -241,10 +260,11 @@ 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){
|
||||
for (XJTradeBillVo vo : xjTradeBillVoList) {
|
||||
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
|
||||
domain.setPlatformInternetSerialNumber(vo.getOrderNo().trim());
|
||||
domain.setInternetSerialNumber(vo.getOrderNo().trim());
|
||||
@ -253,23 +273,23 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
domain.setInternetChargeStation(vo.getStationName());
|
||||
domain.setInternetStartSoc(vo.getStartSoc());
|
||||
domain.setInternetEndSoc(vo.getEndSoc());
|
||||
BigDecimal chargingDegree = vo.getChargingDegree()!=null ? BigDecimal.valueOf(vo.getChargingDegree()): BigDecimal.ZERO;
|
||||
BigDecimal chargingDegree = vo.getChargingDegree() != null ? BigDecimal.valueOf(vo.getChargingDegree()) : BigDecimal.ZERO;
|
||||
domain.setInternetChargingDegree(chargingDegree);
|
||||
domain.setInternetChargingTime(vo.getChargingTime().toString());
|
||||
domain.setInternetStartTime(vo.getChargingStartTime());
|
||||
domain.setInternetEndTime(vo.getChargingEndTime());
|
||||
|
||||
BigDecimal orderAmount = vo.getBillAmount() !=null? BigDecimal.valueOf(vo.getBillAmount()): BigDecimal.ZERO;
|
||||
BigDecimal orderAmount = vo.getBillAmount() != null ? BigDecimal.valueOf(vo.getBillAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetOrderAmount(orderAmount);
|
||||
|
||||
BigDecimal powerAmount = vo.getOrderPowerAmount()!=null? BigDecimal.valueOf(vo.getOrderPowerAmount()): BigDecimal.ZERO;
|
||||
BigDecimal powerAmount = vo.getOrderPowerAmount() != null ? BigDecimal.valueOf(vo.getOrderPowerAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetPowerAmount(powerAmount);
|
||||
|
||||
BigDecimal serverAmount = vo.getOrderServerAmount()!= null? BigDecimal.valueOf(vo.getOrderServerAmount()): BigDecimal.ZERO;
|
||||
BigDecimal serverAmount = vo.getOrderServerAmount() != null ? BigDecimal.valueOf(vo.getOrderServerAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetServerAmount(serverAmount);
|
||||
domain.setInternetDiscountAmount(BigDecimal.ZERO);
|
||||
|
||||
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);
|
||||
|
||||
serialNumberList.add(domain.getInternetSerialNumber());
|
||||
@ -277,24 +297,26 @@ 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<>();
|
||||
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
switch (suffix.toUpperCase()){
|
||||
switch (suffix.toUpperCase()) {
|
||||
case "XLS":
|
||||
case "XLSX":
|
||||
ExcelUtil<XDTTradebillVo> util = new ExcelUtil<XDTTradebillVo>(XDTTradebillVo.class);
|
||||
@ -305,10 +327,11 @@ 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){
|
||||
for (XDTTradebillVo vo : xdtTradebillVoList) {
|
||||
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
|
||||
domain.setPlatformInternetSerialNumber(vo.getOrderNo().trim());
|
||||
domain.setInternetSerialNumber(vo.getOrderNo().trim());
|
||||
@ -316,55 +339,58 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
domain.setInternetName("新电途");
|
||||
domain.setInternetChargeStation(vo.getStationName());
|
||||
|
||||
BigDecimal chargingDegree = vo.getChargingDegree()!=null? BigDecimal.valueOf(vo.getChargingDegree()): BigDecimal.ZERO;
|
||||
BigDecimal chargingDegree = vo.getChargingDegree() != null ? BigDecimal.valueOf(vo.getChargingDegree()) : BigDecimal.ZERO;
|
||||
domain.setInternetChargingDegree(chargingDegree);
|
||||
|
||||
BigDecimal orderAmount = vo.getOrderAmount() !=null? BigDecimal.valueOf(vo.getOrderAmount()): BigDecimal.ZERO;
|
||||
BigDecimal orderAmount = vo.getOrderAmount() != null ? BigDecimal.valueOf(vo.getOrderAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetOrderAmount(orderAmount);
|
||||
|
||||
BigDecimal powerAmount = vo.getPowerAmount()!=null? BigDecimal.valueOf(vo.getPowerAmount()): BigDecimal.ZERO;
|
||||
BigDecimal powerAmount = vo.getPowerAmount() != null ? BigDecimal.valueOf(vo.getPowerAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetPowerAmount(powerAmount);
|
||||
|
||||
BigDecimal serverAmount = vo.getServerAmount()!= null? BigDecimal.valueOf(vo.getServerAmount()): BigDecimal.ZERO;
|
||||
BigDecimal serverAmount = vo.getServerAmount() != null ? BigDecimal.valueOf(vo.getServerAmount()) : BigDecimal.ZERO;
|
||||
domain.setInternetServerAmount(serverAmount);
|
||||
domain.setInternetDiscountAmount(BigDecimal.ZERO);
|
||||
|
||||
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);
|
||||
|
||||
serialNumberList.add(domain.getInternetSerialNumber());
|
||||
// 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<>();
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
|
||||
List<String> serialNumberList = new ArrayList<>();
|
||||
switch (suffix.toUpperCase()){
|
||||
switch (suffix.toUpperCase()) {
|
||||
case "XLS":
|
||||
case "XLSX":
|
||||
ExcelUtil<KDTradebillVo> util = new ExcelUtil<KDTradebillVo>(KDTradebillVo.class);
|
||||
kdTradebillVoList = util.importExcel(new FileInputStream(dataFile), 1);
|
||||
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for(KDTradebillVo vo: kdTradebillVoList){
|
||||
for (KDTradebillVo vo : kdTradebillVoList) {
|
||||
if (vo.getOrderNo().equals("交易订单号") || StrUtil.hasBlank(vo.getOrderNo())) {
|
||||
continue;
|
||||
}
|
||||
@ -374,44 +400,46 @@ 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());
|
||||
|
||||
BigDecimal chargingDegree = vo.getChargingDegree() == null ? BigDecimal.ZERO: BigDecimal.valueOf(vo.getChargingDegree());
|
||||
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());
|
||||
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());
|
||||
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();
|
||||
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);
|
||||
getHistoryOrderList(checkRecordDomainList, serialNumberList, startTime, endTime, tenantId);
|
||||
return checkRecordDomainList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出对账单
|
||||
*
|
||||
* @param response 返回体
|
||||
* @param params 查询参数
|
||||
* @param params 查询参数
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
@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 = internetCheckRecordMapper.selectByParams(params);
|
||||
|
||||
// 通过工具类创建writer,默认创建xls格式
|
||||
@ -462,18 +490,18 @@ public class InternetBillServiceImpl implements InternetBillService {
|
||||
}
|
||||
|
||||
|
||||
private void getHistoryOrderInfo(XhpcTradebillInternetCheckRecordDomain domain) {
|
||||
|
||||
private void getHistoryOrderInfo(XhpcTradebillInternetCheckRecordDomain domain){
|
||||
XhpcHistoryOrderDomain orderDomain = historyOrderMapper.findOneByInternetSerialNumber(domain.getInternetSerialNumber());
|
||||
if(orderDomain != null){
|
||||
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;
|
||||
BigDecimal chargingDegree = orderDomain.getChargingDegree() != null ?
|
||||
BigDecimal.valueOf(orderDomain.getChargingDegree()) : BigDecimal.ZERO;
|
||||
domain.setPlatformChargingDegree(chargingDegree);
|
||||
domain.setPlatformChargingTime(orderDomain.getChargingTime());
|
||||
domain.setPlatformStartTime(orderDomain.getStartTime());
|
||||
@ -488,24 +516,27 @@ 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){
|
||||
for (XhpcHistoryOrderDomain orderDomain : orderDomainList) {
|
||||
orderDomainMap.put(orderDomain.getInternetSerialNumber(), orderDomain);
|
||||
}
|
||||
|
||||
for(XhpcTradebillInternetCheckRecordDomain domain: domainList){
|
||||
for (XhpcTradebillInternetCheckRecordDomain domain : domainList) {
|
||||
XhpcHistoryOrderDomain orderDomain = orderDomainMap.get(domain.getInternetSerialNumber());
|
||||
if(orderDomain != null){
|
||||
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;
|
||||
BigDecimal chargingDegree = orderDomain.getChargingDegree() != null ?
|
||||
BigDecimal.valueOf(orderDomain.getChargingDegree()) : BigDecimal.ZERO;
|
||||
domain.setPlatformChargingDegree(chargingDegree);
|
||||
domain.setPlatformChargingTime(orderDomain.getChargingTime());
|
||||
domain.setPlatformStartTime(orderDomain.getStartTime());
|
||||
@ -516,25 +547,51 @@ 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;
|
||||
return domainList;
|
||||
}
|
||||
|
||||
private void checkoutOrderResult(XhpcTradebillInternetCheckRecordDomain domain){
|
||||
private void checkoutOrderResult(XhpcTradebillInternetCheckRecordDomain domain) {
|
||||
|
||||
int checkoutStatus = 0;
|
||||
// 流量方的订单金额大于本平台的历史订单的订单金额,就可以判断成功
|
||||
if(domain.getPlatformOrderAmount() != null && domain.getPlatformOrderAmount().compareTo(domain.getInternetOrderAmount()) == 0
|
||||
&& domain.getPlatformPowerAmount() != null && domain.getPlatformPowerAmount().compareTo(domain.getInternetPowerAmount()) == 0
|
||||
&& domain.getPlatformServerAmount() != null && domain.getPlatformServerAmount().compareTo(domain.getInternetServerAmount()) == 0
|
||||
&& domain.getPlatformChargingDegree() != null && domain.getPlatformChargingDegree().compareTo(domain.getInternetChargingDegree()) == 0){
|
||||
if (domain.getPlatformOrderAmount() != null && domain.getPlatformOrderAmount().compareTo(domain.getInternetOrderAmount()) == 0
|
||||
&& domain.getPlatformPowerAmount() != null && domain.getPlatformPowerAmount().compareTo(domain.getInternetPowerAmount()) == 0
|
||||
&& domain.getPlatformServerAmount() != null && domain.getPlatformServerAmount().compareTo(domain.getInternetServerAmount()) == 0
|
||||
&& domain.getPlatformChargingDegree() != null && domain.getPlatformChargingDegree().compareTo(domain.getInternetChargingDegree()) == 0) {
|
||||
checkoutStatus = 2;
|
||||
}
|
||||
domain.setStatus(checkoutStatus);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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