├── _config.yml ├── familytree ├── .settings │ ├── org.eclipse.jdt.apt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── src │ └── main │ │ ├── resources │ │ ├── excel │ │ │ └── template.xlsx │ │ ├── application.properties │ │ ├── mapper │ │ │ ├── VerificationTokenMapper.xml │ │ │ ├── UserRoleMapper.xml │ │ │ ├── PartnerMapper.xml │ │ │ ├── ChildrenMapper.xml │ │ │ ├── UserMenuMapper.xml │ │ │ ├── MenuRightMapper.xml │ │ │ ├── RoleMenuMapper.xml │ │ │ ├── CategoryMapper.xml │ │ │ ├── ImageFileMapper.xml │ │ │ ├── CemeteryMapper.xml │ │ │ ├── RoleMapper.xml │ │ │ ├── CategoryContentMapper.xml │ │ │ ├── VillageMapper.xml │ │ │ ├── RegionMapper.xml │ │ │ ├── UserMenuRightMapper.xml │ │ │ ├── RoleMenuRightMapper.xml │ │ │ ├── UserMapper.xml │ │ │ └── DictMapper.xml │ │ ├── application.yml │ │ └── templates │ │ │ └── ActiveAccountResult.ftl │ │ └── java │ │ └── com │ │ └── starfire │ │ └── familytree │ │ ├── vo │ │ ├── DeleteVO.java │ │ ├── MenuRightVO.java │ │ ├── RelationshipVO.java │ │ ├── UserMenuVO.java │ │ ├── PrincipalVO.java │ │ ├── OrgChartVO.java │ │ ├── RoleMenuVO.java │ │ ├── FileInfoVO.java │ │ ├── UploadResponse.java │ │ ├── ImageRespVO.java │ │ ├── RouteVO.java │ │ ├── MenuTree.java │ │ ├── ResetPasswordVO.java │ │ ├── SignUpUserVO.java │ │ ├── UserVO.java │ │ └── OrgChartItemVO.java │ │ ├── service │ │ ├── IBaseService.java │ │ ├── IVerificationTokenService.java │ │ ├── OnForgotPasswordEvent.java │ │ ├── impl │ │ │ ├── VerificationTokenServiceImpl.java │ │ │ ├── ForgotPasswordListener.java │ │ │ └── RegistrationListener.java │ │ └── OnRegistrationCompleteEvent.java │ │ ├── config │ │ ├── ResourceServerConfig.java │ │ ├── WebConfig.java │ │ ├── MybatisPlusConfig.java │ │ ├── SwaggerConfig.java │ │ ├── SecurityConfig.java │ │ ├── AuthorizationServerConfig.java │ │ └── ApplicationConfig.java │ │ ├── validation │ │ └── EmailExistsException.java │ │ ├── excel │ │ ├── service │ │ │ ├── ExcelHeaderEnum.java │ │ │ └── IExcelService.java │ │ └── controller │ │ │ └── ExcelController.java │ │ ├── basic │ │ ├── service │ │ │ ├── FileUploadService.java │ │ │ ├── impl │ │ │ │ ├── FileUploadServiceImpl.java │ │ │ │ ├── RegionServiceImpl.java │ │ │ │ └── DictServiceImpl.java │ │ │ ├── IRegionService.java │ │ │ └── IDictService.java │ │ ├── mapper │ │ │ ├── RegionMapper.java │ │ │ └── DictMapper.java │ │ ├── entity │ │ │ ├── Region.java │ │ │ ├── AbstractEntity.java │ │ │ └── Dict.java │ │ └── controller │ │ │ ├── RegionController.java │ │ │ └── FileUploadController.java │ │ ├── login │ │ ├── vo │ │ │ ├── AuthToken.java │ │ │ └── LoginReq.java │ │ └── controller │ │ │ └── LoginController.java │ │ ├── enums │ │ ├── BooleanEnum.java │ │ ├── GenderEnum.java │ │ ├── UserTypeEnum.java │ │ ├── MenuTypeEnum.java │ │ └── ValidEnum.java │ │ ├── controller │ │ └── VerificationTokenController.java │ │ ├── bs │ │ ├── mapper │ │ │ ├── ImageFileMapper.java │ │ │ └── VillageMapper.java │ │ ├── service │ │ │ ├── IImageFileService.java │ │ │ ├── IVillageService.java │ │ │ └── impl │ │ │ │ └── ImageFileServiceImpl.java │ │ ├── entity │ │ │ ├── ImageFile.java │ │ │ └── Village.java │ │ └── controller │ │ │ └── ImageFileController.java │ │ ├── security │ │ ├── mapper │ │ │ ├── MenuRightMapper.java │ │ │ ├── UserMenuMapper.java │ │ │ ├── RoleMenuMapper.java │ │ │ ├── UserRoleMapper.java │ │ │ ├── UserMenuRightMapper.java │ │ │ ├── RoleMenuRightMapper.java │ │ │ ├── RoleMapper.java │ │ │ └── MenuMapper.java │ │ ├── service │ │ │ ├── IRoleService.java │ │ │ ├── IUserMenuRightService.java │ │ │ ├── IRoleMenuRightService.java │ │ │ ├── IUserMenuService.java │ │ │ ├── IUserRoleService.java │ │ │ ├── IMenuRightService.java │ │ │ ├── IRoleMenuService.java │ │ │ ├── IMenuService.java │ │ │ └── impl │ │ │ │ ├── RoleServiceImpl.java │ │ │ │ ├── UserMenuRightServiceImpl.java │ │ │ │ ├── RoleMenuRightServiceImpl.java │ │ │ │ ├── UserRoleServiceImpl.java │ │ │ │ └── MenuRightServiceImpl.java │ │ ├── entity │ │ │ ├── UserRole.java │ │ │ ├── RoleMenu.java │ │ │ ├── UserMenu.java │ │ │ ├── MenuRight.java │ │ │ ├── RoleMenuRight.java │ │ │ ├── UserMenuRight.java │ │ │ ├── Role.java │ │ │ └── Menu.java │ │ └── controller │ │ │ ├── UserRoleController.java │ │ │ ├── MenuRightController.java │ │ │ ├── UserMenuRightController.java │ │ │ ├── RoleMenuRightController.java │ │ │ ├── RoleController.java │ │ │ ├── UserMenuController.java │ │ │ └── RoleMenuController.java │ │ ├── folk │ │ ├── controller │ │ │ ├── PartnerController.java │ │ │ ├── ChildrenController.java │ │ │ ├── CemeteryController.java │ │ │ ├── CategoryContentController.java │ │ │ └── CategoryController.java │ │ ├── service │ │ │ ├── IPartnerService.java │ │ │ ├── ICategoryContentService.java │ │ │ ├── ICemeteryService.java │ │ │ ├── ICategoryService.java │ │ │ ├── IChildrenService.java │ │ │ ├── impl │ │ │ │ ├── PartnerServiceImpl.java │ │ │ │ ├── CemeteryServiceImpl.java │ │ │ │ ├── CategoryContentServiceImpl.java │ │ │ │ ├── CategoryServiceImpl.java │ │ │ │ └── ChildrenServiceImpl.java │ │ │ └── IPeopleService.java │ │ ├── mapper │ │ │ ├── ChildrenMapper.java │ │ │ ├── CemeteryMapper.java │ │ │ ├── PartnerMapper.java │ │ │ ├── CategoryContentMapper.java │ │ │ ├── CategoryMapper.java │ │ │ └── PeopleMapper.java │ │ └── entity │ │ │ ├── Cemetery.java │ │ │ ├── Category.java │ │ │ ├── Children.java │ │ │ ├── Partner.java │ │ │ └── CategoryContent.java │ │ ├── dto │ │ └── UserDto.java │ │ ├── utils │ │ ├── ErrorsUtils.java │ │ ├── FieldErrorUtils.java │ │ ├── JacksonUtils.java │ │ ├── StringHelper.java │ │ └── ChineseNumber.java │ │ ├── exception │ │ └── ExceptionController.java │ │ ├── mapper │ │ └── VerificationTokenMapper.java │ │ ├── usercenter │ │ ├── mapper │ │ │ └── UserMapper.java │ │ ├── service │ │ │ └── IUserService.java │ │ └── entity │ │ │ └── User.java │ │ ├── FamilytreeApplication.java │ │ ├── entity │ │ └── VerificationToken.java │ │ ├── response │ │ ├── FormatResponse.java │ │ └── Response.java │ │ └── filter │ │ └── CustomAuthenticationFilter.java └── .classpath ├── .gitattributes └── README.md /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /familytree/.settings/org.eclipse.jdt.apt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.apt.aptEnabled=true 3 | -------------------------------------------------------------------------------- /familytree/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luzhihua407/family_tree/HEAD/familytree/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /familytree/src/main/resources/excel/template.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/luzhihua407/family_tree/HEAD/familytree/src/main/resources/excel/template.xlsx -------------------------------------------------------------------------------- /familytree/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip 2 | -------------------------------------------------------------------------------- /familytree/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles=pom.xml 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /familytree/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/DeleteVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class DeleteVO { 7 | private T ids; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/MenuRightVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class MenuRightVO { 7 | private String key; 8 | private String label; 9 | } 10 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/IBaseService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | 5 | public interface IBaseService extends IService { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/ResourceServerConfig.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.config; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | 5 | @Configuration 6 | //@EnableResourceServer 7 | public class ResourceServerConfig { 8 | 9 | 10 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/RelationshipVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class RelationshipVO { 7 | 8 | private Long husbandId; 9 | private Long wifeId; 10 | private Long[] childrenIds; 11 | } 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.md linguist-language=Java 2 | *.yml linguist-language=Java 3 | *.html linguist-language=Java 4 | *.js linguist-language=Java 5 | *.xml linguist-language=Java 6 | *.css linguist-language=Java 7 | *.sql linguist-language=Java 8 | *.uml linguist-language=Java 9 | *.cmd linguist-language=Java 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 家谱系统,逐渐完善中... 2 | 3 | 家谱是一脉相承,一脉相传的东西,我们的祖宗是谁?有哪些丰功伟绩,我们的家训是什么?翻开家谱,我们可以回忆什么?又给我们或者后人哪些启示呢? 4 | 5 | 6 | 某些技术: 7 | - Spring boot 2.0.5.RELEASE 8 | - Spring Cloud Finchley.SR1 9 | - MyBatis-Plus 3.0.7.1 10 | - Oauth2 11 | - UI AntDesign https://github.com/luzhihua407/family_tree_ui 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /familytree/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/main/resources/templates/security/role/add.ftl=UTF-8 5 | encoding//src/main/resources/templates/security/role/list.ftl=UTF-8 6 | encoding//src/test/java=UTF-8 7 | encoding/=UTF-8 8 | -------------------------------------------------------------------------------- /familytree/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.processAnnotations=enabled 6 | org.eclipse.jdt.core.compiler.source=1.8 7 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/validation/EmailExistsException.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.validation; 2 | 3 | 4 | @SuppressWarnings("serial") 5 | public class EmailExistsException extends RuntimeException { 6 | 7 | public EmailExistsException(final String message) { 8 | super(message); 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/UserMenuVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | @Data 9 | public class UserMenuVO { 10 | 11 | private List menuIds=new ArrayList(); 12 | 13 | private String userId; 14 | } 15 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/excel/service/ExcelHeaderEnum.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.excel.service; 2 | 3 | /** 4 | * @author luzh 5 | * @version 1.0.0 6 | * @ClassName ExcelHeaderEnum.java 7 | * @Description TODO 8 | * @createTime 2019年12月12日 17:13:00 9 | */ 10 | public enum ExcelHeaderEnum { 11 | 姓名(),性别(),第几世(); 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/service/FileUploadService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.service; 2 | 3 | import java.io.InputStream; 4 | 5 | /** 6 | * @version 1.0 7 | * @author: Luzh 8 | * @date: 2019/8/30 17:55 9 | */ 10 | public interface FileUploadService { 11 | 12 | public String upload(InputStream inputStream,String path); 13 | } 14 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/login/vo/AuthToken.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.login.vo; 2 | 3 | import lombok.Data; 4 | 5 | @Data 6 | public class AuthToken { 7 | private String access_token; 8 | private String token_type; 9 | private String refresh_token; 10 | private String expires_in; 11 | private String scope; 12 | } 13 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/PrincipalVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | @Data 9 | public class PrincipalVO { 10 | 11 | UserVO user; 12 | 13 | private List menus=new ArrayList(); 14 | private List permission=new ArrayList(); 15 | } 16 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/OrgChartVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.ArrayList; 6 | import java.util.List; 7 | 8 | /** 9 | * 组织图表 10 | * @version 1.0 11 | * @author: Luzh 12 | * @date: 2019/8/30 8:48 13 | */ 14 | @Data 15 | public class OrgChartVO { 16 | private List items=new ArrayList<>(); 17 | } 18 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/RoleMenuVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import lombok.Data; 7 | 8 | @Data 9 | public class RoleMenuVO { 10 | 11 | private Boolean own=false; 12 | 13 | private String roleId; 14 | 15 | private String roleName; 16 | 17 | private List menuIds=new ArrayList(); 18 | } 19 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/enums/BooleanEnum.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | 5 | public enum BooleanEnum { 6 | 7 | 否(0), 是(1); 8 | 9 | @EnumValue 10 | private int value; 11 | 12 | BooleanEnum(int value) { 13 | this.value = value; 14 | } 15 | 16 | public int getValue() { 17 | return value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/enums/GenderEnum.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | 5 | public enum GenderEnum { 6 | 7 | 不清楚(0),男(1), 女(2); 8 | 9 | @EnumValue 10 | private int value; 11 | 12 | GenderEnum(Integer value) { 13 | this.value = value; 14 | } 15 | 16 | 17 | public int getValue() { 18 | return value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/WebConfig.java: -------------------------------------------------------------------------------- 1 | //package com.starfire.familytree.config; 2 | // 3 | //import org.springframework.context.annotation.Configuration; 4 | //import org.springframework.web.servlet.config.annotation.*; 5 | // 6 | //@Configuration 7 | //public class WebConfig implements WebMvcConfigurer { 8 | // 9 | // @Override 10 | // public void addCorsMappings(CorsRegistry registry) { 11 | // registry.addMapping("/**"); 12 | // } 13 | // 14 | // 15 | //} -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/FileInfoVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import com.starfire.familytree.response.Response; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | 9 | /** 10 | * @author luzh 11 | * @version 1.0.0 12 | * @ClassName FileInfoVO.java 13 | * @Description TODO 14 | * @createTime 2019年12月19日 20:34:00 15 | */ 16 | @Data 17 | public class FileInfoVO { 18 | 19 | private Response response; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/enums/UserTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | import com.baomidou.mybatisplus.core.enums.IEnum; 5 | 6 | public enum UserTypeEnum{ 7 | 8 | 管理员(1), 普通用户(2); 9 | 10 | @EnumValue 11 | private int value; 12 | 13 | UserTypeEnum(int value) { 14 | this.value = value; 15 | } 16 | 17 | public int getValue() { 18 | return value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/controller/VerificationTokenController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.controller; 2 | 3 | 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | /** 8 | *

9 | * 前端控制器 10 | *

11 | * 12 | * @author luzh 13 | * @since 2019-02-19 14 | */ 15 | @RestController 16 | @RequestMapping("/verification-token") 17 | public class VerificationTokenController { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/UploadResponse.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * @author luzh 7 | * @version 1.0.0 8 | * @ClassName a.java 9 | * @Description TODO 10 | * @createTime 2019年12月19日 21:07:00 11 | */ 12 | @Data 13 | public class UploadResponse{ 14 | private String name; 15 | private String status= "done"; 16 | private String thumbUrl; 17 | private String url; 18 | private int height; 19 | private int width; 20 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/mapper/ImageFileMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.mapper; 2 | 3 | import com.starfire.familytree.bs.entity.ImageFile; 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * Mapper 接口 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-12-18 15 | */ 16 | public interface ImageFileMapper extends BaseMapper { 17 | 18 | public List getImageFiles(Long otherId); 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/ImageRespVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import com.starfire.familytree.bs.entity.ImageFile; 4 | import com.starfire.familytree.response.Response; 5 | import lombok.Data; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * @author luzh 11 | * @version 1.0.0 12 | * @ClassName ImageRespVO.java 13 | * @Description TODO 14 | * @createTime 2019年12月19日 20:26:00 15 | */ 16 | @Data 17 | public class ImageRespVO { 18 | private List fileList; 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/service/IImageFileService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.service; 2 | 3 | import com.starfire.familytree.bs.entity.ImageFile; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 服务类 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-12-18 15 | */ 16 | public interface IImageFileService extends IService { 17 | 18 | public List getImageFiles(Long otherId); 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/MenuRightMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.security.entity.MenuRight; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * Mapper 接口 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-03-03 15 | */ 16 | public interface MenuRightMapper extends BaseMapper { 17 | 18 | public List getPermissionForAdmin(); 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/RouteVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.fasterxml.jackson.annotation.JsonInclude; 5 | import lombok.Data; 6 | 7 | @Data 8 | @JsonInclude(JsonInclude.Include.NON_NULL) 9 | public class RouteVO { 10 | 11 | private String id; 12 | private String icon; 13 | private String name; 14 | 15 | private String route; 16 | 17 | private String menuParentId; 18 | private String breadcrumbParentId; 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/service/impl/FileUploadServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.service.impl; 2 | 3 | import com.starfire.familytree.basic.service.FileUploadService; 4 | 5 | import java.io.InputStream; 6 | 7 | /** 8 | * @version 1.0 9 | * @author: Luzh 10 | * @date: 2019/8/30 17:56 11 | */ 12 | public class FileUploadServiceImpl implements FileUploadService { 13 | 14 | @Override 15 | public String upload(InputStream inputStream, String path) { 16 | 17 | return null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/controller/PartnerController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | *

10 | * 前端控制器 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-08-15 15 | */ 16 | @RestController 17 | @RequestMapping("/folk/partner") 18 | @Api(tags = "配偶模块") 19 | public class PartnerController { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/controller/ChildrenController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.controller; 2 | 3 | 4 | import io.swagger.annotations.Api; 5 | import org.springframework.web.bind.annotation.RequestMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | *

10 | * 前端控制器 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-08-15 15 | */ 16 | @RestController 17 | @RequestMapping("/folk/children") 18 | @Api(tags = "晚辈模块") 19 | public class ChildrenController { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/MenuTree.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import lombok.Data; 7 | 8 | @Data 9 | public class MenuTree { 10 | 11 | private String title; 12 | private String value; 13 | private String key; 14 | private List children=new ArrayList(); 15 | public MenuTree(String title, String value, String key) { 16 | super(); 17 | this.title = title; 18 | this.value = value; 19 | this.key = key; 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/IPartnerService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.folk.entity.Partner; 5 | import com.starfire.familytree.folk.entity.People; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | public interface IPartnerService extends IService { 18 | 19 | public People getWife(Long husbandId); 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/enums/MenuTypeEnum.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | 5 | 6 | /** 7 | * 8 | * @version 1.0 9 | * @author: Luzh 10 | * @date: 2019/8/21 9:14 11 | */ 12 | 13 | public enum MenuTypeEnum{ 14 | 15 | 目录(0),可见菜单(1),不可见菜单(2); 16 | 17 | @EnumValue 18 | private int value; 19 | 20 | MenuTypeEnum(int value) { 21 | 22 | this.value=value; 23 | } 24 | 25 | 26 | public int getValue() { 27 | return value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/dto/UserDto.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.dto; 2 | 3 | import javax.validation.constraints.NotEmpty; 4 | import javax.validation.constraints.NotNull; 5 | 6 | public class UserDto { 7 | 8 | private Long id; 9 | 10 | @NotNull 11 | @NotEmpty 12 | private String username; 13 | @NotNull 14 | @NotEmpty 15 | private String password; 16 | private Integer age; 17 | @NotNull 18 | @NotEmpty 19 | private String email; 20 | private Long roleId; 21 | private Integer gender; 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/mapper/ChildrenMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.folk.entity.Children; 5 | import com.starfire.familytree.folk.entity.People; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | public interface ChildrenMapper extends BaseMapper { 18 | 19 | public List getChildrenList(Long parentId); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/UserMenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.security.entity.UserMenu; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * Mapper 接口 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-03-03 15 | */ 16 | public interface UserMenuMapper extends BaseMapper { 17 | 18 | public void deleteByUserId(Long userId); 19 | 20 | public List getListByUserId(Long userId); 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/RoleMenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.security.entity.RoleMenu; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * Mapper 接口 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-03-03 15 | */ 16 | public interface RoleMenuMapper extends BaseMapper { 17 | 18 | 19 | public void deleteByRoleId(Long roleId); 20 | 21 | public List getListByRoleId(Long roleId); 22 | } 23 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/utils/ErrorsUtils.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.utils; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.validation.FieldError; 6 | 7 | public class ErrorsUtils { 8 | 9 | public static String[] convert(List errors) { 10 | String[] error=new String[errors.size()]; 11 | int i=0; 12 | for (FieldError fieldError : errors) { 13 | String field = fieldError.getField(); 14 | String defaultMessage = fieldError.getDefaultMessage(); 15 | error[i++]=field+defaultMessage; 16 | } 17 | return error; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/IVerificationTokenService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.entity.VerificationToken; 5 | 6 | /** 7 | *

8 | * 服务类 9 | *

10 | * 11 | * @author luzh 12 | * @since 2019-02-19 13 | */ 14 | public interface IVerificationTokenService extends IService { 15 | 16 | void createVerificationToken(Long userId, String token); 17 | 18 | VerificationToken getVerificationToken(String VerificationToken); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/exception/ExceptionController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.exception; 2 | 3 | import com.starfire.familytree.response.Response; 4 | import org.springframework.web.bind.annotation.ExceptionHandler; 5 | import org.springframework.web.bind.annotation.RestControllerAdvice; 6 | 7 | @RestControllerAdvice 8 | public class ExceptionController { 9 | 10 | @ExceptionHandler 11 | public Response handlerException(Exception e) { 12 | Response response = Response.failure(100, e.getMessage()); 13 | return response; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/login/vo/LoginReq.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.login.vo; 2 | 3 | import java.io.Serializable; 4 | 5 | import javax.validation.constraints.NotEmpty; 6 | 7 | import lombok.Data; 8 | 9 | @Data 10 | public class LoginReq implements Serializable { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = -1712567317430656144L; 16 | 17 | @NotEmpty(message="用户名不能为空") 18 | private String username; 19 | @NotEmpty(message="密码不能为空") 20 | private String password; 21 | private String scope; 22 | private String grant_type; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/mapper/CemeteryMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.mapper; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.starfire.familytree.folk.entity.Cemetery; 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-10-07 16 | */ 17 | public interface CemeteryMapper extends BaseMapper { 18 | 19 | Page getPage(Page page, Map param); 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/enums/ValidEnum.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.enums; 2 | 3 | import com.baomidou.mybatisplus.annotation.EnumValue; 4 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 5 | 6 | /** 7 | * 8 | * @version 1.0 9 | * @author: Luzh 10 | * @date: 2019/8/21 9:14 11 | */ 12 | public enum ValidEnum { 13 | 否(0), 是(1); 14 | 15 | @EnumValue 16 | private int value; 17 | 18 | 19 | ValidEnum(int value) { 20 | 21 | this.value=value; 22 | 23 | } 24 | 25 | public int getValue() { 26 | return value; 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/service/IRegionService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.basic.entity.Region; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | *

11 | * 省市区服务类 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-07 16 | */ 17 | public interface IRegionService extends IService { 18 | 19 | public PageInfo, Region> page(PageInfo, Region> page); 20 | 21 | 22 | } 23 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/excel/service/IExcelService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.excel.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.folk.entity.Category; 5 | import com.starfire.familytree.folk.entity.People; 6 | 7 | import java.io.InputStream; 8 | 9 | /** 10 | * @author luzh 11 | * @version 1.0.0 12 | * @ClassName IExcelService.java 13 | * @Description TODO 14 | * @createTime 2019年12月12日 14:41:00 15 | */ 16 | public interface IExcelService extends IService { 17 | 18 | public void importPeople(InputStream inp); 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/mapper/PartnerMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.folk.entity.Partner; 5 | import com.starfire.familytree.folk.entity.People; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | public interface PartnerMapper extends BaseMapper { 18 | 19 | /** 20 | * 获取妻子 21 | * @param husbandId 22 | * @return 23 | */ 24 | public People getWife(Long husbandId); 25 | } 26 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/UserRoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.security.entity.UserRole; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * Mapper 接口 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-03-03 15 | */ 16 | public interface UserRoleMapper extends BaseMapper { 17 | 18 | public Long getRoleIdByUserId(Long userId); 19 | 20 | public List getRoleIdsByUserId(Long userId); 21 | 22 | public void deleteRoleByUserId(Long userId); 23 | } 24 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/ICategoryContentService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.folk.entity.CategoryContent; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | public interface ICategoryContentService extends IService { 18 | 19 | public PageInfo, CategoryContent> page(PageInfo, CategoryContent> page); 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/mapper/CategoryContentMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.starfire.familytree.folk.entity.CategoryContent; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | public interface CategoryContentMapper extends BaseMapper { 18 | 19 | public Page getPage(Page page, Map param); 20 | } 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/utils/FieldErrorUtils.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.utils; 2 | 3 | import org.springframework.validation.FieldError; 4 | 5 | import java.util.List; 6 | 7 | public class FieldErrorUtils { 8 | 9 | public static String toString(List list) { 10 | StringBuffer sb = new StringBuffer(); 11 | for (FieldError fieldError : list) { 12 | String field = fieldError.getField(); 13 | String defaultMessage = fieldError.getDefaultMessage(); 14 | sb.append(field).append(defaultMessage).append(";"); 15 | } 16 | return sb.toString(); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/ICemeteryService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service; 2 | 3 | import com.starfire.familytree.folk.entity.Cemetery; 4 | import com.starfire.familytree.folk.entity.Cemetery; 5 | import com.baomidou.mybatisplus.extension.service.IService; 6 | import com.starfire.familytree.vo.PageInfo; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-10-07 17 | */ 18 | public interface ICemeteryService extends IService { 19 | 20 | public PageInfo, Cemetery> page(PageInfo, Cemetery> page); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/mapper/VerificationTokenMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.entity.VerificationToken; 5 | import com.starfire.familytree.usercenter.entity.User; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | /** 9 | *

10 | * Mapper 接口 11 | *

12 | * 13 | * @author luzh 14 | * @since 2019-02-19 15 | */ 16 | public interface VerificationTokenMapper extends BaseMapper { 17 | 18 | VerificationToken findByToken(@Param("token") String token); 19 | 20 | VerificationToken findByUser(User user); 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/ResetPasswordVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.NotEmpty; 6 | import javax.validation.constraints.NotNull; 7 | import javax.validation.constraints.Size; 8 | 9 | @Data 10 | public class ResetPasswordVO { 11 | 12 | @NotEmpty(message = "用户ID不能为空") 13 | private Long userId; 14 | 15 | @NotEmpty(message = "密码不能为空") 16 | @Size(min = 6, max = 32, message = "密码长度为6-32个字符") 17 | private String password; 18 | 19 | @NotEmpty(message = "密码不能为空") 20 | @Size(min = 6, max = 32, message = "密码长度为6-32个字符") 21 | private String againPassword; 22 | } 23 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/ICategoryService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.folk.entity.Category; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-08-15 17 | */ 18 | public interface ICategoryService extends IService { 19 | 20 | public PageInfo, Category> page(PageInfo, Category> page); 21 | 22 | List getCategoryList(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/SignUpUserVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import lombok.Data; 4 | 5 | import javax.validation.constraints.NotNull; 6 | 7 | /** 8 | * @author luzh 9 | * @version 1.0.0 10 | * @ClassName SignUpUser.java 11 | * @Description TODO 12 | * @createTime 2019年11月14日 20:41:00 13 | */ 14 | @Data 15 | public class SignUpUserVO { 16 | 17 | @NotNull(message = "用户名不能为空") 18 | private String username; 19 | 20 | @NotNull(message = "密码不能为空") 21 | private String password; 22 | 23 | @NotNull(message = "邮箱不能为空") 24 | private String email; 25 | 26 | @NotNull(message = "村名不能为空") 27 | private String villageName; 28 | } 29 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/mapper/RegionMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.starfire.familytree.basic.entity.Region; 6 | import com.starfire.familytree.folk.entity.People; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-03-07 18 | */ 19 | public interface RegionMapper extends BaseMapper { 20 | 21 | Page page(Page page,@Param(value = "param") Map param); 22 | } 23 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IRoleService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.starfire.familytree.security.entity.Role; 6 | import com.starfire.familytree.vo.PageInfo; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * 服务类 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-03-03 18 | */ 19 | public interface IRoleService extends IService { 20 | 21 | public PageInfo, Role> page(PageInfo, Role> page); 22 | 23 | public Role getRoleByCode(String code); 24 | 25 | public List getRoles(); 26 | } 27 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/mapper/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.starfire.familytree.folk.entity.Category; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-08-15 18 | */ 19 | public interface CategoryMapper extends BaseMapper { 20 | 21 | public Page getPage(Page page,@Param("param") Map param); 22 | 23 | List getCategoryList(); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IUserMenuRightService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.security.entity.UserMenuRight; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-03-03 17 | */ 18 | public interface IUserMenuRightService extends IService { 19 | public PageInfo, UserMenuRight> page(PageInfo, UserMenuRight> pageInfo); 20 | 21 | public List getPermission(Long userId); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/UserMenuRightMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.security.entity.UserMenuRight; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | public interface UserMenuRightMapper extends BaseMapper { 18 | 19 | 20 | public void deleteByMenuId(Long menuId); 21 | 22 | public void deleteByUserMenuId(Long userMenuId); 23 | 24 | public List getCheckedMenuByUserId(Long userId); 25 | 26 | public List getPermission(Long userId); 27 | } 28 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/RoleMenuRightMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.starfire.familytree.security.entity.RoleMenuRight; 5 | 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | /** 10 | *

11 | * Mapper 接口 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | public interface RoleMenuRightMapper extends BaseMapper { 18 | 19 | public void deleteByMenuId(Long menuId); 20 | 21 | public List getCheckedMenuByRoleId(Long roleId); 22 | 23 | public List getPermission(Long roleId); 24 | 25 | 26 | public void deleteByRoleMenuId(Long roleMenuId); 27 | } 28 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/OnForgotPasswordEvent.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service; 2 | 3 | import com.starfire.familytree.usercenter.entity.User; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | import java.util.Locale; 7 | 8 | public class OnForgotPasswordEvent extends ApplicationEvent { 9 | /** 10 | * 11 | */ 12 | private static final long serialVersionUID = 1L; 13 | private String email; 14 | 15 | public OnForgotPasswordEvent(String email) { 16 | super(email); 17 | this.email = email; 18 | } 19 | 20 | 21 | public String getEmail() { 22 | return email; 23 | } 24 | 25 | public void setEmail(String email) { 26 | this.email = email; 27 | } 28 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | @TableName("security_user_role") 21 | public class UserRole extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private Long userId; 27 | 28 | private Long roleId; 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/utils/JacksonUtils.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.utils; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; 7 | 8 | @Slf4j 9 | public class JacksonUtils { 10 | 11 | private static ObjectMapper mapper = Jackson2ObjectMapperBuilder.json().build(); 12 | 13 | public static String toString(Object obj) { 14 | try { 15 | return mapper.writeValueAsString(obj); 16 | } catch (JsonProcessingException e) { 17 | log.error(e.getMessage()); 18 | throw new RuntimeException(e); 19 | } 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /familytree/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.mail.host=smtp.qq.com 2 | spring.mail.username=670177230@qq.com 3 | spring.mail.password=ifbsdoljafacbfha 4 | spring.mail.default-encoding=UTF-8 5 | spring.mail.port=465 6 | spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory 7 | spring.mail.properties.mail.debug=false 8 | spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration 9 | email.system=670177230@qq.com 10 | email.confirm.template=\u4f60\u597d%s\uff0c\u8bf7\u70b9\u51fb\u94fe\u63a5%s\u6fc0\u6d3b\u8d26\u53f7 11 | web.loginPage=http://localhost:7000/login 12 | web.successUrl=http://localhost:7000/user 13 | village.upload.dir=D://Myself/images/village/ 14 | logging.level.org.springframework.web.filter.CommonsRequestLoggingFilter=INFO -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IRoleMenuRightService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.security.entity.RoleMenuRight; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-03-03 17 | */ 18 | public interface IRoleMenuRightService extends IService { 19 | 20 | public PageInfo, RoleMenuRight> page(PageInfo, RoleMenuRight> pageInfo); 21 | 22 | public void deleteByMenuId(Long menuId); 23 | 24 | public List getPermission(Long roleId); 25 | } 26 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/RoleMenu.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | @TableName("security_role_menu") 21 | public class RoleMenu extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private Boolean own; 27 | 28 | private Long menuId; 29 | 30 | private Long roleId; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/UserMenu.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | @TableName("security_user_menu") 21 | public class UserMenu extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private Boolean own; 27 | 28 | private Long menuId; 29 | 30 | private Long userId; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IUserMenuService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.security.entity.UserMenu; 5 | import com.starfire.familytree.vo.PageInfo; 6 | import com.starfire.familytree.vo.UserMenuVO; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-03-03 17 | */ 18 | public interface IUserMenuService extends IService { 19 | public PageInfo, UserMenu> page(PageInfo, UserMenu> pageInfo); 20 | 21 | public void addOrUpdateUserMenu(UserMenuVO userMenuVO); 22 | 23 | public UserMenuVO getUserMenuByUserId(Long userId); 24 | } 25 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/mapper/VillageMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.mapper; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.starfire.familytree.bs.entity.Village; 5 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-11-12 18 | */ 19 | public interface VillageMapper extends BaseMapper { 20 | 21 | public Village getVillage(@Param("code") String code); 22 | 23 | public Page page(Page page, Map param); 24 | 25 | public List getVillageName(String villageName); 26 | } 27 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/MenuRight.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | @TableName("security_menu_right") 21 | public class MenuRight extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private String code; 27 | 28 | private String name; 29 | 30 | private Long menuId; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/VerificationTokenMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/IChildrenService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.folk.entity.Children; 5 | import com.starfire.familytree.folk.entity.People; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 服务类 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | public interface IChildrenService extends IService { 18 | 19 | /** 20 | * 获取孩子 21 | * @param parentId 22 | * @return 23 | */ 24 | public List getChildrenList(Long parentId); 25 | 26 | /** 27 | * 获取所有后辈 28 | * @param parentId 29 | * @return 30 | */ 31 | public List getJuniorList(Long parentId); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/service/IVillageService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.service; 2 | 3 | import com.starfire.familytree.bs.entity.Village; 4 | import com.baomidou.mybatisplus.extension.service.IService; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-11-12 17 | */ 18 | public interface IVillageService extends IService { 19 | 20 | public Village getVillage(String code) ; 21 | 22 | public PageInfo, Village> page(PageInfo, Village> pageInfo); 23 | 24 | public Map getOverview(String villageCode); 25 | 26 | public List getVillageName(String villageName); 27 | } 28 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/RoleMenuRight.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | @TableName("security_role_menu_right") 21 | public class RoleMenuRight extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private Long menuId; 27 | 28 | private Long menuRightId; 29 | 30 | private Long roleMenuId; 31 | 32 | 33 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/UserVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | 4 | 5 | import javax.validation.constraints.NotEmpty; 6 | import javax.validation.constraints.NotNull; 7 | 8 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 9 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 10 | import lombok.Data; 11 | 12 | @Data 13 | public class UserVO { 14 | 15 | @JsonSerialize(using = ToStringSerializer.class) 16 | private Long id; 17 | private Integer age; 18 | @NotNull 19 | @NotEmpty 20 | private String email; 21 | 22 | private String username; 23 | 24 | private String realName; 25 | 26 | @JsonSerialize(using = ToStringSerializer.class) 27 | private Long roleId; 28 | 29 | private Integer gender; 30 | 31 | 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/UserMenuRight.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-03 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = false) 19 | @Accessors(chain = true) 20 | @TableName("security_user_menu_right") 21 | public class UserMenuRight extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private Long menuId; 27 | 28 | private Long menuRightId; 29 | 30 | private Long userMenuId; 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IUserRoleService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.security.entity.UserRole; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-03-03 17 | */ 18 | public interface IUserRoleService extends IService { 19 | public PageInfo, UserRole> page(PageInfo, UserRole> pageInfo); 20 | 21 | public Long getRoleIdByUserId(Long userId); 22 | 23 | public List getRoleIdsByUserId(Long userId); 24 | 25 | public void deleteRoleByUserId(Long userId); 26 | } 27 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.starfire.familytree.security.entity.Role; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-03-03 18 | */ 19 | public interface RoleMapper extends BaseMapper { 20 | 21 | public Role getRoleByCode(String code); 22 | 23 | public List getRoles(); 24 | 25 | public Page queryPage(Page page, @Param("queryCon") Map queryCon); 26 | 27 | public void deleteByRoleId(Long roleId); 28 | } 29 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/vo/OrgChartItemVO.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.vo; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import lombok.Data; 5 | 6 | /** 7 | * 组织图表项目,封装basicprimitives item对象,id和parent 类型为long 无法正常表示关系 8 | * @version 1.0 9 | * @author: Luzh 10 | * @date: 2019/8/30 8:45 11 | */ 12 | @Data 13 | @JsonInclude(JsonInclude.Include.NON_NULL) 14 | public class OrgChartItemVO { 15 | 16 | 17 | private Integer id; 18 | private Integer[] parents; 19 | private Integer relativeItem; 20 | private Integer position; 21 | private String title; 22 | private String description; 23 | private String image; 24 | private String sex; 25 | private String generations; 26 | private String label; 27 | private String remark; 28 | private String peopleId; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/entity/Cemetery.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import java.time.LocalDateTime; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.experimental.Accessors; 9 | 10 | /** 11 | *

12 | * 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-10-07 17 | */ 18 | @Data 19 | @EqualsAndHashCode(callSuper = true) 20 | @Accessors(chain = true) 21 | @TableName("bs_cemetery") 22 | public class Cemetery extends AbstractEntity { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | private String name; 27 | 28 | private String address; 29 | 30 | private String remark; 31 | 32 | private String shape; 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/impl/PartnerServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.starfire.familytree.folk.entity.Partner; 5 | import com.starfire.familytree.folk.entity.People; 6 | import com.starfire.familytree.folk.mapper.PartnerMapper; 7 | import com.starfire.familytree.folk.service.IPartnerService; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

14 | * 服务实现类 15 | *

16 | * 17 | * @author luzh 18 | * @since 2019-08-15 19 | */ 20 | @Service 21 | public class PartnerServiceImpl extends ServiceImpl implements IPartnerService { 22 | 23 | @Override 24 | public People getWife(Long husbandId) { 25 | return baseMapper.getWife(husbandId); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/entity/Category.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @Accessors(chain = true) 20 | @TableName("bs_category") 21 | public class Category extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * 类别名称 27 | */ 28 | private String name; 29 | 30 | /** 31 | * 备注 32 | */ 33 | private String remark; 34 | 35 | /** 36 | * 父级id 37 | */ 38 | private Long parentId; 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/entity/Children.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @Accessors(chain = true) 20 | @TableName("bs_children") 21 | public class Children extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * 父辈ID 27 | */ 28 | private Long parentId; 29 | 30 | /** 31 | * 子辈ID 32 | */ 33 | private Long childrenId; 34 | 35 | /** 36 | * 备注 37 | */ 38 | private String remark; 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/entity/Partner.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-08-15 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @Accessors(chain = true) 20 | @TableName("bs_partner") 21 | public class Partner extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | /** 26 | * 丈夫ID 27 | */ 28 | private Long husbandId; 29 | 30 | /** 31 | * 妻子ID 32 | */ 33 | private Long wifeId; 34 | 35 | 36 | /** 37 | * 备注 38 | */ 39 | private String remark; 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/service/IDictService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.basic.entity.Dict; 5 | import com.starfire.familytree.vo.PageInfo; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | *

12 | * 系统字典数据服务类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-03-06 17 | */ 18 | public interface IDictService extends IService { 19 | 20 | public PageInfo, Dict> page(PageInfo, Dict> page); 21 | 22 | public List getParentDict(String code); 23 | 24 | public Dict getDict(String code); 25 | 26 | List getSubDictListByParentCode(String code); 27 | 28 | List getBranchList(); 29 | 30 | List getProdTeam(); 31 | 32 | List getPermissionList(); 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/usercenter/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.usercenter.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.core.metadata.IPage; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.starfire.familytree.security.entity.Menu; 7 | import com.starfire.familytree.usercenter.entity.User; 8 | import org.apache.ibatis.annotations.Param; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | *

14 | * Mapper 接口 15 | *

16 | * 17 | * @author luzh 18 | * @since 2019-03-03 19 | */ 20 | public interface UserMapper extends BaseMapper { 21 | 22 | public User getUserByUserName(@Param(value = "username") String username); 23 | 24 | public User getUserByEmail(String email); 25 | 26 | public IPage queryPage(Page page, @Param("queryCon") Map queryCon); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.config; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.transaction.annotation.EnableTransactionManagement; 8 | //Spring boot方式 9 | @EnableTransactionManagement 10 | @Configuration 11 | @MapperScan({"com.starfire.familytree.**.mapper"}) 12 | public class MybatisPlusConfig { 13 | 14 | /** 15 | * 分页插件 16 | */ 17 | @Bean 18 | public PaginationInterceptor paginationInterceptor() { 19 | PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); 20 | // paginationInterceptor.setLimit(你的最大单页限制数量,默认 500 条,小于 0 如 -1 不受限制); 21 | return paginationInterceptor; 22 | } 23 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IMenuRightService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.security.entity.MenuRight; 5 | import com.starfire.familytree.vo.MenuRightVO; 6 | import com.starfire.familytree.vo.PageInfo; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * 服务类 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-03-03 18 | */ 19 | public interface IMenuRightService extends IService { 20 | public PageInfo, MenuRight> page(PageInfo, MenuRight> page); 21 | 22 | public List getList(Long menuId); 23 | 24 | public List convert(List menuRights); 25 | 26 | public void removeByMenuId(Long menuId); 27 | 28 | public List getPermissionForAdmin(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IRoleMenuService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.security.entity.RoleMenu; 5 | import com.starfire.familytree.vo.PageInfo; 6 | import com.starfire.familytree.vo.RoleMenuVO; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * 服务类 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-03-03 18 | */ 19 | public interface IRoleMenuService extends IService { 20 | public PageInfo, RoleMenu> page(PageInfo, RoleMenu> pageInfo); 21 | 22 | 23 | public RoleMenuVO getRoleMenuByRoleId(Long roleId); 24 | 25 | public List getListByRoleId(Long roleId); 26 | 27 | public void deleteByRoleId(Long roleId); 28 | 29 | public void addOrUpdateRoleMenu(RoleMenuVO roleMenuVo); 30 | } 31 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/entity/Region.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.experimental.Accessors; 7 | 8 | 9 | /** 10 | *

11 | * 12 | *

13 | * 14 | * @author luzh 15 | * @since 2019-03-07 16 | */ 17 | @Data 18 | @EqualsAndHashCode(callSuper = true) 19 | @Accessors(chain = true) 20 | @TableName("basic_region") 21 | public class Region extends AbstractEntity { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | private String areaCode; 27 | 28 | private String code; 29 | 30 | private String fullName; 31 | 32 | private String name; 33 | 34 | private String postCode; 35 | 36 | private String remark; 37 | 38 | private String shortName; 39 | 40 | private Long areaId; 41 | 42 | private Long typeId; 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/utils/StringHelper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.utils; 2 | 3 | import net.sourceforge.pinyin4j.PinyinHelper; 4 | import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat; 5 | import net.sourceforge.pinyin4j.format.HanyuPinyinToneType; 6 | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; 7 | 8 | public class StringHelper { 9 | 10 | public static String toPinyin(String chinese){ 11 | HanyuPinyinOutputFormat format=new HanyuPinyinOutputFormat(); 12 | format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); 13 | try { 14 | String pinyinString = PinyinHelper.toHanYuPinyinString(chinese, format, "", false); 15 | return pinyinString; 16 | } catch (BadHanyuPinyinOutputFormatCombination badHanyuPinyinOutputFormatCombination) { 17 | badHanyuPinyinOutputFormatCombination.printStackTrace(); 18 | } 19 | return ""; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/FamilytreeApplication.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | import org.springframework.boot.builder.SpringApplicationBuilder; 8 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 9 | 10 | @SpringBootApplication 11 | public class FamilytreeApplication extends SpringBootServletInitializer { 12 | private final static Logger log = LoggerFactory.getLogger(FamilytreeApplication.class); 13 | 14 | @Override 15 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 16 | return application.sources(FamilytreeApplication.class); 17 | } 18 | 19 | public static void main(String[] args) throws Exception { 20 | SpringApplication.run(FamilytreeApplication.class, args); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/UserRoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | delete from security_user_role where user_id=#{userId} 13 | 14 | 15 | 18 | 19 | 22 | 23 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/mapper/DictMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.starfire.familytree.basic.entity.Dict; 6 | import com.starfire.familytree.basic.entity.Region; 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import java.util.List; 10 | import java.util.Map; 11 | 12 | /** 13 | *

14 | * Mapper 接口 15 | *

16 | * 17 | * @author luzh 18 | * @since 2019-03-06 19 | */ 20 | public interface DictMapper extends BaseMapper { 21 | 22 | Page page(Page page, @Param(value = "param") Map param); 23 | 24 | List getParentDict(String code); 25 | 26 | Dict getDict(String code); 27 | 28 | List getSubDictListByParentCode(String parentCode); 29 | 30 | List getBranchList(); 31 | 32 | List getProdTeam(); 33 | 34 | List getPermissionList(); 35 | } 36 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | import com.starfire.familytree.basic.entity.AbstractEntity; 6 | import com.starfire.familytree.enums.BooleanEnum; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.experimental.Accessors; 10 | 11 | import javax.validation.constraints.NotEmpty; 12 | 13 | /** 14 | *

15 | * 16 | *

17 | * 18 | * @author luzh 19 | * @since 2019-03-03 20 | */ 21 | @Data 22 | @EqualsAndHashCode(callSuper = false) 23 | @Accessors(chain = true) 24 | @TableName("security_role") 25 | public class Role extends AbstractEntity { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | 30 | private BooleanEnum admin = BooleanEnum.否; 31 | 32 | @NotEmpty(message = "不能为空") 33 | private String code; 34 | 35 | @NotEmpty(message = "不能为空") 36 | private String name; 37 | 38 | private String remark; 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/PartnerMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/ChildrenMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/service/impl/ImageFileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.service.impl; 2 | 3 | import com.starfire.familytree.bs.entity.ImageFile; 4 | import com.starfire.familytree.bs.mapper.ImageFileMapper; 5 | import com.starfire.familytree.bs.service.IImageFileService; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | *

13 | * 服务实现类 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-12-18 18 | */ 19 | @Service 20 | public class ImageFileServiceImpl extends ServiceImpl implements IImageFileService { 21 | 22 | 23 | @Override 24 | public List getImageFiles(Long otherId) { 25 | List imageFiles = baseMapper.getImageFiles(otherId); 26 | for (int i = 0; i < imageFiles.size(); i++) { 27 | ImageFile imageFile = imageFiles.get(i); 28 | imageFile.setPath("http://localhost/images"+imageFile.getPath()); 29 | } 30 | return imageFiles; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/usercenter/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.usercenter.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.usercenter.entity.User; 5 | import com.starfire.familytree.vo.PageInfo; 6 | import com.starfire.familytree.vo.ResetPasswordVO; 7 | import org.apache.ibatis.annotations.Param; 8 | import org.springframework.security.core.userdetails.UserDetailsService; 9 | 10 | import java.util.Map; 11 | 12 | /** 13 | *

14 | * 服务类 15 | *

16 | * 17 | * @author luzh 18 | * @since 2019-03-03 19 | */ 20 | public interface IUserService extends UserDetailsService, IService { 21 | 22 | public User getUserByUserName(String username); 23 | 24 | public User getUserByEmail(String email); 25 | 26 | public User registerNewUserAccount(User user); 27 | 28 | public Boolean activeUser(Long userId); 29 | 30 | 31 | public PageInfo, User> page(PageInfo, User> pageInfo); 32 | 33 | public User saveOrUpdateUser(User user); 34 | 35 | void resetPassword(ResetPasswordVO resetPasswordVO); 36 | } 37 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/UserMenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | delete from security_user_menu where user_id=#{userId} 19 | 20 | 23 | 24 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/MenuRightMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/RoleMenuMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | delete from security_role_menu where role_id=#{roleId} 19 | 20 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/entity/AbstractEntity.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.entity; 2 | 3 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 4 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 5 | import com.starfire.familytree.enums.ValidEnum; 6 | import lombok.Data; 7 | 8 | import java.io.Serializable; 9 | import java.time.LocalDateTime; 10 | 11 | /** 12 | * 实体基类 13 | * 14 | * @author luzh 15 | */ 16 | @Data 17 | //@MappedSuperclass 18 | public abstract class AbstractEntity implements Serializable { 19 | /** 20 | * 21 | */ 22 | private static final long serialVersionUID = 1L; 23 | 24 | /** 25 | * @author luzh 26 | */ 27 | 28 | @JsonSerialize(using = ToStringSerializer.class) 29 | // @Id 30 | private Long id = null; 31 | 32 | /** 33 | * 创建人 34 | */ 35 | private String creator="system"; 36 | 37 | /** 38 | * 创建时间 39 | */ 40 | private LocalDateTime createTime = LocalDateTime.now(); 41 | 42 | /** 43 | * 编辑人 44 | */ 45 | private String editor; 46 | 47 | /** 48 | * 编辑时间 49 | */ 50 | private LocalDateTime editTime; 51 | 52 | private ValidEnum valid = ValidEnum.是; 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/entity/ImageFile.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.entity; 2 | 3 | import com.starfire.familytree.basic.entity.AbstractEntity; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import java.time.LocalDateTime; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | import lombok.experimental.Accessors; 9 | 10 | /** 11 | *

12 | * 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-12-18 17 | */ 18 | @Data 19 | @EqualsAndHashCode(callSuper = true) 20 | @Accessors(chain = true) 21 | @TableName("bs_image_file") 22 | public class ImageFile extends AbstractEntity { 23 | 24 | private static final long serialVersionUID = 1L; 25 | 26 | /** 27 | * 图片路径 28 | */ 29 | private String path; 30 | 31 | /** 32 | * 图片名称 33 | */ 34 | private String name; 35 | 36 | /** 37 | * 简述 38 | */ 39 | private String brief; 40 | 41 | /** 42 | * base64数据 43 | */ 44 | private String data; 45 | 46 | /** 47 | * 宽度 48 | */ 49 | private Integer width; 50 | 51 | /** 52 | * 长度 53 | */ 54 | private Integer heigth; 55 | 56 | /** 57 | * 外表主键 58 | */ 59 | private Long otherId; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/impl/VerificationTokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.starfire.familytree.entity.VerificationToken; 5 | import com.starfire.familytree.mapper.VerificationTokenMapper; 6 | import com.starfire.familytree.service.IVerificationTokenService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | *

12 | * 服务实现类 13 | *

14 | * 15 | * @author luzh 16 | * @since 2019-02-19 17 | */ 18 | @Service 19 | public class VerificationTokenServiceImpl extends ServiceImpl implements IVerificationTokenService { 20 | 21 | @Autowired 22 | private VerificationTokenMapper tokenRepository; 23 | 24 | @Override 25 | public void createVerificationToken(Long userId, String token) { 26 | VerificationToken myToken = new VerificationToken(token, userId); 27 | tokenRepository.insert(myToken); 28 | } 29 | 30 | @Override 31 | public VerificationToken getVerificationToken(String token) { 32 | return tokenRepository.findByToken(token); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/IMenuService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import com.baomidou.mybatisplus.extension.service.IService; 7 | import com.starfire.familytree.security.entity.Menu; 8 | import com.starfire.familytree.vo.MenuTree; 9 | import com.starfire.familytree.vo.PageInfo; 10 | 11 | /** 12 | *

13 | * 服务类 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-03-03 18 | */ 19 | public interface IMenuService extends IService { 20 | 21 | public PageInfo, Menu> page(PageInfo, Menu> pageInfo); 22 | 23 | public List getChildMenu(Long parentId); 24 | 25 | public List getParentMenu(Long menuId); 26 | 27 | public List getParentMenuIds(List childMenuIds); 28 | 29 | public List getParentMenus(); 30 | 31 | public List getByIds(List menuIds); 32 | 33 | public List getMenusTree(); 34 | 35 | public List getMenusByRoleId(Long roleId); 36 | 37 | public Menu getMenuByCode(String code); 38 | 39 | public List getParentMenusByAdmin(); 40 | 41 | public List getMenusByUserId(Long userId); 42 | } 43 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/CategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 22 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/impl/CemeteryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.starfire.familytree.folk.entity.Category; 5 | import com.starfire.familytree.folk.entity.Cemetery; 6 | import com.starfire.familytree.folk.mapper.CemeteryMapper; 7 | import com.starfire.familytree.folk.service.ICemeteryService; 8 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.Map; 13 | 14 | /** 15 | *

16 | * 服务实现类 17 | *

18 | * 19 | * @author luzh 20 | * @since 2019-10-07 21 | */ 22 | @Service 23 | public class CemeteryServiceImpl extends ServiceImpl implements ICemeteryService { 24 | 25 | @Override 26 | public PageInfo, Cemetery> page(PageInfo, Cemetery> pageInfo) { 27 | Map param = pageInfo.getParam(); 28 | Page page = pageInfo.toMybatisPlusPage(); 29 | Page result = baseMapper.getPage(page,param); 30 | pageInfo.from(result); 31 | return pageInfo; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/service/impl/RegionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.starfire.familytree.basic.entity.Region; 7 | import com.starfire.familytree.basic.mapper.RegionMapper; 8 | import com.starfire.familytree.basic.service.IRegionService; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.Map; 13 | 14 | /** 15 | *

16 | * 省市区服务实现类 17 | *

18 | * 19 | * @author luzh 20 | * @since 2019-03-07 21 | */ 22 | @Service 23 | public class RegionServiceImpl extends ServiceImpl implements IRegionService { 24 | 25 | @Override 26 | public PageInfo, Region> page(PageInfo, Region> pageInfo) { 27 | Page page = pageInfo.toMybatisPlusPage(); 28 | Map param = pageInfo.getParam(); 29 | Page selectPage =baseMapper.page(page, param); 30 | pageInfo.from(selectPage); 31 | return pageInfo; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/OnRegistrationCompleteEvent.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service; 2 | 3 | import com.starfire.familytree.usercenter.entity.User; 4 | import org.springframework.context.ApplicationEvent; 5 | 6 | import java.util.Locale; 7 | 8 | public class OnRegistrationCompleteEvent extends ApplicationEvent { 9 | /** 10 | * 11 | */ 12 | private static final long serialVersionUID = 1L; 13 | private String appUrl; 14 | private Locale locale; 15 | private User user; 16 | 17 | public OnRegistrationCompleteEvent( 18 | User user, Locale locale, String appUrl) { 19 | super(user); 20 | 21 | this.user = user; 22 | this.locale = locale; 23 | this.appUrl = appUrl; 24 | } 25 | 26 | public String getAppUrl() { 27 | return appUrl; 28 | } 29 | 30 | public void setAppUrl(String appUrl) { 31 | this.appUrl = appUrl; 32 | } 33 | 34 | public Locale getLocale() { 35 | return locale; 36 | } 37 | 38 | public void setLocale(Locale locale) { 39 | this.locale = locale; 40 | } 41 | 42 | public User getUser() { 43 | return user; 44 | } 45 | 46 | public void setUser(User user) { 47 | this.user = user; 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/ImageFileMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/CemeteryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 27 | 28 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/entity/Village.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.starfire.familytree.basic.entity.AbstractEntity; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import java.time.LocalDateTime; 7 | import java.util.Map; 8 | 9 | import com.starfire.familytree.vo.ImageRespVO; 10 | import lombok.Data; 11 | import lombok.EqualsAndHashCode; 12 | import lombok.experimental.Accessors; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author luzh 20 | * @since 2019-11-12 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = true) 24 | @Accessors(chain = true) 25 | @TableName("bs_village") 26 | public class Village extends AbstractEntity { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | /** 31 | * 村编号 32 | */ 33 | private String code; 34 | 35 | /** 36 | * 村名 37 | */ 38 | private String name; 39 | 40 | /** 41 | * 备注 42 | */ 43 | private String remark; 44 | 45 | /** 46 | * 地址 47 | */ 48 | private String address; 49 | 50 | /** 51 | * 经度 52 | */ 53 | private Double longitude; 54 | 55 | /** 56 | * 纬度 57 | */ 58 | private Double latitude; 59 | 60 | @TableField(exist = false) 61 | private ImageRespVO file; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/entity/CategoryContent.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 6 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 7 | import com.starfire.familytree.basic.entity.AbstractEntity; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | import java.beans.Transient; 13 | 14 | /** 15 | *

16 | * 17 | *

18 | * 19 | * @author luzh 20 | * @since 2019-08-15 21 | */ 22 | @Data 23 | @EqualsAndHashCode(callSuper = true) 24 | @Accessors(chain = true) 25 | @TableName("bs_category_content") 26 | public class CategoryContent extends AbstractEntity { 27 | 28 | private static final long serialVersionUID = 1L; 29 | 30 | /** 31 | * 子标题 32 | */ 33 | private String subTitle; 34 | 35 | /** 36 | * 标题 37 | */ 38 | private String title; 39 | 40 | /** 41 | * 内容 42 | */ 43 | private String content; 44 | 45 | /** 46 | * 类别编号 47 | */ 48 | @JsonSerialize(using = ToStringSerializer.class) 49 | private Long categoryId; 50 | 51 | @TableField(exist = false) 52 | private String categoryName; 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/entity/Dict.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableField; 4 | import com.baomidou.mybatisplus.annotation.TableName; 5 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 6 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 7 | import com.starfire.familytree.enums.BooleanEnum; 8 | import lombok.Data; 9 | import lombok.EqualsAndHashCode; 10 | import lombok.experimental.Accessors; 11 | 12 | import javax.validation.constraints.NotNull; 13 | import java.beans.Transient; 14 | import java.math.BigDecimal; 15 | 16 | /** 17 | *

18 | * 19 | *

20 | * 21 | * @author luzh 22 | * @since 2019-03-06 23 | */ 24 | @Data 25 | @EqualsAndHashCode(callSuper = true) 26 | @Accessors(chain = true) 27 | @TableName("basic_dict") 28 | public class Dict extends AbstractEntity { 29 | 30 | private static final long serialVersionUID = 1L; 31 | 32 | @NotNull(message = "编码不能为空") 33 | private String code; 34 | 35 | private Integer dis; 36 | 37 | @NotNull(message = "名称不能为空") 38 | private String name; 39 | 40 | private BigDecimal numValue; 41 | 42 | private String remark; 43 | 44 | private String value; 45 | 46 | @JsonSerialize(using = ToStringSerializer.class) 47 | private Long parentId; 48 | 49 | @TableField(exist = false) 50 | private String parentName; 51 | } 52 | -------------------------------------------------------------------------------- /familytree/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/entity/VerificationToken.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.TableName; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.io.Serializable; 9 | import java.sql.Timestamp; 10 | import java.util.Calendar; 11 | import java.util.Date; 12 | 13 | /** 14 | *

15 | * 16 | *

17 | * 18 | * @author luzh 19 | * @since 2019-02-19 20 | */ 21 | @Data 22 | @EqualsAndHashCode(callSuper = false) 23 | @Accessors(chain = true) 24 | @TableName("verification_token") 25 | public class VerificationToken implements Serializable { 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | private Long id; 30 | 31 | private String token; 32 | 33 | private Long userId; 34 | 35 | private Date expiryDate; 36 | 37 | public Date calculateExpiryDate(int expiryTimeInMinutes) { 38 | Calendar cal = Calendar.getInstance(); 39 | cal.setTime(new Timestamp(cal.getTime().getTime())); 40 | cal.add(Calendar.MINUTE, expiryTimeInMinutes); 41 | return new Date(cal.getTime().getTime()); 42 | } 43 | 44 | public VerificationToken(String token, Long userId) { 45 | super(); 46 | this.token = token; 47 | this.userId = userId; 48 | } 49 | 50 | public VerificationToken() { 51 | super(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/impl/CategoryContentServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.starfire.familytree.folk.entity.CategoryContent; 6 | import com.starfire.familytree.folk.mapper.CategoryContentMapper; 7 | import com.starfire.familytree.folk.service.ICategoryContentService; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.Map; 13 | 14 | /** 15 | *

16 | * 服务实现类 17 | *

18 | * 19 | * @author luzh 20 | * @since 2019-08-15 21 | */ 22 | @Service 23 | public class CategoryContentServiceImpl extends ServiceImpl implements ICategoryContentService { 24 | @Autowired 25 | private CategoryContentMapper categoryContentMapper; 26 | 27 | @Override 28 | public PageInfo, CategoryContent> page(PageInfo, CategoryContent> pageInfo) { 29 | Map param = pageInfo.getParam(); 30 | Page page = pageInfo.toMybatisPlusPage(); 31 | Page result = categoryContentMapper.getPage(page,param); 32 | pageInfo.from(result); 33 | return pageInfo; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 4 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 5 | import com.starfire.familytree.folk.entity.Category; 6 | import com.starfire.familytree.folk.mapper.CategoryMapper; 7 | import com.starfire.familytree.folk.service.ICategoryService; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-08-15 22 | */ 23 | @Service 24 | public class CategoryServiceImpl extends ServiceImpl implements ICategoryService { 25 | 26 | 27 | @Override 28 | public PageInfo, Category> page(PageInfo, Category> pageInfo) { 29 | Map param = pageInfo.getParam(); 30 | Page page = pageInfo.toMybatisPlusPage(); 31 | Page result = baseMapper.getPage(page,param); 32 | pageInfo.from(result); 33 | return pageInfo; 34 | } 35 | 36 | @Override 37 | public List getCategoryList() { 38 | 39 | return baseMapper.getCategoryList(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/impl/ForgotPasswordListener.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service.impl; 2 | 3 | import com.starfire.familytree.service.IVerificationTokenService; 4 | import com.starfire.familytree.service.OnForgotPasswordEvent; 5 | import com.starfire.familytree.service.OnRegistrationCompleteEvent; 6 | import com.starfire.familytree.usercenter.entity.User; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.context.ApplicationListener; 10 | import org.springframework.mail.SimpleMailMessage; 11 | import org.springframework.mail.javamail.JavaMailSender; 12 | import org.springframework.stereotype.Component; 13 | 14 | import java.util.UUID; 15 | 16 | @Component 17 | public class ForgotPasswordListener implements 18 | ApplicationListener { 19 | 20 | @Autowired 21 | private IVerificationTokenService service; 22 | 23 | 24 | @Autowired 25 | private JavaMailSender mailSender; 26 | 27 | @Value("${email.system}") 28 | private String systemEmail; 29 | 30 | @Override 31 | public void onApplicationEvent(OnForgotPasswordEvent event) { 32 | SimpleMailMessage email = new SimpleMailMessage(); 33 | email.setFrom(systemEmail); 34 | email.setTo(event.getEmail()); 35 | email.setSubject("找回密码"); 36 | email.setText("测试"); 37 | mailSender.send(email); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/mapper/MenuMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.mapper; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 9 | import com.baomidou.mybatisplus.core.metadata.IPage; 10 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 11 | import com.starfire.familytree.security.entity.Menu; 12 | 13 | /** 14 | *

15 | * Mapper 接口 16 | *

17 | * 18 | * @author luzh 19 | * @since 2019-03-03 20 | */ 21 | public interface MenuMapper extends BaseMapper { 22 | 23 | public List getChildMenu(Long parentMenuId); 24 | 25 | public List getParentMenu(Long menuId); 26 | 27 | public IPage queryPage(Page page,@Param("queryCon")Map queryCon); 28 | 29 | public List getRootMenuTree(); 30 | 31 | public List getInvisibleMenus(); 32 | 33 | public List getParentMenus(); 34 | 35 | public List getByIds(@Param("menuIds") List menuIds); 36 | 37 | public List getMenusByRoleId(Long roleId); 38 | 39 | public List getMenusByUserId(Long userId); 40 | 41 | public List getParentMenusByRoleId(Long roleId); 42 | 43 | public List getParentMenusByUserId(Long userId); 44 | 45 | public List getParentMenuIds(@Param("childMenuIds")List childMenuIds); 46 | 47 | public Menu getMenuByCode(String code); 48 | 49 | public List getParentMenusByAdmin(); 50 | } 51 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.starfire.familytree.security.entity.Role; 7 | import com.starfire.familytree.security.mapper.RoleMapper; 8 | import com.starfire.familytree.security.service.IRoleService; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-03-03 22 | */ 23 | @Service 24 | public class RoleServiceImpl extends ServiceImpl implements IRoleService { 25 | 26 | @Override 27 | public PageInfo, Role> page(PageInfo, Role> pageInfo) { 28 | Page page = pageInfo.toMybatisPlusPage(); 29 | Map param = pageInfo.getParam(); 30 | Page selectPage = (Page) baseMapper.queryPage(page, param); 31 | pageInfo.from(selectPage); 32 | return pageInfo; 33 | } 34 | 35 | @Override 36 | public Role getRoleByCode(String code) { 37 | return baseMapper.getRoleByCode(code); 38 | } 39 | 40 | @Override 41 | public List getRoles() { 42 | return baseMapper.getRoles(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/IPeopleService.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.starfire.familytree.folk.entity.CategoryContent; 5 | import com.starfire.familytree.folk.entity.People; 6 | import com.starfire.familytree.vo.PageInfo; 7 | import com.starfire.familytree.vo.RelationshipVO; 8 | import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination; 9 | 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | /** 14 | *

15 | * 服务类 16 | *

17 | * 18 | * @author luzh 19 | * @since 2019-08-09 20 | */ 21 | public interface IPeopleService extends IService { 22 | 23 | 24 | public People addWife(People wife,Long husbandId); 25 | 26 | public People addChildren(People child,Long parentId); 27 | 28 | public People getHusband(Long husbandId); 29 | 30 | public People addPeople(People people) ; 31 | 32 | 33 | public List getPeoplesByGeneration(int gen); 34 | 35 | /** 36 | * 获取祖先第一人 37 | * @param gen 38 | * @return 39 | */ 40 | public People getForefather(int gen); 41 | 42 | public People getPeople(Long id); 43 | 44 | public People getFamilyTree(Map param); 45 | 46 | public PageInfo, People> page(PageInfo, People> page); 47 | 48 | List getPeopleByName(String name); 49 | 50 | boolean addRelationship(RelationshipVO relationshipVO); 51 | 52 | public List> getNames(String name); 53 | } 54 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/impl/UserMenuRightServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.starfire.familytree.security.entity.UserMenuRight; 7 | import com.starfire.familytree.security.mapper.UserMenuRightMapper; 8 | import com.starfire.familytree.security.service.IUserMenuRightService; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-03-03 22 | */ 23 | @Service 24 | public class UserMenuRightServiceImpl extends ServiceImpl implements IUserMenuRightService { 25 | @Override 26 | public PageInfo, UserMenuRight> page(PageInfo, UserMenuRight> pageInfo) { 27 | QueryWrapper qw = new QueryWrapper(); 28 | Page page = pageInfo.toMybatisPlusPage(); 29 | Page selectPage = (Page) baseMapper.selectPage(page, qw); 30 | pageInfo.from(selectPage); 31 | return pageInfo; 32 | } 33 | 34 | @Override 35 | public List getPermission(Long userId) { 36 | return baseMapper.getPermission(userId); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/bs/controller/ImageFileController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.bs.controller; 2 | 3 | 4 | import com.starfire.familytree.bs.entity.ImageFile; 5 | import com.starfire.familytree.bs.entity.Village; 6 | import com.starfire.familytree.bs.service.IImageFileService; 7 | import com.starfire.familytree.bs.service.IVillageService; 8 | import com.starfire.familytree.response.Response; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.GetMapping; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | 13 | import org.springframework.web.bind.annotation.RestController; 14 | 15 | import java.util.HashMap; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | *

21 | * 前端控制器 22 | *

23 | * 24 | * @author luzh 25 | * @since 2019-12-18 26 | */ 27 | @RestController 28 | @RequestMapping("imageFile") 29 | public class ImageFileController { 30 | 31 | @Autowired 32 | private IVillageService villageService; 33 | 34 | @Autowired 35 | private IImageFileService imageFileService; 36 | 37 | @GetMapping("/getVillageImages") 38 | public Response getVillageImages() { 39 | String villageCode="changqitang"; 40 | Village village = villageService.getVillage(villageCode); 41 | List imageFiles = imageFileService.getImageFiles(village.getId()); 42 | Response response = new Response<>(); 43 | Map map=new HashMap<>(); 44 | map.put("images",imageFiles); 45 | return response.success(map); 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.http.ResponseEntity; 6 | import springfox.documentation.builders.ApiInfoBuilder; 7 | import springfox.documentation.builders.PathSelectors; 8 | import springfox.documentation.builders.RequestHandlerSelectors; 9 | import springfox.documentation.service.ApiInfo; 10 | import springfox.documentation.service.Contact; 11 | import springfox.documentation.spi.DocumentationType; 12 | import springfox.documentation.spring.web.plugins.Docket; 13 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 14 | 15 | import java.time.LocalDate; 16 | 17 | /** 18 | * @version 1.0 19 | * @author: Luzh 20 | * @date: 2019/8/19 16:04 21 | */ 22 | @Configuration 23 | @EnableSwagger2 24 | public class SwaggerConfig { 25 | @Bean 26 | public Docket api() { 27 | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) 28 | .select() 29 | .apis(RequestHandlerSelectors.any()) 30 | .paths(PathSelectors.any()) 31 | .build() 32 | .pathMapping("/") 33 | .directModelSubstitute(LocalDate.class, String.class) 34 | .genericModelSubstitutes(ResponseEntity.class) 35 | ; 36 | } 37 | 38 | @Bean 39 | public ApiInfo apiInfo() { 40 | return new ApiInfoBuilder().title("接口文档").version("1.0").contact(new Contact("luzh", "", "670177230@qq.com")).build(); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/RoleMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 26 | 35 | 36 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/CategoryContentMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/mapper/PeopleMapper.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.starfire.familytree.folk.entity.People; 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | /** 12 | *

13 | * Mapper 接口 14 | *

15 | * 16 | * @author luzh 17 | * @since 2019-08-09 18 | */ 19 | public interface PeopleMapper extends BaseMapper { 20 | 21 | public List getPeoplesByGeneration(@Param("gen") int gen); 22 | 23 | public People getForefather(@Param("gen") int gen); 24 | 25 | Page getPage(Page page, @Param("param")Map param); 26 | 27 | People getFamilyTree(String branch); 28 | 29 | List getPeopleByName(@Param("name")String name); 30 | 31 | public String getBranchByName(@Param("name")String name); 32 | 33 | public List> getNamesByPinyin(@Param("pinyin")String pinyin); 34 | 35 | public List> getPeopleNumByGender(@Param("villageCode")String villageCode); 36 | 37 | public List> getPeopleNumByEducation(@Param("villageCode")String villageCode); 38 | 39 | public List> getPeopleNumByProTeam(@Param("villageCode")String villageCode); 40 | 41 | public List> getPeopleNumByBranch(@Param("villageCode")String villageCode); 42 | 43 | public List> getGenderByGenerations(@Param("villageCode")String villageCode); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/impl/RoleMenuRightServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.starfire.familytree.security.entity.RoleMenuRight; 7 | import com.starfire.familytree.security.mapper.RoleMenuRightMapper; 8 | import com.starfire.familytree.security.service.IRoleMenuRightService; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-03-03 22 | */ 23 | @Service 24 | public class RoleMenuRightServiceImpl extends ServiceImpl implements IRoleMenuRightService { 25 | @Override 26 | public PageInfo, RoleMenuRight> page(PageInfo, RoleMenuRight> pageInfo) { 27 | QueryWrapper qw = new QueryWrapper(); 28 | Page page = pageInfo.toMybatisPlusPage(); 29 | Page selectPage = (Page) baseMapper.selectPage(page, qw); 30 | pageInfo.from(selectPage); 31 | return pageInfo; 32 | } 33 | 34 | @Override 35 | public void deleteByMenuId(Long menuId) { 36 | baseMapper.deleteByMenuId(menuId); 37 | } 38 | 39 | @Override 40 | public List getPermission(Long roleId) { 41 | return baseMapper.getPermission(roleId); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/service/impl/ChildrenServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.service.impl; 2 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 | import com.starfire.familytree.enums.BooleanEnum; 5 | import com.starfire.familytree.folk.entity.Children; 6 | import com.starfire.familytree.folk.entity.People; 7 | import com.starfire.familytree.folk.mapper.ChildrenMapper; 8 | import com.starfire.familytree.folk.mapper.PeopleMapper; 9 | import com.starfire.familytree.folk.service.IChildrenService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | /** 17 | *

18 | * 服务实现类 19 | *

20 | * 21 | * @author luzh 22 | * @since 2019-08-15 23 | */ 24 | @Service 25 | public class ChildrenServiceImpl extends ServiceImpl implements IChildrenService { 26 | 27 | @Autowired 28 | private PeopleMapper peopleMapper; 29 | 30 | @Override 31 | public List getChildrenList(Long parentId) { 32 | return baseMapper.getChildrenList(parentId); 33 | } 34 | 35 | @Override 36 | public List getJuniorList(Long parentId) { 37 | List juniorList=new ArrayList<>(); 38 | List childrenList = getChildrenList(parentId); 39 | juniorList.addAll(childrenList); 40 | for (int i = 0; i < childrenList.size(); i++) { 41 | People people = childrenList.get(i); 42 | Long peopleId = people.getId(); 43 | List peopleList = getChildrenList(peopleId); 44 | juniorList.addAll(peopleList); 45 | } 46 | return juniorList; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/entity/Menu.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.entity; 2 | 3 | import javax.validation.constraints.NotEmpty; 4 | 5 | import com.baomidou.mybatisplus.annotation.TableField; 6 | import com.baomidou.mybatisplus.annotation.TableName; 7 | import com.fasterxml.jackson.annotation.JsonValue; 8 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; 9 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; 10 | 11 | import com.starfire.familytree.basic.entity.AbstractEntity; 12 | import com.starfire.familytree.enums.MenuTypeEnum; 13 | import com.starfire.familytree.vo.MenuRightVO; 14 | import lombok.Data; 15 | import lombok.EqualsAndHashCode; 16 | import lombok.experimental.Accessors; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | /** 22 | *

23 | * 24 | *

25 | * 26 | * @author luzh 27 | * @since 2019-03-03 28 | */ 29 | @Data 30 | @EqualsAndHashCode(callSuper = false) 31 | @Accessors(chain = true) 32 | @TableName("security_menu") 33 | public class Menu extends AbstractEntity { 34 | 35 | 36 | private static final long serialVersionUID = 1L; 37 | 38 | @NotEmpty(message="编码不能为空") 39 | private String code; 40 | 41 | private String icon; 42 | 43 | private String idPath; 44 | 45 | @NotEmpty(message="名称不能为空") 46 | private String name; 47 | 48 | private String remark; 49 | 50 | private MenuTypeEnum type; 51 | 52 | @NotEmpty(message="路径不能为空") 53 | private String url; 54 | 55 | @JsonSerialize(using=ToStringSerializer.class) 56 | private Long parent; 57 | 58 | @TableField(exist=false) 59 | private String parentMenuName; 60 | 61 | @TableField(exist=false) 62 | private List menuRights=new ArrayList<>(); 63 | 64 | } 65 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/VillageMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 29 | 30 | 33 | 34 | 37 | 38 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/impl/UserRoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.starfire.familytree.security.entity.UserRole; 7 | import com.starfire.familytree.security.mapper.UserRoleMapper; 8 | import com.starfire.familytree.security.service.IUserRoleService; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 服务实现类 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-03-03 22 | */ 23 | @Service 24 | public class UserRoleServiceImpl extends ServiceImpl implements IUserRoleService { 25 | @Override 26 | public PageInfo, UserRole> page(PageInfo, UserRole> pageInfo) { 27 | QueryWrapper qw = new QueryWrapper(); 28 | Page page = pageInfo.toMybatisPlusPage(); 29 | Page selectPage = (Page) baseMapper.selectPage(page, qw); 30 | pageInfo.from(selectPage); 31 | return pageInfo; 32 | } 33 | 34 | @Override 35 | public Long getRoleIdByUserId(Long userId) { 36 | return baseMapper.getRoleIdByUserId(userId); 37 | } 38 | 39 | @Override 40 | public List getRoleIdsByUserId(Long userId) { 41 | return baseMapper.getRoleIdsByUserId(userId); 42 | } 43 | 44 | @Override 45 | public void deleteRoleByUserId(Long userId) { 46 | baseMapper.deleteRoleByUserId(userId); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/RegionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/UserMenuRightMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | delete from security_user_menu_right where menu_id=#{menuId} 22 | 23 | 24 | delete from security_user_menu_right where user_menu_id=#{userMenuId} 25 | 26 | 31 | 32 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/RoleMenuRightMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | delete from security_role_menu_right where menu_id=#{menuId} 19 | 20 | 21 | delete from security_role_menu_right where role_menu_id=#{role_menu_id} 22 | 23 | 26 | 31 | 32 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/response/FormatResponse.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.response; 2 | 3 | import org.springframework.core.MethodParameter; 4 | import org.springframework.http.MediaType; 5 | import org.springframework.http.converter.HttpMessageConverter; 6 | import org.springframework.http.server.ServerHttpRequest; 7 | import org.springframework.http.server.ServerHttpResponse; 8 | import org.springframework.web.bind.annotation.ControllerAdvice; 9 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; 10 | 11 | import java.lang.reflect.Method; 12 | 13 | @ControllerAdvice 14 | public class FormatResponse implements ResponseBodyAdvice { 15 | 16 | public FormatResponse() { 17 | // TODO Auto-generated constructor stub 18 | } 19 | 20 | @Override 21 | public boolean supports(MethodParameter returnType, Class> converterType) { 22 | Method method = returnType.getMethod(); 23 | Class returnType2 = method.getReturnType(); 24 | String clazz = method.toString(); 25 | String[] split = clazz.split(" "); 26 | String methodName = split[2]; 27 | //如果不是自己的包的方法 28 | if (methodName.startsWith("com.startfire")) { 29 | return false; 30 | } else if (returnType2.isAssignableFrom(Response.class)) { //如果返回类型是Response ,则不执行自动化格式返回 31 | return false; 32 | } 33 | return true; 34 | 35 | } 36 | 37 | @Override 38 | public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, 39 | Class> selectedConverterType, ServerHttpRequest request, 40 | ServerHttpResponse response) { 41 | Response resp = new Response(); 42 | return resp.success(body == null ? "" : body); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/excel/controller/ExcelController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.excel.controller; 2 | 3 | 4 | import com.starfire.familytree.excel.service.IExcelService; 5 | import com.starfire.familytree.response.Response; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.apache.pdfbox.pdmodel.PDDocument; 8 | import org.apache.pdfbox.printing.PDFPageable; 9 | import org.apache.poi.hssf.usermodel.HSSFWorkbook; 10 | import org.apache.poi.ss.usermodel.Sheet; 11 | import org.apache.poi.ss.usermodel.Workbook; 12 | import org.apache.poi.ss.util.WorkbookUtil; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.stereotype.Controller; 15 | import org.springframework.web.bind.annotation.*; 16 | import org.springframework.web.multipart.MultipartFile; 17 | 18 | import java.awt.print.PrinterException; 19 | import java.awt.print.PrinterJob; 20 | import java.io.*; 21 | 22 | /** 23 | * Excel 操作 24 | */ 25 | @Slf4j 26 | @RestController 27 | @RequestMapping("/excel") 28 | public class ExcelController { 29 | 30 | @Autowired 31 | private IExcelService excelService; 32 | 33 | @PostMapping(value="/importPeople") 34 | public Response importPeople(@RequestParam("file") MultipartFile multipartFile) { 35 | try { 36 | excelService.importPeople(multipartFile.getInputStream()); 37 | } catch (IOException e) { 38 | e.printStackTrace(); 39 | } 40 | Response response = new Response<>(); 41 | return response.success(""); 42 | } 43 | 44 | @PostMapping(value="/toPDF") 45 | public Response toPDF() throws PrinterException { 46 | PrinterJob job = PrinterJob.getPrinterJob(); 47 | PDDocument document=new PDDocument(); 48 | job.setPageable(new PDFPageable(document)); 49 | job.print(); 50 | Response response = new Response<>(); 51 | return response.success(""); 52 | } 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/response/Response.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.response; 2 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; 4 | import com.fasterxml.jackson.annotation.JsonInclude.Include; 5 | import lombok.Data; 6 | import lombok.NonNull; 7 | 8 | import java.io.Serializable; 9 | 10 | @Data 11 | @JsonInclude(Include.NON_NULL) 12 | public class Response implements Serializable { 13 | 14 | /** 15 | * 16 | */ 17 | private static final long serialVersionUID = 1L; 18 | 19 | private int code = 200; 20 | 21 | private boolean success = true; 22 | 23 | @NonNull 24 | private String msg; 25 | 26 | private T data; 27 | 28 | public static Response failure(int code, String msg) { 29 | Response response = new Response(100, false, msg, null); 30 | return response; 31 | 32 | } 33 | 34 | public Response failure() { 35 | Response response = new Response(100, false, "失败", null); 36 | return response; 37 | 38 | } 39 | 40 | // public static Response success(String msg) { 41 | // Response response = Response.of(200, true, msg, null); 42 | // return response; 43 | // 44 | // } 45 | 46 | // public static Response success(Object data) { 47 | // Response response = Response.of(200, true, "成功", data); 48 | // return response; 49 | // 50 | // } 51 | 52 | public Response success(T data) { 53 | Response response = new Response(200, true, "成功", data); 54 | return response; 55 | 56 | } 57 | 58 | public Response success() { 59 | Response response = new Response(200, true, "成功", null); 60 | return response; 61 | 62 | } 63 | 64 | public Response(int code, boolean success, String msg, T data) { 65 | this.code = code; 66 | this.success = success; 67 | this.msg = msg; 68 | this.data = data; 69 | } 70 | 71 | public Response() { 72 | super(); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /familytree/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8090 3 | servlet: 4 | context-path: / 5 | 6 | spring: 7 | datasource: 8 | druid: 9 | url: jdbc:mysql://localhost:3306/familytree?characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false 10 | username: root 11 | password: root 12 | driverClassName: com.mysql.jdbc.Driver 13 | maxActive: 20 14 | initialSize: 1 15 | maxWait: 60000 16 | poolPreparedStatements: true 17 | maxPoolPreparedStatementPerConnectionSize: 20 18 | minIdle: 1 19 | timeBetweenEvictionRunsMillis: 60000 20 | minEvictableIdleTimeMillis: 300000 21 | validationQuery: select 1 from dual 22 | testWhileIdle: true 23 | testOnBorrow: false 24 | testOnReturn: false 25 | jackson: 26 | date-format: yyyy-MM-dd HH:mm:ss 27 | time-zone: GMT+8 28 | serialization: 29 | WRITE_DATES_AS_TIMESTAMPS: false 30 | devtools: 31 | livereload: 32 | enabled: true 33 | restart: 34 | enabled: true 35 | session: 36 | timeout: 3600 37 | jdbc: 38 | schema: schema-mysql.sql 39 | store-type: jdbc 40 | jpa: 41 | hibernate: 42 | ddl-auto: none 43 | resources: 44 | add-mappings: true 45 | security: 46 | user: 47 | name: admin 48 | password: admin 49 | 50 | security: 51 | oauth2: 52 | client: 53 | client-id: family_tree 54 | client-secret: family_tree 55 | access-token-uri: http://localhost/oauth/token 56 | user-authorization-uri: http://localhost/oauth/authorize 57 | resource: 58 | user-info-uri: http://localhost/user/me 59 | 60 | logging: 61 | level: INFO 62 | 63 | mybatis-plus: 64 | mapper-locations: classpath:/mapper/*Mapper.xml 65 | configuration: 66 | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl 67 | default-enum-type-handler: com.baomidou.mybatisplus.extension.handlers.EnumTypeHandler 68 | type-enums-package: com.starfire.familytree.enums 69 | global-config: 70 | db-config: 71 | field-strategy: ignored -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/service/impl/RegistrationListener.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.service.impl; 2 | 3 | import com.starfire.familytree.service.IVerificationTokenService; 4 | import com.starfire.familytree.service.OnRegistrationCompleteEvent; 5 | import com.starfire.familytree.usercenter.entity.User; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.context.ApplicationListener; 9 | import org.springframework.mail.SimpleMailMessage; 10 | import org.springframework.mail.javamail.JavaMailSender; 11 | import org.springframework.stereotype.Component; 12 | 13 | import java.util.UUID; 14 | 15 | @Component 16 | public class RegistrationListener implements 17 | ApplicationListener { 18 | 19 | @Autowired 20 | private IVerificationTokenService service; 21 | 22 | 23 | @Autowired 24 | private JavaMailSender mailSender; 25 | 26 | @Value("${email.confirm.template}") 27 | private String template; 28 | 29 | @Value("${email.system}") 30 | private String systemEmail; 31 | 32 | @Override 33 | public void onApplicationEvent(OnRegistrationCompleteEvent event) { 34 | this.confirmRegistration(event); 35 | } 36 | 37 | private void confirmRegistration(OnRegistrationCompleteEvent event) { 38 | User user = event.getUser(); 39 | String token = UUID.randomUUID().toString(); 40 | service.createVerificationToken(user.getId(), token); 41 | String recipientAddress = user.getEmail(); 42 | String subject = "注册确认"; 43 | String confirmationUrl 44 | = event.getAppUrl() + "/SignUp/regitrationConfirm?token=" + token + " "; 45 | String username = user.getUsername(); 46 | 47 | SimpleMailMessage email = new SimpleMailMessage(); 48 | email.setFrom(systemEmail); 49 | email.setTo(recipientAddress); 50 | email.setSubject(subject); 51 | email.setText(String.format(template, username, confirmationUrl)); 52 | mailSender.send(email); 53 | } 54 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/service/impl/DictServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 6 | import com.starfire.familytree.basic.entity.Dict; 7 | import com.starfire.familytree.basic.mapper.DictMapper; 8 | import com.starfire.familytree.basic.service.IDictService; 9 | import com.starfire.familytree.vo.PageInfo; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 字典服务实现类 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-03-06 22 | */ 23 | @Service 24 | public class DictServiceImpl extends ServiceImpl implements IDictService { 25 | @Override 26 | public PageInfo, Dict> page(PageInfo, Dict> pageInfo) { 27 | Page page = pageInfo.toMybatisPlusPage(); 28 | Map param = pageInfo.getParam(); 29 | Page selectPage = baseMapper.page(page, param); 30 | pageInfo.from(selectPage); 31 | return pageInfo; 32 | } 33 | 34 | @Override 35 | public List getParentDict(String code) { 36 | return baseMapper.getParentDict(code); 37 | } 38 | 39 | @Override 40 | public Dict getDict(String code) { 41 | 42 | return baseMapper.getDict(code); 43 | } 44 | 45 | @Override 46 | public List getSubDictListByParentCode(String code) { 47 | List list = baseMapper.getSubDictListByParentCode(code); 48 | return list; 49 | } 50 | 51 | @Override 52 | public List getBranchList() { 53 | return baseMapper.getBranchList(); 54 | } 55 | 56 | @Override 57 | public List getProdTeam() { 58 | return baseMapper.getProdTeam(); 59 | } 60 | 61 | @Override 62 | public List getPermissionList() { 63 | return baseMapper.getPermissionList(); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 38 | 41 | 42 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/controller/CemeteryController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.controller; 2 | 3 | 4 | import com.starfire.familytree.folk.entity.Cemetery; 5 | import com.starfire.familytree.folk.service.ICemeteryService; 6 | import com.starfire.familytree.folk.service.ICemeteryService; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-10-07 22 | */ 23 | @RestController 24 | @RequestMapping("/folk/cemetery") 25 | public class CemeteryController { 26 | @Autowired 27 | private ICemeteryService cemeteryService; 28 | 29 | /** 30 | * 分页 31 | * 32 | * @param page 33 | * @return 34 | * @author luzh 35 | */ 36 | @PostMapping("/page") 37 | public PageInfo, Cemetery> page(@RequestBody(required = false) PageInfo, Cemetery> page) { 38 | if(page==null){ 39 | page=new PageInfo<>(); 40 | } 41 | PageInfo, Cemetery> pageInfo = cemeteryService.page(page); 42 | return pageInfo; 43 | 44 | } 45 | 46 | @PostMapping("/add") 47 | public Boolean addCemetery(@RequestBody Cemetery cemetery) { 48 | boolean b = cemeteryService.save(cemetery); 49 | return b; 50 | } 51 | 52 | @PostMapping("/delete") 53 | public Boolean deleteCemetery(@RequestBody DeleteVO deleteVO) { 54 | Long[] ids = deleteVO.getIds(); 55 | for (int i = 0; i < ids.length; i++) { 56 | Long id = Long.valueOf(ids[i]); 57 | boolean b = cemeteryService.removeById(id); 58 | 59 | } 60 | return true; 61 | } 62 | 63 | @GetMapping("/get") 64 | public Cemetery getCemetery(Long id) { 65 | Cemetery cemetery = cemeteryService.getById(id); 66 | return cemetery; 67 | } 68 | 69 | 70 | @PostMapping("/edit") 71 | public Boolean editCemetery(@RequestBody Cemetery cemetery) { 72 | boolean b = cemeteryService.updateById(cemetery); 73 | return b; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/controller/CategoryContentController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.controller; 2 | 3 | 4 | import com.starfire.familytree.folk.entity.CategoryContent; 5 | import com.starfire.familytree.folk.service.ICategoryContentService; 6 | import com.starfire.familytree.vo.DeleteVO; 7 | import com.starfire.familytree.vo.PageInfo; 8 | import io.swagger.annotations.Api; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.Map; 13 | 14 | /** 15 | *

16 | * 类别具体内容 17 | *

18 | * 19 | * @author luzh 20 | * @since 2019-08-15 21 | */ 22 | @RestController 23 | @RequestMapping("/folk/category_content") 24 | @Api(tags = "分类内容模块") 25 | public class CategoryContentController { 26 | 27 | @Autowired 28 | private ICategoryContentService categoryContentService; 29 | 30 | /** 31 | * 分页 32 | * 33 | * @param page 34 | * @return 35 | * @author luzh 36 | */ 37 | @PostMapping("/page") 38 | public PageInfo, CategoryContent> page(@RequestBody(required = false) PageInfo, CategoryContent> page) { 39 | page=page==null?new PageInfo<>():page; 40 | PageInfo, CategoryContent> pageInfo = categoryContentService.page(page); 41 | return pageInfo; 42 | 43 | } 44 | 45 | @PostMapping("/add") 46 | public Boolean addCategoryContent(@RequestBody CategoryContent categoryContent) { 47 | boolean b = categoryContentService.save(categoryContent); 48 | return b; 49 | } 50 | 51 | @PostMapping("/delete") 52 | public Boolean deleteCategoryContent(@RequestBody DeleteVO deleteVO) { 53 | Long[] ids = deleteVO.getIds(); 54 | for (int i = 0; i < ids.length; i++) { 55 | Long id = Long.valueOf(ids[i]); 56 | boolean b = categoryContentService.removeById(id); 57 | 58 | } 59 | return true; 60 | } 61 | 62 | @GetMapping("/get") 63 | public CategoryContent getCategoryContent(Long id) { 64 | CategoryContent categoryContent = categoryContentService.getById(id); 65 | return categoryContent; 66 | } 67 | 68 | @PostMapping("/edit") 69 | public Boolean editCategoryContent(@RequestBody CategoryContent categoryContent) { 70 | boolean b = categoryContentService.updateById(categoryContent); 71 | return b; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /familytree/src/main/resources/templates/ActiveAccountResult.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 激活账号 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 30 | 31 | 32 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/folk/controller/CategoryController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.folk.controller; 2 | 3 | 4 | import com.starfire.familytree.folk.entity.Category; 5 | import com.starfire.familytree.folk.service.ICategoryService; 6 | import com.starfire.familytree.vo.DeleteVO; 7 | import com.starfire.familytree.vo.PageInfo; 8 | import io.swagger.annotations.Api; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.web.bind.annotation.*; 11 | 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | /** 16 | *

17 | * 前端控制器 18 | *

19 | * 20 | * @author luzh 21 | * @since 2019-08-15 22 | */ 23 | @RestController 24 | @RequestMapping("/folk/category") 25 | @Api(tags = "分类模块") 26 | public class CategoryController { 27 | 28 | @Autowired 29 | private ICategoryService categoryService; 30 | 31 | /** 32 | * 分页 33 | * 34 | * @param page 35 | * @return 36 | * @author luzh 37 | */ 38 | @PostMapping("/page") 39 | public PageInfo, Category> page(@RequestBody(required = false) PageInfo, Category> page) { 40 | if(page==null){ 41 | page=new PageInfo<>(); 42 | } 43 | PageInfo, Category> pageInfo = categoryService.page(page); 44 | return pageInfo; 45 | 46 | } 47 | 48 | @PostMapping("/add") 49 | public Boolean addCategory(@RequestBody Category category) { 50 | boolean b = categoryService.save(category); 51 | return b; 52 | } 53 | 54 | @PostMapping("/delete") 55 | public Boolean deleteCategory(@RequestBody DeleteVO deleteVO) { 56 | Long[] ids = deleteVO.getIds(); 57 | for (int i = 0; i < ids.length; i++) { 58 | Long id = Long.valueOf(ids[i]); 59 | boolean b = categoryService.removeById(id); 60 | 61 | } 62 | return true; 63 | } 64 | 65 | @GetMapping("/get") 66 | public Category getCategory(Long id) { 67 | Category category = categoryService.getById(id); 68 | return category; 69 | } 70 | 71 | @GetMapping("/getCategoryList") 72 | public List getCategoryList() { 73 | List categoryList = categoryService.getCategoryList(); 74 | return categoryList; 75 | } 76 | 77 | 78 | 79 | @PostMapping("/edit") 80 | public Boolean editCategory(@RequestBody Category category) { 81 | boolean b = categoryService.updateById(category); 82 | return b; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/utils/ChineseNumber.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.utils; 2 | 3 | public class ChineseNumber { 4 | 5 | public static String numberToCH(int intInput) { 6 | String si = String.valueOf(intInput); 7 | String sd = ""; 8 | if (si.length() == 1) // 個 9 | { 10 | sd += GetCH(intInput); 11 | return sd; 12 | } else if (si.length() == 2)// 十 13 | { 14 | if (si.substring(0, 1).equals("1")) 15 | sd += "十"; 16 | else 17 | sd += (GetCH(intInput / 10) + "十"); 18 | sd += numberToCH(intInput % 10); 19 | } else if (si.length() == 3)// 百 20 | { 21 | sd += (GetCH(intInput / 100) + "百"); 22 | if (String.valueOf(intInput % 100).length() < 2) 23 | sd += "零"; 24 | sd += numberToCH(intInput % 100); 25 | } else if (si.length() == 4)// 千 26 | { 27 | sd += (GetCH(intInput / 1000) + "千"); 28 | if (String.valueOf(intInput % 1000).length() < 3) 29 | sd += "零"; 30 | sd += numberToCH(intInput % 1000); 31 | } else if (si.length() == 5)// 萬 32 | { 33 | sd += (GetCH(intInput / 10000) + "萬"); 34 | if (String.valueOf(intInput % 10000).length() < 4) 35 | sd += "零"; 36 | sd += numberToCH(intInput % 10000); 37 | } 38 | 39 | return sd; 40 | } 41 | 42 | private static String GetCH(int input) { 43 | String sd = ""; 44 | switch (input) { 45 | case 1: 46 | sd = "一"; 47 | break; 48 | case 2: 49 | sd = "二"; 50 | break; 51 | case 3: 52 | sd = "三"; 53 | break; 54 | case 4: 55 | sd = "四"; 56 | break; 57 | case 5: 58 | sd = "五"; 59 | break; 60 | case 6: 61 | sd = "六"; 62 | break; 63 | case 7: 64 | sd = "七"; 65 | break; 66 | case 8: 67 | sd = "八"; 68 | break; 69 | case 9: 70 | sd = "九"; 71 | break; 72 | default: 73 | break; 74 | } 75 | return sd; 76 | } 77 | 78 | public static void main(String[] args) { 79 | System.err.println(numberToCH(21)); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/UserRoleController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.security.entity.UserRole; 6 | import com.starfire.familytree.security.service.IUserRoleService; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import io.swagger.annotations.Api; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Arrays; 14 | import java.util.Map; 15 | 16 | /** 17 | *

18 | * 用户角色控制器 19 | *

20 | * 21 | * @author luzh 22 | * @since 2019-03-03 23 | */ 24 | @RestController 25 | @RequestMapping("/security/user_role") 26 | @Api(tags = "用户角色模块") 27 | public class UserRoleController { 28 | @Autowired 29 | private IUserRoleService userRoleService; 30 | 31 | /** 32 | * 新增或修改 33 | * 34 | * @param userRole 35 | * @return 36 | * @author luzh 37 | */ 38 | @PostMapping("/addOrUpdate") 39 | public Response addOrUpdateUserRole(@RequestBody UserRole userRole) { 40 | userRoleService.saveOrUpdate(userRole); 41 | Response response = new Response(); 42 | return response.success(userRole); 43 | 44 | } 45 | 46 | /** 47 | * 删除 48 | * 49 | * @return 50 | * @author luzh 51 | */ 52 | @PostMapping("/delete") 53 | public Response deleteUserRole(@RequestBody DeleteVO deleteVO) { 54 | String[] ids = deleteVO.getIds(); 55 | boolean flag = userRoleService.removeByIds(Arrays.asList(ids)); 56 | Response response = new Response(); 57 | if (!flag) { 58 | return response.failure(); 59 | } 60 | return response.success(); 61 | 62 | } 63 | 64 | /** 65 | * 分页 66 | * 67 | * @param page 68 | * @return 69 | * @author luzh 70 | */ 71 | @PostMapping("/page") 72 | public Response, UserRole>> page(@RequestBody(required = false) PageInfo, UserRole> page) { 73 | if(page==null){ 74 | page=new PageInfo<>(); 75 | } 76 | PageInfo, UserRole> pageInfo = userRoleService.page(page); 77 | Response, UserRole>> response = new Response, UserRole>>(); 78 | return response.success(pageInfo); 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/MenuRightController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.security.entity.MenuRight; 6 | import com.starfire.familytree.security.service.IMenuRightService; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import io.swagger.annotations.Api; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Arrays; 14 | import java.util.Map; 15 | 16 | /** 17 | *

18 | * 菜单权限控制器 19 | *

20 | * 21 | * @author luzh 22 | * @since 2019-03-03 23 | */ 24 | @RestController 25 | @RequestMapping("/security/menu_right") 26 | @Api(tags = "菜单权限模块") 27 | public class MenuRightController { 28 | @Autowired 29 | private IMenuRightService menuRightService; 30 | 31 | /** 32 | * 新增或修改 33 | * 34 | * @param menuRight 35 | * @return 36 | * @author luzh 37 | */ 38 | @PostMapping("/addOrUpdate") 39 | public Response addOrUpdateMenuRight(@RequestBody MenuRight menuRight) { 40 | menuRightService.saveOrUpdate(menuRight); 41 | Response response = new Response(); 42 | return response.success(menuRight); 43 | 44 | } 45 | 46 | /** 47 | * 删除 48 | * 49 | * @return 50 | * @author luzh 51 | */ 52 | @PostMapping("/delete") 53 | public Response deleteMenuRight(@RequestBody DeleteVO deleteVO) { 54 | String[] ids = deleteVO.getIds(); 55 | boolean flag = menuRightService.removeByIds(Arrays.asList(ids)); 56 | Response response = new Response(); 57 | if (!flag) { 58 | return response.failure(); 59 | } 60 | return response.success(); 61 | 62 | } 63 | 64 | /** 65 | * 分页 66 | * 67 | * @param page 68 | * @return 69 | * @author luzh 70 | */ 71 | @PostMapping("/page") 72 | public Response, MenuRight>> page(@RequestBody(required = false) PageInfo, MenuRight> page) { 73 | if(page==null){ 74 | page=new PageInfo<>(); 75 | } 76 | PageInfo, MenuRight> pageInfo = menuRightService.page(page); 77 | Response, MenuRight>> response = new Response, MenuRight>>(); 78 | return response.success(pageInfo); 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/UserMenuRightController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.security.entity.UserMenuRight; 6 | import com.starfire.familytree.security.service.IUserMenuRightService; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import io.swagger.annotations.Api; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Arrays; 14 | import java.util.Map; 15 | 16 | /** 17 | *

18 | * 用户菜单权限控制器 19 | *

20 | * 21 | * @author luzh 22 | * @since 2019-03-03 23 | */ 24 | @RestController 25 | @RequestMapping("/security/user_menu_right") 26 | @Api(tags = "用户菜单权限模块") 27 | public class UserMenuRightController { 28 | @Autowired 29 | private IUserMenuRightService userMenuRightService; 30 | 31 | /** 32 | * 新增或修改 33 | * 34 | * @param userMenuRight 35 | * @return 36 | * @author luzh 37 | */ 38 | @PostMapping("/addOrUpdate") 39 | public Response addOrUpdateUserMenuRight(@RequestBody UserMenuRight userMenuRight) { 40 | userMenuRightService.saveOrUpdate(userMenuRight); 41 | Response response = new Response(); 42 | return response.success(userMenuRight); 43 | 44 | } 45 | 46 | /** 47 | * 删除 48 | * 49 | * @return 50 | * @author luzh 51 | */ 52 | @PostMapping("/delete") 53 | public Response deleteUserMenuRight(@RequestBody DeleteVO deleteVO) { 54 | String[] ids = deleteVO.getIds(); 55 | boolean flag = userMenuRightService.removeByIds(Arrays.asList(ids)); 56 | Response response = new Response(); 57 | if (!flag) { 58 | return response.failure(); 59 | } 60 | return response.success(); 61 | 62 | } 63 | 64 | /** 65 | * 分页 66 | * 67 | * @param page 68 | * @return 69 | * @author luzh 70 | */ 71 | @PostMapping("/page") 72 | public Response, UserMenuRight>> page(@RequestBody(required = false) PageInfo, UserMenuRight> page) { 73 | if(page==null){ 74 | page=new PageInfo<>(); 75 | } 76 | PageInfo, UserMenuRight> pageInfo = userMenuRightService.page(page); 77 | Response, UserMenuRight>> response = new Response, UserMenuRight>>(); 78 | return response.success(pageInfo); 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/RoleMenuRightController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.security.entity.RoleMenuRight; 6 | import com.starfire.familytree.security.service.IRoleMenuRightService; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import io.swagger.annotations.Api; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.Arrays; 14 | import java.util.Map; 15 | 16 | /** 17 | *

18 | * 角色菜单权限控制器 19 | *

20 | * 21 | * @author luzh 22 | * @since 2019-03-03 23 | */ 24 | @RestController 25 | @RequestMapping("/security/role_menu_right") 26 | @Api(tags = "角色菜单权限模块") 27 | public class RoleMenuRightController { 28 | @Autowired 29 | private IRoleMenuRightService roleMenuRightRightService; 30 | 31 | /** 32 | * 新增或修改 33 | * 34 | * @param roleRoleMenuRightRight 35 | * @return 36 | * @author luzh 37 | */ 38 | @PostMapping("/addOrUpdate") 39 | public Response addOrUpdateRoleMenuRight(@RequestBody RoleMenuRight roleRoleMenuRightRight) { 40 | roleMenuRightRightService.saveOrUpdate(roleRoleMenuRightRight); 41 | Response response = new Response(); 42 | return response.success(roleRoleMenuRightRight); 43 | 44 | } 45 | 46 | /** 47 | * 删除 48 | * 49 | * @return 50 | * @author luzh 51 | */ 52 | @PostMapping("/delete") 53 | public Response deleteRoleMenuRight(@RequestBody DeleteVO deleteVO) { 54 | String[] ids = deleteVO.getIds(); 55 | boolean flag = roleMenuRightRightService.removeByIds(Arrays.asList(ids)); 56 | Response response = new Response(); 57 | if (!flag) { 58 | return response.failure(); 59 | } 60 | return response.success(); 61 | 62 | } 63 | 64 | /** 65 | * 分页 66 | * 67 | * @param page 68 | * @return 69 | * @author luzh 70 | */ 71 | @PostMapping("/page") 72 | public Response, RoleMenuRight>> page(@RequestBody(required = false) PageInfo, RoleMenuRight> page) { 73 | if(page==null){ 74 | page=new PageInfo<>(); 75 | } 76 | PageInfo, RoleMenuRight> pageInfo = roleMenuRightRightService.page(page); 77 | Response, RoleMenuRight>> response = new Response, RoleMenuRight>>(); 78 | return response.success(pageInfo); 79 | 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/service/impl/MenuRightServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.service.impl; 2 | 3 | import com.baomidou.mybatisplus.core.conditions.Wrapper; 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 7 | import com.starfire.familytree.security.entity.MenuRight; 8 | import com.starfire.familytree.security.mapper.MenuRightMapper; 9 | import com.starfire.familytree.security.service.IMenuRightService; 10 | import com.starfire.familytree.vo.MenuRightVO; 11 | import com.starfire.familytree.vo.PageInfo; 12 | import org.springframework.stereotype.Service; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | import java.util.Map; 17 | 18 | /** 19 | *

20 | * 服务实现类 21 | *

22 | * 23 | * @author luzh 24 | * @since 2019-03-03 25 | */ 26 | @Service 27 | public class MenuRightServiceImpl extends ServiceImpl implements IMenuRightService { 28 | @Override 29 | public PageInfo, MenuRight> page(PageInfo, MenuRight> pageInfo) { 30 | QueryWrapper qw = new QueryWrapper(); 31 | Map param = pageInfo.getParam(); 32 | Page page = pageInfo.toMybatisPlusPage(); 33 | Page selectPage = (Page) baseMapper.selectPage(page, qw); 34 | pageInfo.from(selectPage); 35 | return pageInfo; 36 | } 37 | 38 | @Override 39 | public List getList(Long menuId) { 40 | QueryWrapper queryWrapper=new QueryWrapper<>(); 41 | queryWrapper.eq("menu_id",menuId); 42 | List menuRights = baseMapper.selectList(queryWrapper); 43 | return menuRights; 44 | } 45 | 46 | @Override 47 | public List convert(List menuRights) { 48 | List list=new ArrayList<>(); 49 | for (int i = 0; i < menuRights.size(); i++) { 50 | MenuRight menuRight = menuRights.get(i); 51 | MenuRightVO vo=new MenuRightVO(); 52 | vo.setKey(menuRight.getCode()); 53 | vo.setLabel(menuRight.getName()); 54 | list.add(vo); 55 | } 56 | return list; 57 | } 58 | 59 | @Override 60 | public void removeByMenuId(Long menuId) { 61 | QueryWrapper queryWrapper=new QueryWrapper<>(); 62 | queryWrapper.eq("menu_id",menuId); 63 | baseMapper.delete(queryWrapper); 64 | } 65 | 66 | @Override 67 | public List getPermissionForAdmin() { 68 | return baseMapper.getPermissionForAdmin(); 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /familytree/src/main/resources/mapper/DictMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 34 | 40 | 41 | 44 | 49 | 52 | 53 | 56 | 59 | 60 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/filter/CustomAuthenticationFilter.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.filter; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.starfire.familytree.login.vo.LoginReq; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.http.MediaType; 8 | import org.springframework.security.authentication.AuthenticationManager; 9 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 10 | import org.springframework.security.core.Authentication; 11 | import org.springframework.security.core.AuthenticationException; 12 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 13 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 14 | import org.springframework.stereotype.Component; 15 | 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | import java.io.IOException; 19 | import java.io.InputStream; 20 | 21 | /** 22 | * AuthenticationFilter that supports rest login(json login) and form login. 23 | */ 24 | //@Component 25 | public class CustomAuthenticationFilter extends UsernamePasswordAuthenticationFilter { 26 | 27 | @Override 28 | public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { 29 | 30 | //attempt Authentication when Content-Type is json 31 | if (request.getContentType().equals(MediaType.APPLICATION_JSON_UTF8_VALUE) 32 | || request.getContentType().equals(MediaType.APPLICATION_JSON_VALUE)) { 33 | 34 | //use jackson to deserialize json 35 | ObjectMapper mapper = new ObjectMapper(); 36 | UsernamePasswordAuthenticationToken authRequest = null; 37 | try (InputStream is = request.getInputStream()) { 38 | LoginReq authenticationBean = mapper.readValue(is, LoginReq.class); 39 | authRequest = new UsernamePasswordAuthenticationToken( 40 | authenticationBean.getUsername(), authenticationBean.getPassword()); 41 | } catch (IOException e) { 42 | e.printStackTrace(); 43 | authRequest = new UsernamePasswordAuthenticationToken( 44 | "", ""); 45 | } finally { 46 | setDetails(request, authRequest); 47 | return this.getAuthenticationManager().authenticate(authRequest); 48 | } 49 | } 50 | 51 | //transmit it to UsernamePasswordAuthenticationFilter 52 | else { 53 | return super.attemptAuthentication(request, response); 54 | } 55 | } 56 | 57 | 58 | @Override 59 | protected AuthenticationSuccessHandler getSuccessHandler() { 60 | return super.getSuccessHandler(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/RoleController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | import com.starfire.familytree.response.Response; 4 | import com.starfire.familytree.security.entity.Role; 5 | import com.starfire.familytree.security.service.IRoleService; 6 | import com.starfire.familytree.vo.DeleteVO; 7 | import com.starfire.familytree.vo.PageInfo; 8 | import io.swagger.annotations.Api; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.*; 13 | 14 | import javax.validation.Valid; 15 | import java.util.Arrays; 16 | import java.util.List; 17 | import java.util.Map; 18 | 19 | /** 20 | *

21 | * 角色操作控制器 22 | *

23 | * 24 | * @author luzh 25 | * @since 2019-03-03 26 | */ 27 | @RestController 28 | @RequestMapping("/security/role") 29 | @Api(tags = "角色模块") 30 | public class RoleController { 31 | 32 | @Autowired 33 | private IRoleService roleService; 34 | 35 | @PostMapping("/page") 36 | public PageInfo, Role> page(@RequestBody(required = false) PageInfo, Role> page) { 37 | if(page==null){ 38 | page=new PageInfo<>(); 39 | } 40 | PageInfo, Role> pageInfo = roleService.page(page); 41 | return pageInfo; 42 | } 43 | 44 | /** 45 | * 新增或修改 46 | * 47 | * @param role 48 | * @return 49 | * @author luzh 50 | */ 51 | @PostMapping("/addOrUpdate") 52 | public Response addOrUpdateRole(@RequestBody @Valid Role role) { 53 | roleService.saveOrUpdate(role); 54 | Response response = new Response(); 55 | return response.success(); 56 | 57 | } 58 | 59 | /** 60 | * 删除 61 | * 62 | * @return 63 | * @author luzh 64 | */ 65 | @PostMapping("/delete") 66 | public Response deleteRole(@RequestBody DeleteVO deleteVO) { 67 | Long[] ids = deleteVO.getIds(); 68 | boolean flag = roleService.removeByIds(Arrays.asList(ids)); 69 | Response response = new Response(); 70 | if (!flag) { 71 | return response.failure(); 72 | } 73 | return response.success(); 74 | 75 | } 76 | @GetMapping("/get") 77 | public Response getRole(Long id) { 78 | Role role = roleService.getById(id); 79 | Response response = new Response(); 80 | return response.success(role); 81 | 82 | } 83 | 84 | /** 85 | * 获取所有角色 86 | * @return 87 | */ 88 | @GetMapping("/getRoles") 89 | public Response> getRoles() { 90 | List roles = roleService.getRoles(); 91 | Response> response = new Response>(); 92 | return response.success(roles); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/controller/RegionController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.controller; 2 | 3 | import com.starfire.familytree.basic.entity.Dict; 4 | import com.starfire.familytree.basic.entity.Region; 5 | import com.starfire.familytree.basic.service.IRegionService; 6 | import com.starfire.familytree.response.Response; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import io.swagger.annotations.Api; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import javax.validation.Valid; 14 | import java.security.Principal; 15 | import java.util.Arrays; 16 | import java.util.Map; 17 | 18 | /** 19 | *

20 | * 省市区控制器 21 | *

22 | * 23 | * @author luzh 24 | * @since 2019-03-07 25 | */ 26 | @RestController 27 | @RequestMapping("/basic/region") 28 | @Api(tags = "地区接口") 29 | public class RegionController { 30 | @Autowired 31 | private IRegionService regionService; 32 | 33 | /** 34 | * 新增或修改 35 | * 36 | * @param region 37 | * @return 38 | * @author luzh 39 | */ 40 | @PostMapping("/addOrUpdate") 41 | public Response addOrUpdateRegion(@RequestBody @Valid Region region) { 42 | regionService.saveOrUpdate(region); 43 | Response response = new Response(); 44 | return response.success(region); 45 | 46 | } 47 | 48 | /** 49 | * 删除 50 | * 51 | * @return 52 | * @author luzh 53 | */ 54 | @PostMapping("/delete") 55 | public Response deleteRegion(@RequestBody DeleteVO deleteVO) { 56 | Long[] ids = deleteVO.getIds(); 57 | boolean flag = regionService.removeByIds(Arrays.asList(ids)); 58 | Response response = new Response(); 59 | if (!flag) { 60 | return response.failure(); 61 | } 62 | return response.success(); 63 | 64 | } 65 | 66 | /** 67 | * 分页 68 | * 69 | * @param page 70 | * @return 71 | * @author luzh 72 | */ 73 | @PostMapping("/page") 74 | public Response, Region>> page(@RequestBody(required = false) PageInfo, Region> page) { 75 | page=page==null?new PageInfo<>():page; 76 | PageInfo, Region> pageInfo = regionService.page(page); 77 | Response, Region>> response = new Response, Region>>(); 78 | return response.success(pageInfo); 79 | 80 | } 81 | 82 | /** 83 | * 获取字典详情 84 | * @param id 85 | * @return 86 | */ 87 | @GetMapping("/get") 88 | public Response getDict(@RequestParam(required = true) Long id) { 89 | 90 | Region region = regionService.getById(id); 91 | Response response = new Response<>(); 92 | return response.success(region); 93 | 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/UserMenuController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.security.entity.UserMenu; 6 | import com.starfire.familytree.security.service.IUserMenuService; 7 | import com.starfire.familytree.vo.DeleteVO; 8 | import com.starfire.familytree.vo.PageInfo; 9 | import com.starfire.familytree.vo.RoleMenuVO; 10 | import com.starfire.familytree.vo.UserMenuVO; 11 | import io.swagger.annotations.Api; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.*; 14 | 15 | import java.util.Arrays; 16 | import java.util.HashSet; 17 | import java.util.List; 18 | import java.util.Map; 19 | 20 | /** 21 | *

22 | * 用户菜单控制器 23 | *

24 | * 25 | * @author luzh 26 | * @since 2019-03-03 27 | */ 28 | @RestController 29 | @RequestMapping("/security/user_menu") 30 | @Api(tags = "用户菜单模块") 31 | public class UserMenuController { 32 | @Autowired 33 | private IUserMenuService userMenuService; 34 | 35 | /** 36 | * 新增或修改 37 | * 38 | * @param userMenuVO 39 | * @return 40 | * @author luzh 41 | */ 42 | @PostMapping("/addOrUpdate") 43 | public Response addOrUpdateUserMenu(@RequestBody UserMenuVO userMenuVO) { 44 | userMenuService.addOrUpdateUserMenu(userMenuVO); 45 | Response response = new Response(); 46 | return response.success(); 47 | 48 | } 49 | 50 | /** 51 | * 删除 52 | * 53 | * @return 54 | * @author luzh 55 | */ 56 | @PostMapping("/delete") 57 | public Response deleteUserMenu(@RequestBody DeleteVO deleteVO) { 58 | String[] ids = deleteVO.getIds(); 59 | boolean flag = userMenuService.removeByIds(Arrays.asList(ids)); 60 | Response response = new Response(); 61 | if (!flag) { 62 | return response.failure(); 63 | } 64 | return response.success(); 65 | 66 | } 67 | 68 | /** 69 | * 分页 70 | * 71 | * @param page 72 | * @return 73 | * @author luzh 74 | */ 75 | @PostMapping("/page") 76 | public Response, UserMenu>> page(@RequestBody(required = false) PageInfo, UserMenu> page) { 77 | if(page==null){ 78 | page=new PageInfo<>(); 79 | } 80 | PageInfo, UserMenu> pageInfo = userMenuService.page(page); 81 | Response, UserMenu>> response = new Response, UserMenu>>(); 82 | return response.success(pageInfo); 83 | 84 | } 85 | 86 | @GetMapping("/getUserMenuByUserId") 87 | public Response getUserMenuByUserId(Long userId) { 88 | UserMenuVO userMenuVO= userMenuService.getUserMenuByUserId(userId); 89 | Response response = new Response(); 90 | return response.success(userMenuVO); 91 | 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/basic/controller/FileUploadController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.basic.controller; 2 | 3 | import com.starfire.familytree.basic.entity.Region; 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.vo.PageInfo; 6 | import com.starfire.familytree.vo.UploadResponse; 7 | import io.swagger.annotations.Api; 8 | import lombok.Data; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.apache.commons.io.FileUtils; 11 | import org.apache.commons.io.FilenameUtils; 12 | import org.apache.tomcat.util.http.fileupload.IOUtils; 13 | import org.springframework.beans.factory.annotation.Value; 14 | import org.springframework.web.HttpRequestHandler; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RequestMapping; 17 | import org.springframework.web.bind.annotation.RequestParam; 18 | import org.springframework.web.bind.annotation.RestController; 19 | import org.springframework.web.multipart.MultipartFile; 20 | import org.springframework.web.util.WebUtils; 21 | 22 | import javax.imageio.ImageIO; 23 | import javax.servlet.ServletContext; 24 | import javax.servlet.http.HttpServletRequest; 25 | import java.awt.image.BufferedImage; 26 | import java.io.File; 27 | import java.io.FileNotFoundException; 28 | import java.io.FileOutputStream; 29 | import java.io.IOException; 30 | import java.util.Map; 31 | 32 | /** 33 | * @version 1.0 34 | * @author: Luzh 35 | * @date: 2019/8/30 17:59 36 | */ 37 | @Slf4j 38 | @RestController 39 | @RequestMapping("/file_upload") 40 | @Api(tags = "文件上传接口") 41 | public class FileUploadController { 42 | 43 | @Value("${village.upload.dir}") 44 | private String filePath; 45 | 46 | @RequestMapping(value = "/upload") 47 | public Response upload(@RequestParam("file") MultipartFile multipartFile, HttpServletRequest request) { 48 | Response response = new Response<>(); 49 | try { 50 | String filename = multipartFile.getOriginalFilename(); 51 | File dir = new File(filePath); 52 | if(dir.exists()==false){ 53 | FileUtils.forceMkdir(dir); 54 | } 55 | File file=new File(filePath+"\\"+filename); 56 | FileOutputStream outputStream = new FileOutputStream(file); 57 | IOUtils.copy(multipartFile.getInputStream(),outputStream); 58 | BufferedImage sourceImg= ImageIO.read(multipartFile.getInputStream()); 59 | int width = sourceImg.getWidth(); 60 | int height = sourceImg.getHeight(); 61 | UploadResponse uploadResponse = new UploadResponse(); 62 | String fileName = file.getName(); 63 | uploadResponse.setHeight(height); 64 | uploadResponse.setWidth(width); 65 | uploadResponse.setName(fileName); 66 | uploadResponse.setUrl("/village/"+fileName); 67 | uploadResponse.setThumbUrl(file.getPath()); 68 | return response.success(uploadResponse); 69 | } catch (FileNotFoundException e) { 70 | log.error(e.getMessage(),e); 71 | } catch (IOException e) { 72 | log.error(e.getMessage(),e); 73 | } 74 | 75 | return response.failure(); 76 | 77 | } 78 | 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/SecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.config; 2 | 3 | import com.starfire.familytree.filter.CustomAuthenticationFilter; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.security.authentication.AuthenticationManager; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.builders.WebSecurity; 10 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 11 | import org.springframework.security.web.authentication.ForwardAuthenticationFailureHandler; 12 | import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler; 13 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; 14 | 15 | @Configuration 16 | public class SecurityConfig extends WebSecurityConfigurerAdapter { 17 | 18 | @Value("${web.loginPage}") 19 | private String loginPage ; 20 | 21 | 22 | @Value("${web.successUrl}") 23 | private String successUrl ; 24 | 25 | @Override 26 | public void configure(WebSecurity web){ 27 | // web.ignoring().anyRequest(); 28 | web.ignoring() 29 | .antMatchers( 30 | "/v2/api-docs", 31 | "/swagger-resources/**", 32 | "/swagger-ui.html/**", 33 | "/webjars/**"); 34 | } 35 | 36 | @Override 37 | public void configure(HttpSecurity http) throws Exception { 38 | //http.authorizeRequests().antMatchers("/**").permitAll(); 39 | http.authorizeRequests().antMatchers("/v2/api-docs", 40 | "/swagger-resources/**", 41 | "/swagger-ui.html/**", 42 | "/webjars/**").permitAll(); 43 | http.cors().and() 44 | .antMatcher("/**").authorizeRequests() 45 | .antMatchers("/login**","/logout","/SignUp/**","/baiduAPI/*").permitAll() 46 | .anyRequest().authenticated() 47 | //这里必须要写formLogin(),不然原有的UsernamePasswordAuthenticationFilter不会出现,也就无法配置我们重新的UsernamePasswordAuthenticationFilter 48 | .and().formLogin().loginPage(loginPage).and().logout().logoutSuccessUrl(loginPage) 49 | .and().csrf().disable(); 50 | http.addFilterAt(customAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class); 51 | } 52 | @Bean 53 | CustomAuthenticationFilter customAuthenticationFilter() throws Exception { 54 | CustomAuthenticationFilter filter = new CustomAuthenticationFilter(); 55 | 56 | filter.setAuthenticationSuccessHandler(new SimpleUrlAuthenticationSuccessHandler(successUrl)); 57 | filter.setAuthenticationFailureHandler(new ForwardAuthenticationFailureHandler(loginPage)); 58 | // filter.setFilterProcessesUrl("/login"); 59 | //这句很关键,重用WebSecurityConfigurerAdapter配置的AuthenticationManager,不然要自己组装AuthenticationManager 60 | filter.setAuthenticationManager(authenticationManagerBean()); 61 | return filter; 62 | } 63 | @Bean // share AuthenticationManager for web and oauth 64 | public AuthenticationManager authenticationManagerBean() throws Exception { 65 | return super.authenticationManagerBean(); 66 | } 67 | } -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/AuthorizationServerConfig.java: -------------------------------------------------------------------------------- 1 | //package com.starfire.familytree.config; 2 | // 3 | //import javax.sql.DataSource; 4 | // 5 | //import org.springframework.beans.factory.annotation.Autowired; 6 | //import org.springframework.context.annotation.Bean; 7 | //import org.springframework.context.annotation.Configuration; 8 | //import org.springframework.security.authentication.AuthenticationManager; 9 | //import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; 10 | //import org.springframework.security.core.userdetails.UserDetailsService; 11 | //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 12 | //import org.springframework.security.crypto.password.PasswordEncoder; 13 | //import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; 14 | //import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; 15 | //import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; 16 | //import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; 17 | //import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; 18 | //import org.springframework.security.oauth2.provider.token.TokenStore; 19 | //import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore; 20 | // 21 | //import com.starfire.familytree.usercenter.service.impl.UserServiceImpl; 22 | // 23 | //@Configuration 24 | //@EnableAuthorizationServer 25 | //public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { 26 | // 27 | // @Autowired 28 | // private DataSource dataSource; 29 | // 30 | // AuthenticationManager authenticationManager; 31 | // 32 | // public AuthorizationServerConfig(AuthenticationConfiguration authenticationConfiguration) throws Exception { 33 | // this.authenticationManager = authenticationConfiguration.getAuthenticationManager(); 34 | // } 35 | // 36 | // @Autowired 37 | // private UserServiceImpl userDetailsService; 38 | // 39 | // @Bean 40 | // public TokenStore tokenStore() { 41 | // return new JdbcTokenStore(dataSource); 42 | // 43 | // } 44 | // 45 | // @Bean 46 | // public PasswordEncoder passwordEncoder() { 47 | // return new BCryptPasswordEncoder(); 48 | // } 49 | // 50 | // @Override 51 | // public void configure(AuthorizationServerSecurityConfigurer security) throws Exception { 52 | // security.tokenKeyAccess("permitAll()").checkTokenAccess("isAuthenticated()"); 53 | // } 54 | // 55 | // @Override 56 | // public void configure(ClientDetailsServiceConfigurer clients) throws Exception { 57 | // MyCustomJdbcClientDetailsServiceBuilder clientDetailsServiceBuilder = new MyCustomJdbcClientDetailsServiceBuilder(); 58 | // clientDetailsServiceBuilder.dataSource(dataSource).passwordEncoder(passwordEncoder()).withClient("family_tree").secret("family_tree") 59 | // .scopes("read", "write").authorizedGrantTypes("password", "authorization_code", "client_credentials").resourceIds("family_tree-resource") 60 | // .accessTokenValiditySeconds(100000); 61 | // clients.setBuilder(clientDetailsServiceBuilder); 62 | // } 63 | // 64 | // @Override 65 | // public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { 66 | // endpoints.tokenStore(tokenStore()).authenticationManager(authenticationManager) 67 | // .userDetailsService(userDetailsService); 68 | // } 69 | // 70 | //} 71 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/config/ApplicationConfig.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; 5 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; 6 | import org.springframework.boot.context.properties.ConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.context.event.ApplicationEventMulticaster; 10 | import org.springframework.context.event.SimpleApplicationEventMulticaster; 11 | import org.springframework.core.task.SimpleAsyncTaskExecutor; 12 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 13 | import org.springframework.security.crypto.password.PasswordEncoder; 14 | import org.springframework.security.oauth2.client.OAuth2RestTemplate; 15 | import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails; 16 | import org.springframework.web.client.RestTemplate; 17 | import org.springframework.web.filter.CommonsRequestLoggingFilter; 18 | import springfox.documentation.swagger2.web.Swagger2Controller; 19 | 20 | import javax.sql.DataSource; 21 | import java.time.LocalDateTime; 22 | import java.time.format.DateTimeFormatter; 23 | import java.util.TimeZone; 24 | 25 | @Configuration 26 | public class ApplicationConfig { 27 | 28 | @Bean(name = "applicationEventMulticaster") 29 | public ApplicationEventMulticaster simpleApplicationEventMulticaster() { 30 | SimpleApplicationEventMulticaster eventMulticaster 31 | = new SimpleApplicationEventMulticaster(); 32 | 33 | eventMulticaster.setTaskExecutor(new SimpleAsyncTaskExecutor()); 34 | return eventMulticaster; 35 | } 36 | 37 | // @Bean 38 | // public CommonsRequestLoggingFilter logFilter() { 39 | // CommonsRequestLoggingFilter filter 40 | // = new CommonsRequestLoggingFilter(); 41 | // filter.setIncludeQueryString(true); 42 | // filter.setIncludePayload(true); 43 | // filter.setMaxPayloadLength(10000); 44 | // filter.setIncludeHeaders(false); 45 | // filter.setAfterMessagePrefix("REQUEST DATA : "); 46 | // return filter; 47 | // } 48 | 49 | @Bean 50 | public RestTemplate rt() { 51 | return new RestTemplate(); 52 | } 53 | 54 | @Bean 55 | public OAuth2RestTemplate ort(OAuth2ProtectedResourceDetails details) { 56 | OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(details); 57 | return oAuth2RestTemplate; 58 | } 59 | @Bean 60 | public PasswordEncoder passwordEncoder() { 61 | 62 | return new BCryptPasswordEncoder(); 63 | } 64 | 65 | @Bean 66 | @ConfigurationProperties("spring.datasource.druid") 67 | public DataSource dataSource() { 68 | return new DruidDataSource(); 69 | } 70 | 71 | @org.springframework.beans.factory.annotation.Value("${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}") 72 | private String pattern; 73 | 74 | @Bean 75 | public LocalDateTimeSerializer localDateTimeDeserializer() { 76 | return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern)); 77 | } 78 | 79 | /** 80 | * 去掉时间格式中间的T字符 81 | * @return 82 | */ 83 | @Bean 84 | public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { 85 | return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer()); 86 | } 87 | 88 | 89 | } 90 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/usercenter/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.usercenter.entity; 2 | 3 | import com.baomidou.mybatisplus.annotation.FieldStrategy; 4 | import com.baomidou.mybatisplus.annotation.TableField; 5 | import com.baomidou.mybatisplus.annotation.TableName; 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | import com.starfire.familytree.basic.entity.AbstractEntity; 8 | import com.starfire.familytree.enums.BooleanEnum; 9 | import com.starfire.familytree.enums.GenderEnum; 10 | import com.starfire.familytree.enums.UserTypeEnum; 11 | import com.starfire.familytree.security.entity.Role; 12 | import lombok.Data; 13 | import lombok.EqualsAndHashCode; 14 | import lombok.experimental.Accessors; 15 | import org.springframework.security.core.GrantedAuthority; 16 | import org.springframework.security.core.userdetails.UserDetails; 17 | 18 | import javax.validation.constraints.Email; 19 | import javax.validation.constraints.NotEmpty; 20 | import javax.validation.constraints.NotNull; 21 | import javax.validation.constraints.Size; 22 | import java.beans.Transient; 23 | import java.time.LocalDateTime; 24 | import java.util.ArrayList; 25 | import java.util.Collection; 26 | import java.util.List; 27 | 28 | /** 29 | *

30 | * 31 | *

32 | * 33 | * @author luzh 34 | * @since 2019-03-03 35 | */ 36 | @EqualsAndHashCode(callSuper = false) 37 | @Accessors(chain = true) 38 | @TableName("sys_user") 39 | @Data 40 | public class User extends AbstractEntity implements UserDetails { 41 | 42 | private static final long serialVersionUID = 1L; 43 | 44 | @TableField(exist = false) 45 | private List authorities = new ArrayList<>(); 46 | 47 | @NotEmpty(message = "邮箱不能为空") 48 | @Email 49 | private String email; 50 | 51 | private BooleanEnum firstLogin=BooleanEnum.否; 52 | 53 | private LocalDateTime lastLoginTime; 54 | 55 | private String mobile; 56 | 57 | @TableField(exist = false) 58 | private String[] roles; 59 | 60 | @NotNull(message = "用户名不能为空") 61 | @Size(min = 2, max = 32, message = "用户名长度为2-32个字符") 62 | private String username; 63 | 64 | 65 | /** 66 | * 值为空,忽略不更新 67 | */ 68 | @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)//Jackson 69 | @TableField(strategy = FieldStrategy.NOT_NULL) 70 | private String password; 71 | 72 | private String realName; 73 | 74 | private LocalDateTime registerTime = LocalDateTime.now(); 75 | 76 | private UserTypeEnum type= UserTypeEnum.普通用户; 77 | 78 | private Integer age; 79 | 80 | @NotNull 81 | private GenderEnum gender= GenderEnum.不清楚; 82 | 83 | private Integer province; 84 | 85 | private Integer city; 86 | 87 | private Integer district; 88 | 89 | private String address; 90 | 91 | @Override 92 | public Collection getAuthorities() { 93 | return authorities; 94 | } 95 | 96 | @Override 97 | public String getPassword() { 98 | return password; 99 | } 100 | 101 | @Override 102 | public String getUsername() { 103 | return username; 104 | } 105 | 106 | @Override 107 | public boolean isAccountNonExpired() { 108 | return true; 109 | } 110 | 111 | @Override 112 | public boolean isAccountNonLocked() { 113 | return true; 114 | } 115 | 116 | @Override 117 | public boolean isCredentialsNonExpired() { 118 | return true; 119 | } 120 | 121 | @Override 122 | public boolean isEnabled() { 123 | return getValid().getValue()==1?true:false; 124 | } 125 | 126 | 127 | } 128 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/security/controller/RoleMenuController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.security.controller; 2 | 3 | 4 | import com.starfire.familytree.response.Response; 5 | import com.starfire.familytree.security.entity.RoleMenu; 6 | import com.starfire.familytree.security.entity.RoleMenuRight; 7 | import com.starfire.familytree.security.service.IMenuService; 8 | import com.starfire.familytree.security.service.IRoleMenuService; 9 | import com.starfire.familytree.vo.DeleteVO; 10 | import com.starfire.familytree.vo.PageInfo; 11 | import com.starfire.familytree.vo.RoleMenuVO; 12 | import io.swagger.annotations.Api; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.web.bind.annotation.*; 15 | 16 | import java.util.*; 17 | 18 | /** 19 | *

20 | * 角色菜单控制器 21 | *

22 | * 23 | * @author luzh 24 | * @since 2019-03-03 25 | */ 26 | @RestController 27 | @RequestMapping("/security/role_menu") 28 | @Api(tags = "角色菜单模块") 29 | public class RoleMenuController { 30 | @Autowired 31 | private IRoleMenuService roleMenuService; 32 | 33 | 34 | @Autowired 35 | private IMenuService menuService; 36 | /** 37 | * 新增或修改 ,先删除所有菜单 38 | * 39 | * @return 40 | * @author luzh 41 | */ 42 | @PostMapping("/addOrUpdate") 43 | public Response addOrUpdateRoleMenu(@RequestBody RoleMenuVO roleMenuVo) { 44 | roleMenuService.addOrUpdateRoleMenu(roleMenuVo); 45 | Response response = new Response(); 46 | return response.success("保存成功"); 47 | 48 | } 49 | 50 | /** 51 | * 提取父和子menuId 52 | * @param menuIds 53 | * @return 54 | */ 55 | private List mergeParentAndChildMenusIds(List menuIds){ 56 | List list=new ArrayList(); 57 | for (String menuId : menuIds) { 58 | list.add(Long.valueOf(menuId)); 59 | } 60 | List mergeList =menuService.getParentMenuIds(list); 61 | list.addAll(mergeList); 62 | return list; 63 | } 64 | 65 | /** 66 | * 删除 67 | * 68 | * @return 69 | * @author luzh 70 | */ 71 | @PostMapping("/delete") 72 | public Response deleteRoleMenu(@RequestBody DeleteVO deleteVO) { 73 | String[] ids = deleteVO.getIds(); 74 | boolean flag = roleMenuService.removeByIds(Arrays.asList(ids)); 75 | Response response = new Response(); 76 | if (!flag) { 77 | return response.failure(); 78 | } 79 | return response.success(); 80 | 81 | } 82 | 83 | /** 84 | * 分页 85 | * 86 | * @param page 87 | * @return 88 | * @author luzh 89 | */ 90 | @PostMapping("/page") 91 | public Response, RoleMenu>> page(@RequestBody(required = false) PageInfo, RoleMenu> page) { 92 | if(page==null){ 93 | page=new PageInfo<>(); 94 | } 95 | PageInfo, RoleMenu> pageInfo = roleMenuService.page(page); 96 | Response, RoleMenu>> response = new Response, RoleMenu>>(); 97 | return response.success(pageInfo); 98 | 99 | } 100 | 101 | @GetMapping("/getRoleMenuByRoleId") 102 | public Response getRoleMenuByRoleId(Long roleId) { 103 | RoleMenuVO rmvo= roleMenuService.getRoleMenuByRoleId(roleId); 104 | Response response = new Response(); 105 | return response.success(rmvo); 106 | 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /familytree/src/main/java/com/starfire/familytree/login/controller/LoginController.java: -------------------------------------------------------------------------------- 1 | package com.starfire.familytree.login.controller; 2 | 3 | import com.fasterxml.jackson.databind.JsonNode; 4 | import com.starfire.familytree.login.vo.LoginReq; 5 | import com.starfire.familytree.usercenter.service.IUserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.HttpEntity; 8 | import org.springframework.http.HttpHeaders; 9 | import org.springframework.http.MediaType; 10 | import org.springframework.http.ResponseEntity; 11 | import org.springframework.security.core.Authentication; 12 | import org.springframework.security.core.context.SecurityContextHolder; 13 | import org.springframework.security.oauth2.client.OAuth2RestTemplate; 14 | import org.springframework.util.LinkedMultiValueMap; 15 | import org.springframework.util.MultiValueMap; 16 | import org.springframework.web.bind.annotation.RequestBody; 17 | import org.springframework.web.bind.annotation.RequestMapping; 18 | import org.springframework.web.bind.annotation.RestController; 19 | import org.springframework.web.client.RestTemplate; 20 | import org.springframework.web.servlet.support.ServletUriComponentsBuilder; 21 | import org.springframework.web.util.UriComponents; 22 | 23 | import javax.servlet.http.HttpServletResponse; 24 | import javax.validation.Valid; 25 | import java.io.IOException; 26 | 27 | @RestController 28 | public class LoginController { 29 | 30 | @Autowired 31 | private RestTemplate rt; 32 | 33 | @Autowired 34 | private OAuth2RestTemplate ort; 35 | 36 | @Autowired 37 | private IUserService userService; 38 | 39 | // @RequestMapping("/login") 40 | // public String login(@Valid @RequestBody LoginReq loginReq){ 41 | // UriComponents uc = ServletUriComponentsBuilder.fromCurrentRequest().path("/oauth/token").build(); 42 | // String uriString = uc.toUriString().replace("/doLogin", ""); 43 | // HttpHeaders headers = new HttpHeaders(); 44 | // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); 45 | // headers.add("Authorization", "Basic ZmFtaWx5X3RyZWU6ZmFtaWx5X3RyZWU="); 46 | // MultiValueMap map=new LinkedMultiValueMap<>(); 47 | // map.add("grant_type", loginReq.getGrant_type()); 48 | // map.add("password", loginReq.getPassword()); 49 | // map.add("scope", loginReq.getScope()); 50 | // map.add("username", loginReq.getUsername()); 51 | // HttpEntity> entity = new HttpEntity>(map, headers); 52 | // ResponseEntity responseEntity = rt.postForEntity(uriString, entity, JsonNode.class); 53 | // JsonNode node = responseEntity.getBody(); 54 | // String access_token = node.findValue("access_token").asText(); 55 | // return access_token; 56 | // } 57 | // @RequestMapping("/doLogin") 58 | // public String doLogin(@Valid @RequestBody LoginReq loginReq){ 59 | // UriComponents uc = ServletUriComponentsBuilder.fromCurrentRequest().path("/oauth/token").build(); 60 | // String uriString = uc.toUriString().replace("/doLogin", ""); 61 | // HttpHeaders headers = new HttpHeaders(); 62 | // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); 63 | // headers.add("Authorization", "Basic ZmFtaWx5X3RyZWU6ZmFtaWx5X3RyZWU="); 64 | // MultiValueMap map=new LinkedMultiValueMap<>(); 65 | // map.add("grant_type", loginReq.getGrant_type()); 66 | // map.add("password", loginReq.getPassword()); 67 | // map.add("scope", loginReq.getScope()); 68 | // map.add("username", loginReq.getUsername()); 69 | // HttpEntity> entity = new HttpEntity>(map, headers); 70 | // ResponseEntity responseEntity = rt.postForEntity(uriString, entity, JsonNode.class); 71 | // JsonNode node = responseEntity.getBody(); 72 | // String access_token = node.findValue("access_token").asText(); 73 | // return access_token; 74 | // } 75 | } 76 | --------------------------------------------------------------------------------