boot代码
This commit is contained in:
@@ -115,5 +115,11 @@ public class User extends TenantEntity {
|
||||
*/
|
||||
private Integer isLeader;
|
||||
|
||||
private String invitationCode;
|
||||
|
||||
private Long pid;
|
||||
|
||||
private Date registerDate;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,15 @@
|
||||
package org.springblade.modules.system.service;
|
||||
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.modules.appFormal.dto.CutAmountRangDTO;
|
||||
import org.springblade.modules.appFormal.dto.PayOrderDicDTO;
|
||||
import org.springblade.modules.appOffline.dto.WatchVideoTimeRangeDTO;
|
||||
import org.springblade.modules.auth.dto.UserRegisterRoleDTO;
|
||||
import org.springblade.modules.system.pojo.entity.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 服务类
|
||||
*
|
||||
@@ -43,4 +50,21 @@ public interface IParamService extends BaseService<Param> {
|
||||
*/
|
||||
String getValue(String paramKey);
|
||||
|
||||
|
||||
UserRegisterRoleDTO getUserRegisterRoleInfo();
|
||||
|
||||
String getFormalAppPrivacy();
|
||||
|
||||
List<PayOrderDicDTO> getOrderBizModel();
|
||||
|
||||
BigDecimal getMallCashToPointRate();
|
||||
|
||||
CutAmountRangDTO getMallCutAmountRangDTO();
|
||||
|
||||
List<PayOrderDicDTO> findAppFormalPayType(Integer payModel);
|
||||
|
||||
Boolean isLookAtAdsByOutput();
|
||||
|
||||
WatchVideoTimeRangeDTO watchVideoTimeRange();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,12 +25,28 @@
|
||||
*/
|
||||
package org.springblade.modules.system.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.modules.appFormal.dto.CutAmountRangDTO;
|
||||
import org.springblade.modules.appFormal.dto.PayOrderDicDTO;
|
||||
import org.springblade.modules.appOffline.dto.WatchVideoTimeRangeDTO;
|
||||
import org.springblade.modules.auth.dto.UserRegisterRoleDTO;
|
||||
import org.springblade.modules.system.pojo.entity.Param;
|
||||
import org.springblade.modules.system.mapper.ParamMapper;
|
||||
import org.springblade.modules.system.service.IParamService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
@@ -41,10 +57,97 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class ParamServiceImpl extends BaseServiceImpl<ParamMapper, Param> implements IParamService {
|
||||
|
||||
|
||||
private static final String APP_USER_REGISTER_ROLE = "yichayilu:app:register:role-info";
|
||||
private static final String APP_FORMAL_USER_PRIVACY = "yichayilu:app:formal:user:privacy";
|
||||
private static final String APP_FORMAL_ORDER_MODEL_TYPE = "yichayilu:app:formal:order:model_type";
|
||||
private static final String APP_FORMAL_MALL_CASH_TO_POINT_RATE = "yichayilu:app:formal:mall.cash.to.point.Rate";
|
||||
private static final String APP_FORMAL_MALL_CUT_AMOUNT_RANG = "yichayilu:app:formal:mall.cut.amount.rang";
|
||||
private static final String APP_FORMAL_MALL_PAY_TYPE = "yichayilu:app:formal:pay.type";
|
||||
|
||||
private static final String APP_FORMAL_DAILY_SIGN_IS_LOOK_ADS = "yichayilu:app:dailysign.is.look.ads";
|
||||
private static final String APP_FORMAL_WATCH_VIDEO_TIME_RANG = "yichayilu:app:dailysign:watch.video.time.rang";
|
||||
|
||||
private UserRegisterRoleDTO userRegisterRoleDTO;
|
||||
private Boolean dailySignIsLookAtAds;
|
||||
private WatchVideoTimeRangeDTO watchVideoTimeRangeDTO;
|
||||
|
||||
@XxlJob("yichayilu-app-userRegisterInfo")
|
||||
@PostConstruct
|
||||
public void initAppUserRegisterInfo() {
|
||||
Param param = this.getOne(Wrappers.<Param>query().lambda().eq(Param::getParamKey, APP_USER_REGISTER_ROLE));
|
||||
userRegisterRoleDTO = JSONObject.parseObject(param.getParamValue(), UserRegisterRoleDTO.class);
|
||||
}
|
||||
|
||||
|
||||
@XxlJob("yichayilu-dailysign-isLookAds")
|
||||
@PostConstruct
|
||||
public void initDailySignIsLookAds() {
|
||||
Param param = this.getOne(Wrappers.<Param>query().lambda().eq(Param::getParamKey, APP_FORMAL_DAILY_SIGN_IS_LOOK_ADS));
|
||||
dailySignIsLookAtAds = Boolean.valueOf(param.getParamValue());
|
||||
}
|
||||
|
||||
@XxlJob("yichayilu-dailysign-watchVideoTimeRange")
|
||||
@PostConstruct
|
||||
public void initDailySignWatchVideoTimeRange() {
|
||||
Param param = this.getOne(Wrappers.<Param>query().lambda().eq(Param::getParamKey, APP_FORMAL_WATCH_VIDEO_TIME_RANG));
|
||||
watchVideoTimeRangeDTO = JSONObject.parseObject(param.getParamValue(), WatchVideoTimeRangeDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(String paramKey) {
|
||||
Param param = this.getOne(Wrappers.<Param>query().lambda().eq(Param::getParamKey, paramKey));
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserRegisterRoleDTO getUserRegisterRoleInfo() {
|
||||
return userRegisterRoleDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormalAppPrivacy() {
|
||||
Param param = this.getOne(Wrappers.<Param>query().lambda().eq(Param::getParamKey, APP_FORMAL_USER_PRIVACY));
|
||||
return param.getParamValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayOrderDicDTO> getOrderBizModel() {
|
||||
Param param = getOne(Wrappers.<Param>lambdaQuery().eq(Param::getParamKey,APP_FORMAL_ORDER_MODEL_TYPE));
|
||||
return param != null && StringUtils.hasLength(param.getParamValue()) ? JSON.parseArray(param.getParamValue(), PayOrderDicDTO.class) : new ArrayList<>(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal getMallCashToPointRate() {
|
||||
Param param = getOne(Wrappers.<Param>lambdaQuery().eq(Param::getParamKey,APP_FORMAL_MALL_CASH_TO_POINT_RATE));
|
||||
return BigDecimal.valueOf(Double.parseDouble(param.getParamValue()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CutAmountRangDTO getMallCutAmountRangDTO() {
|
||||
Param param = getOne(Wrappers.<Param>lambdaQuery().eq(Param::getParamKey,APP_FORMAL_MALL_CUT_AMOUNT_RANG));
|
||||
return JSONObject.parseObject(param.getParamValue(), CutAmountRangDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PayOrderDicDTO> findAppFormalPayType(Integer payModel) {
|
||||
Param param = getOne(Wrappers.<Param>lambdaQuery().eq(Param::getParamKey, APP_FORMAL_MALL_PAY_TYPE));
|
||||
if (param != null && StringUtils.hasLength(param.getParamValue())) {
|
||||
Map<Integer, List<PayOrderDicDTO>> result = JSON.parseObject(param.getParamValue(), new TypeReference<Map<Integer, List<PayOrderDicDTO>>>() {
|
||||
});
|
||||
return CollectionUtils.isEmpty(result) ? new ArrayList<>(0) : payModel == null ? result.get(-1) : result.get(payModel);
|
||||
}
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isLookAtAdsByOutput() {
|
||||
return dailySignIsLookAtAds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WatchVideoTimeRangeDTO watchVideoTimeRange() {
|
||||
return watchVideoTimeRangeDTO;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,15 +49,13 @@ import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.jackson.JsonUtil;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.*;
|
||||
import org.springblade.modules.auth.dto.UserRegisterRoleDTO;
|
||||
import org.springblade.modules.auth.provider.UserType;
|
||||
import org.springblade.modules.system.excel.UserExcel;
|
||||
import org.springblade.modules.system.mapper.UserMapper;
|
||||
import org.springblade.modules.system.pojo.entity.*;
|
||||
import org.springblade.modules.system.pojo.vo.UserVO;
|
||||
import org.springblade.modules.system.service.IRoleService;
|
||||
import org.springblade.modules.system.service.IUserDeptService;
|
||||
import org.springblade.modules.system.service.IUserOauthService;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springblade.modules.system.service.*;
|
||||
import org.springblade.modules.system.wrapper.UserWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -86,6 +84,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
private final IRoleService roleService;
|
||||
private final BladeTenantProperties tenantProperties;
|
||||
private final BladeRedis bladeRedis;
|
||||
private final IParamService paramService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -462,11 +461,15 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
|
||||
if (tenant == null || tenant.getId() == null) {
|
||||
throw new OAuth2Exception("租户信息错误!");
|
||||
}
|
||||
|
||||
UserRegisterRoleDTO userRegisterRoleInfo = paramService.getUserRegisterRoleInfo();
|
||||
|
||||
user.setRealName(user.getName());
|
||||
user.setRoleId(StringPool.MINUS_ONE);
|
||||
user.setDeptId(StringPool.MINUS_ONE);
|
||||
user.setPostId(StringPool.MINUS_ONE);
|
||||
user.setStatus(StatusType.IN_ACTIVE.getType());
|
||||
user.setRoleId(userRegisterRoleInfo.getRoleId());
|
||||
user.setDeptId(userRegisterRoleInfo.getDeptId());
|
||||
user.setPostId(userRegisterRoleInfo.getPostId());
|
||||
user.setAvatar(userRegisterRoleInfo.getAvatar());
|
||||
user.setStatus(StatusType.ACTIVE.getType());
|
||||
return this.submit(user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user