├── SecondStore_前端 └── secondstore │ ├── .browserslistrc │ ├── babel.config.js │ ├── postcss.config.js │ ├── src │ ├── api │ │ ├── shop.js │ │ └── login.js │ ├── assets │ │ ├── img1.jpg │ │ ├── img2.jpg │ │ ├── img3.jpg │ │ ├── img4.jpg │ │ ├── img5.jpg │ │ └── logo.png │ ├── request │ │ ├── myserver.js │ │ └── server.js │ ├── components │ │ ├── CommodityIntroduction.vue │ │ ├── CommodityQA.vue │ │ ├── CommodityCommentListItem.vue │ │ ├── HeaderCategory.vue │ │ ├── Header.vue │ │ ├── HomeScrollPic.vue │ │ ├── HeaderCart.vue │ │ ├── HeaderSearch.vue │ │ ├── CommodityList.vue │ │ ├── AddSubtractButton.vue │ │ ├── CommodityTabComponent.vue │ │ ├── CommoditySort.vue │ │ ├── Navigation.vue │ │ ├── CommodityCommentList.vue │ │ ├── CommodityCard.vue │ │ ├── UserLogin.vue │ │ └── Dialog.vue │ ├── store │ │ ├── modules │ │ │ ├── user.js │ │ │ └── cart.js │ │ └── store.js │ ├── views │ │ ├── Home.vue │ │ ├── HomePage.vue │ │ ├── admin │ │ │ ├── CommodityAudit.vue │ │ │ ├── BargainManagement.vue │ │ │ ├── AdminHome.vue │ │ │ ├── SellRateManagement.vue │ │ │ ├── RechargeManagement.vue │ │ │ └── UserAudit.vue │ │ ├── Account.vue │ │ ├── sell │ │ │ ├── SellInfo.vue │ │ │ ├── SellHome.vue │ │ │ ├── Shop.vue │ │ │ └── SellOrder.vue │ │ ├── Checkout.vue │ │ ├── ShoppingCart.vue │ │ └── Commodity.vue │ ├── main.js │ ├── utils │ │ └── filters.js │ ├── App.vue │ ├── plugin │ │ ├── MessageBox.vue │ │ └── vue-msgbox.js │ └── router │ │ └── router.js │ ├── public │ ├── favicon.ico │ └── index.html │ ├── .gitignore │ ├── README.md │ ├── .eslintrc.js │ ├── vue.config.js │ └── package.json └── SecondStore_后端 └── SecondStore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java ├── src ├── test │ └── java │ │ └── com │ │ └── example │ │ └── demo │ │ └── DemoApplicationTests.java └── main │ ├── java │ └── com │ │ └── example │ │ └── SecondStore │ │ ├── entity │ │ ├── vo │ │ │ ├── OrdersInfo.java │ │ │ ├── CommodityEvaluationInfo.java │ │ │ └── ShoppingInfo.java │ │ ├── Kind.java │ │ ├── Rate.java │ │ ├── Administrator.java │ │ ├── CommodityPhoto.java │ │ ├── Shop.java │ │ ├── ShoppingCart.java │ │ ├── ShopEvaluation.java │ │ ├── CommodityEvaluation.java │ │ ├── MiddleCount.java │ │ ├── User.java │ │ ├── Sell.java │ │ ├── Orders.java │ │ └── Commodity.java │ │ ├── service │ │ ├── ShopService.java │ │ ├── KindService.java │ │ ├── RateService.java │ │ ├── MiddleCountService.java │ │ ├── SellService.java │ │ ├── UserService.java │ │ ├── AdministratorService.java │ │ ├── CommodityPhotoService.java │ │ ├── ShopEvaluationService.java │ │ ├── OrderService.java │ │ ├── CommodityService.java │ │ ├── impl │ │ │ ├── ShopServiceImpl.java │ │ │ ├── RateServiceImpl.java │ │ │ ├── KindServiceImpl.java │ │ │ ├── OrderServiceImpl.java │ │ │ ├── MiddleCountServiceImpl.java │ │ │ ├── CommodityPhotoServiceImpl.java │ │ │ ├── ShopEvaluationServiceImpl.java │ │ │ ├── AdministratorServiceImpl.java │ │ │ ├── SellServiceImpl.java │ │ │ ├── UserServiceImpl.java │ │ │ ├── CommodityEvaluationServiceImpl.java │ │ │ ├── CommodityServiceImpl.java │ │ │ └── ShoppingCartServiceImpl.java │ │ ├── ShoppingCartService.java │ │ └── CommodityEvaluationService.java │ │ ├── dao │ │ ├── RateDao.java │ │ ├── KindDao.java │ │ ├── SellDao.java │ │ ├── ShopDao.java │ │ ├── UserDao.java │ │ ├── CommodityDao.java │ │ ├── MiddleCountDao.java │ │ ├── AdministratorDao.java │ │ ├── CommodityPhotoDao.java │ │ ├── ShopEvaluationDao.java │ │ ├── OrderDao.java │ │ ├── ShoppingCartDao.java │ │ └── CommodityEvaluationDao.java │ │ ├── SecondStoreApplication.java │ │ ├── config │ │ ├── WebSocketConfig.java │ │ ├── MyInterceptorConfig.java │ │ └── MybatisPlusConfig.java │ │ ├── util │ │ └── Util.java │ │ ├── controller │ │ ├── KindController.java │ │ ├── ShopController.java │ │ ├── AdministratorController.java │ │ ├── ShopEvaluationController.java │ │ ├── CommodityEvaluationController.java │ │ ├── CommodityPhotoController.java │ │ ├── UserController.java │ │ ├── CommodityController.java │ │ ├── OrderController.java │ │ ├── SellController.java │ │ └── ShoppingCartController.java │ │ └── task │ │ └── MiddleCountTask.java │ └── resources │ └── application.yml ├── .gitignore └── pom.xml /SecondStore_前端/secondstore/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | autoprefixer: {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/api/shop.js: -------------------------------------------------------------------------------- 1 | export default { 2 | shopList: { url: "/shoplist", type: "get" }, 3 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/public/favicon.ico -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/assets/img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/src/assets/img1.jpg -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/assets/img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/src/assets/img2.jpg -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/assets/img3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/src/assets/img3.jpg -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/assets/img4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/src/assets/img4.jpg -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/assets/img5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/src/assets/img5.jpg -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_前端/secondstore/src/assets/logo.png -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/request/myserver.js: -------------------------------------------------------------------------------- 1 | import server from './server' 2 | 3 | function myserver(){ 4 | this.server = server; 5 | } 6 | 7 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/api/login.js: -------------------------------------------------------------------------------- 1 | export default { 2 | loginIn: { url: "/login", type: "post" }, 3 | loginOut: { url: "/loginOut", type: "post" } 4 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MrW1108/SecondStore/HEAD/SecondStore_后端/SecondStore/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/test/java/com/example/demo/DemoApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.example.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DemoApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/request/server.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | 3 | let server = axios.create({ 4 | baseURL: "/api", 5 | timeout: "5000" 6 | }) 7 | 8 | //请求拦截 9 | // server.interceptors.request.use(config => {}) 10 | 11 | 12 | //响应拦截 13 | // server.interceptors.response.use(config =>{}) 14 | 15 | 16 | export default server; 17 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/vo/OrdersInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity.vo; 2 | 3 | import com.example.SecondStore.entity.Orders; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | @EqualsAndHashCode(callSuper = true) 8 | @Data 9 | public class OrdersInfo extends Orders { 10 | private Integer level; 11 | } 12 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/ShopService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.Shop; 5 | 6 | /** 7 | * 店铺(Shop)表服务接口 8 | * 9 | * @author bwmgd 10 | * @since 2021-04-25 09:50:11 11 | */ 12 | public interface ShopService extends IService { 13 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/KindService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.Kind; 5 | 6 | /** 7 | * 类别(Kind)表服务接口 8 | * 9 | * @author bwmgd 10 | * @since 2021-04-25 09:50:11 11 | */ 12 | public interface KindService extends IService { 13 | 14 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/RateService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.Rate; 5 | 6 | /** 7 | * (Rate)表服务接口 8 | * 9 | * @author bwmgd 10 | * @since 2021-05-14 14:14:12 11 | */ 12 | public interface RateService extends IService { 13 | 14 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/README.md: -------------------------------------------------------------------------------- 1 | # secondstore 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | npm run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | npm run lint 26 | ``` 27 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityIntroduction.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 19 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/essential', 8 | 'eslint:recommended' 9 | ], 10 | rules: { 11 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 12 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 13 | }, 14 | parserOptions: { 15 | parser: 'babel-eslint' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/RateDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.Rate; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * (Rate)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-05-14 14:14:12 12 | */ 13 | @Mapper 14 | public interface RateDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/vo/CommodityEvaluationInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity.vo; 2 | 3 | import com.example.SecondStore.entity.CommodityEvaluation; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | @EqualsAndHashCode(callSuper = true) 8 | @Data 9 | public class CommodityEvaluationInfo extends CommodityEvaluation { 10 | private String name; //userName 11 | } 12 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8084 3 | 4 | spring: 5 | datasource: 6 | username: root 7 | password: wjz1108 8 | url: jdbc:mysql://localhost:3306/2018011322?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC 9 | driver-class-name: com.mysql.cj.jdbc.Driver 10 | servlet: 11 | multipart: 12 | max-file-size: 10MB 13 | max-request-size: 100MB 14 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/KindDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.Kind; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 类别(Kind)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface KindDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/SellDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.Sell; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 商家(Sell)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface SellDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/ShopDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.Shop; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 店铺(Shop)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface ShopDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.User; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 普通用户(User)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface UserDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/SecondStoreApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SecondStoreApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SecondStoreApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/CommodityDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.Commodity; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 商品(Commodity)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface CommodityDao extends BaseMapper { 15 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityQA.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 29 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/MiddleCountDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.MiddleCount; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 中间用户(MiddleCount)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface MiddleCountDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/AdministratorDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.Administrator; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 管理员(Administrator)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface AdministratorDao extends BaseMapper { 15 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/CommodityPhotoDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.CommodityPhoto; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | * 商品图片(CommodityPhoto)表数据库访问层 9 | * 10 | * @author bwmgd 11 | * @since 2021-04-25 09:50:11 12 | */ 13 | @Mapper 14 | public interface CommodityPhotoDao extends BaseMapper { 15 | 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/MiddleCountService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.MiddleCount; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 中间用户(MiddleCount)表服务接口 10 | * 11 | * @author bwmgd 12 | * @since 2021-04-25 09:50:11 13 | */ 14 | public interface MiddleCountService extends IService { 15 | MiddleCount getMiddleCountByOrderId(Serializable orderId); 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/SellService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.Sell; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 商家(Sell)表服务接口 10 | * 11 | * @author bwmgd 12 | * @since 2021-04-25 09:50:11 13 | */ 14 | public interface SellService extends IService { 15 | Sell register(Serializable name); 16 | 17 | Sell login(Serializable name, Serializable password); 18 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.User; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 普通用户(User)表服务接口 10 | * 11 | * @author bwmgd 12 | * @since 2021-04-25 09:50:11 13 | */ 14 | public interface UserService extends IService { 15 | User register(Serializable name); 16 | 17 | User login(Serializable name, Serializable password); 18 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/AdministratorService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.Administrator; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * 管理员(Administrator)表服务接口 10 | * 11 | * @author bwmgd 12 | * @since 2021-04-25 09:50:11 13 | */ 14 | public interface AdministratorService extends IService { 15 | Administrator login(Serializable name, Serializable password); 16 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Kind.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 类别(Kind)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 10:55:25 13 | */ 14 | @Data 15 | public class Kind implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String name; 20 | 21 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/vo/ShoppingInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity.vo; 2 | 3 | import com.example.SecondStore.entity.ShoppingCart; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | @EqualsAndHashCode(callSuper = true) 8 | @Data 9 | public class ShoppingInfo extends ShoppingCart { 10 | private String name; 11 | private Integer shopId; 12 | private String shopName; 13 | private Double price; 14 | private Double discount; 15 | private Integer inventory; 16 | } 17 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Rate.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * (Rate)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-14 14:14:12 13 | */ 14 | @Data 15 | public class Rate implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | //百分比 20 | private Double rate; 21 | 22 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/CommodityPhotoService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.CommodityPhoto; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * 商品图片(CommodityPhoto)表服务接口 11 | * 12 | * @author bwmgd 13 | * @since 2021-04-25 09:50:11 14 | */ 15 | public interface CommodityPhotoService extends IService { 16 | List getPhotoByCommodityId(Serializable commodityId); 17 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | proxy: { 4 | // /api是后台数据接口的上下文路径 5 | '/api': { 6 | //这里的地址是后端数据接口的地址 7 | // http://bwmgd.club:25510/#/home 8 | // target: 'http://111.229.37.167/', 9 | target: 'http://localhost:8084/', 10 | //允许跨域 11 | changOrigin: true, 12 | pathRewrite: { 13 | '^/api': '' 14 | } 15 | } 16 | } 17 | }, 18 | productionSourceMap: process.env.NODE_ENV === 'production' ? false : true 19 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 6 | 7 | /** 8 | * 开启WebSocket支持 9 | * @author zhengkai.blog.csdn.net 10 | */ 11 | @Configuration 12 | public class WebSocketConfig { 13 | 14 | @Bean 15 | public ServerEndpointExporter serverEndpointExporter() { 16 | return new ServerEndpointExporter(); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/ShopEvaluationService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.ShopEvaluation; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * 店铺评价(ShopEvaluation)表服务接口 11 | * 12 | * @author bwmgd 13 | * @since 2021-04-25 09:50:11 14 | */ 15 | public interface ShopEvaluationService extends IService { 16 | List getEvaluationsByShopId(Serializable shopId); 17 | Double calculateScore(int shopId); 18 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Administrator.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 管理员(Administrator)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 10:55:25 13 | */ 14 | @Data 15 | public class Administrator implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String name; 20 | 21 | private String password; 22 | 23 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.example.SecondStore.entity.Orders; 6 | import com.example.SecondStore.entity.vo.OrdersInfo; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 订单(Order)表服务接口 12 | * 13 | * @author bwmgd 14 | * @since 2021-04-25 09:50:11 15 | */ 16 | public interface OrderService extends IService { 17 | IPage pageByStatus(IPage page, Serializable status); 18 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/CommodityService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.example.SecondStore.entity.Commodity; 5 | 6 | import java.io.Serializable; 7 | import java.util.List; 8 | 9 | /** 10 | * 商品(Commodity)表服务接口 11 | * 12 | * @author bwmgd 13 | * @since 2021-04-25 09:50:11 14 | */ 15 | public interface CommodityService extends IService { 16 | List getCommoditiesByShopId(Serializable shopId,Serializable status); 17 | List getCommoditiesByKindId(Serializable kindId); 18 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/CommodityPhoto.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 商品图片(CommodityPhoto)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 18:27:33 13 | */ 14 | @Data 15 | public class CommodityPhoto implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String photo; 20 | 21 | private Integer commodityId; 22 | 23 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | secondstore 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Shop.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 店铺(Shop)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 10:55:25 13 | */ 14 | @Data 15 | public class Shop implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String name; 20 | 21 | private Integer sellerId; 22 | 23 | private Double score; 24 | 25 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/store/modules/user.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | user:null, 3 | sell:null, 4 | admin:null 5 | } 6 | 7 | const mutations = { 8 | saveUser(state, user){ //更改用户状态信息 9 | state.user = user 10 | }, 11 | deleteUser(state){ 12 | state.user = null 13 | }, 14 | saveSell(state, sell){ 15 | state.sell = sell; 16 | }, 17 | deleteSell(state){ 18 | state.sell = null 19 | }, 20 | saveAdmin(state, admin){ 21 | state.admin = admin 22 | }, 23 | deleteAdmin(state){ 24 | state.admin = null 25 | } 26 | } 27 | export default{ 28 | namespaced: true, 29 | state, 30 | mutations 31 | } 32 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 20 | 21 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/ShopEvaluationDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.example.SecondStore.entity.ShopEvaluation; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.apache.ibatis.annotations.Select; 7 | 8 | /** 9 | * 店铺评价(ShopEvaluation)表数据库访问层 10 | * 11 | * @author bwmgd 12 | * @since 2021-04-25 09:50:11 13 | */ 14 | @Mapper 15 | public interface ShopEvaluationDao extends BaseMapper { 16 | @Select("select avg(score) from shop_evaluation where shop_id = #{shopId}") 17 | Double calculateScore(int shopId); 18 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/ShopServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.example.SecondStore.dao.ShopDao; 5 | import com.example.SecondStore.entity.Shop; 6 | import com.example.SecondStore.service.ShopService; 7 | import org.springframework.stereotype.Service; 8 | import lombok.extern.slf4j.Slf4j; 9 | 10 | /** 11 | * 店铺(Shop)表服务实现类 12 | * 13 | * @author bwmgd 14 | * @since 2021-04-25 09:50:11 15 | */ 16 | @Slf4j 17 | @Service("shopService") 18 | public class ShopServiceImpl extends ServiceImpl implements ShopService { 19 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/HomePage.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 20 | 21 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/ShoppingCart.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 购物车(ShoppingCart)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 10:55:25 13 | */ 14 | @Data 15 | public class ShoppingCart implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private Integer commodityId; 20 | 21 | private Integer quantity; 22 | 23 | private Integer userId; 24 | 25 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/RateServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.example.SecondStore.dao.RateDao; 5 | import com.example.SecondStore.entity.Rate; 6 | import com.example.SecondStore.service.RateService; 7 | import org.springframework.stereotype.Service; 8 | import lombok.extern.slf4j.Slf4j; 9 | 10 | /** 11 | * (Rate)表服务实现类 12 | * 13 | * @author bwmgd 14 | * @since 2021-05-14 14:14:12 15 | */ 16 | @Slf4j 17 | @Service("rateService") 18 | public class RateServiceImpl extends ServiceImpl implements RateService { 19 | 20 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/KindServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.example.SecondStore.dao.KindDao; 5 | import com.example.SecondStore.entity.Kind; 6 | import com.example.SecondStore.service.KindService; 7 | import org.springframework.stereotype.Service; 8 | import lombok.extern.slf4j.Slf4j; 9 | 10 | /** 11 | * 类别(Kind)表服务实现类 12 | * 13 | * @author bwmgd 14 | * @since 2021-04-25 09:50:11 15 | */ 16 | @Slf4j 17 | @Service("kindService") 18 | public class KindServiceImpl extends ServiceImpl implements KindService { 19 | 20 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/ShopEvaluation.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 店铺评价(ShopEvaluation)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 13:28:12 13 | */ 14 | @Data 15 | public class ShopEvaluation implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String evaluation; 20 | 21 | private Integer shopId; 22 | 23 | //0~5星级 24 | private Integer score; 25 | 26 | private Integer userId; 27 | 28 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/ShoppingCartService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.example.SecondStore.entity.ShoppingCart; 6 | import com.example.SecondStore.entity.vo.ShoppingInfo; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 购物车(ShoppingCart)表服务接口 12 | * 13 | * @author bwmgd 14 | * @since 2021-04-25 09:50:11 15 | */ 16 | public interface ShoppingCartService extends IService { 17 | 18 | ShoppingCart getShoppingCartByCommodityId(ShoppingCart shopCraft); 19 | 20 | IPage page(IPage page, Serializable userId); 21 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/admin/CommodityAudit.vue: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/CommodityEvaluation.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 商品评价(CommodityEvaluation)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 10:55:25 13 | */ 14 | @Data 15 | public class CommodityEvaluation implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String evaluation; 20 | 21 | private Integer commodityId; 22 | 23 | //0~5星级 24 | private Integer score; 25 | 26 | private Integer userId; 27 | 28 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/config/MyInterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 6 | 7 | @Configuration 8 | public class MyInterceptorConfig extends WebMvcConfigurationSupport { 9 | private String UPLOAD_FOLDER = "C:\\Users\\Administrator\\Desktop\\软件开发实践\\img"; 10 | 11 | @Override 12 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 13 | registry.addResourceHandler("/img/**").addResourceLocations("file:" + UPLOAD_FOLDER + "/"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router/router' 4 | import store from './store/store' 5 | import ElementUI from 'element-ui'; 6 | import 'element-ui/lib/theme-chalk/index.css'; 7 | import VueAxios from 'vue-axios' //安装插件 8 | import axios from 'axios'; 9 | import msgBox from './plugin/vue-msgbox' 10 | import { currency, factPrice } from './utils/filters' 11 | 12 | Vue.config.productionTip = false 13 | Vue.use(ElementUI) 14 | Vue.use(msgBox) 15 | Vue.use(VueAxios, axios) 16 | axios.defaults.baseURL = "/api" 17 | Vue.prototype.HOST = "/api" 18 | Vue.filter('currency', currency) 19 | Vue.filter('factPrice', factPrice) 20 | 21 | new Vue({ 22 | router, 23 | store, 24 | render: h => h(App) 25 | }).$mount('#app') 26 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.config; 2 | 3 | import com.baomidou.mybatisplus.annotation.DbType; 4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; 5 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | @Configuration 10 | public class MybatisPlusConfig { 11 | 12 | @Bean 13 | public MybatisPlusInterceptor mybatisPlusInterceptor() { 14 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); 15 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); 16 | return interceptor; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/CommodityEvaluationService.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.example.SecondStore.entity.CommodityEvaluation; 6 | import com.example.SecondStore.entity.vo.CommodityEvaluationInfo; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * 商品评价(CommodityEvaluation)表服务接口 12 | * 13 | * @author bwmgd 14 | * @since 2021-04-25 09:50:11 15 | */ 16 | public interface CommodityEvaluationService extends IService { 17 | Double calculateScore(int commodityId); 18 | Integer evaluationCount(int commodityId); 19 | IPage getEvaluationById(IPage page, Serializable commodityId); 20 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/OrderDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.example.SecondStore.entity.Orders; 6 | import com.example.SecondStore.entity.vo.OrdersInfo; 7 | import org.apache.ibatis.annotations.Mapper; 8 | import org.apache.ibatis.annotations.Select; 9 | 10 | import java.io.Serializable; 11 | import java.util.List; 12 | 13 | /** 14 | * 订单(Order)表数据库访问层 15 | * 16 | * @author bwmgd 17 | * @since 2021-04-25 09:50:11 18 | */ 19 | @Mapper 20 | public interface OrderDao extends BaseMapper { 21 | @Select("select * from orders o join sell s on o.shop_id = s.id where o.status = #{status}") 22 | List getOrdersByStatus(IPage page, Serializable status); 23 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "secondstore", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "axios": "^0.21.1", 12 | "axios-mock-adapter": "^1.19.0", 13 | "core-js": "^2.6.5", 14 | "element-ui": "^2.15.1", 15 | "mockjs": "^1.1.0", 16 | "vue": "^2.6.10", 17 | "vue-axios": "^3.2.4", 18 | "vue-router": "^3.0.3", 19 | "vuex": "^3.0.1" 20 | }, 21 | "devDependencies": { 22 | "@vue/cli-plugin-babel": "^3.0.4", 23 | "@vue/cli-plugin-eslint": "^3.0.4", 24 | "@vue/cli-service": "^3.0.4", 25 | "babel-eslint": "^10.0.1", 26 | "eslint": "^5.16.0", 27 | "eslint-plugin-vue": "^5.0.0", 28 | "vue-template-compiler": "^2.6.10" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/MiddleCount.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.util.Date; 4 | import java.io.Serializable; 5 | 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import lombok.Data; 8 | import com.baomidou.mybatisplus.annotation.TableId; 9 | import com.baomidou.mybatisplus.annotation.IdType; 10 | 11 | /** 12 | * 中间用户(MiddleCount)表实体类 13 | * 14 | * @author bwmgd 15 | * @since 2021-05-11 10:55:25 16 | */ 17 | @Data 18 | public class MiddleCount implements Serializable { 19 | @TableId(value="id",type= IdType.AUTO) 20 | private Integer id; 21 | 22 | private Integer userId; 23 | 24 | private Integer sellerId; 25 | 26 | private Integer orderId; 27 | 28 | private Double amount; 29 | 30 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 31 | private Date creatTime; 32 | 33 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/ShoppingCartDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.example.SecondStore.entity.ShoppingCart; 6 | import com.example.SecondStore.entity.vo.ShoppingInfo; 7 | import org.apache.ibatis.annotations.Mapper; 8 | import org.apache.ibatis.annotations.Select; 9 | 10 | import java.io.Serializable; 11 | import java.util.List; 12 | 13 | /** 14 | * 购物车(ShoppingCart)表数据库访问层 15 | * 16 | * @author bwmgd 17 | * @since 2021-04-25 09:50:11 18 | */ 19 | @Mapper 20 | public interface ShoppingCartDao extends BaseMapper { 21 | @Select("select * from shopping_cart s join commodity c on c.id = s.commodity_id where s.user_id = #{userId}") 22 | List getShoppingCartByUserId(IPage page, Serializable userId); 23 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 普通用户(User)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 10:55:25 13 | */ 14 | @Data 15 | public class User implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String name; 20 | 21 | private String phone; 22 | 23 | private String email; 24 | 25 | private String city; 26 | 27 | //0:男,1:女 28 | private Integer sex; 29 | 30 | private String card; 31 | 32 | private String password; 33 | 34 | //0:待审核,1:正常,2:审核失败 35 | private Integer status; 36 | 37 | private Double wallet; 38 | 39 | private Double points; 40 | 41 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Sell.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 商家(Sell)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 18:27:33 13 | */ 14 | @Data 15 | public class Sell implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String name; 20 | 21 | private String phone; 22 | 23 | //0:男,1:女 24 | private Integer sex; 25 | 26 | private String card; 27 | 28 | private String password; 29 | 30 | //0:待审核,1:正常,2:审核失败 31 | private Integer status; 32 | 33 | private Double wallet; 34 | 35 | private String idCardUp; 36 | 37 | private String idCardBack; 38 | 39 | private String license; 40 | 41 | //level 42 | private Integer level; 43 | 44 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.example.SecondStore.dao.OrderDao; 6 | import com.example.SecondStore.entity.Orders; 7 | import com.example.SecondStore.service.OrderService; 8 | import com.example.SecondStore.entity.vo.OrdersInfo; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | * 订单(Order)表服务实现类 16 | * 17 | * @author bwmgd 18 | * @since 2021-04-25 09:50:11 19 | */ 20 | @Slf4j 21 | @Service("orderService") 22 | public class OrderServiceImpl extends ServiceImpl implements OrderService { 23 | @Override 24 | public IPage pageByStatus(IPage page, Serializable status) { 25 | return page.setRecords(this.baseMapper.getOrdersByStatus(page, status)); 26 | } 27 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityCommentListItem.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 31 | 32 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/MiddleCountServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.example.SecondStore.dao.MiddleCountDao; 6 | import com.example.SecondStore.entity.MiddleCount; 7 | import com.example.SecondStore.service.MiddleCountService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.io.Serializable; 12 | 13 | /** 14 | * 中间用户(MiddleCount)表服务实现类 15 | * 16 | * @author bwmgd 17 | * @since 2021-04-25 09:50:11 18 | */ 19 | @Slf4j 20 | @Service("middleCountService") 21 | public class MiddleCountServiceImpl extends ServiceImpl implements MiddleCountService { 22 | 23 | @Override 24 | public MiddleCount getMiddleCountByOrderId(Serializable orderId) { 25 | return getOne(new LambdaQueryWrapper().eq(MiddleCount::getOrderId, orderId)); 26 | } 27 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/util/Util.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.web.multipart.MultipartFile; 5 | 6 | import java.io.File; 7 | import java.io.IOException; 8 | import java.util.UUID; 9 | 10 | @Slf4j 11 | public class Util { 12 | public final static String IMAGE_PATH = 13 | "C:\\Users\\Administrator\\Desktop\\软件开发实践\\img\\"; 14 | 15 | public static String SaveImage(MultipartFile file) throws IOException { 16 | //获取上传文件名,包含后缀 17 | String originalFilename = file.getOriginalFilename(); 18 | //获取后缀 19 | assert originalFilename != null; 20 | String substring = originalFilename.substring(originalFilename.lastIndexOf(".")); 21 | //保存的文件名 22 | UUID uuid = UUID.randomUUID(); 23 | String dFileName = uuid + substring; 24 | //生成保存文件 25 | File uploadFile = new File(IMAGE_PATH + dFileName); 26 | //将上传文件保存到路径 27 | file.transferTo(uploadFile); 28 | return "/img/" + dFileName; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/CommodityPhotoServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.example.SecondStore.dao.CommodityPhotoDao; 6 | import com.example.SecondStore.entity.CommodityPhoto; 7 | import com.example.SecondStore.service.CommodityPhotoService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.io.Serializable; 12 | import java.util.List; 13 | 14 | /** 15 | * 商品图片(CommodityPhoto)表服务实现类 16 | * 17 | * @author bwmgd 18 | * @since 2021-04-25 09:50:11 19 | */ 20 | @Slf4j 21 | @Service("commodityPhotoService") 22 | public class CommodityPhotoServiceImpl extends ServiceImpl implements CommodityPhotoService { 23 | 24 | @Override 25 | public List getPhotoByCommodityId(Serializable commodityId) { 26 | return list(new LambdaQueryWrapper().eq(CommodityPhoto::getCommodityId, commodityId)); 27 | } 28 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Orders.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.util.Date; 4 | import java.io.Serializable; 5 | 6 | import com.fasterxml.jackson.annotation.JsonFormat; 7 | import lombok.Data; 8 | import com.baomidou.mybatisplus.annotation.TableId; 9 | import com.baomidou.mybatisplus.annotation.IdType; 10 | 11 | /** 12 | * 订单(Order)表实体类 13 | * 14 | * @author bwmgd 15 | * @since 2021-05-11 10:55:25 16 | */ 17 | @Data 18 | public class Orders implements Serializable { 19 | @TableId(value="id",type= IdType.AUTO) 20 | private Integer id; 21 | 22 | private Integer commodityId; 23 | 24 | private Integer quantity; 25 | 26 | private Double amount; 27 | 28 | private Integer userId; 29 | 30 | private Integer shopId; 31 | 32 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 33 | private Date creatTime; 34 | 35 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 36 | private Date endTime; 37 | 38 | //0:待支付,1:取消支付,2:等待发货,3:运输中,4:已收货,5:退货审核中,6:已退货,7:拒绝退货,8:已完成 39 | private Integer status; 40 | 41 | //0:能退货,1:不能退货 42 | private Integer canReturn; 43 | 44 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/utils/filters.js: -------------------------------------------------------------------------------- 1 | const digitsRE = /(\d{3})(?=\d)/g 2 | 3 | export function factPrice(value, discount){ 4 | value = parseFloat(value); 5 | discount = parseFloat(discount); 6 | if(!discount) return value 7 | return value * discount; 8 | } 9 | 10 | export function currency (value, currency, decimals) { 11 | value = parseFloat(value) 12 | if (!isFinite(value) || (!value && value !== 0)) return '' 13 | currency = currency != null ? currency : '¥' 14 | decimals = decimals != null ? decimals : 2 15 | var stringified = Math.abs(value).toFixed(decimals) 16 | var _int = decimals 17 | ? stringified.slice(0, -1 - decimals) 18 | : stringified 19 | var i = _int.length % 3 20 | var head = i > 0 21 | ? (_int.slice(0, i) + (_int.length > 3 ? ',' : '')) 22 | : '' 23 | var _float = decimals 24 | ? stringified.slice(-1 - decimals) 25 | : '' 26 | var sign = value < 0 ? '-' : '' 27 | return sign + currency + head + 28 | _int.slice(i).replace(digitsRE, '$1,') + 29 | _float 30 | } 31 | 32 | 33 | 34 | export function formatTime(value){ 35 | return value.toLocaleString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''); 36 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/store/store.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import user from './modules/user' 4 | import cart from './modules/cart' 5 | Vue.use(Vuex) 6 | 7 | export default new Vuex.Store({ 8 | state: { 9 | waitCheck:[],//商家待审核商品列表 10 | soldOut:[],//商家已下架商品列表 11 | evaluation:[], //单个商品的评论 12 | }, 13 | mutations: { 14 | //商家待审核商品列表 15 | getWaitCheck(state, list){ 16 | state.waitCheck = list; 17 | }, 18 | addWaitCheck(state, value){ 19 | state.waitCheck.unshift(value); 20 | }, 21 | deleteWaitCheck(state, index){ 22 | state.waitCheck.splice(index, 1); 23 | }, 24 | 25 | //商家已下架商品列表 26 | getSoldOut(state, list){ 27 | state.soldOut = list; 28 | }, 29 | addSoldOut(state, value){ 30 | state.soldOut.unshift(value); 31 | }, 32 | deleteSoldOut(state, index){ 33 | state.soldOut.splice(index, 1); 34 | }, 35 | 36 | //单个商品的评论 37 | getEvaluation(state,list){ 38 | state.evaluation = list; 39 | }, 40 | addEvaluation(state, value){ 41 | state.evaluation.unshift(value); 42 | }, 43 | }, 44 | actions: { 45 | 46 | }, 47 | modules: { 48 | user, 49 | cart 50 | } 51 | }) 52 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/entity/Commodity.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.entity; 2 | 3 | import java.io.Serializable; 4 | import lombok.Data; 5 | import com.baomidou.mybatisplus.annotation.TableId; 6 | import com.baomidou.mybatisplus.annotation.IdType; 7 | 8 | /** 9 | * 商品(Commodity)表实体类 10 | * 11 | * @author bwmgd 12 | * @since 2021-05-11 18:44:15 13 | */ 14 | @Data 15 | public class Commodity implements Serializable { 16 | @TableId(value="id",type= IdType.AUTO) 17 | private Integer id; 18 | 19 | private String name; 20 | 21 | private Integer shopId; 22 | 23 | private String shopName; 24 | 25 | private String photoOne; 26 | 27 | private Integer inventory; 28 | 29 | private Integer kindId; 30 | 31 | private Double price; 32 | 33 | private Integer degree; 34 | 35 | private Double discount; 36 | 37 | //0:不许议价,1:准许议价 38 | private Integer bargain; 39 | 40 | private String size; 41 | 42 | private String instruction; 43 | 44 | //0:待审核,1:发布,2:锁定,3:下架 45 | private Integer status; 46 | 47 | //平均分数(5分制) 48 | private Double score; 49 | 50 | private Integer evaluationCount; 51 | 52 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/HeaderCategory.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 31 | 32 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/ShopEvaluationServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.example.SecondStore.dao.ShopEvaluationDao; 6 | import com.example.SecondStore.entity.ShopEvaluation; 7 | import com.example.SecondStore.service.ShopEvaluationService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Service; 10 | 11 | import java.io.Serializable; 12 | import java.util.List; 13 | 14 | /** 15 | * 店铺评价(ShopEvaluation)表服务实现类 16 | * 17 | * @author bwmgd 18 | * @since 2021-04-25 09:50:11 19 | */ 20 | @Slf4j 21 | @Service("shopEvaluationService") 22 | public class ShopEvaluationServiceImpl extends ServiceImpl implements ShopEvaluationService { 23 | 24 | @Override 25 | public List getEvaluationsByShopId(Serializable shopId) { 26 | return list(new LambdaQueryWrapper().eq(ShopEvaluation::getShopId, shopId)); 27 | } 28 | 29 | @Override 30 | public Double calculateScore(int shopId) { 31 | return baseMapper.calculateScore(shopId); 32 | } 33 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/KindController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.api.ApiController; 5 | import com.baomidou.mybatisplus.extension.api.R; 6 | import com.example.SecondStore.entity.Kind; 7 | import com.example.SecondStore.service.KindService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | /** 13 | * 类别(Kind)表控制层 14 | * 15 | * @author bwmgd 16 | * @since 2021-04-25 09:50:11 17 | */ 18 | @Slf4j 19 | @RestController 20 | @RequestMapping("kind") 21 | public class KindController extends ApiController { 22 | /** 23 | * 服务对象 24 | */ 25 | @Autowired 26 | private KindService kindService; 27 | 28 | /** 29 | * 分页查询所有数据 30 | * 31 | * @return 所有数据 32 | */ 33 | @GetMapping 34 | public R selectAll() { 35 | return success(this.kindService.list()); 36 | } 37 | 38 | /** 39 | * 新增数据 40 | * 41 | * @param kind 实体对象 42 | * @return 新增结果 43 | */ 44 | @PostMapping 45 | public R insert(@RequestBody Kind kind) { 46 | return success(this.kindService.save(kind)); 47 | } 48 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/Header.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 25 | 26 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/dao/CommodityEvaluationDao.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.example.SecondStore.entity.CommodityEvaluation; 6 | import com.example.SecondStore.entity.vo.CommodityEvaluationInfo; 7 | import org.apache.ibatis.annotations.Mapper; 8 | import org.apache.ibatis.annotations.Select; 9 | 10 | import java.io.Serializable; 11 | import java.util.List; 12 | 13 | /** 14 | * 商品评价(CommodityEvaluation)表数据库访问层 15 | * 16 | * @author bwmgd 17 | * @since 2021-04-25 09:50:11 18 | */ 19 | @Mapper 20 | public interface CommodityEvaluationDao extends BaseMapper { 21 | @Select("select avg(score) from commodity_evaluation where commodity_id = #{commodityId}") 22 | Double calculateScore(int commodityId); 23 | 24 | @Select("select count(*) from commodity_evaluation where commodity_id = #{commodityId}") 25 | Integer evaluationCount(int commodityId); 26 | 27 | @Select("select * from commodity_evaluation c join user u on c.user_id = u.id where c.commodity_id = #{commodityId}") 28 | List getCommodityEvaluationById(IPage page, Serializable commodityId); 29 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/Account.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 40 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/HomeScrollPic.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 25 | 26 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/sell/SellInfo.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 41 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/AdministratorServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.example.SecondStore.dao.AdministratorDao; 7 | import com.example.SecondStore.entity.Administrator; 8 | import com.example.SecondStore.service.AdministratorService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.Serializable; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | /** 17 | * 管理员(Administrator)表服务实现类 18 | * 19 | * @author bwmgd 20 | * @since 2021-04-25 09:50:11 21 | */ 22 | @Slf4j 23 | @Service("administratorService") 24 | public class AdministratorServiceImpl extends ServiceImpl implements AdministratorService { 25 | @Override 26 | public Administrator login(Serializable name, Serializable password) { 27 | Map, Serializable> map = new HashMap<>(); 28 | map.put(Administrator::getName, name); 29 | map.put(Administrator::getPassword, password); 30 | return getOne(new LambdaQueryWrapper().allEq(map)); 31 | } 32 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/HeaderCart.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 27 | 28 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/ShopController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.api.ApiController; 5 | import com.baomidou.mybatisplus.extension.api.R; 6 | import com.example.SecondStore.entity.Shop; 7 | import com.example.SecondStore.service.ShopService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | * 店铺(Shop)表控制层 16 | * 17 | * @author bwmgd 18 | * @since 2021-04-25 09:50:11 19 | */ 20 | @Slf4j 21 | @RestController 22 | @RequestMapping("shop") 23 | public class ShopController extends ApiController { 24 | /** 25 | * 服务对象 26 | */ 27 | @Autowired 28 | private ShopService shopService; 29 | 30 | /** 31 | * 通过主键查询单条数据 32 | * 33 | * @param id 主键 34 | * @return 单条数据 35 | */ 36 | @GetMapping("/shopId{id}") 37 | public R selectOne(@PathVariable Serializable id) { 38 | return success(this.shopService.getById(id)); 39 | } 40 | 41 | /** 42 | * 新增数据 43 | * 44 | * @param shop 实体对象 45 | * @return 新增结果 46 | */ 47 | @PostMapping 48 | public R insert(@RequestBody Shop shop) { 49 | return success(this.shopService.save(shop)); 50 | } 51 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 31 | 32 | 46 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/SellServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.example.SecondStore.dao.SellDao; 7 | import com.example.SecondStore.entity.Sell; 8 | import com.example.SecondStore.service.SellService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.Serializable; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | /** 17 | * 商家(Sell)表服务实现类 18 | * 19 | * @author bwmgd 20 | * @since 2021-04-25 09:50:11 21 | */ 22 | @Slf4j 23 | @Service("sellService") 24 | public class SellServiceImpl extends ServiceImpl implements SellService { 25 | 26 | @Override 27 | public Sell register(Serializable name) { 28 | return getOne(new LambdaQueryWrapper().eq(Sell::getName, name)); 29 | } 30 | 31 | @Override 32 | public Sell login(Serializable name, Serializable password) { 33 | Map, Serializable> map = new HashMap<>(); 34 | map.put(Sell::getName, name); 35 | map.put(Sell::getPassword, password); 36 | return getOne(new LambdaQueryWrapper().allEq(map)); 37 | } 38 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.example.SecondStore.dao.UserDao; 7 | import com.example.SecondStore.entity.User; 8 | import com.example.SecondStore.service.UserService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.Serializable; 13 | import java.util.HashMap; 14 | import java.util.Map; 15 | 16 | /** 17 | * 普通用户(User)表服务实现类 18 | * 19 | * @author bwmgd 20 | * @since 2021-04-25 09:50:11 21 | */ 22 | @Slf4j 23 | @Service("userService") 24 | public class UserServiceImpl extends ServiceImpl implements UserService { 25 | 26 | @Override 27 | public User register(Serializable name) { 28 | return getOne(new LambdaQueryWrapper().eq(User::getName, name)); 29 | } 30 | 31 | @Override 32 | public User login(Serializable name, Serializable password) { 33 | Map, Serializable> map = new HashMap<>(); 34 | map.put(User::getName, name); 35 | map.put(User::getPassword, password); 36 | return getOne(new LambdaQueryWrapper().allEq(map)); 37 | } 38 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/plugin/MessageBox.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 24 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/HeaderSearch.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 34 | 35 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/CommodityEvaluationServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.example.SecondStore.dao.CommodityEvaluationDao; 6 | import com.example.SecondStore.entity.CommodityEvaluation; 7 | import com.example.SecondStore.entity.vo.CommodityEvaluationInfo; 8 | import com.example.SecondStore.service.CommodityEvaluationService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | * 商品评价(CommodityEvaluation)表服务实现类 16 | * 17 | * @author bwmgd 18 | * @since 2021-04-25 09:50:11 19 | */ 20 | @Slf4j 21 | @Service("commodityEvaluationService") 22 | public class CommodityEvaluationServiceImpl extends ServiceImpl implements CommodityEvaluationService { 23 | @Override 24 | public Double calculateScore(int commodityId) { 25 | return baseMapper.calculateScore(commodityId); 26 | } 27 | 28 | @Override 29 | public Integer evaluationCount(int commodityId) { 30 | return baseMapper.evaluationCount(commodityId); 31 | } 32 | 33 | @Override 34 | public IPage getEvaluationById(IPage page, Serializable commodityId) { 35 | return page.setRecords(this.baseMapper.getCommodityEvaluationById(page, commodityId)); 36 | } 37 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/plugin/vue-msgbox.js: -------------------------------------------------------------------------------- 1 | import MessageBox from './MessageBox' 2 | 3 | const msgBox = {}; 4 | 5 | msgBox.install = function(Vue){ 6 | Vue.prototype.$msgBox = msgBox; 7 | msgBox.show = (function(){ 8 | // 组件数据属性和事件响应函数的默认值 9 | let defaults = { 10 | title: '', 11 | ok: '确定', 12 | cancel: '', 13 | handleOk: function(){}, 14 | handleCancel: function(){} 15 | } 16 | 17 | let MessageBoxImpl = Vue.extend(MessageBox); 18 | // 调用msgBox.show函数时需要提供一个选项对象, 19 | // 用于初始化组件内的各个选项 20 | return function(opts){ //配置参数 21 | for(let attr in opts){ 22 | defaults[attr] = opts[attr]; 23 | } 24 | 25 | let vm = new MessageBoxImpl({ 26 | el: document.createElement("div"), // 创建一个组件挂载的根元素 27 | data() { 28 | return { 29 | title: defaults.title, 30 | ok: defaults.ok, 31 | cancel: defaults.cancel, 32 | } 33 | }, 34 | methods: { 35 | handleOk(){ 36 | defaults.handleOk.call(this); 37 | // 点击“确定”按钮时,从DOM中删除提示框组件 38 | document.body.removeChild(vm.$el); 39 | }, 40 | handleCancel(){ 41 | defaults.handleCancel.call(this); 42 | // 点击“取消”按钮时,从DOM中删除提示框组件 43 | document.body.removeChild(vm.$el); 44 | } 45 | } 46 | }); 47 | // 将组件绑定的根元素添加到HTML body元素内 48 | document.body.appendChild(vm.$el) 49 | } 50 | })(); 51 | 52 | } 53 | export default msgBox; 54 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityList.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 39 | 40 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/CommodityServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.example.SecondStore.dao.CommodityDao; 7 | import com.example.SecondStore.entity.Commodity; 8 | import com.example.SecondStore.service.CommodityService; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.io.Serializable; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | /** 18 | * 商品(Commodity)表服务实现类 19 | * 20 | * @author bwmgd 21 | * @since 2021-04-25 09:50:11 22 | */ 23 | @Slf4j 24 | @Service("commodityService") 25 | public class CommodityServiceImpl extends ServiceImpl implements CommodityService { 26 | 27 | @Override 28 | public List getCommoditiesByShopId(Serializable shopId, Serializable status) { 29 | Map, Serializable> map = new HashMap<>(); 30 | map.put(Commodity::getShopId, shopId); 31 | map.put(Commodity::getStatus, status); 32 | return list(new LambdaQueryWrapper().allEq(map)); 33 | } 34 | 35 | @Override 36 | public List getCommoditiesByKindId(Serializable kindId) { 37 | Map, Serializable> map = new HashMap<>(); 38 | map.put(Commodity::getKindId, kindId); 39 | map.put(Commodity::getStatus, 1); 40 | return list(new LambdaQueryWrapper().allEq(map)); 41 | } 42 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/service/impl/ShoppingCartServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.example.SecondStore.dao.ShoppingCartDao; 8 | import com.example.SecondStore.entity.ShoppingCart; 9 | import com.example.SecondStore.entity.vo.ShoppingInfo; 10 | import com.example.SecondStore.service.ShoppingCartService; 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.io.Serializable; 15 | import java.util.HashMap; 16 | import java.util.Map; 17 | 18 | /** 19 | * 购物车(ShoppingCart)表服务实现类 20 | * 21 | * @author bwmgd 22 | * @since 2021-04-25 09:50:11 23 | */ 24 | @Slf4j 25 | @Service("shoppingCartService") 26 | public class ShoppingCartServiceImpl extends ServiceImpl implements ShoppingCartService { 27 | @Override 28 | public ShoppingCart getShoppingCartByCommodityId(ShoppingCart shopCraft) { 29 | Map, Serializable> map = new HashMap<>(); 30 | map.put(ShoppingCart::getCommodityId, shopCraft.getCommodityId()); 31 | map.put(ShoppingCart::getUserId, shopCraft.getUserId()); 32 | return getOne(new LambdaQueryWrapper().allEq(map)); 33 | } 34 | 35 | @Override 36 | public IPage page(IPage page, Serializable userId) { 37 | return page.setRecords(this.baseMapper.getShoppingCartByUserId(page, userId)); 38 | } 39 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/store/modules/cart.js: -------------------------------------------------------------------------------- 1 | const state = { 2 | items: [], //购物车 3 | payItems:[],//要结算的商品 4 | } 5 | // mutations 6 | const mutations = { 7 | //获取购物车数据 8 | getItems(state,list){ 9 | state.items = list; 10 | }, 11 | // 添加商品到购物车中 12 | pushProductToCart(state, { id, commodityId, photoOne, name, price, quantity}) { 13 | if(! quantity) 14 | quantity = 1; 15 | state.items.push({ id, commodityId, photoOne, name, price, quantity }); 16 | }, 17 | // 增加商品数量 18 | incrementItemQuantity(state, { id, quantity }) { 19 | let cartItem = state.items.find(item => item.id == id); 20 | cartItem.quantity += quantity; 21 | }, 22 | //减少商品数量 23 | reduceItemQuantity(state, {id, quantity}){ 24 | let cartItem = state.items.find(item => item.id == id); 25 | cartItem.quantity -= quantity; 26 | }, 27 | // 用于清空购物车 28 | setCartItems(state) { 29 | state.items = [] 30 | }, 31 | // 删除购物车中的产品(可以多个) 32 | deleteCartItem(state, list){ 33 | console.log(list) 34 | for(let i=0; i item.id === list[i].id); 36 | if(index > -1) 37 | state.items.splice(index, 1); 38 | } 39 | }, 40 | 41 | //获得要结算的商品列表 42 | getPayItems(state, list){ 43 | state.payItems = list; 44 | } 45 | } 46 | 47 | 48 | const getters = { 49 | // 获取购物车中商品的数量 50 | itemsCount: (state) => { 51 | return state.items.length; 52 | }, 53 | 54 | //获得待结算的商品总价 55 | totalPrice: (state) => { 56 | return state.payItems.reduce((total, product) => { 57 | return total + product.price * product.discount * product.quantity 58 | },0).toFixed(2) 59 | } 60 | } 61 | 62 | export default { 63 | namespaced: true, 64 | state, 65 | mutations, 66 | getters, 67 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/AdministratorController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.api.ApiController; 5 | import com.baomidou.mybatisplus.extension.api.R; 6 | import com.example.SecondStore.entity.Administrator; 7 | import com.example.SecondStore.service.AdministratorService; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.io.Serializable; 13 | 14 | /** 15 | * 管理员(Administrator)表控制层 16 | * 17 | * @author bwmgd 18 | * @since 2021-04-25 09:50:11 19 | */ 20 | @Slf4j 21 | @RestController 22 | @RequestMapping("admin") 23 | public class AdministratorController extends ApiController { 24 | /** 25 | * 服务对象 26 | */ 27 | @Autowired 28 | private AdministratorService administratorService; 29 | 30 | /** 31 | * 通过主键查询单条数据 32 | * 33 | * @param id 主键 34 | * @return 单条数据 35 | */ 36 | @GetMapping("{id}") 37 | public R selectOne(@PathVariable Serializable id) { 38 | return success(this.administratorService.getById(id)); 39 | } 40 | 41 | 42 | /** 43 | * 新增数据 44 | * 45 | * @param administrator 实体对象 46 | * @return 新增结果 47 | */ 48 | @PostMapping 49 | public R insert(@RequestBody Administrator administrator) { 50 | return success(this.administratorService.save(administrator)); 51 | } 52 | 53 | @PostMapping("login") 54 | public R login(@RequestBody Administrator administrator) { 55 | if ((administrator = administratorService.login(administrator.getName(), administrator.getPassword())) != null) { 56 | return success(administrator); 57 | } 58 | return failed("用户名或密码错误"); 59 | } 60 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/AddSubtractButton.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 35 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityTabComponent.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 51 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/ShopEvaluationController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 5 | import com.baomidou.mybatisplus.extension.api.ApiController; 6 | import com.baomidou.mybatisplus.extension.api.R; 7 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 8 | import com.example.SecondStore.entity.Shop; 9 | import com.example.SecondStore.entity.ShopEvaluation; 10 | import com.example.SecondStore.service.ShopEvaluationService; 11 | import com.example.SecondStore.service.ShopService; 12 | import com.example.SecondStore.service.impl.ShopServiceImpl; 13 | import lombok.extern.slf4j.Slf4j; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | import java.io.Serializable; 18 | 19 | /** 20 | * 店铺评价(ShopEvaluation)表控制层 21 | * 22 | * @author bwmgd 23 | * @since 2021-04-25 09:50:11 24 | */ 25 | @Slf4j 26 | @RestController 27 | @RequestMapping("shopEvaluation") 28 | public class ShopEvaluationController extends ApiController { 29 | /** 30 | * 服务对象 31 | */ 32 | @Autowired 33 | private ShopEvaluationService shopEvaluationService; 34 | 35 | /** 36 | * 新增数据 37 | * 38 | * @param shopEvaluation 实体对象 39 | * @return 新增结果 40 | */ 41 | @PostMapping 42 | public R insert(@RequestBody ShopEvaluation shopEvaluation) { 43 | boolean save = this.shopEvaluationService.save(shopEvaluation); 44 | ShopService shopService = new ShopServiceImpl(); 45 | Shop shop = shopService.getById(shopEvaluation.getShopId()); 46 | shop.setScore(shopEvaluationService.calculateScore(shopEvaluation.getShopId())); 47 | shopService.updateById(shop); 48 | return success(save); 49 | } 50 | 51 | @GetMapping("{shopId}") 52 | public R getShopEvaluation(@PathVariable Serializable shopId, @RequestParam("page") long page) { 53 | return success(this.shopEvaluationService.page(new Page<>(page, 15), 54 | new LambdaQueryWrapper().eq(ShopEvaluation::getShopId, shopId))); 55 | } 56 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/admin/BargainManagement.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 50 | 51 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/admin/AdminHome.vue: -------------------------------------------------------------------------------- 1 | 23 | 51 | 52 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/CommodityEvaluationController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.api.ApiController; 5 | import com.baomidou.mybatisplus.extension.api.R; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.example.SecondStore.entity.Commodity; 8 | import com.example.SecondStore.entity.CommodityEvaluation; 9 | import com.example.SecondStore.service.CommodityEvaluationService; 10 | import com.example.SecondStore.service.CommodityService; 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import java.io.Serializable; 16 | 17 | /** 18 | * 商品评价(CommodityEvaluation)表控制层 19 | * 20 | * @author bwmgd 21 | * @since 2021-04-25 09:50:11 22 | */ 23 | @Slf4j 24 | @RestController 25 | @RequestMapping("commodityEvaluation") 26 | public class CommodityEvaluationController extends ApiController { 27 | /** 28 | * 服务对象 29 | */ 30 | @Autowired 31 | private CommodityEvaluationService commodityEvaluationService; 32 | 33 | @Autowired 34 | private CommodityService commodityService; 35 | 36 | /** 37 | * 新增数据 38 | * 39 | * @param commodityEvaluation 实体对象 40 | * @return 新增结果 41 | */ 42 | @PostMapping 43 | public R insert(@RequestBody CommodityEvaluation commodityEvaluation) { 44 | boolean save = this.commodityEvaluationService.save(commodityEvaluation); 45 | if(save){ 46 | Commodity commodity = commodityService.getById(commodityEvaluation.getCommodityId()); 47 | commodity.setEvaluationCount(commodityEvaluationService.evaluationCount(commodity.getId())); 48 | commodity.setScore(commodityEvaluationService.calculateScore(commodity.getId())); 49 | commodityService.updateById(commodity); 50 | return success(true); 51 | }else { 52 | return failed("评论失败"); 53 | } 54 | } 55 | 56 | @GetMapping("/commodity/{commodityId}") 57 | public R getCommodityEvaluation(@PathVariable Serializable commodityId, @RequestParam("page") long page) { 58 | return success(this.commodityEvaluationService.getEvaluationById(new Page<>(page, 20),commodityId)); 59 | } 60 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/Checkout.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 49 | 50 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommoditySort.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 55 | 56 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/Navigation.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/task/MiddleCountTask.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.task; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.example.SecondStore.dao.*; 5 | import com.example.SecondStore.entity.Orders; 6 | import com.example.SecondStore.entity.Sell; 7 | import com.example.SecondStore.entity.User; 8 | import com.example.SecondStore.entity.MiddleCount; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.scheduling.annotation.EnableScheduling; 11 | import org.springframework.scheduling.annotation.Scheduled; 12 | 13 | import javax.annotation.Resource; 14 | import java.time.LocalDateTime; 15 | import java.util.List; 16 | 17 | @Configuration //1.主要用于标记配置类,兼备Component的效果。 18 | @EnableScheduling // 2.开启定时任务 19 | public class MiddleCountTask { 20 | 21 | @Resource 22 | private MiddleCountDao middleCountDao; 23 | @Resource 24 | private OrderDao orderDao; 25 | @Resource 26 | private UserDao userDao; 27 | @Resource 28 | private SellDao sellDao; 29 | @Resource 30 | private RateDao rateDao; 31 | 32 | //3.添加定时任务 33 | // @Scheduled(cron = "0 0 0/1 * * ?") 34 | @Scheduled(cron = "0/20 * * * * ?") 35 | private void configureTasks() { 36 | QueryWrapper creatTime = 37 | new QueryWrapper().le("creat_time", LocalDateTime.now() 38 | // .plusHours(-1) 39 | .plusSeconds(-20) 40 | ); 41 | 42 | List middleCounts = middleCountDao.selectList(creatTime); 43 | System.out.println(middleCounts); 44 | if (middleCounts.isEmpty()) return; 45 | for (MiddleCount middleCount : middleCounts) { 46 | QueryWrapper orderId = new QueryWrapper().eq("id", middleCount.getOrderId()); 47 | Orders orders = orderDao.selectOne(orderId); 48 | orders.setCanReturn(1); 49 | orderDao.updateById(orders); 50 | User user = userDao.selectOne(new QueryWrapper().eq("id", middleCount.getUserId())); 51 | user.setPoints(user.getPoints() + middleCount.getAmount()); 52 | userDao.updateById(user); 53 | Sell sell = sellDao.selectOne(new QueryWrapper().eq("id", middleCount.getSellerId())); 54 | Integer level = sell.getLevel(); 55 | System.out.println(level); 56 | sell.setWallet(sell.getWallet() + middleCount.getAmount() * 57 | (1 - rateDao.selectById(level).getRate())); 58 | sellDao.updateById(sell); 59 | middleCountDao.deleteById(middleCount.getId()); 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/sell/SellHome.vue: -------------------------------------------------------------------------------- 1 | 27 | 52 | 53 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/CommodityPhotoController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.api.ApiController; 5 | import com.baomidou.mybatisplus.extension.api.R; 6 | import com.example.SecondStore.entity.Commodity; 7 | import com.example.SecondStore.entity.CommodityPhoto; 8 | import com.example.SecondStore.service.CommodityPhotoService; 9 | import com.example.SecondStore.service.CommodityService; 10 | import com.example.SecondStore.util.Util; 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | import java.io.IOException; 17 | import java.io.Serializable; 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | /** 22 | * 商品图片(CommodityPhoto)表控制层 23 | * 24 | * @author bwmgd 25 | * @since 2021-04-25 09:50:11 26 | */ 27 | @Slf4j 28 | @RestController 29 | @RequestMapping("commodityPhoto") 30 | public class CommodityPhotoController extends ApiController { 31 | /** 32 | * 服务对象 33 | */ 34 | @Autowired 35 | private CommodityPhotoService commodityPhotoService; 36 | @Autowired 37 | private CommodityService commodityService; 38 | 39 | @GetMapping("{commodityId}") 40 | public R selectByCommodityID(@PathVariable Serializable commodityId) { 41 | return success(this.commodityPhotoService.getPhotoByCommodityId(commodityId)); 42 | } 43 | 44 | @PostMapping 45 | public R insert(@RequestParam("file") MultipartFile[] file, 46 | @RequestParam("commodityId") Integer commodityId) { 47 | log.info(commodityId+"sdad"); 48 | log.info(String.valueOf(commodityId)); 49 | log.info(file[0].getName()); 50 | if (commodityId == null) return failed("非法id"); 51 | List commodityPhotoList = new ArrayList<>(); 52 | try { 53 | for (MultipartFile p : file) { 54 | log.info(String.valueOf(p.getSize())); 55 | CommodityPhoto photo = new CommodityPhoto(); 56 | photo.setCommodityId(commodityId); 57 | photo.setPhoto(Util.SaveImage(p)); 58 | commodityPhotoList.add(photo); 59 | } 60 | Commodity commodity = commodityService.getById(commodityId); 61 | commodity.setPhotoOne(commodityPhotoList.get(0).getPhoto()); 62 | commodityService.updateById(commodity); 63 | } catch (IOException e) { 64 | e.printStackTrace(); 65 | return failed(e.getMessage()); 66 | } 67 | return success(this.commodityPhotoService.saveBatch(commodityPhotoList)); 68 | } 69 | 70 | /** 71 | * 修改数据 72 | * 73 | * @param commodityPhoto 实体对象 74 | * @return 修改结果 75 | */ 76 | @PostMapping("update") 77 | public R update(@RequestBody CommodityPhoto commodityPhoto) { 78 | return success(this.commodityPhotoService.updateById(commodityPhoto)); 79 | } 80 | 81 | @PostMapping("delete") 82 | public R delete(@RequestBody CommodityPhoto commodityPhoto) { 83 | return success(this.commodityPhotoService.removeById(commodityPhoto.getId())); 84 | } 85 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/admin/SellRateManagement.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 77 | 78 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 6 | import com.baomidou.mybatisplus.extension.api.ApiController; 7 | import com.baomidou.mybatisplus.extension.api.R; 8 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 9 | import com.example.SecondStore.entity.User; 10 | import com.example.SecondStore.service.UserService; 11 | import lombok.extern.slf4j.Slf4j; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import java.io.Serializable; 16 | import java.util.Map; 17 | 18 | /** 19 | * 普通用户(User)表控制层 20 | * 21 | * @author bwmgd 22 | * @since 2021-04-25 09:50:11 23 | */ 24 | @Slf4j 25 | @RestController 26 | @RequestMapping("user") 27 | public class UserController extends ApiController { 28 | /** 29 | * 服务对象 30 | */ 31 | @Autowired 32 | private UserService userService; 33 | 34 | /** 35 | * 分页查询所有数据 36 | * 37 | * @param page 分页对象 38 | * @return 所有数据 39 | */ 40 | @GetMapping 41 | public R selectAll(@RequestParam("page") long page, @RequestParam(name = "status", required = false) Serializable status) { 42 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); 43 | if (status != null) wrapper.eq(User::getStatus, status); 44 | return success(this.userService.page(new Page<>(page, 20), wrapper)); 45 | } 46 | 47 | @PostMapping() 48 | public R selectList(@RequestBody Map map) { 49 | return success(this.userService.list(new QueryWrapper().allEq(map))); 50 | } 51 | 52 | /** 53 | * 通过主键查询单条数据 54 | * 55 | * @param id 主键 56 | * @return 单条数据 57 | */ 58 | @GetMapping("{id}") 59 | public R selectOne(@PathVariable Serializable id) { 60 | return success(this.userService.getById(id)); 61 | } 62 | 63 | /** 64 | * 新增数据 65 | * 66 | * @param user 实体对象 67 | * @return 新增结果 68 | */ 69 | @PostMapping("/register") 70 | public R insert(@RequestBody User user) { 71 | if (userService.register(user.getName()) != null) //用户名重复 72 | return failed("该用户名已被注册"); 73 | return success(this.userService.save(user)); 74 | } 75 | 76 | /** 77 | * 修改数据 78 | * 79 | * @param user 实体对象 80 | * @return 修改结果 81 | */ 82 | @PostMapping("update") 83 | public R update(@RequestBody User user) { 84 | return success(this.userService.updateById(user)); 85 | } 86 | 87 | @PostMapping("delete") 88 | public R delete(@RequestParam User user) { 89 | return success(this.userService.removeById(user.getId())); 90 | } 91 | 92 | @PostMapping("login") 93 | public R login(@RequestBody User user) { 94 | if ((user = userService.login(user.getName(), user.getPassword())) != null) { 95 | if(user.getStatus() == 1) return success(user); 96 | else if(user.getStatus() == 0) return failed("审核中,请耐心等待!"); 97 | else return failed("该账号审核失败,请注册新账号!"); 98 | } 99 | return failed("用户名或密码错误"); 100 | } 101 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityCommentList.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 110 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/sell/Shop.vue: -------------------------------------------------------------------------------- 1 | 19 | 90 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | org.springframework.boot 8 | spring-boot-starter-parent 9 | 2.4.5 10 | 11 | 12 | 13 | com.example 14 | SecondStore 15 | 0.0.1-SNAPSHOT 16 | SecondStore 17 | SecondStore project for Spring Boot 18 | 19 | 20 | 1.8 21 | 3.4.1 22 | 8.0.24 23 | 2.4.5 24 | 25 | 26 | 27 | 28 | 29 | mysql 30 | mysql-connector-java 31 | ${mysql.version} 32 | compile 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-web 38 | 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-test 43 | test 44 | 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-devtools 49 | runtime 50 | true 51 | 52 | 53 | 54 | org.mybatis.spring.boot 55 | mybatis-spring-boot-starter 56 | 2.1.4 57 | 58 | 59 | 60 | org.projectlombok 61 | lombok 62 | true 63 | 64 | 65 | 66 | com.baomidou 67 | mybatis-plus-boot-starter 68 | ${baomidou.version} 69 | 70 | 71 | 72 | org.apache.velocity 73 | velocity-engine-core 74 | 2.3 75 | 76 | 77 | 78 | org.springframework.boot 79 | spring-boot-starter-websocket 80 | 81 | 82 | 83 | org.slf4j 84 | slf4j-nop 85 | 1.7.2 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | org.apache.maven.plugins 95 | maven-surefire-plugin 96 | 2.4.2 97 | 98 | true 99 | 100 | 101 | 102 | 103 | org.springframework.boot 104 | spring-boot-maven-plugin 105 | ${spring.version} 106 | 107 | true 108 | true 109 | 110 | 111 | org.projectlombok 112 | lombok 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/admin/RechargeManagement.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 106 | 107 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/CommodityController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.extension.api.ApiController; 6 | import com.baomidou.mybatisplus.extension.api.R; 7 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 8 | import com.example.SecondStore.entity.Commodity; 9 | import com.example.SecondStore.service.CommodityService; 10 | import com.example.SecondStore.entity.Shop; 11 | import com.example.SecondStore.service.ShopService; 12 | import lombok.extern.slf4j.Slf4j; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | import java.io.Serializable; 17 | import java.util.Map; 18 | 19 | /** 20 | * 商品(Commodity)表控制层 21 | * 22 | * @author bwmgd 23 | * @since 2021-04-25 09:50:11 24 | */ 25 | @Slf4j 26 | @RestController 27 | @RequestMapping("commodity") 28 | public class CommodityController extends ApiController { 29 | /** 30 | * 服务对象 31 | */ 32 | @Autowired 33 | private CommodityService commodityService; 34 | @Autowired 35 | private ShopService shopService; 36 | 37 | @GetMapping 38 | public R selectAll(@RequestParam("page") long page) { 39 | return success(this.commodityService.page(new Page<>(page, 10),new QueryWrapper().eq("status", 1))); 40 | } 41 | 42 | /** 43 | * 查询未审核商品列表 44 | * 45 | * @param map 按关键字map查询 46 | * @return 商品列表 47 | */ 48 | @PostMapping("audit") 49 | public R selectBy(@RequestBody Map map) { 50 | return success(this.commodityService.list(new QueryWrapper().allEq(map))); 51 | } 52 | 53 | @PostMapping("searchOrder") 54 | public R searchOrder(@RequestBody Map map) { 55 | int page = 1; 56 | int status = 1; 57 | if (mapExist(map, "status")) status = Integer.parseInt(map.get("status")[0]); 58 | QueryWrapper wrapper = new QueryWrapper().eq("status", status); 59 | if (mapExist(map, "page")) page = Integer.parseInt(map.get("page")[0]); 60 | if (mapExist(map, "shop_id")) wrapper.eq("shop_id", map.get("shop_id")[0]); //按店铺 61 | if (mapExist(map, "kind_id")) wrapper.eq("kind_id", map.get("kind_id")[0]); //按类别 62 | if (mapExist(map, "keyword")) { //多关键词查找 63 | for (String keyword : map.get("keyword")) { 64 | wrapper.like("name", keyword); 65 | } 66 | } 67 | if (mapExist(map, "asc")) wrapper.orderByAsc(map.get("asc")); //关键列升序 68 | if (mapExist(map, "desc")) wrapper.orderByDesc(map.get("desc")); //关键列降序 69 | return success(this.commodityService.page(new Page<>(page, 10), wrapper)); //返回列表 70 | } 71 | 72 | private Boolean mapExist(Map map, String key) { //判断map中是否包含对应字段 73 | return map.containsKey(key) && map.get(key).length != 0; 74 | } 75 | 76 | /** 77 | * 通过主键查询单条数据 78 | * 79 | * @param id 主键 80 | * @return 单条数据 81 | */ 82 | @GetMapping("{id}") 83 | public R selectOne(@PathVariable Serializable id) { 84 | return success(this.commodityService.getById(id)); 85 | } 86 | 87 | /** 88 | * 按商品状态查询商品 89 | * 90 | * @param page 分页对象 91 | * @param commodity 查询实体 92 | * @param status 商品状态 93 | * @return 商品list 94 | */ 95 | @GetMapping("shop/status/{status}") 96 | public R selectByStatus(Page page, Commodity commodity, @PathVariable Serializable status) { 97 | return success(this.commodityService.page(page, new QueryWrapper<>(commodity).eq("status", status))); 98 | } 99 | 100 | /** 101 | * 新增数据 102 | * 103 | * @param commodity 实体对象 104 | * @return 新增结果 105 | */ 106 | @PostMapping 107 | public R insert(@RequestBody Commodity commodity) { 108 | Shop shop = shopService.getById(commodity.getShopId()); 109 | log.info(shop.getName()); 110 | commodity.setShopName(shop.getName()); 111 | log.info(commodity.toString()); 112 | if (this.commodityService.save(commodity)) { 113 | return success(commodity.getId()); 114 | } 115 | return failed("error"); 116 | } 117 | 118 | /** 119 | * 修改数据 120 | * 121 | * @param commodity 实体对象 122 | * @return 修改结果 123 | */ 124 | @PostMapping("update") 125 | public R update(@RequestBody Commodity commodity) { 126 | return success(this.commodityService.updateById(commodity)); 127 | } 128 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 5 | import com.baomidou.mybatisplus.extension.api.ApiController; 6 | import com.baomidou.mybatisplus.extension.api.R; 7 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 8 | import com.example.SecondStore.entity.Commodity; 9 | import com.example.SecondStore.entity.Orders; 10 | import com.example.SecondStore.entity.User; 11 | import com.example.SecondStore.service.*; 12 | import com.example.SecondStore.entity.MiddleCount; 13 | import lombok.extern.slf4j.Slf4j; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | import java.io.Serializable; 18 | import java.util.List; 19 | 20 | /** 21 | * 订单(Order)表控制层 22 | * 23 | * @author bwmgd 24 | * @since 2021-04-25 09:50:11 25 | */ 26 | @Slf4j 27 | @RestController 28 | @RequestMapping("order") 29 | public class OrderController extends ApiController { 30 | /** 31 | * 服务对象 32 | */ 33 | @Autowired 34 | private OrderService orderService; 35 | @Autowired 36 | private UserService userService; 37 | @Autowired 38 | private ShopService shopService; 39 | @Autowired 40 | private MiddleCountService middleCountService; 41 | @Autowired 42 | private CommodityService commodityService; 43 | 44 | /** 45 | * 通过主键查询单条数据 46 | * 47 | * @param id 主键 48 | * @return 单条数据 49 | */ 50 | @GetMapping("{id}") 51 | public R selectOne(@PathVariable Serializable id) { 52 | return success(this.orderService.getById(id)); 53 | } 54 | 55 | @GetMapping("user/{userId}") 56 | public R selectByUserID(@RequestParam("page") long page, @PathVariable Serializable userId) { 57 | return success(this.orderService.page(new Page<>(page, 20), 58 | new LambdaQueryWrapper().eq(Orders::getUserId, userId))); 59 | } 60 | 61 | @GetMapping("shop/{shopId}") 62 | public R selectByShopID(@RequestParam("page") long page, @PathVariable Serializable shopId) { 63 | return success(this.orderService.page(new Page<>(page, 20), 64 | new LambdaQueryWrapper().eq(Orders::getShopId, shopId).between(Orders::getStatus,2,8))); 65 | } 66 | 67 | @GetMapping 68 | public R selectAll(@RequestParam("page") long page){ 69 | return success(this.orderService.pageByStatus(new Page<>(page, 20),8)); 70 | } 71 | 72 | /** 73 | * 修改数据 74 | * 75 | * @param orders 实体对象 76 | * @return 修改结果 77 | */ 78 | @PostMapping("update") 79 | public R update(@RequestBody Orders orders) { 80 | if (orders.getCanReturn() == 1) { 81 | if (orders.getStatus() == 5 || orders.getStatus() == 6) { 82 | return failed("支付超过24h,无法退货"); 83 | } 84 | } 85 | else if (orders.getStatus() == 6) { 86 | MiddleCount middleCount = middleCountService.getMiddleCountByOrderId(orders.getId()); 87 | User user = userService.getById(orders.getUserId()); 88 | user.setWallet(user.getWallet() + middleCount.getAmount()); 89 | middleCountService.removeById(middleCount.getId()); 90 | } 91 | if (orders.getStatus() == 1 || orders.getStatus() == 6) { 92 | Commodity commodity = commodityService.getById(orders.getCommodityId()); 93 | commodity.setInventory(commodity.getInventory() + orders.getQuantity()); 94 | commodityService.updateById(commodity); 95 | } 96 | return success(this.orderService.updateById(orders)); 97 | } 98 | 99 | @PostMapping("pay") 100 | public R payOrders(@RequestBody List orders) { 101 | User user = userService.getById(orders.get(0).getUserId()); 102 | double sum = orders.stream().mapToDouble(Orders::getAmount).sum(); 103 | if (user.getWallet() < sum) { 104 | return failed("余额不足"); 105 | } 106 | for (Orders order : orders) { 107 | MiddleCount middleCount = new MiddleCount(); 108 | middleCount.setOrderId(order.getId()); 109 | middleCount.setUserId(user.getId()); 110 | middleCount.setAmount(order.getAmount()); 111 | middleCount.setSellerId(shopService.getById(order.getShopId()).getSellerId()); 112 | middleCountService.save(middleCount); 113 | user.setWallet(user.getWallet() - order.getAmount()); 114 | order.setStatus(2); 115 | orderService.updateById(order); 116 | } 117 | return success(userService.updateById(user)); 118 | } 119 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/SellController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 6 | import com.baomidou.mybatisplus.extension.api.ApiController; 7 | import com.baomidou.mybatisplus.extension.api.R; 8 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 9 | import com.example.SecondStore.entity.Sell; 10 | import com.example.SecondStore.service.SellService; 11 | import com.example.SecondStore.entity.Shop; 12 | import com.example.SecondStore.service.ShopService; 13 | import com.example.SecondStore.util.Util; 14 | import com.fasterxml.jackson.databind.ObjectMapper; 15 | import lombok.extern.slf4j.Slf4j; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.web.bind.annotation.*; 18 | import org.springframework.web.multipart.MultipartFile; 19 | 20 | import java.io.IOException; 21 | import java.io.Serializable; 22 | import java.util.Map; 23 | 24 | /** 25 | * 商家(Sell)表控制层 26 | * 27 | * @author bwmgd 28 | * @since 2021-04-25 09:50:11 29 | */ 30 | @Slf4j 31 | @RestController 32 | @RequestMapping("sell") 33 | public class SellController extends ApiController { 34 | /** 35 | * 服务对象 36 | */ 37 | @Autowired 38 | private SellService sellService; 39 | @Autowired 40 | private ShopService shopService; 41 | 42 | /** 43 | * 分页查询所有数据 44 | * 45 | * @param page 分页对象 46 | * @return 所有数据 47 | */ 48 | @GetMapping 49 | public R selectAll(@RequestParam("page") long page, @RequestParam(name = "status", required = false) Serializable status) { 50 | LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); 51 | if (status != null) wrapper.eq(Sell::getStatus, status); 52 | return success(this.sellService.page(new Page<>(page, 20), wrapper)); 53 | } 54 | 55 | /** 56 | * 通过主键查询单条数据 57 | * 58 | * @param id 主键 59 | * @return 单条数据 60 | */ 61 | @GetMapping("{id}") 62 | public R selectOne(@PathVariable Serializable id) { 63 | return success(this.sellService.getById(id)); 64 | } 65 | 66 | 67 | @PostMapping("/register") 68 | public R insert(@RequestParam("idCardUp") MultipartFile idCardUp, 69 | @RequestParam("idCardBack") MultipartFile idCardBack, 70 | @RequestParam("license") MultipartFile license, 71 | @RequestParam("sell") String sellJson 72 | ) { 73 | try { 74 | Sell sell = new ObjectMapper().readValue(sellJson, Sell.class); 75 | if (sellService.register(sell.getName()) != null) { 76 | return failed("用户名重复"); 77 | } 78 | try { 79 | sell.setIdCardUp(Util.SaveImage(idCardUp)); 80 | sell.setIdCardBack(Util.SaveImage(idCardBack)); 81 | sell.setLicense(Util.SaveImage(license)); 82 | } catch (IOException e) { 83 | log.info(e.getMessage()); 84 | return failed(e.getMessage()); 85 | } 86 | log.info(sell.getName()); 87 | this.sellService.save(sell); 88 | Shop shop = new Shop(); 89 | shop.setSellerId(sell.getId()); 90 | shop.setName(sell.getName()); 91 | if (shopService.save(shop)) return success(shop.getId()); 92 | return failed("error"); 93 | } catch (IOException e) { 94 | log.error(e.getMessage()); 95 | return failed(e.getMessage()); 96 | } 97 | } 98 | 99 | @PostMapping 100 | public R selectSellList(@RequestBody Map map) { 101 | return success(this.sellService.list(new QueryWrapper().allEq(map))); 102 | } 103 | 104 | /** 105 | * 修改数据 106 | * 107 | * @param sell 实体对象 108 | * @return 修改结果 109 | */ 110 | @PostMapping("update") 111 | public R update(@RequestBody Sell sell) { 112 | return success(this.sellService.updateById(sell)); 113 | } 114 | 115 | @PostMapping("delete") 116 | public R delete(@RequestBody Sell sell) { 117 | return success(this.sellService.removeById(sell.getId())); 118 | } 119 | 120 | @PostMapping("login") 121 | public R login(@RequestBody Sell sell) { 122 | if ((sell = sellService.login(sell.getName(), sell.getPassword())) != null) { 123 | if(sell.getStatus() == 1) return success(sell); 124 | else if(sell.getStatus() == 0) return failed("审核中,请耐心等待!"); 125 | else return failed("该账号审核失败,请注册新账号!"); 126 | } 127 | return failed("用户名或密码错误"); 128 | } 129 | } -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/CommodityCard.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 85 | 86 | -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/src/main/java/com/example/SecondStore/controller/ShoppingCartController.java: -------------------------------------------------------------------------------- 1 | package com.example.SecondStore.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.api.ApiController; 5 | import com.baomidou.mybatisplus.extension.api.R; 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 7 | import com.example.SecondStore.entity.Commodity; 8 | import com.example.SecondStore.entity.Orders; 9 | import com.example.SecondStore.entity.ShoppingCart; 10 | import com.example.SecondStore.service.CommodityService; 11 | import com.example.SecondStore.service.ShoppingCartService; 12 | import com.example.SecondStore.service.OrderService; 13 | import lombok.extern.slf4j.Slf4j; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | 17 | import java.io.Serializable; 18 | import java.math.BigDecimal; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | * 购物车(ShoppingCart)表控制层 24 | * 25 | * @author bwmgd 26 | * @since 2021-04-25 09:50:11 27 | */ 28 | @Slf4j 29 | @RestController 30 | @RequestMapping("shoppingCart") 31 | public class ShoppingCartController extends ApiController { 32 | /** 33 | * 服务对象 34 | */ 35 | @Autowired 36 | private ShoppingCartService shoppingCartService; 37 | @Autowired 38 | private CommodityService commodityService; 39 | @Autowired 40 | private OrderService orderService; 41 | 42 | @GetMapping("{userId}") 43 | public R getShopCraftById(@PathVariable Serializable userId, @RequestParam("page") long page) { 44 | return success(this.shoppingCartService.page(new Page<>(page, 10), userId)); 45 | } 46 | 47 | /** 48 | * 新增数据 49 | * 50 | * @param shoppingCart 实体对象 51 | * @return 新增结果 52 | */ 53 | @PostMapping 54 | public R insert(@RequestBody ShoppingCart shoppingCart) { 55 | ShoppingCart oldShoppingCart = shoppingCartService.getShoppingCartByCommodityId(shoppingCart); 56 | Commodity commodity = commodityService.getById(shoppingCart.getCommodityId()); 57 | if (commodity == null) return failed("非法参数"); 58 | 59 | if (oldShoppingCart == null) { 60 | // if (shoppingCart.getQuantity() > commodity.getInventory()) { 61 | // return failed("库存不足"); 62 | // } 63 | return success(this.shoppingCartService.save(shoppingCart)); 64 | } 65 | 66 | int quantity = shoppingCart.getQuantity() + oldShoppingCart.getQuantity(); 67 | // if (quantity > commodity.getInventory()) { 68 | // return failed("库存不足"); 69 | // } 70 | oldShoppingCart.setQuantity(quantity); 71 | return update(oldShoppingCart); 72 | } 73 | 74 | /** 75 | * 修改数据 76 | * 77 | * @param shoppingCart 实体对象 78 | * @return 修改结果 79 | */ 80 | @PostMapping("update") 81 | public R update(@RequestBody ShoppingCart shoppingCart) { 82 | if (shoppingCart.getQuantity() <= 0) { 83 | return success(this.shoppingCartService.removeById(shoppingCart.getId())); 84 | } 85 | return success(this.shoppingCartService.updateById(shoppingCart)); 86 | } 87 | 88 | @PostMapping("delete") 89 | public R delete(@RequestBody List shoppingCarts){ 90 | if(shoppingCarts.size()>0){ 91 | for (ShoppingCart shoppingCart : shoppingCarts) { 92 | this.shoppingCartService.removeById(shoppingCart.getId()); 93 | } 94 | return success(true); 95 | } 96 | return failed("操作失败"); 97 | } 98 | 99 | @PostMapping("checkOut") 100 | public R checkOutShoppingCart(@RequestBody List shoppingCarts) { 101 | List orders = new ArrayList<>(); 102 | List commodities = new ArrayList<>(); 103 | for (ShoppingCart shoppingCart : shoppingCarts) { 104 | Commodity commodity = commodityService.getById(shoppingCart.getCommodityId()); 105 | int inventory = commodity.getInventory() - shoppingCart.getQuantity(); 106 | if (inventory < 0) return failed("库存不足"); 107 | commodity.setInventory(inventory); 108 | Orders order = new Orders(); 109 | order.setCommodityId(commodity.getId()); 110 | order.setQuantity(shoppingCart.getQuantity()); 111 | if (commodity.getDiscount() == null || commodity.getDiscount() == 0.0) { 112 | order.setAmount(commodity.getPrice() * shoppingCart.getQuantity()); 113 | } 114 | else { 115 | double amount = commodity.getDiscount() * commodity.getPrice() * shoppingCart.getQuantity(); 116 | amount = new BigDecimal(amount).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); 117 | order.setAmount(amount); 118 | } 119 | order.setUserId(shoppingCart.getUserId()); 120 | order.setShopId(commodity.getShopId()); 121 | orders.add(order); 122 | commodities.add(commodity); 123 | } 124 | orderService.saveBatch(orders); 125 | commodityService.updateBatchById(commodities); 126 | return success(orders); 127 | } 128 | } -------------------------------------------------------------------------------- /SecondStore_后端/SecondStore/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/ShoppingCart.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 133 | 134 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/Commodity.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 128 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/router/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | 4 | Vue.use(Router) 5 | 6 | const routes = [ 7 | 8 | //商城系统路由信息 9 | { 10 | path: '/', 11 | component:() => import('../views/Home.vue'), 12 | redirect:{ //重定向 13 | name: 'home' 14 | }, 15 | children:[ 16 | { 17 | name: 'home', 18 | path: 'home', 19 | meta: { 20 | title: '商城首页' 21 | }, 22 | component: () => import('../views/HomePage.vue') 23 | }, 24 | { 25 | path: 'kind/:id', 26 | name: 'category', 27 | meta: { 28 | title: '分类商品' 29 | }, 30 | component: () => import('../views/Commodities.vue') 31 | }, 32 | { 33 | path: 'searchOrder', 34 | name: 'searchOrder', 35 | meta: { 36 | title: '搜索结果' 37 | }, 38 | component: () => import('../views/Commodities.vue') 39 | }, 40 | { 41 | path: 'commodity/:id', 42 | name: 'commodity', 43 | meta:{ 44 | title: '商品信息' 45 | }, 46 | component: ()=>import('../views/Commodity.vue') 47 | }, 48 | { 49 | path: 'cart', 50 | name: 'cart', 51 | meta: { 52 | title: '购物车', 53 | requiresAuth: true 54 | }, 55 | component: () => import('../views/ShoppingCart.vue') 56 | }, 57 | { 58 | path:'account', 59 | name: 'account', 60 | meta: { 61 | title: '我的账户', 62 | requiresAuth: true 63 | }, 64 | component: ()=>import('../views/Account.vue') 65 | }, 66 | { 67 | path: 'check', 68 | name: 'check', 69 | meta: { 70 | title: '结算', 71 | requiresAuth: true 72 | }, 73 | component: () => import('../views/Checkout.vue') 74 | }, 75 | { 76 | path: 'order', 77 | name: 'order', 78 | meta: { 79 | title: '我的订单', 80 | requiresAuth: true 81 | }, 82 | component: () => import('../views/Order.vue') 83 | }, 84 | ] 85 | }, 86 | 87 | 88 | { 89 | path: '/login', 90 | name: 'login', 91 | meta: { 92 | title: '登录' 93 | }, 94 | component: ()=>import('../components/UserLogin.vue') 95 | }, 96 | { 97 | path: '/register', 98 | name: 'register', 99 | meta:{ 100 | title: '注册' 101 | }, 102 | component: ()=>import('../components/UserRegister.vue') 103 | }, 104 | { 105 | path: '/sellRegister', 106 | name: 'sellRegister', 107 | meta:{ 108 | title: '商家注册' 109 | }, 110 | component: ()=>import('../components/SellRegister.vue') 111 | }, 112 | 113 | 114 | // 商家系统路由信息 115 | { 116 | path: '/shop', 117 | component: ()=>import('../views/sell/SellHome.vue'), 118 | children:[ 119 | { 120 | path:'shopId/:id', 121 | name:'shop', 122 | meta:{ 123 | title:'商家系统' 124 | }, 125 | component: ()=>import('../views/sell/Shop.vue') 126 | }, 127 | { 128 | path:'info', 129 | name:'sellInfo', 130 | meta:{ 131 | title:'商家系统' 132 | }, 133 | component: ()=>import('../views/sell/SellInfo.vue') 134 | }, 135 | { 136 | path:'order', 137 | name:'sellOrder', 138 | meta:{ 139 | title:'我的订单' 140 | }, 141 | component: ()=>import('../views/sell/SellOrder.vue') 142 | }, 143 | { 144 | path:'commodity/:id', 145 | name:'shopCommodity', 146 | meta:{ 147 | title:'商品详情' 148 | }, 149 | component: ()=>import('../views/Commodity.vue') 150 | }, 151 | ] 152 | }, 153 | 154 | 155 | // 管理员系统路由信息 156 | { 157 | path: '/admin', 158 | redirect:{ 159 | name: 'userAudit' 160 | }, 161 | meta:{ 162 | title: '管理员系统' 163 | }, 164 | component: ()=>import('../views/admin/AdminHome.vue'), 165 | children:[ 166 | { 167 | path:'bargain', 168 | name:'bargain', 169 | meta:{ 170 | title:'交易管理' 171 | }, 172 | component:()=>import('../views/admin/BargainManagement.vue') 173 | }, 174 | { 175 | path:'audit/commodity', 176 | name:'commodityAudit', 177 | meta:{ 178 | title:'商品审核' 179 | }, 180 | component:()=>import('../views/admin/CommodityAudit.vue') 181 | }, 182 | { 183 | path:'audit/user', 184 | name:'userAudit', 185 | meta:{ 186 | title:'用户审核' 187 | }, 188 | component:()=>import('../views/admin/UserAudit.vue') 189 | }, 190 | { 191 | path:'recharge', 192 | name:'recharge', 193 | meta:{ 194 | title:'充值管理' 195 | }, 196 | component:()=>import('../views/admin/RechargeManagement.vue') 197 | }, 198 | { 199 | path:'sellRate', 200 | name:'sellRate', 201 | meta:{ 202 | title:'商家等级管理' 203 | }, 204 | component:()=>import('../views/admin/SellRateManagement.vue') 205 | }, 206 | ] 207 | } 208 | ] 209 | 210 | 211 | const router = new Router({ 212 | routes 213 | }) 214 | 215 | 216 | //全局前置守卫 217 | router.beforeEach((to, from, next) => { 218 | // 判断该路由是否需要登录权限 219 | if (to.matched.some(record => record.meta.requiresAuth)) 220 | { 221 | // 路由需要验证,判断用户是否已经登录 222 | if(sessionStorage.getItem('user') || sessionStorage.getItem('sell') || sessionStorage.getItem('admin')){ 223 | next(); 224 | } 225 | else{ 226 | next({ 227 | path: '/login', 228 | query: {redirect: to.fullPath} 229 | }); 230 | } 231 | } 232 | else 233 | next(); 234 | }) 235 | 236 | // 通过全局后置守卫设置页面的标题 237 | router.afterEach((to) => { 238 | document.title = to.meta.title; 239 | }) 240 | 241 | export default router 242 | 243 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/sell/SellOrder.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 139 | 140 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/UserLogin.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 136 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/components/Dialog.vue: -------------------------------------------------------------------------------- 1 | 56 | -------------------------------------------------------------------------------- /SecondStore_前端/secondstore/src/views/admin/UserAudit.vue: -------------------------------------------------------------------------------- 1 | 88 | 89 | 168 | 169 | --------------------------------------------------------------------------------