6 Commits

  1. 8
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/member/impl/CerePlatformMemberLevelServiceImpl.java
  2. 2
      cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml
  3. 2
      cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml
  4. 1
      cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml
  5. 2
      cereshop-admin/src/main/resources/mybatis/mapper/label/CerePlatformLabelDAO.xml
  6. 4
      cereshop-admin/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml
  7. 6
      cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
  8. 2
      cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml
  9. 2
      cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml
  10. 1
      cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java
  11. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/member/CerePlatformMemberLevelDAO.java
  12. 6
      cereshop-app/src/main/java/com/shop/cereshop/app/page/login/BuyerUser.java
  13. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/cart/impl/CereShopCartServiceImpl.java
  14. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/member/CerePlatformMemberLevelService.java
  15. 12
      cereshop-app/src/main/java/com/shop/cereshop/app/service/member/impl/CerePlatformMemberLevelServiceImpl.java
  16. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java
  17. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereProductMemberServiceImpl.java
  18. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/scene/impl/CereShopSceneServiceImpl.java
  19. 16
      cereshop-app/src/main/java/com/shop/cereshop/app/utils/MemberUtil.java
  20. 2
      cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
  21. 8
      cereshop-app/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml
  22. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/SceneController.java
  23. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java
  24. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java
  25. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CerePlatformLabelDAO.java
  26. 5
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/member/CerePlatformMemberLevelDAO.java
  27. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/scene/CereShopSceneDAO.java
  28. 3
      cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java
  29. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java
  30. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CerePlatformLabelService.java
  31. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CerePlatformLabelServiceImpl.java
  32. 10
      cereshop-business/src/main/java/com/shop/cereshop/business/service/member/impl/CerePlatformMemberLevelServiceImpl.java
  33. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/scene/CereShopSceneService.java
  34. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/service/scene/impl/CereShopSceneServiceImpl.java
  35. 2
      cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
  36. 2
      cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml
  37. 4
      cereshop-business/src/main/resources/mybatis/mapper/label/CerePlatformLabelDAO.xml
  38. 6
      cereshop-business/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml
  39. 2
      cereshop-business/src/main/resources/mybatis/mapper/member/CerePlatformMembershipDAO.xml
  40. 4
      cereshop-business/src/main/resources/mybatis/mapper/scene/CereShopSceneDAO.xml
  41. 2
      cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml
  42. 10
      cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml
  43. 2
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java

8
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/member/impl/CerePlatformMemberLevelServiceImpl.java

@ -44,9 +44,9 @@ public class CerePlatformMemberLevelServiceImpl implements CerePlatformMemberLev
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void save(MemberLevelSaveParam param, CerePlatformUser user) throws CoBusinessException {
String time= TimeUtils.yyMMddHHmmss();
if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), null) > 0) {
/* if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), null) > 0) {
throw new CoBusinessException(CoReturnFormat.EXIST_MEMBER_LEVEL);
}
}*/
if (param.getGrowth() != 0 && cerePlatformMemberLevelDAO.countByGrowth(0) == 0) {
throw new CoBusinessException(CoReturnFormat.NEED_ZERO_GROWTH);
}
@ -67,9 +67,9 @@ public class CerePlatformMemberLevelServiceImpl implements CerePlatformMemberLev
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void update(MemberLevelUpdateParam param, CerePlatformUser user) throws CoBusinessException {
String time= TimeUtils.yyMMddHHmmss();
if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), param.getMemberLevelId()) > 0) {
/* if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), param.getMemberLevelId()) > 0) {
throw new CoBusinessException(CoReturnFormat.EXIST_MEMBER_LEVEL);
}
}*/
CerePlatformMemberLevel oldLevel = cerePlatformMemberLevelDAO.selectByPrimaryKey(param.getMemberLevelId());
if (oldLevel == null) {
throw new CoBusinessException(CoReturnFormat.PARAM_INVALID);

2
cereshop-admin/src/main/resources/mybatis/mapper/admin/CereActivitySignDAO.xml

@ -5,7 +5,7 @@
<select id="selectUserCount" resultType="com.shop.cereshop.admin.param.admin.StatsByDay">
SELECT date(create_time) as statsDate, count(buyer_user_id) as totalCount
from cere_buyer_user
where create_time >= #{startTime} and create_time &lt; #{endTime}
where project = 0 and create_time >= #{startTime} and create_time &lt; #{endTime}
group by date(create_time)
</select>

2
cereshop-admin/src/main/resources/mybatis/mapper/buyer/CereBuyerWithdrawalDAO.xml

@ -117,7 +117,7 @@
SELECT a.withdrawal_id,a.withdrawal_money,a.state,
IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) `name`,b.phone from cere_buyer_withdrawal a
LEFT JOIN cere_buyer_user b ON a.buyer_user_id=b.buyer_user_id
where 1=1
where b.project = 0
<if test="name!=null and name!=''">
and IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) like concat('%',#{name},'%')
</if>

1
cereshop-admin/src/main/resources/mybatis/mapper/credit/CereCreditRecordDAO.xml

@ -29,6 +29,7 @@
<if test="search != null and search != ''">
and (a.buyer_user_id = #{search} or b.name like concat('%', #{search}, '%'))
</if>
where b.project = 0
</select>

2
cereshop-admin/src/main/resources/mybatis/mapper/label/CerePlatformLabelDAO.xml

@ -247,7 +247,7 @@
<select id="findAll" resultType="com.shop.cereshop.commons.domain.label.CerePlatformLabel">
SELECT buyer_label_id, label_name, label_type, meet_conditions, last_consumption_time, consumption_frequency,
consumption_money, consumption_day, consumption_start_time, consumption_end_time,
frequency_start, frequency_end, money_start, money_end FROM cere_platform_label
frequency_start, frequency_end, money_start, money_end FROM cere_platform_label where business_id=0
</select>
<select id="findAllByDay" parameterType="java.lang.Object" resultType="java.lang.Object">

4
cereshop-admin/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml

@ -151,7 +151,7 @@
<select id="countMemberLevel" resultType="int">
select count(*)
from cere_platform_member_level
where (member_level_name = #{memberLevelName} or growth = #{growth})
where business_id=0 and (member_level_name = #{memberLevelName} or growth = #{growth})
<if test="excludeMemberLevelId != null">
and member_level_id != #{excludeMemberLevelId}
</if>
@ -160,6 +160,6 @@
<select id="countByGrowth" resultType="int">
select count(*)
from cere_platform_member_level
where growth = #{growth}
where business_id=0 and growth = #{growth}
</select>
</mapper>

6
cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml

@ -570,19 +570,19 @@
<select id="selectChannelOrderUserCount" resultType="java.lang.Integer">
select count(distinct a.buyer_user_id) from cere_shop_order a
join cere_buyer_user b on b.buyer_user_id = a.buyer_user_id
where b.channel_code = #{channelCode} and a.payment_state = 1
where b.project = 0 and b.channel_code = #{channelCode} and a.payment_state = 1
</select>
<select id="selectChannelOrderCount" resultType="java.lang.Integer">
select count(distinct a.order_id) from cere_shop_order a
join cere_buyer_user b on b.buyer_user_id = a.buyer_user_id
where b.channel_code = #{channelCode} and a.payment_state = 1
where b.project = 0 and b.channel_code = #{channelCode} and a.payment_state = 1
</select>
<select id="selectChannelOrderAmount" resultType="java.math.BigDecimal">
select ifnull(sum(price), 0) from cere_shop_order a
join cere_buyer_user b on b.buyer_user_id = a.buyer_user_id
where b.channel_code = #{channelCode} and a.payment_state = 1
where b.project=0 and b.channel_code = #{channelCode} and a.payment_state = 1
</select>
<select id="selectSalesVolumeBySkuIdList" resultType="java.util.Map">

2
cereshop-admin/src/main/resources/mybatis/mapper/risk/CereRiskBlackDAO.xml

@ -22,7 +22,7 @@
select a.id, a.type, a.buyer_user_id, a.state, a.create_time, a.update_time,
b.name, b.phone, b.wechat_open_id as openId
from cere_risk_black a left join cere_buyer_user b on a.buyer_user_id = b.buyer_user_id
where a.type = 2
where a.type = 2 and b.project = 0
<if test="search != null and search != ''">
and
(

2
cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopCommentDAO.xml

@ -128,7 +128,7 @@
SELECT a.comment_id,a.shop_name,a.shop_code,a.product_id,a.state
,IF(b.wechat_name IS NULL,b.`name`,b.wechat_name) `name`,a.create_time from cere_shop_comment a
LEFT JOIN cere_buyer_user b ON a.buyer_user_id=b.buyer_user_id
where 1=1
where b.project = 0
<if test="ifSensitive!=null">
and a.if_sensitive=#{ifSensitive}
</if>

1
cereshop-app/src/main/java/com/shop/cereshop/app/controller/distributor/DistributorController.java

@ -238,6 +238,7 @@ public class DistributorController {
public Result addDistributor(@RequestBody ShopDistributorParam param,HttpServletRequest request) throws CoBusinessException{
//获取当前登录账户
CereBuyerUser user = (CereBuyerUser) request.getAttribute("user");
param.setShopId(Long.valueOf(user.getProject()));
cereShopDistributorService.addDistributor(param);
return new Result(CoReturnFormat.SUCCESS,user.getWechatName(),"申请分销员", GsonUtil.objectToGson(param));
}

4
cereshop-app/src/main/java/com/shop/cereshop/app/dao/member/CerePlatformMemberLevelDAO.java

@ -21,7 +21,7 @@ public interface CerePlatformMemberLevelDAO extends BaseMapper<CerePlatformMembe
int updateByPrimaryKey(CerePlatformMemberLevel record);
CerePlatformMemberLevel selectNextLevel(Long memberLevelId);
CerePlatformMemberLevel selectNextLevel(Long businessId, Long memberLevelId);
CerePlatformMemberLevel selectFirstLevel();
CerePlatformMemberLevel selectFirstLevel(Long businessId);
}

6
cereshop-app/src/main/java/com/shop/cereshop/app/page/login/BuyerUser.java

@ -121,4 +121,10 @@ public class BuyerUser {
* 下一级会员等级名称
*/
private String nextLevelName;
/**
* 所属项目
*/
@ApiModelProperty(value = "所属项目")
private String project;
}

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/cart/impl/CereShopCartServiceImpl.java

@ -504,7 +504,7 @@ public class CereShopCartServiceImpl implements CereShopCartService {
}
//没登录的情况下默认第一等级会员
if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(user.getProject()));
if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId();
}
@ -545,7 +545,7 @@ public class CereShopCartServiceImpl implements CereShopCartService {
memberLevelId = user.getMemberLevelId();
}
if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(user.getProject()));
if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId();
}

5
cereshop-app/src/main/java/com/shop/cereshop/app/service/member/CerePlatformMemberLevelService.java

@ -21,16 +21,17 @@ public interface CerePlatformMemberLevelService {
/**
* 查询下一个等级
* @param businessId
* @param memberLevelId
* @return
*/
CerePlatformMemberLevel selectNextLevel(Long memberLevelId);
CerePlatformMemberLevel selectNextLevel(Long businessId, Long memberLevelId);
/**
* 查询最小等级
* @return
*/
CerePlatformMemberLevel selectFirstLevel();
CerePlatformMemberLevel selectFirstLevel(Long businessId);
/**
* 查询所有的会员等级详情

12
cereshop-app/src/main/java/com/shop/cereshop/app/service/member/impl/CerePlatformMemberLevelServiceImpl.java

@ -10,6 +10,8 @@ import com.shop.cereshop.app.dao.member.CerePlatformMemberLevelDAO;
import com.shop.cereshop.app.dao.member.CerePlatformMembershipDAO;
import com.shop.cereshop.app.param.member.MemberLevelInfo;
import com.shop.cereshop.app.service.member.CerePlatformMemberLevelService;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.commons.domain.activity.CereBuyerCoupon;
import com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,18 +35,20 @@ public class CerePlatformMemberLevelServiceImpl implements CerePlatformMemberLev
}
@Override
public CerePlatformMemberLevel selectNextLevel(Long memberLevelId) {
return cerePlatformMemberLevelDAO.selectNextLevel(memberLevelId);
public CerePlatformMemberLevel selectNextLevel(Long businessId, Long memberLevelId) {
return cerePlatformMemberLevelDAO.selectNextLevel(businessId, memberLevelId);
}
@Override
public CerePlatformMemberLevel selectFirstLevel() {
return cerePlatformMemberLevelDAO.selectFirstLevel();
public CerePlatformMemberLevel selectFirstLevel(Long businessId) {
return cerePlatformMemberLevelDAO.selectFirstLevel(businessId);
}
@Override
public List<MemberLevelInfo> getAllMemberLevelInfo() {
Long businessId = Long.valueOf(ContextUtil.getProject());
LambdaQueryWrapper<CerePlatformMemberLevel> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CerePlatformMemberLevel::getBusinessId, businessId);
wrapper.orderByAsc(CerePlatformMemberLevel::getGrowth);
List<CerePlatformMemberLevel> memberLevelList = cerePlatformMemberLevelDAO.selectList(wrapper);
List<MemberLevelInfo> levelInfoList = new ArrayList<>();

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java

@ -3329,12 +3329,12 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
if (polite.getGrowth() != null && polite.getGrowth() > 0) {
if (user.getMemberLevelId() != null && user.getMemberLevelId() > 0) {
user.setGrowth(user.getGrowth() + polite.getGrowth());
CerePlatformMemberLevel nextLevel = cerePlatformMemberLevelService.selectNextLevel(user.getMemberLevelId());
CerePlatformMemberLevel nextLevel = cerePlatformMemberLevelService.selectNextLevel(Long.valueOf(user.getProject()), user.getMemberLevelId());
if (nextLevel != null && user.getGrowth() >= nextLevel.getGrowth()) {
user.setMemberLevelId(nextLevel.getMemberLevelId());
}
} else {
CerePlatformMemberLevel level = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel level = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(user.getProject()));
if (level != null) {
user.setMemberLevelId(level.getMemberLevelId());
user.setGrowth(polite.getGrowth());

5
cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereProductMemberServiceImpl.java

@ -14,6 +14,7 @@ import com.shop.cereshop.app.page.product.ProductDetail;
import com.shop.cereshop.app.param.member.MemberProductPageParam;
import com.shop.cereshop.app.service.member.CerePlatformMemberLevelService;
import com.shop.cereshop.app.service.product.CereProductMemberService;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
import com.shop.cereshop.commons.domain.common.Page;
@ -73,7 +74,7 @@ public class CereProductMemberServiceImpl implements CereProductMemberService {
memberLevelId = user.getMemberLevelId();
}
if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId();
}
@ -121,7 +122,7 @@ public class CereProductMemberServiceImpl implements CereProductMemberService {
memberLevelId = user.getMemberLevelId();
}
if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId();
}

5
cereshop-app/src/main/java/com/shop/cereshop/app/service/scene/impl/CereShopSceneServiceImpl.java

@ -12,6 +12,7 @@ import com.shop.cereshop.app.page.product.ProductDetail;
import com.shop.cereshop.app.service.member.CerePlatformMemberLevelService;
import com.shop.cereshop.app.service.product.CereProductSkuService;
import com.shop.cereshop.app.service.scene.CereShopSceneService;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.app.utils.SceneUtil;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
@ -74,7 +75,7 @@ public class CereShopSceneServiceImpl implements CereShopSceneService {
}
//没登录的情况下默认第一等级会员
if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId();
}
@ -146,7 +147,7 @@ public class CereShopSceneServiceImpl implements CereShopSceneService {
}
//没登录的情况下默认第一等级会员
if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId();
}

16
cereshop-app/src/main/java/com/shop/cereshop/app/utils/MemberUtil.java

@ -18,7 +18,7 @@ public class MemberUtil {
CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class);
if (cereBuyerUser.getMemberLevelId() != null) {
CerePlatformMemberLevel level = service.selectByMemberLevelId(cereBuyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(cereBuyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(cereBuyerUser.getProject()), cereBuyerUser.getMemberLevelId());
if (level != null) {
cereBuyerUser.setMemberLevelName(level.getMemberLevelName());
}
@ -27,13 +27,13 @@ public class MemberUtil {
cereBuyerUser.setNextLevelName(nextLevel.getMemberLevelName());
}
} else {
CerePlatformMemberLevel level = service.selectFirstLevel();
CerePlatformMemberLevel level = service.selectFirstLevel(Long.valueOf(cereBuyerUser.getProject()));
if (level != null) {
cereBuyerUser.setMemberLevelId(level.getMemberLevelId());
cereBuyerUser.setMemberLevelName(level.getMemberLevelName());
cereBuyerUser.setGrowth(0);
CerePlatformMemberLevel nextLevel = service.selectNextLevel(cereBuyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(cereBuyerUser.getProject()), cereBuyerUser.getMemberLevelId());
if (nextLevel != null) {
cereBuyerUser.setNextLevelGrowth(nextLevel.getGrowth());
cereBuyerUser.setNextLevelName(nextLevel.getMemberLevelName());
@ -48,7 +48,7 @@ public class MemberUtil {
CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class);
if (buyerUser.getMemberLevelId() != null) {
CerePlatformMemberLevel level = service.selectByMemberLevelId(buyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(buyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(ContextUtil.getProject()), buyerUser.getMemberLevelId());
if (level != null) {
buyerUser.setMemberLevelName(level.getMemberLevelName());
}
@ -57,13 +57,13 @@ public class MemberUtil {
buyerUser.setNextLevelName(nextLevel.getMemberLevelName());
}
} else {
CerePlatformMemberLevel level = service.selectFirstLevel();
CerePlatformMemberLevel level = service.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (level != null) {
buyerUser.setMemberLevelId(level.getMemberLevelId());
buyerUser.setMemberLevelName(level.getMemberLevelName());
buyerUser.setGrowth(0);
CerePlatformMemberLevel nextLevel = service.selectNextLevel(buyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(ContextUtil.getProject()), buyerUser.getMemberLevelId());
if (nextLevel != null) {
buyerUser.setNextLevelGrowth(nextLevel.getGrowth());
buyerUser.setNextLevelName(nextLevel.getMemberLevelName());
@ -84,7 +84,7 @@ public class MemberUtil {
}
CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class);
if (cereBuyerUser.getMemberLevelId() == null) {
CerePlatformMemberLevel firstLevel = service.selectFirstLevel();
CerePlatformMemberLevel firstLevel = service.selectFirstLevel(Long.valueOf(cereBuyerUser.getProject()));
if (firstLevel == null) {
cereBuyerUser.setMemberLevelId(0L);
cereBuyerUser.setGrowth(growth);
@ -94,7 +94,7 @@ public class MemberUtil {
}
}
if (cereBuyerUser.getMemberLevelId() != null) {
CerePlatformMemberLevel nextLevel = service.selectNextLevel(cereBuyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(cereBuyerUser.getProject()), cereBuyerUser.getMemberLevelId());
cereBuyerUser.setGrowth(cereBuyerUser.getGrowth() + growth);
//当前用户的成长值达到了下一个级别的成长值
if (nextLevel != null && cereBuyerUser.getGrowth() >= nextLevel.getGrowth()) {

2
cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml

@ -307,7 +307,7 @@
<select id="findByOpenid" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.login.BuyerUser">
SELECT buyer_user_id,IF(wechat_name IS NULL,`name`,wechat_name) wechat_name,token,phone,head_image,member_level_id,
growth, credit, if_black FROM cere_buyer_user where wechat_open_id=#{openid} AND project=#{project}
growth, credit, if_black, project FROM cere_buyer_user where wechat_open_id=#{openid} AND project=#{project}
</select>
<select id="findByAliUserId" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.login.BuyerUser">

8
cereshop-app/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml

@ -123,17 +123,17 @@
update_time = #{updateTime,jdbcType=VARCHAR}
where member_level_id = #{memberLevelId,jdbcType=BIGINT}
</update>
<select id="selectNextLevel" resultType="com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel">
<select id="selectNextLevel" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel">
select
<include refid="Base_Column_List" />
from cere_platform_member_level
where growth > (select growth from cere_platform_member_level where member_level_id = #{memberLevelId})
where business_id=#{businessId} and growth > (select growth from cere_platform_member_level where member_level_id = #{memberLevelId})
order by growth limit 1
</select>
<select id="selectFirstLevel" resultType="com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel">
<select id="selectFirstLevel" parameterType="java.lang.Long" resultType="com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel">
select
<include refid="Base_Column_List" />
from cere_platform_member_level
from cere_platform_member_level where business_id=#{businessId}
order by growth limit 1
</select>
</mapper>

6
cereshop-business/src/main/java/com/shop/cereshop/business/controller/SceneController.java

@ -163,8 +163,10 @@ public class SceneController {
*/
@PostMapping(value = "getMemberLevels")
@ApiOperation(value = "查询会员等级数据")
public Result<List<CerePlatformMemberLevel>> getMemberLevels() throws CoBusinessException{
List<CerePlatformMemberLevel> list=cereShopSceneService.getMemberLevels();
public Result<List<CerePlatformMemberLevel>> getMemberLevels(HttpServletRequest request) throws CoBusinessException{
//获取当前登录账户
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user");
List<CerePlatformMemberLevel> list=cereShopSceneService.getMemberLevels(user.getBusinessId());
return new Result(list);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java

@ -32,7 +32,7 @@ public interface CereBuyerUserDAO extends BaseMapper<CereBuyerUser> {
List<BuyerUser> getAll(BuyerUserGetAllParam param);
CereBuyerUser checkPhone(@Param("phone") String phone);
CereBuyerUser checkPhone(@Param("project") String project, @Param("phone") String phone);
BuyerUserDetail getById(@Param("shopId") Long shopId, @Param("buyerUserId") Long buyerUserId);

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/distributor/CereShopDistributorDAO.java

@ -55,7 +55,7 @@ public interface CereShopDistributorDAO extends BaseMapper<CereShopDistributor>
CereShopDistributor checkPhone(@Param("distributorPhone") String distributorPhone,
@Param("distributorId") Long distributorId,@Param("shopId") Long shopId);
CereBuyerUser checkBuyerUser(@Param("distributorPhone") String distributorPhone);
CereBuyerUser checkBuyerUser(@Param("project") String project, @Param("distributorPhone") String distributorPhone);
void updateReliveBindByShopId(@Param("shopId") Long shopId,@Param("time") String time);

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/label/CerePlatformLabelDAO.java

@ -33,7 +33,7 @@ public interface CerePlatformLabelDAO extends BaseMapper<CerePlatformLabel> {
void deleteByIds(@Param("ids") List<Long> ids);
List<CerePlatformLabel> findAll();
List<CerePlatformLabel> findAll(Long businessId);
List<Long> findAllByDay(@Param("consumptionDay") Integer consumptionDay);

5
cereshop-business/src/main/java/com/shop/cereshop/business/dao/member/CerePlatformMemberLevelDAO.java

@ -35,9 +35,10 @@ public interface CerePlatformMemberLevelDAO extends BaseMapper<CerePlatformMembe
List<Long> findOther(@Param("memberLevelId") Long memberLevelId);
int countMemberLevel(@Param("memberLevelName")String memberLevelName,
int countMemberLevel(@Param("businessId")Long businessId,
@Param("memberLevelName")String memberLevelName,
@Param("growth")Integer growth,
@Param("excludeMemberLevelId")Long excludeMemberLevelId);
int countByGrowth(int growth);
int countByGrowth(Long businessId, int growth);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/scene/CereShopSceneDAO.java

@ -40,7 +40,7 @@ public interface CereShopSceneDAO extends BaseMapper<CereShopScene> {
List<ShopScene> getAll(SceneGetAllParam param);
List<CerePlatformMemberLevel> getMemberLevels();
List<CerePlatformMemberLevel> getMemberLevels(@Param("businessId") Long businessId);
List<CereShopScene> findAll();
}

3
cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java

@ -96,11 +96,12 @@ public class CereBuyerUserServiceImpl implements CereBuyerUserService {
public void save(UserSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException {
String time = TimeUtils.yyMMddHHmmss();
//校验手机号是否存在
CereBuyerUser cereBuyerUser=cereBuyerUserDAO.checkPhone(param.getPhone());
CereBuyerUser cereBuyerUser=cereBuyerUserDAO.checkPhone(String.valueOf(user.getBusinessId()), param.getPhone());
if(cereBuyerUser!=null){
throw new CoBusinessException(CoReturnFormat.PHONE_ALREADY);
}
cereBuyerUser=new CereBuyerUser();
cereBuyerUser.setProject(String.valueOf(user.getBusinessId()));
cereBuyerUser.setCreateTime(time);
cereBuyerUser.setBirthday(param.getBirthday());
cereBuyerUser.setName("MJ"+RandomStringUtil.getRandomCode(4,0));

4
cereshop-business/src/main/java/com/shop/cereshop/business/service/distributor/impl/CereShopDistributorServiceImpl.java

@ -55,7 +55,7 @@ public class CereShopDistributorServiceImpl implements CereShopDistributorServic
throw new CoBusinessException(CoReturnFormat.DISTRIBUTOR_PHONE_ALREADY_ADD);
}
//校验客户是否有效
CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(param.getDistributorPhone());
CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(String.valueOf(user.getBusinessId()), param.getDistributorPhone());
if(buyerUser==null){
throw new CoBusinessException(CoReturnFormat.USER_NOT_BUYER);
}else {
@ -108,7 +108,7 @@ public class CereShopDistributorServiceImpl implements CereShopDistributorServic
throw new CoBusinessException(CoReturnFormat.DISTRIBUTOR_NOT_SELF);
}
//校验客户是否有效
CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(param.getDistributorPhone());
CereBuyerUser buyerUser=cereShopDistributorDAO.checkBuyerUser(String.valueOf(user.getBusinessId()), param.getDistributorPhone());
if(buyerUser==null){
throw new CoBusinessException(CoReturnFormat.USER_NOT_BUYER);
}else {

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/label/CerePlatformLabelService.java

@ -29,7 +29,7 @@ public interface CerePlatformLabelService {
List<PlatformLabel> findExcel(LabelExcelParam param) throws CoBusinessException;
List<CerePlatformLabel> findAll();
List<CerePlatformLabel> findAll(Long business);
List<Long> findAllByDay(Integer consumptionDay);

4
cereshop-business/src/main/java/com/shop/cereshop/business/service/label/impl/CerePlatformLabelServiceImpl.java

@ -195,8 +195,8 @@ public class CerePlatformLabelServiceImpl implements CerePlatformLabelService {
}
@Override
public List<CerePlatformLabel> findAll() {
return cerePlatformLabelDAO.findAll();
public List<CerePlatformLabel> findAll(Long business) {
return cerePlatformLabelDAO.findAll(business);
}
@Override

10
cereshop-business/src/main/java/com/shop/cereshop/business/service/member/impl/CerePlatformMemberLevelServiceImpl.java

@ -49,10 +49,10 @@ public class CerePlatformMemberLevelServiceImpl implements CerePlatformMemberLev
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void save(MemberLevelSaveParam param, CerePlatformBusinessUser user) throws CoBusinessException {
String time= TimeUtils.yyMMddHHmmss();
if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), null) > 0) {
/* if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), null) > 0) {
throw new CoBusinessException(CoReturnFormat.EXIST_MEMBER_LEVEL);
}
if (param.getGrowth() != 0 && cerePlatformMemberLevelDAO.countByGrowth(0) == 0) {
}*/
if (param.getGrowth() != 0 && cerePlatformMemberLevelDAO.countByGrowth(user.getBusinessId(), 0) == 0) {
throw new CoBusinessException(CoReturnFormat.NEED_ZERO_GROWTH);
}
CerePlatformMemberLevel memberLevel=new CerePlatformMemberLevel();
@ -73,9 +73,9 @@ public class CerePlatformMemberLevelServiceImpl implements CerePlatformMemberLev
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void update(MemberLevelUpdateParam param, CerePlatformBusinessUser user) throws CoBusinessException {
String time= TimeUtils.yyMMddHHmmss();
if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), param.getMemberLevelId()) > 0) {
/*if (cerePlatformMemberLevelDAO.countMemberLevel(StringUtils.trim(param.getMemberLevelName()), param.getGrowth(), param.getMemberLevelId()) > 0) {
throw new CoBusinessException(CoReturnFormat.EXIST_MEMBER_LEVEL);
}
}*/
CerePlatformMemberLevel oldLevel = cerePlatformMemberLevelDAO.selectByPrimaryKey(param.getMemberLevelId());
if (oldLevel == null) {
throw new CoBusinessException(CoReturnFormat.PARAM_INVALID);

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/scene/CereShopSceneService.java

@ -37,7 +37,7 @@ public interface CereShopSceneService {
void updateState(CereShopScene cereShopScene) throws CoBusinessException;
List<CerePlatformMemberLevel> getMemberLevels() throws CoBusinessException;
List<CerePlatformMemberLevel> getMemberLevels(Long businessId) throws CoBusinessException;
List<CereShopScene> findAll();
}

4
cereshop-business/src/main/java/com/shop/cereshop/business/service/scene/impl/CereShopSceneServiceImpl.java

@ -458,8 +458,8 @@ public class CereShopSceneServiceImpl implements CereShopSceneService {
}
@Override
public List<CerePlatformMemberLevel> getMemberLevels() throws CoBusinessException {
return cereShopSceneDAO.getMemberLevels();
public List<CerePlatformMemberLevel> getMemberLevels(Long businessId) throws CoBusinessException {
return cereShopSceneDAO.getMemberLevels(businessId);
}
@Override

2
cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml

@ -268,7 +268,7 @@
</select>
<select id="checkPhone" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.buyer.CereBuyerUser">
SELECT phone FROM cere_buyer_user where phone=#{phone}
SELECT phone FROM cere_buyer_user where project=#{project} and phone=#{phone}
</select>
<select id="getById" parameterType="java.lang.Object" resultType="com.shop.cereshop.business.page.buyer.BuyerUserDetail">

2
cereshop-business/src/main/resources/mybatis/mapper/distributor/CereShopDistributorDAO.xml

@ -258,7 +258,7 @@
</select>
<select id="checkBuyerUser" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.buyer.CereBuyerUser">
SELECT buyer_user_id,state,if_black FROM cere_buyer_user where phone=#{distributorPhone}
SELECT buyer_user_id,state,if_black FROM cere_buyer_user where project=#{project} and phone=#{distributorPhone}
</select>
<update id="updateReliveBindByShopId" parameterType="java.lang.Object">

4
cereshop-business/src/main/resources/mybatis/mapper/label/CerePlatformLabelDAO.xml

@ -247,10 +247,10 @@
)
</delete>
<select id="findAll" resultType="com.shop.cereshop.commons.domain.label.CerePlatformLabel">
<select id="findAll" parameterType="java.lang.Long" resultType="com.shop.cereshop.commons.domain.label.CerePlatformLabel">
SELECT buyer_label_id, label_name, label_type, meet_conditions, last_consumption_time, consumption_frequency,
consumption_money, consumption_day, consumption_start_time, consumption_end_time,
frequency_start, frequency_end, money_start, money_end FROM cere_platform_label
frequency_start, frequency_end, money_start, money_end FROM cere_platform_label where business_id=#{businessId}
</select>
<select id="findAllByDay" parameterType="java.lang.Object" resultType="java.lang.Long">

6
cereshop-business/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml

@ -159,11 +159,15 @@
<if test="excludeMemberLevelId != null">
and member_level_id != #{excludeMemberLevelId}
</if>
<if test="businessId != null">
and business_id != #{businessId}
</if>
</select>
<select id="countByGrowth" resultType="int">
select count(*)
from cere_platform_member_level
where growth = #{growth}
where business_id=#{businessId} and growth = #{growth}
</select>
</mapper>

2
cereshop-business/src/main/resources/mybatis/mapper/member/CerePlatformMembershipDAO.xml

@ -10,7 +10,7 @@
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
member_id, member_name, member_icon, member_reason, create_time, update_time
member_id, business_id, member_name, member_icon, member_reason, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select

4
cereshop-business/src/main/resources/mybatis/mapper/scene/CereShopSceneDAO.xml

@ -192,8 +192,8 @@
ORDER BY update_time DESC,create_time DESC
</select>
<select id="getMemberLevels" resultType="com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel">
SELECT * FROM cere_platform_member_level
<select id="getMemberLevels" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.member.CerePlatformMemberLevel">
SELECT * FROM cere_platform_member_level where business_id=#{businessId}
</select>
<select id="findAll" resultType="com.shop.cereshop.commons.domain.scene.CereShopScene">

2
cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopRelationshipDAO.xml

@ -91,7 +91,7 @@
b.if_bind,b.update_time,b.distributor_id FROM cere_buyer_user a
LEFT JOIN cere_distributor_buyer b ON a.buyer_user_id=b.buyer_user_id and b.shop_id=#{shopId}
LEFT JOIN cere_shop_distributor c ON b.distributor_id=c.distributor_id
where 1=1
where a.project = #{shopId}
<if test="name!=null and name!=''">
and (a.wechat_name like concat('%',#{name},'%') OR
a.`name` like concat('%',#{name},'%'))

10
cereshop-business/src/main/resources/mybatis/mapper/tool/CereShopOperateDAO.xml

@ -237,10 +237,10 @@
<select id="findNoBuy" parameterType="com.shop.cereshop.business.param.tool.CrowdCondition"
resultType="java.lang.Long">
SELECT a.buyer_user_id from cere_buyer_user a
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id,project from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
#{number} DAY) &lt;= date(payment_time)
GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id
where b.shop_id=#{shopId} and b.count=0
where b.project=#{shopId} and b.count=0 and a.project=#{shopId}
<if test="ids!=null and ids.size()>0">
and a.buyer_user_id in (
<foreach collection="ids" item="id" index="index" separator=",">
@ -253,10 +253,10 @@
<select id="findNoOrder" parameterType="com.shop.cereshop.business.param.tool.CrowdCondition"
resultType="java.lang.Long">
SELECT a.buyer_user_id from cere_buyer_user a
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id,shop_id,project from cere_shop_order where DATE_SUB(CURDATE(), INTERVAL
#{number} DAY) &lt;= date(create_time)
GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id
where b.shop_id=#{shopId} and b.count=0
where b.project=#{shopId} and b.count=0 and a.project=#{shopId}
<if test="ids!=null and ids.size()>0">
and a.buyer_user_id in (
<foreach collection="ids" item="id" index="index" separator=",">
@ -272,7 +272,7 @@
LEFT JOIN (SELECT COUNT(*) count,buyer_user_id from cere_shop_visit where DATE_SUB(CURDATE(), INTERVAL #{number}
DAY) &lt;= date(visit_time)
GROUP BY buyer_user_id) b ON a.buyer_user_id=b.buyer_user_id
where b.count=0
where a.project=#{shopId} and b.count=0
<if test="ids!=null and ids.size()>0">
and a.buyer_user_id in (
<foreach collection="ids" item="id" index="index" separator=",">

2
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/scene/CereShopScene.java

@ -24,7 +24,7 @@ public class CereShopScene implements Serializable {
private Long sceneId;
/**
* 店铺id
* 店铺id存的是商家id
*/
private Long shopId;

Loading…
Cancel
Save