mirror of https://github.com/elunez/eladmin
parent
3095f3730e
commit
3f7c8332da
|
@ -140,7 +140,9 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||||
File dest = new File(path).getCanonicalFile();
|
File dest = new File(path).getCanonicalFile();
|
||||||
// 检测是否存在目录
|
// 检测是否存在目录
|
||||||
if (!dest.getParentFile().exists()) {
|
if (!dest.getParentFile().exists()) {
|
||||||
dest.getParentFile().mkdirs();
|
if (!dest.getParentFile().mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 文件写入
|
// 文件写入
|
||||||
file.transferTo(dest);
|
file.transferTo(dest);
|
||||||
|
@ -220,7 +222,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
|
||||||
try {
|
try {
|
||||||
InputStream in = new FileInputStream(file);
|
InputStream in = new FileInputStream(file);
|
||||||
try {
|
try {
|
||||||
in.read(b);
|
System.out.println(in.read(b));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,13 @@ public class ZipUtils {
|
||||||
System.out.println("file unzip : " + newFile.getAbsoluteFile());
|
System.out.println("file unzip : " + newFile.getAbsoluteFile());
|
||||||
//大部分网络上的源码,这里没有判断子目录
|
//大部分网络上的源码,这里没有判断子目录
|
||||||
if (ze.isDirectory()) {
|
if (ze.isDirectory()) {
|
||||||
newFile.mkdirs();
|
if (!newFile.mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
new File(newFile.getParent()).mkdirs();
|
if (!new File(newFile.getParent()).mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
FileOutputStream fos = new FileOutputStream(newFile);
|
FileOutputStream fos = new FileOutputStream(newFile);
|
||||||
int len;
|
int len;
|
||||||
while ((len = zis.read(buffer)) != -1) {
|
while ((len = zis.read(buffer)) != -1) {
|
||||||
|
@ -80,12 +84,16 @@ public class ZipUtils {
|
||||||
File file = new File(out, entry.getName());
|
File file = new File(out, entry.getName());
|
||||||
|
|
||||||
if (entry.isDirectory()) {
|
if (entry.isDirectory()) {
|
||||||
file.mkdirs();
|
if (!file.mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
File parent = file.getParentFile();
|
File parent = file.getParentFile();
|
||||||
|
|
||||||
if (!parent.exists()) {
|
if (!parent.exists()) {
|
||||||
parent.mkdirs();
|
if (!parent.mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) {
|
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||||
|
@ -115,7 +123,9 @@ public class ZipUtils {
|
||||||
public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {
|
public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {
|
||||||
File desDir = new File(folderPath);
|
File desDir = new File(folderPath);
|
||||||
if (!desDir.exists()) {
|
if (!desDir.exists()) {
|
||||||
desDir.mkdirs();
|
if (!desDir.mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ZipFile zf = new ZipFile(zipFile);
|
ZipFile zf = new ZipFile(zipFile);
|
||||||
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
|
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
|
||||||
|
@ -127,7 +137,9 @@ public class ZipUtils {
|
||||||
if (!desFile.exists()) {
|
if (!desFile.exists()) {
|
||||||
File fileParentDir = desFile.getParentFile();
|
File fileParentDir = desFile.getParentFile();
|
||||||
if (!fileParentDir.exists()) {
|
if (!fileParentDir.exists()) {
|
||||||
fileParentDir.mkdirs();
|
if (!fileParentDir.mkdirs()) {
|
||||||
|
System.out.println("was not successful.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,6 @@ import me.zhengjie.utils.PageUtil;
|
||||||
import me.zhengjie.utils.QueryHelp;
|
import me.zhengjie.utils.QueryHelp;
|
||||||
import me.zhengjie.utils.ValidationUtil;
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
import org.quartz.CronExpression;
|
import org.quartz.CronExpression;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
@ -46,7 +43,6 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service(value = "quartzJobService")
|
@Service(value = "quartzJobService")
|
||||||
@CacheConfig(cacheNames = "quartzJob")
|
|
||||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
public class QuartzJobServiceImpl implements QuartzJobService {
|
public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
|
|
||||||
|
@ -55,7 +51,6 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
private final QuartzManage quartzManage;
|
private final QuartzManage quartzManage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable
|
|
||||||
public Object queryAll(JobQueryCriteria criteria, Pageable pageable){
|
public Object queryAll(JobQueryCriteria criteria, Pageable pageable){
|
||||||
return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
|
return PageUtil.toPage(quartzJobRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable));
|
||||||
}
|
}
|
||||||
|
@ -76,7 +71,6 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#p0")
|
|
||||||
public QuartzJob findById(Long id) {
|
public QuartzJob findById(Long id) {
|
||||||
QuartzJob quartzJob = quartzJobRepository.findById(id).orElseGet(QuartzJob::new);
|
QuartzJob quartzJob = quartzJobRepository.findById(id).orElseGet(QuartzJob::new);
|
||||||
ValidationUtil.isNull(quartzJob.getId(),"QuartzJob","id",id);
|
ValidationUtil.isNull(quartzJob.getId(),"QuartzJob","id",id);
|
||||||
|
@ -84,7 +78,6 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public QuartzJob create(QuartzJob resources) {
|
public QuartzJob create(QuartzJob resources) {
|
||||||
if (!CronExpression.isValidExpression(resources.getCronExpression())){
|
if (!CronExpression.isValidExpression(resources.getCronExpression())){
|
||||||
|
@ -96,7 +89,6 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(QuartzJob resources) {
|
public void update(QuartzJob resources) {
|
||||||
if (!CronExpression.isValidExpression(resources.getCronExpression())){
|
if (!CronExpression.isValidExpression(resources.getCronExpression())){
|
||||||
|
@ -107,7 +99,6 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
public void updateIsPause(QuartzJob quartzJob) {
|
public void updateIsPause(QuartzJob quartzJob) {
|
||||||
if (quartzJob.getIsPause()) {
|
if (quartzJob.getIsPause()) {
|
||||||
quartzManage.resumeJob(quartzJob);
|
quartzManage.resumeJob(quartzJob);
|
||||||
|
@ -125,7 +116,6 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(Set<Long> ids) {
|
public void delete(Set<Long> ids) {
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
|
|
|
@ -51,7 +51,6 @@ public class ExecutionJob extends QuartzJobBean {
|
||||||
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
private final static ThreadPoolExecutor EXECUTOR = ThreadPoolExecutorUtil.getPoll();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void executeInternal(JobExecutionContext context) {
|
public void executeInternal(JobExecutionContext context) {
|
||||||
QuartzJob quartzJob = (QuartzJob) context.getMergedJobDataMap().get(QuartzJob.JOB_KEY);
|
QuartzJob quartzJob = (QuartzJob) context.getMergedJobDataMap().get(QuartzJob.JOB_KEY);
|
||||||
// 获取spring bean
|
// 获取spring bean
|
||||||
|
|
|
@ -190,6 +190,7 @@ public class MenuServiceImpl implements MenuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable
|
||||||
public Object getMenus(Long pid) {
|
public Object getMenus(Long pid) {
|
||||||
List<Menu> menus;
|
List<Menu> menus;
|
||||||
if(pid != null && !pid.equals(0L)){
|
if(pid != null && !pid.equals(0L)){
|
||||||
|
@ -201,6 +202,7 @@ public class MenuServiceImpl implements MenuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable
|
||||||
public List<MenuDto> getSuperior(MenuDto menuDto, List<Menu> menus) {
|
public List<MenuDto> getSuperior(MenuDto menuDto, List<Menu> menus) {
|
||||||
if(menuDto.getPid() == null){
|
if(menuDto.getPid() == null){
|
||||||
menus.addAll(menuRepository.findByPidIsNull());
|
menus.addAll(menuRepository.findByPidIsNull());
|
||||||
|
@ -291,6 +293,7 @@ public class MenuServiceImpl implements MenuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable
|
||||||
public Menu findOne(Long id) {
|
public Menu findOne(Long id) {
|
||||||
Menu menu = menuRepository.findById(id).orElseGet(Menu::new);
|
Menu menu = menuRepository.findById(id).orElseGet(Menu::new);
|
||||||
ValidationUtil.isNull(menu.getId(),"Menu","id",id);
|
ValidationUtil.isNull(menu.getId(),"Menu","id",id);
|
||||||
|
|
|
@ -37,7 +37,9 @@ public class MultipartConfig {
|
||||||
String location = System.getProperty("user.home") + "/.eladmin/file/tmp";
|
String location = System.getProperty("user.home") + "/.eladmin/file/tmp";
|
||||||
File tmpFile = new File(location);
|
File tmpFile = new File(location);
|
||||||
if (!tmpFile.exists()) {
|
if (!tmpFile.exists()) {
|
||||||
tmpFile.mkdirs();
|
if (!tmpFile.mkdirs()) {
|
||||||
|
System.out.println("create was not successful.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
factory.setLocation(location);
|
factory.setLocation(location);
|
||||||
return factory.createMultipartConfig();
|
return factory.createMultipartConfig();
|
||||||
|
|
|
@ -26,9 +26,6 @@ import me.zhengjie.exception.BadRequestException;
|
||||||
import me.zhengjie.utils.*;
|
import me.zhengjie.utils.*;
|
||||||
import me.zhengjie.repository.LocalStorageRepository;
|
import me.zhengjie.repository.LocalStorageRepository;
|
||||||
import me.zhengjie.service.LocalStorageService;
|
import me.zhengjie.service.LocalStorageService;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -49,7 +46,6 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@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 {
|
||||||
|
|
||||||
|
@ -57,22 +53,18 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||||
private final LocalStorageMapper localStorageMapper;
|
private final LocalStorageMapper localStorageMapper;
|
||||||
private final FileProperties properties;
|
private final FileProperties properties;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable
|
|
||||||
public Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){
|
public Object queryAll(LocalStorageQueryCriteria criteria, Pageable pageable){
|
||||||
Page<LocalStorage> page = localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
Page<LocalStorage> page = localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||||
return PageUtil.toPage(page.map(localStorageMapper::toDto));
|
return PageUtil.toPage(page.map(localStorageMapper::toDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable
|
|
||||||
public List<LocalStorageDto> queryAll(LocalStorageQueryCriteria criteria){
|
public List<LocalStorageDto> queryAll(LocalStorageQueryCriteria criteria){
|
||||||
return localStorageMapper.toDto(localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
return localStorageMapper.toDto(localStorageRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#p0")
|
|
||||||
public LocalStorageDto findById(Long id){
|
public LocalStorageDto findById(Long id){
|
||||||
LocalStorage localStorage = localStorageRepository.findById(id).orElseGet(LocalStorage::new);
|
LocalStorage localStorage = localStorageRepository.findById(id).orElseGet(LocalStorage::new);
|
||||||
ValidationUtil.isNull(localStorage.getId(),"LocalStorage","id",id);
|
ValidationUtil.isNull(localStorage.getId(),"LocalStorage","id",id);
|
||||||
|
@ -80,7 +72,6 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public LocalStorageDto create(String name, MultipartFile multipartFile) {
|
public LocalStorageDto create(String name, MultipartFile multipartFile) {
|
||||||
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
FileUtil.checkSize(properties.getMaxSize(), multipartFile.getSize());
|
||||||
|
@ -108,7 +99,6 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(LocalStorage resources) {
|
public void update(LocalStorage resources) {
|
||||||
LocalStorage localStorage = localStorageRepository.findById(resources.getId()).orElseGet(LocalStorage::new);
|
LocalStorage localStorage = localStorageRepository.findById(resources.getId()).orElseGet(LocalStorage::new);
|
||||||
|
@ -118,7 +108,6 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteAll(Long[] ids) {
|
public void deleteAll(Long[] ids) {
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
|
|
|
@ -29,7 +29,6 @@ import me.zhengjie.service.dto.PictureQueryCriteria;
|
||||||
import me.zhengjie.exception.BadRequestException;
|
import me.zhengjie.exception.BadRequestException;
|
||||||
import me.zhengjie.utils.*;
|
import me.zhengjie.utils.*;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
@ -47,7 +46,6 @@ import java.util.*;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service(value = "pictureService")
|
@Service(value = "pictureService")
|
||||||
@CacheConfig(cacheNames = "picture")
|
|
||||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||||
public class PictureServiceImpl implements PictureService {
|
public class PictureServiceImpl implements PictureService {
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ import me.zhengjie.utils.QueryHelp;
|
||||||
import me.zhengjie.utils.ValidationUtil;
|
import me.zhengjie.utils.ValidationUtil;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
|
||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
@ -86,7 +85,7 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CachePut(cacheNames = "qiNiuConfig", key = "'1'")
|
@CachePut(key = "'1'")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public QiniuConfig update(QiniuConfig qiniuConfig) {
|
public QiniuConfig update(QiniuConfig qiniuConfig) {
|
||||||
String http = "http://", https = "https://";
|
String http = "http://", https = "https://";
|
||||||
|
@ -98,7 +97,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig) {
|
public QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig) {
|
||||||
FileUtil.checkSize(maxSize, file.getSize());
|
FileUtil.checkSize(maxSize, file.getSize());
|
||||||
|
@ -138,7 +136,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable
|
|
||||||
public QiniuContent findByContentId(Long id) {
|
public QiniuContent findByContentId(Long id) {
|
||||||
QiniuContent qiniuContent = qiniuContentRepository.findById(id).orElseGet(QiniuContent::new);
|
QiniuContent qiniuContent = qiniuContentRepository.findById(id).orElseGet(QiniuContent::new);
|
||||||
ValidationUtil.isNull(qiniuContent.getId(),"QiniuContent", "id",id);
|
ValidationUtil.isNull(qiniuContent.getId(),"QiniuContent", "id",id);
|
||||||
|
@ -146,7 +143,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable
|
|
||||||
public String download(QiniuContent content,QiniuConfig config){
|
public String download(QiniuContent content,QiniuConfig config){
|
||||||
String finalUrl;
|
String finalUrl;
|
||||||
String type = "公开";
|
String type = "公开";
|
||||||
|
@ -162,7 +158,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(QiniuContent content, QiniuConfig config) {
|
public void delete(QiniuContent content, QiniuConfig config) {
|
||||||
//构造一个带指定Zone对象的配置类
|
//构造一个带指定Zone对象的配置类
|
||||||
|
@ -178,7 +173,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void synchronize(QiniuConfig config) {
|
public void synchronize(QiniuConfig config) {
|
||||||
if(config.getId() == null){
|
if(config.getId() == null){
|
||||||
|
@ -216,7 +210,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
public void deleteAll(Long[] ids, QiniuConfig config) {
|
public void deleteAll(Long[] ids, QiniuConfig config) {
|
||||||
for (Long id : ids) {
|
for (Long id : ids) {
|
||||||
delete(findByContentId(id), config);
|
delete(findByContentId(id), config);
|
||||||
|
@ -224,7 +217,6 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CacheEvict(allEntries = true)
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(String type) {
|
public void update(String type) {
|
||||||
qiNiuConfigRepository.update(type);
|
qiNiuConfigRepository.update(type);
|
||||||
|
|
|
@ -23,20 +23,20 @@ package me.zhengjie.utils;
|
||||||
public enum AliPayStatusEnum {
|
public enum AliPayStatusEnum {
|
||||||
|
|
||||||
/** 交易成功 */
|
/** 交易成功 */
|
||||||
FINISHED("交易成功", "TRADE_FINISHED"),
|
FINISHED("TRADE_FINISHED"),
|
||||||
|
|
||||||
/** 支付成功 */
|
/** 支付成功 */
|
||||||
SUCCESS("支付成功", "TRADE_SUCCESS"),
|
SUCCESS("TRADE_SUCCESS"),
|
||||||
|
|
||||||
/** 交易创建 */
|
/** 交易创建 */
|
||||||
BUYER_PAY("交易创建", "WAIT_BUYER_PAY"),
|
BUYER_PAY("WAIT_BUYER_PAY"),
|
||||||
|
|
||||||
/** 交易关闭 */
|
/** 交易关闭 */
|
||||||
CLOSED("交易关闭", "TRADE_CLOSED");
|
CLOSED("TRADE_CLOSED");
|
||||||
|
|
||||||
private String value;
|
private final String value;
|
||||||
|
|
||||||
AliPayStatusEnum(String name, String value) {
|
AliPayStatusEnum(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,10 +61,10 @@ public class AlipayUtils {
|
||||||
|
|
||||||
// 获取支付宝POST过来反馈信息
|
// 获取支付宝POST过来反馈信息
|
||||||
Map<String,String> params = new HashMap<>(1);
|
Map<String,String> params = new HashMap<>(1);
|
||||||
Map requestParams = request.getParameterMap();
|
Map<String, String[]> requestParams = request.getParameterMap();
|
||||||
for (Object o : requestParams.keySet()) {
|
for (Object o : requestParams.keySet()) {
|
||||||
String name = (String) o;
|
String name = (String) o;
|
||||||
String[] values = (String[]) requestParams.get(name);
|
String[] values = requestParams.get(name);
|
||||||
String valueStr = "";
|
String valueStr = "";
|
||||||
for (int i = 0; i < values.length; i++) {
|
for (int i = 0; i < values.length; i++) {
|
||||||
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
package me.zhengjie.utils;
|
package me.zhengjie.utils;
|
||||||
|
|
||||||
import com.qiniu.storage.Region;
|
import com.qiniu.storage.Region;
|
||||||
import me.zhengjie.utils.FileUtil;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue