Commit 0c738b1e authored by dqjdda's avatar dqjdda
Browse files

代码优化,获取Ip优化

parent f26342ee
......@@ -4,12 +4,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Objects;
import java.util.Set;
......
......@@ -34,7 +34,7 @@ public class User extends BaseEntity {
private UserAvatar userAvatar;
@NotBlank
@Pattern(regexp = "([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}",message = "格式错误")
@Pattern(regexp = "([a-z0-9A-Z]+[-|.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}",message = "格式错误")
private String email;
@NotBlank
......
package me.zhengjie.modules.system.domain;
import cn.hutool.core.util.ObjectUtil;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import me.zhengjie.base.BaseEntity;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* @author Zheng Jie
......
......@@ -7,7 +7,6 @@ import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.Dict;
import me.zhengjie.modules.system.service.DictService;
import me.zhengjie.modules.system.service.dto.DictQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......
......@@ -7,7 +7,6 @@ import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.system.domain.DictDetail;
import me.zhengjie.modules.system.service.DictDetailService;
import me.zhengjie.modules.system.service.dto.DictDetailQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
......@@ -16,11 +15,8 @@ import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author Zheng Jie
......@@ -43,8 +39,7 @@ public class DictDetailController {
@ApiOperation("查询字典详情")
@GetMapping
public ResponseEntity getDictDetails(DictDetailQueryCriteria criteria,
@PageableDefault(value = 10, sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){
String[] names = criteria.getDictName().split(",");
@PageableDefault(sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){
return new ResponseEntity<>(dictDetailService.queryAll(criteria,pageable),HttpStatus.OK);
}
......@@ -52,7 +47,7 @@ public class DictDetailController {
@ApiOperation("查询多个字典详情")
@GetMapping(value = "/map")
public ResponseEntity getDictDetailMaps(DictDetailQueryCriteria criteria,
@PageableDefault(value = 10, sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){
@PageableDefault(sort = {"sort"}, direction = Sort.Direction.ASC) Pageable pageable){
String[] names = criteria.getDictName().split(",");
Map<String,Object> map = new HashMap<>(names.length);
for (String name : names) {
......
......@@ -9,7 +9,6 @@ import me.zhengjie.modules.system.domain.Job;
import me.zhengjie.modules.system.service.JobService;
import me.zhengjie.modules.system.service.dto.JobQueryCriteria;
import me.zhengjie.utils.ThrowableUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -17,8 +16,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Set;
/**
* @author Zheng Jie
* @date 2019-03-29
......
......@@ -28,6 +28,7 @@ import java.util.Set;
@Api(tags = "系统:菜单管理")
@RestController
@RequestMapping("/api/menus")
@SuppressWarnings("unchecked")
public class MenuController {
private final MenuService menuService;
......@@ -49,7 +50,8 @@ public class MenuController {
public ResponseEntity buildMenus(){
UserDTO user = userService.findByName(SecurityUtils.getUsername());
List<MenuDTO> menuDTOList = menuService.findByRoles(roleService.findByUsers_Id(user.getId()));
return new ResponseEntity<>(menuService.buildMenus((List<MenuDTO>) menuService.buildTree(menuDTOList).get("content")),HttpStatus.OK);
List<MenuDTO> menuDTOS = (List<MenuDTO>) menuService.buildTree(menuDTOList).get("content");
return new ResponseEntity<>(menuService.buildMenus(menuDTOS),HttpStatus.OK);
}
@ApiOperation("返回全部的菜单")
......
package me.zhengjie.modules.system.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Set;
/**
* @author Zheng Jie
......
......@@ -17,9 +17,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Map;
import java.util.Optional;
/**
* @author Zheng Jie
......
......@@ -22,7 +22,7 @@ public class QiniuContent implements Serializable {
private Long id;
// 文件名
@Column(name = "name",unique = false)
@Column(name = "name")
private String key;
// 空间名
......
......@@ -10,7 +10,5 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
*/
public interface PictureRepository extends JpaRepository<Picture,Long>, JpaSpecificationExecutor<Picture> {
Picture findByUrl(String url);
Picture findByMd5Code(String code);
}
......@@ -12,9 +12,9 @@ public interface VerificationCodeRepository extends JpaRepository<VerificationCo
/**
* 获取有效的验证码
* @param scenes 业务场景,如重置密码,重置邮箱等等
* @param type
* @param value
* @return
* @param type 类型
* @param value
* @return VerificationCode
*/
VerificationCode findByScenesAndTypeAndValueAndStatusIsTrue(String scenes, String type, String value);
}
......@@ -2,9 +2,6 @@ package me.zhengjie.service;
import me.zhengjie.domain.AlipayConfig;
import me.zhengjie.domain.vo.TradeVo;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
/**
* @author Zheng Jie
......
......@@ -28,7 +28,7 @@ public interface EmailService {
* 发送邮件
* @param emailVo 邮件发送的内容
* @param emailConfig 邮件配置
* @throws Exception
* @throws Exception /
*/
@Async
void send(EmailVo emailVo, EmailConfig emailConfig) throws Exception;
......
......@@ -10,7 +10,7 @@ import org.mapstruct.ReportingPolicy;
* @author Zheng Jie
* @date 2019-09-05
*/
@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE)
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface LocalStorageMapper extends BaseMapper<LocalStorageDTO, LocalStorage> {
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment