Commit 49260a8c authored by zhangfeng's avatar zhangfeng

bugfix-438,443: 分享统计id命名,客户端活动列表筛选

parent fc70713f
......@@ -16,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 分享记录")
@Api(tags = "用户 APP - 分享记录")
@RequestMapping("/member/score-rule/share-record")
public class AppScoreRuleShareRecordController {
......
......@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.depository.service.warehouse.WarehouseService;
......@@ -57,6 +58,8 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, ScoreRuleDO> implements ScoreRuleService {
private static final String PROD_REGISTER_URL = "https://app2.groupage.cn/#/pages/register/register?code=";
private static final String UAT_REGISTER_URL = "https://apptest.groupage.cn/#/pages/register/register?code=";
private static final String PROD_SHARE_URL = "https://app2.groupage.cn/#";
private static final String UAT_SHARE_URL = "https://apptest.groupage.cn/#";
@Value("${spring.profiles.active}")
private String env;
@Resource
......@@ -509,7 +512,12 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
@Override
public List<AppScoreRuleListBackVO> appGetScoreRuleList(AppScoreRuleListReqVO reqVO) {
List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectList("status", ScoreRuleStatusEnum.ENABLED.getValue());
// 开启,且活动开始时间在当前时间前,结束时间在当前时间后
LambdaQueryWrapperX<ScoreRuleDO> queryWrapperX = new LambdaQueryWrapperX<>();
queryWrapperX.eq(ScoreRuleDO::getStatus, ScoreRuleStatusEnum.ENABLED.getValue())
.lt(ScoreRuleDO::getStartTime, new Date())
.gt(ScoreRuleDO::getEndTime, new Date());
List<ScoreRuleDO> scoreRuleDOS = scoreRuleMapper.selectList(queryWrapperX);
if (CollectionUtils.isNotEmpty(scoreRuleDOS)) {
List<AppScoreRuleListBackVO> appScoreRuleListBackVOS = new ArrayList<>();
for (ScoreRuleDO scoreRuleDO : scoreRuleDOS) {
......@@ -531,6 +539,13 @@ public class ScoreRuleServiceImpl extends AbstractService<ScoreRuleMapper, Score
}
} else if (scoreRuleDO.getType() == ScoreRuleTypeEnum.SHARE.getValue()) {
ScoreRuleShareExtraVO scoreRuleShareExtraVO = JsonUtils.parseObject(scoreRuleDO.getExtra(), ScoreRuleShareExtraVO.class);
MemberUserDO memberUserDO = memberUserService.getUser(reqVO.getMemberId());
String activityUrl = scoreRuleShareExtraVO.getActivityUrl();
if (memberUserDO != null && !"pro".equals(env)) {
scoreRuleShareExtraVO.setActivityUrl(UAT_SHARE_URL + activityUrl);
} else if (memberUserDO != null) {
scoreRuleShareExtraVO.setActivityUrl(PROD_SHARE_URL + activityUrl);
}
appScoreRuleListBackVO.setExtraShare(scoreRuleShareExtraVO);
}
String type = appScoreRuleListBackVO.getType().toString();
......
......@@ -91,7 +91,7 @@ public class ScoreRuleGenCodeUtils {
if (currentMaxShareRecordCode == null){
codeNum = 1L;
} else {
codeNum = Long.parseLong(currentMaxShareRecordCode.substring(3)) + 1;
codeNum = Long.parseLong(currentMaxShareRecordCode.substring(5)) + 1;
}
redisHelper.set(key, String.valueOf(codeNum),10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
......@@ -100,7 +100,8 @@ public class ScoreRuleGenCodeUtils {
lock.unlock();
}
}
// 获得5位序列号,不足位前面补0
// 获得5位序列号
codeNum = codeNum % 100000;
code.append(String.format("%05d", codeNum));
return code.toString();
}
......
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