123
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ruoyi.cai.controller.admin;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.dto.admin.SystemConfigResponse;
|
||||||
|
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||||
|
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/cai/systemConfig")
|
||||||
|
public class SystemConfigController {
|
||||||
|
@Autowired
|
||||||
|
private SystemConfigManager systemConfigManager;
|
||||||
|
@GetMapping("/all")
|
||||||
|
public R<List<SystemConfigResponse>> all(){
|
||||||
|
List<SystemConfigResponse> responses = new ArrayList<>();
|
||||||
|
Map<String, String> allSystemConfig = systemConfigManager.getAllSystemConfig();
|
||||||
|
SystemConfigEnum[] values = SystemConfigEnum.values();
|
||||||
|
for (SystemConfigEnum value : values) {
|
||||||
|
SystemConfigResponse sys = new SystemConfigResponse();
|
||||||
|
sys.setKey(value.getKey());
|
||||||
|
sys.setValue(allSystemConfig.getOrDefault(value.getKey(),value.getDefaultValue()));
|
||||||
|
sys.setDesc(value.getDesc());
|
||||||
|
responses.add(sys);
|
||||||
|
}
|
||||||
|
return R.ok(responses);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/update")
|
||||||
|
public R<Boolean> update(String key,String value){
|
||||||
|
systemConfigManager.set(key,value);
|
||||||
|
return R.ok(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.cai.dto.admin;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SystemConfigResponse implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 823337632804304288L;
|
||||||
|
private String key;
|
||||||
|
private String desc;
|
||||||
|
private String value;
|
||||||
|
}
|
||||||
@@ -9,9 +9,6 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
@Schema(description = "用户列表返回")
|
@Schema(description = "用户列表返回")
|
||||||
public class UserListVo extends UserBaseVo {
|
public class UserListVo extends UserBaseVo {
|
||||||
/**
|
@Schema(description = "绑定时间")
|
||||||
* 最后在线时间
|
private LocalDateTime bindTime;
|
||||||
*/
|
|
||||||
@Schema(description = "最后在线时间")
|
|
||||||
private LocalDateTime lastLiveTime;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,4 +98,8 @@ public class SystemConfigManager {
|
|||||||
public void setSystemConfig(SystemConfigEnum systemConfig,String value){
|
public void setSystemConfig(SystemConfigEnum systemConfig,String value){
|
||||||
redisTemplate.opsForHash().put(RedisConstant.SYSTEM_CONFIG, systemConfig.name(),value);
|
redisTemplate.opsForHash().put(RedisConstant.SYSTEM_CONFIG, systemConfig.name(),value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void set(String key, String value) {
|
||||||
|
redisTemplate.opsForHash().put(RedisConstant.SYSTEM_CONFIG, key,value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public interface UserInviteMapper extends BaseMapper<UserInvite> {
|
|||||||
|
|
||||||
InviteCountDTO countInviteAndReward(@Param("userId") Long userId);
|
InviteCountDTO countInviteAndReward(@Param("userId") Long userId);
|
||||||
|
|
||||||
Page<UserListVo> inviteUserPage(@Param("build") Page<Object> build, @Param("userId") Long userId);
|
Page<UserListVo> inviteUserPage(@Param("build") Page<Object> build, @Param("inviteId") Long inviteId);
|
||||||
|
|
||||||
Page<UserInviteAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserInviteAdminVo bo);
|
Page<UserInviteAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserInviteAdminVo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public interface UserInviteService extends IService<UserInvite> {
|
|||||||
|
|
||||||
InviteHomeVo inviteHome(Long userId);
|
InviteHomeVo inviteHome(Long userId);
|
||||||
|
|
||||||
Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long userId);
|
Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long inviteId);
|
||||||
|
|
||||||
Page<UserInviteAdminVo> pageAdmin(PageQuery pageQuery, UserInviteAdminVo bo);
|
Page<UserInviteAdminVo> pageAdmin(PageQuery pageQuery, UserInviteAdminVo bo);
|
||||||
|
|
||||||
|
|||||||
@@ -58,9 +58,12 @@ public class UserInviteServiceImpl extends ServiceImpl<UserInviteMapper, UserInv
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取我邀请的人
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long userId) {
|
public Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long inviteId) {
|
||||||
return baseMapper.inviteUserPage(pageQuery.build(),userId);
|
return baseMapper.inviteUserPage(pageQuery.build(),inviteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="createTime" column="create_time"/>
|
<result property="createTime" column="create_time"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="countInviteAndReward" resultType="com.ruoyi.cai.dto.app.dto.InviteCountDTO">
|
<select id="countInviteAndReward" resultType="com.ruoyi.cai.dto.app.dto.InviteCountDTO">
|
||||||
select ifnull(sum(reward_money_total),0) as total_reward,
|
select ifnull(sum(reward_coin_total),0) as total_reward,
|
||||||
ifnull(count(1),0) as total_invite
|
ifnull(count(1),0) as total_invite
|
||||||
from cai_user_invite
|
from cai_user_invite
|
||||||
where invite_id = #{userId}
|
where invite_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
<select id="inviteUserPage" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
<select id="inviteUserPage" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
||||||
select t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age
|
select t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age, t1.create_time as bind_time
|
||||||
from cai_user_invite t1
|
from cai_user_invite t1
|
||||||
join cai_user t2 on t1.user_id = t2.id
|
join cai_user t2 on t1.user_id = t2.id
|
||||||
where t1.user_id = #{userId}
|
where t1.invite_id = #{inviteId}
|
||||||
</select>
|
</select>
|
||||||
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.UserInviteAdminVo">
|
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.UserInviteAdminVo">
|
||||||
select t1.*,
|
select t1.*,
|
||||||
|
|||||||
Reference in New Issue
Block a user