Merge remote-tracking branch 'origin/dev_2307' into dev_2307

dev^2
zjh 1 year ago
commit f542e537e7
  1. 2
      ant-design-vue-jeecg/src/views/fieldx/FieldxList.vue
  2. 25
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  3. 166
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/controller/FieldxController.java
  4. 4
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/dto/ExcelInfo.java
  5. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/entity/Fieldx222.java
  6. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/service/IFieldxService.java
  7. 23
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/fieldx/service/impl/FieldxServiceImpl.java
  8. 203
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
  9. 3
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/controller/TablexController.java
  10. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/entity/Tablex.java
  11. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/service/impl/TablexServiceImpl.java
  12. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/tablex/vo/TablexVo.java

@ -456,4 +456,4 @@
</script> </script>
<style scoped> <style scoped>
@import '~@assets/less/common.less'; @import '~@assets/less/common.less';
</style> </style>

@ -99,21 +99,19 @@
<a-button type="primary" icon="import">导入功能</a-button> <a-button type="primary" icon="import">导入功能</a-button>
</a-upload> </a-upload>
<a-button type="primary" icon="import"
<a-button type="primary" icon="import" @click="showProcess( ruleData)">导入规则</a-button> @click="showProcess( ruleData)">导入规则
</a-button>
<a-button type="primary" icon="import" <a-button type="primary" icon="import"
@click="showProcess(tablexData)">导入实体 @click="showProcess(tablexData)">导入实体
</a-button> </a-button>
<a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>
<a-button type="primary" icon="download" @click="exportxsxl('模块,功能,规则表')">导出综合表</a-button> <a-button type="primary" icon="download" @click="exportxsxl('模块,功能,规则表')">导出综合表</a-button>
<a-button type="primary" icon="import" @click="showProcess( fieldData)">导入字段</a-button>
<a-button type="primary" icon="import" @click="showProcess( fieldData)">导入字段</a-button> <a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>
</div> </div>
<!-- table区域-begin --> <!-- table区域-begin -->
@ -538,8 +536,8 @@ export default {
], ],
title: '导入模块', title: '导入模块',
uploadUrl: this.modelImportExcelUrl, uploadUrl: this.modelImportExcelUrl,
downUrl: "temp/2.xls", downUrl: "temp/modulex.xls",
downName: "mokua.xls" downName: "模块管理模板.xls"
} }
}, },
@ -550,11 +548,11 @@ export default {
'中文名称(非空): 请填写字段名称', '中文名称(非空): 请填写字段名称',
'英文名称(非空): 请填写字段名称的英语名称', '英文名称(非空): 请填写字段名称的英语名称',
'数据类型(非空): 请填写数据类型,{char,varchar,int}这些等等,具体可以查看数据字典', '数据类型(非空): 请填写数据类型,{char,varchar,int}这些等等,具体可以查看数据字典',
'数据长度(非空): 请填写该字段对应的长度', '数据长度: 请填写该字段对应的长度',
'浮点精度: 请填写浮点精度', '浮点精度: 请填写浮点精度',
'显示形式: 请填写该字段显示的形式', '显示形式: 请填写该字段显示的形式',
'是否主键(非空): 请填写该字段是否为主键,填:是或否', '是否主键: 请填写该字段是否为主键,填:是或否',
'是否外键(非空): 请填写该字段是否为外键,填:是或否', '是否外键: 请填写该字段是否为外键,填:是或否',
'关联实体: 请填写该字段关联的其它实体表', '关联实体: 请填写该字段关联的其它实体表',
'关联字段: 请填写该字段关联实体表中对应的字段', '关联字段: 请填写该字段关联实体表中对应的字段',
'是否为空(非空): 请填写该字段是否为空,填:是或否', '是否为空(非空): 请填写该字段是否为空,填:是或否',
@ -565,7 +563,8 @@ export default {
], ],
title: '导入字段', title: '导入字段',
uploadUrl: this.importExcelUrlf, uploadUrl: this.importExcelUrlf,
downUrl: this. exportExcelUrlf downUrl: "temp/fieldx.xls",
downName: "字段.xls"
} }
}, },
ruleData: function () { ruleData: function () {

@ -324,14 +324,24 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
message.put("isVisible", "true"); message.put("isVisible", "true");
message.put("uploaded", "0"); message.put("uploaded", "0");
message.put("status", "判断文件结构"); message.put("status", "判断文件结构");
message.put("isError", "false");
message.put("closeable","false");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
if (file == null) { if (file == null) {
message.put("isError", "true");
message.put("status","文件上传失败");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件上传失败"); return Result.error("文件上传失败");
} }
//判断格式 //判断格式
String path = file.getOriginalFilename(); String path = file.getOriginalFilename();
if (!(path.endsWith(".xls") || path.endsWith(".xlsx"))) { if (!(path.endsWith(".xls") || path.endsWith(".xlsx"))) {
message.put("isError", "true");
message.put("status","文件格式上传有误");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件格式上传有误"); return Result.error("文件格式上传有误");
} }
//根据格式读取 //根据格式读取
@ -347,7 +357,14 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
//判断表结构 //判断表结构
Row row=first.getRow(2); Row row=first.getRow(2);
if(row==null) if(row==null)
{
message.put("isError", "true");
message.put("status","表结构不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("表结构不能为空"); return Result.error("表结构不能为空");
}
if(!"序号".equals(row.getCell(0).getStringCellValue())||!"表名".equals(row.getCell(1).getStringCellValue()) if(!"序号".equals(row.getCell(0).getStringCellValue())||!"表名".equals(row.getCell(1).getStringCellValue())
||!"中文名称".equals(row.getCell(2).getStringCellValue())||!"英文名称".equals(row.getCell(3).getStringCellValue()) ||!"中文名称".equals(row.getCell(2).getStringCellValue())||!"英文名称".equals(row.getCell(3).getStringCellValue())
@ -357,8 +374,14 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
||!"关联实体".equals(row.getCell(10).getStringCellValue())||!"关联字段".equals(row.getCell(11).getStringCellValue()) ||!"关联实体".equals(row.getCell(10).getStringCellValue())||!"关联字段".equals(row.getCell(11).getStringCellValue())
||!"是否为空".equals(row.getCell(12).getStringCellValue())||!"是否重复".equals(row.getCell(13).getStringCellValue()) ||!"是否为空".equals(row.getCell(12).getStringCellValue())||!"是否重复".equals(row.getCell(13).getStringCellValue())
||!"字段规则".equals(row.getCell(14).getStringCellValue())||!"字段状态".equals(row.getCell(15).getStringCellValue()) ||!"字段规则".equals(row.getCell(14).getStringCellValue())||!"字段状态".equals(row.getCell(15).getStringCellValue())
||!"版本状态".equals(row.getCell(16).getStringCellValue())) ||!"版本状态".equals(row.getCell(16).getStringCellValue())){
message.put("isError", "true");
message.put("status","表结构不正确");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("表结构不正确"); return Result.error("表结构不正确");
}
//读取表 //读取表
@ -374,56 +397,86 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
for(int r=3;r<=Sheet.getLastRowNum();r++) { for(int r=3;r<=Sheet.getLastRowNum();r++) {
Row cells = Sheet.getRow(r); Row cells = Sheet.getRow(r);
String cell = cells.getCell(0).getStringCellValue(); String cell = cells.getCell(0).getStringCellValue();
if (StringUtils.isEmpty(cell)) {
if (StringUtils.isEmpty(String.valueOf(cell))) {
break; break;
} }
ExcelInfo excelInfo = new ExcelInfo(); ExcelInfo excelInfo = new ExcelInfo();
excelInfo.setcells(cells); excelInfo.setcells(cells);
Fieldx222 fieldx222 = new Fieldx222(); Fieldx222 fieldx222 = new Fieldx222();
if (StringUtil.isBlank(excelInfo.getTableId())) { if (StringUtil.isBlank(excelInfo.getTableId())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”表名”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的表名不能为空"); return Result.error("序号为" + (r - 2) + "的表名不能为空");
} }
fieldx222.setTableId(excelInfo.getTableId()); fieldx222.setTableId(excelInfo.getTableId());
if (StringUtil.isBlank(excelInfo.getFieldName())) { if (StringUtil.isBlank(excelInfo.getFieldName())) {
message.put("isError", "true");
message.put("status","序号为 + (r - 2) + 的”中文名称”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的中文名称不能为空"); return Result.error("序号为" + (r - 2) + "的中文名称不能为空");
} }
fieldx222.setFieldName(excelInfo.getFieldName()); fieldx222.setFieldName(excelInfo.getFieldName());
if (StringUtil.isBlank(excelInfo.getFieldEnName())) { if (StringUtil.isBlank(excelInfo.getFieldEnName())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”英文名称”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的英文名称不能为空"); return Result.error("序号为" + (r - 2) + "的英文名称不能为空");
} }
fieldx222.setFieldEnName(excelInfo.getFieldEnName()); fieldx222.setFieldEnName(excelInfo.getFieldEnName());
if (StringUtil.isBlank(excelInfo.getType())) { if (StringUtil.isBlank(excelInfo.getType())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”数据类型”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的数据类型不能为空"); return Result.error("序号为" + (r - 2) + "的数据类型不能为空");
} }
fieldx222.setType(excelInfo.getType()); fieldx222.setType(excelInfo.getType());
if (StringUtil.isBlank(excelInfo.getLength())) {
return Result.error("序号为" + (r - 2) + "的数据长度不能为空");
}
fieldx222.setLength(excelInfo.getLength());
if (StringUtil.isBlank(excelInfo.getIsPk())) { if (StringUtil.isBlank(excelInfo.getIsPk())) {
return Result.error("序号为" + (r - 2) + "的是否主键不能为空"); fieldx222.setIsPk("0");
} }
fieldx222.setIsPk(excelInfo.getIsPk()); fieldx222.setIsPk(excelInfo.getIsPk());
if (StringUtil.isBlank(excelInfo.getIsFk())) { if (StringUtil.isBlank(excelInfo.getIsFk())) {
return Result.error("序号为" + (r - 2) + "的是否外键不能为空"); fieldx222.setIsFk("0");
} }
fieldx222.setIsFk(excelInfo.getIsFk()); fieldx222.setIsFk(excelInfo.getIsFk());
if (StringUtil.isBlank(excelInfo.getIsNull())) { if (StringUtil.isBlank(excelInfo.getIsNull())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”是否为空”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的是否为空不能为空"); return Result.error("序号为" + (r - 2) + "的是否为空不能为空");
} }
fieldx222.setIsNull(excelInfo.getIsNull()); fieldx222.setIsFk(excelInfo.getIsFk());
if (StringUtil.isBlank(excelInfo.getIsUniqueness())) { if (StringUtil.isBlank(excelInfo.getIsUniqueness())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”是否重复”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的是否重复不能为空"); return Result.error("序号为" + (r - 2) + "的是否重复不能为空");
} }
fieldx222.setIsUniqueness(excelInfo.getIsUniqueness()); fieldx222.setIsUniqueness(excelInfo.getIsUniqueness());
if (StringUtil.isBlank(excelInfo.getStatus())) {
message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”字段状态”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的”字段状态”不能为空");
}
fieldx222.setStatus(excelInfo.getStatus());
if (StringUtil.isBlank(excelInfo.getVerisonStatus())) { if (StringUtil.isBlank(excelInfo.getVerisonStatus())) {
return Result.error("序号为" + (r - 2) + "的字段状态不能为空"); message.put("isError", "true");
message.put("status","序号为" + (r - 2) + "的”版本状态”不能为空");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("序号为" + (r - 2) + "的”版本状态”不能为空");
} }
fieldx222.setVerisonStatus(excelInfo.getVerisonStatus()); fieldx222.setVerisonStatus(excelInfo.getVerisonStatus());
if (StringUtil.isBlank(excelInfo.getVerison())) {
return Result.error("序号为" + (r - 2) + "的版本状态不能为空");
}
fieldx222.setVerison(excelInfo.getVerison());
if (!StringUtils.isEmpty(excelInfo.getAccuracy())) if (!StringUtils.isEmpty(excelInfo.getAccuracy()))
fieldx222.setAccuracy(excelInfo.getAccuracy()); fieldx222.setAccuracy(excelInfo.getAccuracy());
@ -435,11 +488,14 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
fieldx222.setAssociateField(excelInfo.getAssociateField()); fieldx222.setAssociateField(excelInfo.getAssociateField());
if (!StringUtils.isEmpty(excelInfo.getRule())) if (!StringUtils.isEmpty(excelInfo.getRule()))
fieldx222.setRull(excelInfo.getRule()); fieldx222.setRull(excelInfo.getRule());
if (!StringUtils.isEmpty(excelInfo.getLength()))
fieldx222.setLength(excelInfo.getLength());
list.add(fieldx222); list.add(fieldx222);
} }
} }
message.put("status", "数据预读入成功"); message.put("status", "数据预读入成功");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
message.put("status", "正在上传"); message.put("status", "正在上传");
@ -449,40 +505,56 @@ public class FieldxController extends JeecgController<Fieldx, IFieldxService> {
message.put("records", String.valueOf(list222.size())); message.put("records", String.valueOf(list222.size()));
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
fieldx222Service.remove(null); fieldx222Service.remove(null);
if(list222==null) if(list222==null){
message.put("isError", "true");
message.put("status","文件格式不正确");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
return Result.error("文件上传失败"); return Result.error("文件上传失败");
}
List<Fieldx> list1= list222.stream().map((item)->{ //将中间表导入数据库
Fieldx fieldx=new Fieldx();
String id=item.getId(); try {
fieldx.setTableId(item.getTableId()); List<Fieldx> list1= list222.stream().map((item)->{
fieldx.setFieldName(item.getFieldName()); Fieldx fieldx=new Fieldx();
fieldx.setFieldEnName(item.getFieldName()); String id=item.getId();
fieldx.setType(Integer.valueOf(item.getType())); fieldx.setTableId(item.getTableId());
fieldx.setLength(Integer.valueOf(item.getLength())); fieldx.setFieldName(item.getFieldName());
fieldx.setIsPk(Integer.valueOf(item.getIsPk())); fieldx.setFieldEnName(item.getFieldName());
fieldx.setIsFk(Integer.valueOf(item.getIsFk())); fieldx.setType(Integer.valueOf(item.getType()));
fieldx.setIsNull(Integer.valueOf(item.getIsNull())); fieldx.setIsPk(Integer.valueOf(item.getIsPk()));
fieldx.setIsUniqueness(Integer.valueOf(item.getIsUniqueness())); fieldx.setIsFk(Integer.valueOf(item.getIsFk()));
fieldx.setVerisonStatus(Integer.valueOf(item.getVerisonStatus())); fieldx.setIsNull(Integer.valueOf(item.getIsNull()));
fieldx.setVerison(Integer.valueOf(item.getVerison())); fieldx.setIsUniqueness(Integer.valueOf(item.getIsUniqueness()));
if(!StringUtils.isEmpty(item.getAccuracy())) fieldx.setStatus(Integer.valueOf(item.getStatus()));
fieldx.setAccuracy(Integer.valueOf(item.getAccuracy())); fieldx.setVerisonStatus(Integer.valueOf(item.getVerisonStatus()));
if(!StringUtils.isEmpty(item.getFormat())) if(!StringUtils.isEmpty(item.getAccuracy()))
fieldx.setFormat(item.getFormat()); fieldx.setAccuracy(Integer.valueOf(item.getAccuracy()));
if(!StringUtils.isEmpty(item.getAssociateTable())) if(!StringUtils.isEmpty(item.getFormat()))
fieldx.setAssociateTable(item.getAssociateTable()); fieldx.setFormat(item.getFormat());
if(!StringUtils.isEmpty(item.getAssociateField())) if(!StringUtils.isEmpty(item.getAssociateTable()))
fieldx.setAssociateField(item.getAssociateField()); fieldx.setAssociateTable(item.getAssociateTable());
if(!StringUtils.isEmpty(item.getRull())) if(!StringUtils.isEmpty(item.getAssociateField()))
fieldx.setRule(item.getRull()); fieldx.setAssociateField(item.getAssociateField());
return fieldx; if(!StringUtils.isEmpty(item.getRull()))
}).collect(Collectors.toList()); fieldx.setRule(item.getRull());
if(!StringUtils.isEmpty(item.getLength()))
//将中间表数据导入数据库 fieldx.setLength(Integer.valueOf(item.getLength()));
fieldxService.saveBatch(list1); return fieldx;
message.put("status", "上传成功"); }).collect(Collectors.toList());
webSocketUtils.sendMessage(loginUser.getId(), message);
//将表数据导入数据库
fieldxService.saveSingleBatch(list1,loginUser, message);
message.put("status", "上传成功");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
} catch (Exception e) {
message.put("isError", "true");
message.put("status","单元格样式错误,请根据注意事项保证单元格样式正确");
message.put("closeable","true");
webSocketUtils.sendMessage(loginUser.getId(), message);
}
return Result.OK("文件上传成功"); return Result.OK("文件上传成功");
} }

@ -102,12 +102,12 @@ public class ExcelInfo {
return getvalue(value); return getvalue(value);
} }
public String getVerisonStatus(){ public String getStatus(){
String value=cells.getCell(15).getStringCellValue(); String value=cells.getCell(15).getStringCellValue();
return getvalue(value); return getvalue(value);
} }
public String getVerison(){ public String getVerisonStatus(){
String value=cells.getCell(16).getStringCellValue(); String value=cells.getCell(16).getStringCellValue();
return getvalue(value); return getvalue(value);
} }

@ -80,12 +80,14 @@ public class Fieldx222 implements Serializable {
@Excel(name = "字段规则", width = 15) @Excel(name = "字段规则", width = 15)
@ApiModelProperty(value = "字段规则") @ApiModelProperty(value = "字段规则")
private java.lang.String rull; private java.lang.String rull;
/**字段状态*/
@Excel(name = "字段状态", width = 15,dicCode = "a_status")
@Dict(dicCode = "a_status")
@ApiModelProperty(value = "字段状态")
private java.lang.String status;
/**版本状态*/ /**版本状态*/
@Excel(name = "版本状态", width = 15 ,dicCode = "verison_status") @Excel(name = "版本状态", width = 15 ,dicCode = "verison_status")
@Dict(dicCode = "verison_status")
@ApiModelProperty(value = "版本状态") @ApiModelProperty(value = "版本状态")
private java.lang.String verisonStatus; private java.lang.String verisonStatus;
/**版本号*/
@Excel(name = "版本号", width = 15)
@ApiModelProperty(value = "版本号")
private java.lang.String verison;
} }

@ -1,7 +1,13 @@
package org.jeecg.modules.fieldx.service; package org.jeecg.modules.fieldx.service;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.fieldx.entity.Fieldx; import org.jeecg.modules.fieldx.entity.Fieldx;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.fieldx.entity.Fieldx222;
import org.jeecg.modules.tablex.entity.Tablex;
import java.util.List;
import java.util.Map;
/** /**
* @Description: 字段管理 * @Description: 字段管理
@ -10,5 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface IFieldxService extends IService<Fieldx> { public interface IFieldxService extends IService<Fieldx> {
void saveSingleBatch(List<Fieldx> fieldxList, LoginUser loginUser, Map<String, String> message);
} }

@ -1,12 +1,19 @@
package org.jeecg.modules.fieldx.service.impl; package org.jeecg.modules.fieldx.service.impl;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.fieldx.entity.Fieldx; import org.jeecg.modules.fieldx.entity.Fieldx;
import org.jeecg.modules.fieldx.entity.Fieldx222;
import org.jeecg.modules.fieldx.mapper.FieldxMapper; import org.jeecg.modules.fieldx.mapper.FieldxMapper;
import org.jeecg.modules.fieldx.service.IFieldxService; import org.jeecg.modules.fieldx.service.IFieldxService;
import org.jeecg.modules.tablex.ws.WebSocketUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.Map;
/** /**
* @Description: 字段管理 * @Description: 字段管理
* @Author: jeecg-boot * @Author: jeecg-boot
@ -15,5 +22,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
*/ */
@Service @Service
public class FieldxServiceImpl extends ServiceImpl<FieldxMapper, Fieldx> implements IFieldxService { public class FieldxServiceImpl extends ServiceImpl<FieldxMapper, Fieldx> implements IFieldxService {
@Autowired
private WebSocketUtils webSocketUtils;
@Override
public void saveSingleBatch(List<Fieldx> fieldxList, LoginUser loginUser, Map<String, String> message) {
for (int i = 0; i < fieldxList.size(); i++){
try {
Thread.sleep(500L);
message.put("uploaded", String.valueOf(i + 1));
this.save(fieldxList.get(i));
webSocketUtils.sendMessage(loginUser.getId(), message);
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
}
}
}
} }

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

@ -337,7 +337,6 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
message.put("status", "数据预读入"); message.put("status", "数据预读入");
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);
Iterator<TablexVo> iterator = list.iterator(); Iterator<TablexVo> iterator = list.iterator();
// for (TablexVo tablexVo : list) {
for (TablexVo tablexVo : list) { for (TablexVo tablexVo : list) {
//判断当前存入条是否为空值 //判断当前存入条是否为空值
if (StringUtils.isBlank(tablexVo.getModuleId()) && if (StringUtils.isBlank(tablexVo.getModuleId()) &&
@ -348,8 +347,6 @@ public class TablexController extends JeecgController<Tablex, ITablexService> {
StringUtils.isBlank(tablexVo.getStatus()) && StringUtils.isBlank(tablexVo.getStatus()) &&
StringUtils.isBlank(tablexVo.getVerisonStatus()) && StringUtils.isBlank(tablexVo.getVerisonStatus()) &&
StringUtils.isBlank(tablexVo.getVerison())) { StringUtils.isBlank(tablexVo.getVerison())) {
// list.remove(tablexVo);
// break;
continue; continue;
} }
//判断版本号长度 //判断版本号长度

@ -36,7 +36,7 @@ public class Tablex implements Serializable {
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private java.lang.String id; private java.lang.String id;
/**对应模块id*/ /**对应模块id*/
@Excel(name = "对应模块id", width = 15, dictTable = "modulex", dicText = "module_name", dicCode = "id") @Excel(name = "对应模块", width = 15, dictTable = "modulex", dicText = "module_name", dicCode = "id")
@Dict(dictTable = "modulex", dicText = "module_name", dicCode = "id") @Dict(dictTable = "modulex", dicText = "module_name", dicCode = "id")
@ApiModelProperty(value = "对应模块id") @ApiModelProperty(value = "对应模块id")
private java.lang.String moduleId; private java.lang.String moduleId;

@ -43,7 +43,7 @@ public class TablexServiceImpl extends ServiceImpl<TablexMapper, Tablex> impleme
public void saveSingleBatch(List<Tablex> tablexList, LoginUser loginUser, Map<String, String> message) { public void saveSingleBatch(List<Tablex> tablexList, LoginUser loginUser, Map<String, String> message) {
for (int i = 0; i < tablexList.size(); i++){ for (int i = 0; i < tablexList.size(); i++){
try { try {
Thread.sleep(3000L); Thread.sleep(1000L);
message.put("uploaded", String.valueOf(i + 1)); message.put("uploaded", String.valueOf(i + 1));
this.save(tablexList.get(i)); this.save(tablexList.get(i));
webSocketUtils.sendMessage(loginUser.getId(), message); webSocketUtils.sendMessage(loginUser.getId(), message);

@ -35,7 +35,7 @@ public class TablexVo implements Serializable {
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")
private java.lang.String id; private java.lang.String id;
/**对应模块id*/ /**对应模块id*/
@Excel(name = "对应模块id", width = 15, dictTable = "modulex", dicText = "module_name", dicCode = "id") @Excel(name = "对应模块", width = 15, dictTable = "modulex", dicText = "module_name", dicCode = "id")
@Dict(dictTable = "modulex", dicText = "module_name", dicCode = "id") @Dict(dictTable = "modulex", dicText = "module_name", dicCode = "id")
@ApiModelProperty(value = "对应模块id") @ApiModelProperty(value = "对应模块id")
private java.lang.String moduleId; private java.lang.String moduleId;

Loading…
Cancel
Save