parent
2c6d3e6942
commit
a994688726
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.xjs.mall;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||||
|
import com.xjs.mall.other.R;
|
||||||
|
import com.xjs.mall.to.SkuReductionTo;
|
||||||
|
import com.xjs.mall.to.SpuBoundTo;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 远程调用优惠服务接口feign
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-03-20
|
||||||
|
*/
|
||||||
|
@FeignClient(contextId = "remoteCouponFeign",
|
||||||
|
value = ServiceNameConstants.MALL_COUPON_SERVICE)
|
||||||
|
public interface RemoteCouponFeign {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存spu优惠信息接口
|
||||||
|
*/
|
||||||
|
@PostMapping("/coupon/spubounds/save")
|
||||||
|
R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存满减、会员价信息接口
|
||||||
|
* @param skuReductionTo 满减信息
|
||||||
|
* @return R
|
||||||
|
*/
|
||||||
|
@PostMapping("/coupon/skufullreduction/saveinfo")
|
||||||
|
R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
|
||||||
|
}
|
||||||
|
|
@ -6,9 +6,9 @@
|
||||||
* 版权所有,侵权必究!
|
* 版权所有,侵权必究!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.xjs.utils;
|
package com.xjs.mall.other;
|
||||||
|
|
||||||
import org.apache.http.HttpStatus;
|
import com.ruoyi.common.core.constant.HttpStatus;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -27,11 +27,11 @@ public class R extends HashMap<String, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static R error() {
|
public static R error() {
|
||||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员");
|
return error(HttpStatus.ERROR, "未知异常,请联系管理员");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static R error(String msg) {
|
public static R error(String msg) {
|
||||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
|
return error(HttpStatus.ERROR, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static R error(int code, String msg) {
|
public static R error(int code, String msg) {
|
||||||
|
|
@ -1,21 +1,26 @@
|
||||||
|
|
||||||
package com.xjs.to;
|
package com.xjs.mall.to;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auto-generated: 2019-11-26 10:50:34
|
* 会员价vo
|
||||||
*
|
* @author xiejs
|
||||||
* @author bejson.com (i@bejson.com)
|
* @since 2022-03-20 13:51:55
|
||||||
* @website http://www.bejson.com/java2pojo/
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class MemberPrice {
|
public class MemberPrice {
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 会员名称
|
||||||
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
|
/**
|
||||||
|
* 会员价格
|
||||||
|
*/
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.xjs.to;
|
package com.xjs.mall.to;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -9,10 +9,22 @@ import java.util.List;
|
||||||
public class SkuReductionTo {
|
public class SkuReductionTo {
|
||||||
|
|
||||||
private Long skuId;
|
private Long skuId;
|
||||||
|
/**
|
||||||
|
* 满多少件打折
|
||||||
|
*/
|
||||||
private int fullCount;
|
private int fullCount;
|
||||||
|
/**
|
||||||
|
* 折扣
|
||||||
|
*/
|
||||||
private BigDecimal discount;
|
private BigDecimal discount;
|
||||||
private int countStatus;
|
private int countStatus;
|
||||||
|
/**
|
||||||
|
* 满多少钱减
|
||||||
|
*/
|
||||||
private BigDecimal fullPrice;
|
private BigDecimal fullPrice;
|
||||||
|
/**
|
||||||
|
* 减多少
|
||||||
|
*/
|
||||||
private BigDecimal reducePrice;
|
private BigDecimal reducePrice;
|
||||||
private int priceStatus;
|
private int priceStatus;
|
||||||
private List<MemberPrice> memberPrice;
|
private List<MemberPrice> memberPrice;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package com.xjs.to;
|
package com.xjs.mall.to;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -5,8 +5,7 @@ package com.ruoyi.common.core.constant;
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
public class ServiceNameConstants
|
public class ServiceNameConstants {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 认证服务的serviceid
|
* 认证服务的serviceid
|
||||||
*/
|
*/
|
||||||
|
|
@ -25,27 +24,28 @@ public class ServiceNameConstants
|
||||||
/**
|
/**
|
||||||
* 第三方api业务服务的serviceid
|
* 第三方api业务服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String BUSINESS_OPENAPI_SERVICE= "xjs-openapi" ;
|
public static final String BUSINESS_OPENAPI_SERVICE = "xjs-openapi";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 预警服务的serviceid
|
* 预警服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String BUSINESS_WARNING_SERVICE= "xjs-warning" ;
|
public static final String BUSINESS_WARNING_SERVICE = "xjs-warning";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志服务的serviceid
|
* 日志服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String BUSINESS_LOG_SERVICE= "xjs-log" ;
|
public static final String BUSINESS_LOG_SERVICE = "xjs-log";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 爬虫服务的serviceid
|
* 爬虫服务的serviceid
|
||||||
*/
|
*/
|
||||||
public static final String BUSINESS_WEBMAGIC_SERVICE= "xjs-webmagic" ;
|
public static final String BUSINESS_WEBMAGIC_SERVICE = "xjs-webmagic";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠服务的serviceid
|
||||||
|
*/
|
||||||
|
public static final String MALL_COUPON_SERVICE = "xjs-mall-coupon";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
"js-cookie": "3.0.1",
|
"js-cookie": "3.0.1",
|
||||||
"jsencrypt": "3.2.1",
|
"jsencrypt": "3.2.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
|
"pubsub-js": "^1.9.4",
|
||||||
"quill": "1.3.7",
|
"quill": "1.3.7",
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
"sortablejs": "1.10.2",
|
"sortablejs": "1.10.2",
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,14 @@ export function addRelation(ids) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据分类id获取分类属性
|
||||||
|
export function getAttrGroupWithAttrs(catelogId) {
|
||||||
|
return request({
|
||||||
|
url: `/mall-product/product/attrgroup/${catelogId}/withattr`,
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,5 +44,14 @@ export function delBrand(ids) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 根据分类id找到品牌
|
||||||
|
export function catelogList(catId) {
|
||||||
|
return request({
|
||||||
|
url: '/mall-product/product/categorybrandrelation/brands/list',
|
||||||
|
method: 'get',
|
||||||
|
params:catId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 保存spu关联的所有信息
|
||||||
|
export function saveSpuInfo(data) {
|
||||||
|
return request({
|
||||||
|
url: '/mall-product/product/spuinfo/save',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -9,7 +9,9 @@
|
||||||
:on-remove="handleRemove"
|
:on-remove="handleRemove"
|
||||||
:on-success="handleUploadSuccess"
|
:on-success="handleUploadSuccess"
|
||||||
:on-preview="handlePreview"
|
:on-preview="handlePreview"
|
||||||
|
:before-remove="removeImg"
|
||||||
:limit="maxCount"
|
:limit="maxCount"
|
||||||
|
accept="image/*"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
>
|
>
|
||||||
<i class="el-icon-plus"></i>
|
<i class="el-icon-plus"></i>
|
||||||
|
|
@ -20,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { policy } from "./policy";
|
import {policy, removeImg} from "@/api/common";
|
||||||
import { getUUID } from '@/utils'
|
import { getUUID } from '@/utils'
|
||||||
export default {
|
export default {
|
||||||
name: "multiUpload",
|
name: "multiUpload",
|
||||||
|
|
@ -74,26 +76,43 @@ export default {
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = true;
|
||||||
this.dialogImageUrl = file.url;
|
this.dialogImageUrl = file.url;
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
let _self = this;
|
let _self = this;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
policy()
|
let isRightSize = file.size / 1024 / 1024 < 10
|
||||||
.then(response => {
|
if (!isRightSize) {
|
||||||
console.log("这是什么${filename}");
|
this.$message.error('文件大小超过 10MB')
|
||||||
_self.dataObj.policy = response.data.policy;
|
}
|
||||||
_self.dataObj.signature = response.data.signature;
|
let isAccept = new RegExp('image/*').test(file.type)
|
||||||
_self.dataObj.ossaccessKeyId = response.data.accessid;
|
if (!isAccept) {
|
||||||
_self.dataObj.key = response.data.dir + "/"+getUUID()+"_${filename}";
|
this.$message.error('应该选择image/*类型的文件')
|
||||||
_self.dataObj.dir = response.data.dir;
|
}
|
||||||
_self.dataObj.host = response.data.host;
|
|
||||||
resolve(true);
|
if (isRightSize && isAccept) {
|
||||||
})
|
policy()
|
||||||
.catch(err => {
|
.then(response => {
|
||||||
console.log("出错了...",err)
|
_self.dataObj.policy = response.data.policy;
|
||||||
reject(false);
|
_self.dataObj.signature = response.data.signature;
|
||||||
});
|
_self.dataObj.ossaccessKeyId = response.data.accessid;
|
||||||
|
_self.dataObj.key = response.data.dir + "/"+getUUID()+"_${filename}";
|
||||||
|
_self.dataObj.dir = response.data.dir;
|
||||||
|
_self.dataObj.host = response.data.host;
|
||||||
|
resolve(true);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log("出错了...",err)
|
||||||
|
reject(false);
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
reject(false);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handleUploadSuccess(res, file) {
|
handleUploadSuccess(res, file) {
|
||||||
this.fileList.push({
|
this.fileList.push({
|
||||||
name: file.name,
|
name: file.name,
|
||||||
|
|
@ -108,7 +127,17 @@ export default {
|
||||||
type: "warning",
|
type: "warning",
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
|
|
||||||
|
//删除图片
|
||||||
|
removeImg(file,fileList) {
|
||||||
|
if (file.url) {
|
||||||
|
let pictureUrl = {"url": file.url};
|
||||||
|
removeImg(pictureUrl).then(res => {
|
||||||
|
})
|
||||||
|
this.emitInput('');
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ import DictTag from '@/components/DictTag'
|
||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
// 字典数据组件
|
// 字典数据组件
|
||||||
import DictData from '@/components/DictData'
|
import DictData from '@/components/DictData'
|
||||||
|
// 消息发布订阅组件
|
||||||
|
import PubSub from 'pubsub-js'
|
||||||
|
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
|
|
@ -48,6 +50,7 @@ Vue.prototype.selectDictLabel = selectDictLabel
|
||||||
Vue.prototype.selectDictLabels = selectDictLabels
|
Vue.prototype.selectDictLabels = selectDictLabels
|
||||||
Vue.prototype.download = download
|
Vue.prototype.download = download
|
||||||
Vue.prototype.handleTree = handleTree
|
Vue.prototype.handleTree = handleTree
|
||||||
|
Vue.prototype.PubSub = PubSub //组件发布订阅消息
|
||||||
|
|
||||||
// 全局组件挂载
|
// 全局组件挂载
|
||||||
Vue.component('DictTag', DictTag)
|
Vue.component('DictTag', DictTag)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-select placeholder="请选择" v-model="brandId" filterable clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="item in brands"
|
||||||
|
:key="item.brandId"
|
||||||
|
:label="item.brandName"
|
||||||
|
:value="item.brandId"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import {catelogList} from "@/api/mall/product/brand";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
//这里存放数据
|
||||||
|
return {
|
||||||
|
catId: 0,
|
||||||
|
brands: [
|
||||||
|
{
|
||||||
|
label: "a",
|
||||||
|
value: 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
brandId: "",
|
||||||
|
subscribe: null
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
//监控data中的数据变化
|
||||||
|
watch: {
|
||||||
|
brandId(val) {
|
||||||
|
this.PubSub.publish("brandId", val);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//方法集合
|
||||||
|
methods: {
|
||||||
|
getCatBrands() {
|
||||||
|
let catId = {
|
||||||
|
brand: this.catId
|
||||||
|
}
|
||||||
|
catelogList(catId).then(res => {
|
||||||
|
this.brands = res.data;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
//监听三级分类消息的变化
|
||||||
|
this.subscribe = PubSub.subscribe("catPath", (msg, val) => {
|
||||||
|
this.catId = val[val.length - 1];
|
||||||
|
this.getCatBrands();
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
PubSub.unsubscribe(this.subscribe); //销毁订阅
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<!--
|
<!--
|
||||||
使用说明:
|
使用说明:
|
||||||
1)、引入category-cascader.vue
|
1)、引入category-cascader.vue
|
||||||
2)、语法:<category-cascader :catelogPath.sync="catelogPath"></category-cascader>
|
2)、语法:<category-cascader :catelogPath.sync="catelogPath"></category-cascader>
|
||||||
解释:
|
解释:
|
||||||
catelogPath:指定的值是cascader初始化需要显示的值,应该和父组件的catelogPath绑定;
|
catelogPath:指定的值是cascader初始化需要显示的值,应该和父组件的catelogPath绑定;
|
||||||
由于有sync修饰符,所以cascader路径变化以后自动会修改父的catelogPath,这是结合子组件this.$emit("update:catelogPath",v);做的
|
由于有sync修饰符,所以cascader路径变化以后自动会修改父的catelogPath,这是结合子组件this.$emit("update:catelogPath",v);做的
|
||||||
-->
|
-->
|
||||||
<div>
|
<div>
|
||||||
<el-cascader
|
<el-cascader
|
||||||
filterable
|
filterable
|
||||||
|
|
@ -28,7 +28,7 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
catelogPath: {
|
catelogPath: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default(){
|
default() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -45,25 +45,29 @@ export default {
|
||||||
paths: this.catelogPath
|
paths: this.catelogPath
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
watch:{
|
watch: {
|
||||||
catelogPath(v){
|
catelogPath(v) {
|
||||||
this.paths = this.catelogPath;
|
this.paths = this.catelogPath;
|
||||||
},
|
},
|
||||||
paths(v){
|
paths(v) {
|
||||||
this.$emit("update:catelogPath",v);
|
this.$emit("update:catelogPath", v);
|
||||||
|
this.PubSub.publish("catPath", v);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//方法集合
|
//方法集合
|
||||||
methods: {
|
methods: {
|
||||||
getCategorys() {
|
getCategorys() {
|
||||||
getMenus().then(res =>{
|
getMenus().then(res => {
|
||||||
this.categorys =res.page
|
this.categorys = res.page
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.getCategorys();
|
this.getCategorys();
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form :inline="true" :model="dataForm">
|
||||||
|
<el-form-item label="分类">
|
||||||
|
<category-cascader :catelogPath.sync="catelogPath"></category-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="品牌">
|
||||||
|
<brand-select style="width:160px"></brand-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态">
|
||||||
|
<el-select style="width:160px" v-model="dataForm.status" clearable>
|
||||||
|
<el-option label="新建" :value="0"></el-option>
|
||||||
|
<el-option label="上架" :value="1"></el-option>
|
||||||
|
<el-option label="下架" :value="2"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="检索">
|
||||||
|
<el-input style="width:160px" v-model="dataForm.key" clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="searchSpuInfo">查询</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<spuinfo :catId="catId"></spuinfo>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CategoryCascader from '../../../components/mall/category-cascader'
|
||||||
|
import BrandSelect from "../../../components/mall/brand-select";
|
||||||
|
import Spuinfo from "./spuinfo";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
//import引入的组件需要注入到对象中才能使用
|
||||||
|
components: {CategoryCascader, Spuinfo, BrandSelect},
|
||||||
|
props: {},
|
||||||
|
name: "SpuList",
|
||||||
|
data() {
|
||||||
|
//这里存放数据
|
||||||
|
return {
|
||||||
|
catId: 0,
|
||||||
|
catelogPath: [],
|
||||||
|
dataForm: {
|
||||||
|
status: "",
|
||||||
|
key: "",
|
||||||
|
brandId: 0,
|
||||||
|
catelogId: 0
|
||||||
|
},
|
||||||
|
catPathSub: null,
|
||||||
|
brandIdSub: null
|
||||||
|
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
//监控data中的数据变化
|
||||||
|
watch: {},
|
||||||
|
//方法集合
|
||||||
|
methods: {
|
||||||
|
searchSpuInfo() {
|
||||||
|
console.log("搜索条件", this.dataForm);
|
||||||
|
this.PubSub.publish("dataForm", this.dataForm);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.catPathSub = PubSub.subscribe("catPath", (msg, val) => {
|
||||||
|
this.dataForm.catelogId = val[val.length - 1];
|
||||||
|
});
|
||||||
|
this.brandIdSub = PubSub.subscribe("brandId", (msg, val) => {
|
||||||
|
this.dataForm.brandId = val;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
PubSub.unsubscribe(this.catPathSub);
|
||||||
|
PubSub.unsubscribe(this.brandIdSub);
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,799 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-steps :active="step" finish-status="success">
|
||||||
|
<el-step title="基本信息"></el-step>
|
||||||
|
<el-step title="规格参数"></el-step>
|
||||||
|
<el-step title="销售属性"></el-step>
|
||||||
|
<el-step title="SKU信息"></el-step>
|
||||||
|
<el-step title="保存完成"></el-step>
|
||||||
|
</el-steps>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="step===0">
|
||||||
|
<el-card class="box-card" style="width:80%;margin:20px auto">
|
||||||
|
<el-form ref="spuBaseForm" :model="spu" label-width="120px" :rules="spuBaseInfoRules">
|
||||||
|
<el-form-item label="商品名称" prop="spuName">
|
||||||
|
<el-input v-model="spu.spuName"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品描述" prop="spuDescription">
|
||||||
|
<el-input v-model="spu.spuDescription"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="选择分类" prop="catalogId">
|
||||||
|
<category-cascader></category-cascader>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="选择品牌" prop="brandId">
|
||||||
|
<brand-select></brand-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品重量(Kg)" prop="weight">
|
||||||
|
<el-input-number v-model.number="spu.weight" :min="0" :precision="3" :step="0.1"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="设置积分" prop="bounds">
|
||||||
|
<label>金币</label>
|
||||||
|
<el-input-number
|
||||||
|
style="width:130px"
|
||||||
|
placeholder="金币"
|
||||||
|
v-model="spu.bounds.buyBounds"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
<label style="margin-left:15px">成长值</label>
|
||||||
|
<el-input-number
|
||||||
|
style="width:130px"
|
||||||
|
placeholder="成长值"
|
||||||
|
v-model="spu.bounds.growBounds"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
>
|
||||||
|
<template slot="prepend">成长值</template>
|
||||||
|
</el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="商品介绍" prop="decript">
|
||||||
|
<multi-upload v-model="spu.decript"></multi-upload>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="商品图集" prop="images">
|
||||||
|
<multi-upload v-model="spu.images"></multi-upload>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="success" @click="collectSpuBaseInfo">下一步:设置基本参数</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="step===1">
|
||||||
|
<el-card class="box-card" style="width:80%;margin:20px auto">
|
||||||
|
<el-tabs tab-position="left" style="width:98%">
|
||||||
|
<el-tab-pane
|
||||||
|
:label="group.attrGroupName"
|
||||||
|
v-for="(group,gidx) in dataResp.attrGroups"
|
||||||
|
:key="group.attrGroupId"
|
||||||
|
>
|
||||||
|
<!-- 遍历属性,每个tab-pane对应一个表单,每个属性是一个表单项 spu.baseAttrs[0] = [{attrId:xx,val:}]-->
|
||||||
|
<el-form ref="form" :model="spu">
|
||||||
|
<el-form-item
|
||||||
|
label-width="90px"
|
||||||
|
:label="attr.attrName"
|
||||||
|
v-for="(attr,aidx) in group.attrs"
|
||||||
|
:key="attr.attrId"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="dataResp.baseAttrs[gidx][aidx].attrId"
|
||||||
|
type="hidden"
|
||||||
|
v-show="false"
|
||||||
|
></el-input>
|
||||||
|
<el-select
|
||||||
|
v-model="dataResp.baseAttrs[gidx][aidx].attrValues"
|
||||||
|
:multiple="attr.valueType === 1"
|
||||||
|
filterable
|
||||||
|
allow-create
|
||||||
|
default-first-option
|
||||||
|
placeholder="请选择或输入值"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="(val,vidx) in attr.valueSelect.split(';')"
|
||||||
|
:key="vidx"
|
||||||
|
:label="val"
|
||||||
|
:value="val"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-checkbox
|
||||||
|
style="margin-left: 20px"
|
||||||
|
v-model="dataResp.baseAttrs[gidx][aidx].showDesc"
|
||||||
|
:true-label="1"
|
||||||
|
:false-label="0"
|
||||||
|
>快速展示
|
||||||
|
</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<div style="margin-top: 20px">
|
||||||
|
<el-button type="primary" @click="step = 0">上一步</el-button>
|
||||||
|
<el-button type="success" @click="generateSaleAttrs">下一步:设置销售属性</el-button>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="step===2">
|
||||||
|
<el-card class="box-card" style="width:80%;margin:20px auto">
|
||||||
|
<el-card class="box-card">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span style="font-size: 15px;font-weight: 800">选择销售属性</span>
|
||||||
|
<el-form ref="saleform" :model="spu">
|
||||||
|
<el-form-item
|
||||||
|
label-width="90px"
|
||||||
|
:label="attr.attrName"
|
||||||
|
v-for="(attr,aidx) in dataResp.saleAttrs"
|
||||||
|
:key="attr.attrId"
|
||||||
|
>
|
||||||
|
<el-input
|
||||||
|
v-model="dataResp.tempSaleAttrs[aidx].attrId"
|
||||||
|
type="hidden"
|
||||||
|
v-show="false"
|
||||||
|
></el-input>
|
||||||
|
<el-checkbox-group v-model="dataResp.tempSaleAttrs[aidx].attrValues">
|
||||||
|
<el-checkbox
|
||||||
|
v-if="dataResp.saleAttrs[aidx].valueSelect !== ''"
|
||||||
|
:label="val"
|
||||||
|
v-for="val in dataResp.saleAttrs[aidx].valueSelect.split(';')"
|
||||||
|
:key="val"
|
||||||
|
></el-checkbox>
|
||||||
|
<div style="margin-left:20px;display:inline">
|
||||||
|
<el-button
|
||||||
|
v-show="!inputVisible[aidx].view"
|
||||||
|
class="button-new-tag"
|
||||||
|
size="mini"
|
||||||
|
@click="showInput(aidx)"
|
||||||
|
>+自定义
|
||||||
|
</el-button>
|
||||||
|
<el-input
|
||||||
|
v-show="inputVisible[aidx].view"
|
||||||
|
v-model="inputValue[aidx].val"
|
||||||
|
:ref="'saveTagInput'+aidx"
|
||||||
|
size="mini"
|
||||||
|
style="width:150px"
|
||||||
|
@keyup.enter.native="handleInputConfirm(aidx)"
|
||||||
|
@blur="handleInputConfirm(aidx)"
|
||||||
|
></el-input>
|
||||||
|
</div>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<el-button type="primary" @click="step = 1">上一步</el-button>
|
||||||
|
<el-button type="success" @click="generateSkus">下一步:设置SKU信息</el-button>
|
||||||
|
</el-card>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="step===3">
|
||||||
|
<el-card class="box-card" style="width:80%;margin:20px auto">
|
||||||
|
<el-table :data="spu.skus" style="width: 100%">
|
||||||
|
<el-table-column label="属性组合" align="center">
|
||||||
|
<el-table-column align="center"
|
||||||
|
:label="item.attrName"
|
||||||
|
v-for="(item,index) in dataResp.tableAttrColumn"
|
||||||
|
:key="item.attrId"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span style="margin-left: 10px">{{ scope.row.attr[index].attrValue }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="商品名称" prop="skuName" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.skuName"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="标题" prop="skuTitle" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.skuTitle"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="副标题" prop="skuSubtitle" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.skuSubtitle"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="价格" prop="price" align="center">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input v-model="scope.row.price"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column type="expand">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-row style="margin-top:15px;margin-left: 20px">
|
||||||
|
<el-col :span="24">
|
||||||
|
<label style="display:block;float:left">选择图集</label>
|
||||||
|
<multi-upload
|
||||||
|
style="float:left;margin-left:10px;"
|
||||||
|
:showFile="false"
|
||||||
|
:listType="'text'"
|
||||||
|
v-model="uploadImages"
|
||||||
|
></multi-upload>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-divider></el-divider>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-card
|
||||||
|
style="width:170px;float:left;margin-left:15px;margin-top:15px;"
|
||||||
|
:body-style="{ padding: '0px' }"
|
||||||
|
v-for="(img,index) in spu.images"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<img :src="img" style="width:160px;height:120px" alt=""/>
|
||||||
|
<div style="padding: 14px;">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-checkbox
|
||||||
|
v-model="scope.row.images[index].imgUrl"
|
||||||
|
:true-label="img"
|
||||||
|
false-label
|
||||||
|
></el-checkbox>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-tag v-if="scope.row.images[index].defaultImg === 1">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
checked
|
||||||
|
:name="scope.row.skuName"
|
||||||
|
@change="checkDefaultImg(scope.row,index,img)"
|
||||||
|
/>设为默认
|
||||||
|
</el-tag>
|
||||||
|
<el-tag v-else>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
:name="scope.row.skuName"
|
||||||
|
@change="checkDefaultImg(scope.row,index,img)"
|
||||||
|
/>设为默认
|
||||||
|
</el-tag>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<!-- 折扣,满减,会员价 -->
|
||||||
|
<el-form :model="scope.row" style="margin-top:35px;margin-left: 20px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="设置折扣">
|
||||||
|
<label>满</label>
|
||||||
|
<el-input-number
|
||||||
|
style="width:120px"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
v-model="scope.row.fullCount"
|
||||||
|
></el-input-number>
|
||||||
|
<label>件</label>
|
||||||
|
|
||||||
|
<label style="margin-left:15px;">打</label>
|
||||||
|
<el-input-number
|
||||||
|
style="width:120px"
|
||||||
|
v-model="scope.row.discount"
|
||||||
|
:precision="2"
|
||||||
|
:max="1"
|
||||||
|
:min="0"
|
||||||
|
:step="0.01"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
<label>折</label>
|
||||||
|
<el-checkbox
|
||||||
|
style="margin-left: 15px"
|
||||||
|
v-model="scope.row.countStatus"
|
||||||
|
:true-label="1"
|
||||||
|
:false-label="0"
|
||||||
|
>可叠加优惠
|
||||||
|
</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="设置满减">
|
||||||
|
<label>满</label>
|
||||||
|
<el-input-number
|
||||||
|
style="width:120px"
|
||||||
|
v-model="scope.row.fullPrice"
|
||||||
|
:step="100"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
<label>元</label>
|
||||||
|
<label style="margin-left:15px;">减</label>
|
||||||
|
<el-input-number
|
||||||
|
style="width:120px"
|
||||||
|
v-model="scope.row.reducePrice"
|
||||||
|
:step="10"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
<label>元</label>
|
||||||
|
<el-checkbox
|
||||||
|
style="margin-left: 15px"
|
||||||
|
v-model="scope.row.priceStatus"
|
||||||
|
:true-label="1"
|
||||||
|
:false-label="0"
|
||||||
|
>可叠加优惠
|
||||||
|
</el-checkbox>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="设置会员价" v-if="scope.row.memberPrice.length>0">
|
||||||
|
<br/>
|
||||||
|
<!-- @change="handlePriceChange(scope,mpidx,$event)" -->
|
||||||
|
<el-form-item v-for="(mp,mpidx) in scope.row.memberPrice" :key="mp.id">
|
||||||
|
{{ mp.name }}
|
||||||
|
<el-input-number
|
||||||
|
style="width:120px"
|
||||||
|
v-model="scope.row.memberPrice[mpidx].price"
|
||||||
|
:precision="2"
|
||||||
|
:min="0"
|
||||||
|
controls-position="right"
|
||||||
|
></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<el-button type="primary" @click="step = 2">上一步</el-button>
|
||||||
|
<el-button type="success" @click="submitSkus" :loading="loadingButton">下一步:保存商品信息</el-button>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" v-show="step===4">
|
||||||
|
<el-card class="box-card" style="width:80%;margin:20px auto">
|
||||||
|
<el-result icon="success" title="保存成功" subTitle="">
|
||||||
|
<template slot="extra">
|
||||||
|
</template>
|
||||||
|
</el-result>
|
||||||
|
<el-button type="primary" @click="addAgian">继续添加</el-button>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CategoryCascader from '../../../components/mall/category-cascader'
|
||||||
|
import BrandSelect from "../../../components/mall/brand-select";
|
||||||
|
import MultiUpload from "@/components/OssUpload/multiUpload";
|
||||||
|
import {getMemberLevelList} from "@/api/mall/member/level";
|
||||||
|
import {getAttrGroupWithAttrs} from "@/api/mall/product/attr-group";
|
||||||
|
import {getBaseAttrList} from "@/api/mall/product/attr";
|
||||||
|
import {saveSpuInfo} from "@/api/mall/product/spu-info";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name:"SpuAdd",
|
||||||
|
components: {CategoryCascader, BrandSelect, MultiUpload},
|
||||||
|
props: {},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
catPathSub: null,
|
||||||
|
brandIdSub: null,
|
||||||
|
uploadDialogVisible: false,
|
||||||
|
uploadImages: [],
|
||||||
|
step: 0,
|
||||||
|
|
||||||
|
loadingButton:false,
|
||||||
|
|
||||||
|
spu: {
|
||||||
|
//要提交的数据
|
||||||
|
spuName: "",
|
||||||
|
spuDescription: "",
|
||||||
|
catalogId: 0,
|
||||||
|
brandId: "",
|
||||||
|
weight: "",
|
||||||
|
publishStatus: 0,
|
||||||
|
decript: [], //商品详情
|
||||||
|
images: [], //商品图集,最后sku也可以新增
|
||||||
|
bounds: {
|
||||||
|
//积分
|
||||||
|
buyBounds: 0,
|
||||||
|
growBounds: 0
|
||||||
|
},
|
||||||
|
baseAttrs: [], //基本属性
|
||||||
|
skus: [] //所有sku信息
|
||||||
|
},
|
||||||
|
spuBaseInfoRules: {
|
||||||
|
spuName: [
|
||||||
|
{required: true, message: "请输入商品名字", trigger: "blur"}
|
||||||
|
],
|
||||||
|
spuDescription: [
|
||||||
|
{required: true, message: "请编写一个简单描述", trigger: "blur"}
|
||||||
|
],
|
||||||
|
catalogId: [
|
||||||
|
{required: true, message: "请选择一个分类", trigger: "blur"}
|
||||||
|
],
|
||||||
|
brandId: [
|
||||||
|
{required: true, message: "请选择一个品牌", trigger: "blur"}
|
||||||
|
],
|
||||||
|
decript: [
|
||||||
|
{required: true, message: "请上传商品详情图集", trigger: "blur"}
|
||||||
|
],
|
||||||
|
images: [
|
||||||
|
{required: true, message: "请上传商品图片集", trigger: "blur"}
|
||||||
|
],
|
||||||
|
weight: [
|
||||||
|
{
|
||||||
|
type: "number",
|
||||||
|
required: true,
|
||||||
|
message: "请填写正确的重量值",
|
||||||
|
trigger: "blur"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
dataResp: {
|
||||||
|
//后台返回的所有数据
|
||||||
|
attrGroups: [],
|
||||||
|
baseAttrs: [],
|
||||||
|
saleAttrs: [],
|
||||||
|
tempSaleAttrs: [],
|
||||||
|
tableAttrColumn: [],
|
||||||
|
memberLevels: [],
|
||||||
|
steped: [false, false, false, false, false]
|
||||||
|
},
|
||||||
|
inputVisible: [],
|
||||||
|
inputValue: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
//监控data中的数据变化
|
||||||
|
watch: {
|
||||||
|
uploadImages(val) {
|
||||||
|
//扩展每个skus里面的imgs选项
|
||||||
|
let imgArr = Array.from(new Set(this.spu.images.concat(val)));
|
||||||
|
|
||||||
|
//{imgUrl:"",defaultImg:0} 由于concat每次迭代上次,有很多重复。所以我们必须得到上次+这次的总长
|
||||||
|
|
||||||
|
this.spu.skus.forEach((item, index) => {
|
||||||
|
let len = imgArr.length - this.spu.skus[index].images.length; //还差这么多
|
||||||
|
if (len > 0) {
|
||||||
|
let imgs = new Array(len);
|
||||||
|
imgs = imgs.fill({imgUrl: "", defaultImg: 0});
|
||||||
|
this.spu.skus[index].images = item.images.concat(imgs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.spu.images = imgArr; //去重
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//方法集合
|
||||||
|
methods: {
|
||||||
|
addAgian() {
|
||||||
|
this.step = 0;
|
||||||
|
this.resetSpuData();
|
||||||
|
},
|
||||||
|
resetSpuData() {
|
||||||
|
this.spu = {
|
||||||
|
spuName: "",
|
||||||
|
spuDescription: "",
|
||||||
|
catalogId: 0,
|
||||||
|
brandId: "",
|
||||||
|
weight: "",
|
||||||
|
publishStatus: 0,
|
||||||
|
decript: [],
|
||||||
|
images: [],
|
||||||
|
bounds: {
|
||||||
|
buyBounds: 0,
|
||||||
|
growBounds: 0
|
||||||
|
},
|
||||||
|
baseAttrs: [],
|
||||||
|
skus: []
|
||||||
|
};
|
||||||
|
|
||||||
|
//清空子组件的值
|
||||||
|
},
|
||||||
|
|
||||||
|
handlePriceChange(scope, mpidx, e) {
|
||||||
|
this.spu.skus[scope.$index].memberPrice[mpidx].price = e;
|
||||||
|
},
|
||||||
|
|
||||||
|
//获取会员等级
|
||||||
|
getMemberLevels() {
|
||||||
|
let params = {
|
||||||
|
page: 1,
|
||||||
|
limit: 500
|
||||||
|
}
|
||||||
|
getMemberLevelList(params).then(res => {
|
||||||
|
this.dataResp.memberLevels = res.page.list;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
showInput(idx) {
|
||||||
|
console.log("``````", this.view);
|
||||||
|
this.inputVisible[idx].view = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
checkDefaultImg(row, index, img) {
|
||||||
|
console.log("默认图片", row, index);
|
||||||
|
//这个图片被选中了,
|
||||||
|
row.images[index].imgUrl = img; //默认选中
|
||||||
|
row.images[index].defaultImg = 1; //修改标志位;
|
||||||
|
//修改其他人的标志位
|
||||||
|
row.images.forEach((item, idx) => {
|
||||||
|
if (idx !== index) {
|
||||||
|
row.images[idx].defaultImg = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleInputConfirm(idx) {
|
||||||
|
let inputValue = this.inputValue[idx].val;
|
||||||
|
if (inputValue) {
|
||||||
|
// this.dynamicTags.push(inputValue);
|
||||||
|
if (this.dataResp.saleAttrs[idx].valueSelect === "") {
|
||||||
|
this.dataResp.saleAttrs[idx].valueSelect = inputValue;
|
||||||
|
} else {
|
||||||
|
this.dataResp.saleAttrs[idx].valueSelect += ";" + inputValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.inputVisible[idx].view = false;
|
||||||
|
this.inputValue[idx].val = "";
|
||||||
|
},
|
||||||
|
collectSpuBaseInfo() {
|
||||||
|
//spuBaseForm
|
||||||
|
this.$refs.spuBaseForm.validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.step = 1;
|
||||||
|
this.showBaseAttrs();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
generateSaleAttrs() {
|
||||||
|
//把页面绑定的所有attr处理到spu里面,这一步都要做
|
||||||
|
this.spu.baseAttrs = [];
|
||||||
|
this.dataResp.baseAttrs.forEach(item => {
|
||||||
|
item.forEach(attr => {
|
||||||
|
let {attrId, attrValues, showDesc} = attr;
|
||||||
|
//跳过没有录入值的属性
|
||||||
|
if (attrValues !== "") {
|
||||||
|
if (attrValues instanceof Array) {
|
||||||
|
//多个值用;隔开
|
||||||
|
attrValues = attrValues.join(";");
|
||||||
|
}
|
||||||
|
this.spu.baseAttrs.push({attrId, attrValues, showDesc});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
console.log("baseAttrs", this.spu.baseAttrs);
|
||||||
|
this.step = 2;
|
||||||
|
this.getShowSaleAttr();
|
||||||
|
},
|
||||||
|
generateSkus: function () {
|
||||||
|
this.step = 3;
|
||||||
|
|
||||||
|
//根据笛卡尔积运算进行生成sku
|
||||||
|
let selectValues = [];
|
||||||
|
this.dataResp.tableAttrColumn = [];
|
||||||
|
this.dataResp.tempSaleAttrs.forEach(item => {
|
||||||
|
if (item.attrValues.length > 0) {
|
||||||
|
selectValues.push(item.attrValues);
|
||||||
|
this.dataResp.tableAttrColumn.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let descartes = this.descartes(selectValues);
|
||||||
|
//[["黑色","6GB","移动"],["黑色","6GB","联通"],["黑色","8GB","移动"],["黑色","8GB","联通"],
|
||||||
|
//["白色","6GB","移动"],["白色","6GB","联通"],["白色","8GB","移动"],["白色","8GB","联通"],
|
||||||
|
//["蓝色","6GB","移动"],["蓝色","6GB","联通"],["蓝色","8GB","移动"],["蓝色","8GB","联通"]]
|
||||||
|
console.log("生成的组合", JSON.stringify(descartes));
|
||||||
|
//有多少descartes就有多少sku
|
||||||
|
let skus = [];
|
||||||
|
|
||||||
|
descartes.forEach((descar, descaridx) => {
|
||||||
|
let attrArray = []; //sku属性组
|
||||||
|
descar.forEach((de, index) => {
|
||||||
|
//构造saleAttr信息
|
||||||
|
let saleAttrItem = {
|
||||||
|
attrId: this.dataResp.tableAttrColumn[index].attrId,
|
||||||
|
attrName: this.dataResp.tableAttrColumn[index].attrName,
|
||||||
|
attrValue: de
|
||||||
|
};
|
||||||
|
attrArray.push(saleAttrItem);
|
||||||
|
});
|
||||||
|
//先初始化几个images,后面的上传还要加
|
||||||
|
let imgs = [];
|
||||||
|
this.spu.images.forEach((img, idx) => {
|
||||||
|
imgs.push({imgUrl: "", defaultImg: 0});
|
||||||
|
});
|
||||||
|
|
||||||
|
//会员价,也必须在循环里面生成,否则会导致数据绑定问题
|
||||||
|
let memberPrices = [];
|
||||||
|
if (this.dataResp.memberLevels.length > 0) {
|
||||||
|
for (let i = 0; i < this.dataResp.memberLevels.length; i++) {
|
||||||
|
if (this.dataResp.memberLevels[i].priviledgeMemberPrice === 1) {
|
||||||
|
memberPrices.push({
|
||||||
|
id: this.dataResp.memberLevels[i].id,
|
||||||
|
name: this.dataResp.memberLevels[i].name,
|
||||||
|
price: 0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//;descaridx,判断如果之前有就用之前的值;
|
||||||
|
let res = this.hasAndReturnSku(this.spu.skus, descar);
|
||||||
|
if (res === null) {
|
||||||
|
skus.push({
|
||||||
|
attr: attrArray,
|
||||||
|
skuName: this.spu.spuName + " " + descar.join(" "),
|
||||||
|
price: 0,
|
||||||
|
skuTitle: this.spu.spuName + " " + descar.join(" "),
|
||||||
|
skuSubtitle: "",
|
||||||
|
images: imgs,
|
||||||
|
descar: descar,
|
||||||
|
fullCount: 0,
|
||||||
|
discount: 0,
|
||||||
|
countStatus: 0,
|
||||||
|
fullPrice: 0.0,
|
||||||
|
reducePrice: 0.0,
|
||||||
|
priceStatus: 0,
|
||||||
|
memberPrice: new Array().concat(memberPrices)
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
skus.push(res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.spu.skus = skus;
|
||||||
|
console.log("结果!!!", this.spu.skus, this.dataResp.tableAttrColumn);
|
||||||
|
},
|
||||||
|
//判断如果包含之前的sku的descar组合,就返回这个sku的详细信息;
|
||||||
|
hasAndReturnSku(skus, descar) {
|
||||||
|
let res = null;
|
||||||
|
if (skus.length > 0) {
|
||||||
|
for (let i = 0; i < skus.length; i++) {
|
||||||
|
if (skus[i].descar.join(" ") === descar.join(" ")) {
|
||||||
|
res = skus[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
getShowSaleAttr() {
|
||||||
|
//获取当前分类可以使用的销售属性
|
||||||
|
if (!this.dataResp.steped[1] && this.spu.catalogId !== 0) {
|
||||||
|
let params = {
|
||||||
|
page: 1,
|
||||||
|
limit: 500
|
||||||
|
}
|
||||||
|
this.$modal.loading("请稍后...")
|
||||||
|
getBaseAttrList(params, this.spu.catalogId, "sale").then(res => {
|
||||||
|
this.dataResp.saleAttrs = res.page.list;
|
||||||
|
res.page.list.forEach(item => {
|
||||||
|
this.dataResp.tempSaleAttrs.push({
|
||||||
|
attrId: item.attrId,
|
||||||
|
attrValues: [],
|
||||||
|
attrName: item.attrName
|
||||||
|
});
|
||||||
|
this.inputVisible.push({view: false});
|
||||||
|
this.inputValue.push({val: ""});
|
||||||
|
});
|
||||||
|
this.dataResp.steped[1] = true;
|
||||||
|
this.$modal.closeLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
showBaseAttrs() {
|
||||||
|
if (!this.dataResp.steped[0]) {
|
||||||
|
this.$modal.loading("请稍后...")
|
||||||
|
getAttrGroupWithAttrs(this.spu.catalogId).then(res => {
|
||||||
|
//先对表单的baseAttrs进行初始化
|
||||||
|
res.data.forEach(item => {
|
||||||
|
let attrArray = [];
|
||||||
|
item.attrs.forEach(attr => {
|
||||||
|
attrArray.push({
|
||||||
|
attrId: attr.attrId,
|
||||||
|
attrValues: "",
|
||||||
|
showDesc: attr.showDesc
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.dataResp.baseAttrs.push(attrArray);
|
||||||
|
});
|
||||||
|
this.dataResp.steped[0] = 0;
|
||||||
|
this.dataResp.attrGroups = res.data;
|
||||||
|
this.$modal.closeLoading()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
submitSkus() {
|
||||||
|
console.log("~~~~~", JSON.stringify(this.spu));
|
||||||
|
this.$confirm("将要提交商品数据,需要一小段时间,是否继续?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.loadingButton=true
|
||||||
|
saveSpuInfo(this.spu).then(res =>{
|
||||||
|
this.step = 4;
|
||||||
|
this.$modal.notifySuccess("保存成功")
|
||||||
|
this.loadingButton=false
|
||||||
|
}).catch(err =>{
|
||||||
|
this.loadingButton=false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
//笛卡尔积运算
|
||||||
|
descartes(list) {
|
||||||
|
//parent上一级索引;count指针计数
|
||||||
|
var point = {};
|
||||||
|
var result = [];
|
||||||
|
var pIndex = null;
|
||||||
|
var tempCount = 0;
|
||||||
|
var temp = [];
|
||||||
|
|
||||||
|
//根据参数列生成指针对象
|
||||||
|
for (var index in list) {
|
||||||
|
if (typeof list[index] == "object") {
|
||||||
|
point[index] = {parent: pIndex, count: 0};
|
||||||
|
pIndex = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//单维度数据结构直接返回
|
||||||
|
if (pIndex == null) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
//动态生成笛卡尔积
|
||||||
|
while (true) {
|
||||||
|
for (var index in list) {
|
||||||
|
tempCount = point[index]["count"];
|
||||||
|
temp.push(list[index][tempCount]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//压入结果数组
|
||||||
|
result.push(temp);
|
||||||
|
temp = [];
|
||||||
|
|
||||||
|
//检查指针最大值问题
|
||||||
|
while (true) {
|
||||||
|
if (point[index]["count"] + 1 >= list[index].length) {
|
||||||
|
point[index]["count"] = 0;
|
||||||
|
pIndex = point[index]["parent"];
|
||||||
|
if (pIndex == null) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//赋值parent进行再次检查
|
||||||
|
index = pIndex;
|
||||||
|
} else {
|
||||||
|
point[index]["count"]++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
created() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
this.catPathSub = PubSub.subscribe("catPath", (msg, val) => {
|
||||||
|
this.spu.catalogId = val[val.length - 1];
|
||||||
|
});
|
||||||
|
this.brandIdSub = PubSub.subscribe("brandId", (msg, val) => {
|
||||||
|
this.spu.brandId = val;
|
||||||
|
});
|
||||||
|
this.getMemberLevels();
|
||||||
|
},
|
||||||
|
|
||||||
|
beforeDestroy() {
|
||||||
|
PubSub.unsubscribe(this.catPathSub);
|
||||||
|
PubSub.unsubscribe(this.brandIdSub);
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-table
|
||||||
|
:data="dataList"
|
||||||
|
border
|
||||||
|
v-loading="dataListLoading"
|
||||||
|
@selection-change="selectionChangeHandle"
|
||||||
|
style="width: 100%;"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
|
||||||
|
<el-table-column prop="spuName" header-align="center" align="center" label="名称"></el-table-column>
|
||||||
|
<el-table-column prop="spuDescription" header-align="center" align="center" label="描述"></el-table-column>
|
||||||
|
<el-table-column prop="catalogId" header-align="center" align="center" label="分类"></el-table-column>
|
||||||
|
<el-table-column prop="brandId" header-align="center" align="center" label="品牌"></el-table-column>
|
||||||
|
<el-table-column prop="weight" header-align="center" align="center" label="重量"></el-table-column>
|
||||||
|
<el-table-column prop="publishStatus" header-align="center" align="center" label="上架状态">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-tag v-if="scope.row.publishStatus === 0">新建</el-tag>
|
||||||
|
<el-tag v-if="scope.row.publishStatus === 1">已上架</el-tag>
|
||||||
|
<el-tag v-if="scope.row.publishStatus === 2">已下架</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="createTime" header-align="center" align="center" label="创建时间"></el-table-column>
|
||||||
|
<el-table-column prop="updateTime" header-align="center" align="center" label="修改时间"></el-table-column>
|
||||||
|
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.publishStatus === 0"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click="productUp(scope.row.id)"
|
||||||
|
>上架</el-button>
|
||||||
|
<el-button type="text" size="small" @click="attrUpdateShow(scope.row)">规格</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<el-pagination
|
||||||
|
@size-change="sizeChangeHandle"
|
||||||
|
@current-change="currentChangeHandle"
|
||||||
|
:current-page="pageIndex"
|
||||||
|
:page-sizes="[10, 20, 50, 100]"
|
||||||
|
:page-size="pageSize"
|
||||||
|
:total="totalPage"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper"
|
||||||
|
></el-pagination>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dataSub: null,
|
||||||
|
dataForm: {},
|
||||||
|
dataList: [],
|
||||||
|
pageIndex: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
totalPage: 0,
|
||||||
|
dataListLoading: false,
|
||||||
|
dataListSelections: [],
|
||||||
|
addOrUpdateVisible: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
catId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
components: {},
|
||||||
|
activated() {
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
productUp(id) {
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/product/spuinfo/" + id + "/up"),
|
||||||
|
method: "post"
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.$message({
|
||||||
|
message: "操作成功",
|
||||||
|
type: "success",
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
this.getDataList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error(data.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
attrUpdateShow(row) {
|
||||||
|
console.log(row);
|
||||||
|
this.$router.push({
|
||||||
|
path: "/product-attrupdate",
|
||||||
|
query: { spuId: row.id, catalogId: row.catalogId }
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 获取数据列表
|
||||||
|
getDataList() {
|
||||||
|
this.dataListLoading = true;
|
||||||
|
let param = {};
|
||||||
|
Object.assign(param, this.dataForm, {
|
||||||
|
page: this.pageIndex,
|
||||||
|
limit: this.pageSize
|
||||||
|
});
|
||||||
|
this.$http({
|
||||||
|
url: this.$http.adornUrl("/product/spuinfo/list"),
|
||||||
|
method: "get",
|
||||||
|
params: this.$http.adornParams(param)
|
||||||
|
}).then(({ data }) => {
|
||||||
|
if (data && data.code === 0) {
|
||||||
|
this.dataList = data.page.list;
|
||||||
|
this.totalPage = data.page.totalCount;
|
||||||
|
} else {
|
||||||
|
this.dataList = [];
|
||||||
|
this.totalPage = 0;
|
||||||
|
}
|
||||||
|
this.dataListLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 每页数
|
||||||
|
sizeChangeHandle(val) {
|
||||||
|
this.pageSize = val;
|
||||||
|
this.pageIndex = 1;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 当前页
|
||||||
|
currentChangeHandle(val) {
|
||||||
|
this.pageIndex = val;
|
||||||
|
this.getDataList();
|
||||||
|
},
|
||||||
|
// 多选
|
||||||
|
selectionChangeHandle(val) {
|
||||||
|
this.dataListSelections = val;
|
||||||
|
},
|
||||||
|
// 新增 / 修改
|
||||||
|
addOrUpdateHandle(id) {}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.dataSub = PubSub.subscribe("dataForm", (msg, val) => {
|
||||||
|
this.dataForm = val;
|
||||||
|
this.getDataList();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
PubSub.unsubscribe(this.dataSub);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -7,6 +7,7 @@ import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
@ -19,10 +20,12 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局序列化处理配置
|
* 全局序列化处理配置
|
||||||
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @since 2021-12-26
|
* @since 2021-12-26
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@Log4j2
|
||||||
public class JsonConfig {
|
public class JsonConfig {
|
||||||
@Bean
|
@Bean
|
||||||
public HttpMessageConverters fastJsonHttpMessageConverters() {
|
public HttpMessageConverters fastJsonHttpMessageConverters() {
|
||||||
|
|
@ -62,13 +65,15 @@ public class JsonConfig {
|
||||||
|
|
||||||
//忽略某些空值
|
//忽略某些空值
|
||||||
PropertyFilter filter = (source, key, value) -> {
|
PropertyFilter filter = (source, key, value) -> {
|
||||||
if(value instanceof List && ((List) value).size() == 0){
|
if (value instanceof List && ((List) value).size() == 0) {
|
||||||
return false;
|
if ("children".equals(key)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fastJsonConfig.setSerializeFilters(valueFilter,filter);
|
fastJsonConfig.setSerializeFilters(valueFilter, filter);
|
||||||
|
|
||||||
fastConverter.setFastJsonConfig(fastJsonConfig);
|
fastConverter.setFastJsonConfig(fastJsonConfig);
|
||||||
|
|
||||||
|
|
@ -76,7 +81,7 @@ public class JsonConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Jackson2ObjectMapperBuilderCustomizer customizer(){
|
public Jackson2ObjectMapperBuilderCustomizer customizer() {
|
||||||
return builder -> builder.featuresToEnable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
return builder -> builder.featuresToEnable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.CouponEntity;
|
import com.xjs.mall.coupon.entity.CouponEntity;
|
||||||
import com.xjs.mall.coupon.service.CouponService;
|
import com.xjs.mall.coupon.service.CouponService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.CouponHistoryEntity;
|
import com.xjs.mall.coupon.entity.CouponHistoryEntity;
|
||||||
import com.xjs.mall.coupon.service.CouponHistoryService;
|
import com.xjs.mall.coupon.service.CouponHistoryService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.CouponSpuCategoryRelationEntity;
|
import com.xjs.mall.coupon.entity.CouponSpuCategoryRelationEntity;
|
||||||
import com.xjs.mall.coupon.service.CouponSpuCategoryRelationService;
|
import com.xjs.mall.coupon.service.CouponSpuCategoryRelationService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.CouponSpuRelationEntity;
|
import com.xjs.mall.coupon.entity.CouponSpuRelationEntity;
|
||||||
import com.xjs.mall.coupon.service.CouponSpuRelationService;
|
import com.xjs.mall.coupon.service.CouponSpuRelationService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.HomeAdvEntity;
|
import com.xjs.mall.coupon.entity.HomeAdvEntity;
|
||||||
import com.xjs.mall.coupon.service.HomeAdvService;
|
import com.xjs.mall.coupon.service.HomeAdvService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.HomeSubjectEntity;
|
import com.xjs.mall.coupon.entity.HomeSubjectEntity;
|
||||||
import com.xjs.mall.coupon.service.HomeSubjectService;
|
import com.xjs.mall.coupon.service.HomeSubjectService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.HomeSubjectSpuEntity;
|
import com.xjs.mall.coupon.entity.HomeSubjectSpuEntity;
|
||||||
import com.xjs.mall.coupon.service.HomeSubjectSpuService;
|
import com.xjs.mall.coupon.service.HomeSubjectSpuService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.MemberPriceEntity;
|
import com.xjs.mall.coupon.entity.MemberPriceEntity;
|
||||||
import com.xjs.mall.coupon.service.MemberPriceService;
|
import com.xjs.mall.coupon.service.MemberPriceService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.SeckillPromotionEntity;
|
import com.xjs.mall.coupon.entity.SeckillPromotionEntity;
|
||||||
import com.xjs.mall.coupon.service.SeckillPromotionService;
|
import com.xjs.mall.coupon.service.SeckillPromotionService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.SeckillSessionEntity;
|
import com.xjs.mall.coupon.entity.SeckillSessionEntity;
|
||||||
import com.xjs.mall.coupon.service.SeckillSessionService;
|
import com.xjs.mall.coupon.service.SeckillSessionService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.SeckillSkuNoticeEntity;
|
import com.xjs.mall.coupon.entity.SeckillSkuNoticeEntity;
|
||||||
import com.xjs.mall.coupon.service.SeckillSkuNoticeService;
|
import com.xjs.mall.coupon.service.SeckillSkuNoticeService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.SeckillSkuRelationEntity;
|
import com.xjs.mall.coupon.entity.SeckillSkuRelationEntity;
|
||||||
import com.xjs.mall.coupon.service.SeckillSkuRelationService;
|
import com.xjs.mall.coupon.service.SeckillSkuRelationService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,17 @@
|
||||||
package com.xjs.mall.coupon.controller;
|
package com.xjs.mall.coupon.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.xjs.mall.coupon.entity.SkuFullReductionEntity;
|
import com.xjs.mall.coupon.entity.SkuFullReductionEntity;
|
||||||
import com.xjs.mall.coupon.service.SkuFullReductionService;
|
import com.xjs.mall.coupon.service.SkuFullReductionService;
|
||||||
|
import com.xjs.mall.other.R;
|
||||||
|
import com.xjs.mall.to.SkuReductionTo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,10 +24,19 @@ import com.xjs.utils.R;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("coupon/skufullreduction")
|
@RequestMapping("coupon/skufullreduction")
|
||||||
|
@Api(tags = "商城-优惠-满减")
|
||||||
public class SkuFullReductionController {
|
public class SkuFullReductionController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SkuFullReductionService skuFullReductionService;
|
private SkuFullReductionService skuFullReductionService;
|
||||||
|
|
||||||
|
@PostMapping("/saveinfo")
|
||||||
|
@ApiOperation("保存满减信息")
|
||||||
|
public R saveInfo(@RequestBody SkuReductionTo skuReductionTo) {
|
||||||
|
skuFullReductionService.saveSkuReduction(skuReductionTo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.coupon.entity.SkuLadderEntity;
|
import com.xjs.mall.coupon.entity.SkuLadderEntity;
|
||||||
import com.xjs.mall.coupon.service.SkuLadderService;
|
import com.xjs.mall.coupon.service.SkuLadderService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,16 @@
|
||||||
package com.xjs.mall.coupon.controller;
|
package com.xjs.mall.coupon.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.xjs.mall.coupon.entity.SpuBoundsEntity;
|
import com.xjs.mall.coupon.entity.SpuBoundsEntity;
|
||||||
import com.xjs.mall.coupon.service.SpuBoundsService;
|
import com.xjs.mall.coupon.service.SpuBoundsService;
|
||||||
|
import com.xjs.mall.other.R;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -26,6 +23,7 @@ import com.xjs.utils.R;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("coupon/spubounds")
|
@RequestMapping("coupon/spubounds")
|
||||||
|
@Api(tags = "商城-优惠-SPU积分")
|
||||||
public class SpuBoundsController {
|
public class SpuBoundsController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpuBoundsService spuBoundsService;
|
private SpuBoundsService spuBoundsService;
|
||||||
|
|
@ -52,9 +50,10 @@ public class SpuBoundsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存 (远程调用使用)
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/save")
|
@PostMapping("/save")
|
||||||
|
@ApiOperation("保存")
|
||||||
public R save(@RequestBody SpuBoundsEntity spuBounds){
|
public R save(@RequestBody SpuBoundsEntity spuBounds){
|
||||||
spuBoundsService.save(spuBounds);
|
spuBoundsService.save(spuBounds);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.xjs.mall.coupon.service;
|
package com.xjs.mall.coupon.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xjs.mall.to.SkuReductionTo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.mall.coupon.entity.SkuFullReductionEntity;
|
import com.xjs.mall.coupon.entity.SkuFullReductionEntity;
|
||||||
|
|
||||||
|
|
@ -16,5 +17,11 @@ import java.util.Map;
|
||||||
public interface SkuFullReductionService extends IService<SkuFullReductionEntity> {
|
public interface SkuFullReductionService extends IService<SkuFullReductionEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存sku优惠满减信息
|
||||||
|
* @param skuReductionTo 优惠满减To
|
||||||
|
*/
|
||||||
|
void saveSkuReduction(SkuReductionTo skuReductionTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,37 @@
|
||||||
package com.xjs.mall.coupon.service.impl;
|
package com.xjs.mall.coupon.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xjs.mall.coupon.dao.SkuFullReductionDao;
|
||||||
|
import com.xjs.mall.coupon.entity.MemberPriceEntity;
|
||||||
|
import com.xjs.mall.coupon.entity.SkuFullReductionEntity;
|
||||||
|
import com.xjs.mall.coupon.entity.SkuLadderEntity;
|
||||||
|
import com.xjs.mall.coupon.service.MemberPriceService;
|
||||||
|
import com.xjs.mall.coupon.service.SkuFullReductionService;
|
||||||
|
import com.xjs.mall.coupon.service.SkuLadderService;
|
||||||
|
import com.xjs.mall.to.MemberPrice;
|
||||||
|
import com.xjs.mall.to.SkuReductionTo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.Query;
|
import com.xjs.utils.Query;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.xjs.mall.coupon.dao.SkuFullReductionDao;
|
import java.math.BigDecimal;
|
||||||
import com.xjs.mall.coupon.entity.SkuFullReductionEntity;
|
import java.util.List;
|
||||||
import com.xjs.mall.coupon.service.SkuFullReductionService;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service("skuFullReductionService")
|
@Service("skuFullReductionService")
|
||||||
public class SkuFullReductionServiceImpl extends ServiceImpl<SkuFullReductionDao, SkuFullReductionEntity> implements SkuFullReductionService {
|
public class SkuFullReductionServiceImpl extends ServiceImpl<SkuFullReductionDao, SkuFullReductionEntity> implements SkuFullReductionService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SkuLadderService skuLadderService;
|
||||||
|
@Autowired
|
||||||
|
private MemberPriceService memberPriceService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
IPage<SkuFullReductionEntity> page = this.page(
|
IPage<SkuFullReductionEntity> page = this.page(
|
||||||
|
|
@ -26,4 +42,43 @@ public class SkuFullReductionServiceImpl extends ServiceImpl<SkuFullReductionDao
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveSkuReduction(SkuReductionTo skuReductionTo) {
|
||||||
|
//保存满减打折、会员价
|
||||||
|
SkuLadderEntity skuLadderEntity = new SkuLadderEntity();
|
||||||
|
skuLadderEntity.setSkuId(skuReductionTo.getSkuId());
|
||||||
|
skuLadderEntity.setFullCount(skuReductionTo.getFullCount());
|
||||||
|
skuLadderEntity.setDiscount(skuReductionTo.getDiscount());
|
||||||
|
skuLadderEntity.setAddOther(skuReductionTo.getCountStatus());
|
||||||
|
//计算折后价
|
||||||
|
//skuLadderEntity.setPrice();
|
||||||
|
|
||||||
|
if (skuReductionTo.getFullCount() > 0) {
|
||||||
|
skuLadderService.save(skuLadderEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
SkuFullReductionEntity skuFullReductionEntity = new SkuFullReductionEntity();
|
||||||
|
BeanUtils.copyProperties(skuReductionTo, skuFullReductionEntity);
|
||||||
|
if (skuFullReductionEntity.getFullPrice().compareTo(new BigDecimal("0")) == 1) {
|
||||||
|
super.save(skuFullReductionEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
//会员价
|
||||||
|
List<MemberPrice> memberPrice = skuReductionTo.getMemberPrice();
|
||||||
|
List<MemberPriceEntity> collect = memberPrice.stream().map(item -> {
|
||||||
|
MemberPriceEntity memberPriceEntity = new MemberPriceEntity();
|
||||||
|
memberPriceEntity.setSkuId(skuReductionTo.getSkuId());
|
||||||
|
memberPriceEntity.setMemberLevelId(item.getId());
|
||||||
|
memberPriceEntity.setMemberLevelName(item.getName());
|
||||||
|
memberPriceEntity.setMemberPrice(item.getPrice());
|
||||||
|
memberPriceEntity.setAddOther(1);
|
||||||
|
return memberPriceEntity;
|
||||||
|
}).filter(item ->
|
||||||
|
item.getMemberPrice().compareTo(new BigDecimal("0")) == 1
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
|
memberPriceService.saveBatch(collect);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.GrowthChangeHistoryEntity;
|
import com.xjs.mall.member.entity.GrowthChangeHistoryEntity;
|
||||||
import com.xjs.mall.member.service.GrowthChangeHistoryService;
|
import com.xjs.mall.member.service.GrowthChangeHistoryService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.IntegrationChangeHistoryEntity;
|
import com.xjs.mall.member.entity.IntegrationChangeHistoryEntity;
|
||||||
import com.xjs.mall.member.service.IntegrationChangeHistoryService;
|
import com.xjs.mall.member.service.IntegrationChangeHistoryService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.MemberCollectSpuEntity;
|
import com.xjs.mall.member.entity.MemberCollectSpuEntity;
|
||||||
import com.xjs.mall.member.service.MemberCollectSpuService;
|
import com.xjs.mall.member.service.MemberCollectSpuService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.MemberCollectSubjectEntity;
|
import com.xjs.mall.member.entity.MemberCollectSubjectEntity;
|
||||||
import com.xjs.mall.member.service.MemberCollectSubjectService;
|
import com.xjs.mall.member.service.MemberCollectSubjectService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.MemberEntity;
|
import com.xjs.mall.member.entity.MemberEntity;
|
||||||
import com.xjs.mall.member.service.MemberService;
|
import com.xjs.mall.member.service.MemberService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.xjs.mall.member.entity.MemberLevelEntity;
|
import com.xjs.mall.member.entity.MemberLevelEntity;
|
||||||
import com.xjs.mall.member.service.MemberLevelService;
|
import com.xjs.mall.member.service.MemberLevelService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.MemberLoginLogEntity;
|
import com.xjs.mall.member.entity.MemberLoginLogEntity;
|
||||||
import com.xjs.mall.member.service.MemberLoginLogService;
|
import com.xjs.mall.member.service.MemberLoginLogService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.MemberReceiveAddressEntity;
|
import com.xjs.mall.member.entity.MemberReceiveAddressEntity;
|
||||||
import com.xjs.mall.member.service.MemberReceiveAddressService;
|
import com.xjs.mall.member.service.MemberReceiveAddressService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.member.entity.MemberStatisticsInfoEntity;
|
import com.xjs.mall.member.entity.MemberStatisticsInfoEntity;
|
||||||
import com.xjs.mall.member.service.MemberStatisticsInfoService;
|
import com.xjs.mall.member.service.MemberStatisticsInfoService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.OrderEntity;
|
import com.xjs.mall.order.entity.OrderEntity;
|
||||||
import com.xjs.mall.order.service.OrderService;
|
import com.xjs.mall.order.service.OrderService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.OrderItemEntity;
|
import com.xjs.mall.order.entity.OrderItemEntity;
|
||||||
import com.xjs.mall.order.service.OrderItemService;
|
import com.xjs.mall.order.service.OrderItemService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.OrderOperateHistoryEntity;
|
import com.xjs.mall.order.entity.OrderOperateHistoryEntity;
|
||||||
import com.xjs.mall.order.service.OrderOperateHistoryService;
|
import com.xjs.mall.order.service.OrderOperateHistoryService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.OrderReturnApplyEntity;
|
import com.xjs.mall.order.entity.OrderReturnApplyEntity;
|
||||||
import com.xjs.mall.order.service.OrderReturnApplyService;
|
import com.xjs.mall.order.service.OrderReturnApplyService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.OrderReturnReasonEntity;
|
import com.xjs.mall.order.entity.OrderReturnReasonEntity;
|
||||||
import com.xjs.mall.order.service.OrderReturnReasonService;
|
import com.xjs.mall.order.service.OrderReturnReasonService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.OrderSettingEntity;
|
import com.xjs.mall.order.entity.OrderSettingEntity;
|
||||||
import com.xjs.mall.order.service.OrderSettingService;
|
import com.xjs.mall.order.service.OrderSettingService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.PaymentInfoEntity;
|
import com.xjs.mall.order.entity.PaymentInfoEntity;
|
||||||
import com.xjs.mall.order.service.PaymentInfoService;
|
import com.xjs.mall.order.service.PaymentInfoService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.order.entity.RefundInfoEntity;
|
import com.xjs.mall.order.entity.RefundInfoEntity;
|
||||||
import com.xjs.mall.order.service.RefundInfoService;
|
import com.xjs.mall.order.service.RefundInfoService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.xjs.mall.product.vo.AttrGroupRelationVo;
|
||||||
import com.xjs.mall.product.vo.AttrResponseVo;
|
import com.xjs.mall.product.vo.AttrResponseVo;
|
||||||
import com.xjs.mall.product.vo.AttrVo;
|
import com.xjs.mall.product.vo.AttrVo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import com.xjs.validation.group.AddGroup;
|
import com.xjs.validation.group.AddGroup;
|
||||||
import com.xjs.validation.group.UpdateGroup;
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,9 @@ import com.xjs.mall.product.service.AttrGroupService;
|
||||||
import com.xjs.mall.product.service.AttrService;
|
import com.xjs.mall.product.service.AttrService;
|
||||||
import com.xjs.mall.product.service.CategoryService;
|
import com.xjs.mall.product.service.CategoryService;
|
||||||
import com.xjs.mall.product.vo.AttrGroupRelationVo;
|
import com.xjs.mall.product.vo.AttrGroupRelationVo;
|
||||||
|
import com.xjs.mall.product.vo.AttrGroupWithAttrsVo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import com.xjs.validation.group.AddGroup;
|
import com.xjs.validation.group.AddGroup;
|
||||||
import com.xjs.validation.group.UpdateGroup;
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -45,6 +46,15 @@ public class AttrGroupController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private AttrAttrgroupRelationService attrAttrgroupRelationService;
|
private AttrAttrgroupRelationService attrAttrgroupRelationService;
|
||||||
|
|
||||||
|
@GetMapping("/{catelogId}/withattr")
|
||||||
|
@ApiOperation("根据分类id获取规格参数")
|
||||||
|
public R getAttrGroupWithAttrs(@PathVariable("catelogId")Long catelogId){
|
||||||
|
//1、查出当前分类下的所有属性分组,
|
||||||
|
//2、查出每个属性分组的所有属性
|
||||||
|
List<AttrGroupWithAttrsVo> vos = attrGroupService.getAttrGroupWithAttrsByCatelogId(catelogId);
|
||||||
|
return R.ok().put("data",vos);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取关联信息
|
* 获取关联信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.xjs.mall.product.entity.BrandEntity;
|
import com.xjs.mall.product.entity.BrandEntity;
|
||||||
import com.xjs.mall.product.service.BrandService;
|
import com.xjs.mall.product.service.BrandService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import com.xjs.validation.group.AddGroup;
|
import com.xjs.validation.group.AddGroup;
|
||||||
import com.xjs.validation.group.SelectGroup;
|
import com.xjs.validation.group.SelectGroup;
|
||||||
import com.xjs.validation.group.UpdateGroup;
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import com.xjs.mall.product.entity.BrandEntity;
|
||||||
import com.xjs.mall.product.entity.CategoryBrandRelationEntity;
|
import com.xjs.mall.product.entity.CategoryBrandRelationEntity;
|
||||||
import com.xjs.mall.product.service.CategoryBrandRelationService;
|
import com.xjs.mall.product.service.CategoryBrandRelationService;
|
||||||
import com.xjs.mall.product.vo.BrandVo;
|
import com.xjs.mall.product.vo.BrandVo;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import com.xjs.validation.group.AddGroup;
|
import com.xjs.validation.group.AddGroup;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import com.ruoyi.common.log.annotation.Log;
|
||||||
import com.ruoyi.common.log.enums.BusinessType;
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
import com.xjs.mall.product.entity.CategoryEntity;
|
import com.xjs.mall.product.entity.CategoryEntity;
|
||||||
import com.xjs.mall.product.service.CategoryService;
|
import com.xjs.mall.product.service.CategoryService;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import com.xjs.validation.group.AddGroup;
|
import com.xjs.validation.group.AddGroup;
|
||||||
import com.xjs.validation.group.UpdateGroup;
|
import com.xjs.validation.group.UpdateGroup;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
|
@ -80,6 +80,7 @@ public class CategoryController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update/sort")
|
@PutMapping("/update/sort")
|
||||||
|
@ApiOperation("修改商品分类排序")
|
||||||
@Log(title = "商品分类", businessType = BusinessType.UPDATE)
|
@Log(title = "商品分类", businessType = BusinessType.UPDATE)
|
||||||
public R updateSort(@RequestBody CategoryEntity[] categoryEntities) {
|
public R updateSort(@RequestBody CategoryEntity[] categoryEntities) {
|
||||||
categoryService.updateBatchById(Arrays.asList(categoryEntities));
|
categoryService.updateBatchById(Arrays.asList(categoryEntities));
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.CommentReplayEntity;
|
import com.xjs.mall.product.entity.CommentReplayEntity;
|
||||||
import com.xjs.mall.product.service.CommentReplayService;
|
import com.xjs.mall.product.service.CommentReplayService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.ProductAttrValueEntity;
|
import com.xjs.mall.product.entity.ProductAttrValueEntity;
|
||||||
import com.xjs.mall.product.service.ProductAttrValueService;
|
import com.xjs.mall.product.service.ProductAttrValueService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.SkuImagesEntity;
|
import com.xjs.mall.product.entity.SkuImagesEntity;
|
||||||
import com.xjs.mall.product.service.SkuImagesService;
|
import com.xjs.mall.product.service.SkuImagesService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,15 @@
|
||||||
package com.xjs.mall.product.controller;
|
package com.xjs.mall.product.controller;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.entity.SkuInfoEntity;
|
import com.xjs.mall.product.entity.SkuInfoEntity;
|
||||||
import com.xjs.mall.product.service.SkuInfoService;
|
import com.xjs.mall.product.service.SkuInfoService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -22,10 +18,11 @@ import com.xjs.utils.R;
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("product/skuinfo")
|
@RequestMapping("product/skuinfo")
|
||||||
|
@Api(tags = "商城-商品-SKU信息")
|
||||||
public class SkuInfoController {
|
public class SkuInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SkuInfoService skuInfoService;
|
private SkuInfoService skuInfoService;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.SkuSaleAttrValueEntity;
|
import com.xjs.mall.product.entity.SkuSaleAttrValueEntity;
|
||||||
import com.xjs.mall.product.service.SkuSaleAttrValueService;
|
import com.xjs.mall.product.service.SkuSaleAttrValueService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.SpuCommentEntity;
|
import com.xjs.mall.product.entity.SpuCommentEntity;
|
||||||
import com.xjs.mall.product.service.SpuCommentService;
|
import com.xjs.mall.product.service.SpuCommentService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.SpuImagesEntity;
|
import com.xjs.mall.product.entity.SpuImagesEntity;
|
||||||
import com.xjs.mall.product.service.SpuImagesService;
|
import com.xjs.mall.product.service.SpuImagesService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,31 @@
|
||||||
package com.xjs.mall.product.controller;
|
package com.xjs.mall.product.controller;
|
||||||
|
|
||||||
|
import com.xjs.mall.other.R;
|
||||||
|
import com.xjs.mall.product.entity.SpuInfoEntity;
|
||||||
|
import com.xjs.mall.product.service.SpuInfoService;
|
||||||
|
import com.xjs.mall.product.vo.spu.SpuSaveVo;
|
||||||
|
import com.xjs.utils.PageUtils;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.entity.SpuInfoEntity;
|
|
||||||
import com.xjs.mall.product.service.SpuInfoService;
|
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.utils.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spu信息
|
* spu信息
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("product/spuinfo")
|
@RequestMapping("product/spuinfo")
|
||||||
|
@Api(tags = "商城-商品-SPU信息")
|
||||||
public class SpuInfoController {
|
public class SpuInfoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SpuInfoService spuInfoService;
|
private SpuInfoService spuInfoService;
|
||||||
|
|
@ -34,7 +34,7 @@ public class SpuInfoController {
|
||||||
* 列表
|
* 列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/list")
|
@RequestMapping("/list")
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
public R list(@RequestParam Map<String, Object> params) {
|
||||||
PageUtils page = spuInfoService.queryPage(params);
|
PageUtils page = spuInfoService.queryPage(params);
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
return R.ok().put("page", page);
|
||||||
|
|
@ -45,18 +45,19 @@ public class SpuInfoController {
|
||||||
* 信息
|
* 信息
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/info/{id}")
|
@RequestMapping("/info/{id}")
|
||||||
public R info(@PathVariable("id") Long id){
|
public R info(@PathVariable("id") Long id) {
|
||||||
SpuInfoEntity spuInfo = spuInfoService.getById(id);
|
SpuInfoEntity spuInfo = spuInfoService.getById(id);
|
||||||
|
|
||||||
return R.ok().put("spuInfo", spuInfo);
|
return R.ok().put("spuInfo", spuInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存
|
* 保存(保存spu关联的所有信息)
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/save")
|
@PostMapping("/save")
|
||||||
public R save(@RequestBody SpuInfoEntity spuInfo){
|
@ApiOperation("保存spu关联的所有信息")
|
||||||
spuInfoService.save(spuInfo);
|
public R saveSpuInfo(@Validated(AddGroup.class) @RequestBody SpuSaveVo spuInfo) {
|
||||||
|
spuInfoService.saveSpuInfo(spuInfo);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -65,8 +66,8 @@ public class SpuInfoController {
|
||||||
* 修改
|
* 修改
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
public R update(@RequestBody SpuInfoEntity spuInfo){
|
public R update(@RequestBody SpuInfoEntity spuInfo) {
|
||||||
spuInfoService.updateById(spuInfo);
|
spuInfoService.updateById(spuInfo);
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
@ -75,8 +76,8 @@ public class SpuInfoController {
|
||||||
* 删除
|
* 删除
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/delete")
|
@RequestMapping("/delete")
|
||||||
public R delete(@RequestBody Long[] ids){
|
public R delete(@RequestBody Long[] ids) {
|
||||||
spuInfoService.removeByIds(Arrays.asList(ids));
|
spuInfoService.removeByIds(Arrays.asList(ids));
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.xjs.mall.product.entity.SpuInfoDescEntity;
|
import com.xjs.mall.product.entity.SpuInfoDescEntity;
|
||||||
import com.xjs.mall.product.service.SpuInfoDescService;
|
import com.xjs.mall.product.service.SpuInfoDescService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.xjs.mall.product.entity;
|
package com.xjs.mall.product.entity;
|
||||||
|
|
||||||
import com.alibaba.fastjson.annotation.JSONField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
|
@ -72,7 +71,6 @@ public class CategoryEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 子分类
|
* 子分类
|
||||||
*/
|
*/
|
||||||
@JSONField
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<CategoryEntity> children;
|
private List<CategoryEntity> children;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package com.xjs.mall.product.entity;
|
package com.xjs.mall.product.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* spu信息介绍
|
* spu信息介绍
|
||||||
|
|
@ -22,7 +22,7 @@ public class SpuInfoDescEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 商品id
|
* 商品id
|
||||||
*/
|
*/
|
||||||
@TableId
|
@TableId(type = IdType.INPUT)
|
||||||
private Long spuId;
|
private Long spuId;
|
||||||
/**
|
/**
|
||||||
* 商品介绍
|
* 商品介绍
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.xjs.mall.product.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.mall.product.entity.AttrGroupEntity;
|
import com.xjs.mall.product.entity.AttrGroupEntity;
|
||||||
|
import com.xjs.mall.product.vo.AttrGroupWithAttrsVo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -32,11 +33,12 @@ public interface AttrGroupService extends IService<AttrGroupEntity> {
|
||||||
*/
|
*/
|
||||||
void removeAttrGroup(List<Long> ids);
|
void removeAttrGroup(List<Long> ids);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据分类id查出所有的分组以及这些组里面的属性
|
* 根据分类id查出所有的分组以及这些组里面的属性
|
||||||
* @param categoryId 分类id
|
* @param categoryId 分类id
|
||||||
* @return list
|
* @return list
|
||||||
*/
|
*/
|
||||||
//List<AttrGroupWithAttrsVo> getAttrGroupWithAttrsByCatelogId(Long categoryId);
|
List<AttrGroupWithAttrsVo> getAttrGroupWithAttrsByCatelogId(Long categoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
package com.xjs.mall.product.service;
|
package com.xjs.mall.product.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.xjs.mall.product.vo.spu.BaseAttrs;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.mall.product.entity.ProductAttrValueEntity;
|
import com.xjs.mall.product.entity.ProductAttrValueEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -11,10 +13,17 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
public interface ProductAttrValueService extends IService<ProductAttrValueEntity> {
|
public interface ProductAttrValueService extends IService<ProductAttrValueEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存spu的规格参数
|
||||||
|
* @param baseAttrs 规格参数数据
|
||||||
|
* @param spuId spuId
|
||||||
|
*/
|
||||||
|
void saveProductAttr(List<BaseAttrs> baseAttrs,Long spuId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,11 @@ import java.util.Map;
|
||||||
public interface SkuInfoService extends IService<SkuInfoEntity> {
|
public interface SkuInfoService extends IService<SkuInfoEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存sku信息
|
||||||
|
* @param skuInfoEntity sku实体类
|
||||||
|
*/
|
||||||
|
void saveSkuInfo(SkuInfoEntity skuInfoEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.mall.product.entity.SpuImagesEntity;
|
import com.xjs.mall.product.entity.SpuImagesEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -11,10 +12,17 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
public interface SpuImagesService extends IService<SpuImagesEntity> {
|
public interface SpuImagesService extends IService<SpuImagesEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存spu图片信息
|
||||||
|
* @param id spuId
|
||||||
|
* @param images 图片集合
|
||||||
|
*/
|
||||||
|
void saveImages(Long id, List<String> images);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,16 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
public interface SpuInfoDescService extends IService<SpuInfoDescEntity> {
|
public interface SpuInfoDescService extends IService<SpuInfoDescEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存spu描述信息
|
||||||
|
* @param descEntity spu描述实体类
|
||||||
|
*/
|
||||||
|
void saveSpuInfoDesc(SpuInfoDescEntity descEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
package com.xjs.mall.product.service;
|
package com.xjs.mall.product.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.mall.product.entity.SpuInfoEntity;
|
import com.xjs.mall.product.entity.SpuInfoEntity;
|
||||||
|
import com.xjs.mall.product.vo.spu.SpuSaveVo;
|
||||||
|
import com.xjs.utils.PageUtils;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -11,10 +12,23 @@ import java.util.Map;
|
||||||
*
|
*
|
||||||
* @author xiejs
|
* @author xiejs
|
||||||
* @email 1294405880@qq.com
|
* @email 1294405880@qq.com
|
||||||
* @date 2022-03-15 10:16:53
|
* @since 2022-03-15 10:16:53
|
||||||
*/
|
*/
|
||||||
public interface SpuInfoService extends IService<SpuInfoEntity> {
|
public interface SpuInfoService extends IService<SpuInfoEntity> {
|
||||||
|
|
||||||
PageUtils queryPage(Map<String, Object> params);
|
PageUtils queryPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存spu关联信息
|
||||||
|
* @param spuInfo spu信息
|
||||||
|
*/
|
||||||
|
void saveSpuInfo(SpuSaveVo spuInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存基本spu信息
|
||||||
|
* @param spuInfoEntity spu实体类
|
||||||
|
*/
|
||||||
|
void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,21 @@ package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.exception.MallException;
|
import com.xjs.exception.MallException;
|
||||||
import com.xjs.mall.product.dao.AttrGroupDao;
|
import com.xjs.mall.product.dao.AttrGroupDao;
|
||||||
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
import com.xjs.mall.product.entity.AttrAttrgroupRelationEntity;
|
||||||
|
import com.xjs.mall.product.entity.AttrEntity;
|
||||||
import com.xjs.mall.product.entity.AttrGroupEntity;
|
import com.xjs.mall.product.entity.AttrGroupEntity;
|
||||||
import com.xjs.mall.product.entity.CategoryEntity;
|
import com.xjs.mall.product.entity.CategoryEntity;
|
||||||
import com.xjs.mall.product.service.AttrAttrgroupRelationService;
|
import com.xjs.mall.product.service.AttrAttrgroupRelationService;
|
||||||
import com.xjs.mall.product.service.AttrGroupService;
|
import com.xjs.mall.product.service.AttrGroupService;
|
||||||
|
import com.xjs.mall.product.service.AttrService;
|
||||||
import com.xjs.mall.product.service.CategoryService;
|
import com.xjs.mall.product.service.CategoryService;
|
||||||
import com.xjs.mall.product.vo.AttrGroupResponseVo;
|
import com.xjs.mall.product.vo.AttrGroupResponseVo;
|
||||||
|
import com.xjs.mall.product.vo.AttrGroupWithAttrsVo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.Query;
|
import com.xjs.utils.Query;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
@ -35,6 +39,8 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEnt
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private AttrAttrgroupRelationService attrAttrgroupRelationService;
|
private AttrAttrgroupRelationService attrAttrgroupRelationService;
|
||||||
|
@Autowired
|
||||||
|
private AttrService attrService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params, Long categoryId) {
|
public PageUtils queryPage(Map<String, Object> params, Long categoryId) {
|
||||||
|
|
@ -99,4 +105,20 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AttrGroupWithAttrsVo> getAttrGroupWithAttrsByCatelogId(Long catelogId) {
|
||||||
|
//1、查询分组信息
|
||||||
|
List<AttrGroupEntity> attrGroupEntities = this.list(new QueryWrapper<AttrGroupEntity>().eq("catelog_id", catelogId));
|
||||||
|
|
||||||
|
//2、查询所有属性
|
||||||
|
return attrGroupEntities.stream().map(group -> {
|
||||||
|
AttrGroupWithAttrsVo attrsVo = new AttrGroupWithAttrsVo();
|
||||||
|
BeanUtils.copyProperties(group,attrsVo);
|
||||||
|
List<AttrEntity> attrs = attrService.getRelationAttr(attrsVo.getAttrGroupId());
|
||||||
|
attrsVo.setAttrs(attrs);
|
||||||
|
return attrsVo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,30 @@
|
||||||
package com.xjs.mall.product.service.impl;
|
package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.xjs.mall.product.dao.ProductAttrValueDao;
|
||||||
|
import com.xjs.mall.product.entity.AttrEntity;
|
||||||
|
import com.xjs.mall.product.entity.ProductAttrValueEntity;
|
||||||
|
import com.xjs.mall.product.service.AttrService;
|
||||||
|
import com.xjs.mall.product.service.ProductAttrValueService;
|
||||||
|
import com.xjs.mall.product.vo.spu.BaseAttrs;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.Query;
|
import com.xjs.utils.Query;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.xjs.mall.product.dao.ProductAttrValueDao;
|
import java.util.List;
|
||||||
import com.xjs.mall.product.entity.ProductAttrValueEntity;
|
import java.util.Map;
|
||||||
import com.xjs.mall.product.service.ProductAttrValueService;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service("productAttrValueService")
|
@Service("productAttrValueService")
|
||||||
public class ProductAttrValueServiceImpl extends ServiceImpl<ProductAttrValueDao, ProductAttrValueEntity> implements ProductAttrValueService {
|
public class ProductAttrValueServiceImpl extends ServiceImpl<ProductAttrValueDao, ProductAttrValueEntity> implements ProductAttrValueService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AttrService attrService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
IPage<ProductAttrValueEntity> page = this.page(
|
IPage<ProductAttrValueEntity> page = this.page(
|
||||||
|
|
@ -26,4 +35,26 @@ public class ProductAttrValueServiceImpl extends ServiceImpl<ProductAttrValueDao
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveProductAttr(List<BaseAttrs> baseAttrs,Long spuId) {
|
||||||
|
List<ProductAttrValueEntity> productAttrValueEntityList = baseAttrs.stream().map(attr -> {
|
||||||
|
ProductAttrValueEntity productAttrValueEntity = new ProductAttrValueEntity();
|
||||||
|
productAttrValueEntity.setAttrId(attr.getAttrId());
|
||||||
|
|
||||||
|
//查询属性名
|
||||||
|
AttrEntity attrEntity = attrService.getById(attr.getAttrId());
|
||||||
|
productAttrValueEntity.setAttrName(attrEntity.getAttrName());
|
||||||
|
|
||||||
|
productAttrValueEntity.setAttrValue(attr.getAttrValues());
|
||||||
|
productAttrValueEntity.setQuickShow(attr.getShowDesc());
|
||||||
|
productAttrValueEntity.setSpuId(spuId);
|
||||||
|
return productAttrValueEntity;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
super.saveBatch(productAttrValueEntityList);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package com.xjs.mall.product.service.impl;
|
package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.utils.Query;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.dao.SkuInfoDao;
|
import com.xjs.mall.product.dao.SkuInfoDao;
|
||||||
import com.xjs.mall.product.entity.SkuInfoEntity;
|
import com.xjs.mall.product.entity.SkuInfoEntity;
|
||||||
import com.xjs.mall.product.service.SkuInfoService;
|
import com.xjs.mall.product.service.SkuInfoService;
|
||||||
|
import com.xjs.utils.PageUtils;
|
||||||
|
import com.xjs.utils.Query;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Service("skuInfoService")
|
@Service("skuInfoService")
|
||||||
|
|
@ -26,4 +26,9 @@ public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoDao, SkuInfoEntity> i
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveSkuInfo(SkuInfoEntity skuInfoEntity) {
|
||||||
|
super.baseMapper.insert(skuInfoEntity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,19 @@
|
||||||
package com.xjs.mall.product.service.impl;
|
package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.utils.Query;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.dao.SpuImagesDao;
|
import com.xjs.mall.product.dao.SpuImagesDao;
|
||||||
import com.xjs.mall.product.entity.SpuImagesEntity;
|
import com.xjs.mall.product.entity.SpuImagesEntity;
|
||||||
import com.xjs.mall.product.service.SpuImagesService;
|
import com.xjs.mall.product.service.SpuImagesService;
|
||||||
|
import com.xjs.utils.PageUtils;
|
||||||
|
import com.xjs.utils.Query;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service("spuImagesService")
|
@Service("spuImagesService")
|
||||||
|
|
@ -26,4 +29,18 @@ public class SpuImagesServiceImpl extends ServiceImpl<SpuImagesDao, SpuImagesEnt
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveImages(Long id, List<String> images) {
|
||||||
|
if (CollUtil.isNotEmpty(images)) {
|
||||||
|
List<SpuImagesEntity> collect = images.stream().map(img -> {
|
||||||
|
SpuImagesEntity spuImagesEntity = new SpuImagesEntity();
|
||||||
|
spuImagesEntity.setSpuId(id);
|
||||||
|
spuImagesEntity.setImgUrl(img);
|
||||||
|
return spuImagesEntity;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
super.saveBatch(collect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
package com.xjs.mall.product.service.impl;
|
package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.xjs.utils.PageUtils;
|
|
||||||
import com.xjs.utils.Query;
|
|
||||||
|
|
||||||
import com.xjs.mall.product.dao.SpuInfoDescDao;
|
import com.xjs.mall.product.dao.SpuInfoDescDao;
|
||||||
import com.xjs.mall.product.entity.SpuInfoDescEntity;
|
import com.xjs.mall.product.entity.SpuInfoDescEntity;
|
||||||
import com.xjs.mall.product.service.SpuInfoDescService;
|
import com.xjs.mall.product.service.SpuInfoDescService;
|
||||||
|
import com.xjs.utils.PageUtils;
|
||||||
|
import com.xjs.utils.Query;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@Service("spuInfoDescService")
|
@Service("spuInfoDescService")
|
||||||
|
|
@ -26,4 +26,9 @@ public class SpuInfoDescServiceImpl extends ServiceImpl<SpuInfoDescDao, SpuInfoD
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveSpuInfoDesc(SpuInfoDescEntity descEntity) {
|
||||||
|
super.baseMapper.insert(descEntity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,29 +1,164 @@
|
||||||
package com.xjs.mall.product.service.impl;
|
package com.xjs.mall.product.service.impl;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import java.util.Map;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.utils.StringUtils;
|
||||||
|
import com.xjs.mall.RemoteCouponFeign;
|
||||||
|
import com.xjs.mall.product.dao.SpuInfoDao;
|
||||||
|
import com.xjs.mall.product.entity.*;
|
||||||
|
import com.xjs.mall.product.service.*;
|
||||||
|
import com.xjs.mall.product.vo.spu.*;
|
||||||
|
import com.xjs.mall.to.SkuReductionTo;
|
||||||
|
import com.xjs.mall.to.SpuBoundTo;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.Query;
|
import com.xjs.utils.Query;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import com.xjs.mall.product.dao.SpuInfoDao;
|
import javax.annotation.Resource;
|
||||||
import com.xjs.mall.product.entity.SpuInfoEntity;
|
import java.math.BigDecimal;
|
||||||
import com.xjs.mall.product.service.SpuInfoService;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@Service("spuInfoService")
|
@Service("spuInfoService")
|
||||||
|
@Transactional
|
||||||
public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
|
public class SpuInfoServiceImpl extends ServiceImpl<SpuInfoDao, SpuInfoEntity> implements SpuInfoService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SpuInfoDescService spuInfoDescService;
|
||||||
|
@Autowired
|
||||||
|
private SpuImagesService spuImagesService;
|
||||||
|
@Autowired
|
||||||
|
private ProductAttrValueService productAttrValueService;
|
||||||
|
@Autowired
|
||||||
|
private SkuInfoService skuInfoService;
|
||||||
|
@Autowired
|
||||||
|
private SkuImagesService skuImagesService;
|
||||||
|
@Autowired
|
||||||
|
private SkuSaleAttrValueService skuSaleAttrValueService;
|
||||||
|
@Resource
|
||||||
|
private RemoteCouponFeign remoteCouponFeign;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
IPage<SpuInfoEntity> page = this.page(
|
IPage<SpuInfoEntity> page = this.page(
|
||||||
new Query<SpuInfoEntity>().getPage(params),
|
new Query<SpuInfoEntity>().getPage(params),
|
||||||
new QueryWrapper<SpuInfoEntity>()
|
new QueryWrapper<>()
|
||||||
);
|
);
|
||||||
|
|
||||||
return new PageUtils(page);
|
return new PageUtils(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveSpuInfo(SpuSaveVo spuSaveVo) {
|
||||||
|
//1、保存spu基本信息 pms_spu_info
|
||||||
|
SpuInfoEntity spuInfoEntity = new SpuInfoEntity();
|
||||||
|
BeanUtils.copyProperties(spuSaveVo, spuInfoEntity);
|
||||||
|
spuInfoEntity.setCreateTime(new Date());
|
||||||
|
spuInfoEntity.setUpdateTime(new Date());
|
||||||
|
this.saveBaseSpuInfo(spuInfoEntity);
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//2、保存spu的描述图片 pms_spu_info_desc
|
||||||
|
List<String> decript = spuSaveVo.getDecript();
|
||||||
|
SpuInfoDescEntity descEntity = new SpuInfoDescEntity();
|
||||||
|
descEntity.setSpuId(spuInfoEntity.getId());
|
||||||
|
descEntity.setDecript(String.join(",", decript)); //把list集合用 , 分割成字符串
|
||||||
|
spuInfoDescService.saveSpuInfoDesc(descEntity);
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//3、保存spu的图片集 pms_spu_images
|
||||||
|
List<String> images = spuSaveVo.getImages();
|
||||||
|
spuImagesService.saveImages(spuInfoEntity.getId(), images);
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//4、保存spu的规格参数 pms_product_attr_value
|
||||||
|
List<BaseAttrs> baseAttrs = spuSaveVo.getBaseAttrs();
|
||||||
|
productAttrValueService.saveProductAttr(baseAttrs, spuInfoEntity.getId());
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// 保存spu的积分信息
|
||||||
|
Bounds bounds = spuSaveVo.getBounds();
|
||||||
|
SpuBoundTo spuBoundTo = new SpuBoundTo(); //服务之间调用传输对象To
|
||||||
|
BeanUtils.copyProperties(bounds, spuBoundTo);
|
||||||
|
spuBoundTo.setSpuId(spuInfoEntity.getId());
|
||||||
|
remoteCouponFeign.saveSpuBounds(spuBoundTo);
|
||||||
|
|
||||||
|
//5、保存当前spu对应的sku信息
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
//5.1、保存sku的基本信息 pms_sku_info
|
||||||
|
List<Skus> skus = spuSaveVo.getSkus();
|
||||||
|
if (CollUtil.isNotEmpty(skus)) {
|
||||||
|
skus.forEach(item -> {
|
||||||
|
|
||||||
|
String defaultImg = "";
|
||||||
|
for (Images image : item.getImages()) {
|
||||||
|
if (image.getDefaultImg() == 1) { //判断是默认图片
|
||||||
|
defaultImg = image.getImgUrl();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SkuInfoEntity skuInfoEntity = new SkuInfoEntity();
|
||||||
|
BeanUtils.copyProperties(item, skuInfoEntity);
|
||||||
|
skuInfoEntity.setBrandId(spuInfoEntity.getBrandId());
|
||||||
|
skuInfoEntity.setCatalogId(spuInfoEntity.getCatalogId());
|
||||||
|
skuInfoEntity.setSaleCount(0L); //销量默认0
|
||||||
|
skuInfoEntity.setSpuId(spuInfoEntity.getId());
|
||||||
|
skuInfoEntity.setSkuDefaultImg(defaultImg);
|
||||||
|
skuInfoService.saveSkuInfo(skuInfoEntity);
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Long skuId = skuInfoEntity.getSkuId();
|
||||||
|
|
||||||
|
//5.2、保存sku的图片信息
|
||||||
|
List<SkuImagesEntity> imagesEntities = item.getImages().stream().map(img -> {
|
||||||
|
SkuImagesEntity skuImagesEntity = new SkuImagesEntity();
|
||||||
|
skuImagesEntity.setSkuId(skuId);
|
||||||
|
skuImagesEntity.setImgUrl(img.getImgUrl());
|
||||||
|
skuImagesEntity.setDefaultImg(img.getDefaultImg());
|
||||||
|
return skuImagesEntity;
|
||||||
|
}).filter(entity ->
|
||||||
|
StringUtils.isNotEmpty(entity.getImgUrl())
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
skuImagesService.saveBatch(imagesEntities);
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//5.3、保存sku的销售属性信息
|
||||||
|
List<Attr> attr = item.getAttr();
|
||||||
|
List<SkuSaleAttrValueEntity> skuSaleAttrValueEntities = attr.stream().map(a -> {
|
||||||
|
SkuSaleAttrValueEntity skuSaleAttrValueEntity = new SkuSaleAttrValueEntity();
|
||||||
|
BeanUtils.copyProperties(a, skuSaleAttrValueEntity);
|
||||||
|
skuSaleAttrValueEntity.setSkuId(skuId);
|
||||||
|
return skuSaleAttrValueEntity;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
skuSaleAttrValueService.saveBatch(skuSaleAttrValueEntities);
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//5.4、保存sku的优惠满减等信息
|
||||||
|
SkuReductionTo skuReductionTo = new SkuReductionTo();
|
||||||
|
BeanUtils.copyProperties(item, skuReductionTo);
|
||||||
|
skuReductionTo.setSkuId(skuId);
|
||||||
|
if (skuReductionTo.getFullCount() > 0 &&
|
||||||
|
skuReductionTo.getFullPrice().compareTo(new BigDecimal("0")) == 1) {
|
||||||
|
remoteCouponFeign.saveSkuReduction(skuReductionTo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveBaseSpuInfo(SpuInfoEntity spuInfoEntity) {
|
||||||
|
super.baseMapper.insert(spuInfoEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.xjs.mall.product.vo;
|
||||||
|
|
||||||
|
import com.xjs.mall.product.entity.AttrEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* attr分组和attrVo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AttrGroupWithAttrsVo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分组id
|
||||||
|
*/
|
||||||
|
private Long attrGroupId;
|
||||||
|
/**
|
||||||
|
* 组名
|
||||||
|
*/
|
||||||
|
private String attrGroupName;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String descript;
|
||||||
|
/**
|
||||||
|
* 组图标
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
/**
|
||||||
|
* 所属分类id
|
||||||
|
*/
|
||||||
|
private Long catelogId;
|
||||||
|
|
||||||
|
private List<AttrEntity> attrs;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2019 bejson.com
|
||||||
|
*/
|
||||||
|
package com.xjs.mall.product.vo.spu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*属性vo
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-03-20 13:49:29
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Attr {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性Id
|
||||||
|
*/
|
||||||
|
private Long attrId;
|
||||||
|
/**
|
||||||
|
* 属性名称
|
||||||
|
*/
|
||||||
|
private String attrName;
|
||||||
|
/**
|
||||||
|
* 属性值
|
||||||
|
*/
|
||||||
|
private String attrValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
package com.xjs.mall.product.vo.spu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 基本属性vo
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BaseAttrs {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性Id
|
||||||
|
*/
|
||||||
|
private Long attrId;
|
||||||
|
/**
|
||||||
|
* 属性值
|
||||||
|
*/
|
||||||
|
private String attrValues;
|
||||||
|
/**
|
||||||
|
* 属性描述状态
|
||||||
|
*/
|
||||||
|
private Integer showDesc;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2019 bejson.com
|
||||||
|
*/
|
||||||
|
package com.xjs.mall.product.vo.spu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Bounds {
|
||||||
|
|
||||||
|
private BigDecimal buyBounds;
|
||||||
|
private BigDecimal growBounds;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2019 bejson.com
|
||||||
|
*/
|
||||||
|
package com.xjs.mall.product.vo.spu;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*图集vo
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-03-20 13:50:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Images {
|
||||||
|
/**
|
||||||
|
* 图片地址
|
||||||
|
*/
|
||||||
|
private String imgUrl;
|
||||||
|
/**
|
||||||
|
* 默认数量
|
||||||
|
*/
|
||||||
|
private Integer defaultImg;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2019 bejson.com
|
||||||
|
*/
|
||||||
|
package com.xjs.mall.product.vo.spu;
|
||||||
|
|
||||||
|
import com.xjs.mall.to.MemberPrice;
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Min;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*sku vo
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-03-20 13:48:50
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Skus {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性bean
|
||||||
|
*/
|
||||||
|
private List<Attr> attr;
|
||||||
|
/**
|
||||||
|
* sku名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "sku名称不能为空", groups = {AddGroup.class})
|
||||||
|
private String skuName;
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
@NotNull(message = "价格不能为空", groups = {AddGroup.class})
|
||||||
|
@Min(message = "价格应该大于 0 ", groups = {AddGroup.class},value = 1)
|
||||||
|
private BigDecimal price;
|
||||||
|
/**
|
||||||
|
* sku标题
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "sku标题不能为空", groups = {AddGroup.class})
|
||||||
|
private String skuTitle;
|
||||||
|
/**
|
||||||
|
* sku副标题
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "sku副标题不能为空", groups = {AddGroup.class})
|
||||||
|
private String skuSubtitle;
|
||||||
|
/**
|
||||||
|
* 图集
|
||||||
|
*/
|
||||||
|
private List<Images> images;
|
||||||
|
/**
|
||||||
|
* 图集描述
|
||||||
|
*/
|
||||||
|
private List<String> descar;
|
||||||
|
/**
|
||||||
|
* 满多少满减
|
||||||
|
*/
|
||||||
|
private Integer fullCount;
|
||||||
|
/**
|
||||||
|
* 满减数量
|
||||||
|
*/
|
||||||
|
private BigDecimal discount;
|
||||||
|
|
||||||
|
private Integer countStatus;
|
||||||
|
/**
|
||||||
|
* 正常价格
|
||||||
|
*/
|
||||||
|
private BigDecimal fullPrice;
|
||||||
|
/**
|
||||||
|
* 优惠价格
|
||||||
|
*/
|
||||||
|
private BigDecimal reducePrice;
|
||||||
|
/**
|
||||||
|
* 价格状态
|
||||||
|
*/
|
||||||
|
private Integer priceStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员bean
|
||||||
|
*/
|
||||||
|
private List<MemberPrice> memberPrice;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,80 @@
|
||||||
|
/**
|
||||||
|
* Copyright 2019 bejson.com
|
||||||
|
*/
|
||||||
|
package com.xjs.mall.product.vo.spu;
|
||||||
|
|
||||||
|
import com.xjs.validation.group.AddGroup;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spu保存的vo
|
||||||
|
* @author xiejs
|
||||||
|
* @since 2022-03-20 13:42:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SpuSaveVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* spu名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "商品名称不能为空",groups = {AddGroup.class})
|
||||||
|
@Size(message = "商品名称长度在 1 到 100 之间",groups = {AddGroup.class},max = 100)
|
||||||
|
private String spuName;
|
||||||
|
/**
|
||||||
|
* spu描述
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "商品描述不能为空",groups = {AddGroup.class})
|
||||||
|
@Size(message = "商品描述长度在 1 到 200 之间",groups = {AddGroup.class},max = 200)
|
||||||
|
private String spuDescription;
|
||||||
|
/**
|
||||||
|
* 三级分类id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "三级分类不能为空",groups = {AddGroup.class})
|
||||||
|
private Long catalogId;
|
||||||
|
/**
|
||||||
|
* 品牌id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "品牌不能为空",groups = {AddGroup.class})
|
||||||
|
private Long brandId;
|
||||||
|
/**
|
||||||
|
* 重量
|
||||||
|
*/
|
||||||
|
@NotNull(message = "商品重量不能为空",groups = {AddGroup.class})
|
||||||
|
private BigDecimal weight;
|
||||||
|
/**
|
||||||
|
* 发布状态
|
||||||
|
*/
|
||||||
|
private Integer publishStatus;
|
||||||
|
/**
|
||||||
|
* 图集描述
|
||||||
|
*/
|
||||||
|
private List<String> decript;
|
||||||
|
/**
|
||||||
|
* 图集
|
||||||
|
*/
|
||||||
|
private List<String> images;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
private Bounds bounds;
|
||||||
|
/**
|
||||||
|
* 基本属性
|
||||||
|
*/
|
||||||
|
@Valid
|
||||||
|
private List<BaseAttrs> baseAttrs;
|
||||||
|
/**
|
||||||
|
* sku
|
||||||
|
*/
|
||||||
|
@Valid
|
||||||
|
private List<Skus> skus;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -3,7 +3,7 @@ package com.xjs.mall.ware.controller;
|
||||||
import com.xjs.mall.ware.entity.PurchaseEntity;
|
import com.xjs.mall.ware.entity.PurchaseEntity;
|
||||||
import com.xjs.mall.ware.service.PurchaseService;
|
import com.xjs.mall.ware.service.PurchaseService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.xjs.mall.ware.controller;
|
||||||
import com.xjs.mall.ware.entity.PurchaseDetailEntity;
|
import com.xjs.mall.ware.entity.PurchaseDetailEntity;
|
||||||
import com.xjs.mall.ware.service.PurchaseDetailService;
|
import com.xjs.mall.ware.service.PurchaseDetailService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.xjs.mall.ware.controller;
|
||||||
import com.xjs.mall.ware.entity.WareInfoEntity;
|
import com.xjs.mall.ware.entity.WareInfoEntity;
|
||||||
import com.xjs.mall.ware.service.WareInfoService;
|
import com.xjs.mall.ware.service.WareInfoService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.xjs.mall.ware.controller;
|
||||||
import com.xjs.mall.ware.entity.WareOrderTaskEntity;
|
import com.xjs.mall.ware.entity.WareOrderTaskEntity;
|
||||||
import com.xjs.mall.ware.service.WareOrderTaskService;
|
import com.xjs.mall.ware.service.WareOrderTaskService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.xjs.mall.ware.controller;
|
||||||
import com.xjs.mall.ware.entity.WareOrderTaskDetailEntity;
|
import com.xjs.mall.ware.entity.WareOrderTaskDetailEntity;
|
||||||
import com.xjs.mall.ware.service.WareOrderTaskDetailService;
|
import com.xjs.mall.ware.service.WareOrderTaskDetailService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ package com.xjs.mall.ware.controller;
|
||||||
import com.xjs.mall.ware.entity.WareSkuEntity;
|
import com.xjs.mall.ware.entity.WareSkuEntity;
|
||||||
import com.xjs.mall.ware.service.WareSkuService;
|
import com.xjs.mall.ware.service.WareSkuService;
|
||||||
import com.xjs.utils.PageUtils;
|
import com.xjs.utils.PageUtils;
|
||||||
import com.xjs.utils.R;
|
import com.xjs.mall.other.R;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue