Browse Source

会员等级成长值校验完善处理

multiwx
dy-hu 11 months ago
parent
commit
bbbe77232a
  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/member/CerePlatformMemberLevelDAO.xml
  3. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/member/CerePlatformMemberLevelDAO.java
  4. 10
      cereshop-business/src/main/java/com/shop/cereshop/business/service/member/impl/CerePlatformMemberLevelServiceImpl.java
  5. 2
      cereshop-business/src/main/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml

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/member/CerePlatformMemberLevelDAO.xml

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

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

@ -39,5 +39,5 @@ public interface CerePlatformMemberLevelDAO extends BaseMapper<CerePlatformMembe
@Param("growth")Integer growth,
@Param("excludeMemberLevelId")Long excludeMemberLevelId);
int countByGrowth(int growth);
int countByGrowth(Long businessId, int growth);
}

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/resources/mybatis/mapper/member/CerePlatformMemberLevelDAO.xml

@ -164,6 +164,6 @@
<select id="countByGrowth" resultType="int">
select count(*)
from cere_platform_member_level
where growth = #{growth}
where business_id=#{businessId} and growth = #{growth}
</select>
</mapper>
Loading…
Cancel
Save