Przeglądaj źródła

feat: 薪事易结算回调todo

lixuesong 1 rok temu
rodzic
commit
e3f643e8d3

+ 15 - 2
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/GigThirdApiController.java

@@ -95,9 +95,22 @@ public class GigThirdApiController {
 	@SysLog("薪事易结算异步通知回调")
 	@PostMapping("/xinshiyi/pay-notify")
 	public String xinShiYiSettleNotifyRequest(@RequestBody String body, @RequestHeader HttpHeaders headers) {
-		log.info("福建企赋结算请求方法参数:body={}, headers={}", body, headers);
+		log.info("薪事易结算请求方法参数:body={}, headers={}", body, headers);
+
+		// 请求body json
+		JSONObject bodyJson = JSONUtil.parseObj(body);
+
+		// 批次号
+		String batchId = bodyJson.getStr("batchId");
+
+		String redisKey = String.format("%s_%s", CacheConstants.QI_FU_SETTLE_NOTIFY_KEY, batchId);
+		Boolean absent = redisTemplate.opsForValue().setIfAbsent(redisKey, batchId, 30, TimeUnit.MINUTES);
+		if (Boolean.FALSE.equals(absent)) {
+			log.warn("存在在途操作batchId={}", batchId);
+			return "fail";
+		}
 
-		return "OK";
+		return "ok";
 	}
 
 	/**