feat: 对账记录

This commit is contained in:
2026-07-27 11:37:31 +08:00
parent 5bbfba353d
commit a1a7527ca8
6 changed files with 425 additions and 0 deletions
@@ -0,0 +1,37 @@
package com.budwk.app.zhgh.pointsmall.reconciliationrecord.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.param.PointsMallReconciliationRecordPageParam;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.service.PointsMallReconciliationRecordService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@IocBean
@Ok("json:full")
@At("/platform/zhgh/points-mall/reconciliationRecord")
public class PointsMallReconciliationRecordController {
@Inject
private PointsMallReconciliationRecordService pointsMallReconciliationRecordService;
@At("")
@Ok("beetl:/platform/zhgh/points-mall/reconciliationRecord/index.html")
@SaCheckPermission("points.mall.reconciliationrecord")
public void index() {
}
@At
@SaCheckPermission("points.mall.reconciliationrecord")
public Result pageData(PointsMallReconciliationRecordPageParam param) {
return Result.success(pointsMallReconciliationRecordService.page(param));
}
@At
@SaCheckPermission("points.mall.reconciliationrecord")
public Result supplierList() {
return Result.success(pointsMallReconciliationRecordService.listSuppliers());
}
}
@@ -0,0 +1,101 @@
package com.budwk.app.zhgh.pointsmall.reconciliationrecord.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_reconciliation_record")
@Comment("积分商城对账记录")
public class PointsMallReconciliationRecord extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("平台退款")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pRefund;
@Column
@Comment("平台订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pTotalPrice;
@Column
@Comment("平台现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pCashAmount;
@Column
@Comment("平台消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pPointsPrice;
@Column
@Comment("供应商退款")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal sRefund;
@Column
@Comment("供应商订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal sTotalPrice;
@Column
@Comment("供应商现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal sCashAmount;
@Column
@Comment("供应商消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal sPointsPrice;
@Column
@Comment("差异原因")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String diffReason;
@Column
@Comment("差异类型")
private Integer diffType;
@Column
@Comment("对账批次号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String batchNo;
@Column
@Comment("通知状态")
private Integer noticeStatus;
@Column
@Comment("推送次数")
private Integer pushTime;
}
@@ -0,0 +1,17 @@
package com.budwk.app.zhgh.pointsmall.reconciliationrecord.param;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class PointsMallReconciliationRecordPageParam extends PageForm {
private String supplierId;
private String orderId;
private String userId;
private Integer diffType;
private String batchNo;
private Integer noticeStatus;
}
@@ -0,0 +1,17 @@
package com.budwk.app.zhgh.pointsmall.reconciliationrecord.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.models.PointsMallReconciliationRecord;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.param.PointsMallReconciliationRecordPageParam;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import org.nutz.dao.entity.Record;
import java.util.List;
public interface PointsMallReconciliationRecordService extends BaseService<PointsMallReconciliationRecord> {
Pagination<Record> page(PointsMallReconciliationRecordPageParam param);
List<PointsMallSupplier> listSuppliers();
}
@@ -0,0 +1,57 @@
package com.budwk.app.zhgh.pointsmall.reconciliationrecord.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.models.PointsMallReconciliationRecord;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.param.PointsMallReconciliationRecordPageParam;
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.service.PointsMallReconciliationRecordService;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class PointsMallReconciliationRecordServiceImpl extends BaseServiceImpl<PointsMallReconciliationRecord> implements PointsMallReconciliationRecordService {
public PointsMallReconciliationRecordServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<Record> page(PointsMallReconciliationRecordPageParam param) {
Cnd cnd = Cnd.where("r.delFlag", "=", false);
if (StrUtil.isNotBlank(param.getSupplierId())) {
cnd.and("r.supplierId", "=", param.getSupplierId());
}
if (StrUtil.isNotBlank(param.getOrderId())) {
cnd.and("r.orderId", "like", "%" + param.getOrderId() + "%");
}
if (StrUtil.isNotBlank(param.getUserId())) {
cnd.and("r.userId", "like", "%" + param.getUserId() + "%");
}
if (param.getDiffType() != null) {
cnd.and("r.diffType", "=", param.getDiffType());
}
if (StrUtil.isNotBlank(param.getBatchNo())) {
cnd.and("r.batchNo", "like", "%" + param.getBatchNo() + "%");
}
if (param.getNoticeStatus() != null) {
cnd.and("r.noticeStatus", "=", param.getNoticeStatus());
}
cnd.desc("r.createdAt");
Sql sql = Sqls.create("select r.*, s.supplierName from points_mall_reconciliation_record r left join points_mall_supplier s on r.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
}
@Override
public List<PointsMallSupplier> listSuppliers() {
return dao().query(PointsMallSupplier.class, Cnd.where("delFlag", "=", false).asc("sortCode"));
}
}
@@ -0,0 +1,196 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="供应商">
<el-select clearable filterable placeholder="请选择供应商" style="width: 100%" v-model="pageForm.supplierId">
<el-option :key="item.supplierId" :label="item.supplierName" :value="item.supplierId" v-for="item in supplierList"></el-option>
</el-select>
</search-item>
<search-item label="订单ID">
<el-input clearable placeholder="请输入订单ID" v-model="pageForm.orderId"></el-input>
</search-item>
<search-item label="用户ID">
<el-input clearable placeholder="请输入用户ID" v-model="pageForm.userId"></el-input>
</search-item>
<search-item label="批次号">
<el-input clearable placeholder="请输入对账批次号" v-model="pageForm.batchNo"></el-input>
</search-item>
<search-item label="差异类型">
<el-select clearable placeholder="请选择差异类型" style="width: 100%" v-model="pageForm.diffType">
<el-option label="一致" :value="0"></el-option>
<el-option label="异常" :value="1"></el-option>
</el-select>
</search-item>
<search-item label="通知状态">
<el-select clearable placeholder="请选择通知状态" style="width: 100%" v-model="pageForm.noticeStatus">
<el-option label="未推送" :value="0"></el-option>
<el-option label="推送成功" :value="1"></el-option>
<el-option label="推送失败" :value="2"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="对账记录"></table-tool>
<el-table :data="tableData" border class="vi-table" size="small" style="width: 100%" v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" label="序号" type="index" width="70"></el-table-column>
<el-table-column align="center" label="批次号" min-width="170" prop="batchNo" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="订单ID" min-width="170" prop="orderId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="供应商" min-width="150" prop="supplierName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="供应商编码" min-width="130" prop="supplierId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="用户ID" min-width="120" prop="userId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="订单总金额(平台)" min-width="140" prop="pTotalPrice"></el-table-column>
<el-table-column align="center" label="现金金额(平台)" min-width="130" prop="pCashAmount"></el-table-column>
<el-table-column align="center" label="积分金额(平台)" min-width="130" prop="pPointsPrice"></el-table-column>
<el-table-column align="center" label="退款金额(平台)" min-width="130" prop="pRefund"></el-table-column>
<el-table-column align="center" label="订单总金额(对账)" min-width="140" prop="sTotalPrice"></el-table-column>
<el-table-column align="center" label="现金金额(对账)" min-width="130" prop="sCashAmount"></el-table-column>
<el-table-column align="center" label="积分金额(对账)" min-width="130" prop="sPointsPrice"></el-table-column>
<el-table-column align="center" label="退款金额(对账)" min-width="130" prop="sRefund"></el-table-column>
<el-table-column align="center" label="差异类型" min-width="110">
<template slot-scope="{row}">
<el-tag :type="diffTypeTag(row.diffType)" size="mini">{{ diffTypeName(row.diffType) }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="通知状态" min-width="110">
<template slot-scope="{row}">
<el-tag :type="noticeStatusTag(row.noticeStatus)" size="mini">{{ noticeStatusName(row.noticeStatus) }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="推送次数" min-width="90" prop="pushTime"></el-table-column>
<el-table-column align="center" label="差异原因" min-width="240" prop="diffReason" show-overflow-tooltip></el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="90">
<template slot-scope="{row}">
<el-button @click="openDetail(row)" size="mini" type="primary">查看</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageChange"
@size-change="sizeChange"
layout="total, sizes, prev, pager, next"
style="margin-top: 16px; text-align: right"
></el-pagination>
</el-card>
<el-dialog :close-on-click-modal="false" title="对账记录详情" :visible.sync="detailDialogVisible" width="820px">
<el-descriptions :column="2" border size="small" v-if="currentRecord">
<el-descriptions-item label="批次号">{{ currentRecord.batchNo || "-" }}</el-descriptions-item>
<el-descriptions-item label="订单ID">{{ currentRecord.orderId || "-" }}</el-descriptions-item>
<el-descriptions-item label="供应商">{{ currentRecord.supplierName || currentRecord.supplierId || "-" }}</el-descriptions-item>
<el-descriptions-item label="用户ID">{{ currentRecord.userId || "-" }}</el-descriptions-item>
<el-descriptions-item label="平台总金额">{{ currentRecord.pTotalPrice || "0" }}</el-descriptions-item>
<el-descriptions-item label="对账总金额">{{ currentRecord.sTotalPrice || "0" }}</el-descriptions-item>
<el-descriptions-item label="平台现金金额">{{ currentRecord.pCashAmount || "0" }}</el-descriptions-item>
<el-descriptions-item label="对账现金金额">{{ currentRecord.sCashAmount || "0" }}</el-descriptions-item>
<el-descriptions-item label="平台积分金额">{{ currentRecord.pPointsPrice || "0" }}</el-descriptions-item>
<el-descriptions-item label="对账积分金额">{{ currentRecord.sPointsPrice || "0" }}</el-descriptions-item>
<el-descriptions-item label="平台退款金额">{{ currentRecord.pRefund || "0" }}</el-descriptions-item>
<el-descriptions-item label="对账退款金额">{{ currentRecord.sRefund || "0" }}</el-descriptions-item>
<el-descriptions-item label="差异类型">{{ diffTypeName(currentRecord.diffType) }}</el-descriptions-item>
<el-descriptions-item label="通知状态">{{ noticeStatusName(currentRecord.noticeStatus) }}</el-descriptions-item>
<el-descriptions-item label="推送次数">{{ currentRecord.pushTime || 0 }}</el-descriptions-item>
<el-descriptions-item label="差异原因">{{ currentRecord.diffReason || "-" }}</el-descriptions-item>
</el-descriptions>
<span slot="footer">
<el-button @click="detailDialogVisible = false">关闭</el-button>
</span>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
supplierList: [],
tableData: [],
tableLoading: false,
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
supplierId: null,
orderId: null,
userId: null,
diffType: null,
batchNo: null,
noticeStatus: null
},
detailDialogVisible: false,
currentRecord: null
}
},
methods: {
indexMethod(index) {
return index + 1 + (this.pageForm.pageNumber - 1) * this.pageForm.pageSize
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
async pageData() {
this.tableLoading = true
const resp = await this.$axios.post(loc() + "/pageData", this.pageForm)
this.tableLoading = false
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.pageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyWarning(resp.msg)
}
},
pageChange(val) {
this.pageForm.pageNumber = val
this.pageData()
},
sizeChange(val) {
this.pageForm.pageSize = val
this.pageForm.pageNumber = 1
this.pageData()
},
async loadSuppliers() {
const resp = await this.$axios.post(loc() + "/supplierList")
if (resp.code === 0) {
this.supplierList = resp.data || []
}
},
openDetail(row) {
this.currentRecord = row
this.detailDialogVisible = true
},
diffTypeName(value) {
return Number(value) === 0 ? "一致" : "异常"
},
diffTypeTag(value) {
return Number(value) === 0 ? "success" : "danger"
},
noticeStatusName(value) {
const map = { 0: "未推送", 1: "推送成功", 2: "推送失败" }
return map[value] || "-"
},
noticeStatusTag(value) {
const map = { 0: "info", 1: "success", 2: "danger" }
return map[value] || "info"
}
},
created() {
this.loadSuppliers()
this.pageData()
}
})
</script>
<!--#
}
#-->