|
@@ -18,6 +18,7 @@ import com.qunzhixinxi.hnqz.admin.entity.SysDeptSub;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.XinbadaInputRecord;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.ZhongyiyunInputRecord;
|
|
|
import com.qunzhixinxi.hnqz.admin.entity.ZhongzhiInputRecord;
|
|
|
+import com.qunzhixinxi.hnqz.admin.enums.GigTypeEnum;
|
|
|
import com.qunzhixinxi.hnqz.admin.enums.SubjectLocation;
|
|
|
import com.qunzhixinxi.hnqz.admin.mapper.QifuInputRecordMapper;
|
|
|
import com.qunzhixinxi.hnqz.admin.service.HuiqiyunInputRecordService;
|
|
@@ -459,6 +460,79 @@ public class GigThirdApiController {
|
|
|
return gigThirdApiService.lingcaiaiNotify(channel, batchNo, Integer.valueOf(orderStatus));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 易马企服异步通知回调
|
|
|
+ *
|
|
|
+ * 接口用于接收批量订单创建结果通知和下发结果通知。
|
|
|
+ * 请注意回调请求头默认的”Content-Type”: “application/octet-stream”
|
|
|
+ * 企业需要给我方响应。通知超时时间10秒,如果没有收到正确响应视为通知失败,失败后重试3次,每次间隔10分钟。
|
|
|
+ *
|
|
|
+ * @param body 请求body
|
|
|
+ * @param headers 请求头
|
|
|
+ */
|
|
|
+ @Inner(value = false)
|
|
|
+ @SysLog("易马企服异步通知回调")
|
|
|
+ @PostMapping("/yima")
|
|
|
+ public Map<String, Object> yimaRequest(@RequestBody String body, @RequestHeader HttpHeaders headers) {
|
|
|
+
|
|
|
+ log.info("易马企服请求方法参数:body={}, headers={}", body, headers);
|
|
|
+
|
|
|
+ // 签名
|
|
|
+ String signature = Objects.requireNonNull(headers.get("signature")).get(0);
|
|
|
+ // 通知类型(order_check_result_notify:订单校验结果通知,order_call_back_notification:订单下发回调通知,task_redispatch_notification:单笔重试回调通知)
|
|
|
+ String actionName = Objects.requireNonNull(headers.get("action_name")).get(0);
|
|
|
+
|
|
|
+ // 请求body json
|
|
|
+ JSONObject bodyJson = JSONUtil.parseObj(body);
|
|
|
+ Integer orderStatus = bodyJson.getInt("order_status");
|
|
|
+ String orderUuid = bodyJson.getStr("order_uuid");
|
|
|
+ String orderNo = bodyJson.getStr("order_no");
|
|
|
+ String customerUserUuid = bodyJson.getStr("customer_user_uuid");
|
|
|
+ String serverUserUuid = bodyJson.getStr("server_user_uuid");
|
|
|
+
|
|
|
+ Map<String, Object> successResult = new HashMap<>();
|
|
|
+ if (!StrUtil.isAllNotBlank(signature, actionName, orderNo) || orderStatus == null) {
|
|
|
+ log.warn("必传参数为空");
|
|
|
+ successResult.put("resp_code", 400);
|
|
|
+ successResult.put("resp_message", "必传参数为空");
|
|
|
+ successResult.put("success", "false");
|
|
|
+ return successResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ String redisKey = String.format("%s_%s_%s", CacheConstants.ZHEGN_QI_ZHI_XING_NOTIFY_KEY, actionName, orderNo);
|
|
|
+ Boolean absent = redisTemplate.opsForValue().setIfAbsent(redisKey, orderNo, 30, TimeUnit.MINUTES);
|
|
|
+ if (!absent) {
|
|
|
+ log.warn("存在在途操作orderNo={}", orderNo);
|
|
|
+ successResult.put("resp_code", 400);
|
|
|
+ successResult.put("resp_message", "存在在途操作");
|
|
|
+ successResult.put("success", "false");
|
|
|
+ return successResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 请求记录到数据库
|
|
|
+ XinbadaInputRecord xinbadaInputRecord = new XinbadaInputRecord();
|
|
|
+ xinbadaInputRecord.setActionName(actionName);
|
|
|
+ xinbadaInputRecord.setSignature(signature);
|
|
|
+ xinbadaInputRecord.setReqBody(body);
|
|
|
+ xinbadaInputRecord.setCreateTime(LocalDateTime.now());
|
|
|
+ // body中的部分字段
|
|
|
+ xinbadaInputRecord.setOrderStatus(orderStatus);
|
|
|
+ xinbadaInputRecord.setOrderUuid(orderUuid);
|
|
|
+ xinbadaInputRecord.setOrderNo(orderNo);
|
|
|
+ xinbadaInputRecord.setCustomerUserUuid(customerUserUuid);
|
|
|
+ xinbadaInputRecord.setServerUserUuid(serverUserUuid);
|
|
|
+ xinbadaInputRecord.setGigType(GigTypeEnum.YI_MA);
|
|
|
+ xinbadaInputRecordService.save(xinbadaInputRecord);
|
|
|
+
|
|
|
+ gigThirdApiService.xinbadaNotify(actionName, orderUuid, orderStatus);
|
|
|
+
|
|
|
+ successResult.put("resp_code", 200);
|
|
|
+ successResult.put("resp_message", "SUCCESS");
|
|
|
+ successResult.put("success", "true");
|
|
|
+
|
|
|
+ return successResult;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 正启之星异步通知回调
|
|
|
*
|
|
@@ -520,6 +594,7 @@ public class GigThirdApiController {
|
|
|
xinbadaInputRecord.setOrderNo(orderNo);
|
|
|
xinbadaInputRecord.setCustomerUserUuid(customerUserUuid);
|
|
|
xinbadaInputRecord.setServerUserUuid(serverUserUuid);
|
|
|
+ xinbadaInputRecord.setGigType(GigTypeEnum.ZHENG_QI_ZHI_XING);
|
|
|
xinbadaInputRecordService.save(xinbadaInputRecord);
|
|
|
|
|
|
gigThirdApiService.xinbadaNotify(actionName, orderUuid, orderStatus);
|