diff --git a/mallinkCallback/src/main/java/com/iformall/controller/callback/car/WxParkCallBackBaseController.java b/mallinkCallback/src/main/java/com/iformall/controller/callback/car/WxParkCallBackBaseController.java index 3747d80ea..790b6b45e 100644 --- a/mallinkCallback/src/main/java/com/iformall/controller/callback/car/WxParkCallBackBaseController.java +++ b/mallinkCallback/src/main/java/com/iformall/controller/callback/car/WxParkCallBackBaseController.java @@ -16,9 +16,6 @@ import com.iformall.exception.MallinkException; import com.iformall.service.*; import com.iformall.service.park.ParkFactory; import com.iformall.service.park.entity.ParkNotifyParam; -import com.iformall.service.park.impl.cyf.CYFUtil; -import com.iformall.service.park.impl.etcp.ETCPUtil; -import com.iformall.service.park.impl.tjd.TJDUtil; import com.iformall.service.park.utils.ParkCacheUtils; import com.iformall.utils.DateUtils; import com.iformall.utils.RedisCacheUtils; @@ -30,17 +27,11 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.RedisTemplate; -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 java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; @RestController public class WxParkCallBackBaseController extends BaseController { @@ -184,9 +175,15 @@ public class WxParkCallBackBaseController extends BaseController { if (null == param) { return new Result(); } + // 回调去重 + String key = "callback:" + param.getCarNumber(); + if (RedisCacheUtils.hasKey(redisTemplate, key)) { + logger.info("回调数据重复=========>{}", JSON.toJSONString(sourceParam)); + return new Result(); + } + RedisCacheUtils.cache(redisTemplate, key, "", 60 * 2); String carNumber = param.getCarNumber(); - ParkCacheUtils.removeCache(redisTemplate, vendor.getMessage(), carNumber); ParkCacheUtils.setCarCouponUnUseCacheLock(redisTemplate, vendor.getMessage(), carNumber); diff --git a/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java b/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java index d4a3f31e7..351c502fa 100644 --- a/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java +++ b/mallinkService/src/main/java/com/iformall/utils/RedisCacheUtils.java @@ -169,4 +169,8 @@ public class RedisCacheUtils { Set keys = template.keys(prefix+"*"); template.delete(keys); } + + public static Boolean hasKey(RedisTemplate template,String key) { + return template.hasKey(key); + } }