Commit 92d1f3d7 authored by yuanshuo's avatar yuanshuo

1.版本号问题=>当评审通过之后会获取当前评审所关联的standard进行最新版本号的更新

parent e8d0e9f4
package com.ruoyi.common;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class VersionUtils {
/*
* 获取当前日期,格式化为yyyyMM
* @return 当前日期的字符串表示,格式为yyyyMM
* */
public static String getCurrentDate() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
return sdf.format(new Date());
}
/*
* 生成最新版本号
* @param currentVersion 当前最新版本号,例如“20240913-1”
* @return 增加后的最新版本号
* */
public static String incrementVersion(String currentVersion){
//将版本号按照“-” 拆分成日期和版本号部分
String[] parts = currentVersion.split("-");
if (parts.length!=2){
throw new ServiceException("当前版本格式有问题", HttpStatus.ERROR);
}
//获取当前日期部分(yyyyMM)
String currentDate = getCurrentDate();
//获取日期部分
String versionDate = parts[0];//版本号中的日期部分
//获取版本号部分,并将其转为整数后+1
int versionNumber = Integer.parseInt(parts[1]);
//如果当前月份与版本号中的日期一致,则递增版本号
if (currentDate.equals(versionDate)){
versionNumber++;
return currentDate + "-" + versionNumber;
} else {
//如果当前月份不同,则重新开始版本号,从 1 开始
return currentDate + "-" + versionNumber;
}
}
/*
* 初始化版本号,格式为yyyyMM-1
* @return 新的初始版本号
* */
public static String initializeVersion() {
return getCurrentDate() + "-1";
}
}
...@@ -69,4 +69,9 @@ public class Standard { ...@@ -69,4 +69,9 @@ public class Standard {
@ApiModelProperty("要点名称") @ApiModelProperty("要点名称")
private String keypointName; private String keypointName;
@ApiModelProperty("原始版本")
private String originalVersion;
@ApiModelProperty("最新版本")
private String currentVersion;
} }
...@@ -182,4 +182,6 @@ public class SystemReviewTask { ...@@ -182,4 +182,6 @@ public class SystemReviewTask {
@ApiModelProperty("企业名称") @ApiModelProperty("企业名称")
private String enterpriseName; private String enterpriseName;
} }
...@@ -69,7 +69,9 @@ public interface ReviewSceneChangeTaskMapper extends BaseMapper<ReviewSceneChang ...@@ -69,7 +69,9 @@ public interface ReviewSceneChangeTaskMapper extends BaseMapper<ReviewSceneChang
/* /*
* 查看评审人员评审意见 * 查看评审人员评审意见
* */ * */
List<ReviewOpinionResponse> getReviewerOpinion(@Param("id") Long id); List<ReviewOpinionResponse> getReviewerOpinion(@Param("id") Long id,@Param("userId") Long userId);
Long getinspectStandardIdByTaskId(@Param("taskId") Long taskId);
} }
......
...@@ -38,4 +38,6 @@ public interface StandardMapper extends BaseMapper<Standard> { ...@@ -38,4 +38,6 @@ public interface StandardMapper extends BaseMapper<Standard> {
List<String> getTypeList(@Param("getChapterListRequest") GetChapterListRequest getChapterListRequest); List<String> getTypeList(@Param("getChapterListRequest") GetChapterListRequest getChapterListRequest);
List<ReviewStandardChapterListResponse> getChapterList(@Param("type") String type); List<ReviewStandardChapterListResponse> getChapterList(@Param("type") String type);
Standard findStandardById(@Param("inspectStandardId") Long inspectStandardId);
} }
...@@ -3,14 +3,18 @@ package com.ruoyi.service.impl; ...@@ -3,14 +3,18 @@ package com.ruoyi.service.impl;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.toolkit.Db; import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.ruoyi.common.VersionUtils;
import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.domain.ReviewSceneChangeTask; import com.ruoyi.domain.ReviewSceneChangeTask;
import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation; import com.ruoyi.domain.ReviewSceneChangeTaskUserRelation;
import com.ruoyi.domain.Standard;
import com.ruoyi.framework.web.domain.server.Sys; import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.mapper.ReviewKeyPointMapper; import com.ruoyi.mapper.ReviewKeyPointMapper;
import com.ruoyi.mapper.StandardMapper;
import com.ruoyi.service.*; import com.ruoyi.service.*;
import com.ruoyi.mapper.ReviewSceneChangeTaskMapper; import com.ruoyi.mapper.ReviewSceneChangeTaskMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.mapper.SysUserRoleMapper;
...@@ -63,6 +67,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -63,6 +67,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
@Autowired @Autowired
private TestUseCaseService testUseCaseService; private TestUseCaseService testUseCaseService;
@Autowired
private StandardMapper standardMapper;
@Override @Override
public void create(ReviewSceneChangeTask reviewSceneChangeTask) throws IOException { public void create(ReviewSceneChangeTask reviewSceneChangeTask) throws IOException {
...@@ -222,7 +229,20 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -222,7 +229,20 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
// 更新审核标准 // 更新审核标准
reviewSceneService.change(task); reviewSceneService.change(task);
// TODO 评审通过修改标准版本号,每月第一天次数从1开始 // TODO 评审通过修改标准版本号,每月第一天次数从1开始
//如果评审通过那么 通过当前评审任务的id获取的InspectStandardId
Long inspectStandardId = reviewSceneChangeTaskMapper.getinspectStandardIdByTaskId(taskId);
//用inspectStandardId去标准表里寻找到关联的标准信息
Standard standard = standardMapper.findStandardById(inspectStandardId);
//获取关联标准之后修改当前标准的最新版本号
if (standard != null){
//获取关联标准之后修改当前标准的最新版本号
String currentVersion = standard.getCurrentVersion();
String newVersion = VersionUtils.incrementVersion(currentVersion);
//更新标准的版本号
standard.setCurrentVersion(newVersion);
standardMapper.updateById(standard);
}
//场景变更时发送信息 //场景变更时发送信息
if (Objects.equals(task.getOperationSort(), "ADD_SCENE") || Objects.equals(task.getOperationSort(), "DELETE_SCENE")) { if (Objects.equals(task.getOperationSort(), "ADD_SCENE") || Objects.equals(task.getOperationSort(), "DELETE_SCENE")) {
// 通知受影响的问卷 // 通知受影响的问卷
...@@ -580,7 +600,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha ...@@ -580,7 +600,9 @@ public class ReviewSceneChangeTaskServiceImpl extends ServiceImpl<ReviewSceneCha
* */ * */
@Override @Override
public List<ReviewOpinionResponse> getReviewerOpinion(Long id) { public List<ReviewOpinionResponse> getReviewerOpinion(Long id) {
List<ReviewOpinionResponse> list = reviewSceneChangeTaskMapper.getReviewerOpinion(id); LoginUser loginUser = SecurityUtils.getLoginUser();
Long userId = loginUser.getUserId();
List<ReviewOpinionResponse> list = reviewSceneChangeTaskMapper.getReviewerOpinion(id,userId);
return list; return list;
} }
......
...@@ -168,7 +168,12 @@ ...@@ -168,7 +168,12 @@
<select id="getReviewerOpinion" resultType="com.ruoyi.web.response.ReviewOpinionResponse"> <select id="getReviewerOpinion" resultType="com.ruoyi.web.response.ReviewOpinionResponse">
select name,comment,decision,decision_time select name,comment,decision,decision_time
from t_review_scene_change_task_user_relation from t_review_scene_change_task_user_relation
where task_id = #{id} where task_id = #{id} and user_id != #{userId}
</select>
<select id="getinspectStandardIdByTaskId" resultType="java.lang.Long">
select inspect_standard_id
from t_review_scene_change_task
where id = #{taskId}
</select> </select>
</mapper> </mapper>
...@@ -77,4 +77,9 @@ ...@@ -77,4 +77,9 @@
from t_review_standard from t_review_standard
where type = #{type} where type = #{type}
</select> </select>
<select id="findStandardById" resultType="com.ruoyi.domain.Standard">
select *
from t_standard
where id = #{inspectStandardId}
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment