Commit 8c4fd97e authored by 郑杰's avatar 郑杰
Browse files

v1.5 beta版发布,详细查看发行版说明

parent b066bb99
package me.zhengjie.tools.domain;
package me.zhengjie.domain;
import lombok.Data;
import javax.persistence.*;
......@@ -23,12 +23,14 @@ public class QiniuConfig implements Serializable {
* 一个账号最多拥有两对密钥(Access/Secret Key)
*/
@NotBlank
@Column(name = "access_key", columnDefinition = "text")
private String accessKey;
/**
* 一个账号最多拥有两对密钥(Access/Secret Key)
*/
@NotBlank
@Column(name = "secret_key", columnDefinition = "text")
private String secretKey;
/**
......
package me.zhengjie.tools.domain;
package me.zhengjie.domain;
import lombok.Data;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
......@@ -50,5 +51,6 @@ public class QiniuContent implements Serializable {
* 更新时间
*/
@UpdateTimestamp
@Column(name = "update_time")
private Timestamp updateTime;
}
package me.zhengjie.system.domain;
package me.zhengjie.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -53,6 +53,7 @@ public class VerificationCode {
* 创建日期
*/
@CreationTimestamp
@Column(name = "create_time")
private Timestamp createTime;
public VerificationCode(String code, String scenes, @NotBlank String type, @NotBlank String value) {
......
package me.zhengjie.tools.domain.vo;
package me.zhengjie.domain.vo;
import lombok.AllArgsConstructor;
import lombok.Data;
......@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;
/**
......
package me.zhengjie.tools.domain.vo;
package me.zhengjie.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package me.zhengjie.tools.repository;
package me.zhengjie.repository;
import me.zhengjie.tools.domain.AlipayConfig;
import me.zhengjie.domain.AlipayConfig;
import org.springframework.data.jpa.repository.JpaRepository;
/**
......
package me.zhengjie.tools.repository;
package me.zhengjie.repository;
import me.zhengjie.tools.domain.EmailConfig;
import me.zhengjie.domain.EmailConfig;
import org.springframework.data.jpa.repository.JpaRepository;
/**
......
package me.zhengjie.tools.repository;
package me.zhengjie.repository;
import me.zhengjie.tools.domain.Picture;
import me.zhengjie.domain.Picture;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package me.zhengjie.tools.repository;
package me.zhengjie.repository;
import me.zhengjie.tools.domain.QiniuConfig;
import me.zhengjie.domain.QiniuConfig;
import org.springframework.data.jpa.repository.JpaRepository;
/**
......
package me.zhengjie.tools.repository;
package me.zhengjie.repository;
import me.zhengjie.tools.domain.QiniuContent;
import me.zhengjie.domain.QiniuContent;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
......
package me.zhengjie.system.repository;
package me.zhengjie.repository;
import me.zhengjie.system.domain.VerificationCode;
import me.zhengjie.domain.VerificationCode;
import org.springframework.data.jpa.repository.JpaRepository;
/**
......@@ -16,5 +16,5 @@ public interface VerificationCodeRepository extends JpaRepository<VerificationCo
* @param value
* @return
*/
VerificationCode findByScenesAndTypeAndValueAndStatusIsTrue(String scenes,String type,String value);
VerificationCode findByScenesAndTypeAndValueAndStatusIsTrue(String scenes, String type, String value);
}
package me.zhengjie.tools.rest;
package me.zhengjie.rest;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.common.aop.log.Log;
import me.zhengjie.tools.domain.AlipayConfig;
import me.zhengjie.tools.domain.vo.TradeVo;
import me.zhengjie.tools.service.AlipayService;
import me.zhengjie.tools.util.AliPayStatusEnum;
import me.zhengjie.tools.util.AlipayUtils;
import me.zhengjie.aop.log.Log;
import me.zhengjie.domain.AlipayConfig;
import me.zhengjie.domain.vo.TradeVo;
import me.zhengjie.service.AlipayService;
import me.zhengjie.util.AliPayStatusEnum;
import me.zhengjie.util.AlipayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -38,7 +38,7 @@ public class AliPayController {
return new ResponseEntity(alipayService.find(),HttpStatus.OK);
}
@Log(description = "配置支付宝")
@Log("配置支付宝")
@PutMapping(value = "/aliPay")
public ResponseEntity payConfig(@Validated @RequestBody AlipayConfig alipayConfig){
alipayConfig.setId(1L);
......@@ -46,7 +46,7 @@ public class AliPayController {
return new ResponseEntity(HttpStatus.OK);
}
@Log(description = "支付宝PC网页支付")
@Log("支付宝PC网页支付")
@ApiOperation(value = "PC网页支付")
@PostMapping(value = "/aliPay/toPayAsPC")
public ResponseEntity toPayAsPC(@Validated@RequestBody TradeVo trade) throws Exception{
......@@ -57,7 +57,7 @@ public class AliPayController {
return ResponseEntity.ok(payUrl);
}
@Log(description = "支付宝手机网页支付")
@Log("支付宝手机网页支付")
@ApiOperation(value = "手机网页支付")
@PostMapping(value = "/aliPay/toPayAsWeb")
public ResponseEntity toPayAsWeb(@Validated @RequestBody TradeVo trade) throws Exception{
......
package me.zhengjie.tools.rest;
package me.zhengjie.rest;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.common.aop.log.Log;
import me.zhengjie.tools.domain.EmailConfig;
import me.zhengjie.tools.domain.vo.EmailVo;
import me.zhengjie.tools.service.EmailService;
import me.zhengjie.aop.log.Log;
import me.zhengjie.domain.EmailConfig;
import me.zhengjie.domain.vo.EmailVo;
import me.zhengjie.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -30,14 +29,14 @@ public class EmailController {
return new ResponseEntity(emailService.find(),HttpStatus.OK);
}
@Log(description = "配置邮件")
@Log("配置邮件")
@PutMapping(value = "/email")
public ResponseEntity emailConfig(@Validated @RequestBody EmailConfig emailConfig){
emailService.update(emailConfig,emailService.find());
return new ResponseEntity(HttpStatus.OK);
}
@Log(description = "发送邮件")
@Log("发送邮件")
@PostMapping(value = "/email")
public ResponseEntity send(@Validated @RequestBody EmailVo emailVo) throws Exception {
log.warn("REST request to send Email : {}" +emailVo);
......
package me.zhengjie.tools.rest;
package me.zhengjie.rest;
import me.zhengjie.common.aop.log.Log;
import me.zhengjie.common.utils.RequestHolder;
import me.zhengjie.core.utils.JwtTokenUtil;
import me.zhengjie.tools.domain.Picture;
import me.zhengjie.tools.service.PictureService;
import me.zhengjie.tools.service.query.PictureQueryService;
import me.zhengjie.aop.log.Log;
import me.zhengjie.domain.Picture;
import me.zhengjie.service.PictureService;
import me.zhengjie.service.query.PictureQueryService;
import me.zhengjie.utils.SecurityContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
......@@ -30,10 +30,7 @@ public class PictureController {
@Autowired
private PictureQueryService pictureQueryService;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Log(description = "查询图片")
@Log("查询图片")
@PreAuthorize("hasAnyRole('ADMIN','PICTURE_ALL','PICTURE_SELECT')")
@GetMapping(value = "/pictures")
public ResponseEntity getRoles(Picture resources, Pageable pageable){
......@@ -46,11 +43,12 @@ public class PictureController {
* @return
* @throws Exception
*/
@Log(description = "上传图片")
@Log("上传图片")
@PreAuthorize("hasAnyRole('ADMIN','PICTURE_ALL','PICTURE_UPLOAD')")
@PostMapping(value = "/pictures")
public ResponseEntity upload(@RequestParam MultipartFile file){
String userName = jwtTokenUtil.getUserName(RequestHolder.getHttpServletRequest());
UserDetails userDetails = SecurityContextHolder.getUserDetails();
String userName = userDetails.getUsername();
Picture picture = pictureService.upload(file,userName);
Map map = new HashMap();
map.put("errno",0);
......@@ -64,7 +62,7 @@ public class PictureController {
* @param id
* @return
*/
@Log(description = "删除图片")
@Log("删除图片")
@PreAuthorize("hasAnyRole('ADMIN','PICTURE_ALL','PICTURE_DELETE')")
@DeleteMapping(value = "/pictures/{id}")
public ResponseEntity delete(@PathVariable Long id) {
......
package me.zhengjie.tools.rest;
package me.zhengjie.rest;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.common.aop.log.Log;
import me.zhengjie.tools.domain.QiniuConfig;
import me.zhengjie.tools.domain.QiniuContent;
import me.zhengjie.tools.service.QiNiuService;
import me.zhengjie.tools.service.query.QiNiuQueryService;
import me.zhengjie.aop.log.Log;
import me.zhengjie.domain.QiniuConfig;
import me.zhengjie.domain.QiniuContent;
import me.zhengjie.service.QiNiuService;
import me.zhengjie.service.query.QiNiuQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
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 org.springframework.web.multipart.MultipartFile;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
......@@ -40,14 +37,14 @@ public class QiniuController {
return new ResponseEntity(qiNiuService.find(), HttpStatus.OK);
}
@Log(description = "配置七牛云存储")
@Log("配置七牛云存储")
@PutMapping(value = "/qiNiuConfig")
public ResponseEntity emailConfig(@Validated @RequestBody QiniuConfig qiniuConfig){
qiNiuService.update(qiniuConfig);
return new ResponseEntity(HttpStatus.OK);
}
@Log(description = "查询文件")
@Log("查询文件")
@GetMapping(value = "/qiNiuContent")
public ResponseEntity getRoles(QiniuContent resources, Pageable pageable){
return new ResponseEntity(qiNiuQueryService.queryAll(resources,pageable),HttpStatus.OK);
......@@ -58,7 +55,7 @@ public class QiniuController {
* @param file
* @return
*/
@Log(description ="上传文件")
@Log("上传文件")
@PostMapping(value = "/qiNiuContent")
public ResponseEntity upload(@RequestParam MultipartFile file){
QiniuContent qiniuContent = qiNiuService.upload(file,qiNiuService.find());
......@@ -73,7 +70,7 @@ public class QiniuController {
* 同步七牛云数据到数据库
* @return
*/
@Log(description ="同步七牛云数据")
@Log("同步七牛云数据")
@PostMapping(value = "/qiNiuContent/synchronize")
public ResponseEntity synchronize(){
log.warn("REST request to synchronize qiNiu : {}");
......@@ -87,7 +84,7 @@ public class QiniuController {
* @return
* @throws Exception
*/
@Log(description ="下载文件")
@Log("下载文件")
@GetMapping(value = "/qiNiuContent/download/{id}")
public ResponseEntity download(@PathVariable Long id){
return new ResponseEntity(qiNiuService.download(qiNiuService.findByContentId(id),qiNiuService.find()),HttpStatus.OK);
......@@ -99,7 +96,7 @@ public class QiniuController {
* @return
* @throws Exception
*/
@Log(description ="删除文件")
@Log("删除文件")
@DeleteMapping(value = "/qiNiuContent/{id}")
public ResponseEntity delete(@PathVariable Long id){
qiNiuService.delete(qiNiuService.findByContentId(id),qiNiuService.find());
......
package me.zhengjie.system.rest;
package me.zhengjie.rest;
import me.zhengjie.common.utils.ElAdminConstant;
import me.zhengjie.common.utils.RequestHolder;
import me.zhengjie.core.security.JwtUser;
import me.zhengjie.core.utils.JwtTokenUtil;
import me.zhengjie.system.domain.VerificationCode;
import me.zhengjie.system.service.VerificationCodeService;
import me.zhengjie.tools.domain.vo.EmailVo;
import me.zhengjie.tools.service.EmailService;
import me.zhengjie.domain.VerificationCode;
import me.zhengjie.domain.vo.EmailVo;
import me.zhengjie.service.EmailService;
import me.zhengjie.service.VerificationCodeService;
import me.zhengjie.utils.ElAdminConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpStatus;
......@@ -26,9 +23,6 @@ public class VerificationCodeController {
@Autowired
private VerificationCodeService verificationCodeService;
@Autowired
private JwtTokenUtil jwtTokenUtil;
@Autowired
@Qualifier("jwtUserDetailsService")
private UserDetailsService userDetailsService;
......@@ -45,11 +39,10 @@ public class VerificationCodeController {
}
@PostMapping(value = "/code/email/resetPass")
public ResponseEntity resetPass() throws Exception {
JwtUser jwtUser = (JwtUser)userDetailsService.loadUserByUsername(jwtTokenUtil.getUserName(RequestHolder.getHttpServletRequest()));
public ResponseEntity resetPass(@RequestParam String email) throws Exception {
VerificationCode code = new VerificationCode();
code.setType("email");
code.setValue(jwtUser.getEmail());
code.setValue(email);
code.setScenes(ElAdminConstant.RESET_MAIL);
EmailVo emailVo = verificationCodeService.sendEmail(code);
emailService.send(emailVo,emailService.find());
......
package me.zhengjie.tools.service;
package me.zhengjie.service;
import me.zhengjie.tools.domain.AlipayConfig;
import me.zhengjie.tools.domain.vo.TradeVo;
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;
......
package me.zhengjie.tools.service;
package me.zhengjie.service;
import me.zhengjie.tools.domain.EmailConfig;
import me.zhengjie.tools.domain.vo.EmailVo;
import me.zhengjie.domain.EmailConfig;
import me.zhengjie.domain.vo.EmailVo;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
......
package me.zhengjie.tools.service;
package me.zhengjie.service;
import me.zhengjie.tools.domain.Picture;
import me.zhengjie.domain.Picture;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
......
package me.zhengjie.tools.service;
package me.zhengjie.service;
import me.zhengjie.tools.domain.QiniuConfig;
import me.zhengjie.tools.domain.QiniuContent;
import me.zhengjie.domain.QiniuConfig;
import me.zhengjie.domain.QiniuContent;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.multipart.MultipartFile;
import java.io.UnsupportedEncodingException;
/**
* @author jie
......
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