修复购物车数量及其列表sku规格显示等问题
This commit is contained in:
@ -1,63 +0,0 @@
|
||||
package co.yixiang.config;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* api页面 /swagger-ui.html
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
|
||||
//@Configuration
|
||||
//@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Value("${jwt.header}")
|
||||
private String tokenHeader;
|
||||
|
||||
@Value("${swagger.enabled}")
|
||||
private Boolean enabled;
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
ParameterBuilder ticketPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<Parameter>();
|
||||
ticketPar.name(tokenHeader).description("token")
|
||||
.modelRef(new ModelRef("string"))
|
||||
.parameterType("header")
|
||||
.defaultValue("Bearer ")
|
||||
.required(true)
|
||||
.build();
|
||||
pars.add(ticketPar.build());
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(enabled)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.paths(Predicates.not(PathSelectors.regex("/error.*")))
|
||||
.build()
|
||||
.globalOperationParameters(pars);
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("yshop 接口文档")
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
package co.yixiang.config;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Parameter;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* api页面 /swagger-ui.html
|
||||
* @author Zheng Jie
|
||||
* @date 2018-11-23
|
||||
*/
|
||||
|
||||
//@Configuration
|
||||
//@EnableSwagger2
|
||||
public class SwaggerConfig2 {
|
||||
|
||||
@Value("${jwt.header}")
|
||||
private String tokenHeader;
|
||||
|
||||
@Value("${swagger.enabled}")
|
||||
private Boolean enabled;
|
||||
|
||||
@Bean
|
||||
public Docket createRestApi() {
|
||||
ParameterBuilder ticketPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<Parameter>();
|
||||
ticketPar.name(tokenHeader).description("token")
|
||||
.modelRef(new ModelRef("string"))
|
||||
.parameterType("header")
|
||||
.defaultValue("Bearer ")
|
||||
.required(true)
|
||||
.build();
|
||||
pars.add(ticketPar.build());
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.enable(enabled)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("co.yixiang.modules"))
|
||||
.paths(Predicates.not(PathSelectors.regex("/error.*")))
|
||||
.build()
|
||||
.globalOperationParameters(pars);
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("yshop 接口文档")
|
||||
.version("1.0")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
@ -4,10 +4,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import co.yixiang.modules.order.entity.YxStoreOrderCartInfo;
|
||||
import co.yixiang.modules.order.mapper.YxStoreOrderCartInfoMapper;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderCartInfoService;
|
||||
import co.yixiang.modules.order.web.param.YxStoreOrderCartInfoQueryParam;
|
||||
import co.yixiang.modules.order.web.vo.YxStoreOrderCartInfoQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@ -16,10 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -41,13 +41,10 @@ import co.yixiang.modules.shop.service.YxStoreProductReplyService;
|
||||
import co.yixiang.modules.shop.service.YxStoreProductService;
|
||||
import co.yixiang.modules.shop.service.YxSystemConfigService;
|
||||
import co.yixiang.modules.shop.web.vo.YxStoreCartQueryVo;
|
||||
//import co.yixiang.modules.task.CancelOrderService;
|
||||
import co.yixiang.modules.user.entity.*;
|
||||
import co.yixiang.modules.user.service.*;
|
||||
import co.yixiang.modules.user.web.vo.YxUserAddressQueryVo;
|
||||
import co.yixiang.modules.user.web.vo.YxUserQueryVo;
|
||||
//import co.yixiang.redisson.DelayJob;
|
||||
//import co.yixiang.redisson.DelayJobService;
|
||||
import co.yixiang.modules.task.DelayJobService;
|
||||
import co.yixiang.modules.user.web.vo.YxWechatUserQueryVo;
|
||||
import co.yixiang.modules.wechat.entity.YxWechatTemplate;
|
||||
@ -66,11 +63,6 @@ import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
//import org.redisson.RedissonDelayedQueue;
|
||||
//import org.redisson.api.RDelayedQueue;
|
||||
//import org.redisson.api.RQueue;
|
||||
//import org.redisson.api.RedissonClient;
|
||||
//import org.apache.webservice.config.annotation.Service;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -3,20 +3,14 @@ package co.yixiang.modules.order.service.impl;
|
||||
import co.yixiang.modules.order.entity.YxStoreOrderStatus;
|
||||
import co.yixiang.modules.order.mapper.YxStoreOrderStatusMapper;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderStatusService;
|
||||
import co.yixiang.modules.order.web.param.YxStoreOrderStatusQueryParam;
|
||||
import co.yixiang.modules.order.web.vo.YxStoreOrderStatusQueryVo;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.web.vo.Paging;
|
||||
import co.yixiang.utils.OrderUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -166,16 +166,17 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
for (YxStoreCart storeCart : carts) {
|
||||
YxStoreProductQueryVo storeProduct = null;
|
||||
if(storeCart.getCombinationId() > 0){
|
||||
storeProduct = storeCombinationMapper.combinatiionInfo(storeCart.getCombinationId());
|
||||
storeProduct = ObjectUtil.clone(storeCombinationMapper.combinatiionInfo(storeCart.getCombinationId()));
|
||||
}else if(storeCart.getSeckillId() > 0){
|
||||
storeProduct = storeSeckillMapper.seckillInfo(storeCart.getSeckillId());
|
||||
storeProduct = ObjectUtil.clone(storeSeckillMapper.seckillInfo(storeCart.getSeckillId()));
|
||||
}else{
|
||||
storeProduct = productService
|
||||
.getYxStoreProductById(storeCart.getProductId());
|
||||
//必须得重新克隆创建一个新对象
|
||||
storeProduct = ObjectUtil.clone(productService
|
||||
.getYxStoreProductById(storeCart.getProductId()));
|
||||
}
|
||||
|
||||
YxStoreCartQueryVo storeCartQueryVo = cartMap.toDto(storeCart);
|
||||
storeCartQueryVo.setProductInfo(storeProduct);
|
||||
|
||||
if(ObjectUtil.isNull(storeProduct)){
|
||||
YxStoreCart yxStoreCart = new YxStoreCart();
|
||||
yxStoreCart.setIsDel(1);
|
||||
@ -192,6 +193,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
invalid.add(storeCartQueryVo);
|
||||
}else{
|
||||
storeProduct.setAttrInfo(productAttrValue);
|
||||
storeCartQueryVo.setProductInfo(storeProduct);
|
||||
|
||||
//设置真实价格
|
||||
//设置VIP价格
|
||||
@ -211,6 +213,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
storeCartQueryVo.setTrueStock(productAttrValue.getStock());
|
||||
|
||||
valid.add(storeCartQueryVo);
|
||||
|
||||
}
|
||||
}else{
|
||||
//设置VIP价格
|
||||
@ -229,11 +232,14 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
storeCartQueryVo.setCostPrice(storeProduct.getCost()
|
||||
.doubleValue());
|
||||
storeCartQueryVo.setTrueStock(storeProduct.getStock());
|
||||
storeCartQueryVo.setProductInfo(storeProduct);
|
||||
|
||||
valid.add(storeCartQueryVo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("valid",valid);
|
||||
map.put("invalid",invalid);
|
||||
@ -313,7 +319,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<YxStoreCartMapper, Y
|
||||
storeCart.setIsNew(isNew);
|
||||
if(ObjectUtil.isNotNull(cart)){
|
||||
if(isNew == 0){
|
||||
storeCart.setCartNum(cartNum + storeCart.getCartNum());
|
||||
storeCart.setCartNum(cartNum + cart.getCartNum());
|
||||
}
|
||||
storeCart.setId(cart.getId());
|
||||
yxStoreCartMapper.updateById(storeCart);
|
||||
|
@ -5,8 +5,8 @@ spring:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://localhost:3306/yshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
|
||||
username: yshop
|
||||
password:
|
||||
username: root
|
||||
password: System!1234
|
||||
|
||||
# 初始化配置
|
||||
initial-size: 3
|
||||
@ -47,7 +47,7 @@ spring:
|
||||
database: 0
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
password: System!1234
|
||||
#连接超时时间
|
||||
timeout: 5000
|
||||
|
||||
|
@ -1,47 +0,0 @@
|
||||
//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);
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,17 +0,0 @@
|
||||
//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;//具体执行实例实现
|
||||
//
|
||||
//}
|
@ -1,32 +0,0 @@
|
||||
//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);
|
||||
// }
|
||||
//
|
||||
//}
|
@ -1,10 +0,0 @@
|
||||
//package co.yixiang.redisson;
|
||||
//
|
||||
///**
|
||||
// * Created by kl on 2018/7/20.
|
||||
// * Content :延时job执行器接口
|
||||
// */
|
||||
//public interface ExecuteJob {
|
||||
//
|
||||
// void execute(DelayJob job);
|
||||
//}
|
@ -1,77 +0,0 @@
|
||||
//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);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
Reference in New Issue
Block a user