|
|
@ -23,13 +23,14 @@ import org.jeecg.modules.modulex.entity.Modulex; |
|
|
|
import org.jeecg.modules.modulex.service.IModulexService; |
|
|
|
import org.jeecg.modules.modulex.service.IModulexService; |
|
|
|
import org.jeecg.modules.projectUserRole.entity.ProjectUserRole; |
|
|
|
import org.jeecg.modules.projectUserRole.entity.ProjectUserRole; |
|
|
|
import org.jeecg.modules.projectUserRole.service.IProjectUserRoleService; |
|
|
|
import org.jeecg.modules.projectUserRole.service.IProjectUserRoleService; |
|
|
|
|
|
|
|
import org.jeecg.modules.projectx.entity.Projectx; |
|
|
|
|
|
|
|
import org.jeecg.modules.projectx.service.IProjectxService; |
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
import org.jeecg.modules.system.entity.SysUser; |
|
|
|
import org.jeecg.modules.system.service.ISysUserService; |
|
|
|
import org.jeecg.modules.system.service.ISysUserService; |
|
|
|
import org.jeecg.modules.tablex.vo.TablexVo; |
|
|
|
|
|
|
|
import org.jeecg.modules.tablex.ws.WebSocketUtils; |
|
|
|
import org.jeecg.modules.tablex.ws.WebSocketUtils; |
|
|
|
import org.jeecgframework.poi.excel.entity.ImportParams; |
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
@ -49,8 +50,11 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
private ISysUserService sysUserService; |
|
|
|
private ISysUserService sysUserService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private WebSocketUtils webSocketUtils; |
|
|
|
private WebSocketUtils webSocketUtils; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IProjectxService projectxService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@Transactional |
|
|
|
public Result<?> importExcel(MultipartFile file) { |
|
|
|
public Result<?> importExcel(MultipartFile file) { |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前操作用户
|
|
|
|
// 获取当前操作用户
|
|
|
@ -137,46 +141,51 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
} |
|
|
|
} |
|
|
|
//------------接收-------------
|
|
|
|
//------------接收-------------
|
|
|
|
FunctionxTest fun = new FunctionxTest(); |
|
|
|
FunctionxTest fun = new FunctionxTest(); |
|
|
|
fun.setPModuleName(list.get(0)); |
|
|
|
fun.setProject(list.get(0)); // 对应项目
|
|
|
|
fun.setModuleName(list.get(1)); // 对应模块
|
|
|
|
fun.setModuleName(list.get(1)); // 对应模块
|
|
|
|
fun.setFunctionName(list.get(2)); // 中文名称
|
|
|
|
fun.setFunctionName(list.get(2)); // 中文名称
|
|
|
|
fun.setFunctionEnName(list.get(3)); // 英文名称
|
|
|
|
fun.setFunctionEnName(list.get(3)); // 英文名称
|
|
|
|
fun.setFunctionCode(list.get(4)); // 功能编码
|
|
|
|
// fun.setFunctionCode(list.get(4)); // 功能编码
|
|
|
|
fun.setFunctionType(list.get(5)); // 功能类型
|
|
|
|
fun.setFunctionType(list.get(4)); // 功能类型
|
|
|
|
fun.setPmDescribe(list.get(6)); // 功能描述
|
|
|
|
fun.setPmDescribe(list.get(5)); // 功能描述
|
|
|
|
fun.setUserRole(list.get(7)); // 用户角色
|
|
|
|
fun.setUserRole(list.get(6)); // 用户角色
|
|
|
|
fun.setManagerUsers(list.get(8)); // 责任人
|
|
|
|
fun.setManagerUsers(list.get(7)); // 责任人
|
|
|
|
fun.setWorkLevel(list.get(9)); // 任务等级
|
|
|
|
fun.setWorkLevel(list.get(8)); // 任务等级
|
|
|
|
fun.setWorkStatus(list.get(10)); // 任务状态
|
|
|
|
fun.setWorkStatus(list.get(9)); // 任务状态
|
|
|
|
fun.setPublishTime(list.get(11)); // 发布时间
|
|
|
|
fun.setPublishTime(list.get(10)); // 发布时间
|
|
|
|
fun.setStartTime(list.get(12)); // 开始时间
|
|
|
|
fun.setStartTime(list.get(11)); // 开始时间
|
|
|
|
fun.setDuration(list.get(13)); // 任务时长
|
|
|
|
fun.setDuration(list.get(12)); // 任务时长
|
|
|
|
fun.setSubmitTime(list.get(14)); // 提交时间
|
|
|
|
fun.setSubmitTime(list.get(13)); // 提交时间
|
|
|
|
fun.setRealDuration(list.get(15)); // 实际时长
|
|
|
|
fun.setRealDuration(list.get(14)); // 实际时长
|
|
|
|
fun.setStatus(list.get(16)); // 功能状态
|
|
|
|
fun.setStatus(list.get(15)); // 功能状态
|
|
|
|
fun.setVerisonStatus(list.get(17)); // 版本状态
|
|
|
|
fun.setVerisonStatus(list.get(16)); // 版本状态
|
|
|
|
fun.setVerison(list.get(18)); // 版本号
|
|
|
|
fun.setVerison(list.get(17)); // 版本号
|
|
|
|
fun.setCreatName(username); |
|
|
|
fun.setCreatName(username); |
|
|
|
|
|
|
|
|
|
|
|
listVo.add(fun); |
|
|
|
listVo.add(fun); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
boolean isSuccessSave = this.saveBatch(listVo); |
|
|
|
|
|
|
|
if (!isSuccessSave) { |
|
|
|
LambdaQueryWrapper<FunctionxTest> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
message.put("isError", "true"); |
|
|
|
queryWrapper.eq(username != null, FunctionxTest::getCreatName, username); |
|
|
|
message.put("status", "文件读入失败"); |
|
|
|
|
|
|
|
message.put("closeable", "true"); |
|
|
|
int isSaveTestSuccess = saveTest(listVo); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
List<FunctionxTest> list = this.list(queryWrapper); |
|
|
|
return Result.error("文件读入失败"); |
|
|
|
// if (isSaveTestSuccess != -1){
|
|
|
|
} |
|
|
|
// this.remove(queryWrapper);
|
|
|
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
|
|
|
// message.put("status", "第" + (isSaveTestSuccess+1) + "行中文名或英文名有重复");
|
|
|
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
|
|
|
// return Result.error("中文名或英文名有重复");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.put("status", "数据校验"); |
|
|
|
message.put("status", "数据校验"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
|
|
//************************具体字段校验******************************
|
|
|
|
//************************具体字段校验******************************
|
|
|
|
LambdaQueryWrapper<FunctionxTest> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapper.eq(username != null, FunctionxTest::getCreatName, username); |
|
|
|
|
|
|
|
List<FunctionxTest> list = this.list(queryWrapper); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean remove = this.remove(queryWrapper); |
|
|
|
boolean remove = this.remove(queryWrapper); |
|
|
|
if (!remove) { |
|
|
|
if (!remove) { |
|
|
@ -193,11 +202,11 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
FunctionxTest function = list.get(i); |
|
|
|
FunctionxTest function = list.get(i); |
|
|
|
Functionx functionx = new Functionx(); |
|
|
|
Functionx functionx = new Functionx(); |
|
|
|
String pModuleId = function.getPModuleName(); |
|
|
|
String project = function.getProject(); |
|
|
|
String moduleId = function.getModuleName(); |
|
|
|
String moduleId = function.getModuleName(); |
|
|
|
String functionName = function.getFunctionName(); |
|
|
|
String functionName = function.getFunctionName(); |
|
|
|
String functionEnName = function.getFunctionEnName(); |
|
|
|
String functionEnName = function.getFunctionEnName(); |
|
|
|
String functionCode = function.getFunctionCode(); |
|
|
|
// String functionCode = function.getFunctionCode();
|
|
|
|
String functionType = function.getFunctionType(); |
|
|
|
String functionType = function.getFunctionType(); |
|
|
|
String pmDescribe = function.getPmDescribe(); |
|
|
|
String pmDescribe = function.getPmDescribe(); |
|
|
|
String userRole = function.getUserRole(); |
|
|
|
String userRole = function.getUserRole(); |
|
|
@ -214,41 +223,46 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
String verison = function.getVerison(); |
|
|
|
String verison = function.getVerison(); |
|
|
|
|
|
|
|
|
|
|
|
String moduleName = ""; // 模块编码
|
|
|
|
String moduleName = ""; // 模块编码
|
|
|
|
|
|
|
|
String moduleCode= ""; // 模块编码
|
|
|
|
functionx.setCreateBy(username); // 创建人
|
|
|
|
functionx.setCreateBy(username); // 创建人
|
|
|
|
functionx.setCreateTime(new Date()); //创建日期
|
|
|
|
functionx.setCreateTime(new Date()); //创建日期
|
|
|
|
if (StringUtils.isBlank(moduleId)) { |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(project)) { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status", "第" + i + "行数据对应模块不能为空"); |
|
|
|
message.put("status", "第" + (i+1) + "行数据项目名称不能为空"); |
|
|
|
message.put("closeable", "true"); |
|
|
|
message.put("closeable", "true"); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
return Result.error("对应模块不能为空"); |
|
|
|
return Result.error("项目名称不能为空"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (pModuleId != null && pModuleId.length()>0) { |
|
|
|
LambdaQueryWrapper<Projectx> projectxQueryWrapper =new LambdaQueryWrapper<>(); |
|
|
|
String pid = ""; |
|
|
|
projectxQueryWrapper.eq(Projectx::getProjectName,project); |
|
|
|
for (Modulex modulex : modulexList) { |
|
|
|
List<Projectx> list1 = projectxService.list(projectxQueryWrapper); |
|
|
|
if (modulex.getModuleName().equals(pModuleId)) { |
|
|
|
if (list1.size()==0){ |
|
|
|
pid = modulex.getId(); |
|
|
|
message.put("isError", "true"); |
|
|
|
break; |
|
|
|
message.put("status", "第" + i + "行数据项目名称错误"); |
|
|
|
} |
|
|
|
message.put("closeable", "true"); |
|
|
|
} |
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
for (Modulex modulex : modulexList) { |
|
|
|
return Result.error("项目名称错误"); |
|
|
|
if (modulex.getModuleName().equals(moduleId) && modulex.getPid().equals(pid)) { |
|
|
|
|
|
|
|
functionx.setModuleId(modulex.getId()); |
|
|
|
|
|
|
|
moduleId = modulex.getId(); |
|
|
|
|
|
|
|
moduleName = modulex.getModuleName(); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
project = list1.get(0).getId(); // 此时project为项目id
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(moduleId)) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("status", "第" + i + "行数据对应模块不能为空"); |
|
|
|
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("对应模块不能为空"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
for (Modulex modulex : modulexList) { |
|
|
|
for (Modulex modulex : modulexList) { |
|
|
|
if (modulex.getModuleName().equals(moduleId) && modulex.getPid() == null) { |
|
|
|
if (modulex.getModuleName().equals(moduleId) && modulex.getProjectId().equals(project)) { |
|
|
|
functionx.setModuleId(modulex.getId()); |
|
|
|
functionx.setModuleId(modulex.getId()); |
|
|
|
moduleId = modulex.getId(); |
|
|
|
moduleId = modulex.getId(); |
|
|
|
moduleName = modulex.getModuleName(); |
|
|
|
moduleName = modulex.getModuleName(); |
|
|
|
|
|
|
|
moduleCode = modulex.getModuleCode(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (functionx.getModuleId() == null) { |
|
|
|
if (functionx.getModuleId() == null) { |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("isError", "true"); |
|
|
|
message.put("status", "第" + (i+1) + "行数据数据对应模块有错误"); |
|
|
|
message.put("status", "第" + (i+1) + "行数据数据对应模块有错误"); |
|
|
@ -342,30 +356,32 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
} |
|
|
|
} |
|
|
|
functionx.setFunctionType(type); |
|
|
|
functionx.setFunctionType(type); |
|
|
|
} |
|
|
|
} |
|
|
|
// 模块编码+功能缩写;自动填充+手动修改
|
|
|
|
// 模块编码+功能缩写;自动填充+手动修改 // 改为自动生成
|
|
|
|
if (StringUtils.isBlank(functionCode)) { |
|
|
|
String firstChar = toFirstChar(functionName); |
|
|
|
message.put("isError", "true"); |
|
|
|
String functionCode = moduleCode + firstChar; |
|
|
|
message.put("status", "第" + (i+1) + "行数据数据功能编码不能为空"); |
|
|
|
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("功能编码不能为空"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
LambdaQueryWrapper<Modulex> queryWrapperModulex = new LambdaQueryWrapper<>(); |
|
|
|
|
|
|
|
queryWrapperModulex.eq(Modulex::getModuleName, moduleName); |
|
|
|
|
|
|
|
Modulex modulex = modulexService.getOne(queryWrapperModulex); |
|
|
|
|
|
|
|
String moduleCode = modulex.getModuleCode(); |
|
|
|
|
|
|
|
String firstChar = toFirstChar(functionType); |
|
|
|
|
|
|
|
String str = moduleCode + firstChar; |
|
|
|
|
|
|
|
if (!str.equals(functionCode)) { |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("status", "第" + (i+1) + "行数据数据功能编码错误"); |
|
|
|
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("功能编码错误"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
functionx.setFunctionCode(functionCode); |
|
|
|
functionx.setFunctionCode(functionCode); |
|
|
|
} |
|
|
|
// if (StringUtils.isBlank(functionCode)) {
|
|
|
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
|
|
|
// message.put("status", "第" + (i+1) + "行数据数据功能编码不能为空");
|
|
|
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
|
|
|
// return Result.error("功能编码不能为空");
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
// LambdaQueryWrapper<Modulex> queryWrapperModulex = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
// queryWrapperModulex.eq(Modulex::getModuleName, moduleName);
|
|
|
|
|
|
|
|
// Modulex modulex = modulexService.getOne(queryWrapperModulex);
|
|
|
|
|
|
|
|
// String moduleCode = modulex.getModuleCode();
|
|
|
|
|
|
|
|
// String firstChar = toFirstChar(functionName);
|
|
|
|
|
|
|
|
// String str = moduleCode + firstChar;
|
|
|
|
|
|
|
|
// if (!str.equals(functionCode)) {
|
|
|
|
|
|
|
|
// message.put("isError", "true");
|
|
|
|
|
|
|
|
// message.put("status", "第" + (i+1) + "行数据数据功能编码错误");
|
|
|
|
|
|
|
|
// message.put("closeable", "true");
|
|
|
|
|
|
|
|
// webSocketUtils.sendMessage(loginUser.getId(), message);
|
|
|
|
|
|
|
|
// return Result.error("功能编码错误");
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// functionx.setFunctionCode(functionCode);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(pmDescribe)) { // 功能描述
|
|
|
|
if (StringUtils.isNotBlank(pmDescribe)) { // 功能描述
|
|
|
|
functionx.setPmDescribe(pmDescribe); |
|
|
|
functionx.setPmDescribe(pmDescribe); |
|
|
@ -514,6 +530,13 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(duration)) { |
|
|
|
if (StringUtils.isNotBlank(duration)) { |
|
|
|
Double aDouble = Double.valueOf(duration); |
|
|
|
Double aDouble = Double.valueOf(duration); |
|
|
|
|
|
|
|
if (aDouble <= 0){ |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("status", "第" + (i+1) + "行数据任务时长错误"); |
|
|
|
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("任务时长错误"); |
|
|
|
|
|
|
|
} |
|
|
|
functionx.setDuration(aDouble); |
|
|
|
functionx.setDuration(aDouble); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -609,6 +632,13 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
return Result.error("版本号不能为空"); |
|
|
|
return Result.error("版本号不能为空"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Integer integer = Integer.valueOf(verison); |
|
|
|
Integer integer = Integer.valueOf(verison); |
|
|
|
|
|
|
|
if (integer<1){ |
|
|
|
|
|
|
|
message.put("isError", "true"); |
|
|
|
|
|
|
|
message.put("status", "第" + (i+1) + "行数据数据版本号不能小于1"); |
|
|
|
|
|
|
|
message.put("closeable", "true"); |
|
|
|
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
return Result.error("版本号不能小于1"); |
|
|
|
|
|
|
|
} |
|
|
|
functionx.setStatus(integer); |
|
|
|
functionx.setStatus(integer); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -639,6 +669,18 @@ public class FunctionXTestServiceImpl extends ServiceImpl<FunctionxTestMapper, F |
|
|
|
return Result.OK("导入成功"); |
|
|
|
return Result.OK("导入成功"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int saveTest(List<FunctionxTest> listVo) { |
|
|
|
|
|
|
|
for (int i = 0; i < listVo.size(); i++) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
this.save(listVo.get(i)); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return i; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return -1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private boolean funCheck(List<String> list) { |
|
|
|
private boolean funCheck(List<String> list) { |
|
|
|
for (int i=0;i<list.size();i++){ |
|
|
|
for (int i=0;i<list.size();i++){ |
|
|
|
if(list.get(i)!=null && list.get(i).length()>0){ |
|
|
|
if(list.get(i)!=null && list.get(i).length()>0){ |
|
|
|