├── bbk-mss-vue ├── babel.config.js ├── public │ ├── favicon.ico │ └── index.html ├── src │ ├── assets │ │ ├── logo.png │ │ └── loc_icon.png │ ├── base │ │ ├── entity.js │ │ ├── ele-base.js │ │ └── utils.js │ ├── main.js │ ├── App.vue │ ├── page │ │ ├── base │ │ │ └── 50X.vue │ │ ├── Login.vue │ │ └── Main.vue │ ├── components │ │ ├── UploadFile.vue │ │ ├── BaiDuMapTrace.vue │ │ ├── material │ │ │ └── catyegory │ │ │ │ └── NewMaterialCatrgory.vue │ │ └── BaiDuSelect.vue │ └── axios │ │ ├── request.js │ │ └── api.js ├── .gitignore ├── .yarnrc ├── package.json └── README.md ├── screenshot ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── 基于Vue应急物资保障系统.docx ├── bbk-mss-java ├── bbk-mss-web │ ├── src │ │ ├── main │ │ │ ├── resources │ │ │ │ ├── META-INF │ │ │ │ │ └── additional-spring-configuration-metadata.json │ │ │ │ ├── mapper │ │ │ │ │ ├── MaterialDao.xml │ │ │ │ │ ├── EventPOMapper.xml │ │ │ │ │ ├── MaterialCategoryDao.xml │ │ │ │ │ ├── ApprovalDao.xml │ │ │ │ │ ├── OperationLogDao.xml │ │ │ │ │ ├── TransportDao.xml │ │ │ │ │ └── UserDao.xml │ │ │ │ ├── templates │ │ │ │ │ ├── mapper.java.ftl │ │ │ │ │ ├── mapper.java.vm │ │ │ │ │ ├── service.java.vm │ │ │ │ │ ├── service.java.ftl │ │ │ │ │ ├── mapper.java.btl │ │ │ │ │ ├── service.java.btl │ │ │ │ │ ├── serviceImpl.java.vm │ │ │ │ │ ├── serviceImpl.java.ftl │ │ │ │ │ ├── serviceImpl.java.btl │ │ │ │ │ ├── controller.java.vm │ │ │ │ │ ├── controller.java.btl │ │ │ │ │ ├── mapper.xml.vm │ │ │ │ │ ├── mapper.xml.ftl │ │ │ │ │ ├── mapper.xml.btl │ │ │ │ │ ├── controller.java.ftl │ │ │ │ │ ├── entity.kt.vm │ │ │ │ │ ├── entity.kt.ftl │ │ │ │ │ ├── entity.kt.btl │ │ │ │ │ ├── entity.java.vm │ │ │ │ │ └── entity.java.k.ftl │ │ │ │ ├── banner.txt │ │ │ │ ├── WebSocketDemo.html │ │ │ │ └── application.yaml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── bestbigkk │ │ │ │ ├── web │ │ │ │ ├── response │ │ │ │ │ ├── Result.java │ │ │ │ │ ├── Tips.java │ │ │ │ │ ├── annotation │ │ │ │ │ │ └── RW.java │ │ │ │ │ ├── handler │ │ │ │ │ │ └── ResponseWrapper.java │ │ │ │ │ └── RWrapper.java │ │ │ │ ├── validator │ │ │ │ │ ├── LogRecord.java │ │ │ │ │ ├── AccessLimit.java │ │ │ │ │ ├── PropertyIn.java │ │ │ │ │ └── impl │ │ │ │ │ │ └── PropertyInValidator.java │ │ │ │ ├── config │ │ │ │ │ ├── WebSocketConfig.java │ │ │ │ │ ├── GlobalInit.java │ │ │ │ │ ├── MybatisPlusConfig.java │ │ │ │ │ ├── WebMvcConfig.java │ │ │ │ │ ├── shiro │ │ │ │ │ │ ├── authc │ │ │ │ │ │ │ ├── JwtToken.java │ │ │ │ │ │ │ ├── MyJwtRealm.java │ │ │ │ │ │ │ └── BaseJwtRealm.java │ │ │ │ │ │ └── filter │ │ │ │ │ │ │ └── JwtFilter.java │ │ │ │ │ ├── RestTemplateConfig.java │ │ │ │ │ ├── CorsConfig.java │ │ │ │ │ ├── WithBoot.java │ │ │ │ │ ├── SwaggerConfig.java │ │ │ │ │ └── RedisConfig.java │ │ │ │ ├── controller │ │ │ │ │ ├── UploadController.java │ │ │ │ │ ├── VerifyController.java │ │ │ │ │ ├── ApprovalController.java │ │ │ │ │ ├── UserController.java │ │ │ │ │ └── TransportController.java │ │ │ │ ├── aspect │ │ │ │ │ ├── impl │ │ │ │ │ │ ├── AccessLimitAspect.java │ │ │ │ │ │ ├── LogRecordPersistence.java │ │ │ │ │ │ └── LogRecordAspect.java │ │ │ │ │ └── AspectCenter.java │ │ │ │ └── exception │ │ │ │ │ └── handler │ │ │ │ │ └── BaseGlobalExceptionHandler.java │ │ │ │ └── BBKApplication.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── bestbigkk │ │ │ ├── simple │ │ │ └── SimpleTest.java │ │ │ └── boot │ │ │ └── BootTest.java │ ├── .gitignore │ └── pom.xml ├── bbk-mss-common │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bestbigkk │ │ │ └── common │ │ │ ├── utils │ │ │ ├── BrowserType.java │ │ │ ├── HttpUtils.java │ │ │ ├── RequestContextHolderUtils.java │ │ │ ├── BeanCopyUtils.java │ │ │ ├── QueryWrapperUtils.java │ │ │ ├── encryption │ │ │ │ └── AESUtils.java │ │ │ └── JwtUtils.java │ │ │ ├── ListResponse.java │ │ │ ├── enums │ │ │ └── Identity.java │ │ │ ├── web │ │ │ └── ResultCode.java │ │ │ ├── config │ │ │ └── oss │ │ │ │ └── qiniu │ │ │ │ ├── QiniuConfig.java │ │ │ │ └── QiniuBeanConfig.java │ │ │ ├── exception │ │ │ └── BusinessException.java │ │ │ ├── aspect │ │ │ └── AbstractAspect.java │ │ │ └── Pagination.java │ ├── .gitignore │ └── pom.xml ├── bbk-mss-service │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── bestbigkk │ │ │ └── service │ │ │ ├── qiniu │ │ │ ├── UploadService.java │ │ │ └── impl │ │ │ │ └── UploadServiceImpl.java │ │ │ ├── EventService.java │ │ │ ├── IUserService.java │ │ │ ├── IMaterialService.java │ │ │ ├── ITransportService.java │ │ │ ├── IOperationLogService.java │ │ │ ├── IMaterialCategoryService.java │ │ │ ├── IApprovalService.java │ │ │ ├── impl │ │ │ ├── UserServiceImpl.java │ │ │ ├── EventServiceImpl.java │ │ │ ├── ApprovalServiceImpl.java │ │ │ ├── MaterialServiceImpl.java │ │ │ ├── TransportServiceImpl.java │ │ │ ├── MaterialCategoryServiceImpl.java │ │ │ └── OperationLogServiceImpl.java │ │ │ └── websocket │ │ │ └── WebSocketServer.java │ ├── .gitignore │ └── pom.xml └── bbk-mss-persistence │ ├── src │ └── main │ │ └── java │ │ └── com │ │ └── bestbigkk │ │ └── persistence │ │ ├── dao │ │ ├── EventDao.java │ │ ├── ApprovalDao.java │ │ ├── MaterialDao.java │ │ ├── TransportDao.java │ │ ├── MaterialCategoryDao.java │ │ ├── UserDao.java │ │ └── OperationLogDao.java │ │ └── entity │ │ ├── EventPO.java │ │ ├── MaterialCategoryPO.java │ │ ├── OperationLogPO.java │ │ ├── UserPO.java │ │ ├── MaterialPO.java │ │ ├── ApprovalPO.java │ │ └── TransportPO.java │ ├── pom.xml │ └── .gitignore ├── .gitignore └── README.md /bbk-mss-vue/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /screenshot/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/1.png -------------------------------------------------------------------------------- /screenshot/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/2.png -------------------------------------------------------------------------------- /screenshot/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/3.png -------------------------------------------------------------------------------- /screenshot/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/4.png -------------------------------------------------------------------------------- /screenshot/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/5.png -------------------------------------------------------------------------------- /screenshot/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/6.png -------------------------------------------------------------------------------- /screenshot/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/7.png -------------------------------------------------------------------------------- /screenshot/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/8.png -------------------------------------------------------------------------------- /screenshot/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/screenshot/9.png -------------------------------------------------------------------------------- /基于Vue应急物资保障系统.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/基于Vue应急物资保障系统.docx -------------------------------------------------------------------------------- /bbk-mss-vue/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/bbk-mss-vue/public/favicon.ico -------------------------------------------------------------------------------- /bbk-mss-vue/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/bbk-mss-vue/src/assets/logo.png -------------------------------------------------------------------------------- /bbk-mss-vue/src/assets/loc_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLin-Coder/No180EmergencyMaterialSupportManagementSystem/HEAD/bbk-mss-vue/src/assets/loc_icon.png -------------------------------------------------------------------------------- /bbk-mss-vue/src/base/entity.js: -------------------------------------------------------------------------------- 1 | //公共对象 2 | const entity = { 3 | pagination:{ 4 | currentPage: 1, 5 | pageSize: 10, 6 | total: 0 7 | }, 8 | }; 9 | 10 | export default entity -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "bbk.shiro.enable", 5 | "type": "java.lang.Boolean", 6 | "description": "是否启用Shiro." 7 | } 8 | ] } -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/MaterialDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/EventPOMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/MaterialCategoryDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/response/Result.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.response; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author: 开 7 | * @date: 2020-03-23 19:11:45 8 | * @describe: Controller响应实体 9 | */ 10 | public interface Result extends Serializable { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/BrowserType.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils; 2 | 3 | /** 4 | * @author: 开 5 | * @date: 2020-03-25 15:22:23 6 | * @describe: 浏览器类型 7 | */ 8 | public enum BrowserType { 9 | IE11,IE10,IE9,IE8,IE7,IE6,Firefox,Safari,Chrome,Opera,Camino,Gecko 10 | } 11 | -------------------------------------------------------------------------------- /bbk-mss-vue/.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 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/qiniu/UploadService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.qiniu; 2 | 3 | import com.qiniu.common.QiniuException; 4 | 5 | import java.io.InputStream; 6 | 7 | public interface UploadService { 8 | 9 | String uploadFile(InputStream inputStream, String fileName) throws QiniuException; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/EventService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.EventPO; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-21 13 | */ 14 | public interface EventService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.UserPO; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-19 13 | */ 14 | public interface IUserService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/EventDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.EventPO; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-21 13 | */ 14 | public interface EventDao extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/IMaterialService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.MaterialPO; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-19 13 | */ 14 | public interface IMaterialService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/ITransportService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.TransportPO; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-20 13 | */ 14 | public interface ITransportService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import BaiduMap from 'vue-baidu-map' 3 | import ElementUI from 'element-ui'; 4 | import 'element-ui/lib/theme-chalk/index.css'; 5 | import App from './App.vue'; 6 | import router from '@/router/router' 7 | 8 | Vue.use(ElementUI); 9 | Vue.use(BaiduMap, { 10 | ak: "L0eY0aB9So7nEfQLkLAdG4cHuS9S68Oc" 11 | }); 12 | 13 | new Vue({ 14 | el: '#app', 15 | router, 16 | render: h => h(App) 17 | }); -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/ApprovalDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.ApprovalPO; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-20 13 | */ 14 | public interface ApprovalDao extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/MaterialDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.MaterialPO; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-19 13 | */ 14 | public interface MaterialDao extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-vue/.yarnrc: -------------------------------------------------------------------------------- 1 | registry "https://registry.npm.taobao.org" 2 | sass_binary_site "https://npm.taobao.org/mirrors/node-sass/" 3 | phantomjs_cdnurl "http://cnpmjs.org/downloads" 4 | electron_mirror "https://npm.taobao.org/mirrors/electron/" 5 | sqlite3_binary_host_mirror "https://foxgis.oss-cn-shanghai.aliyuncs.com/" 6 | profiler_binary_host_mirror "https://npm.taobao.org/mirrors/node-inspector/" 7 | chromedriver_cdnurl "https://cdn.npm.taobao.org/dist/chromedriver" -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/TransportDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.TransportPO; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-20 13 | */ 14 | public interface TransportDao extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/IOperationLogService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.OperationLogPO; 5 | 6 | /** 7 | *

8 | * 操作日志表 服务类 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-03-24 13 | */ 14 | public interface IOperationLogService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/IMaterialCategoryService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.MaterialCategoryPO; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-19 13 | */ 14 | public interface IMaterialCategoryService extends IService { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 24 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/MaterialCategoryDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.MaterialCategoryPO; 5 | 6 | /** 7 | *

8 | * Mapper 接口 9 | *

10 | * 11 | * @author xugongkai 12 | * @since 2020-04-19 13 | */ 14 | public interface MaterialCategoryDao extends BaseMapper { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/IApprovalService.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.bestbigkk.persistence.entity.ApprovalPO; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | *

9 | * 服务类 10 | *

11 | * 12 | * @author xugongkai 13 | * @since 2020-04-20 14 | */ 15 | public interface IApprovalService extends IService { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.UserPO; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | *

9 | * Mapper 接口 10 | *

11 | * 12 | * @author xugongkai 13 | * @since 2020-04-19 14 | */ 15 | @Repository 16 | public interface UserDao extends BaseMapper { 17 | 18 | } 19 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/mapper.java.ftl: -------------------------------------------------------------------------------- 1 | package ${package.Mapper}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superMapperClassPackage}; 5 | 6 | /** 7 | *

8 | * ${table.comment!} Mapper 接口 9 | *

10 | * 11 | * @author ${author} 12 | * @since ${date} 13 | */ 14 | <#if kotlin> 15 | interface ${table.mapperName} : ${superMapperClass}<${entity}> 16 | <#else> 17 | public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/mapper.java.vm: -------------------------------------------------------------------------------- 1 | package ${package.Mapper}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superMapperClassPackage}; 5 | 6 | /** 7 | *

8 | * $!{table.comment} Mapper 接口 9 | *

10 | * 11 | * @author ${author} 12 | * @since ${date} 13 | */ 14 | #if(${kotlin}) 15 | interface ${table.mapperName} : ${superMapperClass}<${entity}> 16 | #else 17 | public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { 18 | 19 | } 20 | #end 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/service.java.vm: -------------------------------------------------------------------------------- 1 | package ${package.Service}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superServiceClassPackage}; 5 | 6 | /** 7 | *

8 | * $!{table.comment} 服务类 9 | *

10 | * 11 | * @author ${author} 12 | * @since ${date} 13 | */ 14 | #if(${kotlin}) 15 | interface ${table.serviceName} : ${superServiceClass}<${entity}> 16 | #else 17 | public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { 18 | 19 | } 20 | #end 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/service.java.ftl: -------------------------------------------------------------------------------- 1 | package ${package.Service}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superServiceClassPackage}; 5 | 6 | /** 7 | *

8 | * ${table.comment!} 服务类 9 | *

10 | * 11 | * @author ${author} 12 | * @since ${date} 13 | */ 14 | <#if kotlin> 15 | interface ${table.serviceName} : ${superServiceClass}<${entity}> 16 | <#else> 17 | public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/mapper.java.btl: -------------------------------------------------------------------------------- 1 | package ${package.Mapper}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superMapperClassPackage}; 5 | 6 | /** 7 | *

8 | * ${table.comment!} Mapper 接口 9 | *

10 | * 11 | * @author ${author} 12 | * @since ${date} 13 | */ 14 | <% if(kotlin){ %> 15 | interface ${table.mapperName} : ${superMapperClass}<${entity}> 16 | <% }else{ %> 17 | public interface ${table.mapperName} extends ${superMapperClass}<${entity}> { 18 | 19 | } 20 | <% } %> 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/service.java.btl: -------------------------------------------------------------------------------- 1 | package ${package.Service}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${superServiceClassPackage}; 5 | 6 | /** 7 | *

8 | * ${table.comment!} 服务类 9 | *

10 | * 11 | * @author ${author} 12 | * @since ${date} 13 | */ 14 | <% if(kotlin){ %> 15 | interface ${table.serviceName} : ${superServiceClass}<${entity}> 16 | <% }else{ %> 17 | public interface ${table.serviceName} extends ${superServiceClass}<${entity}> { 18 | 19 | } 20 | <% } %> 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/validator/LogRecord.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.validator; 2 | 3 | 4 | import java.lang.annotation.*; 5 | 6 | /** 7 | * @author: 开 8 | * @date: 2020-03-24 14:52:39 9 | * @describe: 使用注解,所以被修饰的方法都会被记录执行记录。 10 | */ 11 | @Target( { ElementType.METHOD } ) 12 | @Retention( RetentionPolicy.RUNTIME ) 13 | @Documented 14 | public @interface LogRecord { 15 | 16 | /** 17 | * 模块名称 18 | */ 19 | String modelName() ; 20 | 21 | /** 22 | * 描述. 23 | */ 24 | String description() default ""; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/dao/OperationLogDao.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.dao; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.bestbigkk.persistence.entity.OperationLogPO; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | *

9 | * 操作日志表 Mapper 接口 10 | *

11 | * 12 | * @author xugongkai 13 | * @since 2020-03-24 14 | */ 15 | @Repository 16 | public interface OperationLogDao extends BaseMapper { 17 | 18 | int countA(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/test/java/com/bestbigkk/simple/SimpleTest.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.simple; 2 | 3 | import com.bestbigkk.common.web.ResultCode; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | 8 | /** 9 | * @author: 开 10 | * @date: 2020-03-24 16:03:36 11 | * @describe: 普通Java测试 12 | */ 13 | public class SimpleTest { 14 | 15 | @Test 16 | public void test() throws IOException { 17 | f(); 18 | f("1"); 19 | } 20 | 21 | public void f(String...a){ 22 | System.out.println(a.length); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/page/base/50X.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 20 | 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/WebSocketConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter; 6 | 7 | /** 8 | * @author: 开 9 | * @date: 2020-03-27 11:46:20 10 | * @describe: WebSocket支持 11 | */ 12 | @Configuration 13 | public class WebSocketConfig { 14 | @Bean 15 | public ServerEndpointExporter serverEndpointExporter() { 16 | return new ServerEndpointExporter(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/GlobalInit.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.boot.CommandLineRunner; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | /** 8 | * @author: 开 9 | * @date: 2020-03-24 15:54:47 10 | * @describe: 跟随SpringBoot进行初始化,在SpringBoot完全启动之后将触发。 11 | */ 12 | @Slf4j 13 | @Configuration 14 | public class GlobalInit implements CommandLineRunner { 15 | 16 | @Override 17 | public void run(String... args) throws Exception { 18 | log.info("伴随启动行为..."); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/ListResponse.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * @author: 开 13 | * @date: 2020-04-19 20:35:22 14 | * @describe: 公共列表响应对象,会加装一个分页信息 15 | */ 16 | @Data 17 | @Builder 18 | @AllArgsConstructor 19 | @NoArgsConstructor 20 | public class ListResponse implements Serializable { 21 | 22 | private List list; 23 | private Pagination pagination; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.UserDao; 5 | import com.bestbigkk.persistence.entity.UserPO; 6 | import com.bestbigkk.service.IUserService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author xugongkai 15 | * @since 2020-04-19 16 | */ 17 | @Service 18 | public class UserServiceImpl extends ServiceImpl implements IUserService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/response/Tips.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.response; 2 | 3 | /** 4 | * @author: 开 5 | * @date: 2020-03-23 20:10:46 6 | * @describe: 补充信息实体,可以在响应数据的时候,主动向其中设置额外信息,响应包装类会自动作为msg信息返回。 7 | */ 8 | public class Tips { 9 | private static final ThreadLocal MSG = new ThreadLocal<>(); 10 | 11 | public static String getAndRemove() { 12 | try { 13 | return MSG.get(); 14 | }finally { 15 | MSG.remove(); 16 | } 17 | } 18 | 19 | public static void set(String content) { 20 | MSG.set(content); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/EventServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.EventDao; 5 | import com.bestbigkk.persistence.entity.EventPO; 6 | import com.bestbigkk.service.EventService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author xugongkai 15 | * @since 2020-04-21 16 | */ 17 | @Service 18 | public class EventServiceImpl extends ServiceImpl implements EventService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/ApprovalServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.ApprovalDao; 5 | import com.bestbigkk.persistence.entity.ApprovalPO; 6 | import com.bestbigkk.service.IApprovalService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author xugongkai 15 | * @since 2020-04-20 16 | */ 17 | @Service 18 | public class ApprovalServiceImpl extends ServiceImpl implements IApprovalService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/MaterialServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.MaterialDao; 5 | import com.bestbigkk.persistence.entity.MaterialPO; 6 | import com.bestbigkk.service.IMaterialService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author xugongkai 15 | * @since 2020-04-19 16 | */ 17 | @Service 18 | public class MaterialServiceImpl extends ServiceImpl implements IMaterialService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/TransportServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.TransportDao; 5 | import com.bestbigkk.persistence.entity.TransportPO; 6 | import com.bestbigkk.service.ITransportService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author xugongkai 15 | * @since 2020-04-20 16 | */ 17 | @Service 18 | public class TransportServiceImpl extends ServiceImpl implements ITransportService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bbk-seed 7 | com.bestbigkk 8 | 2.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ${bbk-persistence-name} 13 | ${bbk-version} 14 | jar 15 | 16 | 17 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/enums/Identity.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.enums; 2 | 3 | /** 4 | * @author: 开 5 | * @date: 2020-04-19 20:01:03 6 | * @describe: 系统身份 7 | */ 8 | public enum Identity { 9 | 10 | /** 11 | * 身份 12 | */ 13 | EVENT_OPERATOR(1, "应急事件响应工作人员"), 14 | APPROVAL_OPERATOR(2, "审批工作人员"), 15 | MATERIAL_OPERATOR(3, "物资仓储管理人员"), 16 | SYSTEM_OPERATOR(4, "系统运维人员"); 17 | 18 | public Integer identityCode; 19 | public String identityName; 20 | 21 | Identity(int identityCode, String identityName) { 22 | this.identityCode = identityCode; 23 | this.identityName = identityName; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/MaterialCategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.MaterialCategoryDao; 5 | import com.bestbigkk.persistence.entity.MaterialCategoryPO; 6 | import com.bestbigkk.service.IMaterialCategoryService; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * 服务实现类 12 | *

13 | * 14 | * @author xugongkai 15 | * @since 2020-04-19 16 | */ 17 | @Service 18 | public class MaterialCategoryServiceImpl extends ServiceImpl implements IMaterialCategoryService { 19 | 20 | } 21 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.transaction.annotation.EnableTransactionManagement; 7 | 8 | /** 9 | * @author: 开 10 | * @date: 2020-04-19 20:31:22 11 | * @describe: MybatisPlus配置 12 | */ 13 | @Configuration 14 | @EnableTransactionManagement 15 | public class MybatisPlusConfig { 16 | 17 | @Bean 18 | public PaginationInterceptor paginationInterceptor() { 19 | return new PaginationInterceptor(); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/web/ResultCode.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.web; 2 | 3 | /** 4 | * @author: 开 5 | * @date: 2020-03-23 19:16:40 6 | * @describe: 响应状态枚举 7 | */ 8 | public enum ResultCode { 9 | 10 | /** 11 | * 正常 12 | */ 13 | OK(200, "操作成功!"), 14 | BAD_REQUEST(400, "无效的请求!"), 15 | UN_AUTHORIZATION(401, "身份未认证/权限不足, 请求无法被接受!"), 16 | DENY(403, "操作被禁止!"), 17 | NOT_FOUND(404, "资源未找到"), 18 | BUSINESS(1314, "服务未达到预期!"), 19 | SERVER_ERROR(500, "服务器错误"), 20 | SERVER_BUSY(502, "服务器繁忙"); 21 | 22 | 23 | 24 | public int code; 25 | public String msg; 26 | 27 | ResultCode(int i, String s) { 28 | this.code = i; 29 | this.msg = s; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/validator/AccessLimit.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.validator; 2 | 3 | import java.lang.annotation.*; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | /** 7 | * @author: 开 8 | * @date: 2020-03-24 15:05:12 9 | * @describe: 限流增强 10 | */ 11 | @Target( { ElementType.METHOD } ) 12 | @Retention( RetentionPolicy.RUNTIME ) 13 | @Documented 14 | public @interface AccessLimit { 15 | 16 | /** 17 | * 每秒向桶中放入令牌的数量 默认最大即不做限流 18 | * @return 19 | */ 20 | double perSecond() default Double.MAX_VALUE; 21 | 22 | /** 23 | * 获取令牌的等待时间 默认0 24 | * @return 25 | */ 26 | int timeOut() default 0; 27 | 28 | /** 29 | * 超时时间单位 30 | * @return 31 | */ 32 | TimeUnit timeOutUnit() default TimeUnit.SECONDS; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/serviceImpl.java.vm: -------------------------------------------------------------------------------- 1 | package ${package.ServiceImpl}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${package.Mapper}.${table.mapperName}; 5 | import ${package.Service}.${table.serviceName}; 6 | import ${superServiceImplClassPackage}; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * $!{table.comment} 服务实现类 12 | *

13 | * 14 | * @author ${author} 15 | * @since ${date} 16 | */ 17 | @Service 18 | #if(${kotlin}) 19 | open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { 20 | 21 | } 22 | #else 23 | public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { 24 | 25 | } 26 | #end 27 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/serviceImpl.java.ftl: -------------------------------------------------------------------------------- 1 | package ${package.ServiceImpl}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${package.Mapper}.${table.mapperName}; 5 | import ${package.Service}.${table.serviceName}; 6 | import ${superServiceImplClassPackage}; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * ${table.comment!} 服务实现类 12 | *

13 | * 14 | * @author ${author} 15 | * @since ${date} 16 | */ 17 | @Service 18 | <#if kotlin> 19 | open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { 20 | 21 | } 22 | <#else> 23 | public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/base/ele-base.js: -------------------------------------------------------------------------------- 1 | 2 | export function resetForm(formName, callBack) { 3 | console.log("重置表单"+formName); 4 | this.$refs[formName].resetFields(); 5 | if(callBack!==undefined){ 6 | callBack(); 7 | } 8 | } 9 | 10 | export function submitForm(formName, validCall, invalidCall) { 11 | this.$refs[formName].validate((valid) => { 12 | console.log("校验表单"+formName); 13 | if (valid) { 14 | if(validCall!==undefined){ 15 | validCall(); 16 | } 17 | } else { 18 | this.$alert('需要按照规定输入正确的数据才可以提交', '表单校验不通过', {confirmButtonText: '我知道了', type:'warning', showClose:false}); 19 | if (invalidCall!==undefined) { 20 | invalidCall(); 21 | } 22 | return false; 23 | } 24 | }); 25 | } -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/serviceImpl.java.btl: -------------------------------------------------------------------------------- 1 | package ${package.ServiceImpl}; 2 | 3 | import ${package.Entity}.${entity}; 4 | import ${package.Mapper}.${table.mapperName}; 5 | import ${package.Service}.${table.serviceName}; 6 | import ${superServiceImplClassPackage}; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

11 | * ${table.comment!} 服务实现类 12 | *

13 | * 14 | * @author ${author} 15 | * @since ${date} 16 | */ 17 | @Service 18 | <% if(kotlin){ %> 19 | open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { 20 | 21 | } 22 | <% }else{ %> 23 | public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} { 24 | 25 | } 26 | <% } %> 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/config/oss/qiniu/QiniuConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.config.oss.qiniu; 2 | 3 | import lombok.Data; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.boot.context.properties.ConfigurationProperties; 6 | 7 | import javax.annotation.PostConstruct; 8 | 9 | /** 10 | * @author: 开 11 | * @date: 2020-04-25 12:18:30 12 | * @describe: 七牛云配置 13 | */ 14 | @Data 15 | @Slf4j 16 | @ConfigurationProperties(prefix = "bbk.oss.qiniu") 17 | public class QiniuConfig { 18 | 19 | private String accessKey; 20 | private String secretKey; 21 | private String bucket; 22 | private String path; 23 | 24 | @PostConstruct 25 | public void init(){ 26 | log.info("加载七牛云配置:" + accessKey + ", " + secretKey + ", " + bucket + ", " + path); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/validator/PropertyIn.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.validator; 2 | 3 | import com.bestbigkk.web.validator.impl.PropertyInValidator; 4 | 5 | import javax.validation.Constraint; 6 | import javax.validation.Payload; 7 | import java.lang.annotation.*; 8 | 9 | /** 10 | * @author: 开 11 | * @date: 2020-01-18 17:27:58 12 | * @describe: 校验给定的字段是否在指定集合 13 | */ 14 | @Target({ElementType.FIELD}) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | @Documented 17 | @Constraint(validatedBy = {PropertyInValidator.class}) 18 | public @interface PropertyIn { 19 | 20 | String message() default "传递的值不在允许的集合"; 21 | 22 | String[] values() default {}; 23 | 24 | boolean require() default false; 25 | 26 | Class[] groups() default {}; 27 | Class[] payload() default {}; 28 | } 29 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/response/annotation/RW.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.response.annotation; 2 | 3 | import org.springframework.core.annotation.AliasFor; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | import java.lang.annotation.ElementType; 8 | import java.lang.annotation.Retention; 9 | import java.lang.annotation.RetentionPolicy; 10 | import java.lang.annotation.Target; 11 | 12 | /** 13 | * @author: 开 14 | * @date: 2020-01-18 17:30:48 15 | * @describe: 使用该注解,指定响应数据需要进行包装 16 | */ 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Target({ElementType.METHOD, ElementType.TYPE}) 19 | @RestController 20 | public @interface RW { 21 | 22 | @AliasFor(annotation = RestController.class) 23 | String value() default ""; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/.gitignore: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Build Tools 3 | 4 | .gradle 5 | /build/ 6 | !gradle/wrapper/gradle-wrapper.jar 7 | 8 | target/ 9 | !.mvn/wrapper/maven-wrapper.jar 10 | 11 | out/ 12 | 13 | ###################################################################### 14 | # IDE 15 | 16 | ### STS ### 17 | .apt_generated 18 | .classpath 19 | .factorypath 20 | .project 21 | .settings 22 | .springBeans 23 | 24 | ### IntelliJ IDEA ### 25 | .idea 26 | *.iws 27 | *.iml 28 | *.ipr 29 | 30 | ### NetBeans ### 31 | nbproject/private/ 32 | build/* 33 | nbbuild/ 34 | dist/ 35 | nbdist/ 36 | .nb-gradle/ 37 | 38 | ###################################################################### 39 | # Others 40 | *.log 41 | *.xml.versionsBackup 42 | *.swp 43 | 44 | !*/build/*.java 45 | !*/build/*.html 46 | !*/build/*.xml 47 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/impl/OperationLogServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.bestbigkk.persistence.dao.OperationLogDao; 5 | import com.bestbigkk.persistence.entity.OperationLogPO; 6 | import com.bestbigkk.service.IOperationLogService; 7 | import org.checkerframework.checker.units.qual.A; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | /** 12 | *

13 | * 操作日志表 服务实现类 14 | *

15 | * 16 | * @author xugongkai 17 | * @since 2020-03-24 18 | */ 19 | @Service 20 | public class OperationLogServiceImpl extends ServiceImpl implements IOperationLogService { 21 | 22 | @Autowired 23 | private OperationLogDao operationLogDao; 24 | } 25 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/config/oss/qiniu/QiniuBeanConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.config.oss.qiniu; 2 | 3 | import com.qiniu.common.Zone; 4 | import com.qiniu.util.Auth; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | 9 | @Configuration 10 | public class QiniuBeanConfig { 11 | 12 | @Autowired 13 | private QiniuConfig qiniuProperties; 14 | 15 | /** 获取七牛云的Configuration */ 16 | @Bean 17 | public com.qiniu.storage.Configuration getQiniuConfig() { 18 | return new com.qiniu.storage.Configuration(Zone.zone0()); 19 | } 20 | 21 | /** 获取Auth */ 22 | @Bean 23 | public Auth getAuth() { 24 | return Auth.create(qiniuProperties.getAccessKey(), qiniuProperties.getSecretKey()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/exception/BusinessException.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.exception; 2 | 3 | import com.bestbigkk.common.web.ResultCode; 4 | import lombok.Data; 5 | 6 | /** 7 | * @author: 开 8 | * @date: 2020-03-24 09:26:55 9 | * @describe: 常规业务异常 10 | */ 11 | @Data 12 | public class BusinessException extends RuntimeException { 13 | private ResultCode resultCode; 14 | 15 | public BusinessException(String message) { 16 | super(message); 17 | resultCode = ResultCode.BAD_REQUEST; 18 | } 19 | 20 | public BusinessException(String message, Throwable cause) { 21 | super(message, cause); 22 | resultCode = ResultCode.BAD_REQUEST; 23 | } 24 | 25 | public BusinessException(ResultCode resultCode, String message) { 26 | super(message); 27 | this.resultCode = resultCode == null ? ResultCode.BAD_REQUEST : resultCode; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/aspect/AbstractAspect.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.aspect; 2 | 3 | import org.aspectj.lang.JoinPoint; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.lang.reflect.Method; 7 | 8 | /** 9 | * @author: 开 10 | * @date: 2020-03-24 15:02:24 11 | * @describe: 切面实现装饰 12 | */ 13 | 14 | public abstract class AbstractAspect { 15 | 16 | /** 17 | * 18 | * @param joinPoint 19 | * @param method 20 | * @param throwable 21 | * @return 22 | * @throws Throwable 23 | */ 24 | public abstract Object doHandlerAspect(JoinPoint joinPoint, Method method, Throwable throwable) throws Throwable; 25 | 26 | /** 27 | * 执行切面实现类要执行的增强操作 28 | * @param joinPoint 29 | * @param method 30 | * @return 31 | * @throws Throwable 32 | */ 33 | public abstract Object execute(JoinPoint joinPoint, Method method, Throwable throwable) throws Throwable; 34 | } 35 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/WebMvcConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.*; 5 | 6 | /** 7 | * @author: 开 8 | * @date: 2020-03-23 19:04:14 9 | * @describe: mvc 10 | */ 11 | @Configuration 12 | public class WebMvcConfig extends WebMvcConfigurationSupport { 13 | 14 | @Override 15 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 16 | 17 | ///将该行注释掉就可以保证NoHandlerFoundException异常可以正确抛出,但是可能会造成static下资源无法访问的问题。 18 | ///registry.addResourceHandler("/**").addResourceLocations("classpath:/static/"); 19 | registry.addResourceHandler("swagger-ui.html") 20 | .addResourceLocations("classpath:/META-INF/resources/"); 21 | registry.addResourceHandler("/webjars/**") 22 | .addResourceLocations("classpath:/META-INF/resources/webjars/"); 23 | super.addResourceHandlers(registry); 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/shiro/authc/JwtToken.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config.shiro.authc; 2 | 3 | import com.bestbigkk.common.utils.SnowflakeIdWorker; 4 | import lombok.Data; 5 | import org.apache.shiro.authc.AuthenticationToken; 6 | 7 | import javax.servlet.ServletRequest; 8 | 9 | /** 10 | * @author: 开 11 | * @date: 2020-03-25 17:24:15 12 | * @describe: 令牌 13 | */ 14 | @Data 15 | public final class JwtToken implements AuthenticationToken { 16 | 17 | /**在Shiro的Redis缓存管理器中,使用该字段唯一标识*/ 18 | private Long id; 19 | 20 | private String token; 21 | 22 | private ServletRequest servletRequest; 23 | 24 | public JwtToken(String token) { 25 | this.token = token; 26 | this.id = SnowflakeIdWorker.nextId(); 27 | } 28 | 29 | @Override 30 | public String getPrincipal() { 31 | return token; 32 | } 33 | 34 | @Override 35 | public String getCredentials() { 36 | return token; 37 | } 38 | 39 | public ServletRequest getServletRequest() { 40 | return servletRequest; 41 | } 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bbk-seed 7 | com.bestbigkk 8 | 2.0-SNAPSHOT 9 | 10 | 11 | 4.0.0 12 | ${bbk-version} 13 | ${bbk-common-name} 14 | jar 15 | 16 | 17 | 18 | 1.9.12 19 | 20 | 21 | 22 | 23 | 24 | uk.com.robust-it 25 | cloning 26 | ${clone-util.version} 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bbk-seed 7 | com.bestbigkk 8 | 2.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | ${bbk-service-name} 13 | ${bbk-version} 14 | jar 15 | 16 | 17 | 18 | com.bestbigkk 19 | ${bbk-common-name} 20 | ${bbk-version} 21 | 22 | 23 | com.bestbigkk 24 | ${bbk-persistence-name} 25 | ${bbk-version} 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/controller.java.vm: -------------------------------------------------------------------------------- 1 | package ${package.Controller}; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | #if(${restControllerStyle}) 7 | import org.springframework.web.bind.annotation.RestController; 8 | #else 9 | import org.springframework.stereotype.Controller; 10 | #end 11 | #if(${superControllerClassPackage}) 12 | import ${superControllerClassPackage}; 13 | #end 14 | 15 | /** 16 | *

17 | * $!{table.comment} 前端控制器 18 | *

19 | * 20 | * @author ${author} 21 | * @since ${date} 22 | */ 23 | #if(${restControllerStyle}) 24 | @RestController 25 | #else 26 | @Controller 27 | #end 28 | @RequestMapping("#if(${package.ModuleName})/${package.ModuleName}#end/#if(${controllerMappingHyphenStyle})${controllerMappingHyphen}#else${table.entityPath}#end") 29 | #if(${kotlin}) 30 | class ${table.controllerName}#if(${superControllerClass}) : ${superControllerClass}()#end 31 | 32 | #else 33 | #if(${superControllerClass}) 34 | public class ${table.controllerName} extends ${superControllerClass} { 35 | #else 36 | public class ${table.controllerName} { 37 | #end 38 | 39 | } 40 | 41 | #end -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/ApprovalDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | id, title, content, create_time, last_update_time, level, status, approval_user_id, material_apply 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /bbk-mss-vue/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 40 | 41 |
42 | 43 | 44 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ${AnsiColor.BRIGHT_YELLOW} 2 | //////////////////////////////////////////////////////////////////// 3 | 4 | _ooOoo_ 5 | o8888888o 6 | 88" . "88 7 | (| -_- |) 8 | O\ = /O 9 | ____/`---'\____ 10 | .' \\| |// `. 11 | / \\||| : |||// \ 12 | / _||||| -:- |||||- \ 13 | | | \\\ - /// | | 14 | | \_| ''\---/'' | | 15 | \ .-\__ `-` ___/-. / 16 | ___`. .' /--.--\ `. . __ 17 | ."" '< `.___\_<|>_/___.' >'"". 18 | | | : `- \`.;`\ _ /`;.`/ - ` : | | 19 | \ \ `-. \_ __\ /__ _/ .-` / / 20 | ======`-.____`-.___\_____/___.-`____.-'====== 21 | `=---=' 22 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 23 | BestBigKK-MaterialSupportSystem 24 | // 佛祖保佑 永不宕机 永无BUG // 25 | 26 | //////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/HttpUtils.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | public class HttpUtils { 6 | 7 | private static final String UNKNOWN = "unknown"; 8 | 9 | public static String getIpAddress(HttpServletRequest request) { 10 | String ip = request.getHeader("x-forwarded-for"); 11 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 12 | ip = request.getHeader("Proxy-Client-IP"); 13 | } 14 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 15 | ip = request.getHeader("WL-Proxy-Client-IP"); 16 | } 17 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 18 | ip = request.getHeader("HTTP_CLIENT_IP"); 19 | } 20 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 21 | ip = request.getHeader("HTTP_X_FORWARDED_FOR"); 22 | } 23 | if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { 24 | ip = request.getRemoteAddr(); 25 | } 26 | return ip+":"+request.getRemotePort(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/validator/impl/PropertyInValidator.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.validator.impl; 2 | 3 | import com.bestbigkk.web.validator.PropertyIn; 4 | import org.springframework.util.StringUtils; 5 | 6 | import javax.validation.ConstraintValidator; 7 | import javax.validation.ConstraintValidatorContext; 8 | 9 | /** 10 | * @author: 开 11 | * @date: 2020-01-18 17:27:25 12 | * @describe: 校验给定字段是否在允许的集合里面实现 13 | */ 14 | public class PropertyInValidator implements ConstraintValidator { 15 | 16 | private PropertyIn propertyIn; 17 | 18 | @Override 19 | public void initialize(PropertyIn constraintAnnotation) { 20 | this.propertyIn = constraintAnnotation; 21 | } 22 | 23 | @Override 24 | public boolean isValid(String value, ConstraintValidatorContext context) { 25 | boolean empty = StringUtils.isEmpty(value); 26 | if (empty) { 27 | return !propertyIn.require(); 28 | } 29 | String[] values = propertyIn.values(); 30 | for (String property : values) { 31 | if (property.equals(value)) { 32 | return true; 33 | } 34 | } 35 | return false; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/RestTemplateConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import io.swagger.models.auth.In; 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.http.client.ClientHttpRequestFactory; 7 | import org.springframework.http.client.SimpleClientHttpRequestFactory; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | /** 11 | * @author: 开 12 | * @date: 2020-03-25 15:37:09 13 | * @describe: resetTemplate配置 14 | */ 15 | @Configuration 16 | public class RestTemplateConfig { 17 | 18 | private static final Integer READ_TIMEOUT = 5000; 19 | private static final Integer CONNECT_TIMEOUT = 15000; 20 | 21 | 22 | @Bean 23 | public RestTemplate restTemplate(ClientHttpRequestFactory factory){ 24 | return new RestTemplate(factory); 25 | } 26 | @Bean 27 | public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ 28 | SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); 29 | factory.setConnectTimeout(CONNECT_TIMEOUT); 30 | factory.setReadTimeout(READ_TIMEOUT); 31 | return factory; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/OperationLogDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | id, model_name, action_args, create_time, log_description, log_location, log_status, error_msg 20 | 21 | 22 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/controller.java.btl: -------------------------------------------------------------------------------- 1 | package ${package.Controller}; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | <% if(restControllerStyle){ %> 7 | import org.springframework.web.bind.annotation.RestController; 8 | <% }else{ %> 9 | import org.springframework.stereotype.Controller; 10 | <% } %> 11 | <% if(isNotEmpty(superControllerClassPackage)){ %> 12 | import ${superControllerClassPackage}; 13 | <% } %> 14 | 15 | /** 16 | *

17 | * ${table.comment!} 前端控制器 18 | *

19 | * 20 | * @author ${author} 21 | * @since ${date} 22 | */ 23 | <% if(restControllerStyle){ %> 24 | @RestController 25 | <% }else{ %> 26 | @Controller 27 | <% } %> 28 | @RequestMapping("<% if(isNotEmpty(package.ModuleName)){ %>/${package.ModuleName}<% } %>/<% if(isNotEmpty(controllerMappingHyphenStyle)){ %>${controllerMappingHyphen}<% }else{ %>${table.entityPath}<% } %>") 29 | <% if(kotlin){ %> 30 | class ${table.controllerName}<% if(isNotEmpty(superControllerClass)){ %> : ${superControllerClass}()<% } %> 31 | <% }else{ %> 32 | <% if(isNotEmpty(superControllerClass)){ %> 33 | public class ${table.controllerName} extends ${superControllerClass} { 34 | <% }else{ %> 35 | public class ${table.controllerName} { 36 | <% } %> 37 | 38 | } 39 | <% } %> 40 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/mapper.xml.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #if(${enableCache}) 6 | 7 | 8 | 9 | #end 10 | #if(${baseResultMap}) 11 | 12 | 13 | #foreach($field in ${table.fields}) 14 | #if(${field.keyFlag})##生成主键排在第一位 15 | 16 | #end 17 | #end 18 | #foreach($field in ${table.commonFields})##生成公共字段 19 | 20 | #end 21 | #foreach($field in ${table.fields}) 22 | #if(!${field.keyFlag})##生成普通字段 23 | 24 | #end 25 | #end 26 | 27 | 28 | #end 29 | #if(${baseColumnList}) 30 | 31 | 32 | #foreach($field in ${table.commonFields}) 33 | ${field.name}, 34 | #end 35 | ${table.fieldNames} 36 | 37 | 38 | #end 39 | 40 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/mapper.xml.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <#if enableCache> 6 | 7 | 8 | 9 | 10 | <#if baseResultMap> 11 | 12 | 13 | <#list table.fields as field> 14 | <#if field.keyFlag><#--生成主键排在第一位--> 15 | 16 | 17 | 18 | <#list table.commonFields as field><#--生成公共字段 --> 19 | 20 | 21 | <#list table.fields as field> 22 | <#if !field.keyFlag><#--生成普通字段 --> 23 | 24 | 25 | 26 | 27 | 28 | 29 | <#if baseColumnList> 30 | 31 | 32 | <#list table.commonFields as field> 33 | ${field.name}, 34 | 35 | ${table.fieldNames} 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/components/UploadFile.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 38 | 39 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/TransportDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | id, approval_id, create_time, expect_time, create_user_id, transport_record, material_record, status, receiver_user_id, transport_type 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/mapper/UserDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | id, account, password, salt, nick_name, sex, picture, address, identity_code, identity_name, create_time, enable 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/RequestContextHolderUtils.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils; 2 | 3 | import org.springframework.web.context.ContextLoader; 4 | import org.springframework.web.context.request.RequestContextHolder; 5 | import org.springframework.web.context.request.ServletRequestAttributes; 6 | 7 | import javax.servlet.ServletContext; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | import javax.servlet.http.HttpSession; 11 | 12 | /** 13 | * @author: 开 14 | * @date: 2020-03-23 19:31:21 15 | * @describe: web域对象快速获取 16 | */ 17 | public class RequestContextHolderUtils { 18 | 19 | public static HttpServletRequest getRequest() { 20 | return getRequestAttributes().getRequest(); 21 | } 22 | 23 | public static HttpServletResponse getResponse() { 24 | return getRequestAttributes().getResponse(); 25 | } 26 | 27 | public static HttpSession getSession() { 28 | return getRequest().getSession(); 29 | } 30 | 31 | public static ServletRequestAttributes getRequestAttributes() { 32 | return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()); 33 | } 34 | 35 | public static ServletContext getServletContext() { 36 | return ContextLoader.getCurrentWebApplicationContext().getServletContext(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/mapper.xml.btl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <% if(enableCache){ %> 6 | 7 | 8 | 9 | <% } %> 10 | <% if(baseResultMap){ %> 11 | 12 | 13 | <% for(field in table.fields){ %> 14 | <% /** 生成主键排在第一位 **/ %> 15 | <% if(field.keyFlag){ %> 16 | 17 | <% } %> 18 | <% } %> 19 | <% for(field in table.commonFields){ %> 20 | <% /** 生成公共字段 **/ %> 21 | 22 | <% } %> 23 | <% for(field in table.fields){ %> 24 | <% /** 生成普通字段 **/ %> 25 | <% if(!field.keyFlag){ %> 26 | 27 | <% } %> 28 | <% } %> 29 | 30 | <% } %> 31 | <% if(baseColumnList){ %> 32 | 33 | 34 | <% for(field in table.commonFields){ %> 35 | ${field.name}, 36 | <% } %> 37 | ${table.fieldNames} 38 | 39 | 40 | <% } %> 41 | 42 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/CorsConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.cors.CorsConfiguration; 6 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 7 | import org.springframework.web.filter.CorsFilter; 8 | 9 | /** 10 | * @author: 开 11 | * @date: 2020-03-24 15:26:10 12 | * @describe: 跨域 13 | */ 14 | @Configuration 15 | public class CorsConfig { 16 | private CorsConfiguration buildConfig() { 17 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 18 | // 1允许服务端访问 19 | corsConfiguration.addAllowedOrigin("*"); 20 | // 1.1允许本地访问 21 | corsConfiguration.addAllowedOrigin("http://localhost:8848"); 22 | // 2允许任何头 23 | corsConfiguration.addAllowedHeader("*"); 24 | // 3允许任何方法(post、get等) 25 | corsConfiguration.addAllowedMethod("*"); 26 | // 4 允许withCredentials报文头 27 | corsConfiguration.setAllowCredentials(true); 28 | return corsConfiguration; 29 | } 30 | 31 | @Bean 32 | public CorsFilter corsFilter() { 33 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 34 | source.registerCorsConfiguration("/**", buildConfig()); 35 | return new CorsFilter(source); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bbk-mss-vue/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "material-support-system-rebuild-vue", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "npx 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.13.1", 14 | "qs": "^6.9.3", 15 | "vue": "^2.6.11", 16 | "vue-axios": "^2.1.5", 17 | "vue-baidu-map": "^0.21.22", 18 | "vue-router": "^3.1.6" 19 | }, 20 | "devDependencies": { 21 | "@vue/cli-plugin-babel": "~4.3.0", 22 | "@vue/cli-plugin-eslint": "~4.3.0", 23 | "@vue/cli-service": "~4.3.0", 24 | "babel-eslint": "^10.1.0", 25 | "eslint": "^6.7.2", 26 | "eslint-plugin-vue": "^6.2.2", 27 | "vue-template-compiler": "^2.6.11" 28 | }, 29 | "eslintConfig": { 30 | "root": true, 31 | "env": { 32 | "node": true 33 | }, 34 | "extends": [ 35 | "plugin:vue/essential", 36 | "eslint:recommended" 37 | ], 38 | "parserOptions": { 39 | "parser": "babel-eslint" 40 | }, 41 | "rules": { 42 | "generator-star-spacing": "off", 43 | "no-tabs": "off", 44 | "no-unused-vars": "off", 45 | "no-console": "off", 46 | "no-irregular-whitespace": "off", 47 | "no-debugger": "off" 48 | } 49 | }, 50 | "browserslist": [ 51 | "> 1%", 52 | "last 2 versions", 53 | "not dead" 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/controller/UploadController.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.controller; 2 | 3 | import com.bestbigkk.common.exception.BusinessException; 4 | import com.bestbigkk.service.qiniu.UploadService; 5 | import com.bestbigkk.web.response.annotation.RW; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiOperation; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RestController; 13 | import org.springframework.web.multipart.MultipartFile; 14 | 15 | import java.io.IOException; 16 | import java.util.Objects; 17 | 18 | @Slf4j 19 | @RW 20 | @RequestMapping(value = "/dev/qiniu", produces = {"application/json;charset=UTF-8"}) 21 | @Api(tags = "七牛云SSO上传接口") 22 | public class UploadController { 23 | 24 | @Autowired 25 | private UploadService uploadService; 26 | 27 | @PostMapping(value = "/upload") 28 | @ApiOperation("上传SSO文件") 29 | public String upload(MultipartFile file) { 30 | if (Objects.isNull(file)) { 31 | throw new BusinessException("请提供要上传的文件"); 32 | } 33 | try { 34 | return uploadService.uploadFile(file.getInputStream(), file.getOriginalFilename()); 35 | } catch (IOException e) { 36 | log.error("七牛云上传错误", e); 37 | } 38 | throw new BusinessException("上传失败,请稍候重试!"); 39 | } 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/WithBoot.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import com.bestbigkk.common.utils.RedisUtils; 4 | import lombok.Getter; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.boot.CommandLineRunner; 9 | import org.springframework.stereotype.Component; 10 | import springfox.documentation.builders.ApiInfoBuilder; 11 | import springfox.documentation.service.ApiInfo; 12 | import springfox.documentation.spring.web.plugins.Docket; 13 | 14 | import java.util.Objects; 15 | 16 | /** 17 | * @author: 开 18 | * @date: 2020-04-19 19:30:14 19 | * @describe: 伴随启动 20 | */ 21 | @Slf4j 22 | @Component 23 | public class WithBoot implements CommandLineRunner { 24 | 25 | @Getter 26 | @Value("${server.servlet.application-display-name}") 27 | private String applicationName; 28 | 29 | @Autowired 30 | private RedisUtils redisUtils; 31 | 32 | private final String machineCountFlag = applicationName + ":machineCountFlag"; 33 | 34 | @Override 35 | public void run(String... args) { 36 | Object count = redisUtils.get(machineCountFlag); 37 | int no = 1; 38 | if (Objects.isNull(count)) { 39 | redisUtils.set(machineCountFlag, 1); 40 | } else { 41 | redisUtils.incr(machineCountFlag, 1); 42 | no = Integer.parseInt(count+"") + 1; 43 | } 44 | applicationName += "_node_" + no; 45 | log.info("成功分配机器编号:{}", applicationName); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/base/utils.js: -------------------------------------------------------------------------------- 1 | //合并source对象的属性到target 2 | export function mergeBean(source, target) { 3 | if(source===undefined){ 4 | return target; 5 | } 6 | if(target===undefined){ 7 | return source; 8 | } 9 | for(const i in source){ 10 | target[i] = source[i]; 11 | } 12 | return target; 13 | } 14 | 15 | export function dateFormat(value, format) { 16 | if (typeof(value) == "undefined" || value == null || value == '') { 17 | return value; 18 | } 19 | const date = new Date(value); 20 | format = format || 'yyyy-MM-dd'; 21 | const o = { 22 | "M+": date.getMonth() + 1, //month 23 | "d+": date.getDate(), //day 24 | "h+": date.getHours(), //hour 25 | "m+": date.getMinutes(), //minute 26 | "s+": date.getSeconds(), //second 27 | "q+": Math.floor((date.getMonth() + 3) / 3), //quarter 28 | "S": date.getMilliseconds() //millisecond 29 | }; 30 | if (/(y+)/.test(format)) { 31 | format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); 32 | } 33 | for (const k in o){ 34 | if (new RegExp("(" + k + ")").test(format)){ 35 | format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); 36 | } 37 | } 38 | return format; 39 | } 40 | 41 | export function isNull(o) { 42 | return o === undefined || o === null || o === ""; 43 | } 44 | 45 | export function isIdentity(code) { 46 | return this.$user.identityCode === code; 47 | } 48 | 49 | export function isNotIdentity(code) { 50 | return this.$user.identityCode !== code; 51 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

180.应急物资保障管理系统

2 | 3 | - 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/)) 4 | - 技术探讨、资料分享,请加QQ群:692619798 5 | - 作者微信:19941326836 QQ:952045282 6 | - 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习 7 | - 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务 8 | - 所有选题地址 ([https://github.com/YuLin-Coder/AllProjectCatalog](https://github.com/YuLin-Coder/AllProjectCatalog)) 9 | 10 | 11 | ## 项目介绍 12 | 基于springboot+vue的应急物资保障管理系统【含报告】:前端 vue、elementui,后端 maven、springmvc、spring、mybatis;角色分为管理员、应急事件响应人员、运输人员、审批人员;集成应急物资、应急事件、审批、应急物资运输等功能于一体的系统。 13 | 14 | 15 | ## 功能模块概述 16 | 17 | 1. 应急物资,应急物资分类管理模块: 18 | 该模块主要是对应急物资以及其分类进行统一的管理,包含对应急物资的新增,支出,信息更新,删除。并提供了多种筛选方式可以边快速的获取到应急物资的当前情况。针对物资分类也提供了类似的功能。 19 | 2. 应急事件管理模块: 20 | 该模块作为应急物资调度的先导而存在,可以通过该模块进行应急事件的建立,维护,并可以按照实际生活中的处理进度,更新某个应急事件的处理状态。进行统一的跟进,同时可以在该界面获取到历史的应急事件以及其处理状态,通过多种方式筛选出指定的数据,然后提供了针对某一个应急事件的物资申请发起的功能,可以为这个事件申请物资。 21 | 3. 审批模块: 22 | 该模块主要是配合应急事件管理模块,对来自该模块下建立的申请进行审批,结合实际的情况进行处理,选择通过审批或者驳回。只有经过审批之后,相关的流程才可以继续流转下去。 23 | 4. 应急物资运输模块: 24 | 通过该模块可以对已经通过审批的申请建立物资运输单,进而对申请的物资进行运输工作,并且可以在这个过程中对其进行物资的流转等操作,应急事件管理人员也可以在该模块下选择结束流转一个运输单,表示已经收到了物资。 25 | 5. 系统模块: 26 | 通过该模块对用户的信息进行管理,进行登录验证,用户权限判断等操作,并且按照用户的身份为其生成菜单。并记录其操作日志。 27 | 28 | ## 环境 29 | 30 | - IntelliJ IDEA 2021.3 31 | 32 | - Mysql 5.7.26 33 | 34 | - Node 14.14.0 35 | 36 | - Redis 3.0 37 | 38 | - JDK 1.8 39 | 40 | ## 运行截图 41 | ![](screenshot/1.png) 42 | 43 | ![](screenshot/2.png) 44 | 45 | ![](screenshot/3.png) 46 | 47 | ![](screenshot/4.png) 48 | 49 | ![](screenshot/5.png) 50 | 51 | ![](screenshot/6.png) 52 | 53 | ![](screenshot/7.png) 54 | 55 | ![](screenshot/8.png) 56 | 57 | ![](screenshot/9.png) 58 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/Pagination.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import io.swagger.annotations.ApiModelProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | import java.util.Arrays; 11 | import java.util.Objects; 12 | 13 | /** 14 | * @author: 开 15 | * @date: 2020-04-19 20:14:58 16 | * @describe: 分页对象 17 | */ 18 | @Data 19 | @NoArgsConstructor 20 | public class Pagination { 21 | 22 | @ApiModelProperty("当前页数") 23 | private Long currentPage; 24 | 25 | @ApiModelProperty("页容量") 26 | private Long pageSize; 27 | 28 | @ApiModelProperty("记录总数") 29 | private Long total; 30 | 31 | public Pagination(long currentPage, long pageSize) { 32 | this.currentPage = currentPage; 33 | this.pageSize = pageSize; 34 | } 35 | 36 | public Page toPage(String...descColumnNames) { 37 | Page page = new Page<>(); 38 | page.setCurrent(this.currentPage==null ? 1 : this.currentPage); 39 | page.setSize(this.pageSize==null ? 10 : this.pageSize); 40 | page.setTotal(this.total == null ? 0 : this.total); 41 | page.setDescs(Arrays.asList(descColumnNames)); 42 | return page; 43 | } 44 | 45 | public Pagination toPagination(IPage page) { 46 | if (Objects.isNull(page)) { 47 | return new Pagination<>(1, 10); 48 | } 49 | 50 | Pagination pagination = new Pagination<>(page.getCurrent(), page.getSize()); 51 | pagination.setTotal(page.getTotal()); 52 | return pagination; 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/test/java/com/bestbigkk/boot/BootTest.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.boot; 2 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.bestbigkk.BBKApplication; 6 | import com.bestbigkk.common.Pagination; 7 | import com.bestbigkk.common.utils.encryption.AESUtils; 8 | import com.bestbigkk.persistence.dao.UserDao; 9 | import com.bestbigkk.persistence.entity.UserPO; 10 | import com.bestbigkk.service.IUserService; 11 | import com.bestbigkk.web.config.WebSocketConfig; 12 | import lombok.extern.slf4j.Slf4j; 13 | import org.junit.runner.RunWith; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.boot.test.context.SpringBootTest; 16 | import org.springframework.test.context.junit4.SpringRunner; 17 | 18 | /** 19 | * @author: 开 20 | * @date: 2020-03-24 16:03:20 21 | * @describe: SpringBoot单元测试 22 | */ 23 | @Slf4j 24 | @RunWith(SpringRunner.class) 25 | @SpringBootTest(classes = BBKApplication.class, webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT) 26 | public class BootTest { 27 | 28 | @Autowired 29 | IUserService userService; 30 | @Autowired 31 | UserDao userDao; 32 | 33 | @org.junit.Test 34 | public void test() { 35 | final IPage page = userService.page(new Pagination(1, 1).toPage()); 36 | log.info("{}", page.getRecords()); 37 | 38 | final IPage page1 = userService.page(new Page(1, 1)); 39 | log.info("{}", page1.getRecords()); 40 | 41 | final IPage page2 = userDao.selectPage(new Pagination(1,1).toPage(), null); 42 | log.info("{}", page2.getRecords()); 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/BBKApplication.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk; 2 | 3 | import com.bestbigkk.common.config.oss.qiniu.QiniuConfig; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 8 | import org.springframework.context.ConfigurableApplicationContext; 9 | import org.springframework.core.env.Environment; 10 | import org.springframework.scheduling.annotation.EnableAsync; 11 | 12 | import java.net.InetAddress; 13 | import java.net.UnknownHostException; 14 | 15 | /** 16 | * @author: 开 17 | * @date: 2020-03-23 15:23:53 18 | * @describe: bestbigkk 19 | */ 20 | @SpringBootApplication 21 | @EnableAsync 22 | @MapperScan(basePackages = "com.bestbigkk.persistence.dao") 23 | @EnableConfigurationProperties(value = {QiniuConfig.class}) 24 | public class BBKApplication { 25 | public static void main(String[] args) throws UnknownHostException { 26 | ConfigurableApplicationContext application = SpringApplication.run(BBKApplication.class, args); 27 | 28 | //常规信息 29 | Environment env = application.getEnvironment(); 30 | String ip = InetAddress.getLocalHost().getHostAddress(); 31 | String port = env.getProperty("server.port"); 32 | String path = env.getProperty("server.servlet.context-path"); 33 | 34 | System.out.println("------------"); 35 | System.out.println("IP : " + ip); 36 | System.out.println("Port: " + port); 37 | System.out.println("Path: " + path); 38 | System.out.println("------------"); 39 | } 40 | 41 | //TODO: 应用下线之后,更新Redis中机器数量标识。 42 | } 43 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/WebSocketDemo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My WebSocket 5 | 6 | 7 | 8 |

Welcome to WebSocket Demo!

9 | 10 |
11 | 12 | 13 | 64 | -------------------------------------------------------------------------------- /bbk-mss-vue/README.md: -------------------------------------------------------------------------------- 1 | # 应急物资保障系统-(毕设) 2 | 3 | > 该系统为应急物资保障系统的前端模块。后端模块请参考:bbk-mss-java 4 | 5 | > 系统简述:模拟应急事件发生时,从事件建立, 物资申请,物资审批,物资流转等所有流程。 6 | 7 | 基于Vue开发,使用Element-ui组件库,配合Axios进行前后端数据交互。 8 | 9 | # 功能模块概述 10 | 11 | 1. 应急物资,应急物资分类管理模块: 12 | 该模块主要是对应急物资以及其分类进行统一的管理,包含对应急物资的新增,支出,信息更新,删除。并提供了多种筛选方式可以边快速的获取到应急物资的当前情况。针对物资分类也提供了类似的功能。 13 | 2. 应急事件管理模块: 14 | 该模块作为应急物资调度的先导而存在,可以通过该模块进行应急事件的建立,维护,并可以按照实际生活中的处理进度,更新某个应急事件的处理状态。进行统一的跟进,同时可以在该界面获取到历史的应急事件以及其处理状态,通过多种方式筛选出指定的数据,然后提供了针对某一个应急事件的物资申请发起的功能,可以为这个事件申请物资。 15 | 3. 审批模块: 16 | 该模块主要是配合应急事件管理模块,对来自该模块下建立的申请进行审批,结合实际的情况进行处理,选择通过审批或者驳回。只有经过审批之后,相关的流程才可以继续流转下去。 17 | 4. 应急物资运输模块: 18 | 通过该模块可以对已经通过审批的申请建立物资运输单,进而对申请的物资进行运输工作,并且可以在这个过程中对其进行物资的流转等操作,应急事件管理人员也可以在该模块下选择结束流转一个运输单,表示已经收到了物资。 19 | 5. 系统模块: 20 | 通过该模块对用户的信息进行管理,进行登录验证,用户权限判断等操作,并且按照用户的身份为其生成菜单。并记录其操作日志。 21 | 22 | # 使用该项目 23 | 1. 使用yarn安装依赖。 24 | 2. 在/src/axios/request.js中配置apiBaseURL属性,指定后端项目运行的地址。 25 | 3. 启动项目,访问http://localhost:8080进入系统。 26 | 27 | # TIPS: 28 | - 糟心的毕设体验之旅,第一份莫名其妙的大改。无奈推到重来,便有了当前重写的第二份,时间太太太仓促,很多地方只求能用即可, 29 | 因而部分功能需要继续改动,较为明显的就是:目前项目已经有了权限控制,但是后端是完全没有生效的,所有的人员均可以访问接口, 30 | 权限的实现是在前端项目进行控制。如若要进行处理,请fork并合理改造改项目。 31 | - 系统启动成功之后,登录信息参见后端项目的t_user表,密码直接存储明文,可以直接使用。 32 | 33 | # 界面 34 | ![界面1](https://gitee.com/xu_gong_kai/bbk-static-resource/raw/master/%E5%BA%94%E6%80%A5%E7%89%A9%E8%B5%84%E4%BF%9D%E9%9A%9C%E7%B3%BB%E7%BB%9F/mss01.jpg) 35 | ![界面2](https://gitee.com/xu_gong_kai/bbk-static-resource/raw/master/%E5%BA%94%E6%80%A5%E7%89%A9%E8%B5%84%E4%BF%9D%E9%9A%9C%E7%B3%BB%E7%BB%9F/mss02.jpg) 36 | ![界面3](https://gitee.com/xu_gong_kai/bbk-static-resource/raw/master/%E5%BA%94%E6%80%A5%E7%89%A9%E8%B5%84%E4%BF%9D%E9%9A%9C%E7%B3%BB%E7%BB%9F/mss03.jpg) 37 | ![界面4](https://gitee.com/xu_gong_kai/bbk-static-resource/raw/master/%E5%BA%94%E6%80%A5%E7%89%A9%E8%B5%84%E4%BF%9D%E9%9A%9C%E7%B3%BB%E7%BB%9F/mss04.jpg) -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/EventPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.fasterxml.jackson.annotation.JsonFormat; 5 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 6 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | import lombok.experimental.Accessors; 12 | 13 | import java.io.Serializable; 14 | import java.time.LocalDateTime; 15 | 16 | /** 17 | * @author xugongkai 18 | * @since 2020-04-21 19 | */ 20 | @Data 21 | @EqualsAndHashCode(callSuper = false) 22 | @Accessors(chain = true) 23 | @TableName("t_event") 24 | @ApiModel(value = "EventPO对象", description = "") 25 | public class EventPO implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | @ApiModelProperty(value = "主键") 30 | @JsonSerialize(using = ToStringSerializer.class) 31 | private Long id; 32 | 33 | @ApiModelProperty(value = "事件名称") 34 | private String title; 35 | 36 | @ApiModelProperty(value = "地点") 37 | private String address; 38 | 39 | @ApiModelProperty(value = "坐标") 40 | private String loc; 41 | 42 | @ApiModelProperty(value = "创建时间") 43 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") 44 | private LocalDateTime createTime; 45 | 46 | @ApiModelProperty(value = "创建人ID") 47 | private Long createUserId; 48 | 49 | @ApiModelProperty(value = "等级") 50 | private String level; 51 | 52 | @ApiModelProperty(value = "受灾图片:图片地址A#图片地址B#图片地址C") 53 | private String picture; 54 | 55 | @ApiModelProperty(value = "详细说明") 56 | private String detail; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/BeanCopyUtils.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.rits.cloning.Cloner; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * javaBean拷贝工具 11 | * 可深度拷贝对象以及对象集合 12 | */ 13 | public class BeanCopyUtils { 14 | 15 | private static final Cloner CLONER = new Cloner(); 16 | 17 | /** 18 | * 复制对象(深度拷贝) 19 | * @param object 20 | * @param 21 | * @return 22 | */ 23 | public static T clone(final T object){ 24 | if (object == null) { 25 | return null; 26 | } 27 | return CLONER.deepClone(object); 28 | } 29 | 30 | /** 31 | * 复制集合(深度拷贝) 32 | * @param object 33 | * @param 34 | * @return 35 | */ 36 | public static List cloneList(final List object){ 37 | if (object == null) { 38 | return null; 39 | } 40 | return CLONER.deepClone(object); 41 | } 42 | 43 | /** 44 | * 复制对象到指定类(深度拷贝) 45 | * @param object 46 | * @param destclas 指定类 47 | * @param 48 | * @return 49 | */ 50 | public static T clone(final Object object, Class destclas){ 51 | if (object == null) { 52 | return null; 53 | } 54 | String json = JSON.toJSONString(object); 55 | return JSON.parseObject(json, destclas); 56 | } 57 | 58 | /** 59 | * 复制集合到指定类(深度拷贝) 60 | * @param object 61 | * @param destclas 指定类 62 | * @param 63 | * @return 64 | */ 65 | public static List cloneList(List object, Class destclas) { 66 | if (object == null) { 67 | return new ArrayList(); 68 | } 69 | String json = JSON.toJSONString(object); 70 | return JSON.parseArray(json, destclas); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/websocket/WebSocketServer.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.websocket; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.websocket.*; 7 | import javax.websocket.server.ServerEndpoint; 8 | import java.util.Map; 9 | import java.util.concurrent.ConcurrentHashMap; 10 | 11 | /** 12 | * @author: 开 13 | * @date: 2020-03-27 11:48:33 14 | * @describe: Websocket 服务端示例 15 | */ 16 | @Component 17 | @Slf4j 18 | @ServerEndpoint("/ws") 19 | public class WebSocketServer { 20 | 21 | /** 22 | * 存放所有在线的客户端 23 | */ 24 | private static Map clients = new ConcurrentHashMap<>(); 25 | 26 | @OnOpen 27 | public void onOpen(Session session) { 28 | log.info("有新的客户端连接了: {}", session.getId()); 29 | clients.put(session.getId(), session); 30 | } 31 | 32 | /** 33 | * 客户端关闭 34 | * @param session session 35 | */ 36 | @OnClose 37 | public void onClose(Session session) { 38 | log.info("有用户断开了, id为:{}", session.getId()); 39 | clients.remove(session.getId()); 40 | } 41 | 42 | /** 43 | * 发生错误 44 | * @param throwable e 45 | */ 46 | @OnError 47 | public void onError(Throwable throwable) { 48 | throwable.printStackTrace(); 49 | } 50 | 51 | /** 52 | * 收到客户端发来消息 53 | * @param message 消息对象 54 | */ 55 | @OnMessage 56 | public void onMessage(String message, Session session) { 57 | log.info("服务端收到客户端发来的消息: {}, id = {}", message, session.getId()); 58 | sendAll(message); 59 | } 60 | 61 | /** 62 | * 群发消息 63 | * @param message 消息内容 64 | */ 65 | private void sendAll(String message) { 66 | for (Map.Entry sessionEntry : clients.entrySet()) { 67 | sessionEntry.getValue().getAsyncRemote().sendText(message); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/MaterialCategoryPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.extension.activerecord.Model; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | import lombok.experimental.Accessors; 13 | 14 | import java.io.Serializable; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 20 | *

21 | * 22 | * @author xugongkai 23 | * @since 2020-04-19 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = false) 27 | @Accessors(chain = true) 28 | @TableName("t_material_category") 29 | @ApiModel(value="MaterialCategoryPO对象", description="") 30 | public class MaterialCategoryPO extends Model { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | @ApiModelProperty(value = "主键") 35 | @JsonSerialize(using = ToStringSerializer.class) 36 | private Long id; 37 | 38 | @ApiModelProperty(value = "物资分类编码") 39 | private String categoryCode; 40 | 41 | @ApiModelProperty(value = "物资分类名称") 42 | private String categoryName; 43 | 44 | @ApiModelProperty(value = "调配策略") 45 | private Boolean enable; 46 | 47 | @ApiModelProperty(value = "创建日期") 48 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 49 | private LocalDateTime createTime; 50 | 51 | @ApiModelProperty(value = "创建人ID") 52 | @JsonSerialize(using = ToStringSerializer.class) 53 | private Long createUserId; 54 | 55 | 56 | @Override 57 | protected Serializable pkVal() { 58 | return this.id; 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.stereotype.Component; 8 | import springfox.documentation.builders.ApiInfoBuilder; 9 | import springfox.documentation.builders.PathSelectors; 10 | import springfox.documentation.builders.RequestHandlerSelectors; 11 | import springfox.documentation.service.ApiInfo; 12 | import springfox.documentation.service.Contact; 13 | import springfox.documentation.spi.DocumentationType; 14 | import springfox.documentation.spring.web.plugins.Docket; 15 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 16 | 17 | /** 18 | * @author: xugongkai 19 | * @data: 2019-12-11 17:09:23 20 | * @describe: 文档配置 21 | **/ 22 | @Configuration 23 | @EnableSwagger2 24 | public class SwaggerConfig { 25 | 26 | @Value("${server.servlet.application-display-name}") 27 | private String applicationName; 28 | 29 | @Bean 30 | public Docket createRestApi() { 31 | return new Docket(DocumentationType.SWAGGER_2) 32 | .apiInfo(apiInfo()) 33 | .select() 34 | .apis(RequestHandlerSelectors.basePackage("com.bestbigkk.web")) 35 | .paths(PathSelectors.any()) 36 | .build(); 37 | } 38 | 39 | private ApiInfo apiInfo() { 40 | final ApiInfo build = new ApiInfoBuilder() 41 | .title(applicationName) 42 | .description("应急物资保障系统") 43 | .termsOfServiceUrl("http://localhost:21584/") 44 | .contact(new Contact("xugongkai", "bestbigkk.com", "xugongkai@banggood.com")) 45 | .version("1.0-SNAPSHOT") 46 | .build(); 47 | return build; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/OperationLogPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.extension.activerecord.Model; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.*; 11 | import lombok.experimental.Accessors; 12 | 13 | import java.io.Serializable; 14 | import java.time.LocalDateTime; 15 | 16 | /** 17 | *

18 | * 操作日志表 19 | *

20 | * 21 | * @author xugongkai 22 | * @since 2020-03-24 23 | */ 24 | @Builder 25 | @NoArgsConstructor 26 | @AllArgsConstructor 27 | @Data 28 | @EqualsAndHashCode(callSuper = false) 29 | @Accessors(chain = true) 30 | @TableName("t_operation_log") 31 | @ApiModel(value="OperationLogPO对象", description="操作日志表") 32 | public class OperationLogPO extends Model { 33 | 34 | private static final long serialVersionUID=1L; 35 | 36 | @ApiModelProperty(value = "主键") 37 | @JsonSerialize(using = ToStringSerializer.class) 38 | private Long id; 39 | 40 | @ApiModelProperty(value = "请求者IP") 41 | private String ip; 42 | 43 | @ApiModelProperty(value = "模块名称") 44 | private String modelName; 45 | 46 | @ApiModelProperty(value = "创建时间") 47 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 48 | private LocalDateTime createTime; 49 | 50 | @ApiModelProperty(value = "日志行为简述") 51 | private String logDescription; 52 | 53 | @ApiModelProperty(value = "携带参数") 54 | private String actionArgs; 55 | 56 | @ApiModelProperty(value = "日志产生地方【ClassName:methodName】") 57 | private String logLocation; 58 | 59 | @ApiModelProperty(value = "异常简述") 60 | private String errorMsg; 61 | 62 | @ApiModelProperty(value = "堆栈信息") 63 | private String stackInfo; 64 | 65 | @Override 66 | protected Serializable pkVal() { 67 | return this.id; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-service/src/main/java/com/bestbigkk/service/qiniu/impl/UploadServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.service.qiniu.impl; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.bestbigkk.common.config.oss.qiniu.QiniuConfig; 5 | import com.bestbigkk.service.qiniu.UploadService; 6 | import com.qiniu.common.QiniuException; 7 | import com.qiniu.common.Zone; 8 | import com.qiniu.http.Response; 9 | import com.qiniu.storage.Configuration; 10 | import com.qiniu.storage.UploadManager; 11 | import com.qiniu.storage.model.DefaultPutRet; 12 | import com.qiniu.util.Auth; 13 | import lombok.extern.slf4j.Slf4j; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.stereotype.Service; 16 | 17 | import java.io.InputStream; 18 | 19 | /** 20 | * @author: 开 21 | * @date: 2020-04-25 12:24:23 22 | * @describe: 七牛云上传实现 23 | */ 24 | @Slf4j 25 | @Service 26 | public class UploadServiceImpl implements UploadService { 27 | 28 | @Autowired 29 | private QiniuConfig qiniuProperties; 30 | 31 | @Override 32 | public String uploadFile(InputStream inputStream, String fileName) throws QiniuException { 33 | //构造一个带指定Zone对象的配置类 34 | Configuration cfg = new Configuration(Zone.zone0()); 35 | UploadManager uploadManager = new UploadManager(cfg); 36 | //默认不指定key的情况下,以文件内容的hash值作为文件名 37 | Auth auth = Auth.create(qiniuProperties.getAccessKey(), qiniuProperties.getSecretKey()); 38 | String upToken = auth.uploadToken(qiniuProperties.getBucket()); 39 | try { 40 | Response response = uploadManager.put(inputStream, fileName, upToken, null, null); 41 | //解析上传成功的结果 42 | DefaultPutRet putRet = JSON.parseObject(response.bodyString(), DefaultPutRet.class); 43 | String return_path = qiniuProperties.getPath()+"/"+putRet.key; 44 | log.info("七牛云上传地址:{}", return_path); 45 | return return_path; 46 | } catch (QiniuException ex) { 47 | log.error("上传错误", ex); 48 | } 49 | return ""; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/components/BaiDuMapTrace.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 62 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/UserPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.extension.activerecord.Model; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | import lombok.experimental.Accessors; 13 | 14 | import java.io.Serializable; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 20 | *

21 | * 22 | * @author xugongkai 23 | * @since 2020-04-19 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = false) 27 | @Accessors(chain = true) 28 | @TableName("t_user") 29 | @ApiModel(value="UserPO对象", description="") 30 | public class UserPO extends Model { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | @ApiModelProperty(value = "id") 35 | @JsonSerialize(using = ToStringSerializer.class) 36 | private Long id; 37 | 38 | @ApiModelProperty(value = "账户") 39 | private String account; 40 | 41 | @ApiModelProperty(value = "密码") 42 | private String password; 43 | 44 | @ApiModelProperty(value = "盐值") 45 | private String salt; 46 | 47 | @ApiModelProperty(value = "昵称") 48 | private String nickName; 49 | 50 | @ApiModelProperty(value = "性别") 51 | private String sex; 52 | 53 | @ApiModelProperty(value = "头像地址") 54 | private String picture; 55 | 56 | @ApiModelProperty(value = "地址") 57 | private String address; 58 | 59 | @ApiModelProperty(value = "身份编码") 60 | private Integer identityCode; 61 | 62 | @ApiModelProperty(value = "身份名称") 63 | private String identityName; 64 | 65 | @ApiModelProperty(value = "创建时间") 66 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 67 | private LocalDateTime createTime; 68 | 69 | @ApiModelProperty(value = "账户是否启用") 70 | private Integer enable; 71 | 72 | 73 | @Override 74 | protected Serializable pkVal() { 75 | return this.id; 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/QueryWrapperUtils.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableId; 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 6 | import org.springframework.stereotype.Component; 7 | 8 | import java.lang.reflect.Field; 9 | import java.util.Arrays; 10 | import java.util.HashSet; 11 | 12 | /** 13 | * @author: 开 14 | * @date: 2020-04-19 19:16:29 15 | * @describe: mybatis-plus query wrapper 条件构造器工具 16 | */ 17 | 18 | @Component 19 | public class QueryWrapperUtils { 20 | 21 | /** 22 | * 传递一个对象,将该对象中所有非空(null)的属性构建为一个querywrapper查询器的条件。 23 | * @param t 对象 24 | * @param ignorePropertiesName 忽略的属性,这些属性不会进入构建为条件 25 | * @param 构件好的条件查询器。 26 | */ 27 | public QueryWrapper buildNotNullEqualsWrapper(T t, String...ignorePropertiesName){ 28 | QueryWrapper wrapper = new QueryWrapper<>(); 29 | HashSet ignore = new HashSet<>(Arrays.asList(ignorePropertiesName)); 30 | for (Field field : t.getClass().getDeclaredFields()) { 31 | field.setAccessible(true); 32 | final String filedName = field.getName(); 33 | if ("serialVersionUID".equals(filedName) || ignore.contains(filedName)) { 34 | continue; 35 | } 36 | try { 37 | if(field.get(t) == null){ 38 | continue; 39 | } 40 | TableId tableId = field.getAnnotation(TableId.class); 41 | if (tableId != null){ 42 | wrapper.eq(tableId.value(),field.get(t)); 43 | continue; 44 | } 45 | TableField tableField = field.getAnnotation(TableField.class); 46 | if(tableField != null && tableField.exist()){ 47 | wrapper.eq(tableField.value(),field.get(t)); 48 | continue; 49 | } 50 | wrapper.eq(filedName.replaceAll("[A-Z]", "_$0").toLowerCase(),field.get(t)); 51 | } catch (IllegalAccessException e) { 52 | e.printStackTrace(); 53 | } 54 | } 55 | return wrapper; 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/MaterialPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.extension.activerecord.Model; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | import lombok.experimental.Accessors; 13 | 14 | import java.io.Serializable; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 20 | *

21 | * 22 | * @author xugongkai 23 | * @since 2020-04-19 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = false) 27 | @Accessors(chain = true) 28 | @TableName("t_material") 29 | @ApiModel(value="MaterialPO对象", description="") 30 | public class MaterialPO extends Model { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | @ApiModelProperty(value = "主键") 35 | @JsonSerialize(using = ToStringSerializer.class) 36 | private Long id; 37 | 38 | @ApiModelProperty(value = "物资批次") 39 | private String materialBatchNo; 40 | 41 | @ApiModelProperty(value = "物资名称") 42 | private String materialName; 43 | 44 | @ApiModelProperty(value = "分类名称") 45 | private String materialCategoryCode; 46 | 47 | @ApiModelProperty(value = "库存数量") 48 | private Integer materialNum; 49 | 50 | @ApiModelProperty(value = "购进来源") 51 | private String materialFrom; 52 | 53 | @ApiModelProperty(value = "被购方联系人") 54 | private String materialContactName; 55 | 56 | @ApiModelProperty(value = "被购方联系方式") 57 | private String materialContactNo; 58 | 59 | @ApiModelProperty(value = "购入合同编号") 60 | private String materialContractNo; 61 | 62 | @ApiModelProperty(value = "调配策略") 63 | private Boolean materialEnable; 64 | 65 | @ApiModelProperty(value = "创建日期") 66 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") 67 | private LocalDateTime createTime; 68 | 69 | 70 | @Override 71 | protected Serializable pkVal() { 72 | return this.id; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/aspect/impl/AccessLimitAspect.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.aspect.impl; 2 | 3 | import com.bestbigkk.common.utils.RequestContextHolderUtils; 4 | import com.bestbigkk.common.aspect.AbstractAspect; 5 | import com.bestbigkk.common.exception.BusinessException; 6 | import com.bestbigkk.common.web.ResultCode; 7 | import com.bestbigkk.web.validator.AccessLimit; 8 | import com.google.common.collect.Maps; 9 | import com.google.common.util.concurrent.RateLimiter; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.aspectj.lang.JoinPoint; 12 | import org.springframework.stereotype.Component; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.lang.reflect.Method; 16 | import java.util.Map; 17 | 18 | /** 19 | * @author: 开 20 | * @date: 2020-03-24 15:04:07 21 | * @describe: 限流切面, 借助Guava中的令牌桶,进行实现。限制各个url的访问速率 22 | */ 23 | @Slf4j 24 | @Component 25 | public class AccessLimitAspect extends AbstractAspect { 26 | 27 | /**使用url做为key,存放令牌桶 防止每次重新创建令牌桶*/ 28 | private static final Map limitMap = Maps.newConcurrentMap(); 29 | 30 | @Override 31 | public Object doHandlerAspect(JoinPoint joinPoint, Method method, Throwable throwable)throws Throwable { 32 | execute(joinPoint,method, throwable); 33 | return null; 34 | } 35 | 36 | @Override 37 | public Object execute(JoinPoint pjp, Method method, Throwable throwable) { 38 | 39 | log.info("尝试从令牌桶获取令牌"); 40 | 41 | AccessLimit lxRateLimit = method.getAnnotation(AccessLimit.class); 42 | final HttpServletRequest request = RequestContextHolderUtils.getRequest(); 43 | 44 | // 或者url(存在map集合的key) 45 | String url = request.getRequestURI(); 46 | RateLimiter rateLimiter; 47 | if (!limitMap.containsKey(url)) { 48 | // 为这个Url创建令牌桶 49 | rateLimiter = RateLimiter.create(lxRateLimit.perSecond()); 50 | limitMap.put(url, rateLimiter); 51 | log.info("为请求{},创建令牌桶,容量{}",url,lxRateLimit.perSecond()); 52 | } 53 | rateLimiter = limitMap.get(url); 54 | 55 | //获取令牌 56 | if (!rateLimiter.tryAcquire(lxRateLimit.timeOut(), lxRateLimit.timeOutUnit())) { 57 | throw new BusinessException(ResultCode.SERVER_BUSY, ""); 58 | } 59 | return null; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/aspect/impl/LogRecordPersistence.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.aspect.impl; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.bestbigkk.common.utils.RedisUtils; 5 | import com.bestbigkk.persistence.dao.OperationLogDao; 6 | import com.bestbigkk.persistence.entity.OperationLogPO; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.scheduling.annotation.Async; 11 | import org.springframework.stereotype.Component; 12 | 13 | import javax.annotation.PostConstruct; 14 | import java.util.LinkedList; 15 | import java.util.List; 16 | 17 | /** 18 | * @author: 开 19 | * @date: 2020-03-24 21:40:34 20 | * @describe: 日志对象持久化异步类,异步操作需要独立出来一个类才可以。 21 | */ 22 | @Component 23 | @Slf4j 24 | public class LogRecordPersistence{ 25 | 26 | /**缓存在Redis中的待持久化日志对象数量。*/ 27 | @Value("${bbk.log.cache:200L}") 28 | public Long CACHE_LENGTH; 29 | public final String REDIS_KEY = "operation:log:list:cache"; 30 | 31 | private final RedisUtils redisUtils; 32 | private final OperationLogDao operationLogDao; 33 | 34 | public LogRecordPersistence(RedisUtils redisUtils, OperationLogDao operationLogDao) { 35 | this.redisUtils = redisUtils; 36 | this.operationLogDao = operationLogDao; 37 | } 38 | 39 | @PostConstruct 40 | void init() { 41 | log.info("方法执行日志缓存数量:{}", CACHE_LENGTH); 42 | } 43 | 44 | boolean add(OperationLogPO operationLogPO) { 45 | final long size = redisUtils.lGetListSize(REDIS_KEY); 46 | if (size >= CACHE_LENGTH) { 47 | return false; 48 | } 49 | return redisUtils.lSet(REDIS_KEY, JSONObject.toJSONString(operationLogPO)); 50 | } 51 | 52 | @Async 53 | public void persistence(OperationLogPO operationLogPO) { 54 | final List objects = redisUtils.lGet(REDIS_KEY, 0, -1); 55 | redisUtils.del(REDIS_KEY); 56 | final List res = new LinkedList<>(); 57 | res.add(operationLogPO); 58 | objects.forEach(o -> res.add(JSONObject.parseObject(o + "", OperationLogPO.class))); 59 | res.forEach(operationLogDao::insert); 60 | log.info("批量持久化到数据库完成,size = {}", res.size()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/axios/request.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import Vue from 'vue'; 3 | import qs from "qs"; 4 | import { Loading } from 'element-ui'; 5 | 6 | const apiBaseURL = "http://localhost:21584/dev"; 7 | const apiTimeOut = 5000; 8 | 9 | const service = axios.create({ 10 | baseURL: apiBaseURL, 11 | timeout: apiTimeOut 12 | }); 13 | 14 | const rawService = axios.create({ 15 | baseURL: apiBaseURL, 16 | timeout: apiTimeOut, 17 | headers: {'Content-Type': 'multipart/form-data'} 18 | }); 19 | 20 | 21 | let loadingIns = undefined; 22 | const loading = { 23 | lock: true, 24 | text: '请求中...', 25 | spinner: 'el-icon-loading', 26 | background: 'rgba(0, 0, 0, 0.7)' 27 | }; 28 | 29 | //请求拦截器 30 | service.interceptors.request.use(config => { 31 | loadingIns = Loading.service(loading); 32 | axios.defaults.headers['Content-Type'] = 'application/x-www-form-urlencoded'; 33 | config.method === 'post' ? config.data = qs.stringify({...config.data}) : config.params = {...config.params}; 34 | return config; 35 | }, errorHandler 36 | ); 37 | 38 | //响应拦截器 39 | rawService.interceptors.response.use( 40 | response => { 41 | if (loadingIns !== undefined) { 42 | loadingIns.close(); 43 | } 44 | const res = response.data; 45 | if (!res.status) { 46 | Vue.prototype.$alert(res.data, "哇哦", {type:'info', center:true}); 47 | } 48 | console.log("响应:"); 49 | console.log(res); 50 | return res; 51 | },errorHandler 52 | ); 53 | 54 | //响应拦截器 55 | service.interceptors.response.use( 56 | response => { 57 | loadingIns.close(); 58 | const res = response.data; 59 | if (!res.status) { 60 | Vue.prototype.$alert(res.data, "哇哦", {type:'info', center:true}); 61 | } 62 | console.log("响应:"); 63 | console.log(res); 64 | return res; 65 | },errorHandler 66 | ); 67 | 68 | function errorHandler(error) { 69 | loadingIns.close(); 70 | const res = error.response.data; 71 | Vue.prototype.$message({ 72 | showClose: true, 73 | message: '错误, 请求未正常完成:'+res.msg+',可打开控制台查看详情(F12) ', 74 | type: 'error', 75 | duration:4000 76 | }); 77 | console.log(JSON.stringify(res.data)); 78 | return Promise.reject(error) 79 | } 80 | 81 | export default {rawService, service}; -------------------------------------------------------------------------------- /bbk-mss-vue/src/page/Login.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 49 | 50 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/shiro/authc/MyJwtRealm.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config.shiro.authc; 2 | 3 | import io.jsonwebtoken.Claims; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.apache.shiro.authz.AuthorizationInfo; 6 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 7 | import org.springframework.stereotype.Component; 8 | 9 | import javax.servlet.ServletRequest; 10 | import java.util.HashSet; 11 | import java.util.Set; 12 | 13 | /** 14 | * @author: 开 15 | * @date: 2020-03-26 18:05:36 16 | * @describe: 示例Realm实现 17 | */ 18 | @Component 19 | @Slf4j 20 | public class MyJwtRealm extends BaseJwtRealm { 21 | 22 | private static final Set TOM_ROLE_NAME_SET = new HashSet<>(); 23 | private static final Set TOM_PERMISSION_NAME_SET = new HashSet<>(); 24 | private static final Set JERRY_ROLE_NAME_SET = new HashSet<>(); 25 | private static final Set JERRY_PERMISSION_NAME_SET = new HashSet<>(); 26 | 27 | static { 28 | TOM_ROLE_NAME_SET.add("admin"); 29 | TOM_PERMISSION_NAME_SET.add("insert"); 30 | TOM_PERMISSION_NAME_SET.add("update"); 31 | TOM_PERMISSION_NAME_SET.add("delete"); 32 | TOM_PERMISSION_NAME_SET.add("query"); 33 | 34 | JERRY_ROLE_NAME_SET.add("user"); 35 | JERRY_PERMISSION_NAME_SET.add("query"); 36 | } 37 | 38 | @Override 39 | protected AuthorizationInfo verifyPermissionAndRolesIsValid(String jwt) { 40 | log.info("自定义校验权限:{}", jwt); 41 | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); 42 | 43 | //解析Token中的信息。 44 | final Claims decode = jwtUtils.decode(jwt); 45 | final String username = (String)decode.get("username"); 46 | 47 | if ("tom".equals(username)) { 48 | info.addRoles(TOM_ROLE_NAME_SET); 49 | info.addStringPermissions(TOM_PERMISSION_NAME_SET); 50 | } else if ("jerry".equals(username)) { 51 | info.addRoles(JERRY_ROLE_NAME_SET); 52 | info.addStringPermissions(JERRY_PERMISSION_NAME_SET); 53 | } 54 | 55 | return info; 56 | } 57 | 58 | @Override 59 | protected boolean verifyIdentityIsValid(String jwt, ServletRequest request) { 60 | log.info("自定义验证身份:{}", jwt); 61 | try { 62 | return !jwtUtils.isExpired(jwt); 63 | } catch (Exception e) { 64 | return false; 65 | } 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/ApprovalPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.extension.activerecord.Model; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | import lombok.experimental.Accessors; 13 | 14 | import java.io.Serializable; 15 | import java.time.LocalDateTime; 16 | 17 | /** 18 | *

19 | * 20 | *

21 | * 22 | * @author xugongkai 23 | * @since 2020-04-20 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = false) 27 | @Accessors(chain = true) 28 | @TableName("t_approval") 29 | @ApiModel(value="ApprovalPO对象", description="") 30 | public class ApprovalPO extends Model { 31 | 32 | private static final long serialVersionUID = 1L; 33 | 34 | @ApiModelProperty(value = "主键") 35 | @JsonSerialize(using = ToStringSerializer.class) 36 | private Long id; 37 | 38 | @ApiModelProperty(value = "审批标题") 39 | private String title; 40 | 41 | @ApiModelProperty(value = "审批主体内容") 42 | private String content; 43 | 44 | @ApiModelProperty(value = "创建时间") 45 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") 46 | private LocalDateTime createTime; 47 | 48 | @ApiModelProperty(value = "最近一次更新时间") 49 | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm") 50 | private LocalDateTime lastUpdateTime; 51 | 52 | @ApiModelProperty(value = "审批优先级[低,中,高,紧急]") 53 | private String level; 54 | 55 | @ApiModelProperty(value = "审批当前状态[待审核,待配送,配送中,已完结]") 56 | private String status; 57 | 58 | @ApiModelProperty(value = "关联审批人ID") 59 | private Long approvalUserId; 60 | 61 | @ApiModelProperty(value = "物资申请信息:物资ID#数量@物资ID#数量") 62 | private String materialApply; 63 | 64 | @ApiModelProperty(value = "创建人ID") 65 | @JsonSerialize(using = ToStringSerializer.class) 66 | private Long createUserId; 67 | 68 | @ApiModelProperty(value = "关联应急事件ID") 69 | @JsonSerialize(using = ToStringSerializer.class) 70 | private Long eventId; 71 | 72 | 73 | 74 | @Override 75 | protected Serializable pkVal() { 76 | return this.id; 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-persistence/src/main/java/com/bestbigkk/persistence/entity/TransportPO.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.persistence.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.baomidou.mybatisplus.extension.activerecord.Model; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 8 | import io.swagger.annotations.ApiModel; 9 | import io.swagger.annotations.ApiModelProperty; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | import lombok.experimental.Accessors; 13 | import org.springframework.format.annotation.DateTimeFormat; 14 | 15 | import java.io.Serializable; 16 | import java.time.LocalDateTime; 17 | 18 | /** 19 | *

20 | * 21 | *

22 | * 23 | * @author xugongkai 24 | * @since 2020-04-20 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = false) 28 | @Accessors(chain = true) 29 | @TableName("t_transport") 30 | @ApiModel(value="TransportPO对象", description="") 31 | public class TransportPO extends Model { 32 | 33 | private static final long serialVersionUID = 1L; 34 | 35 | @ApiModelProperty(value = "主键") 36 | @JsonSerialize(using = ToStringSerializer.class) 37 | private Long id; 38 | 39 | @ApiModelProperty(value = "关联审批ID") 40 | @JsonSerialize(using = ToStringSerializer.class) 41 | private Long approvalId; 42 | 43 | @ApiModelProperty(value = "创建时间") 44 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") 45 | @JsonFormat(pattern = "yyyy-MM-dd") 46 | private LocalDateTime createTime; 47 | 48 | @ApiModelProperty(value = "预期完成时间") 49 | @JsonFormat(pattern = "yyyy-MM-dd") 50 | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") 51 | private LocalDateTime expectTime; 52 | 53 | @ApiModelProperty(value = "创建人") 54 | private Long createUserId; 55 | 56 | @ApiModelProperty(value = "运输状态详情,存储格式:时间#地点@时间#地点") 57 | private String transportRecord; 58 | 59 | @ApiModelProperty(value = "运送物资列表,存储格式:物资ID#数量@物资ID#数量") 60 | private String materialRecord; 61 | 62 | @ApiModelProperty(value = "运送状态:配送中,已接收") 63 | private String status; 64 | 65 | @ApiModelProperty(value = "接收人信息") 66 | private Long receiverUserId; 67 | 68 | @ApiModelProperty(value = "运输方式") 69 | private String transportType; 70 | 71 | 72 | @Override 73 | protected Serializable pkVal() { 74 | return this.id; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/response/handler/ResponseWrapper.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.response.handler; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.bestbigkk.web.response.RWrapper; 5 | import com.bestbigkk.web.response.Tips; 6 | import com.bestbigkk.web.response.annotation.RW; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.core.MethodParameter; 9 | import org.springframework.http.MediaType; 10 | import org.springframework.http.converter.StringHttpMessageConverter; 11 | import org.springframework.http.server.ServerHttpRequest; 12 | import org.springframework.http.server.ServerHttpResponse; 13 | import org.springframework.web.bind.annotation.ControllerAdvice; 14 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; 15 | 16 | import java.util.Objects; 17 | 18 | /** 19 | * @author: 开 20 | * @date: 2020-01-18 17:29:30 21 | * @describe: 对直接响应的数据进行包装 22 | */ 23 | @Slf4j 24 | @ControllerAdvice(annotations = RW.class) 25 | public class ResponseWrapper implements ResponseBodyAdvice { 26 | 27 | private static final String TARGET_FORMAT = "application/json;charset=UTF-8"; 28 | 29 | @Override 30 | public boolean supports(MethodParameter returnType, Class converterType) { 31 | log.info("returnType: [{}]", returnType); 32 | log.info("converterType: [{}]", converterType); 33 | return true; 34 | } 35 | 36 | @Override 37 | public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) { 38 | 39 | // Content-Type不为@RW中指定的produces,不进行包装 40 | if(!TARGET_FORMAT.equals(selectedContentType.toString())){ 41 | return body; 42 | } 43 | 44 | /* 45 | 如果响应的为String类型数据,直接包装为Wrapper对象返回会出现转换异常 String can not cast to Wrapper... 46 | 所以直接转换为Json字符串。 47 | */ 48 | boolean toJsonString = selectedConverterType.equals(StringHttpMessageConverter.class); 49 | 50 | // 如果响应已经是统一响应体,则直接返回body 51 | if(body instanceof RWrapper){ 52 | return body; 53 | } 54 | 55 | // 只有正常返回的结果才会进入这个判断流程,所以返回正常成功的状态码 56 | final RWrapper success = RWrapper.success(body); 57 | final String s = Tips.getAndRemove(); 58 | if (Objects.nonNull(s)) { 59 | success.setMsg(s); 60 | } 61 | return toJsonString ? JSONObject.toJSONString(success) : success; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/aspect/AspectCenter.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.aspect; 2 | 3 | import com.bestbigkk.web.aspect.impl.AccessLimitAspect; 4 | import com.bestbigkk.web.aspect.impl.LogRecordAspect; 5 | import com.bestbigkk.web.validator.AccessLimit; 6 | import com.bestbigkk.web.validator.LogRecord; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.aspectj.lang.JoinPoint; 9 | import org.aspectj.lang.ProceedingJoinPoint; 10 | import org.aspectj.lang.annotation.AfterThrowing; 11 | import org.aspectj.lang.annotation.Around; 12 | import org.aspectj.lang.annotation.Aspect; 13 | import org.aspectj.lang.annotation.Pointcut; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.context.annotation.Configuration; 16 | 17 | import java.lang.reflect.Method; 18 | 19 | /** 20 | * 切面:防止xss攻击 记录log 参数验证 21 | * @author liugh 22 | * @since 2018-05-03 23 | */ 24 | @Aspect 25 | @Configuration 26 | @Slf4j 27 | public class AspectCenter { 28 | 29 | @Autowired 30 | private AccessLimitAspect accessLimitAspect; 31 | @Autowired 32 | private LogRecordAspect logRecordAspect; 33 | 34 | @Pointcut("execution(* com.bestbigkk.web.controller..*(..)) ") 35 | public void aspect() { } 36 | 37 | @Around(value = "aspect()") 38 | public Object validationPoint(ProceedingJoinPoint pjp)throws Throwable{ 39 | 40 | Method method = currentMethod(pjp,pjp.getSignature().getName()); 41 | 42 | //是否需要限流 43 | if (method.isAnnotationPresent(AccessLimit.class)) { 44 | accessLimitAspect.doHandlerAspect(pjp, method, null); 45 | } 46 | 47 | return pjp.proceed(pjp.getArgs()); 48 | } 49 | 50 | @AfterThrowing(value = "aspect()", throwing = "e") 51 | public Object afterThrowing(JoinPoint joinPoint, Throwable e) throws Throwable { 52 | Method method = currentMethod(joinPoint, joinPoint.getSignature().getName()); 53 | 54 | //是否需要记录日志 55 | if (method.isAnnotationPresent(LogRecord.class)) { 56 | logRecordAspect.doHandlerAspect(joinPoint, method, e); 57 | } 58 | 59 | return null; 60 | } 61 | 62 | 63 | /** 64 | * 获取目标类的所有方法,找到当前要执行的方法 65 | */ 66 | private Method currentMethod (JoinPoint joinPoint , String methodName ) { 67 | Method[] methods = joinPoint.getTarget().getClass().getMethods(); 68 | Method resultMethod = null; 69 | for ( Method method : methods ) { 70 | if ( method.getName().equals( methodName ) ) { 71 | resultMethod = method; 72 | break; 73 | } 74 | } 75 | return resultMethod; 76 | } 77 | 78 | 79 | } 80 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/encryption/AESUtils.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils.encryption; 2 | 3 | import lombok.SneakyThrows; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.stereotype.Component; 7 | 8 | import javax.annotation.PostConstruct; 9 | import javax.crypto.Cipher; 10 | import javax.crypto.KeyGenerator; 11 | import javax.crypto.spec.SecretKeySpec; 12 | import java.io.UnsupportedEncodingException; 13 | import java.nio.charset.StandardCharsets; 14 | import java.security.Key; 15 | import java.security.NoSuchAlgorithmException; 16 | import java.util.Base64; 17 | 18 | /** 19 | * @author: 开 20 | * @date: 2020-03-27 14:28:58 21 | * @describe: AES工具 22 | */ 23 | @Component 24 | @Slf4j 25 | public class AESUtils { 26 | 27 | private static KeyGenerator keyGen; 28 | private static Cipher cipher; 29 | private static final String algorithmStr = "AES/ECB/PKCS5Padding"; 30 | 31 | @Value("${bbk.encryption.aesSecretKey:XUGONGKAI980827}") 32 | private String keyStr; 33 | 34 | @SneakyThrows 35 | @PostConstruct 36 | void init() { 37 | log.info("AES工具类密匙:{}", keyStr); 38 | keyGen = KeyGenerator.getInstance("AES"); 39 | keyGen.init(128); 40 | cipher = Cipher.getInstance(algorithmStr); 41 | } 42 | 43 | /** 44 | * 加密方法. 45 | */ 46 | public String encrypt(String content) { 47 | byte[] encryptedBytes = null; 48 | Key key = new SecretKeySpec(keyStr.getBytes(), "AES"); 49 | try { 50 | cipher.init(Cipher.ENCRYPT_MODE, key); 51 | encryptedBytes = cipher.doFinal(stringToBytes(content)); 52 | return bytesToString(Base64.getEncoder().encode(encryptedBytes)); 53 | } catch (Exception e) { 54 | e.printStackTrace(); 55 | log.error("加密出错", e); 56 | return null; 57 | } 58 | } 59 | 60 | /** 61 | * 解密方法. 62 | */ 63 | public String decrypt(String content) { 64 | byte[] originBytes; 65 | 66 | Key key = new SecretKeySpec(keyStr.getBytes(), "AES"); 67 | try { 68 | cipher.init(Cipher.DECRYPT_MODE, key); 69 | originBytes = cipher.doFinal(Base64.getDecoder().decode(content)); 70 | return bytesToString(originBytes); 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | log.error("解密出错", e); 74 | return null; 75 | } 76 | } 77 | 78 | private byte[] stringToBytes(String str) { 79 | return str.getBytes(); 80 | } 81 | 82 | private String bytesToString(byte[] bytes) { 83 | return new String(bytes, StandardCharsets.UTF_8); 84 | } 85 | } -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/controller/VerifyController.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.controller; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.bestbigkk.common.exception.BusinessException; 6 | import com.bestbigkk.common.utils.JwtUtils; 7 | import com.bestbigkk.persistence.entity.UserPO; 8 | import com.bestbigkk.service.IUserService; 9 | import com.bestbigkk.web.response.annotation.RW; 10 | import io.swagger.annotations.Api; 11 | import io.swagger.annotations.ApiOperation; 12 | import lombok.AllArgsConstructor; 13 | import lombok.Data; 14 | import org.apache.commons.beanutils.BeanMap; 15 | import org.apache.commons.beanutils.BeanUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.web.bind.annotation.GetMapping; 18 | import org.springframework.web.bind.annotation.PostMapping; 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | 21 | import java.lang.reflect.InvocationTargetException; 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | import java.util.Objects; 25 | import java.util.concurrent.TimeUnit; 26 | 27 | /** 28 | * @author: 开 29 | * @date: 2020-04-19 18:57:11 30 | * @describe: 用户控制器 31 | */ 32 | @RW 33 | @Api(tags = "验证接口") 34 | @RequestMapping(value = "/dev/verify", produces = {"application/json;charset=UTF-8"}) 35 | public class VerifyController { 36 | 37 | @Autowired 38 | private JwtUtils jwtUtils; 39 | @Autowired 40 | private IUserService userService; 41 | 42 | @PostMapping("/login") 43 | @ApiOperation(value = "登录操作") 44 | public R login(UserPO user) throws InterruptedException { 45 | final String account = user.getAccount(); 46 | final String password = user.getPassword(); 47 | if (Objects.isNull(account) || Objects.isNull(password)) { 48 | throw new BusinessException("用户名或密码错误"); 49 | } 50 | final UserPO target = userService.getOne(new QueryWrapper().lambda().eq(UserPO::getAccount, account).eq(UserPO::getPassword, password)); 51 | if (Objects.isNull(target)) { 52 | throw new BusinessException("用户名或密码错误"); 53 | } 54 | Map userMap = new HashMap<>(); 55 | try { 56 | Map map = BeanUtils.describe(target); 57 | map.forEach(userMap::put); 58 | } catch (Exception e) { 59 | throw new BusinessException("登陆失败,Bean转化失败"); 60 | } 61 | return new R(jwtUtils.encode("xugongkai", userMap), JSON.toJSONString(target).replaceAll("\"", "'")); 62 | } 63 | } 64 | 65 | @Data 66 | @AllArgsConstructor 67 | class R{ 68 | private String token; 69 | private String userJson; 70 | } 71 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/components/material/catyegory/NewMaterialCatrgory.vue: -------------------------------------------------------------------------------- 1 | 26 | 75 | 77 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/page/Main.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 68 | 69 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/controller.java.ftl: -------------------------------------------------------------------------------- 1 | package ${package.Controller}; 2 | 3 | import com.dacheng.info.bim.business.base.common.JsonBean; 4 | import com.dacheng.info.bim.business.base.common.ResultCode; 5 | import io.swagger.annotations.ApiImplicitParam; 6 | import io.swagger.annotations.ApiImplicitParams; 7 | import org.springframework.web.bind.annotation.*; 8 | import ${package.Service}.${table.serviceName}; 9 | import ${package.Entity}.${entity}; 10 | import io.swagger.annotations.Api; 11 | import io.swagger.annotations.ApiOperation; 12 | import org.slf4j.Logger; 13 | import org.slf4j.LoggerFactory; 14 | import java.util.Objects; 15 | 16 | import javax.annotation.Resource; 17 | <#if restControllerStyle> 18 | import org.springframework.web.bind.annotation.RestController; 19 | <#else> 20 | import org.springframework.stereotype.Controller; 21 | 22 | <#if superControllerClassPackage??> 23 | import ${superControllerClassPackage}; 24 | 25 | 26 | /** 27 | * ${table.comment!} 前端控制器 28 | * 29 | * @author ${author} 30 | * @data ${date} 31 | * @describe: 32 | */ 33 | <#if restControllerStyle> 34 | @Api(tags = {"${table.comment!}API接口"}) 35 | @RestController 36 | <#else> 37 | @Controller 38 | @Sl4j 39 | @RequestMapping("<#if package.ModuleName??>/${package.ModuleName}/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}") 40 | <#if kotlin>class ${table.controllerName}<#if superControllerClass??>:${superControllerClass}()<#else><#if superControllerClass??>public class ${table.controllerName} extends ${superControllerClass}{<#else>public class ${table.controllerName} { 41 | 42 | @Resource 43 | private ${table.serviceName} ${(table.serviceName?substring(1))?uncap_first}; 44 | 45 | @ApiOperation(value = "新增一个对象") 46 | @PostMapping 47 | public ${entity} add( ${entity} ${entity?uncap_first}){ 48 | return null; 49 | } 50 | 51 | @ApiOperation(value = "删除数据") 52 | @DeleteMapping("{id}") 53 | public Boolean delete(@RequestParam("id") Long id){ 54 | if(Objects.isNull(id)){ 55 | throw new BusinessException("必须提供要删除对象的ID"); 56 | } 57 | return null; 58 | } 59 | 60 | @ApiOperation(value = "更新数据") 61 | @PutMapping() 62 | public ${entity} updateById( ${entity} ${entity?uncap_first}){ 63 | if(Objects.isNull(${entity?uncap_first})){ 64 | throw new BusinessException("必须提供要更新对象的ID"); 65 | } 66 | return null; 67 | } 68 | 69 | @ApiOperation(value = "查询单一对象") 70 | @GetMapping(value="/{id}") 71 | public ${entity} findById(@PathVariable("id") Long id ){ 72 | return null; 73 | } 74 | 75 | @ApiOperation(value = "查询多个对象") 76 | @GetMapping(value="/list") 77 | public ListResponse<${entity}> findListByPagination(${entity} ${entity?uncap_first}, Pagination<${entity}}> pagination){ 78 | return null; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-common/src/main/java/com/bestbigkk/common/utils/JwtUtils.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.common.utils; 2 | 3 | 4 | import java.util.*; 5 | import com.auth0.jwt.*; 6 | import com.auth0.jwt.algorithms.Algorithm; 7 | import io.jsonwebtoken.*; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * @author: 开 12 | * @date: 2020-03-25 18:00:55 13 | * @describe: Jwt 14 | */ 15 | @Component 16 | public class JwtUtils { 17 | 18 | /** 生成签名是所使用的秘钥*/ 19 | private final String encodedSecretKey = "123qwer"; 20 | 21 | /** 22 | * 令牌有效期(s) 23 | */ 24 | private Long expireSeconds = 7200L; 25 | 26 | /**生成签名的时候所使用的加密算法*/ 27 | private final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; 28 | 29 | 30 | /** 31 | * 生成 JWT Token 字符串 32 | * 33 | * @param issue 签发人名称 34 | * @param claims 额外添加到荷部分的信息。 35 | * 例如可以添加用户名、用户ID、用户(加密前的)密码等信息 36 | */ 37 | public String encode(String issue, Map claims) { 38 | if (claims == null) { 39 | claims = new HashMap<>(2); 40 | } 41 | // 签发时间(iat):荷载部分的标准字段之一 42 | Long now = System.currentTimeMillis(); 43 | claims.put("iat", now); 44 | claims.put("exp", new Date(now + (expireSeconds = expireSeconds == null ? 3600L : expireSeconds) * 1000).getTime()); 45 | 46 | // 下面就是在为payload添加各种标准声明和私有声明了 47 | JwtBuilder builder = Jwts.builder() 48 | // 荷载部分的非标准字段/附加字段,一般写在标准的字段之前。 49 | .setClaims(claims) 50 | // JWT ID(jti):荷载部分的标准字段之一,JWT 的唯一性标识,虽不强求,但尽量确保其唯一性。 51 | .setId(UUID.randomUUID().toString()) 52 | // 签发人(issue):荷载部分的标准字段之一,代表这个 JWT 的所有者。通常是 username、userid 这样具有用户代表性的内容。 53 | .setSubject(issue) 54 | // 设置生成签名的算法和秘钥 55 | .signWith(signatureAlgorithm, encodedSecretKey); 56 | 57 | return builder.compact(); 58 | } 59 | 60 | 61 | /** 62 | * JWT Token 由 头部 荷载部 和 签名部 三部分组成。签名部分是由加密算法生成,无法反向解密。 63 | * 而 头部 和 荷载部分是由 Base64 编码算法生成,是可以反向反编码回原样的。 64 | * 这也是为什么不要在 JWT Token 中放敏感数据的原因。 65 | * 66 | * @param jwtToken 加密后的token 67 | * @return claims 返回荷载部分的键值对 68 | */ 69 | public Claims decode(String jwtToken) { 70 | 71 | // 得到 DefaultJwtParser 72 | return Jwts.parser() 73 | // 设置签名的秘钥 74 | .setSigningKey(encodedSecretKey) 75 | // 设置需要解析的 jwt 76 | .parseClaimsJws(jwtToken) 77 | .getBody(); 78 | } 79 | 80 | /** 81 | * 判断一个token是否过期 82 | * @param jwtToken 83 | * @return 84 | */ 85 | public boolean isExpired(String jwtToken) { 86 | try { 87 | final Claims decode = decode(jwtToken); 88 | long exp = (long) decode.get("exp"); 89 | return System.currentTimeMillis() > exp; 90 | } catch (Exception e) { 91 | return true; 92 | } 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/entity.kt.vm: -------------------------------------------------------------------------------- 1 | package ${package.Entity}; 2 | 3 | #foreach($pkg in ${table.importPackages}) 4 | import ${pkg}; 5 | #end 6 | #if(${swagger2}) 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | #end 10 | /** 11 | *

12 | * $!{table.comment} 13 | *

14 | * 15 | * @author ${author} 16 | * @since ${date} 17 | */ 18 | #if(${table.convert}) 19 | @TableName("${table.name}") 20 | #end 21 | #if(${swagger2}) 22 | @ApiModel(value="${entity}对象", description="$!{table.comment}") 23 | #end 24 | #if(${superEntityClass}) 25 | class ${entity} : ${superEntityClass}#if(${activeRecord})<${entity}>#end() { 26 | #elseif(${activeRecord}) 27 | class ${entity} : Model<${entity}>() { 28 | #else 29 | class ${entity} : Serializable { 30 | #end 31 | 32 | ## ---------- BEGIN 字段循环遍历 ---------- 33 | #foreach($field in ${table.fields}) 34 | #if(${field.keyFlag}) 35 | #set($keyPropertyName=${field.propertyName}) 36 | #end 37 | #if("$!field.comment" != "") 38 | #if(${swagger2}) 39 | @ApiModelProperty(value = "${field.comment}") 40 | #else 41 | /** 42 | * ${field.comment} 43 | */ 44 | #end 45 | #end 46 | #if(${field.keyFlag}) 47 | ## 主键 48 | #if(${field.keyIdentityFlag}) 49 | @TableId(value = "${field.name}", type = IdType.AUTO) 50 | #elseif(!$null.isNull(${idType}) && "$!idType" != "") 51 | @TableId(value = "${field.name}", type = IdType.${idType}) 52 | #elseif(${field.convert}) 53 | @TableId("${field.name}") 54 | #end 55 | ## 普通字段 56 | #elseif(${field.fill}) 57 | ## ----- 存在字段填充设置 ----- 58 | #if(${field.convert}) 59 | @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) 60 | #else 61 | @TableField(fill = FieldFill.${field.fill}) 62 | #end 63 | #elseif(${field.convert}) 64 | @TableField("${field.name}") 65 | #end 66 | ## 乐观锁注解 67 | #if(${versionFieldName}==${field.name}) 68 | @Version 69 | #end 70 | ## 逻辑删除注解 71 | #if(${logicDeleteFieldName}==${field.name}) 72 | @TableLogic 73 | #end 74 | #if(${field.propertyType} == "Integer") 75 | var ${field.propertyName}: Int? = null 76 | #else 77 | var ${field.propertyName}: ${field.propertyType}? = null 78 | #end 79 | #end 80 | ## ---------- END 字段循环遍历 ---------- 81 | 82 | 83 | #if(${entityColumnConstant}) 84 | companion object { 85 | #foreach($field in ${table.fields}) 86 | 87 | const val ${field.name.toUpperCase()} : String = "${field.name}" 88 | 89 | #end 90 | } 91 | 92 | #end 93 | #if(${activeRecord}) 94 | override fun pkVal(): Serializable? { 95 | #if(${keyPropertyName}) 96 | return ${keyPropertyName} 97 | #else 98 | return null 99 | #end 100 | } 101 | 102 | #end 103 | override fun toString(): String { 104 | return "${entity}{" + 105 | #foreach($field in ${table.fields}) 106 | #if($!{foreach.index}==0) 107 | "${field.propertyName}=" + ${field.propertyName} + 108 | #else 109 | ", ${field.propertyName}=" + ${field.propertyName} + 110 | #end 111 | #end 112 | "}" 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/axios/api.js: -------------------------------------------------------------------------------- 1 | import Request from './request' 2 | import qs from 'qs' 3 | 4 | const POST = 'post'; 5 | const GET = 'get'; 6 | const PUT = 'put'; 7 | const DELETE = 'delete'; 8 | const FILE = 'file'; 9 | 10 | //Base请求 11 | function R(url, method, data) { 12 | if(method===POST){ 13 | return Request.service({ 14 | url:url, 15 | method: method, 16 | data 17 | }); 18 | } 19 | if(method===GET || method===PUT){ 20 | return Request.service({ 21 | url:url + "?"+ qs.stringify(data), 22 | method: method 23 | }); 24 | } 25 | if (method === FILE) { 26 | const formData = new FormData(); 27 | for (const key in data) { 28 | formData.append(key, data[key]); 29 | } 30 | return Request.rawService({ 31 | url:url, 32 | method: 'post', 33 | data : formData 34 | }); 35 | } 36 | } 37 | 38 | //登录 39 | export const toLogin = (data) => { return R("/verify/login", POST, data)}; 40 | 41 | //应急事件 42 | export const eventApi = { 43 | newEvent: (data) => { 44 | return R('/event', POST, data); 45 | }, 46 | listEvent: (data) => { 47 | return R('/event/list', GET, data); 48 | }, 49 | deleteEvent : (data)=>{ 50 | return R('/event/'+data, DELETE, {}); 51 | } 52 | }; 53 | 54 | export const materialApi = { 55 | newMaterialCategory:(data)=>{ 56 | return R("/material/category", POST, data); 57 | }, 58 | listMaterialCategory: (data)=>{ 59 | return R("/material/category/list", GET, data); 60 | }, 61 | deleteMaterialCategory: (data)=>{ 62 | return R("/material/category", DELETE, data); 63 | }, 64 | newMaterial: (data)=>{ 65 | return R("/material", POST, data); 66 | }, 67 | listMaterial: (data)=>{ 68 | return R("/material/list", GET, data); 69 | }, 70 | deleteMaterial: (data)=>{ 71 | return R("/material", DELETE, data); 72 | } 73 | }; 74 | 75 | 76 | export const approvalApi = { 77 | newApproval: (data)=>{ 78 | return R("/approval", POST, data); 79 | }, 80 | deleteApproval: (data)=>{ 81 | return R("/approval", DELETE, data); 82 | }, 83 | updateApproval : (data)=>{ 84 | return R("/approval", PUT, data); 85 | }, 86 | listApproval: (data)=>{ 87 | return R("/approval/list", GET, data); 88 | } 89 | }; 90 | 91 | export const transportApi = { 92 | newTransport: (data)=>{ 93 | return R("/transport", POST, data); 94 | }, 95 | listTransport: (data)=>{ 96 | return R("/transport/list", GET, data); 97 | }, 98 | updateTransport: (data)=>{ 99 | return R("/transport", PUT, data); 100 | } 101 | }; 102 | 103 | export const ossApi = { 104 | upload : (data)=>{ 105 | return R("/qiniu/upload", FILE, data); 106 | } 107 | }; 108 | 109 | export const userApi = { 110 | listUser: (data)=>{ 111 | return R("/user/list", GET, data); 112 | } 113 | }; 114 | 115 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/entity.kt.ftl: -------------------------------------------------------------------------------- 1 | package ${package.Entity} 2 | 3 | <#list table.importPackages as pkg> 4 | import ${pkg} 5 | 6 | <#if swagger2> 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | 10 | /** 11 | *

12 | * ${table.comment} 13 | *

14 | * 15 | * @author ${author} 16 | * @since ${date} 17 | */ 18 | <#if table.convert> 19 | @TableName("${table.name}") 20 | 21 | <#if swagger2> 22 | @ApiModel(value="${entity}对象", description="${table.comment!}") 23 | 24 | <#if superEntityClass??> 25 | class ${entity} : ${superEntityClass}<#if activeRecord><${entity}> { 26 | <#elseif activeRecord> 27 | class ${entity} : Model<${entity}>() { 28 | <#else> 29 | class ${entity} : Serializable { 30 | 31 | 32 | <#-- ---------- BEGIN 字段循环遍历 ----------> 33 | <#list table.fields as field> 34 | <#if field.keyFlag> 35 | <#assign keyPropertyName="${field.propertyName}"/> 36 | 37 | 38 | <#if field.comment!?length gt 0> 39 | <#if swagger2> 40 | @ApiModelProperty(value = "${field.comment}") 41 | <#else> 42 | /** 43 | * ${field.comment} 44 | */ 45 | 46 | 47 | <#if field.keyFlag> 48 | <#-- 主键 --> 49 | <#if field.keyIdentityFlag> 50 | @TableId(value = "${field.name}", type = IdType.AUTO) 51 | <#elseif idType ??> 52 | @TableId(value = "${field.name}", type = IdType.${idType}) 53 | <#elseif field.convert> 54 | @TableId("${field.name}") 55 | 56 | <#-- 普通字段 --> 57 | <#elseif field.fill??> 58 | <#-- ----- 存在字段填充设置 -----> 59 | <#if field.convert> 60 | @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) 61 | <#else> 62 | @TableField(fill = FieldFill.${field.fill}) 63 | 64 | <#elseif field.convert> 65 | @TableField("${field.name}") 66 | 67 | <#-- 乐观锁注解 --> 68 | <#if (versionFieldName!"") == field.name> 69 | @Version 70 | 71 | <#-- 逻辑删除注解 --> 72 | <#if (logicDeleteFieldName!"") == field.name> 73 | @TableLogic 74 | 75 | <#if field.propertyType == "Integer"> 76 | var ${field.propertyName}: Int? = null 77 | <#else> 78 | var ${field.propertyName}: ${field.propertyType}? = null 79 | 80 | 81 | <#-- ---------- END 字段循环遍历 ----------> 82 | 83 | 84 | <#if entityColumnConstant> 85 | companion object { 86 | <#list table.fields as field> 87 | 88 | const val ${field.name.toUpperCase()} : String = "${field.name}" 89 | 90 | 91 | } 92 | 93 | 94 | <#if activeRecord> 95 | override fun pkVal(): Serializable? { 96 | <#if keyPropertyName??> 97 | return ${keyPropertyName} 98 | <#else> 99 | return null 100 | 101 | } 102 | 103 | 104 | override fun toString(): String { 105 | return "${entity}{" + 106 | <#list table.fields as field> 107 | <#if field_index==0> 108 | "${field.propertyName}=" + ${field.propertyName} + 109 | <#else> 110 | ", ${field.propertyName}=" + ${field.propertyName} + 111 | 112 | 113 | "}" 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/response/RWrapper.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.response; 2 | 3 | import com.bestbigkk.common.web.ResultCode; 4 | import com.bestbigkk.common.utils.RequestContextHolderUtils; 5 | import com.fasterxml.jackson.annotation.JsonFormat; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Builder; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | import java.time.LocalDateTime; 13 | import java.util.Objects; 14 | 15 | /** 16 | * @author: 开 17 | * @date: 2020-03-23 19:12:40 18 | * @describe: 普通响应 19 | */ 20 | @Builder 21 | @NoArgsConstructor 22 | @AllArgsConstructor 23 | @Data 24 | public class RWrapper implements Result { 25 | 26 | private static final long serialVersionUID = 874200365941306385L; 27 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") 28 | private LocalDateTime timeStamp; 29 | private Boolean status; 30 | private String path; 31 | private Integer code; 32 | private String msg; 33 | private T data; 34 | 35 | public static RWrapper success() { 36 | RWrapper result = new RWrapper<>(); 37 | result.setResultCode(ResultCode.OK); 38 | return result; 39 | } 40 | 41 | public static RWrapper success(T data) { 42 | RWrapper result = new RWrapper<>(); 43 | result.setResultCode(ResultCode.OK); 44 | result.setData(data); 45 | return result; 46 | } 47 | 48 | public static RWrapper failure(ResultCode resultCode) { 49 | RWrapper result = new RWrapper<>(); 50 | result.setResultCode(resultCode); 51 | return result; 52 | } 53 | 54 | public static RWrapper failure(HttpServletRequest servletRequest, ResultCode resultCode, String msg) { 55 | RWrapper result = new RWrapper<>(); 56 | result.setResultCode(resultCode, servletRequest); 57 | if (Objects.nonNull(msg)) { 58 | result.setMsg(msg); 59 | } 60 | return result; 61 | } 62 | 63 | public static RWrapper failure(ResultCode resultCode, T data) { 64 | RWrapper result = new RWrapper<>(); 65 | result.setResultCode(resultCode); 66 | result.setData(data); 67 | return result; 68 | } 69 | 70 | public static RWrapper failure(ResultCode resultCode, String msg, T data) { 71 | RWrapper result = new RWrapper<>(); 72 | result.setResultCode(resultCode); 73 | result.setData(data); 74 | result.setMsg(msg); 75 | return result; 76 | } 77 | 78 | private void setResultCode(ResultCode code, HttpServletRequest servletRequest) { 79 | this.code = code.code; 80 | this.msg = code.msg; 81 | this.timeStamp = LocalDateTime.now(); 82 | this.status = code.equals(ResultCode.OK); 83 | 84 | servletRequest = Objects.isNull(servletRequest) ? RequestContextHolderUtils.getRequest() : servletRequest; 85 | this.path = servletRequest.getRequestURI(); 86 | } 87 | 88 | private void setResultCode(ResultCode code) { 89 | setResultCode(code, null); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/shiro/filter/JwtFilter.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config.shiro.filter; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.bestbigkk.common.web.ResultCode; 5 | import com.bestbigkk.web.config.shiro.authc.JwtToken; 6 | import com.bestbigkk.web.response.RWrapper; 7 | import com.bestbigkk.web.response.Tips; 8 | import lombok.SneakyThrows; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.apache.shiro.web.filter.AccessControlFilter; 11 | 12 | import javax.servlet.ServletRequest; 13 | import javax.servlet.ServletResponse; 14 | import javax.servlet.http.HttpServletRequest; 15 | import javax.servlet.http.HttpServletResponse; 16 | import java.io.PrintWriter; 17 | 18 | /** 19 | * @author: 开 20 | * @date: 2020-03-25 18:38:16 21 | * @describe: 自定义一个Filter,用来拦截所有的请求判断是否携带Token 22 | * isAccessAllowed()判断是否携带了有效的JwtToken 23 | * onAccessDenied()是没有携带JwtToken的时候进行账号密码登录,登录成功允许访问,登录失败拒绝访问 24 | * 25 | * 该拦截器必须要注册在Shiro默认拦截器的后面,因此【不要主动注入到容器中】否则该拦截器去拦截原本属于其他拦截器的地址。 26 | * 在anonymousFilter的后面注册jwtFilter,可以保证之前设置的放行的地址正常先进入anonymousFilter中。 27 | * 28 | * 29 | */ 30 | @Slf4j 31 | public final class JwtFilter extends AccessControlFilter { 32 | 33 | 34 | /* 35 | * 1. 返回true,shiro就直接允许访问url 36 | * 2. 返回false,shiro才会根据onAccessDenied的方法的返回值决定是否允许访问url 37 | * */ 38 | 39 | @Override 40 | protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) { 41 | log.warn("isAccessAllowed 方法被调用"); 42 | //这里先让它始终返回false来使用onAccessDenied()方法 43 | return false; 44 | } 45 | 46 | /** 47 | * 返回结果为true表明登录通过 48 | */ 49 | @Override 50 | @SneakyThrows 51 | protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) { 52 | //所以以后发起请求的时候就需要在Header中放一个Authorization,值就是对应的Token 53 | HttpServletRequest request = (HttpServletRequest) servletRequest; 54 | 55 | log.warn("onAccessDenied 方法被调用:::"+ request.getRequestURI()); 56 | 57 | String jwt = request.getHeader("Authorization"); 58 | log.info("从Request-Header中获取Authorization: {}", jwt); 59 | JwtToken jwtToken = new JwtToken(jwt); 60 | jwtToken.setServletRequest(servletRequest); 61 | 62 | try { 63 | // 委托 realm 进行登录认证, 所以这个地方最终还是调用JwtRealm进行的认证 64 | getSubject(servletRequest, servletResponse).login(jwtToken); 65 | } catch (Exception e) { 66 | //肯定是Jwt校验失败的异常 67 | final HttpServletResponse response = (HttpServletResponse) servletResponse; 68 | response.setContentType("application/json; charset=utf-8"); 69 | response.setCharacterEncoding("UTF-8"); 70 | 71 | final String s = Tips.getAndRemove(); 72 | 73 | String jsonString = JSONObject.toJSONString(RWrapper.failure((HttpServletRequest) servletRequest, ResultCode.UN_AUTHORIZATION , s)); 74 | 75 | final PrintWriter writer = response.getWriter(); 76 | writer.write(jsonString); 77 | writer.flush(); 78 | writer.close(); 79 | 80 | return false; 81 | } 82 | 83 | return true; 84 | } 85 | } 86 | 87 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | bbk-seed 7 | com.bestbigkk 8 | 2.0-SNAPSHOT 9 | 10 | 4.0.0 11 | jar 12 | 13 | ${bbk-web-name} 14 | ${bbk-version} 15 | 16 | 17 | 18 | com.bestbigkk 19 | ${bbk-common-name} 20 | ${bbk-version} 21 | 22 | 23 | com.bestbigkk 24 | ${bbk-service-name} 25 | ${bbk-version} 26 | 27 | 28 | 29 | mysql 30 | mysql-connector-java 31 | 32 | 33 | 34 | com.baomidou 35 | mybatis-plus-boot-starter 36 | ${mybatis-plus.version} 37 | 38 | 39 | com.baomidou 40 | mybatis-plus-generator 41 | ${mybatis-plus.version} 42 | test 43 | 44 | 45 | org.apache.velocity 46 | velocity-engine-core 47 | 2.0 48 | test 49 | 50 | 51 | com.baomidou 52 | mybatis-plus-extension 53 | ${mybatis-plus.version} 54 | compile 55 | 56 | 57 | 58 | ${application-name} 59 | 60 | 61 | 62 | org.springframework.boot 63 | spring-boot-maven-plugin 64 | 1.5.1.RELEASE 65 | 66 | 67 | 68 | repackage 69 | 70 | 71 | 72 | 73 | 74 | 75 | org.apache.maven.plugins 76 | maven-compiler-plugin 77 | 78 | 1.8 79 | 1.8 80 | UTF-8 81 | 82 | 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/RedisConfig.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config; 2 | 3 | import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; 4 | import com.fasterxml.jackson.annotation.PropertyAccessor; 5 | import com.fasterxml.jackson.databind.ObjectMapper; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.crazycake.shiro.RedisCacheManager; 8 | import org.crazycake.shiro.RedisManager; 9 | import org.springframework.beans.factory.annotation.Value; 10 | import org.springframework.cache.CacheManager; 11 | import org.springframework.cache.annotation.CachingConfigurerSupport; 12 | import org.springframework.cache.annotation.EnableCaching; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.data.redis.cache.RedisCacheConfiguration; 16 | import org.springframework.data.redis.cache.RedisCacheWriter; 17 | import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; 18 | import org.springframework.data.redis.core.RedisTemplate; 19 | import org.springframework.data.redis.serializer.*; 20 | import org.springframework.util.StringUtils; 21 | 22 | import java.time.Duration; 23 | 24 | import static java.util.Collections.singletonMap; 25 | 26 | @Configuration 27 | @EnableCaching 28 | @Slf4j 29 | public class RedisConfig extends CachingConfigurerSupport { 30 | 31 | @Value("${spring.redis.port}") 32 | private String port; 33 | @Value("${spring.redis.host}") 34 | private String host; 35 | @Value("${spring.redis.password}") 36 | private String redisPassword; 37 | 38 | private LettuceConnectionFactory lettuceConnectionFactory; 39 | public RedisConfig(LettuceConnectionFactory lettuceConnectionFactory) { 40 | this.lettuceConnectionFactory = lettuceConnectionFactory; 41 | } 42 | 43 | /** 44 | * RedisTemplate配置 45 | * 46 | * @param lettuceConnectionFactory 47 | * @return 48 | */ 49 | @Bean 50 | public RedisTemplate redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) { 51 | // 设置序列化 52 | Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); 53 | ObjectMapper om = new ObjectMapper(); 54 | om.setVisibility(PropertyAccessor.ALL, Visibility.ANY); 55 | jackson2JsonRedisSerializer.setObjectMapper(om); 56 | // 配置redisTemplate 57 | RedisTemplate redisTemplate = new RedisTemplate(); 58 | redisTemplate.setConnectionFactory(lettuceConnectionFactory); 59 | RedisSerializer stringSerializer = new StringRedisSerializer(); 60 | // key序列化 61 | redisTemplate.setKeySerializer(stringSerializer); 62 | // value序列化 63 | redisTemplate.setValueSerializer(jackson2JsonRedisSerializer); 64 | // Hash key序列化 65 | redisTemplate.setHashKeySerializer(stringSerializer); 66 | // Hash value序列化 67 | redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer); 68 | redisTemplate.afterPropertiesSet(); 69 | return redisTemplate; 70 | } 71 | 72 | 73 | /** 74 | * 配置shiro redisManager 75 | * 使用的是shiro-redis开源插件 76 | * 77 | * @return 78 | */ 79 | @Bean 80 | public RedisManager redisManager() { 81 | log.info("创建RedisManager,连接Redis..URL= " + host + ":" + port); 82 | RedisManager redisManager = new RedisManager(); 83 | redisManager.setHost(host+":"+port); 84 | redisManager.setTimeout(0); 85 | if (!StringUtils.isEmpty(redisPassword)) { 86 | redisManager.setPassword(redisPassword); 87 | } 88 | return redisManager; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/entity.kt.btl: -------------------------------------------------------------------------------- 1 | package ${package.Entity} 2 | <% for(pkg in table.importPackages){ %> 3 | import ${pkg} 4 | <% } %> 5 | <% if(swagger2){ %> 6 | import io.swagger.annotations.ApiModel 7 | import io.swagger.annotations.ApiModelProperty 8 | <% } %> 9 | /** 10 | *

11 | * ${table.comment!} 12 | *

13 | * 14 | * @author ${author} 15 | * @since ${date} 16 | */ 17 | <% if(table.convert){ %> 18 | @TableName("${table.name}") 19 | <% } %> 20 | <% if(swagger2){ %> 21 | @ApiModel(value="${entity}对象", description="${table.comment!''}") 22 | <% } %> 23 | <% if(isNotEmpty(superEntityClass)){ %> 24 | class ${entity} : ${superEntityClass}<% if(activeRecord){ %><${entity}><%}%>{ 25 | <% }else if(activeRecord){ %> 26 | class ${entity} : Model<${entity}> { 27 | <% }else{ %> 28 | class ${entity} : Serializable { 29 | <% } %> 30 | 31 | <% /** -----------BEGIN 字段循环遍历----------- **/ %> 32 | <% for(field in table.fields){ %> 33 | <% 34 | if(field.keyFlag){ 35 | var keyPropertyName = field.propertyName; 36 | } 37 | %> 38 | 39 | <% if(isNotEmpty(field.comment)){ %> 40 | <% if(swagger2){ %> 41 | @ApiModelProperty(value = "${field.comment}") 42 | <% }else{ %> 43 | /** 44 | * ${field.comment} 45 | */ 46 | <% } %> 47 | <% } %> 48 | <% if(field.keyFlag){ %> 49 | <% 50 | /*主键*/ 51 | %> 52 | <% if(field.keyIdentityFlag){ %> 53 | @TableId(value = "${field.name}", type = IdType.AUTO) 54 | <% }else if(isNotEmpty(idType)){ %> 55 | @TableId(value = "${field.name}", type = IdType.${idType}) 56 | <% }else if(field.convert){ %> 57 | @TableId("${field.name}") 58 | <% } %> 59 | <% 60 | /*普通字段*/ 61 | %> 62 | <% }else if(isNotEmpty(field.fill)){ %> 63 | <% if(field.convert){ %> 64 | @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) 65 | <% }else{ %> 66 | @TableField(fill = FieldFill.${field.fill}) 67 | <% } %> 68 | <% }else if(field.convert){ %> 69 | @TableField("${field.name}") 70 | <% } %> 71 | <% 72 | /*乐观锁注解*/ 73 | %> 74 | <% if(versionFieldName!'' == field.name){ %> 75 | @Version 76 | <% } %> 77 | <% 78 | /*逻辑删除注解*/ 79 | %> 80 | <% if(logicDeleteFieldName!'' == field.name){ %> 81 | @TableLogic 82 | <% } %> 83 | <% if(field.propertyType == 'Integer'){ %> 84 | var ${field.propertyName}: Int ? = null 85 | <% }else{ %> 86 | var ${field.propertyName}: ${field.propertyType} ? = null 87 | <% } %> 88 | <% } %> 89 | <% /** -----------END 字段循环遍历----------- **/ %> 90 | 91 | <% if(entityColumnConstant){ %> 92 | companion object { 93 | <% for(field in table.fields){ %> 94 | const val ${strutil.toUpperCase(field.name)} : String = "${field.name}" 95 | <% } %> 96 | } 97 | <% } %> 98 | <% if(activeRecord){ %> 99 | @Override 100 | override fun pkVal(): Serializable? { 101 | <% if(isNotEmpty(keyPropertyName)){ %> 102 | return this.${keyPropertyName} 103 | <% }else{ %> 104 | return null; 105 | <% } %> 106 | } 107 | 108 | <% } %> 109 | 110 | <% if(!entityLombokModel){ %> 111 | @Override 112 | override fun toString(): String { 113 | return "${entity}{" + 114 | <% for(field in table.fields){ %> 115 | <% if(fieldLP.index==0){ %> 116 | "${field.propertyName}=" + ${field.propertyName} + 117 | <% }else{ %> 118 | ", ${field.propertyName}=" + ${field.propertyName} + 119 | <% } %> 120 | <% } %> 121 | "}" 122 | } 123 | <% } %> 124 | } 125 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/aspect/impl/LogRecordAspect.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.aspect.impl; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.bestbigkk.common.utils.HttpUtils; 5 | import com.bestbigkk.common.utils.RequestContextHolderUtils; 6 | import com.bestbigkk.persistence.entity.OperationLogPO; 7 | import com.bestbigkk.common.aspect.AbstractAspect; 8 | import com.bestbigkk.common.exception.BusinessException; 9 | import com.bestbigkk.web.validator.LogRecord; 10 | import lombok.extern.slf4j.Slf4j; 11 | import org.aspectj.lang.JoinPoint; 12 | import org.springframework.core.LocalVariableTableParameterNameDiscoverer; 13 | import org.springframework.stereotype.Component; 14 | 15 | import java.lang.reflect.Method; 16 | import java.time.LocalDateTime; 17 | import java.util.Objects; 18 | import java.util.stream.Stream; 19 | 20 | /** 21 | * 记录日志切面 22 | * @author liugh 23 | * @since on 2018/5/10. 24 | */ 25 | @Slf4j 26 | @Component 27 | public class LogRecordAspect extends AbstractAspect { 28 | 29 | private final LogRecordPersistence logRecordPersistence; 30 | 31 | public LogRecordAspect(LogRecordPersistence logRecordPersistence) { 32 | this.logRecordPersistence = logRecordPersistence; 33 | } 34 | 35 | 36 | @Override 37 | public Object doHandlerAspect(JoinPoint pjp, Method method, Throwable throwable) throws Throwable{ 38 | if (Objects.isNull(throwable) || throwable instanceof BusinessException) { 39 | return null; 40 | } 41 | return execute(pjp,method, throwable); 42 | } 43 | 44 | @Override 45 | public Object execute(JoinPoint pjp, Method method, Throwable throwable) throws Throwable{ 46 | LogRecord logRecord = method.getAnnotation(LogRecord.class ); 47 | 48 | final String modelName = logRecord.modelName(); 49 | final String description = logRecord.description(); 50 | 51 | final StringBuilder stringBuilder = new StringBuilder(); 52 | final StackTraceElement[] trace = throwable.getStackTrace(); 53 | Stream.of(trace).forEach(stackTraceElement -> stringBuilder.append(stackTraceElement).append("\n")); 54 | 55 | LocalVariableTableParameterNameDiscoverer localVariableTableParameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); 56 | final String[] parameterNames = localVariableTableParameterNameDiscoverer.getParameterNames(method); 57 | 58 | final Object[] args = pjp.getArgs(); 59 | StringBuilder res = new StringBuilder(); 60 | for (int i = 0; i < args.length; i++) { 61 | String paramName = Objects.requireNonNull(parameterNames)[i]; 62 | try { 63 | res.append("【").append(paramName).append("=").append(JSONObject.toJSONString(args[i].toString())).append("】"); 64 | } catch (Exception e) { 65 | res.append("【").append(paramName).append("=").append("无法转换该参数类型保存").append("】"); 66 | } 67 | } 68 | 69 | final OperationLogPO build = OperationLogPO.builder() 70 | .createTime(LocalDateTime.now()) 71 | .logDescription(description) 72 | .modelName(modelName) 73 | .errorMsg(throwable.getMessage()) 74 | .stackInfo(stringBuilder.toString()) 75 | .logLocation(pjp.getTarget().getClass().getName() + ":" + method.getName()) 76 | .ip(HttpUtils.getIpAddress(RequestContextHolderUtils.getRequest())) 77 | .actionArgs(res.toString()) 78 | .build(); 79 | 80 | if (!logRecordPersistence.add(build)) { 81 | logRecordPersistence.persistence(build); 82 | } 83 | 84 | return null; 85 | } 86 | 87 | 88 | 89 | } 90 | 91 | 92 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/controller/ApprovalController.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.bestbigkk.common.ListResponse; 7 | import com.bestbigkk.common.Pagination; 8 | import com.bestbigkk.common.exception.BusinessException; 9 | import com.bestbigkk.common.utils.QueryWrapperUtils; 10 | import com.bestbigkk.persistence.entity.ApprovalPO; 11 | import com.bestbigkk.service.IApprovalService; 12 | import com.bestbigkk.web.response.annotation.RW; 13 | import io.swagger.annotations.Api; 14 | import io.swagger.annotations.ApiOperation; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.web.bind.annotation.*; 17 | 18 | import java.util.Objects; 19 | 20 | /** 21 | * @author: 开 22 | * @date: 2020-04-19 18:57:11 23 | * @describe: 用户控制器 24 | */ 25 | @RW 26 | @Api(tags = "审批接口") 27 | @RequestMapping(value = "/dev/approval", produces = {"application/json;charset=UTF-8"}) 28 | public class ApprovalController { 29 | 30 | @Autowired 31 | private IApprovalService approvalService; 32 | @Autowired 33 | private QueryWrapperUtils queryWrapperUtils; 34 | 35 | @PostMapping 36 | @ApiOperation(value = "新增一个审批") 37 | public ApprovalPO add(ApprovalPO approvalPo) { 38 | boolean save = approvalService.save(approvalPo); 39 | if (save) { 40 | return approvalPo; 41 | } 42 | throw new BusinessException("新增失败"); 43 | } 44 | 45 | @DeleteMapping(value = "/{id}") 46 | @ApiOperation(value = "按照ID删除一个审批") 47 | public Boolean delete(@PathVariable("id") String id) { 48 | 49 | final ApprovalPO beDelete = approvalService.getById(id); 50 | if (Objects.isNull(beDelete)) { 51 | throw new BusinessException("被删除审批对象不存在"); 52 | } 53 | 54 | final boolean remove = approvalService.removeById(id); 55 | if (remove) { 56 | return true; 57 | } 58 | 59 | throw new BusinessException("删除失败,请检查审批对象是否存在"); 60 | } 61 | 62 | @PutMapping 63 | @ApiOperation(value = "按照ID更新审批对象信息,以ID确定被更新审批对象") 64 | public ApprovalPO update(ApprovalPO approvalPo) { 65 | 66 | if (Objects.isNull(approvalPo.getId())) { 67 | throw new BusinessException("必须指定更新审批对象的ID"); 68 | } 69 | 70 | final ApprovalPO beUpdate = approvalService.getById(approvalPo.getId()); 71 | if (Objects.isNull(beUpdate)) { 72 | throw new BusinessException("被更新审批对象不存在"); 73 | } 74 | 75 | final boolean update = approvalService.updateById(approvalPo); 76 | if (update) { 77 | return query(approvalPo.getId()); 78 | } 79 | throw new BusinessException("更新失败"); 80 | } 81 | 82 | @GetMapping("/{id}") 83 | @ApiOperation(value = "按照ID查询一个审批对象") 84 | public ApprovalPO query(@PathVariable("id") Long id) { 85 | final ApprovalPO user = approvalService.getById(id); 86 | if (Objects.nonNull(user)) { 87 | return user; 88 | } 89 | throw new BusinessException("审批对象不存在"); 90 | } 91 | 92 | @GetMapping("/list") 93 | @ApiOperation(value = "按照条件查询审批对象列表") 94 | public ListResponse querys(ApprovalPO user, Pagination page) { 95 | final QueryWrapper query = queryWrapperUtils.buildNotNullEqualsWrapper(user); 96 | final IPage record = approvalService.page(page.toPage("create_time"), query); 97 | return new ListResponse<>(record.getRecords(), new Pagination().toPagination(record)); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/config/shiro/authc/BaseJwtRealm.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.config.shiro.authc; 2 | 3 | import com.bestbigkk.common.web.ResultCode; 4 | import com.bestbigkk.common.exception.BusinessException; 5 | import com.bestbigkk.common.utils.JwtUtils; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.apache.shiro.authc.AuthenticationInfo; 8 | import org.apache.shiro.authc.AuthenticationToken; 9 | import org.apache.shiro.authc.SimpleAuthenticationInfo; 10 | import org.apache.shiro.authz.AuthorizationInfo; 11 | import org.apache.shiro.realm.AuthorizingRealm; 12 | import org.apache.shiro.subject.PrincipalCollection; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | 15 | import javax.servlet.ServletRequest; 16 | import java.util.Objects; 17 | 18 | /** 19 | * @author: 开 20 | * @date: 2020-03-26 10:25:03 21 | * @describe: 配合Shiro进行身份,权限校验的Realm,主要从Jwt里获取信息。 22 | * 这里为了便于再次通用,对Realm再次进行了针对Jwt的封装。后续项目使用的时候, 23 | * 【需要建立一个具体的子类,实现贴合于当前系统的校验方法,来保证Shiro可用】 24 | * 如果Shiro未启用,则可以不配置。 25 | */ 26 | 27 | @Slf4j 28 | public abstract class BaseJwtRealm extends AuthorizingRealm { 29 | 30 | @Autowired 31 | protected JwtUtils jwtUtils; 32 | 33 | private static final ResultCode unAuthorization = ResultCode.UN_AUTHORIZATION; 34 | 35 | 36 | 37 | /** 38 | * 多重写一个support 39 | * 标识这个Realm是专门用来验证JwtToken 40 | * 不负责验证其他的token(UsernamePasswordToken) 41 | * */ 42 | @Override 43 | public boolean supports(AuthenticationToken token) { 44 | //这个token就是从过滤器中传入的jwtToken 45 | return token instanceof JwtToken; 46 | } 47 | 48 | 49 | 50 | /** 51 | * 授权校验,只有通过了doGetAuthenticationInfo的身份认证,且方法要求了权限认证,才会执行。因此进入的JWT都是有效的 52 | * 可以验证当前用户的【角色】和【权限】 53 | * */ 54 | @Override 55 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) { 56 | 57 | String jwt = (String) principals.getPrimaryPrincipal(); 58 | AuthorizationInfo authorizationInfo; 59 | try { 60 | authorizationInfo = verifyPermissionAndRolesIsValid(jwt); 61 | if (Objects.isNull(authorizationInfo)) { 62 | throw new BusinessException(unAuthorization, unAuthorization.msg); 63 | } 64 | } catch (Exception e) { 65 | throw new BusinessException(unAuthorization, unAuthorization.msg); 66 | } 67 | return authorizationInfo; 68 | } 69 | 70 | /**认证账户密码,这个token就是从过滤器中传入的jwtToken*/ 71 | @Override 72 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token){ 73 | JwtToken jwtToken = (JwtToken) token; 74 | String jwt = jwtToken.getPrincipal(); 75 | 76 | try { 77 | if (!verifyIdentityIsValid(jwt, jwtToken.getServletRequest())) { 78 | throw new BusinessException(unAuthorization, unAuthorization.msg); 79 | } 80 | } catch (Exception e) { 81 | throw new BusinessException(ResultCode.SERVER_ERROR, "身份验证服务出现异常"); 82 | } 83 | 84 | log.info("{}校验通过登录", jwt); 85 | 86 | // 这里需要再次返回一个对象给后续的拦截器进行验证,由于Jwt只是字符串,我们在这里已经验证了,所以直接返回 jwt, jwt 让后续的匹配为true即可。 87 | return new SimpleAuthenticationInfo(jwt, jwt,"JwtRealm"); 88 | } 89 | 90 | /** 91 | * 校验当前Jwt表示的用户信息,是否是被当前系统认可的。 92 | * @param jwt 当前请求登录用户携带的JWT。 93 | * @param servletRequest 请求对象 94 | * @return 是否通过验证 95 | */ 96 | protected abstract boolean verifyIdentityIsValid(String jwt, ServletRequest servletRequest); 97 | 98 | /** 99 | * 给定当前请求用户携带的jwt,要求返回其具有的权限以及角色信息 100 | * @param jwt 当前请求登录用户携带的JWT。 101 | * @return 角色信息。 102 | */ 103 | protected abstract AuthorizationInfo verifyPermissionAndRolesIsValid(String jwt); 104 | 105 | 106 | } 107 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.bestbigkk.common.Pagination; 7 | import com.bestbigkk.common.enums.Identity; 8 | import com.bestbigkk.common.exception.BusinessException; 9 | import com.bestbigkk.common.utils.QueryWrapperUtils; 10 | import com.bestbigkk.persistence.entity.UserPO; 11 | import com.bestbigkk.service.IUserService; 12 | import com.bestbigkk.common.ListResponse; 13 | import com.bestbigkk.web.response.annotation.RW; 14 | import io.swagger.annotations.Api; 15 | import io.swagger.annotations.ApiOperation; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.web.bind.annotation.*; 18 | 19 | import java.util.Objects; 20 | 21 | /** 22 | * @author: 开 23 | * @date: 2020-04-19 18:57:11 24 | * @describe: 用户控制器 25 | */ 26 | @RW 27 | @Api(tags = "用户接口") 28 | @RequestMapping(value = "/dev/user", produces = {"application/json;charset=UTF-8"}) 29 | public class UserController { 30 | 31 | @Autowired 32 | private IUserService userService; 33 | @Autowired 34 | private QueryWrapperUtils queryWrapperUtils; 35 | 36 | @PostMapping 37 | @ApiOperation(value = "新增一个用户") 38 | public UserPO add(UserPO user) { 39 | boolean registered = userService.save(user); 40 | if (registered) { 41 | return user; 42 | } 43 | throw new BusinessException("注册失败"); 44 | } 45 | 46 | @DeleteMapping(value = "/{id}") 47 | @ApiOperation(value = "按照ID删除一个用户") 48 | public Boolean delete(@PathVariable("id") Long id) { 49 | 50 | final UserPO beDelete = userService.getById(id); 51 | if (Objects.isNull(beDelete)) { 52 | throw new BusinessException("被删除用户不存在"); 53 | } 54 | 55 | if (Identity.SYSTEM_OPERATOR.identityCode.equals(beDelete.getIdentityCode())) { 56 | throw new BusinessException("无法删除该身份的用户"); 57 | } 58 | 59 | final boolean remove = userService.removeById(id); 60 | if (remove) { 61 | return true; 62 | } 63 | 64 | throw new BusinessException("删除失败,请检查用户ID"); 65 | } 66 | 67 | @PutMapping 68 | @ApiOperation(value = "按照ID更新用户信息,以ID确定被更新用户") 69 | public UserPO update(UserPO user) { 70 | 71 | if (Objects.isNull(user.getId())) { 72 | throw new BusinessException("必须指定更新用户的ID"); 73 | } 74 | 75 | final UserPO beUpdate = userService.getById(user.getId()); 76 | if (Objects.isNull(beUpdate)) { 77 | throw new BusinessException("被更新用户不存在"); 78 | } 79 | 80 | final boolean update = userService.updateById(user); 81 | if (update) { 82 | return query(user.getId()); 83 | } 84 | throw new BusinessException("更新失败"); 85 | } 86 | 87 | @GetMapping("/{id}") 88 | @ApiOperation(value = "按照ID查询一个用户") 89 | public UserPO query(@PathVariable("id") Long id) { 90 | final UserPO user = userService.getById(id); 91 | if (Objects.nonNull(user)) { 92 | return user; 93 | } 94 | throw new BusinessException("用户不存在"); 95 | } 96 | 97 | @GetMapping("/list") 98 | @ApiOperation(value = "按照条件查询用户列表") 99 | public ListResponse querys(UserPO user, Pagination page) { 100 | final QueryWrapper query = queryWrapperUtils.buildNotNullEqualsWrapper(user); 101 | final IPage record = userService.page(page.toPage("create_time"), query); 102 | return new ListResponse<>(record.getRecords(), new Pagination().toPagination(record)); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/controller/TransportController.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.controller; 2 | 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.core.metadata.IPage; 6 | import com.bestbigkk.common.ListResponse; 7 | import com.bestbigkk.common.Pagination; 8 | import com.bestbigkk.common.exception.BusinessException; 9 | import com.bestbigkk.common.utils.QueryWrapperUtils; 10 | import com.bestbigkk.persistence.entity.TransportPO; 11 | import com.bestbigkk.service.ITransportService; 12 | import com.bestbigkk.web.response.annotation.RW; 13 | import io.swagger.annotations.Api; 14 | import io.swagger.annotations.ApiOperation; 15 | import org.springframework.beans.factory.annotation.Autowired; 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import org.springframework.web.bind.annotation.*; 18 | 19 | import java.util.Objects; 20 | 21 | /** 22 | * @author: 开 23 | * @date: 2020-04-19 18:57:11 24 | * @describe: 用户控制器 25 | */ 26 | @RW 27 | @Api(tags = "运输单接口") 28 | @RequestMapping(value = "/dev/transport", produces = {"application/json;charset=UTF-8"}) 29 | public class TransportController { 30 | @Autowired 31 | private ITransportService transportService; 32 | @Autowired 33 | private QueryWrapperUtils queryWrapperUtils; 34 | 35 | @PostMapping 36 | @ApiOperation(value = "新增一个运输单") 37 | public TransportPO add(TransportPO transportPO) { 38 | boolean registered = transportService.save(transportPO); 39 | if (registered) { 40 | return transportPO; 41 | } 42 | throw new BusinessException("注册失败"); 43 | } 44 | 45 | @DeleteMapping(value = "/{id}") 46 | @ApiOperation(value = "按照ID删除一个运输单") 47 | public Boolean delete(@PathVariable("id") Long id) { 48 | 49 | final TransportPO beDelete = transportService.getById(id); 50 | if (Objects.isNull(beDelete)) { 51 | throw new BusinessException("被删除运输单不存在"); 52 | } 53 | 54 | final boolean remove = transportService.removeById(id); 55 | if (remove) { 56 | return true; 57 | } 58 | 59 | throw new BusinessException("删除失败,请检查运输单ID"); 60 | } 61 | 62 | @PutMapping 63 | @ApiOperation(value = "按照ID更新运输单信息,以ID确定被更新运输单对象") 64 | public TransportPO update(TransportPO user) { 65 | 66 | if (Objects.isNull(user.getId())) { 67 | throw new BusinessException("必须指定更新运输单的ID"); 68 | } 69 | 70 | final TransportPO beUpdate = transportService.getById(user.getId()); 71 | if (Objects.isNull(beUpdate)) { 72 | throw new BusinessException("被更新运输单不存在"); 73 | } 74 | 75 | final boolean update = transportService.updateById(user); 76 | if (update) { 77 | return query(user.getId()); 78 | } 79 | throw new BusinessException("更新失败"); 80 | } 81 | 82 | @GetMapping("/{id}") 83 | @ApiOperation(value = "按照ID查询一个运输单") 84 | public TransportPO query(@PathVariable("id") Long id) { 85 | final TransportPO user = transportService.getById(id); 86 | if (Objects.nonNull(user)) { 87 | return user; 88 | } 89 | throw new BusinessException("运输单不存在"); 90 | } 91 | 92 | @GetMapping("/list") 93 | @ApiOperation(value = "按照条件查询运输单列表") 94 | public ListResponse querys(TransportPO transport, Pagination page) { 95 | final QueryWrapper query = queryWrapperUtils.buildNotNullEqualsWrapper(transport); 96 | final IPage record = transportService.page(page.toPage("create_time"), query); 97 | return new ListResponse<>(record.getRecords(), new Pagination().toPagination(record)); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/java/com/bestbigkk/web/exception/handler/BaseGlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.bestbigkk.web.exception.handler; 2 | 3 | import com.bestbigkk.common.exception.BusinessException; 4 | import com.bestbigkk.web.response.RWrapper; 5 | import com.bestbigkk.common.web.ResultCode; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.http.converter.HttpMessageNotReadableException; 8 | import org.springframework.validation.BindException; 9 | import org.springframework.web.bind.MethodArgumentNotValidException; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.validation.ConstraintViolation; 13 | import javax.validation.ConstraintViolationException; 14 | import javax.validation.Path; 15 | import java.util.*; 16 | 17 | /** 18 | * @author: 开 19 | * @date: 2020-03-23 19:57:15 20 | * @describe: 全局异常处理 21 | */ 22 | @Slf4j 23 | public abstract class BaseGlobalExceptionHandler { 24 | 25 | /** 26 | * 违反约束异常 27 | */ 28 | protected RWrapper handleConstraintViolationException(ConstraintViolationException e, HttpServletRequest request) { 29 | log.info("handleConstraintViolationException start, uri:{}, caused by: ", request.getRequestURI(), e); 30 | return RWrapper.failure(ResultCode.BAD_REQUEST, "参数校验不通过", wrapperError(e)); 31 | } 32 | 33 | /** 34 | * 转换参数校验校验异常信息 35 | * @return 36 | */ 37 | private List> wrapperError(ConstraintViolationException e) { 38 | LinkedList> res = new LinkedList<>(); 39 | final Set> constraintViolations = e.getConstraintViolations(); 40 | constraintViolations.forEach(constraintViolation -> { 41 | final String errorMsg = constraintViolation.getMessageTemplate(); 42 | final Path paramName = constraintViolation.getPropertyPath(); 43 | res.add(new HashMap(2) {{ 44 | put("msg", errorMsg); 45 | put("key", paramName.toString()); 46 | }}); 47 | }); 48 | return res; 49 | } 50 | 51 | /** 52 | * 处理验证参数封装错误时异常 53 | */ 54 | protected RWrapper handleConstraintViolationException(HttpMessageNotReadableException e, HttpServletRequest request) { 55 | log.info("handleConstraintViolationException start, uri:{}, caused by: ", request.getRequestURI(), e); 56 | return RWrapper.failure(ResultCode.BAD_REQUEST, e.getMessage()); 57 | } 58 | 59 | /** 60 | * 处理参数绑定时异常(反400错误码) 61 | */ 62 | protected RWrapper handleBindException(BindException e, HttpServletRequest request) { 63 | log.info("handleBindException start, uri:{}, caused by: ", request.getRequestURI(), e); 64 | return RWrapper.failure(ResultCode.BAD_REQUEST, e.getFieldErrors()); 65 | } 66 | 67 | /** 68 | * 处理使用@Validated注解时,参数验证错误异常(反400错误码) 69 | */ 70 | protected RWrapper handleMethodArgumentNotValidException(MethodArgumentNotValidException e, HttpServletRequest request) { 71 | log.info("handleBindException start, uri:{}, caused by: ", request.getRequestURI(), e); 72 | return RWrapper.failure(ResultCode.BAD_REQUEST, e.getBindingResult()); 73 | } 74 | 75 | /** 76 | * 处理通用自定义业务异常 77 | */ 78 | protected RWrapper handleBusinessException(BusinessException e, HttpServletRequest request) { 79 | log.info("handleBusinessException start, uri:{}, exception:{}, caused by: {}", request.getRequestURI(), e.getClass(), e.getMessage()); 80 | return RWrapper.failure(e.getResultCode(), e.getMessage()); 81 | } 82 | 83 | /** 84 | * 处理运行时系统异常(反500错误码) 85 | */ 86 | protected RWrapper handleRuntimeException(Throwable e, HttpServletRequest request) { 87 | log.error("handleRuntimeException start, uri:{}, caused by: ", request.getRequestURI(), e); 88 | return RWrapper.failure(ResultCode.SERVER_ERROR, e.getMessage()); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | bbk: 2 | log: 3 | cache: 1 4 | encryption: 5 | aesSecretKey: qwertyuiopasdfgh 6 | shiro: 7 | enable: true 8 | cache: 3600 9 | oss: 10 | qiniu: 11 | accessKey: xxx 12 | secretKey: xxx 13 | bucket: material-support-system 14 | path: http://mss.oss.bestbigkk.com 15 | server: 16 | port: 21584 17 | tomcat: 18 | max-swallow-size: -1 19 | compression: 20 | enabled: true 21 | min-response-size: 1024 22 | mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/* 23 | servlet: 24 | context-path: / 25 | application-display-name: MaterialSupportSystem 26 | devtools: 27 | #热部署生效 28 | restart: 29 | enabled: true 30 | #classpath目录下的WEB-INF文件夹内容修改不重启 31 | exclude: WEB-INF/** 32 | 33 | spring: 34 | mvc: 35 | throw-exception-if-no-handler-found: true 36 | resources: 37 | add-mappings: false 38 | servlet: 39 | multipart: 40 | max-file-size: 10MB 41 | max-request-size: 10MB 42 | jackson: 43 | date-format: yyyy-MM-dd HH:mm:ss 44 | time-zone: GMT+8 45 | aop: 46 | proxy-target-class: true 47 | 48 | # Redis 49 | redis: 50 | database: 0 51 | host: localhost 52 | port: 6379 53 | password: 54 | lettuce: 55 | pool: 56 | max-active: 16 57 | max-idle: 8 58 | max-wait: 1 59 | min-idle: 0 60 | shutdown-timeout: 1000ms 61 | 62 | #排除druid的自动配置。 63 | autoconfigure: 64 | exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure 65 | # 数据源 66 | datasource: 67 | type: com.alibaba.druid.pool.DruidDataSource 68 | dynamic: 69 | primary: master #设置默认的数据源或者数据源组,默认值即为master 70 | strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源. 71 | datasource: 72 | master: 73 | driver-class-name: com.mysql.cj.jdbc.Driver 74 | url: jdbc:mysql://localhost:3306/no180_xugongkai_bbk_mss?useSSL=true&autoReconnect=true&serverTimezone=Asia/Shanghai 75 | username: root 76 | password: 123456 77 | # 使用阿里的Druid连接池 78 | druid: 79 | # 连接池的配置信息 80 | # 初始化大小,最小,最大 81 | initial-size: 5 82 | min-idle: 5 83 | maxActive: 20 84 | # 配置获取连接等待超时的时间 85 | maxWait: 60000 86 | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 87 | timeBetweenEvictionRunsMillis: 60000 88 | # 配置一个连接在池中最小生存的时间,单位是毫秒 89 | minEvictableIdleTimeMillis: 300000 90 | validationQuery: SELECT 1 91 | testWhileIdle: true 92 | testOnBorrow: false 93 | testOnReturn: false 94 | # 打开PSCache,并且指定每个连接上PSCache的大小 95 | poolPreparedStatements: true 96 | maxPoolPreparedStatementPerConnectionSize: 20 97 | # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 98 | filters: stat,wall,slf4j 99 | # 通过connectProperties属性来打开mergeSql功能;慢SQL记录 100 | connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 101 | # 配置DruidStatFilter 102 | web-stat-filter: 103 | enabled: true 104 | url-pattern: "/*" 105 | exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*" 106 | # 配置DruidStatViewServlet 107 | stat-view-servlet: 108 | url-pattern: "/druid/*" 109 | # IP白名单(没有配置或者为空,则允许所有访问) 110 | allow: 127.0.0.1,192.168.163.1 111 | # IP黑名单 (存在共同时,deny优先于allow) 112 | deny: 192.168.1.73 113 | # 禁用HTML页面上的“Reset All”功能 114 | reset-enable: false 115 | # 登录名 116 | login-username: bestbigkk 117 | # 登录密码 118 | login-password: bestbigkk 119 | mybatis-plus: 120 | mapper-locations: classpath:/mapper/*.xml 121 | typeAliasesPackage: com.bestbigkk.persistence.entity 122 | global-config: 123 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 124 | id-type: 2 125 | #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" 126 | field-strategy: 2 127 | #驼峰下划线转换 128 | db-column-underline: true 129 | #刷新mapper 调试神器 130 | refresh-mapper: true 131 | configuration: 132 | map-underscore-to-camel-case: true 133 | cache-enabled: false 134 | #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/entity.java.vm: -------------------------------------------------------------------------------- 1 | package ${package.Entity}; 2 | 3 | #foreach($pkg in ${table.importPackages}) 4 | import ${pkg}; 5 | #end 6 | #if(${swagger2}) 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | #end 10 | #if(${entityLombokModel}) 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | import lombok.experimental.Accessors; 14 | #end 15 | 16 | /** 17 | *

18 | * $!{table.comment} 19 | *

20 | * 21 | * @author ${author} 22 | * @since ${date} 23 | */ 24 | #if(${entityLombokModel}) 25 | @Data 26 | #if(${superEntityClass}) 27 | @EqualsAndHashCode(callSuper = true) 28 | #else 29 | @EqualsAndHashCode(callSuper = false) 30 | #end 31 | @Accessors(chain = true) 32 | #end 33 | #if(${table.convert}) 34 | @TableName("${table.name}") 35 | #end 36 | #if(${swagger2}) 37 | @ApiModel(value="${entity}对象", description="$!{table.comment}") 38 | #end 39 | #if(${superEntityClass}) 40 | public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end { 41 | #elseif(${activeRecord}) 42 | public class ${entity} extends Model<${entity}> { 43 | #else 44 | public class ${entity} implements Serializable { 45 | #end 46 | 47 | #if(${entitySerialVersionUID}) 48 | private static final long serialVersionUID=1L; 49 | #end 50 | ## ---------- BEGIN 字段循环遍历 ---------- 51 | #foreach($field in ${table.fields}) 52 | 53 | #if(${field.keyFlag}) 54 | #set($keyPropertyName=${field.propertyName}) 55 | #end 56 | #if("$!field.comment" != "") 57 | #if(${swagger2}) 58 | @ApiModelProperty(value = "${field.comment}") 59 | #else 60 | /** 61 | * ${field.comment} 62 | */ 63 | #end 64 | #end 65 | #if(${field.keyFlag}) 66 | ## 主键 67 | #if(${field.keyIdentityFlag}) 68 | @TableId(value = "${field.name}", type = IdType.AUTO) 69 | #elseif(!$null.isNull(${idType}) && "$!idType" != "") 70 | @TableId(value = "${field.name}", type = IdType.${idType}) 71 | #elseif(${field.convert}) 72 | @TableId("${field.name}") 73 | #end 74 | ## 普通字段 75 | #elseif(${field.fill}) 76 | ## ----- 存在字段填充设置 ----- 77 | #if(${field.convert}) 78 | @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) 79 | #else 80 | @TableField(fill = FieldFill.${field.fill}) 81 | #end 82 | #elseif(${field.convert}) 83 | @TableField("${field.name}") 84 | #end 85 | ## 乐观锁注解 86 | #if(${versionFieldName}==${field.name}) 87 | @Version 88 | #end 89 | ## 逻辑删除注解 90 | #if(${logicDeleteFieldName}==${field.name}) 91 | @TableLogic 92 | #end 93 | private ${field.propertyType} ${field.propertyName}; 94 | #end 95 | ## ---------- END 字段循环遍历 ---------- 96 | 97 | #if(!${entityLombokModel}) 98 | #foreach($field in ${table.fields}) 99 | #if(${field.propertyType.equals("boolean")}) 100 | #set($getprefix="is") 101 | #else 102 | #set($getprefix="get") 103 | #end 104 | 105 | public ${field.propertyType} ${getprefix}${field.capitalName}() { 106 | return ${field.propertyName}; 107 | } 108 | 109 | #if(${entityBuilderModel}) 110 | public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { 111 | #else 112 | public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { 113 | #end 114 | this.${field.propertyName} = ${field.propertyName}; 115 | #if(${entityBuilderModel}) 116 | return this; 117 | #end 118 | } 119 | #end 120 | ## --foreach end--- 121 | #end 122 | ## --end of #if(!${entityLombokModel})-- 123 | 124 | #if(${entityColumnConstant}) 125 | #foreach($field in ${table.fields}) 126 | public static final String ${field.name.toUpperCase()} = "${field.name}"; 127 | 128 | #end 129 | #end 130 | #if(${activeRecord}) 131 | @Override 132 | protected Serializable pkVal() { 133 | #if(${keyPropertyName}) 134 | return this.${keyPropertyName}; 135 | #else 136 | return null; 137 | #end 138 | } 139 | 140 | #end 141 | #if(!${entityLombokModel}) 142 | @Override 143 | public String toString() { 144 | return "${entity}{" + 145 | #foreach($field in ${table.fields}) 146 | #if($!{foreach.index}==0) 147 | "${field.propertyName}=" + ${field.propertyName} + 148 | #else 149 | ", ${field.propertyName}=" + ${field.propertyName} + 150 | #end 151 | #end 152 | "}"; 153 | } 154 | #end 155 | } 156 | -------------------------------------------------------------------------------- /bbk-mss-java/bbk-mss-web/src/main/resources/templates/entity.java.k.ftl: -------------------------------------------------------------------------------- 1 | package ${package.Entity}; 2 | 3 | <#list table.importPackages as pkg> 4 | import ${pkg}; 5 | 6 | <#if swagger2> 7 | import io.swagger.annotations.ApiModel; 8 | import io.swagger.annotations.ApiModelProperty; 9 | 10 | <#if entityLombokModel> 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | import lombok.experimental.Accessors; 14 | 15 | 16 | /** 17 | * ${table.comment!} 18 | * @author ${author} 19 | * @since ${date} 20 | */ 21 | <#if entityLombokModel> 22 | @Data 23 | <#if superEntityClass??> 24 | @EqualsAndHashCode(callSuper = true) 25 | <#else> 26 | @EqualsAndHashCode(callSuper = false) 27 | 28 | @Accessors(chain = true) 29 | 30 | <#if table.convert> 31 | @TableName("${table.name}") 32 | 33 | <#if swagger2> 34 | @ApiModel(value="${entity}对象", description="${table.comment!}") 35 | 36 | <#if superEntityClass??> 37 | public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}> { 38 | <#elseif activeRecord> 39 | public class ${entity} extends Model<${entity}> { 40 | <#else> 41 | public class ${entity} implements Serializable { 42 | 43 | <#-- ---------- BEGIN 字段循环遍历 ----------> 44 | <#list table.fields as field> 45 | <#if field.keyFlag> 46 | <#assign keyPropertyName="${field.propertyName}"/> 47 | 48 | 49 | <#if field.comment!?length gt 0> 50 | <#if swagger2> 51 | @ApiModelProperty(value = "${field.comment}") 52 | <#else> 53 | /** 54 | * ${field.comment} 55 | */ 56 | 57 | 58 | <#if field.keyFlag> 59 | <#-- 主键 --> 60 | <#if field.keyIdentityFlag> 61 | @TableId(value = "${field.name}", type = IdType.AUTO) 62 | <#elseif idType??> 63 | @TableId(value = "${field.name}", type = IdType.${idType}) 64 | <#elseif field.convert> 65 | @TableId("${field.name}") 66 | 67 | <#-- 普通字段 --> 68 | <#elseif field.fill??> 69 | <#-- ----- 存在字段填充设置 -----> 70 | <#if field.convert> 71 | @TableField(value = "${field.name}", fill = FieldFill.${field.fill}) 72 | <#else> 73 | @TableField(fill = FieldFill.${field.fill}) 74 | 75 | <#elseif field.convert> 76 | @TableField("${field.name}") 77 | 78 | <#-- 乐观锁注解 --> 79 | <#if (versionFieldName!"") == field.name> 80 | @Version 81 | 82 | <#-- 逻辑删除注解 --> 83 | <#if (logicDeleteFieldName!"") == field.name> 84 | @TableLogic 85 | 86 | private ${field.propertyType} ${field.propertyName}; 87 | 88 | <#------------ END 字段循环遍历 ----------> 89 | 90 | <#if !entityLombokModel> 91 | <#list table.fields as field> 92 | <#if field.propertyType == "boolean"> 93 | <#assign getprefix="is"/> 94 | <#else> 95 | <#assign getprefix="get"/> 96 | 97 | public ${field.propertyType} ${getprefix}${field.capitalName}() { 98 | return ${field.propertyName}; 99 | } 100 | 101 | <#if entityBuilderModel> 102 | public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) { 103 | <#else> 104 | public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) { 105 | 106 | this.${field.propertyName} = ${field.propertyName}; 107 | <#if entityBuilderModel> 108 | return this; 109 | 110 | } 111 | 112 | 113 | 114 | <#if entityColumnConstant> 115 | <#list table.fields as field> 116 | public static final String ${field.name?upper_case} = "${field.name}"; 117 | 118 | 119 | 120 | <#if activeRecord> 121 | @Override 122 | protected Serializable pkVal() { 123 | <#if keyPropertyName??> 124 | return this.${keyPropertyName}; 125 | <#else> 126 | return null; 127 | 128 | } 129 | 130 | 131 | <#if !entityLombokModel> 132 | @Override 133 | public String toString() { 134 | return "${entity}{" + 135 | <#list table.fields as field> 136 | <#if field_index==0> 137 | "${field.propertyName}=" + ${field.propertyName} + 138 | <#else> 139 | ", ${field.propertyName}=" + ${field.propertyName} + 140 | 141 | 142 | "}"; 143 | } 144 | 145 | } 146 | -------------------------------------------------------------------------------- /bbk-mss-vue/src/components/BaiDuSelect.vue: -------------------------------------------------------------------------------- 1 | 30 | 99 | 100 | --------------------------------------------------------------------------------