房间背景/经理用户
This commit is contained in:
parent
8320aae316
commit
4d5151f4bc
@ -0,0 +1,13 @@
|
||||
package com.red.circle.other.inner.endpoint.team.manager;
|
||||
|
||||
import com.red.circle.other.inner.endpoint.team.manager.api.TeamManagerClientApi;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
@FeignClient(name = "teamManagerClient", url = "${feign.other.url}" +
|
||||
TeamManagerClientApi.API_PREFIX)
|
||||
public interface TeamManagerClient extends TeamManagerClientApi {
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.red.circle.other.inner.endpoint.team.manager.api;
|
||||
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.agency.manager.TeamManagerDTO;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.RequestParam;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
public interface TeamManagerClientApi {
|
||||
|
||||
String API_PREFIX = "/team/manager/client";
|
||||
|
||||
@GetMapping("/getById")
|
||||
ResultResponse<TeamManagerDTO> getById(@RequestParam("id") Long id);
|
||||
|
||||
@GetMapping("/getByUserId")
|
||||
ResultResponse<TeamManagerDTO> getByUserId(@RequestParam("userId") Long userId);
|
||||
|
||||
@PostMapping("/add")
|
||||
ResultResponse<Void> add(@RequestBody @Validated TeamManagerAddCmd cmd);
|
||||
|
||||
@GetMapping("/check")
|
||||
ResultResponse<Boolean> check(@RequestParam("userId") Long userId);
|
||||
|
||||
@PostMapping("/mapCheck")
|
||||
ResultResponse<Map<Long, Boolean>> mapCheck(@RequestBody Set<Long> userIds);
|
||||
|
||||
@PostMapping("/pageOps")
|
||||
ResultResponse<PageResult<TeamManagerDTO>> pageOps(@RequestBody TeamManagerOpsPageQryCmd qryCmd);
|
||||
|
||||
@PostMapping("/updateSelectiveById")
|
||||
ResultResponse<Void> updateSelectiveById(@RequestBody @Validated TeamManagerDTO dto);
|
||||
|
||||
@GetMapping("/deleteById")
|
||||
ResultResponse<Void> deleteById(@RequestParam("id") Long id);
|
||||
|
||||
}
|
||||
@ -32,6 +32,9 @@ public interface UserHistoryIdentityClientApi {
|
||||
@GetMapping("/saveHost")
|
||||
ResultResponse<Void> saveHost(@RequestParam("userId") Long userId);
|
||||
|
||||
@GetMapping("/saveBd")
|
||||
ResultResponse<Void> saveBd(@RequestParam("userId") Long userId);
|
||||
}
|
||||
@GetMapping("/saveBd")
|
||||
ResultResponse<Void> saveBd(@RequestParam("userId") Long userId);
|
||||
|
||||
@GetMapping("/saveManager")
|
||||
ResultResponse<Void> saveManager(@RequestParam("userId") Long userId);
|
||||
}
|
||||
|
||||
@ -5,10 +5,14 @@ package com.red.circle.other.inner.enums.team;
|
||||
*
|
||||
* @author pengshigang on 2021/7/17
|
||||
*/
|
||||
public enum TeamUserIdentity {
|
||||
/**
|
||||
* 代理
|
||||
*/
|
||||
public enum TeamUserIdentity {
|
||||
/**
|
||||
* 经理
|
||||
*/
|
||||
MANAGER,
|
||||
/**
|
||||
* 代理
|
||||
*/
|
||||
AGENT,
|
||||
/**
|
||||
* 主播
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package com.red.circle.other.inner.model.cmd.team.manager;
|
||||
|
||||
import com.red.circle.framework.dto.Command;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 添加团队经理.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamManagerAddCmd extends Command {
|
||||
|
||||
@NotNull(message = "id required.")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "sysOrigin required.")
|
||||
private String sysOrigin;
|
||||
|
||||
@NotNull(message = "userId required.")
|
||||
private Long userId;
|
||||
|
||||
private String contact;
|
||||
|
||||
@NotBlank(message = "regionId required.")
|
||||
private String regionId;
|
||||
|
||||
@NotNull(message = "createUser required.")
|
||||
private Long createUser;
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.red.circle.other.inner.model.cmd.team.manager;
|
||||
|
||||
import com.red.circle.framework.core.dto.PageCommand;
|
||||
import java.io.Serial;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 运营后台团队经理查询.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamManagerOpsPageQryCmd extends PageCommand {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private String sysOrigin;
|
||||
|
||||
private Long createUser;
|
||||
|
||||
}
|
||||
@ -34,9 +34,14 @@ public class UserHistoryIdentityDTO implements Serializable {
|
||||
*/
|
||||
private Boolean agent;
|
||||
|
||||
/**
|
||||
* 是否做过主播.
|
||||
*/
|
||||
private Boolean host;
|
||||
|
||||
}
|
||||
/**
|
||||
* 是否做过主播.
|
||||
*/
|
||||
private Boolean host;
|
||||
|
||||
/**
|
||||
* 是否做过团队经理.
|
||||
*/
|
||||
private Boolean manager;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.red.circle.other.inner.model.dto.agency.manager;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.red.circle.framework.dto.DTO;
|
||||
import java.io.Serial;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class TeamManagerDTO extends DTO {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String sysOrigin;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
private String contact;
|
||||
|
||||
private String regionId;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
|
||||
private Long createUser;
|
||||
|
||||
private Long updateUser;
|
||||
|
||||
}
|
||||
@ -43,14 +43,19 @@ public class RoomProfileDTO implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 背景图.
|
||||
*/
|
||||
private String roomBackground;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
private String roomName;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.red.circle.console.adapter.app.team.manager;
|
||||
|
||||
import com.red.circle.console.app.dto.clienobject.team.manager.TeamManagerCO;
|
||||
import com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerUpdateCmd;
|
||||
import com.red.circle.console.app.service.app.team.manager.TeamManagerService;
|
||||
import com.red.circle.console.infra.annotations.OpsOperationReqLog;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.web.controller.BaseController;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.RestController;
|
||||
|
||||
/**
|
||||
* 团队经理前端控制器.
|
||||
*/
|
||||
@RestController("teamOpsManagerRestController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/team/manager")
|
||||
public class TeamManagerRestController extends BaseController {
|
||||
|
||||
private final TeamManagerService teamManagerService;
|
||||
|
||||
@GetMapping("/page")
|
||||
public PageResult<TeamManagerCO> pageOps(TeamManagerOpsPageQryCmd qryCmd) {
|
||||
return teamManagerService.pageOps(qryCmd);
|
||||
}
|
||||
|
||||
@OpsOperationReqLog("添加团队经理")
|
||||
@PostMapping("/add")
|
||||
public void add(@RequestBody @Validated TeamManagerAddCmd cmd) {
|
||||
cmd.setCreateUser(getReqUserId());
|
||||
teamManagerService.add(cmd);
|
||||
}
|
||||
|
||||
@OpsOperationReqLog("编辑团队经理")
|
||||
@PostMapping("/update")
|
||||
public void update(@RequestBody @Validated TeamManagerUpdateCmd cmd) {
|
||||
cmd.setUpdateUser(getReqUserId());
|
||||
teamManagerService.update(cmd);
|
||||
}
|
||||
|
||||
@OpsOperationReqLog("删除团队经理")
|
||||
@GetMapping("/del")
|
||||
public void deleteById(Long id) {
|
||||
teamManagerService.delete(id, getReqUserId());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,133 @@
|
||||
package com.red.circle.console.app.service.app.team.manager;
|
||||
|
||||
import com.red.circle.console.app.dto.clienobject.team.manager.TeamManagerCO;
|
||||
import com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerUpdateCmd;
|
||||
import com.red.circle.console.infra.database.rds.entity.admin.User;
|
||||
import com.red.circle.console.infra.database.rds.service.admin.UserService;
|
||||
import com.red.circle.console.inner.error.ConsoleErrorCode;
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.endpoint.team.manager.TeamManagerClient;
|
||||
import com.red.circle.other.inner.endpoint.team.target.UserHistoryIdentityClient;
|
||||
import com.red.circle.other.inner.endpoint.user.region.RegionConfigClient;
|
||||
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.agency.manager.TeamManagerDTO;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||
import com.red.circle.tool.core.text.StringUtils;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 团队经理管理实现.
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TeamManagerServiceImpl implements TeamManagerService {
|
||||
|
||||
private final UserService userService;
|
||||
private final TeamManagerClient teamManagerClient;
|
||||
private final UserProfileClient userProfileClient;
|
||||
private final RegionConfigClient regionConfigClient;
|
||||
private final UserHistoryIdentityClient userHistoryIdentityClient;
|
||||
|
||||
@Override
|
||||
public PageResult<TeamManagerCO> pageOps(TeamManagerOpsPageQryCmd qryCmd) {
|
||||
PageResult<TeamManagerDTO> pageResult = ResponseAssert.requiredSuccess(
|
||||
teamManagerClient.pageOps(qryCmd));
|
||||
|
||||
if (pageResult.checkRecordsEmpty()) {
|
||||
return pageResult.emptyRecords();
|
||||
}
|
||||
|
||||
Map<Long, User> sysUserMap = userService.mapBackUser(
|
||||
Stream.of(pageResult.getRecords().stream()
|
||||
.filter(info -> Objects.nonNull(info.getCreateUser())
|
||||
&& info.getCreateUser() > 0)
|
||||
.map(TeamManagerDTO::getCreateUser)
|
||||
.collect(Collectors.toSet()),
|
||||
pageResult.getRecords().stream()
|
||||
.filter(info -> Objects.nonNull(info.getUpdateUser())
|
||||
&& info.getUpdateUser() > 0)
|
||||
.map(TeamManagerDTO::getUpdateUser)
|
||||
.collect(Collectors.toSet()))
|
||||
.flatMap(Collection::stream)
|
||||
.collect(Collectors.toSet()));
|
||||
|
||||
Map<Long, UserProfileDTO> userProfileMap = ResponseAssert.requiredSuccess(
|
||||
userProfileClient.mapByUserIds(pageResult.getRecords().stream()
|
||||
.map(TeamManagerDTO::getUserId)
|
||||
.collect(Collectors.toSet())));
|
||||
|
||||
Map<String, String> regionNameMap = ResponseAssert.requiredSuccess(
|
||||
regionConfigClient.mapRegionNameByRegionIds(
|
||||
pageResult.getRecords().stream()
|
||||
.map(TeamManagerDTO::getRegionId)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet())));
|
||||
|
||||
return pageResult.convert(info -> new TeamManagerCO()
|
||||
.setId(info.getId())
|
||||
.setSysOrigin(info.getSysOrigin())
|
||||
.setUserProfile(userProfileMap.get(info.getUserId()))
|
||||
.setContact(info.getContact())
|
||||
.setCreateUserName(
|
||||
Optional.ofNullable(sysUserMap.get(info.getCreateUser())).map(User::getNickname)
|
||||
.orElse(""))
|
||||
.setUpdateUserName(
|
||||
Optional.ofNullable(sysUserMap.get(info.getUpdateUser())).map(User::getNickname)
|
||||
.orElse(""))
|
||||
.setRegionId(info.getRegionId())
|
||||
.setRegionName(regionNameMap.get(info.getRegionId()))
|
||||
.setCreateTime(info.getCreateTime())
|
||||
.setUpdateTime(info.getUpdateTime()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerAddCmd cmd) {
|
||||
UserProfileDTO userProfile = ResponseAssert.requiredSuccess(
|
||||
userProfileClient.getByUserId(cmd.getUserId()));
|
||||
ResponseAssert.notNull(ConsoleErrorCode.USER_INFO_NOT_FOUND, userProfile);
|
||||
|
||||
ResponseAssert.isFalse(ConsoleErrorCode.USER_ALREADY_EXISTS,
|
||||
ResponseAssert.requiredSuccess(teamManagerClient.check(cmd.getUserId())));
|
||||
|
||||
com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd addCmd =
|
||||
new com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd()
|
||||
.setId(IdWorkerUtils.getId())
|
||||
.setUserId(cmd.getUserId())
|
||||
.setSysOrigin(cmd.getSysOrigin())
|
||||
.setContact(cmd.getContact())
|
||||
.setRegionId(cmd.getRegionId())
|
||||
.setCreateUser(cmd.getCreateUser());
|
||||
|
||||
ResponseAssert.requiredSuccess(teamManagerClient.add(addCmd));
|
||||
ResponseAssert.requiredSuccess(userHistoryIdentityClient.saveManager(cmd.getUserId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(TeamManagerUpdateCmd cmd) {
|
||||
ResponseAssert.requiredSuccess(teamManagerClient.updateSelectiveById(new TeamManagerDTO()
|
||||
.setId(cmd.getId())
|
||||
.setContact(cmd.getContact())
|
||||
.setRegionId(cmd.getRegionId())
|
||||
.setUpdateUser(cmd.getUpdateUser())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id, Long updateUser) {
|
||||
TeamManagerDTO db = ResponseAssert.requiredSuccess(teamManagerClient.getById(id));
|
||||
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, db);
|
||||
ResponseAssert.requiredSuccess(teamManagerClient.deleteById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -23,9 +23,10 @@ import com.red.circle.other.inner.endpoint.material.props.PropsBackpackClient;
|
||||
import com.red.circle.other.inner.endpoint.material.props.PropsNobleVipClient;
|
||||
import com.red.circle.other.inner.endpoint.sys.SysCountryCodeClient;
|
||||
import com.red.circle.other.inner.endpoint.sys.SysImAccountClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamInfoClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamLeaderClient;
|
||||
import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamInfoClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamLeaderClient;
|
||||
import com.red.circle.other.inner.endpoint.team.manager.TeamManagerClient;
|
||||
import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient;
|
||||
import com.red.circle.other.inner.endpoint.team.target.UserHistoryIdentityClient;
|
||||
import com.red.circle.other.inner.endpoint.user.device.RegisterDeviceClient;
|
||||
import com.red.circle.other.inner.endpoint.user.region.UserRegionClient;
|
||||
@ -91,8 +92,9 @@ public class UserBaseInfoServiceImpl implements
|
||||
private final TeamProfileClient teamProfileClient;
|
||||
private final UserProfileClient userProfileClient;
|
||||
private final FreightGoldClient freightGoldClient;
|
||||
private final BdTeamLeaderClient bdTeamLeaderClient;
|
||||
private final SysCountryCodeClient countryCodeClient;
|
||||
private final BdTeamLeaderClient bdTeamLeaderClient;
|
||||
private final TeamManagerClient teamManagerClient;
|
||||
private final SysCountryCodeClient countryCodeClient;
|
||||
private final PropsBackpackClient propsBackpackClient;
|
||||
private final PropsNobleVipClient propsNobleVipClient;
|
||||
private final WalletDiamondClient walletDiamondClient;
|
||||
@ -283,9 +285,10 @@ public class UserBaseInfoServiceImpl implements
|
||||
return new UserIdentityCO()
|
||||
.setAgent(Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole()))
|
||||
.setAnchor(Objects.nonNull(teamMember))
|
||||
.setBd(ResponseAssert.requiredSuccess(bdTeamInfoClient.check(userId)))
|
||||
.setBdLeader(ResponseAssert.requiredSuccess(bdTeamLeaderClient.check(userId)))
|
||||
.setFreightAgent(
|
||||
.setBd(ResponseAssert.requiredSuccess(bdTeamInfoClient.check(userId)))
|
||||
.setBdLeader(ResponseAssert.requiredSuccess(bdTeamLeaderClient.check(userId)))
|
||||
.setManager(ResponseAssert.requiredSuccess(teamManagerClient.check(userId)))
|
||||
.setFreightAgent(
|
||||
ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userId)))
|
||||
.setHistoryIdentity(
|
||||
ResponseAssert.requiredSuccess(historyIdentityClient.getLabels(userId)));
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
package com.red.circle.console.app.dto.clienobject.team.manager;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.red.circle.framework.dto.ClientObject;
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
import java.io.Serial;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamManagerCO extends ClientObject {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
private String sysOrigin;
|
||||
|
||||
private UserProfileDTO userProfile;
|
||||
|
||||
private String contact;
|
||||
|
||||
private String createUserName;
|
||||
|
||||
private String updateUserName;
|
||||
|
||||
private String regionId;
|
||||
|
||||
private String regionName;
|
||||
|
||||
private Timestamp createTime;
|
||||
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -31,13 +31,18 @@ public class UserIdentityCO implements Serializable {
|
||||
*/
|
||||
private Boolean bd;
|
||||
|
||||
/**
|
||||
* true:bd Leader,false:不是.
|
||||
*/
|
||||
private Boolean bdLeader;
|
||||
|
||||
/**
|
||||
* 货运代理: true:是 false:不是.
|
||||
/**
|
||||
* true:bd Leader,false:不是.
|
||||
*/
|
||||
private Boolean bdLeader;
|
||||
|
||||
/**
|
||||
* true:团队经理,false:不是.
|
||||
*/
|
||||
private Boolean manager;
|
||||
|
||||
/**
|
||||
* 货运代理: true:是 false:不是.
|
||||
*/
|
||||
private Boolean freightAgent;
|
||||
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.red.circle.console.app.dto.cmd.app.team.manager;
|
||||
|
||||
import com.red.circle.framework.dto.Command;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.Serial;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 添加团队经理.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamManagerAddCmd extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "userId required.")
|
||||
private Long userId;
|
||||
|
||||
private String sysOrigin;
|
||||
|
||||
private String contact;
|
||||
|
||||
private Long createUser;
|
||||
|
||||
@NotBlank(message = "regionId required.")
|
||||
private String regionId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.red.circle.console.app.dto.cmd.app.team.manager;
|
||||
|
||||
import com.red.circle.framework.dto.Command;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.io.Serial;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 修改团队经理.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TeamManagerUpdateCmd extends Command {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "id required.")
|
||||
private Long id;
|
||||
|
||||
private String contact;
|
||||
|
||||
private Long updateUser;
|
||||
|
||||
@NotBlank(message = "regionId required.")
|
||||
private String regionId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.red.circle.console.app.service.app.team.manager;
|
||||
|
||||
import com.red.circle.console.app.dto.clienobject.team.manager.TeamManagerCO;
|
||||
import com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.console.app.dto.cmd.app.team.manager.TeamManagerUpdateCmd;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
|
||||
/**
|
||||
* 团队经理管理.
|
||||
*/
|
||||
public interface TeamManagerService {
|
||||
|
||||
PageResult<TeamManagerCO> pageOps(TeamManagerOpsPageQryCmd qryCmd);
|
||||
|
||||
void add(TeamManagerAddCmd cmd);
|
||||
|
||||
void update(TeamManagerUpdateCmd cmd);
|
||||
|
||||
void delete(Long id, Long updateUser);
|
||||
|
||||
}
|
||||
@ -3,10 +3,11 @@ package com.red.circle.other.adapter.app.room;
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.framework.web.controller.BaseController;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomCmdData;
|
||||
import com.red.circle.other.app.service.room.RoomProfileService;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
|
||||
import com.red.circle.framework.web.controller.BaseController;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomBackgroundCmd;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomCmdData;
|
||||
import com.red.circle.other.app.service.room.RoomProfileService;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -82,8 +83,21 @@ public class RoomProfileRestController extends BaseController {
|
||||
* @eo.request-type json
|
||||
*/
|
||||
@PutMapping
|
||||
public RoomProfileDTO updateProfileV2(@RequestBody @Validated UpdateRoomCmdData cmd) {
|
||||
return roomProfileService.updateProfile(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
public RoomProfileDTO updateProfileV2(@RequestBody @Validated UpdateRoomCmdData cmd) {
|
||||
return roomProfileService.updateProfile(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改房间背景图.
|
||||
*
|
||||
* @eo.name 修改房间背景图.
|
||||
* @eo.url /background
|
||||
* @eo.method put
|
||||
* @eo.request-type json
|
||||
*/
|
||||
@PutMapping("/background")
|
||||
public RoomProfileManagerDTO updateBackground(@RequestBody @Validated UpdateRoomBackgroundCmd cmd) {
|
||||
return roomProfileService.updateBackground(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
package com.red.circle.other.app.command.room;
|
||||
|
||||
import com.red.circle.common.business.core.ImageSizeConst;
|
||||
import com.red.circle.external.inner.endpoint.oss.OssServiceClient;
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||
import com.red.circle.other.app.convertor.live.RoomProfileAppConvertor;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomBackgroundCmd;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
import com.red.circle.other.infra.database.mongo.entity.sys.ApiOperationLog;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||
import com.red.circle.other.infra.database.mongo.service.sys.ApiOperationLogService;
|
||||
import com.red.circle.other.inner.asserts.RoomErrorCode;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
import com.red.circle.tool.core.date.DateUtils;
|
||||
import com.red.circle.tool.core.json.JacksonUtils;
|
||||
import com.red.circle.tool.core.sequence.IdWorkerUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 修改房间背景图.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateRoomBackgroundCmdExe {
|
||||
|
||||
private final OssServiceClient ossServiceClient;
|
||||
private final ApiOperationLogService apiOperationLogService;
|
||||
private final RoomProfileAppConvertor roomProfileAppConvertor;
|
||||
private final RoomProfileManagerService roomProfileManagerService;
|
||||
|
||||
public RoomProfileManagerDTO execute(UpdateRoomBackgroundCmd cmd) {
|
||||
Long reqUserId = cmd.requiredReqUserId();
|
||||
|
||||
apiOperationLogService.add(
|
||||
new ApiOperationLog()
|
||||
.setId(IdWorkerUtils.getIdStr())
|
||||
.setRequestUserId(reqUserId)
|
||||
.setApiDesc("房间背景图变更")
|
||||
.setBusinessCode("ROOM_BACKGROUND_UPDATE")
|
||||
.setBusinessContent(String.valueOf(cmd.getRoomId()))
|
||||
.setCmd(JacksonUtils.toJson(cmd))
|
||||
.setExpiredTime(DateUtils.nowPlusDays(7))
|
||||
.setCreateTime(DateUtils.now())
|
||||
);
|
||||
|
||||
RoomProfile roomProfile = roomProfileManagerService.getProfileById(cmd.getRoomId());
|
||||
ResponseAssert.notNull(RoomErrorCode.ROOM_NOT_EXISTS, roomProfile);
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
cmd.reqIsSelf(roomProfile.getUserId()));
|
||||
|
||||
String roomBackground = ossServiceClient.processImgSaveAsCompressZoom(
|
||||
cmd.getRoomBackground(),
|
||||
ImageSizeConst.COVER_HEIGHT
|
||||
).getBody();
|
||||
|
||||
RoomProfile updateRoomProfile = new RoomProfile();
|
||||
updateRoomProfile.setId(cmd.getRoomId());
|
||||
updateRoomProfile.setUserId(roomProfile.getUserId());
|
||||
updateRoomProfile.setSysOrigin(cmd.requireReqSysOrigin());
|
||||
updateRoomProfile.setRoomBackground(roomBackground);
|
||||
|
||||
ResponseAssert.isTrue(CommonErrorCode.UPDATE_FAILURE,
|
||||
roomProfileManagerService.updateSelectiveProfile(updateRoomProfile));
|
||||
|
||||
return roomProfileAppConvertor.toRoomProfileManagerDTO(
|
||||
roomProfileManagerService.getById(cmd.getRoomId())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -70,13 +70,18 @@ public class UpdateRoomProfileCmdExe {
|
||||
}
|
||||
cmd.setRoomName(KeywordConstant.filter(cmd.getRoomName()));
|
||||
cmd.setRoomDesc(KeywordConstant.filter(cmd.getRoomDesc()));
|
||||
if (StringUtils.isNotBlank(cmd.getRoomCover())) {
|
||||
cmd.setRoomCover(ossServiceClient.processImgSaveAsCompressZoom(cmd.getRoomCover(),
|
||||
ImageSizeConst.COVER_HEIGHT).getBody()
|
||||
);
|
||||
}
|
||||
|
||||
RoomProfile updateRoomProfile = roomProfileAppConvertor.toRoomProfile(cmd);
|
||||
if (StringUtils.isNotBlank(cmd.getRoomCover())) {
|
||||
cmd.setRoomCover(ossServiceClient.processImgSaveAsCompressZoom(cmd.getRoomCover(),
|
||||
ImageSizeConst.COVER_HEIGHT).getBody()
|
||||
);
|
||||
}
|
||||
if (StringUtils.isNotBlank(cmd.getRoomBackground())) {
|
||||
cmd.setRoomBackground(ossServiceClient.processImgSaveAsCompressZoom(cmd.getRoomBackground(),
|
||||
ImageSizeConst.COVER_HEIGHT).getBody()
|
||||
);
|
||||
}
|
||||
|
||||
RoomProfile updateRoomProfile = roomProfileAppConvertor.toRoomProfile(cmd);
|
||||
updateRoomProfile.setUserId(roomProfile.getUserId());
|
||||
updateRoomProfile.setSysOrigin(cmd.requireReqSysOrigin());
|
||||
roomProfileManagerService.updateSelectiveProfile(updateRoomProfile);
|
||||
|
||||
@ -4,6 +4,7 @@ import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
|
||||
import com.red.circle.other.infra.database.rds.service.team.TeamManagerInfoService;
|
||||
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.enums.team.TeamUserIdentity;
|
||||
import java.util.Objects;
|
||||
@ -21,8 +22,13 @@ public class TeamUserIdentityQryExe {
|
||||
|
||||
private final TeamMemberService teamMemberService;
|
||||
private final TeamProfileService teamProfileService;
|
||||
private final TeamManagerInfoService teamManagerInfoService;
|
||||
|
||||
public TeamUserIdentity execute(AppUserIdCmd cmd) {
|
||||
if (teamManagerInfoService.checkManager(cmd.getUserId())) {
|
||||
return TeamUserIdentity.MANAGER;
|
||||
}
|
||||
|
||||
TeamMember teamMember = teamMemberService.getByMemberId(cmd.getUserId());
|
||||
|
||||
if (Objects.isNull(teamMember)
|
||||
|
||||
@ -1,15 +1,17 @@
|
||||
package com.red.circle.other.app.service.room;
|
||||
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.other.app.command.room.UpdateRoomProfileCmdExe;
|
||||
import com.red.circle.other.app.command.room.query.RoomProfileByIdQryExe;
|
||||
import com.red.circle.other.app.command.room.query.RoomProfileByUserIdQryExe;
|
||||
import com.red.circle.other.app.command.room.query.RoomVoiceProfileByUserIdQryExe;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomCmdData;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.other.app.command.room.UpdateRoomBackgroundCmdExe;
|
||||
import com.red.circle.other.app.command.room.UpdateRoomProfileCmdExe;
|
||||
import com.red.circle.other.app.command.room.query.RoomProfileByIdQryExe;
|
||||
import com.red.circle.other.app.command.room.query.RoomProfileByUserIdQryExe;
|
||||
import com.red.circle.other.app.command.room.query.RoomVoiceProfileByUserIdQryExe;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomBackgroundCmd;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomCmdData;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -21,11 +23,12 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RoomProfileServiceImpl implements RoomProfileService {
|
||||
|
||||
private final RoomProfileByIdQryExe roomProfileByIdQryExe;
|
||||
private final UpdateRoomProfileCmdExe updateRoomProfileCmdExe;
|
||||
private final RoomProfileByUserIdQryExe roomProfileByUserIdQryExe;
|
||||
private final RoomVoiceProfileByUserIdQryExe roomVoiceProfileByUserIdQryExe;
|
||||
|
||||
private final RoomProfileByIdQryExe roomProfileByIdQryExe;
|
||||
private final UpdateRoomProfileCmdExe updateRoomProfileCmdExe;
|
||||
private final UpdateRoomBackgroundCmdExe updateRoomBackgroundCmdExe;
|
||||
private final RoomProfileByUserIdQryExe roomProfileByUserIdQryExe;
|
||||
private final RoomVoiceProfileByUserIdQryExe roomVoiceProfileByUserIdQryExe;
|
||||
|
||||
@Override
|
||||
public RoomProfileManagerDTO getRoomProfile(AppExtCommand cmd) {
|
||||
@ -43,8 +46,13 @@ public class RoomProfileServiceImpl implements RoomProfileService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoomProfileDTO updateProfile(UpdateRoomCmdData cmd) {
|
||||
return updateRoomProfileCmdExe.execute(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
public RoomProfileDTO updateProfile(UpdateRoomCmdData cmd) {
|
||||
return updateRoomProfileCmdExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoomProfileManagerDTO updateBackground(UpdateRoomBackgroundCmd cmd) {
|
||||
return updateRoomBackgroundCmdExe.execute(cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,9 +9,10 @@ import com.red.circle.other.app.service.team.TeamBdService;
|
||||
import com.red.circle.other.infra.database.rds.entity.sys.Administrator;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamInfoClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamLeaderClient;
|
||||
import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamInfoClient;
|
||||
import com.red.circle.other.inner.endpoint.team.bd.BdTeamLeaderClient;
|
||||
import com.red.circle.other.inner.endpoint.team.manager.TeamManagerClient;
|
||||
import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient;
|
||||
import com.red.circle.other.inner.enums.material.PropsCommodityType;
|
||||
import com.red.circle.other.inner.enums.sys.appmanager.RoomRolesEnum;
|
||||
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
||||
@ -32,8 +33,9 @@ public class UserIdentityServiceImpl implements UserIdentityService {
|
||||
private final FreightGoldClient freightGoldClient;
|
||||
private final BdTeamInfoClient bdTeamInfoClient;
|
||||
private final AdministratorService administratorService;
|
||||
private final AdministratorAuthService administratorAuthService;
|
||||
private final BdTeamLeaderClient bdTeamLeaderClient;
|
||||
private final AdministratorAuthService administratorAuthService;
|
||||
private final BdTeamLeaderClient bdTeamLeaderClient;
|
||||
private final TeamManagerClient teamManagerClient;
|
||||
|
||||
@Override
|
||||
public UserIdentityVO getUserIdentity(Long userId) {
|
||||
@ -46,21 +48,23 @@ public class UserIdentityServiceImpl implements UserIdentityService {
|
||||
boolean isSuperAdmin = isValidAdmin && Optional.of(administrator)
|
||||
.map(e -> RoomRolesEnum.MANAGER.eq(e.getRoles()) || RoomRolesEnum.SUPER_ADMIN.eq(e.getRoles()))
|
||||
.orElse(Boolean.FALSE);
|
||||
boolean isManager = isValidAdmin && Optional.of(administrator)
|
||||
.map(e -> RoomRolesEnum.MANAGER.eq(e.getRoles()))
|
||||
.orElse(Boolean.FALSE);
|
||||
|
||||
return new UserIdentityVO()
|
||||
.setAgent(Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole()))
|
||||
.setAnchor(Objects.nonNull(teamMember))
|
||||
.setBd(ResponseAssert.requiredSuccess(bdTeamInfoClient.check(userId)))
|
||||
boolean isManager = isValidAdmin && Optional.of(administrator)
|
||||
.map(e -> RoomRolesEnum.MANAGER.eq(e.getRoles()))
|
||||
.orElse(Boolean.FALSE);
|
||||
boolean isTeamManager = ResponseAssert.requiredSuccess(teamManagerClient.check(userId));
|
||||
|
||||
return new UserIdentityVO()
|
||||
.setAgent(Objects.nonNull(teamMember) && TeamMemberRole.OWN.eq(teamMember.getRole()))
|
||||
.setAnchor(Objects.nonNull(teamMember))
|
||||
.setBd(ResponseAssert.requiredSuccess(bdTeamInfoClient.check(userId)))
|
||||
.setFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkFreightAgent(userId)))
|
||||
.setSuperFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkSuperFreightAgent(userId)))
|
||||
.setSuperAdmin(isSuperAdmin)
|
||||
.setAdmin(isValidAdmin)
|
||||
.setBdLeader(ResponseAssert.requiredSuccess(bdTeamLeaderClient.check(userId)))
|
||||
.setManager(isManager)
|
||||
;
|
||||
.setSuperFreightAgent(ResponseAssert.requiredSuccess(freightGoldClient.checkSuperFreightAgent(userId)))
|
||||
.setSuperAdmin(isSuperAdmin)
|
||||
.setAdmin(isValidAdmin)
|
||||
.setBdLeader(ResponseAssert.requiredSuccess(bdTeamLeaderClient.check(userId)))
|
||||
.setManager(isTeamManager)
|
||||
.setAppManager(isManager)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
package com.red.circle.other.app.command.room;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import com.red.circle.external.inner.endpoint.oss.OssServiceClient;
|
||||
import com.red.circle.framework.core.dto.ReqSysOrigin;
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.other.app.convertor.live.RoomProfileAppConvertor;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomBackgroundCmd;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfileManager;
|
||||
import com.red.circle.other.infra.database.mongo.entity.sys.ApiOperationLog;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||
import com.red.circle.other.infra.database.mongo.service.sys.ApiOperationLogService;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
class UpdateRoomBackgroundCmdExeTest {
|
||||
|
||||
@Test
|
||||
void execute_shouldUpdateBackgroundWhenRequesterIsRoomOwner() {
|
||||
OssServiceClient ossServiceClient = mock(OssServiceClient.class);
|
||||
ApiOperationLogService apiOperationLogService = mock(ApiOperationLogService.class);
|
||||
RoomProfileAppConvertor roomProfileAppConvertor = mock(RoomProfileAppConvertor.class);
|
||||
RoomProfileManagerService roomProfileManagerService = mock(RoomProfileManagerService.class);
|
||||
UpdateRoomBackgroundCmdExe exe = new UpdateRoomBackgroundCmdExe(
|
||||
ossServiceClient,
|
||||
apiOperationLogService,
|
||||
roomProfileAppConvertor,
|
||||
roomProfileManagerService
|
||||
);
|
||||
|
||||
UpdateRoomBackgroundCmd cmd = new UpdateRoomBackgroundCmd();
|
||||
cmd.setReqUserId(1001L);
|
||||
cmd.setReqSysOrigin(ReqSysOrigin.of("LIKEI", "LIKEI"));
|
||||
cmd.setRoomId(2002L);
|
||||
cmd.setRoomBackground("source.png");
|
||||
|
||||
RoomProfile currentProfile = new RoomProfile();
|
||||
currentProfile.setId(2002L);
|
||||
currentProfile.setUserId(1001L);
|
||||
RoomProfileManager updatedProfile = new RoomProfileManager();
|
||||
updatedProfile.setId(2002L);
|
||||
RoomProfileManagerDTO expected = new RoomProfileManagerDTO();
|
||||
|
||||
when(roomProfileManagerService.getProfileById(2002L)).thenReturn(currentProfile);
|
||||
when(ossServiceClient.processImgSaveAsCompressZoom(eq("source.png"), eq(510)))
|
||||
.thenReturn(ResultResponse.success("processed.png"));
|
||||
when(roomProfileManagerService.updateSelectiveProfile(any(RoomProfile.class))).thenReturn(true);
|
||||
when(roomProfileManagerService.getById(2002L)).thenReturn(updatedProfile);
|
||||
when(roomProfileAppConvertor.toRoomProfileManagerDTO(updatedProfile)).thenReturn(expected);
|
||||
|
||||
RoomProfileManagerDTO result = exe.execute(cmd);
|
||||
|
||||
assertSame(expected, result);
|
||||
verify(apiOperationLogService).add(any(ApiOperationLog.class));
|
||||
|
||||
ArgumentCaptor<RoomProfile> updateCaptor = ArgumentCaptor.forClass(RoomProfile.class);
|
||||
verify(roomProfileManagerService).updateSelectiveProfile(updateCaptor.capture());
|
||||
RoomProfile updateProfile = updateCaptor.getValue();
|
||||
assertEquals(2002L, updateProfile.getId());
|
||||
assertEquals(1001L, updateProfile.getUserId());
|
||||
assertEquals("LIKEI", updateProfile.getSysOrigin());
|
||||
assertEquals("processed.png", updateProfile.getRoomBackground());
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
|
||||
import com.red.circle.other.infra.database.rds.service.team.TeamManagerInfoService;
|
||||
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.enums.team.TeamUserIdentity;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -18,7 +19,9 @@ class TeamUserIdentityQryExeTest {
|
||||
void executeShouldReturnTouristWhenOwnerTeamIsClosed() {
|
||||
TeamMemberService teamMemberService = mock(TeamMemberService.class);
|
||||
TeamProfileService teamProfileService = mock(TeamProfileService.class);
|
||||
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService);
|
||||
TeamManagerInfoService teamManagerInfoService = mock(TeamManagerInfoService.class);
|
||||
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService,
|
||||
teamManagerInfoService);
|
||||
|
||||
AppUserIdCmd cmd = new AppUserIdCmd();
|
||||
cmd.setUserId(100L);
|
||||
@ -28,6 +31,7 @@ class TeamUserIdentityQryExeTest {
|
||||
.setRole(TeamMemberRole.OWN);
|
||||
|
||||
when(teamMemberService.getByMemberId(100L)).thenReturn(teamMember);
|
||||
when(teamManagerInfoService.checkManager(100L)).thenReturn(false);
|
||||
when(teamProfileService.checkStatusAvailable(200L)).thenReturn(false);
|
||||
|
||||
assertEquals(TeamUserIdentity.TOURIST, exe.execute(cmd));
|
||||
@ -37,7 +41,9 @@ class TeamUserIdentityQryExeTest {
|
||||
void executeShouldReturnAgentWhenOwnerTeamIsAvailable() {
|
||||
TeamMemberService teamMemberService = mock(TeamMemberService.class);
|
||||
TeamProfileService teamProfileService = mock(TeamProfileService.class);
|
||||
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService);
|
||||
TeamManagerInfoService teamManagerInfoService = mock(TeamManagerInfoService.class);
|
||||
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService,
|
||||
teamManagerInfoService);
|
||||
|
||||
AppUserIdCmd cmd = new AppUserIdCmd();
|
||||
cmd.setUserId(100L);
|
||||
@ -47,8 +53,25 @@ class TeamUserIdentityQryExeTest {
|
||||
.setRole(TeamMemberRole.OWN);
|
||||
|
||||
when(teamMemberService.getByMemberId(100L)).thenReturn(teamMember);
|
||||
when(teamManagerInfoService.checkManager(100L)).thenReturn(false);
|
||||
when(teamProfileService.checkStatusAvailable(200L)).thenReturn(true);
|
||||
|
||||
assertEquals(TeamUserIdentity.AGENT, exe.execute(cmd));
|
||||
}
|
||||
|
||||
@Test
|
||||
void executeShouldReturnManagerWhenUserIsTeamManager() {
|
||||
TeamMemberService teamMemberService = mock(TeamMemberService.class);
|
||||
TeamProfileService teamProfileService = mock(TeamProfileService.class);
|
||||
TeamManagerInfoService teamManagerInfoService = mock(TeamManagerInfoService.class);
|
||||
TeamUserIdentityQryExe exe = new TeamUserIdentityQryExe(teamMemberService, teamProfileService,
|
||||
teamManagerInfoService);
|
||||
|
||||
AppUserIdCmd cmd = new AppUserIdCmd();
|
||||
cmd.setUserId(100L);
|
||||
|
||||
when(teamManagerInfoService.checkManager(100L)).thenReturn(true);
|
||||
|
||||
assertEquals(TeamUserIdentity.MANAGER, exe.execute(cmd));
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,14 +49,19 @@ public class RoomVoiceProfileCO extends ClientObject {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 背景图.
|
||||
*/
|
||||
private String roomBackground;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
private String roomName;
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
package com.red.circle.other.app.dto.cmd.room;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 修改房间背景图.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class UpdateRoomBackgroundCmd extends AppExtCommand {
|
||||
|
||||
/**
|
||||
* 房间id.
|
||||
*
|
||||
* @eo.required
|
||||
*/
|
||||
@NotNull(message = "roomId required.")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long roomId;
|
||||
|
||||
/**
|
||||
* 房间背景图.
|
||||
*
|
||||
* @eo.required
|
||||
*/
|
||||
@NotBlank(message = "roomBackground required.")
|
||||
private String roomBackground;
|
||||
|
||||
}
|
||||
@ -23,14 +23,19 @@ public class UpdateRoomCmdData extends AppExtCommand {
|
||||
@NotNull(message = "id required.")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 背景图.
|
||||
*/
|
||||
private String roomBackground;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
private String roomName;
|
||||
|
||||
/**
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
package com.red.circle.other.app.dto.h5;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
package com.red.circle.other.app.dto.h5;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ -54,14 +54,20 @@ public class UserIdentityVO implements Serializable {
|
||||
*/
|
||||
private Boolean superAdmin;
|
||||
|
||||
/**
|
||||
* 是否是经理
|
||||
*/
|
||||
private Boolean manager;
|
||||
|
||||
/**
|
||||
* 历史身份.
|
||||
/**
|
||||
* 是否是经理
|
||||
*/
|
||||
private Boolean manager;
|
||||
|
||||
/**
|
||||
* 是否是App管理员角色里的经理.
|
||||
*/
|
||||
@JsonProperty("app_manager")
|
||||
private Boolean appManager;
|
||||
|
||||
/**
|
||||
* 历史身份.
|
||||
*/
|
||||
private List<String> historyIdentity;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,11 +2,12 @@ package com.red.circle.other.app.service.room;
|
||||
|
||||
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomCmdData;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
||||
import com.red.circle.common.business.dto.cmd.app.AppUserIdCmd;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomBackgroundCmd;
|
||||
import com.red.circle.other.app.dto.cmd.room.UpdateRoomCmdData;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileDTO;
|
||||
import com.red.circle.other.inner.model.dto.live.RoomProfileManagerDTO;
|
||||
|
||||
/**
|
||||
* 房间资料信息.
|
||||
@ -20,6 +21,8 @@ public interface RoomProfileService {
|
||||
RoomProfileManagerDTO getRoomProfile(AppRoomIdCmd cmd);
|
||||
|
||||
RoomProfileManagerDTO getRoomProfile(AppUserIdCmd cmd);
|
||||
|
||||
RoomProfileDTO updateProfile(UpdateRoomCmdData cmd);
|
||||
}
|
||||
|
||||
RoomProfileDTO updateProfile(UpdateRoomCmdData cmd);
|
||||
|
||||
RoomProfileManagerDTO updateBackground(UpdateRoomBackgroundCmd cmd);
|
||||
}
|
||||
|
||||
@ -41,14 +41,19 @@ public class RoomProfile implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
/**
|
||||
* 封面.
|
||||
*/
|
||||
private String roomCover;
|
||||
|
||||
/**
|
||||
* 背景图.
|
||||
*/
|
||||
private String roomBackground;
|
||||
|
||||
/**
|
||||
* 名称.
|
||||
*/
|
||||
private String roomName;
|
||||
|
||||
/**
|
||||
|
||||
@ -805,12 +805,15 @@ public class RoomProfileManagerServiceImpl implements RoomProfileManagerService
|
||||
return update;
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(newProfile.getRoomCover())) {
|
||||
update.set("roomCover", newProfile.getRoomCover());
|
||||
}
|
||||
if (StringUtils.isNotBlank(newProfile.getRoomName())) {
|
||||
update.set("roomName", newProfile.getRoomName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(newProfile.getRoomCover())) {
|
||||
update.set("roomCover", newProfile.getRoomCover());
|
||||
}
|
||||
if (StringUtils.isNotBlank(newProfile.getRoomBackground())) {
|
||||
update.set("roomBackground", newProfile.getRoomBackground());
|
||||
}
|
||||
if (StringUtils.isNotBlank(newProfile.getRoomName())) {
|
||||
update.set("roomName", newProfile.getRoomName());
|
||||
}
|
||||
if (StringUtils.isNotBlank(newProfile.getRoomDesc())) {
|
||||
update.set("roomDesc", newProfile.getRoomDesc());
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package com.red.circle.other.infra.database.rds.dao.team;
|
||||
|
||||
import com.red.circle.framework.mybatis.dao.BaseDAO;
|
||||
import com.red.circle.other.infra.database.rds.entity.team.TeamManagerInfo;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
public interface TeamManagerInfoDAO extends BaseDAO<TeamManagerInfo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.red.circle.other.infra.database.rds.entity.team;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.red.circle.framework.mybatis.entity.TimestampBaseEntity;
|
||||
import java.io.Serial;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("team_manager_base_info")
|
||||
public class TeamManagerInfo extends TimestampBaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键标识.
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 来源app.
|
||||
*/
|
||||
@TableField("sys_origin")
|
||||
private String sysOrigin;
|
||||
|
||||
/**
|
||||
* 经理用户ID.
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 联系方式.
|
||||
*/
|
||||
@TableField("contact")
|
||||
private String contact;
|
||||
|
||||
/**
|
||||
* 区域ID.
|
||||
*/
|
||||
@TableField("region_id")
|
||||
private String regionId;
|
||||
|
||||
}
|
||||
@ -44,10 +44,16 @@ public class UserHistoryIdentity extends TimestampBaseEntity {
|
||||
@TableField("is_agent")
|
||||
private Boolean agent;
|
||||
|
||||
/**
|
||||
* 是否做过主播.
|
||||
*/
|
||||
@TableField("is_host")
|
||||
private Boolean host;
|
||||
|
||||
}
|
||||
/**
|
||||
* 是否做过主播.
|
||||
*/
|
||||
@TableField("is_host")
|
||||
private Boolean host;
|
||||
|
||||
/**
|
||||
* 是否做过团队经理.
|
||||
*/
|
||||
@TableField("is_manager")
|
||||
private Boolean manager;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.red.circle.other.infra.database.rds.service.team;
|
||||
|
||||
import com.red.circle.framework.mybatis.service.BaseService;
|
||||
import com.red.circle.other.infra.database.rds.entity.team.TeamManagerInfo;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 团队经理服务.
|
||||
*/
|
||||
public interface TeamManagerInfoService extends BaseService<TeamManagerInfo> {
|
||||
|
||||
boolean checkManager(Long userId);
|
||||
|
||||
TeamManagerInfo getByUserId(Long userId);
|
||||
|
||||
void deleteById(Long id);
|
||||
|
||||
List<TeamManagerInfo> listByUserIds(Set<Long> userIds);
|
||||
|
||||
}
|
||||
@ -13,10 +13,15 @@ import java.util.Set;
|
||||
*/
|
||||
public interface UserHistoryIdentityService extends BaseService<UserHistoryIdentity> {
|
||||
|
||||
/**
|
||||
* 保存身份=bd.
|
||||
*/
|
||||
void saveBd(Long userId);
|
||||
/**
|
||||
* 保存身份=bd.
|
||||
*/
|
||||
void saveBd(Long userId);
|
||||
|
||||
/**
|
||||
* 保存身份=manager.
|
||||
*/
|
||||
void saveManager(Long userId);
|
||||
|
||||
/**
|
||||
* 保存身份=host.
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
package com.red.circle.other.infra.database.rds.service.team.impl;
|
||||
|
||||
import com.red.circle.framework.mybatis.constant.PageConstant;
|
||||
import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import com.red.circle.other.infra.database.rds.dao.team.TeamManagerInfoDAO;
|
||||
import com.red.circle.other.infra.database.rds.entity.team.TeamManagerInfo;
|
||||
import com.red.circle.other.infra.database.rds.service.team.TeamManagerInfoService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 团队经理服务实现.
|
||||
*/
|
||||
@Service
|
||||
public class TeamManagerInfoServiceImpl
|
||||
extends BaseServiceImpl<TeamManagerInfoDAO, TeamManagerInfo>
|
||||
implements TeamManagerInfoService {
|
||||
|
||||
@Override
|
||||
public boolean checkManager(Long userId) {
|
||||
return Objects.nonNull(query()
|
||||
.eq(TeamManagerInfo::getUserId, userId)
|
||||
.last(PageConstant.LIMIT_ONE)
|
||||
.getOne());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamManagerInfo getByUserId(Long userId) {
|
||||
return query()
|
||||
.eq(TeamManagerInfo::getUserId, userId)
|
||||
.last(PageConstant.LIMIT_ONE)
|
||||
.getOne();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
delete().eq(TeamManagerInfo::getId, id).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TeamManagerInfo> listByUserIds(Set<Long> userIds) {
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
return query()
|
||||
.in(TeamManagerInfo::getUserId, userIds)
|
||||
.list();
|
||||
}
|
||||
|
||||
}
|
||||
@ -27,26 +27,50 @@ public class UserHistoryIdentityServiceImpl extends
|
||||
UserHistoryIdentityService {
|
||||
|
||||
@Override
|
||||
public void saveBd(Long userId) {
|
||||
if (exists(userId)) {
|
||||
update()
|
||||
.set(UserHistoryIdentity::getBd, Boolean.TRUE)
|
||||
.eq(UserHistoryIdentity::getId, userId)
|
||||
public void saveBd(Long userId) {
|
||||
if (exists(userId)) {
|
||||
update()
|
||||
.set(UserHistoryIdentity::getBd, Boolean.TRUE)
|
||||
.eq(UserHistoryIdentity::getId, userId)
|
||||
.execute();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.TRUE)
|
||||
.setAgent(Boolean.FALSE)
|
||||
.setHost(Boolean.FALSE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.TRUE)
|
||||
.setAgent(Boolean.FALSE)
|
||||
.setHost(Boolean.FALSE)
|
||||
.setManager(Boolean.FALSE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveManager(Long userId) {
|
||||
if (exists(userId)) {
|
||||
update()
|
||||
.set(UserHistoryIdentity::getManager, Boolean.TRUE)
|
||||
.eq(UserHistoryIdentity::getId, userId)
|
||||
.execute();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.FALSE)
|
||||
.setAgent(Boolean.FALSE)
|
||||
.setHost(Boolean.FALSE)
|
||||
.setManager(Boolean.TRUE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveHost(Long userId) {
|
||||
@ -58,15 +82,16 @@ public class UserHistoryIdentityServiceImpl extends
|
||||
return;
|
||||
}
|
||||
try {
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.FALSE)
|
||||
.setAgent(Boolean.FALSE)
|
||||
.setHost(Boolean.TRUE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.FALSE)
|
||||
.setAgent(Boolean.FALSE)
|
||||
.setHost(Boolean.TRUE)
|
||||
.setManager(Boolean.FALSE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -81,15 +106,16 @@ public class UserHistoryIdentityServiceImpl extends
|
||||
return;
|
||||
}
|
||||
try {
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.FALSE)
|
||||
.setAgent(Boolean.TRUE)
|
||||
.setHost(Boolean.TRUE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
save(new UserHistoryIdentity()
|
||||
.setId(userId)
|
||||
.setBd(Boolean.FALSE)
|
||||
.setAgent(Boolean.TRUE)
|
||||
.setHost(Boolean.TRUE)
|
||||
.setManager(Boolean.FALSE)
|
||||
);
|
||||
} catch (DuplicateKeyException ex) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
private boolean exists(Long userId) {
|
||||
@ -141,10 +167,14 @@ public class UserHistoryIdentityServiceImpl extends
|
||||
res.add("Agent");
|
||||
}
|
||||
|
||||
if (Objects.equals(identity.getHost(), Boolean.TRUE)) {
|
||||
res.add("Host");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
if (Objects.equals(identity.getHost(), Boolean.TRUE)) {
|
||||
res.add("Host");
|
||||
}
|
||||
|
||||
if (Objects.equals(identity.getManager(), Boolean.TRUE)) {
|
||||
res.add("Manager");
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ import org.mockito.ArgumentCaptor;
|
||||
import org.bson.Document;
|
||||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.Query;
|
||||
import org.springframework.data.mongodb.core.query.Update;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
||||
class RoomProfileManagerServiceImplTest {
|
||||
@ -104,6 +105,26 @@ class RoomProfileManagerServiceImplTest {
|
||||
assertEquals(99L, queryCaptor.getValue().getQueryObject().getLong("id"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateSelectiveProfile_shouldUpdateRoomBackground() {
|
||||
RoomProfileManager room = new RoomProfileManager();
|
||||
room.setId(99L);
|
||||
|
||||
when(mongoTemplate.findOne(any(Query.class), eq(RoomProfileManager.class))).thenReturn(room);
|
||||
|
||||
RoomProfile updateProfile = new RoomProfile();
|
||||
updateProfile.setId(99L);
|
||||
updateProfile.setRoomBackground("background.png");
|
||||
|
||||
service.updateSelectiveProfile(updateProfile);
|
||||
|
||||
ArgumentCaptor<Update> updateCaptor = ArgumentCaptor.forClass(Update.class);
|
||||
verify(mongoTemplate).updateFirst(any(Query.class), updateCaptor.capture(),
|
||||
eq(RoomProfileManager.class));
|
||||
Document setDocument = (Document) updateCaptor.getValue().getUpdateObject().get("$set");
|
||||
assertEquals("background.png", setDocument.getString("roomBackground"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void listSelectiveLimitByCountryCodes_shouldQueryIncludedCountriesWithMemberCountSort() {
|
||||
ArgumentCaptor<Query> queryCaptor = ArgumentCaptor.forClass(Query.class);
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package com.red.circle.other.app.inner.convertor.team;
|
||||
|
||||
import com.red.circle.framework.core.convertor.ConvertorModel;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.infra.database.rds.entity.team.TeamManagerInfo;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.other.inner.model.dto.agency.manager.TeamManagerDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* 团队经理转换器.
|
||||
*/
|
||||
@Mapper(componentModel = ConvertorModel.SPRING)
|
||||
public interface TeamManagerInnerConvertor {
|
||||
|
||||
TeamManagerDTO toTeamManagerDTO(TeamManagerInfo managerInfo);
|
||||
|
||||
TeamManagerInfo toTeamManagerInfo(TeamManagerAddCmd cmd);
|
||||
|
||||
TeamManagerInfo toTeamManagerInfo(TeamManagerDTO dto);
|
||||
|
||||
PageResult<TeamManagerDTO> toPageTeamManagerDTO(PageResult<TeamManagerInfo> pageResult);
|
||||
|
||||
}
|
||||
@ -52,8 +52,14 @@ public class UserHistoryIdentityEndpoint implements UserHistoryIdentityClientApi
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> saveBd(Long userId) {
|
||||
historyIdentityClientService.saveBd(userId);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
}
|
||||
public ResultResponse<Void> saveBd(Long userId) {
|
||||
historyIdentityClientService.saveBd(userId);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> saveManager(Long userId) {
|
||||
historyIdentityClientService.saveManager(userId);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,72 @@
|
||||
package com.red.circle.other.app.inner.endpoint.team.manager;
|
||||
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.dto.ResultResponse;
|
||||
import com.red.circle.other.app.inner.service.team.manager.TeamManagerClientService;
|
||||
import com.red.circle.other.inner.endpoint.team.manager.api.TeamManagerClientApi;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.agency.manager.TeamManagerDTO;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 团队经理.
|
||||
*/
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping(value = TeamManagerClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RequiredArgsConstructor
|
||||
public class TeamManagerClientEndpoint implements TeamManagerClientApi {
|
||||
|
||||
private final TeamManagerClientService teamManagerClientService;
|
||||
|
||||
@Override
|
||||
public ResultResponse<TeamManagerDTO> getById(Long id) {
|
||||
return ResultResponse.success(teamManagerClientService.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<TeamManagerDTO> getByUserId(Long userId) {
|
||||
return ResultResponse.success(teamManagerClientService.getByUserId(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> add(TeamManagerAddCmd cmd) {
|
||||
teamManagerClientService.add(cmd);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Boolean> check(Long userId) {
|
||||
return ResultResponse.success(teamManagerClientService.check(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Map<Long, Boolean>> mapCheck(Set<Long> userIds) {
|
||||
return ResultResponse.success(teamManagerClientService.mapCheck(userIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<PageResult<TeamManagerDTO>> pageOps(TeamManagerOpsPageQryCmd qryCmd) {
|
||||
return ResultResponse.success(teamManagerClientService.pageOps(qryCmd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> updateSelectiveById(TeamManagerDTO dto) {
|
||||
teamManagerClientService.updateSelectiveById(dto);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> deleteById(Long id) {
|
||||
teamManagerClientService.deleteById(id);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,7 +18,9 @@ public interface UserHistoryIdentityClientService {
|
||||
|
||||
Map<Long, UserHistoryIdentityDTO> mapByIds(Set<Long> userIds);
|
||||
|
||||
void saveHost(Long userId);
|
||||
|
||||
void saveBd(Long userId);
|
||||
}
|
||||
void saveHost(Long userId);
|
||||
|
||||
void saveBd(Long userId);
|
||||
|
||||
void saveManager(Long userId);
|
||||
}
|
||||
|
||||
@ -47,7 +47,12 @@ public class UserHistoryIdentityClientServiceImpl implements UserHistoryIdentity
|
||||
|
||||
|
||||
@Override
|
||||
public void saveBd(Long userId) {
|
||||
historyIdentityService.saveBd(userId);
|
||||
}
|
||||
}
|
||||
public void saveBd(Long userId) {
|
||||
historyIdentityService.saveBd(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveManager(Long userId) {
|
||||
historyIdentityService.saveManager(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package com.red.circle.other.app.inner.service.team.manager;
|
||||
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.agency.manager.TeamManagerDTO;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 团队经理 inner 服务.
|
||||
*/
|
||||
public interface TeamManagerClientService {
|
||||
|
||||
TeamManagerDTO getById(Long id);
|
||||
|
||||
TeamManagerDTO getByUserId(Long userId);
|
||||
|
||||
void add(TeamManagerAddCmd cmd);
|
||||
|
||||
boolean check(Long userId);
|
||||
|
||||
Map<Long, Boolean> mapCheck(Set<Long> userIds);
|
||||
|
||||
PageResult<TeamManagerDTO> pageOps(TeamManagerOpsPageQryCmd qryCmd);
|
||||
|
||||
void updateSelectiveById(TeamManagerDTO dto);
|
||||
|
||||
void deleteById(Long id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.red.circle.other.app.inner.service.team.manager.impl;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.app.inner.convertor.team.TeamManagerInnerConvertor;
|
||||
import com.red.circle.other.app.inner.service.team.manager.TeamManagerClientService;
|
||||
import com.red.circle.other.infra.database.rds.entity.team.TeamManagerInfo;
|
||||
import com.red.circle.other.infra.database.rds.service.team.TeamManagerInfoService;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerAddCmd;
|
||||
import com.red.circle.other.inner.model.cmd.team.manager.TeamManagerOpsPageQryCmd;
|
||||
import com.red.circle.other.inner.model.dto.agency.manager.TeamManagerDTO;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 团队经理 inner 服务实现.
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TeamManagerClientServiceImpl implements TeamManagerClientService {
|
||||
|
||||
private final TeamManagerInfoService teamManagerInfoService;
|
||||
private final TeamManagerInnerConvertor teamManagerInnerConvertor;
|
||||
|
||||
@Override
|
||||
public TeamManagerDTO getById(Long id) {
|
||||
return teamManagerInnerConvertor.toTeamManagerDTO(teamManagerInfoService.getById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TeamManagerDTO getByUserId(Long userId) {
|
||||
return teamManagerInnerConvertor.toTeamManagerDTO(teamManagerInfoService.getByUserId(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(TeamManagerAddCmd cmd) {
|
||||
teamManagerInfoService.save(teamManagerInnerConvertor.toTeamManagerInfo(cmd));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean check(Long userId) {
|
||||
return teamManagerInfoService.checkManager(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, Boolean> mapCheck(Set<Long> userIds) {
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
|
||||
return teamManagerInfoService.listByUserIds(userIds).stream()
|
||||
.collect(Collectors.toMap(TeamManagerInfo::getUserId, v -> Boolean.TRUE, (v1, v2) -> v2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<TeamManagerDTO> pageOps(TeamManagerOpsPageQryCmd qryCmd) {
|
||||
return teamManagerInnerConvertor.toPageTeamManagerDTO(
|
||||
teamManagerInfoService.query()
|
||||
.eq(Objects.nonNull(qryCmd.getUserId()), TeamManagerInfo::getUserId, qryCmd.getUserId())
|
||||
.eq(TeamManagerInfo::getSysOrigin, qryCmd.getSysOrigin())
|
||||
.eq(Objects.nonNull(qryCmd.getCreateUser()), TeamManagerInfo::getCreateUser,
|
||||
qryCmd.getCreateUser())
|
||||
.orderByDesc(TeamManagerInfo::getCreateTime)
|
||||
.page(qryCmd.getPageQuery())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSelectiveById(TeamManagerDTO dto) {
|
||||
teamManagerInfoService.updateSelectiveById(teamManagerInnerConvertor.toTeamManagerInfo(dto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(Long id) {
|
||||
teamManagerInfoService.deleteById(id);
|
||||
}
|
||||
|
||||
}
|
||||
168
sql/20260506_likei_google_product_config.sql
Normal file
168
sql/20260506_likei_google_product_config.sql
Normal file
@ -0,0 +1,168 @@
|
||||
-- LIKEI Google Play in-app product configs.
|
||||
-- This script is idempotent for the two product_package values below:
|
||||
-- it keeps one row per sys_origin + platform + product_package, updates it,
|
||||
-- removes duplicate rows for those packages, and inserts missing rows.
|
||||
--
|
||||
-- Production LIKEI regions verified from mongo-1 Mongo sys_region_config:
|
||||
-- 7455586935705044691 Pakistan - 03
|
||||
-- 2047598855125528577 Pakistan - rolex
|
||||
-- 2046578237923979266 Europe Region
|
||||
-- 2046488527570530306 Africa Region
|
||||
-- 2046067717605224449 Southeast Asia Region
|
||||
-- 2046067036517363714 Middle East Region
|
||||
-- 2046066409959649281 Turkey Region
|
||||
-- 2045389832842178561 South Asia
|
||||
-- 69d88849bdbcc07ebc3f118c Default
|
||||
--
|
||||
-- For production, confirm the LIKEI region ids in Mongo first:
|
||||
-- db.sys_region_config.find(
|
||||
-- {sysOrigin: "LIKEI", del: false},
|
||||
-- {_id: 1, regionName: 1, regionCode: 1}
|
||||
-- )
|
||||
-- If production has different region ids, replace @target_regions before running.
|
||||
|
||||
START TRANSACTION;
|
||||
|
||||
SET @sys_origin := CONVERT('LIKEI' USING utf8mb4) COLLATE utf8mb4_0900_ai_ci;
|
||||
SET @platform := CONVERT('GOOGLE' USING utf8mb4) COLLATE utf8mb4_0900_ai_ci;
|
||||
SET @obsolete_product_package := CONVERT('coins.800000' USING utf8mb4) COLLATE utf8mb4_0900_ai_ci;
|
||||
SET @target_regions := CONVERT('7455586935705044691,2047598855125528577,2046578237923979266,2046488527570530306,2046067717605224449,2046067036517363714,2046066409959649281,2045389832842178561,69d88849bdbcc07ebc3f118c' USING utf8mb4) COLLATE utf8mb4_0900_ai_ci;
|
||||
SET @country_codes := NULL;
|
||||
SET @operator_id := 0;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp_likei_google_product_config (
|
||||
row_no INT NOT NULL PRIMARY KEY,
|
||||
product_package VARCHAR(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
|
||||
unit_price DECIMAL(10, 2) NOT NULL,
|
||||
obtain_candy DECIMAL(10, 2) NOT NULL,
|
||||
reward_candy DECIMAL(10, 2) NOT NULL DEFAULT 0,
|
||||
sort_no INT NOT NULL,
|
||||
description VARCHAR(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL
|
||||
);
|
||||
|
||||
INSERT INTO tmp_likei_google_product_config (
|
||||
row_no,
|
||||
product_package,
|
||||
unit_price,
|
||||
obtain_candy,
|
||||
reward_candy,
|
||||
sort_no,
|
||||
description
|
||||
) VALUES
|
||||
(1, 'coins.80000', 1.00, 80000.00, 0.00, 1, '80000 coins'),
|
||||
(2, 'coins.240000', 3.00, 240000.00, 0.00, 2, '240000 coins');
|
||||
|
||||
DELETE FROM sys_product_config_v2
|
||||
WHERE sys_origin = @sys_origin
|
||||
AND platform = @platform
|
||||
AND product_package = @obsolete_product_package;
|
||||
|
||||
DELETE FROM sys_product_config_package
|
||||
WHERE product_package = @obsolete_product_package;
|
||||
|
||||
CREATE TEMPORARY TABLE tmp_likei_google_product_keep AS
|
||||
SELECT
|
||||
t.product_package,
|
||||
MIN(t.id) AS keep_id
|
||||
FROM sys_product_config_v2 t
|
||||
JOIN tmp_likei_google_product_config s
|
||||
ON s.product_package = t.product_package
|
||||
WHERE t.sys_origin = @sys_origin
|
||||
AND t.platform = @platform
|
||||
GROUP BY t.product_package;
|
||||
|
||||
DELETE t
|
||||
FROM sys_product_config_v2 t
|
||||
JOIN tmp_likei_google_product_keep k
|
||||
ON k.product_package = t.product_package
|
||||
WHERE t.sys_origin = @sys_origin
|
||||
AND t.platform = @platform
|
||||
AND t.id <> k.keep_id;
|
||||
|
||||
UPDATE sys_product_config_v2 t
|
||||
JOIN tmp_likei_google_product_keep k
|
||||
ON k.keep_id = t.id
|
||||
JOIN tmp_likei_google_product_config s
|
||||
ON s.product_package = k.product_package
|
||||
SET
|
||||
t.description = s.description,
|
||||
t.unit_price = s.unit_price,
|
||||
t.obtain_candy = s.obtain_candy,
|
||||
t.reward_candy = s.reward_candy,
|
||||
t.regions = @target_regions,
|
||||
t.country_codes = @country_codes,
|
||||
t.sort = s.sort_no,
|
||||
t.is_showcase = 1,
|
||||
t.update_time = CURRENT_TIMESTAMP,
|
||||
t.update_user = @operator_id;
|
||||
|
||||
SET @next_product_config_id := (
|
||||
SELECT COALESCE(MAX(id), 0)
|
||||
FROM sys_product_config_v2
|
||||
);
|
||||
|
||||
INSERT INTO sys_product_config_v2 (
|
||||
id,
|
||||
sys_origin,
|
||||
description,
|
||||
product_package,
|
||||
unit_price,
|
||||
obtain_candy,
|
||||
reward_candy,
|
||||
platform,
|
||||
regions,
|
||||
country_codes,
|
||||
sort,
|
||||
is_showcase,
|
||||
create_time,
|
||||
update_time,
|
||||
create_user,
|
||||
update_user
|
||||
)
|
||||
SELECT
|
||||
(@next_product_config_id := @next_product_config_id + 1) AS id,
|
||||
@sys_origin,
|
||||
s.description,
|
||||
s.product_package,
|
||||
s.unit_price,
|
||||
s.obtain_candy,
|
||||
s.reward_candy,
|
||||
@platform,
|
||||
@target_regions,
|
||||
@country_codes,
|
||||
s.sort_no,
|
||||
1,
|
||||
CURRENT_TIMESTAMP,
|
||||
CURRENT_TIMESTAMP,
|
||||
@operator_id,
|
||||
@operator_id
|
||||
FROM tmp_likei_google_product_config s
|
||||
LEFT JOIN tmp_likei_google_product_keep k
|
||||
ON k.product_package = s.product_package
|
||||
WHERE k.keep_id IS NULL;
|
||||
|
||||
SELECT
|
||||
id,
|
||||
sys_origin,
|
||||
product_package,
|
||||
unit_price,
|
||||
obtain_candy,
|
||||
reward_candy,
|
||||
platform,
|
||||
regions,
|
||||
country_codes,
|
||||
sort,
|
||||
is_showcase
|
||||
FROM sys_product_config_v2
|
||||
WHERE sys_origin = @sys_origin
|
||||
AND platform = @platform
|
||||
AND product_package IN (
|
||||
SELECT product_package
|
||||
FROM tmp_likei_google_product_config
|
||||
)
|
||||
ORDER BY sort, unit_price;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_likei_google_product_keep;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_likei_google_product_config;
|
||||
|
||||
COMMIT;
|
||||
32
sql/20260506_team_manager_identity.sql
Normal file
32
sql/20260506_team_manager_identity.sql
Normal file
@ -0,0 +1,32 @@
|
||||
SET @table_schema = DATABASE();
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `team_manager_base_info` (
|
||||
`id` bigint NOT NULL COMMENT '主键ID',
|
||||
`sys_origin` varchar(64) NOT NULL DEFAULT '' COMMENT '来源APP',
|
||||
`user_id` bigint NOT NULL COMMENT '经理用户ID',
|
||||
`contact` varchar(255) NOT NULL DEFAULT '' COMMENT '联系方式',
|
||||
`region_id` varchar(64) NOT NULL DEFAULT '' COMMENT '区域ID',
|
||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`create_user` bigint DEFAULT NULL COMMENT '创建人',
|
||||
`update_user` bigint DEFAULT NULL COMMENT '更新人',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_team_manager_user_id` (`user_id`),
|
||||
KEY `idx_team_manager_sys_origin` (`sys_origin`),
|
||||
KEY `idx_team_manager_region` (`region_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='团队经理基本信息';
|
||||
|
||||
SET @ddl = IF(
|
||||
EXISTS(
|
||||
SELECT 1
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @table_schema
|
||||
AND TABLE_NAME = 'user_history_identity'
|
||||
AND COLUMN_NAME = 'is_manager'
|
||||
),
|
||||
'SELECT 1',
|
||||
"ALTER TABLE `user_history_identity` ADD COLUMN `is_manager` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否做过团队经理' AFTER `is_host`"
|
||||
);
|
||||
PREPARE stmt FROM @ddl;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
Loading…
x
Reference in New Issue
Block a user