作业表单提交

This commit is contained in:
pengjie 2024-05-17 19:00:08 +08:00
parent 7a35cc8257
commit 1daaae84ff
3 changed files with 149 additions and 0 deletions

View File

@ -1,5 +1,12 @@
package com.zhgd.xmgl.modules.xz.special.controller; 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.service.IXzGroundSafetService;
import com.zhgd.xmgl.modules.xz.special.entity.XzGroundSafet; import com.zhgd.xmgl.modules.xz.special.entity.XzGroundSafet;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -7,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -78,6 +86,72 @@ public class XzGroundSafetController {
return Result.ok(); return Result.ok();
} }
/**
* 添加
*
* @param paramMap
* @return
*/
@ApiOperation(value = "添加星纵-动土安全作业票信息", notes = "添加星纵-动土安全作业票信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<XzGroundSafet> 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();
}
/** /**
* 编辑 * 编辑
* *

View File

@ -1,5 +1,11 @@
package com.zhgd.xmgl.modules.xz.special.controller; 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.service.IXzOpenCircuitSafeService;
import com.zhgd.xmgl.modules.xz.special.entity.XzOpenCircuitSafe; import com.zhgd.xmgl.modules.xz.special.entity.XzOpenCircuitSafe;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -78,6 +84,72 @@ public class XzOpenCircuitSafeController {
return Result.ok(); return Result.ok();
} }
/**
* 添加
*
* @param paramMap
* @return
*/
@ApiOperation(value = "添加星纵-断路安全作业票信息", notes = "添加星纵-断路安全作业票信息", httpMethod = "POST")
@PostMapping(value = "/save")
public Result<XzOpenCircuitSafe> 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();
}
/** /**
* 编辑 * 编辑
* *

View File

@ -373,6 +373,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/xmgl/xzBlindPlatePlugSafe/save").permitAll() .antMatchers("/xmgl/xzBlindPlatePlugSafe/save").permitAll()
.antMatchers("/xmgl/xzHighJobSafe/save").permitAll() .antMatchers("/xmgl/xzHighJobSafe/save").permitAll()
.antMatchers("/xmgl/xzHoistSafetyWork/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() .antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
.anyRequest().authenticated() // 剩下所有的验证都需要验证. .anyRequest().authenticated() // 剩下所有的验证都需要验证.
.and() .and()