配置文件修改

devhuozheluoji
郭向斌 2 years ago
parent b903c453d7
commit e021526a26

@ -63,11 +63,13 @@ public class ApiController {
private TaskService taskService; private TaskService taskService;
@Value("${spring.profiles.active}") @Value("${spring.profiles.active}")
private String profiles; private String profiles;
@Value("${system.project.wlyCallback}")
private String wlyCallback;
@ApiOperation(value = "通用识别") @ApiOperation(value = "通用识别")
@RequestMapping("/identify") @RequestMapping("/identify")
@Transactional @Transactional
@ResponseBody @ResponseBody
@AutoLog(value = "api接口-通用识别",logType = CommonConstant.OPERATE_TYPE_1) @AutoLog(value = "api接口-通用识别",logType = CommonConstant.LOG_TYPE_2,operateType=CommonConstant.OPERATE_TYPE_1)
public Result<?> pushSemantic(@RequestBody JSONObject requestBody) throws InterruptedException { public Result<?> pushSemantic(@RequestBody JSONObject requestBody) throws InterruptedException {
// if (!"test".equals(profiles)) { // if (!"test".equals(profiles)) {
// return Result.error("当前环境不支持该功能,请访问测试环境"); // return Result.error("当前环境不支持该功能,请访问测试环境");
@ -265,7 +267,7 @@ public class ApiController {
Map<String, String> configRuleMap = ocrRuleCheckVo.getConfigRuleMap();*/ Map<String, String> configRuleMap = ocrRuleCheckVo.getConfigRuleMap();*/
OcrIdentifyDTO identifyDTO = ocrIdentifyService.findById("1702560400245035009"); OcrIdentifyDTO identifyDTO = ocrIdentifyService.findById("1702560400245035009");
List<OcrIdentifyDetail> identifyDetailList = ocrIdentifyDetailService.listByIdentifyId(identifyDTO.getId()); List<OcrIdentifyDetail> identifyDetailList = ocrIdentifyDetailService.listByIdentifyId(identifyDTO.getId());
CallBackWlyUtils.callbackWly(identifyDTO,identifyDetailList); CallBackWlyUtils.callbackWly(wlyCallback,identifyDTO,identifyDetailList);
return Result.OK(""); return Result.OK("");
} }

@ -66,7 +66,8 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
IOcrIdentifyCallbackLogService ocrIdentifyCallbackLogService; IOcrIdentifyCallbackLogService ocrIdentifyCallbackLogService;
@Value("${system.project.fileReviewUrlPrefix}") @Value("${system.project.fileReviewUrlPrefix}")
private String fileReviewUrlPrefix; private String fileReviewUrlPrefix;
@Value("${system.project.wlyCallback}")
private String wlyCallback;
@Override @Override
public OcrIdentifyDTO findById(String id) { public OcrIdentifyDTO findById(String id) {
OcrIdentifyDTO ocrIdentifyDTO = baseMapper.findById(id); OcrIdentifyDTO ocrIdentifyDTO = baseMapper.findById(id);
@ -428,7 +429,7 @@ public class OcrIdentifyServiceImpl extends ServiceImpl<OcrIdentifyMapper, OcrId
OcrIdentify ocrIdentify = super.getById(ocrIdentifyId); OcrIdentify ocrIdentify = super.getById(ocrIdentifyId);
List<OcrIdentifyDetail> identifyDetailList = ocrIdentifyDetailService.listByIdentifyId(ocrIdentifyId); List<OcrIdentifyDetail> identifyDetailList = ocrIdentifyDetailService.listByIdentifyId(ocrIdentifyId);
ocrIdentifyCallbackLog.setStartTime(date); ocrIdentifyCallbackLog.setStartTime(date);
boolean b = CallBackWlyUtils.callbackWly(ocrIdentify, identifyDetailList); boolean b = CallBackWlyUtils.callbackWly(wlyCallback,ocrIdentify, identifyDetailList);
ocrIdentifyCallbackLog.setStatus(b?1:0);//0-失败1-成功 ocrIdentifyCallbackLog.setStatus(b?1:0);//0-失败1-成功
ocrIdentifyCallbackLog.setEndTime(new Date()); ocrIdentifyCallbackLog.setEndTime(new Date());
ocrIdentifyCallbackLogService.save(ocrIdentifyCallbackLog); ocrIdentifyCallbackLogService.save(ocrIdentifyCallbackLog);

@ -27,7 +27,9 @@ import java.util.List;
@Slf4j @Slf4j
public class CallBackWlyUtils { public class CallBackWlyUtils {
public static boolean callbackWly(OcrIdentify ocrIdentify, List<OcrIdentifyDetail> identifyDetails) {
public static boolean callbackWly(String url,OcrIdentify ocrIdentify, List<OcrIdentifyDetail> identifyDetails) {
String requestId = ocrIdentify.getRequestId(); String requestId = ocrIdentify.getRequestId();
log.info("数据准备:{}",requestId); log.info("数据准备:{}",requestId);
//请求对象 //请求对象
@ -91,7 +93,7 @@ public class CallBackWlyUtils {
System.out.println("============================================="); System.out.println("=============================================");
System.out.println(JSONObject.toJSONString(callBackWlyRequestBody)); System.out.println(JSONObject.toJSONString(callBackWlyRequestBody));
System.out.println("============================================="); System.out.println("=============================================");
semanticResponseJson = RestUtil.post("https://192.168.1.100:8894/api/task/image/ocr/callback", JSONObject.parseObject(JSONObject.toJSONString(callBackWlyRequestBody, SerializerFeature.WriteNullStringAsEmpty))); semanticResponseJson = RestUtil.post(url, JSONObject.parseObject(JSONObject.toJSONString(callBackWlyRequestBody, SerializerFeature.WriteNullStringAsEmpty)));
} catch (org.springframework.web.client.ResourceAccessException e) { } catch (org.springframework.web.client.ResourceAccessException e) {
log.error("请求无量云回调接口失败-拒绝连接 (Connection refused)"); log.error("请求无量云回调接口失败-拒绝连接 (Connection refused)");
log.error(e.getMessage()); log.error(e.getMessage());

@ -301,4 +301,5 @@ system:
project: project:
env: customer_test env: customer_test
enableHandleTask: true enableHandleTask: true
fileReviewUrlPrefix: http://localhost:8071/files fileReviewUrlPrefix: http://localhost:8071/files
wlyCallback: https://hyycsozs.prevailcloud.com/api/task/image/ocr/callback
Loading…
Cancel
Save