1、代码优化
2、bug修复 3、数据库优化
This commit is contained in:
53
admin/package-lock.json
generated
53
admin/package-lock.json
generated
@@ -5259,6 +5259,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dom7": {
|
||||||
|
"version": "2.1.5",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/dom7/download/dom7-2.1.5.tgz?cache=0&sync_timestamp=1594742476927&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdom7%2Fdownload%2Fdom7-2.1.5.tgz",
|
||||||
|
"integrity": "sha1-p5QRAXgAsx2EAAcM2uu/ySwfY3c=",
|
||||||
|
"requires": {
|
||||||
|
"ssr-window": "^2.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ssr-window": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/ssr-window/download/ssr-window-2.0.0.tgz",
|
||||||
|
"integrity": "sha1-mMMBrvmVIzF/jWlhjwAQeRCW78Q="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"domain-browser": {
|
"domain-browser": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
|
||||||
@@ -15780,6 +15795,11 @@
|
|||||||
"tweetnacl": "~0.14.0"
|
"tweetnacl": "~0.14.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ssr-window": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/ssr-window/download/ssr-window-1.0.1.tgz",
|
||||||
|
"integrity": "sha1-MHUqakZm53Z/C35qpvwv29DZs2k="
|
||||||
|
},
|
||||||
"ssri": {
|
"ssri": {
|
||||||
"version": "6.0.1",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ssri/-/ssri-6.0.1.tgz",
|
||||||
@@ -16358,6 +16378,15 @@
|
|||||||
"upper-case": "^1.1.1"
|
"upper-case": "^1.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"swiper": {
|
||||||
|
"version": "4.5.1",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/swiper/download/swiper-4.5.1.tgz",
|
||||||
|
"integrity": "sha1-7UOZjngM60eGEAecjSP9Ql7KY28=",
|
||||||
|
"requires": {
|
||||||
|
"dom7": "^2.1.3",
|
||||||
|
"ssr-window": "^1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"symbol-observable": {
|
"symbol-observable": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz",
|
||||||
@@ -16905,6 +16934,21 @@
|
|||||||
"integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=",
|
"integrity": "sha1-y99WD9e5r2MlAv7UD5GMFX6pcTc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"tree": {
|
||||||
|
"version": "0.1.3",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/tree/download/tree-0.1.3.tgz",
|
||||||
|
"integrity": "sha1-FPulc9eFMAnEzO9E90CfrHFik48=",
|
||||||
|
"requires": {
|
||||||
|
"underscore": "^1.10.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"underscore": {
|
||||||
|
"version": "1.10.2",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/underscore/download/underscore-1.10.2.tgz",
|
||||||
|
"integrity": "sha1-c9aqNmjzGI5K2w8ZQ70Sz9fvqq8="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"trim-newlines": {
|
"trim-newlines": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz",
|
||||||
@@ -17442,6 +17486,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz",
|
"resolved": "https://registry.npmjs.org/vue/-/vue-2.6.10.tgz",
|
||||||
"integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
|
"integrity": "sha512-ImThpeNU9HbdZL3utgMCq0oiMzAkt1mcgy3/E6zWC/G6AaQoeuFdsl9nDhTDU3X1R6FK7nsIUuRACVcjI+A2GQ=="
|
||||||
},
|
},
|
||||||
|
"vue-awesome-swiper": {
|
||||||
|
"version": "3.1.3",
|
||||||
|
"resolved": "https://registry.npm.taobao.org/vue-awesome-swiper/download/vue-awesome-swiper-3.1.3.tgz",
|
||||||
|
"integrity": "sha1-BVALUB/7P+yb9+uZhbz0roNg7Z4=",
|
||||||
|
"requires": {
|
||||||
|
"object-assign": "^4.1.1",
|
||||||
|
"swiper": "^4.0.7"
|
||||||
|
}
|
||||||
|
},
|
||||||
"vue-count-to": {
|
"vue-count-to": {
|
||||||
"version": "1.0.13",
|
"version": "1.0.13",
|
||||||
"resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/vue-count-to/-/vue-count-to-1.0.13.tgz",
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
"jsonlint": "1.6.3",
|
"jsonlint": "1.6.3",
|
||||||
"jszip": "3.2.1",
|
"jszip": "3.2.1",
|
||||||
"node-sass": "^4.13.1",
|
|
||||||
"monaco-editor": "^0.20.0",
|
"monaco-editor": "^0.20.0",
|
||||||
|
"node-sass": "^4.13.1",
|
||||||
"normalize.css": "7.0.0",
|
"normalize.css": "7.0.0",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"path-to-regexp": "2.4.0",
|
"path-to-regexp": "2.4.0",
|
||||||
@@ -68,6 +68,7 @@
|
|||||||
"showdown": "1.9.0",
|
"showdown": "1.9.0",
|
||||||
"sortablejs": "1.8.4",
|
"sortablejs": "1.8.4",
|
||||||
"throttle-debounce": "^2.1.0",
|
"throttle-debounce": "^2.1.0",
|
||||||
|
"tree": "^0.1.3",
|
||||||
"tui-editor": "1.3.3",
|
"tui-editor": "1.3.3",
|
||||||
"vue": "2.6.10",
|
"vue": "2.6.10",
|
||||||
"vue-awesome-swiper": "^3.1.3",
|
"vue-awesome-swiper": "^3.1.3",
|
||||||
|
|||||||
@@ -49,6 +49,18 @@ service.interceptors.response.use(
|
|||||||
response => {
|
response => {
|
||||||
const res = response.data
|
const res = response.data
|
||||||
// if the custom code is not 20000, it is judged as an error.
|
// if the custom code is not 20000, it is judged as an error.
|
||||||
|
if (res.code === 401) {
|
||||||
|
// to re-login
|
||||||
|
MessageBox.confirm('您已经登出,您可以取消停留在这个页面,或重新登录', '退出', {
|
||||||
|
confirmButtonText: '或重新登录',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
store.dispatch('user/resetToken').then(() => {
|
||||||
|
location.reload()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200) {
|
||||||
Message({
|
Message({
|
||||||
message: res.message || 'Error',
|
message: res.message || 'Error',
|
||||||
@@ -57,19 +69,7 @@ service.interceptors.response.use(
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
// 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
|
||||||
if (res.code === 401) {
|
// return Promise.reject(new Error(res.message || 'Error'))
|
||||||
// to re-login
|
|
||||||
MessageBox.confirm('您已经登出,您可以取消停留在这个页面,或重新登录', '退出', {
|
|
||||||
confirmButtonText: '或重新登录',
|
|
||||||
cancelButtonText: '取消',
|
|
||||||
type: 'warning'
|
|
||||||
}).then(() => {
|
|
||||||
store.dispatch('user/resetToken').then(() => {
|
|
||||||
location.reload()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return Promise.reject(new Error(res.message || 'Error'))
|
|
||||||
} else {
|
} else {
|
||||||
return res.data
|
return res.data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export default {
|
|||||||
},
|
},
|
||||||
loginForm: {
|
loginForm: {
|
||||||
account: 'demo', // admin
|
account: 'demo', // admin
|
||||||
pwd: '123456',
|
pwd: 'crmeb.com',
|
||||||
key: '',
|
key: '',
|
||||||
code: ''
|
code: ''
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -95,12 +95,12 @@
|
|||||||
min-width="400"
|
min-width="400"
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div v-if="scope.row.productList.length">
|
<div v-if=" scope.row.productList && scope.row.productList.length">
|
||||||
<div v-for="(val, i ) in scope.row.productList" :key="i" class="tabBox acea-row row-middle">
|
<div v-for="(val, i ) in scope.row.productList" :key="i" class="tabBox acea-row row-middle">
|
||||||
<div class="demo-image__preview">
|
<div class="demo-image__preview">
|
||||||
<el-image
|
<el-image
|
||||||
:src="val.info.productInfo.image"
|
:src="val.info.productInfo.image"
|
||||||
:preview-src-list="imgList"
|
:preview-src-list="[val.info.productInfo.image]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span class="tabBox_tit mr10">{{ val.info.productInfo.storeName + ' | ' }}{{ val.info.productInfo.attrInfo.suk ? val.info.productInfo.attrInfo.suk:'-' }}</span>
|
<span class="tabBox_tit mr10">{{ val.info.productInfo.storeName + ' | ' }}{{ val.info.productInfo.attrInfo.suk ? val.info.productInfo.attrInfo.suk:'-' }}</span>
|
||||||
@@ -308,7 +308,6 @@
|
|||||||
isCreate: 1,
|
isCreate: 1,
|
||||||
editData: null,
|
editData: null,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
imgList: [],
|
|
||||||
tableData: {
|
tableData: {
|
||||||
data: [],
|
data: [],
|
||||||
total: 0
|
total: 0
|
||||||
@@ -508,11 +507,6 @@
|
|||||||
this.tableData.data = res.list.list || []
|
this.tableData.data = res.list.list || []
|
||||||
this.tableData.total = res.list.total
|
this.tableData.total = res.list.total
|
||||||
this.orderChartType = res.status
|
this.orderChartType = res.status
|
||||||
this.tableData.data.map((item) => {
|
|
||||||
item.productList.map((i) => {
|
|
||||||
this.imgList.push(i.info.productInfo.image)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
const stat = res.top
|
const stat = res.top
|
||||||
this.cardLists = [
|
this.cardLists = [
|
||||||
{ name: '订单数量', count: stat.count },
|
{ name: '订单数量', count: stat.count },
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
// 物流公司列表
|
// 物流公司列表
|
||||||
getList () {
|
getList () {
|
||||||
expressList({ page: 1, limit: 999, isShow:true }).then(async res => {
|
expressList({ page: 1, limit: 999, isShow:1 }).then(async res => {
|
||||||
this.express = res.list
|
this.express = res.list
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -237,12 +237,12 @@
|
|||||||
<template v-if="formValidate.isSub">
|
<template v-if="formValidate.isSub">
|
||||||
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
|
<el-input v-model="scope.row.brokerage" type="number" :min="0" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
|
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
@@ -276,12 +276,12 @@
|
|||||||
<template v-if="formValidate.isSub">
|
<template v-if="formValidate.isSub">
|
||||||
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
|
<el-input v-model="scope.row.brokerage" type="number" :min="0" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
|
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
@@ -315,12 +315,12 @@
|
|||||||
<template v-if="formValidate.isSub">
|
<template v-if="formValidate.isSub">
|
||||||
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
<el-table-column align="center" label="一级返佣(元)" min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.extension_one" type="number" :min="0" class="priceBox" />
|
<el-input v-model="scope.row.brokerage" type="number" :min="0" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
<el-table-column align="center" label="二级返佣(元)" min-width="120">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.extension_two" type="number" :min="0" class="priceBox" />
|
<el-input v-model="scope.row.brokerageTwo" type="number" :min="0" class="priceBox" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</template>
|
</template>
|
||||||
@@ -735,23 +735,23 @@
|
|||||||
onChangetype(item) {
|
onChangetype(item) {
|
||||||
if (item === 1) {
|
if (item === 1) {
|
||||||
this.OneattrValue.map(item => {
|
this.OneattrValue.map(item => {
|
||||||
this.$set(item, 'extension_one', null)
|
this.$set(item, 'brokerage', null)
|
||||||
this.$set(item, 'extension_two', null)
|
this.$set(item, 'brokerageTwo', null)
|
||||||
})
|
})
|
||||||
this.ManyAttrValue.map(item => {
|
this.ManyAttrValue.map(item => {
|
||||||
this.$set(item, 'extension_one', null)
|
this.$set(item, 'brokerage', null)
|
||||||
this.$set(item, 'extension_two', null)
|
this.$set(item, 'brokerageTwo', null)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.OneattrValue.map(item => {
|
this.OneattrValue.map(item => {
|
||||||
delete item.extension_one
|
delete item.brokerage
|
||||||
delete item.extension_two
|
delete item.brokerageTwo
|
||||||
this.$set(item, 'extension_one', null)
|
this.$set(item, 'brokerage', null)
|
||||||
this.$set(item, 'extension_two', null)
|
this.$set(item, 'brokerageTwo', null)
|
||||||
})
|
})
|
||||||
this.ManyAttrValue.map(item => {
|
this.ManyAttrValue.map(item => {
|
||||||
delete item.extension_one
|
delete item.brokerage
|
||||||
delete item.extension_two
|
delete item.brokerageTwo
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -772,8 +772,8 @@
|
|||||||
this.$set(val, 'barCode', this.oneFormBatch[0].barCode)
|
this.$set(val, 'barCode', this.oneFormBatch[0].barCode)
|
||||||
this.$set(val, 'weight', this.oneFormBatch[0].weight)
|
this.$set(val, 'weight', this.oneFormBatch[0].weight)
|
||||||
this.$set(val, 'volume', this.oneFormBatch[0].volume)
|
this.$set(val, 'volume', this.oneFormBatch[0].volume)
|
||||||
this.$set(val, 'extension_one', this.oneFormBatch[0].extension_one)
|
this.$set(val, 'brokerage', this.oneFormBatch[0].brokerage)
|
||||||
this.$set(val, 'extension_two', this.oneFormBatch[0].extension_two)
|
this.$set(val, 'brokerageTwo', this.oneFormBatch[0].brokerageTwo)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 添加按钮
|
// 添加按钮
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ public class Constants {
|
|||||||
|
|
||||||
//积分
|
//积分
|
||||||
public static final String CONFIG_KEY_INTEGRAL_RATE = "integral_ratio"; //积分抵用比例(1积分抵多少金额
|
public static final String CONFIG_KEY_INTEGRAL_RATE = "integral_ratio"; //积分抵用比例(1积分抵多少金额
|
||||||
public static final String CONFIG_KEY_INTEGRAL_RATE_ORDER_GIVE = "integral_order_give"; //下单支付金额按比例赠送积分(实际支付1元赠送多少积分
|
public static final String CONFIG_KEY_INTEGRAL_RATE_ORDER_GIVE = "order_give_integral"; //下单支付金额按比例赠送积分(实际支付1元赠送多少积分
|
||||||
|
|
||||||
//后台首页登录图片
|
//后台首页登录图片
|
||||||
public static final String CONFIG_KEY_ADMIN_LOGIN_LOGO = "login_logo"; //登录页LOGO
|
public static final String CONFIG_KEY_ADMIN_LOGIN_LOGO = "login_logo"; //登录页LOGO
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zbkj.crmeb.front.response;
|
package com.zbkj.crmeb.front.response;
|
||||||
|
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -18,6 +19,6 @@ public class ComputeOrderResponse {
|
|||||||
private BigDecimal payPostage;
|
private BigDecimal payPostage;
|
||||||
private BigDecimal couponPrice;
|
private BigDecimal couponPrice;
|
||||||
private BigDecimal deductionPrice;
|
private BigDecimal deductionPrice;
|
||||||
private BigDecimal usedIntegral;
|
private Integer usedIntegral;
|
||||||
private BigDecimal SurplusIntegral;
|
private Integer SurplusIntegral;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ public class PriceGroupResponse {
|
|||||||
private BigDecimal payPrice;
|
private BigDecimal payPrice;
|
||||||
private BigDecimal payPostage;
|
private BigDecimal payPostage;
|
||||||
private BigDecimal deductionPrice;
|
private BigDecimal deductionPrice;
|
||||||
private BigDecimal usedIntegral;
|
private Integer usedIntegral;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class UserCenterResponse implements Serializable {
|
|||||||
private BigDecimal brokeragePrice;
|
private BigDecimal brokeragePrice;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户剩余积分")
|
@ApiModelProperty(value = "用户剩余积分")
|
||||||
private BigDecimal integral;
|
private Integer integral;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户剩余经验")
|
@ApiModelProperty(value = "用户剩余经验")
|
||||||
private Integer experience;
|
private Integer experience;
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
response.setStoreSelfMention(systemConfigService.getValueByKey("store_self_mention"));
|
response.setStoreSelfMention(systemConfigService.getValueByKey("store_self_mention"));
|
||||||
response.setOther(otherMap);
|
response.setOther(otherMap);
|
||||||
response.setSystemStore(null);
|
response.setSystemStore(null);
|
||||||
response.setOrderKey(orderUtils.cacheOrderInfo(currentUserInfo.getUid(), response));
|
response.setOrderKey(orderUtils.cacheSetOrderInfo(currentUserInfo.getUid(), response));
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,6 +366,8 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
smsInfo.put("adminName", currentUser.getNickname());
|
smsInfo.put("adminName", currentUser.getNickname());
|
||||||
boolean codeResult = smsService.pushCodeToList(currentUser.getPhone(),1, smsInfo);
|
boolean codeResult = smsService.pushCodeToList(currentUser.getPhone(),1, smsInfo);
|
||||||
if(!codeResult) throw new CrmebException("短信加入发送队列失败");
|
if(!codeResult) throw new CrmebException("短信加入发送队列失败");
|
||||||
|
|
||||||
|
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_REFUND_BY_USER, existStoreOrder.getId());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -646,7 +648,6 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
OrderCreateRequest orderCreateRequest = new OrderCreateRequest();
|
OrderCreateRequest orderCreateRequest = new OrderCreateRequest();
|
||||||
BeanUtils.copyProperties(request,orderCreateRequest);
|
BeanUtils.copyProperties(request,orderCreateRequest);
|
||||||
ComputeOrderResponse priceGroup = orderUtils.computedOrder(orderCreateRequest, cor, orderKey);
|
ComputeOrderResponse priceGroup = orderUtils.computedOrder(orderCreateRequest, cor, orderKey);
|
||||||
|
|
||||||
if(null == priceGroup){
|
if(null == priceGroup){
|
||||||
throw new CrmebException("计算失败");
|
throw new CrmebException("计算失败");
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
|||||||
// 清除缓存的订单信息
|
// 清除缓存的订单信息
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
throw new CrmebException("订单支付失败!");
|
throw new CrmebException("订单支付失败!");
|
||||||
}
|
}
|
||||||
return responseVo;
|
return responseVo;
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ public class StoreOrder implements Serializable {
|
|||||||
private String deliveryId;
|
private String deliveryId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "消费赚取积分")
|
@ApiModelProperty(value = "消费赚取积分")
|
||||||
private BigDecimal gainIntegral;
|
private Integer gainIntegral;
|
||||||
|
|
||||||
@ApiModelProperty(value = "使用积分")
|
@ApiModelProperty(value = "使用积分")
|
||||||
private BigDecimal useIntegral;
|
private Integer useIntegral;
|
||||||
|
|
||||||
@ApiModelProperty(value = "给用户退了多少积分")
|
@ApiModelProperty(value = "给用户退了多少积分")
|
||||||
private BigDecimal backIntegral;
|
private Integer backIntegral;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String mark;
|
private String mark;
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import lombok.experimental.Accessors;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -26,11 +28,15 @@ public class StoreProductStockRequest implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商品ID, 多个逗号分割,如果是修改所有的,参数值为 all", required = true)
|
@ApiModelProperty(value = "商品ID", required = true)
|
||||||
@NotBlank(message = "请选择商品")
|
@NotEmpty(message = "请选择商品")
|
||||||
private String idList;
|
private Integer productId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "类型, 增加 add | 修改 update | 减少 diff", required = true)
|
@ApiModelProperty(value = "商品属性ID集合", required = true)
|
||||||
|
@NotEmpty(message = "请选择商品属性id集合")
|
||||||
|
private Integer attrId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "类型, 增加 add | 减少 diff", required = true)
|
||||||
@NotBlank(message = "请选择类型")
|
@NotBlank(message = "请选择类型")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class StoreProductCartProductInfoResponse implements Serializable {
|
|||||||
// private Boolean merUse;
|
// private Boolean merUse;
|
||||||
|
|
||||||
@ApiModelProperty(value = "获得积分")
|
@ApiModelProperty(value = "获得积分")
|
||||||
private BigDecimal giveIntegral;
|
private Integer giveIntegral;
|
||||||
|
|
||||||
@ApiModelProperty(value = "成本价")
|
@ApiModelProperty(value = "成本价")
|
||||||
private BigDecimal cost;
|
private BigDecimal cost;
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ public interface StoreProductService extends IService<StoreProduct> {
|
|||||||
*/
|
*/
|
||||||
List<StoreProduct> getList(IndexStoreProductSearchRequest request, PageParamRequest pageParamRequest);
|
List<StoreProduct> getList(IndexStoreProductSearchRequest request, PageParamRequest pageParamRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id集合获取商品信息
|
||||||
|
* @param productIds id集合
|
||||||
|
* @return 商品信息
|
||||||
|
*/
|
||||||
|
List<StoreProduct> getListInIds(List<Integer> productIds);
|
||||||
/**
|
/**
|
||||||
* 基本参数获取
|
* 基本参数获取
|
||||||
* @param storeProduct 产品参数
|
* @param storeProduct 产品参数
|
||||||
@@ -121,4 +127,9 @@ public interface StoreProductService extends IService<StoreProduct> {
|
|||||||
* @return 删除结果
|
* @return 删除结果
|
||||||
*/
|
*/
|
||||||
boolean deleteProduct(Integer productId);
|
boolean deleteProduct(Integer productId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 后台任务批量操作
|
||||||
|
*/
|
||||||
|
public void consumeProductStock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.constants.Constants;
|
|||||||
import com.utils.RedisUtil;
|
import com.utils.RedisUtil;
|
||||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||||
import com.zbkj.crmeb.store.service.OrderTaskService;
|
import com.zbkj.crmeb.store.service.OrderTaskService;
|
||||||
|
import com.zbkj.crmeb.store.service.StoreOrderService;
|
||||||
import com.zbkj.crmeb.store.service.StoreOrderTaskService;
|
import com.zbkj.crmeb.store.service.StoreOrderTaskService;
|
||||||
import com.zbkj.crmeb.task.order.OrderRefundByUser;
|
import com.zbkj.crmeb.task.order.OrderRefundByUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -29,6 +30,9 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StoreOrderTaskService storeOrderTaskService;
|
private StoreOrderTaskService storeOrderTaskService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreOrderService storeOrderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户取消订单
|
* 用户取消订单
|
||||||
* @author Mr.Zhang
|
* @author Mr.Zhang
|
||||||
@@ -49,7 +53,8 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
StoreOrder storeOrder = getJavaBeanStoreOrder(data);
|
// StoreOrder storeOrder = getJavaBeanStoreOrder(data);
|
||||||
|
StoreOrder storeOrder = storeOrderService.getById(Integer.valueOf(data.toString()));
|
||||||
boolean result = storeOrderTaskService.cancelByUser(storeOrder);
|
boolean result = storeOrderTaskService.cancelByUser(storeOrder);
|
||||||
if(!result){
|
if(!result){
|
||||||
redisUtil.lPush(redisKey, data);
|
redisUtil.lPush(redisKey, data);
|
||||||
@@ -79,18 +84,18 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
//如果10秒钟拿不到一个数据,那么退出循环
|
//如果10秒钟拿不到一个数据,那么退出循环
|
||||||
Object data = redisUtil.getRightPop(redisKey, 10L);
|
Object orderId = redisUtil.getRightPop(redisKey, 10L);
|
||||||
if(null == data){
|
if(null == orderId){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
StoreOrder storeOrder = getJavaBeanStoreOrder(data);
|
StoreOrder storeOrder = storeOrderService.getById(Integer.valueOf(orderId.toString()));
|
||||||
boolean result = storeOrderTaskService.refundApply(storeOrder);
|
boolean result = storeOrderTaskService.refundApply(storeOrder);
|
||||||
if(!result){
|
if(!result){
|
||||||
redisUtil.lPush(redisKey, data);
|
redisUtil.lPush(redisKey, orderId);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
redisUtil.lPush(redisKey, data);
|
redisUtil.lPush(redisKey, orderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,18 +146,18 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
//如果10秒钟拿不到一个数据,那么退出循环
|
//如果10秒钟拿不到一个数据,那么退出循环
|
||||||
Object data = redisUtil.getRightPop(redisKey, 10L);
|
Object id = redisUtil.getRightPop(redisKey, 10L);
|
||||||
if(null == data){
|
if(null == id){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try{
|
try{
|
||||||
StoreOrder storeOrder = getJavaBeanStoreOrder(data);
|
StoreOrder storeOrder = storeOrderService.getByEntityOne(new StoreOrder().setId(Integer.valueOf(id.toString())));
|
||||||
boolean result = storeOrderTaskService.takeByUser(storeOrder);
|
boolean result = storeOrderTaskService.takeByUser(storeOrder);
|
||||||
if(!result){
|
if(!result){
|
||||||
redisUtil.lPush(redisKey, data);
|
redisUtil.lPush(redisKey, id);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
redisUtil.lPush(redisKey, data);
|
redisUtil.lPush(redisKey, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -187,4 +192,4 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1172,7 +1172,12 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
|||||||
userBill.setLinkId(storeOrder.getId()+"");
|
userBill.setLinkId(storeOrder.getId()+"");
|
||||||
userBill.setBalance(currentUser.getNowMoney());
|
userBill.setBalance(currentUser.getNowMoney());
|
||||||
userBill.setMark("支付" + storeOrder.getPayPrice() + "元购买商品");
|
userBill.setMark("支付" + storeOrder.getPayPrice() + "元购买商品");
|
||||||
userBillService.save(userBill);
|
boolean saveUserbillResult = userBillService.save(userBill);
|
||||||
|
if(storeOrder.getUseIntegral() > 0){
|
||||||
|
BigDecimal useIntegral = BigDecimal.valueOf(storeOrder.getUseIntegral(),0);
|
||||||
|
currentUser.setIntegral(currentUser.getIntegral().subtract(useIntegral));
|
||||||
|
userService.updateBase(currentUser);
|
||||||
|
}
|
||||||
userService.userPayCountPlus(currentUser);
|
userService.userPayCountPlus(currentUser);
|
||||||
return orderUpdate2PayResult;
|
return orderUpdate2PayResult;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.utils.CrmebUtil;
|
|||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.marketing.service.StoreCouponUserService;
|
import com.zbkj.crmeb.marketing.service.StoreCouponUserService;
|
||||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||||
|
import com.zbkj.crmeb.store.model.StoreProduct;
|
||||||
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
||||||
import com.zbkj.crmeb.store.service.*;
|
import com.zbkj.crmeb.store.service.*;
|
||||||
import com.zbkj.crmeb.store.vo.StoreOrderInfoVo;
|
import com.zbkj.crmeb.store.vo.StoreOrderInfoVo;
|
||||||
@@ -23,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Mr.Zhang
|
* @author Mr.Zhang
|
||||||
@@ -78,10 +80,8 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
//回滚优惠券
|
//回滚优惠券
|
||||||
rollbackCoupon(storeOrder);
|
rollbackCoupon(storeOrder);
|
||||||
|
|
||||||
//回滚库存
|
// 回滚积分
|
||||||
rollbackIntegral(storeOrder);
|
rollbackIntegral(storeOrder);
|
||||||
|
|
||||||
//回滚积分
|
|
||||||
setIntegral(storeOrder, 1); //单独回滚使用积分
|
setIntegral(storeOrder, 1); //单独回滚使用积分
|
||||||
|
|
||||||
return rollbackStock(storeOrder);
|
return rollbackStock(storeOrder);
|
||||||
@@ -118,6 +118,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
|
|
||||||
//回滚经验
|
//回滚经验
|
||||||
rollbackExp(storeOrder);
|
rollbackExp(storeOrder);
|
||||||
|
rollbackStock(storeOrder);
|
||||||
return true;
|
return true;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
return false;
|
return false;
|
||||||
@@ -169,6 +170,9 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
//获得赠送积分
|
//获得赠送积分
|
||||||
setIntegral(storeOrder, 1);
|
setIntegral(storeOrder, 1);
|
||||||
|
|
||||||
|
// 获取商品额外赠送的积分
|
||||||
|
setGiveIntegral(storeOrder);
|
||||||
|
|
||||||
//获得赠送经验
|
//获得赠送经验
|
||||||
setExp(storeOrder, 1);
|
setExp(storeOrder, 1);
|
||||||
|
|
||||||
@@ -209,11 +213,11 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
*/
|
*/
|
||||||
private void setIntegral(StoreOrder storeOrder, int type) {
|
private void setIntegral(StoreOrder storeOrder, int type) {
|
||||||
try {
|
try {
|
||||||
if(storeOrder.getUseIntegral().compareTo(BigDecimal.ZERO) < 1){
|
if(storeOrder.getUseIntegral() < 1){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
||||||
userOperateFundsRequest.setValue(storeOrder.getUseIntegral());
|
userOperateFundsRequest.setValue(BigDecimal.valueOf(storeOrder.getUseIntegral()));
|
||||||
userOperateFundsRequest.setFoundsType(Constants.ORDER_STATUS_STR_BARGAIN);
|
userOperateFundsRequest.setFoundsType(Constants.ORDER_STATUS_STR_BARGAIN);
|
||||||
userOperateFundsRequest.setUid(storeOrder.getUid());
|
userOperateFundsRequest.setUid(storeOrder.getUid());
|
||||||
userOperateFundsRequest.setTitle(Constants.ORDER_STATUS_STR_TAKE);
|
userOperateFundsRequest.setTitle(Constants.ORDER_STATUS_STR_TAKE);
|
||||||
@@ -225,6 +229,25 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取额外赠送积分
|
||||||
|
private void setGiveIntegral(StoreOrder storeOrder){
|
||||||
|
// 获取商品额外赠送积分
|
||||||
|
List<StoreOrderInfoVo> orderInfoList = storeOrderInfoService.getOrderListByOrderId(storeOrder.getId());
|
||||||
|
List<Integer> productIds = orderInfoList.stream().map(StoreOrderInfoVo::getProductId).collect(Collectors.toList());
|
||||||
|
if(productIds.size() > 0){
|
||||||
|
List<StoreProduct> products = storeProductService.getListInIds(productIds);
|
||||||
|
int sumIntegral = products.stream().mapToInt(e -> e.getGiveIntegral().intValue()).sum();
|
||||||
|
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
||||||
|
userOperateFundsRequest.setValue(BigDecimal.valueOf(sumIntegral));
|
||||||
|
userOperateFundsRequest.setFoundsType(Constants.ORDER_STATUS_STR_BARGAIN);
|
||||||
|
userOperateFundsRequest.setUid(storeOrder.getUid());
|
||||||
|
userOperateFundsRequest.setTitle(Constants.ORDER_STATUS_STR_TAKE);
|
||||||
|
userOperateFundsRequest.setFoundsCategory(Constants.USER_BILL_CATEGORY_INTEGRAL);
|
||||||
|
userOperateFundsRequest.setType(1);
|
||||||
|
userService.updateFounds(userOperateFundsRequest, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算积分
|
* 计算积分
|
||||||
* @author Mr.Zhang
|
* @author Mr.Zhang
|
||||||
@@ -237,7 +260,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
rate = "1";
|
rate = "1";
|
||||||
}
|
}
|
||||||
BigDecimal rateBigDecimal = CrmebUtil.getBigDecimalRate(rate);
|
BigDecimal rateBigDecimal = CrmebUtil.getBigDecimalRate(rate);
|
||||||
return rateBigDecimal.multiply(payPrice).setScale(BigDecimal.ROUND_DOWN);
|
return rateBigDecimal.multiply(payPrice).setScale(BigDecimal.ROUND_HALF_DOWN);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
throw new CrmebException("计算积分失败" + e.getMessage());
|
throw new CrmebException("计算积分失败" + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -495,8 +518,9 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
|
|
||||||
for (StoreOrderInfoVo orderInfoVo : orderInfoVoList) {
|
for (StoreOrderInfoVo orderInfoVo : orderInfoVoList) {
|
||||||
StoreProductStockRequest stockRequest = new StoreProductStockRequest();
|
StoreProductStockRequest stockRequest = new StoreProductStockRequest();
|
||||||
stockRequest.setIdList(orderInfoVo.getProductId().toString());
|
stockRequest.setProductId(orderInfoVo.getProductId());
|
||||||
stockRequest.setType("diff");
|
stockRequest.setAttrId(Integer.valueOf(orderInfoVo.getInfo().getProductAttrUnique()));
|
||||||
|
stockRequest.setType("add");
|
||||||
// if(orderInfoVo.getInfo().getInteger("cart_num") < 1){
|
// if(orderInfoVo.getInfo().getInteger("cart_num") < 1){
|
||||||
if(orderInfoVo.getInfo().getCartNum() < 1){
|
if(orderInfoVo.getInfo().getCartNum() < 1){
|
||||||
//如果取不到值,则跳过
|
//如果取不到值,则跳过
|
||||||
@@ -522,9 +546,10 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
|||||||
private void rollbackIntegral(StoreOrder storeOrder) {
|
private void rollbackIntegral(StoreOrder storeOrder) {
|
||||||
|
|
||||||
//回滚使用积分
|
//回滚使用积分
|
||||||
if(storeOrder.getBackIntegral().compareTo(BigDecimal.ZERO) > 0){
|
if(storeOrder.getUseIntegral() > 0){
|
||||||
//有退积分操作, 那么用户使用的积分会减少
|
//有退积分操作, 那么用户使用的积分会减少
|
||||||
storeOrder.setUseIntegral(storeOrder.getUseIntegral().subtract(storeOrder.getBackIntegral()));
|
// storeOrder.setUseIntegral(storeOrder.getUseIntegral()- (storeOrder.getBackIntegral()));
|
||||||
|
storeOrder.setBackIntegral(storeOrder.getUseIntegral());
|
||||||
}
|
}
|
||||||
setIntegral(storeOrder, 1);
|
setIntegral(storeOrder, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class StoreProductAttrValueServiceImpl extends ServiceImpl<StoreProductAt
|
|||||||
@Override
|
@Override
|
||||||
public boolean decProductAttrStock(Integer productId, Integer attrValueId, Integer num, Integer type) {
|
public boolean decProductAttrStock(Integer productId, Integer attrValueId, Integer num, Integer type) {
|
||||||
List<StoreProductAttrValue> existAttrValues = getListByProductIdAndAttrId(productId, attrValueId+"");
|
List<StoreProductAttrValue> existAttrValues = getListByProductIdAndAttrId(productId, attrValueId+"");
|
||||||
if(existAttrValues.size() == 0) throw new CrmebException("商品部存在");
|
if(existAttrValues.size() == 0) throw new CrmebException("商品不存在");
|
||||||
|
|
||||||
StoreProductAttrValue attrValue = existAttrValues.get(0);
|
StoreProductAttrValue attrValue = existAttrValues.get(0);
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ import com.zbkj.crmeb.store.response.StoreProductTabsHeader;
|
|||||||
import com.zbkj.crmeb.store.service.*;
|
import com.zbkj.crmeb.store.service.*;
|
||||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||||
import com.zbkj.crmeb.system.service.SystemConfigService;
|
import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||||
|
import com.zbkj.crmeb.task.order.OrderRefundByUser;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -97,6 +100,8 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StoreCouponService storeCouponService;
|
private StoreCouponService storeCouponService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(OrderRefundByUser.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* H5端使用
|
* H5端使用
|
||||||
* @param request
|
* @param request
|
||||||
@@ -242,6 +247,18 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
|||||||
return CommonPage.copyPageInfo(storeProductPage, storeProductResponses);
|
return CommonPage.copyPageInfo(storeProductPage, storeProductResponses);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据商品id集合获取
|
||||||
|
* @param productIds id集合
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<StoreProduct> getListInIds(List<Integer> productIds) {
|
||||||
|
LambdaQueryWrapper<StoreProduct> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.in(StoreProduct::getId,productIds);
|
||||||
|
return dao.selectList(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据产品属性查询
|
* 根据产品属性查询
|
||||||
* @param storeProduct 产品参数
|
* @param storeProduct 产品参数
|
||||||
@@ -673,10 +690,36 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean stockAddRedis(StoreProductStockRequest request) {
|
public boolean stockAddRedis(StoreProductStockRequest request) {
|
||||||
redisUtil.lPush(Constants.PRODUCT_STOCK_UPDATE, request);
|
redisUtil.lPush(Constants.PRODUCT_STOCK_UPDATE, JSON.toJSONString(request));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void consumeProductStock() {
|
||||||
|
String redisKey = Constants.PRODUCT_STOCK_UPDATE;
|
||||||
|
Long size = redisUtil.getListSize(redisKey);
|
||||||
|
logger.info("StoreProductServiceImpl.doProductStock | size:" + size);
|
||||||
|
if(size < 1){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
//如果10秒钟拿不到一个数据,那么退出循环
|
||||||
|
Object data = redisUtil.getRightPop(redisKey, 10L);
|
||||||
|
if(null == data){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try{
|
||||||
|
StoreProductStockRequest storeProductStockRequest =
|
||||||
|
com.alibaba.fastjson.JSONObject.toJavaObject(com.alibaba.fastjson.JSONObject.parseObject(data.toString()), StoreProductStockRequest.class);
|
||||||
|
boolean result = doProductStock(storeProductStockRequest);
|
||||||
|
if(!result){
|
||||||
|
redisUtil.lPush(redisKey, data);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
redisUtil.lPush(redisKey, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扣减库存添加销量
|
* 扣减库存添加销量
|
||||||
@@ -691,14 +734,15 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
|||||||
// 不存在=但属性 存在则是多属性
|
// 不存在=但属性 存在则是多属性
|
||||||
StoreProductAttrValue productsInAttrValue =
|
StoreProductAttrValue productsInAttrValue =
|
||||||
storeProductAttrValueService.getById(attrValueId);
|
storeProductAttrValueService.getById(attrValueId);
|
||||||
|
StoreProduct storeProduct = getById(productId);
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
if(null != productsInAttrValue){
|
if(null != productsInAttrValue){
|
||||||
result = storeProductAttrValueService.decProductAttrStock(productId,attrValueId,num,type);
|
result = storeProductAttrValueService.decProductAttrStock(productId,attrValueId,num,type);
|
||||||
}
|
}
|
||||||
LambdaUpdateWrapper<StoreProduct> lqwuper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<StoreProduct> lqwuper = new LambdaUpdateWrapper<>();
|
||||||
lqwuper.eq(StoreProduct::getId, productId);
|
lqwuper.eq(StoreProduct::getId, productId);
|
||||||
lqwuper.set(StoreProduct::getStock, productsInAttrValue.getStock()-num);
|
lqwuper.set(StoreProduct::getStock, storeProduct.getStock()-num);
|
||||||
lqwuper.set(StoreProduct::getSales, productsInAttrValue.getStock()+num);
|
lqwuper.set(StoreProduct::getSales, storeProduct.getSales()+num);
|
||||||
result = update(lqwuper);
|
result = update(lqwuper);
|
||||||
if(result){ //判断库存警戒值
|
if(result){ //判断库存警戒值
|
||||||
Integer alterNumI=0;
|
Integer alterNumI=0;
|
||||||
@@ -1251,6 +1295,26 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
|||||||
|
|
||||||
///////////////////////////////////////////自定义方法
|
///////////////////////////////////////////自定义方法
|
||||||
|
|
||||||
|
// 操作库存
|
||||||
|
private boolean doProductStock(StoreProductStockRequest storeProductStockRequest){
|
||||||
|
StoreProduct existProduct = getById(storeProductStockRequest.getProductId());
|
||||||
|
List<StoreProductAttrValue> existAttr =
|
||||||
|
storeProductAttrValueService.getListByProductIdAndAttrId(storeProductStockRequest.getProductId(), storeProductStockRequest.getAttrId().toString());
|
||||||
|
if(null == existProduct || null == existAttr){ // 为找到商品
|
||||||
|
logger.info("库存修改任务未获取到商品信息"+JSON.toJSONString(storeProductStockRequest));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
boolean isPlus = storeProductStockRequest.getType().equals("add");
|
||||||
|
int productStock = isPlus ? existProduct.getStock() + storeProductStockRequest.getNum() : existProduct.getStock() - storeProductStockRequest.getNum();
|
||||||
|
existProduct.setStock(productStock);
|
||||||
|
updateById(existProduct);
|
||||||
|
for (StoreProductAttrValue attrValue : existAttr) {
|
||||||
|
int productAttrStock = isPlus ? attrValue.getStock() + storeProductStockRequest.getNum() : attrValue.getStock() - storeProductStockRequest.getNum();
|
||||||
|
attrValue.setStock(productAttrStock);
|
||||||
|
storeProductAttrValueService.updateById(attrValue);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -246,9 +246,9 @@ public class OrderUtils {
|
|||||||
|
|
||||||
// 需要return的自定义变量
|
// 需要return的自定义变量
|
||||||
BigDecimal couponPrice = BigDecimal.ZERO;
|
BigDecimal couponPrice = BigDecimal.ZERO;
|
||||||
BigDecimal surPlusIntegral = BigDecimal.ZERO;
|
Integer surPlusIntegral = 0;
|
||||||
BigDecimal deductionPrice = BigDecimal.ZERO;
|
BigDecimal deductionPrice = BigDecimal.ZERO;
|
||||||
BigDecimal usedIntegral = BigDecimal.ZERO;
|
Integer usedIntegral = 0;
|
||||||
BigDecimal payPrice = cor.getPriceGroup().getTotalPrice();
|
BigDecimal payPrice = cor.getPriceGroup().getTotalPrice();
|
||||||
|
|
||||||
User currentUser = userService.getInfo();
|
User currentUser = userService.getInfo();
|
||||||
@@ -323,16 +323,18 @@ public class OrderUtils {
|
|||||||
if(null != request.getUseIntegral() && currentUser.getIntegral().compareTo(BigDecimal.ZERO) > 0){
|
if(null != request.getUseIntegral() && currentUser.getIntegral().compareTo(BigDecimal.ZERO) > 0){
|
||||||
deductionPrice = currentUser.getIntegral().multiply(BigDecimal.valueOf(Double.valueOf(cor.getOther().get("integralRatio").toString())));
|
deductionPrice = currentUser.getIntegral().multiply(BigDecimal.valueOf(Double.valueOf(cor.getOther().get("integralRatio").toString())));
|
||||||
if(request.getUseIntegral()){
|
if(request.getUseIntegral()){
|
||||||
|
// 积分兑换金额小于实际支付金额
|
||||||
if(deductionPrice.compareTo(payPrice) < 0){
|
if(deductionPrice.compareTo(payPrice) < 0){
|
||||||
payPrice = payPrice.subtract(deductionPrice);
|
payPrice = payPrice.subtract(deductionPrice);
|
||||||
usedIntegral = currentUser.getIntegral();
|
usedIntegral = currentUser.getIntegral().intValue();
|
||||||
}else{
|
}else{
|
||||||
deductionPrice = payPrice;
|
deductionPrice = payPrice;
|
||||||
if(payPrice.compareTo(BigDecimal.ZERO) > 0 && usedIntegral.compareTo(BigDecimal.ZERO) > 0){
|
if(payPrice.compareTo(BigDecimal.ZERO) > 0 && usedIntegral > 0){
|
||||||
usedIntegral = payPrice.divide(usedIntegral);
|
usedIntegral = payPrice.divide(BigDecimal.valueOf(usedIntegral.doubleValue())).intValue();
|
||||||
surPlusIntegral = currentUser.getIntegral().subtract(usedIntegral);
|
surPlusIntegral = currentUser.getIntegral().intValue() - usedIntegral;
|
||||||
}
|
}
|
||||||
payPrice = BigDecimal.ZERO;
|
payPrice = BigDecimal.ZERO;
|
||||||
|
usedIntegral = currentUser.getIntegral().intValue();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
payPrice = currentOrderPriceGroup.getPayPrice();
|
payPrice = currentOrderPriceGroup.getPayPrice();
|
||||||
@@ -340,7 +342,7 @@ public class OrderUtils {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
deductionPrice = BigDecimal.ZERO;
|
deductionPrice = BigDecimal.ZERO;
|
||||||
usedIntegral = BigDecimal.ZERO;
|
usedIntegral = 0;
|
||||||
}
|
}
|
||||||
if(payPrice.compareTo(BigDecimal.ZERO) <= 0) payPrice = BigDecimal.ZERO;
|
if(payPrice.compareTo(BigDecimal.ZERO) <= 0) payPrice = BigDecimal.ZERO;
|
||||||
|
|
||||||
@@ -358,9 +360,18 @@ public class OrderUtils {
|
|||||||
result.setPayPrice(payPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
result.setPayPrice(payPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
||||||
result.setPayPostage(payPostage.setScale(2, BigDecimal.ROUND_CEILING));
|
result.setPayPostage(payPostage.setScale(2, BigDecimal.ROUND_CEILING));
|
||||||
result.setCouponPrice(couponPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
result.setCouponPrice(couponPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
||||||
result.setDeductionPrice(deductionPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
result.setDeductionPrice(request.getUseIntegral() ? deductionPrice.setScale(2, BigDecimal.ROUND_CEILING) : BigDecimal.ZERO);
|
||||||
result.setUsedIntegral(usedIntegral.setScale(2, BigDecimal.ROUND_CEILING));
|
result.setUsedIntegral(usedIntegral);
|
||||||
result.setSurplusIntegral(surPlusIntegral.setScale(2, BigDecimal.ROUND_CEILING));
|
result.setSurplusIntegral(surPlusIntegral);
|
||||||
|
// 更新计算后的数据到订单缓存
|
||||||
|
cor.getPriceGroup().setTotalPrice(result.getTotalPrice());
|
||||||
|
cor.getPriceGroup().setPayPrice(result.getPayPrice());
|
||||||
|
cor.getPriceGroup().setPayPostage(result.getPayPostage());
|
||||||
|
cor.getPriceGroup().setCouponPrice(result.getCouponPrice());
|
||||||
|
cor.getPriceGroup().setDeductionPrice(result.getDeductionPrice());
|
||||||
|
cor.getPriceGroup().setUsedIntegral(result.getUsedIntegral());
|
||||||
|
// cacheDeleteOrderInfo(currentUser.getUid(), orderKey);
|
||||||
|
cacheRepliceOrderInfo(orderKey, currentUser.getUid(), cor);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +387,7 @@ public class OrderUtils {
|
|||||||
UserAddress currentUserAddress = new UserAddress();
|
UserAddress currentUserAddress = new UserAddress();
|
||||||
List<Integer> cartIds = new ArrayList<>();
|
List<Integer> cartIds = new ArrayList<>();
|
||||||
Integer totalNum = 0;
|
Integer totalNum = 0;
|
||||||
BigDecimal gainIntegral = BigDecimal.ZERO;
|
Integer gainIntegral = 0;
|
||||||
|
|
||||||
// todo 开启事务
|
// todo 开启事务
|
||||||
|
|
||||||
@@ -400,11 +411,11 @@ public class OrderUtils {
|
|||||||
totalNum += cartResponse.getCartNum();
|
totalNum += cartResponse.getCartNum();
|
||||||
// todo 秒杀拼团砍价 二期
|
// todo 秒杀拼团砍价 二期
|
||||||
|
|
||||||
BigDecimal cartInfoGainIntegral =
|
Integer cartInfoGainIntegral =
|
||||||
cartResponse.getProductInfo().getGiveIntegral().compareTo(BigDecimal.ZERO) > 0 ?
|
(cartResponse.getProductInfo().getGiveIntegral() != null && cartResponse.getProductInfo().getGiveIntegral() > 0 )?
|
||||||
cartResponse.getProductInfo().getGiveIntegral().multiply(BigDecimal.valueOf(cartResponse.getCartNum().doubleValue()))
|
cartResponse.getProductInfo().getGiveIntegral() * cartResponse.getCartNum()
|
||||||
:BigDecimal.ZERO;
|
: 0;
|
||||||
gainIntegral = gainIntegral.add(cartInfoGainIntegral);
|
gainIntegral = gainIntegral + cartInfoGainIntegral;
|
||||||
}
|
}
|
||||||
// todo 检测营销产品状态
|
// todo 检测营销产品状态
|
||||||
// 发快递还是门店自提
|
// 发快递还是门店自提
|
||||||
@@ -435,7 +446,7 @@ public class OrderUtils {
|
|||||||
BigDecimal mapPayPrice = cor.getPriceGroup().getPayPrice();
|
BigDecimal mapPayPrice = cor.getPriceGroup().getPayPrice();
|
||||||
BigDecimal mapPayPostage = cor.getPriceGroup().getPayPostage();
|
BigDecimal mapPayPostage = cor.getPriceGroup().getPayPostage();
|
||||||
BigDecimal mapDeductionPrice = cor.getPriceGroup().getDeductionPrice();
|
BigDecimal mapDeductionPrice = cor.getPriceGroup().getDeductionPrice();
|
||||||
BigDecimal mapUsedIntegral = cor.getPriceGroup().getUsedIntegral();
|
Integer mapUsedIntegral = cor.getPriceGroup().getUsedIntegral();
|
||||||
BigDecimal mapCostPrice = cor.getPriceGroup().getCostPrice();
|
BigDecimal mapCostPrice = cor.getPriceGroup().getCostPrice();
|
||||||
|
|
||||||
int couponId = null == cor.getUsableCoupon() ? 0: cor.getUsableCoupon().getId();
|
int couponId = null == cor.getUsableCoupon() ? 0: cor.getUsableCoupon().getId();
|
||||||
@@ -483,8 +494,8 @@ public class OrderUtils {
|
|||||||
if(request.getUseIntegral() && currentUser.getIntegral().compareTo(BigDecimal.ZERO) > 0){
|
if(request.getUseIntegral() && currentUser.getIntegral().compareTo(BigDecimal.ZERO) > 0){
|
||||||
BigDecimal deductionPrice = BigDecimal.ZERO;
|
BigDecimal deductionPrice = BigDecimal.ZERO;
|
||||||
if(null != cor.getPriceGroup().getUsedIntegral()){
|
if(null != cor.getPriceGroup().getUsedIntegral()){
|
||||||
deductionPrice = cor.getPriceGroup().getUsedIntegral();
|
deductionPrice = BigDecimal.valueOf(cor.getPriceGroup().getUsedIntegral(),2);
|
||||||
if(cor.getPriceGroup().getUsedIntegral().compareTo(BigDecimal.ZERO) > 0){
|
if(cor.getPriceGroup().getUsedIntegral() > 0){
|
||||||
currentUser.setIntegral(BigDecimal.ZERO);
|
currentUser.setIntegral(BigDecimal.ZERO);
|
||||||
disIntegle = userService.updateBase(currentUser);
|
disIntegle = userService.updateBase(currentUser);
|
||||||
}else{
|
}else{
|
||||||
@@ -538,7 +549,7 @@ public class OrderUtils {
|
|||||||
storeCartService.deleteCartByIds(idsInt);
|
storeCartService.deleteCartByIds(idsInt);
|
||||||
|
|
||||||
// 删除缓存订单
|
// 删除缓存订单
|
||||||
cacheDeleteOrderInfo(currentUser.getUid(),storeOrder.getId());
|
cacheDeleteOrderInfo(currentUser.getUid(), orderKey);
|
||||||
// 检查缺省的默认地址设置
|
// 检查缺省的默认地址设置
|
||||||
UserAddress defaultAddress = userAddressService.getDefault();
|
UserAddress defaultAddress = userAddressService.getDefault();
|
||||||
if(null != defaultAddress){
|
if(null != defaultAddress){
|
||||||
@@ -783,7 +794,7 @@ public class OrderUtils {
|
|||||||
* @param confirmOrderResponse 确认订单对象
|
* @param confirmOrderResponse 确认订单对象
|
||||||
* @return 缓存结果
|
* @return 缓存结果
|
||||||
*/
|
*/
|
||||||
public String cacheOrderInfo(Integer userId,ConfirmOrderResponse confirmOrderResponse){
|
public String cacheSetOrderInfo(Integer userId,ConfirmOrderResponse confirmOrderResponse){
|
||||||
String key = DigestUtils.md5Hex(DateUtil.getNowTime().toString());
|
String key = DigestUtils.md5Hex(DateUtil.getNowTime().toString());
|
||||||
redisUtil.set("user_order_" + userId + key, JSONObject.toJSONString(confirmOrderResponse),Constants.ORDER_CASH_CONFIRM, TimeUnit.MINUTES);
|
redisUtil.set("user_order_" + userId + key, JSONObject.toJSONString(confirmOrderResponse),Constants.ORDER_CASH_CONFIRM, TimeUnit.MINUTES);
|
||||||
return key;
|
return key;
|
||||||
@@ -807,13 +818,27 @@ public class OrderUtils {
|
|||||||
* @param userId 用户id
|
* @param userId 用户id
|
||||||
* @param cacheKey 缓存key
|
* @param cacheKey 缓存key
|
||||||
*/
|
*/
|
||||||
public void cacheDeleteOrderInfo(Integer userId, Integer cacheKey){
|
public void cacheDeleteOrderInfo(Integer userId, String cacheKey){
|
||||||
String key = "user_order_" + userId + cacheKey;
|
String key = "user_order_" + userId + cacheKey;
|
||||||
boolean exists = redisUtil.exists(key);
|
boolean exists = redisUtil.exists(key);
|
||||||
if(!exists) return;
|
if(!exists) return;
|
||||||
redisUtil.remove(key);
|
redisUtil.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新当前订单结算信息 切换收货地址以及积分抵扣后支付金额可能会变动
|
||||||
|
* @param orderKey
|
||||||
|
* @param userId
|
||||||
|
* @param confirmOrderResponse
|
||||||
|
*/
|
||||||
|
public void cacheRepliceOrderInfo(String orderKey,Integer userId, ConfirmOrderResponse confirmOrderResponse){
|
||||||
|
String key = "user_order_" + userId + orderKey;
|
||||||
|
if(redisUtil.exists(key)){
|
||||||
|
redisUtil.remove(key);
|
||||||
|
}
|
||||||
|
redisUtil.set(key, JSONObject.toJSONString(confirmOrderResponse),Constants.ORDER_CASH_CONFIRM, TimeUnit.MINUTES);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据订单号查询订单信息
|
* 根据订单号查询订单信息
|
||||||
* @param id 订单id
|
* @param id 订单id
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
package com.zbkj.crmeb.system.controller;
|
|
||||||
|
|
||||||
import com.common.CommonPage;
|
|
||||||
import com.common.CommonResult;
|
|
||||||
import com.common.PageParamRequest;
|
|
||||||
import com.zbkj.crmeb.system.request.SystemUserTaskRequest;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import com.zbkj.crmeb.system.service.SystemUserTaskService;
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserTask;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 等级任务设置 前端控制器
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("api/admin/system/user/task")
|
|
||||||
@Api(tags = "设置 -- 会员等级 -- 等级任务")
|
|
||||||
public class SystemUserTaskController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SystemUserTaskService systemUserTaskService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分页显示等级任务设置
|
|
||||||
* @param systemUserTaskRequest 搜索条件
|
|
||||||
* @param pageParamRequest 分页参数
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "分页列表")
|
|
||||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
||||||
public CommonResult<CommonPage<SystemUserTask>> getList(@ModelAttribute SystemUserTaskRequest systemUserTaskRequest, @ModelAttribute PageParamRequest pageParamRequest){
|
|
||||||
SystemUserTask systemUserTask = new SystemUserTask();
|
|
||||||
BeanUtils.copyProperties(systemUserTaskRequest, systemUserTask);
|
|
||||||
CommonPage<SystemUserTask> systemUserTaskCommonPage = CommonPage.restPage(systemUserTaskService.getList(systemUserTaskRequest, pageParamRequest));
|
|
||||||
return CommonResult.success(systemUserTaskCommonPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增等级任务设置
|
|
||||||
* @param systemUserTaskRequest 新增参数
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "新增")
|
|
||||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
||||||
public CommonResult<String> save(@ModelAttribute SystemUserTaskRequest systemUserTaskRequest){
|
|
||||||
SystemUserTask systemUserTask = new SystemUserTask();
|
|
||||||
BeanUtils.copyProperties(systemUserTaskRequest, systemUserTask);
|
|
||||||
|
|
||||||
if(systemUserTaskService.save(systemUserTask)){
|
|
||||||
return CommonResult.success();
|
|
||||||
}else{
|
|
||||||
return CommonResult.failed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除等级任务设置
|
|
||||||
* @param id Integer
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "删除")
|
|
||||||
@RequestMapping(value = "/delete", method = RequestMethod.GET)
|
|
||||||
public CommonResult<String> delete(@RequestParam(value = "id") Integer id){
|
|
||||||
if(systemUserTaskService.removeById(id)){
|
|
||||||
return CommonResult.success();
|
|
||||||
}else{
|
|
||||||
return CommonResult.failed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改等级任务设置
|
|
||||||
* @param id integer id
|
|
||||||
* @param systemUserTaskRequest 修改参数
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "修改")
|
|
||||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
|
||||||
public CommonResult<String> update(@RequestParam Integer id, @ModelAttribute SystemUserTaskRequest systemUserTaskRequest){
|
|
||||||
SystemUserTask systemUserTask = new SystemUserTask();
|
|
||||||
BeanUtils.copyProperties(systemUserTaskRequest, systemUserTask);
|
|
||||||
systemUserTask.setId(id);
|
|
||||||
|
|
||||||
if(systemUserTaskService.updateById(systemUserTask)){
|
|
||||||
return CommonResult.success();
|
|
||||||
}else{
|
|
||||||
return CommonResult.failed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询等级任务设置信息
|
|
||||||
* @param id Integer
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "详情")
|
|
||||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
|
||||||
public CommonResult<SystemUserTask> info(@RequestParam(value = "id") Integer id){
|
|
||||||
SystemUserTask systemUserTask = systemUserTaskService.getById(id);
|
|
||||||
return CommonResult.success(systemUserTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.zbkj.crmeb.system.dao;
|
|
||||||
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserTask;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 等级任务设置 Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
public interface SystemUserTaskDao extends BaseMapper<SystemUserTask> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.zbkj.crmeb.system.model;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 等级任务设置
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("eb_system_user_task")
|
|
||||||
@ApiModel(value="SystemUserTask对象", description="等级任务设置")
|
|
||||||
public class SystemUserTask implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "配置原名")
|
|
||||||
private String realName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务类型")
|
|
||||||
private String taskType;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "限定数")
|
|
||||||
private Integer number;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "等级id")
|
|
||||||
private Integer levelId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序")
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否显示")
|
|
||||||
private Boolean isShow;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一")
|
|
||||||
private Boolean isMust;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务说明")
|
|
||||||
private String illustrate;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "新增时间")
|
|
||||||
private Integer addTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.zbkj.crmeb.system.request;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 等级任务设置
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("eb_system_user_task")
|
|
||||||
@ApiModel(value="SystemUserTask对象", description="等级任务设置")
|
|
||||||
public class SystemUserTaskRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "配置原名")
|
|
||||||
private String realName;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务类型")
|
|
||||||
private String taskType;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "限定数")
|
|
||||||
private Integer number;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "等级id")
|
|
||||||
private Integer levelId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序")
|
|
||||||
private Integer sort;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否显示")
|
|
||||||
private Boolean isShow;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一")
|
|
||||||
private Boolean isMust;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务说明")
|
|
||||||
private String illustrate;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "新增时间")
|
|
||||||
private Integer addTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.zbkj.crmeb.system.service;
|
|
||||||
|
|
||||||
import com.common.PageParamRequest;
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserTask;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.zbkj.crmeb.system.request.SystemUserTaskRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @Description SystemUserTaskService 接口
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
public interface SystemUserTaskService extends IService<SystemUserTask> {
|
|
||||||
List<SystemUserTask> getList(SystemUserTaskRequest request, PageParamRequest pageParamRequest);
|
|
||||||
|
|
||||||
boolean complete(Integer userId, Integer levelId);
|
|
||||||
}
|
|
||||||
@@ -76,12 +76,15 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
|||||||
lambdaQueryWrapper.eq(SystemConfig::getStatus, false);
|
lambdaQueryWrapper.eq(SystemConfig::getStatus, false);
|
||||||
|
|
||||||
SystemConfig systemConfig = dao.selectOne(lambdaQueryWrapper);
|
SystemConfig systemConfig = dao.selectOne(lambdaQueryWrapper);
|
||||||
if(StringUtils.isBlank(systemConfig.getValue())){
|
|
||||||
systemConfig.setValue(null);
|
String value = null;
|
||||||
|
if(null != systemConfig && StringUtils.isNotBlank(systemConfig.getValue())){
|
||||||
|
value = systemConfig.getValue();
|
||||||
}
|
}
|
||||||
return systemConfig.getValue();
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据key更新值
|
* 根据key更新值
|
||||||
* @param key key
|
* @param key key
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
package com.zbkj.crmeb.system.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.common.PageParamRequest;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserLevel;
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserTask;
|
|
||||||
import com.zbkj.crmeb.system.dao.SystemUserTaskDao;
|
|
||||||
import com.zbkj.crmeb.system.request.SystemUserTaskRequest;
|
|
||||||
import com.zbkj.crmeb.system.service.SystemUserLevelService;
|
|
||||||
import com.zbkj.crmeb.system.service.SystemUserTaskService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.zbkj.crmeb.user.service.UserTaskFinishService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @Description SystemUserTaskServiceImpl 接口实现
|
|
||||||
* @since 2020-04-13
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class SystemUserTaskServiceImpl extends ServiceImpl<SystemUserTaskDao, SystemUserTask> implements SystemUserTaskService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SystemUserTaskDao dao;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SystemUserLevelService systemUserLevelService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserTaskFinishService userTaskFinishService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SystemUserTask> getList(SystemUserTaskRequest request, PageParamRequest pageParamRequest) {
|
|
||||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
|
||||||
return dao.selectList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 完成任务
|
|
||||||
* @param userId integer id
|
|
||||||
* @param levelId integer 等级
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-10
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean complete(Integer userId, Integer levelId) {
|
|
||||||
List<SystemUserLevel> systemUserLevels = systemUserLevelService.getGradeListByLevelId(levelId);
|
|
||||||
if(systemUserLevels == null){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//从集合中取出ID
|
|
||||||
List<Integer> idList = systemUserLevels.stream().map(SystemUserLevel::getId).distinct().collect(Collectors.toList());
|
|
||||||
|
|
||||||
//获取任务信息
|
|
||||||
LambdaQueryWrapper<SystemUserTask> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.select(SystemUserTask::getId);
|
|
||||||
lambdaQueryWrapper.in(SystemUserTask::getId, idList);
|
|
||||||
List<SystemUserTask> systemUserTasks = dao.selectList(lambdaQueryWrapper);
|
|
||||||
if(systemUserTasks == null){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//完成任务
|
|
||||||
return userTaskFinishService.saveByTaskList(userId, systemUserTasks);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.zbkj.crmeb.task.product;
|
||||||
|
|
||||||
|
import com.utils.DateUtil;
|
||||||
|
import com.zbkj.crmeb.store.service.OrderTaskService;
|
||||||
|
import com.zbkj.crmeb.store.service.StoreProductService;
|
||||||
|
import com.zbkj.crmeb.task.order.OrderTakeByUser;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stivepeim
|
||||||
|
* @title: ProductStock
|
||||||
|
* @projectName crmeb
|
||||||
|
* @description: 操作商品库存
|
||||||
|
* @date 2020/8/2017:04
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Configuration //读取配置
|
||||||
|
@EnableScheduling // 2.开启定时任务
|
||||||
|
public class ProductStock {
|
||||||
|
//日志
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ProductStock.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreProductService storeProductService;
|
||||||
|
|
||||||
|
@Scheduled(fixedDelay = 1000 * 60L) //1分钟同步一次数据
|
||||||
|
public void init(){
|
||||||
|
logger.info("---OrderTakeByUser task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDateTime());
|
||||||
|
try {
|
||||||
|
storeProductService.consumeProductStock();
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("OrderTakeByUser.task" + " | msg : " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,19 +3,17 @@ package com.zbkj.crmeb.user.controller;
|
|||||||
import com.common.CommonPage;
|
import com.common.CommonPage;
|
||||||
import com.common.CommonResult;
|
import com.common.CommonResult;
|
||||||
import com.common.PageParamRequest;
|
import com.common.PageParamRequest;
|
||||||
import com.zbkj.crmeb.user.request.UserLevelRequest;
|
import com.zbkj.crmeb.user.model.UserLevel;
|
||||||
import com.zbkj.crmeb.user.request.UserLevelSearchRequest;
|
import com.zbkj.crmeb.user.request.UserLevelSearchRequest;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import com.zbkj.crmeb.user.service.UserLevelService;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import io.swagger.annotations.Api;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
import com.zbkj.crmeb.user.service.UserLevelService;
|
|
||||||
import com.zbkj.crmeb.user.model.UserLevel;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,46 +41,6 @@ public class UserLevelController {
|
|||||||
CommonPage<UserLevel> userLevelCommonPage = CommonPage.restPage(userLevelService.getList(request, pageParamRequest));
|
CommonPage<UserLevel> userLevelCommonPage = CommonPage.restPage(userLevelService.getList(request, pageParamRequest));
|
||||||
return CommonResult.success(userLevelCommonPage);
|
return CommonResult.success(userLevelCommonPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改用户会员等级
|
|
||||||
* @param userId integer id
|
|
||||||
* @param levelId integer 等级
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-29
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "修改")
|
|
||||||
@RequestMapping(value = "/level", method = RequestMethod.POST)
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name="userId", value="会员ID", dataType = "Integer", required = true),
|
|
||||||
@ApiImplicitParam(name="levelId", value="等级ID", dataType = "Integer", required = true)
|
|
||||||
})
|
|
||||||
public CommonResult<String> level(@RequestParam Integer userId, @RequestParam int levelId){
|
|
||||||
if(userLevelService.level(userId, levelId)){
|
|
||||||
return CommonResult.success();
|
|
||||||
}else{
|
|
||||||
return CommonResult.failed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除会员等级
|
|
||||||
* @param userId integer id
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-29
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "清除会员等级")
|
|
||||||
@RequestMapping(value = "/clean", method = RequestMethod.POST)
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name="userId", value="会员ID", dataType = "Integer", required = true),
|
|
||||||
})
|
|
||||||
public CommonResult<String> clean(@RequestParam Integer userId){
|
|
||||||
if(userLevelService.clean(userId)){
|
|
||||||
return CommonResult.success();
|
|
||||||
}else{
|
|
||||||
return CommonResult.failed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.dao;
|
|
||||||
|
|
||||||
import com.zbkj.crmeb.user.model.UserNotice;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户通知表 Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
public interface UserNoticeDao extends BaseMapper<UserNotice> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.dao;
|
|
||||||
|
|
||||||
import com.zbkj.crmeb.user.model.UserTaskFinish;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户任务完成记录表 Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
public interface UserTaskFinishDao extends BaseMapper<UserTaskFinish> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.model;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户通知表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("eb_user_notice")
|
|
||||||
@ApiModel(value="UserNotice对象", description="用户通知表")
|
|
||||||
public class UserNotice implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "接收消息的用户id(类型:json数据)")
|
|
||||||
private String uid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "消息通知类型(1:系统消息;2:用户通知)")
|
|
||||||
private Boolean type;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "发送人")
|
|
||||||
private String user;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息的标题信息")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息的内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息发送的时间")
|
|
||||||
private Integer addTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否发送(0:未发送;1:已发送)")
|
|
||||||
private Boolean isSend;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "发送时间")
|
|
||||||
private Integer sendTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.model;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import java.util.Date;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户任务完成记录表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("eb_user_task_finish")
|
|
||||||
@ApiModel(value="UserTaskFinish对象", description="用户任务完成记录表")
|
|
||||||
public class UserTaskFinish implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
public UserTaskFinish(){}
|
|
||||||
public UserTaskFinish(Integer taskId, Integer uid, Boolean status) {
|
|
||||||
this.taskId = taskId;
|
|
||||||
this.uid = uid;
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "任务id")
|
|
||||||
private Integer taskId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户id")
|
|
||||||
private Integer uid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否有效")
|
|
||||||
private Boolean status;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "添加时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "更新时间")
|
|
||||||
private Date updateTime;
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.request;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户通知表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("eb_user_notice")
|
|
||||||
@ApiModel(value="UserNotice对象", description="用户通知表")
|
|
||||||
public class UserNoticeRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "接收消息的用户id(类型:json数据)")
|
|
||||||
private String uid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "消息通知类型(1:系统消息;2:用户通知)")
|
|
||||||
private Boolean type;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "发送人")
|
|
||||||
private String user;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息的标题信息")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息的内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息发送的时间")
|
|
||||||
private Integer addTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否发送(0:未发送;1:已发送)")
|
|
||||||
private Boolean isSend;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "发送时间")
|
|
||||||
private Integer sendTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.request;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户通知表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("eb_user_notice")
|
|
||||||
@ApiModel(value="UserNotice对象", description="用户通知表")
|
|
||||||
public class UserNoticeSearchRequest implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.AUTO)
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "接收消息的用户id(类型:json数据)")
|
|
||||||
private String uid;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "消息通知类型(1:系统消息;2:用户通知)")
|
|
||||||
private Boolean type;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "发送人")
|
|
||||||
private String user;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息的标题信息")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息的内容")
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通知消息发送的时间")
|
|
||||||
private Integer addTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否发送(0:未发送;1:已发送)")
|
|
||||||
private Boolean isSend;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "发送时间")
|
|
||||||
private Integer sendTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -18,7 +18,6 @@ public interface UserLevelService extends IService<UserLevel> {
|
|||||||
|
|
||||||
boolean level(Integer userId, int levelId);
|
boolean level(Integer userId, int levelId);
|
||||||
|
|
||||||
boolean clean(Integer userId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户id获取用户等级
|
* 根据用户id获取用户等级
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.service;
|
|
||||||
|
|
||||||
import com.common.PageParamRequest;
|
|
||||||
import com.zbkj.crmeb.user.model.UserNotice;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.zbkj.crmeb.user.request.UserNoticeSearchRequest;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @Description UserNoticeService 接口
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
public interface UserNoticeService extends IService<UserNotice> {
|
|
||||||
|
|
||||||
List<UserNotice> getList(UserNoticeSearchRequest request, PageParamRequest pageParamRequest);
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.service;
|
|
||||||
|
|
||||||
import com.common.PageParamRequest;
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserTask;
|
|
||||||
import com.zbkj.crmeb.user.model.UserTaskFinish;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @Description UserTaskFinishService 接口
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
public interface UserTaskFinishService extends IService<UserTaskFinish> {
|
|
||||||
boolean saveByTaskList(Integer userId, List<SystemUserTask> systemUserTasks);
|
|
||||||
|
|
||||||
boolean deleteByUser(Integer userId);
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,6 @@ import com.github.pagehelper.PageHelper;
|
|||||||
import com.utils.DateUtil;
|
import com.utils.DateUtil;
|
||||||
import com.zbkj.crmeb.system.model.SystemUserLevel;
|
import com.zbkj.crmeb.system.model.SystemUserLevel;
|
||||||
import com.zbkj.crmeb.system.service.SystemUserLevelService;
|
import com.zbkj.crmeb.system.service.SystemUserLevelService;
|
||||||
import com.zbkj.crmeb.system.service.SystemUserTaskService;
|
|
||||||
import com.zbkj.crmeb.user.model.User;
|
import com.zbkj.crmeb.user.model.User;
|
||||||
import com.zbkj.crmeb.user.model.UserLevel;
|
import com.zbkj.crmeb.user.model.UserLevel;
|
||||||
import com.zbkj.crmeb.user.dao.UserLevelDao;
|
import com.zbkj.crmeb.user.dao.UserLevelDao;
|
||||||
@@ -17,7 +16,6 @@ import com.zbkj.crmeb.user.request.UserLevelSearchRequest;
|
|||||||
import com.zbkj.crmeb.user.service.UserLevelService;
|
import com.zbkj.crmeb.user.service.UserLevelService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.zbkj.crmeb.user.service.UserService;
|
import com.zbkj.crmeb.user.service.UserService;
|
||||||
import com.zbkj.crmeb.user.service.UserTaskFinishService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -42,11 +40,6 @@ public class UserLevelServiceImpl extends ServiceImpl<UserLevelDao, UserLevel> i
|
|||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SystemUserTaskService systemUserTaskService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserTaskFinishService userTaskFinishService;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
@@ -99,50 +92,12 @@ public class UserLevelServiceImpl extends ServiceImpl<UserLevelDao, UserLevel> i
|
|||||||
updateById(userLevel);
|
updateById(userLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//提取等级任务并记录完成情况
|
|
||||||
systemUserTaskService.complete(userId, levelId);
|
|
||||||
|
|
||||||
//更新会员等级
|
//更新会员等级
|
||||||
user.setLevel(systemUserLevel.getGrade());
|
user.setLevel(systemUserLevel.getGrade());
|
||||||
userService.updateById(user);
|
userService.updateById(user);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除会员等级
|
|
||||||
* @param userId integer id
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-29
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean clean(Integer userId) {
|
|
||||||
//删除当前会员信息
|
|
||||||
deleteByUserId(userId);
|
|
||||||
//删除任务
|
|
||||||
userTaskFinishService.deleteByUser(userId);
|
|
||||||
//更新user表
|
|
||||||
return userService.cleanLevel(userId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清除userLevel
|
|
||||||
* @param userId integer id
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-29
|
|
||||||
*/
|
|
||||||
private void deleteByUserId(Integer userId) {
|
|
||||||
//删除当前会员信息
|
|
||||||
UserLevel userLevel = new UserLevel();
|
|
||||||
userLevel.setIsDel(true);
|
|
||||||
|
|
||||||
LambdaQueryWrapper<UserLevel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.eq(UserLevel::getUid, userId);
|
|
||||||
update(userLevel, lambdaQueryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取会员的等级信息,并且验证
|
* 获取会员的等级信息,并且验证
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.service.impl;
|
|
||||||
|
|
||||||
import com.common.PageParamRequest;
|
|
||||||
import com.github.pagehelper.PageHelper;
|
|
||||||
import com.utils.CrmebUtil;
|
|
||||||
|
|
||||||
import com.zbkj.crmeb.user.model.UserNotice;
|
|
||||||
import com.zbkj.crmeb.user.dao.UserNoticeDao;
|
|
||||||
import com.zbkj.crmeb.user.request.UserNoticeSearchRequest;
|
|
||||||
import com.zbkj.crmeb.user.service.UserNoticeService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @Description UserNoticeServiceImpl 接口实现
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class UserNoticeServiceImpl extends ServiceImpl<UserNoticeDao, UserNotice> implements UserNoticeService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UserNoticeDao dao;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
* @param request 请求参数
|
|
||||||
* @param pageParamRequest 分页类参数
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
* @return List<UserNotice>
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<UserNotice> getList(UserNoticeSearchRequest request, PageParamRequest pageParamRequest) {
|
|
||||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
|
||||||
return dao.selectList(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -320,7 +320,93 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
|||||||
@Override
|
@Override
|
||||||
public boolean updateBase(User user) {
|
public boolean updateBase(User user) {
|
||||||
LambdaUpdateWrapper<User> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<User> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.setEntity(user);
|
// lambdaUpdateWrapper.setEntity(user);
|
||||||
|
if(null == user.getUid()) return false;
|
||||||
|
lambdaUpdateWrapper.eq(User::getUid,user.getUid());
|
||||||
|
if(StringUtils.isNotBlank(user.getNickname())){
|
||||||
|
lambdaUpdateWrapper.set(User::getNickname, user.getNickname());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getAccount())){
|
||||||
|
lambdaUpdateWrapper.set(User::getAccount, user.getAccount());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getPwd())){
|
||||||
|
lambdaUpdateWrapper.set(User::getPwd, user.getPwd());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getRealName())){
|
||||||
|
lambdaUpdateWrapper.set(User::getRealName, user.getRealName());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getBirthday())){
|
||||||
|
lambdaUpdateWrapper.set(User::getBirthday, user.getBirthday());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getCardId())){
|
||||||
|
lambdaUpdateWrapper.set(User::getCardId, user.getCardId());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getMark())){
|
||||||
|
lambdaUpdateWrapper.set(User::getMark, user.getMark());
|
||||||
|
}
|
||||||
|
if(null != user.getPartnerId()){
|
||||||
|
lambdaUpdateWrapper.set(User::getPartnerId, user.getPartnerId());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getGroupId())){
|
||||||
|
lambdaUpdateWrapper.set(User::getGroupId, user.getGroupId());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getTagId())){
|
||||||
|
lambdaUpdateWrapper.set(User::getTagId, user.getTagId());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getAvatar())){
|
||||||
|
lambdaUpdateWrapper.set(User::getAvatar, user.getAvatar());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getPhone())){
|
||||||
|
lambdaUpdateWrapper.set(User::getPhone, user.getPhone());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getAddIp())){
|
||||||
|
lambdaUpdateWrapper.set(User::getAddIp, user.getAddIp());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getLastIp())){
|
||||||
|
lambdaUpdateWrapper.set(User::getLastIp, user.getLastIp());
|
||||||
|
}
|
||||||
|
if(null != user.getNowMoney() && user.getNowMoney().compareTo(BigDecimal.ZERO) > 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getNowMoney, user.getNowMoney());
|
||||||
|
}
|
||||||
|
if(null != user.getBrokeragePrice() && user.getBrokeragePrice().compareTo(BigDecimal.ZERO) > 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getBrokeragePrice, user.getBrokeragePrice());
|
||||||
|
}
|
||||||
|
if(null != user.getIntegral() && user.getIntegral().compareTo(BigDecimal.ZERO) >= 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getIntegral, user.getIntegral());
|
||||||
|
}
|
||||||
|
if(null != user.getExperience() && user.getExperience() > 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getExperience, user.getExperience());
|
||||||
|
}
|
||||||
|
if(null != user.getSignNum() && user.getSignNum() > 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getSignNum, user.getSignNum());
|
||||||
|
}
|
||||||
|
if(null != user.getStatus()){
|
||||||
|
lambdaUpdateWrapper.set(User::getStatus, user.getStatus());
|
||||||
|
}
|
||||||
|
if(null != user.getLevel() && user.getLevel() > 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getLevel, user.getLevel());
|
||||||
|
}
|
||||||
|
if(null != user.getSpreadUid() && user.getSpreadUid() > 0){
|
||||||
|
lambdaUpdateWrapper.set(User::getSpreadUid, user.getSpreadUid());
|
||||||
|
}
|
||||||
|
if(null != user.getSpreadTime()){
|
||||||
|
lambdaUpdateWrapper.set(User::getSpreadTime, user.getSpreadTime());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getUserType())){
|
||||||
|
lambdaUpdateWrapper.set(User::getUserType, user.getUserType());
|
||||||
|
}
|
||||||
|
if(null != user.getIsPromoter()){
|
||||||
|
lambdaUpdateWrapper.set(User::getIsPromoter, user.getIsPromoter());
|
||||||
|
}
|
||||||
|
if(null != user.getPayCount()){
|
||||||
|
lambdaUpdateWrapper.set(User::getPayCount, user.getPayCount());
|
||||||
|
}
|
||||||
|
if(null != user.getSpreadCount()){
|
||||||
|
lambdaUpdateWrapper.set(User::getSpreadCount, user.getSpreadCount());
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(user.getAddres())){
|
||||||
|
lambdaUpdateWrapper.set(User::getAddres, user.getAddres());
|
||||||
|
}
|
||||||
return update(lambdaUpdateWrapper);
|
return update(lambdaUpdateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,8 +784,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
|||||||
@Override
|
@Override
|
||||||
public UserCenterResponse getUserCenter() {
|
public UserCenterResponse getUserCenter() {
|
||||||
UserCenterResponse userCenterResponse = new UserCenterResponse();
|
UserCenterResponse userCenterResponse = new UserCenterResponse();
|
||||||
BeanUtils.copyProperties(getInfo(), userCenterResponse);
|
|
||||||
User currentUser = getInfo();
|
User currentUser = getInfo();
|
||||||
|
BeanUtils.copyProperties(currentUser, userCenterResponse);
|
||||||
|
userCenterResponse.setIntegral(currentUser.getIntegral().intValue());
|
||||||
UserCenterOrderStatusNumResponse userCenterOrderStatusNumResponse = new UserCenterOrderStatusNumResponse();
|
UserCenterOrderStatusNumResponse userCenterOrderStatusNumResponse = new UserCenterOrderStatusNumResponse();
|
||||||
userCenterOrderStatusNumResponse.setNoBuy(0);
|
userCenterOrderStatusNumResponse.setNoBuy(0);
|
||||||
userCenterOrderStatusNumResponse.setNoPink(0);
|
userCenterOrderStatusNumResponse.setNoPink(0);
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
package com.zbkj.crmeb.user.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
|
|
||||||
import com.zbkj.crmeb.system.model.SystemUserTask;
|
|
||||||
import com.zbkj.crmeb.user.model.UserTaskFinish;
|
|
||||||
import com.zbkj.crmeb.user.dao.UserTaskFinishDao;
|
|
||||||
import com.zbkj.crmeb.user.service.UserTaskFinishService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @Description UserTaskFinishServiceImpl 接口实现
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class UserTaskFinishServiceImpl extends ServiceImpl<UserTaskFinishDao, UserTaskFinish> implements UserTaskFinishService {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private UserTaskFinishDao dao;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量完成任务
|
|
||||||
* @param userId 用户id
|
|
||||||
* @param list 任务列表
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean saveByTaskList(Integer userId, List<SystemUserTask> list) {
|
|
||||||
ArrayList<UserTaskFinish> userTaskFinishes = new ArrayList<>();
|
|
||||||
for (SystemUserTask systemUserTasks: list) {
|
|
||||||
if(!checkTaskIsFinished(userId, systemUserTasks.getId())){
|
|
||||||
//如果没有完成任务,则新加一条数据
|
|
||||||
userTaskFinishes.add(new UserTaskFinish(systemUserTasks.getId(), userId, true));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(userTaskFinishes.size() > 0){
|
|
||||||
return saveBatch(userTaskFinishes);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除任务
|
|
||||||
* @param userId 用户id
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-29
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean deleteByUser(Integer userId) {
|
|
||||||
LambdaQueryWrapper<UserTaskFinish> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.eq(UserTaskFinish::getUid, userId);
|
|
||||||
return remove(lambdaQueryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测任务是否已完成
|
|
||||||
* @param userId 用户id
|
|
||||||
* @param taskId 等级id
|
|
||||||
* @author Mr.Zhang
|
|
||||||
* @since 2020-04-28
|
|
||||||
*/
|
|
||||||
private boolean checkTaskIsFinished(Integer userId, Integer taskId) {
|
|
||||||
LambdaQueryWrapper<UserTaskFinish> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
lambdaQueryWrapper.eq(UserTaskFinish::getUid, userId);
|
|
||||||
lambdaQueryWrapper.eq(UserTaskFinish::getTaskId, taskId);
|
|
||||||
UserTaskFinish userTaskFinish = getOne(lambdaQueryWrapper);
|
|
||||||
if(userTaskFinish == null){
|
|
||||||
//如果没有找到,那么说明没有完成
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!userTaskFinish.getStatus()){
|
|
||||||
//status == false 更新当前ID的status
|
|
||||||
userTaskFinish.setStatus(true);
|
|
||||||
updateById(userTaskFinish);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreBargainDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreBargainUserHelpDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreBargainUserDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreCategoryDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreCombinationDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StorePinkDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreServiceLogDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.store.dao.StoreServiceDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.system.dao.SystemConfigTabDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.system.dao.SystemFileDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.system.dao.SystemLogDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.system.dao.SystemNoticeAdminDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.system.dao.SystemNoticeDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.system.dao.SystemUserTaskDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.user.dao.UserNoticeDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.zbkj.crmeb.user.dao.UserTaskFinishDao">
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user