Repository: moshuying/project-3-crm
Branch: main
Commit: ae731cc0378a
Files: 383
Total size: 13.9 MB
Directory structure:
gitextract_6d5po4kp/
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── dependabot.yml
│ └── workflows/
│ ├── blank.yml
│ └── codeql-analysis.yml
├── .gitignore
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── back/
│ ├── .gitignore
│ ├── LICENSE
│ ├── README-zh.md
│ ├── README.md
│ ├── pom.xml
│ ├── resetDB.sh
│ └── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── msy/
│ │ │ └── plus/
│ │ │ ├── Application.java
│ │ │ ├── aspect/
│ │ │ │ └── ControllerLogAspect.java
│ │ │ ├── controller/
│ │ │ │ ├── AccountController.java
│ │ │ │ ├── AnalysisController.java
│ │ │ │ ├── CustomerFollowUpHistoryController.java
│ │ │ │ ├── CustomerHandoverController.java
│ │ │ │ ├── CustomerManagerController.java
│ │ │ │ ├── DepartmentController.java
│ │ │ │ ├── DictionaryContentsController.java
│ │ │ │ ├── DictionaryDetailsController.java
│ │ │ │ ├── EmployeeController.java
│ │ │ │ ├── PermissionController.java
│ │ │ │ └── RoleController.java
│ │ │ ├── core/
│ │ │ │ ├── cache/
│ │ │ │ │ ├── CacheExpire.java
│ │ │ │ │ └── MyRedisCacheManager.java
│ │ │ │ ├── config/
│ │ │ │ │ ├── JasyptConfig.java
│ │ │ │ │ ├── RedisCacheConfig.java
│ │ │ │ │ ├── RedisConfig.java
│ │ │ │ │ ├── Swagger3Config.java
│ │ │ │ │ ├── ValidatorConfig.java
│ │ │ │ │ ├── WebMvcConfig.java
│ │ │ │ │ ├── WebSecurityConfig.java
│ │ │ │ │ └── YamlPropertySourceFactory.java
│ │ │ │ ├── constant/
│ │ │ │ │ └── ProjectConstant.java
│ │ │ │ ├── dto/
│ │ │ │ │ └── AbstractConverter.java
│ │ │ │ ├── exception/
│ │ │ │ │ ├── ExceptionResolver.java
│ │ │ │ │ ├── ResourcesNotFoundException.java
│ │ │ │ │ ├── RsaException.java
│ │ │ │ │ ├── ServiceException.java
│ │ │ │ │ ├── UsernameNotFoundException2.java
│ │ │ │ │ └── YamlNotFoundException.java
│ │ │ │ ├── jasypt/
│ │ │ │ │ └── MyEncryptablePropertyDetector.java
│ │ │ │ ├── jwt/
│ │ │ │ │ ├── JwtConfigurationProperties.java
│ │ │ │ │ └── JwtUtil.java
│ │ │ │ ├── mapper/
│ │ │ │ │ └── MyMapper.java
│ │ │ │ ├── response/
│ │ │ │ │ ├── Result.java
│ │ │ │ │ ├── ResultCode.java
│ │ │ │ │ └── ResultGenerator.java
│ │ │ │ ├── rsa/
│ │ │ │ │ ├── RsaConfigurationProperties.java
│ │ │ │ │ └── RsaUtils.java
│ │ │ │ ├── service/
│ │ │ │ │ ├── AbstractService.java
│ │ │ │ │ └── Service.java
│ │ │ │ └── upload/
│ │ │ │ └── UploadConfigurationProperties.java
│ │ │ ├── dto/
│ │ │ │ ├── AccountDTO.java
│ │ │ │ ├── AccountLoginDTO.java
│ │ │ │ ├── AnalysisQuery.java
│ │ │ │ ├── CustomerHandoverList.java
│ │ │ │ ├── CustomerManagerList.java
│ │ │ │ ├── LoginResultDTO.java
│ │ │ │ ├── RoleDTO.java
│ │ │ │ └── RoleWithPermissionDTO.java
│ │ │ ├── entity/
│ │ │ │ ├── AccountDO.java
│ │ │ │ ├── AccountWithRoleDO.java
│ │ │ │ ├── Analysis.java
│ │ │ │ ├── CFUHSearch.java
│ │ │ │ ├── CustomerFollowUpHistory.java
│ │ │ │ ├── CustomerHandover.java
│ │ │ │ ├── CustomerManager.java
│ │ │ │ ├── Department.java
│ │ │ │ ├── DictionaryContents.java
│ │ │ │ ├── DictionaryDetails.java
│ │ │ │ ├── Employee.java
│ │ │ │ ├── EmployeeDetail.java
│ │ │ │ ├── EmployeeWithRoleDO.java
│ │ │ │ ├── LoginResultDO.java
│ │ │ │ ├── Permission.java
│ │ │ │ ├── RoleDO.java
│ │ │ │ ├── RolePermissionDO.java
│ │ │ │ ├── RoleWithPermissionDO.java
│ │ │ │ └── Test.java
│ │ │ ├── filter/
│ │ │ │ ├── AuthenticationFilter.java
│ │ │ │ ├── CorsFilter.java
│ │ │ │ ├── MyAuthenticationEntryPoint.java
│ │ │ │ └── RequestWrapper.java
│ │ │ ├── mapper/
│ │ │ │ ├── AccountMapper.java
│ │ │ │ ├── CustomerFollowUpHistoryMapper.java
│ │ │ │ ├── CustomerHandoverMapper.java
│ │ │ │ ├── CustomerManagerMapper.java
│ │ │ │ ├── DepartmentMapper.java
│ │ │ │ ├── DictionaryContentsMapper.java
│ │ │ │ ├── DictionaryDetailsMapper.java
│ │ │ │ ├── EmployeeMapper.java
│ │ │ │ ├── PermissionMapper.java
│ │ │ │ └── RoleMapper.java
│ │ │ ├── query/
│ │ │ │ └── AccountQuery.java
│ │ │ ├── service/
│ │ │ │ ├── AccountService.java
│ │ │ │ ├── CustomerFollowUpHistoryService.java
│ │ │ │ ├── CustomerHandoverService.java
│ │ │ │ ├── CustomerManagerService.java
│ │ │ │ ├── DepartmentService.java
│ │ │ │ ├── DictionaryContentsService.java
│ │ │ │ ├── DictionaryDetailsService.java
│ │ │ │ ├── EmployeeService.java
│ │ │ │ ├── PermissionService.java
│ │ │ │ ├── RoleService.java
│ │ │ │ └── impl/
│ │ │ │ ├── AccountServiceImpl.java
│ │ │ │ ├── CustomerFollowUpHistoryServiceImpl.java
│ │ │ │ ├── CustomerHandoverServiceImpl.java
│ │ │ │ ├── CustomerManagerServiceImpl.java
│ │ │ │ ├── DepartmentServiceImpl.java
│ │ │ │ ├── DictionaryContentsServiceImpl.java
│ │ │ │ ├── DictionaryDetailsServiceImpl.java
│ │ │ │ ├── EmployeeServiceImpl.java
│ │ │ │ ├── PermissionServiceImpl.java
│ │ │ │ ├── RoleServiceImpl.java
│ │ │ │ └── UserDetailsServiceImpl.java
│ │ │ └── util/
│ │ │ ├── AssertUtils.java
│ │ │ ├── ContextUtils.java
│ │ │ ├── DateUtils.java
│ │ │ ├── FileUtils.java
│ │ │ ├── IdCardUtils.java
│ │ │ ├── IdUtils.java
│ │ │ ├── IpUtils.java
│ │ │ ├── JsonUtils.java
│ │ │ ├── RedisUtils.java
│ │ │ └── UrlUtils.java
│ │ └── resources/
│ │ ├── META-INF/
│ │ │ ├── spring-devtools.yml
│ │ │ └── swagger3.yml
│ │ ├── application-dev.yml
│ │ ├── application-test.yml
│ │ ├── application.yml
│ │ ├── banner.txt
│ │ ├── mapper/
│ │ │ ├── AccountMapper.xml
│ │ │ ├── CustomerFollowUpHistoryMapper.xml
│ │ │ ├── CustomerHandoverMapper.xml
│ │ │ ├── CustomerManagerMapper.xml
│ │ │ ├── DepartmentMapper.xml
│ │ │ ├── DictionaryContentsMapper.xml
│ │ │ ├── DictionaryDetailsMapper.xml
│ │ │ ├── EmployeeMapper.xml
│ │ │ ├── PermissionMapper.xml
│ │ │ └── RoleMapper.xml
│ │ └── rsa/
│ │ ├── private-key.pem
│ │ └── public-key.pem
│ └── test/
│ ├── java/
│ │ ├── CodeGenerator.java
│ │ ├── JasyptStringEncryptor.java
│ │ ├── PasswordEncryptor.java
│ │ ├── RsaEncryptor.java
│ │ └── com/
│ │ └── msy/
│ │ └── plus/
│ │ ├── AccountControllerTest.java
│ │ ├── BaseControllerTest.java
│ │ ├── WithCustomSecurityContextFactory.java
│ │ ├── WithCustomUser.java
│ │ └── util/
│ │ └── JsonUtilsTest.java
│ ├── resources/
│ │ ├── generator/
│ │ │ └── template/
│ │ │ ├── controller-restful.ftl
│ │ │ ├── controller.ftl
│ │ │ ├── service-impl.ftl
│ │ │ └── service.ftl
│ │ └── sql/
│ │ └── dev/
│ │ ├── account.sql
│ │ ├── account_role.sql
│ │ └── role.sql
│ └── rest-test/
│ └── upload.http
├── docs/
│ ├── CRM需求模拟.docx
│ ├── JAVA实训方案-CRM(10天)-高级.docx
│ ├── crm商业计划书.pptx
│ ├── 员工信息模板.xlsx
│ └── 项目需求文档.docx
├── front/
│ ├── .github/
│ │ └── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ └── feature_request.md
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.en-US.md
│ ├── README.md
│ ├── babel.config.js
│ ├── docs/
│ │ ├── .vuepress/
│ │ │ ├── components/
│ │ │ │ ├── Alert.vue
│ │ │ │ ├── Color.vue
│ │ │ │ └── ColorList.vue
│ │ │ ├── config.js
│ │ │ ├── plugins/
│ │ │ │ └── alert/
│ │ │ │ ├── Alert.vue
│ │ │ │ ├── alertMixin.js
│ │ │ │ ├── clientRootMixin.js
│ │ │ │ ├── enhanceApp.js
│ │ │ │ └── index.js
│ │ │ └── styles/
│ │ │ ├── index.styl
│ │ │ └── palette.styl
│ │ ├── README.md
│ │ ├── advance/
│ │ │ ├── README.md
│ │ │ ├── api.md
│ │ │ ├── async.md
│ │ │ ├── authority.md
│ │ │ ├── chart.md
│ │ │ ├── error.md
│ │ │ ├── guard.md
│ │ │ ├── i18n.md
│ │ │ ├── interceptors.md
│ │ │ ├── login.md
│ │ │ ├── skill.md
│ │ │ └── theme.md
│ │ ├── develop/
│ │ │ ├── README.md
│ │ │ ├── layout.md
│ │ │ ├── mock.md
│ │ │ ├── page.md
│ │ │ ├── router.md
│ │ │ ├── service.md
│ │ │ └── theme.md
│ │ ├── other/
│ │ │ ├── README.md
│ │ │ ├── community.md
│ │ │ └── upgrade.md
│ │ └── start/
│ │ ├── README.md
│ │ ├── faq.md
│ │ └── use.md
│ ├── package.json
│ ├── public/
│ │ └── index.html
│ ├── src/
│ │ ├── App.vue
│ │ ├── bootstrap.js
│ │ ├── components/
│ │ │ ├── cache/
│ │ │ │ └── AKeepAlive.js
│ │ │ ├── card/
│ │ │ │ └── ChartCard.vue
│ │ │ ├── chart/
│ │ │ │ ├── Bar.vue
│ │ │ │ ├── MiniArea.vue
│ │ │ │ ├── MiniBar.vue
│ │ │ │ ├── MiniProgress.vue
│ │ │ │ ├── Radar.vue
│ │ │ │ ├── RankingList.vue
│ │ │ │ ├── Trend.vue
│ │ │ │ └── index.less
│ │ │ ├── checkbox/
│ │ │ │ ├── ColorCheckbox.vue
│ │ │ │ ├── ImgCheckbox.vue
│ │ │ │ └── index.js
│ │ │ ├── exception/
│ │ │ │ ├── ExceptionPage.vue
│ │ │ │ └── typeConfig.js
│ │ │ ├── form/
│ │ │ │ └── FormRow.vue
│ │ │ ├── input/
│ │ │ │ └── IInput.vue
│ │ │ ├── menu/
│ │ │ │ ├── Contextmenu.vue
│ │ │ │ ├── SideMenu.vue
│ │ │ │ ├── index.less
│ │ │ │ └── menu.js
│ │ │ ├── page/
│ │ │ │ └── header/
│ │ │ │ ├── PageHeader.vue
│ │ │ │ └── index.less
│ │ │ ├── result/
│ │ │ │ └── Result.vue
│ │ │ ├── setting/
│ │ │ │ ├── Setting.vue
│ │ │ │ ├── SettingItem.vue
│ │ │ │ └── i18n.js
│ │ │ ├── table/
│ │ │ │ ├── StandardTable.vue
│ │ │ │ ├── advance/
│ │ │ │ │ ├── ActionColumns.vue
│ │ │ │ │ ├── ActionSize.vue
│ │ │ │ │ ├── AdvanceTable.vue
│ │ │ │ │ ├── SearchArea.vue
│ │ │ │ │ └── index.js
│ │ │ │ └── api/
│ │ │ │ └── ApiTable.vue
│ │ │ ├── task/
│ │ │ │ ├── TaskGroup.vue
│ │ │ │ └── TaskItem.vue
│ │ │ ├── tool/
│ │ │ │ ├── AStepItem.vue
│ │ │ │ ├── AvatarList.vue
│ │ │ │ ├── DetailList.vue
│ │ │ │ ├── Drawer.vue
│ │ │ │ ├── FooterToolBar.vue
│ │ │ │ ├── HeadInfo.vue
│ │ │ │ ├── TagSelect.vue
│ │ │ │ └── TagSelectOption.vue
│ │ │ └── transition/
│ │ │ └── PageToggleTransition.vue
│ │ ├── config/
│ │ │ ├── config.js
│ │ │ ├── default/
│ │ │ │ ├── admin.config.js
│ │ │ │ ├── animate.config.js
│ │ │ │ ├── antd.config.js
│ │ │ │ ├── index.js
│ │ │ │ └── setting.config.js
│ │ │ ├── index.js
│ │ │ └── replacer/
│ │ │ ├── index.js
│ │ │ └── resolve.config.js
│ │ ├── layouts/
│ │ │ ├── AdminLayout.vue
│ │ │ ├── BlankView.vue
│ │ │ ├── CommonLayout.vue
│ │ │ ├── PageLayout.vue
│ │ │ ├── PageView.vue
│ │ │ ├── footer/
│ │ │ │ └── PageFooter.vue
│ │ │ ├── header/
│ │ │ │ ├── AdminHeader.vue
│ │ │ │ ├── HeaderAvatar.vue
│ │ │ │ ├── HeaderNotice.vue
│ │ │ │ ├── HeaderSearch.vue
│ │ │ │ └── index.less
│ │ │ └── tabs/
│ │ │ ├── TabsHead.vue
│ │ │ ├── TabsView.vue
│ │ │ ├── i18n.js
│ │ │ └── index.js
│ │ ├── main.js
│ │ ├── mock/
│ │ │ ├── common/
│ │ │ │ ├── activityData.js
│ │ │ │ ├── index.js
│ │ │ │ └── tableData.js
│ │ │ ├── goods/
│ │ │ │ └── index.js
│ │ │ ├── index.js
│ │ │ ├── user/
│ │ │ │ ├── login.js
│ │ │ │ └── routes.js
│ │ │ └── workplace/
│ │ │ └── index.js
│ │ ├── pages/
│ │ │ ├── analysis/
│ │ │ │ └── index.vue
│ │ │ ├── components/
│ │ │ │ ├── Palette.vue
│ │ │ │ ├── TaskCard.vue
│ │ │ │ └── table/
│ │ │ │ ├── Api.vue
│ │ │ │ ├── Table.vue
│ │ │ │ └── index.js
│ │ │ ├── customer/
│ │ │ │ ├── followHistory.vue
│ │ │ │ ├── handoverHistory.vue
│ │ │ │ ├── manager.vue
│ │ │ │ ├── official.vue
│ │ │ │ └── resource.vue
│ │ │ ├── dashboard/
│ │ │ │ └── workplace/
│ │ │ │ ├── WorkPlace.vue
│ │ │ │ ├── i18n.js
│ │ │ │ ├── index.js
│ │ │ │ └── index.less
│ │ │ ├── department/
│ │ │ │ └── index.vue
│ │ │ ├── dictionary/
│ │ │ │ ├── contents.vue
│ │ │ │ └── details.vue
│ │ │ ├── employee/
│ │ │ │ └── index.vue
│ │ │ ├── exception/
│ │ │ │ ├── 403.vue
│ │ │ │ ├── 404.vue
│ │ │ │ └── 500.vue
│ │ │ ├── login/
│ │ │ │ ├── Login.vue
│ │ │ │ └── index.js
│ │ │ ├── permission/
│ │ │ │ └── index.vue
│ │ │ ├── result/
│ │ │ │ ├── Error.vue
│ │ │ │ └── Success.vue
│ │ │ └── role/
│ │ │ └── index.vue
│ │ ├── plugins/
│ │ │ ├── authority-plugin.js
│ │ │ ├── i18n-extend.js
│ │ │ ├── index.js
│ │ │ └── tabs-page-plugin.js
│ │ ├── router/
│ │ │ ├── async/
│ │ │ │ ├── config.async.js
│ │ │ │ └── router.map.js
│ │ │ ├── config.js
│ │ │ ├── guards.js
│ │ │ ├── i18n.js
│ │ │ └── index.js
│ │ ├── services/
│ │ │ ├── analysis.js
│ │ │ ├── api.js
│ │ │ ├── customerFollowUpHistory.js
│ │ │ ├── customerHandover.js
│ │ │ ├── customerManager.js
│ │ │ ├── dataSource.js
│ │ │ ├── department.js
│ │ │ ├── dictionaryContents.js
│ │ │ ├── dictionaryDetails.js
│ │ │ ├── employee.js
│ │ │ ├── index.js
│ │ │ ├── permission.js
│ │ │ ├── role.js
│ │ │ └── user.js
│ │ ├── store/
│ │ │ ├── index.js
│ │ │ └── modules/
│ │ │ ├── account.js
│ │ │ ├── index.js
│ │ │ └── setting.js
│ │ ├── theme/
│ │ │ ├── antd/
│ │ │ │ ├── ant-menu.less
│ │ │ │ ├── ant-message.less
│ │ │ │ ├── ant-table.less
│ │ │ │ ├── ant-time-picker.less
│ │ │ │ └── index.less
│ │ │ ├── default/
│ │ │ │ ├── color.less
│ │ │ │ ├── index.less
│ │ │ │ ├── nprogress.less
│ │ │ │ └── style.less
│ │ │ ├── index.less
│ │ │ └── theme.less
│ │ └── utils/
│ │ ├── Objects.js
│ │ ├── authority-utils.js
│ │ ├── axios-interceptors.js
│ │ ├── colors.js
│ │ ├── formatter.js
│ │ ├── i18n.js
│ │ ├── request.js
│ │ ├── routerUtil.js
│ │ ├── theme-color-replacer-extend.js
│ │ ├── themeUtil.js
│ │ ├── util.js
│ │ └── validators.js
│ └── vue.config.js
└── mysql/
├── dev.sql
└── prod.sql
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: moshuying # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
================================================
FILE: .github/dependabot.yml
================================================
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
================================================
FILE: .github/workflows/blank.yml
================================================
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
================================================
FILE: .github/workflows/codeql-analysis.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '45 1 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'java', 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
================================================
FILE: .gitignore
================================================
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
idea
================================================
FILE: .travis.yml
================================================
language: node_js
node_js:
- "14"
install:
- cd ./front
- npm i
script:
- npm run build
notifications:
email:
- 1460083332@qq.com
cache:
directories:
- node_modules #缓存依赖
#after_script前5句是把部署分支的.git文件夹保护起来,用于保留历史部署的commit日志,否则部署分支永远只有一条commit记录。
#命令里面的变量都是在Travis CI里配置过的。
# after_script:
# - git clone https://${GH_REF} .temp
# - cd .temp
# - git checkout gh-pages
# - cd ../
# - mv .temp/.git dist
# - cd dist
# - git config user.name "${U_NAME}"
# - git config user.email "${U_EMAIL}"
# - git add .
# - git commit -m ":construction_worker:- Build & Deploy by Travis CI"
# - git push --force --quiet "https://${Travis_Token}@${GH_REF}" gh-pages:${D_BRANCH}
# E: Build LifeCycle
# 只有指定的分支提交时才会运行脚本
# branches:
# only:
# - master
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
================================================
FILE: CONTRIBUTING.md
================================================
感谢贡献者们
墨抒颖 MoShuYing 刘九江 LiuJiuJiang
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <2021> <刘九江>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
================================================
FILE: README.md
================================================
# project-3 CRM 客户资源管理系统
[](http://commitizen.github.io/cz-cli/) [](https://gitter.im/墨抒颖/project-3-crm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
   
  
### 国内用户请访问[同步仓库](https://gitee.com/moshuying/project-3-crm)
# 简述
[sql文件包含在/mysql文件夹内](https://github.com/moshuying/project-3-crm/blob/main/mysql)
在线演示(向下翻页就有)

系统包括:系统设置、客户管理、营销管理、服务管理、合同管理和统计分析六个功能模块。可满足管理人员日常对客户的资源维护、销售数据分析、潜在和有价值客户分析等需求。
甲方需求文档和演讲ppt位于/docs目录下。较为详细的描述了甲方的功能需求。
- [腾讯文档在线查看甲方需求](https://docs.qq.com/doc/DR0JVbFpmdXNEU1NM)
- [ppt商业计划书在线查看](https://docs.qq.com/slide/DR2dIaXB1b3hVZkdw)
- [商业计划书参考](https://max.book118.com/html/2017/0508/105355794.shtm)
- [sourceforge](https://sourceforge.net/projects/project-3-crm/)
系统经过github工作流,travis集成测试。尽可能多的测试了系统中的功能。
客户关系管理系统用于管理与客户相关的信息与活动,包括企业与顾客间在销售、营销和服务上的交互。从而提升其管理方式,向客户提供创新式的个性化的客户交互和服务。CRM不仅仅是一个软件,它还是方法论、软件和IT能力综合,是一种商业策略。其最终目标是吸引新客户、保留老客户以及将已有客户转为忠实客户。为企业一系列的客户关系管理解决方案。
# contributors
[](https://github.com/moshuying/project-3-crm/graphs/contributors)
部分页面截图






















================================================
FILE: SECURITY.md
================================================
# Security Policy
## Supported Versions
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |
## Reporting a Vulnerability
Use this section to tell people how to report a vulnerability.
Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
================================================
FILE: back/.gitignore
================================================
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
.idea/
target/
*.iml
application-prod.yml
================================================
FILE: back/LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: back/README-zh.md
================================================
# Spring Boot API Seedling


[English](./README.md) | 简体中文
## 简介
本项目修改自:[spring-boot-api-project-seed](https://github.com/lihengming/spring-boot-api-project-seed)
原项目本身很简洁,已经能满足很多基本需求,在此感谢种子作者。
我根据需求继续添加了一些小功能,比如 API 的签名认证、调用文档、一些小工具等,所以就有了该 Seedling 项目。
添加的内容包括:
- Spring Cache:缓存
- Redis:缓存中间件
- Swagger3:API 文档展示
- Spring Security + JWT:对调用方签名认证
- Jasypt:加密配置
- 其他略
代码规范参考阿里巴巴 Java 开发手册,安装 Alibaba Java Coding Guidelines 插件。
风格规范使用 Google,安装 google-java-format 插件。
注解工具:Lombok,安装同名 Idea 插件。
## 版本
| 依赖 | 版本 |
|:-----------:|--------:|
| Java | 1.8 |
| SpringBoot | 2.3.5 |
## 快速开始
\# 克隆项目
git clone https://github.com/Zoctan/spring-boot-api-seedling.git
\# 配置代码生成器
对 test/java 包内的代码生成器 CodeGenerator 进行配置
导入 test/resources/sql 目录下的开发环境 dev 的数据库文件 *.sql
\# 根据表名生成代码
输入表名,运行 CodeGenerator.main() 方法,生成基础代码(观看[种子项目的快速演示视频](http://v.youku.com/v_show/id_XMjg1NjYwNDgxNg==.html?spm=a2h3j.8428770.3416059.1))
\# last
对开发环境配置文件 application-dev.properties 进行配置,启动项目,Have Fun Too:)
## 技术选型&文档
1. Spring Boot([种子项目作者的学习&使用指南](https://www.jianshu.com/p/1a9fd8936bd8) | [基础教程](http://blog.didispace.com/Spring-Boot%E5%9F%BA%E7%A1%80%E6%95%99%E7%A8%8B/))
2. MyBatis([官方中文文档](http://www.mybatis.org/mybatis-3/zh/index.html))
3. MyBatis通用Mapper插件([官方中文文档](https://mapperhelper.github.io/docs/))
4. MyBatis PageHelper分页插件([官方中文文档](https://pagehelper.github.io/))
5. Druid Spring Boot Starter([官方中文文档](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter/))
6. FastJson([官方中文文档](https://github.com/alibaba/fastjson/wiki/Quick-Start-CN) | [W3CSchool使用指南](https://www.w3cschool.cn/fastjson/fastjson-quickstart.html))
## 相关项目
- [前端 Vue + 后端 Spring Boot 完全分离的用户角色管理模板](https://github.com/Zoctan/spring-boot-vue-admin)
## 更新记录
2020-11-09 更新 Swagger2 至 Swagger3,更新其他依赖版本。
2019-08-13 更换 Tomcat 容器为 Jetty,修复 RSA 密钥文件无法读取问题,添加文件上传控制器,更新其他依赖版本。
2018-11-29 配置改为 yml ,完善单元测试,更新其他依赖版本。
2018-07-21 增加 Jasypt 自定义配置和配置密码加密,Tomcat 打包,修改 RSA 工具和添加相应配置。
2018-07-15 增加 DTO 层,避免 DO 层被污染。
2018-07-11 添加了可自定义缓存过期时间的注解,修改了数据表 user 为 account。
================================================
FILE: back/README.md
================================================
# Spring Boot API Seedling


English | [简体中文](./README-zh.md)
## Introduction
Modified from: [spring-boot-api-project-seed](https://github.com/lihengming/spring-boot-api-project-seed)
The original project is very well and has been able to meet many basic needs. Thanks the seed author!
Seedling project:
I continued to add some small functions according to my needs, such as API signature authentication, API documents, some tools, etc.
The added content includes:
- Spring Cache: To cache
- Redis: Cache middleware
- Swagger3:API Doc
- Spring Security + JWT:Sign the caller authentication
- Jasypt:Encryption configuration
- etc.
The code specification refers to the《Alibaba Java Development》 and install the Alibaba Java Coding Guidelines plugin.
The style specification refers to Google and install google-java-format plugin.
Annotation tool: Lombok, install the Idea plugin of the same name.
## Version
| Dependencies | Version |
|:------------:|--------:|
| Java | 1.8 |
| SpringBoot | 2.3.5 |
## Start
\# Clone project
git clone https://github.com/Zoctan/spring-boot-api-seedling.git
\# Configure code generator
configure package test/java/.../CodeGenerator, import directory test/resources/sql/dev/*.sql file
\# Generate code from database schema
input table name, run CodeGenerator.main() method to generate basic code (watch [demo video](http://v.youku.com/v_show/id_XMjg1NjYwNDgxNg==.html?spm=a2h3j.8428770.3416059.1))
\# Last
configure the development environment configuration file application-dev.properties and start the project.
Have Fun Too:)
## Related project
- [前端 Vue + 后端 Spring Boot 完全分离的用户角色管理模板](https://github.com/Zoctan/spring-boot-vue-admin)
## Update log
2020-11-09 Update Swagger2 to Swagger3, update other dependencies version.
2019-08-13 Modify Tomcat to Jetty, read RSA file error have been fixed, add file upload controller, update dependencies version.
2018-11-29 Modify setting file format to yml, improve unit testing, update dependencies version.
2018-07-21 Add Jasypt custom setting and password encryption, add Tomcat pack, modify RSA tool.
2018-07-15 Add DTO to prevent DO pollution.
2018-07-11 Add annotation for customizable cache expiration time, modify the data table user to account.
================================================
FILE: back/pom.xml
================================================
4.0.0com.github.zoctanspring-boot-api-seeding1.1warorg.springframework.bootspring-boot-starter-parent2.3.5.RELEASE1.8UTF-8UTF-85.3.5.RELEASE3.0.00.9.13.3.01.9.41.153.1132.0.0-jre2.1.31.3.74.1.52.1.51.3.01.2.831.2.23.0.32.3.301.18.166.1.6.Finalio.springfoxspringfox-boot-starter${swagger3.version}org.springframework.bootspring-boot-starter-securityio.jsonwebtokenjjwt${jjwt.version}mysqlmysql-connector-javaorg.springframework.bootspring-boot-starter-aoporg.springframework.bootspring-boot-starter-testtestorg.springframework.bootspring-boot-starter-weborg.springframework.bootspring-boot-starter-tomcatorg.springframework.bootspring-boot-starter-jettyorg.springframework.securityspring-security-test${spring-security-test.version}testorg.springframework.bootspring-boot-devtoolstrueorg.springframework.bootspring-boot-starter-cacheorg.springframework.bootspring-boot-starter-data-redisio.lettucelettuce-coreredis.clientsjedis${jedis.version}commons-beanutilscommons-beanutils${commons-beanutils.version}commons-codeccommons-codec${commons-codec.version}org.apache.commonscommons-lang3${commons-lang3.version}com.google.guavaguava${guava.version}com.alibabafastjson${fastjson.version}com.alibabadruid-spring-boot-starter${druid.version}com.github.ulisesbocchiojasypt-spring-boot-starter${jasypt.version}com.github.pagehelperpagehelper-spring-boot-starter${pagehelper.version}org.mybatis.spring.bootmybatis-spring-boot-starter${mybatis.version}tk.mybatismapper${mapper.version}tk.mybatismapper-spring-boot-starter${mapper-starter.version}org.freemarkerfreemarker${freemarker.version}org.mybatis.generatormybatis-generator-core${mybatis-generator.version}org.projectlomboklombok${lombok.version}providedorg.hibernate.validatorhibernate-validator${hibernate.version}${project.artifactId}org.springframework.bootspring-boot-maven-pluginrepackagecom.msy.plus.Applicationmaven-compiler-plugin${java.version}${java.version}aliyun-snapshotshttps://maven.aliyun.com/repository/snapshotsaliyun-repohttps://maven.aliyun.com/repository/centralaliyun-pluginhttps://maven.aliyun.com/repository/central
================================================
FILE: back/resetDB.sh
================================================
#!/bin/bash
db="seedling_dev"
while IFS= read -r -d '' sql; do
echo "$sql"" -> "$db
mysql -uroot -proot $db <"$sql"
done < <(find src/test/resources/sql/dev/ -name '*.sql' -print0)
echo "finished"
echo "import $db done"
================================================
FILE: back/src/main/java/com/msy/plus/Application.java
================================================
package com.msy.plus;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import tk.mybatis.spring.annotation.MapperScan;
import static com.msy.plus.core.constant.ProjectConstant.FILTER_PACKAGE;
import static com.msy.plus.core.constant.ProjectConstant.MAPPER_PACKAGE;
/**
* 主程序
*
* @author MoShuying
* @date 2018/05/27
*/
@EnableCaching
@SpringBootApplication
@EnableEncryptableProperties
@EnableTransactionManagement
@MapperScan(basePackages = MAPPER_PACKAGE)
@ServletComponentScan(basePackages = FILTER_PACKAGE)
public class Application extends SpringBootServletInitializer {
public static void main(final String[] args) {
SpringApplication.run(Application.class, args);
}
/** 容器启动配置 */
@Override
protected SpringApplicationBuilder configure(final SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/aspect/ControllerLogAspect.java
================================================
package com.msy.plus.aspect;
import com.msy.plus.util.IpUtils;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
import java.util.Optional;
import static com.msy.plus.core.constant.ProjectConstant.CONTROLLER_PACKAGE;
/**
* Controller log aspect
*
* @author MoShuying
* @date 2018/07/13
*/
@Aspect
@Slf4j
@Component
public class ControllerLogAspect {
private LocalDateTime startTime;
@Pointcut("execution(* " + CONTROLLER_PACKAGE + "..*.*(..))")
public void controllers() {}
/**
* before controller handling, log something
*
* @param joinPoint controller join point
*/
@Before("controllers()")
public void doBefore(final JoinPoint joinPoint) {
log.debug("===========================================================");
log.debug("================ Controller Log Start ===================");
log.debug("===========================================================");
this.startTime = LocalDateTime.now();
final ServletRequestAttributes attributes =
(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (Optional.ofNullable(attributes).isPresent()) {
final HttpServletRequest request = attributes.getRequest();
log.debug("==> Request: [{}]{}", request.getMethod(), request.getRequestURL());
log.debug("==> From IP: {}", IpUtils.getIpAddress());
}
log.debug(
"==> Method: {}",
joinPoint.getSignature().getDeclaringTypeName() + "#" + joinPoint.getSignature().getName());
log.debug("==> Args: {}", Arrays.toString(joinPoint.getArgs()));
}
/**
* after controller handling, return result
*
* @param result origin result
*/
@AfterReturning(pointcut = "controllers()", returning = "result")
public void doAfterReturning(final Object result) {
// 处理请求的时间差
final long difference = ChronoUnit.MILLIS.between(this.startTime, LocalDateTime.now());
log.debug("==> Spend: {}s", difference / 1000.0);
log.debug("==> Return: {}", result);
log.debug("================ Controller Log End =====================");
}
/**
* log when throwing error
*
* @param e error
*/
@AfterThrowing(pointcut = "controllers()", throwing = "e")
public static void doAfterThrowing(final Throwable e) {
log.debug("==> Exception: {}", e.toString());
e.printStackTrace();
log.debug("================ Controller Log End =====================");
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/AccountController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.jwt.JwtUtil;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.dto.AccountDTO;
import com.msy.plus.dto.AccountLoginDTO;
import com.msy.plus.dto.LoginResultDTO;
import com.msy.plus.service.AccountService;
import com.msy.plus.service.impl.UserDetailsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.*;
/**
* @author MoShuying
* @date 2018/07/15
*/
@Slf4j
@Api(tags={"账户操作接口(登录)"})
@Validated
@RestController
@RequestMapping("/account")
public class AccountController {
@Resource private AccountService accountService;
@Resource private UserDetailsServiceImpl userDetailsService;
@Resource private JwtUtil jwtUtil;
@Operation(summary = "账户注册", description = "注册账户,签发token")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "2004", description = "账户名重复")
})
@PostMapping
public Result register(
@Parameter(required = true) @RequestBody @Valid final AccountDTO accountDTO,
final BindingResult bindingResult) {
// 账户持久化
this.accountService.save(accountDTO);
// 签发 token
final UserDetails userDetails =
this.userDetailsService.loadUserByUsername(accountDTO.getName());
final String token = this.jwtUtil.sign(
accountDTO.getName(),
userDetails.getAuthorities(),
accountService.getByNameWithRole(userDetails.getUsername()).getId());
return ResultGenerator.genOkResult(token);
}
@Operation(summary = "账户登录", description = "账户登录,签发token")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "1000", description = "密码错误")
})
@PostMapping("/token")
public Result login(
@Parameter(required = true) @RequestBody @Valid final AccountLoginDTO accountLoginDTO,
final BindingResult bindingResult) {
// {"name":"admin","password":"admin"}
final String name = accountLoginDTO.getName();
final String password = accountLoginDTO.getPassword();
// 验证账户
final UserDetails userDetails = this.userDetailsService.loadUserByUsername(name);
if (!this.accountService.verifyPassword(password, userDetails.getPassword())) {
return ResultGenerator.genFailedResult("密码错误");
}
// 更新登录时间
this.accountService.updateLoginTimeByName(name);
final String token = this.jwtUtil.sign(name, userDetails.getAuthorities(),accountService.getByNameWithRole(name).getId());
// 返回Ant Design Admin提供的登录返回格式
LoginResultDTO loginResultDTO = new LoginResultDTO();
// 设置过期时间,和application-*.yml文件中的过期时间设定一致
final long expireTime = this.jwtUtil.getJwtProperties().getExpireTime().toMillis();
loginResultDTO.setExpireAt(new Date(new Date().getTime()+expireTime));
loginResultDTO.setToken(token);
loginResultDTO.setUserName(name);
Map roles = new HashMap();
roles.put("id",name);
roles.put("operation",new String[]{"add","edit","delete"});
loginResultDTO.getRoles().add(roles);
loginResultDTO.setMessage("欢迎回来 "+name);
return ResultGenerator.genOkResult(loginResultDTO);
}
@Operation(summary = "账户注销", description = "账户注销,使token失效")
@ApiResponses({@ApiResponse(responseCode = "200", description = "OK")})
@DeleteMapping("/token")
public Result logout(@RequestHeader Map headers) {
String header = jwtUtil.getJwtProperties().getHeader();
jwtUtil.invalidRedisToken(jwtUtil.getName(headers.get(header)).get());
return ResultGenerator.genOkResult();
}
@PreAuthorize("#accountDTO.name == authentication.name or hasAuthority('ADMIN')")
@Operation(summary = "更新账户", description = "更新账户信息")
@ApiResponses({@ApiResponse(responseCode = "200", description = "OK")})
@PatchMapping
public Result update(@Parameter(required = true) @RequestBody final AccountDTO accountDTO) {
this.accountService.updateByName(accountDTO);
return ResultGenerator.genOkResult();
}
@PreAuthorize("hasAuthority('ADMIN')" +
"or hasAuthority('主席')"+
"or hasAuthority('高级主席')"+
"or hasAuthority('副主席')"+
"or hasAuthority('总裁')")
@Operation(summary = "删除账户", description = "删除账户信息")
@ApiResponses({@ApiResponse(responseCode = "200", description = "OK")})
@Parameter(
name = "id",
description = "账户Id",
required = true,
in = ParameterIn.QUERY,
example = "1")
@DeleteMapping("/{id}")
public Result delete(@PathVariable final Long id) {
this.accountService.deleteById(id);
return ResultGenerator.genOkResult();
}
//
// @Operation(summary = "获取单个账户", description = "获取单个账户信息")
// @ApiResponses({@ApiResponse(responseCode = "200", description = "OK")})
// @Parameter(
// name = "id",
// description = "账户Id",
// required = true,
// in = ParameterIn.PATH,
// example = "1")
// @GetMapping("/{id}")
// public Result detail(@PathVariable final Long id) {
// final AccountWithRoleDO account = this.accountService.getByIdWithRole(id);
// return ResultGenerator.genOkResult(account);
// }
//
// @Operation(summary = "获取账户列表", description = "获取多个账户信息")
// @ApiResponses({@ApiResponse(responseCode = "200", description = "OK")})
// @Parameters({
// @Parameter(name = "page", description = "页号", in = ParameterIn.QUERY, example = "1"),
// @Parameter(name = "size", description = "页大小", in = ParameterIn.QUERY, example = "10")
// })
// @Cacheable(value = "account.list", unless = "#result == null or #result.code != 200")
// @CacheExpire(expire = 60)
// @GetMapping
// public Result list(
// @RequestParam(defaultValue = "0") final Integer page,
// @RequestParam(defaultValue = "0") final Integer size) {
// AccountController.log.debug("==> No cache, find database");
// PageHelper.startPage(page, size);
// final List list = this.accountService.listAll();
// final PageInfo pageInfo = PageInfo.of(list);
// // 不显示 password 字段
// final PageInfo objectPageInfo = JsonUtils.deleteFields(pageInfo, PageInfo.class, "password");
// return ResultGenerator.genOkResult(objectPageInfo);
// }
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/AnalysisController.java
================================================
package com.msy.plus.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.msy.plus.core.jwt.JwtUtil;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.dto.AnalysisQuery;
import com.msy.plus.entity.*;
import com.msy.plus.service.CustomerManagerService;
import com.msy.plus.service.EmployeeService;
import com.msy.plus.service.RoleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author MoShuYing
* @date 2021/05/15
*/
@PreAuthorize(
"hasAuthority('ADMIN')"+
"or hasAuthority('董事长')"+
"or hasAuthority('主席')"+
"or hasAuthority('高级主席')"+
"or hasAuthority('副主席')"+
"or hasAuthority('总裁')"+
"or hasAuthority('会长')"+
"or hasAuthority('高级总裁')"+
"or hasAuthority('高级副总裁')"+
"or hasAuthority('副总裁')"+
"or hasAuthority('总经理')"+
"or hasAuthority('副总经理')"+
"or hasAuthority('总监')"+
"or hasAuthority('经理')"+
"or hasAuthority('高级经理')"+
"or hasAuthority('副经理')"+
"or hasAuthority('主任')"+
"or hasAuthority('高级主任')"+
"or hasAuthority('副主任')"+
"or hasAuthority('组长')"+
"or hasAuthority('副组长')"+
"or hasAuthority('普通员工')"+
"or hasAuthority('人事专员')"+
"or hasAuthority('市场专员')"+
"or hasAuthority('市场主管')"+
"or hasAuthority('销售主管')"
)
@Api(tags={"统计分析接口"})
@RestController
@RequestMapping("/analysis")
public class AnalysisController {
@Resource CustomerManagerService customerManagerService;
@Resource EmployeeService employeeService;
@Resource RoleService roleService;
@Resource private JwtUtil jwtUtil;
@Operation(description = "统计分析")
@PostMapping
public Result listAndSearch(@RequestBody AnalysisQuery analysisQuery,@RequestHeader Map headers) {
String header = jwtUtil.getJwtProperties().getHeader();
String id= jwtUtil.getId(headers.get(header)).get();
List roleIds = employeeService.getDetailById(Integer.valueOf(id).longValue()).getRoleIds();
for(Long roleId:roleIds){
RoleWithPermissionDO roleWithPermissionDO = roleService.getDetailById(roleId);
if(roleWithPermissionDO==null) {
continue;
}
String roleName = roleWithPermissionDO.getName();
if(roleName==null || roleName.isEmpty()){
continue;
}
if(roleName.equals("董事长")){
PageHelper.startPage(analysisQuery.getPage(),analysisQuery.getSize());
PageInfo pageInfo = PageInfo.of(customerManagerService.queryAnalysis(analysisQuery));
return ResultGenerator.genOkResult(pageInfo);
}
}
// 除了董事长 其他人都只能查看自己的
analysisQuery.setName(jwtUtil.getName(headers.get(header)).get());
PageHelper.startPage(analysisQuery.getPage(),analysisQuery.getSize());
PageInfo pageInfo = PageInfo.of(customerManagerService.queryAnalysis(analysisQuery));
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/CustomerFollowUpHistoryController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.jwt.JwtUtil;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.entity.CFUHSearch;
import com.msy.plus.entity.CustomerFollowUpHistory;
import com.msy.plus.service.CustomerFollowUpHistoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author MoShuYing
* @date 2021/05/21
*/
@PreAuthorize("hasAuthority('ADMIN')")
@Api(tags={"客户跟进记录接口"})
@RestController
@RequestMapping("/customer/follow/up/history")
public class CustomerFollowUpHistoryController {
@Resource private CustomerFollowUpHistoryService customerFollowUpHistoryService;
@Resource private JwtUtil jwtUtil;
@Operation(description = "客户跟进记录添加")
@PostMapping
public Result add(@RequestBody CustomerFollowUpHistory customerFollowUpHistory,@RequestHeader Map headers) {
if(customerFollowUpHistory.getId()!=null){
customerFollowUpHistory.setId(null);
}
String header = jwtUtil.getJwtProperties().getHeader();
String id= jwtUtil.getId(headers.get(header)).get();
customerFollowUpHistory.setInputuser(Integer.valueOf(id));
customerFollowUpHistoryService.save(customerFollowUpHistory);
return ResultGenerator.genOkResult();
}
// @Operation(description = "客户跟进记录删除")
// @DeleteMapping("/{id}")
// public Result delete(@PathVariable Long id) {
// customerFollowUpHistoryService.deleteById(id);
// return ResultGenerator.genOkResult();
// }
@Operation(description = "客户跟进记录更新")
@PutMapping
public Result update(@RequestBody CustomerFollowUpHistory customerFollowUpHistory) {
customerFollowUpHistoryService.update(customerFollowUpHistory);
return ResultGenerator.genOkResult();
}
@Operation(description = "客户跟进记录获取详细信息")
@GetMapping("/{id}")
public Result detail(@PathVariable Long id) {
CustomerFollowUpHistory customerFollowUpHistory = customerFollowUpHistoryService.getById(id);
return ResultGenerator.genOkResult(customerFollowUpHistory);
}
@Operation(description = "客户跟进记录分页查询")
@GetMapping
@ApiOperation(value="分页查询客户跟进记录", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "") String keyword,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date startTime,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date endTime,
@RequestParam(required = false) Integer type) {
PageHelper.startPage(page, size);
List list = customerFollowUpHistoryService.listAndSearch(keyword,startTime,endTime,type);
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/CustomerHandoverController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.jwt.JwtUtil;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.dto.CustomerHandoverList;
import com.msy.plus.entity.CustomerHandover;
import com.msy.plus.service.CustomerHandoverService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author MoShuYing
* @date 2021/05/21
*/
@PreAuthorize(
"hasAuthority('ADMIN')"+
"or hasAuthority('董事长')"+
"or hasAuthority('主席')"+
"or hasAuthority('高级主席')"+
"or hasAuthority('副主席')"+
"or hasAuthority('总裁')"+
"or hasAuthority('会长')"+
"or hasAuthority('高级总裁')"+
"or hasAuthority('高级副总裁')"+
"or hasAuthority('副总裁')"+
"or hasAuthority('总经理')"+
"or hasAuthority('副总经理')"+
"or hasAuthority('总监')"+
"or hasAuthority('经理')"+
"or hasAuthority('高级经理')"+
"or hasAuthority('副经理')"+
"or hasAuthority('主任')"+
"or hasAuthority('高级主任')"+
"or hasAuthority('副主任')"+
"or hasAuthority('组长')"+
"or hasAuthority('副组长')"+
"or hasAuthority('普通员工')"+
"or hasAuthority('人事专员')"+
"or hasAuthority('市场专员')"+
"or hasAuthority('市场主管')"+
"or hasAuthority('销售主管')"
)
@Api(tags={"移交历史接口"})
@RestController
@RequestMapping("/customer/handover")
public class CustomerHandoverController {
@Resource private CustomerHandoverService customerHandoverService;
@Resource private JwtUtil jwtUtil;
@Operation(description = "移交历史添加")
@PostMapping
public Result add(@RequestBody CustomerHandover customerHandover,@RequestHeader Map headers) {
if(customerHandover.getId()!=null){
customerHandover.setId(null);
}
String header = jwtUtil.getJwtProperties().getHeader();
String id= jwtUtil.getId(headers.get(header)).get();
customerHandover.setTransuser(Integer.valueOf(id));
customerHandoverService.save(customerHandover);
return ResultGenerator.genOkResult();
}
// @Operation(description = "移交历史删除")
// @DeleteMapping("/{id}")
// public Result delete(@PathVariable Long id) {
// customerHandoverService.deleteById(id);
// return ResultGenerator.genOkResult();
// }
//
// @Operation(description = "移交历史更新")
// @PutMapping
// public Result update(@RequestBody CustomerHandover customerHandover) {
// customerHandoverService.update(customerHandover);
// return ResultGenerator.genOkResult();
// }
//
// @Operation(description = "移交历史获取详细信息")
// @GetMapping("/{id}")
// public Result detail(@PathVariable Long id) {
// CustomerHandover customerHandover = customerHandoverService.getById(id);
// return ResultGenerator.genOkResult(customerHandover);
// }
@Operation(description = "移交历史分页查询")
@GetMapping
@ApiOperation(value="分页查询移交历史", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "") String keyword,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date startTime,
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) Date endTime) {
PageHelper.startPage(page, size);
List list = customerHandoverService.listAndSearch(keyword,startTime,endTime);
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/CustomerManagerController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.jwt.JwtUtil;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.dto.CustomerManagerList;
import com.msy.plus.entity.CustomerManager;
import com.msy.plus.service.CustomerManagerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author MoShuYing
* @date 2021/05/20
*/
@PreAuthorize(
"hasAuthority('ADMIN')"+
"or hasAuthority('董事长')"+
"or hasAuthority('主席')"+
"or hasAuthority('高级主席')"+
"or hasAuthority('副主席')"+
"or hasAuthority('总裁')"+
"or hasAuthority('会长')"+
"or hasAuthority('高级总裁')"+
"or hasAuthority('高级副总裁')"+
"or hasAuthority('副总裁')"+
"or hasAuthority('总经理')"+
"or hasAuthority('副总经理')"+
"or hasAuthority('总监')"+
"or hasAuthority('经理')"+
"or hasAuthority('高级经理')"+
"or hasAuthority('副经理')"+
"or hasAuthority('主任')"+
"or hasAuthority('高级主任')"+
"or hasAuthority('副主任')"+
"or hasAuthority('组长')"+
"or hasAuthority('副组长')"+
"or hasAuthority('普通员工')"+
"or hasAuthority('人事专员')"+
"or hasAuthority('市场专员')"+
"or hasAuthority('市场主管')"+
"or hasAuthority('销售主管')"
)
@Api(tags={"客户管理接口"})
@RestController
@RequestMapping("/customer/manager")
public class CustomerManagerController {
@Resource private CustomerManagerService customerManagerService;
@Resource private JwtUtil jwtUtil;
@Operation(description = "客户管理添加")
@PostMapping
public Result add(@RequestBody CustomerManager customerManager,@RequestHeader Map headers) {
if(customerManager.getId()!=null){
customerManager.setId(null);
}
String header = jwtUtil.getJwtProperties().getHeader();
String id= jwtUtil.getId(headers.get(header)).get();
customerManager.setInputuser(Integer.valueOf(id));
customerManager.setSeller(Integer.valueOf(id));
customerManagerService.save(customerManager);
return ResultGenerator.genOkResult();
}
// @Operation(description = "客户管理删除")
// @DeleteMapping("/{id}")
// public Result delete(@PathVariable Long id) {
// customerManagerService.deleteById(id);
// return ResultGenerator.genOkResult();
// }
@Operation(description = "客户管理更新")
@PutMapping
public Result update(@RequestBody CustomerManager customerManager) {
customerManagerService.update(customerManager);
return ResultGenerator.genOkResult();
}
@Operation(description = "客户管理获取详细信息")
@GetMapping("/{id}")
public Result detail(@PathVariable Long id) {
CustomerManager customerManager = customerManagerService.getById(id);
return ResultGenerator.genOkResult(customerManager);
}
@Operation(description = "客户管理分页查询")
@GetMapping
@ApiOperation(value="分页查询客户管理", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "",required = false) String keyword,
@RequestParam(required = false) Integer status) {
PageHelper.startPage(page, size);
List list = customerManagerService.listAllWithDictionary(keyword,status);
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/DepartmentController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.entity.Department;
import com.msy.plus.service.DepartmentService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author MoShuYing
* @date 2021/05/12
*/
@PreAuthorize(
"hasAuthority('ADMIN') " +
"or hasAuthority('董事长') " +
"or hasAuthority('主席') " +
"or hasAuthority('高级主席') " +
"or hasAuthority('副主席') " +
"or hasAuthority('总裁') " +
"or hasAuthority('会长') " +
"or hasAuthority('高级总裁') " +
"or hasAuthority('高级副总裁')")
@Api(tags={"部门接口"})
@RestController
@RequestMapping("/department")
public class DepartmentController {
@Resource
private DepartmentService departmentService;
@Operation(description = "部门添加")
@PostMapping
public Result add(@RequestBody Department department) {
departmentService.save(department);
return ResultGenerator.genOkResult();
}
@Operation(description = "部门删除")
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
departmentService.deleteById(id);
return ResultGenerator.genOkResult();
}
@Operation(description = "部门更新")
@PatchMapping
public Result update(@RequestBody Department department) {
departmentService.update(department);
return ResultGenerator.genOkResult();
}
@Operation(description = "获取部门详细信息")
@GetMapping("/{id}")
public Result detail(@PathVariable Long id) {
Department department = departmentService.getById(id);
return ResultGenerator.genOkResult(department);
}
@Operation(description = "分页查询部门")
@GetMapping
@ApiOperation(value="分页查询部门", notes="分页查询")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
PageHelper.startPage(page, size);
List list = departmentService.listAll();
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/DictionaryContentsController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.entity.DictionaryContents;
import com.msy.plus.service.DictionaryContentsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author MoShuYing
* @date 2021/05/18
*/
@PreAuthorize("hasAuthority('ADMIN')")
@Api(tags={"数据字典接口"})
@RestController
@RequestMapping("/dictionary/contents")
public class DictionaryContentsController {
@Resource
private DictionaryContentsService dictionaryContentsService;
@Operation(description = "数据字典添加")
@PostMapping
public Result add(@RequestBody DictionaryContents dictionaryContents) {
dictionaryContentsService.save(dictionaryContents);
return ResultGenerator.genOkResult();
}
// @Operation(description = "数据字典删除")
// @DeleteMapping("/{id}")
// public Result delete(@PathVariable Long id) {
// dictionaryContentsService.deleteById(id);
// return ResultGenerator.genOkResult();
// }
@Operation(description = "数据字典更新")
@PutMapping
public Result update(@RequestBody DictionaryContents dictionaryContents) {
dictionaryContentsService.update(dictionaryContents);
return ResultGenerator.genOkResult();
}
@Operation(description = "数据字典获取详细信息")
@GetMapping("/{id}")
public Result detail(@PathVariable Long id) {
DictionaryContents dictionaryContents = dictionaryContentsService.getById(id);
return ResultGenerator.genOkResult(dictionaryContents);
}
@Operation(description = "数据字典分页查询")
@GetMapping
@ApiOperation(value="分页查询数据字典", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "null") String keyword) {
String inKeyword = null;
if (!(keyword == null || keyword.equals("null"))) {
inKeyword = keyword;
}
PageHelper.startPage(page, size);
List list = dictionaryContentsService.listWithKeyword(inKeyword);
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/DictionaryDetailsController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.entity.DictionaryContents;
import com.msy.plus.entity.DictionaryDetails;
import com.msy.plus.service.DictionaryDetailsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author MoShuYing
* @date 2021/05/18
*/
@PreAuthorize("hasAuthority('ADMIN')")
@Api(tags={"数据字典明细接口"})
@RestController
@RequestMapping("/dictionary/details")
public class DictionaryDetailsController {
@Resource
private DictionaryDetailsService dictionaryDetailsService;
@Operation(description = "数据字典明细添加")
@PostMapping
public Result add(@RequestBody DictionaryDetails dictionaryDetails) {
dictionaryDetailsService.save(dictionaryDetails);
return ResultGenerator.genOkResult();
}
// @Operation(description = "数据字典明细删除")
// @DeleteMapping("/{id}")
// public Result delete(@PathVariable Long id) {
// dictionaryDetailsService.deleteById(id);
// return ResultGenerator.genOkResult();
// }
@Operation(description = "数据字典明细更新")
@PutMapping
public Result update(@RequestBody DictionaryDetails dictionaryDetails) {
dictionaryDetailsService.update(dictionaryDetails);
return ResultGenerator.genOkResult();
}
@Operation(description = "数据字典明细获取详细信息")
@GetMapping("/{id}")
public Result detail(@PathVariable Long id) {
DictionaryDetails dictionaryDetails = dictionaryDetailsService.getById(id);
return ResultGenerator.genOkResult(dictionaryDetails);
}
@Operation(description = "数据字典明细分页查询")
@GetMapping
@ApiOperation(value="分页查询数据字典明细", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(defaultValue = "1") Integer id,
@RequestParam(defaultValue = "null") String keyword) {
String inKeyword = null;
if (!(keyword == null || keyword.equals("null"))) {
inKeyword = keyword;
}
Integer inId = Integer.valueOf(id);
if(inId==null){
inId = dictionaryDetailsService.listAll().get(0).getId();
}
PageHelper.startPage(page, size);
List list = dictionaryDetailsService.listWithKeyword(inId.intValue(),inKeyword);
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/EmployeeController.java
================================================
package com.msy.plus.controller;
import com.alibaba.fastjson.JSONObject;
import com.msy.plus.core.jwt.JwtUtil;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.entity.Employee;
import com.msy.plus.entity.EmployeeDetail;
import com.msy.plus.entity.EmployeeWithRoleDO;
import com.msy.plus.service.EmployeeService;
import com.msy.plus.util.JsonUtils;
import com.msy.plus.util.RedisUtils;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author MoShuYing
* @date 2021/05/15
*/
@PreAuthorize(
"hasAuthority('ADMIN')"+
"or hasAuthority('董事长')"+
"or hasAuthority('主席')"+
"or hasAuthority('高级主席')"+
"or hasAuthority('副主席')"+
"or hasAuthority('总裁')"+
"or hasAuthority('会长')"+
"or hasAuthority('高级总裁')"+
"or hasAuthority('高级副总裁')"+
"or hasAuthority('副总裁')"+
"or hasAuthority('总经理')"+
"or hasAuthority('副总经理')"+
"or hasAuthority('总监')"+
"or hasAuthority('经理')"+
"or hasAuthority('高级经理')"+
"or hasAuthority('副经理')"+
"or hasAuthority('主任')"+
"or hasAuthority('高级主任')"+
"or hasAuthority('副主任')"+
"or hasAuthority('组长')"+
"or hasAuthority('副组长')"+
"or hasAuthority('人事专员')"+
"or hasAuthority('市场专员')"+
"or hasAuthority('市场主管')"+
"or hasAuthority('销售主管')"
)
@Api(tags={"员工接口"})
@RestController
@RequestMapping("/employee")
public class EmployeeController {
@Resource
private EmployeeService employeeService;
@Resource private PasswordEncoder passwordEncoder;
@Resource private JwtUtil jwtUtil;
@Operation(description = "员工添加")
@PostMapping
public Result add(@RequestBody EmployeeDetail employee) {
if (employee.getId()!=null){
employee.setId(null);
}
if(employee.getDept() ==null){
return ResultGenerator.genFailedResult("请填写员工部门信息");
}
if(employee.getPassword()!=null && employee.getPassword().length()<=5){
return ResultGenerator.genFailedResult("密码长度不能少于或等于五位");
}
employee.setPassword(this.passwordEncoder.encode(employee.getPassword().trim()));
try{
employeeService.save(employee);
}catch (Exception e){
e.printStackTrace();
String msg = "信息有误";
if(e.toString().contains("for key 'employee.employee_name_uindex'")){
msg = "已有同名员工,请检查员工名称";
}else if(e.toString().contains("for key 'employee.employee_email_uindex'")){
msg = "已有同名邮箱,请检查员工邮箱";
}
return ResultGenerator.genFailedResult(msg);
}
if(!(employee.getRoleIds() ==null || employee.getRoleIds().size()<1)){
employeeService.saveRoles(employee.getId(),employee.getRoleIds());
}
return ResultGenerator.genOkResult();
}
@Operation(description = "员工删除")
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
employeeService.deleteById(id);
employeeService.deleteEmployeeWithRole(id);
return ResultGenerator.genOkResult();
}
@Operation(description = "员工更新")
@PutMapping
public Result update(@RequestBody EmployeeDetail employee,@RequestHeader Map headers) {
if(employee.getName().equals("admin")){
return ResultGenerator.genFailedResult("禁止修改管理员角色!");
}
// 更新员工基本信息
if(employee.getDept() ==null){
return ResultGenerator.genFailedResult("请填写员工部门信息");
}
if(employee.getPassword()!=null){
if(employee.getPassword().length()<=5){
return ResultGenerator.genFailedResult("密码长度不能少于或等于五位");
}
employee.setPassword(this.passwordEncoder.encode(employee.getPassword().trim()));
}
try{
employeeService.update((Employee) employee);
}catch (Exception e){
e.printStackTrace();
String msg = "信息有误";
if(e.toString().contains("for key 'employee.employee_name_uindex'")){
msg = "已有同名员工,请检查员工名称";
}else if(e.toString().contains("for key 'employee.employee_email_uindex'")){
msg = "已有同名邮箱,请检查员工邮箱";
}
return ResultGenerator.genFailedResult(msg);
}
List now= employee.getRoleIds();
if(now==null) {
return ResultGenerator.genOkResult();
}
List raw = this.employeeService.getAllEmployeeRoleTableRow(employee.getId());
// diff运算
List adds = new ArrayList<>();
List removes = new ArrayList<>();
for(Long i:now){
if(!raw.contains(i)){
adds.add(i);
}
}
for(Long i:raw){
if(!now.contains(i)){
removes.add(i);
}
}
// 更新权限即注销对应用户登录
if(!adds.isEmpty() || !removes.isEmpty()){
jwtUtil.invalidRedisToken(employee.getName());
}
if(!adds.isEmpty()){
this.employeeService.saveRoles(employee.getId(),adds);
}
if(!removes.isEmpty()){
for(Long i :removes){
this.employeeService.deleteEmployeeWithRoleItem(employee.getId(),i);
}
}
return ResultGenerator.genOkResult();
}
@Operation(description = "员工获取详细信息")
@GetMapping("/{id}")
public Result detail(@PathVariable Long id) {
EmployeeDetail employee = employeeService.getDetailById(id);
final EmployeeDetail object = JsonUtils.deleteFields(employee, EmployeeDetail.class, "password");
return ResultGenerator.genOkResult(object);
}
@Operation(description = "员工分页查询")
@GetMapping
@ApiOperation(value="分页查询员工", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(
@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size,
@RequestParam(required = false) Integer dept,
@RequestParam(defaultValue = "") String keyword) {
PageHelper.startPage(page, size);
List list = employeeService.listEmployeeWithRole(keyword, dept);
PageInfo pageInfo = PageInfo.of(list);
// 不显示 password 字段
final PageInfo objectPageInfo = JsonUtils.deleteFields(pageInfo, PageInfo.class, "password");
return ResultGenerator.genOkResult(objectPageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/PermissionController.java
================================================
package com.msy.plus.controller;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.entity.Permission;
import com.msy.plus.service.PermissionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author MoShuYing
* @date 2021/05/14
*/
@PreAuthorize("hasAuthority('ADMIN')")
@Api(tags={"权限接口"})
@RestController
@RequestMapping("/permission")
public class PermissionController {
@Resource
private PermissionService permissionService;
//
// @Operation(description = "权限添加")
// @PostMapping
// public Result add(@RequestBody Permission permission) {
// permissionService.save(permission);
// return ResultGenerator.genOkResult();
// }
@Operation(description = "权限删除")
@DeleteMapping("/{id}")
public Result delete(@PathVariable Long id) {
permissionService.deleteById(id);
return ResultGenerator.genOkResult();
}
// @Operation(description = "权限更新")
// @PutMapping
// public Result update(@RequestBody Permission permission) {
// permissionService.update(permission);
// return ResultGenerator.genOkResult();
// }
// @Operation(description = "权限获取详细信息")
// @GetMapping("/{id}")
// public Result detail(@PathVariable Long id) {
// Permission permission = permissionService.getById(id);
// return ResultGenerator.genOkResult(permission);
// }
@Operation(description = "权限分页查询")
@GetMapping
@ApiOperation(value="分页查询权限", notes="分页查询 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(@RequestParam(defaultValue = "1") Integer page,
@RequestParam(defaultValue = "10") Integer size) {
PageHelper.startPage(page, size);
List list = permissionService.listAll();
PageInfo pageInfo = PageInfo.of(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/controller/RoleController.java
================================================
package com.msy.plus.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.msy.plus.core.response.Result;
import com.msy.plus.core.response.ResultGenerator;
import com.msy.plus.dto.RoleWithPermissionDTO;
import com.msy.plus.entity.RoleDO;
import com.msy.plus.entity.RolePermissionDO;
import com.msy.plus.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*;
/**
* 角色控制器
*
* @author MoShuying
* @date 2018/05/27
*/
@PreAuthorize("hasAuthority('ADMIN')")
@Api(tags={"角色接口"})
@RestController
@RequestMapping("/role")
public class RoleController {
@Resource private RoleService roleService;
@Operation(description = "角色添加")
@PostMapping
public Result add(@RequestBody final RoleWithPermissionDTO roleDTO) {
if(roleDTO.getPermissions()==null){
return ResultGenerator.genFailedResult("尚未添加角色权限");
}
try{
this.roleService.save(roleDTO);
}catch (DuplicateKeyException e){
return ResultGenerator.genFailedResult("提交的信息中包含已存在的字段");
}
List temp = new ArrayList<>();
roleDTO.getPermissions().forEach(e->{ temp.add(e.getId()); });
this.roleService.savePermissions(roleDTO.getId(),temp);
return ResultGenerator.genOkResult();
}
@Operation(description = "角色删除")
@DeleteMapping("/{id}")
public Result delete(@PathVariable final Long id) {
List raw = this.roleService.getAllRolePermissionTableRow(id);
for(RolePermissionDO e :raw){
this.roleService.deleteRolePermissionItem(id,e.getPermission_id());
}
this.roleService.deleteById(id);
return ResultGenerator.genOkResult();
}
@Operation(description = "角色更新")
@PutMapping
public Result update(@RequestBody final RoleWithPermissionDTO roleWithPermissionDTO) {
// 更新用户基本信息
this.roleService.update(roleWithPermissionDTO);
List nowPermissions = new ArrayList<>();
if(roleWithPermissionDTO.getPermissions()==null){
return ResultGenerator.genOkResult();
}
List rawPer = this.roleService.getAllRolePermissionTableRow(roleWithPermissionDTO.getId());
// 表中权限信息去重
Set raw = new HashSet<>();
for(RolePermissionDO e: rawPer){
raw.add(e.getPermission_id());
}
roleWithPermissionDTO.getPermissions().forEach(e->{ nowPermissions.add(e.getId()); });
// diff运算
Set adds = new HashSet<>();
Set removes = new HashSet<>();
// 如果修改后的不包含原来的 那么为新增元素
for(Long i:nowPermissions){
if(!raw.contains(i)){
adds.add(i);
}
}
// 如果原来的不包含修改后的 那么是删除元素
for(Long i:raw){
if(!nowPermissions.contains(i)){
removes.add(i);
}
}
if(!adds.isEmpty()){
this.roleService.savePermissions(roleWithPermissionDTO.getId(),new ArrayList<>(adds));
}
if(!removes.isEmpty()){
removes.forEach(e->{
this.roleService.deleteRolePermissionItem(roleWithPermissionDTO.getId(),e);
});
}
return ResultGenerator.genOkResult();
}
@Operation(description = "角色详情")
@GetMapping("/{id}")
public Result detail(@PathVariable final Long id) {
final RoleDO role = this.roleService.getDetailById(id);
return ResultGenerator.genOkResult(role);
}
@Operation(description = "角色列表")
@GetMapping
@ApiOperation(value="分页查询角色", notes="分页查询角色列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "第几页", required = true, dataType = "Integer", paramType="query"),
@ApiImplicitParam(name = "size", value = "一页有几条", required = true, dataType = "Integer", paramType="query")
})
public Result list(
@RequestParam(defaultValue = "1") final Integer page,
@RequestParam(defaultValue = "10") final Integer size) {
PageHelper.startPage(page, size);
final List list = this.roleService.listAll();
final PageInfo pageInfo = new PageInfo<>(list);
return ResultGenerator.genOkResult(pageInfo);
}
}
================================================
FILE: back/src/main/java/com/msy/plus/core/cache/CacheExpire.java
================================================
package com.msy.plus.core.cache;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
/**
* 缓存过期注解
*
* @author MoShuying
* @date 2018/07/11
*/
@Inherited
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface CacheExpire {
/** 过期时间,默认 60s */
@AliasFor("expire")
long value() default 60L;
/** 过期时间,默认 60s */
@AliasFor("value")
long expire() default 60L;
}
================================================
FILE: back/src/main/java/com/msy/plus/core/cache/MyRedisCacheManager.java
================================================
package com.msy.plus.core.cache;
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.cache.Cache;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.data.redis.cache.RedisCache;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.cache.RedisCacheWriter;
import org.springframework.data.redis.serializer.RedisSerializationContext;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.lang.NonNull;
import org.springframework.util.ReflectionUtils;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.Callable;
/**
* Redis 容易出现缓存问题(超时、Redis 宕机等),当使用 spring cache 的注释 Cacheable、Cacheput 等处理缓存问题时, 我们无法使用 try catch
* 处理出现的异常,所以最后导致结果是整个服务报错无法正常工作。 通过自定义 MyRedisCacheManager 并继承 RedisCacheManager 来处理异常可以解决这个问题
*
*
http://www.spring4all.com/article/937
*
* @author MoShuying
* @date 2018/07/11
*/
@Slf4j
public class MyRedisCacheManager extends RedisCacheManager
implements ApplicationContextAware, InitializingBean {
/** key serializer */
public static final StringRedisSerializer STRING_SERIALIZER = new StringRedisSerializer();
/**
* value serializer
*
*