Browse Source

1.处理商城会员自动升级到下一级会员业务所属商家过滤 2.处理商城获取会员第一等级业务所属商家过滤

multiwx
dy-hu 6 months ago
parent
commit
f8c5446771
  1. 2
      cereshop-admin/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml
  2. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/member/CerePlatformMemberLevelDAO.java
  3. 6
      cereshop-app/src/main/java/com/shop/cereshop/app/page/login/BuyerUser.java
  4. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/cart/impl/CereShopCartServiceImpl.java
  5. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/member/CerePlatformMemberLevelService.java
  6. 8
      cereshop-app/src/main/java/com/shop/cereshop/app/service/member/impl/CerePlatformMemberLevelServiceImpl.java
  7. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java
  8. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/product/impl/CereProductMemberServiceImpl.java
  9. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/scene/impl/CereShopSceneServiceImpl.java
  10. 16
      cereshop-app/src/main/java/com/shop/cereshop/app/utils/MemberUtil.java
  11. 2
      cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
  12. 8
      cereshop-app/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml

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

@ -151,7 +151,7 @@
<select id="countMemberLevel" resultType="int"> <select id="countMemberLevel" resultType="int">
select count(*) select count(*)
from cere_platform_member_level 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"> <if test="excludeMemberLevelId != null">
and member_level_id != #{excludeMemberLevelId} and member_level_id != #{excludeMemberLevelId}
</if> </if>

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); 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; 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) { if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(user.getProject()));
if (firstLevel != null) { if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId(); memberLevelId = firstLevel.getMemberLevelId();
} }
@ -545,7 +545,7 @@ public class CereShopCartServiceImpl implements CereShopCartService {
memberLevelId = user.getMemberLevelId(); memberLevelId = user.getMemberLevelId();
} }
if (memberLevelId == null) { if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(user.getProject()));
if (firstLevel != null) { if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId(); 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 * @param memberLevelId
* @return * @return
*/ */
CerePlatformMemberLevel selectNextLevel(Long memberLevelId);
CerePlatformMemberLevel selectNextLevel(Long businessId, Long memberLevelId);
/** /**
* 查询最小等级 * 查询最小等级
* @return * @return
*/ */
CerePlatformMemberLevel selectFirstLevel();
CerePlatformMemberLevel selectFirstLevel(Long businessId);
/** /**
* 查询所有的会员等级详情 * 查询所有的会员等级详情

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

@ -33,13 +33,13 @@ public class CerePlatformMemberLevelServiceImpl implements CerePlatformMemberLev
} }
@Override @Override
public CerePlatformMemberLevel selectNextLevel(Long memberLevelId) {
return cerePlatformMemberLevelDAO.selectNextLevel(memberLevelId);
public CerePlatformMemberLevel selectNextLevel(Long businessId, Long memberLevelId) {
return cerePlatformMemberLevelDAO.selectNextLevel(businessId, memberLevelId);
} }
@Override @Override
public CerePlatformMemberLevel selectFirstLevel() {
return cerePlatformMemberLevelDAO.selectFirstLevel();
public CerePlatformMemberLevel selectFirstLevel(Long businessId) {
return cerePlatformMemberLevelDAO.selectFirstLevel(businessId);
} }
@Override @Override

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 (polite.getGrowth() != null && polite.getGrowth() > 0) {
if (user.getMemberLevelId() != null && user.getMemberLevelId() > 0) { if (user.getMemberLevelId() != null && user.getMemberLevelId() > 0) {
user.setGrowth(user.getGrowth() + polite.getGrowth()); 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()) { if (nextLevel != null && user.getGrowth() >= nextLevel.getGrowth()) {
user.setMemberLevelId(nextLevel.getMemberLevelId()); user.setMemberLevelId(nextLevel.getMemberLevelId());
} }
} else { } else {
CerePlatformMemberLevel level = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel level = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(user.getProject()));
if (level != null) { if (level != null) {
user.setMemberLevelId(level.getMemberLevelId()); user.setMemberLevelId(level.getMemberLevelId());
user.setGrowth(polite.getGrowth()); 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.param.member.MemberProductPageParam;
import com.shop.cereshop.app.service.member.CerePlatformMemberLevelService; import com.shop.cereshop.app.service.member.CerePlatformMemberLevelService;
import com.shop.cereshop.app.service.product.CereProductMemberService; 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.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
import com.shop.cereshop.commons.domain.common.Page; import com.shop.cereshop.commons.domain.common.Page;
@ -73,7 +74,7 @@ public class CereProductMemberServiceImpl implements CereProductMemberService {
memberLevelId = user.getMemberLevelId(); memberLevelId = user.getMemberLevelId();
} }
if (memberLevelId == null) { if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) { if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId(); memberLevelId = firstLevel.getMemberLevelId();
} }
@ -121,7 +122,7 @@ public class CereProductMemberServiceImpl implements CereProductMemberService {
memberLevelId = user.getMemberLevelId(); memberLevelId = user.getMemberLevelId();
} }
if (memberLevelId == null) { if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) { if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId(); 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.member.CerePlatformMemberLevelService;
import com.shop.cereshop.app.service.product.CereProductSkuService; import com.shop.cereshop.app.service.product.CereProductSkuService;
import com.shop.cereshop.app.service.scene.CereShopSceneService; 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.app.utils.SceneUtil;
import com.shop.cereshop.commons.constant.IntegerEnum; import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
@ -74,7 +75,7 @@ public class CereShopSceneServiceImpl implements CereShopSceneService {
} }
//没登录的情况下默认第一等级会员 //没登录的情况下默认第一等级会员
if (memberLevelId == null) { if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) { if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId(); memberLevelId = firstLevel.getMemberLevelId();
} }
@ -146,7 +147,7 @@ public class CereShopSceneServiceImpl implements CereShopSceneService {
} }
//没登录的情况下默认第一等级会员 //没登录的情况下默认第一等级会员
if (memberLevelId == null) { if (memberLevelId == null) {
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel();
CerePlatformMemberLevel firstLevel = cerePlatformMemberLevelService.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (firstLevel != null) { if (firstLevel != null) {
memberLevelId = firstLevel.getMemberLevelId(); 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); CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class);
if (cereBuyerUser.getMemberLevelId() != null) { if (cereBuyerUser.getMemberLevelId() != null) {
CerePlatformMemberLevel level = service.selectByMemberLevelId(cereBuyerUser.getMemberLevelId()); 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) { if (level != null) {
cereBuyerUser.setMemberLevelName(level.getMemberLevelName()); cereBuyerUser.setMemberLevelName(level.getMemberLevelName());
} }
@ -27,13 +27,13 @@ public class MemberUtil {
cereBuyerUser.setNextLevelName(nextLevel.getMemberLevelName()); cereBuyerUser.setNextLevelName(nextLevel.getMemberLevelName());
} }
} else { } else {
CerePlatformMemberLevel level = service.selectFirstLevel();
CerePlatformMemberLevel level = service.selectFirstLevel(Long.valueOf(cereBuyerUser.getProject()));
if (level != null) { if (level != null) {
cereBuyerUser.setMemberLevelId(level.getMemberLevelId()); cereBuyerUser.setMemberLevelId(level.getMemberLevelId());
cereBuyerUser.setMemberLevelName(level.getMemberLevelName()); cereBuyerUser.setMemberLevelName(level.getMemberLevelName());
cereBuyerUser.setGrowth(0); cereBuyerUser.setGrowth(0);
CerePlatformMemberLevel nextLevel = service.selectNextLevel(cereBuyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(cereBuyerUser.getProject()), cereBuyerUser.getMemberLevelId());
if (nextLevel != null) { if (nextLevel != null) {
cereBuyerUser.setNextLevelGrowth(nextLevel.getGrowth()); cereBuyerUser.setNextLevelGrowth(nextLevel.getGrowth());
cereBuyerUser.setNextLevelName(nextLevel.getMemberLevelName()); cereBuyerUser.setNextLevelName(nextLevel.getMemberLevelName());
@ -48,7 +48,7 @@ public class MemberUtil {
CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class); CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class);
if (buyerUser.getMemberLevelId() != null) { if (buyerUser.getMemberLevelId() != null) {
CerePlatformMemberLevel level = service.selectByMemberLevelId(buyerUser.getMemberLevelId()); 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) { if (level != null) {
buyerUser.setMemberLevelName(level.getMemberLevelName()); buyerUser.setMemberLevelName(level.getMemberLevelName());
} }
@ -57,13 +57,13 @@ public class MemberUtil {
buyerUser.setNextLevelName(nextLevel.getMemberLevelName()); buyerUser.setNextLevelName(nextLevel.getMemberLevelName());
} }
} else { } else {
CerePlatformMemberLevel level = service.selectFirstLevel();
CerePlatformMemberLevel level = service.selectFirstLevel(Long.valueOf(ContextUtil.getProject()));
if (level != null) { if (level != null) {
buyerUser.setMemberLevelId(level.getMemberLevelId()); buyerUser.setMemberLevelId(level.getMemberLevelId());
buyerUser.setMemberLevelName(level.getMemberLevelName()); buyerUser.setMemberLevelName(level.getMemberLevelName());
buyerUser.setGrowth(0); buyerUser.setGrowth(0);
CerePlatformMemberLevel nextLevel = service.selectNextLevel(buyerUser.getMemberLevelId());
CerePlatformMemberLevel nextLevel = service.selectNextLevel(Long.valueOf(ContextUtil.getProject()), buyerUser.getMemberLevelId());
if (nextLevel != null) { if (nextLevel != null) {
buyerUser.setNextLevelGrowth(nextLevel.getGrowth()); buyerUser.setNextLevelGrowth(nextLevel.getGrowth());
buyerUser.setNextLevelName(nextLevel.getMemberLevelName()); buyerUser.setNextLevelName(nextLevel.getMemberLevelName());
@ -84,7 +84,7 @@ public class MemberUtil {
} }
CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class); CerePlatformMemberLevelService service = SpringUtil.getBean(CerePlatformMemberLevelService.class);
if (cereBuyerUser.getMemberLevelId() == null) { if (cereBuyerUser.getMemberLevelId() == null) {
CerePlatformMemberLevel firstLevel = service.selectFirstLevel();
CerePlatformMemberLevel firstLevel = service.selectFirstLevel(Long.valueOf(cereBuyerUser.getProject()));
if (firstLevel == null) { if (firstLevel == null) {
cereBuyerUser.setMemberLevelId(0L); cereBuyerUser.setMemberLevelId(0L);
cereBuyerUser.setGrowth(growth); cereBuyerUser.setGrowth(growth);
@ -94,7 +94,7 @@ public class MemberUtil {
} }
} }
if (cereBuyerUser.getMemberLevelId() != null) { 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); cereBuyerUser.setGrowth(cereBuyerUser.getGrowth() + growth);
//当前用户的成长值达到了下一个级别的成长值 //当前用户的成长值达到了下一个级别的成长值
if (nextLevel != null && cereBuyerUser.getGrowth() >= nextLevel.getGrowth()) { 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 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, 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>
<select id="findByAliUserId" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.login.BuyerUser"> <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} update_time = #{updateTime,jdbcType=VARCHAR}
where member_level_id = #{memberLevelId,jdbcType=BIGINT} where member_level_id = #{memberLevelId,jdbcType=BIGINT}
</update> </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 select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from cere_platform_member_level 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 order by growth limit 1
</select> </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 select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
from cere_platform_member_level
from cere_platform_member_level where business_id=#{businessId}
order by growth limit 1 order by growth limit 1
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save