Browse Source

新增epmet-user模块,修改resi-guide数据库连接

master
yinzuomei 6 years ago
parent
commit
7aa38143a8
  1. 5
      epmet-gateway/pom.xml
  2. 8
      epmet-gateway/src/main/resources/bootstrap.yml
  3. 4
      epmet-module/resi-guide/resi-guide-server/pom.xml
  4. 35
      epmet-user/epmet-user-client/pom.xml
  5. 121
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java
  6. 140
      epmet-user/epmet-user-server/pom.xml
  7. 27
      epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java
  8. 26
      epmet-user/epmet-user-server/src/main/java/com/epmet/config/ModuleConfigImpl.java
  9. 68
      epmet-user/epmet-user-server/src/main/java/com/epmet/config/SwaggerConfig.java
  10. 94
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java
  11. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java
  12. 91
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java
  13. 86
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java
  14. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java
  15. 95
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java
  16. 104
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java
  17. 117
      epmet-user/epmet-user-server/src/main/resources/bootstrap.yml
  18. 159
      epmet-user/epmet-user-server/src/main/resources/logback-spring.xml
  19. 27
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml
  20. 21
      epmet-user/pom.xml
  21. 1
      pom.xml

5
epmet-gateway/pom.xml

@ -117,6 +117,9 @@
<!-- 7、定时任务服务 -->
<!-- <gateway.routes.epmet-job-server.uri>lb://epmet-job-server</gateway.routes.epmet-job-server.uri>-->
<gateway.routes.epmet-job-server.uri>http://localhost:8084</gateway.routes.epmet-job-server.uri>
<!-- 8、用户模块 -->
<!-- <gateway.routes.epmet-user-server.uri>lb://epmet-user-server</gateway.routes.epmet-user-server.uri>-->
<gateway.routes.epmet-user-server.uri>http://localhost:8087</gateway.routes.epmet-user-server.uri>
<!-- 9、新模块结构demo -->
<gateway.routes.epmet-demo-server.uri>lb://epmet-demo-server</gateway.routes.epmet-demo-server.uri>
<!-- <gateway.routes.epmet-demo-server.uri>http://localhost:8088</gateway.routes.epmet-demo-server.uri>-->
@ -168,6 +171,8 @@
<gateway.routes.epmet-activiti-server.uri>lb://epmet-activiti-server</gateway.routes.epmet-activiti-server.uri>
<!-- 7、定时任务服务 -->
<gateway.routes.epmet-job-server.uri>lb://epmet-job-server</gateway.routes.epmet-job-server.uri>
<!-- 8、用户模块 -->
<gateway.routes.epmet-user-server.uri>lb://epmet-user-server</gateway.routes.epmet-user-server.uri>
<!-- 9、新模块结构demo -->
<gateway.routes.epmet-demo-server.uri>lb://epmet-demo-server</gateway.routes.epmet-demo-server.uri>
<!-- 10、运营端客户定制化服务 -->

8
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@

4
epmet-module/resi-guide/resi-guide-server/pom.xml

@ -89,7 +89,7 @@
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_resi_guide?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
@ -119,7 +119,7 @@
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_admin?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_resi_guide?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>

35
epmet-user/epmet-user-client/pom.xml

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>
<version>2.0.0</version>
</parent>
<artifactId>epmet-user-client</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
</build>
</project>

121
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerUserDTO.java

@ -0,0 +1,121 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

140
epmet-user/epmet-user-server/pom.xml

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>
<version>2.0.0</version>
</parent>
<artifactId>epmet-user-server</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-mybatis</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-dynamic-datasource</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<server.port>8087</server.port>
<spring.profiles.active>dev</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
</properties>
</profile>
<profile>
<id>test</id>
<!--<activation>
<activeByDefault>true</activeByDefault>
</activation>-->
<properties>
<server.port>8087</server.port>
<spring.profiles.active>test</spring.profiles.active>
<!-- 数据库配置-->
<spring.datasource.druid.url>
<![CDATA[jdbc:mysql://47.104.224.45:3308/epmet_user?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</spring.datasource.druid.url>
<spring.datasource.druid.username>epmet</spring.datasource.druid.username>
<spring.datasource.druid.password>elink@833066</spring.datasource.druid.password>
<!-- redis配置 -->
<spring.redis.index>0</spring.redis.index>
<spring.redis.host>122.152.200.70</spring.redis.host>
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.server-addr>122.152.200.70:8848</nacos.server-addr>
<nacos.discovery.namespace>fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
<nacos.config.group></nacos.config.group>
<nacos.config-enabled>false</nacos.config-enabled>
<nacos.ip/>
</properties>
</profile>
</profiles>
</project>

27
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);
}
}

26
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";
}
}

68
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<ApiKey> security() {
return newArrayList(
new ApiKey(Constant.TOKEN_HEADER, Constant.TOKEN_HEADER, "header")
);
}
}

94
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerUserController.java

@ -0,0 +1,94 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<PageData<CustomerUserDTO>> page(@RequestParam Map<String, Object> params){
PageData<CustomerUserDTO> page = customerUserService.page(params);
return new Result<PageData<CustomerUserDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<CustomerUserDTO> get(@PathVariable("id") String id){
CustomerUserDTO data = customerUserService.get(id);
return new Result<CustomerUserDTO>().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<String, Object> params, HttpServletResponse response) throws Exception {
List<CustomerUserDTO> list = customerUserService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, CustomerUserExcel.class);
}
}

33
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerUserDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<CustomerUserEntity> {
}

91
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/CustomerUserEntity.java

@ -0,0 +1,91 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

86
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/CustomerUserExcel.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}

47
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/CustomerUserRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;
}
}

95
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerUserService.java

@ -0,0 +1,95 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<CustomerUserEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<CustomerUserDTO>
* @author generator
* @date 2020-03-16
*/
PageData<CustomerUserDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<CustomerUserDTO>
* @author generator
* @date 2020-03-16
*/
List<CustomerUserDTO> list(Map<String, Object> 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);
}

104
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerUserServiceImpl.java

@ -0,0 +1,104 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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<CustomerUserDao, CustomerUserEntity> implements CustomerUserService {
@Autowired
private CustomerUserRedis customerUserRedis;
@Override
public PageData<CustomerUserDTO> page(Map<String, Object> params) {
IPage<CustomerUserEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, CustomerUserDTO.class);
}
@Override
public List<CustomerUserDTO> list(Map<String, Object> params) {
List<CustomerUserEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, CustomerUserDTO.class);
}
private QueryWrapper<CustomerUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<CustomerUserEntity> 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));
}
}

117
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

159
epmet-user/epmet-user-server/src/main/resources/logback-spring.xml

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<property name="log.path" value="logs/epmetuser"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--1. 输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--2. 输出到文档-->
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/debug.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/info.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/warn.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文档的路径及文档名 -->
<file>${log.path}/error.log</file>
<!--日志文档输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<logger name="com.epmet.dao" level="DEBUG"/>
<root level="INFO">
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
<!-- 生产环境 -->
<springProfile name="prod">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/>
<appender-ref ref="WARN_FILE"/>
<appender-ref ref="ERROR_FILE"/>
</root>
</springProfile>
</configuration>

27
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerUserDao.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.CustomerUserDao">
<resultMap type="com.epmet.entity.CustomerUserEntity" id="customerUserMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="wxOpenId" column="WX_OPEN_ID"/>
<result property="mobile" column="MOBILE"/>
<result property="nickname" column="NICKNAME"/>
<result property="sex" column="SEX"/>
<result property="headImgUrl" column="HEAD_IMG_URL"/>
<result property="country" column="COUNTRY"/>
<result property="province" column="PROVINCE"/>
<result property="city" column="CITY"/>
<result property="language" column="LANGUAGE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
</mapper>

21
epmet-user/pom.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>
<version>2.0.0</version>
</parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-user</artifactId>
<packaging>pom</packaging>
<modules>
<module>epmet-user-client</module>
<module>epmet-user-server</module>
</modules>
</project>

1
pom.xml

@ -26,6 +26,7 @@
<module>epmet-auth</module>
<module>epmet-admin</module>
<module>epmet-module</module>
<module>epmet-user</module>
</modules>
<properties>

Loading…
Cancel
Save