分销员中心-配置信息
This commit is contained in:
parent
30f35128fd
commit
33e2a12618
|
|
@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
@CacheConfig(cacheNames = "distributionConfig")
|
||||
public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionConfigMapper, MkDistributionConfig> implements MkDistributionConfigService{
|
||||
public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionConfigMapper, MkDistributionConfig> implements MkDistributionConfigService {
|
||||
|
||||
@Resource
|
||||
private MkDistributionLevelConfigService levelConfigService;
|
||||
|
|
@ -37,7 +37,9 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
|
|||
return null;
|
||||
}
|
||||
MkDistributionConfigVO configVO = BeanUtil.copyProperties(config, MkDistributionConfigVO.class);
|
||||
configVO.setLevelConfigList(levelConfigService.list(new QueryWrapper().eq(MkDistributionLevelConfig::getDistributionConfigId, config.getId())));
|
||||
configVO.setLevelConfigList(levelConfigService.list(new QueryWrapper()
|
||||
.eq(MkDistributionLevelConfig::getDistributionConfigId, config.getId())
|
||||
.orderBy(MkDistributionLevelConfig::getLevel).asc()));
|
||||
return configVO;
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +50,7 @@ public class MkDistributionConfigServiceImpl extends ServiceImpl<MkDistributionC
|
|||
BeanUtil.copyProperties(dto, config);
|
||||
|
||||
if (dto.getLevelConfigList() != null) {
|
||||
levelConfigService.updateByShopId(dto.getLevelConfigList(), config.getShopId(), config.getId());
|
||||
levelConfigService.updateByShopId(dto.getLevelConfigList(), config.getShopId(), config.getId());
|
||||
}
|
||||
|
||||
return updateById(config);
|
||||
|
|
|
|||
|
|
@ -132,22 +132,51 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||
|
||||
@Override
|
||||
public Map<String, Object> centerConfig(Long userId, Long shopId) {
|
||||
Map<String, Object> result = new HashMap<>(3);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
ShopInfo shopInfo = shopInfoService.getById(shopId);
|
||||
AssertUtil.isNull(shopInfo, "店铺不存在");
|
||||
result.put("shopName", shopInfo.getShopName());
|
||||
result.put("parentName", "");
|
||||
result.put("parentPhone", "");
|
||||
ShopUser shopUser = shopUserService.getShopUserInfo(userId, shopId);
|
||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||
if (shopUser.getDistributionUserId() != null) {
|
||||
MkDistributionUser mkDistributionUser = this.getById(shopUser.getDistributionUserId());
|
||||
AssertUtil.isNull(mkDistributionUser, "上级分销员不存在");
|
||||
ShopUser shopUserParent = shopUserService.getById(mkDistributionUser.getShopUserId());
|
||||
result.put("parentName", shopUserParent.getNickName());
|
||||
result.put("parentPhone", shopUserParent.getPhone());
|
||||
}
|
||||
MkDistributionUser mkDistributionUser = this.getOne(QueryWrapper.create()
|
||||
.eq(MkDistributionUser::getShopUserId, shopUser.getId()).eq(MkDistributionUser::getShopId, shopId));
|
||||
MkDistributionConfigVO mkDistributionConfigVO = mkDistributionConfigService.detail(shopId);
|
||||
if (mkDistributionUser != null) {
|
||||
|
||||
result.put("inviteCode", mkDistributionUser.getInviteCode());
|
||||
result.put("status", mkDistributionUser.getStatus() == 9);
|
||||
if (mkDistributionUser.getDistributionLevelId() != null) {
|
||||
List<MkDistributionLevelConfig> levelConfigList = mkDistributionConfigVO.getLevelConfigList();
|
||||
boolean isNextLevel = false;
|
||||
for (MkDistributionLevelConfig levelConfig : levelConfigList) {
|
||||
if ("invite".equals(mkDistributionConfigVO.getUpgradeType()) && isNextLevel) {
|
||||
result.put("nextLevelGap", levelConfig.getInviteCount() - mkDistributionUser.getInviteCount());
|
||||
break;
|
||||
}
|
||||
if (levelConfig.getId().equals(mkDistributionUser.getDistributionLevelId())) {
|
||||
result.put("level", levelConfig.getLevel());
|
||||
result.put("levelName", levelConfig.getName());
|
||||
result.put("levelOneCommission", levelConfig.getLevelOneCommission());
|
||||
result.put("levelTwoCommission", levelConfig.getLevelTwoCommission());
|
||||
isNextLevel = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result.put("level", 0);
|
||||
result.put("levelName", "无");
|
||||
}
|
||||
} else {
|
||||
result.put("config", mkDistributionConfigVO);
|
||||
}
|
||||
return null;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue