From 9498ec272b54ca0fa7fbb1b555480bb037fb05b2 Mon Sep 17 00:00:00 2001 From: guo Date: Wed, 6 Dec 2023 16:23:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E6=85=A7=E6=A2=81=E5=9C=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SmartBeamFieldBeamController.java | 1 - .../impl/SmartBeamFieldBeamServiceImpl.java | 14 +++++-- ...artBeamFieldProductionLineServiceImpl.java | 3 +- ...tBeamFieldSaveBeamPedestalServiceImpl.java | 17 +++++---- .../controller/${entityName}Controller.javai | 37 +------------------ 5 files changed, 25 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldBeamController.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldBeamController.java index a68847962..887d750f1 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldBeamController.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/controller/SmartBeamFieldBeamController.java @@ -145,7 +145,6 @@ public class SmartBeamFieldBeamController { @ApiImplicitParams({ @ApiImplicitParam(name = "smartBeamFieldBeamId", value = "智慧梁场-梁ID", paramType = "body", required = true, dataType = "String"), @ApiImplicitParam(name = "smartBeamFieldSaveBeamPedestalId", value = "智慧梁场-存梁台座id", paramType = "body", required = true, dataType = "String"), - @ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String") }) @PostMapping(value = "/bindSaveBeamForBeam") public Result bindSaveBeamForBeam(@ApiIgnore @RequestBody HashMap paramMap) { diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldBeamServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldBeamServiceImpl.java index 7d36ba534..a2b9f58fa 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldBeamServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldBeamServiceImpl.java @@ -161,14 +161,22 @@ public class SmartBeamFieldBeamServiceImpl extends ServiceImpl= 2) { - throw new OpenAlertException(String.format("该存梁台座已存两个梁,不能再添加梁")); + throw new OpenAlertException("该存梁台座已存两个梁,不能再添加梁"); } - String projectSn = MapUtils.getString(paramMap, "projectSn"); + if (CollUtil.isNotEmpty(smartBeamFieldBeamToSaveBeamPedestalMapper.selectList(new LambdaQueryWrapper() + .eq(SmartBeamFieldBeamToSaveBeamPedestal::getSmartBeamFieldSaveBeamPedestalId, smartBeamFieldSaveBeamPedestalId) + .eq(SmartBeamFieldBeamToSaveBeamPedestal::getSmartBeamFieldBeamId, smartBeamFieldBeamId) + .eq(SmartBeamFieldBeamToSaveBeamPedestal::getIsSaveBeam, 1) + ))) { + throw new OpenAlertException("该存梁台座已存在该梁"); + } + + SmartBeamFieldBeam beam = getById(smartBeamFieldBeamId); SmartBeamFieldBeamToSaveBeamPedestal saveBeamPedestalBeam = new SmartBeamFieldBeamToSaveBeamPedestal(); saveBeamPedestalBeam.setSmartBeamFieldSaveBeamPedestalId(smartBeamFieldSaveBeamPedestalId); saveBeamPedestalBeam.setSmartBeamFieldBeamId(smartBeamFieldBeamId); saveBeamPedestalBeam.setIsSaveBeam(1); - saveBeamPedestalBeam.setProjectSn(projectSn); + saveBeamPedestalBeam.setProjectSn(beam.getProjectSn()); smartBeamFieldBeamToSaveBeamPedestalMapper.insert(saveBeamPedestalBeam); } diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java index 7893f81f7..2000e42f2 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldProductionLineServiceImpl.java @@ -73,9 +73,10 @@ public class SmartBeamFieldProductionLineServiceImpl extends ServiceImpl productionLineMakeBeamPedestalList = smartBeamFieldProduZctionLine.getProductionLineMakeBeamPedestalList(); if (CollUtil.isNotEmpty(productionLineMakeBeamPedestalList)) { for (SmartBeamFieldProductionLineToMakeBeamPedestal smartBeamFieldProductionLineToMakeBeamPedestal : productionLineMakeBeamPedestalList) { + smartBeamFieldProductionLineToMakeBeamPedestal.setId(null); smartBeamFieldProductionLineToMakeBeamPedestal.setSmartBeamFieldProductionLineId(smartBeamFieldProduZctionLine.getId()); if (smartBeamFieldProductionLineToMakeBeamPedestal.getSmartBeamFieldMakeBeamPedestalId() == null) { - throw new OpenAlertException("智慧梁场-制梁台座id不能为空"); + throw new OpenAlertException("productionLineMakeBeamPedestalList[i].smartBeamFieldMakeBeamPedestalId(智慧梁场-制梁台座id)不能为空"); } smartBeamFieldProductionLineToMakeBeamPedestal.setProjectSn(smartBeamFieldProduZctionLine.getProjectSn()); smartBeamFieldProductionLineToMakeBeamPedestalMapper.insert(smartBeamFieldProductionLineToMakeBeamPedestal); diff --git a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamPedestalServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamPedestalServiceImpl.java index bd101a0bf..0381d3d7e 100644 --- a/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamPedestalServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/smartbeamfield/service/impl/SmartBeamFieldSaveBeamPedestalServiceImpl.java @@ -139,7 +139,11 @@ public class SmartBeamFieldSaveBeamPedestalServiceImpl extends ServiceImpl() .set(SmartBeamFieldBeamToSaveBeamPedestal::getIsSaveBeam, 0) @@ -148,13 +152,12 @@ public class SmartBeamFieldSaveBeamPedestalServiceImpl extends ServiceImpl add(@RequestBody ${entityName} ${entityName?uncap_first}) { + public Result<${entityName}> add(@RequestBody @Validate ${entityName} ${entityName?uncap_first}) { ${entityName?uncap_first}Service.add(${entityName?uncap_first}); return Result.ok(); } @@ -99,7 +99,7 @@ public class ${entityName}Controller { */ @ApiOperation(value = "编辑${tableVo.ftlDescription}信息", notes = "编辑${tableVo.ftlDescription}信息" , httpMethod="POST") @PostMapping(value = "/edit") - public Result<${entityName}> edit(@RequestBody ${entityName} ${entityName?uncap_first}) { + public Result<${entityName}> edit(@RequestBody @Validate ${entityName} ${entityName?uncap_first}) { ${entityName?uncap_first}Service.edit(${entityName?uncap_first}); return Result.ok(); } @@ -147,37 +147,4 @@ public class ${entityName}Controller { return result; } - /** - * 导出excel - * - * @param request - * @param response - */ - @ApiOperation(value = "导出excel${tableVo.ftlDescription}信息", notes = "导出excel${tableVo.ftlDescription}信息" , httpMethod="POST") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { - // Step.1 组装查询条件 - QueryWrapper<${entityName}> queryWrapper = null; - try { - String paramsStr = request.getParameter("paramsStr"); - if (oConvertUtils.isNotEmpty(paramsStr)) { - String deString = URLDecoder.decode(paramsStr, "UTF-8"); - ${entityName} ${entityName?uncap_first} = JSON.parseObject(deString, ${entityName}.class); - queryWrapper = QueryGenerator.initQueryWrapper(${entityName?uncap_first}, request.getParameterMap()); - } - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - - //Step.2 AutoPoi 导出Excel - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - List<${entityName}> pageList = ${entityName?uncap_first}Service.list(queryWrapper); - //导出文件名称 - mv.addObject(NormalExcelConstants.FILE_NAME, "${tableVo.ftlDescription}列表"); - mv.addObject(NormalExcelConstants.CLASS, ${entityName}.class); - mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("${tableVo.ftlDescription}列表数据", "导出人:Jeecg", "导出信息")); - mv.addObject(NormalExcelConstants.DATA_LIST, pageList); - return mv; - } - }