yshop1.8.1修复库存显示问题、修复评价等问题,明细可登陆后台查看
This commit is contained in:
@ -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.vo.YxStoreProductAttrValueQueryVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@ -23,6 +24,10 @@ import java.io.Serializable;
|
||||
@Repository
|
||||
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}" +
|
||||
" where product_id=#{productId} and `unique`=#{unique}")
|
||||
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 == 3'>and A.product_score < 2</if>"+
|
||||
" 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获取查询对象
|
||||
|
@ -83,8 +83,8 @@ public class YxStoreProductReplyServiceImpl extends BaseServiceImpl<YxStoreProdu
|
||||
|
||||
//好评率
|
||||
|
||||
replyCountDTO.setReplySstar(""+NumberUtil.mul(NumberUtil.div(goodCount,sumCount),5));
|
||||
replyCountDTO.setReplyChance(""+NumberUtil.mul(NumberUtil.div(goodCount,sumCount),100));
|
||||
replyCountDTO.setReplySstar(""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(goodCount,sumCount),5),2));
|
||||
replyCountDTO.setReplyChance(""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(goodCount,sumCount),100),2));
|
||||
|
||||
return replyCountDTO;
|
||||
}
|
||||
@ -197,7 +197,7 @@ public class YxStoreProductReplyServiceImpl extends BaseServiceImpl<YxStoreProdu
|
||||
.eq("reply_type","product").eq("product_score",5);
|
||||
int productScoreCount = yxStoreProductReplyMapper.selectCount(wrapper);
|
||||
if(count > 0){
|
||||
return ""+NumberUtil.mul(NumberUtil.div(productScoreCount,count),100);
|
||||
return ""+NumberUtil.round(NumberUtil.mul(NumberUtil.div(productScoreCount,count),100),2);
|
||||
}
|
||||
|
||||
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.YxStoreProductAttrValue;
|
||||
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.mapping.YxStoreProductMap;
|
||||
import co.yixiang.modules.shop.service.*;
|
||||
@ -65,6 +66,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<YxStoreProductMap
|
||||
@Autowired
|
||||
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);
|
||||
ProductDTO productDTO = new ProductDTO();
|
||||
YxStoreProductQueryVo storeProductQueryVo = storeProductMap.toDto(storeProduct);
|
||||
|
||||
//处理库存
|
||||
Integer newStock = storeProductAttrValueMapper.sumStock(id);
|
||||
if(newStock != null) storeProductQueryVo.setStock(newStock);
|
||||
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
storeProductQueryVo.getPrice().doubleValue(),uid);
|
||||
|
@ -73,7 +73,7 @@ swagger:
|
||||
enabled: true
|
||||
title: yshop商城移动端API
|
||||
serverUrl: http://localhost:8009
|
||||
version: 1.7
|
||||
version: 1.8
|
||||
|
||||
# 文件存储路径
|
||||
file:
|
||||
@ -82,7 +82,7 @@ file:
|
||||
# 文件大小 /M
|
||||
maxSize: 100
|
||||
avatarMaxSize: 5
|
||||
localUrl: http://localhost:8000
|
||||
localUrl: http://localhost:8009/api
|
||||
yshop:
|
||||
#通知相关配置
|
||||
notify:
|
||||
|
@ -93,7 +93,7 @@ file:
|
||||
# 文件大小 /M
|
||||
maxSize: 100
|
||||
avatarMaxSize: 5
|
||||
localUrl: http://localhost:8000
|
||||
localUrl:
|
||||
|
||||
yshop:
|
||||
#通知相关配置
|
||||
|
Reference in New Issue
Block a user