Commit 7c35a79c authored by ZhengJie's avatar ZhengJie
Browse files

[新增功能](el-admin v2.5): v2.5 beta

详情 https://www.ydyno.com/archives/1225.html
parent d35ffc9d
package me.zhengjie.service;
import me.zhengjie.domain.VerificationCode;
import me.zhengjie.domain.vo.EmailVo;
/**
* @author Zheng Jie
* @date 2018-12-26
*/
public interface VerificationCodeService {
/**
* 发送邮件验证码
* @param code 验证码
* @return EmailVo
*/
EmailVo sendEmail(VerificationCode code);
/**
* 验证
* @param code 验证码
*/
void validated(VerificationCode code);
}
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.dto; package me.zhengjie.service.dto;
import lombok.Data; import lombok.Getter;
import lombok.Setter;
import me.zhengjie.base.BaseDTO;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
/** /**
* @author Zheng Jie * @author Zheng Jie
* @date 2019-09-05 * @date 2019-09-05
*/ */
@Data @Getter
public class LocalStorageDto implements Serializable { @Setter
public class LocalStorageDto extends BaseDTO implements Serializable {
private Long id; private Long id;
...@@ -22,8 +39,4 @@ public class LocalStorageDto implements Serializable { ...@@ -22,8 +39,4 @@ public class LocalStorageDto implements Serializable {
private String type; private String type;
private String size; private String size;
private String operate;
private Timestamp createTime;
} }
\ No newline at end of file
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.dto; package me.zhengjie.service.dto;
import lombok.Data; import lombok.Data;
...@@ -13,7 +28,7 @@ import me.zhengjie.annotation.Query; ...@@ -13,7 +28,7 @@ import me.zhengjie.annotation.Query;
@Data @Data
public class LocalStorageQueryCriteria{ public class LocalStorageQueryCriteria{
@Query(blurry = "name,suffix,type,operate,size") @Query(blurry = "name,suffix,type,createBy,size")
private String blurry; private String blurry;
@Query(type = Query.Type.BETWEEN) @Query(type = Query.Type.BETWEEN)
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.dto; package me.zhengjie.service.dto;
import lombok.Data; import lombok.Data;
import me.zhengjie.annotation.Query; import me.zhengjie.annotation.Query;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.dto; package me.zhengjie.service.dto;
import lombok.Data; import lombok.Data;
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.impl; package me.zhengjie.service.impl;
import com.alipay.api.AlipayClient; import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient; import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradePagePayRequest; import com.alipay.api.request.AlipayTradePagePayRequest;
import com.alipay.api.request.AlipayTradeWapPayRequest; import com.alipay.api.request.AlipayTradeWapPayRequest;
import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.vo.TradeVo; import me.zhengjie.domain.vo.TradeVo;
import me.zhengjie.domain.AlipayConfig; import me.zhengjie.domain.AlipayConfig;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
...@@ -22,6 +38,7 @@ import java.util.Optional; ...@@ -22,6 +38,7 @@ import java.util.Optional;
* @date 2018-12-31 * @date 2018-12-31
*/ */
@Service @Service
@RequiredArgsConstructor
@CacheConfig(cacheNames = "alipay") @CacheConfig(cacheNames = "alipay")
@SuppressWarnings("all") @SuppressWarnings("all")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
...@@ -29,10 +46,6 @@ public class AliPayServiceImpl implements AliPayService { ...@@ -29,10 +46,6 @@ public class AliPayServiceImpl implements AliPayService {
private final AliPayRepository alipayRepository; private final AliPayRepository alipayRepository;
public AliPayServiceImpl(AliPayRepository alipayRepository) {
this.alipayRepository = alipayRepository;
}
@Override @Override
public String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception { public String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception {
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.impl; package me.zhengjie.service.impl;
import cn.hutool.extra.mail.Mail; import cn.hutool.extra.mail.Mail;
import cn.hutool.extra.mail.MailAccount; import cn.hutool.extra.mail.MailAccount;
import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.EmailConfig; import me.zhengjie.domain.EmailConfig;
import me.zhengjie.domain.vo.EmailVo; import me.zhengjie.domain.vo.EmailVo;
import me.zhengjie.exception.BadRequestException; import me.zhengjie.exception.BadRequestException;
...@@ -21,16 +37,13 @@ import java.util.Optional; ...@@ -21,16 +37,13 @@ import java.util.Optional;
* @date 2018-12-26 * @date 2018-12-26
*/ */
@Service @Service
@RequiredArgsConstructor
@CacheConfig(cacheNames = "email") @CacheConfig(cacheNames = "email")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class EmailServiceImpl implements EmailService { public class EmailServiceImpl implements EmailService {
private final EmailRepository emailRepository; private final EmailRepository emailRepository;
public EmailServiceImpl(EmailRepository emailRepository) {
this.emailRepository = emailRepository;
}
@Override @Override
@CachePut(key = "'1'") @CachePut(key = "'1'")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.impl; package me.zhengjie.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import lombok.RequiredArgsConstructor;
import me.zhengjie.config.FileProperties; import me.zhengjie.config.FileProperties;
import me.zhengjie.domain.LocalStorage; import me.zhengjie.domain.LocalStorage;
import me.zhengjie.service.dto.LocalStorageDto; import me.zhengjie.service.dto.LocalStorageDto;
...@@ -22,11 +38,9 @@ import java.util.ArrayList; ...@@ -22,11 +38,9 @@ import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
/** /**
...@@ -34,21 +48,15 @@ import javax.servlet.http.HttpServletResponse; ...@@ -34,21 +48,15 @@ import javax.servlet.http.HttpServletResponse;
* @date 2019-09-05 * @date 2019-09-05
*/ */
@Service @Service
@RequiredArgsConstructor
@CacheConfig(cacheNames = "localStorage") @CacheConfig(cacheNames = "localStorage")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class LocalStorageServiceImpl implements LocalStorageService { public class LocalStorageServiceImpl implements LocalStorageService {
private final LocalStorageRepository localStorageRepository; private final LocalStorageRepository localStorageRepository;
private final LocalStorageMapper localStorageMapper; private final LocalStorageMapper localStorageMapper;
private final FileProperties properties; private final FileProperties properties;
public LocalStorageServiceImpl(LocalStorageRepository localStorageRepository, LocalStorageMapper localStorageMapper, FileProperties properties) {
this.localStorageRepository = localStorageRepository;
this.localStorageMapper = localStorageMapper;
this.properties = properties;
}
@Override @Override
@Cacheable @Cacheable
...@@ -90,8 +98,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { ...@@ -90,8 +98,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
suffix, suffix,
file.getPath(), file.getPath(),
type, type,
FileUtil.getSize(multipartFile.getSize()), FileUtil.getSize(multipartFile.getSize())
SecurityUtils.getCurrentUsername()
); );
return localStorageMapper.toDto(localStorageRepository.save(localStorage)); return localStorageMapper.toDto(localStorageRepository.save(localStorage));
}catch (Exception e){ }catch (Exception e){
...@@ -130,7 +137,7 @@ public class LocalStorageServiceImpl implements LocalStorageService { ...@@ -130,7 +137,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
map.put("备注名", localStorageDTO.getName()); map.put("备注名", localStorageDTO.getName());
map.put("文件类型", localStorageDTO.getType()); map.put("文件类型", localStorageDTO.getType());
map.put("文件大小", localStorageDTO.getSize()); map.put("文件大小", localStorageDTO.getSize());
map.put("操作人", localStorageDTO.getOperate()); map.put("创建者", localStorageDTO.getCreateBy());
map.put("创建日期", localStorageDTO.getCreateTime()); map.put("创建日期", localStorageDTO.getCreateTime());
list.add(map); list.add(map);
} }
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.impl; package me.zhengjie.service.impl;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
...@@ -5,6 +20,7 @@ import cn.hutool.http.HttpUtil; ...@@ -5,6 +20,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.zhengjie.domain.Picture; import me.zhengjie.domain.Picture;
import me.zhengjie.repository.PictureRepository; import me.zhengjie.repository.PictureRepository;
...@@ -29,6 +45,7 @@ import java.util.*; ...@@ -29,6 +45,7 @@ import java.util.*;
* @date 2018-12-27 * @date 2018-12-27
*/ */
@Slf4j @Slf4j
@RequiredArgsConstructor
@Service(value = "pictureService") @Service(value = "pictureService")
@CacheConfig(cacheNames = "picture") @CacheConfig(cacheNames = "picture")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
...@@ -36,19 +53,11 @@ public class PictureServiceImpl implements PictureService { ...@@ -36,19 +53,11 @@ public class PictureServiceImpl implements PictureService {
@Value("${smms.token}") @Value("${smms.token}")
private String token; private String token;
private final PictureRepository pictureRepository; private final PictureRepository pictureRepository;
private static final String SUCCESS = "success"; private static final String SUCCESS = "success";
private static final String CODE = "code"; private static final String CODE = "code";
private static final String MSG = "message"; private static final String MSG = "message";
public PictureServiceImpl(PictureRepository pictureRepository) {
this.pictureRepository = pictureRepository;
}
@Override @Override
public Object queryAll(PictureQueryCriteria criteria, Pageable pageable){ public Object queryAll(PictureQueryCriteria criteria, Pageable pageable){
return PageUtil.toPage(pictureRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable)); return PageUtil.toPage(pictureRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.impl; package me.zhengjie.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -9,6 +24,7 @@ import com.qiniu.storage.UploadManager; ...@@ -9,6 +24,7 @@ import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet; import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.storage.model.FileInfo; import com.qiniu.storage.model.FileInfo;
import com.qiniu.util.Auth; import com.qiniu.util.Auth;
import lombok.RequiredArgsConstructor;
import me.zhengjie.domain.QiniuConfig; import me.zhengjie.domain.QiniuConfig;
import me.zhengjie.domain.QiniuContent; import me.zhengjie.domain.QiniuContent;
import me.zhengjie.repository.QiniuContentRepository; import me.zhengjie.repository.QiniuContentRepository;
...@@ -40,19 +56,14 @@ import java.util.*; ...@@ -40,19 +56,14 @@ import java.util.*;
* @date 2018-12-31 * @date 2018-12-31
*/ */
@Service @Service
@RequiredArgsConstructor
@CacheConfig(cacheNames = "qiNiu") @CacheConfig(cacheNames = "qiNiu")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class QiNiuServiceImpl implements QiNiuService { public class QiNiuServiceImpl implements QiNiuService {
private final QiNiuConfigRepository qiNiuConfigRepository; private final QiNiuConfigRepository qiNiuConfigRepository;
private final QiniuContentRepository qiniuContentRepository; private final QiniuContentRepository qiniuContentRepository;
public QiNiuServiceImpl(QiNiuConfigRepository qiNiuConfigRepository, QiniuContentRepository qiniuContentRepository) {
this.qiNiuConfigRepository = qiNiuConfigRepository;
this.qiniuContentRepository = qiniuContentRepository;
}
@Value("${qiniu.max-size}") @Value("${qiniu.max-size}")
private Long maxSize; private Long maxSize;
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.service.mapper; package me.zhengjie.service.mapper;
import me.zhengjie.base.BaseMapper; import me.zhengjie.base.BaseMapper;
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.utils; package me.zhengjie.utils;
/** /**
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.utils; package me.zhengjie.utils;
import com.alipay.api.AlipayApiException; import com.alipay.api.AlipayApiException;
......
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package me.zhengjie.utils; package me.zhengjie.utils;
import com.qiniu.storage.Region; import com.qiniu.storage.Region;
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
<module>eladmin-logging</module> <module>eladmin-logging</module>
<module>eladmin-system</module> <module>eladmin-system</module>
<module>eladmin-tools</module> <module>eladmin-tools</module>
<module>eladmin-monitor</module>
<module>eladmin-generator</module> <module>eladmin-generator</module>
</modules> </modules>
......
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