├── vue-gc-web ├── .browserslistrc ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── login.png │ │ ├── logo.png │ │ ├── sight.jpg │ │ ├── beauty.jpg │ │ ├── virusjpg.jpg │ │ ├── garbagePropaganda.jpg │ │ ├── garbagePropaganda2.jpg │ │ ├── garbagePropaganda3.jpeg │ │ └── css │ │ │ └── global.css │ ├── store │ │ ├── getters.js │ │ ├── index.js │ │ └── modules │ │ │ └── login.js │ ├── App.vue │ ├── main.js │ ├── utils │ │ ├── request.js │ │ └── quill-config.js │ ├── components │ │ ├── MapSearch.vue │ │ ├── WatchOrder.vue │ │ ├── Dry.vue │ │ ├── Harmful.vue │ │ ├── Wet.vue │ │ ├── Recycle.vue │ │ ├── ManageOrder.vue │ │ ├── UploadImage.vue │ │ ├── MapGeo.vue │ │ ├── Search.vue │ │ ├── Manage.vue │ │ ├── AlterPrice.vue │ │ ├── BrowseOrder.vue │ │ ├── CharacterAnimation.vue │ │ ├── ImageIdentify.vue │ │ ├── UserManage.vue │ │ ├── Chat.vue │ │ └── AddGarbage.vue │ ├── plugins │ │ └── element.js │ ├── router │ │ └── index.js │ └── views │ │ ├── Login.vue │ │ ├── Register.vue │ │ ├── UserPage.vue │ │ └── Home.vue ├── .editorconfig ├── babel.config.js ├── .gitignore ├── .eslintrc.js ├── README.md ├── vue.config.js └── package.json ├── garbagecollection ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── mybatis-config.xml │ │ │ └── mybatis-generator.xml │ │ └── java │ │ │ └── com │ │ │ └── byc │ │ │ ├── mapper │ │ │ ├── GcSystemRouterMapper.java │ │ │ ├── GcSystemRouterMapper.xml │ │ │ ├── CommodityListMapper.java │ │ │ ├── CommodityListMapper.xml │ │ │ ├── OrderListMapper.java │ │ │ ├── UserMapper.java │ │ │ ├── GarbageMapper.java │ │ │ ├── OrderListMapper.xml │ │ │ ├── UserMapper.xml │ │ │ └── GarbageMapper.xml │ │ │ ├── service │ │ │ ├── IUserService.java │ │ │ ├── IOrderService.java │ │ │ ├── IGarbageService.java │ │ │ └── serviceImpls │ │ │ │ ├── UserService.java │ │ │ │ ├── GarbageService.java │ │ │ │ └── OrderService.java │ │ │ ├── config │ │ │ ├── WebSocketConfig.java │ │ │ ├── SwaggerConfig.java │ │ │ └── ImageServerConfig.java │ │ │ ├── GarbagecollectionApplication.java │ │ │ ├── vo │ │ │ ├── MsgVO.java │ │ │ ├── Commodity.java │ │ │ └── OrderShow.java │ │ │ ├── enums │ │ │ └── ResponseCodeEnum.java │ │ │ ├── controller │ │ │ ├── GcRouterController.java │ │ │ ├── WebSocketServerController.java │ │ │ ├── UserController.java │ │ │ ├── OrderController.java │ │ │ └── GarbageController.java │ │ │ ├── bean │ │ │ ├── gcSystemRouter.java │ │ │ ├── CommodityList.java │ │ │ ├── Garbage.java │ │ │ ├── OrderList.java │ │ │ └── User.java │ │ │ ├── Filter │ │ │ ├── EncodingFilter.java │ │ │ └── CrosFilter.java │ │ │ ├── utils │ │ │ ├── ApplicationContextUtil.java │ │ │ └── FtpUtil.java │ │ │ └── common │ │ │ └── ServerResponse.java │ └── test │ │ └── java │ │ └── com │ │ └── byc │ │ └── garbagecollection │ │ └── GarbagecollectionApplicationTests.java ├── .gitignore └── mvnw.cmd └── README.md /vue-gc-web/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /vue-gc-web/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/public/favicon.ico -------------------------------------------------------------------------------- /vue-gc-web/src/assets/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/2.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/assets/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/3.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/assets/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/login.png -------------------------------------------------------------------------------- /vue-gc-web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/logo.png -------------------------------------------------------------------------------- /vue-gc-web/src/assets/sight.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/sight.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/assets/beauty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/beauty.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/assets/virusjpg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/virusjpg.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/assets/garbagePropaganda.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/garbagePropaganda.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/assets/garbagePropaganda2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/garbagePropaganda2.jpg -------------------------------------------------------------------------------- /vue-gc-web/src/store/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | adminAndUser: state => state.adminAndUser 3 | } 4 | 5 | export default getters 6 | -------------------------------------------------------------------------------- /vue-gc-web/src/assets/garbagePropaganda3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/vue-gc-web/src/assets/garbagePropaganda3.jpeg -------------------------------------------------------------------------------- /garbagecollection/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/garbagecollection/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /vue-gc-web/.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /garbagecollection/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ycBi/vue-springboot/HEAD/garbagecollection/src/main/resources/application.properties -------------------------------------------------------------------------------- /vue-gc-web/src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 17 | -------------------------------------------------------------------------------- /garbagecollection/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /vue-gc-web/src/assets/css/global.css: -------------------------------------------------------------------------------- 1 | /*全局样式表*/ 2 | html, 3 | body, 4 | #app{ 5 | height: 100%; 6 | margin: 0; 7 | padding: 0; 8 | } 9 | .el-breadcrumb { 10 | margin-bottom: 15px; 11 | } 12 | .el-card { 13 | box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15) !important 14 | } 15 | -------------------------------------------------------------------------------- /vue-gc-web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ], 5 | plugins: [ 6 | [ 7 | 'component', 8 | { 9 | libraryName: 'element-ui', 10 | styleLibraryName: 'theme-chalk' 11 | } 12 | ] 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /vue-gc-web/.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 | -------------------------------------------------------------------------------- /garbagecollection/src/main/resources/mybatis-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/GcSystemRouterMapper.java: -------------------------------------------------------------------------------- 1 | package com.byc.mapper; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | import org.springframework.stereotype.Repository; 5 | 6 | @Mapper 7 | @Repository 8 | public interface GcSystemRouterMapper { 9 | // 根据id获得权限 10 | String getRouterByPermission(int gcPermission); 11 | } 12 | -------------------------------------------------------------------------------- /garbagecollection/src/test/java/com/byc/garbagecollection/GarbagecollectionApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.byc.garbagecollection; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class GarbagecollectionApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-springboot 2 | 这是一个基于vue+springboot+mysql的垃圾分类管理系统 3 | 前端采用的是VUE Cli3脚手架生成,前后端通信使用了vue基于ajax封装的axios,组件开发使用的饿了吗的element 4 | 后端使用的半自动化的orm框架--mybatis,springboot版本为2.2.1 5 | mysql的版本8.0.18 6 | jdk版本为:8 7 | 图片使用的是nginx作为静态资源服务器(官网自行下载) 8 | 上传使用了ftpserver工具(网上资源下载) 9 | 系统还有很多bug,里面调了百度地图和ai接口 10 | 当你git clone时候可能我得百度ak和sk过期,请自行百度注册获取ak和sk进行代码修改 11 | 项目仍有很多bug,作者只是在校大学生,有问题请多见谅 12 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.byc.service; 2 | 3 | import com.byc.bean.User; 4 | 5 | 6 | public interface IUserService { 7 | public boolean insertUser(String uname,String password); 8 | public User getUser(String name); 9 | public User updateUserPassword(String password,String uname); 10 | public User updateUserTelphone(String uname, String telphone); 11 | } 12 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/service/IOrderService.java: -------------------------------------------------------------------------------- 1 | package com.byc.service; 2 | 3 | import com.byc.bean.OrderList; 4 | 5 | import java.util.List; 6 | import java.util.UUID; 7 | 8 | public interface IOrderService { 9 | public OrderList selectOrderById(String id); 10 | public List selectOrderByUserId(String userId); 11 | public List SelectOrderByCycleId(String cycleId); 12 | } 13 | -------------------------------------------------------------------------------- /vue-gc-web/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: [ 7 | 'plugin:vue/essential', 8 | '@vue/standard' 9 | ], 10 | parserOptions: { 11 | parser: 'babel-eslint' 12 | }, 13 | rules: { 14 | 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off', 15 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off' 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /vue-gc-web/README.md: -------------------------------------------------------------------------------- 1 | # vue-gc-web 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 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/GcSystemRouterMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | -------------------------------------------------------------------------------- /garbagecollection/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 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 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.byc.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 | @Configuration 8 | public class WebSocketConfig { 9 | @Bean 10 | public ServerEndpointExporter serverEndpointExporter() { 11 | return new ServerEndpointExporter(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /vue-gc-web/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | import getters from './getters' 4 | import login from './modules/login' 5 | 6 | Vue.use(Vuex) 7 | 8 | const state = { 9 | adminAndUser: { 10 | } 11 | } 12 | const mutations = { 13 | getAdminAndUser (state, data) { 14 | state.adminAndUser = JSON.parse(data) 15 | } 16 | } 17 | 18 | export default new Vuex.Store({ 19 | state, 20 | mutations, 21 | getters, 22 | modules: { 23 | login 24 | } 25 | }) 26 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/GarbagecollectionApplication.java: -------------------------------------------------------------------------------- 1 | package com.byc; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | 8 | @MapperScan(value = "com.byc.mapper") 9 | @SpringBootApplication 10 | public class GarbagecollectionApplication { 11 | 12 | public static void main(String[] args) { 13 | SpringApplication.run(GarbagecollectionApplication.class, args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/CommodityListMapper.java: -------------------------------------------------------------------------------- 1 | package com.byc.mapper; 2 | 3 | import com.byc.bean.CommodityList; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Mapper 10 | @Repository 11 | public interface CommodityListMapper { 12 | //生成商品列表 13 | int insertCommodity(String id,String commodity,float amount,String orderItemListId,float gPrice); 14 | //跟据orderItemListId来获取该订单相关的信息 15 | List selectOrderListInfo(String orderItemListId); 16 | } 17 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/vo/MsgVO.java: -------------------------------------------------------------------------------- 1 | package com.byc.vo; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import lombok.Data; 6 | 7 | @Data 8 | @ApiModel(description = "websocket消息内容") 9 | public class MsgVO { 10 | 11 | @ApiModelProperty(value = "用户id") 12 | private String userId; 13 | 14 | @ApiModelProperty(value = "用户名") 15 | private String username; 16 | 17 | @ApiModelProperty(value = "消息") 18 | private String msg; 19 | 20 | @ApiModelProperty(value = "在线人数") 21 | private int count; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/CommodityListMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | insert into commoditylist values (#{id},#{commodity},#{amount},#{orderItemListId},#{gPrice}) 8 | 9 | 12 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/enums/ResponseCodeEnum.java: -------------------------------------------------------------------------------- 1 | package com.byc.enums; 2 | 3 | public enum ResponseCodeEnum { 4 | SUCCESS(0,"SUCCESS"), 5 | 6 | ERROR(1,"ERROR"), 7 | 8 | WARN(2,"WARN "), 9 | 10 | NEED_LOGIN(10,"NEED_LOGIN"), 11 | 12 | ILLEGAL_ARGUMENT(2,"ILLEGAL_ARGUMENT"); 13 | private final int code; 14 | private final String desc; 15 | private ResponseCodeEnum(int code,String desc) { 16 | this.code = code; 17 | this.desc = desc; 18 | } 19 | 20 | public int getCode() { 21 | return code; 22 | } 23 | 24 | public String getDesc() { 25 | return desc; 26 | } 27 | } -------------------------------------------------------------------------------- /vue-gc-web/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import './plugins/element.js' 6 | // 导入全局样式表 7 | import './assets/css/global.css' 8 | import axios from 'axios' 9 | import VueAxios from 'vue-axios' 10 | import BaiduMap from 'vue-baidu-map' 11 | 12 | axios.defaults.baseURL = 'http://127.0.0.1:8081' 13 | // Vue.use(axios, VueAxios) 14 | Vue.use(VueAxios, axios) 15 | Vue.use(BaiduMap, { 16 | ak: 'GWPgqGL4WyTGqqnL6okKtGrZmZcc3F5U' // 官方提供的ak秘钥 17 | }) 18 | 19 | Vue.config.productionTip = false 20 | 21 | new Vue({ 22 | router, 23 | store, 24 | render: h => h(App) 25 | }).$mount('#app') 26 | -------------------------------------------------------------------------------- /vue-gc-web/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/service/IGarbageService.java: -------------------------------------------------------------------------------- 1 | package com.byc.service; 2 | 3 | import com.byc.bean.Garbage; 4 | import com.github.pagehelper.Page; 5 | 6 | import java.util.List; 7 | 8 | public interface IGarbageService { 9 | public boolean insertGarbageName(String gName,String gType,float gPrice,String gDesc,String image); 10 | public boolean updateGarbageInformation(String gName, String gType, String gDesc, String gPrice); 11 | 12 | public boolean deleteGarbageByName(String gName); 13 | public Garbage getGarbageByName(String name); 14 | public Page getGarbageListByType(String gType); 15 | public List getGarbageList(); 16 | public List getGarbageListByisCycle(int isCycle); 17 | } 18 | -------------------------------------------------------------------------------- /vue-gc-web/vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | devServer: { 3 | open: false, // 是否自动弹出浏览器页面 4 | host: 'localhost', 5 | port: '8080', 6 | https: false, 7 | hotOnly: false, 8 | disableHostCheck: true, 9 | clientLogLevel: 'info', 10 | proxy: { 11 | '/': { // 给代理的地址取别名 12 | target: 'http://127.0.0.1:8081', // API服务器的地址 13 | ws: true, // 代理websockets 14 | changeOrigin: true 15 | // pathRewrite: { // 重写路径 比如'/api/aaa/ccc'重写为'/aaa/ccc' 16 | // '^/api': '' 17 | // } 18 | } 19 | // '/baiduApi': { 20 | // target: 'https://aip.baidubce.com', // API服务器的地址 21 | // ws: true, // 代理websockets 22 | // changeOrigin: true 23 | // } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /vue-gc-web/src/utils/request.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | // import store from "../store"; 3 | 4 | const service = axios.create({ 5 | baseURL: 'http://localhost:8081', 6 | timeout: 1000 7 | }) 8 | 9 | // // 拦截器 10 | // service.interceptors.request.use( 11 | // // 展示进读条 12 | // config => { 13 | // // if (store.getters.token) { 14 | // // // 为请求头对象,添加 Token 验证的 Authorization 字段 15 | // // config.headers.Authorization = store.getters.token 16 | // // } 17 | // return config 18 | // }, 19 | // error => { 20 | // return Promise.reject(error) 21 | // } 22 | // ) 23 | // service.interceptors.response.use( 24 | // response => { 25 | // const res = response.data 26 | // return res 27 | // }, 28 | // error => { 29 | // return Promise.reject(error) 30 | // } 31 | // ) 32 | 33 | export default service 34 | -------------------------------------------------------------------------------- /vue-gc-web/src/store/modules/login.js: -------------------------------------------------------------------------------- 1 | import service from '../../utils/request' 2 | import qs from 'qs' 3 | 4 | const login = { 5 | namespaced: true, 6 | actions: { 7 | // 管理员登陆 8 | // async adminLogin (context, payload) { 9 | // const response = await service.post('/manage/user/login', qs.stringify(payload.data)) 10 | // return response 11 | // }, 12 | // 普通用户或管理员登陆 13 | async userLogin (context, payload) { 14 | const response = await service.post('/user/login', qs.stringify(payload.data)) 15 | return response 16 | }, 17 | // 用户注册 18 | async userRegister (context, payload) { 19 | const response = await service.post('user/register', qs.stringify(payload.data)) 20 | return response 21 | }, 22 | // 用户退出 23 | async userLogout () { 24 | const response = await service.post('/user/logout') 25 | return response 26 | } 27 | } 28 | } 29 | export default login 30 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/controller/GcRouterController.java: -------------------------------------------------------------------------------- 1 | package com.byc.controller; 2 | 3 | import com.byc.mapper.GcSystemRouterMapper; 4 | import io.swagger.annotations.Api; 5 | import io.swagger.annotations.ApiOperation; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | import org.springframework.web.bind.annotation.RestController; 10 | 11 | @RestController 12 | @Api(tags = "权限管理相关接口") 13 | @RequestMapping("/router") 14 | public class GcRouterController { 15 | 16 | @Autowired 17 | GcSystemRouterMapper gcSystemRouterMapper; 18 | 19 | @ApiOperation("添加新的垃圾种类信息") 20 | @GetMapping("/getRouterInfo") 21 | //根据登录的角色权限不同获得不同的路由 22 | public String getRouterInfo(int permission){ 23 | String routerByPermission = gcSystemRouterMapper.getRouterByPermission(permission); 24 | return routerByPermission; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/OrderListMapper.java: -------------------------------------------------------------------------------- 1 | package com.byc.mapper; 2 | 3 | import com.byc.bean.OrderList; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | import java.util.UUID; 9 | 10 | @Mapper 11 | @Repository 12 | public interface OrderListMapper { 13 | //添加新生成的订单(废弃) 14 | int addOrder(OrderList orderList); 15 | //通过订单号来查询订单 16 | OrderList selectOrderById(String id); 17 | //根据用户id来查询相关的订单 18 | List selectOrderByUserId(String userid); 19 | //回收人员来查询相关的订单 20 | List selectOrderByCycleId(String cycleid); 21 | //添加新生成的订单 22 | int generateOrder(String id,float payment,String address,String creationTime,String userid,int orderStatus); 23 | // 根据订单的状态来获取订单(用于回收人员接收) 24 | List getOrderInfoByOrderStatus(int orderStatus); 25 | // 改变订单的状态 26 | int changeOrderStatus(String id,String endTime,String cycleid,int orderStatus); 27 | } 28 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/bean/gcSystemRouter.java: -------------------------------------------------------------------------------- 1 | package com.byc.bean; 2 | 3 | 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | @ApiModel 9 | public class gcSystemRouter { 10 | @ApiModelProperty(value = "权限") 11 | private int gcPermission; 12 | @ApiModelProperty(value = "路由") 13 | private String gcRouter; 14 | 15 | public gcSystemRouter(){} 16 | 17 | public gcSystemRouter(int gcPermission, String gcRouter) { 18 | this.gcPermission = gcPermission; 19 | this.gcRouter = gcRouter; 20 | } 21 | 22 | public int getGcPermission() { 23 | return gcPermission; 24 | } 25 | 26 | public void setGcPermission(int gcPermission) { 27 | this.gcPermission = gcPermission; 28 | } 29 | 30 | public String getGcRouter() { 31 | return gcRouter; 32 | } 33 | 34 | public void setGcRouter(String gcRouter) { 35 | this.gcRouter = gcRouter; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/Filter/EncodingFilter.java: -------------------------------------------------------------------------------- 1 | package com.byc.Filter; 2 | 3 | 4 | import javax.servlet.*; 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import java.io.IOException; 8 | 9 | //用于utf-8的编码器 10 | public class EncodingFilter implements Filter { 11 | private String encoding = "UTF-8"; 12 | @Override 13 | public void init(FilterConfig filterConfig) throws ServletException { 14 | if (this.encoding == null) { 15 | this.encoding = filterConfig.getInitParameter("encoding"); 16 | } 17 | 18 | } 19 | 20 | @Override 21 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { 22 | HttpServletRequest request = (HttpServletRequest) servletRequest; 23 | HttpServletResponse response = (HttpServletResponse) servletResponse; 24 | request.setCharacterEncoding(encoding); 25 | response.setCharacterEncoding(encoding); 26 | filterChain.doFilter(request,response); 27 | } 28 | 29 | @Override 30 | public void destroy() { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/Filter/CrosFilter.java: -------------------------------------------------------------------------------- 1 | package com.byc.Filter; 2 | 3 | 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.servlet.*; 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | import java.io.IOException; 10 | 11 | @Component 12 | public class CrosFilter implements Filter { 13 | @Override 14 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 15 | throws IOException, ServletException { 16 | HttpServletResponse res = (HttpServletResponse) response; 17 | res.addHeader("Access-Control-Allow-Credentials", "true"); 18 | res.addHeader("Access-Control-Allow-Origin", "*"); 19 | res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); 20 | res.addHeader("Access-Control-Allow-Headers", "Content-Type,X-CAF-Authorization-Token,sessionToken,X-TOKEN"); 21 | if (((HttpServletRequest) request).getMethod().equals("OPTIONS")) { 22 | response.getWriter().println("ok"); 23 | return; 24 | } 25 | chain.doFilter(request, response); 26 | } 27 | @Override 28 | public void destroy() { 29 | } 30 | @Override 31 | public void init(FilterConfig filterConfig) throws ServletException { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.byc.config; 2 | 3 | import io.swagger.annotations.Contact; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import springfox.documentation.builders.ApiInfoBuilder; 7 | import springfox.documentation.builders.PathSelectors; 8 | import springfox.documentation.builders.RequestHandlerSelectors; 9 | import springfox.documentation.spi.DocumentationType; 10 | import springfox.documentation.spring.web.plugins.Docket; 11 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 12 | 13 | /* 14 | * 将swagger整合到springboot中 15 | * */ 16 | @Configuration 17 | @EnableSwagger2 18 | public class SwaggerConfig { 19 | @Bean 20 | public Docket createRestApi() { 21 | return new Docket(DocumentationType.SWAGGER_2) 22 | .pathMapping("/") 23 | .select() 24 | .apis(RequestHandlerSelectors.basePackage("com.byc.controller")) 25 | .paths(PathSelectors.any()) 26 | .build().apiInfo(new ApiInfoBuilder() 27 | .title("垃圾分类管理接口") 28 | .description("SpringBoot整合Swagger接口信息") 29 | .version("9.0") 30 | .license("The Apache License") 31 | .build()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.byc.mapper; 2 | 3 | import com.byc.bean.User; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | import org.springframework.stereotype.Component; 7 | import org.springframework.stereotype.Repository; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | import java.util.List; 11 | import java.util.UUID; 12 | 13 | @Mapper 14 | @Repository 15 | public interface UserMapper { 16 | //添加新的用户 17 | int addNewUser(User user); 18 | //更新用户 19 | int updateUser(User user); 20 | //查询用户根据用户名 21 | User getUserByName(String name); 22 | //查询所有的用户 23 | List getUserList(); 24 | //根据用户名查询出该用户是否存在 25 | int checkUser(String name); 26 | //验证密码的正确性 27 | User checkUserByPassword( String name, String password); 28 | //改变用户的使用状态 29 | int updateUserStatus(String id, int status); 30 | //管理员界面展示部分的用户信息 31 | List getPartUserInfo(); 32 | //根据用户名来删除用户信息 33 | int deleteUser(String uname); 34 | // to improve user information 35 | int improveInfo(@Param("uname") String uname,@Param("telphone")String telphone,@Param("email")String email,@Param("address")String address); 36 | //根据用户id来获取信息 37 | User getUserInfoById(String id); 38 | // 修改用户的金额(用于接单成功) 39 | int updateUserMoney(String id,float money); 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/GarbageMapper.java: -------------------------------------------------------------------------------- 1 | package com.byc.mapper; 2 | 3 | import com.byc.bean.Garbage; 4 | import com.github.pagehelper.Page; 5 | import org.apache.ibatis.annotations.Mapper; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | @Mapper 11 | @Repository 12 | public interface GarbageMapper { 13 | //添加新的垃圾 14 | int addGarbage(Garbage garbage); 15 | //修改垃圾的信息 16 | int updateGarbage(Garbage garbage); 17 | //删除垃圾的信息 18 | int deleteGarbage(String gname); 19 | //查询垃圾的信息通过垃圾种类名称(精确查询) 20 | Garbage getGarbageByName(String gName); 21 | //通过垃圾的名称来模糊查询相关信息 22 | List getGarbageByFuzzyName(String gName); 23 | //通过垃圾类型查找相关垃圾种类 24 | Page getGarbageListByType(String gType); 25 | //查询所有的垃圾信息 26 | List getGarbageList(); 27 | //根据垃圾可回收不可回收来查询相关垃圾种类 28 | List getGarbageListByisCycle(int isCycle); 29 | //获取部分垃圾信息用于展示 30 | List getPartGarbageList(); 31 | //根据id来修改垃圾的名称 32 | int updateGarbageNameById(String id,String gName); 33 | //根据id来修改垃圾的价格 34 | int updateGarbagePrice(String id, float gPrice); 35 | //根据垃圾的id来修该垃圾 36 | int deleteGarbageById(String id); 37 | // 根据垃圾的id来修改用户的信息 38 | int updateGarbageInfo(String id,float gPrice,String gType,String gDesc); 39 | //根据垃圾名称来上传图片 40 | int uploadImage(String image,String gName); 41 | } 42 | -------------------------------------------------------------------------------- /vue-gc-web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-gc-web", 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.19.2", 12 | "core-js": "^3.6.4", 13 | "element-ui": "^2.4.5", 14 | "qs": "^6.9.1", 15 | "vue": "^2.6.11", 16 | "vue-axios": "^2.1.5", 17 | "vue-baidu-map": "^0.21.22", 18 | "vue-router": "^3.1.5", 19 | "vuex": "^3.1.2" 20 | }, 21 | "devDependencies": { 22 | "@vue/cli-plugin-babel": "~4.2.0", 23 | "@vue/cli-plugin-eslint": "~4.2.0", 24 | "@vue/cli-plugin-router": "~4.2.0", 25 | "@vue/cli-plugin-vuex": "~4.2.0", 26 | "@vue/cli-service": "~4.2.0", 27 | "@vue/eslint-config-standard": "^5.1.0", 28 | "babel-eslint": "^10.0.3", 29 | "babel-plugin-component": "^1.1.1", 30 | "eslint": "^6.7.2", 31 | "eslint-plugin-import": "^2.20.1", 32 | "eslint-plugin-node": "^11.0.0", 33 | "eslint-plugin-promise": "^4.2.1", 34 | "eslint-plugin-standard": "^4.0.0", 35 | "eslint-plugin-vue": "^6.1.2", 36 | "less": "^3.11.1", 37 | "less-loader": "^5.0.0", 38 | "node-sass": "^4.13.1", 39 | "sass-loader": "^8.0.2", 40 | "vue-cli-plugin-element": "^1.0.1", 41 | "vue-template-compiler": "^2.6.11" 42 | }, 43 | "description": "## Project setup ``` npm install ```", 44 | "main": ".eslintrc.js", 45 | "author": "", 46 | "license": "ISC" 47 | } 48 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/utils/ApplicationContextUtil.java: -------------------------------------------------------------------------------- 1 | package com.byc.utils; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Arrays; 9 | import java.util.List; 10 | 11 | /** 12 | *

全局上下文工具类配置

13 | * 14 | * @description : 解决静态方法中mapper的调用 15 | */ 16 | @Slf4j 17 | public class ApplicationContextUtil { 18 | 19 | private static ApplicationContext applicationContext; 20 | 21 | public static void setApplicationContext(ApplicationContext ac) 22 | throws BeansException { 23 | applicationContext = ac; 24 | } 25 | 26 | public static ApplicationContext getApplicationContext() { 27 | return applicationContext; 28 | } 29 | 30 | /** 31 | * 根据Class类型在IOC容器中获取对象 32 | * @param clazz Class类型 33 | * @return 对象 34 | */ 35 | public static List getBeanByType(Class clazz) { 36 | List list = new ArrayList(); 37 | 38 | /* 获取接口的所有实例名 */ 39 | String[] beanNames = applicationContext.getBeanNamesForType(clazz); 40 | 41 | if (beanNames == null || beanNames.length == 0) { 42 | return list; 43 | } 44 | 45 | T t = null; 46 | for (String beanName : beanNames) { 47 | t = (T)applicationContext.getBean(beanName); 48 | list.add(t); 49 | } 50 | 51 | return list; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/bean/CommodityList.java: -------------------------------------------------------------------------------- 1 | package com.byc.bean; 2 | 3 | import io.swagger.annotations.Api; 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | 7 | @ApiModel 8 | public class CommodityList { 9 | @ApiModelProperty(value="单列商品id") 10 | private String id; 11 | @ApiModelProperty(value="商品id") 12 | private String commodity; 13 | @ApiModelProperty(value="商品数量") 14 | private float amount; 15 | @ApiModelProperty(value="商品价格") 16 | private float gPrice; 17 | 18 | public CommodityList(){} 19 | 20 | public CommodityList(String id, String commodity, float amount,float gPrice) { 21 | this.id = id; 22 | this.commodity = commodity; 23 | this.amount = amount; 24 | this.gPrice = gPrice; 25 | } 26 | 27 | public String getId() { 28 | return id; 29 | } 30 | 31 | public String getCommodity() { 32 | return commodity; 33 | } 34 | 35 | public float getAmount() { 36 | return amount; 37 | } 38 | 39 | public void setId(String id) { 40 | this.id = id; 41 | } 42 | 43 | public void setCommodity(String commodity) { 44 | this.commodity = commodity; 45 | } 46 | 47 | public void setAmount(float amount) { 48 | this.amount = amount; 49 | } 50 | 51 | public float getgPrice() { 52 | return gPrice; 53 | } 54 | 55 | public void setgPrice(float gPrice) { 56 | this.gPrice = gPrice; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/OrderListMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | insert into orderList values (#{id},#{payment},#{address},#{creationTime},#{endTime},#{userid},#{cycleid},#{orderStatus}) 8 | 9 | 12 | 15 | 18 | 19 | insert into orderList(id,payment,address,creationTime,userid,orderStatus) values (#{id},#{payment},#{address},#{creationTime},#{userid},#{orderStatus}) 20 | 21 | 24 | 25 | update orderList set orderStatus = 1,endTime = #{endTime},cycleid = #{cycleid} ,orderStatus=#{orderStatus} where id = #{id} 26 | 27 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/vo/Commodity.java: -------------------------------------------------------------------------------- 1 | package com.byc.vo; 2 | 3 | import java.io.Serializable; 4 | 5 | public class Commodity implements Serializable { 6 | //可回收物id 7 | private String id; 8 | //可回收物名称 9 | private String gName; 10 | //可回收物价格 11 | private float gPrice; 12 | //可回收物数量 13 | private float amount; 14 | //单项商品回收总价 15 | private float cycleMoney; 16 | 17 | public Commodity(){} 18 | 19 | public Commodity(String id, String gName, float gPrice, float amount, float cycleMoney) { 20 | this.id = id; 21 | this.gName = gName; 22 | this.gPrice = gPrice; 23 | this.amount = amount; 24 | this.cycleMoney = cycleMoney; 25 | } 26 | 27 | public String getId() { 28 | return id; 29 | } 30 | 31 | public void setId(String id) { 32 | this.id = id; 33 | } 34 | 35 | public String getgName() { 36 | return gName; 37 | } 38 | 39 | public void setgName(String gName) { 40 | this.gName = gName; 41 | } 42 | 43 | public float getgPrice() { 44 | return gPrice; 45 | } 46 | // 单项商品的总价为单价乘以数量 47 | public void setgPrice() { 48 | this.gPrice = this.amount*this.gPrice; 49 | } 50 | 51 | public float getAmount() { 52 | return amount; 53 | } 54 | 55 | public void setAmount(float amount) { 56 | this.amount = amount; 57 | } 58 | 59 | public float getCycleMoney() { 60 | return cycleMoney; 61 | } 62 | 63 | public void setCycleMoney(float cycleMoney) { 64 | this.cycleMoney = cycleMoney; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/MapSearch.vue: -------------------------------------------------------------------------------- 1 | 23 | 49 | 50 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/config/ImageServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.byc.config; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | @ConfigurationProperties(prefix = "ftp") 8 | public class ImageServerConfig { 9 | private String address; 10 | 11 | private Integer port; 12 | 13 | private String username; 14 | 15 | private String password; 16 | 17 | private String basePath; 18 | 19 | private String imageBaseUrl; 20 | 21 | public String getAddress() { 22 | return address; 23 | } 24 | 25 | public Integer getPort() { 26 | return port; 27 | } 28 | 29 | public String getUsername() { 30 | return username; 31 | } 32 | 33 | public String getPassword() { 34 | return password; 35 | } 36 | 37 | public String getbasePath() { 38 | return basePath; 39 | } 40 | 41 | public String getImageBaseUrl() { 42 | return imageBaseUrl; 43 | } 44 | 45 | public void setAddress(String address) { 46 | this.address = address; 47 | } 48 | 49 | public void setPort(Integer port) { 50 | this.port = port; 51 | } 52 | 53 | public void setUsername(String username) { 54 | this.username = username; 55 | } 56 | 57 | public void setPassword(String password) { 58 | this.password = password; 59 | } 60 | 61 | public void setbasePath(String basePath) { 62 | this.basePath = basePath; 63 | } 64 | 65 | public void setImageBaseUrl(String imageBaseUrl) { 66 | this.imageBaseUrl = imageBaseUrl; 67 | } 68 | public ImageServerConfig(){ 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/WatchOrder.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 68 | -------------------------------------------------------------------------------- /vue-gc-web/src/plugins/element.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import { 3 | Form, 4 | FormItem, 5 | Message, 6 | Button, 7 | Input, 8 | Header, 9 | Footer, 10 | Main, 11 | Container, 12 | Link, 13 | Tabs, 14 | TabPane, 15 | Radio, 16 | Step, 17 | Steps, 18 | Menu, 19 | MenuItem, 20 | Carousel, 21 | CarouselItem, 22 | Dialog, 23 | Breadcrumb, 24 | BreadcrumbItem, 25 | Table, 26 | TableColumn, 27 | InputNumber, 28 | MessageBox, 29 | Divider, 30 | Option, 31 | Select, 32 | Card, 33 | Pagination, 34 | Tooltip, 35 | Aside, 36 | MenuItemGroup, 37 | Submenu, 38 | Row, 39 | Col, 40 | Tag, 41 | Image, 42 | Upload, 43 | Dropdown, 44 | DropdownItem, 45 | DropdownMenu, 46 | Switch, 47 | Autocomplete, 48 | Popconfirm, 49 | Loading 50 | } from 'element-ui' 51 | 52 | Vue.use(Popconfirm) 53 | Vue.use(Form) 54 | Vue.use(FormItem) 55 | Vue.use(Button) 56 | Vue.use(Input) 57 | Vue.use(Header) 58 | Vue.use(Main) 59 | Vue.use(Footer) 60 | Vue.use(Container) 61 | Vue.use(Link) 62 | Vue.use(Tabs) 63 | Vue.use(TabPane) 64 | Vue.use(Radio) 65 | Vue.use(Steps) 66 | Vue.use(Step) 67 | Vue.use(Menu) 68 | Vue.use(MenuItem) 69 | Vue.use(Carousel) 70 | Vue.use(CarouselItem) 71 | Vue.use(Dialog) 72 | Vue.use(BreadcrumbItem) 73 | Vue.use(Breadcrumb) 74 | Vue.use(Table) 75 | Vue.use(TableColumn) 76 | Vue.use(InputNumber) 77 | Vue.use(Divider) 78 | Vue.use(Select) 79 | Vue.use(Option) 80 | Vue.use(Card) 81 | Vue.use(Pagination) 82 | Vue.use(Tooltip) 83 | Vue.use(Aside) 84 | Vue.use(MenuItemGroup) 85 | Vue.use(Submenu) 86 | Vue.use(Row) 87 | Vue.use(Col) 88 | Vue.use(Tag) 89 | Vue.use(Image) 90 | Vue.use(Upload) 91 | Vue.use(Dropdown) 92 | Vue.use(DropdownMenu) 93 | Vue.use(DropdownItem) 94 | Vue.use(Switch) 95 | Vue.use(Autocomplete) 96 | Vue.use(Loading) 97 | Vue.prototype.$message = Message 98 | Vue.prototype.$confirm = MessageBox.confirm 99 | Vue.prototype.$prompt = MessageBox.prompt 100 | Vue.prototype.$alert = MessageBox.alert 101 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/vo/OrderShow.java: -------------------------------------------------------------------------------- 1 | package com.byc.vo; 2 | 3 | 4 | import com.byc.bean.CommodityList; 5 | 6 | import java.util.List; 7 | 8 | public class OrderShow { 9 | //订单商品集合 10 | private List commodityLists; 11 | //该订单总价 12 | private float total; 13 | //上门回收地址 14 | private String address; 15 | //订单创建日期 16 | private String creationTime; 17 | //订单状态 18 | private int orderStatus; 19 | //订单id 20 | private String orderId; 21 | 22 | public OrderShow(){} 23 | 24 | public OrderShow(List commodityLists, float total, String address, String creationTime, int orderStatus,String orderId) { 25 | this.commodityLists = commodityLists; 26 | this.total = total; 27 | this.address = address; 28 | this.creationTime = creationTime; 29 | this.orderStatus = orderStatus; 30 | this.orderId = orderId; 31 | } 32 | 33 | public List getCommodityLists() { 34 | return commodityLists; 35 | } 36 | 37 | public void setCommodityLists(List commodityLists) { 38 | this.commodityLists = commodityLists; 39 | } 40 | 41 | public float getTotal() { 42 | return total; 43 | } 44 | 45 | public void setTotal(float total) { 46 | this.total = total; 47 | } 48 | 49 | public String getAddress() { 50 | return address; 51 | } 52 | 53 | public void setAddress(String address) { 54 | this.address = address; 55 | } 56 | 57 | public String getCreationTime() { 58 | return creationTime; 59 | } 60 | 61 | public void setCreationTime(String creationTime) { 62 | this.creationTime = creationTime; 63 | } 64 | 65 | public int getOrderStatus() { 66 | return orderStatus; 67 | } 68 | 69 | public void setOrderStatus(int orderStatus) { 70 | this.orderStatus = orderStatus; 71 | } 72 | 73 | public String getOrderId() { 74 | return orderId; 75 | } 76 | 77 | public void setOrderId(String orderId) { 78 | this.orderId = orderId; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Dry.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 86 | 87 | 90 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | INSERT INTO USER VALUES (#{id},#{uname},#{upassword},#{role},#{telphone},#{userStatus},#{email},#{registerTime},#{address},#{money}) 9 | 10 | 11 | 12 | UPDATE USER SET upassword=#{upassword},telphone=#{telphone} where uname=#{uname} 13 | 14 | 15 | 18 | 19 | 22 | 23 | 26 | 27 | 30 | 31 | 32 | update user set userStatus = #{param2} where id=#{param1} 33 | 34 | 35 | 38 | 39 | 40 | delete from user where uname=#{uname} 41 | 42 | 43 | update user set telphone=#{telphone},email=#{email},address=#{address} where uname=#{uname} 44 | 45 | 48 | 49 | update user set money = #{money} where id = #{id} 50 | 51 | 52 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Harmful.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 85 | 86 | 89 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Wet.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 87 | 88 | 91 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/bean/Garbage.java: -------------------------------------------------------------------------------- 1 | package com.byc.bean; 2 | 3 | 4 | import io.swagger.annotations.ApiModel; 5 | import io.swagger.annotations.ApiModelProperty; 6 | 7 | @ApiModel 8 | public class Garbage { 9 | @ApiModelProperty(value="垃圾id") 10 | private String id; 11 | @ApiModelProperty(value="垃圾名称") 12 | private String gName; 13 | @ApiModelProperty(value="垃圾类型") 14 | private String gType; 15 | @ApiModelProperty(value="垃圾价格") 16 | private float gPrice; 17 | @ApiModelProperty(value="垃圾描述") 18 | private String gDesc; 19 | @ApiModelProperty(value="是否可回收") 20 | private int isCycle; 21 | @ApiModelProperty(value = "图片存储服务器的地址") 22 | private String image; 23 | 24 | public void setId(String id) { 25 | this.id = id; 26 | } 27 | 28 | public void setgName(String gName) { 29 | this.gName = gName; 30 | } 31 | 32 | public void setgType(String gType) { 33 | this.gType = gType; 34 | } 35 | 36 | public void setgPrice(float gPrice) { 37 | this.gPrice = gPrice; 38 | } 39 | 40 | public void setgDesc(String gDesc) { 41 | this.gDesc = gDesc; 42 | } 43 | 44 | public void setIsCycle(int isCycle) { 45 | this.isCycle = isCycle; 46 | } 47 | 48 | public void setimage(String image) { 49 | this.image = image; 50 | } 51 | 52 | public String getId() { 53 | return id; 54 | } 55 | 56 | public String getgName() { 57 | return gName; 58 | } 59 | 60 | public String getgType() { 61 | return gType; 62 | } 63 | 64 | public float getgPrice() { 65 | return gPrice; 66 | } 67 | 68 | public String getgDesc() { 69 | return gDesc; 70 | } 71 | 72 | public int getIsCycle() { 73 | return isCycle; 74 | } 75 | 76 | public String getimage() { 77 | return image; 78 | } 79 | 80 | public Garbage(){ 81 | 82 | } 83 | 84 | public Garbage(String id, String gName, String gType, float gPrice, String gDesc, int isCycle, String image) { 85 | this.id = id; 86 | this.gName = gName; 87 | this.gType = gType; 88 | this.gPrice = gPrice; 89 | this.gDesc = gDesc; 90 | this.isCycle = isCycle; 91 | this.image = image; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Recycle.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 90 | 91 | 94 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/mapper/GarbageMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | insert into garbage values (#{id},#{gName},#{gType},#{gPrice},#{gDesc},#{isCycle},#{image}) 8 | 9 | 10 | update garbage set gType=#{gType},gPrice=#{gPrice},gDesc=#{gDesc},isCycle=#{isCycle} where gName=#{gName} 11 | 12 | 13 | delete from garbage where gname=#{gName} 14 | 15 | 16 | delete from garbage where id=#{id} 17 | 18 | 21 | 24 | 27 | 30 | 33 | 36 | 37 | update garbage set gName=#{param2} where id=#{param1} 38 | 39 | 40 | update garbage set gPrice=#{param2} where id=#{param1} 41 | 42 | 43 | update garbage set gType=#{gType},gPrice=#{gPrice},gDesc=#{gDesc} where id=#{id} 44 | 45 | 46 | update garbage set image=#{image} where gName=#{gName} 47 | 48 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/ManageOrder.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 74 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/UploadImage.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 72 | 73 | 99 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/common/ServerResponse.java: -------------------------------------------------------------------------------- 1 | package com.byc.common; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 5 | import com.byc.enums.ResponseCodeEnum; 6 | import java.io.Serializable; 7 | 8 | // 需要进行序列化 9 | @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) 10 | public class ServerResponse implements Serializable { 11 | private int status; 12 | private String msg; 13 | private T data; 14 | 15 | private ServerResponse(int status, String msg, T data) { 16 | this.status = status; 17 | this.msg = msg; 18 | this.data = data; 19 | } 20 | 21 | private ServerResponse(int status) { 22 | this.status = status; 23 | } 24 | 25 | private ServerResponse(int status, String msg) { 26 | this.status = status; 27 | this.msg = msg; 28 | } 29 | 30 | private ServerResponse(int status, T data) { 31 | this.status = status; 32 | this.data = data; 33 | } 34 | 35 | public int getStatus() { 36 | return status; 37 | } 38 | 39 | 40 | public String getMsg() { 41 | return msg; 42 | } 43 | 44 | 45 | public T getData() { 46 | return data; 47 | } 48 | 49 | 50 | // 判断是否是个正确的响应 51 | @JsonIgnore 52 | public boolean isSuccess() { 53 | return this.status == ResponseCodeEnum.SUCCESS.getCode(); 54 | } 55 | 56 | public static ServerResponse createBySuccess() { 57 | return new ServerResponse(ResponseCodeEnum.SUCCESS.getCode()); 58 | } 59 | 60 | public static ServerResponse createBySuccessMessage(String msg) { 61 | return new ServerResponse(ResponseCodeEnum.SUCCESS.getCode(), msg); 62 | } 63 | 64 | public static ServerResponse createBySuccess(T data) { 65 | return new ServerResponse(ResponseCodeEnum.SUCCESS.getCode(), data); 66 | } 67 | 68 | public static ServerResponse createBySuccess(String msg, T data) { 69 | return new ServerResponse(ResponseCodeEnum.SUCCESS.getCode(), msg, data); 70 | } 71 | 72 | public static ServerResponse createByError() { 73 | return new ServerResponse(ResponseCodeEnum.ERROR.getCode(), ResponseCodeEnum.ERROR.getDesc()); 74 | } 75 | public static ServerResponse createByWarnMessage(String msg) { 76 | return new ServerResponse(ResponseCodeEnum.WARN.getCode(), msg); 77 | } 78 | 79 | public static ServerResponse createByErrorMessage(String msg) { 80 | return new ServerResponse(ResponseCodeEnum.ERROR.getCode(), msg); 81 | } 82 | 83 | public static ServerResponse createByErrorCodeMessage(int code, String msg) { 84 | return new ServerResponse(code, msg); 85 | } 86 | } -------------------------------------------------------------------------------- /vue-gc-web/src/components/MapGeo.vue: -------------------------------------------------------------------------------- 1 | 15 | 81 | 82 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/bean/OrderList.java: -------------------------------------------------------------------------------- 1 | package com.byc.bean; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | @ApiModel 7 | public class OrderList { 8 | @ApiModelProperty(value="订单id") 9 | private String id; 10 | @ApiModelProperty(value="支付金额") 11 | private float payment; 12 | @ApiModelProperty(value="地址") 13 | private String address; 14 | @ApiModelProperty(value="创建时间") 15 | 16 | private String creationTime; 17 | @ApiModelProperty(value="结束时间") 18 | 19 | private String endTime; 20 | @ApiModelProperty(value="用户id") 21 | private String userid; 22 | @ApiModelProperty(value="回收人员id") 23 | private String cycleid; 24 | @ApiModelProperty(value="订单状态") 25 | private int orderStatus; 26 | 27 | public OrderList(){} 28 | public OrderList(String id, float payment, String address, String creationTime, String endTime, String userid, String cycleid,int orderStatus) { 29 | this.id = id; 30 | this.payment = payment; 31 | this.address = address; 32 | this.creationTime = creationTime; 33 | this.endTime = endTime; 34 | this.userid = userid; 35 | this.cycleid = cycleid; 36 | this.orderStatus = orderStatus; 37 | } 38 | 39 | public String getId() { 40 | return id; 41 | } 42 | 43 | public float getPayment() { 44 | return payment; 45 | } 46 | 47 | public String getCreationTime() { 48 | return creationTime; 49 | } 50 | 51 | public String getEndTime() { 52 | return endTime; 53 | } 54 | 55 | public String getUserid() { 56 | return userid; 57 | } 58 | 59 | public String getCycleid() { 60 | return cycleid; 61 | } 62 | 63 | public void setId(String id) { 64 | this.id = id; 65 | } 66 | 67 | public void setPayment(float payment) { 68 | this.payment = payment; 69 | } 70 | 71 | 72 | public void setCreationTime(String creationTime) { 73 | this.creationTime = creationTime; 74 | } 75 | 76 | public void setEndTime(String endTime) { 77 | this.endTime = endTime; 78 | } 79 | 80 | public void setUserid(String userid) { 81 | this.userid = userid; 82 | } 83 | 84 | public void setCycleid(String cycleid) { 85 | this.cycleid = cycleid; 86 | } 87 | 88 | public String getAddress() { 89 | return address; 90 | } 91 | 92 | public int getOrderStatus() { 93 | return orderStatus; 94 | } 95 | 96 | public void setAddress(String address) { 97 | this.address = address; 98 | } 99 | 100 | public void setOrderStatus(int orderStatus) { 101 | this.orderStatus = orderStatus; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Search.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 94 | 95 | 117 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/bean/User.java: -------------------------------------------------------------------------------- 1 | package com.byc.bean; 2 | 3 | import io.swagger.annotations.ApiModel; 4 | import io.swagger.annotations.ApiModelProperty; 5 | import org.joda.time.DateTime; 6 | 7 | import java.io.Serializable; 8 | import java.util.UUID; 9 | 10 | /* 11 | * create by byc*/ 12 | @ApiModel 13 | public class User implements Serializable { 14 | @ApiModelProperty(value = "用户id") 15 | private String id; 16 | @ApiModelProperty(value = "用户名") 17 | private String uname; 18 | @ApiModelProperty(value = "用户密码") 19 | private String upassword; 20 | @ApiModelProperty(value = "用户角色") 21 | private int role=0; 22 | @ApiModelProperty(value = "用户电话") 23 | private String telphone; 24 | @ApiModelProperty(value = "用户状态") 25 | // 1代表正常使用,0代表禁用 26 | private int userStatus =1; 27 | @ApiModelProperty(value = "邮箱") 28 | private String email; 29 | @ApiModelProperty(value = "注册时间") 30 | private String registerTime; 31 | @ApiModelProperty(value = "地址") 32 | private String address; 33 | @ApiModelProperty(value = "账户金额") 34 | private float money; 35 | 36 | //有参构造器 37 | public User(String id, String uname, String upassword, int role, String telphone,int userStatus,String email,String registerTime,String address,float money) { 38 | this.id = id; 39 | this.uname = uname; 40 | this.upassword = upassword; 41 | this.role = role; 42 | this.telphone = telphone; 43 | this.userStatus = userStatus; 44 | this.email = email; 45 | this.registerTime = registerTime; 46 | this.address = address; 47 | this.money = money; 48 | } 49 | 50 | //无参构造器 51 | public User(){} 52 | 53 | public String getId() { 54 | return id; 55 | } 56 | 57 | public void setId(String id) { 58 | this.id = id; 59 | } 60 | 61 | public String getUname() { 62 | return uname; 63 | } 64 | 65 | public void setUname(String uname) { 66 | this.uname = uname; 67 | } 68 | 69 | public String getUpassword() { 70 | return upassword; 71 | } 72 | 73 | public void setUpassword(String upassword) { 74 | this.upassword = upassword; 75 | } 76 | 77 | public int getRole() { 78 | return role; 79 | } 80 | 81 | public void setRole(int role) { 82 | this.role = role; 83 | } 84 | 85 | public String getTelphone() { 86 | return telphone; 87 | } 88 | 89 | public void setTelphone(String telphone) { 90 | this.telphone = telphone; 91 | } 92 | 93 | public int getUserStatus() { 94 | return userStatus; 95 | } 96 | 97 | public void setUserStatus(int userStatus) { 98 | this.userStatus = userStatus; 99 | } 100 | 101 | public String getEmail() { 102 | return email; 103 | } 104 | 105 | public void setEmail(String email) { 106 | this.email = email; 107 | } 108 | 109 | public String getRegisterTime() { 110 | return registerTime; 111 | } 112 | 113 | public void setRegisterTime(String registerTime) { 114 | this.registerTime = registerTime; 115 | } 116 | 117 | public String getAddress() { 118 | return address; 119 | } 120 | 121 | public void setAddress(String address) { 122 | this.address = address; 123 | } 124 | 125 | public float getMoney() { 126 | return money; 127 | } 128 | 129 | public void setMoney(float money) { 130 | this.money = money; 131 | } 132 | 133 | 134 | 135 | } 136 | -------------------------------------------------------------------------------- /vue-gc-web/src/utils/quill-config.js: -------------------------------------------------------------------------------- 1 | import store from '../store' 2 | /* 富文本编辑图片上传配置 */ 3 | const uploadConfig = { 4 | action: 'common.uploadfile.single', // 必填参数 图片上传地址 5 | methods: 'POST', // 必填参数 图片上传方式 6 | token: '', // 可选参数 如果需要token验证,假设你的token有存放在sessionStorage 7 | name: 'img', // 必填参数 文件的参数名 8 | size: 1024, // 可选参数 图片大小,单位为Kb, 1M = 1024Kb 9 | accept: 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon' // 可选 可上传的图片格式 10 | } 11 | 12 | // toolbar工具栏的工具选项(默认展示全部) 13 | const toolOptions = [ 14 | ['bold', 'italic', 'underline', 'strike'], 15 | ['blockquote', 'code-block'], 16 | [{ 17 | header: 1 18 | }, { 19 | header: 2 20 | }], 21 | [{ 22 | list: 'ordered' 23 | }, { 24 | list: 'bullet' 25 | }], 26 | [{ 27 | script: 'sub' 28 | }, { 29 | script: 'super' 30 | }], 31 | [{ 32 | indent: '-1' 33 | }, { 34 | indent: '+1' 35 | }], 36 | [{ 37 | direction: 'rtl' 38 | }], 39 | [{ 40 | size: ['small', false, 'large', 'huge'] 41 | }], 42 | [{ 43 | header: [1, 2, 3, 4, 5, 6, false] 44 | }], 45 | [{ 46 | color: [] 47 | }, { 48 | background: [] 49 | }], 50 | [{ 51 | font: [] 52 | }], 53 | [{ 54 | align: [] 55 | }], 56 | ['clean'], 57 | ['link', 'image', 'video'] 58 | ] 59 | const handlers = { 60 | image: function image () { 61 | var self = this 62 | 63 | var fileInput = this.container.querySelector('input.ql-image[type=file]') 64 | if (fileInput === null) { 65 | fileInput = document.createElement('input') 66 | fileInput.setAttribute('type', 'file') 67 | // 设置图片参数名 68 | if (uploadConfig.name) { 69 | fileInput.setAttribute('name', uploadConfig.name) 70 | } 71 | // 可设置上传图片的格式 72 | fileInput.setAttribute('accept', uploadConfig.accept) 73 | fileInput.classList.add('ql-image') 74 | // 监听选择文件 75 | fileInput.addEventListener('change', function () { 76 | // 创建formData 77 | const formData = new FormData() 78 | formData.append('upload_file', fileInput.files[0]) 79 | fileInput.value = '' 80 | // 这里 请求 81 | store.dispatch({ 82 | type: 'goods/richTextImgUpload', 83 | data: formData 84 | }).then(res => { 85 | var path = res.file_path 86 | // 这里很重要,你图片上传成功后,img的src需要在这里添加,res.path就是你服务器返回的图片链接。 87 | self.quill.insertEmbed(length, 'image', path) 88 | self.quill.setSelection(length + 1) 89 | fileInput.value = '' 90 | }) 91 | // btwApiUtil.post('common.uploadfile.single', {}, function (resp) { 92 | // var path = resp.data.ftpPath; 93 | // var picPath = process.env.FTP_URL + path; 94 | // let length = self.quill.getSelection(true).index; 95 | // //这里很重要,你图片上传成功后,img的src需要在这里添加,res.path就是你服务器返回的图片链接。 96 | // self.quill.insertEmbed(length, 'image', picPath); 97 | // self.quill.setSelection(length + 1) 98 | // fileInput.value = '' 99 | // }, formData); 100 | }) 101 | this.container.appendChild(fileInput) 102 | } 103 | fileInput.click() 104 | } 105 | } 106 | export default { 107 | placeholder: '', 108 | theme: 'snow', // 主题 109 | modules: { 110 | toolbar: { 111 | container: toolOptions, // 工具栏选项 112 | handlers: handlers // 事件重写 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /garbagecollection/src/main/resources/mybatis-generator.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 39 | 46 | 47 | 48 |
49 | 56 | 57 | 58 |
59 | 66 | 67 | 68 |
69 |
70 |
-------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/utils/FtpUtil.java: -------------------------------------------------------------------------------- 1 | package com.byc.utils; 2 | 3 | import org.apache.commons.net.ftp.FTP; 4 | import org.apache.commons.net.ftp.FTPClient; 5 | import org.apache.commons.net.ftp.FTPReply; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | 11 | // file translate protocol 12 | public class FtpUtil { 13 | public static Boolean uploadFile(String host, int port, String username, String password, String basePath, 14 | String filePath, String fileName, InputStream inputStream) throws IOException { 15 | //1、创建临时路径 16 | String tempPath = ""; 17 | //2、创建FTPClient对象(对于连接ftp服务器,以及上传和上传都必须要用到一个对象) 18 | FTPClient ftp = new FTPClient(); 19 | try { 20 | //3、定义返回的状态码 21 | int reply; 22 | //4、连接ftp(当前项目所部署的服务器和ftp服务器之间可以相互通讯,表示连接成功) 23 | ftp.connect(host, port); 24 | //5、输入账号和密码进行登录 25 | ftp.login(username, password); 26 | //6、接受状态码(如果成功,返回230,如果失败返回503) 27 | reply = ftp.getReplyCode(); 28 | //7、根据状态码检测ftp的连接,调用isPositiveCompletion(reply)-->如果连接成功返回true,否则返回false 29 | if (!FTPReply.isPositiveCompletion(reply)) { 30 | //说明连接失败,需要断开连接 31 | ftp.disconnect(); 32 | return false; 33 | } 34 | //8、changWorkingDirectory(linux上的文件夹):检测所传入的目录是否存在,如果存在返回true,否则返回false 35 | //basePath+filePath-->home/ftp/www/2019/09/02 36 | if (!ftp.changeWorkingDirectory(basePath + filePath)) { 37 | //9、截取filePath:2019/09/02-->String[]:2019,09,02 38 | String[] dirs = filePath.split("/"); 39 | //10、把basePath(/home/ftp/www)-->tempPath 40 | tempPath = basePath; 41 | for (String dir : dirs) { 42 | //11、循环数组(第一次循环-->2019) 43 | if (null == dir || "".equals(dir)) 44 | continue;//跳出本地循环,进入下一次循环 45 | //12、更换临时路径:/home/ftp/www/2019 46 | tempPath += "/" + dir; 47 | //13、再次检测路径是否存在(/home/ftp/www/2019)-->返回false,说明路径不存在 48 | if (!ftp.changeWorkingDirectory(tempPath)) { 49 | //14、makeDirectory():创建目录 返回Boolean雷类型,成功返回true 50 | if (!ftp.makeDirectory(tempPath)) { 51 | return false; 52 | } else { 53 | //15、严谨判断(重新检测路径是否真的存在(检测是否创建成功)) 54 | ftp.changeWorkingDirectory(tempPath); 55 | } 56 | } 57 | } 58 | } 59 | //16.把文件转换为二进制字符流的形式进行上传 60 | ftp.setFileType(FTP.BINARY_FILE_TYPE); 61 | //17、这才是真正上传方法storeFile(filename,input),返回Boolean雷类型,上传成功返回true 62 | if (!ftp.storeFile(fileName, inputStream)) { 63 | return false; 64 | } 65 | // 18.关闭输入流 66 | inputStream.close(); 67 | // 19.退出ftp 68 | ftp.logout(); 69 | } catch (IOException e) { 70 | e.printStackTrace(); 71 | throw new IOException(e); 72 | } finally { 73 | if (ftp.isConnected()) { 74 | try { 75 | // 20.断开ftp的连接 76 | ftp.disconnect(); 77 | } catch (IOException ioe) { 78 | ioe.printStackTrace(); 79 | } 80 | } 81 | } 82 | return true; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/service/serviceImpls/UserService.java: -------------------------------------------------------------------------------- 1 | package com.byc.service.serviceImpls; 2 | 3 | import com.byc.bean.User; 4 | import com.byc.common.ServerResponse; 5 | import com.byc.mapper.UserMapper; 6 | import com.byc.service.IUserService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | import org.springframework.web.bind.annotation.PathVariable; 11 | 12 | import java.io.Serializable; 13 | import java.text.SimpleDateFormat; 14 | import java.util.Date; 15 | import java.util.List; 16 | import java.util.UUID; 17 | 18 | @Service 19 | @Transactional 20 | public class UserService implements IUserService, Serializable { 21 | @Autowired 22 | UserMapper userMapper; 23 | //添加新的用户 24 | public boolean insertUser(String uname,String password){ 25 | User user = new User(); 26 | user.setId(UUID.randomUUID().toString()); 27 | user.setUname(uname); 28 | user.setUpassword(password); 29 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 30 | user.setRegisterTime(simpleDateFormat.format(new Date())); 31 | //返回修改的行数 32 | int i = userMapper.addNewUser(user); 33 | if(i>0) 34 | return true; 35 | else 36 | return false; 37 | } 38 | //根据名字查出用户信息 39 | public User getUser(String name){ 40 | User user=userMapper.getUserByName(name); 41 | return user; 42 | } 43 | 44 | //根据用户的用户名来判断用户已经存在(用户注册界面) 45 | public ServerResponse register(String username){ 46 | int i = userMapper.checkUser(username); 47 | if(i>0){ 48 | return ServerResponse.createByWarnMessage("用户已存在"); 49 | } 50 | return ServerResponse.createByErrorMessage("用户名不存在"); 51 | } 52 | //根据用户输入的用户名来判断是否存在(用于登录界面) 53 | public ServerResponse login(String username, String password) { 54 | int i = userMapper.checkUser(username); 55 | if ( i== 0) { 56 | return ServerResponse.createByErrorMessage("用户名不存在"); 57 | } 58 | User user = userMapper.checkUserByPassword(username, password); 59 | if ( user==null) { 60 | return ServerResponse.createByErrorMessage("密码错误"); 61 | } 62 | return ServerResponse.createBySuccess("登陆成功", user); 63 | } 64 | //根据名称来修改密码 65 | public User updateUserPassword(String password,String uname){ 66 | User user = userMapper.getUserByName(uname); 67 | user.setUpassword(password); 68 | userMapper.updateUser(user); 69 | return user; 70 | } 71 | //根据名称来修改电话 72 | public User updateUserTelphone(String uname, String telphone){ 73 | User user = userMapper.getUserByName(uname); 74 | user.setTelphone(telphone); 75 | userMapper.updateUser(user); 76 | return user; 77 | } 78 | 79 | //根据id来修改用户的状态 80 | public int updateUserStatus(String id , int status){ 81 | int i = userMapper.updateUserStatus(id, status); 82 | return i; 83 | 84 | } 85 | 86 | //管理员拿到部分用户信息展览到界面 87 | public List getPartUserInfo(){ 88 | List partUserInfo = userMapper.getPartUserInfo(); 89 | return partUserInfo; 90 | } 91 | 92 | //根据用户名来删除用户信息 93 | public int deleteUserService(String uname){ 94 | int i = userMapper.deleteUser(uname); 95 | return i; 96 | } 97 | 98 | //improve user information service 99 | public int improveInfoServie(String uname,String telphone,String email,String address){ 100 | int i = userMapper.improveInfo(uname, telphone, email, address); 101 | return i; 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/controller/WebSocketServerController.java: -------------------------------------------------------------------------------- 1 | package com.byc.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.byc.bean.User; 5 | import com.byc.mapper.UserMapper; 6 | import com.byc.utils.ApplicationContextUtil; 7 | import com.byc.vo.MsgVO; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Component; 10 | 11 | import javax.websocket.*; 12 | import javax.websocket.server.PathParam; 13 | import javax.websocket.server.ServerEndpoint; 14 | import java.io.IOException; 15 | import java.util.ArrayList; 16 | import java.util.HashSet; 17 | import java.util.List; 18 | import java.util.Set; 19 | import java.util.concurrent.ConcurrentHashMap; 20 | 21 | @Slf4j 22 | @Component 23 | @ServerEndpoint("/groupChat/{sid}/{userId}") 24 | public class WebSocketServerController { 25 | 26 | /** 27 | * 房间号 -> 组成员信息 28 | */ 29 | private static ConcurrentHashMap> groupMemberInfoMap = new ConcurrentHashMap<>(); 30 | /** 31 | * 房间号 -> 在线人数 32 | */ 33 | private static ConcurrentHashMap> onlineUserMap = new ConcurrentHashMap<>(); 34 | 35 | /** 36 | * 收到消息调用的方法,群成员发送消息 37 | * 38 | * @param sid:房间号 39 | * @param userId:用户id 40 | * @param message:发送消息 41 | */ 42 | @OnMessage 43 | public void onMessage(@PathParam("sid") String sid, @PathParam("userId") String userId, String message) { 44 | List sessionList = groupMemberInfoMap.get(sid); 45 | Set onlineUserList = onlineUserMap.get(sid); 46 | // 先一个群组内的成员发送消息 47 | sessionList.forEach(item -> { 48 | try { 49 | // json字符串转对象 50 | MsgVO msg = JSONObject.parseObject(message, MsgVO.class); 51 | msg.setCount(onlineUserList.size()); 52 | // json对象转字符串 53 | String text = JSONObject.toJSONString(msg); 54 | item.getBasicRemote().sendText(text); 55 | } catch (IOException e) { 56 | e.printStackTrace(); 57 | } 58 | }); 59 | } 60 | 61 | /** 62 | * 建立连接调用的方法,群成员加入 63 | * 64 | * @param session 65 | * @param sid 66 | */ 67 | @OnOpen 68 | public void onOpen(Session session, @PathParam("sid") String sid, @PathParam("userId") String userId) { 69 | List sessionList = groupMemberInfoMap.computeIfAbsent(sid, k -> new ArrayList<>()); 70 | Set onlineUserList = onlineUserMap.computeIfAbsent(sid, k -> new HashSet<>()); 71 | onlineUserList.add(userId); 72 | sessionList.add(session); 73 | // 发送上线通知 74 | sendInfo(sid, userId, onlineUserList.size(), "上线了~"); 75 | } 76 | 77 | 78 | public void sendInfo(String sid, String userId, Integer onlineSum, String info) { 79 | // 获取该连接用户信息 80 | User currentUser = ApplicationContextUtil.getApplicationContext().getBean(UserMapper.class).getUserInfoById(userId); 81 | // 发送通知 82 | MsgVO msg = new MsgVO(); 83 | msg.setCount(onlineSum); 84 | msg.setUserId(userId); 85 | // json对象转字符串 86 | String text = JSONObject.toJSONString(msg); 87 | onMessage(sid, userId, text); 88 | } 89 | 90 | /** 91 | * 关闭连接调用的方法,群成员退出 92 | * 93 | * @param session 94 | * @param sid 95 | */ 96 | @OnClose 97 | public void onClose(Session session, @PathParam("sid") String sid, @PathParam("userId") String userId) { 98 | List sessionList = groupMemberInfoMap.get(sid); 99 | sessionList.remove(session); 100 | Set onlineUserList = onlineUserMap.get(sid); 101 | onlineUserList.remove(userId); 102 | // 发送离线通知 103 | sendInfo(sid, userId, onlineUserList.size(), "下线了~"); 104 | } 105 | 106 | /** 107 | * 传输消息错误调用的方法 108 | * 109 | * @param error 110 | */ 111 | @OnError 112 | public void OnError(Throwable error) { 113 | log.info("Connection error"); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.byc.controller; 2 | 3 | import com.byc.bean.User; 4 | import com.byc.common.ServerResponse; 5 | import com.byc.mapper.UserMapper; 6 | import com.byc.service.serviceImpls.UserService; 7 | import io.swagger.annotations.Api; 8 | import io.swagger.annotations.ApiImplicitParam; 9 | import io.swagger.annotations.ApiImplicitParams; 10 | import io.swagger.annotations.ApiOperation; 11 | import org.apache.ibatis.annotations.Param; 12 | import org.apache.ibatis.annotations.Update; 13 | import org.apache.tomcat.util.bcel.Const; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.web.bind.annotation.*; 16 | import springfox.documentation.annotations.ApiIgnore; 17 | 18 | import javax.servlet.http.HttpSession; 19 | import java.util.List; 20 | 21 | @RestController 22 | @Api(tags = "用户管理相关接口") 23 | @RequestMapping("/user") 24 | public class UserController { 25 | @Autowired 26 | UserService userService; 27 | 28 | @PostMapping("/login") 29 | @ApiOperation("登录用户接口") 30 | //@ApiImplicitParams(@ApiImplicitParam(name = "user", value = "用户相关信息")) 31 | public ServerResponse login(@RequestParam("username") String username, @RequestParam("password") String password, @ApiIgnore HttpSession session) { 32 | ServerResponse response = userService.login(username, password); 33 | if (response.isSuccess()) { 34 | session.setAttribute("currentUser", response.getData()); 35 | } 36 | return response; 37 | } 38 | 39 | @PostMapping("/register") 40 | @ApiOperation("注册用户接口") 41 | public ServerResponse register(@RequestParam("username") String username) { 42 | ServerResponse register = userService.register(username); 43 | return register; 44 | } 45 | 46 | @PostMapping("/insert") 47 | @ApiOperation("注册用户") 48 | public boolean insertUser(String username, String password) { 49 | boolean b = userService.insertUser(username, password); 50 | return b; 51 | } 52 | 53 | @GetMapping("/name") 54 | @ApiOperation("查询用户信息") 55 | //根据用户名来查找用户信息 56 | public User getUser(@RequestParam("name") String name) { 57 | User user = userService.getUser(name); 58 | return user; 59 | } 60 | 61 | @PutMapping("/password/{uname}") 62 | @ApiOperation("根据用户名来修改用户密码") 63 | //根据用户名来修改用户密码 64 | public User updateUserPassword(String password, @PathVariable("uname") String uname) { 65 | User user = userService.updateUserPassword(password, uname); 66 | return user; 67 | } 68 | 69 | @PutMapping("/phone/{uname}") 70 | @ApiOperation("根据用户名来修改用户电话") 71 | //根据用户名来修改用户电话 72 | public User updateUserTelphone(@PathVariable("uname") String uname, String telphone) { 73 | User user = userService.updateUserTelphone(uname, telphone); 74 | return user; 75 | } 76 | @PutMapping("/status") 77 | @ApiOperation("管理员来修改用户状态") 78 | //根据用户id来修改用户的状态 79 | public int updateUserStatus(String id ,int status ){ 80 | int i = userService.updateUserStatus(id, status); 81 | return i; 82 | } 83 | @GetMapping("/getPartInfo") 84 | @ApiOperation("拿到部分用户") 85 | //拿到部分的用户 86 | public List getPartUserInfo(){ 87 | List partUserInfo = userService.getPartUserInfo(); 88 | return partUserInfo; 89 | } 90 | 91 | @DeleteMapping("/deleteUserInfo") 92 | @ApiOperation("删除用户信息(用户可能违规)") 93 | //根据用户名来删除用户信息 94 | public int deleteUser(@RequestParam("uname") String uname){ 95 | int i = userService.deleteUserService(uname); 96 | return i; 97 | 98 | } 99 | 100 | @PutMapping("/improveInfo") 101 | @ApiOperation("完善用户信息") 102 | public int improveInfo(@RequestParam("uname") String uname,@RequestParam("telphone") String telphone,@RequestParam("email") String email,@RequestParam("address") String address) { 103 | int i = userService.improveInfoServie(uname, telphone, email, address); 104 | return i; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Manage.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 126 | 127 | 130 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/AlterPrice.vue: -------------------------------------------------------------------------------- 1 | 62 | 63 | 136 | 137 | 149 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.byc.controller; 2 | 3 | import com.byc.bean.Garbage; 4 | import com.byc.bean.OrderList; 5 | import com.byc.service.serviceImpls.OrderService; 6 | import com.byc.vo.Commodity; 7 | import com.byc.vo.OrderShow; 8 | import com.google.common.collect.Maps; 9 | import io.swagger.annotations.Api; 10 | import io.swagger.annotations.ApiOperation; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import java.sql.SQLOutput; 15 | import java.util.List; 16 | import java.util.Map; 17 | import java.util.UUID; 18 | 19 | @RestController 20 | @Api(tags = "订单管理相关接口") 21 | @RequestMapping("/order") 22 | public class OrderController { 23 | @Autowired 24 | OrderService orderService; 25 | 26 | // @ApiOperation("生成订单接口") 27 | // @PostMapping("/") 28 | // public boolean addOrder(float payment, String orderItemList, String userId, String cycleId){ 29 | // boolean b = orderService.addOrder(payment, orderItemList, userId, cycleId); 30 | // return b; 31 | // } 32 | @ApiOperation("查看订单号信息") 33 | @GetMapping("/getInfo/{id}") 34 | public OrderList selectOrderById(@PathVariable("id") String id){ 35 | OrderList orderList = orderService.selectOrderById(id); 36 | return orderList; 37 | } 38 | @ApiOperation(("通过用户id查找订单信息")) 39 | @GetMapping("/getInfoByUserID/{id}") 40 | public List selectOrderByUserId(@PathVariable("id") String userId){ 41 | List orderLists = orderService.selectOrderByUserId(userId); 42 | return orderLists; 43 | } 44 | @ApiOperation("通过回收人员id") 45 | @GetMapping("/getInfoByCycleID/{id}") 46 | public List SelectOrderByCycleId(@PathVariable("id") String cycleId){ 47 | List orderLists = orderService.SelectOrderByCycleId(cycleId); 48 | return orderLists; 49 | } 50 | // @PostMapping("/generateOrder") 51 | // public boolean generateOrder(@RequestBody List commodities){ 52 | // System.out.println(commodities); 53 | //// System.out.println(userInfoId); 54 | //// System.out.println(userInfoAddress); 55 | // return true; 56 | // } 57 | 58 | @PostMapping("/generateOrder") 59 | public int generateOrder(@RequestBody Map map){ 60 | // System.out.println(map); 61 | // System.out.println(map.get("commodities")); 62 | // System.out.println(map.get("userInfoId")); 63 | // System.out.println(map.get("userInfoAddress")); 64 | List maps= (List) map.get("commodities"); 65 | int i = orderService.generateOrderService(map.get("userInfoAddress").toString(), map.get("userInfoId").toString(), maps); 66 | if (i==0) 67 | return 0; 68 | // for ( Map p: maps 69 | // ) { 70 | // System.out.println(p); 71 | // } 72 | // System.out.println(objects); 73 | // List commodities=(List)map.get("commodities"); 74 | // System.out.println(commodities); 75 | // for (Commodity commodity:commodities 76 | // ) { 77 | // System.out.println(commodity); 78 | // } 79 | 80 | return 1; 81 | } 82 | 83 | @GetMapping("/getShopInfo") 84 | //根据用户id来查找与自己相关的订单(等待接收的订单) 85 | public List getOrderShoData(String userId){ 86 | List orderShowService = orderService.getOrderShowService(userId); 87 | return orderShowService; 88 | } 89 | 90 | @GetMapping("/getShopInfoByOrderId") 91 | //根据订单id来获取信息 92 | public Map getOrderByOrderId(String orderId){ 93 | Map orderByOrderId = orderService.getOrderByOrderId(orderId); 94 | return orderByOrderId; 95 | } 96 | 97 | @GetMapping("/getOrderInfoForCycle") 98 | public List> getOrderInfoForCycle(int status){ 99 | List> orderInfoByOrderStatus = orderService.getOrderInfoByOrderStatus(status); 100 | return orderInfoByOrderStatus; 101 | } 102 | 103 | @PutMapping("/receiveOrder") 104 | /* 105 | * id为订单id 106 | * */ 107 | public int receiveOrder(String id,String userId){ 108 | int i = orderService.receiveOrderService(id,userId); 109 | return i; 110 | } 111 | 112 | @GetMapping("/getShopInfoByCycleId") 113 | //根据用户id来查找与自己相关的订单(等待接收的订单) 114 | public List> getCycleOrderData(String cycleId){ 115 | List> orderInfoByCycleId = orderService.getOrderInfoByCycleId(cycleId); 116 | return orderInfoByCycleId; 117 | } 118 | 119 | } 120 | -------------------------------------------------------------------------------- /vue-gc-web/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import VueRouter from 'vue-router' 3 | import Login from '../views/Login' 4 | import Home from '../views/Home' 5 | import Register from '../views/Register' 6 | import Wet from '../components/Wet' 7 | import Dry from '../components/Dry' 8 | import Recycle from '../components/Recycle' 9 | import Harmful from '../components/Harmful' 10 | import Search from '../components/Search' 11 | import Cart from '../components/Cart' 12 | import WatchOrder from '../components/WatchOrder' 13 | import AlterPrice from '../components/AlterPrice' 14 | import AddGarbage from '../components/AddGarbage' 15 | import Manage from '../components/Manage' 16 | import UserManage from '../components/UserManage' 17 | import MapGeo from '../components/MapGeo' 18 | import MapSearch from '../components/MapSearch' 19 | import UserPage from '../views/UserPage.vue' 20 | import ImageIdentify from '../components/ImageIdentify' 21 | import UploadImage from '../components/UploadImage.vue' 22 | import BrowseOrder from '../components/BrowseOrder' 23 | import ManageOrder from '../components/ManageOrder' 24 | import Chat from '../components/Chat' 25 | import CharacterAnimation from '../components/CharacterAnimation' 26 | 27 | Vue.use(VueRouter) 28 | 29 | const routes = [{ 30 | path: '/', 31 | redirect: '/login', 32 | hidden: true 33 | }, 34 | { 35 | path: '/login', 36 | component: Login, 37 | hidden: true 38 | }, 39 | { 40 | path: '/register', 41 | component: Register, 42 | hidden: true 43 | }, 44 | { 45 | path: '/home', 46 | name: '', 47 | component: Home, 48 | hidden: true 49 | }, 50 | { 51 | path: '/home', 52 | name: '垃圾展示', 53 | component: Home, 54 | iconCls: 'el-icon-s-grid', 55 | children: [{ 56 | path: '/wet', 57 | name: '湿垃圾', 58 | component: Wet, 59 | meta: { 60 | keepAlive: true 61 | } 62 | }, 63 | { 64 | path: '/dry', 65 | name: '干垃圾', 66 | component: Dry, 67 | meta: { 68 | keepAlive: false 69 | } 70 | }, 71 | { 72 | path: '/harmful', 73 | name: '有害垃圾', 74 | component: Harmful, 75 | meta: { 76 | keepAlive: false 77 | } 78 | }, 79 | { 80 | path: '/recycle', 81 | name: '可回收垃圾', 82 | component: Recycle, 83 | meta: { 84 | keepAlive: false 85 | } 86 | } 87 | ] 88 | }, 89 | { 90 | path: '/home', 91 | name: '用户功能', 92 | component: Home, 93 | iconCls: 'el-icon-menu', 94 | children: [{ 95 | path: '/search', 96 | name: '垃圾搜索', 97 | component: Search 98 | }, 99 | { 100 | path: '/Cart', 101 | name: '回收车', 102 | component: Cart 103 | }, 104 | { 105 | path: '/watchOrder', 106 | name: '订单查看', 107 | component: WatchOrder 108 | }, 109 | { 110 | path: '/map', 111 | name: '地图', 112 | component: MapGeo 113 | }, 114 | { 115 | path: '/mapSearch', 116 | name: '回收点搜索', 117 | component: MapSearch 118 | }, 119 | { 120 | path: '/imageIdentify', 121 | name: '图片识别', 122 | component: ImageIdentify 123 | }, 124 | { 125 | path: '/chat', 126 | name: '聊天', 127 | component: Chat 128 | }, 129 | { 130 | path: '/anime', 131 | name: '动漫化', 132 | component: CharacterAnimation 133 | } 134 | ] 135 | }, 136 | { 137 | path: '/home', 138 | name: '管理员功能', 139 | component: Home, 140 | iconCls: 'el-icon-s-order', 141 | children: [{ 142 | path: '/userManage', 143 | name: '用户管理', 144 | component: UserManage 145 | }, 146 | { 147 | path: '/addGarbage', 148 | name: '添加垃圾', 149 | component: AddGarbage 150 | }, 151 | { 152 | path: '/alter', 153 | name: '回收价格修改', 154 | component: AlterPrice 155 | }, 156 | { 157 | path: '/manage', 158 | name: '管理订单', 159 | component: Manage 160 | }, 161 | { 162 | path: '/uploadImage', 163 | name: '上传图片', 164 | component: UploadImage 165 | } 166 | ] 167 | }, 168 | { 169 | path: '/home', 170 | name: '回收人员功能', 171 | component: Home, 172 | iconCls: 'el-icon-s-data', 173 | children: [{ 174 | path: '/browseOrder', 175 | name: '接收订单', 176 | component: BrowseOrder 177 | }, 178 | { 179 | path: '/manageOrder', 180 | name: '订单查看', 181 | component: ManageOrder 182 | }] 183 | }, 184 | { 185 | path: '/userPage', 186 | name: '用户主页', 187 | component: UserPage, 188 | hidden: true 189 | } 190 | ] 191 | 192 | const router = new VueRouter({ 193 | routes 194 | }) 195 | 196 | router.beforeEach((to, from, next) => { 197 | if (to.path === '/login') { 198 | return next() 199 | } 200 | // 应该使用后台的token来验证,此处使用本地的localStroage来验证 201 | const tokenStr = window.localStorage.getItem('adminAndUser') 202 | if (!tokenStr) return next('/login') 203 | next() 204 | }) 205 | export default router 206 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/BrowseOrder.vue: -------------------------------------------------------------------------------- 1 | 68 | 69 | 138 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/CharacterAnimation.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 116 | 117 | 134 | -------------------------------------------------------------------------------- /vue-gc-web/src/views/Login.vue: -------------------------------------------------------------------------------- 1 | 28 | 94 | 95 | 153 | -------------------------------------------------------------------------------- /vue-gc-web/src/views/Register.vue: -------------------------------------------------------------------------------- 1 | 26 | 27 | 115 | 116 | 161 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/controller/GarbageController.java: -------------------------------------------------------------------------------- 1 | package com.byc.controller; 2 | 3 | import com.byc.bean.Garbage; 4 | import com.byc.mapper.GarbageMapper; 5 | import com.byc.service.serviceImpls.GarbageService; 6 | import com.github.pagehelper.PageHelper; 7 | import com.github.pagehelper.PageInfo; 8 | import io.swagger.annotations.Api; 9 | import io.swagger.annotations.ApiOperation; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | import org.springframework.web.multipart.MultipartFile; 13 | 14 | import java.util.List; 15 | import java.util.Map; 16 | import java.util.UUID; 17 | 18 | @RestController 19 | @Api(tags = "垃圾管理相关接口") 20 | @RequestMapping("/garbage") 21 | public class GarbageController { 22 | @Autowired 23 | GarbageService garbageService; 24 | 25 | @ApiOperation("添加新的垃圾种类信息") 26 | @PostMapping("/addNewGarbage") 27 | //添加新的垃圾种类信息 28 | public boolean addGarbageInformation(String gName,String gType,float gPrice,String gDesc,String image){ 29 | boolean b = garbageService.insertGarbageName(gName,gType,gPrice,gDesc,image); 30 | return b; 31 | } 32 | @ApiOperation("根据垃圾名称来更新信息") 33 | @PutMapping("/update/{gName}") 34 | public boolean updateGarbageInformation(@PathVariable("gName") String gName, String gType, String gDesc, String gPrice){ 35 | boolean b = garbageService.updateGarbageInformation(gName, gType, gDesc, gPrice); 36 | return b; 37 | } 38 | 39 | 40 | @ApiOperation("根据垃圾名称来删除该条垃圾信息") 41 | @DeleteMapping("/delete") 42 | public boolean deleteGarbageByName(@RequestParam("gName") String gName){ 43 | boolean b = garbageService.deleteGarbageByName(gName); 44 | return b; 45 | } 46 | 47 | @ApiOperation("根据垃圾的id来删除垃圾") 48 | @DeleteMapping("/deleteById") 49 | public int deleteGarbageById(@RequestParam("id") String id){ 50 | int i = garbageService.deleteGarbageByIdService(id); 51 | return i; 52 | } 53 | @ApiOperation("通过垃圾名称来查找垃圾信息") 54 | @GetMapping("/getName") 55 | public Garbage getGarbageByName(@RequestParam("name") String name){ 56 | Garbage garbageByName = garbageService.getGarbageByName(name); 57 | return garbageByName; 58 | } 59 | 60 | @ApiOperation("通过垃圾类型来查找垃圾") 61 | @GetMapping("/getInfo") 62 | public PageInfo getGarbageListByType(@RequestParam("type") String gType, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "5") int size){ 63 | PageHelper.startPage(page,size); 64 | PageInfo garbagePageInfo = new PageInfo<>(garbageService.getGarbageListByType(gType)); 65 | return garbagePageInfo; 66 | } 67 | 68 | @ApiOperation("查找所有的垃圾信息") 69 | @GetMapping("/get") 70 | public List getGarbageList(){ 71 | List garbageList = garbageService.getGarbageList(); 72 | return garbageList; 73 | } 74 | @ApiOperation("查询部分垃圾信息用于展示") 75 | @GetMapping("/getPartGarbageInfo") 76 | public List getPartList(){ 77 | List partGarbageList = garbageService.getPartGarbageList(); 78 | return partGarbageList; 79 | } 80 | 81 | @ApiOperation("根据是否可回收来查找垃圾") 82 | @GetMapping("/getGarbageList/{isCycle}") 83 | public List getGarbageListByisCycle(@PathVariable("isCycle") int isCycle){ 84 | List garbageListByisCycle = garbageService.getGarbageListByisCycle(isCycle); 85 | return garbageListByisCycle; 86 | } 87 | 88 | @ApiOperation("根据id来修改垃圾的名称") 89 | @PutMapping("/updateGarbageName") 90 | public int updateGarbageNameById(@RequestParam("id") String id,@RequestParam("gName") String gName){ 91 | int i = garbageService.updateGarbageNameByIdService(id, gName); 92 | return i; 93 | } 94 | 95 | @ApiOperation("根据id来修改垃圾的回收价格") 96 | @PutMapping("/updateGarbagePrice") 97 | public int updateGarbagePriceById(@RequestParam("id") String id,@RequestParam("gPrice") float gPrice){ 98 | int i = garbageService.updateGarbageNameByPriceService(id,gPrice); 99 | return i; 100 | } 101 | 102 | @ApiOperation("根据id来修改垃圾的信息") 103 | @PutMapping("/updateGarbageInfo") 104 | public int updateGarbage(@RequestParam("id") String id,@RequestParam("gPrice") float gPrice,@RequestParam("gType") String gType,@RequestParam("gDesc") String gDesc){ 105 | int i = garbageService.updateGarbageService(id, gPrice, gType, gDesc); 106 | return i; 107 | } 108 | 109 | @ApiOperation("根据名字模糊擦查询垃圾信息") 110 | @GetMapping("/getGarbageInfoByFuzzyName") 111 | public List getGarbageByFuzzyName(@RequestParam("name") String name){ 112 | List garbageByFuzzyNameList = garbageService.getGarbageByFuzzyNameList(name); 113 | return garbageByFuzzyNameList; 114 | } 115 | 116 | @ApiOperation("上传垃圾图片信息") 117 | @PostMapping("/uploadImage") 118 | public Map uploadGarbageImage(@RequestParam("file") MultipartFile file,@RequestParam("gName") String gName){ 119 | Map map = garbageService.uploadPicture(file,gName); 120 | System.out.println(gName); 121 | return map; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/ImageIdentify.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 134 | 135 | 152 | -------------------------------------------------------------------------------- /garbagecollection/.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 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/UserManage.vue: -------------------------------------------------------------------------------- 1 | 84 | 85 | 144 | 145 | 148 | -------------------------------------------------------------------------------- /vue-gc-web/src/views/UserPage.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 125 | 126 | 190 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/service/serviceImpls/GarbageService.java: -------------------------------------------------------------------------------- 1 | package com.byc.service.serviceImpls; 2 | 3 | import com.byc.bean.Garbage; 4 | import com.byc.config.ImageServerConfig; 5 | import com.byc.mapper.GarbageMapper; 6 | import com.byc.service.IGarbageService; 7 | import com.byc.utils.FtpUtil; 8 | import com.github.pagehelper.Page; 9 | import org.joda.time.DateTime; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | import org.springframework.web.multipart.MultipartFile; 14 | import java.io.Serializable; 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | import java.util.UUID; 19 | 20 | @Service 21 | @Transactional 22 | public class GarbageService implements IGarbageService, Serializable { 23 | @Autowired 24 | GarbageMapper garbageMapper; 25 | @Autowired 26 | ImageServerConfig imageServerConfig; 27 | 28 | //添加新的垃圾种类 29 | public boolean insertGarbageName(String gName,String gType,float gPrice,String gDesc,String image) { 30 | Garbage garbage=new Garbage(); 31 | garbage.setId(UUID.randomUUID().toString()); 32 | garbage.setgName(gName); 33 | garbage.setgType(gType); 34 | garbage.setgDesc(gDesc); 35 | garbage.setgPrice(gPrice); 36 | garbage.setIsCycle(1); 37 | garbage.setimage(image); 38 | int i = garbageMapper.addGarbage(garbage); 39 | return i > 0 ? true : false; 40 | } 41 | 42 | //更新垃圾先关信息 43 | public boolean updateGarbageInformation(String gName, String gType, String gDesc, String gPrice) { 44 | Garbage garbage = garbageMapper.getGarbageByName(gName); 45 | if (gName != null) 46 | garbage.setgName(gName); 47 | if (gType != null) 48 | garbage.setgType(gType); 49 | if (gDesc != null) 50 | garbage.setgDesc(gDesc); 51 | if (gPrice != null) 52 | garbage.setgPrice(Float.parseFloat(gPrice)); 53 | int i = garbageMapper.updateGarbage(garbage); 54 | return i > 0 ? true : false; 55 | } 56 | 57 | //根据垃圾名称来删除垃圾信息 58 | public boolean deleteGarbageByName(String gName) { 59 | int i = garbageMapper.deleteGarbage(gName); 60 | return i > 0 ? true : false; 61 | } 62 | 63 | //根据垃圾的名称获得垃圾相关信息 64 | public Garbage getGarbageByName(String name) { 65 | Garbage garbageByName = garbageMapper.getGarbageByName(name); 66 | return garbageByName; 67 | } 68 | //根据垃圾的类型获得相关垃圾的信息 69 | public Page getGarbageListByType(String gType){ 70 | Page garbageListByType = garbageMapper.getGarbageListByType(gType); 71 | return garbageListByType; 72 | } 73 | 74 | //查询所有的垃圾信息 75 | public List getGarbageList(){ 76 | List garbageList = garbageMapper.getGarbageList(); 77 | return garbageList; 78 | }; 79 | 80 | //查询部分的垃圾信息用于界面展览 81 | public List getPartGarbageList(){ 82 | List partGarbageList = garbageMapper.getPartGarbageList(); 83 | return partGarbageList; 84 | } 85 | 86 | //根据垃圾是否可回收来搜索垃圾信息 87 | public List getGarbageListByisCycle(int isCycle){ 88 | List garbageListByisCycle = garbageMapper.getGarbageListByisCycle(isCycle); 89 | return garbageListByisCycle; 90 | } 91 | 92 | //根据id来修改垃圾的名称 93 | public int updateGarbageNameByIdService(String id,String gName){ 94 | int i = garbageMapper.updateGarbageNameById(id, gName); 95 | return i; 96 | } 97 | 98 | //跟据id来修改垃圾的价格 99 | public int updateGarbageNameByPriceService(String id,float gPrice){ 100 | int i = garbageMapper.updateGarbagePrice(id, gPrice); 101 | return i; 102 | } 103 | 104 | //根据id来删除垃圾 105 | public int deleteGarbageByIdService(String id){ 106 | int i = garbageMapper.deleteGarbageById(id); 107 | return i; 108 | } 109 | 110 | // 根据id来修改休息 111 | public int updateGarbageService(String id,float gPrice,String gType,String gDesc){ 112 | int i = garbageMapper.updateGarbageInfo(id, gPrice,gType, gDesc); 113 | return i; 114 | } 115 | 116 | //根据上传的垃圾图片调用百度图像识别api接口返回识别内容 117 | 118 | //通过用户输入的垃圾名称来模糊查询 119 | public List getGarbageByFuzzyNameList(String name){ 120 | List garbageByFuzzyName = garbageMapper.getGarbageByFuzzyName(name); 121 | return garbageByFuzzyName; 122 | } 123 | 124 | // 125 | public Map uploadPicture(MultipartFile uploadFile,String name) { 126 | Map resultMap = new HashMap<>(); 127 | try { 128 | //生成一个新的文件名 129 | //取原始文件名 130 | String oldName = uploadFile.getOriginalFilename(); 131 | //生成新文件名 132 | //UUID.randomUUID(); 133 | String newName = UUID.randomUUID().toString().substring(1,9); 134 | newName = newName + oldName.substring(oldName.lastIndexOf(".")); 135 | //图片上传 136 | String imagePath = new DateTime().toString("/yyyy/MM/dd"); 137 | // FtpUtil ftpUtil = new FtpUtil(); 138 | boolean result = FtpUtil.uploadFile(imageServerConfig.getAddress(), imageServerConfig.getPort(), imageServerConfig.getUsername(), imageServerConfig.getPassword(), 139 | imageServerConfig.getbasePath(), imagePath, newName, uploadFile.getInputStream()); 140 | //返回结果 141 | if(!result) { 142 | resultMap.put("error", 1); 143 | resultMap.put("message", "文件上传失败"); 144 | return resultMap; 145 | } 146 | resultMap.put("error", 0); 147 | resultMap.put("message", "文件上传成功"); 148 | //上传成功后图片的存储路径,返回给前台显示图片 149 | resultMap.put("url", imageServerConfig.getImageBaseUrl() + imagePath + "/" + newName); 150 | String image = imageServerConfig.getImageBaseUrl()+imagePath+"/"+newName; 151 | int i = garbageMapper.uploadImage(image, name); 152 | return resultMap; 153 | 154 | } catch (Exception e) { 155 | resultMap.put("error", 1); 156 | resultMap.put("message", "文件上传发生异常"); 157 | System.out.println(e); 158 | return resultMap; 159 | } 160 | 161 | } 162 | } -------------------------------------------------------------------------------- /vue-gc-web/src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 77 | 129 | 189 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/Chat.vue: -------------------------------------------------------------------------------- 1 | 25 | 106 | 107 | 240 | -------------------------------------------------------------------------------- /garbagecollection/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 162 | if ERRORLEVEL 1 goto error 163 | goto end 164 | 165 | :error 166 | set ERROR_CODE=1 167 | 168 | :end 169 | @endlocal & set ERROR_CODE=%ERROR_CODE% 170 | 171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 175 | :skipRcPost 176 | 177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 179 | 180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 181 | 182 | exit /B %ERROR_CODE% 183 | -------------------------------------------------------------------------------- /vue-gc-web/src/components/AddGarbage.vue: -------------------------------------------------------------------------------- 1 | 99 | 100 | 218 | 219 | 239 | -------------------------------------------------------------------------------- /garbagecollection/src/main/java/com/byc/service/serviceImpls/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.byc.service.serviceImpls; 2 | 3 | import com.byc.bean.CommodityList; 4 | import com.byc.bean.OrderList; 5 | import com.byc.bean.User; 6 | import com.byc.mapper.CommodityListMapper; 7 | import com.byc.mapper.OrderListMapper; 8 | import com.byc.mapper.UserMapper; 9 | import com.byc.service.IOrderService; 10 | import com.byc.vo.OrderShow; 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Service; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.io.Serializable; 16 | import java.text.SimpleDateFormat; 17 | import java.util.*; 18 | 19 | @Service 20 | @Transactional 21 | public class OrderService implements IOrderService, Serializable { 22 | @Autowired 23 | OrderListMapper orderMapper; 24 | @Autowired 25 | CommodityListMapper commodityListMapper; 26 | @Autowired 27 | UserMapper userMapper; 28 | //生成订单 29 | // public boolean addOrder(float payment, String orderItemList, String userId, String cycleId){ 30 | // OrderList orderList = new OrderList(); 31 | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 32 | // //订单号 33 | // orderList.setId(UUID.randomUUID().toString()); 34 | // orderList.setPayment(payment); 35 | // orderList.setOrderItemList(orderItemList); 36 | // orderList.setUserid(userId); 37 | // orderList.setCycleid(cycleId); 38 | // orderList.setCreationTime(simpleDateFormat.format(new Date())); 39 | // orderList.setEndTime(simpleDateFormat.format(new Date())); 40 | // int i = orderMapper.addOrder(orderList); 41 | // return i>0?true:false; 42 | // } 43 | //通过订单号id来查询订单信息 44 | public OrderList selectOrderById(String id){ 45 | OrderList orderList = orderMapper.selectOrderById(id); 46 | return orderList; 47 | } 48 | 49 | //用户根据相关的用户id来查找与自己相关的订单信息 50 | public List selectOrderByUserId(String userId){ 51 | List orderLists = orderMapper.selectOrderByUserId(userId); 52 | return orderLists; 53 | } 54 | 55 | //回收人员来查询相关的订单 56 | public List SelectOrderByCycleId(String cycleId){ 57 | List orderLists = orderMapper.selectOrderByCycleId(cycleId); 58 | return orderLists; 59 | } 60 | 61 | //生成订单 62 | public int generateOrderService(String userInfoAddress,String userInfoId,List maps){ 63 | String orderId = UUID.randomUUID().toString(); 64 | String address = userInfoAddress; 65 | String userId = userInfoId; 66 | int orderStatus = 0; 67 | float payment = 0; 68 | // float v = Float.parseFloat(amount); 69 | // float payment = gPrice*v; 70 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 71 | String creationTime = simpleDateFormat.format(new Date()); 72 | // int i = orderMapper.generateOrder(orderId, payment, address, creationTime, userId, orderStatus); 73 | // if(i==0){ 74 | // //代表插入失败 75 | // return 0; 76 | // } 77 | for (Map p: maps 78 | ) { 79 | payment = payment + ((Float.parseFloat(p.get("amount").toString()))*(Float.parseFloat(p.get("gPrice").toString()))); 80 | int i1 = commodityListMapper.insertCommodity(UUID.randomUUID().toString(), p.get("gName").toString(), Float.parseFloat(p.get("amount").toString()), orderId,Float.parseFloat(p.get("gPrice").toString())); 81 | if (i1==0){ 82 | //代表插入失败 83 | return 0; 84 | } 85 | } 86 | int i = orderMapper.generateOrder(orderId, payment, address, creationTime, userId, orderStatus); 87 | if(i==0){ 88 | //代表插入失败 89 | return 0; 90 | } 91 | return 1; 92 | } 93 | 94 | //根据用户id来获取订单页面的展示数据 95 | public List getOrderShowService(String userId){ 96 | // float total=0; 97 | ArrayList orderShows = new ArrayList<>(); 98 | List orderLists = orderMapper.selectOrderByUserId(userId); 99 | // OrderShow orderShow = new OrderShow(); 100 | for (OrderList orderList:orderLists 101 | ) { 102 | OrderShow orderShow = new OrderShow(); 103 | // //筛选出没有接单的订单 104 | // if(orderList.getOrderStatus()==1) 105 | // continue; 106 | // total+=orderList.getPayment(); 107 | orderShow.setAddress(orderList.getAddress()); 108 | orderShow.setCreationTime(orderList.getCreationTime()); 109 | orderShow.setOrderStatus(orderList.getOrderStatus()); 110 | orderShow.setTotal(orderList.getPayment()); 111 | orderShow.setOrderId(orderList.getId()); 112 | List commodityLists = commodityListMapper.selectOrderListInfo(orderList.getId()); 113 | orderShow.setCommodityLists(commodityLists); 114 | orderShows.add(orderShow); 115 | } 116 | return orderShows; 117 | } 118 | 119 | // 根据订单id来搜索订单 120 | public Map getOrderByOrderId(String orderId){ 121 | OrderList orderList = orderMapper.selectOrderById(orderId); 122 | Map stringObjectMap = new HashMap<>(); 123 | stringObjectMap.put("garbageOrder",orderList); 124 | List commodityLists = commodityListMapper.selectOrderListInfo(orderId); 125 | stringObjectMap.put("commodityList",commodityLists); 126 | User userInfoById = userMapper.getUserInfoById(orderList.getUserid()); 127 | stringObjectMap.put("user",userInfoById); 128 | User cycleInfoById = userMapper.getUserInfoById(orderList.getCycleid()); 129 | stringObjectMap.put("cycle",cycleInfoById); 130 | return stringObjectMap; 131 | } 132 | //根据订单的状态来获取订单 133 | public List> getOrderInfoByOrderStatus(int status){ 134 | // HashMap stringObjectHashMap = new HashMap<>(); 135 | ArrayList> lists = new ArrayList<>(); 136 | List orderInfoByOrderStatus = orderMapper.getOrderInfoByOrderStatus(status); 137 | // 没有接单的订单 138 | // stringObjectHashMap.put("garbageOrder",orderInfoByOrderStatus); 139 | // 140 | for (OrderList orderList:orderInfoByOrderStatus 141 | ) { 142 | User userInfoById = userMapper.getUserInfoById(orderList.getUserid()); 143 | List commodityLists = commodityListMapper.selectOrderListInfo(orderList.getId()); 144 | HashMap stringObjectHashMap = new HashMap<>(); 145 | stringObjectHashMap.put("garbageOrder",orderList); 146 | stringObjectHashMap.put("user",userInfoById); 147 | stringObjectHashMap.put("commodity",commodityLists); 148 | lists.add(stringObjectHashMap); 149 | } 150 | return lists; 151 | } 152 | 153 | /* 154 | * 改变订单的状态,将回收金额加到订单用户账户的金额上 155 | * */ 156 | public int receiveOrderService(String orderId,String userId){ 157 | OrderList orderList = orderMapper.selectOrderById(orderId); 158 | //订单的金额加上已有的金额 159 | float newAmount= userMapper.getUserInfoById(orderList.getUserid()).getMoney()+orderList.getPayment(); 160 | int i = userMapper.updateUserMoney(orderList.getUserid(), newAmount); 161 | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 162 | String endTime = simpleDateFormat.format(new Date()); 163 | int i1 = orderMapper.changeOrderStatus(orderId, endTime,userId,2); 164 | if (i==1&&i1==1){ 165 | return 1; 166 | } 167 | return 0; 168 | } 169 | 170 | //根据回收人员id来获取订单 171 | public List> getOrderInfoByCycleId(String cycleId){ 172 | // HashMap stringObjectHashMap = new HashMap<>(); 173 | ArrayList> lists = new ArrayList<>(); 174 | List orderLists = orderMapper.selectOrderByCycleId(cycleId); 175 | for (OrderList orderList:orderLists 176 | ) { 177 | // 通过订单的用户id获取用户的信息 178 | User userInfoById = userMapper.getUserInfoById(orderList.getUserid()); 179 | HashMap stringObjectHashMap = new HashMap<>(); 180 | stringObjectHashMap.put("userInfo",userInfoById); 181 | // 拿到改订单的商品信息(list) 182 | List commodityLists = commodityListMapper.selectOrderListInfo(orderList.getId()); 183 | stringObjectHashMap.put("commodity",commodityLists); 184 | // 添加该订单信息 185 | stringObjectHashMap.put("orderInfo",orderList); 186 | lists.add(stringObjectHashMap); 187 | } 188 | return lists; 189 | } 190 | 191 | } 192 | --------------------------------------------------------------------------------