|
@@ -0,0 +1,81 @@
|
|
|
|
+package com.shkpr.service.alambizplugin.controller;
|
|
|
|
+
|
|
|
|
+import com.global.base.log.LogLevelFlag;
|
|
|
|
+import com.global.base.log.LogPrintMgr;
|
|
|
|
+import com.shkpr.service.alambizplugin.apiparam.JPGetOne;
|
|
|
|
+import com.shkpr.service.alambizplugin.bizservice.GisSurveyBizService;
|
|
|
|
+import com.shkpr.service.alambizplugin.commtools.CommTool;
|
|
|
|
+import com.shkpr.service.alambizplugin.constants.ApiURI;
|
|
|
|
+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.controllervalid.CommonParamValidSK;
|
|
|
|
+import com.shkpr.service.alambizplugin.dto.ResponseRes;
|
|
|
|
+import com.shkpr.service.alambizplugin.exception.SelfException;
|
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
+
|
|
|
|
+@RequestMapping(ApiURI.URI_GIS_SURVEY_H)
|
|
|
|
+@RestController
|
|
|
|
+public class ApiGisSurveyController {
|
|
|
|
+ final String MSG_SUCCESS = "success.";
|
|
|
|
+ final String MSG_FAILED = "failed.";
|
|
|
|
+ private String mStrClassName = "", mBizType = "";
|
|
|
|
+ private AtomicInteger mSeqSysCheckReq = null;
|
|
|
|
+
|
|
|
|
+ public ApiGisSurveyController() {
|
|
|
|
+ mStrClassName = "ApiGisSurveyController";
|
|
|
|
+ mBizType = LogFlagBusiType.BUSI_GIS_SURVEY.toStrValue();
|
|
|
|
+ mSeqSysCheckReq = new AtomicInteger(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping(value = ApiURI.URI_XXX_SYS_CHECK)
|
|
|
|
+ public ResponseRes sysCheck(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}) JPGetOne oJsonParam
|
|
|
|
+ , BindingResult bindRes) throws Exception{
|
|
|
|
+ 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.checkValid()){
|
|
|
|
+ throw new SelfException(ResponseCode.STATUS_ERROR_JSON_FORMAT.toStrCode()
|
|
|
|
+ , String.format(ApiURI.EXCEPTION_FORMAT
|
|
|
|
+ , strPlatform
|
|
|
|
+ , URI_PATH
|
|
|
|
+ , ResponseCode.STATUS_ERROR_JSON_FORMAT.toStrMsg()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ long llReqBefore = System.currentTimeMillis();
|
|
|
|
+ String strRunSeq = String.format("%d-%d", llReqBefore, mSeqSysCheckReq.incrementAndGet());
|
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO, mBizType, mStrClassName, strUserId
|
|
|
|
+ ,String.format("%s:%s seq:{%s} param:%s begin====>"
|
|
|
|
+ ,strPlatform
|
|
|
|
+ ,URI_PATH
|
|
|
|
+ ,strRunSeq
|
|
|
|
+ ,oJsonParam.toString()));
|
|
|
|
+
|
|
|
|
+ ResponseRes<String> resResult = new ResponseRes<String>();
|
|
|
|
+ resResult.setResmsg(MSG_FAILED);
|
|
|
|
+ resResult.setResdata("");
|
|
|
|
+
|
|
|
|
+ ResponseCode code = GisSurveyBizService.sysCheckFun();
|
|
|
|
+ resResult.setRescode(code.toStrCode());
|
|
|
|
+ resResult.setResmsg((code==ResponseCode.RESULT_NORMAL)?MSG_SUCCESS:code.toStrMsg());
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+}
|