合并qyy分支
This commit is contained in:
parent
af16ff2f41
commit
20fa736d26
|
|
@ -0,0 +1,9 @@
|
||||||
|
drop table if exists `coupon`;
|
||||||
|
Create table coupon(
|
||||||
|
couponId INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
userId VARCHAR(20),
|
||||||
|
limitNum int,
|
||||||
|
minusNum int,
|
||||||
|
couponDate Varchar(50),
|
||||||
|
outDate Varchar(50)
|
||||||
|
);
|
||||||
|
|
@ -18,6 +18,9 @@ import PointsDetails from '../views/PointsDetails.vue';
|
||||||
import Wallet from '../views/Wallet.vue';
|
import Wallet from '../views/Wallet.vue';
|
||||||
import Error403 from '../components/Error403';
|
import Error403 from '../components/Error403';
|
||||||
import SearchResults from "../views/SearchResults";
|
import SearchResults from "../views/SearchResults";
|
||||||
|
import PointStore from '../views/PointStore.vue';
|
||||||
|
import CouponDetails from '../views/CouponDetails.vue';
|
||||||
|
import CouponSelect from '../views/CouponSelect.vue';
|
||||||
|
|
||||||
|
|
||||||
const routes = [{
|
const routes = [{
|
||||||
|
|
@ -88,6 +91,19 @@ const routes = [{
|
||||||
path: '/searchResults',
|
path: '/searchResults',
|
||||||
name: 'SearchResults',
|
name: 'SearchResults',
|
||||||
component: SearchResults
|
component: SearchResults
|
||||||
|
},{
|
||||||
|
path: '/PointStore',
|
||||||
|
name: 'PointStore',
|
||||||
|
component: PointStore
|
||||||
|
}, {
|
||||||
|
path: '/CouponDetails',
|
||||||
|
name: 'CouponDetails',
|
||||||
|
component: CouponDetails
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/CouponSelect',
|
||||||
|
name: 'CouponSelect',
|
||||||
|
component: CouponSelect
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,298 @@
|
||||||
|
<template>
|
||||||
|
<div class="wrapper">
|
||||||
|
<!-- header部分 -->
|
||||||
|
<header>
|
||||||
|
<i class="fa fa-angle-left" @click="back"></i>
|
||||||
|
<p>我的券包</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="points-total">
|
||||||
|
<div class="num">
|
||||||
|
<!-- <img src="../assets/吃货豆.png">
|
||||||
|
<p style="color: goldenrod;">{{ sum }}</p> -->
|
||||||
|
</div>
|
||||||
|
<div class="text">
|
||||||
|
<p>券包有效期三天,记得使用哦~</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="points-detail">
|
||||||
|
<div class="top">
|
||||||
|
<p :class="{ active: isShouzhi }" @click="toggleTab('shouzhi')">可用积分</p>
|
||||||
|
<p :class="{ active: !isShouzhi }" @click="toggleTab('duihuan')">已过期积分</p>
|
||||||
|
</div>
|
||||||
|
<div class="border">
|
||||||
|
<ul class="get-pay" v-show="isShouzhi">
|
||||||
|
<li class="li1">
|
||||||
|
<ul class="details">
|
||||||
|
<li>
|
||||||
|
<h4>获取时间</h4>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<h4>券名</h4>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<h4>过期时间</h4>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="li1">
|
||||||
|
<ul class="details" v-for="item in availablePointArr">
|
||||||
|
<li>
|
||||||
|
<h4>{{item.couponDate}}</h4>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>满{{ item.limitNum }}减{{item.minusNum}}券</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p style="color: green;">{{ item.outDate }}</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="duihuan" v-show="!isShouzhi">
|
||||||
|
<li class="li1">
|
||||||
|
<ul class="details">
|
||||||
|
<li>
|
||||||
|
<h4>获取时间</h4>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<h4>过期数量</h4>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<h4>过期时间</h4>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="li1">
|
||||||
|
<ul class="details" v-for="item in outDatePointArr">
|
||||||
|
<li>
|
||||||
|
<h4>{{item.pointDate}}</h4>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>{{ item.pointNum }}</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p style="color: red;">{{ item.outDate }}</p>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'PointsDetails',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isShouzhi: true,
|
||||||
|
availablePointArr: [],
|
||||||
|
outDatePointArr: [],
|
||||||
|
user: {}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
sum() {
|
||||||
|
return this.availablePointArr.reduce((accumulator, currentValue) => accumulator + currentValue.pointNum,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
console.log("PointsDetail, Here");
|
||||||
|
this.user = this.$getSessionStorage('user');
|
||||||
|
|
||||||
|
// this.$axios.get('PointController/AvailablePoints',{
|
||||||
|
// 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);
|
||||||
|
// });
|
||||||
|
|
||||||
|
this.$axios.get(`CouponController/getCouponByUserId/${this.user.userId}`)
|
||||||
|
.then(response=>{
|
||||||
|
let result = response.data.result;
|
||||||
|
this.availablePointArr = result;
|
||||||
|
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$axios.get('PointController/OutofDatePoints',{
|
||||||
|
params:{
|
||||||
|
userId: this.user.userId
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Authorization:this.user.password
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
let result = response.data.result;
|
||||||
|
this.outDatePointArr = result;
|
||||||
|
console.log("outDatePoint:\n"+result)
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
back() {
|
||||||
|
this.$router.go(-1);
|
||||||
|
},
|
||||||
|
toggleTab(tab) {
|
||||||
|
this.isShouzhi = tab === 'shouzhi';
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.wrapper {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #F4F8Fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************** header ******************/
|
||||||
|
.wrapper header {
|
||||||
|
width: 100%;
|
||||||
|
height: 12vw;
|
||||||
|
background-color: #01B0F2;
|
||||||
|
font-size: 4.8vw;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper header i {
|
||||||
|
margin: 0vw 0vw 0vw 3vw;
|
||||||
|
font-size: 6vw;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper header p {
|
||||||
|
margin: 0vw 0vw 0vw 32vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-total {
|
||||||
|
padding-top: 20vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-total .num {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 1vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-total .num p {
|
||||||
|
font-size: 6vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-total .num img {
|
||||||
|
width: 8vw;
|
||||||
|
height: 8vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-total .text {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 2.8vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail {
|
||||||
|
padding-top: 6vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 3.5vw;
|
||||||
|
padding-bottom: 2vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .top p {
|
||||||
|
font-weight: normal;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .top p.active {
|
||||||
|
font-weight: bold;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .border {
|
||||||
|
width: 100%;
|
||||||
|
padding: 2vw 2vw 0vw 2vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .border .get-pay {
|
||||||
|
width: 100%;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 2vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .border .get-pay .li1 {
|
||||||
|
padding: 2vw 0vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .border .get-pay .details {
|
||||||
|
display: flex;
|
||||||
|
margin: 0vw 2vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .points-detail .border .get-pay .details li {
|
||||||
|
width: 34%;
|
||||||
|
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%;
|
||||||
|
font-size: 2.8vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,271 @@
|
||||||
|
<template>
|
||||||
|
<div class="wrapper">
|
||||||
|
<!-- header部分 -->
|
||||||
|
<header>
|
||||||
|
<i class="fa fa-angle-left" @click="back"></i>
|
||||||
|
<p>消费券选择</p>
|
||||||
|
</header>
|
||||||
|
<!-- 地址列表部分 -->
|
||||||
|
<ul class="addresslist">
|
||||||
|
<li v-for="item in CouponList">
|
||||||
|
<!-- <div class="addresslist-left" @click="setDeliveryAddress(item)">
|
||||||
|
<h3>{{item.contactName}}{{getSexText(item.contactSex)}} {{item.contactTel}}
|
||||||
|
</h3>
|
||||||
|
<p>{{item.address}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="addresslist-right">
|
||||||
|
<i class="fa fa-edit" @click="editUserAddress(item.daId)"></i>
|
||||||
|
<i class="fa fa-remove" @click="removeUserAddress(item.daId)"></i>
|
||||||
|
</div> -->
|
||||||
|
<div class="Coupon-Intro" @click="useThisCoupon(item)">
|
||||||
|
<p class="Coupon-Name">满{{item.limitNum}}减{{item.minusNum}}优惠券</p>
|
||||||
|
<p class="Coupon-Outdate">有效日期:{{item.outDate}}</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<div class="Coupon-Intro" @click="notUseCoupon()">
|
||||||
|
<p class="Coupon-Name">不使用消费券</p>
|
||||||
|
<p class="Coupon-Outdate">-</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<!-- 新增地址部分 -->
|
||||||
|
<!-- <div class="addbtn" @click="toAddUserAddress">
|
||||||
|
<i class="fa fa-plus-circle"></i>
|
||||||
|
<p>新增收货地址</p>
|
||||||
|
</div> -->
|
||||||
|
<!-- 底部菜单部分 -->
|
||||||
|
<Footer></Footer>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import Footer from '../components/Footer.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UserAddress',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
businessId: this.$route.query.businessId,
|
||||||
|
user: {},
|
||||||
|
deliveryAddressArr: [],
|
||||||
|
CouponList:[],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.user = this.$getSessionStorage('user');
|
||||||
|
|
||||||
|
this.listDeliveryAddressByUserId();
|
||||||
|
this.getCouponByUserId(this.user.userId);
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
Footer
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
back() {
|
||||||
|
this.$router.go(-1);
|
||||||
|
},
|
||||||
|
getSexText(sex) {
|
||||||
|
return sex === 1 ? '先生' : '女士';
|
||||||
|
},
|
||||||
|
listDeliveryAddressByUserId() {
|
||||||
|
//查询送货地址
|
||||||
|
let url=`DeliveryAddressController/listDeliveryAddressByUserId/${this.user.userId}`
|
||||||
|
this.$axios.get(url).then(response => {
|
||||||
|
this.deliveryAddressArr = response.data.result;
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setDeliveryAddress(deliveryAddress) {
|
||||||
|
//把用户选择的默认送货地址存储到localStorage中
|
||||||
|
this.$setLocalStorage(this.user.userId, deliveryAddress);
|
||||||
|
this.$router.push({
|
||||||
|
path: '/orders',
|
||||||
|
query: {
|
||||||
|
businessId: this.businessId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toAddUserAddress() {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/addUserAddress',
|
||||||
|
query: {
|
||||||
|
businessId: this.businessId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
editUserAddress(daId) {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/editUserAddress',
|
||||||
|
query: {
|
||||||
|
businessId: this.businessId,
|
||||||
|
daId: daId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
removeUserAddress(daId) {
|
||||||
|
if (!confirm('确认要删除此送货地址吗?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let url=`DeliveryAddressController/removeDeliveryAddress/${daId}`
|
||||||
|
this.$axios.delete(url).then(response => {
|
||||||
|
if (response.data.result > 0) {
|
||||||
|
let deliveryAddress = this.$getLocalStorage(this.user.userId);
|
||||||
|
if (deliveryAddress != null && deliveryAddress.daId == daId) {
|
||||||
|
this.$removeLocalStorage(this.user.userId);
|
||||||
|
}
|
||||||
|
this.listDeliveryAddressByUserId();
|
||||||
|
} else {
|
||||||
|
alert('删除地址失败!');
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCouponByUserId(userId)
|
||||||
|
{
|
||||||
|
this.$axios.get(`CouponController/getCouponByUserId/${userId}`).then(response =>{
|
||||||
|
this.CouponList=response.data.result;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
useThisCoupon(Coupon)
|
||||||
|
{
|
||||||
|
this.$setLocalStorage(this.$route.query.businessId,Coupon);
|
||||||
|
this.$router.push({
|
||||||
|
path: '/orders',
|
||||||
|
query: {
|
||||||
|
businessId: this.businessId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
notUseCoupon()
|
||||||
|
{
|
||||||
|
|
||||||
|
this.$setLocalStorage(this.$route.query.businessId,null)
|
||||||
|
this.$router.push({
|
||||||
|
path: '/orders',
|
||||||
|
query: {
|
||||||
|
businessId: this.businessId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/*************** 总容器 ***************/
|
||||||
|
.wrapper {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************** header ***************/
|
||||||
|
.wrapper header {
|
||||||
|
width: 100%;
|
||||||
|
height: 12vw;
|
||||||
|
background-color: #01B0F2;
|
||||||
|
font-size: 4.8vw;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper header i {
|
||||||
|
margin: 0vw 0vw 0vw 3vw;
|
||||||
|
font-size: 6vw;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper header p {
|
||||||
|
margin: 0vw 0vw 0vw 33.5vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************** addresslist ***************/
|
||||||
|
.wrapper .addresslist {
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 12vw;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .addresslist li {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-bottom: solid 1px #DDD;
|
||||||
|
padding: 3vw;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .addresslist li .addresslist-left {
|
||||||
|
flex: 5;
|
||||||
|
/*左边这块区域是可以点击的*/
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .addresslist li .addresslist-left h3 {
|
||||||
|
font-size: 4.6vw;
|
||||||
|
font-weight: 300;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .addresslist li .addresslist-left p {
|
||||||
|
font-size: 4vw;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .addresslist li .addresslist-right {
|
||||||
|
flex: 1;
|
||||||
|
font-size: 5.6vw;
|
||||||
|
color: #999;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************** 新增地址部分 ***************/
|
||||||
|
.wrapper .addbtn {
|
||||||
|
width: 100%;
|
||||||
|
height: 14vw;
|
||||||
|
border-top: solid 1px #DDD;
|
||||||
|
border-bottom: solid 1px #DDD;
|
||||||
|
background-color: #fff;
|
||||||
|
margin-top: 4vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 4.5vw;
|
||||||
|
color: #01B0F2;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin-left: 2vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .Coupon-Intro{
|
||||||
|
cursor: pointer;
|
||||||
|
width: 100%;
|
||||||
|
height: 16vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 3vw;
|
||||||
|
color: #666;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 3.5vw;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -17,7 +17,8 @@
|
||||||
<div class="search-fixed-top" ref="fixedBox">
|
<div class="search-fixed-top" ref="fixedBox">
|
||||||
<!-- 搜索框部分中间的白框 -->
|
<!-- 搜索框部分中间的白框 -->
|
||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
<i @click="toSearch()" :class="{'fa fa-search': true, 'blue-icon': keyword!==''}"></i><input type="text" v-model="keyword" placeholder="搜索饿了么商家、商品名称">
|
<i @click="toSearch()" :class="{'fa fa-search': true, 'blue-icon': keyword!==''}"></i>
|
||||||
|
<input type="text" v-model="keyword" placeholder="搜索饿了么商家、商品名称" @keydown.enter="toSearch()" >
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,22 @@
|
||||||
<span>></span>
|
<span>></span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- 积分商城,积分系统新增部分 -->
|
||||||
|
<li>
|
||||||
|
<div class="red" @click="toPointStore">
|
||||||
|
<img src="../assets/img/红包.png">
|
||||||
|
<p>积分商城</p>
|
||||||
|
<span>></span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<div class="red" @click="toCouponDetails">
|
||||||
|
<img src="../assets/img/红包.png">
|
||||||
|
<p>我的券包</p>
|
||||||
|
<span>></span>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<li @click="toaddress()">
|
<li @click="toaddress()">
|
||||||
|
|
@ -154,7 +170,7 @@
|
||||||
},
|
},
|
||||||
toPointsdetails() {
|
toPointsdetails() {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/pointsdetails'
|
path: '/pointsDetails'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
toWallet() {
|
toWallet() {
|
||||||
|
|
@ -173,6 +189,21 @@
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/userAddress'
|
path: '/userAddress'
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
// 积分系统新增部分
|
||||||
|
toPointStore(){
|
||||||
|
console.log("to Point Store");
|
||||||
|
this.$router.push({
|
||||||
|
path: '/PointStore'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toCouponDetails()
|
||||||
|
{
|
||||||
|
this.$router.push(
|
||||||
|
{
|
||||||
|
path:'/CouponDetails'
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,11 @@
|
||||||
<p>配送费</p>
|
<p>配送费</p>
|
||||||
<p>¥{{ business.deliveryPrice }}</p>
|
<p>¥{{ business.deliveryPrice }}</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="order-deliveryfee">-->
|
|
||||||
<!-- <p>{{ totalPoint }}积分(每100积分抵扣¥1.00)</p>-->
|
<div class="coupon-select" @click="toCouponSelect">
|
||||||
<!-- <p>-¥{{del.toFixed(2)}}</p>-->
|
<p>选择消费券</p>
|
||||||
<!-- </div>-->
|
<p>{{ getCouponName() }}</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- 合计部分 -->
|
<!-- 合计部分 -->
|
||||||
<div class="total">
|
<div class="total">
|
||||||
|
|
@ -64,13 +65,14 @@
|
||||||
user: {},
|
user: {},
|
||||||
cartArr: [],
|
cartArr: [],
|
||||||
deliveryaddress: {},
|
deliveryaddress: {},
|
||||||
availablePointArr: []
|
availablePointArr: [],
|
||||||
|
couponUsed: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.user = this.$getSessionStorage('user');
|
this.user = this.$getSessionStorage('user');
|
||||||
this.deliveryaddress = this.$getLocalStorage(this.user.userId);
|
this.deliveryaddress = this.$getLocalStorage(this.user.userId);
|
||||||
|
this.couponUsed = this.$getLocalStorage(this.businessId);
|
||||||
//查询当前商家
|
//查询当前商家
|
||||||
let businessUrl = `BusinessController/getBusinessById/${this.businessId}`
|
let businessUrl = `BusinessController/getBusinessById/${this.businessId}`
|
||||||
this.$axios.get(businessUrl).then(response => {
|
this.$axios.get(businessUrl).then(response => {
|
||||||
|
|
@ -86,39 +88,19 @@
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
// this.$axios.get('PointController/AvailablePoints',{
|
|
||||||
// params:{
|
|
||||||
// userId: this.user.userId
|
|
||||||
// },
|
|
||||||
// headers: {
|
|
||||||
// Authorization:this.user.password
|
|
||||||
// }
|
|
||||||
// }).then(response => {
|
|
||||||
// let result = response.data;
|
|
||||||
// this.availablePointArr = result;
|
|
||||||
// }).catch(error => {
|
|
||||||
// console.error(error);
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
// totalPoint() {
|
|
||||||
// let totalPoint = 0;
|
|
||||||
// for (let item of this.availablePointArr) {
|
|
||||||
// totalPoint += item.pointNum;
|
|
||||||
// }
|
|
||||||
// return totalPoint;
|
|
||||||
// },
|
|
||||||
// del() {
|
|
||||||
// return Math.floor(this.totalPoint/100);
|
|
||||||
// },
|
|
||||||
totalPrice() {
|
totalPrice() {
|
||||||
let totalPrice = 0;
|
let totalPrice = 0;
|
||||||
for (let cartItem of this.cartArr) {
|
for (let cartItem of this.cartArr) {
|
||||||
totalPrice += cartItem.food.foodPrice * cartItem.quantity;
|
totalPrice += cartItem.food.foodPrice * cartItem.quantity;
|
||||||
}
|
}
|
||||||
totalPrice += this.business.deliveryPrice;
|
totalPrice += this.business.deliveryPrice;
|
||||||
// totalPrice -= this.del;
|
|
||||||
|
//积分券包界面新增
|
||||||
|
if (this.couponUsed != null) {
|
||||||
|
totalPrice -= this.couponUsed.minusNum;
|
||||||
|
}
|
||||||
return totalPrice;
|
return totalPrice;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -144,24 +126,47 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建订单
|
//创建订单
|
||||||
|
|
||||||
let url = `OrdersController/createOrders/${this.user.userId}/${this.businessId}/${this.deliveryaddress.daId}/${this.totalPrice}`
|
let url = `OrdersController/createOrders/${this.user.userId}/${this.businessId}/${this.deliveryaddress.daId}/${this.totalPrice}`
|
||||||
this.$axios.post(url).then(response => {
|
this.$axios.post(url).then(response => {
|
||||||
let orderId = response.data.result;
|
let orderId = response.data.result;
|
||||||
if (orderId > 0) {
|
if (orderId > 0) {
|
||||||
|
//积分系统新增代码
|
||||||
|
if (this.couponUsed != null) {
|
||||||
|
this.$axios.delete(`CouponController/deleteCouponByCouponId/${this.couponUsed.couponId}`);
|
||||||
|
}
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/payment',
|
path: '/payment',
|
||||||
query: {
|
query: {
|
||||||
orderId: orderId,
|
orderId: orderId,
|
||||||
userId: this.user.userId,
|
userId: this.user.userId,
|
||||||
reduction: this.del
|
reduction: this.couponUsed===null?0:this.couponUsed.minusNum
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.$removeSessionStorage(this.businessId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
alert('创建订单失败!');
|
alert('创建订单失败!');
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
toCouponSelect() {
|
||||||
|
this.$router.push(
|
||||||
|
{
|
||||||
|
path: '/CouponSelect',
|
||||||
|
query: {
|
||||||
|
businessId: this.businessId
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCouponName() {
|
||||||
|
if (this.couponUsed == null) {
|
||||||
|
return "不使用优惠券";
|
||||||
|
} else {
|
||||||
|
return "满" + this.couponUsed.limitNum + "减" + this.couponUsed.minusNum + "优惠券";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -317,6 +322,19 @@
|
||||||
font-size: 3.5vw;
|
font-size: 3.5vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.wrapper .coupon-select {
|
||||||
|
width: 100%;
|
||||||
|
height: 16vw;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 3vw;
|
||||||
|
color: #666;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 3.5vw;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
/****************** 订单合计部分 ******************/
|
/****************** 订单合计部分 ******************/
|
||||||
.wrapper .total {
|
.wrapper .total {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,14 @@
|
||||||
<p>¥{{orders.business.deliveryPrice}}</p>
|
<p>¥{{orders.business.deliveryPrice}}</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p>积分</p>
|
<p>消费券减免</p>
|
||||||
<p>-¥{{reduction}}</p>
|
<p>-¥{{reduction}}</p>
|
||||||
</li>
|
</li>
|
||||||
|
<!-- 积分系统新增显示 -->
|
||||||
|
<li>
|
||||||
|
<p>获得积分</p>
|
||||||
|
<p>{{orders.orderTotal*10}}</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- 支付方式部分 -->
|
<!-- 支付方式部分 -->
|
||||||
<ul class="payment-type">
|
<ul class="payment-type">
|
||||||
|
|
@ -99,31 +104,56 @@
|
||||||
this.isShowDetailet = !this.isShowDetailet;
|
this.isShowDetailet = !this.isShowDetailet;
|
||||||
},
|
},
|
||||||
pay() {
|
pay() {
|
||||||
this.$axios.put('OrdersController/Orders', this.$qs.stringify({
|
// this.$axios.put('OrdersController/Orders', this.$qs.stringify({
|
||||||
orderId: this.orderId,
|
// orderId: this.orderId,
|
||||||
userId: this.userId,
|
// userId: this.userId,
|
||||||
orderTotal: this.orders.orderTotal,
|
// orderTotal: this.orders.orderTotal,
|
||||||
reduction: this.reduction
|
// reduction: this.reduction
|
||||||
}),{
|
// }),{
|
||||||
headers: {
|
// headers: {
|
||||||
Authorization:this.$getSessionStorage('user').password
|
// Authorization:this.$getSessionStorage('user').password
|
||||||
}
|
// }
|
||||||
}).then(response => {
|
// }).then(response => {
|
||||||
let orderId = response.data;
|
// let orderId = response.data;
|
||||||
if (orderId > 0) {
|
// if (orderId > 0) {
|
||||||
this.paySuccess=true;
|
// this.paySuccess=true;
|
||||||
this.isPayed=true;
|
// this.isPayed=true;
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
this.$router.push({
|
// this.$router.push({
|
||||||
path: '/orderList'
|
// path: '/orderList'
|
||||||
|
// });
|
||||||
|
// }, 500);
|
||||||
|
// } else {
|
||||||
|
// alert('支付失败!');
|
||||||
|
// }
|
||||||
|
// }).catch(error => {
|
||||||
|
// console.error(error);
|
||||||
|
// });
|
||||||
|
|
||||||
|
console.log("Kicked");
|
||||||
|
let url=`OrdersController/Orders/${this.orderId}`
|
||||||
|
this.$axios.put(url)
|
||||||
|
.then(
|
||||||
|
response =>
|
||||||
|
{
|
||||||
|
console.log(response);
|
||||||
|
console.log("支付成功");
|
||||||
|
let url=`PointController/addPointByPointId/${this.userId}/${this.orders.orderDate}/${this.orders.orderTotal*10}`
|
||||||
|
console.log(url);
|
||||||
|
this.$axios.post(url).then(response =>
|
||||||
|
{
|
||||||
|
console.log(response.data);
|
||||||
});
|
});
|
||||||
}, 500);
|
this.$router.push({path:'/orderList'});
|
||||||
} else {
|
|
||||||
alert('支付失败!');
|
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
)
|
||||||
|
.catch(error =>
|
||||||
|
{
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
||||||
|
|
@ -1,191 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="wrapper">
|
|
||||||
<!-- header部分 -->
|
|
||||||
<header>
|
|
||||||
<p>积分明细</p>
|
|
||||||
</header>
|
|
||||||
<!-- 订单列表部分 -->
|
|
||||||
<h3>可用积分({{ sum }})</h3>
|
|
||||||
<p style="color: gray;">每批积分将在获得后180天过期</p>
|
|
||||||
<ul class="order">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr style="background-color: #0097FF;color: aliceblue;">
|
|
||||||
<th>积分</th>
|
|
||||||
<th>获得时间</th>
|
|
||||||
<th>过期时间</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="item in availablePointArr" style="background-color: whitesmoke;">
|
|
||||||
<td>{{ item.pointNum }}</td>
|
|
||||||
<td>{{ item.pointDate }}</td>
|
|
||||||
<td style="color: green">{{ item.outDate }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</ul>
|
|
||||||
<h3>过期积分<i class="fa fa-caret-down" @click="detailetShow()"></i></h3>
|
|
||||||
<ul class="order" v-show="isShowDetailet">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr style="background-color: gray;color: aliceblue;">
|
|
||||||
<th>积分</th>
|
|
||||||
<th>获得时间</th>
|
|
||||||
<th>过期时间</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr v-for="item in outDatePointArr" style="background-color: whitesmoke;">
|
|
||||||
<td>{{ item.pointNum }}</td>
|
|
||||||
<td>{{ item.pointDate }}</td>
|
|
||||||
<td style="color: red">{{ item.outDate }}</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</ul>
|
|
||||||
<!-- 底部菜单部分 -->
|
|
||||||
<Footer></Footer>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
|
||||||
import Footer from '../components/Footer.vue';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'Point',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
availablePointArr: [],
|
|
||||||
outDatePointArr: [],
|
|
||||||
user: {},
|
|
||||||
isShowDetailet: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
sum() {
|
|
||||||
return this.availablePointArr.reduce((accumulator, currentValue) => accumulator + currentValue.pointNum, 0);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.user = this.$getSessionStorage('user');
|
|
||||||
|
|
||||||
this.$axios.get('PointController/AvailablePoints',{
|
|
||||||
params:{
|
|
||||||
userId: this.user.userId
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
Authorization:this.user.password
|
|
||||||
}
|
|
||||||
}).then(response => {
|
|
||||||
let result = response.data;
|
|
||||||
this.availablePointArr = result;
|
|
||||||
}).catch(error => {
|
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.$axios.get('PointController/OutofDatePoints',{
|
|
||||||
params:{
|
|
||||||
userId: this.user.userId
|
|
||||||
},
|
|
||||||
headers: {
|
|
||||||
Authorization:this.user.password
|
|
||||||
}
|
|
||||||
}).then(response => {
|
|
||||||
let result = response.data;
|
|
||||||
this.outDatePointArr = result;
|
|
||||||
}).catch(error => {
|
|
||||||
console.error(error);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
detailetShow(){
|
|
||||||
this.isShowDetailet=!this.isShowDetailet;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
Footer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<style scoped>
|
|
||||||
/****************** 总容器 ******************/
|
|
||||||
.wrapper {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************** header部分 ******************/
|
|
||||||
.wrapper header {
|
|
||||||
width: 100%;
|
|
||||||
height: 12vw;
|
|
||||||
background-color: #0097FF;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 4.8vw;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
z-index: 1000;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************** 历史订单列表部分 ******************/
|
|
||||||
.wrapper h3 {
|
|
||||||
margin-top: 12vw;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 4vw;
|
|
||||||
font-size: 5vw;
|
|
||||||
font-weight: 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order li {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order li .order-info {
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 2vw 4vw;
|
|
||||||
font-size: 4vw;
|
|
||||||
color: #666;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order li .order-info .order-info-right {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order li .order-info .order-info-right .order-info-right-icon {
|
|
||||||
background-color: #f90;
|
|
||||||
color: #fff;
|
|
||||||
border-radius: 3px;
|
|
||||||
margin-left: 2vw;
|
|
||||||
user-select: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order li .order-detailet {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order li .order-detailet li {
|
|
||||||
width: 100%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
padding: 1vw 4vw;
|
|
||||||
color: #666;
|
|
||||||
font-size: 3vw;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper .order table {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -0,0 +1,308 @@
|
||||||
|
|
||||||
|
<!-- 积分商城,整个篇的代码全部由积分系统0更新 -->
|
||||||
|
<template>
|
||||||
|
<div class ="wrapper">
|
||||||
|
<header>
|
||||||
|
<i class="fa fa-angle-left" @click="back"></i>
|
||||||
|
<p>积分商城</p>
|
||||||
|
</header>
|
||||||
|
<!-- 用来容纳剩余积分的盒子 -->
|
||||||
|
<div class="rest-box">
|
||||||
|
<p class="rest-point">剩余积分</p>
|
||||||
|
<p class="rest-num">{{sum}}</p>
|
||||||
|
</div>
|
||||||
|
<ul class="coupon-list">
|
||||||
|
<li class="coupon-unit">
|
||||||
|
<div class ="coupon-card">
|
||||||
|
<p class="coupon-title">满50减40购物券</p>
|
||||||
|
<div class ="devide-line"></div>
|
||||||
|
<p class="coupon-intro">结算时如果总额满50元,可以优惠40元。</p>
|
||||||
|
|
||||||
|
<!-- 这个地方多套一层保证右对齐 -->
|
||||||
|
<div class="purchase-area">
|
||||||
|
<div class="purchase-button" @click="buy50coupon">
|
||||||
|
<p class="purchase-button-word">立即购买(1000)</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="coupon-unit">
|
||||||
|
<div class ="coupon-card">
|
||||||
|
<p class="coupon-title">满20减15购物券</p>
|
||||||
|
<div class ="devide-line"></div>
|
||||||
|
<p class="coupon-intro">结算时如果总额满20元,可以优惠15元。</p>
|
||||||
|
|
||||||
|
<!-- 这个地方多套一层保证右对齐 -->
|
||||||
|
<div class="purchase-area">
|
||||||
|
<div class="purchase-button" @click="buy20coupon">
|
||||||
|
<p class="purchase-button-word">立即购买(800)</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="coupon-unit">
|
||||||
|
<div class ="coupon-card">
|
||||||
|
<p class="coupon-title">满10减8购物券</p>
|
||||||
|
<div class ="devide-line"></div>
|
||||||
|
<p class="coupon-intro">结算时如果总额10元,可以优惠8元。</p>
|
||||||
|
|
||||||
|
<!-- 这个地方多套一层保证右对齐 -->
|
||||||
|
<div class="purchase-area">
|
||||||
|
<div class="purchase-button" @click="buy10coupon">
|
||||||
|
<p class="purchase-button-word">立即购买(600)</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'PointsDetails',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isShouzhi: true,
|
||||||
|
availablePointArr: [],
|
||||||
|
outDatePointArr: [],
|
||||||
|
user: {}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
sum() {
|
||||||
|
return this.availablePointArr.reduce((accumulator, currentValue) => accumulator + currentValue.pointNum,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
console.log("PointsDetail, Here");
|
||||||
|
this.user = this.$getSessionStorage('user');
|
||||||
|
|
||||||
|
this.$axios.get('PointController/AvailablePoints',{
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.$axios.get('PointController/OutofDatePoints',{
|
||||||
|
params:{
|
||||||
|
userId: this.user.userId
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Authorization:this.user.password
|
||||||
|
}
|
||||||
|
}).then(response => {
|
||||||
|
let result = response.data.result;
|
||||||
|
this.outDatePointArr = result;
|
||||||
|
console.log("outDatePoint:\n"+result)
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
back() {
|
||||||
|
this.$router.go(-1);
|
||||||
|
},
|
||||||
|
toggleTab(tab) {
|
||||||
|
this.isShouzhi = tab === 'shouzhi';
|
||||||
|
},
|
||||||
|
buy50coupon(){
|
||||||
|
console.log("buy50coupon");
|
||||||
|
console.log(this.sum);
|
||||||
|
if(this.sum>1000)
|
||||||
|
{
|
||||||
|
console.log("50点券购买成功");
|
||||||
|
this.substractPoint(1000);
|
||||||
|
this.$axios.post(`/CouponController/saveCoupon/${this.user.userId}/50/40`)
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
buy20coupon()
|
||||||
|
{
|
||||||
|
console.log("buy20coupon");
|
||||||
|
if(this.sum>800)
|
||||||
|
{
|
||||||
|
console.log("20点券购买成功");
|
||||||
|
this.substractPoint(800);
|
||||||
|
this.$axios.post(`/CouponController/saveCoupon/${this.user.userId}/20/15`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
buy10coupon()
|
||||||
|
{
|
||||||
|
console.log("buy10coupon");
|
||||||
|
if(this.sum>600)
|
||||||
|
{
|
||||||
|
console.log("10点券购买成功");
|
||||||
|
this.$axios.post(`/CouponController/saveCoupon/${this.user.userId}/10/8`)
|
||||||
|
this.substractPoint(600);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
// 扣除积分
|
||||||
|
substractPoint(substractNum)
|
||||||
|
{
|
||||||
|
var subNum=substractNum;
|
||||||
|
|
||||||
|
for(const availablePoint of this.availablePointArr)
|
||||||
|
{
|
||||||
|
console.log("subnum="+subNum+"pointNum="+availablePoint.pointNum)
|
||||||
|
if(subNum===0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(subNum<availablePoint.pointNum)
|
||||||
|
{
|
||||||
|
console.log("单条剩余积分 "+(availablePoint.pointNum-subNum));
|
||||||
|
this.$axios.post(`/PointController/updatePointNumById/${availablePoint.pointId}/${availablePoint.pointNum-subNum}`);
|
||||||
|
subNum=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(subNum>=availablePoint.pointNum)
|
||||||
|
{
|
||||||
|
subNum=subNum-availablePoint.pointNum;
|
||||||
|
this.$axios.delete(`/PointController/deletePointByPointId/${availablePoint.pointId}`);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$router.go(0);
|
||||||
|
//
|
||||||
|
// while(substractNum!=0)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.wrapper {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #F4F8Fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************** header ******************/
|
||||||
|
.wrapper header {
|
||||||
|
width: 100%;
|
||||||
|
height: 12vw;
|
||||||
|
background-color: #01B0F2;
|
||||||
|
font-size: 4.8vw;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper header i {
|
||||||
|
margin: 0vw 0vw 0vw 3vw;
|
||||||
|
font-size: 6vw;
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper header p {
|
||||||
|
margin: 0vw 0vw 0vw 32vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .rest-box{
|
||||||
|
width: 80vw;
|
||||||
|
height: 10vw;
|
||||||
|
margin-top: 12vw;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.wrapper .rest-box .rest-point
|
||||||
|
{
|
||||||
|
font-size: 6vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .rest-box .rest-num
|
||||||
|
{
|
||||||
|
font-size: 6vw;
|
||||||
|
color: #FFAA00;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .coupon-card {
|
||||||
|
margin-top: 2vw;
|
||||||
|
margin-left: 5vw;
|
||||||
|
margin-right: 5vw;
|
||||||
|
background-color: #01B0F2;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .coupon-card .coupon-title{
|
||||||
|
padding:3vw 0vw 3vw 3vw;
|
||||||
|
font-size: 6vw;
|
||||||
|
color: #F4F8Fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .coupon-card .devide-line{
|
||||||
|
background-color: #F4F8Fb;
|
||||||
|
width: 80vw;
|
||||||
|
height: 2px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .coupon-card .coupon-intro{
|
||||||
|
padding:3vw 0vw 3vw 3vw;
|
||||||
|
|
||||||
|
font-size: 4vw;
|
||||||
|
color: #F4F8Fb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wrapper .coupon-card .purchase-area{
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.wrapper .coupon-card .purchase-button{
|
||||||
|
width: 40vw;
|
||||||
|
height: 8vw;
|
||||||
|
background-color: #00dd00;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-right: 3vw;
|
||||||
|
margin-bottom: 3vw;
|
||||||
|
text-align: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.wrapper .coupon-card .purchase-button .purchase-button-word{
|
||||||
|
color: #F4F8Fb;
|
||||||
|
font-size: 4vw;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -101,6 +101,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
console.log("PointsDetail, Here");
|
||||||
this.user = this.$getSessionStorage('user');
|
this.user = this.$getSessionStorage('user');
|
||||||
|
|
||||||
this.$axios.get('PointController/AvailablePoints',{
|
this.$axios.get('PointController/AvailablePoints',{
|
||||||
|
|
@ -111,8 +112,11 @@
|
||||||
Authorization:this.user.password
|
Authorization:this.user.password
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
let result = response.data;
|
// 积分系统新增的改动
|
||||||
|
let result = response.data.result;
|
||||||
this.availablePointArr = result;
|
this.availablePointArr = result;
|
||||||
|
console.log(response);
|
||||||
|
// console.log(this.user.userId+" "+this.user.password);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
|
@ -125,8 +129,9 @@
|
||||||
Authorization:this.user.password
|
Authorization:this.user.password
|
||||||
}
|
}
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
let result = response.data;
|
let result = response.data.result;
|
||||||
this.outDatePointArr = result;
|
this.outDatePointArr = result;
|
||||||
|
console.log("outDatePoint:\n"+result)
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
<!-- 搜索框部分中间的白框 -->
|
<!-- 搜索框部分中间的白框 -->
|
||||||
<div class="search-box">
|
<div class="search-box">
|
||||||
<i @click="toSearch()" :class="{'fa fa-search': true, 'blue-icon': keyword!==''}"></i>
|
<i @click="toSearch()" :class="{'fa fa-search': true, 'blue-icon': keyword!==''}"></i>
|
||||||
<input type="text" v-model="keyword" @input="toSearch()" placeholder="搜索饿了么商家、商品名称">
|
<input type="text" v-model="keyword" @keydown.enter="toSearch()" @input="toSearch()" placeholder="搜索饿了么商家、商品名称">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
CREATE TABLE point (
|
||||||
|
pointId INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
userId VARCHAR(20),
|
||||||
|
pointDate VARCHAR(50),
|
||||||
|
pointNum INT,
|
||||||
|
outDate VARCHAR(50)
|
||||||
|
);
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
<outputRelativeToContentRoot value="true" />
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="coupon_server_10950" />
|
||||||
<module name="food_server_10200" />
|
<module name="food_server_10200" />
|
||||||
<module name="food_server_10201" />
|
<module name="food_server_10201" />
|
||||||
<module name="eureka_server_13001" />
|
<module name="eureka_server_13001" />
|
||||||
|
|
@ -19,6 +20,7 @@
|
||||||
<module name="user_server_10100" />
|
<module name="user_server_10100" />
|
||||||
<module name="gateway_server_14000" />
|
<module name="gateway_server_14000" />
|
||||||
<module name="business_server_10301" />
|
<module name="business_server_10301" />
|
||||||
|
<module name="point_server_10900" />
|
||||||
<module name="deliveryaddress_server_10500" />
|
<module name="deliveryaddress_server_10500" />
|
||||||
<module name="search_server_11600" />
|
<module name="search_server_11600" />
|
||||||
<module name="business_server_10300" />
|
<module name="business_server_10300" />
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
<file url="file://$PROJECT_DIR$/config_server_15000/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/config_server_15000/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/config_server_15001/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/config_server_15001/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/config_server_15001/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/config_server_15001/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/coupon_server_10950/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/coupon_server_10950/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/deliveryaddress_server_10500/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/deliveryaddress_server_10500/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/deliveryaddress_server_10500/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/deliveryaddress_server_10500/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/eureka_server_13000/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/eureka_server_13000/src/main/java" charset="UTF-8" />
|
||||||
|
|
@ -29,6 +31,8 @@
|
||||||
<file url="file://$PROJECT_DIR$/orders_server_10600/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/orders_server_10600/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/orders_server_10601/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/orders_server_10601/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/orders_server_10601/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/orders_server_10601/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/point_server_10900/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/point_server_10900/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/search_server_11600/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/search_server_11600/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/search_server_11600/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/search_server_11600/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,4 @@
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
<component name="SwUserDefinedSpecifications">
|
|
||||||
<option name="specTypeByUrl">
|
|
||||||
<map />
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="business_server_10300" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="business_server_10300" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="business_server_10301" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="business_server_10301" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="cart_server_10400" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="cart_server_10400" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="cart_server_10401" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="cart_server_10401" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="config_server_15000" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="config_server_15000" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="config_server_15001" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="config_server_15001" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="coupon_server_10950" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="coupon_server_10950" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="deliveryaddress_server_10500" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="deliveryaddress_server_10500" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="eureka_server_13000" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="eureka_server_13000" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="eureka_server_13001" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="eureka_server_13001" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="food_server_10200" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="food_server_10200" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="food_server_10201" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="food_server_10201" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="gateway_server_14000" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="gateway_server_14000" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="orders_server_10600" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="orders_server_10600" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="orders_server_10601" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="orders_server_10601" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="point_server_10900" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="point_server_10900" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="search_server_11600" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="search_server_11600" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="user_server_10100" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
|
||||||
|
<option name="FRAME_DEACTIVATION_UPDATE_POLICY" value="UpdateClassesAndResources" />
|
||||||
|
<module name="user_server_10100" />
|
||||||
|
<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>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="SqlDialectMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$/orders_server_10600/src/main/resources/mapper/OrdersDetailetMapper.xml" dialect="GenericSQL" />
|
||||||
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -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>coupon_server_10950</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>
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.neusoft.controller;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
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.RequestHeader;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.neusoft.po.CommonResult;
|
||||||
|
import com.neusoft.po.Coupon;
|
||||||
|
import com.neusoft.service.CouponService;
|
||||||
|
import com.neusoft.service.impl.CouponServiceImpl;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/CouponController")
|
||||||
|
public class CouponController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CouponServiceImpl couponService;
|
||||||
|
|
||||||
|
@PostMapping("/saveCoupon/{userId}/{limitNum}/{minusNum}")
|
||||||
|
public CommonResult<Integer> listOutofDatePoint(@PathVariable("userId") String userId,@PathVariable("limitNum") int limitNum,@PathVariable("minusNum") int minusNum) throws Exception {
|
||||||
|
|
||||||
|
Coupon coupon =new Coupon();
|
||||||
|
coupon.setUserId(userId);
|
||||||
|
coupon.setLimitNum(limitNum);
|
||||||
|
coupon.setMinusNum(minusNum);
|
||||||
|
return new CommonResult<>(200,"success",couponService.saveCoupon(coupon));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getCouponByUserId/{userId}")
|
||||||
|
public CommonResult<List<Coupon>> getCouponByUserId(@PathVariable String userId) throws ParseException
|
||||||
|
{
|
||||||
|
return new CommonResult<>(200,"success",couponService.ListAvailableCoupon(userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/deleteCouponByCouponId/{couponId}")
|
||||||
|
public CommonResult<Integer> deleteCouponByCouponId(@PathVariable("couponId") int couponId)
|
||||||
|
{
|
||||||
|
Coupon coupon =new Coupon();
|
||||||
|
coupon.setCouponId(couponId);
|
||||||
|
return new CommonResult<>(200,"success",couponService.deleteCouponByCouponId(coupon));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.neusoft.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Options;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import com.neusoft.po.Coupon;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CouponMapper {
|
||||||
|
|
||||||
|
@Select("select * from coupon where couponId=#{couponId}")
|
||||||
|
public Coupon getCouponByCouponId(Coupon coupon);
|
||||||
|
|
||||||
|
@Select("select * from coupon where userId=#{userId}")
|
||||||
|
public List<Coupon> listCouponByUserId(Coupon coupon);
|
||||||
|
|
||||||
|
|
||||||
|
@Insert("insert into coupon values(#{couponId},#{userId},#{limitNum},#{minusNum},#{couponDate},#{outDate})")
|
||||||
|
@Options(useGeneratedKeys=true,keyProperty="couponId",keyColumn="couponId")
|
||||||
|
public int saveCoupon(Coupon coupon);
|
||||||
|
|
||||||
|
@Delete("delete from coupon where couponId=#{couponId}")
|
||||||
|
public int deleteCouponByCouponId(Coupon coupon);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.neusoft.po;
|
||||||
|
|
||||||
|
public class Coupon {
|
||||||
|
|
||||||
|
public int couponId;
|
||||||
|
public String userId;
|
||||||
|
public int limitNum;
|
||||||
|
public int minusNum;
|
||||||
|
public String couponDate;
|
||||||
|
public String outDate;
|
||||||
|
|
||||||
|
public Coupon()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public Coupon(int couponId,String userId,int limitNum,int minusNum,String couponDate,String outDate)
|
||||||
|
{
|
||||||
|
this.couponId=couponId;
|
||||||
|
this.userId=userId;
|
||||||
|
this.limitNum=limitNum;
|
||||||
|
this.minusNum=minusNum;
|
||||||
|
this.couponDate=couponDate;
|
||||||
|
this.outDate=outDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getCouponId()
|
||||||
|
{
|
||||||
|
return this.couponId;
|
||||||
|
}
|
||||||
|
public void setCouponId(int couponId)
|
||||||
|
{
|
||||||
|
this.couponId=couponId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId()
|
||||||
|
{
|
||||||
|
return this.userId;
|
||||||
|
}
|
||||||
|
public void setUserId(String userId)
|
||||||
|
{
|
||||||
|
this.userId=userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLimitNum()
|
||||||
|
{
|
||||||
|
return this.limitNum;
|
||||||
|
}
|
||||||
|
public void setLimitNum(int limitNum)
|
||||||
|
{
|
||||||
|
this.limitNum=limitNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMinusNum()
|
||||||
|
{
|
||||||
|
return this.minusNum;
|
||||||
|
}
|
||||||
|
public void setMinusNum(int minusNum)
|
||||||
|
{
|
||||||
|
this.minusNum=minusNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCouponDate()
|
||||||
|
{
|
||||||
|
return this.couponDate;
|
||||||
|
}
|
||||||
|
public void setCouponDate(String couponDate)
|
||||||
|
{
|
||||||
|
this.couponDate=couponDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOutDate()
|
||||||
|
|
||||||
|
{
|
||||||
|
return this.outDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutDate(String outDate)
|
||||||
|
{
|
||||||
|
this.outDate=outDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.neusoft.service;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.neusoft.po.Coupon;
|
||||||
|
|
||||||
|
|
||||||
|
public interface CouponService {
|
||||||
|
|
||||||
|
public List<Coupon> ListAvailableCoupon(String userId) throws ParseException;
|
||||||
|
|
||||||
|
public List<Coupon> ListOutCoupon(int userId) throws ParseException;
|
||||||
|
|
||||||
|
public int saveCoupon(Coupon coupon);
|
||||||
|
|
||||||
|
public int deleteCouponByCouponId(Coupon coupon);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.neusoft.service.impl;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.neusoft.mapper.CouponMapper;
|
||||||
|
import com.neusoft.po.Coupon;
|
||||||
|
import com.neusoft.service.CouponService;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CouponServiceImpl implements CouponService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public CouponMapper couponMapper;
|
||||||
|
|
||||||
|
public List<Coupon> ListAvailableCoupon(String userId) throws ParseException
|
||||||
|
{
|
||||||
|
|
||||||
|
Coupon coupon=new Coupon();
|
||||||
|
coupon.setUserId(userId);
|
||||||
|
List<Coupon> couponList =couponMapper.listCouponByUserId(coupon);
|
||||||
|
|
||||||
|
return couponList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Coupon> ListOutCoupon(int userId) throws ParseException
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int saveCoupon(Coupon coupon)
|
||||||
|
{
|
||||||
|
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String formattedDate = sdf.format(new Date());
|
||||||
|
Date currentDate=new Date();
|
||||||
|
coupon.setCouponDate(formattedDate);
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.setTime(currentDate);
|
||||||
|
calendar.add(Calendar.DAY_OF_MONTH, 3);
|
||||||
|
Date threeDaysLater = calendar.getTime();
|
||||||
|
String outDate=sdf.format(threeDaysLater);
|
||||||
|
coupon.setOutDate(outDate);
|
||||||
|
couponMapper.saveCoupon(coupon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
public int deleteCouponByCouponId(Coupon coupon)
|
||||||
|
{
|
||||||
|
|
||||||
|
couponMapper.deleteCouponByCouponId(coupon);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
config:
|
||||||
|
name: coupon_server_10950
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
config:
|
||||||
|
name: coupon_server_10950
|
||||||
|
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
|
||||||
|
|
@ -45,7 +45,7 @@ spring:
|
||||||
- id: deliveryaddressServer
|
- id: deliveryaddressServer
|
||||||
uri: lb://deliveryaddress-server
|
uri: lb://deliveryaddress-server
|
||||||
predicates:
|
predicates:
|
||||||
- Path=/DeliveryaddressController/*/**
|
- Path=/DeliveryAddressController/*/**
|
||||||
|
|
||||||
- id: ordersServer
|
- id: ordersServer
|
||||||
uri: lb://orders-server
|
uri: lb://orders-server
|
||||||
|
|
@ -57,6 +57,16 @@ spring:
|
||||||
predicates:
|
predicates:
|
||||||
- Path=/SearchController/*/**
|
- Path=/SearchController/*/**
|
||||||
|
|
||||||
|
- id: pointServer
|
||||||
|
uri: lb://point-server
|
||||||
|
predicates:
|
||||||
|
- Path=/PointController/*/**
|
||||||
|
|
||||||
|
- id: couponServer
|
||||||
|
uri: lb://coupon-server
|
||||||
|
predicates:
|
||||||
|
- Path=/CouponController/*/**
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
service-url:
|
service-url:
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ spring:
|
||||||
- id: deliveryaddressServer
|
- id: deliveryaddressServer
|
||||||
uri: lb://deliveryaddress-server
|
uri: lb://deliveryaddress-server
|
||||||
predicates:
|
predicates:
|
||||||
- Path=/DeliveryaddressController/*/**
|
- Path=/DeliveryAddressController/*/**
|
||||||
|
|
||||||
- id: ordersServer
|
- id: ordersServer
|
||||||
uri: lb://orders-server
|
uri: lb://orders-server
|
||||||
|
|
@ -57,6 +57,16 @@ spring:
|
||||||
predicates:
|
predicates:
|
||||||
- Path=/SearchController/*/**
|
- Path=/SearchController/*/**
|
||||||
|
|
||||||
|
- id: pointServer
|
||||||
|
uri: lb://point-server
|
||||||
|
predicates:
|
||||||
|
- Path=/PointController/*/**
|
||||||
|
|
||||||
|
- id: couponServer
|
||||||
|
uri: lb://coupon-server
|
||||||
|
predicates:
|
||||||
|
- Path=/CouponController/*/**
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
service-url:
|
service-url:
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,12 @@ public class OrdersController {
|
||||||
return new CommonResult<>(200,"success",list);
|
return new CommonResult<>(200,"success",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);
|
||||||
|
}
|
||||||
// @PutMapping("/Orders")
|
// @PutMapping("/Orders")
|
||||||
// public int payOrdersById(OrderState orderState, @RequestHeader("Authorization") String token) throws Exception {
|
// public int payOrdersById(OrderState orderState, @RequestHeader("Authorization") String token) throws Exception {
|
||||||
// return ordersService.payOrdersById(orderState.getOrderId(), orderState.getUserId(), orderState.getOrderTotal(), orderState.getReduction(),token);
|
// return ordersService.payOrdersById(orderState.getOrderId(), orderState.getUserId(), orderState.getOrderTotal(), orderState.getReduction(),token);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
<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>point_server_10900</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>
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.neusoft.controller;
|
||||||
|
|
||||||
|
import com.neusoft.po.CommonResult;
|
||||||
|
import com.neusoft.po.Point;
|
||||||
|
import com.neusoft.service.PointService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/PointController")
|
||||||
|
public class PointController {
|
||||||
|
@Autowired
|
||||||
|
private PointService pointService;
|
||||||
|
|
||||||
|
@GetMapping("/OutofDatePoints")
|
||||||
|
public CommonResult<List<Point>> listOutofDatePoint(@RequestParam("userId") String userId, @RequestHeader("Authorization") String token) throws Exception {
|
||||||
|
return new CommonResult<>(200,"success",pointService.listOutofDatePoint(userId,token));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/AvailablePoints")
|
||||||
|
public CommonResult<List<Point>> listAvailablePoint(@RequestParam("userId") String userId, @RequestHeader("Authorization") String token) throws Exception {
|
||||||
|
return new CommonResult<>(200,"success",pointService.listAvailablePoint(userId,token));
|
||||||
|
// return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/addPointByPointId/{userId}/{date}/{pointNum}")
|
||||||
|
public CommonResult<Integer> addPointByPointId(@PathVariable("userId") String userId,@PathVariable("date") String date,@PathVariable("pointNum") Integer pointNum)
|
||||||
|
{
|
||||||
|
System.out.println("addPointById/"+userId+"/"+date+"/"+pointNum);
|
||||||
|
return new CommonResult(200,"success",pointService.addPointByPointId(userId, date, pointNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updatePointNumById/{pointId}/{PointNum}")
|
||||||
|
public CommonResult<Integer> updatePointNumById(@PathVariable String pointId,@PathVariable int PointNum)
|
||||||
|
{
|
||||||
|
System.out.println("pointId="+pointId+"pointNum="+PointNum);
|
||||||
|
return new CommonResult(200,"success",pointService.updatePointByPointId(pointId, PointNum));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/deletePointByPointId/{pointId}")
|
||||||
|
public CommonResult<Integer> deletePointByPointId(@PathVariable("pointId") String pointId)
|
||||||
|
{
|
||||||
|
return new CommonResult(200,"success",pointService.deletePointByPointId(pointId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.neusoft.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.neusoft.po.Point;
|
||||||
|
|
||||||
|
import feign.Param;
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.neusoft.service;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.neusoft.po.Point;
|
||||||
|
|
||||||
|
public interface PointService {
|
||||||
|
public List<Point> listOutofDatePoint(String userId, String token) throws ParseException;
|
||||||
|
|
||||||
|
public List<Point> listAvailablePoint(String userId, String token) throws ParseException;
|
||||||
|
|
||||||
|
|
||||||
|
public int addPointByPointId(String userId,String date,Integer pointNum);
|
||||||
|
|
||||||
|
public int updatePointByPointId(String pointId,int PointNum);
|
||||||
|
|
||||||
|
public int deletePointByPointId(String pointId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
package com.neusoft.service.impl;
|
||||||
|
|
||||||
|
import com.neusoft.mapper.PointMapper;
|
||||||
|
import com.neusoft.mapper.UserMapper;
|
||||||
|
import com.neusoft.po.Point;
|
||||||
|
import com.neusoft.po.User;
|
||||||
|
import com.neusoft.service.PointService;
|
||||||
|
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.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PointServiceImpl implements PointService {
|
||||||
|
@Autowired
|
||||||
|
private PointMapper pointMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserMapper userMapper0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Point> listOutofDatePoint(String userId, String token) throws ParseException {
|
||||||
|
User user = new User();
|
||||||
|
user.setUserId(userId);
|
||||||
|
user.setPassword(token);
|
||||||
|
if (userMapper0.getUserByIdByPass(user) == null) return null;
|
||||||
|
|
||||||
|
List<Point> list = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
list = pointMapper.listPointsByUserId(userId);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
for (Point i : list) {
|
||||||
|
i.setOutDate(sdf.format(new Date(sdf.parse(i.getPointDate()).getTime() + 15552000000L)));
|
||||||
|
sdf.parse(i.getPointDate());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
List<Point> res = new ArrayList<Point>();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date now = new Date();
|
||||||
|
for (Point i : list) {
|
||||||
|
if (sdf.parse(i.getOutDate()).before(now)) {
|
||||||
|
res.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Point> listAvailablePoint(String userId, String token) throws ParseException {
|
||||||
|
User user = new User();
|
||||||
|
user.setUserId(userId);
|
||||||
|
user.setPassword(token);
|
||||||
|
|
||||||
|
if(userMapper0.getUserByIdByPass(user) == null) return null;
|
||||||
|
|
||||||
|
List<Point> list = new ArrayList<>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
list = pointMapper.listPointsByUserId(userId);
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
for (Point i : list) {
|
||||||
|
i.setOutDate(sdf.format(new Date(sdf.parse(i.getPointDate()).getTime() + 15552000000L)));
|
||||||
|
sdf.parse(i.getPointDate());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
List<Point> res = new ArrayList<Point>();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
Date now = new Date();
|
||||||
|
for (Point i : list) {
|
||||||
|
if (!sdf.parse(i.getOutDate()).before(now)) {
|
||||||
|
res.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
//积分系统新增方法
|
||||||
|
@Override
|
||||||
|
public int addPointByPointId(String userId,String date,Integer pointNum)
|
||||||
|
{
|
||||||
|
Point point=new Point(null,userId,date,pointNum,null);
|
||||||
|
pointMapper.addPointByPointId(point);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updatePointByPointId(String PointId,int pointNum)
|
||||||
|
{
|
||||||
|
Point point =new Point(PointId,null,null,pointNum,null);
|
||||||
|
pointMapper.setPointByPointId(point);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int deletePointByPointId(String pointId)
|
||||||
|
{
|
||||||
|
|
||||||
|
pointMapper.deletePointByPointId(pointId);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
config:
|
||||||
|
name: point_server_10900
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
config:
|
||||||
|
name: point_server_10900
|
||||||
|
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
|
||||||
|
|
@ -23,7 +23,9 @@
|
||||||
<module>orders_server_10601</module>
|
<module>orders_server_10601</module>
|
||||||
<module>config_server_15000</module>
|
<module>config_server_15000</module>
|
||||||
<module>config_server_15001</module>
|
<module>config_server_15001</module>
|
||||||
<module>search_server_116000</module>
|
<module>search_server_11600</module>
|
||||||
|
<module>point_server_10900</module>
|
||||||
|
<module>coupon_server_10950</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.neusoft;
|
package com.neusoft;
|
||||||
|
|
||||||
import org.ansj.domain.Result;
|
|
||||||
import org.ansj.splitWord.analysis.ToAnalysis;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@ public class SearchServiceImpl implements SearchService {
|
||||||
Result res = ToAnalysis.parse(query);
|
Result res = ToAnalysis.parse(query);
|
||||||
List<String> keywords=new ArrayList<>();
|
List<String> keywords=new ArrayList<>();
|
||||||
for(Term term:res){
|
for(Term term:res){
|
||||||
|
if(!term.getName().matches("^\\s+$")){
|
||||||
keywords.add(term.getName());
|
keywords.add(term.getName());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return foodMapper.listFoodByKeyWord(keywords);
|
return foodMapper.listFoodByKeyWord(keywords);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue