Commit 351baab7 by caiyt

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

parents 5385b57d f20d798f
...@@ -138,10 +138,10 @@ public class Goods extends BaseEntity { ...@@ -138,10 +138,10 @@ public class Goods extends BaseEntity {
private String preferential; private String preferential;
/** 商品sku数量 */ /** 商品sku数量 */
private Integer skuCount; private Integer skuCount = 0;
/** 商品售罄sku数量 */ /** 商品售罄sku数量 */
private Integer selloutCount; private Integer selloutCount = 0;
/** /**
* 总销量 * 总销量
......
...@@ -33,7 +33,7 @@ public class SysBanner extends BaseEntity { ...@@ -33,7 +33,7 @@ public class SysBanner extends BaseEntity {
/** /**
* 目标:1-小程序首页,2-小程序我的,0-其它 * 目标:1-小程序首页,2-小程序我的,0-其它
*/ */
private Integer target; private String target;
/** /**
* 省份列表 * 省份列表
*/ */
......
...@@ -14,7 +14,7 @@ public class BannerListPo { ...@@ -14,7 +14,7 @@ public class BannerListPo {
/** /**
* 目标:1-小程序首页,2-小程序我的,0-其它 * 目标:1-小程序首页,2-小程序我的,0-其它
*/ */
private Integer target; private String target;
/** /**
* 状态 * 状态
*/ */
......
...@@ -24,7 +24,7 @@ public class BannerPo { ...@@ -24,7 +24,7 @@ public class BannerPo {
/** /**
* 目标:1-小程序首页,2-小程序我的,0-其它 * 目标:1-小程序首页,2-小程序我的,0-其它
*/ */
private Integer target; private String[] target;
/** /**
* 排序 * 排序
*/ */
......
...@@ -27,7 +27,8 @@ public class BannerVo { ...@@ -27,7 +27,8 @@ public class BannerVo {
/** /**
* 目标:1-小程序首页,2-小程序我的,0-其它 * 目标:1-小程序首页,2-小程序我的,0-其它
*/ */
private Integer target; private String[] target;
private String targetStr;
/** /**
* 排序 * 排序
*/ */
......
...@@ -31,9 +31,6 @@ public interface ShopGoodsSkuMapper { ...@@ -31,9 +31,6 @@ public interface ShopGoodsSkuMapper {
*/ */
public List<ShopGoodsSku> selectShopGoodsSkuList(ShopGoodsSku shopGoodsSku); 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关联 * 新增从店铺到sku关联
* *
......
...@@ -109,8 +109,13 @@ public class AppServiceImpl { ...@@ -109,8 +109,13 @@ public class AppServiceImpl {
if (!StringUtils.isEmpty(lng) && !StringUtils.isEmpty(lat)) { 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 realDistance = DistanceUtil.getRealDistance(Double.parseDouble(lng), Double.parseDouble(lat), Double.parseDouble(shop.getLng()), Double.parseDouble(shop.getLat()));
double realKm = realDistance / 1000; double realKm = realDistance / 1000;
double shopLimit = shop.getDistanceLimit() == null ? 0 : shop.getDistanceLimit(); if (realKm > 10) {
if (realKm > 10 || realKm > shopLimit) { shop.setOrderState(0);
shop.setStateDesc("距离较远,门店暂停接单");
return false;
}
Double shopLimit = shop.getDistanceLimit();
if (shopLimit != null && shopLimit > 0 && realKm > shopLimit) {
shop.setOrderState(0); shop.setOrderState(0);
shop.setStateDesc("距离较远,门店暂停接单"); shop.setStateDesc("距离较远,门店暂停接单");
return false; return false;
......
...@@ -57,6 +57,8 @@ public class ShopServiceImpl implements IShopService { ...@@ -57,6 +57,8 @@ public class ShopServiceImpl implements IShopService {
private JiGuangPushServiceImpl jiGuangPushService; private JiGuangPushServiceImpl jiGuangPushService;
@Autowired @Autowired
private GoodsTagMapper goodsTagMapper; private GoodsTagMapper goodsTagMapper;
@Autowired
private ShopGoodsServiceImpl shopGoodsService;
/** /**
* 查询店铺 * 查询店铺
...@@ -279,10 +281,22 @@ public class ShopServiceImpl implements IShopService { ...@@ -279,10 +281,22 @@ public class ShopServiceImpl implements IShopService {
} }
} }
Integer selloutCount = shopGoodsSkuMapper.getSelloutSkuCount(shopId, goods.getId()); List<Spec> specs = shopGoodsService.getShopGoodsSpecs(shopId, goods.getId());
Integer sellinCount = shopGoodsSkuMapper.getSellinSkuCount(shopId, goods.getId()); if (CollectionUtils.isEmpty(specs)) {
goods.setSelloutCount(selloutCount); goods.setSelloutCount(0);
goods.setSkuCount(sellinCount + selloutCount); 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 shopRecommend = new ShopRecommend();
shopRecommend.setShopId(String.valueOf(shopId)); shopRecommend.setShopId(String.valueOf(shopId));
......
...@@ -56,7 +56,7 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -56,7 +56,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
if (banner.getType() == null || banner.getType() < 1 || banner.getType() > 3) { if (banner.getType() == null || banner.getType() < 1 || banner.getType() > 3) {
throw new ServiceException("类型不正确,1-小程序,2-KDS,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-其它"); throw new ServiceException("轮播位置不正确,1-小程序首页,2-小程序我的,0-其它");
} }
if (banner.getSort() == null) { if (banner.getSort() == null) {
...@@ -88,7 +88,7 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -88,7 +88,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
if (banner.getType() == null || banner.getType() < 1 || banner.getType() > 3) { if (banner.getType() == null || banner.getType() < 1 || banner.getType() > 3) {
throw new ServiceException("类型不正确,1-小程序,2-KDS,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-其它"); throw new ServiceException("轮播位置不正确,1-小程序首页,2-小程序我的,0-其它");
} }
if (banner.getSort() == null) { if (banner.getSort() == null) {
...@@ -110,9 +110,12 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -110,9 +110,12 @@ public class SysBannerServiceImpl implements ISysBannerService {
banner.setImage(bannerPo.getImage()); banner.setImage(bannerPo.getImage());
banner.setPage(bannerPo.getPage()); banner.setPage(bannerPo.getPage());
banner.setType(bannerPo.getType()); banner.setType(bannerPo.getType());
banner.setTarget(bannerPo.getTarget());
banner.setSort(bannerPo.getSort()); banner.setSort(bannerPo.getSort());
banner.setState(bannerPo.getState()); 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) { if (bannerPo.getProvince() != null && bannerPo.getProvince().length > 0) {
banner.setProvince("," + Arrays.asList(bannerPo.getProvince()).stream().collect(Collectors.joining(",")) + ","); banner.setProvince("," + Arrays.asList(bannerPo.getProvince()).stream().collect(Collectors.joining(",")) + ",");
} }
...@@ -134,10 +137,28 @@ public class SysBannerServiceImpl implements ISysBannerService { ...@@ -134,10 +137,28 @@ public class SysBannerServiceImpl implements ISysBannerService {
bannerVo.setImage(banner.getImage()); bannerVo.setImage(banner.getImage());
bannerVo.setPage(banner.getPage()); bannerVo.setPage(banner.getPage());
bannerVo.setType(banner.getType()); bannerVo.setType(banner.getType());
bannerVo.setTarget(banner.getTarget());
bannerVo.setSort(banner.getSort()); bannerVo.setSort(banner.getSort());
bannerVo.setState(banner.getState()); 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())) { if (!StringUtils.isEmpty(banner.getProvince())) {
String str = trim(banner.getProvince()); String str = trim(banner.getProvince());
bannerVo.setProvinceStr(str); bannerVo.setProvinceStr(str);
......
...@@ -33,14 +33,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -33,14 +33,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if> <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where> </where>
</select> </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"> <select id="selectShopGoodsSkuById" parameterType="String" resultMap="ShopGoodsSkuResult">
<include refid="selectShopGoodsSkuVo"/> <include refid="selectShopGoodsSkuVo"/>
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
select * from sys_banner select * from sys_banner
<where> <where>
<if test="type != null ">type = #{type}</if> <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="province != null and province != ''">and province like concat('%,', #{province}, ',%')</if>
<if test="city != null and city != ''">and city like concat('%,', #{city}, ',%')</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> <if test="area != null and area != ''">and area like concat('%,', #{area}, ',%')</if>
...@@ -62,6 +62,9 @@ ...@@ -62,6 +62,9 @@
</insert> </insert>
<select id="selectBanners" resultMap="BannerResult"> <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> </select>
</mapper> </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