账务管理

This commit is contained in:
jinqiming 2022-02-18 17:33:27 +08:00
parent 4e01b8e79b
commit 74f2900647
10 changed files with 800 additions and 155 deletions

View File

@ -1,33 +1,22 @@
package com.snow.system.controller;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.constant.SequenceConstants;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysFnAccountBill;
import com.snow.system.service.ISysFnAccountBillService;
import com.snow.system.service.ISysSequenceService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.snow.common.annotation.Log;
import com.snow.common.enums.BusinessType;
import org.springframework.stereotype.Controller;
import com.snow.system.domain.SysFnAccount;
import com.snow.system.service.ISysFnAccountService;
import com.snow.common.annotation.RepeatSubmit;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.common.core.page.TableDataInfo;
import com.snow.common.enums.BusinessType;
import com.snow.framework.util.ShiroUtils;
import com.snow.system.domain.SysFnAccount;
import com.snow.system.domain.request.RechargeAccountRequest;
import com.snow.system.service.ISysFnAccountService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 账户Controller
@ -44,11 +33,6 @@ public class SysFnAccountController extends BaseController
@Autowired
private ISysFnAccountService sysFnAccountService;
@Autowired
private ISysSequenceService sysSequenceService;
@Autowired
private ISysFnAccountBillService sysFnAccountBillService;
@RequiresPermissions("system:account:view")
@GetMapping()
@ -70,19 +54,7 @@ public class SysFnAccountController extends BaseController
return getDataTable(list);
}
/**
* 导出账户列表
*/
@RequiresPermissions("system:account:export")
@Log(title = "账户", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(SysFnAccount sysFnAccount)
{
List<SysFnAccount> list = sysFnAccountService.selectSysFnAccountList(sysFnAccount);
ExcelUtil<SysFnAccount> util = new ExcelUtil<SysFnAccount>(SysFnAccount.class);
return util.exportExcel(list, "account");
}
/**
* 新增账户
@ -103,8 +75,6 @@ public class SysFnAccountController extends BaseController
public AjaxResult addSave(SysFnAccount sysFnAccount)
{
Long userId = ShiroUtils.getUserId();
String accountNo = sysSequenceService.getNewSequenceNo(SequenceConstants.FN_ACCOUNT_NO);
sysFnAccount.setAccountNo(accountNo);
sysFnAccount.setCreateBy(String.valueOf(userId));
sysFnAccount.setUpdateBy(String.valueOf(userId));
return toAjax(sysFnAccountService.insertSysFnAccount(sysFnAccount));
@ -145,9 +115,23 @@ public class SysFnAccountController extends BaseController
return toAjax(sysFnAccountService.deleteSysFnAccountByIds(ids));
}
/**
* 获取账户详情
* @param accountNo 账户号
* @return 账户详情
*/
@RequiresPermissions("system:account:detail")
@PostMapping("/getSysFnAccountByNo")
@ResponseBody
public AjaxResult getSysFnAccountByNo(String accountNo)
{
return AjaxResult.success(sysFnAccountService.getSysFnAccountByNo(accountNo));
}
/**
* 账户充值
* @param sysFnAccount
* @param rechargeAccountRequest
* @return
*/
@RequiresPermissions("system:account:rechargeAccount")
@ -155,20 +139,7 @@ public class SysFnAccountController extends BaseController
@PostMapping( "/rechargeAccount")
@RepeatSubmit
@ResponseBody
public AjaxResult rechargeAccount(SysFnAccount sysFnAccount){
LambdaQueryWrapper<SysFnAccount> lambda = new QueryWrapper<SysFnAccount>().lambda();
SysFnAccount fnAccount = sysFnAccountService.getOne(lambda.eq(SysFnAccount::getAccountNo, sysFnAccount.getAccountNo()));
BigDecimal amount = sysFnAccount.getTotalAmount().add(fnAccount.getTotalAmount());
sysFnAccount.setTotalAmount(amount);
sysFnAccountService.updateSysFnAccount(sysFnAccount);
String billNo = sysSequenceService.getNewSequenceNo(SequenceConstants.FN_ACCOUNT_BILL_NO);
SysFnAccountBill sysFnAccountBill=new SysFnAccountBill();
sysFnAccountBill.setAccountNo(sysFnAccount.getAccountNo());
sysFnAccountBill.setBillAmount(sysFnAccount.getTotalAmount());
sysFnAccountBill.setBillType(1);
sysFnAccountBill.setRemark("充值");
sysFnAccountBill.setBillNo(billNo);
sysFnAccountBillService.insertSysFnAccountBill(sysFnAccountBill);
return AjaxResult.success();
public AjaxResult rechargeAccount(RechargeAccountRequest rechargeAccountRequest){
return AjaxResult.success(sysFnAccountService.rechargeAccount(rechargeAccountRequest));
}
}

View File

@ -0,0 +1,222 @@
.toast-title {
font-weight: 700
}
.toast-message {
-ms-word-wrap: break-word;
word-wrap: break-word
}
.toast-message a, .toast-message label {
color: #fff
}
.toast-message a:hover {
color: #ccc;
text-decoration: none
}
.toast-close-button {
position: relative;
right: -.3em;
top: -.3em;
float: right;
font-size: 20px;
font-weight: 700;
color: #fff;
-webkit-text-shadow: 0 1px 0 #fff;
text-shadow: 0 1px 0 #fff;
opacity: .8;
-ms-filter: alpha(Opacity=80);
filter: alpha(opacity=80)
}
.toast-close-button:focus, .toast-close-button:hover {
color: #000;
text-decoration: none;
cursor: pointer;
opacity: .4;
-ms-filter: alpha(Opacity=40);
filter: alpha(opacity=40)
}
button.toast-close-button {
padding: 0;
cursor: pointer;
background: 0 0;
border: 0;
-webkit-appearance: none
}
.toast-top-center {
top: 0;
right: 0;
width: 100%
}
.toast-bottom-center {
bottom: 0;
right: 0;
width: 100%
}
.toast-top-full-width {
top: 0;
right: 0;
width: 100%
}
.toast-bottom-full-width {
bottom: 0;
right: 0;
width: 100%
}
.toast-top-left {
top: 12px;
left: 12px
}
.toast-top-right {
top: 12px;
right: 12px
}
.toast-bottom-right {
right: 12px;
bottom: 12px
}
.toast-bottom-left {
bottom: 12px;
left: 12px
}
#toast-container {
position: fixed;
z-index: 999999
}
#toast-container * {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box
}
#toast-container > div {
position: relative;
overflow: hidden;
margin: 0 0 6px;
padding: 15px 15px 15px 50px;
width: 300px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-position: 15px center;
background-repeat: no-repeat;
-moz-box-shadow: 0 0 12px #999;
-webkit-box-shadow: 0 0 12px #999;
box-shadow: 0 0 12px #999;
color: #fff;
opacity: .8;
-ms-filter: alpha(Opacity=80);
filter: alpha(opacity=80)
}
#toast-container > :hover {
-moz-box-shadow: 0 0 12px #000;
-webkit-box-shadow: 0 0 12px #000;
box-shadow: 0 0 12px #000;
opacity: 1;
-ms-filter: alpha(Opacity=100);
filter: alpha(opacity=100);
cursor: pointer
}
#toast-container > .toast-info {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=) !important
}
#toast-container > .toast-error {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=) !important
}
#toast-container > .toast-success {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==) !important
}
#toast-container > .toast-warning {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=) !important
}
#toast-container.toast-bottom-center > div, #toast-container.toast-top-center > div {
width: 300px;
margin: auto
}
#toast-container.toast-bottom-full-width > div, #toast-container.toast-top-full-width > div {
width: 96%;
margin: auto
}
.toast {
background-color: #030303
}
.toast-success {
background-color: #51a351
}
.toast-error {
background-color: #bd362f
}
.toast-info {
background-color: #2f96b4
}
.toast-warning {
background-color: #f89406
}
.toast-progress {
position: absolute;
left: 0;
bottom: 0;
height: 4px;
background-color: #000;
opacity: .4;
-ms-filter: alpha(Opacity=40);
filter: alpha(opacity=40)
}
@media all and (max-width: 240px) {
#toast-container > div {
padding: 8px 8px 8px 50px;
width: 11em
}
#toast-container .toast-close-button {
right: -.2em;
top: -.2em
}
}
@media all and (min-width: 241px) and (max-width: 480px) {
#toast-container > div {
padding: 8px 8px 8px 50px;
width: 18em
}
#toast-container .toast-close-button {
right: -.2em;
top: -.2em
}
}
@media all and (min-width: 481px) and (max-width: 768px) {
#toast-container > div {
padding: 15px 15px 15px 50px;
width: 25em
}
}

View File

@ -1,102 +1,250 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('账户列表')" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INSPINIA | E-commerce</title>
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet">
<link th:href="@{/css/animate.css}" rel="stylesheet">
<link th:href="@{/css/style.css}" rel="stylesheet">
<link th:href="@{/css/toastr/toastr.min.css}" rel="stylesheet"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>账户号:</label>
<input type="text" name="accountNo"/>
</li>
<li>
<label>账户名称:</label>
<input type="text" name="accountName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
<body>
<div id="wrapper">
<div id="page-wrapper" class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
<div class="row">
<div class="col-md-4">
<div class="payment-card">
<i class="fa fa-cc-visa payment-icon-big text-success"></i>
<h2>
**** **** **** 1060
</h2>
<div class="row">
<div class="col-sm-6">
<small>
<strong>Expiry date:</strong> 10/16
</small>
</div>
<div class="col-sm-6 text-right">
<small>
<strong>Name:</strong> David Williams
</small>
</div>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<div class="payment-card">
<i class="fa fa-cc-mastercard payment-icon-big text-warning"></i>
<h2>
**** **** **** 7002
</h2>
<div class="row">
<div class="col-sm-6">
<small>
<strong>Expiry date:</strong> 10/16
</small>
</div>
<div class="col-sm-6 text-right">
<small>
<strong>Name:</strong> Anna Smith
</small>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="payment-card">
<i class="fa fa-cc-discover payment-icon-big text-danger"></i>
<h2>
**** **** **** 3466
</h2>
<div class="row">
<div class="col-sm-6">
<small>
<strong>Expiry date:</strong> 10/16
</small>
</div>
<div class="col-sm-6 text-right">
<small>
<strong>Name:</strong> Morgan Stanch
</small>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
Payment method
</div>
<div class="ibox-content">
<div class="panel-group payments-method" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<div class="float-right">
<i class="fa fa-cc-paypal text-success"></i>
</div>
<h5 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">PayPal</a>
</h5>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
<div class="row">
<div class="col-md-10">
<h2>Summary</h2>
<strong>Product:</strong>: Name of product <br/>
<strong>Price:</strong>: <span class="text-navy">$452.90</span>
<p class="m-t">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<a class="btn btn-success" href="">
<i class="fa fa-cc-paypal"> </i> Purchase via PayPal
</a>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<div class="float-right">
<i class="fa fa-cc-amex text-success"></i>
<i class="fa fa-cc-mastercard text-warning"></i>
<i class="fa fa-cc-discover text-danger"></i>
</div>
<h5 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">Credit Card</a>
</h5>
</div>
<div id="collapseTwo" class="panel-collapse collapse in">
<div class="panel-body">
<div class="row">
<div class="col-md-4">
<h2>Summary</h2>
<strong>Product:</strong>: Name of product <br/>
<strong>Price:</strong>: <span class="text-navy">$452.90</span>
<p class="m-t">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat.
</p>
<p>
Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat
nulla pariatur. Excepteur sint occaecat cupidatat.
</p>
</div>
<div class="col-md-8">
<form role="form" id="payment-form">
<div class="row">
<div class="col-12">
<div class="form-group">
<label>CARD NUMBER</label>
<div class="input-group">
<input type="text" class="form-control" name="Number" placeholder="Valid Card Number" required />
<span class="input-group-addon"><i class="fa fa-credit-card"></i></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-7 col-md-7">
<div class="form-group">
<label>EXPIRATION DATE</label>
<input type="text" class="form-control" name="Expiry" placeholder="MM / YY" required/>
</div>
</div>
<div class="col-5 col-md-5 float-right">
<div class="form-group">
<label>CV CODE</label>
<input type="text" class="form-control" name="CVC" placeholder="CVC" required/>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="form-group">
<label>NAME OF CARD</label>
<input type="text" class="form-control" name="nameCard" placeholder="NAME AND SURNAME"/>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<button class="btn btn-primary" type="submit">Make a payment!</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:account:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:account:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:account:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:account:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:account:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:account:remove')}]];
var prefix = ctx + "system/account";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "账户",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键id',
visible: false
},
{
field: 'accountNo',
title: '账户号'
},
{
field: 'accountName',
title: '账户名称'
},
{
field: 'totalAmount',
title: '账户总金额'
},
{
field: 'freezeAmount',
title: '账户冻结金额'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</div>
</div>
<!-- Mainly scripts -->
<th:block th:include="include :: footer" />
</body>
</html>
</html>

View File

@ -0,0 +1,167 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('账户列表')" />
<link th:href="@{/css/toastr/toastr.min.css}" rel="stylesheet"/>
</head>
<body >
<div class="container-div" id="wrapper">
<div class="row">
<div class="col-sm-12 search-collapse wrapper wrapper-content animated fadeInRight">
<div class="col-md-4">
<div class="payment-card">
<i class="fa fa-cc-visa payment-icon-big text-success"></i>
<h2>
**** **** **** 1060
</h2>
<div class="row">
<div class="col-sm-6">
<small>
<strong>到期日:</strong> 10/16
</small>
</div>
<div class="col-sm-6 text-right">
<small>
<strong>姓名:</strong> 小明
</small>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="payment-card">
<i class="fa fa-cc-mastercard payment-icon-big text-warning"></i>
<h2>
**** **** **** 7002
</h2>
<div class="row">
<div class="col-sm-6">
<small>
<strong>到期日:</strong> 10/16
</small>
</div>
<div class="col-sm-6 text-right">
<small>
<strong>姓名:</strong> 小明
</small>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="payment-card">
<i class="fa fa-cc-discover payment-icon-big text-danger"></i>
<h2>
**** **** **** 3466
</h2>
<div class="row">
<div class="col-sm-6">
<small>
<strong>到期日:</strong> 10/16
</small>
</div>
<div class="col-sm-6 text-right">
<small>
<strong>姓名:</strong> 小明
</small>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>账户号:</label>
<input type="text" name="accountNo"/>
</li>
<li>
<label>账户名称:</label>
<input type="text" name="accountName"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:account:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:account:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:account:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:account:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:account:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:account:remove')}]];
var prefix = ctx + "system/account";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "账户",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键id',
visible: false
},
{
field: 'accountNo',
title: '账户号'
},
{
field: 'accountName',
title: '账户名称'
},
{
field: 'totalAmount',
title: '账户总金额'
},
{
field: 'freezeAmount',
title: '账户冻结金额'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -1,13 +1,13 @@
package com.snow.system.domain;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import lombok.Data;
import java.math.BigDecimal;
/**
* 账户流水详情对象 sys_fn_account_bill
*

View File

@ -0,0 +1,27 @@
package com.snow.system.domain.request;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author qimingjin
* @Title: 充值账户
* @Description:
* @date 2022/2/18 11:15
*/
@Data
public class RechargeAccountRequest implements Serializable {
private static final long serialVersionUID = -1810523463388701478L;
/**
* 账户号
*/
private String accountNo;
/**
* 充值金额
*/
private BigDecimal rechargeAmount;
}

View File

@ -0,0 +1,44 @@
package com.snow.system.domain.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author qimingjin
* @Title: 账户
* @Description:
* @date 2022/2/18 10:54
*/
@Data
public class SysFnAccountResponse implements Serializable {
private static final long serialVersionUID = -4475531068106536295L;
/**
* 账户号
*/
private String accountNo;
/** 账户名称 */
private String accountName;
/** 账户总金额 */
private BigDecimal totalAmount;
/** 账户冻结金额 */
private BigDecimal freezeAmount;
/**
* 可用金额
*/
private BigDecimal usableAmount;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
}

View File

@ -3,6 +3,8 @@ package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.SysFnAccount;
import com.baomidou.mybatisplus.extension.service.IService;
import com.snow.system.domain.request.RechargeAccountRequest;
import com.snow.system.domain.response.SysFnAccountResponse;
/**
* 账户Service接口
@ -59,4 +61,18 @@ public interface ISysFnAccountService extends IService<SysFnAccount>
* @return 结果
*/
public int deleteSysFnAccountById(Long id);
/**
* 获取账户信息通过账户
* @param accountNo 账户号
* @return 账户信息
*/
public SysFnAccountResponse getSysFnAccountByNo(String accountNo);
/**
* 充值账户
* @param rechargeAccountRequest
* @return
*/
public boolean rechargeAccount(RechargeAccountRequest rechargeAccountRequest);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.ArrayList;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -26,6 +27,10 @@ public class SysFnAccountBillServiceImpl extends ServiceImpl<SysFnAccountBillMap
@Resource
private SysFnAccountBillMapper sysFnAccountBillMapper;
@Resource
private SysSequenceServiceImpl sysSequenceService;
/**
* 查询账户流水详情
*
@ -60,6 +65,8 @@ public class SysFnAccountBillServiceImpl extends ServiceImpl<SysFnAccountBillMap
*/
@Override
public int insertSysFnAccountBill(SysFnAccountBill sysFnAccountBill) {
String billNo = sysSequenceService.getNewSequenceNo(SequenceConstants.FN_ACCOUNT_BILL_NO);
sysFnAccountBill.setBillNo(billNo);
sysFnAccountBill.setCreateTime(DateUtils.getNowDate());
return sysFnAccountBillMapper.insert(sysFnAccountBill);
}

View File

@ -1,12 +1,20 @@
package com.snow.system.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.ArrayList;
import java.util.Optional;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.snow.common.constant.SequenceConstants;
import com.snow.common.utils.DateUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.snow.system.domain.SysFnAccountBill;
import com.snow.system.domain.request.RechargeAccountRequest;
import com.snow.system.domain.response.SysFnAccountResponse;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.SysFnAccountMapper;
import com.snow.system.domain.SysFnAccount;
@ -26,6 +34,12 @@ public class SysFnAccountServiceImpl extends ServiceImpl<SysFnAccountMapper, Sys
@Resource
private SysFnAccountMapper sysFnAccountMapper;
@Resource
private SysSequenceServiceImpl sysSequenceService;
@Resource
private SysFnAccountBillServiceImpl sysFnAccountBillService;
/**
* 查询账户
*
@ -59,6 +73,8 @@ public class SysFnAccountServiceImpl extends ServiceImpl<SysFnAccountMapper, Sys
*/
@Override
public int insertSysFnAccount(SysFnAccount sysFnAccount) {
String accountNo = sysSequenceService.getNewSequenceNo(SequenceConstants.FN_ACCOUNT_NO);
sysFnAccount.setAccountNo(accountNo);
sysFnAccount.setCreateTime(DateUtils.getNowDate());
return sysFnAccountMapper.insert(sysFnAccount);
}
@ -96,4 +112,31 @@ public class SysFnAccountServiceImpl extends ServiceImpl<SysFnAccountMapper, Sys
public int deleteSysFnAccountById(Long id) {
return sysFnAccountMapper.deleteById(id);
}
@Override
public SysFnAccountResponse getSysFnAccountByNo(String accountNo) {
SysFnAccount sysFnAccount = getOne(new QueryWrapper<SysFnAccount>().lambda().eq(SysFnAccount::getAccountNo, accountNo));
SysFnAccountResponse sysFnAccountResponse = BeanUtil.copyProperties(sysFnAccount, SysFnAccountResponse.class);
//计算可用金额
BigDecimal usableAmount = sysFnAccountResponse.getTotalAmount().subtract(sysFnAccountResponse.getFreezeAmount());
sysFnAccountResponse.setUsableAmount(usableAmount);
return sysFnAccountResponse;
}
@Override
public boolean rechargeAccount(RechargeAccountRequest rechargeAccountRequest) {
LambdaQueryWrapper<SysFnAccount> lambda = new QueryWrapper<SysFnAccount>().lambda();
SysFnAccount fnAccount = getOne(lambda.eq(SysFnAccount::getAccountNo, rechargeAccountRequest.getAccountNo()));
BigDecimal rechargeAmount = Optional.ofNullable(rechargeAccountRequest.getRechargeAmount()).orElse(BigDecimal.ZERO);
BigDecimal amount = rechargeAmount.add(fnAccount.getTotalAmount());
fnAccount.setTotalAmount(amount);
updateSysFnAccount(fnAccount);
SysFnAccountBill sysFnAccountBill=new SysFnAccountBill();
sysFnAccountBill.setAccountNo(rechargeAccountRequest.getAccountNo());
sysFnAccountBill.setBillAmount(rechargeAccountRequest.getRechargeAmount());
sysFnAccountBill.setBillType(1);
sysFnAccountBill.setRemark("充值");
sysFnAccountBillService.insertSysFnAccountBill(sysFnAccountBill);
return false;
}
}