Merge branch 'tradebill'

This commit is contained in:
ZZ 2021-12-28 10:17:15 +08:00
commit f3fce357b6
48 changed files with 4783 additions and 0 deletions

35
xhpc-modules/xhpc-tradebill/.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
HELP.md
target/
.mvn/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea/
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-modules</artifactId>
<version>3.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xhpc-tradebill</artifactId>
<description>
账单对账服务
</description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- RuoYi Common DataSource -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-datasource</artifactId>
</dependency>
<!-- RuoYi Common Core -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common-core</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>xhpc-common</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- 支付宝支付 通用版 -->
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>4.15.14.ALL</version>
</dependency>
<!-- 微信支付 -->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.12</version>
</dependency>
<dependency>
<groupId>com.aliyun.oss</groupId>
<artifactId>aliyun-sdk-oss</artifactId>
<version>3.10.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,26 @@
package com.xhpc.tradebill;
import com.xhpc.common.security.annotation.EnableCustomConfig;
import com.xhpc.common.security.annotation.EnableRyFeignClients;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@EnableConfigurationProperties
@ConfigurationPropertiesScan(basePackages = {"com.xhpc.tradebill.config"})
@EnableCustomConfig
@SpringBootApplication
@EnableRyFeignClients
@EnableDiscoveryClient
@MapperScan("com.xhpc.tradebill.mapper")
public class XhpcTradebillApplication {
public static void main(String[] args) {
SpringApplication.run(XhpcTradebillApplication.class, args);
}
}

View File

@ -0,0 +1,24 @@
package com.xhpc.tradebill.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 支付宝支付配置类
*/
@Data
@ConfigurationProperties(prefix = "oss")
public class AliOSSProperties {
private boolean enabled;
private String name;
private boolean tenantMode;
private String endpoint;
private String accessKey;
private String secretKey;
private String bucketName;
private String region;
private String domain;
}

View File

@ -0,0 +1,23 @@
package com.xhpc.tradebill.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 支付宝支付配置类
*/
@Data
@ConfigurationProperties(prefix = "alibaba.pay")
public class AliPayProperties {
private String gatewayDomain;
private String serverDomain;
private String publicKey;
private String privateKey;
private String appId;
private String certPath;
private String publicCertPath;
private String rootCertPath;
}

View File

@ -0,0 +1,42 @@
package com.xhpc.tradebill.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* 微信支付配置类
*/
@Data
@ConfigurationProperties(prefix = "wx.pay")
public class WxPayProperties {
/**
* 设置微信公众号或者小程序等的appid
*/
private String appId;
/**
* 微信支付商户号
*/
private String mchId;
/**
* 微信支付商户密钥
*/
private String mchKey;
/**
* 服务商模式下的子商户公众账号ID普通模式请不要配置请在配置文件中将对应项删除
*/
private String subAppId;
/**
* 服务商模式下的子商户号普通模式请不要配置最好是请在配置文件中将对应项删除
*/
private String subMchId;
/**
* apiclient_cert.p12文件的绝对路径或者如果放在项目中请以classpath:开头指定
*/
private String keyPath;
}

View File

@ -0,0 +1,42 @@
package com.xhpc.tradebill.constant;
/**
* 微信支付常量
*/
public class WeixinPayConstant {
/**
* 返回当日所有订单信息不含充值退款订单)
*/
public static final String BILL_TYPE_ALL = "ALL";
/**
* 返回当日成功支付的订单不含充值退款订单
*/
public static final String BILL_TYPE_SUCCESS = "SUCCESS";
/**
* 返回当日退款订单不含充值退款订单
*/
public static final String BILL_TYPE_REFUND = "REFUND";
/**
* 返回格式为.gzip的压缩包账单
*/
public static final String TAR_TYPE_GZIP = "GZIP";
/**
* 基本账户
*/
public static final String ACCOUNT_TYPE_BASIC = "BASIC";
/**
* 运营账户
*/
public static final String ACCOUNT_TYPE_OPERATION = "OPERATION";
/**
* 手续费账户
*/
public static final String ACCOUNT_TYPE_FEES = "FEES";
}

View File

@ -0,0 +1,49 @@
package com.xhpc.tradebill.controller;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain;
import com.xhpc.tradebill.service.CommonService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/common")
public class CommonController extends BaseController {
@Resource
CommonService commonService;
@PostMapping("/oss/upload")
public AjaxResult OssUpload(@RequestBody XhpcTradebillUploadRecordDomain domain) throws Exception{
return AjaxResult.success(commonService.ossUpload(domain));
}
@PostMapping("/file/upload")
public AjaxResult fileUpload(MultipartFile file, int type) throws Exception {
if (file ==null || type < 1){
return AjaxResult.error("文件或者对账类型为空");
}
return AjaxResult.success(commonService.fileUpload(file, type));
}
@GetMapping("/file/getPage")
public AjaxResult getFilePage(int type,
String name) throws Exception {
startPage();
Map<String, Object> parmas = new HashMap<>();
parmas.put("type", type);
parmas.put("createBy", SecurityUtils.getUserId());
parmas.put("name", name);
return AjaxResult.success(commonService.getFilePage(parmas));
}
}

View File

@ -0,0 +1,106 @@
package com.xhpc.tradebill.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain;
import com.xhpc.tradebill.service.InternetBillService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/internet")
public class InternetBillController extends BaseController {
@Resource
InternetBillService internetBillService;
@GetMapping("/checkList/{uploadId}")
public AjaxResult getCheckList(@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String stationName,
@RequestParam(required = false) String internetName,
@RequestParam(required = false) Integer status){
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("stationName", stationName);
params.put("internetName", internetName);
params.put("status", status);
return AjaxResult.success(internetBillService.getInternetCheckList(params));
}
@GetMapping("/checkPage")
public TableDataInfo getCheckPage(@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String station,
@RequestParam(required = false) String internetName,
@RequestParam(required = false) Integer status){
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("stationName", station);
params.put("internetName", internetName);
params.put("status", status);
startPage();
return getDataTable(internetBillService.getInternetCheckList(params));
}
@GetMapping("/statusTotal")
public AjaxResult getStatusTotal(@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String stationName,
@RequestParam(required = false) String internetName,
@RequestParam(required = false) Integer status){
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("stationName", stationName);
params.put("internetName", internetName);
params.put("status", status);
return AjaxResult.success(internetBillService.getStatusTotal(params));
}
@GetMapping("/checkInfo/{id}")
public AjaxResult getCheckInfo(@PathVariable Integer id){
return AjaxResult.success(internetBillService.getInfoByPk(id));
}
@PostMapping("/checkInfo")
public AjaxResult updateCheckInfo(@RequestBody XhpcTradebillInternetCheckRecordDomain domain){
return AjaxResult.success(internetBillService.updateInfoByDomain(domain));
}
@PostMapping("/export")
public void export(HttpServletResponse response,
@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String stationName,
@RequestParam(required = false) String internetName,
@RequestParam(required = false) Integer status) throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("stationName", stationName);
params.put("internetName", internetName);
params.put("status", status);
internetBillService.export(response, params);
}
}

View File

@ -0,0 +1,96 @@
package com.xhpc.tradebill.controller;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
import com.xhpc.tradebill.service.PaymentBillService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/payment")
public class PaymentBillController extends BaseController {
@Resource
PaymentBillService paymentBillService;
@GetMapping("/checkList/{uploadId}")
public AjaxResult getCheckList(@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String userId,
@RequestParam(required = false) Integer status){
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("userId", userId);
params.put("status", status);
return AjaxResult.success(paymentBillService.getPaymentCheckList(params));
}
@GetMapping("/checkPage")
public TableDataInfo getCheckPage(@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String userId,
@RequestParam(required = false) Integer status){
startPage();
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("userId", userId);
params.put("status", status);
return getDataTable(paymentBillService.getPaymentCheckList(params));
}
@GetMapping("/statusTotal")
public AjaxResult getStatusTotal(@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String userId,
@RequestParam(required = false) Integer status){
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("userId", userId);
params.put("status", status);
return AjaxResult.success(paymentBillService.getStatusTotal(params));
}
@GetMapping("/checkInfo/{id}")
public AjaxResult getCheckInfo(@PathVariable Integer id){
return AjaxResult.success(paymentBillService.getInfoByPk(id));
}
@PostMapping("/checkInfo")
public AjaxResult updateCheckInfo(@RequestBody XhpcTradebillPaymentCheckRecordDomain domain){
return AjaxResult.success(paymentBillService.updateInfoByDomain(domain));
}
@PostMapping("/export")
public void export(HttpServletResponse response,
@RequestParam(required = false) Integer uploadId,
@RequestParam(required = false) String orderNumber,
@RequestParam(required = false) String userId,
@RequestParam(required = false) Integer status) throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("uploadId", uploadId);
params.put("orderNumber",orderNumber);
params.put("userId", userId);
params.put("status", status);
paymentBillService.export(response, params);
}
}

View File

@ -0,0 +1,17 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
@Data
@Table(name = "et_order_mapping")
public class EtOrderMappingDomain {
private Long id;
private String xhOrderNo;
private String evcsOrderNo;
}

View File

@ -0,0 +1,170 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Table(name="xhpc_charge_order")
public class XhpcChargeOrderDomain implements Serializable {
/**
* 充电订单id
*/
private Long chargeOrderId;
/**
* 电站id
*/
private Long chargingStationId;
/**
* 用户id
*/
private Long userId;
/**
* 终端id
*/
private Long terminalId;
/**
* 互联网流水订单号
*/
private String internetSerialNumber;
/**
* 订单编号
*/
private String serialNumber;
/**
* 充电启始soc
*/
private String startSoc;
/**
* 结束soc
*/
private String endSoc;
/**
* 订单来源0C端用户 1流量用户
*/
private Integer source;
/**
* 状态-1准备充电 0开始充电 1自动结算2异常3平台结算
*/
private Integer status;
/**
* 删除标志0代表存在 1代表删除
*/
private Integer delFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新者
*/
private String updateBy;
/**
* 备注
*/
private String remark;
/**
* 费率模型id
*/
private Long rateModelId;
/**
* 充电方式
*/
private String chargingMode;
/**
* 开始充电时间
*/
private Date startTime;
/**
* 结束充电时间
*/
private Date endTime;
/**
* 充电时长
*/
private String chargingTime;
/**
* 充电度数
*/
private BigDecimal chargingDegree;
/**
* 协议定,停止方式
*/
private Integer type;
/**
* 异常备注
*/
private String erroRemark;
/**
* 总金额
*/
private BigDecimal amountCharged;
/**
* 功率
*/
private String power;
/**
* 充电时长
*/
private Long chargingTimeNumber;
/**
* 司机唯一标识手机号
*/
private String driverId;
/**
* 充电金额
*/
private Integer chargingAmt;
/**
* 车牌
*/
private String plateNum;
/**
* 符合Evcs标准的订单号,并非来自第三方的订单号
*/
private String evcsOrderNo;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,249 @@
package com.xhpc.tradebill.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* xhpc_history_order
* @author
*/
@Data
public class XhpcHistoryOrderDomain implements Serializable {
/**
* 历史订单id
*/
private Long historyOrderId;
/**
* 电站id
*/
private Long chargingStationId;
/**
* 场站名称
*/
private String chargingStationName;
/**
* 充电订单id
*/
private Long chargeOrderId;
/**
* 用户id
*/
private Long userId;
/**
* 终端id
*/
private Long terminalId;
/**
* 订单编号
*/
private String serialNumber;
/**
* 流量方订单号
*/
private String internetSerialNumber;
/**
* 总电费
*/
private BigDecimal powerPriceTotal;
/**
* 总服务费
*/
private BigDecimal servicePriceTotal;
/**
* 订单总价
*/
private BigDecimal totalPrice;
/**
* 电站活动抵扣--抵扣的总金额
*/
private BigDecimal promotionDiscount;
/**
* 实际价格-用户支付的钱
*/
private BigDecimal actPrice;
/**
* 实收电费-运营商电费
*/
private BigDecimal actPowerPrice;
/**
* 实收服务费-运营商服务费
*/
private BigDecimal actServicePrice;
/**
* 流量方总金额抽成
*/
private BigDecimal internetCommission;
/**
* 流量方服务费抽成
*/
private BigDecimal internetSvcCommission;
/**
* 平台总金额抽成
*/
private BigDecimal platformCommission;
/**
* 平台服务费抽成
*/
private BigDecimal platformSvcCommisssion;
/**
* 运维总抽成
*/
private BigDecimal operationCommission;
/**
* 运维服务费抽成
*/
private BigDecimal operationSvcCommission;
/**
* 开始充电soc
*/
private String startSoc;
/**
* 结束时soc
*/
private String endSoc;
/**
* 对账状态0待确认 1已确认2待提交3待审核
*/
private Integer reconciliationStatus;
/**
* 清分状态0待清分 1清分在途2已提现3待提交4待审核
*/
private Integer sortingStatus;
/**
* 1 自动结算 2 平台结算
*/
private Byte type;
/**
* 状态0正常 1停用
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
/**
* 创建时间
*/
private Date createTime;
/**
* 创建者
*/
private String createBy;
/**
* 更新时间
*/
private Date updateTime;
/**
* 更新者
*/
private String updateBy;
/**
* 备注
*/
private String remark;
/**
* 0未统计 1小时统计 2 其他统计
*/
private Integer state;
/**
* VIN
*/
private String vinNormal;
private String searchValue;
/**
* 运营商在EVCS分配的唯一OperatorID
*/
private String operatorIdEvcs;
private Integer chargeModelEvcs;
private Double connectorPowerEvcs;
private Double meterValueEndEvcs;
private Double meterValueStartEvcs;
private String operatorId3rdptyEvcs;
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
private Integer stopReasonEvcs;
private Double totalPower;
private String userNameEvcs;
private String phone;
/**
* 互联网订单流水号
*/
private String evcsOrderNo;
/**
* -1:未推送/推送失败 0:成功 1:争议交易 299:自定义
*/
private Integer confirmResult;
private Long rateModelId;
/**
* 充电方式
*/
private String chargingMode;
/**
* 充电度数
*/
private Double chargingDegree;
/**
* 充电时长
*/
private String chargingTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,79 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
/**
* 充值订单实体对象
*/
@Data
@Table(name = "xhpc_recharge_order")
public class XhpcRechargeOrderDomain {
/**
* 充值订单id
*/
private Long rechargeOrderId;
/**
* 用户id
*/
private Long userId;
/**
* 充值订单编号
*/
private String rechargeOrderNumber;
/**
* 微信支付订单号
*/
private String prepayId;
/**
* 支付宝订单编号
*/
private String alipayNumber;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 充值渠道1微信 2支付宝 3平台
*/
private Integer type;
/**
* 状态0待支付 1充值成功2充值失败
*/
private Integer status;
/**
* 订单来源0 C端用户 1 流量方用户 2社区用户 3B端用户
*/
private Integer source;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
private Date updateTime;
private String updateBy;
private Date createTime;
private String createBy;
}

View File

@ -0,0 +1,82 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
/**
* 退款订单实体对象
*/
@Data
@Table(name = "xhpc_refund_order")
public class XhpcRefundOrderDomain {
/**
* 退款订单id
*/
private Long refundOrderId;
/**
* 退款订单编号
*/
private String refundOrderNumber;
/**
* 用户id
*/
private Long userId;
/**
* 微信支付订单号
*/
private String openId;
/**
* 支付宝订单编号
*/
private String alipayId;
/**
* 充值金额
*/
private BigDecimal amount;
/**
* 退款渠道1微信 2支付宝 3平台
*/
private Integer type;
/**
* 审核状态0审核中 1审核通过2审核失败
*/
private Integer examineStatus;
/**
* 订单来源0 C端用户 1 流量方用户 2社区用户 3B端用户
*/
private Integer source;
/**
* 状态0退款中 1退款成功2退款失败3取消订单
*/
private Integer status;
/**
* 删除标志0代表存在 2代表删除
*/
private Integer delFlag;
private Date createTime;
private String createBy;
private Date updateTime;
private String updateBy;
}

View File

@ -0,0 +1,119 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Table(name="xhpc_tradebill_internet_check_record")
public class XhpcTradebillInternetCheckRecordDomain implements Serializable {
private Integer id;
private Date createTime;
private Long createBy;
private String createName;
private Date updateTime;
private Long updateBy;
private String updateName;
private Integer uploadId;
private Long historyOrderNo;
private String userId;
private String internetName;
private String platformInternetSerialNumber;
private String platformSerialNumber;
private String platformChargeStation;
private String platformStartSoc;
private String platformEndSoc;
private BigDecimal platformChargingDegree;
private String platformChargingTime;
private Date platformStartTime;
private Date platformEndTime;
private BigDecimal platformOrderAmount;
private BigDecimal platformPowerAmount;
private BigDecimal platformServerAmount;
private BigDecimal platformDiscountAmount;
private BigDecimal platformPayAmount;
private String internetSerialNumber;
private String internetChargeStation;
private String internetStartSoc;
private String internetEndSoc;
private BigDecimal internetChargingDegree;
private String internetChargingTime;
private Date internetStartTime;
private Date internetEndTime;
private BigDecimal internetOrderAmount;
private BigDecimal internetPowerAmount;
private BigDecimal internetServerAmount;
private BigDecimal internetDiscountAmount;
private BigDecimal internetPayAmount;
private String remark;
private Integer status;
private String statusName;
private String source;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,62 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@Table(name="xhpc_tradebill_payment_check_record")
public class XhpcTradebillPaymentCheckRecordDomain implements Serializable {
private Integer id;
private Date createTime;
private Long createBy;
private String createName;
private Date updateTime;
private Long updateBy;
private String updateName;
private Integer uploadId;
private Integer orderType;
private Integer paymentChannel;
private String platformOrderNumber;
private String platformPayNumber;
private String platformUserId;
private BigDecimal platformAmount;
private Date platformPayTime;
private String paymentPayNumber;
private String paymentUserId;
private BigDecimal paymentAmount;
private Date paymentPayTime;
private Integer status;
private String statusName;
private String remark;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,46 @@
package com.xhpc.tradebill.domain;
import lombok.Data;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
@Data
@Table(name="xhpc_tradebill_upload_record")
public class XhpcTradebillUploadRecordDomain implements Serializable {
private Integer id;
private Date createTime;
private Long createBy;
private Date updateTime;
private Long updateBy;
private String source;
private String fileName;
private String url;
private Integer type;
private Integer status;
private Integer delFlag;
private Integer successCount;
private Integer failCount;
private Integer uncheckCount;
private Integer checkedCount;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,15 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.EtOrderMappingDomain;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface EtOrderMappingMapper {
EtOrderMappingDomain selectByXhOrderNo(String xhOrderNo);
EtOrderMappingDomain selectByEvcsOrderNo(String evcsOrderNo);
}

View File

@ -0,0 +1,8 @@
package com.xhpc.tradebill.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface XhpcChargeOrderMapper {
}

View File

@ -0,0 +1,14 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcHistoryOrderDomain;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface XhpcHistoryOrderMapper {
XhpcHistoryOrderDomain findOneBySerialNumber(String serialNumber);
XhpcHistoryOrderDomain findOneByInternetSerialNumber(String internetSerialNumber);
}

View File

@ -0,0 +1,11 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcRechargeOrderDomain;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface XhpcRechargeOrderMapper {
XhpcRechargeOrderDomain findOneByOrderNumber(String orderNumber);
}

View File

@ -0,0 +1,11 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcRefundOrderDomain;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface XhpcRefundOrderMapper {
XhpcRefundOrderDomain findByOrderNumber(String orderNumber);
}

View File

@ -0,0 +1,35 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface XhpcTradebillInternetCheckRecordMapper {
int deleteByPrimaryKey(Integer id);
int insert(XhpcTradebillInternetCheckRecordDomain record);
int insertSelective(XhpcTradebillInternetCheckRecordDomain record);
XhpcTradebillInternetCheckRecordDomain selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(XhpcTradebillInternetCheckRecordDomain record);
int updateByPrimaryKey(XhpcTradebillInternetCheckRecordDomain record);
List<XhpcTradebillInternetCheckRecordDomain> selectListByParams(@Param("params") Map<String, Object> params);
List<Map<String, Object>> selectTotalGroupbyStatus(@Param("params") Map<String, Object> params);
int insertCheckList(List<XhpcTradebillInternetCheckRecordDomain> paymentCheckList);
boolean updateStatusByPk(XhpcTradebillInternetCheckRecordDomain record);
List<Map<String, Object>> selectByParams(Map<String, Object> params);
}

View File

@ -0,0 +1,35 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface XhpcTradebillPaymentCheckRecordMapper {
int deleteByPrimaryKey(Integer id);
int insert(XhpcTradebillPaymentCheckRecordDomain record);
int insertSelective(XhpcTradebillPaymentCheckRecordDomain record);
XhpcTradebillPaymentCheckRecordDomain selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(XhpcTradebillPaymentCheckRecordDomain record);
int updateByPrimaryKey(XhpcTradebillPaymentCheckRecordDomain record);
List<XhpcTradebillPaymentCheckRecordDomain> selectListByParams(@Param("params") Map params);
int insertCheckList(List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList);
List<Map<String, Object>> selectTotalGroupbyStatus(@Param("params") Map<String, Object> params);
boolean updateStatusByPk(XhpcTradebillPaymentCheckRecordDomain record);
List<Map<String, Object>> selectByParams(@Param("params") Map<String, Object> params);
}

View File

@ -0,0 +1,28 @@
package com.xhpc.tradebill.mapper;
import com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface XhpcTradebillUploadRecordMapper {
XhpcTradebillUploadRecordDomain selectByUrl(String url);
int deleteByPrimaryKey(Integer id);
int insert(XhpcTradebillUploadRecordDomain record);
int insertSelective(XhpcTradebillUploadRecordDomain record);
XhpcTradebillUploadRecordDomain selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(XhpcTradebillUploadRecordDomain record);
int updateByPrimaryKey(XhpcTradebillUploadRecordDomain record);
List<XhpcTradebillUploadRecordDomain> selectByType(@Param("params") Map params);
}

View File

@ -0,0 +1,18 @@
package com.xhpc.tradebill.service;
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
import com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
public interface CommonService {
XhpcTradebillUploadRecordDomain ossUpload(XhpcTradebillUploadRecordDomain domain) throws Exception;
XhpcTradebillUploadRecordDomain fileUpload(MultipartFile file, int type) throws Exception;
List<XhpcTradebillUploadRecordDomain> getFilePage(Map<String, Object> params);
}

View File

@ -0,0 +1,114 @@
package com.xhpc.tradebill.service;
import com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Map;
public interface InternetBillService {
XhpcTradebillInternetCheckRecordDomain getInfoByPk(int pk);
boolean updateInfoByDomain(XhpcTradebillInternetCheckRecordDomain domain);
Integer insertInternetCheckList(int uploadId, List<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList);
/**
* 获取对账列表
* @param uploadId 上传文件ID
* @return 对账数据
*/
List<XhpcTradebillInternetCheckRecordDomain> getInternetCheckList(Map<String, Object> params);
Map<String, Object> getStatusTotal(Map<String, Object> params);
/**
* 获取恒大对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(String fileUrl) throws Exception;
/**
* 获取恒大对账数据
* @param dataFile 文件
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(File dataFile) throws Exception;
/**
* 获取小桔对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(String fileUrl) throws Exception;
/**
* 获取小桔对账数据
* @param dataFile 文件
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(File dataFile) throws Exception;
/**
* 获取新电途对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(String fileUrl) throws Exception;
/**
* 获取新电途对账数据
* @param dataFile 文件
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(File dataFile) throws Exception;
/**
* 获取快电对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(String fileUrl) throws Exception;
/**
* 获取快电对账数据
* @param dataFile 文件
* @return 对账数据
* @throws Exception 异常
*/
List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile) throws Exception;
/**
* 导出对账单
* @param response 返回体
* @param params 查询参数
* @throws Exception 异常
*/
void export(HttpServletResponse response, Map<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,106 @@
package com.xhpc.tradebill.service;
import com.alipay.api.response.AlipayDataBillAccountlogQueryResponse;
import com.github.binarywang.wxpay.bean.result.WxPayFundFlowResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Map;
public interface PaymentBillService {
XhpcTradebillPaymentCheckRecordDomain getInfoByPk(int pk);
boolean updateInfoByDomain(XhpcTradebillPaymentCheckRecordDomain domain);
Integer insertPaymentCheckList(int uploadId, List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList);
Map<String, Object> getStatusTotal(Map<String, Object> params);
/**
* 获取对账列表
* @param params 参数Map
* @return 对账数据
*/
List<XhpcTradebillPaymentCheckRecordDomain> getPaymentCheckList(Map<String, Object> params);
/**
* 支付宝订单对账
*
* @param fileUrl 数据文件存放地址
* @return 对账完成的数据列表
*/
List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl) throws Exception ;
/**
* 支付宝订单对账
*
* @param dataFile 数据文件
* @return 对账完成的数据列表
*/
List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(File dataFile) throws Exception ;
/**
* 微信订单对账
*
* @param fileUrl 数据文件存放地址
* @return 对账完成的数据列表
*/
List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl) throws Exception ;
/**
* 微信订单对账
*
* @param dataFile 数据文件
* @return 对账完成的数据列表
*/
List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(File dataFile) throws Exception ;
/**
* 计算财务支付数据和订单是否对照正常
*
* @param domain 需对账的数据
* @return 对账完成的数据
*/
XhpcTradebillPaymentCheckRecordDomain computeTradebillData(XhpcTradebillPaymentCheckRecordDomain domain) ;
/**
* 使用微信支付SDK获取账单信息
*
* @param billDate 账单日期格式2021-12-20
* @return 账单数据
* @throws WxPayException 异常
*/
WxPayFundFlowResult getWechatPayBill(String billDate) throws WxPayException;
/**
* 使用支付宝SDK获取账单信息
*
* @param startTime 账单开始时间
* @param endTime 账单结束时间
* @return 账单数据
* @throws Exception 异常
*/
AlipayDataBillAccountlogQueryResponse getAliPayBill(String startTime, String endTime) throws Exception;
/**
* 导出对账单
* @param response 返回体
* @param params 查询参数
* @throws Exception 异常
*/
void export(HttpServletResponse response, Map<String, Object> params) throws Exception;
}

View File

@ -0,0 +1,192 @@
package com.xhpc.tradebill.service.impl;
import com.aliyun.oss.OSSClient;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.tradebill.config.AliOSSProperties;
import com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain;
import com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain;
import com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain;
import com.xhpc.tradebill.mapper.XhpcTradebillUploadRecordMapper;
import com.xhpc.tradebill.service.CommonService;
import com.xhpc.tradebill.service.InternetBillService;
import com.xhpc.tradebill.service.PaymentBillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class CommonServiceImpl implements CommonService {
@Resource
XhpcTradebillUploadRecordMapper uploadRecordMapper;
@Resource
PaymentBillService paymentBillService;
@Resource
InternetBillService internetBillService;
@Resource
AliOSSProperties ossProperties;
@Override
public XhpcTradebillUploadRecordDomain ossUpload(XhpcTradebillUploadRecordDomain domain) throws Exception{
Long userId = SecurityUtils.getUserId();
domain.setCreateBy(userId);
domain.setUpdateBy(userId);
domain.setSource("上传");
domain.setFileName(domain.getFileName());
domain.setStatus(0);
domain.setDelFlag(0);
domain.setSuccessCount(0);
domain.setFailCount(0);
domain.setUncheckCount(0);
domain.setCheckedCount(0);
uploadRecordMapper.insertSelective(domain);
XhpcTradebillUploadRecordDomain resDomain = uploadRecordMapper.selectByUrl(domain.getUrl());
List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckRecordDomainList = null;
List<XhpcTradebillInternetCheckRecordDomain> recordDomainList = null;
Map<String, Integer> totalMap = new HashMap<>();
int insertCount = 0;
resDomain.setStatus(2);
switch (domain.getType()){
case 1:
case 2:
// 微信支付
paymentCheckRecordDomainList = paymentBillService.getWechatDataList(domain.getUrl());
insertCount = paymentBillService.insertPaymentCheckList(resDomain.getId(), paymentCheckRecordDomainList);
totalMap = computePaymentRecord(paymentCheckRecordDomainList);
break;
case 3:
case 4:
// 支付宝支付
paymentCheckRecordDomainList = paymentBillService.getAliPayDataList(domain.getUrl());
insertCount = paymentBillService.insertPaymentCheckList(resDomain.getId(), paymentCheckRecordDomainList);
totalMap = computePaymentRecord(paymentCheckRecordDomainList);
break;
case 5:
// 恒大
recordDomainList = internetBillService.getHdInternetDataList(domain.getUrl());
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
totalMap = computeInternetRecord(recordDomainList);
break;
case 6:
// 小桔
recordDomainList = internetBillService.getXjInternetDataList(domain.getUrl());
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
totalMap = computeInternetRecord(recordDomainList);
break;
case 7:
// 新电途
recordDomainList = internetBillService.getXDTInternetDataList(domain.getUrl());
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
totalMap = computeInternetRecord(recordDomainList);
break;
case 8:
// 快电
recordDomainList = internetBillService.getKDInternetDataList(domain.getUrl());
insertCount = internetBillService.insertInternetCheckList(resDomain.getId(), recordDomainList);
totalMap = computeInternetRecord(recordDomainList);
break;
default:
resDomain.setStatus(1);
totalMap.put("successCount", 0);
totalMap.put("failCount", 0);
totalMap.put("checkCount", 0);
totalMap.put("uncheckCount", 0);
break;
}
resDomain.setStatus(1);
resDomain.setSuccessCount(totalMap.get("successCount"));
resDomain.setFailCount(totalMap.get("failCount"));
resDomain.setCheckedCount(totalMap.get("checkCount"));
resDomain.setUncheckCount(totalMap.get("uncheckCount"));
uploadRecordMapper.updateByPrimaryKey(resDomain);
return resDomain;
}
@Override
public XhpcTradebillUploadRecordDomain fileUpload(MultipartFile file, int type) throws Exception{
XhpcTradebillUploadRecordDomain domain = new XhpcTradebillUploadRecordDomain();
// 创建OSSClient实例
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;
OSSClient ossClient = new OSSClient(ossProperties.getEndpoint(), ossProperties.getAccessKey(), ossProperties.getSecretKey());
// 上传文件流
ossClient.putObject(ossProperties.getBucketName(), ossPath, dataFile);
ossClient.shutdown();
domain.setFileName(file.getOriginalFilename());
domain.setUrl(ossProperties.getDomain() + ossPath);
domain.setType(type);
return ossUpload(domain);
}
@Override
public List<XhpcTradebillUploadRecordDomain> getFilePage(Map<String, Object> params){
return uploadRecordMapper.selectByType(params);
}
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++;
} else {
uncheckCount++;
}
}
result.put("successCount", successCount);
result.put("failCount", failCount);
result.put("checkCount", checkCount);
result.put("uncheckCount", uncheckCount);
return result;
}
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++;
} else {
uncheckCount++;
}
}
result.put("successCount", successCount);
result.put("failCount", failCount);
result.put("checkCount", checkCount);
result.put("uncheckCount", uncheckCount);
return result;
}
}

View File

@ -0,0 +1,467 @@
package com.xhpc.tradebill.service.impl;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.text.csv.CsvReader;
import cn.hutool.core.text.csv.CsvUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.utils.poi.ExcelUtil;
import com.xhpc.tradebill.domain.XhpcHistoryOrderDomain;
import com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain;
import com.xhpc.tradebill.mapper.EtOrderMappingMapper;
import com.xhpc.tradebill.mapper.XhpcHistoryOrderMapper;
import com.xhpc.tradebill.mapper.XhpcTradebillInternetCheckRecordMapper;
import com.xhpc.tradebill.service.InternetBillService;
import com.xhpc.tradebill.utils.DownloadUtil;
import com.xhpc.tradebill.vo.HDTradebillVo;
import com.xhpc.tradebill.vo.KDTradebillVo;
import com.xhpc.tradebill.vo.XDTTradebillVo;
import com.xhpc.tradebill.vo.XJTradeBillVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import java.util.*;
@Slf4j
@Service
public class InternetBillServiceImpl implements InternetBillService {
@Resource
XhpcTradebillInternetCheckRecordMapper internetCheckRecordMapper;
@Resource
XhpcHistoryOrderMapper historyOrderMapper;
@Resource
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);
}
@Override
public Integer insertInternetCheckList(int uploadId, List<XhpcTradebillInternetCheckRecordDomain> internetCheckRecordDomainList){
Long userId = SecurityUtils.getUserId();
for(XhpcTradebillInternetCheckRecordDomain domain: internetCheckRecordDomainList){
domain.setUploadId(uploadId);
domain.setCreateBy(userId);
domain.setUpdateBy(userId);
}
return internetCheckRecordMapper.insertCheckList(internetCheckRecordDomainList);
}
@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;
int uncheckCount = 0;
int checkCount = 0;
for(Map<String, Object> res : resultList){
switch (res.get("status").toString()){
case "0":
uncheckCount = Integer.parseInt(res.get("total").toString()); break;
case "1":
failCount = Integer.parseInt(res.get("total").toString()); break;
case "2":
successCount = Integer.parseInt(res.get("total").toString()); break;
default: break;
}
}
checkCount = successCount + failCount;
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("successCount", successCount);
resultMap.put("failCount", failCount);
resultMap.put("uncheckCount", uncheckCount);
resultMap.put("checkCount", checkCount);
return resultMap;
}
/**
* 获取恒大对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl);
return getHdInternetDataList(dataFile);
}
/**
* 获取小桔对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl);
return getXjInternetDataList(dataFile);
}
/**
* 获取新电途对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl);
return getXDTInternetDataList(dataFile);
}
/**
* 获取快电对账数据
* @param fileUrl 文件访问地址
* @return 对账数据
* @throws Exception 异常
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl);
return getKDInternetDataList(dataFile);
}
/**
* 获取恒大对账数据
* @param dataFile 对账单文件,格式为xlsx
* @return 对账数据
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getHdInternetDataList(File dataFile) throws Exception {
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
List<HDTradebillVo> hdTradebillVoList = new ArrayList<>();
switch (suffix.toUpperCase()){
case "XLS":
case "XLSX":
ExcelUtil<HDTradebillVo> util = new ExcelUtil<HDTradebillVo>(HDTradebillVo.class);
hdTradebillVoList = util.importExcel(new FileInputStream(dataFile));
break;
case "CSV":
CsvReader reader = CsvUtil.getReader();
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
hdTradebillVoList = reader.read(fileReader.readString(), HDTradebillVo.class);
break;
default:break;
}
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;
domain.setInternetChargingDegree(chargingDegree);
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;
domain.setInternetPowerAmount(powerAmount);
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;
domain.setInternetPayAmount(payAmount);
getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain);
}
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus));
return checkRecordDomainList;
}
/**
* 获取小桔对账数据
* @param dataFile 对账单文件,格式为xlsx
* @return 对账数据
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getXjInternetDataList(File dataFile) throws Exception {
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<XJTradeBillVo> xjTradeBillVoList = new ArrayList<>();
switch (suffix.toUpperCase()){
case "XLS":
case "XLSX":
ExcelUtil<XJTradeBillVo> util = new ExcelUtil<XJTradeBillVo>(XJTradeBillVo.class);
xjTradeBillVoList = util.importExcel(new FileInputStream(dataFile));
break;
case "CSV":
CsvReader reader = CsvUtil.getReader();
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
xjTradeBillVoList = reader.read(fileReader.readString(), XJTradeBillVo.class);
break;
default: break;
}
for(XJTradeBillVo vo: xjTradeBillVoList){
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
domain.setPlatformInternetSerialNumber(vo.getOrderNo().trim());
domain.setInternetSerialNumber(vo.getOrderNo().trim());
domain.setSource("小桔");
domain.setInternetName("小桔");
domain.setInternetChargeStation(vo.getStationName());
domain.setInternetStartSoc(vo.getStartSoc());
domain.setInternetEndSoc(vo.getEndSoc());
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;
domain.setInternetOrderAmount(orderAmount);
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;
domain.setInternetServerAmount(serverAmount);
domain.setInternetDiscountAmount(BigDecimal.ZERO);
BigDecimal payAmount = vo.getOrderTotalAmount()!=null ? BigDecimal.valueOf(vo.getOrderTotalAmount()): BigDecimal.ZERO;
domain.setInternetPayAmount(payAmount);
getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain);
}
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus));
return checkRecordDomainList;
}
/**
* 获取新电途对账数据
* @param dataFile 对账单文件,格式为xlsx
* @return 对账数据
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getXDTInternetDataList(File dataFile) throws Exception {
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<XDTTradebillVo> xdtTradebillVoList = new ArrayList<>();
switch (suffix.toUpperCase()){
case "XLS":
case "XLSX":
ExcelUtil<XDTTradebillVo> util = new ExcelUtil<XDTTradebillVo>(XDTTradebillVo.class);
xdtTradebillVoList = util.importExcel(new FileInputStream(dataFile));
break;
case "CSV":
CsvReader reader = CsvUtil.getReader();
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
xdtTradebillVoList = reader.read(fileReader.readString(), XDTTradebillVo.class);
break;
default: break;
}
for(XDTTradebillVo vo: xdtTradebillVoList){
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.getChargingDegree()!=null? BigDecimal.valueOf(vo.getChargingDegree()): BigDecimal.ZERO;
domain.setInternetChargingDegree(chargingDegree);
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;
domain.setInternetPowerAmount(powerAmount);
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;
domain.setInternetPayAmount(payAmount);
getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain);
}
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus));
return checkRecordDomainList;
}
/**
* 获取快电对账数据
* @param dataFile 对账单文件,格式为xlsx
* @return 对账数据
*/
@Override
public List<XhpcTradebillInternetCheckRecordDomain> getKDInternetDataList(File dataFile) throws Exception {
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
List<XhpcTradebillInternetCheckRecordDomain> checkRecordDomainList = new ArrayList<>();
List<KDTradebillVo> kdTradebillVoList = new ArrayList<>();
switch (suffix.toUpperCase()){
case "XLS":
case "XLSX":
ExcelUtil<KDTradebillVo> util = new ExcelUtil<KDTradebillVo>(KDTradebillVo.class);
kdTradebillVoList = util.importExcel(new FileInputStream(dataFile));
break;
case "CSV":
CsvReader reader = CsvUtil.getReader();
FileReader fileReader = new FileReader(dataFile.getAbsolutePath(), Charset.forName("GBK"));
kdTradebillVoList = reader.read(fileReader.readString(), KDTradebillVo.class);
break;
default: break;
}
for(KDTradebillVo vo: kdTradebillVoList){
XhpcTradebillInternetCheckRecordDomain domain = new XhpcTradebillInternetCheckRecordDomain();
domain.setSource("快电");
domain.setInternetName("快电");
getHistoryOrderInfo(domain);
checkRecordDomainList.add(domain);
}
checkRecordDomainList.sort(Comparator.comparing(XhpcTradebillInternetCheckRecordDomain::getStatus));
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格式
ExcelWriter writer = cn.hutool.poi.excel.ExcelUtil.getWriter(true);
writer.addHeaderAlias("internet_name", "流量方名称");
writer.addHeaderAlias("user_id", "用户账号");
writer.addHeaderAlias("platform_order_number", "平台-订单编号");
writer.addHeaderAlias("platform_charge_station", "平台-充电场站名称");
writer.addHeaderAlias("platform_start_soc", "平台-开始SOC");
writer.addHeaderAlias("platform_end_soc", "平台-结束SOC");
writer.addHeaderAlias("platform_charging_degree", "平台-充电电量");
writer.addHeaderAlias("platform_charging_time", "平台-充电时长");
writer.addHeaderAlias("platform_start_time", "平台-开始充电时间");
writer.addHeaderAlias("platform_end_time", "平台-结束充电时间");
writer.addHeaderAlias("platform_order_amount", "平台-订单总金额");
writer.addHeaderAlias("platform_power_amount", "平台-电费金额");
writer.addHeaderAlias("platform_server_amount", "平台-服务费金额");
writer.addHeaderAlias("platform_discount_amount", "平台-折扣费用");
writer.addHeaderAlias("platform_pay_amount", "平台-实际支付金额");
writer.addHeaderAlias("internet_order_number", "流量方-订单编号");
writer.addHeaderAlias("internet_charge_station", "流量方-充电场站名称");
writer.addHeaderAlias("internet_start_soc", "流量方-开始SOC");
writer.addHeaderAlias("internet_end_soc", "流量方-结束SOC");
writer.addHeaderAlias("internet_charging_degree", "流量方-充电电量");
writer.addHeaderAlias("internet_charging_time", "流量方-充电时长");
writer.addHeaderAlias("internet_start_time", "流量方-开始充电时间");
writer.addHeaderAlias("internet_end_time", "流量方-结束充电时间");
writer.addHeaderAlias("internet_order_amount", "流量方-订单总金额");
writer.addHeaderAlias("internet_power_amount", "流量方-电费金额");
writer.addHeaderAlias("internet_server_amount", "流量方-服务费金额");
writer.addHeaderAlias("internet_discount_amount", "流量方-折扣费用");
writer.addHeaderAlias("internet_pay_amount", "流量方-实际支付金额");
writer.addHeaderAlias("status", "对账状态0-待对账1-对账错误2-对账正确)");
writer.addHeaderAlias("remark", "备注");
writer.setOnlyAlias(true);
writer.write(list, true);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
writer.close();
IoUtil.close(out);
}
private void getHistoryOrderInfo(XhpcTradebillInternetCheckRecordDomain domain){
XhpcHistoryOrderDomain orderDomain = historyOrderMapper.findOneByInternetSerialNumber(domain.getInternetSerialNumber());
if(orderDomain != null){
domain.setHistoryOrderNo(orderDomain.getHistoryOrderId());
domain.setPlatformInternetSerialNumber(orderDomain.getInternetSerialNumber());
domain.setPlatformSerialNumber(orderDomain.getSerialNumber());
domain.setPlatformChargeStation(orderDomain.getChargingStationName());
domain.setPlatformStartSoc(orderDomain.getStartSoc());
domain.setPlatformEndSoc(orderDomain.getEndSoc());
BigDecimal chargingDegree = orderDomain.getChargingDegree() != null?
BigDecimal.valueOf(orderDomain.getChargingDegree()): BigDecimal.ZERO;
domain.setPlatformChargingDegree(chargingDegree);
domain.setPlatformChargingTime(orderDomain.getChargingTime());
domain.setPlatformStartTime(orderDomain.getStartTime());
domain.setPlatformEndTime(orderDomain.getEndTime());
domain.setPlatformOrderAmount(orderDomain.getTotalPrice());
domain.setPlatformPowerAmount(orderDomain.getPowerPriceTotal());
domain.setPlatformServerAmount(orderDomain.getServicePriceTotal());
domain.setPlatformDiscountAmount(orderDomain.getPromotionDiscount());
domain.setPlatformPayAmount(orderDomain.getActPrice());
}
checkoutOrderResult(domain);
}
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){
checkoutStatus = 2;
}
domain.setStatus(checkoutStatus);
}
}

View File

@ -0,0 +1,443 @@
package com.xhpc.tradebill.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.text.csv.CsvData;
import cn.hutool.core.text.csv.CsvReader;
import cn.hutool.core.text.csv.CsvRow;
import cn.hutool.core.text.csv.CsvUtil;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.alibaba.fastjson.JSON;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayDataBillAccountlogQueryRequest;
import com.alipay.api.response.AlipayDataBillAccountlogQueryResponse;
import com.github.binarywang.wxpay.bean.result.WxPayFundFlowResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.xhpc.common.core.utils.SecurityUtils;
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.XhpcTradebillPaymentCheckRecordDomain;
import com.xhpc.tradebill.mapper.XhpcRechargeOrderMapper;
import com.xhpc.tradebill.mapper.XhpcRefundOrderMapper;
import com.xhpc.tradebill.mapper.XhpcTradebillPaymentCheckRecordMapper;
import com.xhpc.tradebill.service.PaymentBillService;
import com.xhpc.tradebill.utils.DownloadUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipFile;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Slf4j
@Service
public class PaymentBillServiceImpl implements PaymentBillService {
public WxPayService wxPayService;
@Resource
AliPayProperties aliPayProperties;
@Resource
XhpcRechargeOrderMapper rechargeOrderMapper;
@Resource
XhpcRefundOrderMapper refundOrderMapper;
@Resource
XhpcTradebillPaymentCheckRecordMapper paymentCheckRecordMapper;
@Override
public XhpcTradebillPaymentCheckRecordDomain getInfoByPk(int pk){
return paymentCheckRecordMapper.selectByPrimaryKey(pk);
}
@Override
public boolean updateInfoByDomain(XhpcTradebillPaymentCheckRecordDomain domain){
domain.setUpdateBy(SecurityUtils.getUserId());
return paymentCheckRecordMapper.updateStatusByPk(domain);
}
@Override
public Integer insertPaymentCheckList(int uploadId, List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckList){
Long userId = SecurityUtils.getUserId();
for(XhpcTradebillPaymentCheckRecordDomain domain: paymentCheckList){
domain.setUploadId(uploadId);
domain.setCreateBy(userId);
domain.setUpdateBy(userId);
}
return paymentCheckRecordMapper.insertCheckList(paymentCheckList);
}
@Override
public Map<String, Object> getStatusTotal(Map<String, Object> params){
List<Map<String, Object>> resultList = paymentCheckRecordMapper.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()){
case "0":
uncheckCount = Integer.parseInt(res.get("total").toString()); break;
case "1":
failCount = Integer.parseInt(res.get("total").toString()); break;
case "2":
successCount = Integer.parseInt(res.get("total").toString()); break;
default: break;
}
}
checkCount = successCount + failCount;
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("successCount", successCount);
resultMap.put("failCount", failCount);
resultMap.put("uncheckCount", uncheckCount);
resultMap.put("checkCount", checkCount);
return resultMap;
}
@Override
public List<XhpcTradebillPaymentCheckRecordDomain> getPaymentCheckList(Map<String, Object> params){
return paymentCheckRecordMapper.selectListByParams(params);
}
/**
* 支付宝订单对账
*
* @param fileUrl 数据文件存放地址
* @return 对账完成的数据列表
*/
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(String fileUrl) throws Exception{
File dataFile = DownloadUtil.downloadFile(fileUrl);
return getAliPayDataList(dataFile);
}
/**
* 支付宝订单对账
*
* @param dataFile 数据文件
* @return 对账完成的数据列表
*/
public List<XhpcTradebillPaymentCheckRecordDomain> getAliPayDataList(File dataFile) throws
Exception {
Long userId = SecurityUtils.getUserId();
List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckRecordDomainList = new ArrayList<>();
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
System.out.println(dataFile.getAbsolutePath());
switch (suffix.toUpperCase()) {
case "CSV":
CsvReader csvReader = CsvUtil.getReader();
CsvData data = csvReader.read(dataFile, CharsetUtil.CHARSET_GBK);
List<CsvRow> rows = data.getRows();
for (CsvRow row : rows) {
// 列数是22则是正文内容
if (row.getRawList().size() != 22) {
continue;
}
// 判断内容是否是中文如果是中文就认为是标题则跳过
if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) {
continue;
}
XhpcTradebillPaymentCheckRecordDomain domain = new XhpcTradebillPaymentCheckRecordDomain();
domain.setCreateBy(userId);
domain.setUpdateBy(userId);
domain.setPaymentChannel(2);
domain.setPaymentUserId(row.get(12));
domain.setPaymentPayTime(DateUtil.parse(row.get(1)));
BigDecimal paymentAmount = BigDecimal.ZERO;
if (row.get(5).equals("在线支付")) {
// 充值订单
domain.setPaymentPayNumber(row.get(4).trim().replaceAll("`", "").replaceAll("'", ""));
domain.setOrderType(1);
System.out.println(row);
paymentAmount = row.get(6) != null && !"".equals(row.get(6).trim())? new BigDecimal(row.get(6)): BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount);
XhpcRechargeOrderDomain rechargeOrderDomain = rechargeOrderMapper.findOneByOrderNumber(row.get(4));
if (rechargeOrderDomain != null) {
domain.setPlatformOrderNumber(rechargeOrderDomain.getRechargeOrderNumber());
domain.setPlatformUserId(rechargeOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(rechargeOrderDomain.getRechargeOrderId().toString());
domain.setPlatformAmount(rechargeOrderDomain.getAmount());
domain.setPlatformPayTime(rechargeOrderDomain.getUpdateTime());
}
} else if (row.get(5).equals("转账")) {
// 退款订单
domain.setPaymentPayNumber(row.get(16).trim().replaceAll("`", "").replaceAll("'", "").replaceAll("单笔转账--", ""));
domain.setOrderType(2);
paymentAmount = row.get(7) != null && !"".equals(row.get(7).trim())? new BigDecimal(row.get(7)): BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount);
XhpcRefundOrderDomain refundOrderDomain = refundOrderMapper.findByOrderNumber(row.get(4));
if (refundOrderDomain != null) {
domain.setPlatformOrderNumber(refundOrderDomain.getRefundOrderNumber());
domain.setPlatformUserId(refundOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(refundOrderDomain.getRefundOrderId().toString());
domain.setPlatformAmount(refundOrderDomain.getAmount());
domain.setPlatformPayTime(refundOrderDomain.getUpdateTime());
}
}
paymentCheckRecordDomainList.add(computeTradebillData(domain));
}
break;
case "ZIP":
ZipFile zip = new ZipFile(dataFile);
File file = null;
for (Enumeration<ZipEntry> enumeration = zip.getEntries(); enumeration.hasMoreElements(); ) {
ZipEntry entry = enumeration.nextElement();
InputStream in = zip.getInputStream(entry);
if (entry.isDirectory()) {
continue;
}
file = File.createTempFile("alipay_", entry.getName().substring(entry.getName().lastIndexOf(".")));
OutputStream outputStream = new FileOutputStream(file);
byte[] buff = new byte[1024];
int len;
while ((len = in.read(buff)) > 0) {
outputStream.write(buff, 0, len);
}
in.close();
outputStream.close();
}
if (file != null) {
paymentCheckRecordDomainList = getAliPayDataList(file);
}
break;
default:
throw new Exception("暂不支持的文件格式");
}
paymentCheckRecordDomainList.sort(Comparator.comparing(XhpcTradebillPaymentCheckRecordDomain::getStatus));
return paymentCheckRecordDomainList;
}
/**
* 微信订单对账
*
* @param fileUrl 数据文件存放地址
* @return 对账完成的数据列表
*/
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(String fileUrl) throws Exception {
File dataFile = DownloadUtil.downloadFile(fileUrl);
return getWechatDataList(dataFile);
}
/**
* 微信订单对账
*
* @param dataFile 数据文件
* @return 对账完成的数据列表
*/
public List<XhpcTradebillPaymentCheckRecordDomain> getWechatDataList(File dataFile) throws Exception {
Long userId = SecurityUtils.getUserId();
List<XhpcTradebillPaymentCheckRecordDomain> paymentCheckRecordDomainList = new ArrayList<>();
String suffix = dataFile.getName().substring(dataFile.getName().lastIndexOf(".") + 1);
if ("CSV".equalsIgnoreCase(suffix)) {// 微信充值订单格式
CsvReader csvReader = CsvUtil.getReader();
CsvData data = csvReader.read(dataFile);
List<CsvRow> rows = data.getRows();
for (CsvRow row : rows) {
// 列数是6则是充值订单
// 列数是13则是退款订单
if (row.getRawList().size() != 6 && row.getRawList().size() != 13) {
continue;
}
XhpcTradebillPaymentCheckRecordDomain domain = new XhpcTradebillPaymentCheckRecordDomain();
domain.setPaymentChannel(1);
domain.setCreateBy(userId);
domain.setUpdateBy(userId);
if (row.getRawList().size() == 6) {
if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) {
continue;
}
domain.setOrderType(1);
domain.setPaymentPayNumber(StringFormat(row.get(2)));
BigDecimal paymentAmount = row.get(5)!=null &&!"".equals(row.get(5).trim())? new BigDecimal(StringFormat(row.get(5))) : BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount);
domain.setPaymentPayTime(DateUtil.parse(row.get(0)));
XhpcRechargeOrderDomain rechargeOrderDomain = rechargeOrderMapper.findOneByOrderNumber(StringFormat(row.get(2)));
if(rechargeOrderDomain != null){
domain.setPlatformOrderNumber(rechargeOrderDomain.getRechargeOrderNumber());
domain.setPlatformUserId(rechargeOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(rechargeOrderDomain.getRechargeOrderId().toString());
domain.setPlatformAmount(rechargeOrderDomain.getAmount());
domain.setPlatformPayTime(rechargeOrderDomain.getUpdateTime());
}
} else if (row.getRawList().size() == 13) {
// 微信退款订单
if (row.get(0).getBytes(StandardCharsets.UTF_8).length != row.get(0).length()) {
continue;
}
domain.setOrderType(2);
domain.setPaymentPayNumber(StringFormat(row.get(2)));
BigDecimal paymentAmount = row.get(10) != null && ! "".equals(row.get(10).trim()) ?
new BigDecimal(StringFormat(row.get(10)))
: BigDecimal.ZERO;
domain.setPaymentAmount(paymentAmount);
domain.setPaymentUserId(StringFormat(row.get(4)));
domain.setPaymentPayTime(DateUtil.parse(row.get(6)));
XhpcRefundOrderDomain refundOrderDomain = refundOrderMapper.findByOrderNumber(StringFormat(row.get(2)));
if (refundOrderDomain!=null){
domain.setPlatformOrderNumber(refundOrderDomain.getRefundOrderNumber());
domain.setPlatformUserId(refundOrderDomain.getUserId().toString());
domain.setPlatformPayNumber(refundOrderDomain.getRefundOrderId().toString());
domain.setPlatformAmount(refundOrderDomain.getAmount());
domain.setPlatformPayTime(refundOrderDomain.getUpdateTime());
}
}
paymentCheckRecordDomainList.add(computeTradebillData(domain));
}
} else {
throw new Exception("暂不支持的文件格式");
}
paymentCheckRecordDomainList.sort(Comparator.comparing(XhpcTradebillPaymentCheckRecordDomain::getStatus));
return paymentCheckRecordDomainList;
}
private String StringFormat(String dataStr){
return dataStr.replaceAll("'", "").replaceAll("`", "");
}
/**
* 计算财务支付数据和订单是否对照正常
*
* @param domain 需对账的数据
* @return 对账完成的数据
*/
public XhpcTradebillPaymentCheckRecordDomain computeTradebillData(XhpcTradebillPaymentCheckRecordDomain domain) {
if (domain.getPaymentAmount().equals(domain.getPlatformAmount())) {
domain.setStatus(2);
} else {
domain.setStatus(0);
}
return domain;
}
/**
* 使用微信支付SDK获取账单信息
*
* @param billDate 账单日期格式2021-12-20
* @return 账单数据
* @throws WxPayException 异常
*/
public WxPayFundFlowResult getWechatPayBill(String billDate) throws WxPayException {
return this.wxPayService.downloadFundFlow(billDate,
WeixinPayConstant.ACCOUNT_TYPE_BASIC,
WeixinPayConstant.TAR_TYPE_GZIP);
}
/**
* 使用支付宝SDK获取账单信息
*
* @param startTime 账单开始时间
* @param endTime 账单结束时间
* @return 账单数据
* @throws Exception 异常
*/
public AlipayDataBillAccountlogQueryResponse getAliPayBill(String startTime, String endTime) throws
Exception {
try {
AlipayClient alipayClient = new DefaultAlipayClient(aliPayProperties.getGatewayDomain(),
aliPayProperties.getAppId(),
aliPayProperties.getPrivateKey(),
aliPayProperties.getPublicKey(),
"json", "GBK", "RSA2");
AlipayDataBillAccountlogQueryRequest request = new AlipayDataBillAccountlogQueryRequest();
HashMap<String, String> params = new HashMap<>();
params.put("start_time", startTime);
params.put("end_time", endTime);
params.put("page_no", "1");
params.put("page_size", "2000");
request.setBizContent(JSON.toJSONString(params));
log.debug(JSON.toJSONString(params));
AlipayDataBillAccountlogQueryResponse response = alipayClient.execute(request);
if (response.isSuccess()) {
log.info("调用支付宝对账接口成功");
return response;
} else {
log.debug("调用支付宝对账接口失败, 失败原因:" + response.getMsg());
throw new AlipayApiException(response.getMsg());
}
} catch (Exception e) {
throw new Exception(e.getMessage());
}
}
@Override
public void export(HttpServletResponse response, Map<String, Object> params) throws Exception{
List<Map<String, Object>> list = paymentCheckRecordMapper.selectByParams(params);
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.addHeaderAlias("order_type", "订单类型1-充值2-退款)");
writer.addHeaderAlias("paymengt_channel", "支付渠道1-微信2-支付宝)");
writer.addHeaderAlias("platform_order_number", "平台-订单编号");
writer.addHeaderAlias("platform_user_id", "平台-用户帐号");
writer.addHeaderAlias("platform_amount", "平台-支付金额");
writer.addHeaderAlias("platform_pay_time", "平台-支付时间");
writer.addHeaderAlias("payment_pay_number", "支付方-订单编号");
writer.addHeaderAlias("payment_user_id", "支付方-用户帐号");
writer.addHeaderAlias("payment_amount", "支付方-支付金额");
writer.addHeaderAlias("payment_pay_time", "支付方-支付时间");
writer.addHeaderAlias("status", "对账状态0-待对账1-对账错误2-对账正确)");
writer.addHeaderAlias("remark", "备注");
writer.setOnlyAlias(true);
writer.write(list, true);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
ServletOutputStream out = response.getOutputStream();
writer.flush(out, true);
writer.close();
IoUtil.close(out);
}
}

View File

@ -0,0 +1,18 @@
package com.xhpc.tradebill.utils;
import cn.hutool.http.HttpUtil;
import com.xhpc.common.core.utils.StringUtils;
import java.io.File;
public class DownloadUtil {
public static File downloadFile(String fileUrl) throws Exception {
if (StringUtils.isEmpty(fileUrl)) {
throw new Exception("文件地址为空");
}
String suffix = fileUrl.substring(fileUrl.lastIndexOf("."));
return HttpUtil.downloadFileFromUrl(fileUrl, File.createTempFile("temp_", suffix));
}
}

View File

@ -0,0 +1,96 @@
package com.xhpc.tradebill.vo;
import cn.hutool.core.annotation.Alias;
import com.xhpc.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 恒大对账单对象
*/
@Data
public class HDTradebillVo {
@Excel(name = "订单号")
@Alias("订单号")
private String orderNo = "";
@Excel(name = "分账时间")
@Alias("分账时间")
private Date billDate;
@Excel(name = "分账商户名称")
@Alias("分账商户名称")
private String billAccount = "";
@Excel(name = "场站名称")
@Alias("场站名称")
private String stationName = "";
@Excel(name = "总电量")
@Alias("总电量")
private Double chargeDegree = 0.0;
@Excel(name = "订单电费总额")
@Alias("订单电费总额")
private Double powerAmount = 0.0;
@Excel(name = "订单服务费总额")
@Alias("订单服务费总额")
private Double ServerAmount = 0.0;
@Excel(name = "订单总金额")
@Alias("订单总金额")
private Double orderTotalAmount = 0.0;
@Excel(name = "客戶实付电费")
@Alias("客戶实付电费")
private Double customerPowerAmount = 0.0;
@Excel(name = "客户实付服务费")
@Alias("客户实付服务费")
private Double customerServerAmount = 0.0;
@Excel(name = "客戶实付总金额")
@Alias("客戶实付总金额")
private Double customerTotalAmount = 0.0;
@Excel(name = "运营商补贴电费")
@Alias("运营商补贴电费")
private Double operatorDiscountPowerAmount;
@Excel(name = "运营商补贴服务费")
@Alias("运营商补贴服务费")
private Double operatorDiscountServerAmount = 0.0;
@Excel(name = "运营商补贴总金额")
@Alias("运营商补贴总金额")
private Double operatorDiscountTotalAmount = 0.0;
@Excel(name = "充电通补贴电费")
@Alias("充电通补贴电费")
private Double internetDiscountPowerAmount = 0.0;
@Excel(name = "充电通补贴服务费")
@Alias("充电通补贴服务费")
private Double internetDiscountServerAmount = 0.0;
@Excel(name = "充电通补贴总金额")
@Alias("充电通补贴总金额")
private Double internetDiscountTotalAmount = 0.0;
@Excel(name = "充电通补贴分账实得")
@Alias("充电通补贴分账实得")
private Double internetRealAmount = 0.0;
@Excel(name = "客戶实付分账实得")
@Alias("客戶实付分账实得")
private Double customerRealAmount = 0.0;
@Excel(name = "总资产入账金额")
@Alias("总资产入账金额")
private Double totalAmount = 0.0;
}

View File

@ -0,0 +1,9 @@
package com.xhpc.tradebill.vo;
import lombok.Data;
@Data
public class KDTradebillVo {
}

View File

@ -0,0 +1,133 @@
package com.xhpc.tradebill.vo;
import cn.hutool.core.annotation.Alias;
import com.xhpc.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 新电途对账单对象
*/
@Data
public class XDTTradebillVo {
@Excel(name = "订单时间")
@Alias("订单时间")
private Date orderTime;
@Excel(name = "订单号")
@Alias("订单号")
private String orderNo = "";
@Excel(name = "订单类型")
@Alias("订单类型")
private String orderType = "";
@Excel(name = "异常类型")
@Alias("异常类型")
private String exceptionType = "";
@Excel(name = "城市")
@Alias("城市")
private String city = "";
@Excel(name = "站点名称")
@Alias("站点名称")
private String stationName = "";
@Excel(name = "充电量")
@Alias("充电量")
private Double chargingDegree = 0.0;
@Excel(name = "订单金额")
@Alias("订单金额")
private Double orderAmount = 0.0;
@Excel(name = "运营商承担费用")
@Alias("运营商承担费用")
private Double operatorCost = 0.0;
@Excel(name = "新电途承担费用")
@Alias("新电途承担费用")
private Double xdtCost = 0.0;
@Excel(name = "本期新电途补贴金额")
@Alias("本期新电途补贴金额")
private Double xdtSubsidyAmount = 0.0;
@Excel(name = "历史新电途补贴金额")
@Alias("历史新电途补贴金额")
private Double xdtHistorySubsidyAmount = 0.0;
@Excel(name = "本期用户实付金额")
@Alias("本期用户实付金额")
private Double payAmount = 0.0;
@Excel(name = "历史用户实付金额")
@Alias("历史用户实付金额")
private Double payHistoryAmount = 0.0;
@Excel(name = "未结清金额")
@Alias("未结清金额")
private Double outStandingAmount = 0.0;
@Excel(name = "坏账金额")
@Alias("坏账金额")
private Double badDebtsAmount = 0.0;
@Excel(name = "新电途线上分润金额")
@Alias("新电途线上分润金额")
private Double xdtOnlineAmount = 0.0;
@Excel(name = "新电途线下分润金额")
@Alias("新电途线下分润金额")
private Double xdtOfflineAmount = 0.0;
@Excel(name = "本期支付手续费")
@Alias("本期支付手续费")
private Double handlingFeeAmount = 0.0;
@Excel(name = "历史支付手续费")
@Alias("历史支付手续费")
private Double handlingFeeHistoryAmount = 0.0;
@Excel(name = "平台分润方式")
@Alias("平台分润方式")
private String profitSharingMethod = "";
@Excel(name = "自动扣除平台活费用")
@Alias("自动扣除平台活费用")
private String autoDiscountAmount = "";
@Excel(name = "充电费")
@Alias("充电费")
private Double powerAmount = 0.0;
@Excel(name = "服务费")
@Alias("服务费")
private Double serverAmount = 0.0;
@Excel(name = "附加费")
@Alias("附加费")
private Double surchargeAmount = 0.0;
@Excel(name = "结算状态")
@Alias("结算状态")
private String checkedStatus = "";
@Excel(name = "订单渠道")
@Alias("订单渠道")
private String orderSource = "";
@Excel(name = "结算日期")
@Alias("结算日期")
private Date checkoutDate;
@Excel(name = "分润账号")
@Alias("分润账号")
private String profitSharingAccount = "";
}

View File

@ -0,0 +1,177 @@
package com.xhpc.tradebill.vo;
import cn.hutool.core.annotation.Alias;
import com.xhpc.common.core.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 小桔对账单对象
*/
@Data
public class XJTradeBillVo {
@Excel(name = "订单id")
@Alias("订单id")
private String orderNo = "";
@Excel(name = "外部订单id")
@Alias("外部订单id")
private String operatorOrderNo = "";
@Excel(name = "城市")
@Alias("城市")
private String city = "";
@Excel(name = "运营商")
@Alias("运营商")
private String operator = "";
@Excel(name = "商户")
@Alias("商户")
private String merchant = "";
@Excel(name = "充电站名称")
@Alias("充电站名称")
private String stationName = "";
@Excel(name = "订单充电时长(分钟)")
@Alias("订单充电时长(分钟)")
private Integer chargingTime = 0;
@Excel(name = "订单充电量(度)")
@Alias("订单充电量(度)")
private Double chargingDegree = 0.0;
@Excel(name = "充电前soc")
@Alias("充电前soc")
private String startSoc = "";
@Excel(name = "充电后soc")
@Alias("充电后soc")
private String endSoc = "";
@Excel(name = "挂单状态")
@Alias("挂单状态")
private String orderStatus = "";
@Excel(name = "充电状态")
@Alias("充电状态")
private String chargingStatus = "";
@Excel(name = "异常类型")
@Alias("异常类型")
private String exceptionType = "";
@Excel(name = "订单来源")
@Alias("订单来源")
private String orderSource = "";
@Excel(name = "启动方式")
@Alias("启动方式")
private String startType = "";
@Excel(name = "实体卡号")
@Alias("实体卡号")
private String physicalCardNo = "";
@Excel(name = "创建订单时间")
@Alias("创建订单时间")
private Date orderStartTime;
@Excel(name = "充电开始时间")
@Alias("充电开始时间")
private Date chargingStartTime;
@Excel(name = "充电完成时间")
@Alias("充电完成时间")
private Date chargingEndTime;
@Excel(name = "账单生成时间")
@Alias("账单生成时间")
private Date billCreateTime;
@Excel(name = "支付完成时间")
@Alias("支付完成时间")
private Date orderPayTime;
@Excel(name = "充电枪ID")
@Alias("充电枪ID")
private Long gunId = 0L;
@Excel(name = "充电桩类型")
@Alias("充电桩类型")
private String pileType = "";
@Excel(name = "活动价总额(元)")
@Alias("活动价总额(元)")
private Double orderTotalAmount = 0.0;
@Excel(name = "电费-活动价(元)")
@Alias("电费-活动价(元)")
private Double orderPowerAmount = 0.0;
@Excel(name = "服务费-活动价(元)")
@Alias("服务费-活动价(元)")
private Double orderServerAmount = 0.0;
@Excel(name = "账单总金额")
@Alias("账单总金额")
private Double billAmount = 0.0;
@Excel(name = "支付状态")
@Alias("支付状态")
private String paymentStatus = "";
@Excel(name = "支付渠道")
@Alias("支付渠道")
private String paymentChannel = "";
@Excel(name = "卡ID")
@Alias("卡ID")
private String cardID = "";
@Excel(name = "尖时电量")
@Alias("尖时电量")
private Double tipChargingDegree = 0.0;
@Excel(name = "峰时电量")
@Alias("峰时电量")
private Double peakChargingDegree = 0.0;
@Excel(name = "平时电量")
@Alias("平时电量")
private Double flatChargingDegree = 0.0;
@Excel(name = "谷时电量")
@Alias("谷时电量")
private Double valleyChargingDegree = 0.0;
@Excel(name = "车型")
@Alias("车型")
private String carType = "";
@Excel(name = "VIN码")
@Alias("VIN码")
private String vinCode = "";
@Excel(name = "车牌号")
@Alias("车牌号")
private String carNo = "";
@Excel(name = "自编号")
@Alias("自编号")
private String serialNumber = "";
@Excel(name = "路线")
@Alias("路线")
private String line = "";
@Excel(name = "所属公司")
@Alias("所属公司")
private String company = "";
}

View File

@ -0,0 +1,9 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
,--.
,--. ,--. | ,---. ,---. ,---.
\ `' / | .-. | | .-. | | .--'
/ /. \ | | | | | '-' ' \ `--.
'--' '--' `--' `--' | |-' `---'
`--'

View File

@ -0,0 +1,90 @@
# Tomcat
server:
port: 8889
# Spring
spring:
application:
# 应用名称
name: xhpc-tradebill
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
root: info
com.xhpc.tradebill.mapper: debug
file:
path: "d:\\logs"
pattern:
console: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n'
file: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n'
wx:
pay:
appId: "wxd0a48e00319ef8a7"
mchId: "1514355771"
mchKey: "sichuanxianghuakejiyouxiangongsi"
keyPath:
alibaba:
pay:
gatewayDomain: "https://openapi.alipay.com/gateway.do"
serverDomain: "https://www.scxhua.cn/prod-api/xhpc-payment/alipay/notifyUrl"
publicKey:
privateKey: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ"
appId: "2021002156615717"
certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"
###获取微信openid地址
#WXGETJSCODE: "https://api.weixin.qq.com/sns/jscode2session?appid=wxb14ef93e9b7901f3&secret=b5c5672141b5930c30a1abee95a2dcbf&js_code="
###阿里云身份证验证地址
#VERIFYCARD: "http://idenauthen.market.alicloudapi.com/idenAuthentication"
##阿里云身份证验证地址appcode
#APPCODE: "APPCODE e26d9088b58e24af69411d5933cece47"
##小程序appid
#APPID: "wxd0a48e00319ef8a7"
##小程序绑定商户id
#MCHID: "1514355771"
##商户后台设置的key
#KEY: "sichuanxianghuakejiyouxiangongsi"
##微信小程序支付地址
#WXPAYUNIFIEDORDER: "https://api.mch.weixin.qq.com/pay/unifiedorder"
##微信支付回调地址
#SERVERDOMAIN: "http://www.scxhua.cn/prod-api/xhpc-payment/wx/paymentCallback"
##微信小程序支付地址
#WXTRANSFERS: "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"
##支付宝支付回调地址
#ALIPAYPSERVERDOMAIN: "https://www.scxhua.cn/prod-api/xhpc-payment/alipay/notifyUrl"
##支付宝公钥
#ALIPAYPUBLICKEY:
##应用私钥
#ALIPAYPRIVATEKEY: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCGHX1s315EKjoIBkNiF3IxCAmvtVg+TdCDL/XmJZWdcZ23tEWmmIMsLRCLUKsaPfTEhnqD6EFJnmpJu4teDImo3aDbOoO31YFEXjMXUnTTS/dtDVEo1OecsRL+Re43KSohOkIL1TMyTuNfeIglQTuhCSZ3LOEOx4OHpYwcrLp8p1ORvAS7x35nsmjLp3oQTJo9RWfzfEaKbm6cxsWLKyr5/5eGDXrUHNC5hIDLjoJbe6iqNKyIiPJHtPZfJ36PcWa7PFvx4X+Ded32KZb2AA3p9w/HX7gn1MnRfT5NGH0k3ggxLNarDU8g6JjQYgNtmE/R8gbp99BudZNfDoSF1llNAgMBAAECggEAaTa9bSoXM/bErALt3ghyx1B8+OGVpts5F5IKoVEe/PNjPfkpIzdGwONhtUnF0cKFQaAWgWE1xuGGlO2Sumevn1Cvnw1axF+1F8Om5UcE67cPFvh5kUTlpyGrutt1tMSQjpy7r7jEf1UwP3e5pzBz7TPWf2wv635OC56uOtivPJZ+8vg7VYon/mNXQuL4AavoxfSDtvo0ad30X2fK1WKeeBtgiT4UzV6ZGZh5igKQHM4lVvmbo/jOeQD0KAod7pRe/h4FBFmCVIWwgW+I+Hnzp8A/nJezoowJ3jiTt0FodC9uBCT64ZCz5dVCryD62LDVjKBxB7cfIoQA+PxCiXr9QQKBgQD+2v38J/MlfK/XCYldclzumizwIw6T0Mv6XvYwXQHYgYDKYNF6k1LhMEUo7fP3EsPdV8h/nXmdU4qadOVm6QSJ/rGEl22yGlO7woUzTY/Ls9eknoqfMYuyI1+ICMnNxmesQbWyc0cOHh44cEF+icfJxEDAmrHGLmBVsKuLUJUuVQKBgQCGt663TF7mixghiUOcT11zC1fqG+dIcvAwHpCHfdxsniYRqnv+SLf6eC5PCkQ5aNAAl/ywOLQAWS0XgYti3LyZ4iuGIYcUE0IDDmhWl68V27iXcLIK+rBRqBGxSdk8xR+zSE8fpO4mXpxn8SH0Butex8PJ+oHTbmdXIUAXdn6HGQKBgQCvAB1rqtsRoL72ADxtCHy78u5srwXxhmyqrc6LgzIjQzn2vejaLJO6wfSbmFnwDNimAwNQbgf2ekkwqphjxBozz8qB66GNrPpWccoZYmcdT48CIUO68MCmQBf3R2GbhWPnKu/ja7kc/p1tz9eJVn70E2kLWK4+EdZgwQHqlhj6SQKBgF4AmbdpYOb5s9Li1vyhHJIEHkpLQi15lkPdb/g7SK26BNJa5b5fu5DYf2fDwCtXCZ0AcN/+EQwVLbOzPzGy2R9/g+NKTdkiPvOnAAM8QH2+HaX+ix3CI3o3DnFpGF6hJieRkzR/f3Ximryks451rZMrTWEIncKMzSstFm3Izy0xAoGBAJQaMqlzpM+QaJiytJNeqRpPWRsi0Dkf4XqJXPWLOrApSISsafZF5vk2ZOeIqRsVCBH3LdfVIJxEBAF4l/Sd2q7xC9JHawJDqa4ea7VwL68ANH2w3jcJ3j6DQqf7NIe/lSGxYF6Jt+74oRFHxN3GDSf+z91DYfZz8hQnyphKDNEJ"
##支付宝appid
#ALIPAYAPPID: "2021002156615717"
##应用公钥证书路径
#CERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
##支付宝公钥证书路径
#PUBLICCERTPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
##支付宝根证书路径
#ROOTCRETPATH: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="logs/xhpc-order"/>
<!-- 日志输出格式 -->
<property name="log.pattern"
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.xhpc" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.EtOrderMappingMapper">
<select id="selectByXhOrderNo" resultType="com.xhpc.tradebill.domain.EtOrderMappingDomain">
select * from et_order_mapping where xh_order_no = #{xhOrderNo}
</select>
<select id="selectByEvcsOrderNo" resultType="com.xhpc.tradebill.domain.EtOrderMappingDomain">
select * from et_order_mapping where evcs_order_no = #{evcsOrderNo}
</select>
</mapper>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcChargeOrderMapper">
</mapper>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcHistoryOrderMapper">
<select id="findOneBySerialNumber" resultType="com.xhpc.tradebill.domain.XhpcHistoryOrderDomain">
select
o.*,
s.name as 'charging_station_name'
from
xhpc_history_order o
left join xhpc_charging_station s on o.charging_station_id=s.charging_station_id
where serial_number=#{serialNumber}
</select>
<select id="findOneByInternetSerialNumber" resultType="com.xhpc.tradebill.domain.XhpcHistoryOrderDomain">
select
o.*,
s.name as 'charging_station_name',
c.charging_degree as 'charging_degree',
c.charging_time as 'charging_time'
from xhpc_history_order o
left join xhpc_charging_station s on o.charging_station_id=s.charging_station_id
left join xhpc_charge_order c on o.charge_order_id=c.charge_order_id
where o.internet_serial_number=#{internetSerialNumber}
</select>
</mapper>

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcRechargeOrderMapper">
<resultMap type="com.xhpc.tradebill.domain.XhpcRechargeOrderDomain" id="XhpcRechargeOrderResult">
<result column="recharge_order_id" property="rechargeOrderId" />
<result column="user_id" property="userId" />
<result column="recharge_order_number" property="rechargeOrderNumber"/>
<result column="prepay_id" property="prepayId" />
<result column="alipay_number" property="alipayNumber" />
<result column="amount" property="amount" />
<result column="type" property="type" />
<result column="status" property="status" />
<result column="del_flag" property="delFlag" />
<result column="create_time" property="createTime" />
<result column="create_by" property="createBy" />
<result column="update_time" property="updateTime" />
<result column="update_by" property="updateBy" />
<result column="source" property="source" />
</resultMap>
<select id="findOneByOrderNumber" resultType="com.xhpc.tradebill.domain.XhpcRechargeOrderDomain">
select
*
from xhpc_recharge_order
where recharge_order_number=#{orderNumber}
</select>
</mapper>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcRefundOrderMapper">
<resultMap type="com.xhpc.tradebill.domain.XhpcRefundOrderDomain" id="XhpcRefundOrderResult">
<result column="refund_order_id" property="refundOrderId"/>
<result column="refund_order_number" property="refundOrderNumber"/>
<result column="user_id" property="userId"/>
<result column="open_id" property="openId"/>
<result column="alipay_id" property="alipayId"/>
<result column="amount" property="amount"/>
<result column="type" property="type"/>
<result column="examine_status" property="examineStatus"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="source" property="source" />
</resultMap>
<select id="findByOrderNumber" resultType="com.xhpc.tradebill.domain.XhpcRefundOrderDomain">
select * from xhpc_refund_order where refund_order_number=#{orderNumber}
</select>
</mapper>

View File

@ -0,0 +1,593 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcTradebillInternetCheckRecordMapper">
<resultMap id="BaseResultMap" type="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
<result column="upload_id" jdbcType="INTEGER" property="uploadId"/>
<result column="history_order_no" jdbcType="BIGINT" property="historyOrderNo"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="internet_name" jdbcType="VARCHAR" property="internetName"/>
<result column="platform_internet_serial_number" jdbcType="VARCHAR" property="platformInternetSerialNumber"/>
<result column="platform_charge_station" jdbcType="VARCHAR" property="platformChargeStation"/>
<result column="platform_start_soc" jdbcType="VARCHAR" property="platformStartSoc"/>
<result column="platform_end_soc" jdbcType="VARCHAR" property="platformEndSoc"/>
<result column="platform_charging_degree" jdbcType="DECIMAL" property="platformChargingDegree"/>
<result column="platform_charging_time" jdbcType="VARCHAR" property="platformChargingTime"/>
<result column="platform_start_time" jdbcType="TIMESTAMP" property="platformStartTime"/>
<result column="platform_end_time" jdbcType="TIMESTAMP" property="platformEndTime"/>
<result column="platform_order_amount" jdbcType="DECIMAL" property="platformOrderAmount"/>
<result column="platform_power_amount" jdbcType="DECIMAL" property="platformPowerAmount"/>
<result column="platform_server_amount" jdbcType="DECIMAL" property="platformServerAmount"/>
<result column="platform_discount_amount" jdbcType="DECIMAL" property="platformDiscountAmount"/>
<result column="platform_pay_amount" jdbcType="DECIMAL" property="platformPayAmount"/>
<result column="internet_serial_number" jdbcType="VARCHAR" property="internetSerialNumber"/>
<result column="internet_charge_station" jdbcType="VARCHAR" property="internetChargeStation"/>
<result column="internet_start_soc" jdbcType="VARCHAR" property="internetStartSoc"/>
<result column="internet_end_soc" jdbcType="VARCHAR" property="internetEndSoc"/>
<result column="internet_charging_degree" jdbcType="DECIMAL" property="internetChargingDegree"/>
<result column="internet_charging_time" jdbcType="VARCHAR" property="internetChargingTime"/>
<result column="internet_start_time" jdbcType="TIMESTAMP" property="internetStartTime"/>
<result column="internet_end_time" jdbcType="TIMESTAMP" property="internetEndTime"/>
<result column="internet_order_amount" jdbcType="DECIMAL" property="internetOrderAmount"/>
<result column="internet_power_amount" jdbcType="DECIMAL" property="internetPowerAmount"/>
<result column="internet_server_amount" jdbcType="DECIMAL" property="internetServerAmount"/>
<result column="internet_discount_amount" jdbcType="DECIMAL" property="internetDiscountAmount"/>
<result column="internet_pay_amount" jdbcType="DECIMAL" property="internetPayAmount"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="status" jdbcType="SMALLINT" property="status"/>
</resultMap>
<sql id="Base_Column_List">
id, create_time, create_by, update_time, update_by, upload_id, history_order_no,
user_id, internet_name, platform_internet_serial_number, platform_charge_station, platform_start_soc,
platform_end_soc, platform_charging_degree, platform_charging_time, platform_start_time,
platform_end_time, platform_order_amount, platform_power_amount, platform_server_amount,
platform_discount_amount, platform_pay_amount, internet_serial_number, internet_charge_station,
internet_start_soc, internet_end_soc, internet_charging_degree, internet_charging_time, internet_start_time,
internet_end_time, internet_order_amount, internet_power_amount, internet_server_amount, internet_discount_amount,
internet_pay_amount, remark, `status`
</sql>
<select id="selectByParams" resultType="java.util.Map">
select
<include refid="Base_Column_List"/>
from xhpc_tradebill_internet_check_record
<where>
<if test="params.uploadId != null and params.uploadId != ''">
and upload_id = #{params.uploadId}
</if>
<if test="params.internetName != null and params.internetName != ''">
and internet_name = #{params.internetName}
</if>
<if test="params.platformChargeStation != null and params.platformChargeStation != '' ">
and platform_charge_station = #{params.platformChargeStation}
</if>
<if test="params.checkStatus != null and params.checkStatus != ''">
and status = #{params.checkStatus}
</if>
</where>
</select>
<select id="selectListByParams" resultType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain">
select
p.*, cu.user_name as 'create_name', uu.user_name as 'update_name',
case when p.status=0 then '未对账' when p.status=1 then '对账错误' when p.status=2 then '对账正确' else '未知' end as
'status_name'
from xhpc_tradebill_internet_check_record p
left join sys_user cu on cu.user_id=p.create_by
left join sys_user uu on uu.user_id=p.update_by
<where>
<if test="params.uploadId != null and params.upload!='' and params.uploadId !=0">
and p.upload_id = #{params.uploadId}
</if>
<if test="params.orderNumber != null and params.orderNumber!=''">
and p.internet_serial_number like concat('%',#{params.orderNumber}, '%')
</if>
<if test="params.stationName != null and params.stationName!=''">
and p.internet_charge_station like concat('%', #{params.internetName},'%')
</if>
<if test="params.internetName != null and params.internetName!=''">
and p.internet_name like concat('%', #{params.internetName},'%')
</if>
<if test="params.status != null and params.status!=''">
and p.status = #{params.status}
</if>
</where>
order by p.upload_id desc, status asc
</select>
<select id="selectTotalGroupbyStatus" resultType="java.util.Map">
select
status, count(id) as 'total'
from xhpc_tradebill_internet_check_record
<where>
<if test="params.uploadId != null and params.upload!='' and params.uploadId !=0">
and upload_id = #{params.uploadId}
</if>
<if test="params.orderNumber != null and params.orderNumber!=''">
and internet_serial_number like concat('%',#{params.orderNumber}, '%')
</if>
<if test="params.stationName != null and params.stationName!=''">
and internet_charge_station like concat('%', #{params.internetName},'%')
</if>
<if test="params.internetName != null and params.internetName!=''">
and internet_name like concat('%', #{params.internetName}, '%')
</if>
<if test="params.status != null and params.status!=''">
and status = #{params.status}
</if>
</where>
group by status
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_tradebill_internet_check_record
where id = #{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from xhpc_tradebill_internet_check_record
where id = #{id}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_internet_check_record (create_time, create_by, update_time,
update_by, upload_id, history_order_no,
user_id, internet_name, platform_internet_serial_number,
platform_serial_number,
platform_charge_station, platform_start_soc,
platform_end_soc, platform_charging_degree,
platform_charging_time, platform_start_time,
platform_end_time, platform_order_amount,
platform_power_amount, platform_server_amount,
platform_discount_amount, platform_pay_amount,
internet_serial_number, internet_charge_station,
internet_start_soc,
internet_end_soc, internet_charging_degree,
internet_charging_time,
internet_start_time, internet_end_time, internet_order_amount,
internet_power_amount, internet_server_amount,
internet_discount_amount,
internet_pay_amount, remark, `status`)
values (now(), #{createBy}, now(),
#{updateBy}, #{uploadId}, #{historyOrderNo},
#{userId}, #{internetName},
#{platformInternetSerialNumber},#{platformSerialNumber},
#{platformChargeStation}, #{platformStartSoc},
#{platformEndSoc}, #{platformChargingDegree},
#{platformChargingTime}, #{platformStartTime},
#{platformEndTime}, #{platformOrderAmount},
#{platformPowerAmount}, #{platformServerAmount},
#{platformDiscountAmount}, #{platformPayAmount},
#{internetSerialNumber}, #{internetChargeStation},
#{internetStartSoc},
#{internetEndSoc}, #{internetChargingDegree},
#{internetChargingTime},
#{internetStartTime}, #{internetEndTime},
#{internetOrderAmount},
#{internetPowerAmount}, #{internetServerAmount},
#{internetDiscountAmount},
#{internetPayAmount}, #{remark}, #{status,jdbcType=SMALLINT})
</insert>
<insert id="insertCheckList" keyColumn="id" keyProperty="id"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_internet_check_record (create_time, create_by, update_time,
update_by, upload_id, history_order_no,
user_id, internet_name, platform_internet_serial_number, platform_serial_number,
platform_charge_station, platform_start_soc,
platform_end_soc, platform_charging_degree,
platform_charging_time, platform_start_time,
platform_end_time, platform_order_amount,
platform_power_amount, platform_server_amount,
platform_discount_amount, platform_pay_amount,
internet_serial_number, internet_charge_station, internet_start_soc,
internet_end_soc, internet_charging_degree, internet_charging_time,
internet_start_time, internet_end_time, internet_order_amount,
internet_power_amount, internet_server_amount, internet_discount_amount,
internet_pay_amount, remark, `status`
) values
<foreach collection="list" item="check" index="index" separator=",">
(
now(), #{check.createBy}, now(),
#{check.updateBy}, #{check.uploadId},
#{check.historyOrderNo},
#{check.userId}, #{check.internetName},
#{check.platformInternetSerialNumber},#{check.platformSerialNumber},
#{check.platformChargeStation}, #{check.platformStartSoc},
#{check.platformEndSoc}, #{check.platformChargingDegree},
#{check.platformChargingTime}, #{check.platformStartTime},
#{check.platformEndTime}, #{check.platformOrderAmount},
#{check.platformPowerAmount}, #{check.platformServerAmount},
#{check.platformDiscountAmount}, #{check.platformPayAmount},
#{check.internetSerialNumber}, #{check.internetChargeStation},
#{check.internetStartSoc},
#{check.internetEndSoc}, #{check.internetChargingDegree},
#{check.internetChargingTime},
#{check.internetStartTime}, #{check.internetEndTime},
#{check.internetOrderAmount},
#{check.internetPowerAmount}, #{check.internetServerAmount},
#{check.internetDiscountAmount},
#{check.internetPayAmount}, #{check.remark},
#{check.status})
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_internet_check_record
<trim prefix="(" suffix=")" suffixOverrides=",">
create_time,
<if test="createBy != null">
create_by,
</if>
update_time,
<if test="updateBy != null">
update_by,
</if>
<if test="uploadId != null">
upload_id,
</if>
<if test="historyOrderNo != null">
history_order_no,
</if>
<if test="userId != null">
user_id,
</if>
<if test="internetName != null">
internet_name,
</if>
<if test="platformInternetSerialNumber != null">
platform_internet_serial_number,
</if>
<if test="platformChargeStation != null">
platform_charge_station,
</if>
<if test="platformStartSoc != null">
platform_start_soc,
</if>
<if test="platformEndSoc != null">
platform_end_soc,
</if>
<if test="platformChargingDegree != null">
platform_charging_degree,
</if>
<if test="platformChargingTime != null">
platform_charging_time,
</if>
<if test="platformStartTime != null">
platform_start_time,
</if>
<if test="platformEndTime != null">
platform_end_time,
</if>
<if test="platformOrderAmount != null">
platform_order_amount,
</if>
<if test="platformPowerAmount != null">
platform_power_amount,
</if>
<if test="platformServerAmount != null">
platform_server_amount,
</if>
<if test="platformDiscountAmount != null">
platform_discount_amount,
</if>
<if test="platformPayAmount != null">
platform_pay_amount,
</if>
<if test="internetSerialNumber != null">
internet_serial_number,
</if>
<if test="internetChargeStation != null">
internet_charge_station,
</if>
<if test="internetStartSoc != null">
internet_start_soc,
</if>
<if test="internetEndSoc != null">
internet_end_soc,
</if>
<if test="internetChargingDegree != null">
internet_charging_degree,
</if>
<if test="internetChargingTime != null">
internet_charging_time,
</if>
<if test="internetStartTime != null">
internet_start_time,
</if>
<if test="internetEndTime != null">
internet_end_time,
</if>
<if test="internetOrderAmount != null">
internet_order_amount,
</if>
<if test="internetPowerAmount != null">
internet_power_amount,
</if>
<if test="internetServerAmount != null">
internet_server_amount,
</if>
<if test="internetDiscountAmount != null">
internet_discount_amount,
</if>
<if test="internetPayAmount != null">
internet_pay_amount,
</if>
<if test="remark != null">
remark,
</if>
<if test="status != null">
`status`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
<if test="createBy != null">
#{createBy},
</if>
now(),
<if test="updateBy != null">
#{updateBy},
</if>
<if test="uploadId != null">
#{uploadId},
</if>
<if test="historyOrderNo != null">
#{historyOrderNo},
</if>
<if test="userId != null">
#{userId},
</if>
<if test="internetName != null">
#{internetName},
</if>
<if test="platformInternetSerialNumber != null">
#{platformInternetSerialNumber},
</if>
<if test="platformChargeStation != null">
#{platformChargeStation},
</if>
<if test="platformStartSoc != null">
#{platformStartSoc},
</if>
<if test="platformEndSoc != null">
#{platformEndSoc},
</if>
<if test="platformChargingDegree != null">
#{platformChargingDegree},
</if>
<if test="platformChargingTime != null">
#{platformChargingTime},
</if>
<if test="platformStartTime != null">
#{platformStartTime},
</if>
<if test="platformEndTime != null">
#{platformEndTime},
</if>
<if test="platformOrderAmount != null">
#{platformOrderAmount},
</if>
<if test="platformPowerAmount != null">
#{platformPowerAmount},
</if>
<if test="platformServerAmount != null">
#{platformServerAmount},
</if>
<if test="platformDiscountAmount != null">
#{platformDiscountAmount},
</if>
<if test="platformPayAmount != null">
#{platformPayAmount},
</if>
<if test="internetSerialNumber != null">
#{internetSerialNumber},
</if>
<if test="internetChargeStation != null">
#{internetChargeStation},
</if>
<if test="internetStartSoc != null">
#{internetStartSoc},
</if>
<if test="internetEndSoc != null">
#{internetEndSoc},
</if>
<if test="internetChargingDegree != null">
#{internetChargingDegree},
</if>
<if test="internetChargingTime != null">
#{internetChargingTime},
</if>
<if test="internetStartTime != null">
#{internetStartTime},
</if>
<if test="internetEndTime != null">
#{internetEndTime},
</if>
<if test="internetOrderAmount != null">
#{internetOrderAmount},
</if>
<if test="internetPowerAmount != null">
#{internetPowerAmount},
</if>
<if test="internetServerAmount != null">
#{internetServerAmount},
</if>
<if test="internetDiscountAmount != null">
#{internetDiscountAmount},
</if>
<if test="internetPayAmount != null">
#{internetPayAmount},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="status != null">
#{status},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain">
update xhpc_tradebill_internet_check_record
<set>
update_time = now(),
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="uploadId != null">
upload_id = #{uploadId},
</if>
<if test="historyOrderNo != null">
history_order_no = #{historyOrderNo},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="internetName != null">
internet_name = #{internetName},
</if>
<if test="platformInternetSerialNumber != null">
platform_internet_serial_number = #{platformInternetSerialNumber},
</if>
<if test="platformChargeStation != null">
platform_charge_station = #{platformChargeStation},
</if>
<if test="platformStartSoc != null">
platform_start_soc = #{platformStartSoc},
</if>
<if test="platformEndSoc != null">
platform_end_soc = #{platformEndSoc},
</if>
<if test="platformChargingDegree != null">
platform_charging_degree = #{platformChargingDegree},
</if>
<if test="platformChargingTime != null">
platform_charging_time = #{platformChargingTime},
</if>
<if test="platformStartTime != null">
platform_start_time = #{platformStartTime},
</if>
<if test="platformEndTime != null">
platform_end_time = #{platformEndTime},
</if>
<if test="platformOrderAmount != null">
platform_order_amount = #{platformOrderAmount},
</if>
<if test="platformPowerAmount != null">
platform_power_amount = #{platformPowerAmount},
</if>
<if test="platformServerAmount != null">
platform_server_amount = #{platformServerAmount},
</if>
<if test="platformDiscountAmount != null">
platform_discount_amount = #{platformDiscountAmount},
</if>
<if test="platformPayAmount != null">
platform_pay_amount = #{platformPayAmount},
</if>
<if test="internetSerialNumber != null">
internet_serial_number = #{internetSerialNumber},
</if>
<if test="internetChargeStation != null">
internet_charge_station = #{internetChargeStation},
</if>
<if test="internetStartSoc != null">
internet_start_soc = #{internetStartSoc},
</if>
<if test="internetEndSoc != null">
internet_end_soc = #{internetEndSoc},
</if>
<if test="internetChargingDegree != null">
internet_charging_degree = #{internetChargingDegree},
</if>
<if test="internetChargingTime != null">
internet_charging_time = #{internetChargingTime},
</if>
<if test="internetStartTime != null">
internet_start_time = #{internetStartTime},
</if>
<if test="internetEndTime != null">
internet_end_time = #{internetEndTime},
</if>
<if test="internetOrderAmount != null">
internet_order_amount = #{internetOrderAmount},
</if>
<if test="internetPowerAmount != null">
internet_power_amount = #{internetPowerAmount},
</if>
<if test="internetServerAmount != null">
internet_server_amount = #{internetServerAmount},
</if>
<if test="internetDiscountAmount != null">
internet_discount_amount = #{internetDiscountAmount},
</if>
<if test="internetPayAmount != null">
internet_pay_amount = #{internetPayAmount},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="status != null">
`status` = #{status,jdbcType=SMALLINT},
</if>
</set>
where id = #{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain">
update xhpc_tradebill_internet_check_record
set update_time = now(),
update_by = #{updateBy},
upload_id = #{uploadId},
history_order_no = #{historyOrderNo},
user_id = #{userId},
internet_name = #{internetName},
platform_internet_serial_number = #{platformInternetSerialNumber},
platform_charge_station = #{platformChargeStation},
platform_start_soc = #{platformStartSoc},
platform_end_soc = #{platformEndSoc},
platform_charging_degree = #{platformChargingDegree},
platform_charging_time = #{platformChargingTime},
platform_start_time = #{platformStartTime},
platform_end_time = #{platformEndTime},
platform_order_amount = #{platformOrderAmount},
platform_power_amount = #{platformPowerAmount},
platform_server_amount = #{platformServerAmount},
platform_discount_amount = #{platformDiscountAmount},
platform_pay_amount = #{platformPayAmount},
internet_serial_number = #{internetSerialNumber},
internet_charge_station = #{internetChargeStation},
internet_start_soc = #{internetStartSoc},
internet_end_soc = #{internetEndSoc},
internet_charging_degree = #{internetChargingDegree},
internet_charging_time = #{internetChargingTime},
internet_start_time = #{internetStartTime},
internet_end_time = #{internetEndTime},
internet_order_amount = #{internetOrderAmount},
internet_power_amount = #{internetPowerAmount},
internet_server_amount = #{internetServerAmount},
internet_discount_amount = #{internetDiscountAmount},
internet_pay_amount = #{internetPayAmount},
remark = #{remark},
`status` = #{status,jdbcType=SMALLINT}
where id = #{id}
</update>
<update id="updateStatusByPk" parameterType="com.xhpc.tradebill.domain.XhpcTradebillInternetCheckRecordDomain">
update xhpc_tradebill_internet_check_record
set update_time = now(),
update_by = #{updateBy},
remark = #{remark},
`status` = #{status,jdbcType=SMALLINT}
where id = #{id}
</update>
</mapper>

View File

@ -0,0 +1,349 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcTradebillPaymentCheckRecordMapper">
<resultMap id="BaseResultMap" type="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="create_by" jdbcType="BIGINT" property="createBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/>
<result column="upload_id" jdbcType="INTEGER" property="uploadId"/>
<result column="order_type" jdbcType="SMALLINT" property="orderType"/>
<result column="payment_channel" jdbcType="SMALLINT" property="paymentChannel"/>
<result column="platform_order_number" jdbcType="BIGINT" property="platformOrderNumber"/>
<result column="platform_pay_number" jdbcType="VARCHAR" property="platformPayNumber"/>
<result column="platform_user_id" jdbcType="VARCHAR" property="platformUserId"/>
<result column="platform_amount" jdbcType="DECIMAL" property="platformAmount"/>
<result column="platform_pay_time" jdbcType="TIMESTAMP" property="platformPayTime"/>
<result column="payment_pay_number" jdbcType="VARCHAR" property="paymentPayNumber"/>
<result column="payment_user_id" jdbcType="VARCHAR" property="paymentUserId"/>
<result column="payment_amount" jdbcType="DECIMAL" property="paymentAmount"/>
<result column="payment_pay_time" jdbcType="TIMESTAMP" property="paymentPayTime"/>
<result column="status" jdbcType="SMALLINT" property="status"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
id, create_time, create_by, update_time, update_by, upload_id, order_type, payment_channel,
platform_order_number, platform_pay_number, platform_user_id, platform_amount, platform_pay_time,
payment_pay_number, payment_user_id, payment_amount, payment_pay_time, `status`, remark
</sql>
<select id="selectByParams" resultType="java.util.Map">
select
<include refid="Base_Column_List"/>
from xhpc_tradebill_payment_check_record
<where>
<if test="params.uploadId != null and params.uploadId != ''">
and upload_id = #{params.uploadId}
</if>
<if test="params.paymentChannel == 1">
and payment_channel = 1 and order_type=1
</if>
<if test="params.paymentChannel == 2">
and payment_channel = 1 and order_type=2
</if>
<if test="params.paymentChannel == 3">
and payment_channel = 2 and order_type=1
</if>
<if test="params.paymentChannel == 4">
and payment_channel = 2 and order_type=2
</if>
<if test="params.checkStatus != null and params.checkStatus != ''">
and status = #{params.checkStatus}
</if>
</where>
</select>
<select id="selectListByParams"
resultType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain">
select
p.*, cu.user_name as 'create_name', uu.user_name as 'update_name',
case when p.status=0 then '未对账' when p.status=1 then '对账错误' when p.status=2 then '对账正确' else '未知' end as
'status_name'
from xhpc_tradebill_payment_check_record p
left join sys_user cu on cu.user_id=p.create_by
left join sys_user uu on uu.user_id=p.update_by
<where>
<if test="params.uploadId!=null and params.uploadId!='' and params.uploadId!=0">
and p.upload_id = #{params.uploadId}
</if>
<if test="params.orderNumber != null and params.orderNumber !=''">
and p.payment_pay_number like concat('%', #{params.orderNumber},'%')
</if>
<if test="params.status != null and params.status !=''">
and p.status=#{params.status}
</if>
</where>
order by p.upload_id desc, status asc
</select>
<select id="selectTotalGroupbyStatus" resultType="java.util.Map">
select
status, count(id) as 'total'
from xhpc_tradebill_payment_check_record
<where>
<if test="params.uploadId!=null and params.uploadId!='' and params.uploadId!=0">
and upload_id = #{params.uploadId}
</if>
<if test="params.status!=null and params.status!=''">
and status = #{params.status}
</if>
<if test="params.paymentPayNumber!=null and params.paymentPayNumber!=''">
and payment_pay_number like concat('%', #{params.orderNumber},'%')
</if>
</where>
group by status
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_tradebill_payment_check_record
where id = #{id}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete
from xhpc_tradebill_payment_check_record
where id = #{id}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_payment_check_record (create_time, create_by, update_time,
update_by, upload_id, order_type,
payment_channel, platform_order_number, platform_pay_number,
platform_user_id, platform_amount, platform_pay_time,
payment_pay_number, payment_user_id, payment_amount,
payment_pay_time, `status`, remark)
values (now(), #{createBy}, now(),
#{updateBy}, #{uploadId}, #{orderType},
#{paymentChannel}, #{platformOrderNumber},
#{platformPayNumber},
#{platformUserId}, #{platformAmount},
#{platformPayTime},
#{paymentPayNumber}, #{paymentUserId},
#{paymentAmount},
#{paymentPayTime}, #{status}, #{remark})
</insert>
<insert id="insertCheckList" keyColumn="id" keyProperty="id"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_payment_check_record (create_time, create_by, update_time,
update_by, upload_id, order_type,
payment_channel, platform_order_number, platform_pay_number,
platform_user_id, platform_amount, platform_pay_time,
payment_pay_number, payment_user_id, payment_amount,
payment_pay_time, `status`, remark) values
<foreach collection="list" item="check" index="index" separator=",">
(
now(), #{check.createBy}, now(),
#{check.updateBy}, #{check.uploadId},
#{check.orderType},
#{check.paymentChannel}, #{check.platformOrderNumber},
#{check.platformPayNumber},
#{check.platformUserId}, #{check.platformAmount},
#{check.platformPayTime},
#{check.paymentPayNumber}, #{check.paymentUserId},
#{check.paymentAmount},
#{check.paymentPayTime}, #{check.status},
#{check.remark}
)
</foreach>
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_payment_check_record
<trim prefix="(" suffix=")" suffixOverrides=",">
create_time,
<if test="createBy != null">
create_by,
</if>
update_time,
<if test="updateBy != null">
update_by,
</if>
<if test="uploadId != null">
upload_id,
</if>
<if test="orderType != null">
order_type,
</if>
<if test="paymentChannel != null">
payment_channel,
</if>
<if test="platformOrderNumber != null">
platform_order_number,
</if>
<if test="platformPayNumber != null">
platform_pay_number,
</if>
<if test="platformUserId != null">
platform_user_id,
</if>
<if test="platformAmount != null">
platform_amount,
</if>
<if test="platformPayTime != null">
platform_pay_time,
</if>
<if test="paymentPayNumber != null">
payment_pay_number,
</if>
<if test="paymentUserId != null">
payment_user_id,
</if>
<if test="paymentAmount != null">
payment_amount,
</if>
<if test="paymentPayTime != null">
payment_pay_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="remark != null">
remark,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
<if test="createBy != null">
#{createBy},
</if>
now(),
<if test="updateBy != null">
#{updateBy},
</if>
<if test="uploadId != null">
#{uploadId},
</if>
<if test="orderType != null">
#{orderType},
</if>
<if test="paymentChannel != null">
#{paymentChannel},
</if>
<if test="platformOrderNumber != null">
#{platformOrderNumber},
</if>
<if test="platformPayNumber != null">
#{platformPayNumber},
</if>
<if test="platformUserId != null">
#{platformUserId},
</if>
<if test="platformAmount != null">
#{platformAmount},
</if>
<if test="platformPayTime != null">
#{platformPayTime},
</if>
<if test="paymentPayNumber != null">
#{paymentPayNumber},
</if>
<if test="paymentUserId != null">
#{paymentUserId},
</if>
<if test="paymentAmount != null">
#{paymentAmount},
</if>
<if test="paymentPayTime != null">
#{paymentPayTime},
</if>
<if test="status != null">
#{status},
</if>
<if test="remark != null">
#{remark},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain">
update xhpc_tradebill_payment_check_record
<set>
update_time = now(),
<if test="updateBy != null">
update_by = #{updateBy},
</if>
<if test="uploadId != null">
upload_id = #{uploadId},
</if>
<if test="orderType != null">
order_type = #{orderType},
</if>
<if test="paymentChannel != null">
payment_channel = #{paymentChannel},
</if>
<if test="platformOrderNumber != null">
platform_order_number = #{platformOrderNumber},
</if>
<if test="platformPayNumber != null">
platform_pay_number = #{platformPayNumber},
</if>
<if test="platformUserId != null">
platform_user_id = #{platformUserId},
</if>
<if test="platformAmount != null">
platform_amount = #{platformAmount},
</if>
<if test="platformPayTime != null">
platform_pay_time = #{platformPayTime},
</if>
<if test="paymentPayNumber != null">
payment_pay_number = #{paymentPayNumber},
</if>
<if test="paymentUserId != null">
payment_user_id = #{paymentUserId},
</if>
<if test="paymentAmount != null">
payment_amount = #{paymentAmount},
</if>
<if test="paymentPayTime != null">
payment_pay_time = #{paymentPayTime},
</if>
<if test="status != null">
`status` = #{status},
</if>
<if test="remark != null">
remark = #{remark},
</if>
</set>
where id = #{id}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain">
update xhpc_tradebill_payment_check_record
set update_time = now(),
update_by = #{updateBy},
upload_id = #{uploadId},
order_type = #{orderType},
payment_channel = #{paymentChannel},
platform_order_number = #{platformOrderNumber},
platform_pay_number = #{platformPayNumber},
platform_user_id = #{platformUserId},
platform_amount = #{platformAmount},
platform_pay_time = #{platformPayTime},
payment_pay_number = #{paymentPayNumber},
payment_user_id = #{paymentUserId},
payment_amount = #{paymentAmount},
payment_pay_time = #{paymentPayTime},
`status` = #{status},
remark = #{remark}
where id = #{id}
</update>
<update id="updateStatusByPk" parameterType="com.xhpc.tradebill.domain.XhpcTradebillPaymentCheckRecordDomain">
update xhpc_tradebill_payment_check_record
set update_time = now(),
update_by = #{updateBy},
`status` = #{status},
remark = #{remark}
where id = #{id}
</update>
</mapper>

View File

@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xhpc.tradebill.mapper.XhpcTradebillUploadRecordMapper">
<resultMap id="BaseResultMap" type="com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="source" jdbcType="VARCHAR" property="source" />
<result column="file_name" jdbcType="VARCHAR" property="fileName" />
<result column="url" jdbcType="VARCHAR" property="url" />
<result column="type" jdbcType="SMALLINT" property="type" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="del_flag" jdbcType="SMALLINT" property="delFlag" />
<result column="success_count" jdbcType="INTEGER" property="successCount" />
<result column="fail_count" jdbcType="INTEGER" property="failCount" />
<result column="uncheck_count" jdbcType="INTEGER" property="uncheckCount" />
<result column="checked_count" jdbcType="INTEGER" property="checkedCount" />
</resultMap>
<sql id="Base_Column_List">
id, create_time, create_by, update_time, update_by, `source`, file_name, url, `type`,
`status`, del_flag, success_count, fail_count, uncheck_count, checked_count
</sql>
<select id="selectByUrl" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_tradebill_upload_record
where url = #{url,jdbcType=VARCHAR}
</select>
<select id="selectByType" resultType="com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain">
select
<include refid="Base_Column_List" />
from xhpc_tradebill_upload_record
<where>
<if test="params.type != null and params.type!=''">
and type = #{params.type}
</if>
<if test="params.name!=null and params.name!=''">
and file_name concat('%', #{params.name}, '%')
</if>
and create_by=#{params.createBy}
</where>
order by update_time desc
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_tradebill_upload_record
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from xhpc_tradebill_upload_record
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_upload_record (create_time, create_by, update_time,
update_by, `source`, file_name,
url, `type`, `status`,
del_flag, success_count, fail_count,
uncheck_count, checked_count)
values (now(), #{createBy,jdbcType=VARCHAR}, now(),
#{updateBy,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR}, #{type,jdbcType=SMALLINT}, #{status,jdbcType=SMALLINT},
#{delFlag,jdbcType=SMALLINT}, #{successCount,jdbcType=INTEGER}, #{failCount,jdbcType=INTEGER},
#{uncheckCount,jdbcType=INTEGER}, #{checkedCount,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain" useGeneratedKeys="true">
insert into xhpc_tradebill_upload_record
<trim prefix="(" suffix=")" suffixOverrides=",">
create_time,
<if test="createBy != null">
create_by,
</if>
update_time,
<if test="updateBy != null">
update_by,
</if>
<if test="source != null">
`source`,
</if>
<if test="fileName != null">
file_name,
</if>
<if test="url != null">
url,
</if>
<if test="type != null">
`type`,
</if>
<if test="status != null">
`status`,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="successCount != null">
success_count,
</if>
<if test="failCount != null">
fail_count,
</if>
<if test="uncheckCount != null">
uncheck_count,
</if>
<if test="checkedCount != null">
checked_count,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
now(),
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="source != null">
#{source,jdbcType=VARCHAR},
</if>
<if test="fileName != null">
#{fileName,jdbcType=VARCHAR},
</if>
<if test="url != null">
#{url,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=SMALLINT},
</if>
<if test="status != null">
#{status,jdbcType=SMALLINT},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=SMALLINT},
</if>
<if test="successCount != null">
#{successCount,jdbcType=INTEGER},
</if>
<if test="failCount != null">
#{failCount,jdbcType=INTEGER},
</if>
<if test="uncheckCount != null">
#{uncheckCount,jdbcType=INTEGER},
</if>
<if test="checkedCount != null">
#{checkedCount,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain">
update xhpc_tradebill_upload_record
<set>
update_time = now(),
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="source != null">
`source` = #{source,jdbcType=VARCHAR},
</if>
<if test="fileName != null">
file_name = #{fileName,jdbcType=VARCHAR},
</if>
<if test="url != null">
url = #{url,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=SMALLINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=SMALLINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=SMALLINT},
</if>
<if test="successCount != null">
success_count = #{successCount,jdbcType=INTEGER},
</if>
<if test="failCount != null">
fail_count = #{failCount,jdbcType=INTEGER},
</if>
<if test="uncheckCount != null">
uncheck_count = #{uncheckCount,jdbcType=INTEGER},
</if>
<if test="checkedCount != null">
checked_count = #{checkedCount,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.tradebill.domain.XhpcTradebillUploadRecordDomain">
update xhpc_tradebill_upload_record
set update_time = now(),
update_by = #{updateBy,jdbcType=VARCHAR},
`source` = #{source,jdbcType=VARCHAR},
file_name = #{fileName,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR},
`type` = #{type,jdbcType=SMALLINT},
`status` = #{status,jdbcType=SMALLINT},
del_flag = #{delFlag,jdbcType=SMALLINT},
success_count = #{successCount,jdbcType=INTEGER},
fail_count = #{failCount,jdbcType=INTEGER},
uncheck_count = #{uncheckCount,jdbcType=INTEGER},
checked_count = #{checkedCount,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>