后台新增修改用户设备名单标记接口
This commit is contained in:
parent
a2a063f46e
commit
a01432ea86
@ -2,6 +2,7 @@ package com.red.circle.other.inner.endpoint.user.user.api;
|
|||||||
|
|
||||||
import com.red.circle.framework.dto.PageResult;
|
import com.red.circle.framework.dto.PageResult;
|
||||||
import com.red.circle.framework.dto.ResultResponse;
|
import com.red.circle.framework.dto.ResultResponse;
|
||||||
|
import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
||||||
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
||||||
@ -69,4 +70,10 @@ public interface UserExpandClientApi {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/getByUserId")
|
@GetMapping("/getByUserId")
|
||||||
ResultResponse<UserExpandDTO> getByUserId(@RequestParam("userId") Long userId);
|
ResultResponse<UserExpandDTO> getByUserId(@RequestParam("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户设备名单标记
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateDeviceListBlock")
|
||||||
|
ResultResponse<Void> updateDeviceListBlock(@RequestBody UpdateUserExpandDeviceListBlockCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.red.circle.other.inner.model.cmd.user;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户设备名单标记.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class UpdateUserExpandDeviceListBlockCmd {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名单标记: true-黑名单 false-白名单 null-不限制.
|
||||||
|
*/
|
||||||
|
private Boolean deviceListBlock;
|
||||||
|
|
||||||
|
}
|
||||||
@ -61,5 +61,10 @@ public class UserExpandDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String registerCountryCode;
|
private String registerCountryCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名单标记: true-黑名单 false-白名单 null-不限制.
|
||||||
|
*/
|
||||||
|
private Boolean deviceListBlock;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
package com.red.circle.console.adapter.app.user;
|
package com.red.circle.console.adapter.app.user;
|
||||||
|
|
||||||
|
|
||||||
|
import com.red.circle.console.app.dto.cmd.app.user.UserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.console.app.service.app.user.UserExpandService;
|
import com.red.circle.console.app.service.app.user.UserExpandService;
|
||||||
import com.red.circle.framework.web.controller.BaseController;
|
import com.red.circle.framework.web.controller.BaseController;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
|
import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@ -32,4 +36,16 @@ public class UserExpandRestController extends BaseController {
|
|||||||
return userExpandService.getById(userId);
|
return userExpandService.getById(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户设备名单标记.
|
||||||
|
* @eo.name 修改设备名单标记
|
||||||
|
* @eo.url /updateDeviceListBlock
|
||||||
|
* @eo.method post
|
||||||
|
* @eo.request-type json
|
||||||
|
*/
|
||||||
|
@PostMapping("/updateDeviceListBlock")
|
||||||
|
public void updateDeviceListBlock(@RequestBody @Validated UserExpandDeviceListBlockCmd cmd) {
|
||||||
|
userExpandService.updateDeviceListBlock(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.red.circle.console.app.service.app.user;
|
package com.red.circle.console.app.service.app.user;
|
||||||
|
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
|
import com.red.circle.console.app.dto.cmd.app.user.UserExpandDeviceListBlockCmd;
|
||||||
|
import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
|
import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
|
||||||
import com.red.circle.other.inner.endpoint.user.user.UserExpandClient;
|
import com.red.circle.other.inner.endpoint.user.user.UserExpandClient;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -27,4 +29,12 @@ public class UserExpandServiceImpl implements
|
|||||||
public UserExpandDTO getById(Long userId) {
|
public UserExpandDTO getById(Long userId) {
|
||||||
return ResponseAssert.requiredSuccess(userExpandClient.getByUserId(userId));
|
return ResponseAssert.requiredSuccess(userExpandClient.getByUserId(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeviceListBlock(UserExpandDeviceListBlockCmd cmd) {
|
||||||
|
UpdateUserExpandDeviceListBlockCmd innerCmd = new UpdateUserExpandDeviceListBlockCmd()
|
||||||
|
.setUserId(cmd.getUserId())
|
||||||
|
.setDeviceListBlock(cmd.getDeviceListBlock());
|
||||||
|
ResponseAssert.requiredSuccess(userExpandClient.updateDeviceListBlock(innerCmd));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.red.circle.console.app.dto.cmd.app.user;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户设备名单标记.
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class UserExpandDeviceListBlockCmd {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名单标记: true-黑名单 false-白名单 null-不限制.
|
||||||
|
*/
|
||||||
|
private Boolean deviceListBlock;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package com.red.circle.console.app.service.app.user;
|
package com.red.circle.console.app.service.app.user;
|
||||||
|
|
||||||
|
import com.red.circle.console.app.dto.cmd.app.user.UserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
|
import com.red.circle.other.inner.model.dto.user.UserExpandDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,5 +21,11 @@ public interface UserExpandService {
|
|||||||
*/
|
*/
|
||||||
UserExpandDTO getById(Long userId);
|
UserExpandDTO getById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户设备名单标记.
|
||||||
|
*
|
||||||
|
* @param cmd 命令
|
||||||
|
*/
|
||||||
|
void updateDeviceListBlock(UserExpandDeviceListBlockCmd cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.red.circle.other.app.inner.endpoint.user.user;
|
|||||||
|
|
||||||
import com.red.circle.framework.dto.PageResult;
|
import com.red.circle.framework.dto.PageResult;
|
||||||
import com.red.circle.framework.dto.ResultResponse;
|
import com.red.circle.framework.dto.ResultResponse;
|
||||||
|
import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
||||||
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
||||||
@ -63,4 +64,10 @@ public class UserExpandClientEndpoint implements UserExpandClientApi {
|
|||||||
public ResultResponse<UserExpandDTO> getByUserId(Long userId) {
|
public ResultResponse<UserExpandDTO> getByUserId(Long userId) {
|
||||||
return ResultResponse.success(userExpandClientService.getById(userId));
|
return ResultResponse.success(userExpandClientService.getById(userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResultResponse<Void> updateDeviceListBlock(UpdateUserExpandDeviceListBlockCmd cmd) {
|
||||||
|
userExpandClientService.updateDeviceListBlock(cmd);
|
||||||
|
return ResultResponse.success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.red.circle.other.app.inner.service.user.user;
|
package com.red.circle.other.app.inner.service.user.user;
|
||||||
|
|
||||||
import com.red.circle.framework.dto.PageResult;
|
import com.red.circle.framework.dto.PageResult;
|
||||||
|
import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
||||||
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
||||||
@ -54,4 +55,9 @@ public interface UserExpandClientService {
|
|||||||
* 获取用户拓展信息
|
* 获取用户拓展信息
|
||||||
*/
|
*/
|
||||||
UserExpandDTO getById(Long userId);
|
UserExpandDTO getById(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户设备名单标记
|
||||||
|
*/
|
||||||
|
void updateDeviceListBlock(UpdateUserExpandDeviceListBlockCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import com.red.circle.framework.dto.PageResult;
|
|||||||
import com.red.circle.other.infra.database.rds.service.user.user.CheckInLogService;
|
import com.red.circle.other.infra.database.rds.service.user.user.CheckInLogService;
|
||||||
import com.red.circle.other.infra.database.rds.service.user.user.ExpandService;
|
import com.red.circle.other.infra.database.rds.service.user.user.ExpandService;
|
||||||
import com.red.circle.other.app.inner.convertor.user.UserProfileInnerConvertor;
|
import com.red.circle.other.app.inner.convertor.user.UserProfileInnerConvertor;
|
||||||
|
import com.red.circle.other.infra.database.rds.entity.user.user.UserExpand;
|
||||||
|
import com.red.circle.other.inner.model.cmd.user.UpdateUserExpandDeviceListBlockCmd;
|
||||||
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
import com.red.circle.other.inner.model.cmd.user.UserCheckInLogQryCmd;
|
||||||
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
import com.red.circle.other.inner.model.dto.user.ActiveUserCountryCodeDTO;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
|
||||||
@ -63,4 +65,16 @@ public class UserExpandClientServiceImpl implements UserExpandClientService {
|
|||||||
.map(userProfileInnerConvertor::toUserExpandDTO)
|
.map(userProfileInnerConvertor::toUserExpandDTO)
|
||||||
.orElse(null);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeviceListBlock(UpdateUserExpandDeviceListBlockCmd cmd) {
|
||||||
|
UserExpand userExpand = expandService.getById(cmd.getUserId());
|
||||||
|
if (userExpand == null) {
|
||||||
|
expandService.init(cmd.getUserId(), "en");
|
||||||
|
}
|
||||||
|
expandService.update()
|
||||||
|
.set(UserExpand::getDeviceListBlock, cmd.getDeviceListBlock())
|
||||||
|
.eq(UserExpand::getUserId, cmd.getUserId())
|
||||||
|
.execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user