diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 8f416ef8e9..7946935ffd 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -40,6 +40,7 @@ public interface NumConstant { int FIFTY_ONE = 51; int SIXTY = 60; int ONE_HUNDRED = 100; + int FIVE_HUNDRED = 500; BigDecimal ONE_HUNDRED_DECIMAL = new BigDecimal(100); BigDecimal ZERO_DECIMAL = new BigDecimal(0); int ONE_THOUSAND = 1000; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupAchievementUtils.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupAchievementUtils.java new file mode 100644 index 0000000000..0f135804a8 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/support/GroupAchievementUtils.java @@ -0,0 +1,53 @@ +package com.epmet.modules.support; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; + +/** + * desc:小组成就下一等级规则工具类 + * + * @author: LiuJanJun + * @date: 2021/4/19 4:11 下午 + * @version: 1.0 + * @remark 利用此工具类生成下一等级的目标值 + */ +public class GroupAchievementUtils { + //小组人数、话题数、转议题数、小组内问题解决数 + + /** + * desc:获取下一等级的话题数目标值 步长500 起始值 500 + * + * @param currentValue + */ + public static Integer getNextTopicTargetValue(Integer currentValue) { + if (currentValue < NumConstant.FIVE_HUNDRED) { + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); + } + return currentValue + NumConstant.FIVE_HUNDRED; + } + + /** + * desc:获取下一等级的转议题数目标值 步长50 起始值 100 + * + * @param currentValue + */ + public static Integer getNextToIssueTargetValue(Integer currentValue) { + if (currentValue < NumConstant.ONE_HUNDRED) { + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); + } + return currentValue + NumConstant.FIFTY; + } + + /** + * desc:获取下一等级的话题解决数目标值 步长100 起始值 100 + * + * @param currentValue + */ + public static Integer getNextResolveTopicTargetValue(Integer currentValue) { + if (currentValue < NumConstant.ONE_HUNDRED) { + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getCode()); + } + return currentValue + NumConstant.ONE_HUNDRED; + } +}