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 String dataOption;
private Integer status;
private Long createTime;
private Long updateTime;
private String dataOption;
private static final long serialVersionUID = 1L;
}

View File

@ -364,6 +364,136 @@ public class NoviceStatisticsExample {
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() {
addCriterion("create_time is null");
return (Criteria) this;

View File

@ -7,7 +7,11 @@ export function getSideTask() {
}
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) {

View File

@ -10,7 +10,7 @@
<el-dropdown-item command="novice">{{ $t('commons.novice_journey') }}</el-dropdown-item>
</el-dropdown-menu>
</template>
<ms-introduction ref="introduction" @skipOpen="skipOpen"/>
<ms-introduction ref="introduction" @skipOpen="skipOpen" />
<ms-side-menus ref="sideMenu"/>
</el-dropdown>
</template>
@ -50,7 +50,7 @@ export default {
}
break;
case "novice":
this.$refs.sideMenu.toggle();
this.$refs.sideMenu.toggle(2);
break;
default:
break;
@ -60,6 +60,7 @@ export default {
getSideTask().then(res=> {
if (res.data.length > 0 && res.data[0].guideStep) {
localStorage.setItem('step', res.data[0].guideStep)
localStorage.setItem("noviceStatus", res.data[0].status)
} else {
localStorage.setItem('guide','0')
}

View File

@ -115,15 +115,19 @@ export default {
},
gotoTurn(){
this.closeDialog()
let redirectUrl = sessionStorage.getItem("redirectUrl")
if(redirectUrl.includes("track")){
this.$emit("skipOpen", "/track/case/all")
this.$router.push("/track/case/all")
if(localStorage.getItem("noviceStatus") && localStorage.getItem("noviceStatus") === "1"){
let redirectUrl = sessionStorage.getItem("redirectUrl")
if(redirectUrl.includes("track")){
this.$emit("skipOpen", "/track/case/all")
this.$router.push("/track/case/all")
}else{
this.$router.push({
path: '/track/case/all',
query: { status: true },
})
}
}else{
this.$router.push({
path: '/track/case/all',
query: { status: true },
})
this.$router.push("/track/case/all")
}
}
}
@ -141,12 +145,13 @@ export default {
padding: 1px 5px 0 5px;
}
::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 {
margin-top: 10vh !important;
border-radius: 8px;
padding-bottom: 1px !important;
background-image: linear-gradient(to bottom, #783887 65%, #FFF 0);
}

View File

@ -1,21 +1,22 @@
<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 :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;" />
<span :style="openBox ? 'display: block;color: #fff;cursor: pointer;' : ''">{{$t('side_task.novice_task')}}</span>
</div>
</div>
</div>
<ms-site-task ref="siteTask" :taskData="taskData" @closeBox="closeBox"/>
<ms-site-task ref="siteTask" :taskData="taskData" @closeBox="closeBox" @closeNovice="closeNovice"/>
</div>
</template>
<script>
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 {hasLicense, hasPermissions} from "../../utils/permission";
@ -27,22 +28,31 @@ export default {
data() {
return {
taskStatus: false,
noviceStatus: false,
openBox:false,
totalTask: 0,
taskData:[]
taskData:[],
language: localStorage.getItem('language'),
};
},
created() {
this.initTaskData()
mounted() {
this.initTaskData(1)
},
methods: {
initTaskData(){
initTaskData(status){
getSideTask().then(res=>{
if(res.data.length > 0 && res.data[0].dataOption){
this.taskData = JSON.parse(res.data[0].dataOption)
this.noviceStatus = res.data[0].status === 1
}else{
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 num = 0
let total = 0
@ -67,16 +77,19 @@ export default {
this.totalTask = num
})
},
toggle(){
toggle(status){
this.initTaskData(status)
this.openBox = true
this.initTaskData()
this.$refs.siteTask.open();
},
closeBox(status){
this.openBox = status
},
closeNovice(status){
this.noviceStatus = status
},
skipOpen(path){
this.initTaskData()
this.initTaskData(1)
this.$refs.siteTask.skipOpen(path);
}
}
@ -114,15 +127,30 @@ export default {
.parentBox .contentsBox div span:last-child {
margin-left: 10px;
}
.parentBox-en .contentsBox div span:last-child {
margin-left: 5px;
}
.parentBox .contentsBox div:nth-child(1) {
bottom: 125px;
}
.parentBox .contentsBox div:hover {
right: 0;
height: 28px;
width: 120px;
width: 100px;
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 {
display: block;

View File

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

View File

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

View File

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

View File

@ -16,21 +16,15 @@ public interface NoviceStatisticsMapper {
int insertSelective(NoviceStatistics record);
List<NoviceStatistics> selectByExampleWithBLOBs(NoviceStatisticsExample example);
List<NoviceStatistics> selectByExample(NoviceStatisticsExample example);
NoviceStatistics selectByPrimaryKey(String id);
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 updateByPrimaryKeySelective(NoviceStatistics record);
int updateByPrimaryKeyWithBLOBs(NoviceStatistics record);
int updateByPrimaryKey(NoviceStatistics record);
}

View File

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

View File

@ -1,15 +1,9 @@
package io.metersphere.novice.controller;
import io.metersphere.base.domain.NoviceStatistics;
import io.metersphere.commons.constants.OperLogConstants;
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.request.NoviceRequest;
import io.metersphere.novice.service.NoviceService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -34,12 +28,16 @@ public class NoviceController {
}
@PostMapping("/save/step")
public void saveStep(@RequestBody StepRequest stepRequest) {
noviceService.saveStep(stepRequest);
public void saveStep(@RequestBody NoviceRequest noviceRequest) {
noviceService.saveStep(noviceRequest);
}
@PostMapping("/save/task")
public void saveTask(@RequestBody NoviceStatistics 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
*/
@Data
public class StepRequest {
public class NoviceRequest {
/**
* 新手引导截止步骤
*/
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.mapper.NoviceStatisticsMapper;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.novice.request.StepRequest;
import io.metersphere.novice.request.NoviceRequest;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -26,7 +26,7 @@ public class NoviceService {
public List<NoviceStatistics> getNoviceInfo() {
NoviceStatisticsExample example = new NoviceStatisticsExample();
example.createCriteria().andUserIdEqualTo(SessionUtils.getUserId());
return noviceStatisticsMapper.selectByExampleWithBLOBs(example);
return noviceStatisticsMapper.selectByExample(example);
}
public void saveNoviceInfo(NoviceStatistics noviceStatistics) {
@ -41,13 +41,14 @@ public class NoviceService {
}else{
noviceStatistics.setId(UUID.randomUUID().toString());
noviceStatistics.setUserId(SessionUtils.getUserId());
noviceStatistics.setStatus(1);
noviceStatistics.setCreateTime(systemTime);
noviceStatistics.setUpdateTime(systemTime);
noviceStatisticsMapper.insertSelective(noviceStatistics);
}
}
public void saveStep(StepRequest stepRequest){
public void saveStep(NoviceRequest noviceRequest){
List<NoviceStatistics> noviceInfo = getNoviceInfo();
long systemTime = System.currentTimeMillis();
if(noviceInfo != null && noviceInfo.size() > 0){
@ -58,18 +59,45 @@ public class NoviceService {
example.createCriteria().andUserIdEqualTo(SessionUtils.getUserId()).andIdEqualTo(noviceStatistics.getId());
noviceStatisticsMapper.updateByExampleSelective(noviceStatistics, example);
} else{
} else {
NoviceStatistics noviceStatistics = new NoviceStatistics();
noviceStatistics.setId(UUID.randomUUID().toString());
noviceStatistics.setUserId(SessionUtils.getUserId());
noviceStatistics.setGuideStep(stepRequest.getGuideStep());
noviceStatistics.setGuideStep(noviceRequest.getGuideStep());
noviceStatistics.setGuideNum(1);
noviceStatistics.setStatus(1);
noviceStatistics.setDataOption(noviceRequest.getDataOption());
noviceStatistics.setCreateTime(systemTime);
noviceStatistics.setUpdateTime(systemTime);
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;
CREATE TABLE IF NOT EXISTS `novice_statistics` (
`id` varchar(50) NOT NULL COMMENT 'ID',
`user_id` varchar(64) NOT NULL COMMENT '用户id',
`guide_step` tinyint NOT NULL DEFAULT '0' COMMENT '新手引导完成的步骤',
`guide_num` int(10) NOT NULL DEFAULT '1' COMMENT '新手引导的次数',
`data_option` longtext DEFAULT NULL COMMENT 'data option (JSON format)',
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
PRIMARY KEY (`id`) USING BTREE
CREATE TABLE IF NOT EXISTS novice_statistics (
id varchar(50) NOT NULL COMMENT 'ID',
user_id varchar(64) NOT NULL COMMENT '用户id',
guide_step tinyint NOT NULL DEFAULT '0' COMMENT '新手引导完成的步骤',
guide_num int(10) NOT NULL DEFAULT '1' COMMENT '新手引导的次数',
data_option longtext DEFAULT NULL COMMENT 'data option (JSON format)',
create_time bigint(13) NOT NULL COMMENT 'Create timestamp',
update_time bigint(13) NOT NULL COMMENT 'Update timestamp',
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci;