├── community-management-system-fe ├── .browserslistrc ├── src │ ├── mock │ │ ├── getAllDistrict.js │ │ ├── getSecretQuestion.js │ │ ├── OfficerGetDistrictName.js │ │ ├── getOptionsWhileEditingOfficerScope.js │ │ ├── gridSelector.js │ │ ├── officerManageSearchResult.js │ │ ├── userInfoShow.js │ │ ├── charts.js │ │ ├── chartsForAll.js │ │ ├── officerManageTableData.js │ │ ├── userManageTableData.js │ │ └── logs.js │ ├── utils │ │ ├── resErrorHandler.js │ │ ├── LeanCloudMessage.js │ │ ├── alioss.js │ │ ├── burringPoint.js │ │ └── chartOptions.js │ ├── mixins │ │ └── logout.js │ ├── store │ │ └── index.js │ ├── App.vue │ ├── assets │ │ ├── styles │ │ │ └── common.scss │ │ └── data │ │ │ └── china-nations.js │ ├── components │ │ ├── finalResetPassword.vue │ │ ├── common-header.vue │ │ ├── secretVerify.vue │ │ ├── phoneCodeVerify.vue │ │ ├── announcementList.vue │ │ └── common-aside.vue │ ├── views │ │ ├── subviews │ │ │ ├── search.vue │ │ │ ├── passwordReset.vue │ │ │ ├── editAnnouncement.vue │ │ │ ├── setPasswordProtect.vue │ │ │ ├── OfficerAddUser.vue │ │ │ ├── announcementManage.vue │ │ │ ├── editLog.vue │ │ │ └── logManage.vue │ │ └── DashBoard.vue │ ├── main.js │ └── router │ │ └── index.js ├── vue.config.js ├── public │ ├── favicon.ico │ └── index.html ├── babel.config.js ├── .gitignore ├── .eslintrc.js └── package.json ├── 社会综合治理系统功能规格说明书.docx └── community-management-system-be ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java ├── src ├── main │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── csgs │ │ │ ├── entity │ │ │ ├── LoginState.java │ │ │ ├── LogTypeResult.java │ │ │ ├── GridEntity.java │ │ │ ├── LogTimeResult.java │ │ │ ├── OfGrid.java │ │ │ ├── CreateGridInfo.java │ │ │ ├── JournalTypeEntity.java │ │ │ ├── AreaList.java │ │ │ ├── AdministratorEntity.java │ │ │ ├── UserSign.java │ │ │ ├── PermissionEntity.java │ │ │ ├── UserEntity.java │ │ │ ├── DistrictInfo.java │ │ │ ├── CommunityInfo.java │ │ │ ├── PageQuery.java │ │ │ ├── GridPersonalInfo.java │ │ │ ├── DistrictEntity.java │ │ │ ├── InsertCommunityId.java │ │ │ ├── User.java │ │ │ ├── Journal.java │ │ │ ├── Announcement.java │ │ │ ├── JournalEntity.java │ │ │ ├── AnnouncementEntity.java │ │ │ ├── FeLog.java │ │ │ ├── PwdProEntity.java │ │ │ ├── CommunityInfoEntity.java │ │ │ ├── ProfileInfo.java │ │ │ └── UserProfile.java │ │ │ ├── mapper │ │ │ ├── PermissionMapper.java │ │ │ ├── DistrictMapper.java │ │ │ ├── JournalTypeMapper.java │ │ │ ├── FeLogMapper.java │ │ │ ├── AnnouncementMapper.java │ │ │ ├── JournalMapper.java │ │ │ ├── PwdProMapper.java │ │ │ ├── GridMapper.java │ │ │ ├── ProfileMapper.java │ │ │ ├── UserMapper.java │ │ │ └── CommunityInfoMapper.java │ │ │ ├── docker │ │ │ └── Dockerfile │ │ │ ├── service │ │ │ ├── UserSignService.java │ │ │ ├── UserProfileService.java │ │ │ ├── ResidentService.java │ │ │ ├── LeaderViewService.java │ │ │ ├── UserPwdProService.java │ │ │ ├── LuceneService.java │ │ │ ├── GridQueryService.java │ │ │ ├── impl │ │ │ │ ├── UserSignServiceImpl.java │ │ │ │ ├── ResidentServiceImpl.java │ │ │ │ ├── UserPwdProServiceImpl.java │ │ │ │ ├── UserProfileServiceImpl.java │ │ │ │ ├── LeaderViewServiceImpl.java │ │ │ │ ├── LuceneServiceImpl.java │ │ │ │ └── GridQueryServiceImpl.java │ │ │ ├── AdminAllService.java │ │ │ └── GridManageService.java │ │ │ ├── utils │ │ │ ├── IsIntegerUtil.java │ │ │ ├── MapToBeanUtil.java │ │ │ ├── CalculatePageUtil.java │ │ │ ├── AuthorityUtil.java │ │ │ ├── SHA256Util.java │ │ │ ├── JwtUtil.java │ │ │ ├── ResultUtil.java │ │ │ └── RedisUtil.java │ │ │ ├── CsgsApplication.java │ │ │ ├── controller │ │ │ ├── LuceneController.java │ │ │ ├── UserProfileController.java │ │ │ ├── FeLogController.java │ │ │ ├── LeaderViewController.java │ │ │ ├── ResidentController.java │ │ │ ├── GridQueryController.java │ │ │ ├── UserSignController.java │ │ │ ├── UserPwdProController.java │ │ │ └── AdminAllController.java │ │ │ └── configs │ │ │ ├── CustomSessionManager.java │ │ │ ├── ElasticSearchConfig.java │ │ │ ├── UserRealm.java │ │ │ └── ShiroConfig.java │ └── resources │ │ ├── mybatis │ │ └── mapper │ │ │ ├── PermissionMapper.xml │ │ │ ├── DistrictMapper.xml │ │ │ ├── JournalTypeMapper.xml │ │ │ ├── FeLogMapper.xml │ │ │ ├── AnnouncementMapper.xml │ │ │ ├── JournalMapper.xml │ │ │ ├── GridMapper.xml │ │ │ ├── PwdProMapper.xml │ │ │ ├── UserMapper.xml │ │ │ └── CommunityInfoMapper.xml │ │ ├── log4j.properties │ │ └── application.yml └── test │ └── java │ └── com │ └── example │ └── csgs │ └── JasyptTest.java └── .gitignore /community-management-system-fe/.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/getAllDistrict.js: -------------------------------------------------------------------------------- 1 | export default ["锦江区", "成华区", "青羊区", "金牛区", "武侯区"]; 2 | -------------------------------------------------------------------------------- /社会综合治理系统功能规格说明书.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShenQingchuan/Software-Engineering-Project/HEAD/社会综合治理系统功能规格说明书.docx -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/getSecretQuestion.js: -------------------------------------------------------------------------------- 1 | export default { 2 | q1: "你的母亲叫什么名字?", 3 | q2: "你的大学全称是什么?" 4 | }; 5 | -------------------------------------------------------------------------------- /community-management-system-fe/vue.config.js: -------------------------------------------------------------------------------- 1 | // vue.config.js 2 | module.exports = { 3 | transpileDependencies: ["vue-echarts", "resize-detector"] 4 | }; 5 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/OfficerGetDistrictName.js: -------------------------------------------------------------------------------- 1 | export default { 2 | districtName: "高新区", 3 | communityArray: ["仁和天地", "晨曦花园", "加州小镇"] 4 | }; 5 | -------------------------------------------------------------------------------- /community-management-system-fe/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShenQingchuan/Software-Engineering-Project/HEAD/community-management-system-fe/public/favicon.ico -------------------------------------------------------------------------------- /community-management-system-be/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ShenQingchuan/Software-Engineering-Project/HEAD/community-management-system-be/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /community-management-system-fe/src/utils/resErrorHandler.js: -------------------------------------------------------------------------------- 1 | export default function resErrorHandler(instance, res) { 2 | console.log(res); 3 | if (res.data.resultCode !== "200") { 4 | instance.$message.error(res.data.msg); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/getOptionsWhileEditingOfficerScope.js: -------------------------------------------------------------------------------- 1 | export default { 2 | districtName: "游仙区", 3 | communityArray: [ 4 | "华景上城", 5 | "卓越 · 万达广场", 6 | "香格里拉", 7 | "锦城湾", 8 | "弘仁里" 9 | ] 10 | }; 11 | -------------------------------------------------------------------------------- /community-management-system-be/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar 3 | -------------------------------------------------------------------------------- /community-management-system-fe/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ["@vue/cli-plugin-babel/preset"], 3 | plugins: [ 4 | [ 5 | "component", 6 | { 7 | libraryName: "element-ui", 8 | styleLibraryName: "theme-chalk" 9 | } 10 | ] 11 | ] 12 | }; 13 | -------------------------------------------------------------------------------- /community-management-system-fe/src/utils/LeanCloudMessage.js: -------------------------------------------------------------------------------- 1 | import AV from "leancloud-storage"; 2 | 3 | AV.init({ 4 | appId: "2ljhc8aJt8UgjvbjHc2u8qrL-gzGzoHsz", 5 | appKey: "nGckV9BcpYFTReNi4BPBemAQ", 6 | serverURL: "https://2ljhc8aj.lc-cn-n1-shared.com" 7 | }); 8 | 9 | export default AV; 10 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/LoginState.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | public class LoginState { 4 | public static final int STATE_SUCCESS = 1; 5 | public static final int STATE_FAIL = 0; 6 | public static final int STATE_UNExist = -1; 7 | public static final int STATE_EXIST = -2; 8 | } 9 | -------------------------------------------------------------------------------- /community-management-system-fe/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/PermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import org.apache.ibatis.annotations.Mapper; 4 | import org.springframework.stereotype.Repository; 5 | 6 | @Repository 7 | public interface PermissionMapper { 8 | int findUserTypeByPermissionName(String permissionName); 9 | } 10 | -------------------------------------------------------------------------------- /community-management-system-fe/src/utils/alioss.js: -------------------------------------------------------------------------------- 1 | const oss = require("ali-oss"); 2 | 3 | export const aliStore = new oss({ 4 | accessKeyId: "LTAILomQSvnSX2JA", 5 | accessKeySecret: "IvvtTBHhu7x13rxiZ4hrIhmUWvOwvT", 6 | bucket: "rpzoss", 7 | region: "oss-cn-chengdu" 8 | }); 9 | 10 | export const OSS_URL = "http://rpzoss.oss-cn-chengdu.aliyuncs.com/"; 11 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mixins/logout.js: -------------------------------------------------------------------------------- 1 | import Cookies from "js-cookie"; 2 | 3 | export default { 4 | methods: { 5 | logout() { 6 | console.log("退出登录"); 7 | Cookies.remove("csgs_token"); 8 | Cookies.remove("JSESSIONID"); 9 | this.$router.push("/sign"); 10 | this.$message.success("退出登录成功!"); 11 | } 12 | } 13 | }; 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM java:8 2 | 3 | VOLUME /tmp 4 | 5 | COPY csgs-0.0.1-SNAPSHOT.jar csgs.jar 6 | 7 | ENV TZ=Asia/Shanghai 8 | 9 | RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo '$TZ' > /etc/timezone 10 | 11 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/csgs.jar"] 12 | -------------------------------------------------------------------------------- /community-management-system-fe/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import Vuex from "vuex"; 3 | 4 | Vue.use(Vuex); 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | userInfo: {} 9 | }, 10 | mutations: { 11 | setUserInfo(state, { info }) { 12 | state.userInfo = info; 13 | } 14 | }, 15 | actions: {}, 16 | modules: {} 17 | }); 18 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/UserSignService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | public interface UserSignService { 6 | 7 | /** 8 | * 退出登陆 9 | * @param request 携带Cookie至后端,清除redis缓存的token 10 | */ 11 | boolean signOut(HttpServletRequest request); 12 | } 13 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/LogTypeResult.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class LogTypeResult { 11 | private String type; 12 | private int count; 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/IsIntegerUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import java.util.regex.Pattern; 4 | 5 | public class IsIntegerUtil { 6 | public static boolean isInteger(String str) { 7 | Pattern pattern = Pattern.compile("^[-\\+]?[\\d]*$"); 8 | return pattern.matcher(str).matches(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/GridEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class GridEntity{ 11 | Long id; 12 | String districtName; 13 | UserEntity userId; 14 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/LogTimeResult.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class LogTimeResult { 11 | private String createTime; 12 | private int count; 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/OfGrid.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class OfGrid { 11 | private String districtName; 12 | private String communityName; 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/CreateGridInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class CreateGridInfo { 11 | private AreaList areaList; 12 | private String userID; 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/JournalTypeEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class JournalTypeEntity { 11 | private Long id; 12 | private String typeName; 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/AreaList.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class AreaList { 11 | private String districtName; 12 | private String[] communityArray; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/AdministratorEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class AdministratorEntity{ 11 | Long id; 12 | 13 | String adminName; //系统管理员名称 14 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/UserSign.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class UserSign { 11 | private String userID; 12 | private String userPassword; 13 | private int userType; 14 | } 15 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/DistrictMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.DistrictEntity; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | @Repository 9 | public interface DistrictMapper { 10 | DistrictEntity findById(Long id); 11 | 12 | List findAllDistrict(); 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/PermissionEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @NoArgsConstructor 9 | @AllArgsConstructor 10 | public class PermissionEntity { 11 | private int id; 12 | private String permissionName; 13 | private int userTypeId; 14 | } 15 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/gridSelector.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | area: "锦江区", 4 | community: [ 5 | "蓝光金悦天娇", 6 | "乐天圣苑", 7 | "晶融汇", 8 | "华润翡翠城1期", 9 | "四海逸家云庭", 10 | "蓝润锦江春天", 11 | "卓锦城1期", 12 | "瑞升望江橡树林2期", 13 | "龙光天悦龙庭" 14 | ] 15 | }, 16 | { 17 | area: "青羊区", 18 | community: ["颐和京都小区", "凯蒂阳光", "天邑花园", "盐井小区", "万西苑"] 19 | } 20 | ]; 21 | -------------------------------------------------------------------------------- /community-management-system-fe/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | extends: ["plugin:vue/essential", "eslint:recommended"], 7 | parserOptions: { 8 | parser: "babel-eslint" 9 | }, 10 | rules: { 11 | "no-console": process.env.NODE_ENV === "production" ? "error" : "off", 12 | "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off" 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/MapToBeanUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import org.springframework.cglib.beans.BeanMap; 4 | 5 | import java.util.Map; 6 | 7 | public class MapToBeanUtil { 8 | public static T mapToBean(Map map, T bean){ 9 | BeanMap beanMap= BeanMap.create(bean); 10 | beanMap.putAll(map); 11 | return bean; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/UserProfileService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | 5 | public interface UserProfileService { 6 | /** 7 | * 修改资料接口 8 | * 场景:用户进入资料编辑界面,对可修改的信息进行修改 9 | * @param id 将要修改资料用户在user表中的id,同样也可以是userProfile表中的id(一对一的关系) 10 | */ 11 | boolean updateMaterial(JSONObject jsonObject, Long id); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/UserEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | @Data 8 | public class UserEntity implements Serializable { 9 | private Long id; 10 | private String userID; 11 | private String userPassword; 12 | private int userType; 13 | private PwdProEntity pwdProId; 14 | private UserProfile profileId; 15 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/DistrictInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class DistrictInfo { 11 | private String district; 12 | private long numHouses; 13 | private long numResidents; 14 | private long numParkingSpaces; 15 | } 16 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/CommunityInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class CommunityInfo { 11 | private String community; 12 | private Long numHouses; 13 | private Long numResidents; 14 | private Long numParkingSpaces; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/PageQuery.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.util.List; 8 | 9 | @Data 10 | @AllArgsConstructor 11 | @NoArgsConstructor 12 | public class PageQuery { 13 | private long curPage; 14 | private long totalPage; 15 | private long totalSize; 16 | private List dataList; 17 | } 18 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/JournalTypeMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.JournalTypeEntity; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import java.util.List; 7 | 8 | @Repository 9 | public interface JournalTypeMapper { 10 | JournalTypeEntity findById(Long uid); 11 | 12 | Long findByTypeName(String typeName); 13 | 14 | List findAllTypeName(); 15 | } 16 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/officerManageSearchResult.js: -------------------------------------------------------------------------------- 1 | export default { 2 | userEntity: { 3 | userID: "510403199911060314", 4 | userProfile: { 5 | userName: "唐梦予", 6 | telphone: "19911226688", 7 | sex: 1, 8 | nation: "汉族", 9 | degreeOfEducation: "本科", 10 | politicCountenance: "共青团员" 11 | } 12 | }, 13 | options: { 14 | districtName: "金牛区", 15 | communityArray: ["理想城邦", "长安新城", "万科新城", "卓越云际"] 16 | } 17 | }; 18 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/GridPersonalInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class GridPersonalInfo { 11 | private Long id; 12 | private String userName; 13 | private String userID; 14 | private String telPhone; 15 | private AreaList areaList; 16 | } 17 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/DistrictEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | @Data 9 | @NoArgsConstructor 10 | @AllArgsConstructor 11 | public class DistrictEntity{ 12 | @JsonInclude(JsonInclude.Include.NON_NULL) 13 | Long id; 14 | String districtName; //所属区 15 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/InsertCommunityId.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class InsertCommunityId { 11 | private Long pid; 12 | private Long CommunityId; 13 | 14 | public InsertCommunityId(Long communityId) { 15 | CommunityId = communityId; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/userInfoShow.js: -------------------------------------------------------------------------------- 1 | export default { 2 | photoUrl: 3 | "https://rpzoss.oss-cn-chengdu.aliyuncs.com/tmyBlog/2020-04-18-030345.jpg", 4 | grid: { 5 | area: "锦江区", 6 | community: "龙湖天岳小区" 7 | }, 8 | userName: "王小明", 9 | userId: "510403199911060314", 10 | usedName: "无", 11 | sex: "男", 12 | nation: "汉族", 13 | bloodType: "RH阴性", 14 | phone: "17396230236", 15 | politics: "共青团员", 16 | occupation: "学生", 17 | email: "657345062@qq.com" 18 | }; 19 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class User { 11 | private Long id; 12 | private String userID; 13 | private String userName; 14 | private String telPhone; 15 | private String districtName; 16 | private String communityName; 17 | } 18 | -------------------------------------------------------------------------------- /community-management-system-be/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/CsgsApplication.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.example.csgs.mapper") 9 | public class CsgsApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(CsgsApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/FeLogMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.FeLog; 4 | import com.example.csgs.entity.LogTimeResult; 5 | import com.example.csgs.entity.LogTypeResult; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | @Repository 11 | public interface FeLogMapper { 12 | int insertLog(FeLog feLog); 13 | 14 | List queryTypeLog(); 15 | 16 | List queryTimeLog(); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/PermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/charts.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | 小区名称: "仁和金居", 4 | 住房: 239, 5 | 车位: 199, 6 | 人口: 401 7 | }, 8 | { 9 | 小区名称: "龙湖别墅", 10 | 住房: 139, 11 | 车位: 99, 12 | 人口: 201 13 | }, 14 | { 15 | 小区名称: "远达帝景华庭", 16 | 住房: 239, 17 | 车位: 199, 18 | 人口: 355 19 | }, 20 | { 21 | 小区名称: "印象马德里", 22 | 住房: 339, 23 | 车位: 109, 24 | 人口: 451 25 | }, 26 | { 27 | 小区名称: "晨曦花园", 28 | 住房: 377, 29 | 车位: 155, 30 | 人口: 681 31 | }, 32 | { 33 | 小区名称: "加州小镇", 34 | 住房: 239, 35 | 车位: 79, 36 | 人口: 411 37 | } 38 | ]; 39 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/Journal.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class Journal { 14 | private Long id; 15 | private String titleName; 16 | private String typeName; 17 | private UserEntity creator; 18 | @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm", timezone = "GMT+8") 19 | private Date createTime; 20 | } 21 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/Announcement.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @AllArgsConstructor 12 | @NoArgsConstructor 13 | public class Announcement { 14 | private long id; 15 | private String titleName; 16 | private String content; 17 | private String creator; 18 | @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm", timezone = "GMT+8") 19 | private Date createTime; 20 | } 21 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/chartsForAll.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | 片区: "青羊区", 4 | 住房: 4910, 5 | 车位: 3211, 6 | 人口: 18650 7 | }, 8 | { 9 | 片区: "锦江区", 10 | 住房: 4330, 11 | 车位: 4196, 12 | 人口: 21650 13 | }, 14 | { 15 | 片区: "双流区", 16 | 住房: 4330, 17 | 车位: 2991, 18 | 人口: 21650 19 | }, 20 | { 21 | 片区: "金牛区", 22 | 住房: 7339, 23 | 车位: 1609, 24 | 人口: 19451 25 | }, 26 | { 27 | 片区: "武侯区", 28 | 住房: 4377, 29 | 车位: 4355, 30 | 人口: 21681 31 | }, 32 | { 33 | 片区: "成华区", 34 | 住房: 6239, 35 | 车位: 4979, 36 | 人口: 22411 37 | } 38 | ]; 39 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/officerManageTableData.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | id: 13, 4 | userName: "小天", 5 | telPhone: "19980492616", 6 | areaList: { 7 | districtName: "游仙区", 8 | communityArray: ["繁花似锦"] 9 | } 10 | }, 11 | { 12 | id: 1, 13 | userName: "小李", 14 | telPhone: "19980492664", 15 | areaList: { 16 | districtName: "高新区", 17 | communityArray: ["仁和天地", "晨曦花园", "加州小镇"] 18 | } 19 | }, 20 | { 21 | id: 2, 22 | userName: "小何", 23 | telPhone: "19980492665", 24 | areaList: { 25 | districtName: "金牛区", 26 | communityArray: ["春风十里", "锦弯城"] 27 | } 28 | } 29 | ]; 30 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/JournalEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.util.Date; 9 | 10 | @Data 11 | @NoArgsConstructor 12 | @AllArgsConstructor 13 | public class JournalEntity { 14 | private Long id; 15 | private String titleName; 16 | private String content; 17 | private UserEntity creatorId; 18 | private JournalTypeEntity typeId; 19 | @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm", timezone = "GMT+8") 20 | private Date createTime; 21 | } 22 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/ResidentService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.example.csgs.entity.CommunityInfo; 4 | import com.example.csgs.entity.PageQuery; 5 | import com.example.csgs.entity.Announcement; 6 | 7 | public interface ResidentService { 8 | /** 9 | * 场景:居民用户登陆,居民首页呈现自己所住小区名、房屋数量、停车位数量、居民数量 10 | * @param id 在user表中某一居民的id 11 | */ 12 | CommunityInfo findResidentRPH(Long id); 13 | 14 | /** 15 | * 场景:在居民首页中获取自身所在网格区域的公告信息 16 | * @param id 在user表中某一居民的id 17 | * @param page 当前请求页数 18 | */ 19 | PageQuery getAnnouncementOfGrid(Long id, String page); 20 | } 21 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/AnnouncementEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonFormat; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import org.hibernate.annotations.UpdateTimestamp; 8 | 9 | import java.util.Date; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | public class AnnouncementEntity { 15 | Long id; 16 | String titleName; 17 | String content; 18 | UserEntity creator; 19 | @UpdateTimestamp 20 | @JsonFormat(pattern = "yyyy年MM月dd日 HH:mm", timezone = "GMT+8") 21 | Date createTime; 22 | } 23 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/AnnouncementMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | 4 | import com.example.csgs.entity.Announcement; 5 | import com.example.csgs.entity.AnnouncementEntity; 6 | import io.lettuce.core.dynamic.annotation.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.HashMap; 10 | import java.util.List; 11 | 12 | @Repository 13 | public interface AnnouncementMapper { 14 | AnnouncementEntity findById(Long uid); 15 | 16 | List findAnnouncementByCreator(@Param("id") Long id); 17 | 18 | int addOneAnnouncement(HashMap map); 19 | 20 | int deleteAnnouncement(Long id); 21 | } 22 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/LeaderViewService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.example.csgs.entity.CommunityInfo; 4 | import com.example.csgs.entity.DistrictInfo; 5 | 6 | import java.util.List; 7 | 8 | public interface LeaderViewService { 9 | /** 10 | * 场景:此时,领导想要看的的整体各项数据(以区为单位展示数据信息内容) 11 | * 所以,我们要整理出每个区下,Residents、Houses、ParkingSpaces各自总和 12 | */ 13 | List getDistrictRSHList(); 14 | 15 | /** 16 | * 场景:此时,领导查看的数据形式为:选择某一区对车位数、居民数、住宅数可视化数据查看 17 | * 所以从前端接受到内容主要是“在District表中区所对应的id号” 18 | * @param id district表中的区的id 19 | */ 20 | List getCommunityRPHList(Long id); 21 | } 22 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/FeLog.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public class FeLog { 11 | private Long id; 12 | private String event; 13 | private String type; 14 | private String page; 15 | private String createTime; 16 | private Long userId; 17 | 18 | public FeLog(String event, String type, String page, String createTime) { 19 | this.event = event; 20 | this.type = type; 21 | this.page = page; 22 | this.createTime = createTime; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /community-management-system-fe/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/userManageTableData.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | area: "锦江区", 4 | community: "龙腾尚居", 5 | userId: "510403199911060314", 6 | userName: "陈小霆", 7 | phone: "13910361502" 8 | }, 9 | { 10 | area: "锦江区", 11 | community: "乐天圣苑", 12 | userId: "210203197503102721", 13 | userName: "陆晓芳", 14 | phone: "13910362075" 15 | }, 16 | { 17 | area: "锦江区", 18 | community: "晶融汇", 19 | userId: "361125195409090039", 20 | userName: "郎纱", 21 | phone: "13522118375" 22 | }, 23 | { 24 | area: "锦江区", 25 | community: "四海逸家云庭", 26 | userId: "441623198701083264", 27 | userName: "孔姬宜", 28 | phone: "13910362125" 29 | } 30 | ]; 31 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/PwdProEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class PwdProEntity implements Serializable{ 13 | private Long id; 14 | private String questionOne; 15 | private String answerOne; 16 | private String questionTwo; 17 | private String answerTwo; 18 | 19 | public PwdProEntity(String questionOne, String questionTwo) { 20 | this.questionOne = questionOne; 21 | this.questionTwo = questionTwo; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/CommunityInfoEntity.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | 6 | @Data 7 | public class CommunityInfoEntity { 8 | @JsonInclude(JsonInclude.Include.NON_NULL) 9 | Long id; 10 | String communityName; //所属小区 11 | @JsonInclude(JsonInclude.Include.NON_NULL) 12 | Long numHouses; 13 | @JsonInclude(JsonInclude.Include.NON_NULL) 14 | Long numResidents; 15 | @JsonInclude(JsonInclude.Include.NON_NULL) 16 | Long numParkingSpaces; 17 | DistrictEntity districtId; 18 | @JsonInclude(JsonInclude.Include.NON_NULL) 19 | GridEntity gridId; 20 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/JournalMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | 4 | import com.example.csgs.entity.Journal; 5 | import com.example.csgs.entity.JournalEntity; 6 | import io.lettuce.core.dynamic.annotation.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.HashMap; 10 | import java.util.List; 11 | 12 | @Repository 13 | public interface JournalMapper { 14 | JournalEntity findById(Long uid); 15 | 16 | List findJournalByCreator(@Param("id") Long id); 17 | 18 | int addOneJournal(HashMap map); 19 | 20 | String findContentById(@Param("id") Long id); 21 | 22 | int deleteJournal(Long id); 23 | } 24 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/DistrictMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 19 | 20 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/JournalTypeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 19 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/UserPwdProService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import java.util.List; 4 | 5 | public interface UserPwdProService { 6 | 7 | /** 8 | * 此密保设置,同时也是密保修改接口,而且只要这个人存在,那么他所对应的PwdProEntity就存在, 9 | * 所以不存在插入一个密保的说法 10 | * @param id user表中用户id 11 | * @param list 密保信息集合 12 | */ 13 | boolean setPwdPro(Long id, List list); 14 | 15 | /** 16 | * 返回用户密保问题 17 | * @param id user表中用户id 18 | */ 19 | List returnPwdProQue(Long id); 20 | 21 | /** 22 | * 判断用户填写的密保问题答案是否与数据库一致 23 | * @param id user表中用户id 24 | * @param list 用户密保问题答案集合 25 | */ 26 | boolean comparePwdProAns(Long id, List list); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /community-management-system-fe/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | 17 | 39 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/PwdProMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.PwdProEntity; 4 | import io.lettuce.core.dynamic.annotation.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.HashMap; 8 | 9 | @Repository 10 | public interface PwdProMapper { 11 | PwdProEntity findById(@Param("id") Long id); 12 | 13 | PwdProEntity findPwdProQueById(@Param("id") Long id); 14 | 15 | PwdProEntity findPwdProAnsById(@Param("id") Long id); 16 | 17 | PwdProEntity findPwdProById(@Param("id") Long id); 18 | 19 | int updatePwdPro(HashMap map); 20 | 21 | int deleteById(Long id); 22 | 23 | void insertPwdPro_selectKey(PwdProEntity pwdProEntity); 24 | } 25 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/GridMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.GridEntity; 4 | import com.example.csgs.entity.UserEntity; 5 | import io.lettuce.core.dynamic.annotation.Param; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | @Repository 11 | public interface GridMapper { 12 | GridEntity findById(@Param("id") Long uid); 13 | 14 | GridEntity findByDistrictNameId(@Param("district") String district, @Param("id") Long id); 15 | 16 | GridEntity findByUserId(UserEntity userEntity); 17 | 18 | GridEntity findDistrictNameByUId(Long id); 19 | 20 | void addOneGrid(@Param("id") Long id, @Param("districtName") String districtName); 21 | 22 | List findAll(); 23 | 24 | int deleteGrid(Long id); 25 | } 26 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/LuceneService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.example.csgs.entity.Announcement; 4 | import com.example.csgs.entity.CommunityInfo; 5 | import com.example.csgs.entity.PageQuery; 6 | import org.elasticsearch.index.query.MultiMatchQueryBuilder; 7 | 8 | import java.io.IOException; 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | public interface LuceneService { 13 | 14 | /** 15 | * 在ElasticSearch中复合查询 16 | * @param indexName 索引名 17 | * @param matchQueryBuilder 复合查询条件 18 | * @param page 页数 19 | * @return 20 | * @throws IOException 21 | */ 22 | List> multiMatchQuery(String indexName, MultiMatchQueryBuilder matchQueryBuilder, 23 | String page) throws IOException; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/FeLogMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | insert into fe_log(event, type, page, create_time, user_id) 10 | values (#{event}, #{type}, #{page}, #{createTime}, #{userId}) 11 | 12 | 13 | 16 | 17 | 20 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/CalculatePageUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import com.example.csgs.entity.PageQuery; 4 | import com.github.pagehelper.Page; 5 | 6 | import java.util.List; 7 | 8 | public class CalculatePageUtil { 9 | public static PageQuery getPageInfo(int page, long pageSize, Page pageable, List dataList){ 10 | long totalPage; 11 | if (pageable.getTotal() != 0) { 12 | if (pageable.getTotal() % pageSize == 0) { 13 | totalPage = pageable.getTotal() / pageSize; 14 | } else { 15 | totalPage = pageable.getTotal() / pageSize + 1; 16 | } 17 | if (page > totalPage) { 18 | return null; 19 | } 20 | } else { 21 | return null; 22 | } 23 | return new PageQuery(pageable.getPageNum(), totalPage, pageable.getTotal(), dataList); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/ProfileMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.*; 4 | import io.lettuce.core.dynamic.annotation.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.HashMap; 8 | import java.util.List; 9 | 10 | @Repository 11 | public interface ProfileMapper{ 12 | UserProfile findById(Long id); 13 | 14 | int updateProfile(HashMap map); 15 | 16 | ProfileInfo getMaterial(Long id); 17 | 18 | int findGridIdIsExist(Long id); 19 | 20 | CommunityInfoEntity findResidentRPH(Long id); 21 | 22 | CommunityInfoEntity findUserIdByProfileId(Long id); 23 | 24 | DistrictEntity findDistrictById(Long id); 25 | 26 | List findProfileByDistrict(@Param("district") String district); 27 | 28 | int deleteById(@Param("id") Long id); 29 | 30 | void insertProfile_selectKey(InsertCommunityId insertCommunityId); 31 | } 32 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | log4j.rootLogger=DEBUG,console,file 2 | 3 | #控制台输出的相关设置 4 | log4j.appender.console = org.apache.log4j.ConsoleAppender 5 | log4j.appender.console.Target = System.out 6 | log4j.appender.console.Threshold=DEBUG 7 | log4j.appender.console.layout = org.apache.log4j.PatternLayout 8 | log4j.appender.console.layout.ConversionPattern=[%p][%d{yyyy/MM/dd HH:mm}][%c]%m%n 9 | 10 | #文件输出的相关设置 11 | log4j.appender.file = org.apache.log4j.DailyRollingFileAppender 12 | log4j.appender.file.File=../log/csgs.log 13 | #log4j.appender.file.MaxFileSize=10mb 14 | log4j.appender.file.Threshold=DEBUG 15 | log4j.appender.file.layout=org.apache.log4j.PatternLayout 16 | log4j.appender.file.layout.ConversionPattern=[%p][%d{yyyy/MM/dd HH:mm}][%c]%m%n 17 | 18 | #日志输出级别 19 | log4j.logger.org.mybatis=DEBUG 20 | log4j.logger.java.sql=DEBUG 21 | log4j.logger.java.sql.Statement=DEBUG 22 | log4j.logger.java.sql.ResultSet=DEBUG 23 | log4j.logger.java.sql.PreparedStatement=DEBUG -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/ProfileInfo.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class ProfileInfo implements Serializable{ 13 | private Long id; 14 | private String userName; //用户真实姓名 15 | private String telPhone; //用户电话号码 16 | private Integer sex; //用户性别 0女 1男 17 | private Integer stature; //用户身高 18 | private String avatarUrl; //用户头像地址 19 | private String nation; //民族 20 | private String degreeOfEducation; //文化程度 21 | private String bloodType; //血型 22 | private String occupation; //职业 23 | private String email; //用户邮箱 24 | private String politicCountenance; //用户政治面貌 25 | private OfGrid ofGrid; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/entity/UserProfile.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | import java.io.Serializable; 8 | 9 | @Data 10 | @NoArgsConstructor 11 | @AllArgsConstructor 12 | public class UserProfile implements Serializable{ 13 | private Long id; 14 | private String userName; //用户真实姓名 15 | private String telPhone; //用户电话号码 16 | private Integer sex; //用户性别 0女 1男 17 | private Integer stature; //用户身高 18 | private String avatarUrl; //用户头像地址 19 | private String nation; //民族 20 | private String degreeOfEducation; //文化程度 21 | private String bloodType; //血型 22 | private String occupation; //职业 23 | private String email; //用户邮箱 24 | private String politicCountenance; //用户政治面貌 25 | private CommunityInfoEntity communityId; //用户所属网格 26 | 27 | } 28 | -------------------------------------------------------------------------------- /community-management-system-fe/src/mock/logs.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | title: "综合治理和城市管理", 4 | content: `综合治理和城市管理。及时解决群众反应的矛盾,排查化解群众纠纷。`, 5 | type: "patrol", 6 | creatorName: "张家坡社区5号网格员", 7 | createTime: 1580267280 8 | }, 9 | { 10 | title: "对辖区内的门面进行流动人口清查", 11 | content: `对辖区内的门面进行流动人口清查,并为流动人口办理流动人口婚育证明`, 12 | type: "survey", 13 | creatorName: "李家屯33号网格员", 14 | createTime: 1580713680 15 | }, 16 | { 17 | title: "半年来工作总结", 18 | content: `半年来共化解下水道堵塞、油烟扰民、垃圾扰民、家庭纠纷等社会矛盾12起。`, 19 | type: "logistical", 20 | creatorName: "五道口民事1号负责员", 21 | createTime: 1581415980 22 | }, 23 | { 24 | title: "申报退休人员独生子女奖励金", 25 | content: `申报辖区内企业退休人员的“独生子女”奖励金。摸排孕妇及新生儿的信息采集。`, 26 | type: "survey", 27 | creatorName: "赵家村8号网格员", 28 | createTime: 1584577143 29 | }, 30 | { 31 | title: "办理完成老年证,上门核查及通报", 32 | content: `给年满60岁的老年人办理老年证,对家庭收入发生变化的低保户,进行上门核查及时上报`, 33 | type: "survey", 34 | creatorName: "玉林小区网格员", 35 | createTime: 1584577143 36 | } 37 | ]; 38 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | 4 | import com.example.csgs.entity.User; 5 | import com.example.csgs.entity.UserEntity; 6 | import io.lettuce.core.dynamic.annotation.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import java.util.HashMap; 10 | import java.util.List; 11 | 12 | @Repository 13 | public interface UserMapper { 14 | UserEntity findById(@Param("id") Long id); 15 | 16 | UserEntity findOneByUserID(@Param("userID") String userID); 17 | 18 | int modifyPassword(@Param("newPassword") String newPassword, @Param("id") Long id); 19 | 20 | int judgeGrid(@Param("id") Long id); 21 | 22 | User findUserByUserID(@Param("UserID") String UserID); 23 | 24 | List findUserByGridInfo(HashMap map); 25 | 26 | int addResidentUser(HashMap map); 27 | 28 | void setGrid(@Param("UserID") String UserID); 29 | 30 | void cancelGrid(@Param("UserID") String UserID); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/GridQueryService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.example.csgs.entity.PageQuery; 4 | import com.example.csgs.entity.User; 5 | 6 | import java.io.IOException; 7 | 8 | public interface GridQueryService { 9 | 10 | /** 11 | * 通过网格员id查询居民用户信息列表 12 | * 场景:网格员登陆进入主界面,数据列表界面 13 | * @param id user表中网格员id 14 | * @param page 当前请求页数 15 | */ 16 | PageQuery allUserOfGrid(Long id, String page); 17 | 18 | /** 19 | * 按各种用户身份信息进行查询 20 | * 场景:网格员查询用户信息 21 | * 组合:<归属地区、归属地区>、<归属小区>、<归属地区>、 22 | * @param id user表中网格员id 23 | * @param page 当前请求页数 24 | * @param userID 所查询用户的身份证号 25 | * @param userName 所查询用户的姓名 26 | * @param community 所查询用户所在的小区名 27 | */ 28 | PageQuery multipleConditions(String userID, String userName, String community, Long id, String page) throws IOException; 29 | 30 | /** 31 | * 网格员删除居民用户 32 | * @param id 所要删除用户在user表中的id 33 | */ 34 | boolean deleteUser(Long id); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/UserSignServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.example.csgs.service.UserSignService; 4 | import com.example.csgs.utils.RedisUtil; 5 | import lombok.extern.log4j.Log4j; 6 | import org.springframework.stereotype.Service; 7 | 8 | import javax.annotation.Resource; 9 | import javax.servlet.http.HttpServletRequest; 10 | 11 | @Log4j 12 | @Service 13 | public class UserSignServiceImpl implements UserSignService { 14 | @Resource 15 | RedisUtil redisUtil; 16 | 17 | /** 18 | * 退出登陆 19 | * @param request 携带Cookie至后端,清除redis缓存的token 20 | */ 21 | @Override 22 | public boolean signOut(HttpServletRequest request) { 23 | String csgs_token = request.getHeader("csgs_token"); 24 | if (!"".equals(csgs_token)) { 25 | if (RedisUtil.hasKey(csgs_token)) { 26 | log.info("用户 uid: " + redisUtil.get(csgs_token) + " 退出登录..."); 27 | redisUtil.remove(csgs_token); 28 | return true; 29 | } 30 | } 31 | return false; 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/AnnouncementMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 18 | 19 | 20 | insert into announcement(content, title_name, creator, create_time) 21 | VALUES (#{content}, #{titleName}, #{creator}, #{createTime}) 22 | 23 | 24 | 25 | delete 26 | from announcement 27 | where id = #{id} 28 | 29 | 30 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/mapper/CommunityInfoMapper.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.mapper; 2 | 3 | import com.example.csgs.entity.CommunityInfoEntity; 4 | import io.lettuce.core.dynamic.annotation.Param; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import java.util.List; 8 | 9 | @Repository 10 | public interface CommunityInfoMapper{ 11 | CommunityInfoEntity findById(@Param("id") Long id); 12 | 13 | CommunityInfoEntity findByOfGrid(@Param("district") String district, @Param("community") String community); 14 | 15 | List findByDistrictID(@Param("id") Long id); 16 | 17 | List findCommunityNameById(@Param("id") Long id); 18 | 19 | List findCommunityByDistrictId(@Param("id") Long id); 20 | 21 | List findCommunityByDistrictName(@Param("district") String districtName); 22 | 23 | List findCommunityNameByGridId(@Param("gridId") Long gridId); 24 | 25 | int setGridIdIsNull(@Param("id") Long id); 26 | 27 | void updateGridId(@Param("id") Long id, @Param("gridId") Long gridId); 28 | 29 | List findCommunityIdByGridId(@Param("id") Long id); 30 | } 31 | -------------------------------------------------------------------------------- /community-management-system-fe/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "community-management-system-fe", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint" 9 | }, 10 | "dependencies": { 11 | "ali-oss": "^6.8.0", 12 | "axios": "^0.19.2", 13 | "core-js": "^3.6.4", 14 | "echarts": "^4.7.0", 15 | "element-ui": "^2.13.0", 16 | "js-cookie": "^2.2.1", 17 | "jsonwebtoken": "^8.5.1", 18 | "leancloud-storage": "^4.5.3", 19 | "mavon-editor": "^2.9.0", 20 | "md5": "^2.2.1", 21 | "moment": "^2.24.0", 22 | "vue": "^2.6.11", 23 | "vue-echarts": "^5.0.0-beta.0", 24 | "vue-router": "^3.1.5", 25 | "vuex": "^3.1.2" 26 | }, 27 | "devDependencies": { 28 | "@vue/cli-plugin-babel": "~4.2.0", 29 | "@vue/cli-plugin-eslint": "~4.2.0", 30 | "@vue/cli-plugin-router": "~4.2.0", 31 | "@vue/cli-plugin-vuex": "~4.2.0", 32 | "@vue/cli-service": "~4.2.0", 33 | "babel-eslint": "^10.0.3", 34 | "babel-plugin-component": "^1.1.1", 35 | "eslint": "^6.7.2", 36 | "eslint-plugin-vue": "^6.1.2", 37 | "sass": "^1.25.0", 38 | "sass-loader": "^8.0.2", 39 | "vue-template-compiler": "^2.6.11" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/AuthorityUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import io.jsonwebtoken.Claims; 4 | import lombok.extern.log4j.Log4j; 5 | import org.apache.shiro.SecurityUtils; 6 | import org.apache.shiro.subject.Subject; 7 | 8 | import javax.servlet.http.HttpServletRequest; 9 | 10 | @Log4j 11 | public class AuthorityUtil { 12 | public static boolean authority(HttpServletRequest request, String id, RedisUtil redisUtil) { 13 | String token = request.getHeader("csgs_token"); 14 | if (!"".equals(token)) { 15 | Claims claims = JwtUtil.parserToken(token); //解析token 16 | if (claims != null) { 17 | String uid = String.valueOf(claims.get("id")); 18 | String sessionID = request.getHeader("Authorization"); 19 | Subject subject = SecurityUtils.getSubject(); 20 | 21 | String tokenId = (String) redisUtil.get(token); 22 | log.info("判定用户令牌信息是否跟请求信息一致!"); 23 | return !"".equals(sessionID) && sessionID.equals(subject.getSession().getId()) 24 | && !"".equals(uid) && id.equals(uid) && !"".equals(tokenId) && tokenId.equals(id); 25 | } 26 | } 27 | return false; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/SHA256Util.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import java.nio.charset.StandardCharsets; 4 | import java.security.MessageDigest; 5 | import java.security.NoSuchAlgorithmException; 6 | 7 | public class SHA256Util { 8 | /** 9 | * 用java原生的摘要实现SHA256加密 10 | * @param str 加密前的报文 11 | */ 12 | public static String getSHA256String(String str) { 13 | String encodeStr = ""; 14 | try { 15 | MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); 16 | messageDigest.update(str.getBytes(StandardCharsets.UTF_8)); 17 | encodeStr = byte2Hex(messageDigest.digest()); 18 | 19 | } catch (NoSuchAlgorithmException e) { 20 | e.printStackTrace(); 21 | } 22 | return encodeStr; 23 | } 24 | 25 | /** 26 | * byte[]转为16进制 27 | * 28 | */ 29 | private static String byte2Hex(byte[] bytes) { 30 | StringBuilder stringBuffer = new StringBuilder(); 31 | for (byte aByte : bytes) { 32 | String temp = Integer.toHexString(aByte & 0xFF); 33 | if (temp.length() == 1) { 34 | stringBuffer.append("0"); 35 | } 36 | stringBuffer.append(temp); 37 | } 38 | return stringBuffer.toString(); 39 | } 40 | } -------------------------------------------------------------------------------- /community-management-system-fe/src/utils/burringPoint.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | import Cookies from "js-cookie"; 3 | 4 | const http = axios.create(); 5 | http.defaults.baseURL = "http://112.126.85.20:9090/log/storage/"; 6 | http.defaults.withCredentials = true; 7 | http.interceptors.request.use(config => { 8 | // 设置统一的请求头 9 | if (Cookies.get("csgs_token")) { 10 | config.headers.csgs_token = Cookies.get("csgs_token"); 11 | config.headers.Authorization = Cookies.get("JSESSIONID"); 12 | } 13 | return config; 14 | }); 15 | 16 | export async function send(config) { 17 | const [uid, event, type, page] = config; 18 | const create_time = new Date(); 19 | const localeTimeString = create_time.toLocaleTimeString(); 20 | try { 21 | const res = await http.post(`${uid}`, { 22 | uid, 23 | event, 24 | type, 25 | page, 26 | create_time: `${create_time.getFullYear()}年${create_time.getMonth() + 27 | 1}月${create_time.getDate()}日 ${localeTimeString.slice( 28 | 2, 29 | localeTimeString.lastIndexOf(":") 30 | )}` 31 | }); 32 | if (res.data.resultCode === "200") { 33 | console.log(`埋点记录 [${type}] - ${create_time} - 日志事件:${event}`); 34 | } else { 35 | await Promise.reject("AJAX 请求失败!"); 36 | } 37 | } catch (err) { 38 | console.error("上传埋点日志出错... " + String(err)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/JournalMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | insert into journal(content, title_name, creator_id, create_time, type_id) 11 | VALUES (#{content}, #{titleName}, #{creator}, #{createTime}, #{typeId}) 12 | 13 | 14 | 25 | 26 | 31 | 32 | 33 | delete 34 | from journal 35 | where id = #{id} 36 | 37 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/LuceneController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.example.csgs.service.LuceneService; 4 | import com.example.csgs.utils.ElasticSearchUtil; 5 | import com.example.csgs.utils.ResultUtil; 6 | import lombok.extern.log4j.Log4j; 7 | import org.elasticsearch.action.search.SearchResponse; 8 | import org.elasticsearch.index.query.QueryBuilders; 9 | import org.elasticsearch.index.query.TermQueryBuilder; 10 | import org.elasticsearch.search.SearchHit; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.annotation.Resource; 14 | import java.io.IOException; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | @RestController 19 | @RequestMapping("/lucene") 20 | @Log4j 21 | public class LuceneController { 22 | @Resource 23 | LuceneService luceneService; 24 | 25 | @GetMapping(value = "/{indexName}") 26 | public Object luceneJournal(@RequestParam String keyword, @RequestParam String page, @PathVariable String indexName) throws IOException { 27 | List> mapList = luceneService.multiMatchQuery(indexName, QueryBuilders.multiMatchQuery( 28 | keyword, "title_name", "content"), page); 29 | if (mapList != null) { 30 | return ResultUtil.success(mapList,"全文搜索<"+ keyword +">成功!"); 31 | } 32 | return ResultUtil.error("未找到相关结果!"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /community-management-system-be/src/test/java/com/example/csgs/JasyptTest.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs; 2 | 3 | import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; 4 | import org.jasypt.encryption.pbe.config.EnvironmentPBEConfig; 5 | import org.junit.Test; 6 | 7 | public class JasyptTest { 8 | @Test 9 | public void testEncrypt() throws Exception { 10 | StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); 11 | EnvironmentPBEConfig config = new EnvironmentPBEConfig(); 12 | 13 | config.setAlgorithm("PBEWithMD5AndDES"); // 加密的算法,这个算法是默认的 14 | config.setPassword("love"); // 加密的密钥 15 | standardPBEStringEncryptor.setConfig(config); 16 | String plainText = "123456"; 17 | String encryptedText = standardPBEStringEncryptor.encrypt(plainText); 18 | System.out.println(encryptedText); 19 | } 20 | 21 | @Test 22 | public void testDe() throws Exception { 23 | StandardPBEStringEncryptor standardPBEStringEncryptor = new StandardPBEStringEncryptor(); 24 | EnvironmentPBEConfig config = new EnvironmentPBEConfig(); 25 | 26 | config.setAlgorithm("PBEWithMD5AndDES"); 27 | config.setPassword("love"); 28 | standardPBEStringEncryptor.setConfig(config); 29 | String encryptedText = "O40eD31qV+xE/o7QHDT+TQ=="; 30 | String plainText = standardPBEStringEncryptor.decrypt(encryptedText); 31 | System.out.println(plainText); 32 | } 33 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/AdminAllService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.example.csgs.entity.AreaList; 4 | import com.example.csgs.entity.CreateGridInfo; 5 | import com.example.csgs.entity.GridPersonalInfo; 6 | import com.example.csgs.entity.PageQuery; 7 | 8 | import java.util.List; 9 | 10 | public interface AdminAllService { 11 | 12 | /** 13 | * 场景:系统管理员新增网格员,首先要获取区域数据信息,然后在其中选择区域分配网格员 14 | * 重点:这里我们返回的区域是,还没有被划分的区域,如果某一区域已经被分配,那么不返回该区域信息 15 | * @param userID 身份证号 16 | * @return 某一区下的区域信息 17 | */ 18 | AreaList getAreaList(String userID); 19 | 20 | /** 21 | * 场景:系统管理员在修改网格员管理区域之前,首先要获取所有未被分配管理的区域数据信息,然后在其中选择区域分配给网格员 22 | * @return 所有区的AreaList信息 23 | */ 24 | List getAllAreaList(); 25 | 26 | /** 27 | * 新增网格员接口 28 | * 同时系统管理员为网格员分配管理区域 29 | * @param createGridInfo 含有区域信息和用户身份证号 30 | * @return 布尔类型 31 | */ 32 | boolean addGrid(CreateGridInfo createGridInfo); 33 | 34 | /** 35 | * 返回当前系统管理员添加的网格员数据列表 36 | * @param page 当前请求页数 37 | * @return 当前页的GridPersonalInfo集合信息和分页信息 38 | */ 39 | PageQuery getAllGrids(String page); 40 | 41 | /** 42 | * 功能:删除某一网格员(user表中任然存在,只是grid表中不存在了) 43 | * @param id grid表中的id 44 | * @return 布尔类型 45 | */ 46 | boolean deleteOneGrid(Long id); 47 | 48 | /** 49 | * 场景:在系统管理员获取到网格员数据信息列表之后,选择修改任意网格员管理区域 50 | * @param areaList 区域信息 51 | * @param id grid表中id 52 | * @return 布尔类型 53 | */ 54 | boolean modifyGrid(AreaList areaList, Long id); 55 | } 56 | -------------------------------------------------------------------------------- /community-management-system-fe/src/assets/styles/common.scss: -------------------------------------------------------------------------------- 1 | .fade-enter-active, 2 | .fade-leave-active { 3 | transition: opacity 0.5s; 4 | } 5 | .fade-enter, 6 | .fade-leave-to { 7 | opacity: 0; 8 | } 9 | .slide-fade-enter-active { 10 | transition: all 0.5s ease-in; 11 | } 12 | .slide-fade-leave-active { 13 | transition: all 0.5s ease-out; 14 | } 15 | .slide-fade-enter, .slide-fade-leave-to 16 | /* .slide-fade-leave-active for below version 2.1.8 */ { 17 | transform: translateX(10px); 18 | opacity: 0; 19 | } 20 | .flex-box { 21 | display: flex; 22 | align-items: center; 23 | } 24 | .flex-1 { 25 | flex: 1; 26 | } 27 | .flex-wrap { 28 | flex-wrap: wrap; 29 | } 30 | .flex-col { 31 | flex-direction: column; 32 | } 33 | .jy-center { 34 | justify-content: center; 35 | } 36 | .jy-start { 37 | justify-content: flex-start; 38 | } 39 | .jy-end { 40 | justify-content: flex-end; 41 | } 42 | .jy-between { 43 | justify-content: space-between; 44 | } 45 | .as-start { 46 | align-items: flex-start; 47 | } 48 | .as-end { 49 | align-items: flex-end; 50 | } 51 | .bb-full { 52 | box-sizing: border-box; 53 | width: 100%; 54 | } 55 | .pagination { 56 | width: 100%; 57 | text-align: center; 58 | margin: 20px auto 0 auto; 59 | font-size: 14px; 60 | font-weight: bold; 61 | } 62 | 63 | .tb-gap { 64 | margin-top: 20px; 65 | margin-bottom: 20px; 66 | } 67 | .lr-gap { 68 | margin-left: 20px; 69 | margin-right: 20px; 70 | } 71 | .font-bold { 72 | font-weight: bold; 73 | } 74 | .text-align-left { 75 | text-align: left; 76 | } 77 | .text-align-right { 78 | text-align: right; 79 | } 80 | .w-full { 81 | width: 100%; 82 | } 83 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/JwtUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import com.example.csgs.entity.UserEntity; 4 | import io.jsonwebtoken.Claims; 5 | import io.jsonwebtoken.Jwts; 6 | import io.jsonwebtoken.SignatureAlgorithm; 7 | 8 | import java.util.Date; 9 | 10 | public class JwtUtil { 11 | 12 | private static final String SUBJECT = "csgs_space";//签名发行者 13 | 14 | private static final String SECRET_kEY = "csgsSpace2020";//签名 15 | 16 | public static final Integer TOKEN_EXPIRE_TIME = 2; //token过期时间 17 | 18 | /** 19 | * 生成token 20 | */ 21 | public static String genJsonWebToken(UserEntity userEntity) { 22 | String token; 23 | if (userEntity != null) { 24 | token = Jwts.builder() 25 | .setSubject(SUBJECT)//发行者 26 | .claim("userType", userEntity.getUserType()) 27 | .claim("id", userEntity.getId()) 28 | .setIssuedAt(new Date())//发行日期 29 | .signWith(SignatureAlgorithm.HS256, SECRET_kEY).compact();//签名 30 | } else { 31 | token = ""; 32 | } 33 | return token; 34 | } 35 | 36 | /** 37 | * 解析token 38 | * @param token token 39 | */ 40 | public static Claims parserToken(String token){ 41 | Claims claims = Jwts.parser() 42 | .setSigningKey(SECRET_kEY) 43 | .parseClaimsJws(token) 44 | .getBody(); 45 | if (!claims.isEmpty() && claims.getSubject().equals(SUBJECT)) { 46 | return claims; 47 | } 48 | return null; 49 | } 50 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9090 3 | spring: 4 | servlet: 5 | multipart: 6 | max-file-size: 10MB 7 | max-request-size: 100MB 8 | # IP:112.126.85.20 localhost 9 | datasource: 10 | url: jdbc:mysql://112.126.85.20:5306/csgs?characterEncoding=utf-8&serverTimezone=Asia/Shanghai 11 | driver-class-name: com.mysql.cj.jdbc.Driver 12 | username: root 13 | type: com.alibaba.druid.pool.DruidDataSource 14 | password: ENC(O40eD31qV+xE/o7QHDT+TQ==) 15 | druid: 16 | initial-size: 5 17 | min-idle: 5 18 | max-active: 20 19 | max-wait: 60000 20 | time-between-eviction-runs-millis: 60000 21 | min-evictable-idle-time-millis: 300000 22 | validation-query: SELECT 1 FROM DUAL 23 | test-while-idle: true 24 | test-on-borrow: false 25 | test-on-return: false 26 | pool-prepared-statements: true 27 | 28 | # filter:stat,wall,log4j 29 | max-pool-prepared-statement-per-connection-size: 20 30 | use-global-data-source-stat: true 31 | connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500 32 | redis: 33 | host: 112.126.85.20 34 | port: 6378 35 | timeout: 50000 36 | database: 0 37 | jasypt: 38 | encryptor: 39 | password: love 40 | mybatis: 41 | type-aliases-package: com.example.csgs.entity 42 | mapper-locations: classpath:mybatis/mapper/*.xml 43 | configuration: 44 | log-impl: org.apache.ibatis.logging.log4j.Log4jImpl 45 | map-underscore-to-camel-case: true 46 | cache-enabled: true 47 | pagehelper: 48 | helperDialect: mysql 49 | reasonable: true 50 | supportMethodsArguments: true 51 | params: count=countSql 52 | 53 | -------------------------------------------------------------------------------- /community-management-system-fe/src/assets/data/china-nations.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | { id: 1, name: "汉族" }, 3 | { id: 2, name: "蒙古族" }, 4 | { id: 3, name: "回族" }, 5 | { id: 4, name: "藏族" }, 6 | { id: 5, name: "维吾尔族" }, 7 | { id: 6, name: "苗族" }, 8 | { id: 7, name: "彝族" }, 9 | { id: 8, name: "壮族" }, 10 | { id: 9, name: "布依族" }, 11 | { id: 10, name: "朝鲜族" }, 12 | { id: 11, name: "满族" }, 13 | { id: 12, name: "侗族" }, 14 | { id: 13, name: "瑶族" }, 15 | { id: 14, name: "白族" }, 16 | { id: 15, name: "土家族" }, 17 | { id: 16, name: "哈尼族" }, 18 | { id: 17, name: "哈萨克族" }, 19 | { id: 18, name: "傣族" }, 20 | { id: 19, name: "黎族" }, 21 | { id: 20, name: "傈僳族" }, 22 | { id: 21, name: "佤族" }, 23 | { id: 22, name: "畲族" }, 24 | { id: 23, name: "高山族" }, 25 | { id: 24, name: "拉祜族" }, 26 | { id: 25, name: "水族" }, 27 | { id: 26, name: "东乡族" }, 28 | { id: 27, name: "纳西族" }, 29 | { id: 28, name: "景颇族" }, 30 | { id: 29, name: "柯尔克孜族" }, 31 | { id: 30, name: "土族" }, 32 | { id: 31, name: "达翰尔族" }, 33 | { id: 32, name: "么佬族" }, 34 | { id: 33, name: "羌族" }, 35 | { id: 34, name: "布朗族" }, 36 | { id: 35, name: "撒拉族" }, 37 | { id: 36, name: "毛南族" }, 38 | { id: 37, name: "仡佬族" }, 39 | { id: 38, name: "锡伯族" }, 40 | { id: 39, name: "阿昌族" }, 41 | { id: 40, name: "普米族" }, 42 | { id: 41, name: "塔吉克族" }, 43 | { id: 42, name: "怒族" }, 44 | { id: 43, name: "乌孜别克族" }, 45 | { id: 44, name: "俄罗斯族" }, 46 | { id: 45, name: "鄂温克族" }, 47 | { id: 46, name: "德昂族" }, 48 | { id: 47, name: "保安族" }, 49 | { id: 48, name: "裕固族" }, 50 | { id: 49, name: "京族" }, 51 | { id: 50, name: "塔塔尔族" }, 52 | { id: 51, name: "独龙族" }, 53 | { id: 52, name: "鄂伦春族" }, 54 | { id: 53, name: "赫哲族" }, 55 | { id: 54, name: "门巴族" }, 56 | { id: 55, name: "珞巴族" }, 57 | { id: 56, name: "基诺族" } 58 | ]; 59 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/configs/CustomSessionManager.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.configs; 2 | 3 | import org.apache.shiro.web.servlet.ShiroHttpServletRequest; 4 | import org.apache.shiro.web.session.mgt.DefaultWebSessionManager; 5 | import org.apache.shiro.web.util.WebUtils; 6 | import org.mybatis.logging.Logger; 7 | import org.mybatis.logging.LoggerFactory; 8 | import org.springframework.util.StringUtils; 9 | 10 | import javax.servlet.ServletRequest; 11 | import javax.servlet.ServletResponse; 12 | import java.io.Serializable; 13 | 14 | public class CustomSessionManager extends DefaultWebSessionManager { 15 | 16 | private static final Logger logger = LoggerFactory.getLogger(CustomSessionManager.class); 17 | 18 | private static final String AUTHORIZATION = "Authorization"; 19 | 20 | private static final String REFERENCED_SESSION_ID_SOURCE = "Stateless request"; 21 | 22 | public CustomSessionManager() { 23 | super(); 24 | setGlobalSessionTimeout(DEFAULT_GLOBAL_SESSION_TIMEOUT * 48); 25 | } 26 | 27 | @Override 28 | protected Serializable getSessionId(ServletRequest request, ServletResponse response) { 29 | String sessionId = WebUtils.toHttp(request).getHeader(AUTHORIZATION);//如果请求头中有 Authorization 则其值为sessionId 30 | if (!StringUtils.isEmpty(sessionId)) { 31 | request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE, REFERENCED_SESSION_ID_SOURCE); 32 | request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID, sessionId); 33 | request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_IS_VALID, Boolean.TRUE); 34 | return sessionId; 35 | } else { 36 | //否则按默认规则从cookie取sessionId 37 | return super.getSessionId(request, response); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/configs/ElasticSearchConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.configs; 2 | 3 | import org.apache.http.HttpHost; 4 | import org.apache.http.auth.AuthScope; 5 | import org.apache.http.auth.UsernamePasswordCredentials; 6 | import org.apache.http.client.CredentialsProvider; 7 | import org.apache.http.impl.client.BasicCredentialsProvider; 8 | import org.apache.http.impl.nio.client.HttpAsyncClientBuilder; 9 | import org.apache.log4j.BasicConfigurator; 10 | import org.elasticsearch.client.RestClient; 11 | import org.elasticsearch.client.RestClientBuilder; 12 | import org.elasticsearch.client.RestHighLevelClient; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | 16 | @Configuration 17 | public class ElasticSearchConfig { 18 | 19 | //配置elasticsearch客户端 20 | @Bean 21 | public RestHighLevelClient restHighLevelClient(){ 22 | BasicConfigurator.configure(); 23 | final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); 24 | credentialsProvider.setCredentials(AuthScope.ANY, 25 | new UsernamePasswordCredentials("elastic","Joson123")); 26 | 27 | RestClientBuilder builder = RestClient.builder( 28 | new HttpHost("es-ppulc3rx.public.tencentelasticsearch.com", 9200,"https")) 29 | .setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() { 30 | @Override 31 | public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpAsyncClientBuilder) { 32 | return httpAsyncClientBuilder.setDefaultCredentialsProvider(credentialsProvider); 33 | } 34 | }); 35 | 36 | return new RestHighLevelClient(builder); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/GridManageService.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service; 2 | 3 | import com.example.csgs.entity.AreaList; 4 | import com.example.csgs.entity.PageQuery; 5 | import com.example.csgs.entity.Announcement; 6 | import com.example.csgs.entity.Journal; 7 | 8 | public interface GridManageService { 9 | 10 | /** 11 | * 发布公告接口 12 | * 场景:网格员发布管理区域公告 13 | * @param id user表中网格员id 14 | * @param content 公告内容 15 | * @param titleName 公告标题 16 | */ 17 | boolean releaseAnnouncement(Long id, String titleName, String content); 18 | 19 | /** 20 | * 网格员发布日志接口 21 | * 场景:网格员进入日志管理界面,点击新增按钮 22 | * @param id user表中网格员id 23 | * @param titleName 日志标题 24 | * @param content 日志内容 25 | * @param type 日志类型 26 | */ 27 | boolean releaseJournal(String titleName, String content, String type, Long id); 28 | 29 | /** 30 | * 网格员获取所有自己发布的公告列表(分页返回数据) 31 | * 场景:网格员进入公告管理界面 32 | * @param id user表中网格员id 33 | * @param page 当前请求页数 34 | */ 35 | PageQuery getAnnouncementList(Long id, String page); 36 | 37 | /** 38 | * 网格员获取所有自己发布的日志列表(分页返回数据) 39 | * 场景:网格员进入日志管理界面(id为网格员的id) 40 | * @param id user表中网格员id 41 | * @param page 当前请求页数 42 | */ 43 | PageQuery getJournalList(Long id, String page); 44 | 45 | /** 46 | * 网格员增加一个居民用户 47 | * 密码默认设置为身份证后六位 48 | * 同时指明该居民位于哪个地区(必须是在该网格员管理的区域之内) 49 | * @param userID 被添加用户身份证号 50 | * @param password 登陆密码(已经过前端加密) 51 | * @param districtName 区名 52 | * @param communityName 小区名 53 | */ 54 | boolean addResidentUser(String userID, String districtName, String communityName, String password); 55 | 56 | /** 57 | * 获取该网格员所管理的区域(id为user表中网格员的id) 58 | * @param id user表中网格员id 59 | */ 60 | AreaList getManageAreaList(Long id); 61 | } 62 | -------------------------------------------------------------------------------- /community-management-system-fe/src/utils/chartOptions.js: -------------------------------------------------------------------------------- 1 | export const userLogTypePieOptions = { 2 | title: { 3 | left: "center", 4 | text: "前端操作日志类型饼图:" 5 | }, 6 | tooltip: { 7 | trigger: "item", 8 | formatter: "{a}
{b}:{c}次 ({d}%)", 9 | position: function(pos, params, dom, rect, size) { 10 | // 鼠标在左侧时 tooltip 显示到右侧,鼠标在右侧时 tooltip 显示到左侧。 11 | let obj = { top: 60 }; 12 | obj[["left", "right"][+(pos[0] < size.viewSize[0] / 2)]] = 5; 13 | return obj; 14 | } 15 | }, 16 | series: [ 17 | { 18 | name: "日志类型", 19 | type: "pie", 20 | radius: ["40%", "80%"], 21 | avoidLabelOverlap: false, 22 | label: { 23 | show: false, 24 | position: "center" 25 | }, 26 | labelLine: { 27 | show: false 28 | }, 29 | data: [] 30 | // { value: 335, name: '零钱通' }, 31 | // { value: 110, name: '零钱+' }, 32 | // { value: 24, name: '零钱' } 33 | } 34 | ] 35 | }; 36 | 37 | export function userLogTimeOptionsMaker(timeList, valueList) { 38 | return { 39 | tooltip: {}, 40 | title: { 41 | left: "center", 42 | text: "前端操作日志数量,按日期聚合:" 43 | }, 44 | xAxis: { 45 | type: "category", 46 | boundaryGap: false, 47 | data: timeList 48 | }, 49 | yAxis: { 50 | type: "value" 51 | }, 52 | series: [ 53 | { 54 | data: valueList, 55 | type: "line", 56 | areaStyle: {} 57 | } 58 | ] 59 | }; 60 | } 61 | 62 | export const singleChartOptions = { 63 | grid: { 64 | x: 50, 65 | y: 50, 66 | x2: 50, 67 | y2: 60 68 | }, 69 | barGap: "0%", 70 | legend: {}, 71 | tooltip: {}, 72 | dataset: { 73 | source: [] 74 | }, 75 | xAxis: { 76 | type: "category", 77 | axisLabel: { 78 | internal: 0 79 | } 80 | }, 81 | yAxis: {}, 82 | series: [{ type: "bar" }, { type: "bar" }, { type: "bar" }] 83 | }; 84 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/GridMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 23 | 24 | 25 | insert into grid(district_name, user_id) 26 | values (#{districtName}, #{id}) 27 | 28 | 29 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 51 | 52 | 53 | delete 54 | from grid 55 | where id = #{id} 56 | 57 | 58 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/PwdProMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 16 | 17 | 24 | 25 | 32 | 33 | 34 | update pwd_protection 35 | set question_one=#{questionOne}, 36 | question_two=#{questionTwo}, 37 | answer_one=#{answerOne}, 38 | answer_two=#{answerTwo} 39 | WHERE id = #{id} 40 | 41 | 42 | 43 | delete 44 | from pwd_protection 45 | where id = #{uid} 46 | 47 | 48 | 49 | 50 | select last_insert_id() AS id 51 | 52 | insert into pwd_protection(answer_one, answer_two, question_one, question_two) 53 | values ('', '', '', ''); 54 | 55 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/ResultUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | 6 | public class ResultUtil { 7 | 8 | @Data 9 | private static class Result { 10 | @JsonInclude(JsonInclude.Include.NON_NULL) 11 | private Object data;//返回数据 12 | private String msg;//返回信息 13 | private String resultCode;//返回结果代码 14 | 15 | } 16 | /** 17 | * 成功返回 18 | * 19 | * @param data 需要返回的 JSON 格式数据 20 | * @param msg 需要返回的文字提示信息 21 | * @return 返回固定 JSON 格式的 Result 22 | */ 23 | public static Object success(Object data, String msg) { 24 | Result result = new Result(); 25 | result.setResultCode("200"); 26 | result.setData(data); 27 | result.setMsg(msg); 28 | return result; 29 | } 30 | 31 | public static Object success(String msg) { 32 | Result result = new Result(); 33 | result.setResultCode("200"); 34 | result.setMsg(msg); 35 | return result; 36 | } 37 | 38 | public static Object success(Object data) { 39 | Result result = new Result(); 40 | result.setResultCode("200"); 41 | result.setData(data); 42 | return result; 43 | } 44 | 45 | public static Object success() { 46 | Result result = new Result(); 47 | result.setResultCode("200"); 48 | return result; 49 | } 50 | 51 | /** 52 | * 错误返回 53 | * @return 返回固定 JSON 格式的 Result 54 | */ 55 | public static Object error() { 56 | Result result = new Result(); 57 | result.setResultCode("0"); 58 | return result; 59 | } 60 | 61 | public static Object error(String msg) { 62 | Result result = new Result(); 63 | result.setResultCode("0"); 64 | result.setMsg(msg); 65 | return result; 66 | } 67 | 68 | public static Object error(String msg, String resultCode) { 69 | Result result = new Result(); 70 | result.setMsg(msg); 71 | result.setResultCode(resultCode); 72 | return result; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /community-management-system-fe/src/components/finalResetPassword.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 71 | 72 | 78 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/UserProfileController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.ProfileInfo; 5 | import com.example.csgs.mapper.ProfileMapper; 6 | import com.example.csgs.service.UserProfileService; 7 | import com.example.csgs.utils.AuthorityUtil; 8 | import com.example.csgs.utils.IsIntegerUtil; 9 | import com.example.csgs.utils.RedisUtil; 10 | import com.example.csgs.utils.ResultUtil; 11 | import lombok.extern.log4j.Log4j; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import javax.annotation.Resource; 15 | import javax.servlet.http.HttpServletRequest; 16 | 17 | @RestController 18 | @RequestMapping("/profile") 19 | @Log4j 20 | public class UserProfileController { 21 | @Resource 22 | UserProfileService userProfileService; 23 | @Resource 24 | ProfileMapper profileMapper; 25 | @Resource 26 | RedisUtil redisUtil; 27 | /** 28 | * 修改资料接口 29 | * 场景:用户进入资料编辑界面,对可修改的信息进行修改 30 | */ 31 | 32 | @PostMapping("/modify/{id}") 33 | public Object updateMaterial(HttpServletRequest request, @RequestBody JSONObject jsonObject, @PathVariable String id) { 34 | if (IsIntegerUtil.isInteger(id) && AuthorityUtil.authority(request, id, redisUtil) && 35 | userProfileService.updateMaterial(jsonObject, Long.parseLong(id))) { 36 | log.info("用户<"+ id +">资料修改成功!"); 37 | return ResultUtil.success("用户资料修改成功!"); 38 | } 39 | log.info("用户<"+ id +">资料修改失败!"); 40 | return ResultUtil.error("用户资料修改失败!"); 41 | } 42 | 43 | /** 44 | * 获取用户资料接口 45 | * 场景:用户进入资料编辑界面,展示资料信息 46 | */ 47 | @GetMapping("/getProfile/{id}") 48 | public Object getMaterial(HttpServletRequest request, @PathVariable String id) { 49 | if (IsIntegerUtil.isInteger(id)) { 50 | ProfileInfo material = profileMapper.getMaterial(Long.parseLong(id)); 51 | if (material != null) { 52 | log.info("用户<" + id + ">获取资料成功!"); 53 | return ResultUtil.success(material, "用户资料获取成功!"); 54 | } 55 | } 56 | log.info("用户<"+ id +">获取资料失败!"); 57 | return ResultUtil.error("用户资料获取失败!"); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/FeLogController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.FeLog; 5 | import com.example.csgs.entity.LogTimeResult; 6 | import com.example.csgs.entity.LogTypeResult; 7 | import com.example.csgs.mapper.FeLogMapper; 8 | import com.example.csgs.utils.AuthorityUtil; 9 | import com.example.csgs.utils.IsIntegerUtil; 10 | import com.example.csgs.utils.RedisUtil; 11 | import com.example.csgs.utils.ResultUtil; 12 | import lombok.extern.log4j.Log4j; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import javax.annotation.Resource; 16 | import javax.servlet.http.HttpServletRequest; 17 | import java.util.List; 18 | 19 | @RestController 20 | @RequestMapping("/log") 21 | @Log4j 22 | public class FeLogController { 23 | @Resource 24 | FeLogMapper feLogMapper; 25 | @Resource 26 | RedisUtil redisUtil; 27 | 28 | @PostMapping("/storage/{id}") 29 | public Object logStorage(HttpServletRequest request, @RequestBody JSONObject jsonObject, @PathVariable String id) { 30 | FeLog feLog = JSONObject.toJavaObject(jsonObject, FeLog.class); 31 | feLog.setUserId(Long.parseLong(id)); 32 | if (IsIntegerUtil.isInteger(id) && AuthorityUtil.authority(request, id, redisUtil)) { 33 | if (feLogMapper.insertLog(feLog) > 0) { 34 | log.info("用户Id<" + feLog.getUserId() + ">前端用户操作日志存储成功!"); 35 | return ResultUtil.success("前端用户操作日志存储成功!"); 36 | } 37 | } 38 | log.info("用户Id<" + feLog.getUserId() + ">前端用户操作日志存储失败!"); 39 | return ResultUtil.error("前端用户操作日志存储失败!"); 40 | } 41 | 42 | @GetMapping("/AggregateQuery/time") 43 | public Object queryTime() { 44 | List logTimeResults = feLogMapper.queryTimeLog(); 45 | if (logTimeResults != null) { 46 | return ResultUtil.success(logTimeResults,"日期聚合查询成功!"); 47 | } 48 | return ResultUtil.error("日期聚合查询失败"); 49 | } 50 | 51 | @GetMapping("/AggregateQuery/type") 52 | public Object queryType() { 53 | List logTypeResults = feLogMapper.queryTypeLog(); 54 | if (logTypeResults != null) { 55 | return ResultUtil.success(logTypeResults,"类型聚合查询成功!"); 56 | } 57 | return ResultUtil.error("类型聚合查询失败"); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/configs/UserRealm.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.configs; 2 | 3 | import com.example.csgs.entity.UserEntity; 4 | import com.example.csgs.mapper.UserMapper; 5 | import lombok.extern.log4j.Log4j; 6 | import org.apache.shiro.SecurityUtils; 7 | import org.apache.shiro.authc.*; 8 | import org.apache.shiro.authz.AuthorizationInfo; 9 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 10 | import org.apache.shiro.realm.AuthorizingRealm; 11 | import org.apache.shiro.subject.PrincipalCollection; 12 | import org.apache.shiro.subject.Subject; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | 15 | import java.util.HashSet; 16 | import java.util.Set; 17 | 18 | @Log4j 19 | public class UserRealm extends AuthorizingRealm { 20 | @Autowired 21 | UserMapper userMapper; 22 | 23 | //授权 24 | @Override 25 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { 26 | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); 27 | Set authority = new HashSet<>(); 28 | 29 | Subject subject = SecurityUtils.getSubject(); 30 | UserEntity currentUser = (UserEntity) subject.getPrincipal(); 31 | switch (currentUser.getUserType()) { 32 | case 1: 33 | log.info("[网格员]进行授权"); 34 | authority.add("grid"); 35 | break; 36 | case 2: 37 | log.info("[领导]进行授权"); 38 | authority.add("leader"); 39 | break; 40 | case 3: 41 | log.info("[系统管理员]进行授权"); 42 | authority.add("leader"); 43 | authority.add("admin"); 44 | break; 45 | } 46 | info.addStringPermissions(authority); 47 | return info; 48 | } 49 | 50 | //认证 51 | @Override 52 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { 53 | UsernamePasswordToken userToken = (UsernamePasswordToken) token; 54 | UserEntity userEntity = userMapper.findOneByUserID(userToken.getUsername()); 55 | if (userEntity != null) { 56 | log.info("userID<"+ userEntity.getUserID() + ">进行认证"); 57 | return new SimpleAuthenticationInfo(userEntity, userEntity.getUserPassword(), ""); 58 | } 59 | return null; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/utils/RedisUtil.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.utils; 2 | 3 | import org.springframework.data.redis.core.StringRedisTemplate; 4 | import org.springframework.stereotype.Component; 5 | 6 | import javax.annotation.PostConstruct; 7 | import java.util.concurrent.TimeUnit; 8 | 9 | @Component 10 | public class RedisUtil { 11 | 12 | private final StringRedisTemplate redisTemplate; 13 | 14 | private static RedisUtil redisUtil; 15 | 16 | public RedisUtil(StringRedisTemplate redisTemplate) { 17 | this.redisTemplate = redisTemplate; 18 | } 19 | 20 | /** 21 | * 此方法只在 Spring启动时 加载一次 22 | */ 23 | @PostConstruct 24 | public void init() { 25 | redisUtil = this; 26 | } 27 | 28 | /** 29 | * 普通缓存获取 30 | * @param key 键 31 | * @return 值 32 | */ 33 | public Object get(String key) { 34 | return key == null ? null : redisTemplate.opsForValue().get(key); 35 | } 36 | 37 | /** 38 | * redis存入数据和设置缓存时间 39 | * 40 | * @param key 键 41 | * @param value 值 42 | * @param time 秒 43 | */ 44 | public void set(String key, String value, long time) { 45 | redisUtil.redisTemplate.opsForValue().set(key, value, time, TimeUnit.DAYS); 46 | } 47 | 48 | /** 49 | * redis根据key删除值 50 | * @param key 键 51 | */ 52 | public void remove(String key) { 53 | redisUtil.redisTemplate.delete(key); 54 | } 55 | 56 | /** 57 | * redis存入数据 58 | * 59 | * @param key 键 60 | * @param value 值 61 | */ 62 | public void set(String key, String value) { 63 | redisUtil.redisTemplate.opsForValue().set(key, value); 64 | } 65 | 66 | /** 67 | * 根据 key 获取过期时间 68 | * 69 | * @param key 70 | * @return 71 | */ 72 | public Long getExpire(String key) { 73 | return redisUtil.redisTemplate.getExpire(key, TimeUnit.DAYS); 74 | } 75 | 76 | /** 77 | * 判断 key 是否存在 78 | * 79 | * @param key 80 | * @return 81 | */ 82 | public static Boolean hasKey(String key) { 83 | return redisUtil.redisTemplate.hasKey(key); 84 | } 85 | 86 | /** 87 | * 根据 key 设置过期时间 88 | * 89 | * @param key key 90 | * @param time 秒 91 | * @return 92 | */ 93 | public Boolean expire(String key, long time) { 94 | return redisUtil.redisTemplate.expire(key, time, TimeUnit.DAYS); 95 | } 96 | } -------------------------------------------------------------------------------- /community-management-system-fe/src/components/common-header.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 59 | 60 | 99 | -------------------------------------------------------------------------------- /community-management-system-fe/src/components/secretVerify.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 84 | 85 | 90 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/search.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | 82 | 83 | 97 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/ResidentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.example.csgs.entity.CommunityInfo; 4 | import com.example.csgs.entity.PageQuery; 5 | import com.example.csgs.entity.Announcement; 6 | import com.example.csgs.entity.CommunityInfoEntity; 7 | import com.example.csgs.mapper.AnnouncementMapper; 8 | import com.example.csgs.mapper.ProfileMapper; 9 | import com.example.csgs.service.ResidentService; 10 | import com.example.csgs.utils.CalculatePageUtil; 11 | import com.github.pagehelper.Page; 12 | import com.github.pagehelper.PageHelper; 13 | import lombok.extern.log4j.Log4j; 14 | import org.springframework.stereotype.Service; 15 | 16 | import javax.annotation.Resource; 17 | import java.util.List; 18 | 19 | @Log4j 20 | @Service 21 | public class ResidentServiceImpl implements ResidentService { 22 | @Resource 23 | ProfileMapper profileMapper; 24 | @Resource 25 | AnnouncementMapper announcementMapper; 26 | /** 27 | * 场景:居民用户登陆,居民首页呈现自己所住小区名、房屋数量、停车位数量、居民数量 28 | * 和网格员向本小区发送的公告信息 29 | * 注意:当前id是居民用户的id 30 | * @param id 在user表中某一居民的id 31 | */ 32 | @Override 33 | public CommunityInfo findResidentRPH(Long id) { 34 | CommunityInfoEntity communityInfoEntity = profileMapper.findResidentRPH(id); 35 | String communityName = communityInfoEntity.getCommunityName(); 36 | Long numHouses = communityInfoEntity.getNumHouses(); 37 | Long numResidents = communityInfoEntity.getNumResidents(); 38 | Long numParkingSpaces = communityInfoEntity.getNumParkingSpaces(); 39 | return new CommunityInfo(communityName, numHouses, numResidents, numParkingSpaces); 40 | } 41 | 42 | /** 43 | * 场景:在居民首页中获取自身所在网格区域的公告信息 44 | * @param id 在user表中某一居民的id 45 | * @param page 当前请求页数 46 | */ 47 | @Override 48 | public PageQuery getAnnouncementOfGrid(Long id,String page) { 49 | int pageSize = 10; 50 | if (profileMapper.findGridIdIsExist(id) > 0) {//判断该用户所在小区现在是否有网格员管理 51 | CommunityInfoEntity communityInfoEntity = profileMapper.findUserIdByProfileId(id); 52 | Long gid = communityInfoEntity.getGridId().getUserId().getId(); 53 | Page pageAble = PageHelper.startPage(Integer.parseInt(page), pageSize); 54 | PageHelper.orderBy("id ASC");//按id升序排列 55 | List announcementList = announcementMapper.findAnnouncementByCreator(gid); 56 | return CalculatePageUtil. 57 | getPageInfo(Integer.parseInt(page), pageSize, pageAble, announcementList); 58 | } 59 | return null; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 20 | 21 | 26 | 27 | 38 | 39 | 50 | 51 | 52 | 53 | update user 54 | set user.user_password=#{newPassword} 55 | where user.id = #{id} 56 | 57 | 58 | 59 | insert into user(userid, user_password, profile_id, pwd_pro_id) 60 | values (#{userID}, #{password}, #{profileId}, #{pwdId}) 61 | 62 | 63 | 64 | update user 65 | set user_type = '1' 66 | where userid = #{userID} 67 | 68 | 69 | 70 | update user 71 | set user_type = '0' 72 | where userid = #{userID} 73 | 74 | 75 | 80 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/LeaderViewController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.example.csgs.entity.CommunityInfo; 4 | import com.example.csgs.entity.DistrictEntity; 5 | import com.example.csgs.entity.DistrictInfo; 6 | import com.example.csgs.mapper.DistrictMapper; 7 | import com.example.csgs.service.LeaderViewService; 8 | import com.example.csgs.utils.IsIntegerUtil; 9 | import com.example.csgs.utils.ResultUtil; 10 | import lombok.extern.log4j.Log4j; 11 | import org.springframework.web.bind.annotation.GetMapping; 12 | import org.springframework.web.bind.annotation.PathVariable; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import javax.annotation.Resource; 17 | import java.util.List; 18 | 19 | @RestController 20 | @RequestMapping("/leader") 21 | @Log4j 22 | public class LeaderViewController { 23 | @Resource 24 | DistrictMapper districtMapper; 25 | @Resource 26 | LeaderViewService leaderViewService; 27 | 28 | /** 29 | * 场景:此时,领导想要看的的整体各项数据(以区为单位展示数据信息内容) 30 | * 所以,我们要整理出每个区下,Residents、Houses、ParkingSpaces各自总和 31 | */ 32 | @GetMapping("/getDistrictRPHList") 33 | public Object getDistrictRSHList() { 34 | List districtRSHList = leaderViewService.getDistrictRSHList(); 35 | if (!districtRSHList.isEmpty()) { 36 | log.info("领导正在查看总体数据....."); 37 | return ResultUtil.success(districtRSHList, "获取所有区RPH信息成功! "); 38 | } 39 | log.info("领导获取总体数据信息失败!"); 40 | return ResultUtil.error("获取所有区RPH信息失败! "); 41 | } 42 | 43 | /** 44 | * 场景:领导在选择查看某一片区数据情况时,前端得先从服务器获取所有片区名信息 45 | * 没有构建相应的service实现方法,主要是太简单。 46 | * 如果你使用mybatis查询过程比较复杂,可以新建接口方法,并在service中实现 47 | */ 48 | @GetMapping("/getAllDistrictName") 49 | public Object getAllDistrictName() { 50 | List districtEntities = districtMapper.findAllDistrict(); 51 | log.info("领导正在<片区界面>选择查看哪一个区的RPH信息......"); 52 | return ResultUtil.success(districtEntities, "获取所有区名信息成功!"); 53 | } 54 | 55 | /** 56 | * 场景:此时,领导查看的数据形式为:选择某一区对车位数、居民数、住宅数可视化数据查看 57 | * 所以从前端接受到内容主要是“在District表中区所对应的id号” 58 | */ 59 | @GetMapping("/getCommunityRPHList/{id}") 60 | public Object getCommunityRSHList(@PathVariable String id) { 61 | if (IsIntegerUtil.isInteger(id)) { 62 | List communityRPHList = leaderViewService.getCommunityRPHList(Long.parseLong(id)); 63 | if (!communityRPHList.isEmpty()) { 64 | log.info("获取id<" + id + ">的区所有小区RPH信息成功! "); 65 | return ResultUtil.success(communityRPHList, "获取id<" + id + ">的区所有小区RPH信息成功! "); 66 | } 67 | } 68 | log.info("获取id<" + id + ">的区所有小区RPH信息失败! "); 69 | return ResultUtil.error("获取id为" + id + "的区所有小区RPH信息失败! "); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/ResidentController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.example.csgs.entity.CommunityInfo; 4 | import com.example.csgs.entity.PageQuery; 5 | import com.example.csgs.entity.Announcement; 6 | import com.example.csgs.service.ResidentService; 7 | import com.example.csgs.utils.AuthorityUtil; 8 | import com.example.csgs.utils.IsIntegerUtil; 9 | import com.example.csgs.utils.RedisUtil; 10 | import com.example.csgs.utils.ResultUtil; 11 | import lombok.extern.log4j.Log4j; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import javax.annotation.Resource; 15 | import javax.servlet.http.HttpServletRequest; 16 | 17 | @RestController 18 | @RequestMapping("/resident") 19 | @Log4j 20 | public class ResidentController { 21 | @Resource 22 | ResidentService residentService; 23 | @Resource 24 | RedisUtil redisUtil; 25 | 26 | /** 27 | * 场景:居民用户登陆,居民首页呈现自己所住小区名、房屋数量、停车位数量、居民数量 28 | * 和网格员向本小区发送的公告信息 29 | * 注意:当前id是居民用户的id 30 | */ 31 | @GetMapping("/ResidentRPH/{id}") 32 | public Object queryCommunityInfo(HttpServletRequest request, @PathVariable String id) { 33 | if (IsIntegerUtil.isInteger(id) && AuthorityUtil.authority(request, id, redisUtil)) { 34 | CommunityInfo communityInfo = residentService.findResidentRPH(Long.parseLong(id)); 35 | if (communityInfo != null) { 36 | log.info("用户<" + id + ">获取所在小区RPH信息成功!"); 37 | return ResultUtil.success(communityInfo, "用户所在社区RPH信息获取成功!"); 38 | } 39 | log.info("用户<" + id + ">获取所在小区RPH信息失败!"); 40 | return ResultUtil.error("用户所在社区RPH信息获取失败!"); 41 | } 42 | log.info("[Refuse]用户所在社区RPH信息查询不匹配!"); 43 | return ResultUtil.success("[Refuse]用户所在社区RPH信息查询不匹配!"); 44 | } 45 | 46 | /** 47 | * 居民用户获取自己所处网格中网格员所发布的公告信息 48 | */ 49 | @GetMapping("/getAnnouncementOfGrid/{id}") 50 | public Object getAnnouncementOfGrid(HttpServletRequest request, @PathVariable String id, @RequestParam String page) { 51 | if (IsIntegerUtil.isInteger(id) && AuthorityUtil.authority(request, id, redisUtil)) { 52 | PageQuery announcementList = residentService.getAnnouncementOfGrid(Long.parseLong(id), page); 53 | if (announcementList != null) { 54 | log.info("用户<" + id + ">获取所在网格公告信息成功!"); 55 | return ResultUtil.success(announcementList, "获取用户所在网格公告信息成功!"); 56 | } 57 | if (Integer.parseInt(page) > 1) { 58 | log.info("居民用户<"+ id +">所在小区已无更多公告!"); 59 | return ResultUtil.error(" 已无更多公告!"); 60 | } 61 | log.info("用户<" + id + ">该用户所在小区未发布任何公告!"); 62 | return ResultUtil.error("该用户所在小区未发布任何公告!"); 63 | } 64 | log.info("[Refuse]用户所在社区公告信息查询不匹配!"); 65 | return ResultUtil.success("[Refuse]用户所在社区公告信息查询不匹配!"); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/UserPwdProServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.example.csgs.entity.PwdProEntity; 4 | import com.example.csgs.mapper.PwdProMapper; 5 | import com.example.csgs.mapper.UserMapper; 6 | import com.example.csgs.service.UserPwdProService; 7 | import lombok.extern.log4j.Log4j; 8 | import org.springframework.stereotype.Service; 9 | import org.springframework.transaction.annotation.Transactional; 10 | 11 | import javax.annotation.Resource; 12 | import java.util.ArrayList; 13 | import java.util.HashMap; 14 | import java.util.List; 15 | 16 | @Log4j 17 | @Service 18 | @Transactional 19 | public class UserPwdProServiceImpl implements UserPwdProService { 20 | @Resource 21 | UserMapper userMapper; 22 | @Resource 23 | PwdProMapper pwdProMapper; 24 | 25 | /** 26 | * 从List集合中提取密保放到HashMap中 27 | * @param id 修改密保用户id 28 | * @param map 装载容器 29 | * @param list 传递密保数据集合 30 | */ 31 | private void addPwdPro(Long id,HashMap map, List list) { 32 | map.put("id",id); 33 | map.put("questionOne",list.get(0)); 34 | map.put("answerOne",list.get(1)); 35 | map.put("questionTwo",list.get(2)); 36 | map.put("answerTwo",list.get(3)); 37 | } 38 | 39 | /** 40 | * 此密保设置,同时也是密保修改接口,而且只要这个人存在,那么他所对应的PwdProEntity就存在, 41 | * 所以不存在插入一个密保的说法 42 | * @param id user表中用户id 43 | * @param list 密保信息集合 44 | */ 45 | @Override 46 | public boolean setPwdPro(Long id, List list) { 47 | PwdProEntity pwdProEntity = pwdProMapper.findPwdProById(id); 48 | HashMap map = new HashMap<>(); 49 | addPwdPro(id,map,list); 50 | if (pwdProEntity != null) { 51 | addPwdPro(id,map,list); 52 | return pwdProMapper.updatePwdPro(map) > 0; 53 | } 54 | return false; 55 | } 56 | 57 | /** 58 | * 返回用户密保问题 59 | * @param id user表中用户id 60 | */ 61 | @Override 62 | public List returnPwdProQue(Long id) { 63 | List list = new ArrayList<>(); 64 | PwdProEntity pwdProEntity = pwdProMapper.findPwdProQueById(id); 65 | if (pwdProEntity != null) { 66 | list.add(pwdProEntity.getQuestionOne()); 67 | list.add(pwdProEntity.getQuestionTwo()); 68 | return list; 69 | } 70 | return null; 71 | } 72 | 73 | /** 74 | * 判断用户填写的密保问题答案是否与数据库一致 75 | * @param id user表中用户id 76 | * @param list 用户密保问题答案集合 77 | */ 78 | @Override 79 | public boolean comparePwdProAns(Long id, List list) { 80 | PwdProEntity pwdProAnsById = pwdProMapper.findPwdProAnsById(id); 81 | if (pwdProAnsById != null) { 82 | return list.get(0).equals(pwdProAnsById.getAnswerOne()) && 83 | list.get(1).equals(pwdProAnsById.getAnswerTwo()); 84 | } 85 | return false; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/resources/mybatis/mapper/CommunityInfoMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 14 | 15 | 22 | 23 | 30 | 31 | 39 | 40 | 47 | 48 | 55 | 56 | 57 | update community_info 58 | set grid_id = null 59 | where id = #{id} 60 | 61 | 62 | 63 | update community_info 64 | set grid_id = #{gridId} 65 | where id = #{id} 66 | 67 | 68 | 75 | 76 | 83 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/passwordReset.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 84 | 85 | 107 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/GridQueryController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.PageQuery; 5 | import com.example.csgs.entity.User; 6 | import com.example.csgs.service.GridQueryService; 7 | import com.example.csgs.utils.IsIntegerUtil; 8 | import com.example.csgs.utils.ResultUtil; 9 | import lombok.extern.log4j.Log4j; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import javax.annotation.Resource; 13 | import java.io.IOException; 14 | 15 | @RestController 16 | @RequestMapping("/query") 17 | @Log4j 18 | public class GridQueryController { 19 | @Resource 20 | GridQueryService gridQueryService; 21 | 22 | /** 23 | * 通过网格员id查询居民用户信息列表 24 | * 场景:网格员登陆进入主界面,数据列表界面 25 | */ 26 | @GetMapping("/allUserOfGrid/{id}") 27 | public Object allUserOfGrid(@PathVariable String id, @RequestParam String page) { 28 | if (IsIntegerUtil.isInteger(id)) { 29 | PageQuery pageQuery = gridQueryService.allUserOfGrid(Long.parseLong(id), page); 30 | if (pageQuery != null) { 31 | log.info("网格员id<" + id + ">获取用户数据列表第<" + page + ">页成功!"); 32 | return ResultUtil.success(pageQuery, "居民用户信息获取成功!"); 33 | } 34 | if (Integer.parseInt(page) > 1) { 35 | log.info("已无更多公告!"); 36 | return ResultUtil.error(" 已无更多公告!"); 37 | } 38 | } 39 | log.info("网格员id<" + id + ">获取用户数据列表第<" + page + ">页失败!"); 40 | return ResultUtil.error("居民用户信息获取失败!"); 41 | } 42 | 43 | /** 44 | * 按各种用户身份信息进行查询 45 | * 场景:网格员查询用户信息 46 | * 组合:<归属小区、姓名>、<归属小区>、<姓名>、 47 | */ 48 | @PostMapping("/multipleConditions/{id}") 49 | public Object multipleConditions(@RequestBody JSONObject jsonObject, @PathVariable String id, @RequestParam String page) throws IOException { 50 | if (IsIntegerUtil.isInteger(id)) { 51 | String userID = jsonObject.getString("userID"); 52 | String userName = jsonObject.getString("userName"); 53 | String community = jsonObject.getString("community"); 54 | 55 | PageQuery userPageQuery = gridQueryService.multipleConditions(userID, userName, community, Long.parseLong(id), page); 56 | if (userPageQuery != null) { 57 | log.info("网格员id<" + id + ">查询居民用户信息成功"); 58 | return ResultUtil.success(userPageQuery, "居民用户信息获取成功"); 59 | } 60 | } 61 | log.info("网格员id<" + id + ">查询居民用户信息失败"); 62 | return ResultUtil.error("居民用户信息获取失败!"); 63 | } 64 | 65 | /** 66 | * 网格员删除自己所管辖区的用户 67 | * 场景:网格员在查看用户数据列表时,可以删除相应的用户 68 | * URL中的id是居民用户的id 69 | */ 70 | @GetMapping("/deleteResident/{id}") 71 | public Object deleteUser(@PathVariable String id) { 72 | if (IsIntegerUtil.isInteger(id) && gridQueryService.deleteUser(Long.parseLong(id))) { 73 | log.info("居民<" + id + ">成功被网格员删除!"); 74 | return ResultUtil.success("用户删除成功!"); 75 | } 76 | log.info("居民<" + id + ">未能被网格员删除!"); 77 | return ResultUtil.error("用户删除失败!"); 78 | } 79 | 80 | } 81 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/UserProfileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.CommunityInfoEntity; 5 | import com.example.csgs.entity.OfGrid; 6 | import com.example.csgs.entity.UserProfile; 7 | import com.example.csgs.mapper.CommunityInfoMapper; 8 | import com.example.csgs.mapper.ProfileMapper; 9 | import com.example.csgs.service.UserProfileService; 10 | import lombok.extern.log4j.Log4j; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import javax.annotation.Resource; 15 | import java.util.HashMap; 16 | 17 | @Service 18 | @Transactional 19 | @Log4j 20 | public class UserProfileServiceImpl implements UserProfileService { 21 | @Resource 22 | ProfileMapper profileMapper; 23 | @Resource 24 | CommunityInfoMapper communityInfoMapper; 25 | 26 | /** 27 | * 修改资料接口 28 | * 场景:用户进入资料编辑界面,对可修改的信息进行修改 29 | * 30 | * @param id 将要修改资料用户在user表中的id,同样也可以是userProfile表中的id(一对一的关系) 31 | */ 32 | @Override 33 | public boolean updateMaterial(JSONObject jsonObject, Long id) { 34 | UserProfile userProfile = profileMapper.findById(id); 35 | if (userProfile != null) { 36 | HashMap map = new HashMap<>(); 37 | addDataToMap(map, jsonObject, id); 38 | 39 | if (jsonObject.containsKey("ofGrid")) { 40 | JSONObject ofGridObject = jsonObject.getJSONObject("ofGrid"); 41 | OfGrid ofGrid = JSONObject.toJavaObject(ofGridObject, OfGrid.class); 42 | String districtName = ofGrid.getDistrictName(); 43 | String communityName = ofGrid.getCommunityName(); 44 | System.out.println(districtName); 45 | CommunityInfoEntity communityInfoEntity = communityInfoMapper. 46 | findByOfGrid(districtName, communityName); 47 | 48 | if (communityInfoEntity != null) { 49 | map.put("communityId", communityInfoEntity.getId()); 50 | } 51 | } 52 | return profileMapper.updateProfile(map) > 0; 53 | } 54 | return false; 55 | } 56 | 57 | /** 58 | * 从Json串中提取资料信息添加到Map中 59 | * 60 | */ 61 | private void addDataToMap(HashMap map, JSONObject jsonObject, Long id) { 62 | map.put("id", id); 63 | map.put("avatarUrl",jsonObject.getString("avatarUrl")); 64 | map.put("occupation", jsonObject.getString("occupation")); 65 | map.put("bloodType", jsonObject.getString("bloodType")); 66 | map.put("degreeOfEducation", jsonObject.getString("degreeOfEducation")); 67 | map.put("email", jsonObject.getString("email")); 68 | map.put("nation", jsonObject.getString("nation")); 69 | map.put("politicCountenance", jsonObject.getString("politicCountenance")); 70 | map.put("sex", jsonObject.getString("sex")); 71 | map.put("stature", jsonObject.getString("stature")); 72 | map.put("telPhone", jsonObject.getString("telPhone")); 73 | map.put("userName", jsonObject.getString("userName")); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/DashBoard.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 92 | 93 | 105 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/UserSignController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.UserEntity; 5 | import com.example.csgs.mapper.UserMapper; 6 | import com.example.csgs.service.UserSignService; 7 | import com.example.csgs.utils.JwtUtil; 8 | import com.example.csgs.utils.RedisUtil; 9 | import com.example.csgs.utils.ResultUtil; 10 | import com.example.csgs.utils.SHA256Util; 11 | import lombok.extern.log4j.Log4j; 12 | import org.apache.shiro.SecurityUtils; 13 | import org.apache.shiro.authc.IncorrectCredentialsException; 14 | import org.apache.shiro.authc.UnknownAccountException; 15 | import org.apache.shiro.authc.UsernamePasswordToken; 16 | import org.apache.shiro.subject.Subject; 17 | import org.springframework.web.bind.annotation.*; 18 | 19 | import javax.annotation.Resource; 20 | import javax.servlet.http.HttpServletRequest; 21 | import java.util.HashMap; 22 | import java.util.Map; 23 | 24 | @RestController 25 | @RequestMapping("/sign") 26 | @Log4j 27 | public class UserSignController { 28 | @Resource 29 | UserSignService userSignService; 30 | @Resource 31 | UserMapper userMapper; 32 | @Resource 33 | RedisUtil redisUtil; 34 | 35 | @PostMapping("/signIn") 36 | public Object toLogin(@RequestBody JSONObject jsonObject) { 37 | Subject subject = SecurityUtils.getSubject(); 38 | String userID = jsonObject.getString("userID"); 39 | String password = SHA256Util.getSHA256String(jsonObject.getString("password")); 40 | UsernamePasswordToken token = new UsernamePasswordToken(userID, password); 41 | 42 | try { 43 | subject.login(token); 44 | UserEntity userEntity = userMapper.findOneByUserID(userID); 45 | String tokens = JwtUtil.genJsonWebToken(userEntity); 46 | 47 | redisUtil.set(tokens, String.valueOf(userEntity.getId()), JwtUtil.TOKEN_EXPIRE_TIME); 48 | Map map = new HashMap<>(); 49 | map.put("token", tokens); 50 | map.put("sessionID", String.valueOf(subject.getSession().getId())); 51 | log.info("用户<" + userID + "> 登录成功!"); 52 | return ResultUtil.success(map, "用户 <" + userID + "> 登录成功!"); 53 | } catch (UnknownAccountException e) { 54 | log.info("用户<" + userID + "> 不存在!"); 55 | return ResultUtil.error("用户 <" + userID + "> 不存在!"); 56 | } catch (IncorrectCredentialsException e) { 57 | log.info("用户<" + userID + "> 密码错误!"); 58 | return ResultUtil.error("用户 <" + userID + "> 密码错误!"); 59 | } 60 | 61 | } 62 | 63 | /** 64 | * 登出接口 65 | */ 66 | @GetMapping("/signOut") 67 | public Object logout(HttpServletRequest request) { 68 | if (userSignService.signOut(request)) { 69 | Subject subject = SecurityUtils.getSubject(); 70 | try { 71 | subject.logout(); 72 | return ResultUtil.success("退出登录Success!"); 73 | } catch (UnknownAccountException e) { 74 | log.info("退出登陆Failure!"); 75 | return ResultUtil.error("退出登录Failure,sessionID不正确!"); 76 | } 77 | } 78 | log.info("退出登录Failure,令牌信息不正确!"); 79 | return ResultUtil.success("退出登录Failure,令牌信息不正确!"); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/editAnnouncement.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 109 | 110 | 132 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/setPasswordProtect.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | 116 | 117 | 127 | -------------------------------------------------------------------------------- /community-management-system-fe/src/components/phoneCodeVerify.vue: -------------------------------------------------------------------------------- 1 | 37 | 38 | 120 | 121 | 131 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/OfficerAddUser.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 112 | 113 | 131 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/configs/ShiroConfig.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.configs; 2 | 3 | import lombok.extern.log4j.Log4j; 4 | import org.apache.shiro.session.mgt.SessionManager; 5 | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; 6 | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; 7 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.core.Ordered; 11 | import org.springframework.web.cors.CorsConfiguration; 12 | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; 13 | import org.springframework.web.filter.CorsFilter; 14 | 15 | import javax.servlet.Filter; 16 | import java.util.Collections; 17 | import java.util.LinkedHashMap; 18 | 19 | @Configuration 20 | @Log4j 21 | public class ShiroConfig { 22 | @Bean 23 | public ShiroFilterFactoryBean shiroFilterFactoryBean() { 24 | ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean(); 25 | //设置安全管理器 26 | bean.setSecurityManager(defaultWebSecurityManager()); 27 | //添加shiro的内置过滤器 28 | /* 29 | anon:无需认证就可以访问 30 | authc:必须认证了才能访问 31 | user:必须拥有“记住我”功能才能使用 32 | perms:拥有对某个资源的权限才能访问 33 | role:拥有某个角色权限才能访问 34 | */ 35 | LinkedHashMap filterMap = new LinkedHashMap<>(); 36 | filterMap.put("/grid/**", "perms[grid]"); 37 | filterMap.put("/query/**", "perms[grid]"); 38 | filterMap.put("/leader/**", "perms[leader]"); 39 | filterMap.put("/admin/**", "perms[admin]"); 40 | filterMap.put("/resident/**", "authc"); 41 | filterMap.put("/profile/**","authc"); 42 | filterMap.put("/pwdPro/**","authc"); 43 | filterMap.put("/log/storage/**","authc"); 44 | filterMap.put("/log/AggregateQuery/**","perms[admin]"); 45 | bean.setFilterChainDefinitionMap(filterMap); 46 | return bean; 47 | } 48 | 49 | //DefaultWebSecurityManager 50 | @Bean 51 | public DefaultWebSecurityManager defaultWebSecurityManager() { 52 | DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); 53 | //关联UserRealm 54 | securityManager.setRealm(userRealm()); 55 | //关联sessionManager 56 | securityManager.setSessionManager(sessionManager()); 57 | return securityManager; 58 | } 59 | 60 | //创建realm对象 61 | @Bean(name = "userRealm") 62 | public UserRealm userRealm() { 63 | return new UserRealm(); 64 | } 65 | 66 | //sessionId管理 67 | @Bean 68 | public SessionManager sessionManager() { 69 | return new CustomSessionManager(); 70 | } 71 | 72 | //跨域 73 | @Bean 74 | public FilterRegistrationBean corsFilter() { 75 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); 76 | CorsConfiguration corsConfiguration = new CorsConfiguration(); 77 | corsConfiguration.setAllowCredentials(true); 78 | corsConfiguration.setAllowedOrigins(Collections.singletonList(CorsConfiguration.ALL)); 79 | corsConfiguration.setAllowedHeaders(Collections.singletonList(CorsConfiguration.ALL)); 80 | corsConfiguration.setAllowedMethods(Collections.singletonList(CorsConfiguration.ALL)); 81 | corsConfiguration.addExposedHeader("Authorization"); 82 | corsConfiguration.addExposedHeader("csgs_token"); 83 | source.registerCorsConfiguration("/**", corsConfiguration); 84 | FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source)); 85 | bean.setOrder(Ordered.HIGHEST_PRECEDENCE); 86 | return bean; 87 | } 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/LeaderViewServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.example.csgs.entity.CommunityInfo; 4 | import com.example.csgs.entity.CommunityInfoEntity; 5 | import com.example.csgs.entity.DistrictEntity; 6 | import com.example.csgs.entity.DistrictInfo; 7 | import com.example.csgs.mapper.CommunityInfoMapper; 8 | import com.example.csgs.mapper.DistrictMapper; 9 | import com.example.csgs.service.LeaderViewService; 10 | import lombok.extern.log4j.Log4j; 11 | import org.springframework.stereotype.Service; 12 | 13 | import javax.annotation.Resource; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @Log4j 18 | @Service 19 | public class LeaderViewServiceImpl implements LeaderViewService { 20 | @Resource 21 | DistrictMapper districtMapper; 22 | @Resource 23 | CommunityInfoMapper communityInfoMapper; 24 | 25 | /** 26 | * 场景:此时,领导想要看的的整体各项数据(以区为单位展示数据信息内容) 27 | * 所以,我们要整理出每个区下,Residents、Houses、ParkingSpaces各自总和 28 | */ 29 | @Override 30 | public List getDistrictRSHList() { 31 | List districtEntities = districtMapper.findAllDistrict(); 32 | List districtInfoList = new ArrayList<>(); 33 | 34 | for (DistrictEntity districtEntity : districtEntities) { 35 | List communityInfoEntities = 36 | communityInfoMapper.findByDistrictID(districtEntity.getId()); 37 | if (!communityInfoEntities.isEmpty()) { 38 | int allNumResidents = 0, allNumParkingSpaces = 0, allNumHouses = 0; 39 | 40 | for (CommunityInfoEntity communityInfoEntity : communityInfoEntities) { 41 | Long numResidents = communityInfoEntity.getNumResidents(); 42 | Long numParkingSpaces = communityInfoEntity.getNumParkingSpaces(); 43 | Long numHouses = communityInfoEntity.getNumHouses(); 44 | 45 | allNumResidents += numResidents; 46 | allNumParkingSpaces += numParkingSpaces; 47 | allNumHouses += numHouses; 48 | } 49 | DistrictInfo districtInfo = new DistrictInfo(districtEntity.getDistrictName(), 50 | allNumHouses, allNumResidents, allNumParkingSpaces); 51 | districtInfoList.add(districtInfo); 52 | } 53 | } 54 | return districtInfoList; 55 | } 56 | 57 | /** 58 | * 场景:此时,领导查看的数据形式为:选择某一区对车位数、居民数、住宅数可视化数据查看 59 | * 所以从前端接受到内容主要是“在District表中区所对应的id号” 60 | * @param id district表中的区的id 61 | */ 62 | @Override 63 | public List getCommunityRPHList(Long id) { 64 | DistrictEntity districtEntity = districtMapper.findById(id); 65 | if (districtEntity != null) { 66 | List communityInfoEntities = 67 | communityInfoMapper.findByDistrictID(districtEntity.getId()); 68 | List communityInfoList = new ArrayList<>(); 69 | if (!communityInfoEntities.isEmpty()) { 70 | for (CommunityInfoEntity communityInfoEntity : communityInfoEntities) { 71 | String communityName = communityInfoEntity.getCommunityName(); 72 | Long numResidents = communityInfoEntity.getNumResidents(); 73 | Long numParkingSpaces = communityInfoEntity.getNumParkingSpaces(); 74 | Long numHouses = communityInfoEntity.getNumHouses(); 75 | CommunityInfo communityInfo = new CommunityInfo(communityName, numHouses, numResidents, numParkingSpaces); 76 | communityInfoList.add(communityInfo); 77 | } 78 | } 79 | return communityInfoList; 80 | } 81 | return null; 82 | } 83 | } 84 | 85 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/announcementManage.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 120 | 121 | 136 | -------------------------------------------------------------------------------- /community-management-system-fe/src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import App from "./App.vue"; 3 | import router from "./router"; 4 | import store from "./store"; 5 | import moment from "moment"; 6 | import { 7 | Button, 8 | Badge, 9 | Radio, 10 | Dialog, 11 | RadioGroup, 12 | Menu, 13 | Checkbox, 14 | CheckboxGroup, 15 | Submenu, 16 | MenuItem, 17 | MenuItemGroup, 18 | Container, 19 | Dropdown, 20 | DropdownItem, 21 | DropdownMenu, 22 | Icon, 23 | Header, 24 | Popconfirm, 25 | Main, 26 | Footer, 27 | Form, 28 | FormItem, 29 | Input, 30 | Tabs, 31 | TabPane, 32 | Tag, 33 | Table, 34 | TableColumn, 35 | Aside, 36 | Card, 37 | Select, 38 | Upload, 39 | Option, 40 | Steps, 41 | Step, 42 | TimePicker, 43 | DatePicker, 44 | Pagination, 45 | Message, 46 | MessageBox, 47 | Notification, 48 | Loading 49 | } from "element-ui"; 50 | import "element-ui/lib/theme-chalk/index.css"; 51 | import "./assets/styles/common.scss"; 52 | // 公共样式 53 | 54 | import mavonEditor from "mavon-editor"; 55 | import "mavon-editor/dist/css/index.css"; 56 | 57 | import ECharts from "vue-echarts"; // 在 webpack 环境下指向 components/ECharts.vue 58 | 59 | // 手动引入 ECharts 各模块来减小打包体积 60 | import "echarts/lib/chart/bar"; 61 | import "echarts/lib/chart/pie"; 62 | import "echarts/lib/component/tooltip"; 63 | import "echarts/lib/component/legend"; 64 | import axios from "axios"; 65 | 66 | // 注册组件后即可使用 67 | Vue.component("v-chart", ECharts); 68 | Vue.use(mavonEditor); 69 | 70 | import Cookies from "js-cookie"; 71 | 72 | // 配置 axios 73 | axios.defaults.baseURL = "http://112.126.85.20:9090/"; 74 | axios.defaults.withCredentials = true; 75 | axios.interceptors.request.use(config => { 76 | // 设置统一的请求头 77 | if (Cookies.get("csgs_token")) { 78 | config.headers.csgs_token = Cookies.get("csgs_token"); 79 | config.headers.Authorization = Cookies.get("JSESSIONID"); 80 | } 81 | return config; 82 | }); 83 | 84 | Vue.prototype.$axios = axios; 85 | 86 | Vue.config.productionTip = false; 87 | Vue.use(Button) 88 | .use(Badge) 89 | .use(Checkbox) 90 | .use(Menu) 91 | .use(Submenu) 92 | .use(MenuItem) 93 | .use(MenuItemGroup) 94 | .use(DropdownMenu) 95 | .use(TimePicker) 96 | .use(DatePicker) 97 | .use(DropdownItem) 98 | .use(Dropdown) 99 | .use(Icon) 100 | .use(Dialog) 101 | .use(Aside) 102 | .use(Container) 103 | .use(Header) 104 | .use(Main) 105 | .use(Card) 106 | .use(Footer) 107 | .use(Radio) 108 | .use(RadioGroup) 109 | .use(Form) 110 | .use(Upload) 111 | .use(Select) 112 | .use(Steps) 113 | .use(Step) 114 | .use(Option) 115 | .use(Pagination) 116 | .use(FormItem) 117 | .use(Input) 118 | .use(Popconfirm) 119 | .use(CheckboxGroup) 120 | .use(Table) 121 | .use(TableColumn) 122 | .use(Tag) 123 | .use(TabPane) 124 | .use(Tabs) 125 | .use(Loading.directive); 126 | 127 | Vue.prototype.$loading = Loading.service; 128 | Vue.prototype.$msgbox = MessageBox; 129 | Vue.prototype.$alert = MessageBox.alert; 130 | Vue.prototype.$confirm = MessageBox.confirm; 131 | Vue.prototype.$prompt = MessageBox.prompt; 132 | Vue.prototype.$notify = Notification; 133 | Vue.prototype.$message = Message; 134 | Vue.prototype.$moment = moment; 135 | 136 | import { send } from "./utils/burringPoint"; 137 | 138 | Vue.directive("bp-click", { 139 | bind(el, { value }) { 140 | el.addEventListener("click", () => { 141 | send(value) 142 | .then(res => console.log(res)) 143 | .catch(err => console.error(err)); 144 | }); 145 | } 146 | }); 147 | Vue.directive("bp-blur", { 148 | bind(el, { value }) { 149 | el.addEventListener("blur", () => { 150 | send(value) 151 | .then(res => console.log(res)) 152 | .catch(err => console.error(err)); 153 | }); 154 | } 155 | }); 156 | Vue.directive("bp-default", { 157 | bind(el, { value }) { 158 | send(value) 159 | .then(res => console.log(res)) 160 | .catch(err => console.error(err)); 161 | } 162 | }); 163 | 164 | new Vue({ 165 | router, 166 | store, 167 | render: h => h(App) 168 | }).$mount("#app"); 169 | -------------------------------------------------------------------------------- /community-management-system-fe/src/components/announcementList.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 80 | 81 | 153 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/editLog.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 131 | 132 | 154 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/LuceneServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.example.csgs.service.LuceneService; 4 | import lombok.extern.log4j.Log4j; 5 | import org.elasticsearch.action.search.SearchRequest; 6 | import org.elasticsearch.action.search.SearchResponse; 7 | import org.elasticsearch.client.RequestOptions; 8 | import org.elasticsearch.client.RestHighLevelClient; 9 | import org.elasticsearch.common.text.Text; 10 | import org.elasticsearch.common.unit.TimeValue; 11 | import org.elasticsearch.index.query.MultiMatchQueryBuilder; 12 | import org.elasticsearch.search.SearchHit; 13 | import org.elasticsearch.search.builder.SearchSourceBuilder; 14 | import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; 15 | import org.elasticsearch.search.fetch.subphase.highlight.HighlightField; 16 | import org.springframework.stereotype.Service; 17 | 18 | import javax.annotation.Resource; 19 | import java.io.IOException; 20 | import java.util.ArrayList; 21 | import java.util.List; 22 | import java.util.Map; 23 | import java.util.concurrent.TimeUnit; 24 | 25 | @Log4j 26 | @Service 27 | public class LuceneServiceImpl implements LuceneService { 28 | @Resource 29 | RestHighLevelClient client; 30 | private SearchRequest searchRequest; 31 | private SearchSourceBuilder sourceBuilder; 32 | 33 | /** 34 | * 在ElasticSearch中复合查询 35 | * @param indexName 索引名 36 | * @param matchQueryBuilder 复合查询条件 37 | * @param page 页数 38 | * @throws IOException 39 | */ 40 | @Override 41 | public List> multiMatchQuery(String indexName, MultiMatchQueryBuilder matchQueryBuilder, 42 | String page) throws IOException { 43 | createSearchObject(indexName); 44 | sourceBuilder.from((Integer.parseInt(page) - 1) * 15); 45 | sourceBuilder.size(15); 46 | sourceBuilder.query(matchQueryBuilder); 47 | buildSearchRequest(); //构建SearchRequest 48 | setKeywordHighlight();//设置相应字段高亮 49 | SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT); 50 | ArrayList> list = null; 51 | if (searchResponse.getHits().getHits().length != 0) { 52 | list = new ArrayList<>(); 53 | for (SearchHit documentFields : searchResponse.getHits().getHits()) { 54 | //替换成高亮结果 55 | analysisHighlight(documentFields,"content"); 56 | analysisHighlight(documentFields,"title_name"); 57 | list.add(documentFields.getSourceAsMap()); 58 | } 59 | } 60 | return list; 61 | } 62 | 63 | private void analysisHighlight(SearchHit documentFields,String fieldName) { 64 | Map highlightFields = documentFields.getHighlightFields(); 65 | HighlightField field = highlightFields.get(fieldName); 66 | Map sourceAsMap = documentFields.getSourceAsMap(); 67 | if (field != null) { 68 | Text[] fragments = field.fragments(); 69 | StringBuilder newField = new StringBuilder(); 70 | for (Text fragment : fragments) { 71 | newField.append(fragment); 72 | } 73 | sourceAsMap.put(fieldName,newField); 74 | } 75 | } 76 | 77 | private void setKeywordHighlight() { 78 | HighlightBuilder highlightBuilder = new HighlightBuilder(); 79 | highlightBuilder.field("title_name"); 80 | highlightBuilder.field("content"); 81 | highlightBuilder.requireFieldMatch(false); 82 | highlightBuilder.preTags(""); 83 | highlightBuilder.postTags(""); 84 | sourceBuilder.highlighter(highlightBuilder); 85 | } 86 | 87 | private void buildSearchRequest() { 88 | sourceBuilder.timeout(new TimeValue(60, TimeUnit.SECONDS)); 89 | searchRequest.source(sourceBuilder); 90 | } 91 | 92 | private void createSearchObject(String indexName) { 93 | searchRequest = new SearchRequest(indexName); 94 | sourceBuilder = new SearchSourceBuilder(); 95 | } 96 | 97 | 98 | } 99 | 100 | -------------------------------------------------------------------------------- /community-management-system-fe/src/views/subviews/logManage.vue: -------------------------------------------------------------------------------- 1 | 61 | 62 | 130 | 131 | 147 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/UserPwdProController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.UserEntity; 5 | import com.example.csgs.mapper.UserMapper; 6 | import com.example.csgs.service.UserPwdProService; 7 | import com.example.csgs.utils.IsIntegerUtil; 8 | import com.example.csgs.utils.ResultUtil; 9 | import com.example.csgs.utils.SHA256Util; 10 | import lombok.extern.log4j.Log4j; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.annotation.Resource; 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | @RestController 18 | @RequestMapping("/pwdPro") 19 | @Log4j 20 | public class UserPwdProController { 21 | @Resource 22 | UserPwdProService userPwdProService; 23 | @Resource 24 | UserMapper userMapper; 25 | 26 | /** 27 | * 设置密保接口 28 | */ 29 | @PutMapping("/setUpPwdPro/{id}") 30 | public Object updatePwdPro(@RequestBody JSONObject jsonObject, @PathVariable String id) { 31 | if (!IsIntegerUtil.isInteger(id)) { 32 | return ResultUtil.error("拒绝访问!请修改请求信息......"); 33 | } 34 | Long uid = Long.parseLong(id); 35 | String questionOne = jsonObject.getString("questionOne"); 36 | String questionTwo = jsonObject.getString("questionTwo"); 37 | String answerOne = jsonObject.getString("answerOne"); 38 | String answerTwo = jsonObject.getString("answerTwo"); 39 | 40 | List list = new ArrayList<>(); 41 | list.add(questionOne); 42 | list.add(answerOne); 43 | list.add(questionTwo); 44 | list.add(answerTwo); 45 | 46 | if (userPwdProService.setPwdPro(uid, list)) { 47 | log.info("用户<"+ id +">设置密保成功!"); 48 | return ResultUtil.success("密保设置成功"); 49 | } 50 | log.info("用户<"+ id +">设置密保失败!"); 51 | return ResultUtil.error("密保设置失败!"); 52 | } 53 | 54 | /** 55 | * 修改密码接口 56 | * 场景:在回答正确密保问题后,进入修改密码界面,提交修改后的密码 57 | */ 58 | @PutMapping("/modifyPwd/{id}") 59 | public Object updatePwd(@RequestBody JSONObject jsonObject, @PathVariable String id) { 60 | if (!IsIntegerUtil.isInteger(id)) { 61 | return ResultUtil.error("拒绝访问!请修改请求信息......"); 62 | } 63 | 64 | String sha256String = SHA256Util.getSHA256String(jsonObject.getString("newPassword")); 65 | UserEntity targetUser = userMapper.findById(Long.parseLong(id)); 66 | if (targetUser != null) { 67 | if (targetUser.getUserPassword().equals(sha256String)) { 68 | log.info("用户<"+ id +">密码修改失败,该密码与原始密码相同!"); 69 | return ResultUtil.error("密码修改失败,该密码与原始密码相同!"); 70 | }else if (userMapper.modifyPassword(sha256String, Long.parseLong(id)) > 0) { 71 | log.info("用户<"+ id +">密码修改成功!"); 72 | return ResultUtil.success("密码修改成功!"); 73 | } 74 | } 75 | log.info("用户<"+ id +">密码修改失败!"); 76 | return ResultUtil.error("密码修改失败!"); 77 | } 78 | 79 | /** 80 | * 返回密保问题接口(两个密保问题) 81 | */ 82 | @GetMapping("/returnPwdProQue/{id}") 83 | public Object returnPwdPro(@PathVariable String id) { 84 | if (!IsIntegerUtil.isInteger(id)) { 85 | return ResultUtil.error("拒绝访问!请修改请求信息......"); 86 | } 87 | 88 | List list = userPwdProService.returnPwdProQue(Long.parseLong(id)); 89 | if (list != null) { 90 | log.info("用户<"+ id +">获取密保问题成功!"); 91 | return ResultUtil.success(list, "获取密保问题成功"); 92 | } 93 | log.info("用户<"+ id +">获取密保问题失败!"); 94 | return ResultUtil.error("获取密保问题失败!"); 95 | } 96 | 97 | /** 98 | * 比较密保答案接口(验证上传的密保答案) 99 | */ 100 | @PostMapping("/comparePwdProAns/{id}") 101 | public Object comparePwdPro(@RequestBody JSONObject jsonObject, @PathVariable String id) { 102 | if (!IsIntegerUtil.isInteger(id)) { 103 | return ResultUtil.error("拒绝访问!请修改请求信息......"); 104 | } 105 | 106 | String answerOne = jsonObject.getString("answerOne"); 107 | String answerTwo = jsonObject.getString("answerTwo"); 108 | 109 | List list = new ArrayList<>(); 110 | list.add(answerOne); 111 | list.add(answerTwo); 112 | 113 | if (userPwdProService.comparePwdProAns(Long.parseLong(id), list)) { 114 | log.info("用户<"+ id +">回答密保问题成功!"); 115 | return ResultUtil.success("回答密保成功"); 116 | } 117 | log.info("用户<"+ id +">回答密保问题失败!"); 118 | return ResultUtil.error("回答密保失败!"); 119 | } 120 | 121 | } 122 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/service/impl/GridQueryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.service.impl; 2 | 3 | import com.example.csgs.entity.*; 4 | import com.example.csgs.mapper.ProfileMapper; 5 | import com.example.csgs.mapper.PwdProMapper; 6 | import com.example.csgs.mapper.UserMapper; 7 | import com.example.csgs.service.GridQueryService; 8 | import com.example.csgs.utils.CalculatePageUtil; 9 | import com.example.csgs.utils.ElasticSearchUtil; 10 | import com.example.csgs.utils.MapToBeanUtil; 11 | import com.github.pagehelper.Page; 12 | import com.github.pagehelper.PageHelper; 13 | import lombok.extern.log4j.Log4j; 14 | import org.elasticsearch.action.search.SearchResponse; 15 | import org.elasticsearch.index.query.QueryBuilders; 16 | import org.elasticsearch.search.SearchHit; 17 | import org.springframework.stereotype.Service; 18 | 19 | import javax.annotation.Resource; 20 | import java.io.IOException; 21 | import java.util.ArrayList; 22 | import java.util.HashMap; 23 | import java.util.List; 24 | import java.util.Map; 25 | 26 | @Log4j 27 | @Service 28 | public class GridQueryServiceImpl implements GridQueryService { 29 | @Resource 30 | UserMapper userMapper; 31 | @Resource 32 | ProfileMapper profileMapper; 33 | @Resource 34 | PwdProMapper pwdProMapper; 35 | 36 | private final int pageSize = 10; 37 | private Page pageable = new Page<>(1, 1); 38 | private List userList = new ArrayList<>(); 39 | 40 | /** 41 | * 通过网格员id查询居民用户信息列表 42 | * 场景:网格员登陆进入主界面,数据列表界面 43 | * 44 | * @param id user表中网格员id 45 | * @param page 当前请求页数 46 | */ 47 | @Override 48 | public PageQuery allUserOfGrid(Long id, String page) { 49 | UserEntity queryUser = userMapper.findById(id); 50 | log.info(id); 51 | if (queryUser != null && queryUser.getUserType() == 1) { 52 | DistrictEntity districtEntity = profileMapper.findDistrictById(id); 53 | log.info("片区名称:" + districtEntity.getDistrictName()); 54 | pageable = PageHelper.startPage(Integer.parseInt(page), pageSize); 55 | PageHelper.orderBy("id ASC"); 56 | userList = profileMapper.findProfileByDistrict(districtEntity.getDistrictName()); 57 | 58 | return CalculatePageUtil.getPageInfo(Integer.parseInt(page), pageSize, pageable, userList); 59 | } 60 | return null; 61 | } 62 | 63 | /** 64 | * 按各种用户身份信息进行查询 65 | * 场景:网格员查询用户信息 66 | * 组合:<归属小区、姓名>、<归属小区>、<姓名>、 67 | * 68 | * @param id user表中网格员id 69 | * @param page 当前请求页数 70 | * @param userID 所查询用户的身份证号 71 | * @param userName 所查询用户的姓名 72 | * @param community 所查询用户所在的小区名 73 | */ 74 | @Override 75 | public PageQuery multipleConditions(String userID, String userName, String community, Long id, String page) throws IOException { 76 | if (userMapper.judgeGrid(id) == 1) { 77 | userList.clear(); 78 | User user = userMapper.findUserByUserID(userID); 79 | if (!userID.equals("") && user != null) { 80 | pageable.setTotal(1); 81 | userList.add(user); 82 | } else { 83 | HashMap map = new HashMap<>(); 84 | map.put("userName", userName); 85 | map.put("community", community); 86 | 87 | pageable = PageHelper.startPage(Integer.parseInt(page), pageSize); 88 | PageHelper.orderBy("id ASC"); 89 | userList = userMapper.findUserByGridInfo(map); 90 | } 91 | return CalculatePageUtil.getPageInfo(Integer.parseInt(page), pageSize, pageable, userList); 92 | } 93 | return null; 94 | } 95 | 96 | /** 97 | * 从searchResponse中拆解数据(多个User实体类)到List集合中 98 | * 99 | * @param searchResponse 使用ElasticSearch所查询到的数据类 100 | */ 101 | private List parseToDataList(SearchResponse searchResponse, T t) { 102 | List dataList = new ArrayList<>(); 103 | for (SearchHit documentFields : searchResponse.getHits().getHits()) { 104 | log.info(documentFields.getSourceAsMap()); 105 | Map sourceAsMap = documentFields.getSourceAsMap(); 106 | T t1 = MapToBeanUtil.mapToBean(sourceAsMap, t); 107 | dataList.add(t1); 108 | } 109 | return dataList; 110 | } 111 | 112 | /** 113 | * 网格员删除居民用户 114 | * 115 | * @param id 所要删除用户在user表中的id 116 | */ 117 | @Override 118 | public boolean deleteUser(Long id) { 119 | UserEntity userResident = userMapper.findById(id); 120 | if (userResident != null && userResident.getUserType() == 0) { 121 | return profileMapper.deleteById(id) > 0 && pwdProMapper.deleteById(id) > 0; 122 | } 123 | return false; 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /community-management-system-be/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.6"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /community-management-system-fe/src/components/common-aside.vue: -------------------------------------------------------------------------------- 1 | 123 | 124 | 139 | 140 | 166 | -------------------------------------------------------------------------------- /community-management-system-fe/src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from "vue"; 2 | import VueRouter from "vue-router"; 3 | import DashBoard from "../views/DashBoard.vue"; 4 | import userManage from "../views/subviews/userManage"; 5 | import residentOverview from "../views/subviews/residentOverview"; 6 | import userInfoShow from "../views/subviews/userInfoShow"; 7 | import userInfoUpdate from "../views/subviews/userInfoUpdate"; 8 | import announcementManage from "../views/subviews/announcementManage"; 9 | import passwordReset from "../views/subviews/passwordReset"; 10 | import editAnnouncement from "../views/subviews/editAnnouncement"; 11 | import logManage from "../views/subviews/logManage"; 12 | import editLog from "../views/subviews/editLog"; 13 | import addOfficer from "../views/subviews/addOfficer"; 14 | import OfficerAddUser from "../views/subviews/OfficerAddUser"; 15 | import statistics from "../views/subviews/statistics"; 16 | import officerManage from "../views/subviews/officerManage"; 17 | import Cookies from "js-cookie"; 18 | import setPasswordProtect from "../views/subviews/setPasswordProtect"; 19 | import Search from "../views/subviews/search"; 20 | 21 | Vue.use(VueRouter); 22 | 23 | function buildTitle(name) { 24 | return `${name} - 社会综合治理系统`; 25 | } 26 | 27 | const routes = [ 28 | { 29 | path: "/", 30 | redirect: "/dashboard" 31 | }, 32 | { 33 | path: "/dashboard", 34 | name: "DashBoard", 35 | component: DashBoard, 36 | meta: { 37 | title: buildTitle("总览台") 38 | }, 39 | children: [ 40 | { 41 | path: "userManage", 42 | name: "userManage", 43 | component: userManage, 44 | meta: { 45 | title: buildTitle("用户管理") 46 | } 47 | }, 48 | { 49 | path: "residentOverview", 50 | name: "residentOverview", 51 | component: residentOverview, 52 | meta: { 53 | title: buildTitle("居民用户总览页") 54 | } 55 | }, 56 | { 57 | path: "userInfoShow/:uid", 58 | name: "userInfoShow", 59 | component: userInfoShow, 60 | meta: { 61 | title: buildTitle("我的个人信息") 62 | } 63 | }, 64 | { 65 | path: "userInfoUpdate", 66 | name: "userInfoUpdate", 67 | component: userInfoUpdate, 68 | meta: { 69 | title: buildTitle("修改个人信息") 70 | } 71 | }, 72 | { 73 | path: "announcementManage", 74 | name: "announcementManage", 75 | component: announcementManage, 76 | meta: { 77 | title: buildTitle("管理公告") 78 | } 79 | }, 80 | { 81 | path: "logManage", 82 | name: "logManage", 83 | component: logManage, 84 | meta: { 85 | title: buildTitle("管理日志") 86 | } 87 | }, 88 | { 89 | path: "passwordReset", 90 | name: "passwordReset", 91 | component: passwordReset, 92 | meta: { 93 | title: buildTitle("修改密码") 94 | } 95 | }, 96 | { 97 | path: "addAnnouncement", 98 | name: "addAnnouncement", 99 | component: editAnnouncement, 100 | meta: { 101 | title: buildTitle("新建公告") 102 | } 103 | }, 104 | { 105 | path: "addLog", 106 | name: "addLog", 107 | component: editLog, 108 | meta: { 109 | title: buildTitle("新建日志") 110 | } 111 | }, 112 | { 113 | path: "addOfficer", 114 | name: "addOfficer", 115 | component: addOfficer, 116 | meta: { 117 | title: buildTitle("添加网格员") 118 | } 119 | }, 120 | { 121 | path: "officerManage", 122 | name: "officerManage", 123 | component: officerManage, 124 | meta: { 125 | title: buildTitle("网格员管理") 126 | } 127 | }, 128 | { 129 | path: "officerAddUser", 130 | name: "officerAddUser", 131 | component: OfficerAddUser, 132 | meta: { 133 | title: buildTitle("添加用户") 134 | } 135 | }, 136 | { 137 | path: "statistics", 138 | name: "statistics", 139 | component: statistics, 140 | meta: { 141 | title: buildTitle("数据视图") 142 | } 143 | }, 144 | { 145 | path: "/dashboard/setPasswordProtect", 146 | name: "/dashboard/setPasswordProtect", 147 | component: setPasswordProtect, 148 | meta: { 149 | title: buildTitle("设置密保") 150 | } 151 | }, 152 | { 153 | path: "/dashboard/search", 154 | name: "/dashboard/search", 155 | component: Search, 156 | meta: { 157 | title: buildTitle("全文检索") 158 | } 159 | } 160 | ] 161 | }, 162 | { 163 | path: "/sign", 164 | name: "Sign", 165 | component: () => 166 | import(/* webpackChunkName: "about" */ "../views/Sign.vue"), 167 | meta: { 168 | title: buildTitle("登录|注册") 169 | } 170 | } 171 | ]; 172 | 173 | const router = new VueRouter({ 174 | routes 175 | }); 176 | 177 | // 重写标签页标题: 178 | router.beforeEach((to, from, next) => { 179 | console.log(`${from.path} -> ${to.path}`); 180 | if (to.meta.title) { 181 | document.title = to.meta.title; 182 | } 183 | if (to.path === "/sign" && Cookies.get("csgs_token") !== undefined) { 184 | Vue.prototype.$message.warning("您已经登录啦!"); 185 | } 186 | if (to.path !== "/sign" && Cookies.get("csgs_token") === undefined) { 187 | next({ 188 | path: "/sign" 189 | }); 190 | } 191 | next(); 192 | }); 193 | 194 | export default router; 195 | -------------------------------------------------------------------------------- /community-management-system-be/src/main/java/com/example/csgs/controller/AdminAllController.java: -------------------------------------------------------------------------------- 1 | package com.example.csgs.controller; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.example.csgs.entity.AreaList; 5 | import com.example.csgs.entity.CreateGridInfo; 6 | import com.example.csgs.entity.GridPersonalInfo; 7 | import com.example.csgs.entity.PageQuery; 8 | import com.example.csgs.entity.ProfileInfo; 9 | import com.example.csgs.entity.UserEntity; 10 | import com.example.csgs.mapper.ProfileMapper; 11 | import com.example.csgs.mapper.UserMapper; 12 | import com.example.csgs.service.AdminAllService; 13 | import com.example.csgs.utils.IsIntegerUtil; 14 | import com.example.csgs.utils.ResultUtil; 15 | import lombok.extern.log4j.Log4j; 16 | import org.elasticsearch.client.RestHighLevelClient; 17 | import org.springframework.web.bind.annotation.*; 18 | 19 | import javax.annotation.Resource; 20 | import java.util.List; 21 | 22 | @RestController 23 | @RequestMapping("/admin") 24 | @Log4j 25 | public class AdminAllController { 26 | @Resource 27 | AdminAllService adminAllService; 28 | @Resource 29 | UserMapper userMapper; 30 | @Resource 31 | ProfileMapper profileMapper; 32 | @Resource 33 | RestHighLevelClient restHighLevelClient; 34 | /** 35 | * 获取用户资料接口 36 | * 场景:系统管理员添加网格员时,需要查看该居民用户的基本资料信息 37 | */ 38 | @GetMapping("/getGridProfile") 39 | public Object getMaterial(@RequestParam String userID) { 40 | 41 | UserEntity userEntity = userMapper.findOneByUserID(userID); 42 | if (userEntity != null && userEntity.getUserType() == 1) { 43 | log.info("[系统管理员]用户 <" + userID + "> 不是一名网格员!"); 44 | return ResultUtil.error("该用户已经是一名网格员!!!"); 45 | }else if (userEntity != null){ 46 | ProfileInfo material = profileMapper.getMaterial(userEntity.getId()); 47 | if (material != null) { 48 | log.info("[系统管理员]用户 <" + userID + "> 资料获取Success!"); 49 | return ResultUtil.success(material, "用户资料获取成功!"); 50 | } 51 | } 52 | log.info("[系统管理员]用户 <" + userID + "> 资料获取Failure!"); 53 | return ResultUtil.error("用户资料不存在!"); 54 | } 55 | /** 56 | * 场景:系统管理员新增网格员,首先要获取区域数据信息,然后在其中选择区域分配网格员 57 | * 重点:这里我们返回的区域是还没有被划分的区域,如果某一区域已经被分配,那么不返回该区域信息 58 | */ 59 | @GetMapping("/getAreaList") 60 | public Object getAreaList(@RequestParam String userID) { 61 | AreaList areaList = adminAllService.getAreaList(userID); 62 | if (areaList != null) { 63 | log.info("[系统管理员]用户 <" + userID + "> 获取"+ areaList.getDistrictName() +"所在区域数据信息获取Success!"); 64 | return ResultUtil.success(areaList, "获取"+ areaList.getDistrictName() +"区域数据信息成功!"); 65 | } 66 | log.info("[系统管理员]用户 <" + userID + "> 所在区域数据信息获取Failure(改用户不存在)!"); 67 | return ResultUtil.error("获取区域数据信息失败(该用户不存在)!"); 68 | } 69 | 70 | /** 71 | * 场景:系统管理员在修改网格员管理区域之前,首先要获取所有未被分配管理的区域数据信息,然后在其中选择区域分配给网格员 72 | */ 73 | @GetMapping("/getAllAreaList") 74 | public Object getAllAreaList() { 75 | List allAreaList = adminAllService.getAllAreaList(); 76 | if (!allAreaList.isEmpty()) { 77 | log.info("[系统管理员]获取所有区域数据信息Success!"); 78 | return ResultUtil.success(allAreaList, "获取所有区域数据信息成功!"); 79 | } 80 | log.info("[系统管理员]获取所有区域数据信息Failure!"); 81 | return ResultUtil.error("获取所有区域数据信息失败!"); 82 | } 83 | 84 | /** 85 | * 新增网格员接口 86 | * 同时系统管理员为网格员分配管理区域 87 | */ 88 | @PostMapping("/addGrid") 89 | public Object addGrid(@RequestBody JSONObject jsonObject) { 90 | CreateGridInfo createGridInfo = JSONObject.toJavaObject(jsonObject, CreateGridInfo.class); 91 | 92 | if (adminAllService.addGrid(createGridInfo)) { 93 | log.info("[系统管理员]添加身份证号为<"+ createGridInfo.getUserID() +">网格员身份Success!"); 94 | return ResultUtil.success("添加网格员操作成功!"); 95 | } 96 | log.info("[系统管理员]添加身份证号为<"+ createGridInfo.getUserID() +">网格员身份Failure!"); 97 | return ResultUtil.error("添加网格员操作失败!"); 98 | } 99 | 100 | /** 101 | * 返回当前系统管理员添加的网格员数据列表 102 | */ 103 | @GetMapping("/getGrids") 104 | public Object getAllGrids(@RequestParam String page) { 105 | PageQuery allGrids = adminAllService.getAllGrids(page); 106 | if (allGrids != null) { 107 | log.info("[系统管理员]获取所有网格员信息Success!"); 108 | return ResultUtil.success(allGrids, "获取网格员数据列表成功!"); 109 | } 110 | log.info("[系统管理员]获取所有区域数据信息Failure!"); 111 | return ResultUtil.error("获取网格员数据列表失败!"); 112 | } 113 | 114 | /** 115 | * 场景:在系统管理员获取到网格员数据信息列表之后,可以进行两项操作: 116 | * 选择修改任意网格员管理区域、是否删除该网格员(user表中任然存在,只是grid表中不存在了) 117 | * 功能:该接口进行管理区域修改 118 | * id是grid表中的id 119 | */ 120 | @PutMapping("/modifyAreaOfGrid/{id}") 121 | public Object modifyGrid(@RequestBody JSONObject jsonObject, @PathVariable String id) { 122 | AreaList areaList = JSONObject.toJavaObject(jsonObject, AreaList.class); 123 | log.info(areaList.toString()); 124 | if (IsIntegerUtil.isInteger(id) && adminAllService.modifyGrid(areaList,Long.parseLong(id))) { 125 | log.info("[系统管理员]修改网格员id:<"+ Long.parseLong(id) +">Success!"); 126 | return ResultUtil.success("网格员管理区域修改成功!"); 127 | } 128 | log.info("[系统管理员]修改网格员id:<"+ Long.parseLong(id) +">Failure!"); 129 | return ResultUtil.error("网格员管理区域修改失败!"); 130 | } 131 | 132 | /** 133 | * 功能:删除某一网格员(user表中任然存在,只是grid表中不存在了) 134 | */ 135 | @DeleteMapping("/deleteOneGrid/{id}") 136 | public Object deleteOneGrid(@PathVariable String id) { 137 | if (IsIntegerUtil.isInteger(id) && adminAllService.deleteOneGrid(Long.parseLong(id))) { 138 | log.info("[系统管理员]删除网格员id:<"+ Long.parseLong(id) +"Success!"); 139 | return ResultUtil.success("删除id为"+ id +"的网格员操作成功!"); 140 | } 141 | log.info("[系统管理员]删除网格员id:<"+ Long.parseLong(id) +"Failure!"); 142 | return ResultUtil.error("删除id为"+ id +"的网格员操作失败!"); 143 | } 144 | } 145 | --------------------------------------------------------------------------------