Эх сурвалжийг харах

【次元EIS接口,过站,测试接口参数data 强制增加unicode转码】

xiaost 1 долоо хоног өмнө
parent
commit
35fd64eb69

+ 7 - 6
src/main/java/com/uas/eis/controller/StepWorkController.java

@@ -5,7 +5,9 @@ import com.uas.eis.exception.ApiStepWorkException;
 import com.uas.eis.sdk.entity.StepWorkApiResult;
 import com.uas.eis.sdk.resp.StepWorkApiResponse;
 import com.uas.eis.service.StepWorkService;
+import com.uas.eis.utils.JSONUtil;
 import com.uas.eis.utils.StringUtil;
+import org.apache.commons.lang.StringEscapeUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -82,13 +84,13 @@ public class StepWorkController {
      * @param data
      * @return
      */
-    @RequestMapping(value="/mes-product/public/station/center/test", method = RequestMethod.POST,
-            consumes = "application/json;charset=UTF-8",
-            produces = "application/json;charset=UTF-8")
+    @RequestMapping(value="/mes-product/public/station/center/test", method = RequestMethod.POST)
     public StepWorkApiResult<Map<String,Object>> test(HttpServletRequest request, @RequestBody String data){
         if(!StringUtil.hasText(data) || !StringUtil.hasText(data) ){
             throw new ApiStepWorkException(new StepWorkApiResult(ErrorMessage.BUSINESS_DATAILLEGAL));
         }
+        //data = StringEscapeUtils.unescapeJava(data);  //转码
+        data = JSONUtil.decodeUnicode(data.replace("%", "\\"));
         return stepWorkService.test(request,data);
     }
 
@@ -104,13 +106,12 @@ public class StepWorkController {
      * }
      * @return
      */
-    @RequestMapping(value="/mes-product/public/station/center/over/station", method = RequestMethod.POST,
-            consumes = "application/json;charset=UTF-8",
-            produces = "application/json;charset=UTF-8")
+    @RequestMapping(value="/mes-product/public/station/center/over/station", method = RequestMethod.POST)
     public StepWorkApiResult<Map<String,Object>> station(HttpServletRequest request, @RequestBody String data){
         if(!StringUtil.hasText(data) || !StringUtil.hasText(data) ){
             throw new ApiStepWorkException(new StepWorkApiResult(ErrorMessage.BUSINESS_DATAILLEGAL));
         }
+        data = JSONUtil.decodeUnicode(data.replace("%", "\\"));
         return stepWorkService.station(request,data);
     }
 }