模块管理导入功能交互

dev^2
lijinyu 1 year ago
parent 757a9971c0
commit d453ec37c5
  1. 80
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  2. 28
      ant-design-vue-jeecg/src/views/modulex/modules/ModulexImport.vue
  3. 6
      ant-design-vue-jeecg/src/views/task/modules/TaskForm.vue
  4. 64
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java
  5. 109
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
  6. 4
      jeecg-boot/jeecg-boot-module-system/src/main/resources/application-dev.yml

@ -71,29 +71,29 @@
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<!-- <a-button type="primary" @click="showModal1()"></a-button> -->
<a-button type="primary" icon="import" @click="showModalImport()">导入模块</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"
@change="handleImportExcel">
<a-modal
title="正在上传..."
:visible="ModalData.isVisible==='true'"
:confirm-loading="false"
:mask="true"
:maskClosable="false"
:keyboard="false"
:closable="false"
:footer="false"
>
<p>当前状态{{ ModalData.status }}</p>
<p>总记录数{{ ModalData.records }}</p>
<p>已上传{{ ModalData.uploaded }}</p>
<a-progress
:percent="parseInt(String(ModalData.uploaded/ModalData.records*100))"
title="上传进度:"
status="active" :steps="ModalData.records"/>
</a-modal>
<a-button type="primary" icon="import" @click="showProcess">导入模块</a-button>
</a-upload>
<!-- <a-button type="primary" icon="import" @click="showModalImport()">导入模块</a-button>-->
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl"-->
<!-- @change="handleImportExcel">-->
<!-- <a-modal-->
<!-- title="正在上传..."-->
<!-- :visible="ModalData.isVisible==='true'"-->
<!-- :confirm-loading="false"-->
<!-- :mask="true"-->
<!-- :maskClosable="false"-->
<!-- :keyboard="false"-->
<!-- :closable="false"-->
<!-- :footer="false"-->
<!-- >-->
<!-- <p>当前状态{{ ModalData.status }}</p>-->
<!-- <p>总记录数{{ ModalData.records }}</p>-->
<!-- <p>已上传{{ ModalData.uploaded }}</p>-->
<!-- <a-progress-->
<!-- :percent="parseInt(String(ModalData.uploaded/ModalData.records*100))"-->
<!-- title="上传进度:"-->
<!-- status="active" :steps="ModalData.records"/>-->
<!-- </a-modal>-->
<a-button type="primary" icon="import" @click="showProcess(modelData)">导入模块</a-button>
<!-- </a-upload>-->
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
:action="functionImportExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入功能</a-button>
@ -443,7 +443,8 @@ export default {
deleteBatch: "/modulex/modulex/deleteBatch",
exportXlsUrl: "/modulex/modulex/exportXls",
importExcelUrlf: "fieldx/fieldx/importExcel",
importExcelUrl: "modulex/modulex/importExcel",
modelImportExcelUrl: "modulex/modulex/importExcel",
modelDownExcelUrl: "modulex/modulex/templateExcel",
functionImportExcelUrl: "/functionx/functionx/importExcel",
tablexImportExcelUrl: "tablex/tablex/importExcel",
tablexDownExcelUrl: "tablex/tablex/templateExcel",
@ -469,8 +470,11 @@ export default {
/* this.showProcess()*/
},
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
modelImportExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.modelImportExcelUrl}`
},
modelDownExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.modelDownExcelUrl}`
},
importExcelUrlf: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrlf}`
@ -509,6 +513,30 @@ export default {
downUrl: this.tablexDownExcelUrl
}
},
modelData: function () {
return {
note: ['上级模块名称(非必填): 添加一级模块不用填,添加二级模块要填',
'项目名称(必填): 从已存在的项目中选',
'中文名称(必填): 相同上级的模块不能重名',
'英文名称(必填): 中文名称的英文名称',
'模块编码(必填): 项目编码+模块缩写',
'责任人(非必填): 模块的开发任务可以分配给1个或多个人员',
'任务等级(必填): 值: 1、2、3、4、5',
'开发状态(必填):值: 未发布、已发布、开发中、已完成、已撤回、已取消',
'任务时长(必填): 单位小时: 等于下级模块时长的和;默认1(小时)',
'实际时长(必填): 单位小时;最小0.1小时;默认16',
'关联实体(非必填): 关联实体表;关联的是该模块管理的实体',
'模块状态(必填): 可填入值为正常、停用、废弃',
'版本状态(必填): 可填入值为当前、历史',
'版本号: 请填写小与五位数的正整数'
],
title: '导入模块',
uploadUrl: this.modelImportExcelUrl,
downUrl: "temp/2.xls",
downName: "mokua.xls"
}
},
ruleData: function () {
return {
note: ['对应模块(必填):填写正确的模块名称',

@ -56,7 +56,7 @@
</template>
<script>
import {getAction} from "@api/manage"
import {downloadFile, getAction} from "@api/manage"
import store from '@/store'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import {mixinDevice} from '@/utils/mixin'
@ -80,6 +80,7 @@ export default {
},
confirmLoading: false,
form: this.$form.createForm(this),
downName:'',
url:
{
downfile: '',
@ -129,18 +130,20 @@ export default {
},
//
handleDownload() {
downloadFile( this.url.downfile,this.downName)
// getAction(this.url.list, params).then((res) =>
getAction(this.url.downfile).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]))
const link = document.createElement('a')
link.href = url
link.setAttribute('download', 'your-document.pdf')
document.body.appendChild(link)
link.click()
})
.catch(error => {
console.error(error)
})
// getAction(this.url.downfile)
// downloadFile( window._CONFIG['downloadUrl'],'temp/ (1).xls').then((response) => {
// const url = window.URL.createObjectURL(new Blob([response.data]))
// const link = document.createElement('a')
// link.href = url
// link.setAttribute('download', 'your-document.pdf')
// document.body.appendChild(link)
// link.click()
// })
// .catch(error => {
// console.error(error)
// })
},
add() {
@ -148,6 +151,7 @@ export default {
show(data) {
this.url.uploadUrl = data.uploadUrl
this.url.downfile = data.downUrl
this.downName = data.downName
this.datas=data.note
this.title=data.title
this.ModalData = {}

@ -175,6 +175,12 @@
<j-image-upload bizPath="scott/pic" v-model="model.taskPic"></j-image-upload>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="1" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="taskPic">
<!-- <a-input v-model="model.taskPic" placeholder="请输入项目图片"></a-input>-->
<j-upload bizPath="temp/" v-model="model.taskPic"></j-upload>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
</j-form-container>

@ -28,10 +28,14 @@ import org.jeecg.modules.modulex.mapper.ModulexMapper;
import org.jeecg.modules.modulex.service.IModulexService;
import org.jeecg.modules.modulex.vo.ModuleFunctionRule;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.def.TemplateExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.modules.modulex.service.ModulexTemplateService;
import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -40,8 +44,10 @@ import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@ -67,6 +73,9 @@ public class ModulexController extends JeecgController<Modulex, IModulexService>
@Autowired
private ModulexTemplateService modulexTemplateService;
@Value("${jeecg.wordPath}")
private String wordPath;
/**
* 分页列表查询
*
@ -398,4 +407,59 @@ public class ModulexController extends JeecgController<Modulex, IModulexService>
return mv;
}
@AutoLog(value = "模块管理-新增下级")
@ApiOperation(value = "模块管理-添加下级", notes = "模块管理-添加下级")
@PutMapping("/addAddSubordinates")
public Result<?> addAddSubordinates(@RequestBody Modulex modulex){
if (StringUtils.hasText(modulex.getPid())){
List<String> collect = modulexService.list(
new LambdaQueryWrapper<Modulex>()
.eq(StringUtils.hasText(modulex.getPid()), Modulex::getPid, modulex.getPid()))
.stream().map(Modulex::getModuleName).collect(Collectors.toList());
collect.add(modulex.getModuleName());
HashSet<String> setList = new HashSet<>(collect);
if (collect.size() != setList.size()){
return Result.error("相同上级的模块不能重名");
}
}
Integer newVersion = modulexService.getMaxVersion(modulex.getVerison());
modulex.setVerison(newVersion + 1);
modulex.setRelatedBean(null);
boolean isTure = modulexService.save(modulex);
if(!isTure){
return Result.OK("新增下级失败");
}
return Result.OK("新增下级成功");
}
@RequestMapping(value = "/templateExcel")
public ModelAndView wbsExcelTemplate(HttpServletRequest request, HttpServletResponse response) {
Map<String, Object> map = new HashMap<String, Object>();
//设置导出文件名称
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date(System.currentTimeMillis());
String currTime = formatter.format(date);
String fileName = currTime + "-" + "模板.xlsx";
try {
String url = getClass().getClassLoader().getResource("static").getPath();
// 模板存放地址 这里写的地址根本拿不到 在其他人的电脑上
String templateUrl = wordPath + File.separator + "实体表模板.xls";
TemplateExportParams params = new TemplateExportParams(
templateUrl);
ModelAndView mv = new ModelAndView(new JeecgTemplateExcelView());
mv.addObject(TemplateExcelConstants.FILE_NAME, fileName);
mv.addObject(TemplateExcelConstants.PARAMS, params);
// 添加模板参数
mv.addObject(TemplateExcelConstants.MAP_DATA, map); //data
return mv;
} catch (Exception e) {
log.error("下载模板异常--》{}", e);
}
return null;
}
}

@ -342,15 +342,11 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
webSocketUtils.sendMessage(loginUser.getId(), message);
String username = loginUser.getUsername();
if (file.isEmpty()) {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("上传为空");
}
String filename = file.getOriginalFilename();
String fileSuffix = filename.substring(filename.lastIndexOf("."));
if (!fileSuffix.equals(".xls") && !fileSuffix.equals(".xlsx")) {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件类型不对");
}
List<ModulexTemplate> modulexVoList = new ArrayList<>();
@ -400,32 +396,24 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
break;
case 1:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "项目名称为空");
}
modulexVo.setProjectId(value);
break;
case 2:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "中文名称为空");
}
modulexVo.setModuleName(value);
break;
case 3:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "英文名称为空");
}
modulexVo.setModuleEnName(value);
break;
case 4:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "模块编码为空");
}
modulexVo.setModuleCode(value);
@ -438,16 +426,12 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
break;
case 7:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "任务等级为空");
}
modulexVo.setWorkLevel(value);
break;
case 8:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "开发状态为空");
}
modulexVo.setWorkStatus(value);
@ -457,8 +441,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
break;
case 10:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "任务时长为空");
}
modulexVo.setDuration(value);
@ -471,8 +453,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
break;
case 13:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "实际时长为空");
}
modulexVo.setRealDuration(value);
@ -485,36 +465,26 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
break;
case 16:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "模块状态为空");
}
modulexVo.setStatus(value);
break;
case 17:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "版本状态为空");
}
modulexVo.setVerisonStatus(value);
break;
case 18:
if (value == null || value == "") {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("第" + (j + 1) + "行" + propertyNames.get(k) + "版本号为空");
}else if(value.length()<=0||value.length()>50){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("版本号不符合规范");
}else {
modulexVo.setVerison(value);
}
break;
default:
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("未知错误");
}
modulexVo.setUploadPerson(username);
@ -528,10 +498,10 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
List<Modulex> modulexList = new ArrayList<>();
List<ModulexTemplate> modulexTemplates = this.SelectModulex();
message.put("records", String.valueOf(modulexTemplates.size()));
webSocketUtils.sendMessage(loginUser.getId(), message);
List<String> ids = new ArrayList<>();
if(modulexTemplates==null||modulexTemplates.size()==0){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,预读数据失败,获取不到表格中的数据,请重新导入");
}
else {
@ -541,8 +511,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}
boolean isTure = modulexTemplateService.removeByIds(ids);
if(!isTure){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("预读数据删除失败,请重新导入");
}
message.put("status", "导入数据中");
@ -556,35 +524,25 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
queryWrapper.eq(Modulex::getModuleName,pid);
List<Modulex> list = this.list(queryWrapper);
if(list==null ||list.size()==0){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,此模块不存在上级");
}
Modulex one =list.get(0);
if(one==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,此模块不存在上级");
}String pid1 = one.getId();
if(pid1==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,此模块不存在上级");
}
modulex.setPid(pid1);
}
String projectId = modulexTemplate.getProjectId();
if(projectId==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,项目名称不能为空");
}else {
LambdaQueryWrapper<Projectx> projectxLambdaQueryWrapper = new LambdaQueryWrapper<>();
projectxLambdaQueryWrapper.eq(Projectx::getProjectName,projectId);
Projectx projectx = projectxService.getOne(projectxLambdaQueryWrapper);
if(projectx==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,项目名称不存在");
} else {
String projectxId = projectx.getId();
@ -594,8 +552,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String moduleName = modulexTemplate.getModuleName();
String pid1 = modulex.getPid();
if(moduleName==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,中文名称不能为空");
}else if(pid1==null){
modulex.setModuleName(moduleName);
@ -604,20 +560,14 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
modulexLambdaQueryWrapper.eq(Modulex::getPid,pid1).eq(Modulex::getModuleName,moduleName);
Modulex modulex1 = this.getOne(modulexLambdaQueryWrapper);
if(modulex1!=null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,相同的上级模块不能重名");
}modulex.setModuleName(moduleName);
String moduleEnName = modulexTemplate.getModuleEnName();
if(moduleEnName==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,英文名称不能为空");
}modulex.setModuleEnName(moduleEnName);
String moduleCode = modulexTemplate.getModuleCode();
if(moduleCode==null||moduleCode.length()>30){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块编码不能为空或者模块编码过长");
}
String modulecode = null;
@ -627,14 +577,10 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
String firstChar = this.toFirstChar(moduleName);
String projectCode = projectx.getProjectCode();
if(projectCode==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("项目编码不存在,请重新填写");
}
modulecode = projectCode + firstChar;
if(!modulecode.equals(moduleCode)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("模块编码不规范,导入失败");
}
modulex.setModuleCode(moduleCode);
@ -648,19 +594,13 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}else {
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
String[] split = managerUsers.split(",");
// sysUserLambdaQueryWrapper.eq(SysUser::getUsername,managerUsers);
sysUserLambdaQueryWrapper.in(SysUser::getUsername,split);
List<SysUser> iSysUserServiceOne = iSysUserService.list(sysUserLambdaQueryWrapper);
if(iSysUserServiceOne==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,责任人信息查询不到");
}else {
List<String> list = iSysUserServiceOne.stream().map(SysUser::getId).collect(Collectors.toList());
// String id = iSysUserServiceOne.getId();
if (list == null) {
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,责任人信息查询不到");
}
modulex.setManagerUsers(String.valueOf(list));
@ -668,23 +608,17 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}
String workLevel = modulexTemplate.getWorkLevel();
if(StringUtils.isBlank(workLevel)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务等级不能为空");
}
else {
Integer integer = Integer.valueOf(workLevel);
if(integer<=0&&integer>=6){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务等级不规范");
}
modulex.setWorkLevel(integer);
}
String workStatus = modulexTemplate.getWorkStatus();
if(StringUtils.isBlank(workStatus)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,工作状态不能为空");
}else {
Integer integer = 100;
@ -702,8 +636,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
case "已取出": integer = 9;
break;
default:
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,开发状态不规范");
}
modulex.setWorkStatus(integer);
@ -714,8 +646,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}else {
Boolean result = this.checkTime(publishTime);
if(!result){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,日期格式不规范");
}else {
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(publishTime);
@ -724,8 +654,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}
String duration = modulexTemplate.getDuration();
if(StringUtils.isBlank(duration)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,任务时长不能为空");
}else {
double parseDouble = Double.parseDouble(duration);
@ -737,8 +665,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}else {
Boolean result = this.checkTime(startTime);
if(!result){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,开始时间不规范");
}else {
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(startTime);
@ -751,8 +677,6 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}else {
Boolean result = this.checkTime(submitTime);
if(!result){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,提交时间不规范");
}else {
Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(submitTime);
@ -761,14 +685,10 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}
String realDuration = modulexTemplate.getRealDuration();
if(StringUtils.isBlank(realDuration)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,实际时长不能为空");
}else {
double parseDouble = Double.parseDouble(realDuration);
if(parseDouble<0.1){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,最小时间0.1小时");
}
modulex.setRealDuration(parseDouble);
@ -781,14 +701,10 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
sysRoleLambdaQueryWrapper.eq(SysRole::getRoleName,userRole);
SysRole one = iSysRoleService.getOne(sysRoleLambdaQueryWrapper);
if(one==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,用户角色不存在");
}
String useRole = one.getId();
if(useRole==null){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,用户角色不存在");
} modulex.setUserRole(useRole);
}
@ -798,15 +714,11 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}else {
Boolean extracted = extracted(modulex, relatedBean);
if(!extracted){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("关联实体不存在");
}
}
String status = modulexTemplate.getStatus();
if(StringUtils.isBlank(status)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块状态不能为空");
}else {
Integer integer = 100;
@ -818,16 +730,12 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
case "废弃": integer = 9;
break;
default:
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,模块状态不规范匹配不到");
}
modulex.setStatus(integer);
}
String verisonStatus = modulexTemplate.getVerisonStatus();
if(StringUtils.isBlank(verisonStatus)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,版本状态不能为空");
}else {
Integer integer = 100;
@ -837,16 +745,12 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
case "历史": integer = 0;
break;
default:
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
Result.error("导入失败,版本状态不规范,匹配失败");
}
modulex.setVerisonStatus(integer);
}
String verison = modulexTemplate.getVerison();
if(StringUtils.isBlank(verison)){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("导入失败,版本号不能为空");
}else {
int parseInt = Integer.parseInt(verison);
@ -856,12 +760,8 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
}
boolean result = this.saveSingleBatch(modulexList, loginUser, message);
if(!result){
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("未知错误导入失败,请重新导入");
}
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.OK("导入成功");
}
}
@ -927,12 +827,11 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
message.put("uploaded", String.valueOf(i + 1));
isTrue = this.save(modulexList.get(i));
if(!isTrue){
webSocketUtils.sendMessage(loginUser.getId(), message);
message.put("isVisible", "false");
webSocketUtils.sendMessage(loginUser.getId(), message);
return false;
}
webSocketUtils.sendMessage(loginUser.getId(), message);
}
return true;
}

@ -137,9 +137,9 @@ spring:
# driver-class-name: com.mysql.cj.jdbc.Driver
# 多数据源配置
#multi-datasource1:
url: jdbc:mysql://127.0.0.1:3306/project_management?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://182.92.169.222:3306/project_management?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: root
password: ycwl2022.
driver-class-name: com.mysql.cj.jdbc.Driver
#redis 配置
redis:

Loading…
Cancel
Save