1.2.3 后台操作按钮调整及其新增开启拼团功能

This commit is contained in:
hupeng
2019-11-19 13:14:38 +08:00
parent 42d8d545a1
commit d52a399ecc
199 changed files with 12712 additions and 367 deletions

View File

@ -0,0 +1,47 @@
//package co.yixiang.config;
//
//import cn.hutool.core.util.StrUtil;
//import org.redisson.Redisson;
//import org.redisson.api.RedissonClient;
//import org.redisson.config.Config;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * redisson 配置类
// * Created on 2018/6/19
// */
//@Configuration
//public class RedissonConfig {
//
// @Value("${spring.redis.host}")
// private String host;
//
// @Value("${spring.redis.port}")
// private String port;
//
// @Value("${spring.redis.password}")
// private String password;
//
// @Value("${spring.redis.database}")
// private Integer database;
//
// // @Bean
// public RedissonClient getRedisson(){
//
// Config config = new Config();
// if(StrUtil.isNotEmpty(password)){
// config.useSingleServer().setAddress("redis://" + host + ":" + port)
// .setPassword(password).setDatabase(database);
// }else{
// config.useSingleServer().setAddress("redis://" + host + ":" + port).setDatabase(database);
// }
// //config.useSingleServer().setAddress("redis://" + host + ":" + port).setPassword(password).setDatabase(database);
// //添加主从配置
//// config.useMasterSlaveServers().setMasterAddress("").setPassword("").addSlaveAddress(new String[]{"",""});
//
// return Redisson.create(config);
// }
//
//}

View File

@ -0,0 +1,17 @@
//package co.yixiang.redisson;
//
//import lombok.Data;
//
//import java.io.Serializable;
//
//
///**
// * Created by kl on 2018/7/20.
// * Content :延时job
// */
//@Data
//public class DelayJob implements Serializable {
// private Integer orderId;//job执行参数
// private Class aClass;//具体执行实例实现
//
//}

View File

@ -0,0 +1,32 @@
//package co.yixiang.redisson;
//
//import org.redisson.api.RBlockingQueue;
//import org.redisson.api.RDelayedQueue;
//import org.redisson.api.RedissonClient;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.TimeUnit;
//
///**
// * Created by kl on 2018/7/20.
// * Content :延时job服务
// */
//@Component
//public class DelayJobService {
//
// @Autowired
// private RedissonClient client;
//
// /**
// * 添加超时任务到redis队列
// * @param job 任务
// * @param delay 超时时间
// */
// public void submitJob(DelayJob job, Long delay){
// RBlockingQueue<DelayJob> blockingQueue = client.getBlockingQueue(JobTimer.jobsTag);
// RDelayedQueue<DelayJob> delayedQueue = client.getDelayedQueue(blockingQueue);
// delayedQueue.offer(job,delay,TimeUnit.SECONDS);
// }
//
//}

View File

@ -0,0 +1,10 @@
//package co.yixiang.redisson;
//
///**
// * Created by kl on 2018/7/20.
// * Content :延时job执行器接口
// */
//public interface ExecuteJob {
//
// void execute(DelayJob job);
//}

View File

@ -0,0 +1,77 @@
//package co.yixiang.redisson;
//
//import cn.hutool.core.util.ObjectUtil;
//import org.redisson.api.RBlockingQueue;
//import org.redisson.api.RDelayedQueue;
//import org.redisson.api.RedissonClient;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.ApplicationContext;
//import org.springframework.stereotype.Component;
//import javax.annotation.PostConstruct;
//import java.util.concurrent.ExecutorService;
//import java.util.concurrent.Executors;
//import java.util.concurrent.TimeUnit;
//
///**
// * 消费已经到点的延时job服务通过job参数调用业务执行器实现
// */
//@Component
//public class JobTimer {
//
// static final String jobsTag = "customer_jobtimer_jobs";
// @Autowired
// private RedissonClient client;
//
// @Autowired
// private ApplicationContext context;
//
// ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
//
// @PostConstruct
// public void startJobTimer() {
// RBlockingQueue<DelayJob> blockingQueue = client.getBlockingQueue(jobsTag);
//
// new Thread() {
// @Override
// public void run() {
// while (true) {
// try {
// DelayJob job = blockingQueue.take();
// if(ObjectUtil.isNotNull(job)){
// executorService.execute(new ExecutorTask(context, job));
// RDelayedQueue<DelayJob> delayedQueue = client.getDelayedQueue(blockingQueue);
// delayedQueue.destroy();
// }
// } catch (Exception e) {
// RDelayedQueue<DelayJob> delayedQueue = client.getDelayedQueue(blockingQueue);
// delayedQueue.destroy();
// e.printStackTrace();
// try {
// TimeUnit.SECONDS.sleep(60);
// } catch (Exception ex) {
// }
// }
// }
// }
// }.start();
// }
//
// class ExecutorTask implements Runnable {
//
// private ApplicationContext context;
//
// private DelayJob delayJob;
//
// public ExecutorTask(ApplicationContext context, DelayJob delayJob) {
// this.context = context;
// this.delayJob = delayJob;
// }
//
// @Override
// public void run() {
// ExecuteJob service = (ExecuteJob) context.getBean(delayJob.getAClass());
// service.execute(delayJob);
// }
// }
//
//}

View File

@ -2,9 +2,13 @@ package co.yixiang.rest;
import co.yixiang.aop.log.Log;
import co.yixiang.domain.LocalStorage;
import co.yixiang.domain.Picture;
import co.yixiang.service.LocalStorageService;
import co.yixiang.service.dto.LocalStorageDTO;
import co.yixiang.service.dto.LocalStorageQueryCriteria;
import co.yixiang.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@ -14,6 +18,9 @@ import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.HashMap;
import java.util.Map;
/**
* @author Zheng Jie
* @date 2019-09-05
@ -26,6 +33,10 @@ public class LocalStorageController {
@Autowired
private LocalStorageService localStorageService;
@Value("${file.localUrl}")
private String localUrl;
@ApiOperation(value = "查询文件")
@GetMapping(value = "/localStorage")
@PreAuthorize("hasAnyRole('ADMIN','LOCALSTORAGE_ALL','LOCALSTORAGE_SELECT')")
@ -36,8 +47,13 @@ public class LocalStorageController {
@ApiOperation(value = "上传文件")
@PostMapping(value = "/localStorage")
@PreAuthorize("hasAnyRole('ADMIN','LOCALSTORAGE_ALL','LOCALSTORAGE_CREATE')")
public ResponseEntity create(@RequestParam String name, @RequestParam("file") MultipartFile file){
return new ResponseEntity(localStorageService.create(name, file),HttpStatus.CREATED);
public ResponseEntity create(@RequestParam(value = "name",defaultValue = "") String name , @RequestParam("file") MultipartFile file){
LocalStorageDTO storageDTO = localStorageService.create(name, file);
String url = localUrl+"/file/"+storageDTO.getType()+"/"+storageDTO.getRealName();
Map<String,Object> map = new HashMap<>(3);
map.put("errno",0);
map.put("data",new String[]{url});
return new ResponseEntity(map,HttpStatus.CREATED);
}
@ApiOperation(value = "修改文件")

View File

@ -34,6 +34,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
@Autowired
private LocalStorageMapper localStorageMapper;
@Value("${file.path}")
private String path;