From 1daaae84ff99ad84d707907f2f78f2f38053865d Mon Sep 17 00:00:00 2001 From: pengjie <17373303529@163.com> Date: Fri, 17 May 2024 19:00:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=A1=A8=E5=8D=95=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/XzGroundSafetController.java | 74 +++++++++++++++++++ .../XzOpenCircuitSafeController.java | 72 ++++++++++++++++++ .../zhgd/xmgl/security/WebSecurityConfig.java | 3 + 3 files changed, 149 insertions(+) diff --git a/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzGroundSafetController.java b/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzGroundSafetController.java index 9958bcae9..3cce8542c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzGroundSafetController.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzGroundSafetController.java @@ -1,5 +1,12 @@ package com.zhgd.xmgl.modules.xz.special.controller; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.zhgd.xmgl.modules.xz.special.entity.XzGasAnalyze; +import com.zhgd.xmgl.modules.xz.special.entity.XzSpecialOperationFireSafety; import com.zhgd.xmgl.modules.xz.special.service.IXzGroundSafetService; import com.zhgd.xmgl.modules.xz.special.entity.XzGroundSafet; import io.swagger.annotations.Api; @@ -7,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiImplicitParams; +import java.util.ArrayList; import java.util.HashMap; import springfox.documentation.annotations.ApiIgnore; @@ -78,6 +86,72 @@ public class XzGroundSafetController { return Result.ok(); } + /** + * 添加 + * + * @param paramMap + * @return + */ + @ApiOperation(value = "添加星纵-动土安全作业票信息", notes = "添加星纵-动土安全作业票信息", httpMethod = "POST") + @PostMapping(value = "/save") + public Result save(@RequestBody JSONObject paramMap) { + log.info("动土安全作业票信息同步" + paramMap); + JSONArray hotWorkExecutionBeginTime = paramMap.getJSONArray("workExecutionBeginTime"); + if (hotWorkExecutionBeginTime != null) { + String begin = hotWorkExecutionBeginTime.getString(0); + String end = hotWorkExecutionBeginTime.getString(0); + paramMap.put("workExecutionBeginTime", DateUtil.parse(begin + ":00", DatePattern.NORM_DATETIME_FORMAT)); + paramMap.put("workExecutionEndTime", DateUtil.parse(end + ":00", DatePattern.NORM_DATETIME_FORMAT)); + } + JSONArray operatingUnit = paramMap.getJSONArray("operatingUnit"); + if (operatingUnit != null) { + paramMap.put("operatingUnit", operatingUnit.get(0)); + } + JSONArray assignmentPersonInCharge = paramMap.getJSONArray("assignmentPersonInCharge"); + if (assignmentPersonInCharge != null) { + paramMap.put("assignmentPersonInCharge", assignmentPersonInCharge.get(0)); + } + JSONArray jobApplicationUnit = paramMap.getJSONArray("jobApplicationUnit"); + if (jobApplicationUnit != null) { + paramMap.put("jobApplicationUnit", jobApplicationUnit.get(0)); + } + String [] param1 = {"name", "flag"}; + JSONArray safeMeasures = paramMap.getJSONArray("safeMeasure"); + JSONArray safeMeasure = new JSONArray(); + if (safeMeasures != null) { + for (int i = 0; i < safeMeasures.size(); i++) { + JSONObject detailObj = new JSONObject(); + JSONObject j = safeMeasures.getJSONObject(i); + int k = 0; + for (String s : j.keySet()) { + detailObj.put(param1[k], j.get(s)); + k++; + } + safeMeasure.add(detailObj); + } + } + paramMap.put("safeMeasure", JSON.toJSONString(safeMeasure)); + String [] param2 = {"content", "person"}; + JSONArray otherSafeMeasures = paramMap.getJSONArray("otherSafeMeasure"); + JSONArray otherSafeMeasure = new JSONArray(); + if (otherSafeMeasures != null) { + for (int i = 0; i < otherSafeMeasures.size(); i++) { + JSONObject detailObj = new JSONObject(); + JSONObject j = otherSafeMeasures.getJSONObject(i); + int k = 0; + for (String s : j.keySet()) { + detailObj.put(param2[k], j.get(s)); + k++; + } + otherSafeMeasure.add(detailObj); + } + } + paramMap.put("otherSafeMeasure", JSON.toJSONString(otherSafeMeasure)); + XzGroundSafet xzGroundSafet = JSONObject.parseObject(JSON.toJSONString(paramMap), XzGroundSafet.class); + xzGroundSafetService.add(xzGroundSafet); + return Result.ok(); + } + /** * 编辑 * diff --git a/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzOpenCircuitSafeController.java b/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzOpenCircuitSafeController.java index af1987ec7..627109bfa 100644 --- a/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzOpenCircuitSafeController.java +++ b/src/main/java/com/zhgd/xmgl/modules/xz/special/controller/XzOpenCircuitSafeController.java @@ -1,5 +1,11 @@ package com.zhgd.xmgl.modules.xz.special.controller; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.zhgd.xmgl.modules.xz.special.entity.XzGroundSafet; import com.zhgd.xmgl.modules.xz.special.service.IXzOpenCircuitSafeService; import com.zhgd.xmgl.modules.xz.special.entity.XzOpenCircuitSafe; import io.swagger.annotations.Api; @@ -78,6 +84,72 @@ public class XzOpenCircuitSafeController { return Result.ok(); } + /** + * 添加 + * + * @param paramMap + * @return + */ + @ApiOperation(value = "添加星纵-断路安全作业票信息", notes = "添加星纵-断路安全作业票信息", httpMethod = "POST") + @PostMapping(value = "/save") + public Result save(@RequestBody JSONObject paramMap) { + log.info("断路安全作业票信息同步" + paramMap); + JSONArray hotWorkExecutionBeginTime = paramMap.getJSONArray("workExecutionBeginTime"); + if (hotWorkExecutionBeginTime != null) { + String begin = hotWorkExecutionBeginTime.getString(0); + String end = hotWorkExecutionBeginTime.getString(0); + paramMap.put("workExecutionBeginTime", DateUtil.parse(begin + ":00", DatePattern.NORM_DATETIME_FORMAT)); + paramMap.put("workExecutionEndTime", DateUtil.parse(end + ":00", DatePattern.NORM_DATETIME_FORMAT)); + } + JSONArray operatingUnit = paramMap.getJSONArray("operatingUnit"); + if (operatingUnit != null) { + paramMap.put("operatingUnit", operatingUnit.get(0)); + } + JSONArray assignmentPersonInCharge = paramMap.getJSONArray("assignmentPersonInCharge"); + if (assignmentPersonInCharge != null) { + paramMap.put("assignmentPersonInCharge", assignmentPersonInCharge.get(0)); + } + JSONArray jobApplicationUnit = paramMap.getJSONArray("jobApplicationUnit"); + if (jobApplicationUnit != null) { + paramMap.put("jobApplicationUnit", jobApplicationUnit.get(0)); + } + String [] param1 = {"name", "flag"}; + JSONArray safeMeasures = paramMap.getJSONArray("safeMeasure"); + JSONArray safeMeasure = new JSONArray(); + if (safeMeasures != null) { + for (int i = 0; i < safeMeasures.size(); i++) { + JSONObject detailObj = new JSONObject(); + JSONObject j = safeMeasures.getJSONObject(i); + int k = 0; + for (String s : j.keySet()) { + detailObj.put(param1[k], j.get(s)); + k++; + } + safeMeasure.add(detailObj); + } + } + paramMap.put("safeMeasure", JSON.toJSONString(safeMeasure)); + String [] param2 = {"content", "person"}; + JSONArray otherSafeMeasures = paramMap.getJSONArray("otherSafeMeasure"); + JSONArray otherSafeMeasure = new JSONArray(); + if (otherSafeMeasures != null) { + for (int i = 0; i < otherSafeMeasures.size(); i++) { + JSONObject detailObj = new JSONObject(); + JSONObject j = otherSafeMeasures.getJSONObject(i); + int k = 0; + for (String s : j.keySet()) { + detailObj.put(param2[k], j.get(s)); + k++; + } + otherSafeMeasure.add(detailObj); + } + } + paramMap.put("otherSafeMeasure", JSON.toJSONString(otherSafeMeasure)); + XzOpenCircuitSafe xzOpenCircuitSafe = JSONObject.parseObject(JSON.toJSONString(paramMap), XzOpenCircuitSafe.class); + xzOpenCircuitSafeService.add(xzOpenCircuitSafe); + return Result.ok(); + } + /** * 编辑 * diff --git a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java index cf6090979..ba5e9b0e6 100644 --- a/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java +++ b/src/main/java/com/zhgd/xmgl/security/WebSecurityConfig.java @@ -373,6 +373,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/xmgl/xzBlindPlatePlugSafe/save").permitAll() .antMatchers("/xmgl/xzHighJobSafe/save").permitAll() .antMatchers("/xmgl/xzHoistSafetyWork/save").permitAll() + .antMatchers("/xmgl/xzOpenCircuitSafe/save").permitAll() + .antMatchers("/xmgl/xzGroundSafet/save").permitAll() + .antMatchers("/xmgl/xzTemporaryElectricitySafe/save").permitAll() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous() .anyRequest().authenticated() // 剩下所有的验证都需要验证. .and()