fix(新手旅程): 新手任务跳过更改为不再显示功能,调整数据库数据类型

This commit is contained in:
lan-yonghui 2023-04-07 00:24:24 +08:00 committed by 刘瑞斌
parent 4cdff4ab1b
commit cc8be22fa2
17 changed files with 436 additions and 148 deletions

View File

@ -13,11 +13,13 @@ public class NoviceStatistics implements Serializable {
private Integer guideNum; private Integer guideNum;
private String dataOption;
private Integer status;
private Long createTime; private Long createTime;
private Long updateTime; private Long updateTime;
private String dataOption;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -364,6 +364,136 @@ public class NoviceStatisticsExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andDataOptionIsNull() {
addCriterion("data_option is null");
return (Criteria) this;
}
public Criteria andDataOptionIsNotNull() {
addCriterion("data_option is not null");
return (Criteria) this;
}
public Criteria andDataOptionEqualTo(String value) {
addCriterion("data_option =", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionNotEqualTo(String value) {
addCriterion("data_option <>", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionGreaterThan(String value) {
addCriterion("data_option >", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionGreaterThanOrEqualTo(String value) {
addCriterion("data_option >=", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionLessThan(String value) {
addCriterion("data_option <", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionLessThanOrEqualTo(String value) {
addCriterion("data_option <=", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionLike(String value) {
addCriterion("data_option like", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionNotLike(String value) {
addCriterion("data_option not like", value, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionIn(List<String> values) {
addCriterion("data_option in", values, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionNotIn(List<String> values) {
addCriterion("data_option not in", values, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionBetween(String value1, String value2) {
addCriterion("data_option between", value1, value2, "dataOption");
return (Criteria) this;
}
public Criteria andDataOptionNotBetween(String value1, String value2) {
addCriterion("data_option not between", value1, value2, "dataOption");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() { public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null"); addCriterion("create_time is null");
return (Criteria) this; return (Criteria) this;

View File

@ -7,7 +7,11 @@ export function getSideTask() {
} }
export function saveStep() { export function saveStep() {
return post(`/novice/save/step`,{'guideStep': localStorage.getItem('step')}); return post(`/novice/save/step`,{'guideStep': localStorage.getItem('step'), 'dataOption': JSON.stringify(TASK_DATA)});
}
export function updateStatus(status) {
return post(`/novice/status`,{'status': status, 'dataOption': JSON.stringify(TASK_DATA)});
} }
export function saveTask(data) { export function saveTask(data) {

View File

@ -50,7 +50,7 @@ export default {
} }
break; break;
case "novice": case "novice":
this.$refs.sideMenu.toggle(); this.$refs.sideMenu.toggle(2);
break; break;
default: default:
break; break;
@ -60,6 +60,7 @@ export default {
getSideTask().then(res=> { getSideTask().then(res=> {
if (res.data.length > 0 && res.data[0].guideStep) { if (res.data.length > 0 && res.data[0].guideStep) {
localStorage.setItem('step', res.data[0].guideStep) localStorage.setItem('step', res.data[0].guideStep)
localStorage.setItem("noviceStatus", res.data[0].status)
} else { } else {
localStorage.setItem('guide','0') localStorage.setItem('guide','0')
} }

View File

@ -115,6 +115,7 @@ export default {
}, },
gotoTurn(){ gotoTurn(){
this.closeDialog() this.closeDialog()
if(localStorage.getItem("noviceStatus") && localStorage.getItem("noviceStatus") === "1"){
let redirectUrl = sessionStorage.getItem("redirectUrl") let redirectUrl = sessionStorage.getItem("redirectUrl")
if(redirectUrl.includes("track")){ if(redirectUrl.includes("track")){
this.$emit("skipOpen", "/track/case/all") this.$emit("skipOpen", "/track/case/all")
@ -125,6 +126,9 @@ export default {
query: { status: true }, query: { status: true },
}) })
} }
}else{
this.$router.push("/track/case/all")
}
} }
} }
} }
@ -141,12 +145,13 @@ export default {
padding: 1px 5px 0 5px; padding: 1px 5px 0 5px;
} }
::v-deep .api-import-next .el-dialog__body { ::v-deep .api-import-next .el-dialog__body {
padding: 12px 5px 0 5px; padding: 24px 5px 0 5px;
} }
::v-deep .api-import-next .el-dialog { ::v-deep .api-import-next .el-dialog {
margin-top: 10vh !important; margin-top: 10vh !important;
border-radius: 8px; border-radius: 8px;
padding-bottom: 1px !important;
background-image: linear-gradient(to bottom, #783887 65%, #FFF 0); background-image: linear-gradient(to bottom, #783887 65%, #FFF 0);
} }

View File

@ -1,21 +1,22 @@
<template> <template>
<div v-if="taskStatus"> <div v-show="taskStatus && noviceStatus">
<!-- 侧边任务按钮--> <!-- 侧边任务按钮-->
<div class="parentBox" @click="toggle()"> <div :class="language === 'en-US' ? 'parentBox parentBox-en' : 'parentBox'" @click="toggle(1)">
<div class="contentsBox"> <div class="contentsBox">
<div :style="openBox ? 'right: 0;width:120px;cursor: auto;' : ''"> <div :style="openBox ? (language === 'en-US' ? 'right: 0;width:140px;cursor: auto;' :
'right: 0;width:100px;cursor: auto;') : ''" >
<font-awesome-icon class="icon global focusing" :icon="['fas', 'compass']" spin style="color: #ffffff;" /> <font-awesome-icon class="icon global focusing" :icon="['fas', 'compass']" spin style="color: #ffffff;" />
<span :style="openBox ? 'display: block;color: #fff;cursor: pointer;' : ''">{{$t('side_task.novice_task')}}</span> <span :style="openBox ? 'display: block;color: #fff;cursor: pointer;' : ''">{{$t('side_task.novice_task')}}</span>
</div> </div>
</div> </div>
</div> </div>
<ms-site-task ref="siteTask" :taskData="taskData" @closeBox="closeBox"/> <ms-site-task ref="siteTask" :taskData="taskData" @closeBox="closeBox" @closeNovice="closeNovice"/>
</div> </div>
</template> </template>
<script> <script>
import MsSiteTask from "../../components/sidemenu/components/SiteTask"; import MsSiteTask from "../../components/sidemenu/components/SiteTask";
import {getSideTask} from "../../api/novice"; import {getSideTask, updateStatus} from "../../api/novice";
import {TASK_DATA} from "../../utils/constants"; import {TASK_DATA} from "../../utils/constants";
import {hasLicense, hasPermissions} from "../../utils/permission"; import {hasLicense, hasPermissions} from "../../utils/permission";
@ -27,22 +28,31 @@ export default {
data() { data() {
return { return {
taskStatus: false, taskStatus: false,
noviceStatus: false,
openBox:false, openBox:false,
totalTask: 0, totalTask: 0,
taskData:[] taskData:[],
language: localStorage.getItem('language'),
}; };
}, },
created() { mounted() {
this.initTaskData() this.initTaskData(1)
}, },
methods: { methods: {
initTaskData(){ initTaskData(status){
getSideTask().then(res=>{ getSideTask().then(res=>{
if(res.data.length > 0 && res.data[0].dataOption){ if(res.data.length > 0 && res.data[0].dataOption){
this.taskData = JSON.parse(res.data[0].dataOption) this.taskData = JSON.parse(res.data[0].dataOption)
this.noviceStatus = res.data[0].status === 1
}else{ }else{
this.taskData = TASK_DATA this.taskData = TASK_DATA
} }
if(status === 2 && res.data[0].status === 0){
updateStatus(1).then(res=>{
this.noviceStatus = true
localStorage.setItem("noviceStatus", "1")
})
}
let microApp = JSON.parse(sessionStorage.getItem("micro_apps")); let microApp = JSON.parse(sessionStorage.getItem("micro_apps"));
let num = 0 let num = 0
let total = 0 let total = 0
@ -67,16 +77,19 @@ export default {
this.totalTask = num this.totalTask = num
}) })
}, },
toggle(){ toggle(status){
this.initTaskData(status)
this.openBox = true this.openBox = true
this.initTaskData()
this.$refs.siteTask.open(); this.$refs.siteTask.open();
}, },
closeBox(status){ closeBox(status){
this.openBox = status this.openBox = status
}, },
closeNovice(status){
this.noviceStatus = status
},
skipOpen(path){ skipOpen(path){
this.initTaskData() this.initTaskData(1)
this.$refs.siteTask.skipOpen(path); this.$refs.siteTask.skipOpen(path);
} }
} }
@ -114,15 +127,30 @@ export default {
.parentBox .contentsBox div span:last-child { .parentBox .contentsBox div span:last-child {
margin-left: 10px; margin-left: 10px;
} }
.parentBox-en .contentsBox div span:last-child {
margin-left: 5px;
}
.parentBox .contentsBox div:nth-child(1) { .parentBox .contentsBox div:nth-child(1) {
bottom: 125px; bottom: 125px;
} }
.parentBox .contentsBox div:hover { .parentBox .contentsBox div:hover {
right: 0; right: 0;
height: 28px; height: 28px;
width: 120px; width: 100px;
cursor: auto; cursor: auto;
} }
.parentBox-en .contentsBox div:hover {
right: 0;
height: 28px;
width: 140px;
cursor: auto;
}
.box {
width: 100px;
}
.box-en {
width: 140px;
}
.parentBox .contentsBox div:hover span { .parentBox .contentsBox div:hover span {
display: block; display: block;

View File

@ -32,8 +32,8 @@
</p> </p>
</div> </div>
<div class="footer"> <div class="footer">
<el-button style="float: right; padding: 15px 0;color:#8C8C8C" type="text" @click="skip()"> <el-button style="float: right; padding: 15px 0;color:#8C8C8C" type="text" @click="notShow()">
{{$t('side_task.skip')}} {{$t('side_task.not_show')}}
</el-button> </el-button>
</div> </div>
</el-card> </el-card>
@ -81,8 +81,8 @@
<el-button v-if="taskIndex > 1" style="float: right;margin-left: 10px; padding: 15px 0" type="text" @click="prev()"> <el-button v-if="taskIndex > 1" style="float: right;margin-left: 10px; padding: 15px 0" type="text" @click="prev()">
{{$t('side_task.prev')}} {{$t('side_task.prev')}}
</el-button> </el-button>
<el-button style="float: left; padding: 15px 0;color:#8C8C8C" type="text" @click="skip()"> <el-button style="float: left; padding: 15px 0;color:#8C8C8C" type="text" @click="notShow()">
{{$t('side_task.skip')}} {{$t('side_task.not_show')}}
</el-button> </el-button>
</div> </div>
</el-card> </el-card>
@ -114,16 +114,43 @@
</div> </div>
</el-card> </el-card>
</div> </div>
<div :class="language === 'en-US' ? 'csat-popup-gif close close-en' : 'csat-popup-gif close'" v-if="noviceVisible">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span style="float: right; padding: 5px 0;" class="moon" @click="closeGif()">
<font-awesome-icon :icon="['fa', 'times']" class="icon"/>
</span>
<span class="text-header" v-html="$t('side_task.close.title')" />
</div>
<div style="height: 40px">
<p class="close-desc">
{{ $t("side_task.close.subtitle") }}
</p>
<p class="close-desc">{{ $t("side_task.close.desc") }}</p>
</div>
<div class="gif-footer-close">
<el-button type="primary" round size="mini" @click="closeGif()">
{{ $t("side_task.close.continue_btn") }}
</el-button>
<el-button type="primary" round size="mini" @click="goContinue()">
{{ $t("side_task.close.close_btn") }}
</el-button>
</div>
</el-card>
</div>
</div> </div>
</template> </template>
<script> <script>
import {hasPermissions} from "../../../utils/permission"; import {hasPermissions} from "../../../utils/permission";
import {updateStatus} from "../../../api/novice";
export default { export default {
name: "SiteTask", name: "SiteTask",
data() { data() {
return { return {
noviceVisible: false,
cardVisible: false, cardVisible: false,
gifVisible: false, gifVisible: false,
gifData:'', gifData:'',
@ -145,7 +172,7 @@ export default {
taskData: Array taskData: Array
}, },
created() { mounted() {
if(this.status){ if(this.status){
this.skipOpen("/track/case/all") this.skipOpen("/track/case/all")
} }
@ -181,13 +208,16 @@ export default {
this.cardVisible = !this.cardVisible; this.cardVisible = !this.cardVisible;
this.$emit("closeBox", this.cardVisible) this.$emit("closeBox", this.cardVisible)
this.gifVisible = this.cardVisible ? this.gifVisible : this.cardVisible; this.gifVisible = this.cardVisible ? this.gifVisible : this.cardVisible;
this.noviceVisible = this.cardVisible ? false : this.cardVisible;
}, },
openGif(gif) { openGif(gif) {
this.gifVisible = true this.gifVisible = true
this.noviceVisible = false
this.gifData = gif this.gifData = gif
}, },
closeGif(){ closeGif(){
this.gifVisible = false this.gifVisible = false
this.noviceVisible = false
}, },
prev() { prev() {
this.taskIndex = this.taskIndex - 1 this.taskIndex = this.taskIndex - 1
@ -197,8 +227,18 @@ export default {
this.taskIndex = this.taskIndex + 1 this.taskIndex = this.taskIndex + 1
this.taskIndex = this.taskIndex > this.taskData.length ? this.taskData.length : this.taskIndex this.taskIndex = this.taskIndex > this.taskData.length ? this.taskData.length : this.taskIndex
}, },
skip() { notShow() {
this.open() this.noviceVisible = true
this.gifVisible = false
},
goContinue () {
updateStatus(0).then(res=>{
this.$success(this.$t('commons.save_success'));
this.cardVisible = false
localStorage.setItem("noviceStatus", "0")
this.$emit("closeNovice", false)
})
}, },
gotoPath(path){ gotoPath(path){
this.$router.push(path) this.$router.push(path)
@ -212,6 +252,7 @@ export default {
this.taskNum() this.taskNum()
this.cardVisible = true this.cardVisible = true
this.$emit("closeBox", this.cardVisible) this.$emit("closeBox", this.cardVisible)
this.$emit("closeNovice", true)
this.openGif(item) this.openGif(item)
} }
}) })
@ -242,6 +283,13 @@ export default {
font-weight: 300; font-weight: 300;
} }
.close-desc {
text-align: left;
margin: 3px 0;
font-size: 14px;
font-weight: 300;
}
.item { .item {
margin-bottom: 10px; margin-bottom: 10px;
margin-left: 35px; margin-left: 35px;
@ -297,6 +345,16 @@ export default {
text-align: center; text-align: center;
} }
.gif-footer-close {
width: 100%;
margin: 10px 0 15px;
text-align: right;
}
.image-slot {
padding-top: 100px;
}
.gif-footer-en { .gif-footer-en {
width: 100%; width: 100%;
margin: 10px 0 44px; margin: 10px 0 44px;
@ -347,6 +405,13 @@ export default {
-webkit-transition: .3s; -webkit-transition: .3s;
transition: .3s; transition: .3s;
} }
.close {
bottom: 362px;
}
.close-en {
bottom: 388px;
}
.text-header { .text-header {
font-weight: 700; font-weight: 700;
@ -390,6 +455,10 @@ export default {
padding: 20px 24px 0px 24px; padding: 20px 24px 0px 24px;
} }
::v-deep .close .el-card__body {
padding: 0 24px;
}
::v-deep .csat-popup-gif .el-card__header { ::v-deep .csat-popup-gif .el-card__header {
border-bottom: none; border-bottom: none;
padding: 20px 20px 10px 24px; padding: 20px 20px 10px 24px;

View File

@ -3627,14 +3627,32 @@ const message = {
next: "Next", next: "Next",
prev: "Previous", prev: "Previous",
skip: "Skip", skip: "Skip",
novice_task: "Novice Task", not_show: "don't show again",
novice_task: "Novice Journey",
over: { over: {
title: "Congratulations!", title: "Congratulations!",
subtitle: "You have completed all the novice journey, full of energy", subtitle: "You have completed all the novice journey, full of energy",
desc: "If you want to continue to learn about advanced tutorials, please follow our technical blog and live channel", desc: "If you want to continue to learn about advanced tutorials, please follow our technical blog and live channel",
blog_url: "Technical Blog", blog_url: "Technical Blog",
live_url: "Live Channel" live_url: "Live Channel"
},
close: {
title: "Close the novice journey",
subtitle: "After closing, the novice task float button will be hidden.",
desc: 'You can still find us in the top "?" dropdown menu.',
continue_btn: "Continue",
close_btn: "Still Close",
} }
} }
}; };

View File

@ -3498,6 +3498,7 @@ const message = {
next: "下一章", next: "下一章",
prev: "上一章", prev: "上一章",
skip: "跳过", skip: "跳过",
not_show: "不再显示",
novice_task: "新手旅程", novice_task: "新手旅程",
over: { over: {
title: "恭喜通关!", title: "恭喜通关!",
@ -3505,6 +3506,13 @@ const message = {
desc: "想继续了解进阶教程,请关注我们的技术博客和直播", desc: "想继续了解进阶教程,请关注我们的技术博客和直播",
blog_url: "博客地址", blog_url: "博客地址",
live_url: "直播间地址" live_url: "直播间地址"
},
close: {
title: "关闭新手旅程",
subtitle: "关闭后,新手任务浮窗将会隐藏",
desc: '你可以在顶部" ? "下拉菜单重新找到我们。',
continue_btn: "现在继续",
close_btn: "仍然关闭",
} }
} }
}; };

View File

@ -3498,6 +3498,7 @@ const message = {
next: "下一章", next: "下一章",
prev: "上一章", prev: "上一章",
skip: "跳過", skip: "跳過",
not_show: "不再顯示",
novice_task: "新手旅程", novice_task: "新手旅程",
over: { over: {
title: "恭喜通關!", title: "恭喜通關!",
@ -3505,6 +3506,13 @@ const message = {
desc: "想繼續了解進階教程,請關注我們的技術博客和直播", desc: "想繼續了解進階教程,請關注我們的技術博客和直播",
blog_url: "博客地址", blog_url: "博客地址",
live_url: "直播間地址" live_url: "直播間地址"
},
close: {
title: "關閉新手旅程",
subtitle: "關閉後,新手任務浮窗將會隱藏",
desc: '你可以在頂部" ? "下拉式功能表重新找到我們。',
continue_btn: "現在繼續",
close_btn: "仍然關閉",
} }
} }
}; };

View File

@ -16,21 +16,15 @@ public interface NoviceStatisticsMapper {
int insertSelective(NoviceStatistics record); int insertSelective(NoviceStatistics record);
List<NoviceStatistics> selectByExampleWithBLOBs(NoviceStatisticsExample example);
List<NoviceStatistics> selectByExample(NoviceStatisticsExample example); List<NoviceStatistics> selectByExample(NoviceStatisticsExample example);
NoviceStatistics selectByPrimaryKey(String id); NoviceStatistics selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") NoviceStatistics record, @Param("example") NoviceStatisticsExample example); int updateByExampleSelective(@Param("record") NoviceStatistics record, @Param("example") NoviceStatisticsExample example);
int updateByExampleWithBLOBs(@Param("record") NoviceStatistics record, @Param("example") NoviceStatisticsExample example);
int updateByExample(@Param("record") NoviceStatistics record, @Param("example") NoviceStatisticsExample example); int updateByExample(@Param("record") NoviceStatistics record, @Param("example") NoviceStatisticsExample example);
int updateByPrimaryKeySelective(NoviceStatistics record); int updateByPrimaryKeySelective(NoviceStatistics record);
int updateByPrimaryKeyWithBLOBs(NoviceStatistics record);
int updateByPrimaryKey(NoviceStatistics record); int updateByPrimaryKey(NoviceStatistics record);
} }

View File

@ -4,14 +4,13 @@
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.NoviceStatistics"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.NoviceStatistics">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" /> <result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="guide_step" jdbcType="TINYINT" property="guideStep" /> <result column="guide_step" jdbcType="INTEGER" property="guideStep" />
<result column="guide_num" jdbcType="TINYINT" property="guideNum" /> <result column="guide_num" jdbcType="INTEGER" property="guideNum" />
<result column="data_option" jdbcType="VARCHAR" property="dataOption" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.NoviceStatistics">
<result column="data_option" jdbcType="LONGVARCHAR" property="dataOption" />
</resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
@ -71,27 +70,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, user_id, guide_step, guide_num, create_time, update_time id, user_id, guide_step, guide_num, data_option, `status`, create_time, update_time
</sql> </sql>
<sql id="Blob_Column_List">
data_option
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.NoviceStatisticsExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from novice_statistics
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.NoviceStatisticsExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.NoviceStatisticsExample" resultMap="BaseResultMap">
select select
<if test="distinct"> <if test="distinct">
@ -106,11 +86,9 @@
order by ${orderByClause} order by ${orderByClause}
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from novice_statistics from novice_statistics
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</select> </select>
@ -125,11 +103,12 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.NoviceStatistics"> <insert id="insert" parameterType="io.metersphere.base.domain.NoviceStatistics">
insert into novice_statistics (id, user_id, guide_step, guide_num, insert into novice_statistics (id, user_id, guide_step,
create_time, update_time, data_option) guide_num, data_option, `status`,
values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{guideStep,jdbcType=TINYINT}, create_time, update_time)
#{guideNum,jdbcType=INTEGER},#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{guideStep,jdbcType=INTEGER},
#{dataOption,jdbcType=LONGVARCHAR}) #{guideNum,jdbcType=INTEGER}, #{dataOption,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.NoviceStatistics"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.NoviceStatistics">
insert into novice_statistics insert into novice_statistics
@ -146,15 +125,18 @@
<if test="guideNum != null"> <if test="guideNum != null">
guide_num, guide_num,
</if> </if>
<if test="dataOption != null">
data_option,
</if>
<if test="status != null">
`status`,
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="dataOption != null">
data_option,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -164,20 +146,23 @@
#{userId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
</if> </if>
<if test="guideStep != null"> <if test="guideStep != null">
#{guideStep,jdbcType=TINYINT}, #{guideStep,jdbcType=INTEGER},
</if> </if>
<if test="guideNum != null"> <if test="guideNum != null">
#{guideNum,jdbcType=INTEGER}, #{guideNum,jdbcType=INTEGER},
</if> </if>
<if test="dataOption != null">
#{dataOption,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="dataOption != null">
#{dataOption,jdbcType=LONGVARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.NoviceStatisticsExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.NoviceStatisticsExample" resultType="java.lang.Long">
@ -196,44 +181,36 @@
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
</if> </if>
<if test="record.guideStep != null"> <if test="record.guideStep != null">
guide_step = #{record.guideStep,jdbcType=TINYINT}, guide_step = #{record.guideStep,jdbcType=INTEGER},
</if> </if>
<if test="record.guideNum != null"> <if test="record.guideNum != null">
guide_num = #{record.guideNum,jdbcType=INTEGER}, guide_num = #{record.guideNum,jdbcType=INTEGER},
</if> </if>
<if test="record.dataOption != null">
data_option = #{record.dataOption,jdbcType=VARCHAR},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.createTime != null"> <if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
</if> </if>
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
</if> </if>
<if test="record.dataOption != null">
data_option = #{record.dataOption,jdbcType=LONGVARCHAR},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update novice_statistics
set id = #{record.id,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR},
guide_step = #{record.guideStep,jdbcType=TINYINT},
guide_num = #{record.guideNum,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
data_option = #{record.dataOption,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update novice_statistics update novice_statistics
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
user_id = #{record.userId,jdbcType=VARCHAR}, user_id = #{record.userId,jdbcType=VARCHAR},
guide_step = #{record.guideStep,jdbcType=TINYINT}, guide_step = #{record.guideStep,jdbcType=INTEGER},
guide_num = #{record.guideNum,jdbcType=INTEGER}, guide_num = #{record.guideNum,jdbcType=INTEGER},
data_option = #{record.dataOption,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT} update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
@ -247,10 +224,16 @@
user_id = #{userId,jdbcType=VARCHAR}, user_id = #{userId,jdbcType=VARCHAR},
</if> </if>
<if test="guideStep != null"> <if test="guideStep != null">
guide_step = #{guideStep,jdbcType=TINYINT}, guide_step = #{guideStep,jdbcType=INTEGER},
</if> </if>
<if test="record.guideNum != null"> <if test="guideNum != null">
guide_num = #{record.guideNum,jdbcType=INTEGER}, guide_num = #{guideNum,jdbcType=INTEGER},
</if>
<if test="dataOption != null">
data_option = #{dataOption,jdbcType=VARCHAR},
</if>
<if test="status != null">
`status` = #{status,jdbcType=INTEGER},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
@ -258,27 +241,16 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="dataOption != null">
data_option = #{dataOption,jdbcType=LONGVARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.NoviceStatistics">
update novice_statistics
set user_id = #{userId,jdbcType=VARCHAR},
guide_step = #{guideStep,jdbcType=TINYINT},
guide_num = #{record.guideNum,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
data_option = #{dataOption,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.NoviceStatistics"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.NoviceStatistics">
update novice_statistics update novice_statistics
set user_id = #{userId,jdbcType=VARCHAR}, set user_id = #{userId,jdbcType=VARCHAR},
guide_step = #{guideStep,jdbcType=TINYINT}, guide_step = #{guideStep,jdbcType=INTEGER},
guide_num = #{record.guideNum,jdbcType=INTEGER}, guide_num = #{guideNum,jdbcType=INTEGER},
data_option = #{dataOption,jdbcType=VARCHAR},
`status` = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT} update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}

View File

@ -1,15 +1,9 @@
package io.metersphere.novice.controller; package io.metersphere.novice.controller;
import io.metersphere.base.domain.NoviceStatistics; import io.metersphere.base.domain.NoviceStatistics;
import io.metersphere.commons.constants.OperLogConstants; import io.metersphere.novice.request.NoviceRequest;
import io.metersphere.commons.constants.OperLogModule;
import io.metersphere.log.annotation.MsAuditLog;
import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.service.NoticeService;
import io.metersphere.novice.request.StepRequest;
import io.metersphere.novice.service.NoviceService; import io.metersphere.novice.service.NoviceService;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -34,12 +28,16 @@ public class NoviceController {
} }
@PostMapping("/save/step") @PostMapping("/save/step")
public void saveStep(@RequestBody StepRequest stepRequest) { public void saveStep(@RequestBody NoviceRequest noviceRequest) {
noviceService.saveStep(stepRequest); noviceService.saveStep(noviceRequest);
} }
@PostMapping("/save/task") @PostMapping("/save/task")
public void saveTask(@RequestBody NoviceStatistics noviceStatistics) { public void saveTask(@RequestBody NoviceStatistics noviceStatistics) {
noviceService.saveNoviceInfo(noviceStatistics); noviceService.saveNoviceInfo(noviceStatistics);
} }
@PostMapping("/status")
public void updateStatus(@RequestBody NoviceRequest noviceRequest) {
noviceService.updateStatus(noviceRequest);
}
} }

View File

@ -8,9 +8,19 @@ import lombok.Data;
* @version: 1.0 * @version: 1.0
*/ */
@Data @Data
public class StepRequest { public class NoviceRequest {
/** /**
* 新手引导截止步骤 * 新手引导截止步骤
*/ */
private Integer guideStep; private Integer guideStep;
/**
* 新手显示状态
*/
private Integer status;
/**
* 新手任务数据
*/
private String dataOption;
} }

View File

@ -4,7 +4,7 @@ import io.metersphere.base.domain.NoviceStatistics;
import io.metersphere.base.domain.NoviceStatisticsExample; import io.metersphere.base.domain.NoviceStatisticsExample;
import io.metersphere.base.mapper.NoviceStatisticsMapper; import io.metersphere.base.mapper.NoviceStatisticsMapper;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.novice.request.StepRequest; import io.metersphere.novice.request.NoviceRequest;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -26,7 +26,7 @@ public class NoviceService {
public List<NoviceStatistics> getNoviceInfo() { public List<NoviceStatistics> getNoviceInfo() {
NoviceStatisticsExample example = new NoviceStatisticsExample(); NoviceStatisticsExample example = new NoviceStatisticsExample();
example.createCriteria().andUserIdEqualTo(SessionUtils.getUserId()); example.createCriteria().andUserIdEqualTo(SessionUtils.getUserId());
return noviceStatisticsMapper.selectByExampleWithBLOBs(example); return noviceStatisticsMapper.selectByExample(example);
} }
public void saveNoviceInfo(NoviceStatistics noviceStatistics) { public void saveNoviceInfo(NoviceStatistics noviceStatistics) {
@ -41,13 +41,14 @@ public class NoviceService {
}else{ }else{
noviceStatistics.setId(UUID.randomUUID().toString()); noviceStatistics.setId(UUID.randomUUID().toString());
noviceStatistics.setUserId(SessionUtils.getUserId()); noviceStatistics.setUserId(SessionUtils.getUserId());
noviceStatistics.setStatus(1);
noviceStatistics.setCreateTime(systemTime); noviceStatistics.setCreateTime(systemTime);
noviceStatistics.setUpdateTime(systemTime); noviceStatistics.setUpdateTime(systemTime);
noviceStatisticsMapper.insertSelective(noviceStatistics); noviceStatisticsMapper.insertSelective(noviceStatistics);
} }
} }
public void saveStep(StepRequest stepRequest){ public void saveStep(NoviceRequest noviceRequest){
List<NoviceStatistics> noviceInfo = getNoviceInfo(); List<NoviceStatistics> noviceInfo = getNoviceInfo();
long systemTime = System.currentTimeMillis(); long systemTime = System.currentTimeMillis();
if(noviceInfo != null && noviceInfo.size() > 0){ if(noviceInfo != null && noviceInfo.size() > 0){
@ -62,14 +63,41 @@ public class NoviceService {
NoviceStatistics noviceStatistics = new NoviceStatistics(); NoviceStatistics noviceStatistics = new NoviceStatistics();
noviceStatistics.setId(UUID.randomUUID().toString()); noviceStatistics.setId(UUID.randomUUID().toString());
noviceStatistics.setUserId(SessionUtils.getUserId()); noviceStatistics.setUserId(SessionUtils.getUserId());
noviceStatistics.setGuideStep(stepRequest.getGuideStep()); noviceStatistics.setGuideStep(noviceRequest.getGuideStep());
noviceStatistics.setGuideNum(1); noviceStatistics.setGuideNum(1);
noviceStatistics.setStatus(1);
noviceStatistics.setDataOption(noviceRequest.getDataOption());
noviceStatistics.setCreateTime(systemTime); noviceStatistics.setCreateTime(systemTime);
noviceStatistics.setUpdateTime(systemTime); noviceStatistics.setUpdateTime(systemTime);
noviceStatisticsMapper.insertSelective(noviceStatistics); noviceStatisticsMapper.insertSelective(noviceStatistics);
} }
}
public void updateStatus(NoviceRequest noviceRequest){
List<NoviceStatistics> noviceInfo = getNoviceInfo();
long systemTime = System.currentTimeMillis();
if(noviceInfo != null && noviceInfo.size() > 0){
NoviceStatistics noviceStatistics = noviceInfo.get(0);
noviceStatistics.setStatus(noviceRequest.getStatus());
noviceStatistics.setUpdateTime(systemTime);
NoviceStatisticsExample example = new NoviceStatisticsExample();
example.createCriteria().andUserIdEqualTo(SessionUtils.getUserId()).andIdEqualTo(noviceStatistics.getId());
noviceStatisticsMapper.updateByExampleSelective(noviceStatistics, example);
} else {
NoviceStatistics noviceStatistics = new NoviceStatistics();
noviceStatistics.setId(UUID.randomUUID().toString());
noviceStatistics.setUserId(SessionUtils.getUserId());
noviceStatistics.setGuideStep(1);
noviceStatistics.setGuideNum(1);
noviceStatistics.setStatus(1);
noviceStatistics.setDataOption(noviceRequest.getDataOption());
noviceStatistics.setCreateTime(systemTime);
noviceStatistics.setUpdateTime(systemTime);
noviceStatisticsMapper.insertSelective(noviceStatistics);
}
} }
} }

View File

@ -0,0 +1,13 @@
SET SESSION innodb_lock_wait_timeout = 7200;
ALTER TABLE novice_statistics
MODIFY COLUMN data_option varchar(9000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL
COMMENT 'data option (JSON format)' AFTER guide_num;
ALTER TABLE novice_statistics
ADD COLUMN `status` tinyint NOT NULL DEFAULT 1 COMMENT '是否显示0不显示1显示' AFTER data_option;
ALTER TABLE novice_statistics
ADD UNIQUE INDEX `uk_id_user_id`(`id`, `user_id`) USING BTREE;
ALTER TABLE novice_statistics
ADD UNIQUE INDEX `uk_user_id`(`user_id`) USING BTREE
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -1,14 +1,14 @@
SET SESSION innodb_lock_wait_timeout = 7200; SET SESSION innodb_lock_wait_timeout = 7200;
CREATE TABLE IF NOT EXISTS `novice_statistics` ( CREATE TABLE IF NOT EXISTS novice_statistics (
`id` varchar(50) NOT NULL COMMENT 'ID', id varchar(50) NOT NULL COMMENT 'ID',
`user_id` varchar(64) NOT NULL COMMENT '用户id', user_id varchar(64) NOT NULL COMMENT '用户id',
`guide_step` tinyint NOT NULL DEFAULT '0' COMMENT '新手引导完成的步骤', guide_step tinyint NOT NULL DEFAULT '0' COMMENT '新手引导完成的步骤',
`guide_num` int(10) NOT NULL DEFAULT '1' COMMENT '新手引导的次数', guide_num int(10) NOT NULL DEFAULT '1' COMMENT '新手引导的次数',
`data_option` longtext DEFAULT NULL COMMENT 'data option (JSON format)', data_option longtext DEFAULT NULL COMMENT 'data option (JSON format)',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp', create_time bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp', update_time bigint(13) NOT NULL COMMENT 'Update timestamp',
PRIMARY KEY (`id`) USING BTREE PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB ) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci; COLLATE = utf8mb4_general_ci;