Commit 351baab7 by caiyt

Merge remote-tracking branch 'origin/v2' into v2

parents 5385b57d f20d798f
......@@ -138,10 +138,10 @@ public class Goods extends BaseEntity {
private String preferential;
/** 商品sku数量 */
private Integer skuCount;
private Integer skuCount = 0;
/** 商品售罄sku数量 */
private Integer selloutCount;
private Integer selloutCount = 0;
/**
* 总销量
......
......@@ -33,7 +33,7 @@ public class SysBanner extends BaseEntity {
/**
* 目标:1-小程序首页,2-小程序我的,0-其它
*/
private Integer target;
private String target;
/**
* 省份列表
*/
......
......@@ -14,7 +14,7 @@ public class BannerListPo {
/**
* 目标:1-小程序首页,2-小程序我的,0-其它
*/
private Integer target;
private String target;
/**
* 状态
*/
......
......@@ -24,7 +24,7 @@ public class BannerPo {
/**
* 目标:1-小程序首页,2-小程序我的,0-其它
*/
private Integer target;
private String[] target;
/**
* 排序
*/
......
......@@ -27,7 +27,8 @@ public class BannerVo {
/**
* 目标:1-小程序首页,2-小程序我的,0-其它
*/
private Integer target;
private String[] target;
private String targetStr;
/**
* 排序
*/
......
......@@ -31,9 +31,6 @@ public interface ShopGoodsSkuMapper {
*/
public List<ShopGoodsSku> selectShopGoodsSkuList(ShopGoodsSku shopGoodsSku);
Integer getSellinSkuCount(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId);
Integer getSelloutSkuCount(@Param("shopId") Long shopId, @Param("goodsId") Long goodsId);
/**
* 新增从店铺到sku关联
*
......
......@@ -109,8 +109,13 @@ public class AppServiceImpl {
if (!StringUtils.isEmpty(lng) && !StringUtils.isEmpty(lat)) {
double realDistance = DistanceUtil.getRealDistance(Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat()));
double realKm = realDistance / 1000;
double shopLimit = shop.getDistanceLimit() == null ? 0 : shop.getDistanceLimit();
if (realKm > 10 || realKm > shopLimit) {
if (realKm > 10) {
shop.setOrderState(0);
shop.setStateDesc("距离较远,门店暂停接单");
return false;
}
Double shopLimit = shop.getDistanceLimit();
if (shopLimit != null && shopLimit > 0 && realKm > shopLimit) {
shop.setOrderState(0);
shop.setStateDesc("距离较远,门店暂停接单");
return false;
......
......@@ -57,6 +57,8 @@ public class ShopServiceImpl implements IShopService {
private JiGuangPushServiceImpl jiGuangPushService;
@Autowired
private GoodsTagMapper goodsTagMapper;
@Autowired
private ShopGoodsServiceImpl shopGoodsService;
/**
* 查询店铺
......@@ -279,10 +281,22 @@ public class ShopServiceImpl implements IShopService {
}
}
Integer selloutCount = shopGoodsSkuMapper.getSelloutSkuCount(shopId, goods.getId());
Integer sellinCount = shopGoodsSkuMapper.getSellinSkuCount(shopId, goods.getId());
goods.setSelloutCount(selloutCount);
goods.setSkuCount(sellinCount + selloutCount);
List<Spec> specs = shopGoodsService.getShopGoodsSpecs(shopId, goods.getId());
if (CollectionUtils.isEmpty(specs)) {
goods.setSelloutCount(0);
goods.setSkuCount(0);
}
specs.forEach(spec -> {
if (CollectionUtils.isEmpty(spec.getSpecRules())) {
return;
}
spec.getSpecRules().forEach(rule -> {
goods.setSkuCount(goods.getSkuCount() + 1);
if (rule.getState() == 0) {
goods.setSelloutCount(goods.getSelloutCount() + 1);
}
});
});
ShopRecommend shopRecommend = new ShopRecommend();
shopRecommend.setShopId(String.valueOf(shopId));
......
......@@ -56,7 +56,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
if (banner.getType() == null || banner.getType() < 1 || banner.getType() > 3) {
throw new ServiceException("类型不正确,1-小程序,2-KDS,3-点单屏");
}
if (banner.getTarget() == null || banner.getTarget() < 0 || banner.getTarget() > 2) {
if (StringUtils.isEmpty(banner.getTarget())) {
throw new ServiceException("轮播位置不正确,1-小程序首页,2-小程序我的,0-其它");
}
if (banner.getSort() == null) {
......@@ -88,7 +88,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
if (banner.getType() == null || banner.getType() < 1 || banner.getType() > 3) {
throw new ServiceException("类型不正确,1-小程序,2-KDS,3-点单屏");
}
if (banner.getTarget() == null || banner.getTarget() < 0 || banner.getTarget() > 2) {
if (StringUtils.isEmpty(banner.getTarget())) {
throw new ServiceException("轮播位置不正确,1-小程序首页,2-小程序我的,0-其它");
}
if (banner.getSort() == null) {
......@@ -110,9 +110,12 @@ public class SysBannerServiceImpl implements ISysBannerService {
banner.setImage(bannerPo.getImage());
banner.setPage(bannerPo.getPage());
banner.setType(bannerPo.getType());
banner.setTarget(bannerPo.getTarget());
banner.setSort(bannerPo.getSort());
banner.setState(bannerPo.getState());
// banner.setTarget(bannerPo.getTarget());
if (bannerPo.getTarget() != null && bannerPo.getTarget().length > 0) {
banner.setTarget("," + Arrays.asList(bannerPo.getTarget()).stream().collect(Collectors.joining(",")) + ",");
}
if (bannerPo.getProvince() != null && bannerPo.getProvince().length > 0) {
banner.setProvince("," + Arrays.asList(bannerPo.getProvince()).stream().collect(Collectors.joining(",")) + ",");
}
......@@ -134,10 +137,28 @@ public class SysBannerServiceImpl implements ISysBannerService {
bannerVo.setImage(banner.getImage());
bannerVo.setPage(banner.getPage());
bannerVo.setType(banner.getType());
bannerVo.setTarget(banner.getTarget());
bannerVo.setSort(banner.getSort());
bannerVo.setState(banner.getState());
// bannerVo.setTarget(banner.getTarget());
if (!StringUtils.isEmpty(banner.getTarget())) {
String str = trim(banner.getTarget());
bannerVo.setTarget(str.split(","));
String targetStr = "";
for (String s : bannerVo.getTarget()) {
if (!StringUtils.isEmpty(targetStr)) {
targetStr += ",";
}
if (s.equals("1")) {
targetStr += "菜单页顶部";
} else if (s.equals("2")) {
targetStr += "我的页banner";
} else if (s.equals("0")) {
targetStr += "菜单轮播";
}
}
bannerVo.setTargetStr(targetStr);
}
if (!StringUtils.isEmpty(banner.getProvince())) {
String str = trim(banner.getProvince());
bannerVo.setProvinceStr(str);
......
......@@ -34,14 +34,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<select id="getSelloutSkuCount" resultType="Integer">
select count(1) from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId} and `state`!=1
</select>
<select id="getSellinSkuCount" resultType="Integer">
select count(1) from shop_goods_sku where shop_id=#{shopId} and goods_id=#{goodsId} and `state`=1
</select>
<select id="selectShopGoodsSkuById" parameterType="String" resultMap="ShopGoodsSkuResult">
<include refid="selectShopGoodsSkuVo"/>
where id = #{id}
......
......@@ -23,7 +23,7 @@
select * from sys_banner
<where>
<if test="type != null ">type = #{type}</if>
<if test="target != null ">and target = #{target}</if>
<if test="target != null and target != ''">and target like concat('%,', #{target}, ',%')</if>
<if test="province != null and province != ''">and province like concat('%,', #{province}, ',%')</if>
<if test="city != null and city != ''">and city like concat('%,', #{city}, ',%')</if>
<if test="area != null and area != ''">and area like concat('%,', #{area}, ',%')</if>
......@@ -62,6 +62,9 @@
</insert>
<select id="selectBanners" resultMap="BannerResult">
select * from sys_banner where `type` = #{type} and `target` = #{target} and `state` = 0 order by sort, created_at
select * from sys_banner
where `type` = #{type}
<if test="target != null and target != ''">and target like concat('%,', #{target}, ',%')</if>
and `state` = 0 order by sort, created_at
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment