yshop1.8.1修复库存显示问题、修复评价等问题,明细可登陆后台查看
This commit is contained in:
@ -151,6 +151,11 @@ yshop基于当前流行技术组合的前后端分离商城系统: SpringBoot2
|
|||||||
- 3、本地上传与七牛云上传合并,修改一个yml即可两者随意切换
|
- 3、本地上传与七牛云上传合并,修改一个yml即可两者随意切换
|
||||||
- 4、升级swagger-bootstrap,swaager统一配置迁移到common(防止注解冲突)
|
- 4、升级swagger-bootstrap,swaager统一配置迁移到common(防止注解冲突)
|
||||||
- 5、后台优化操作显示
|
- 5、后台优化操作显示
|
||||||
|
- yshop1.8.1发布更新如下:
|
||||||
|
- 1、修复库存问题#I17Z5X
|
||||||
|
- 2、修复评价百分比精度问题#I17UQY
|
||||||
|
- 3、修复评价列表问题#I17TZC
|
||||||
|
- 4、移动端图片上传修改为统一处理
|
||||||
|
|
||||||
|
|
||||||
#### 反馈交流
|
#### 反馈交流
|
||||||
|
@ -1 +1 @@
|
|||||||
nohup java -jar yshop-api-1.7.jar --spring.profiles.active=prod &
|
nohup java -jar yshop-api-1.8.jar --spring.profiles.active=prod &
|
@ -1,4 +1,4 @@
|
|||||||
PID=$(ps -ef | grep yshop-api-1.7.jar | grep -v grep | awk '{ print $2 }')
|
PID=$(ps -ef | grep yshop-api-1.8.jar | grep -v grep | awk '{ print $2 }')
|
||||||
if [ -z "$PID" ];then
|
if [ -z "$PID" ];then
|
||||||
echo Application is already stopped
|
echo Application is already stopped
|
||||||
else
|
else
|
||||||
|
@ -7,6 +7,7 @@ import co.yixiang.modules.shop.entity.YxStoreProductAttrValue;
|
|||||||
import co.yixiang.modules.shop.web.param.YxStoreProductAttrValueQueryParam;
|
import co.yixiang.modules.shop.web.param.YxStoreProductAttrValueQueryParam;
|
||||||
import co.yixiang.modules.shop.web.vo.YxStoreProductAttrValueQueryVo;
|
import co.yixiang.modules.shop.web.vo.YxStoreProductAttrValueQueryVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
import org.apache.ibatis.annotations.Update;
|
import org.apache.ibatis.annotations.Update;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -23,6 +24,10 @@ import java.io.Serializable;
|
|||||||
@Repository
|
@Repository
|
||||||
public interface YxStoreProductAttrValueMapper extends BaseMapper<YxStoreProductAttrValue> {
|
public interface YxStoreProductAttrValueMapper extends BaseMapper<YxStoreProductAttrValue> {
|
||||||
|
|
||||||
|
@Select("select sum(stock) from yx_store_product_attr_value " +
|
||||||
|
"where product_id = #{productId}")
|
||||||
|
Integer sumStock(Integer productId);
|
||||||
|
|
||||||
@Update("update yx_store_product_attr_value set stock=stock-#{num}, sales=sales+#{num}" +
|
@Update("update yx_store_product_attr_value set stock=stock-#{num}, sales=sales+#{num}" +
|
||||||
" where product_id=#{productId} and `unique`=#{unique}")
|
" where product_id=#{productId} and `unique`=#{unique}")
|
||||||
int decStockIncSales(@Param("num") int num,@Param("productId") int productId,
|
int decStockIncSales(@Param("num") int num,@Param("productId") int productId,
|
||||||
|
@ -45,7 +45,7 @@ public interface YxStoreProductReplyMapper extends BaseMapper<YxStoreProductRepl
|
|||||||
"<if test='type == 2'>and A.product_score < 5 and A.product_score > 2</if>" +
|
"<if test='type == 2'>and A.product_score < 5 and A.product_score > 2</if>" +
|
||||||
"<if test='type == 3'>and A.product_score < 2</if>"+
|
"<if test='type == 3'>and A.product_score < 2</if>"+
|
||||||
" order by A.add_time DESC</script>")
|
" order by A.add_time DESC</script>")
|
||||||
List<YxStoreProductReplyQueryVo> selectReplyList(Page page, @Param("productId") int productId,int type);
|
List<YxStoreProductReplyQueryVo> selectReplyList(Page page, @Param("productId") int productId,@Param("type") int type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID获取查询对象
|
* 根据ID获取查询对象
|
||||||
|
@ -83,8 +83,8 @@ public class YxStoreProductReplyServiceImpl extends BaseServiceImpl<YxStoreProdu
|
|||||||
|
|
||||||
//好评率
|
//好评率
|
||||||
|
|
||||||
replyCountDTO.setReplySstar(""+NumberUtil.mul(NumberUtil.div(goodCount,sumCount),5));
|
replyCountDTO.setReplySstar(""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(goodCount,sumCount),5),2));
|
||||||
replyCountDTO.setReplyChance(""+NumberUtil.mul(NumberUtil.div(goodCount,sumCount),100));
|
replyCountDTO.setReplyChance(""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(goodCount,sumCount),100),2));
|
||||||
|
|
||||||
return replyCountDTO;
|
return replyCountDTO;
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ public class YxStoreProductReplyServiceImpl extends BaseServiceImpl<YxStoreProdu
|
|||||||
.eq("reply_type","product").eq("product_score",5);
|
.eq("reply_type","product").eq("product_score",5);
|
||||||
int productScoreCount = yxStoreProductReplyMapper.selectCount(wrapper);
|
int productScoreCount = yxStoreProductReplyMapper.selectCount(wrapper);
|
||||||
if(count > 0){
|
if(count > 0){
|
||||||
return ""+NumberUtil.mul(NumberUtil.div(productScoreCount,count),100);
|
return ""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(productScoreCount,count),100),2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "0";
|
return "0";
|
||||||
|
@ -7,6 +7,7 @@ import co.yixiang.modules.shop.entity.YxStoreCategory;
|
|||||||
import co.yixiang.modules.shop.entity.YxStoreProduct;
|
import co.yixiang.modules.shop.entity.YxStoreProduct;
|
||||||
import co.yixiang.modules.shop.entity.YxStoreProductAttrValue;
|
import co.yixiang.modules.shop.entity.YxStoreProductAttrValue;
|
||||||
import co.yixiang.modules.shop.mapper.YxStoreCategoryMapper;
|
import co.yixiang.modules.shop.mapper.YxStoreCategoryMapper;
|
||||||
|
import co.yixiang.modules.shop.mapper.YxStoreProductAttrValueMapper;
|
||||||
import co.yixiang.modules.shop.mapper.YxStoreProductMapper;
|
import co.yixiang.modules.shop.mapper.YxStoreProductMapper;
|
||||||
import co.yixiang.modules.shop.mapping.YxStoreProductMap;
|
import co.yixiang.modules.shop.mapping.YxStoreProductMap;
|
||||||
import co.yixiang.modules.shop.service.*;
|
import co.yixiang.modules.shop.service.*;
|
||||||
@ -65,6 +66,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YxUserService userService;
|
private YxUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private YxStoreProductAttrValueMapper storeProductAttrValueMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加库存 减少销量
|
* 增加库存 减少销量
|
||||||
@ -125,6 +129,11 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
|||||||
Map<String, Object> returnMap = storeProductAttrService.getProductAttrDetail(id,0,0);
|
Map<String, Object> returnMap = storeProductAttrService.getProductAttrDetail(id,0,0);
|
||||||
ProductDTO productDTO = new ProductDTO();
|
ProductDTO productDTO = new ProductDTO();
|
||||||
YxStoreProductQueryVo storeProductQueryVo = storeProductMap.toDto(storeProduct);
|
YxStoreProductQueryVo storeProductQueryVo = storeProductMap.toDto(storeProduct);
|
||||||
|
|
||||||
|
//处理库存
|
||||||
|
Integer newStock = storeProductAttrValueMapper.sumStock(id);
|
||||||
|
if(newStock != null) storeProductQueryVo.setStock(newStock);
|
||||||
|
|
||||||
//设置VIP价格
|
//设置VIP价格
|
||||||
double vipPrice = userService.setLevelPrice(
|
double vipPrice = userService.setLevelPrice(
|
||||||
storeProductQueryVo.getPrice().doubleValue(),uid);
|
storeProductQueryVo.getPrice().doubleValue(),uid);
|
||||||
|
@ -73,7 +73,7 @@ swagger:
|
|||||||
enabled: true
|
enabled: true
|
||||||
title: yshop商城移动端API
|
title: yshop商城移动端API
|
||||||
serverUrl: http://localhost:8009
|
serverUrl: http://localhost:8009
|
||||||
version: 1.7
|
version: 1.8
|
||||||
|
|
||||||
# 文件存储路径
|
# 文件存储路径
|
||||||
file:
|
file:
|
||||||
@ -82,7 +82,7 @@ file:
|
|||||||
# 文件大小 /M
|
# 文件大小 /M
|
||||||
maxSize: 100
|
maxSize: 100
|
||||||
avatarMaxSize: 5
|
avatarMaxSize: 5
|
||||||
localUrl: http://localhost:8000
|
localUrl: http://localhost:8009/api
|
||||||
yshop:
|
yshop:
|
||||||
#通知相关配置
|
#通知相关配置
|
||||||
notify:
|
notify:
|
||||||
|
@ -93,7 +93,7 @@ file:
|
|||||||
# 文件大小 /M
|
# 文件大小 /M
|
||||||
maxSize: 100
|
maxSize: 100
|
||||||
avatarMaxSize: 5
|
avatarMaxSize: 5
|
||||||
localUrl: http://localhost:8000
|
localUrl:
|
||||||
|
|
||||||
yshop:
|
yshop:
|
||||||
#通知相关配置
|
#通知相关配置
|
||||||
|
@ -3,6 +3,7 @@ package co.yixiang.modules.shop.repository;
|
|||||||
import co.yixiang.modules.shop.domain.YxStoreProductAttr;
|
import co.yixiang.modules.shop.domain.YxStoreProductAttr;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hupeng
|
* @author hupeng
|
||||||
@ -12,4 +13,7 @@ public interface YxStoreProductAttrRepository extends JpaRepository<YxStoreProdu
|
|||||||
//@Modifying
|
//@Modifying
|
||||||
//@Query(value = "delete from yx_store_product_attr where product_id =?1",nativeQuery = true)
|
//@Query(value = "delete from yx_store_product_attr where product_id =?1",nativeQuery = true)
|
||||||
void deleteByProductId(int id);
|
void deleteByProductId(int id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package co.yixiang.modules.shop.repository;
|
|||||||
import co.yixiang.modules.shop.domain.YxStoreProductAttrValue;
|
import co.yixiang.modules.shop.domain.YxStoreProductAttrValue;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hupeng
|
* @author hupeng
|
||||||
@ -13,4 +14,8 @@ public interface YxStoreProductAttrValueRepository extends JpaRepository<YxStore
|
|||||||
//@Modifying
|
//@Modifying
|
||||||
// @Query(value = "delete from yx_store_product_attr_value where product_id =?1",nativeQuery = true)
|
// @Query(value = "delete from yx_store_product_attr_value where product_id =?1",nativeQuery = true)
|
||||||
void deleteByProductId(Integer id);
|
void deleteByProductId(Integer id);
|
||||||
|
|
||||||
|
@Query(value = "select sum(stock) from yx_store_product_attr_value " +
|
||||||
|
"where product_id = ?1",nativeQuery = true)
|
||||||
|
Integer sumStock(Integer productId);
|
||||||
}
|
}
|
@ -68,6 +68,10 @@ public class YxStoreProductServiceImpl implements YxStoreProductService {
|
|||||||
.findNameById(Integer.valueOf(product.getCateId()));
|
.findNameById(Integer.valueOf(product.getCateId()));
|
||||||
YxStoreProductDTO yxStoreProductDTO = yxStoreProductMapper.toDto(product);
|
YxStoreProductDTO yxStoreProductDTO = yxStoreProductMapper.toDto(product);
|
||||||
yxStoreProductDTO.setCateName(cateName);
|
yxStoreProductDTO.setCateName(cateName);
|
||||||
|
//规格属性库存
|
||||||
|
Integer newStock = yxStoreProductAttrValueRepository.sumStock(product.getId());
|
||||||
|
if(newStock != null) yxStoreProductDTO.setStock(newStock);
|
||||||
|
|
||||||
storeProductDTOS.add(yxStoreProductDTO);
|
storeProductDTOS.add(yxStoreProductDTO);
|
||||||
}
|
}
|
||||||
Map<String,Object> map = new LinkedHashMap<>(2);
|
Map<String,Object> map = new LinkedHashMap<>(2);
|
||||||
|
@ -76,7 +76,7 @@ swagger:
|
|||||||
enabled: true
|
enabled: true
|
||||||
title: yshop商城管理后台API
|
title: yshop商城管理后台API
|
||||||
serverUrl: http://localhost:8000
|
serverUrl: http://localhost:8000
|
||||||
version: 1.7
|
version: 1.8
|
||||||
|
|
||||||
# 文件存储路径
|
# 文件存储路径
|
||||||
file:
|
file:
|
||||||
@ -85,4 +85,4 @@ file:
|
|||||||
# 文件大小 /M
|
# 文件大小 /M
|
||||||
maxSize: 100
|
maxSize: 100
|
||||||
avatarMaxSize: 5
|
avatarMaxSize: 5
|
||||||
localUrl:
|
localUrl: http://localhost:8000
|
@ -81,7 +81,7 @@ swagger:
|
|||||||
enabled: true
|
enabled: true
|
||||||
title: yshop商城管理后台API
|
title: yshop商城管理后台API
|
||||||
serverUrl: http://localhost:8000
|
serverUrl: http://localhost:8000
|
||||||
version: 1.7
|
version: 1.8
|
||||||
|
|
||||||
# 文件存储路径
|
# 文件存储路径
|
||||||
file:
|
file:
|
||||||
|
Reference in New Issue
Block a user