merge from main branch

main
itao 1 year ago
commit cf419fbe92

@ -0,0 +1,3 @@
# luoo_cms
通用CMS BANNER,协议,文章等,意见反馈)

@ -0,0 +1,62 @@
<?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.luoo</groupId>
<artifactId>luoo_parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>luoo_cms</artifactId>
<description>通用CMS BANNER,协议,文章等,意见反馈) </description>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.luoo</groupId>
<artifactId>luoo_common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<!--swagger 升级版-->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
</project>

@ -0,0 +1,54 @@
package com.luoo.cms;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import util.IdWorker;
import util.JwtUtil;
import java.net.InetAddress;
import java.net.UnknownHostException;
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableFeignClients
public class CmsApplication {
private static Logger logger = LoggerFactory.getLogger(CmsApplication.class);
public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext application = SpringApplication.run(CmsApplication.class, args);
Environment env = application.getEnvironment();
logger.info("\n----------------------------------------------------------\n\t"
+ "Application '{}' is running! Access URLs:\n\t" + "Local: \t\thttp://localhost:{}\n\t"
+ "External: \thttp://{}:{}\n\t" + "Doc: \thttp://{}:{}/doc.html\n\t"
+ "Version: \tversion={},profiles={}\n" + "----------------------------------------------------------",
env.getProperty("spring.application.name"), env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"),
InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"),
env.getProperty("api.version"),env.getProperty("spring.profiles.active"));
}
@Bean
public JwtUtil jwtUtil(){
return new JwtUtil();
}
@Bean
public IdWorker idWorkker(){
return new IdWorker(1, 1);
}
}

@ -0,0 +1,52 @@
package com.luoo.cms.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.time.LocalDate;
import java.time.LocalTime;
@EnableSwagger2
@Configuration
public class SwaggerConfig {
@Autowired
private ConfigurableEnvironment configurableEnvironment;
@Bean
public Docket docket() {
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("com.luoo.cms"))
.paths(PathSelectors.any())
.build().directModelSubstitute(LocalTime.class, String.class)
.directModelSubstitute(LocalDate.class, String.class);
String appName = configurableEnvironment.getProperty("spring.application.name");
if (appName != null){
docket.pathMapping(String.format("/%s", appName));
}
return docket;
}
private ApiInfo apiInfo() {
ApiInfo info = new ApiInfoBuilder()
.title("通用CMS")
.description("通用CMS")
.version("0.0.1")
.contact(new Contact("通用CMS", "", ""))
.build();
return info;
}
}

@ -0,0 +1,49 @@
package com.luoo.cms.controller;
import api.Result;
import com.luoo.cms.pojo.Banner;
import com.luoo.cms.service.BannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Api(tags = "banner轮播图")
@RestController
@RequestMapping("/banner")
public class BannerController {
@Autowired
private BannerService bannerService;
@ApiOperation("通过id查询一个banner")
@GetMapping("/{id}")
public Result<Banner> findById(@PathVariable String id){
return Result.success(bannerService.findById(id));
}
@ApiOperation("banner列表")
@GetMapping("/list")
public Result<List<Banner>> findById(){
return Result.success(bannerService.bannerList());
}
@ApiOperation("添加一个banner")
@PostMapping
public Result<Void> add(@RequestBody Banner banner){
bannerService.add(banner);
return Result.success();
}
@ApiOperation("通过id删除banner")
@DeleteMapping("/{id}")
public Result<Void> delete(@PathVariable String id ){
bannerService.deleteById(id);
return Result.success();
}
}

@ -0,0 +1,32 @@
package com.luoo.cms.controller;
import api.Result;
import com.luoo.cms.pojo.Agreement;
import com.luoo.cms.pojo.Banner;
import com.luoo.cms.service.AgreementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@Api(tags = "通用CMS")
@RestController
@RequestMapping("/cms")
public class CmsController {
@Autowired
private AgreementService agreementService;
@ApiOperation("通过key查询")
@GetMapping("/agreement/{key}")
public Result<Agreement> findById(@PathVariable String key){
return Result.success(agreementService.findByKey(key));
}
}

@ -0,0 +1,16 @@
package com.luoo.cms.dao;
import com.luoo.cms.pojo.Agreement;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.lang.NonNull;
import java.util.Optional;
public interface AgreementDao extends JpaRepository<Agreement,String> {
@Query("select a from Agreement a where a.key = ?1")
Optional<Agreement> findByKey(String key);
Optional<Agreement> findByKeyAndState(@NonNull String key, int state);
}

@ -0,0 +1,8 @@
package com.luoo.cms.dao;
import com.luoo.cms.pojo.Banner;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BannerDao extends JpaRepository<Banner,String> {
}

@ -0,0 +1,45 @@
package com.luoo.cms.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Entity
@Table(name = "tb_agreement")
@ApiModel(value = "协议")
public class Agreement implements Serializable {
@Id
private String id;
@ApiModelProperty(value = "url别名")
private String key;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "状态")
private int state = 0;
@Column(name = "create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:dd")
@ApiModelProperty(value = "创建时间")
protected LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time")
@ApiModelProperty(value = "更新时间", hidden = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
protected LocalDateTime updateTime = LocalDateTime.now();
}

@ -0,0 +1,42 @@
package com.luoo.cms.pojo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@Entity
@Table(name = "tb_banner")
@ApiModel(value = "banner轮播图")
public class Banner implements Serializable {
@Id
private String id;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "图片地址")
private String imgUrl;
@ApiModelProperty(value = "点击跳转地址")
private String url;
@ApiModelProperty(value = "状态")
private int state = 0;
@Column(name = "create_time")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:dd")
@ApiModelProperty(value = "创建时间")
protected LocalDateTime createTime = LocalDateTime.now();
@Column(name = "update_time")
@ApiModelProperty(value = "更新时间", hidden = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
protected LocalDateTime updateTime = LocalDateTime.now();
}

@ -0,0 +1,30 @@
package com.luoo.cms.service;
import com.luoo.cms.dao.AgreementDao;
import com.luoo.cms.pojo.Agreement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class AgreementService {
@Autowired
private AgreementDao agreementDao;
public Agreement findByKey1(String key) {
Agreement agreement = new Agreement();
agreement.setKey(key);
Example<Agreement> example = Example.of(agreement);
return agreementDao.findOne(example).get();
}
public Agreement findByKey(String key) {
//agreementDao.findByKeyAndState(key,0);
return agreementDao.findByKey(key).get();
}
}

@ -0,0 +1,38 @@
package com.luoo.cms.service;
import com.luoo.cms.dao.BannerDao;
import com.luoo.cms.pojo.Banner;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import util.IdWorker;
import java.util.List;
@Service
@Transactional
public class BannerService {
@Autowired
private BannerDao bannerDao;
@Autowired
private IdWorker idWorker;
public Banner findById(String id) {
return bannerDao.findById(id).get();
}
public void add(Banner banner) {
banner.setId(idWorker.nextId()+"");
bannerDao.save(banner);
}
public void deleteById(String id) {
bannerDao.deleteById(id);
}
public List<Banner> bannerList() {
return bannerDao.findAll();
}
}

@ -0,0 +1,8 @@
spring:
cloud:
config:
name: cms
profile: dev
label: master
uri: http://116.62.145.60:12000
# uri: http://127.0.0.1:12000

@ -29,7 +29,7 @@ public enum StatusCode implements IErrorCode {
// tag 模块错误码以50XXX不足5位补0;
TAG_COMMON_FAILED(50000, "标签模块错误"),
// recruit 模块错误码以50XXX不足5位补0;
// recruit 模块错误码以60XXX不足5位补0;
RECRUIT_COMMON_FAILED(60000, "招聘模块错误");
private int code;

@ -1,8 +1,10 @@
package exception;
import api.StatusCode;
public class BizException extends RuntimeException {
private static final long serialVersionUID = 2466145171145432619L;
private StatusCode codeEnum;
private Integer code = 500;
public BizException(String message) {
@ -14,7 +16,25 @@ public class BizException extends RuntimeException {
this.code = code;
}
public StatusCode getCodeEnum() {
return codeEnum;
}
public Integer getCode() {
return this.code;
}
public BizException(StatusCode codeEnum) {
super(codeEnum.getMessage());
this.codeEnum = codeEnum;
this.code = codeEnum.getCode();
}
/**
* fillInStackTrace .
*/
@Override
public Throwable fillInStackTrace() {
return this;
}
}

@ -38,6 +38,23 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-bus</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-stream-binder-rabbit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
@ -50,18 +67,15 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- docker的maven插件官网
https://github.com/spotify/docker-maven-plugin -->
<!-- docker的maven插件官网 https://github.com/spotify/docker-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>
116.62.145.60:5000/${project.artifactId}:${project.version}</imageName>
<imageName>116.62.145.60:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java",
"-jar","/${project.build.finalName}.jar"]</entryPoint>
<entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
@ -74,5 +88,4 @@
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,12 @@
package com.luoo.user.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface GlobalInterceptor {
boolean checkParam() default true;
}

@ -0,0 +1,17 @@
package com.luoo.user.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import com.luoo.user.enums.VerifyRegexEnum;
@Target({ElementType.PARAMETER,ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface VerifyParam {
VerifyRegexEnum regex() default VerifyRegexEnum.NO;
int min() default -1;
int max() default -1;
boolean required() default false;
}

@ -0,0 +1,93 @@
package com.luoo.user.aspect;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import org.apache.commons.lang3.ArrayUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.luoo.user.annotation.GlobalInterceptor;
import com.luoo.user.annotation.VerifyParam;
import com.luoo.user.util.StringTools;
import com.luoo.user.util.VerifyUtils;
import api.StatusCode;
import exception.BizException;
@Aspect
@Component("operationAspect")
public class OperationAspect {
static Logger logger= LoggerFactory.getLogger(OperationAspect.class);
private static final String[] BASE_TYPE_ARRAY=new String[] {"java.lang.String","java.lang.Integer","java.lang.Long"};
@Before("@annotation(com.luoo.user.annotation.GlobalInterceptor)")
public void interceptorDo(JoinPoint point) {
Object[] arguments=point.getArgs();
Method method=((MethodSignature)point.getSignature()).getMethod();
GlobalInterceptor interceptor=method.getAnnotation(GlobalInterceptor.class);
if(null==interceptor) {
return;
}
if(interceptor.checkParam()) {
validateParams(method,arguments);
}
}
private void validateParams(Method method, Object[] arguments) {
Parameter[] parameters=method.getParameters();
for(int i=0;i<parameters.length;i++) {
Parameter parameter=parameters[i];
Object value=arguments[i];
VerifyParam verifyParam=parameter.getAnnotation(VerifyParam.class);
if(null==verifyParam) {
continue;
}
String paramTypeName=parameter.getParameterizedType().getTypeName();
if(ArrayUtils.contains(BASE_TYPE_ARRAY, paramTypeName)) {
checkValue(value,verifyParam);
}else {
checkObjValue(parameter,value);
}
}
}
private void checkObjValue(Parameter parameter,Object value) {
try {
String typeName=parameter.getParameterizedType().getTypeName();
Class<?> clazz=Class.forName(typeName);
Field[] fields= clazz.getDeclaredFields();
for(Field field:fields) {
VerifyParam fieldVerifyParam=field.getAnnotation(VerifyParam.class);
if(null==fieldVerifyParam) {
continue;
}
field.setAccessible(true);
Object resultValue=field.get(value);
checkValue(resultValue,fieldVerifyParam);
}
}catch(Exception e) {
logger.error(StatusCode.VALIDATE_FAILED.getMessage(),e.getMessage());
throw new BizException(StatusCode.VALIDATE_FAILED);
}
}
private void checkValue(Object value, VerifyParam verifyParam) {
boolean isEmpty= null==value||StringTools.isEmpty(value.toString());
int length= null==value?0:value.toString().length();
if(isEmpty&&verifyParam.required()) {
throw new BizException(StatusCode.VALIDATE_FAILED);
}
if(!isEmpty&&(-1!=verifyParam.max()&&verifyParam.max()<length||-1!=verifyParam.min()&&verifyParam.min()>length)) {
throw new BizException(StatusCode.VALIDATE_FAILED);
}
if(!isEmpty&&!StringTools.isEmpty(verifyParam.regex().getRegex())&&!VerifyUtils.verify(verifyParam.regex(), String.valueOf(value))) {
throw new BizException(StatusCode.VALIDATE_FAILED);
}
}
}

@ -0,0 +1,8 @@
package com.luoo.user.constants;
public class Constants {
public static final String IMAGE_CHECK_CODE_KEY="image_check_code_key";
public static final String REDIS_KEY_IMAGE_CHECK_CODE="redis_key_image_check_code_";
public static final String REDIS_KEY_MOBILE_CHECK_CODE="redis_key_mobile_check_code_";
}

@ -1,19 +1,32 @@
package com.luoo.user.controller;
import exception.BizException;
import api.Result;
import api.StatusCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
*/
@Slf4j
@ControllerAdvice
public class BaseExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result<Void> error(Exception e){
e.printStackTrace();
return Result.failed(StatusCode.USER_COMMON_FAILED);
}
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result<Void> error(Exception e) {
log.error("执行出错", e);
return Result.failed(StatusCode.USER_COMMON_FAILED, e.getMessage());
}
@ExceptionHandler(value = BizException.class)
@ResponseBody
public Result<String> error(BizException e) {
log.info("业务错误:{}", e.getMessage());
StatusCode statusCode = null == e.getCodeEnum() ? StatusCode.USER_COMMON_FAILED : e.getCodeEnum();
return Result.failed(statusCode, e.getMessage());
}
}

@ -1,16 +1,28 @@
package com.luoo.user.controller;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;
import com.luoo.user.annotation.GlobalInterceptor;
import com.luoo.user.annotation.VerifyParam;
import com.luoo.user.constants.Constants;
import com.luoo.user.dto.response.CreateImageCode;
import com.luoo.user.dto.response.UserRespDTO;
import com.luoo.user.enums.VerifyRegexEnum;
import com.luoo.user.pojo.User;
import com.luoo.user.service.UserService;
import com.luoo.user.util.NickNameUtil;
import api.PageResult;
import api.Result;
@ -76,37 +88,89 @@ public class UserController {
}
@ApiOperation(value = "2.登录/注册后返回token")
@PostMapping("/appLogin/{mobile}/{checkcode}")
public Result appLogin(@PathVariable String mobile, @PathVariable String checkcode) {
@PostMapping("/appLogin/{mobile}/{mobileCheckCode}")
@GlobalInterceptor
public Result appLogin( @PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.MOBILE)String mobile,
@PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.MOBILE_CHECK_CODE) String mobileCheckCode
) {
// 得到缓存中的验证码
String checkcodeRedis = (String) redisTemplate.opsForValue().get("checkcode_" + mobile);
if (null == checkcodeRedis || checkcodeRedis.isEmpty()) {
return Result.failed(StatusCode.USER_VERIFICATION_CODE_EXPIRED);
String redisKey=Constants.REDIS_KEY_MOBILE_CHECK_CODE+mobile;
try {
UserRespDTO userRespDTO=new UserRespDTO();
String checkcodeRedis = (String) redisTemplate.opsForValue().get(redisKey);
if (null == checkcodeRedis || checkcodeRedis.isEmpty()) {
return Result.failed(StatusCode.USER_VERIFICATION_CODE_EXPIRED);
}
if (!checkcodeRedis.equals(mobileCheckCode)) {
return Result.failed(StatusCode.USER_VERIFICATION_CODE_MISMATCH);
}
User user = userService.loginOrRegister(mobile);
BeanUtils.copyProperties(user, userRespDTO);
String token = jwtUtil.createJWT(user.getId(),user.getMobile(),"user");
userRespDTO.setToken(token);
return Result.success(userRespDTO);
}finally {
redisTemplate.delete(redisKey);
}
if (!checkcodeRedis.equals(checkcode)) {
return Result.failed(StatusCode.USER_VERIFICATION_CODE_MISMATCH);
}
UserRespDTO userRespDTO = userService.loginOrRegister(mobile);
return Result.success(userRespDTO);
}
@ApiOperation(value = "3.游客登录返回token", notes = "token中的subject和roles均为tourist")
@GetMapping("/touristLogin")
public Result<UserRespDTO> touristLogin() {
UserRespDTO userRespDTO = userService.touristLogin();
return Result.success(userRespDTO);
UserRespDTO userRespDTO=new UserRespDTO();
userRespDTO.setId(String.valueOf(idWorker.nextId()));
userRespDTO.setNickname("游客"+NickNameUtil.getRandomNickName());
String token = jwtUtil.createJWT(userRespDTO.getId(),"tourist","tourist");
userRespDTO.setToken(token);
return Result.success(userRespDTO);
}
/**
*
*/
@ApiOperation(value = "1.发送短信验证码")
@ApiOperation(value = "1.发送短信验证码有效期15分钟")
@PostMapping("/sendsms/{mobile}")
public Result<Void> sendSms(@PathVariable String mobile) {
@GlobalInterceptor
public Result<Void> sendSms(@PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.MOBILE)String mobile) {
userService.sendSms(mobile);
return Result.success();
}
/**
* token
*/
/*
* @ApiOperation(value = "5.token 续期默认token 有效期7天")
*
* @PostMapping("/autoLogin")
*
* @GlobalInterceptor public Result<String>
* autoLogin(@PathVariable @VerifyParam(required=true,max=32) String deviceId,
*
* @PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.MOBILE)String
* mobile) { userService.sendSms(deviceId,mobile); return Result.success(); }
*/
/**
*
*/
@ApiOperation(value = "4.三次短信验证码失败后获取图行验证码有效期10分钟")
@GetMapping("/imageCheckCode/{mobile}")
@GlobalInterceptor
public void imageCheckCode(HttpServletResponse response,
@PathVariable @VerifyParam(required=true,regex=VerifyRegexEnum.MOBILE) String mobile) throws IOException {
CreateImageCode vCode = new CreateImageCode(130,38,5,10);
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setContentType("image/jpeg");
String code=vCode.getCode();
String redisKey=Constants.REDIS_KEY_IMAGE_CHECK_CODE+mobile;
redisTemplate.opsForValue().set(redisKey,code,10,TimeUnit.MINUTES);
vCode.write(response.getOutputStream());
}
@PostMapping("/register/{code}")
public Result regist(@PathVariable String code, @RequestBody User user) {

@ -26,5 +26,4 @@ public interface UserDao extends JpaRepository<User,String>,JpaSpecificationExec
public User findByLoginname(String loginname);
}

@ -1,20 +0,0 @@
package com.luoo.user.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class UserVO {
@ApiModelProperty(value = "ID")
private String id;//ID
@ApiModelProperty(value = "昵称首次注册登录登录用户随机为“雀乐XXX”游客为“游客XXX”",example="雀乐XXX")
private String nickname;//昵称
@ApiModelProperty(value = "性别0为男1 为女首次注册登录默认为0",example="0")
private String sex;//性别
@ApiModelProperty(value = "头像,首次注册登录,默认头像",example="default")
private String avatar;//头像
@ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”",example="无签名")
private String personality;//个性
@ApiModelProperty(value = "TOKEN")
private String token;
}

@ -0,0 +1,139 @@
package com.luoo.user.dto.response;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Random;
import javax.imageio.ImageIO;
public class CreateImageCode {
private int width = 160;
private int height = 40;
private int codeCount = 4;
// 干扰线数
private int lineCount = 20;
// 验证码图片Buffer
private BufferedImage buffImg = null;
// 验证码
private String code = null;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
Random random = new Random();
public CreateImageCode() {
createImage();
}
public CreateImageCode(int width, int height) {
this.width = width;
this.height = height;
createImage();
}
public CreateImageCode(int width, int height, int codeCount) {
this.width = width;
this.height = height;
this.codeCount = codeCount;
createImage();
}
public CreateImageCode(int width, int height, int codeCount, int lineCount) {
this.width = width;
this.height = height;
this.codeCount = codeCount;
this.lineCount = lineCount;
createImage();
}
// 生成图片
private void createImage() {
int fontWidth = width / codeCount;// 字体宽度。
int fontHeight = height - 5;// 字体高度。
int codeY = height - 8;
// 得到图片
buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = buffImg.getGraphics();
// 设置背景色
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
// 设置边框
//g.setColor(getRandColor(200, 250));
//g.drawRect(1, 1, width - 2, height - 2);
// 设置字体
Font font = new Font("Fixedsys", Font.BOLD, fontHeight);
g.setFont(font);
// 设置干扰线
for (int i = 0; i < lineCount; i++) {
int x1 = random.nextInt(width);
int y1 = random.nextInt(height);
int x2 = random.nextInt(width);
int y2 = random.nextInt(height);
g.setColor(getRandColor(1, 255));
g.drawLine(x1, y1, x2, y2);
}
// 添加噪点
float yawpRate = 0.01f;// 噪声率
int area = (int) (yawpRate * width * height);
for (int i = 0; i < area; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
buffImg.setRGB(x, y, random.nextInt(255));
}
String str1 = randomStr(codeCount);// 得到随机字符
this.code = str1;
for (int i = 0; i < codeCount; i++) {
String strRand = str1.substring(i, i + 1);
g.setColor(getRandColor(1, 255));
// g.drawString(a,x,y);
// a为要画出来的东西x和y表示要画的东西最左侧字符的基线位于此图形上下文坐标系的 (x, y) 位置处
g.drawString(strRand, i * fontWidth + 3, codeY);
}
}
// 得到随机字符
private String randomStr(int n) {
String str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
String str2 = "";
int len = str1.length() - 1;
double r;
for (int i = 0; i < n; i++) {
r = (Math.random()) * len;
str2 = str2 + str1.charAt((int) r);
}
return str2;
}
// 得到随机颜色
private Color getRandColor(int fc, int bc) {// 给定范围获得随机颜色
if (fc > 255)
fc = 255;
if (bc > 255)
bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
public void write(OutputStream sos) throws IOException {
ImageIO.write(buffImg, "png", sos);
sos.close();
}
}

@ -8,11 +8,11 @@ public class UserRespDTO {
private String id;//ID
@ApiModelProperty(value = "昵称首次注册登录登录用户随机为“雀乐XXX”游客为“游客XXX”",example="雀乐XXX")
private String nickname;//昵称
@ApiModelProperty(value = "性别0为男1 为女,首次注册登录,默认为0",example="0")
@ApiModelProperty(value = "性别0为男1 为女,首次注册登录,留空不显示",example="0")
private String sex;//性别
@ApiModelProperty(value = "头像,首次注册登录,默认头像",example="default")
@ApiModelProperty(value = "头像,首次注册登录,UI设计默认头像")
private String avatar;//头像
@ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”",example="无签名")
@ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”")
private String personality;//个性
@ApiModelProperty(value = "TOKEN")
private String token;

@ -0,0 +1,24 @@
package com.luoo.user.enums;
public enum VerifyRegexEnum {
NO("", "不校验"),
MOBILE("(1[0-9])\\d{9}$", "手机号码"),
MOBILE_CHECK_CODE("\\d{6}$", "手机短信验证号码"),
PASSWORD("^(?=.*\\d)(?=.*[a-zA-Z])[\\da-zA-Z~!@#$%^&*_]{8,}$", "只能是数字,字母,特殊字符 8-18位");
private String regex;
private String desc;
VerifyRegexEnum(String regex, String desc) {
this.regex = regex;
this.desc = desc;
}
public String getRegex() {
return regex;
}
public String getDesc() {
return desc;
}
}

@ -9,12 +9,17 @@ import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
/**
*
* @author Administrator
*
*/
@Getter
@Setter
@Entity
@Table(name="tb_user")
@EntityListeners(AuditingEntityListener.class)
@ -41,127 +46,6 @@ public class User implements Serializable{
private String personality;//个性
private Integer fanscount;//粉丝数
private Integer followcount;//关注数
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getLoginname() {
return loginname;
}
public void setLoginname(String loginname) {
this.loginname = loginname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public java.util.Date getBirthday() {
return birthday;
}
public void setBirthday(java.util.Date birthday) {
this.birthday = birthday;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public java.util.Date getRegdate() {
return regdate;
}
public void setRegdate(java.util.Date regdate) {
this.regdate = regdate;
}
public java.util.Date getUpdatedate() {
return updatedate;
}
public void setUpdatedate(java.util.Date updatedate) {
this.updatedate = updatedate;
}
public java.util.Date getLastdate() {
return lastdate;
}
public void setLastdate(java.util.Date lastdate) {
this.lastdate = lastdate;
}
public Long getOnline() {
return online;
}
public void setOnline(Long online) {
this.online = online;
}
public String getInterest() {
return interest;
}
public void setInterest(String interest) {
this.interest = interest;
}
public String getPersonality() {
return personality;
}
public void setPersonality(String personality) {
this.personality = personality;
}
public Integer getFanscount() {
return fanscount;
}
public void setFanscount(Integer fanscount) {
this.fanscount = fanscount;
}
public Integer getFollowcount() {
return followcount;
}
public void setFollowcount(Integer followcount) {
this.followcount = followcount;
}
//private String deviceId;//设备id
//private String deviceBrand;//设备品牌
}

@ -24,10 +24,12 @@ import org.springframework.transaction.annotation.Transactional;
import util.IdWorker;
import com.apifan.common.random.RandomSource;
import com.luoo.user.constants.Constants;
import com.luoo.user.dao.UserDao;
import com.luoo.user.dto.response.UserRespDTO;
import com.luoo.user.enumerate.Gender;
import com.luoo.user.pojo.User;
import com.luoo.user.util.NickNameUtil;
import util.JwtUtil;
@ -43,7 +45,7 @@ public class UserService {
@Autowired
private UserDao userDao;
@Autowired
private IdWorker idWorker;
@ -53,7 +55,6 @@ public class UserService {
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private BCryptPasswordEncoder encoder;
@ -63,7 +64,6 @@ public class UserService {
@Autowired
private JwtUtil jwtUtil;
/**
* token
*/
@ -71,22 +71,22 @@ public class UserService {
String userid = (String) request.getAttribute("userid");
String mobile = (String) request.getAttribute("mobile");
System.out.println("用户ID"+userid);
System.out.println("手机号"+mobile);
System.out.println("用户ID" + userid);
System.out.println("手机号" + mobile);
}
/**
*
*
* @return
*/
public List<User> findAll() {
return userDao.findAll();
}
/**
* +
*
* @param whereMap
* @param page
* @param size
@ -94,13 +94,13 @@ public class UserService {
*/
public Page<User> findSearch(Map whereMap, int page, int size) {
Specification<User> specification = createSpecification(whereMap);
PageRequest pageRequest = PageRequest.of(page-1, size);
PageRequest pageRequest = PageRequest.of(page - 1, size);
return userDao.findAll(specification, pageRequest);
}
/**
*
*
* @param whereMap
* @return
*/
@ -111,6 +111,7 @@ public class UserService {
/**
* ID
*
* @param id
* @return
*/
@ -120,13 +121,14 @@ public class UserService {
/**
*
*
* @param user
*/
public void add(User user) {
user.setId( idWorker.nextId()+"" );
user.setFanscount(0); //粉丝数
user.setFollowcount(0); //关注数
user.setOnline(0L); //在线时长
user.setId(idWorker.nextId() + "");
user.setFanscount(0); // 粉丝数
user.setFollowcount(0); // 关注数
user.setOnline(0L); // 在线时长
user.setRegdate(new Date());
user.setUpdatedate(new Date());
user.setLastdate(new Date());
@ -137,6 +139,7 @@ public class UserService {
/**
*
*
* @param user
*/
public void update(User user) {
@ -145,12 +148,13 @@ public class UserService {
/**
*
*
* @param id
*/
public void deleteById(String id) {
String token = (String) request.getAttribute("claims_admin");
if (token==null || "".equals(token)) {
if (token == null || "".equals(token)) {
throw new RuntimeException("权限不足");
}
userDao.deleteById(id);
@ -158,6 +162,7 @@ public class UserService {
/**
*
*
* @param searchMap
* @return
*/
@ -168,127 +173,113 @@ public class UserService {
@Override
public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicateList = new ArrayList<Predicate>();
// ID
if (searchMap.get("id")!=null && !"".equals(searchMap.get("id"))) {
predicateList.add(cb.like(root.get("id").as(String.class), "%"+(String)searchMap.get("id")+"%"));
}
// 手机号码
if (searchMap.get("mobile")!=null && !"".equals(searchMap.get("mobile"))) {
predicateList.add(cb.like(root.get("mobile").as(String.class), "%"+(String)searchMap.get("mobile")+"%"));
}
// 用户名
if (searchMap.get("loginname")!=null && !"".equals(searchMap.get("loginname"))) {
predicateList.add(cb.like(root.get("loginname").as(String.class), "%"+(String)searchMap.get("loginname")+"%"));
}
// 密码
if (searchMap.get("password")!=null && !"".equals(searchMap.get("password"))) {
predicateList.add(cb.like(root.get("password").as(String.class), "%"+(String)searchMap.get("password")+"%"));
}
// 昵称
if (searchMap.get("nickname")!=null && !"".equals(searchMap.get("nickname"))) {
predicateList.add(cb.like(root.get("nickname").as(String.class), "%"+(String)searchMap.get("nickname")+"%"));
}
// 性别
if (searchMap.get("sex")!=null && !"".equals(searchMap.get("sex"))) {
predicateList.add(cb.like(root.get("sex").as(String.class), "%"+(String)searchMap.get("sex")+"%"));
}
// 头像
if (searchMap.get("avatar")!=null && !"".equals(searchMap.get("avatar"))) {
predicateList.add(cb.like(root.get("avatar").as(String.class), "%"+(String)searchMap.get("avatar")+"%"));
}
// E-Mail
if (searchMap.get("email")!=null && !"".equals(searchMap.get("email"))) {
predicateList.add(cb.like(root.get("email").as(String.class), "%"+(String)searchMap.get("email")+"%"));
}
// 兴趣
if (searchMap.get("interest")!=null && !"".equals(searchMap.get("interest"))) {
predicateList.add(cb.like(root.get("interest").as(String.class), "%"+(String)searchMap.get("interest")+"%"));
}
// 个性
if (searchMap.get("personality")!=null && !"".equals(searchMap.get("personality"))) {
predicateList.add(cb.like(root.get("personality").as(String.class), "%"+(String)searchMap.get("personality")+"%"));
}
return cb.and( predicateList.toArray(new Predicate[predicateList.size()]));
// ID
if (searchMap.get("id") != null && !"".equals(searchMap.get("id"))) {
predicateList
.add(cb.like(root.get("id").as(String.class), "%" + (String) searchMap.get("id") + "%"));
}
// 手机号码
if (searchMap.get("mobile") != null && !"".equals(searchMap.get("mobile"))) {
predicateList.add(
cb.like(root.get("mobile").as(String.class), "%" + (String) searchMap.get("mobile") + "%"));
}
// 用户名
if (searchMap.get("loginname") != null && !"".equals(searchMap.get("loginname"))) {
predicateList.add(cb.like(root.get("loginname").as(String.class),
"%" + (String) searchMap.get("loginname") + "%"));
}
// 密码
if (searchMap.get("password") != null && !"".equals(searchMap.get("password"))) {
predicateList.add(cb.like(root.get("password").as(String.class),
"%" + (String) searchMap.get("password") + "%"));
}
// 昵称
if (searchMap.get("nickname") != null && !"".equals(searchMap.get("nickname"))) {
predicateList.add(cb.like(root.get("nickname").as(String.class),
"%" + (String) searchMap.get("nickname") + "%"));
}
// 性别
if (searchMap.get("sex") != null && !"".equals(searchMap.get("sex"))) {
predicateList
.add(cb.like(root.get("sex").as(String.class), "%" + (String) searchMap.get("sex") + "%"));
}
// 头像
if (searchMap.get("avatar") != null && !"".equals(searchMap.get("avatar"))) {
predicateList.add(
cb.like(root.get("avatar").as(String.class), "%" + (String) searchMap.get("avatar") + "%"));
}
// E-Mail
if (searchMap.get("email") != null && !"".equals(searchMap.get("email"))) {
predicateList.add(
cb.like(root.get("email").as(String.class), "%" + (String) searchMap.get("email") + "%"));
}
// 兴趣
if (searchMap.get("interest") != null && !"".equals(searchMap.get("interest"))) {
predicateList.add(cb.like(root.get("interest").as(String.class),
"%" + (String) searchMap.get("interest") + "%"));
}
// 个性
if (searchMap.get("personality") != null && !"".equals(searchMap.get("personality"))) {
predicateList.add(cb.like(root.get("personality").as(String.class),
"%" + (String) searchMap.get("personality") + "%"));
}
return cb.and(predicateList.toArray(new Predicate[predicateList.size()]));
}
};
}
public void sendSms(String mobile) {
public void sendSms(String mobile) {
// 生成6位数字随机数
String checkcode = RandomStringUtils.randomNumeric(6);
// 向缓存中放一份
redisTemplate.opsForValue().set("checkcode_"+mobile,checkcode,6, TimeUnit.HOURS);
String redisKey = Constants.REDIS_KEY_MOBILE_CHECK_CODE + mobile;
redisTemplate.opsForValue().set(redisKey, checkcode, 15, TimeUnit.MINUTES);
// 向用户发一份
Map<String,String> map = new HashMap<>();
map.put("mobile",mobile);
map.put("checkcode",checkcode);
// rabbitTemplate.convertAndSend("sms",map);
Map<String, String> map = new HashMap<>();
map.put("mobile", mobile);
map.put("checkcode", checkcode);
rabbitTemplate.convertAndSend("sms",map);
// 在控制台放一份(方便测试)
System.out.println("验证码是:"+checkcode);
}
System.out.println("验证码是:" + checkcode);
}
public User login(String mobile, String password) {
// User user = userDao.findByLoginname(loginname);
User user = userDao.findByMobile(mobile);
if (user!=null && encoder.matches(password,user.getPassword())) {
if (user != null && encoder.matches(password, user.getPassword())) {
return user;
}
return null;
}
public void updatefanscountandfollowcount(int x, String userid, String friendid) {
userDao.updatefanscount(x,friendid);
userDao.updatefollowcount(x,userid);
}
public UserRespDTO loginOrRegister(String mobile) {
User user = userDao.findByMobile(mobile);
if(null==user) {
user=new User();
user.setId(String.valueOf(idWorker.nextId()));
user.setMobile(mobile);
user.setNickname("雀乐"+getRandomNickName());
user.setSex(Gender.Male.getCode());
user.setAvatar("default");
user.setPersonality("无签名");
userDao.save(user);
}
UserRespDTO userVO=new UserRespDTO();
BeanUtils.copyProperties(user, userVO);
String token = jwtUtil.createJWT(user.getId(),user.getMobile(),"user");
userVO.setToken(token);
return userVO;
}
public User findByMobile(String mobile) {
public void updatefanscountandfollowcount(int x, String userid, String friendid) {
userDao.updatefanscount(x, friendid);
userDao.updatefollowcount(x, userid);
}
public User loginOrRegister(String mobile) {
User user = userDao.findByMobile(mobile);
if (null == user) {
user = new User();
user.setId(String.valueOf(idWorker.nextId()));
user.setMobile(mobile);
user.setNickname("雀乐" + NickNameUtil.getRandomNickName());
userDao.save(user);
} else {
user.setLastdate(new Date());
userDao.save(user);
}
return user;
}
public UserRespDTO touristLogin() {
UserRespDTO userVO=new UserRespDTO();
userVO.setId(String.valueOf(idWorker.nextId()));
userVO.setNickname("游客"+getRandomNickName());
userVO.setSex(Gender.Male.getCode());
userVO.setAvatar("default");
userVO.setPersonality("无签名");
String token = jwtUtil.createJWT(userVO.getId(),"tourist","tourist");
userVO.setToken(token);
return userVO;
}
private String getRandomNickName() {
String rawNickName=RandomSource.personInfoSource().randomChineseNickName(3);
if(rawNickName.length()>3) {
return rawNickName.substring(0, 3);
}
return rawNickName;
public User findByMobile(String mobile) {
User user = userDao.findByMobile(mobile);
return user;
}
}

@ -0,0 +1,13 @@
package com.luoo.user.util;
import com.apifan.common.random.RandomSource;
public class NickNameUtil {
public static String getRandomNickName() {
String rawNickName=RandomSource.personInfoSource().randomChineseNickName(3);
if(rawNickName.length()>3) {
return rawNickName.substring(0, 3);
}
return rawNickName;
}
}

@ -0,0 +1,14 @@
package com.luoo.user.util;
public class StringTools {
public static boolean isEmpty(String str) {
if (null == str || "".equals(str) || "null".equals(str) || "\u0000".equals(str)) {
return true;
} else if ("".equals(str.trim())) {
return true;
}
return false;
}
}

@ -0,0 +1,29 @@
package com.luoo.user.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.luoo.user.enums.VerifyRegexEnum;
/**
* @ClassName VerifyUtils
* @Description TODO
* @Author Administrator
* @Date 2023/8/30 21:59
*/
public class VerifyUtils {
public static boolean verify(String regex,String value){
if(StringTools.isEmpty(value)){
return false;
}
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(value);
return matcher.matches();
}
public static boolean verify(VerifyRegexEnum regexEnum,String value){
return verify(regexEnum.getRegex(),value);
}
}

@ -50,19 +50,31 @@
<artifactId>swagger-bootstrap-ui</artifactId>
</dependency>
</dependencies>
<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- docker的maven插件官网 https://github.com/spotify/docker-maven-plugin -->
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<configuration>
<imageName>116.62.145.60:5000/${project.artifactId}:${project.version}</imageName>
<baseImage>jdk1.8</baseImage>
<entryPoint>["java", "-jar","/${project.build.finalName}.jar"]</entryPoint>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<dockerHost>http://116.62.145.60:2375</dockerHost>
</configuration>
</plugin>
</plugins>
</build>

@ -21,6 +21,7 @@
<module>luoo_sms</module>
<module>luoo_config</module>
<module>luoo_tag</module>
<module>luoo_cms</module>
</modules>
<packaging>pom</packaging>
<name>luoo_parent</name>

Loading…
Cancel
Save