|
|
|
@ -51,6 +51,7 @@ import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest; |
|
|
|
@ -60,13 +61,13 @@ import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* @Description: 实体表 |
|
|
|
|
* @Author: jeecg-boot |
|
|
|
|
* @Date: 2023-04-10 |
|
|
|
|
* @Version: V1.0 |
|
|
|
|
*/ |
|
|
|
|
@Api(tags="实体表") |
|
|
|
|
@Api(tags = "实体表") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/tablex/tablex") |
|
|
|
|
@Slf4j |
|
|
|
@ -91,6 +92,9 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
@Autowired |
|
|
|
|
private WebSocketUtils webSocketUtils; |
|
|
|
|
|
|
|
|
|
@Value("${jeecg.wordPath}") |
|
|
|
|
private String wordPath; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
|
* |
|
|
|
@ -151,7 +155,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
@AutoLog(value = "转化") |
|
|
|
|
@ApiOperation(value = "转化", notes = "转化") |
|
|
|
|
@PostMapping(value = "/zh") |
|
|
|
|
public Result<?> zh(@RequestBody Tablex tablex,HttpServletRequest req) { |
|
|
|
|
public Result<?> zh(@RequestBody Tablex tablex, HttpServletRequest req) { |
|
|
|
|
String reid = tablex.getId(); |
|
|
|
|
tablex.setId(null); |
|
|
|
|
List<Tablex> tablexList = tablexService.list(); |
|
|
|
@ -166,11 +170,11 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
tablex.setVerison(1); |
|
|
|
|
tablex.setTableStructure("CREATE TABLE '" + tablex.getTableEnName() + "' ();"); |
|
|
|
|
QueryWrapper<Tablex> queryWrapper = QueryGenerator.initQueryWrapper(tablex, req.getParameterMap()); |
|
|
|
|
queryWrapper.eq("table_name",tablex.getTableName()).or().eq("table_en_name",tablex.getTableEnName()); |
|
|
|
|
queryWrapper.eq("table_name", tablex.getTableName()).or().eq("table_en_name", tablex.getTableEnName()); |
|
|
|
|
List<Tablex> tlist = tablexService.list(queryWrapper); |
|
|
|
|
if(tlist.size()>0){ |
|
|
|
|
if (tlist.size() > 0) { |
|
|
|
|
return Result.error("中文或者英文名称重复,不可转化"); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
tablexService.save(tablex); |
|
|
|
|
modulexService.setmodule(tablex.getId(), tablex.getModuleId()); |
|
|
|
|
requirementEntity.setEntityStatus(3); |
|
|
|
@ -296,7 +300,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
if (StringUtils.isBlank(originalFilename) || |
|
|
|
|
(!originalFilename.endsWith("xls") && |
|
|
|
|
!originalFilename.endsWith("xlsx"))) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件格式不正确"); |
|
|
|
|
} |
|
|
|
@ -313,13 +317,13 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
//读取excel数据
|
|
|
|
|
list = ExcelImportUtil.importExcel(file.getInputStream(), TablexVo.class, params); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("文件读取失败"); |
|
|
|
|
} |
|
|
|
|
//判断文件中是否存在数据
|
|
|
|
|
if (list == null || list.size() == 0) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("Excel数据为空"); |
|
|
|
|
} |
|
|
|
@ -328,36 +332,37 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
for (TablexVo tablexVo : list) { |
|
|
|
|
//判断当前存入行是否为空值
|
|
|
|
|
if (tablexVo.getModuleId() == null && |
|
|
|
|
tablexVo.getTableName() == null && |
|
|
|
|
tablexVo.getTableEnName() == null && |
|
|
|
|
tablexVo.getTableStructure() == null && |
|
|
|
|
tablexVo.getStructuralDiagram() == null && |
|
|
|
|
tablexVo.getStatus() == null && |
|
|
|
|
tablexVo.getVerisonStatus() == null && |
|
|
|
|
tablexVo.getVerison() == null) continue; |
|
|
|
|
// 将总的记录数传递给前端
|
|
|
|
|
message.put("records", String.valueOf(list.size())); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(tablexVo.getModuleId()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getTableName()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getTableEnName()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getTableStructure()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getStructuralDiagram()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getStatus()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getVerisonStatus()) && |
|
|
|
|
StringUtils.isBlank(tablexVo.getVerison())) { |
|
|
|
|
list.remove(tablexVo); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//判断版本号长度
|
|
|
|
|
String verison = tablexVo.getVerison(); |
|
|
|
|
if (verison.length() > 5) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("预读入失败,版本号格式错误"); |
|
|
|
|
} |
|
|
|
|
//存入临时表中
|
|
|
|
|
tablexVoService.save(tablexVo); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//从临时表中取出数据
|
|
|
|
|
List<TablexVo> voList = tablexVoService.list(); |
|
|
|
|
// 将总的记录数传递给前端
|
|
|
|
|
message.put("records", String.valueOf(voList.size())); |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
//删除临时表中的数据
|
|
|
|
|
tablexVoService.removeAll(voList); |
|
|
|
|
|
|
|
|
|
if (voList.size() == 0) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("导入失败,数据为空"); |
|
|
|
|
} |
|
|
|
@ -370,16 +375,16 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
Tablex tablex = new Tablex(); |
|
|
|
|
|
|
|
|
|
String moduleId = voList.get(i).getModuleId(); |
|
|
|
|
if (moduleId == null || moduleId.equals("")){ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
if (moduleId == null || moduleId.equals("")) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("对应模块填写不能为空"); |
|
|
|
|
} |
|
|
|
|
LambdaQueryWrapper<Modulex> queryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
queryWrapper.eq(Modulex::getId,moduleId); |
|
|
|
|
queryWrapper.eq(Modulex::getId, moduleId); |
|
|
|
|
Modulex modulex = modulexService.getOne(queryWrapper); |
|
|
|
|
if(modulex == null){ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
if (modulex == null) { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("对应模块填写错误"); |
|
|
|
|
} |
|
|
|
@ -418,15 +423,15 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
tablexList.add(tablex); |
|
|
|
|
|
|
|
|
|
//单条保存到真实表中
|
|
|
|
|
tablexService.saveSingleBatch(tablexList,loginUser,message); |
|
|
|
|
tablexService.saveSingleBatch(tablexList, loginUser, message); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本号填写错误!"); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
/* message.put("isVisible", "false");*/ |
|
|
|
|
webSocketUtils.sendMessage(loginUser.getId(), message); |
|
|
|
|
return Result.error("导入失败,第" + i + 1 + "行的版本状态填写错误!"); |
|
|
|
|
} |
|
|
|
@ -461,7 +466,7 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
return Result.ok("文件导入成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* //导出实体标准模板
|
|
|
|
|
//导出实体标准模板
|
|
|
|
|
@RequestMapping(value = "/templateExcel") |
|
|
|
|
public ModelAndView wbsExcelTemplate(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
@ -486,5 +491,5 @@ public class TablexController extends JeecgController<Tablex, ITablexService> { |
|
|
|
|
log.error("下载模板异常--》{}", e); |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|