From 7aa38143a8babfee7b9080edd2ee9c2ab7763ebc Mon Sep 17 00:00:00 2001 From: yinzuomei <57602893@qq.com> Date: Mon, 16 Mar 2020 14:25:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Eepmet-user=E6=A8=A1=E5=9D=97,?= =?UTF-8?q?=E4=BF=AE=E6=94=B9resi-guide=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 5 + .../src/main/resources/bootstrap.yml | 8 + .../resi-guide/resi-guide-server/pom.xml | 4 +- epmet-user/epmet-user-client/pom.xml | 35 ++++ .../java/com/epmet/dto/CustomerUserDTO.java | 121 +++++++++++++ epmet-user/epmet-user-server/pom.xml | 140 +++++++++++++++ .../main/java/com/epmet/UserApplication.java | 27 +++ .../com/epmet/config/ModuleConfigImpl.java | 26 +++ .../java/com/epmet/config/SwaggerConfig.java | 68 ++++++++ .../controller/CustomerUserController.java | 94 +++++++++++ .../java/com/epmet/dao/CustomerUserDao.java | 33 ++++ .../com/epmet/entity/CustomerUserEntity.java | 91 ++++++++++ .../com/epmet/excel/CustomerUserExcel.java | 86 ++++++++++ .../com/epmet/redis/CustomerUserRedis.java | 47 ++++++ .../epmet/service/CustomerUserService.java | 95 +++++++++++ .../service/impl/CustomerUserServiceImpl.java | 104 ++++++++++++ .../src/main/resources/bootstrap.yml | 117 +++++++++++++ .../src/main/resources/logback-spring.xml | 159 ++++++++++++++++++ .../main/resources/mapper/CustomerUserDao.xml | 27 +++ epmet-user/pom.xml | 21 +++ pom.xml | 1 + 21 files changed, 1307 insertions(+), 2 deletions(-) create mode 100644 epmet-user/epmet-user-client/pom.xml create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java create mode 100644 epmet-user/epmet-user-server/pom.xml create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/config/ModuleConfigImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/config/SwaggerConfig.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/bootstrap.yml create mode 100644 epmet-user/epmet-user-server/src/main/resources/logback-spring.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml create mode 100644 epmet-user/pom.xml diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 1d450badbb..e63f9f7d69 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -117,6 +117,9 @@ http://localhost:8084 + + + http://localhost:8087 lb://epmet-demo-server @@ -168,6 +171,8 @@ lb://epmet-activiti-server lb://epmet-job-server + + lb://epmet-user-server lb://epmet-demo-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 04f2b77ea5..a6cb5e4252 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -82,6 +82,14 @@ spring: - Path=${server.servlet.context-path}/job/** filters: - StripPrefix=1 + #用户服务 + - id: epmet-user-server + uri: @gateway.routes.epmet-user-server.uri@ + order: 7 + predicates: + - Path=${server.servlet.context-path}/epmetuser/** + filters: + - StripPrefix=1 #demo流服务 - id: epmet-demo-server uri: @gateway.routes.epmet-demo-server.uri@ diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index f7f8694547..f50ad1cf6d 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -89,7 +89,7 @@ - + epmet elink@833066 @@ -119,7 +119,7 @@ - + epmet elink@833066 diff --git a/epmet-user/epmet-user-client/pom.xml b/epmet-user/epmet-user-client/pom.xml new file mode 100644 index 0000000000..da75b38ba7 --- /dev/null +++ b/epmet-user/epmet-user-client/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + + com.epmet + epmet-user + 2.0.0 + + + epmet-user-client + jar + + + + com.epmet + epmet-commons-tools + 2.0.0 + + + io.springfox + springfox-swagger2 + + + io.springfox + springfox-swagger-ui + + + + + ${project.artifactId} + + + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java new file mode 100644 index 0000000000..348dc373d2 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java @@ -0,0 +1,121 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class CustomerUserDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 昵称 + */ + private String nickname; + + /** + * 性别:0.未知 1.男性2女性 + */ + private Integer sex; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 语言 + */ + private String language; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml new file mode 100644 index 0000000000..80043ebabe --- /dev/null +++ b/epmet-user/epmet-user-server/pom.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + + + com.epmet + epmet-user + 2.0.0 + + + epmet-user-server + jar + + + + com.epmet + epmet-user-client + 2.0.0 + + + com.epmet + epmet-commons-mybatis + 2.0.0 + + + com.epmet + epmet-commons-dynamic-datasource + 2.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework + spring-context-support + + + org.springframework.boot + spring-boot-starter-actuator + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + ${project.basedir}/src/main/java + + + true + ${basedir}/src/main/resources + + + + + + + dev + + true + + + 8087 + dev + + + + + + epmet + elink@833066 + + 0 + 122.152.200.70 + 6379 + 123456 + + false + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + test + + + 8087 + test + + + + + + epmet + elink@833066 + + 0 + 122.152.200.70 + 6379 + 123456 + + true + 122.152.200.70:8848 + fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b + + + false + + + + + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java new file mode 100644 index 0000000000..7d54b4e248 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 管理后台 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@SpringBootApplication +public class UserApplication { + + public static void main(String[] args) { + SpringApplication.run(UserApplication.class, args); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/config/ModuleConfigImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/config/ModuleConfigImpl.java new file mode 100644 index 0000000000..583ecbea38 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/config/ModuleConfigImpl.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.config.ModuleConfig; +import org.springframework.stereotype.Service; + +/** + * 模块配置信息 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Service +public class ModuleConfigImpl implements ModuleConfig { + @Override + public String getName() { + return "epmetuser"; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/config/SwaggerConfig.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/config/SwaggerConfig.java new file mode 100644 index 0000000000..e4ceef42ee --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/config/SwaggerConfig.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.config; + +import com.epmet.commons.tools.constant.Constant; +import io.swagger.annotations.ApiOperation; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.ApiKey; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import java.util.List; + +import static com.google.common.collect.Lists.newArrayList; + +/** + * Swagger配置 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //加了ApiOperation注解的类,才生成接口文档 + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + //包下的类,才生成接口文档 + //.apis(RequestHandlerSelectors.basePackage("io.renren.controller")) + .paths(PathSelectors.any()) + .build() + .directModelSubstitute(java.util.Date.class, String.class) + .securitySchemes(security()); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("人人开源") + .description("系统模块开发文档") + .termsOfServiceUrl("https://www.renren.io/community") + .version("1.4.0") + .build(); + } + + private List security() { + return newArrayList( + new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header") + ); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java new file mode 100644 index 0000000000..ae4187b65d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.CustomerUserDTO; +import com.epmet.excel.CustomerUserExcel; +import com.epmet.service.CustomerUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@RestController +@RequestMapping("customeruser") +public class CustomerUserController { + + @Autowired + private CustomerUserService customerUserService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerUserService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerUserDTO data = customerUserService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerUserService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerUserDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerUserService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + customerUserService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = customerUserService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, CustomerUserExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java new file mode 100644 index 0000000000..e41ca338d6 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.CustomerUserEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface CustomerUserDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java new file mode 100644 index 0000000000..11a6e86b09 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_user") +public class CustomerUserEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 微信openId + */ + private String wxOpenId; + + /** + * 手机号 + */ + private String mobile; + + /** + * 昵称 + */ + private String nickname; + + /** + * 性别:0.未知 1.男性2女性 + */ + private Integer sex; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 语言 + */ + private String language; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java new file mode 100644 index 0000000000..e1d2bc9aec --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java @@ -0,0 +1,86 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class CustomerUserExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "客户Id CUSTOMER.id") + private String customerId; + + @Excel(name = "微信openId") + private String wxOpenId; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "昵称") + private String nickname; + + @Excel(name = "性别:0.未知 1.男性2女性") + private Integer sex; + + @Excel(name = "头像") + private String headImgUrl; + + @Excel(name = "国家") + private String country; + + @Excel(name = "省份") + private String province; + + @Excel(name = "城市") + private String city; + + @Excel(name = "语言") + private String language; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java new file mode 100644 index 0000000000..f70ed57881 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Component +public class CustomerUserRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java new file mode 100644 index 0000000000..39ebe54c91 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.CustomerUserDTO; +import com.epmet.entity.CustomerUserEntity; + +import java.util.List; +import java.util.Map; + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +public interface CustomerUserService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerUserDTO + * @author generator + * @date 2020-03-16 + */ + CustomerUserDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void save(CustomerUserDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void update(CustomerUserDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-16 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java new file mode 100644 index 0000000000..59e3ccafaa --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.CustomerUserDao; +import com.epmet.dto.CustomerUserDTO; +import com.epmet.entity.CustomerUserEntity; +import com.epmet.redis.CustomerUserRedis; +import com.epmet.service.CustomerUserService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 居民用户信息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Service +public class CustomerUserServiceImpl extends BaseServiceImpl implements CustomerUserService { + + @Autowired + private CustomerUserRedis customerUserRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerUserDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerUserDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public CustomerUserDTO get(String id) { + CustomerUserEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerUserDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerUserDTO dto) { + CustomerUserEntity entity = ConvertUtils.sourceToTarget(dto, CustomerUserEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerUserDTO dto) { + CustomerUserEntity entity = ConvertUtils.sourceToTarget(dto, CustomerUserEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000000..f7070de4b7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -0,0 +1,117 @@ +server: + port: @server.port@ + servlet: + context-path: /epmetuser + +spring: + main: + allow-bean-definition-overriding: true + application: + name: epmet-user-server + #环境 dev|test|prod + profiles: + active: dev + messages: + encoding: UTF-8 + basename: i18n/messages_common + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm:ss + redis: + database: @spring.redis.index@ + host: @spring.redis.host@ + port: @spring.redis.port@ + password: @spring.redis.password@ + timeout: 30s + datasource: + druid: + #MySQL + driver-class-name: com.mysql.cj.jdbc.Driver + url: @spring.datasource.druid.url@ + username: @spring.datasource.druid.username@ + password: @spring.datasource.druid.password@ + initial-size: 10 + max-active: 100 + min-idle: 10 + max-wait: 60000 + pool-prepared-statements: true + max-pool-prepared-statement-per-connection-size: 20 + time-between-eviction-runs-millis: 60000 + min-evictable-idle-time-millis: 300000 + #Oracle需要打开注释 + #validation-query: SELECT 1 FROM DUAL + test-while-idle: true + test-on-borrow: false + test-on-return: false + filter: + stat: + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: false + wall: + config: + multi-statement-allow: true + cloud: + nacos: + discovery: + server-addr: @nacos.server-addr@ + #nacos的命名空间ID,默认是public + namespace: @nacos.discovery.namespace@ + #不把自己注册到注册中心的地址 + register-enabled: @nacos.register-enabled@ + ip: @nacos.ip@ + config: + enabled: @nacos.config-enabled@ + server-addr: @nacos.server-addr@ + namespace: @nacos.config.namespace@ + group: @nacos.config.group@ + file-extension: yaml +management: + endpoints: + web: + exposure: + include: "*" + endpoint: + health: + show-details: ALWAYS + +mybatis-plus: + mapper-locations: classpath:/mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.epmet.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: ID_WORKER + banner: false + #原生配置 + configuration: + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +feign: + hystrix: + enabled: true + client: + config: + default: + loggerLevel: BASIC + httpclient: + enabled: true + max-connections: 200 + max-connections-per-route: 50 + +hystrix: + command: + default: + execution: + isolation: + thread: + timeoutInMilliseconds: 60000 #缺省为1000 + +ribbon: + ReadTimeout: 300000 + ConnectTimeout: 300000 diff --git a/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml b/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000..c34321a409 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/logback-spring.xml @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + debug + + + ${CONSOLE_LOG_PATTERN} + + UTF-8 + + + + + + + + ${log.path}/debug.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/debug-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + debug + ACCEPT + DENY + + + + + + + ${log.path}/info.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + ${log.path}/info-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + info + ACCEPT + DENY + + + + + + + ${log.path}/warn.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/warn-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + warn + ACCEPT + DENY + + + + + + + ${log.path}/error.log + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + ${log.path}/error-%d{yyyy-MM-dd}.%i.log + + 100MB + + + 15 + + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml new file mode 100644 index 0000000000..14a5b36bc6 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/pom.xml b/epmet-user/pom.xml new file mode 100644 index 0000000000..9e06fd4e2f --- /dev/null +++ b/epmet-user/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + com.epmet + epmet-cloud + 2.0.0 + + + com.epmet + epmet-user + pom + + + epmet-user-client + epmet-user-server + + + diff --git a/pom.xml b/pom.xml index 5f1a213922..741f491b12 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,7 @@ epmet-auth epmet-admin epmet-module + epmet-user