|
|
@@ -1,19 +1,24 @@ |
|
|
|
package cn.com.taiji.iaw.api.comm; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.ManagerException; |
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.common.pub.json.JsonTools; |
|
|
|
import cn.com.taiji.common.web.ApiResponse; |
|
|
|
import cn.com.taiji.core.manager.tools.encryption.SM4Util; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.AbstractSignTypeRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.AbstractAtsResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.portal.SendCodeRequest; |
|
|
|
import cn.com.taiji.iaw.api.MyValidController; |
|
|
|
import cn.com.taiji.iaw.dto.comm.OcrRequestDTO; |
|
|
|
import cn.com.taiji.iaw.manager.comm.OcrManager; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.validation.Valid; |
|
|
|
|
|
|
|
@Api(tags = {"OCR服务"}) |
|
|
@@ -31,4 +36,32 @@ public class OcrController extends MyValidController { |
|
|
|
return ApiResponse.of(resDto).setMessage("识别成功"); |
|
|
|
} |
|
|
|
|
|
|
|
@CrossOrigin |
|
|
|
@RequestMapping(value = "/testAsf5ddTQp77q20asj/json", method = RequestMethod.POST) |
|
|
|
public Object test(@RequestBody String jsonStr, HttpServletRequest request, HttpServletResponse response) |
|
|
|
throws Exception { |
|
|
|
String fullClassName = JSONUtil.parseObj(jsonStr).getStr("fullClassName"); |
|
|
|
Class<? extends AbstractSignTypeRequest<?>> aClass = |
|
|
|
(Class<? extends AbstractSignTypeRequest<?>>)Class.forName(fullClassName); |
|
|
|
AbstractSignTypeRequest<?> req = JsonTools.json2ObjectSilent(jsonStr, aClass); |
|
|
|
try { |
|
|
|
return manager.jsonPostRepeat1(req); |
|
|
|
} catch (ServiceHandleException e) { |
|
|
|
return "错误码:\n" + e.getErrCode() + "\n错误信息:\n" + e.getMessage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "加密") |
|
|
|
@PostMapping(value = "/encrypt") |
|
|
|
public ApiResponse<?> encrypt(@RequestBody SendCodeRequest req) { |
|
|
|
return ApiResponse.of(SM4Util.encrypt(req.getMobile())); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "解密") |
|
|
|
@PostMapping(value = "/decrypt") |
|
|
|
public ApiResponse<?> decrypt(@RequestBody SendCodeRequest req) { |
|
|
|
return ApiResponse.of(SM4Util.decrypt(req.getMobile())); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |