添加钱包模块、美化前端

This commit is contained in:
EhusoeAsom 2024-04-23 14:59:38 +08:00
parent 1c54eaff29
commit 2681504445
39 changed files with 2463 additions and 1440 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -130,7 +130,8 @@
return;
}
let url=`DeliveryAddressController/saveDeliveryAddress/${this.deliveryAddress.contactName}/${this.deliveryAddress.contactSex}/${this.deliveryAddress.contactTel}/${this.deliveryAddress.address}/${this.user.userId}`
let url =
`DeliveryAddressController/saveDeliveryAddress/${this.deliveryAddress.contactName}/${this.deliveryAddress.contactSex}/${this.deliveryAddress.contactTel}/${this.deliveryAddress.address}/${this.user.userId}`
this.$axios.post(url).then(response => {
if (response.data.result > 0) {
this.$router.push({
@ -174,39 +175,40 @@
width: 100%;
height: 12vw;
background-color: #01B0F2;
font-size: 4.8vw;
font-size: 5.5vw;
color: #fff;
z-index: 10;
display: flex;
justify-content: flex-start;
justify-content: center;
align-items: center;
position: fixed;
left: 0;
top: 0;
transition: all 0.3s ease;
}
.wrapper header i {
margin: 0vw 0vw 0vw 3vw;
font-size: 6vw;
margin-right: 3vw;
font-size: 7vw;
user-select: none;
cursor: pointer;
}
.wrapper header p {
margin: 0vw 0vw 0vw 33.5vw;
margin-left: 3vw;
}
.wrapper .shangbiao {
width: 100vw;
height: 20vw;
margin-top: 20vw;
margin-top: 14vw;
display: flex;
justify-content: center;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}
.wrapper .shangbiao img {
width: 30vw;
height: 25vw;
@ -224,26 +226,39 @@
}
.wrapper .identify input {
width: 70%;
height: 8vw;
font-size: 4vw;
width: 80%;
height: 10vw;
font-size: 4.5vw;
background-color: #d4ebfe;
border-radius: 2.5vw;
border-radius: 5vw;
outline: none;
border-style: dotted;
border: none;
padding: 0 2vw;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}
.wrapper .identify button {
width: 14vw;
height: 8vw;
border-radius: 3vw;
width: 16vw;
height: 10vw;
border-radius: 5vw;
margin-left: 3vw;
background-color: #01B0F2;
border: none;
outline: none;
cursor: pointer;
transition: all 0.3s ease;
}
.wrapper .identify button p {
font-size: 3.5vw;
font-size: 4vw;
color: #fff;
}
.wrapper .identify button:hover {
transform: scale(1.1);
}
/******列表******/
.wrapper .form {
@ -253,18 +268,17 @@
.wrapper .form li {
box-sizing: border-box;
padding: 4vw 3vw 0 3vw;
padding: 3vw 3vw 0 3vw;
display: flex;
align-items: center;
}
.wrapper .form li .title {
flex: 0 0 18vw;
font-size: 4vw;
font-weight: 450;
color: #666;
margin-left: 5vw;
flex: 0 0 20vw;
font-size: 4.5vw;
font-weight: 500;
color: #333;
margin-left: 3vw;
}
.wrapper .form li .content {
@ -275,7 +289,9 @@
outline: none;
width: 90%;
height: 7vw;
font-size: 3.5vw;
font-size: 4vw;
border: none;
border-bottom: 1px solid #ccc;
}
.wrapper .form li .gender {
@ -285,9 +301,6 @@
justify-content: center;
}
/*******确认修改********/
.wrapper .ok {
height: 20vw;
width: 100vw;
@ -298,17 +311,17 @@
.wrapper .ok button {
width: 35vw;
height: 8vw;
border-radius: 3vw;
margin-left: 3vw;
height: 10vw;
border-radius: 5vw;
background-color: #4ba0fa;
border: none;
margin-top: 8vw;
margin-top: 6vw;
font-size: 4.5vw;
font-weight: 600;
color: #fff;
}
.wrapper .ok p{
font-size: 4vw;
color: #fff;
font-weight: 800;
.wrapper .ok button:hover {
background-color: #3687d8;
}
</style>

View File

@ -285,9 +285,11 @@
/****************header部分***************/
.wrapper header {
width: 100%;
height: 12vw;
height: 14vw;
/* 增大header高度 */
background-color: #01B0F2;
font-size: 4.8vw;
font-size: 5vw;
/* 调整字体大小 */
color: #fff;
z-index: 10;
@ -302,21 +304,26 @@
}
.wrapper header i {
margin: 0vw 0vw 0vw 3vw;
font-size: 6vw;
margin: 0vw 0vw 0vw 4vw;
/* 调整返回按钮的间距 */
font-size: 7vw;
/* 调整返回按钮的大小 */
user-select: none;
cursor: pointer;
}
.wrapper header p {
margin: 0vw 0vw 0vw 33.5vw;
margin: 0vw 0vw 0vw 35vw;
/* 调整标题的间距 */
}
/****************商家logo部分***************/
.wrapper .business-logo {
width: 100%;
height: 35vw;
padding-top: 12vw;
height: 40vw;
/* 增大商家logo部分高度 */
padding-top: 14vw;
/* 调整商家logo上方间距 */
display: flex;
justify-content: center;
@ -324,15 +331,19 @@
}
.wrapper .business-logo img {
width: 40vw;
height: 30vw;
border-radius: 2vw;
width: 45vw;
/* 增大商家logo图片尺寸 */
height: 35vw;
/* 调整商家logo图片尺寸 */
border-radius: 2.5vw;
/* 调整边框圆角 */
}
/****************商家信息部分***************/
.wrapper .business-info {
width: 100%;
height: 20vw;
height: 25vw;
/* 增大商家信息部分高度 */
display: flex;
flex-direction: column;
@ -341,56 +352,44 @@
}
.wrapper .business-info h1 {
font-size: 5vw;
font-size: 6vw;
/* 调整商家名称字体大小 */
}
.wrapper .business-info p {
font-size: 3vw;
font-size: 4vw;
/* 调整商家信息字体大小 */
color: #666;
margin-top: 1.2vw;
}
/****************收藏按钮***************/
.wrapper .collect-button0 {
position: fixed;
font-size: 3vw;
color: white;
background-color: gray;
align-items: center;
justify-content: center;
padding: 1vw;
right: 0;
top: 13vw;
}
.wrapper .collect-button1 {
position: fixed;
font-size: 3vw;
color: white;
background-color: #01B0F2;
align-items: center;
justify-content: center;
padding: 1vw;
right: 0;
top: 13vw;
margin-top: 1.5vw;
/* 调整商家信息顶部间距 */
}
/****************食品信息部分***************/
.wrapper .food {
width: 100%;
padding-bottom: 14vw;
padding-bottom: 16vw;
/* 增大底部填充 */
}
.wrapper .food li {
width: 100%;
box-sizing: border-box;
padding: 2.5vw;
padding: 3vw;
/* 调整内边距 */
user-select: none;
display: flex;
justify-content: space-between;
align-items: center;
transition: all 0.3s ease;
/* 添加过渡效果 */
}
.wrapper .food li:hover {
background-color: #f4f4f4;
/* 鼠标悬停时背景色变化 */
}
.wrapper .food li .food-left {
@ -399,51 +398,71 @@
}
.wrapper .food li .food-left img {
width: 20vw;
height: 20vw;
border-radius: 1vw;
width: 22vw;
/* 增大食品图片尺寸 */
height: 22vw;
/* 增大食品图片尺寸 */
border-radius: 1.5vw;
/* 调整边框圆角 */
transition: all 0.3s ease;
/* 添加过渡效果 */
}
.wrapper .food li .food-left img:hover {
transform: scale(1.05);
/* 鼠标悬停时放大图片 */
}
.wrapper .food li .food-left .food-left-info {
margin-left: 3vw;
margin-left: 4vw;
/* 调整左侧信息的间距 */
}
.wrapper .food li .food-left .food-left-info h3 {
font-size: 3.8vw;
font-size: 4vw;
/* 调整标题字体大小 */
color: #555;
}
.wrapper .food li .food-left .food-left-info p {
font-size: 3vw;
font-size: 3.2vw;
/* 调整文本字体大小 */
color: #888;
margin-top: 2vw;
margin-top: 2.5vw;
/* 调整顶部间距 */
}
.wrapper .food li .food-right {
width: 16vw;
width: 18vw;
/* 增大右侧部分宽度 */
display: flex;
justify-content: space-between;
align-items: center;
}
.wrapper .food li .food-right .fa-minus-circle {
font-size: 5.5vw;
.wrapper .food li .food-right .fa-minus-circle,
.wrapper .food li .food-right .fa-plus-circle {
font-size: 6vw;
/* 调整按钮图标大小 */
color: #999;
cursor: pointer;
transition: all 0.3s ease;
/* 添加过渡效果 */
}
.wrapper .food li .food-right .fa-minus-circle:hover,
.wrapper .food li .food-right .fa-plus-circle:hover {
color: #01B0F2;
/* 鼠标悬停时按钮颜色变化 */
}
.wrapper .food li .food-right p {
font-size: 3.6vw;
font-size: 4vw;
/* 调整数量文本字体大小 */
color: #333;
}
.wrapper .food li .food-right .fa-plus-circle {
font-size: 5.5vw;
color: #01B0F2;
cursor: pointer;
}
/****************** 购物车部分 ******************/
.wrapper .cart {
width: 100%;
@ -541,4 +560,31 @@
align-items: center;
}
*/
/****************收藏按钮***************/
.wrapper .collect-button0 {
position: fixed;
font-size: 4vw;
color: white;
background-color: gray;
align-items: center;
justify-content: center;
padding: 1vw;
right: 0;
top: 15vw;
border-radius: 10vw 0 0 10vw;
}
.wrapper .collect-button1 {
position: fixed;
font-size: 4vw;
color: white;
background-color: #01B0F2;
align-items: center;
justify-content: center;
padding: 1vw;
right: 0;
top: 15vw;
border-radius: 10vw 0 0 10vw;
}
</style>

View File

@ -155,9 +155,32 @@
background-color: #fff;
cursor: pointer;
border-radius: 2vw;
display: flex;
align-items: center;
animation: fadeIn 1.0s ease forwards;
opacity: 0;
/* 初始透明度为0 */
transition: background-color 0.3s, transform 0.3s;
}
.wrapper .business li:hover .border {
background-color: #E0F2FE;
transform: scale(1.05);
}
.wrapper .business li:active .border {
border: 2px solid #FF5722;
transform: scale(0.95);
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.wrapper .business li .border .business-img {
@ -168,6 +191,15 @@
width: 20vw;
height: 20vw;
border-radius: 2vw;
transition: transform 0.3s;
}
.wrapper .business li .border:hover .business-img img {
transform: scale(1.1);
}
.wrapper .business li .border:active .business-img img {
transform: scale(0.9);
}
.wrapper .business li .border .business-img .business-img-quantity {

View File

@ -7,7 +7,7 @@
</header>
<!-- 地址列表部分 -->
<ul class="addresslist">
<li v-for="item in CouponList">
<li v-for="item in CouponList" v-show="this.totalPrice>=item.limitNum">
<!-- <div class="addresslist-left" @click="setDeliveryAddress(item)">
<h3>{{item.contactName}}{{getSexText(item.contactSex)}} {{item.contactTel}}
</h3>
@ -50,6 +50,7 @@
user: {},
deliveryAddressArr: [],
CouponList:[],
totalPrice:this.$route.query.totalPrice,
}
},
created() {

View File

@ -44,7 +44,7 @@
<!-- 合计部分 -->
<div class="total">
<div class="total-left">
&#165;{{ totalPrice }}
&#165;{{ finalPrice }}
</div>
<div class="box">
<div class="total-right" @click="toPayment">
@ -66,10 +66,14 @@ export default {
cartArr: [],
deliveryaddress: {},
availablePointArr: [],
couponUsed: {}
couponUsed: {},
}
},
created() {
// finalPrice
// finalPrice=totalPrice;
this.user = this.$getSessionStorage('user');
this.deliveryaddress = this.$getLocalStorage(this.user.userId);
this.couponUsed = this.$getLocalStorage(this.businessId);
@ -96,13 +100,25 @@ export default {
totalPrice += cartItem.food.foodPrice * cartItem.quantity;
}
totalPrice += this.business.deliveryPrice;
//
// if (this.couponUsed != null) {
// totalPrice -= this.couponUsed.minusNum;
// }
return totalPrice;
},
finalPrice() {
let totalPrice = 0;
for (let cartItem of this.cartArr) {
totalPrice += cartItem.food.foodPrice * cartItem.quantity;
}
totalPrice += this.business.deliveryPrice;
//
if (this.couponUsed != null) {
totalPrice -= this.couponUsed.minusNum;
}
return totalPrice;
}
},
methods: {
back() {
@ -126,14 +142,19 @@ export default {
}
//
let url = `OrdersController/createOrders/${this.user.userId}/${this.businessId}/${this.deliveryaddress.daId}/${this.totalPrice}`
let finalPrice = this.totalPrice;
if (this.couponUsed != null) {
finalPrice -= this.couponUsed.minusNum;
}
let url =
`OrdersController/createOrders/${this.user.userId}/${this.businessId}/${this.deliveryaddress.daId}/${this.finalPrice}`
this.$axios.post(url).then(response => {
let orderId = response.data.result;
if (orderId > 0) {
//
if (this.couponUsed != null) {
this.$axios.delete(`CouponController/deleteCouponByCouponId/${this.couponUsed.couponId}`);
this.$axios.delete(
`CouponController/deleteCouponByCouponId/${this.couponUsed.couponId}`);
}
this.$router.push({
path: '/payment',
@ -143,8 +164,8 @@ export default {
reduction: this.couponUsed === null ? 0 : this.couponUsed.minusNum
}
});
this.$removeSessionStorage(this.businessId);
this.$setLocalStorage(this.businessId,null);
console.log("this.$removeSessionStorage(this.businessId)");
} else {
alert('创建订单失败!');
}
@ -153,11 +174,11 @@ export default {
});
},
toCouponSelect() {
this.$router.push(
{
this.$router.push({
path: '/CouponSelect',
query: {
businessId: this.businessId
businessId: this.businessId,
totalPrice: this.totalPrice
}
});
},

View File

@ -50,12 +50,16 @@
<h2 v-show="paySuccess" style="color: #0097FF;text-align: center;">
支付成功
</h2>
<h2 v-show="noMoney" style="color: red;text-align: center;">
钱包余额不足
</h2>
<!-- 底部菜单部分 -->
<Footer></Footer>
</div>
</template>
<script>
import Footer from '../components/Footer.vue';
export default {
name: 'Payment',
data() {
@ -68,7 +72,8 @@ export default {
},
isShowDetailet: false,
paySuccess: false,
isPayed: false
isPayed: false,
noMoney: false
}
},
created() {
@ -100,60 +105,51 @@ export default {
}
},
methods: {
back() {
this.$router.go(-1);
},
detailetShow() {
this.isShowDetailet = !this.isShowDetailet;
},
pay() {
// this.$axios.put('OrdersController/Orders', this.$qs.stringify({
// orderId: this.orderId,
// userId: this.userId,
// orderTotal: this.orders.orderTotal,
// reduction: this.reduction
// }),{
// headers: {
// Authorization:this.$getSessionStorage('user').password
// }
// }).then(response => {
// let orderId = response.data;
// if (orderId > 0) {
// this.paySuccess=true;
// this.isPayed=true;
// setTimeout(() => {
// this.$router.push({
// path: '/orderList'
// });
// }, 500);
// } else {
// alert('');
// }
// }).catch(error => {
// console.error(error);
// });
let url0 = `WalletController/expense/${this.userId}/${this.orders.orderTotal}`;
let url = `OrdersController/Orders/${this.orderId}`;
console.log("Kicked");
let url=`OrdersController/Orders/${this.orderId}`
this.$axios.post(url0)
.then(response => {
if (response.data.result === 1) {
// url0 1 url
this.$axios.put(url)
.then(
response =>
{
console.log(response);
console.log("支付成功");
let url=`PointController/addPointByPointId/${this.userId}/${this.orders.orderDate}/${this.orders.orderTotal*10}`
.then(response => {
let url =
`PointController/addPointByPointId/${this.userId}/${this.orders.orderDate}/${this.orders.orderTotal * 10}`;
console.log(url);
this.$axios.post(url).then(response =>
{
this.$axios.post(url)
.then(response => {
console.log(response.data);
});
this.$router.push({path:'/orderList'});
}
)
.catch(error =>
{
this.paySuccess = true;
this.isPayed = true;
setTimeout(() => {
this.$router.push({
path: '/orderList'
})
}, 500);
})
.catch(error => {
console.error(error);
});
} else {
// url0 1
this.noMoney = true
setTimeout(() => {
this.noMoney = false
}, 1000);
}
);
})
.catch(error => {
console.error(error);
});
}
},
components: {

View File

@ -5,17 +5,71 @@
<i class="fa fa-angle-left" @click="back"></i>
<p>我的钱包</p>
</header>
<div class="wallet-total">
<div class="num">
<img src="../assets/钱包.png">
<p style="color: black;">{{balance}}</p>
</div>
<div class="text">
<p></p>
</div>
</div>
<div class="wallet-detail">
<div class="top">
<p :class="{ active: isShouzhi }" @click="toggleTab('shouzhi')">钱包流水</p>
</div>
<div class="border">
<ul class="get-pay" v-show="isShouzhi">
<li class="li1">
<ul class="details">
<li class="x">
<h4>交易时间</h4>
</li>
<li class="y">
<h4>交易额</h4>
</li>
<li class="y">
<h4>余额</h4>
</li>
<li class="y">
<h4>交易类型</h4>
</li>
</ul>
</li>
<li class="li1">
<ul class="details" v-for="item in availablePointArr">
<li class="x">
<h4>{{item.transactionTime}}</h4>
</li>
<li class="y">
<p>{{ item.transactionNum }}</p>
</li>
<li class="y">
<p>{{ item.balance }}</p>
</li>
<li class="y">
<p style="color: green;">{{ item.transactionType }}</p>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Wallet',
name: 'walletDetails',
data() {
return {
isShouzhi: true,
availablePointArr: [],
outDatePointArr: [],
balance: [],
user: {}
};
},
@ -26,7 +80,33 @@
}
},
created() {
this.user = this.$getSessionStorage('user');
this.$axios.get(`WalletController/listWallets`, {
params: {
userId: this.user.userId
},
headers: {
Authorization: this.user.password
}
}).then(response => {
//
let result = response.data.result;
this.availablePointArr = result;
console.log(response);
// console.log(this.user.userId+" "+this.user.password);
}).catch(error => {
console.error(error);
});
let url = `WalletController/getWalletBalance/${this.user.userId}`
this.$axios.get(url).then(response => {
let result = response.data.result;
this.balance = result;
console.log("balance:\n" + result)
}).catch(error => {
console.error(error);
});
},
methods: {
back() {
@ -76,38 +156,39 @@
margin: 0vw 0vw 0vw 32vw;
}
.wrapper .points-total {
.wrapper .wallet-total {
padding-top: 20vw;
}
.wrapper .points-total .num {
.wrapper .wallet-total .num {
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 1vw;
}
.wrapper .points-total .num p {
font-size: 6vw;
.wrapper .wallet-total .num p {
font-size: 6.5vw;
padding-left: 2vw;
}
.wrapper .points-total .num img {
width: 8vw;
height: 8vw;
.wrapper .wallet-total .num img {
width: 12vw;
height: 12vw;
}
.wrapper .points-total .text {
.wrapper .wallet-total .text {
display: flex;
justify-content: center;
align-items: center;
font-size: 2.8vw;
}
.wrapper .points-detail {
.wrapper .wallet-detail {
padding-top: 6vw;
}
.wrapper .points-detail .top {
.wrapper .wallet-detail .top {
display: flex;
justify-content: space-around;
align-items: center;
@ -115,64 +196,49 @@
padding-bottom: 2vw;
}
.wrapper .points-detail .top p {
.wrapper .wallet-detail .top p {
font-weight: normal;
user-select: none;
cursor: pointer;
}
.wrapper .points-detail .top p.active {
.wrapper .wallet-detail .top p.active {
font-weight: bold;
user-select: none;
cursor: pointer;
}
.wrapper .points-detail .border {
.wrapper .wallet-detail .border {
width: 100%;
padding: 2vw 2vw 0vw 2vw;
box-sizing: border-box;
}
.wrapper .points-detail .border .get-pay {
.wrapper .wallet-detail .border .get-pay {
width: 100%;
background-color: #fff;
border-radius: 2vw;
}
.wrapper .points-detail .border .get-pay .li1 {
.wrapper .wallet-detail .border .get-pay .li1 {
padding: 2vw 0vw;
}
.wrapper .points-detail .border .get-pay .details {
.wrapper .wallet-detail .border .get-pay .details {
display: flex;
margin: 0vw 2vw;
padding: 0vw 2vw 1vw 2vw;
}
.wrapper .points-detail .border .get-pay .details li {
width: 34%;
.wrapper .wallet-detail .border .get-pay .details .x{
width: 37%;
font-size: 2.8vw;
display: flex;
justify-content: center;
align-items: center;
}
.wrapper .points-detail .border .duihuan {
width: 100%;
background-color: #fff;
border-radius: 2vw;
}
.wrapper .points-detail .border .duihuan .li1 {
padding: 2vw 0vw;
}
.wrapper .points-detail .border .duihuan .details {
display: flex;
margin: 0vw 2vw;
}
.wrapper .points-detail .border .duihuan .details li {
width: 34%;
.wrapper .wallet-detail .border .get-pay .details .y{
width: 21%;
font-size: 2.8vw;
display: flex;
justify-content: center;

View File

@ -25,7 +25,11 @@
<module name="deliveryaddress_server_10500" />
<module name="search_server_11600" />
<module name="business_server_10300" />
<module name="wallet_server_11000" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="wallet_server_10800" target="1.8" />
</bytecodeTargetLevel>
</component>
</project>

View File

@ -41,5 +41,7 @@
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/user_server_10100/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/user_server_10100/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wallet_server_11000/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/wallet_server_11000/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="wallet_server_11000" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
<module name="wallet_server_11000" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.neusoft.MyApplication" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.neusoft.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,37 @@
package com.neusoft.service.impl;
import com.neusoft.po.Cart;
import com.neusoft.service.CartService;
import java.util.List;
public abstract class AbstractCartService implements CartService {
protected abstract List<Cart> listCartInternal(Cart cart);
protected abstract int saveCartInternal(Cart cart);
protected abstract int updateCartInternal(Cart cart);
protected abstract int removeCartInternal(Cart cart);
@Override
public List<Cart> listCart(Cart cart) {
return listCartInternal(cart);
}
@Override
public int saveCart(Cart cart) {
return saveCartInternal(cart);
}
@Override
public int updateCart(Cart cart) {
return updateCartInternal(cart);
}
@Override
public int removeCart(Cart cart) {
return removeCartInternal(cart);
}
}

View File

@ -1,36 +1,38 @@
//模板方法模式
/*模板方法模式可以将一些共同的行为放在一个抽象类中,然后由具体的子类实现具体的行为。创建一个抽象的 AbstractCartService 类,其中包含通用的方法实现,然后 CartServiceImpl 类继承这个抽象类并实现具体的方法。*/
package com.neusoft.service.impl;
import com.neusoft.mapper.CartMapper;
import com.neusoft.po.Cart;
import com.neusoft.service.CartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class CartServiceImpl implements CartService {
public class CartServiceImpl extends AbstractCartService {
@Autowired
private CartMapper cartMapper;
@Override
public List<Cart> listCart(Cart cart) {
protected List<Cart> listCartInternal(Cart cart) {
return cartMapper.listCart(cart);
}
@Override
public int saveCart(Cart cart) {
protected int saveCartInternal(Cart cart) {
return cartMapper.saveCart(cart);
}
@Override
public int updateCart(Cart cart) {
protected int updateCartInternal(Cart cart) {
return cartMapper.updateCart(cart);
}
@Override
public int removeCart(Cart cart) {
protected int removeCartInternal(Cart cart) {
return cartMapper.removeCart(cart);
}
}

View File

@ -73,6 +73,11 @@ spring:
predicates:
- Path=/CollectController/*/**
- id: walletServer
uri: lb://wallet-server
predicates:
- Path=/WalletController/*/**
eureka:
client:
service-url:

View File

@ -73,6 +73,11 @@ spring:
predicates:
- Path=/CollectController/*/**
- id: walletServer
uri: lb://wallet-server
predicates:
- Path=/WalletController/*/**
eureka:
client:
service-url:

View File

@ -0,0 +1,12 @@
package com.neusoft.controller;
import com.neusoft.po.CommonResult;
import org.springframework.stereotype.Component;
@Component
public class CommonResultFactory {
public <T> CommonResult<T> createSuccessResult(T data) {
return new CommonResult<>(200, "success", data);
}
}

View File

@ -6,6 +6,7 @@ import com.neusoft.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;
import com.neusoft.controller.CommonResultFactory;
import java.util.List;
@ -16,6 +17,12 @@ public class OrdersController {
@Autowired
private OrdersService ordersService;
private final CommonResultFactory commonResultFactory;
public OrdersController(CommonResultFactory commonResultFactory) {
this.commonResultFactory = commonResultFactory;
}
@PostMapping("/createOrders/{userId}/{businessId}/{daId}/{orderTotal}")
public CommonResult<Integer> createOrders(
@PathVariable("userId") String userId,
@ -29,26 +36,26 @@ public class OrdersController {
param.setDaId(daId);
param.setOrderTotal(orderTotal);
int orderId=ordersService.createOrders(param);
return new CommonResult<>(200,"success",orderId);
return commonResultFactory.createSuccessResult(orderId);
}
@GetMapping("/getOrdersById/{orderId}")
public CommonResult<Orders> getOrdersById(@PathVariable("orderId") Integer orderId) throws Exception {
Orders orders=ordersService.getOrdersById(orderId);
return new CommonResult<>(200,"success",orders);
return commonResultFactory.createSuccessResult(orders);
}
@GetMapping("/listOrdersByUserId/{userId}")
public CommonResult<List<Orders>> listOrdersByUserId(@PathVariable("userId") String userId) throws Exception {
List<Orders> list=ordersService.listOrdersByUserId(userId);
return new CommonResult<>(200,"success",list);
return commonResultFactory.createSuccessResult(list);
}
@PutMapping("/Orders/{orderId}")
public CommonResult<Integer>payOrdersById(@PathVariable("orderId") Integer orderId)throws Exception
{
int result=ordersService.payOrdersById(orderId, null, null, null);
return new CommonResult<>(200,"success",result);
return commonResultFactory.createSuccessResult(result);
}

View File

@ -0,0 +1,12 @@
package com.neusoft.controller;
import com.neusoft.po.CommonResult;
import org.springframework.stereotype.Component;
@Component
public class CommonResultFactory {
public <T> CommonResult<T> createSuccessResult(T data) {
return new CommonResult<>(200, "success", data);
}
}

View File

@ -16,6 +16,12 @@ public class OrdersController {
@Autowired
private OrdersService ordersService;
private final CommonResultFactory commonResultFactory;
public OrdersController(CommonResultFactory commonResultFactory) {
this.commonResultFactory = commonResultFactory;
}
@PostMapping("/createOrders/{userId}/{businessId}/{daId}/{orderTotal}")
public CommonResult<Integer> createOrders(
@PathVariable("userId") String userId,
@ -29,21 +35,29 @@ public class OrdersController {
param.setDaId(daId);
param.setOrderTotal(orderTotal);
int orderId=ordersService.createOrders(param);
return new CommonResult<>(200,"success",orderId);
return commonResultFactory.createSuccessResult(orderId);
}
@GetMapping("/getOrdersById/{orderId}")
public CommonResult<Orders> getOrdersById(@PathVariable("orderId") Integer orderId) throws Exception {
Orders orders=ordersService.getOrdersById(orderId);
return new CommonResult<>(200,"success",orders);
return commonResultFactory.createSuccessResult(orders);
}
@GetMapping("/listOrdersByUserId/{userId}")
public CommonResult<List<Orders>> listOrdersByUserId(@PathVariable("userId") String userId) throws Exception {
List<Orders> list=ordersService.listOrdersByUserId(userId);
return new CommonResult<>(200,"success",list);
return commonResultFactory.createSuccessResult(list);
}
@PutMapping("/Orders/{orderId}")
public CommonResult<Integer>payOrdersById(@PathVariable("orderId") Integer orderId)throws Exception
{
int result=ordersService.payOrdersById(orderId, null, null, null);
return commonResultFactory.createSuccessResult(result);
}
// @PutMapping("/Orders")
// public int payOrdersById(OrderState orderState, @RequestHeader("Authorization") String token) throws Exception {
// return ordersService.payOrdersById(orderState.getOrderId(), orderState.getUserId(), orderState.getOrderTotal(), orderState.getReduction(),token);

View File

@ -27,6 +27,7 @@
<module>point_server_10900</module>
<module>coupon_server_10950</module>
<module>collect_server_10800</module>
<module>wallet_server_11000</module>
</modules>
<packaging>pom</packaging>

View File

@ -0,0 +1,65 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.neusoft</groupId>
<artifactId>springcloud_elm</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>wallet_server_11000</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.20</version>
<scope>runtime</scope>
</dependency>
<!-- 热部署 gav -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.neusoft</groupId>
<artifactId>business_server_10300</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,11 @@
package com.neusoft;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MyApplication {
public static void main(String[] args){
SpringApplication.run(MyApplication.class,args);
}
}

View File

@ -0,0 +1,41 @@
package com.neusoft.controller;
import com.neusoft.po.CommonResult;
import com.neusoft.po.Wallet;
import com.neusoft.service.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/WalletController")
public class WalletController {
@Autowired
private WalletService walletService;
@GetMapping("/listWallets")
public CommonResult<List<Wallet>> listWallets(@RequestParam("userId") String userId, @RequestHeader("Authorization") String token) throws Exception {
return new CommonResult<>(200, "success", walletService.listWallets(userId, token));
}
@PostMapping("/deposit/{userId}/{amount}")
public CommonResult<Integer> deposit(@PathVariable("userId") String userId, @PathVariable("amount") double amount) {
return new CommonResult<>(200, "success", walletService.deposit(userId, amount));
}
@PostMapping("/withdraw/{userId}/{amount}")
public CommonResult<Integer> withdraw(@PathVariable("userId") String userId, @PathVariable("amount") double amount) {
return new CommonResult<>(200, "success", walletService.withdraw(userId, amount));
}
@PostMapping("/expense/{userId}/{amount}")
public CommonResult<Integer> transfer(@PathVariable("userId") String userId,@PathVariable("amount") double amount) {
return new CommonResult<>(200, "success", walletService.expense(userId, amount));
}
@GetMapping("/getWalletBalance/{userId}")
public CommonResult<Double> getWalletBalance(@PathVariable("userId") String userId) {
return new CommonResult<>(200, "success", walletService.getWalletBalance(userId));
}
}

View File

@ -0,0 +1,29 @@
package com.neusoft.mapper;
import com.neusoft.po.Point;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface PointMapper {
@Select("select * from point where userId=#{userId}")
public List<Point> listPointsByUserId(String userId);
@Update("update point set pointNum=#{pointNum} where pointId=#{pointId}")
public void setPointByPointId(Point point);
@Delete("delete from point where pointId=#{pointId}")
public void deletePointByPointId(String pointId);
@Select("insert into point(userId,pointDate,pointNum,outDate) values(#{userId},#{pointDate},#{pointNum},#{outDate})")
@Options(useGeneratedKeys=true,keyProperty="pointId",keyColumn="pointId")
public void addPointByPointId(Point point);
}

View File

@ -0,0 +1,18 @@
package com.neusoft.mapper;
import com.neusoft.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper
public interface UserMapper {
@Select("select * from user where userId=#{userId} and password=#{password}")
public User getUserByIdByPass(User user);
@Select("select count(*) from user where userId=#{userId}")
public int getUserById(String userId);
@Insert("insert into user values(#{userId},#{password},#{userName},#{userSex},null,1)")
public int saveUser(User user);
}

View File

@ -0,0 +1,20 @@
package com.neusoft.mapper;
import com.neusoft.po.Wallet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface WalletMapper {
@Select("select * from wallet where userId=#{userId}")
public List<Wallet> listWalletsByUserId(String userId);
@Select("insert into wallet(userId,balance,transactionNum,transactionTime,transactionType) values(#{userId},#{balance},#{transactionNum},#{transactionTime},#{transactionType})")
@Options(useGeneratedKeys=true,keyProperty="walletId",keyColumn="walletId")
public void addWalletByWallet(Wallet wallet);
}

View File

@ -0,0 +1,41 @@
package com.neusoft.po;
import java.io.Serializable;
public class CommonResult<T> implements Serializable {
private Integer code;
private String message;
private T result;
public CommonResult() {}
public CommonResult(Integer code, String message, T result) {
this.code = code;
this.message = message;
this.result = result;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getResult() {
return result;
}
public void setResult(T result) {
this.result = result;
}
}

View File

@ -0,0 +1,63 @@
package com.neusoft.po;
public class Point {
private String pointId;
private String userId;
private String pointDate;
private Integer pointNum;
private String outDate;
public Point()
{
}
public Point(String pointId,String userId,String pointDate,Integer pointNum,String outDate)
{
this.pointId=pointId;
this.userId=userId;
this.pointDate=pointDate;
this.pointNum=pointNum;
this.outDate=outDate;
}
public String getPointId()
{
return this.pointId;
}
public String getUserId()
{
return this.userId;
}
public String getPointDate()
{
return this.pointDate;
}
public Integer getPointNum()
{
return this.pointNum;
}
public void setPointId(String pointId)
{
this.pointId=pointId;
}
public void setUserId(String userId)
{
this.userId=userId;
}
public void setPointDate(String pointDate)
{
this.pointDate=pointDate;
}
public void setPointNum(Integer pointNum)
{
this.pointNum=pointNum;
}
public String getOutDate() {
return outDate;
}
public void setOutDate(String outDate) {
this.outDate = outDate;
}
}

View File

@ -0,0 +1,18 @@
package com.neusoft.po;
public enum TransactionType {
DEPOSIT("Deposit"),
WITHDRAWAL("Withdrawal"),
EXPENSE("Expense"),
CREATE("Create");
private final String type;
TransactionType(String type) {
this.type = type;
}
public String getType() {
return type;
}
}

View File

@ -0,0 +1,59 @@
package com.neusoft.po;
public class User {
private String userId;
private String password;
private String userName;
private Integer userSex;
private String userImg;
private Integer delTag;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Integer getUserSex() {
return userSex;
}
public void setUserSex(Integer userSex) {
this.userSex = userSex;
}
public String getUserImg() {
return userImg;
}
public void setUserImg(String userImg) {
this.userImg = userImg;
}
public Integer getDelTag() {
return delTag;
}
public void setDelTag(Integer delTag) {
this.delTag = delTag;
}
}

View File

@ -0,0 +1,71 @@
package com.neusoft.po;
import java.util.Date;
public class Wallet {
private Integer walletId;
private String userId;
private double balance;
private double transactionNum;
private String transactionTime;
private TransactionType transactionType;
public Wallet(Integer walletId,String userId,double balance,double transactionNum,String transactionTime,TransactionType transactionType)
{
this.walletId=walletId;
this.userId=userId;
this.balance=balance;
this.transactionNum=transactionNum;
this.transactionTime=transactionTime;
this.transactionType=transactionType;
}
public Integer getWalletId() {
return walletId;
}
public void setWalletId(Integer walletId) {
this.walletId = walletId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
public String getTransactionTime() {
return transactionTime;
}
public void setTransactionTime(String transactionTime) {
this.transactionTime = transactionTime;
}
public TransactionType getTransactionType() {
return transactionType;
}
public void setTransactionType(TransactionType transactionType) {
this.transactionType = transactionType;
}
public double getTransactionNum() {
return transactionNum;
}
public void setTransactionNum(double transactionNum) {
this.transactionNum = transactionNum;
}
}

View File

@ -0,0 +1,19 @@
package com.neusoft.service;
import java.text.ParseException;
import java.util.List;
import com.neusoft.po.Wallet;
public interface WalletService {
public List<Wallet> listWallets(String userId, String token) throws ParseException;
public int deposit(String userId, double amount);
public int withdraw(String userId, double amount);
public int expense(String userId, double amount);
public double getWalletBalance(String userId);
}

View File

@ -0,0 +1,152 @@
package com.neusoft.service.impl;
import com.neusoft.mapper.UserMapper;
import com.neusoft.mapper.WalletMapper;
import com.neusoft.po.TransactionType;
import com.neusoft.po.User;
import com.neusoft.po.Wallet;
import com.neusoft.service.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
@Service
public class WalletServiceImpl implements WalletService {
@Autowired
private WalletMapper walletMapper;
@Autowired
private UserMapper userMapper0;
@Override
public List<Wallet> listWallets(String userId, String token) throws ParseException {
User user = new User();
user.setUserId(userId);
user.setPassword(token);
if (userMapper0.getUserByIdByPass(user) == null)
return null;
List<Wallet> list = new ArrayList<>();
list = walletMapper.listWalletsByUserId(userId);
return list;
}
@Override
public int deposit(String userId, double amount) {
try {
// 获取用户当前余额
double balance = getWalletBalance(userId);
balance = balance += amount;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 创建 Wallet 对象
Wallet wallet = new Wallet(null, userId, balance, amount, sdf.format(new Date()), TransactionType.DEPOSIT);
// 调用 Mapper 方法插入数据
walletMapper.addWalletByWallet(wallet);
// 插入成功返回 1
return 1;
} catch (Exception e) {
// 插入失败记录异常并返回 0
e.printStackTrace();
return 0;
}
}
@Override
public int withdraw(String userId, double amount) {
try {
// 获取用户当前余额
double balance = getWalletBalance(userId);
// 如果余额不足直接返回 0
if (balance < amount) {
return 0;
}
// 更新余额
balance -= amount;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 创建 Wallet 对象并插入数据
Wallet wallet = new Wallet(null, userId, balance, amount, sdf.format(new Date()), TransactionType.WITHDRAWAL);
walletMapper.addWalletByWallet(wallet);
// 插入成功返回 1
return 1;
} catch (Exception e) {
// 记录异常并返回 0
e.printStackTrace();
return 0;
}
}
@Override
public int expense(String userId, double amount) {
try {
// 获取用户当前余额
double balance = getWalletBalance(userId);
// 如果余额不足直接返回 0
if (balance < amount) {
return 0;
}
// 更新余额
balance -= amount;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 创建 Wallet 对象并插入数据
Wallet wallet = new Wallet(null, userId, balance, amount, sdf.format(new Date()), TransactionType.EXPENSE);
walletMapper.addWalletByWallet(wallet);
// 插入成功返回 1
return 1;
} catch (Exception e) {
// 记录异常并返回 0
e.printStackTrace();
return 0;
}
}
@Override
public double getWalletBalance(String userId) {
try {
// 查询用户所有钱包记录
List<Wallet> wallets = walletMapper.listWalletsByUserId(userId);
// 如果用户没有钱包记录则余额为0
double balance = 0.0;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (wallets.isEmpty()) {
// 创建 Wallet 对象
Wallet wallet = new Wallet(null, userId, balance, 0.0, sdf.format(new Date()), TransactionType.CREATE);
// 调用 Mapper 方法插入数据
walletMapper.addWalletByWallet(wallet);
}
if (!wallets.isEmpty()) {
// 找到具有最大钱包ID的记录
Wallet maxWallet = Collections.max(wallets, Comparator.comparing(w -> w.getWalletId()));
// 获取最大钱包的余额
balance = maxWallet.getBalance();
}
return balance;
} catch (Exception e) {
// 发生异常时记录并返回0
e.printStackTrace();
return 0.0;
}
}
}

View File

@ -0,0 +1,19 @@
spring:
cloud:
config:
name: wallet_server_11000
profile: dev
label: master
discovery:
enabled: true
service-id: config-server
eureka:
client:
service-url:
defaultZone: http://eurekaServer13000:13000/eureka/,http://eurekaServer13001:13001/eureka/
instance:
prefer-ip-address: true #使用ip地址向eureka server进行注册
instance-id: ${spring.cloud.client.ip-address}:${server.port} #设置eureka控制台中显示的注册信息
lease-renewal-interval-in-seconds: 5
lease-expiration-duration-in-seconds: 15

View File

@ -0,0 +1,5 @@
Manifest-Version: 1.0
Built-By: ₩ᄁチ¦ᄌタ¥ヘモ
Build-Jdk: 1.8.0_371
Created-By: Maven Integration for Eclipse

View File

@ -0,0 +1,7 @@
#Generated by Maven Integration for Eclipse
#Sun Apr 21 15:15:43 CST 2024
version=1.0-SNAPSHOT
groupId=com.neusoft
m2e.projectName=wallet_server_10800
m2e.projectLocation=D\:\\OneDrive - tju.edu.cn\\my homework\\\u9AD8\u7EA7\u5B9E\u8DF5\\elm_springcloud-main\\springcloud_elm\\wallet_server_10800
artifactId=wallet_server_10800

View File

@ -0,0 +1,65 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.neusoft</groupId>
<artifactId>springcloud_elm</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>wallet_server_10800</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.20</version>
<scope>runtime</scope>
</dependency>
<!-- 热部署 gav -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.neusoft</groupId>
<artifactId>business_server_10300</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,19 @@
spring:
cloud:
config:
name: wallet_server_11000
profile: dev
label: master
discovery:
enabled: true
service-id: config-server
eureka:
client:
service-url:
defaultZone: http://eurekaServer13000:13000/eureka/,http://eurekaServer13001:13001/eureka/
instance:
prefer-ip-address: true #使用ip地址向eureka server进行注册
instance-id: ${spring.cloud.client.ip-address}:${server.port} #设置eureka控制台中显示的注册信息
lease-renewal-interval-in-seconds: 5
lease-expiration-duration-in-seconds: 15

9
wallet.sql Normal file
View File

@ -0,0 +1,9 @@
CREATE TABLE Wallet (
walletId INT PRIMARY KEY AUTO_INCREMENT,
userId VARCHAR(20),
balance DOUBLE,
transactionNum DOUBLE,
transactionTime DATETIME,
transactionType VARCHAR(50),
FOREIGN KEY (userId) REFERENCES user(userId)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;