Compare commits
No commits in common. "重构状态机" and "main" have entirely different histories.
42
grep_log.bat
42
grep_log.bat
@ -1,42 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
:: 1. 设置动态参数
|
|
||||||
set REMOTE_IP=119.29.151.152
|
|
||||||
set REMOTE_PORT=22101
|
|
||||||
set REMOTE_USER=ubuntu
|
|
||||||
set SCRIPT_PATH=/home/ubuntu/grep_log.sh
|
|
||||||
|
|
||||||
REM 检查是否提供了参数
|
|
||||||
if "%~1"=="" (
|
|
||||||
echo Usage: grep_log.bat <KEYWORD> [-A <n>] [-B <n>] [-C <n>]
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
REM 设置变量
|
|
||||||
set KEYWORD=%1
|
|
||||||
shift
|
|
||||||
|
|
||||||
REM 解析选项
|
|
||||||
set OPTIONS=
|
|
||||||
|
|
||||||
:parse_options
|
|
||||||
if "%~1"=="" goto done
|
|
||||||
if "%~1"=="-A" (
|
|
||||||
set OPTIONS=-A %2
|
|
||||||
shift
|
|
||||||
)
|
|
||||||
if "%~1"=="-B" (
|
|
||||||
set OPTIONS=-B %2
|
|
||||||
shift
|
|
||||||
)
|
|
||||||
if "%~1"=="-C" (
|
|
||||||
set OPTIONS=-C %2
|
|
||||||
shift
|
|
||||||
)
|
|
||||||
shift
|
|
||||||
goto parse_options
|
|
||||||
|
|
||||||
:done
|
|
||||||
|
|
||||||
REM 远程执行 Linux 脚本
|
|
||||||
call ssh -p %REMOTE_PORT% %REMOTE_USER%@%REMOTE_IP% "bash %SCRIPT_PATH% %KEYWORD% %OPTIONS%"
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
KEYWORD="3mc31t"
|
|
||||||
|
|
||||||
# 目标服务器信息(格式:IP地址:端口)
|
|
||||||
SERVERS=(
|
|
||||||
"172.26.1.3:22"
|
|
||||||
"172.26.1.7:22"
|
|
||||||
"172.26.1.9:22"
|
|
||||||
"172.26.1.15:22"
|
|
||||||
)
|
|
||||||
|
|
||||||
# 目标路径
|
|
||||||
LOG_DIR="/data/logs/advisor"
|
|
||||||
|
|
||||||
for SERVER in "${SERVERS[@]}"; do
|
|
||||||
# 获取 IP 和端口
|
|
||||||
IP=$(echo $SERVER | cut -d ':' -f 1)
|
|
||||||
PORT=$(echo $SERVER | cut -d ':' -f 2)
|
|
||||||
|
|
||||||
# 查询日期
|
|
||||||
echo "log on $IP:"
|
|
||||||
ssh -p $PORT ubuntu@$IP "grep -n $KEYWORD $LOG_DIR/*.log"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "All logs printed."
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
@echo off
|
|
||||||
|
|
||||||
:: 1. 设置动态参数
|
|
||||||
set REMOTE_IP=119.29.151.152
|
|
||||||
set REMOTE_PORT=22101
|
|
||||||
set REMOTE_USER=ubuntu
|
|
||||||
set SCRIPT_PATH=/home/ubuntu/grep_log.sh
|
|
||||||
|
|
||||||
REM 检查是否提供了参数
|
|
||||||
if "%~1"=="" (
|
|
||||||
echo Usage: grep_log.bat <KEYWORD> [-A <n>] [-B <n>] [-C <n>]
|
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
REM 设置变量
|
|
||||||
set KEYWORD=%1
|
|
||||||
shift
|
|
||||||
|
|
||||||
REM 解析选项
|
|
||||||
set OPTIONS=
|
|
||||||
|
|
||||||
:parse_options
|
|
||||||
if "%~1"=="" goto done
|
|
||||||
if "%~1"=="-A" (
|
|
||||||
set OPTIONS=-A %2
|
|
||||||
shift
|
|
||||||
)
|
|
||||||
if "%~1"=="-B" (
|
|
||||||
set OPTIONS=-B %2
|
|
||||||
shift
|
|
||||||
)
|
|
||||||
if "%~1"=="-C" (
|
|
||||||
set OPTIONS=-C %2
|
|
||||||
shift
|
|
||||||
)
|
|
||||||
shift
|
|
||||||
goto parse_options
|
|
||||||
|
|
||||||
:done
|
|
||||||
|
|
||||||
REM 远程执行 Linux 脚本
|
|
||||||
call ssh -p %REMOTE_PORT% %REMOTE_USER%@%REMOTE_IP% "bash %SCRIPT_PATH% %KEYWORD% %OPTIONS%"
|
|
||||||
@ -98,9 +98,6 @@ public class AdvisorInfoService {
|
|||||||
@Value("${advisor.roleId}")
|
@Value("${advisor.roleId}")
|
||||||
private Integer advisorRoleId;
|
private Integer advisorRoleId;
|
||||||
|
|
||||||
@Value("${user.admin.roles}")
|
|
||||||
private Integer adminRoleId;
|
|
||||||
|
|
||||||
public static final Set<Integer> TG_SHOW_STATUS = ImmutableSet.of(
|
public static final Set<Integer> TG_SHOW_STATUS = ImmutableSet.of(
|
||||||
AdvisorInfoStatus.PASS.value,
|
AdvisorInfoStatus.PASS.value,
|
||||||
AdvisorInfoStatus.EVENT_SUBMIT.value,
|
AdvisorInfoStatus.EVENT_SUBMIT.value,
|
||||||
@ -153,7 +150,7 @@ public class AdvisorInfoService {
|
|||||||
if (dept != null && DeptType.HEAD.value.equals(dept.getType())) {
|
if (dept != null && DeptType.HEAD.value.equals(dept.getType())) {
|
||||||
deptId = null;
|
deptId = null;
|
||||||
}
|
}
|
||||||
if (backendUserVO.getRoles().contains(adminRoleId)) {
|
if (backendUserVO.getRoles().contains(StateMachine.ROLE.ADMIN)) {
|
||||||
deptId = null;
|
deptId = null;
|
||||||
}
|
}
|
||||||
Map<Integer, UserLogin> userLoginMap = userService.getUserLoginMap();
|
Map<Integer, UserLogin> userLoginMap = userService.getUserLoginMap();
|
||||||
|
|||||||
@ -18,14 +18,14 @@ public class AdvisorInfoStateMachine {
|
|||||||
advisorInfoSM.add(AdvisorInfoStatus.INIT, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, AdvisorInfoStatus.INIT);
|
advisorInfoSM.add(AdvisorInfoStatus.INIT, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, AdvisorInfoStatus.INIT);
|
||||||
|
|
||||||
// 待审核 -> 管理员[驳回] -> 已驳回
|
// 待审核 -> 管理员[驳回] -> 已驳回
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.TO_AUDIT, AdvisorInfoStatus.EVENT_REJECT, StateMachine.ROLE.NOT_ADVISOR, AdvisorInfoStatus.REJECTED);
|
advisorInfoSM.add(AdvisorInfoStatus.TO_AUDIT, AdvisorInfoStatus.EVENT_REJECT, StateMachine.ROLE.ADMIN, AdvisorInfoStatus.REJECTED);
|
||||||
// 待审核 -> 管理员[通过] -> 一级审核通过
|
// 待审核 -> 管理员[通过] -> 一级审核通过
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.TO_AUDIT, AdvisorInfoStatus.EVENT_PASS, StateMachine.ROLE.NOT_ADVISOR, AdvisorInfoStatus.PASS);
|
advisorInfoSM.add(AdvisorInfoStatus.TO_AUDIT, AdvisorInfoStatus.EVENT_PASS, StateMachine.ROLE.ADMIN, AdvisorInfoStatus.PASS);
|
||||||
|
|
||||||
// 已上架 -> 管理员[下架] -> 已下架
|
// 已上架 -> 管理员[下架] -> 已下架
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.PASS, AdvisorInfoStatus.EVENT_SOLD_OUT, StateMachine.ROLE.NOT_ADVISOR, AdvisorInfoStatus.SOLD_OUT);
|
advisorInfoSM.add(AdvisorInfoStatus.PASS, AdvisorInfoStatus.EVENT_SOLD_OUT, StateMachine.ROLE.ADMIN, AdvisorInfoStatus.SOLD_OUT);
|
||||||
// 已上架 -> 管理员[编辑] -> 已上架
|
// 已上架 -> 管理员[编辑] -> 已上架
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.PASS, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.NOT_ADVISOR, AdvisorInfoStatus.PASS);
|
advisorInfoSM.add(AdvisorInfoStatus.PASS, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADMIN, AdvisorInfoStatus.PASS);
|
||||||
|
|
||||||
// 已驳回 -> 投顾[编辑] -> 已驳回
|
// 已驳回 -> 投顾[编辑] -> 已驳回
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.REJECTED, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, AdvisorInfoStatus.REJECTED);
|
advisorInfoSM.add(AdvisorInfoStatus.REJECTED, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, AdvisorInfoStatus.REJECTED);
|
||||||
@ -37,9 +37,9 @@ public class AdvisorInfoStateMachine {
|
|||||||
// 已下架 —> 投顾[发布] -> 待审核
|
// 已下架 —> 投顾[发布] -> 待审核
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.SOLD_OUT, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, AdvisorInfoStatus.TO_AUDIT);
|
advisorInfoSM.add(AdvisorInfoStatus.SOLD_OUT, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, AdvisorInfoStatus.TO_AUDIT);
|
||||||
// 已下架 -> 管理员[上架] -> 已上架
|
// 已下架 -> 管理员[上架] -> 已上架
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.SOLD_OUT, AdvisorInfoStatus.EVENT_PUT_ON, StateMachine.ROLE.NOT_ADVISOR, AdvisorInfoStatus.PASS);
|
advisorInfoSM.add(AdvisorInfoStatus.SOLD_OUT, AdvisorInfoStatus.EVENT_PUT_ON, StateMachine.ROLE.ADMIN, AdvisorInfoStatus.PASS);
|
||||||
// 已下架 -> 管理员[编辑] -> 已下架
|
// 已下架 -> 管理员[编辑] -> 已下架
|
||||||
advisorInfoSM.add(AdvisorInfoStatus.SOLD_OUT, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.NOT_ADVISOR, AdvisorInfoStatus.SOLD_OUT);
|
advisorInfoSM.add(AdvisorInfoStatus.SOLD_OUT, AdvisorInfoStatus.EVENT_UPDATE, StateMachine.ROLE.ADMIN, AdvisorInfoStatus.SOLD_OUT);
|
||||||
|
|
||||||
return advisorInfoSM;
|
return advisorInfoSM;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,9 @@ import com.google.common.collect.Table;
|
|||||||
import com.syzb.common.handler.BizException;
|
import com.syzb.common.handler.BizException;
|
||||||
import com.syzb.common.result.ResponseStatus;
|
import com.syzb.common.result.ResponseStatus;
|
||||||
import com.syzb.common.vo.BackendUserVO;
|
import com.syzb.common.vo.BackendUserVO;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,14 +20,20 @@ import java.util.Map;
|
|||||||
public class StateMachine<T> {
|
public class StateMachine<T> {
|
||||||
|
|
||||||
public static class ROLE {
|
public static class ROLE {
|
||||||
public static final int ADVISOR = 1;
|
public static final int ADMIN = 1;
|
||||||
public static final int NOT_ADVISOR = 2;
|
public static final int ADVISOR = 2;
|
||||||
|
public static final int COMPLIANCE = 3; // 一级审核
|
||||||
|
public static final int BUSINESS = 4; // 二级审核
|
||||||
|
public static final int OPERATION = 5; // 三级审核
|
||||||
|
|
||||||
private static final Map<Integer, String> MAP = MapUtil.newHashMap();
|
private static final Map<Integer, String> MAP = MapUtil.newHashMap();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
MAP.put(ADMIN, "管理员");
|
||||||
MAP.put(ADVISOR, "投顾");
|
MAP.put(ADVISOR, "投顾");
|
||||||
MAP.put(NOT_ADVISOR, "非投顾");
|
MAP.put(COMPLIANCE, "合规");
|
||||||
|
MAP.put(BUSINESS, "业务负责人");
|
||||||
|
MAP.put(OPERATION, "运营");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +53,13 @@ public class StateMachine<T> {
|
|||||||
table.put(source, event + "|" + role, target);
|
table.put(source, event + "|" + role, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加状态事件(不同角色特殊处理。比如下架产品,投顾编辑后为待提交状态;运营人员编辑后仍未下架状态)
|
||||||
|
public void add(T source, T event, List<Integer> roles, T target) {
|
||||||
|
for (int role : roles) {
|
||||||
|
table.put(source, event + "|" + role, target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 添加状态事件(事件和目标相同,省略参数)
|
// 添加状态事件(事件和目标相同,省略参数)
|
||||||
public void add(T source, T target) {
|
public void add(T source, T target) {
|
||||||
table.put(source, target, target);
|
table.put(source, target, target);
|
||||||
@ -72,13 +87,34 @@ public class StateMachine<T> {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
String statusMsg = "原状态:[" + source + "]";
|
String statusMsg = "原状态:[" + source + "]";
|
||||||
String roleMsg = role == null ? "" : ",角色:[" + (ROLE.MAP.getOrDefault(role, role.toString())) + "]";
|
String roleMsg = role == null ? "" : ",角色:[" + (ROLE.ADMIN == role ? "管理员" : "投顾") + "]";
|
||||||
String eventMsg = ",不能执行:[" + event + "]动作";
|
String eventMsg = ",不能执行:[" + event + "]动作";
|
||||||
throw new BizException(ResponseStatus.STATUS_ERROR, statusMsg + roleMsg + eventMsg);
|
throw new BizException(ResponseStatus.STATUS_ERROR, statusMsg + roleMsg + eventMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T send(T source, T event, List<Integer> roles) {
|
||||||
|
T target = null;
|
||||||
|
for (Integer role : roles) {
|
||||||
|
target = this.send(source, event, role);
|
||||||
|
}
|
||||||
|
if (target == null) {
|
||||||
|
String statusMsg = "原状态:[" + source + "]";
|
||||||
|
String roleMsg = "";
|
||||||
|
if (!CollectionUtils.isEmpty(roles)) {
|
||||||
|
roleMsg = " 角色:[";
|
||||||
|
for (Integer role : roles) {
|
||||||
|
roleMsg += "," + ROLE.MAP.get(role);
|
||||||
|
}
|
||||||
|
roleMsg += "]";
|
||||||
|
}
|
||||||
|
String eventMsg = ",不能执行:[" + event + "]动作";
|
||||||
|
throw new BizException(ResponseStatus.STATUS_ERROR, statusMsg + roleMsg + eventMsg);
|
||||||
|
}
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
public T send(T source, T event, BackendUserVO userVO) {
|
public T send(T source, T event, BackendUserVO userVO) {
|
||||||
int role = userVO.getAdvisorId() == null ? ROLE.NOT_ADVISOR : StateMachine.ROLE.ADVISOR;
|
int role = userVO.getAdvisorId() == null ? StateMachine.ROLE.ADMIN : StateMachine.ROLE.ADVISOR;
|
||||||
return this.send(source, event, role);
|
return this.send(source, event, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,15 +16,15 @@ public class VideoActivityStateMachine {
|
|||||||
public StateMachine<VideoActivityStatus> videoActivityStatusSm() {
|
public StateMachine<VideoActivityStatus> videoActivityStatusSm() {
|
||||||
StateMachine<VideoActivityStatus> activityStatusSm = new StateMachine<>();
|
StateMachine<VideoActivityStatus> activityStatusSm = new StateMachine<>();
|
||||||
// 待审核 [运营人员]审核 通过 上架
|
// 待审核 [运营人员]审核 通过 上架
|
||||||
activityStatusSm.add(VideoActivityStatus.TO_AUDIT, VideoActivityStatus.EVENT_PASS, StateMachine.ROLE.NOT_ADVISOR, VideoActivityStatus.PASS);
|
activityStatusSm.add(VideoActivityStatus.TO_AUDIT, VideoActivityStatus.EVENT_PASS, StateMachine.ROLE.ADMIN, VideoActivityStatus.PASS);
|
||||||
// 待审核 [运营人员]审核 驳回 已驳回
|
// 待审核 [运营人员]审核 驳回 已驳回
|
||||||
activityStatusSm.add(VideoActivityStatus.TO_AUDIT, VideoActivityStatus.EVENT_REJECT, StateMachine.ROLE.NOT_ADVISOR, VideoActivityStatus.REJECTED);
|
activityStatusSm.add(VideoActivityStatus.TO_AUDIT, VideoActivityStatus.EVENT_REJECT, StateMachine.ROLE.ADMIN, VideoActivityStatus.REJECTED);
|
||||||
// 已驳回 [投顾]编辑 待审核
|
// 已驳回 [投顾]编辑 待审核
|
||||||
activityStatusSm.add(VideoActivityStatus.REJECTED, VideoActivityStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR, VideoActivityStatus.TO_AUDIT);
|
activityStatusSm.add(VideoActivityStatus.REJECTED, VideoActivityStatus.EVENT_UPDATE, StateMachine.ROLE.ADMIN, VideoActivityStatus.TO_AUDIT);
|
||||||
// 已上架 [运营人员] 下架
|
// 已上架 [运营人员] 下架
|
||||||
activityStatusSm.add(VideoActivityStatus.PASS, VideoActivityStatus.EVENT_SOLD_OUT, StateMachine.ROLE.NOT_ADVISOR, VideoActivityStatus.SOLD_OUT);
|
activityStatusSm.add(VideoActivityStatus.PASS, VideoActivityStatus.EVENT_SOLD_OUT, StateMachine.ROLE.ADMIN, VideoActivityStatus.SOLD_OUT);
|
||||||
// 已下架 [运营人员] 上架
|
// 已下架 [运营人员] 上架
|
||||||
activityStatusSm.add(VideoActivityStatus.SOLD_OUT, VideoActivityStatus.EVENT_PUT_ON, StateMachine.ROLE.NOT_ADVISOR, VideoActivityStatus.PASS);
|
activityStatusSm.add(VideoActivityStatus.SOLD_OUT, VideoActivityStatus.EVENT_PUT_ON, StateMachine.ROLE.ADMIN, VideoActivityStatus.PASS);
|
||||||
return activityStatusSm;
|
return activityStatusSm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,34 +13,38 @@ public class VideoLiveColumnStateMachine {
|
|||||||
public StateMachine<VideoLiveColumnStatus> videoLiveColumnSM() {
|
public StateMachine<VideoLiveColumnStatus> videoLiveColumnSM() {
|
||||||
StateMachine<VideoLiveColumnStatus> videoLiveColumnSM = new StateMachine<>();
|
StateMachine<VideoLiveColumnStatus> videoLiveColumnSM = new StateMachine<>();
|
||||||
|
|
||||||
// 待提交>待提交
|
// 待提交>待提交 (券商投顾操作)(投顾编辑)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UN_SUBMIT, VideoLiveColumnStatus.EVENT_EDIT, VideoLiveColumnStatus.UN_SUBMIT);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UN_SUBMIT, VideoLiveColumnStatus.EVENT_EDIT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UN_SUBMIT);
|
||||||
// 待提交>上架待审核
|
// 待提交>上架待审核 (券商投顾操作)(投顾申请上架)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UN_SUBMIT, VideoLiveColumnStatus.EVENT_SUBMIT, VideoLiveColumnStatus.UP_UN_AUDIT);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UN_SUBMIT, VideoLiveColumnStatus.EVENT_SUBMIT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP_UN_AUDIT);
|
||||||
// 待提交>上架
|
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UN_SUBMIT, VideoLiveColumnStatus.EVENT_PUT_ON, VideoLiveColumnStatus.UP);
|
|
||||||
|
|
||||||
// 上架待审核>待提交
|
// 上架待审核>待提交 (券商投顾操作)(投顾撤回)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_WITHDRAW, VideoLiveColumnStatus.UN_SUBMIT);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_WITHDRAW, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UN_SUBMIT);
|
||||||
// 上架待审核>通过上架
|
// 上架待审核>通过上架 (一级投顾管理岗操作)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_PASS, VideoLiveColumnStatus.UP);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_PASS, new ArrayList<>(Arrays.asList(StateMachine.ROLE.COMPLIANCE, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP);
|
||||||
// 上架待审核>驳回
|
// 上架待审核>驳回 (一级投顾管理岗操作)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_REJECT, VideoLiveColumnStatus.REJECT);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_REJECT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.REJECT);
|
||||||
|
|
||||||
// 驳回>上架待审核
|
// 驳回>上架待审核 (券商投顾操作)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.REJECT, VideoLiveColumnStatus.EVENT_EDIT, VideoLiveColumnStatus.UP_UN_AUDIT);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.REJECT, VideoLiveColumnStatus.EVENT_EDIT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP_UN_AUDIT);
|
||||||
// 驳回>申请上架
|
// 一审驳回>上架待审核/三审驳回>上架待审核/三审驳回>上架待审核 (申请上架)
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.REJECT, VideoLiveColumnStatus.EVENT_SUBMIT, VideoLiveColumnStatus.UP_UN_AUDIT);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.REJECT, VideoLiveColumnStatus.EVENT_SUBMIT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP_UN_AUDIT);
|
||||||
|
|
||||||
// 上架>下架
|
// 上架>下架
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.UP, VideoLiveColumnStatus.EVENT_PUT_OFF, VideoLiveColumnStatus.DOWN);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UP, VideoLiveColumnStatus.EVENT_PUT_OFF, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.DOWN);
|
||||||
|
|
||||||
|
// 待审核>上架
|
||||||
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UP_UN_AUDIT, VideoLiveColumnStatus.EVENT_PASS, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP);
|
||||||
|
|
||||||
// 下架>上架
|
// 下架>上架
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.DOWN, VideoLiveColumnStatus.EVENT_PUT_ON, VideoLiveColumnStatus.UP);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.DOWN, VideoLiveColumnStatus.EVENT_PUT_ON, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP);
|
||||||
// 下架>下架
|
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.DOWN, VideoLiveColumnStatus.EVENT_EDIT, VideoLiveColumnStatus.DOWN);
|
videoLiveColumnSM.add(VideoLiveColumnStatus.UN_SUBMIT, VideoLiveColumnStatus.EVENT_PUT_ON, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP);
|
||||||
// 下架>上架待审核
|
|
||||||
videoLiveColumnSM.add(VideoLiveColumnStatus.DOWN, VideoLiveColumnStatus.EVENT_SUBMIT, VideoLiveColumnStatus.UP_UN_AUDIT);
|
// 下架>下架 (投顾编辑/管理员编辑)
|
||||||
|
videoLiveColumnSM.add(VideoLiveColumnStatus.DOWN, VideoLiveColumnStatus.EVENT_EDIT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.DOWN);
|
||||||
|
// 下架>上架待审核 (申请上架)
|
||||||
|
videoLiveColumnSM.add(VideoLiveColumnStatus.DOWN, VideoLiveColumnStatus.EVENT_SUBMIT, new ArrayList<>(Arrays.asList(StateMachine.ROLE.ADVISOR, StateMachine.ROLE.ADMIN)), VideoLiveColumnStatus.UP_UN_AUDIT);
|
||||||
|
|
||||||
return videoLiveColumnSM;
|
return videoLiveColumnSM;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,9 +75,6 @@ public class AuthService {
|
|||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
@Value("${user.admin.roles}")
|
|
||||||
private Integer adminRoleId;
|
|
||||||
|
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public AuthVO login(LoginQuery query) {
|
public AuthVO login(LoginQuery query) {
|
||||||
String uuid = query.getUuid();
|
String uuid = query.getUuid();
|
||||||
@ -223,8 +220,9 @@ public class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Integer getAuthId(BackendUserVO backendUserVO) {
|
public Integer getAuthId(BackendUserVO backendUserVO) {
|
||||||
|
int admin = StateMachine.ROLE.ADMIN;
|
||||||
List<Integer> roles = backendUserVO.getRoles();
|
List<Integer> roles = backendUserVO.getRoles();
|
||||||
if (roles.contains(adminRoleId)) {
|
if (roles.contains(admin)) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return backendUserVO.getUserId();
|
return backendUserVO.getUserId();
|
||||||
@ -246,7 +244,7 @@ public class AuthService {
|
|||||||
String deptId = backendUserVO.getDeptId();
|
String deptId = backendUserVO.getDeptId();
|
||||||
Map<String, Dept> deptMap = deptService.getDeptMap();
|
Map<String, Dept> deptMap = deptService.getDeptMap();
|
||||||
Dept dept = deptMap.get(deptId);
|
Dept dept = deptMap.get(deptId);
|
||||||
boolean contains = backendUserVO.getRoles().contains(adminRoleId);
|
boolean contains = backendUserVO.getRoles().contains(StateMachine.ROLE.ADMIN);
|
||||||
if (contains) {
|
if (contains) {
|
||||||
//超管
|
//超管
|
||||||
return null;
|
return null;
|
||||||
@ -294,7 +292,7 @@ public class AuthService {
|
|||||||
//分部:只查看所属部门的数据
|
//分部:只查看所属部门的数据
|
||||||
//总部:查看所有数据
|
//总部:查看所有数据
|
||||||
List<Integer> roles = backendUserVO.getRoles();
|
List<Integer> roles = backendUserVO.getRoles();
|
||||||
if (roles.contains(adminRoleId)) {
|
if (roles.contains(StateMachine.ROLE.ADMIN)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (DeptType.HEAD.value.equals(type)) {
|
if (DeptType.HEAD.value.equals(type)) {
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public class AdminVideoActivityService {
|
|||||||
}
|
}
|
||||||
VideoActivityStatus dbStatus = VideoActivityStatus.fromValue(dbActivity.getStatus());
|
VideoActivityStatus dbStatus = VideoActivityStatus.fromValue(dbActivity.getStatus());
|
||||||
VideoActivityStatus event = VideoActivityStatus.fromValue(query.getStatus());
|
VideoActivityStatus event = VideoActivityStatus.fromValue(query.getStatus());
|
||||||
VideoActivityStatus targetStatus = activityStatusSm.send(dbStatus, event, backendUserVO);
|
VideoActivityStatus targetStatus = activityStatusSm.send(dbStatus, event, StateMachine.ROLE.ADMIN);
|
||||||
VideoLiveActivity activity = query.toPO(targetStatus, VideoActivityStatus.PASS.equals(targetStatus) ? backendUserVO.getUserId() : null);
|
VideoLiveActivity activity = query.toPO(targetStatus, VideoActivityStatus.PASS.equals(targetStatus) ? backendUserVO.getUserId() : null);
|
||||||
if (VideoActivityStatus.PASS.equals(targetStatus)) {
|
if (VideoActivityStatus.PASS.equals(targetStatus)) {
|
||||||
check(dbActivity.getActivityRang(), dbActivity.getAdvisorId());
|
check(dbActivity.getActivityRang(), dbActivity.getAdvisorId());
|
||||||
|
|||||||
@ -80,7 +80,7 @@ public class AdminVideoCartService {
|
|||||||
VideoCart dbCart = getVideoCart(videoId, productId, productType);
|
VideoCart dbCart = getVideoCart(videoId, productId, productType);
|
||||||
VideoCartStatus dbStatus = VideoCartStatus.fromValue(dbCart.getStatus());
|
VideoCartStatus dbStatus = VideoCartStatus.fromValue(dbCart.getStatus());
|
||||||
VideoCartStatus submitStatus = VideoCartStatus.fromValue(query.getStatus());
|
VideoCartStatus submitStatus = VideoCartStatus.fromValue(query.getStatus());
|
||||||
VideoCartStatus status = videoCartStatusSm.send(dbStatus, submitStatus, backendUserVO);
|
VideoCartStatus status = videoCartStatusSm.send(dbStatus, submitStatus, StateMachine.ROLE.ADVISOR);
|
||||||
dbCart.setStatus(status.value);
|
dbCart.setStatus(status.value);
|
||||||
if (query.getNum() != null) {
|
if (query.getNum() != null) {
|
||||||
dbCart.setSaleLimit(query.getNum());
|
dbCart.setSaleLimit(query.getNum());
|
||||||
|
|||||||
@ -336,7 +336,7 @@ public class AdminVideoInfoService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
VideoStatus dbStatus = VideoStatus.fromValue(videoInDb.getStatus());
|
VideoStatus dbStatus = VideoStatus.fromValue(videoInDb.getStatus());
|
||||||
VideoStatus targetStatus = videoStatusSm.send(dbStatus, VideoStatus.EVENT_UPDATE, backendUser);
|
VideoStatus targetStatus = videoStatusSm.send(dbStatus, VideoStatus.EVENT_UPDATE, StateMachine.ROLE.ADVISOR);
|
||||||
// 管理员修改/待提交/驳回/下架直接修改
|
// 管理员修改/待提交/驳回/下架直接修改
|
||||||
if (VideoStatus.INIT.equals(dbStatus) || VideoStatus.REJECTED.equals(dbStatus) || VideoStatus.SOLD_OUT.equals(dbStatus) || VideoStatus.PASS.equals(dbStatus)) {
|
if (VideoStatus.INIT.equals(dbStatus) || VideoStatus.REJECTED.equals(dbStatus) || VideoStatus.SOLD_OUT.equals(dbStatus) || VideoStatus.PASS.equals(dbStatus)) {
|
||||||
// 上架修改需要添加修改待审核
|
// 上架修改需要添加修改待审核
|
||||||
|
|||||||
@ -29,7 +29,7 @@ cron:
|
|||||||
syncModuleUser: "40 1/5 * * * ?"
|
syncModuleUser: "40 1/5 * * * ?"
|
||||||
user:
|
user:
|
||||||
admin:
|
admin:
|
||||||
roles: 1 #管理员角色id,用逗号隔开
|
roles: 1,3,4,5 #管理员角色id,用逗号隔开
|
||||||
defaultPwd: syzb.hello.dev
|
defaultPwd: syzb.hello.dev
|
||||||
dept:
|
dept:
|
||||||
head:
|
head:
|
||||||
|
|||||||
@ -28,7 +28,7 @@ cron:
|
|||||||
syncModuleUser: "40 1/5 * * * ?"
|
syncModuleUser: "40 1/5 * * * ?"
|
||||||
user:
|
user:
|
||||||
admin:
|
admin:
|
||||||
roles: 1 #管理员角色id,用逗号隔开
|
roles: 1,3,4,5 #管理员角色id,用逗号隔开
|
||||||
defaultPwd: syzb.hello.dev
|
defaultPwd: syzb.hello.dev
|
||||||
dept:
|
dept:
|
||||||
head:
|
head:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user