yshop1.8.1修复库存显示问题、修复评价等问题,明细可登陆后台查看

This commit is contained in:
hupeng
2020-01-11 18:12:32 +08:00
parent 6c663012a4
commit 3977f79185
14 changed files with 45 additions and 13 deletions

View File

@ -151,6 +151,11 @@ yshop基于当前流行技术组合的前后端分离商城系统 SpringBoot2
- 3、本地上传与七牛云上传合并修改一个yml即可两者随意切换
- 4、升级swagger-bootstrap,swaager统一配置迁移到common(防止注解冲突)
- 5、后台优化操作显示
- yshop1.8.1发布更新如下:
- 1、修复库存问题#I17Z5X
- 2、修复评价百分比精度问题#I17UQY
- 3、修复评价列表问题#I17TZC
- 4、移动端图片上传修改为统一处理
#### 反馈交流

View File

@ -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 &

View File

@ -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
echo Application is already stopped
else

View File

@ -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,

View File

@ -45,7 +45,7 @@ public interface YxStoreProductReplyMapper extends BaseMapper<YxStoreProductRepl
"<if test='type == 2'>and A.product_score &lt; 5 and A.product_score &gt; 2</if>" +
"<if test='type == 3'>and A.product_score &lt; 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获取查询对象

View File

@ -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";

View File

@ -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);

View File

@ -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:

View File

@ -93,7 +93,7 @@ file:
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
localUrl: http://localhost:8000
localUrl:
yshop:
#通知相关配置

View File

@ -3,6 +3,7 @@ package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProductAttr;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
* @author hupeng
@ -12,4 +13,7 @@ public interface YxStoreProductAttrRepository extends JpaRepository<YxStoreProdu
//@Modifying
//@Query(value = "delete from yx_store_product_attr where product_id =?1",nativeQuery = true)
void deleteByProductId(int id);
}

View File

@ -3,6 +3,7 @@ package co.yixiang.modules.shop.repository;
import co.yixiang.modules.shop.domain.YxStoreProductAttrValue;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
/**
* @author hupeng
@ -13,4 +14,8 @@ public interface YxStoreProductAttrValueRepository extends JpaRepository<YxStore
//@Modifying
// @Query(value = "delete from yx_store_product_attr_value where product_id =?1",nativeQuery = true)
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);
}

View File

@ -68,6 +68,10 @@ public class YxStoreProductServiceImpl implements YxStoreProductService {
.findNameById(Integer.valueOf(product.getCateId()));
YxStoreProductDTO yxStoreProductDTO = yxStoreProductMapper.toDto(product);
yxStoreProductDTO.setCateName(cateName);
//规格属性库存
Integer newStock = yxStoreProductAttrValueRepository.sumStock(product.getId());
if(newStock != null) yxStoreProductDTO.setStock(newStock);
storeProductDTOS.add(yxStoreProductDTO);
}
Map<String,Object> map = new LinkedHashMap<>(2);

View File

@ -76,7 +76,7 @@ swagger:
enabled: true
title: yshop商城管理后台API
serverUrl: http://localhost:8000
version: 1.7
version: 1.8
# 文件存储路径
file:
@ -85,4 +85,4 @@ file:
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
localUrl:
localUrl: http://localhost:8000

View File

@ -81,7 +81,7 @@ swagger:
enabled: true
title: yshop商城管理后台API
serverUrl: http://localhost:8000
version: 1.7
version: 1.8
# 文件存储路径
file: