|
@@ -2,8 +2,10 @@ package com.shkpr.service.alambizplugin.controller;
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
|
import com.global.base.log.LogLevelFlag;
|
|
|
import com.global.base.log.LogPrintMgr;
|
|
|
+import com.shkpr.service.alambizplugin.apiparam.GisSurveyCRSParams;
|
|
|
import com.shkpr.service.alambizplugin.apiparam.GisSurveyCheckParams;
|
|
|
import com.shkpr.service.alambizplugin.apiparam.GisSurveyThirdExportParams;
|
|
|
import com.shkpr.service.alambizplugin.apiparam.GisSurveyThirdImportParams;
|
|
@@ -11,19 +13,23 @@ import com.shkpr.service.alambizplugin.bizservice.GisSurveyCadConvertBizService;
|
|
|
import com.shkpr.service.alambizplugin.bizservice.GisSurveySystemCheckBizService;
|
|
|
import com.shkpr.service.alambizplugin.bizservice.GisSurveyThirdExportBizService;
|
|
|
import com.shkpr.service.alambizplugin.bizservice.GisSurveyThirdImportBizService;
|
|
|
+import com.shkpr.service.alambizplugin.commtools.CRSUtil;
|
|
|
import com.shkpr.service.alambizplugin.commtools.CommTool;
|
|
|
import com.shkpr.service.alambizplugin.constants.ApiURI;
|
|
|
import com.shkpr.service.alambizplugin.constants.CadEnum;
|
|
|
import com.shkpr.service.alambizplugin.constants.CommAsyncStatusEnum;
|
|
|
+import com.shkpr.service.alambizplugin.constants.CommCRSDefine;
|
|
|
import com.shkpr.service.alambizplugin.constants.FileTypeEnum;
|
|
|
import com.shkpr.service.alambizplugin.constants.GisSurveyImportStatusEnum;
|
|
|
import com.shkpr.service.alambizplugin.constants.LogFlagBusiType;
|
|
|
import com.shkpr.service.alambizplugin.constants.ResponseCode;
|
|
|
import com.shkpr.service.alambizplugin.controllerfilter.TokenAuthenticationService;
|
|
|
+import com.shkpr.service.alambizplugin.controllerserializer.GeometrySerializer;
|
|
|
import com.shkpr.service.alambizplugin.controllervalid.CommonParamValidSK;
|
|
|
import com.shkpr.service.alambizplugin.dbdao.services.GisSurveyLayerApplyThirdCopyServiceImpl;
|
|
|
import com.shkpr.service.alambizplugin.dbdao.services.intef.GisSurveyLayerApplyService;
|
|
|
import com.shkpr.service.alambizplugin.dto.CommAsyncResult;
|
|
|
+import com.shkpr.service.alambizplugin.dto.CommCRSInfo;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyLayerApplyThirdCopy;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveySystemCheckResultDetail;
|
|
|
import com.shkpr.service.alambizplugin.dto.GisSurveyThirdImportResult;
|
|
@@ -32,6 +38,7 @@ import com.shkpr.service.alambizplugin.dto.ResponseRes;
|
|
|
import com.shkpr.service.alambizplugin.exception.SelfException;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.locationtech.jts.geom.Geometry;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.web.PageableDefault;
|
|
|
import org.springframework.validation.BindingResult;
|
|
@@ -69,6 +76,8 @@ public class ApiGisSurveyController {
|
|
|
private final AtomicInteger mSeqThirdExportReq;
|
|
|
private final AtomicInteger mSeqThirdExportGetReq;
|
|
|
private final AtomicInteger mSeqCadConvertGetReq;
|
|
|
+ private final AtomicInteger mSeqCrsGetListReq;
|
|
|
+ private final AtomicInteger mSeqCrsGetInfoReq;
|
|
|
|
|
|
private final ObjectMapper objectMapper;
|
|
|
|
|
@@ -99,6 +108,8 @@ public class ApiGisSurveyController {
|
|
|
mSeqThirdExportGetReq = new AtomicInteger(0);
|
|
|
mSeqCadConvertReq = new AtomicInteger(0);
|
|
|
mSeqCadConvertGetReq = new AtomicInteger(0);
|
|
|
+ mSeqCrsGetListReq = new AtomicInteger(0);
|
|
|
+ mSeqCrsGetInfoReq = new AtomicInteger(0);
|
|
|
this.objectMapper = objectMapper;
|
|
|
this.systemCheckBizService = systemCheckBizService;
|
|
|
this.thirdImportBizService = thirdImportBizService;
|
|
@@ -266,6 +277,7 @@ public class ApiGisSurveyController {
|
|
|
* @param operator 操作人
|
|
|
* @param jobId 任务id
|
|
|
* @param nature 用水性质,supply/drain
|
|
|
+ * @param sourceCRSCode 源坐标系code
|
|
|
* @param resetNo 是否重置点号
|
|
|
* @param ignoreFail 是否忽略失败
|
|
|
* @return 第三方导入结果
|
|
@@ -278,6 +290,7 @@ public class ApiGisSurveyController {
|
|
|
, @RequestParam(value = "operator", required = false) String operator
|
|
|
, @RequestParam(value = "jobId", required = false) String jobId
|
|
|
, @RequestParam(value = "nature", required = false) String nature
|
|
|
+ , @RequestParam(value = "sourceCRSCode", required = false, defaultValue = CommCRSDefine.CGCS2000) String sourceCRSCode
|
|
|
, @RequestParam(value = "resetNo", required = false) Boolean resetNo
|
|
|
, @RequestParam(value = "checkConstraint", required = false, defaultValue = "false") Boolean checkConstraint
|
|
|
, @RequestParam(value = "ignoreFail", required = false, defaultValue = "false") String ignoreFail) throws SelfException {
|
|
@@ -294,7 +307,8 @@ public class ApiGisSurveyController {
|
|
|
, ResponseCode.STATUS_ERROR_PARAM_FORMAT.toStrMsg()));
|
|
|
}
|
|
|
//构建入参数
|
|
|
- GisSurveyThirdImportParams params = new GisSurveyThirdImportParams(files, operator, jobId, nature, resetNo, checkConstraint, Boolean.parseBoolean(ignoreFail));
|
|
|
+ GisSurveyThirdImportParams params = new GisSurveyThirdImportParams(files, operator, jobId, nature, sourceCRSCode,
|
|
|
+ resetNo, checkConstraint, Boolean.parseBoolean(ignoreFail));
|
|
|
//begin
|
|
|
long llReqBefore = System.currentTimeMillis();
|
|
|
String strRunSeq = String.format("%d-%d", llReqBefore, mSeqThirdImportReq.incrementAndGet());
|
|
@@ -673,10 +687,10 @@ public class ApiGisSurveyController {
|
|
|
|
|
|
//导出类型枚举
|
|
|
FileTypeEnum fileTypeEnum = FileTypeEnum.getFileType(oJsonParam.getFileType());
|
|
|
- if (fileTypeEnum == null) fileTypeEnum = FileTypeEnum.EXCEL;
|
|
|
+ oJsonParam.setFileTypeEnum(fileTypeEnum == null ? FileTypeEnum.EXCEL : fileTypeEnum);
|
|
|
|
|
|
//执行第三方导出
|
|
|
- CommAsyncResult<Map<String, String>> result = thirdExportBizService.thirdExport(oJsonParam.getJobId(), fileTypeEnum, oJsonParam.getOperator());
|
|
|
+ CommAsyncResult<Map<String, String>> result = thirdExportBizService.thirdExport(oJsonParam);
|
|
|
String resultStr = null;
|
|
|
try {
|
|
|
if (result != null) resultStr = objectMapper.writeValueAsString(result);
|
|
@@ -980,4 +994,214 @@ public class ApiGisSurveyController {
|
|
|
, resResult.getTimestamp() - llReqBefore));
|
|
|
return resResult;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取坐标系列表
|
|
|
+ *
|
|
|
+ * @param request request
|
|
|
+ * @param strClientType 客户端类型
|
|
|
+ * @param strUserAgent 用户信息
|
|
|
+ * @return crs列表
|
|
|
+ */
|
|
|
+ @GetMapping(value = ApiURI.URI_XXX_CRS_GET_LIST)
|
|
|
+ public ResponseRes<String> crsGetList(HttpServletRequest request
|
|
|
+ , @RequestHeader(value = ApiURI.HEADER_CLIENT_TYPE, required = false) String strClientType
|
|
|
+ , @RequestHeader(value = ApiURI.HEADER_USER_AGENT, required = false) String strUserAgent) {
|
|
|
+ //入参校验
|
|
|
+ final String URI_PATH = request.getRequestURI();
|
|
|
+ final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
|
|
|
+ final String strUserId = (String) request.getAttribute(TokenAuthenticationService.HEADER_USERID);
|
|
|
+
|
|
|
+ //begin
|
|
|
+ long llReqBefore = System.currentTimeMillis();
|
|
|
+ String strRunSeq = String.format("%d-%d", llReqBefore, mSeqCrsGetListReq.incrementAndGet());
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
+ , String.format("%s:%s seq:{%s} begin====>"
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , strRunSeq));
|
|
|
+
|
|
|
+ //构建result
|
|
|
+ ResponseRes<String> resResult = new ResponseRes<>();
|
|
|
+ resResult.setRescode(ResponseCode.RESULT_BAD.toStrCode());
|
|
|
+ resResult.setResmsg(ResponseCode.RESULT_BAD.toStrMsg());
|
|
|
+
|
|
|
+ //获取crs列表
|
|
|
+ List<CRSUtil.Item> result = CRSUtil.getList();
|
|
|
+ String resultStr = null;
|
|
|
+ try {
|
|
|
+ if (CollectionUtils.isNotEmpty(result)) resultStr = objectMapper.writeValueAsString(result);
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
|
|
|
+ , String.format("Json序列化异常: error:%s", e));
|
|
|
+ }
|
|
|
+
|
|
|
+ //执行成功
|
|
|
+ if (resultStr != null) {
|
|
|
+ resResult.setRescode(ResponseCode.RESULT_NORMAL.toStrCode());
|
|
|
+ resResult.setResmsg(ResponseCode.RESULT_NORMAL.toStrMsg());
|
|
|
+ resResult.setResdata(resultStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ //end
|
|
|
+ resResult.setTimestamp(System.currentTimeMillis());
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
+ , String.format("%s:%s seq:{%s} rescode:{%s} resmsg:{%s} time:{%d ms} end<===="
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , strRunSeq
|
|
|
+ , resResult.getRescode()
|
|
|
+ , resResult.getResmsg()
|
|
|
+ , resResult.getTimestamp() - llReqBefore));
|
|
|
+ return resResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取坐标系信息
|
|
|
+ *
|
|
|
+ * @param request request
|
|
|
+ * @param strClientType 客户端类型
|
|
|
+ * @param strUserAgent 用户信息
|
|
|
+ * @return crs信息
|
|
|
+ */
|
|
|
+ @GetMapping(value = ApiURI.URI_XXX_CRS_GET_INFO)
|
|
|
+ public ResponseRes<String> crsGetInfo(HttpServletRequest request
|
|
|
+ , @RequestHeader(value = ApiURI.HEADER_CLIENT_TYPE, required = false) String strClientType
|
|
|
+ , @RequestHeader(value = ApiURI.HEADER_USER_AGENT, required = false) String strUserAgent
|
|
|
+ , @RequestParam(value = "code", required = false) String code) throws SelfException {
|
|
|
+ //入参校验
|
|
|
+ final String URI_PATH = request.getRequestURI();
|
|
|
+ final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
|
|
|
+ final String strUserId = (String) request.getAttribute(TokenAuthenticationService.HEADER_USERID);
|
|
|
+ if (StringUtils.isAnyBlank(code) || StringUtils.length(code) > 64) {
|
|
|
+ throw new SelfException(ResponseCode.STATUS_ERROR_PARAM_FORMAT.toStrCode()
|
|
|
+ , String.format(ApiURI.EXCEPTION_FORMAT
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , ResponseCode.STATUS_ERROR_PARAM_FORMAT.toStrMsg()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //begin
|
|
|
+ long llReqBefore = System.currentTimeMillis();
|
|
|
+ String strRunSeq = String.format("%d-%d", llReqBefore, mSeqCrsGetInfoReq.incrementAndGet());
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
+ , String.format("%s:%s seq:{%s} begin====>"
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , strRunSeq));
|
|
|
+
|
|
|
+ //构建result
|
|
|
+ ResponseRes<String> resResult = new ResponseRes<>();
|
|
|
+ resResult.setRescode(ResponseCode.RESULT_BAD.toStrCode());
|
|
|
+ resResult.setResmsg(ResponseCode.RESULT_BAD.toStrMsg());
|
|
|
+
|
|
|
+ //获取crs信息
|
|
|
+ CommCRSInfo result = CRSUtil.getInfo(code);
|
|
|
+ String resultStr = null;
|
|
|
+ try {
|
|
|
+ if (result != null) resultStr = objectMapper.writeValueAsString(result);
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
|
|
|
+ , String.format("Json序列化异常: error:%s", e));
|
|
|
+ }
|
|
|
+
|
|
|
+ //执行成功
|
|
|
+ if (resultStr != null) {
|
|
|
+ resResult.setRescode(ResponseCode.RESULT_NORMAL.toStrCode());
|
|
|
+ resResult.setResmsg(ResponseCode.RESULT_NORMAL.toStrMsg());
|
|
|
+ resResult.setResdata(resultStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ //end
|
|
|
+ resResult.setTimestamp(System.currentTimeMillis());
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
+ , String.format("%s:%s seq:{%s} rescode:{%s} resmsg:{%s} time:{%d ms} end<===="
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , strRunSeq
|
|
|
+ , resResult.getRescode()
|
|
|
+ , resResult.getResmsg()
|
|
|
+ , resResult.getTimestamp() - llReqBefore));
|
|
|
+ return resResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 坐标系转换
|
|
|
+ *
|
|
|
+ * @param request request
|
|
|
+ * @param strClientType 客户端类型
|
|
|
+ * @param strUserAgent 用户信息
|
|
|
+ * @return crs信息
|
|
|
+ */
|
|
|
+ @PostMapping(value = ApiURI.URI_XXX_CRS_TRANSFORM)
|
|
|
+ public ResponseRes<String> crsTransform(HttpServletRequest request
|
|
|
+ , @RequestHeader(value = ApiURI.HEADER_CLIENT_TYPE, required = false) String strClientType
|
|
|
+ , @RequestHeader(value = ApiURI.HEADER_USER_AGENT, required = false) String strUserAgent
|
|
|
+ , @RequestBody(required = false) @Validated(value = {CommonParamValidSK.class}) GisSurveyCRSParams oJsonParam
|
|
|
+ , BindingResult bindRes) throws SelfException {
|
|
|
+ //入参校验
|
|
|
+ final String URI_PATH = request.getRequestURI();
|
|
|
+ final String strPlatform = CommTool.getPlatformByAgent(strClientType, strUserAgent);
|
|
|
+ final String strUserId = (String) request.getAttribute(TokenAuthenticationService.HEADER_USERID);
|
|
|
+
|
|
|
+ if (oJsonParam == null || bindRes.hasErrors() || oJsonParam.getGeometry() == null) {
|
|
|
+ throw new SelfException(ResponseCode.STATUS_ERROR_JSON_FORMAT.toStrCode()
|
|
|
+ , String.format(ApiURI.EXCEPTION_FORMAT
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , ResponseCode.STATUS_ERROR_JSON_FORMAT.toStrMsg()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //begin
|
|
|
+ long llReqBefore = System.currentTimeMillis();
|
|
|
+ String strRunSeq = String.format("%d-%d", llReqBefore, mSeqCrsGetInfoReq.incrementAndGet());
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
+ , String.format("%s:%s seq:{%s} begin====>"
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , strRunSeq));
|
|
|
+
|
|
|
+ //构建result
|
|
|
+ ResponseRes<String> resResult = new ResponseRes<>();
|
|
|
+ resResult.setRescode(ResponseCode.RESULT_BAD.toStrCode());
|
|
|
+ resResult.setResmsg(ResponseCode.RESULT_BAD.toStrMsg());
|
|
|
+
|
|
|
+ //转换坐标系
|
|
|
+ Geometry result = CRSUtil.transform(oJsonParam.getGeometry(), oJsonParam.getSourceCRSCode(), oJsonParam.getTargetCRSCode());
|
|
|
+ String resultStr = null;
|
|
|
+ try {
|
|
|
+ if (result != null) {
|
|
|
+ //创建objectMapper,并注册geo序列化
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ SimpleModule module = new SimpleModule();
|
|
|
+ module.addSerializer(Geometry.class, new GeometrySerializer());
|
|
|
+ objectMapper.registerModule(module);
|
|
|
+
|
|
|
+ resultStr = objectMapper.writeValueAsString(result);
|
|
|
+ }
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR, mBizType, mStrClassName
|
|
|
+ , String.format("Json序列化异常: error:%s", e));
|
|
|
+ }
|
|
|
+
|
|
|
+ //执行成功
|
|
|
+ if (resultStr != null) {
|
|
|
+ resResult.setRescode(ResponseCode.RESULT_NORMAL.toStrCode());
|
|
|
+ resResult.setResmsg(ResponseCode.RESULT_NORMAL.toStrMsg());
|
|
|
+ resResult.setResdata(resultStr);
|
|
|
+ }
|
|
|
+
|
|
|
+ //end
|
|
|
+ resResult.setTimestamp(System.currentTimeMillis());
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
+ , String.format("%s:%s seq:{%s} rescode:{%s} resmsg:{%s} time:{%d ms} end<===="
|
|
|
+ , strPlatform
|
|
|
+ , URI_PATH
|
|
|
+ , strRunSeq
|
|
|
+ , resResult.getRescode()
|
|
|
+ , resResult.getResmsg()
|
|
|
+ , resResult.getTimestamp() - llReqBefore));
|
|
|
+ return resResult;
|
|
|
+ }
|
|
|
}
|