{"id":91346,"date":"2026-08-07T18:25:22","date_gmt":"2026-08-07T10:25:22","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/91346.html"},"modified":"2026-08-07T18:25:22","modified_gmt":"2026-08-07T10:25:22","slug":"%e5%a4%a7%e8%90%a5%e9%94%80%e5%b9%b3%e5%8f%b0-%e7%bb%86%e8%8a%82%e4%bc%98%e5%8c%96%e5%92%8c%e5%89%8d%e7%ab%af%e5%af%b9%e6%8e%a5","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/91346.html","title":{"rendered":"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5"},"content":{"rendered":"<h2>\u4e00\u3001\u524d\u8a00<\/h2>\n<p>\u81f3\u6b64&#xff0c;\u6d3b\u52a8\u9886\u57df\u5c31\u57fa\u672c\u4e0a\u5b8c\u6210\u4e86&#xff0c;\u540e\u7eed\u8fd8\u6709\u4e00\u4e2a\u7528\u6237\u8fd4\u5229\u548c\u7ed3\u7b97&#xff0c;\u8fd9\u4e2a\u5728\u4e0b\u4e00\u8282\u5b9e\u73b0&#xff0c;\u8fd9\u4e00\u8282\u5148\u5bf9\u524d\u9762\u5199\u7684\u6d3b\u52a8\u9886\u57df\u548c\u7b56\u7565\u9886\u57df\u8fdb\u884c\u4f18\u5316&#xff0c;\u8c03\u6574\u4e00\u4e9b\u7ec6\u8282\u95ee\u9898&#xff0c;\u5e76\u4e14\u8865\u5145\u4e00\u90e8\u5206\u5185\u5bb9\u3002<\/p>\n<p>\u6700\u540e\u5bf9\u63a5\u524d\u7aef&#xff0c;\u524d\u540e\u7aef\u8054\u8c03\u3002<\/p>\n<\/p>\n<h2>\u4e8c\u3001\u7ec6\u8282\u4f18\u5316<\/h2>\n<h3>1.Redis\u7f16\u7801\u95ee\u9898<\/h3>\n<p>\u524d\u9762\u6211\u4eec\u5728Redis\u4e2d\u5b58\u50a8\u7684\u503c\u90fd\u662f\u5e8f\u5217\u5316\u540e\u7684\u4e71\u7801&#xff0c;\u6211\u4eec\u8fd8\u662f\u5e0c\u671b\u5b83\u53ef\u4ee5\u7528JSON\u683c\u5f0f\u5b58\u50a8&#xff0c;\u8fd9\u6837\u65e2\u65b9\u4fbf\u6211\u4eec\u8c03\u8bd5&#xff0c;\u4e5f\u4fbf\u4e8e\u8fd0\u7ef4\u3002<\/p>\n<p>\u5728Redis\u914d\u7f6e\u7c7b\u4e2d\u89e3\u5f00\u89e3\u7801\u5668\u7684\u6ce8\u91ca&#xff0c;\u8fd9\u6837\u5c31\u53ef\u4ee5\u53d8\u6210JSON\u683c\u5f0f\u4e86\u3002\u6ce8\u610f&#xff0c;\u5fc5\u987b\u662f\u7528\u6211\u8fd9\u4e2a\u89e3\u7801\u5668&#xff0c;\u90a3\u4e2a RedisCodec() \u6709\u95ee\u9898&#xff0c;\u4e0d\u4f1a\u81ea\u52a8\u628a\u6570\u7ec4\u4e2d\u7684\u5bf9\u8c61\u683c\u5f0f\u5316&#xff0c;\u751a\u81f3\u8fde\u6570\u7ec4\u4e2d\u7684map\u5bf9\u8c61\u90fd\u4e0d\u884c&#xff0c;\u6211\u7528\u8fd9\u4e2a\u51fa\u4e86\u5f88\u591a\u95ee\u9898&#xff0c;\u4e00\u76f4\u62a5NPE&#xff0c;AI\u90fd\u6ca1\u627e\u51fa\u6765\u8fd9\u4e2a\u95ee\u9898&#xff0c;\u6700\u540e\u662f\u6211\u4eb2\u81ea\u6253\u4e86\u65e0\u6570\u4e2a\u65ad\u70b9\u624d\u627e\u51fa\u6765\u7684\u3002<\/p>\n<p>config.setCodec(new JsonJacksonCodec());<\/p>\n<p>&#064;Bean(&#034;redissonClient&#034;)<br \/>\n    public RedissonClient redissonClient(ConfigurableApplicationContext applicationContext, RedisClientConfigProperties properties) {<br \/>\n        Config config &#061; new Config();<br \/>\n        \/\/ \u6839\u636e\u9700\u8981\u53ef\u4ee5\u8bbe\u5b9a\u7f16\u89e3\u7801\u5668&#xff1b;https:\/\/github.com\/redisson\/redisson\/wiki\/4.-%E6%95%B0%E6%8D%AE%E5%BA%8F%E5%88%97%E5%8C%96<br \/>\n        config.setCodec(new new JsonJacksonCodec());<\/p>\n<p>        config.useSingleServer()<br \/>\n                .setAddress(&#034;redis:\/\/&#034; &#043; properties.getHost() &#043; &#034;:&#034; &#043; properties.getPort())<br \/>\n                .setPassword(properties.getPassword())<br \/>\n                .setConnectionPoolSize(properties.getPoolSize())<br \/>\n                .setConnectionMinimumIdleSize(properties.getMinIdleSize())<br \/>\n                .setIdleConnectionTimeout(properties.getIdleTimeout())<br \/>\n                .setConnectTimeout(properties.getConnectTimeout())<br \/>\n                .setRetryAttempts(properties.getRetryAttempts())<br \/>\n                .setRetryInterval(properties.getRetryInterval())<br \/>\n                .setPingConnectionInterval(properties.getPingInterval())<br \/>\n                .setKeepAlive(properties.isKeepAlive())<br \/>\n                .setDatabase(properties.getDatabase())<br \/>\n        ;<\/p>\n<p>        return Redisson.create(config);<br \/>\n    }<\/p>\n<p>\u540e\u7eed\u6d4b\u8bd5\u4f1a\u53d1\u73b0\u53ef\u80fd\u4f1a\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898&#xff1a;<\/p>\n<p>java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.bigmarket.domain.strategy.model.entity.StrategyAwardEntity<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u662f\u7531\u4e8efastjson\u9ed8\u8ba4\u4e0d\u4f1a\u5c06\u5b58\u5165Redis\u7684\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u6309\u7167&#064;type\u6807\u8bb0\u7684\u7c7b\u6765\u89e3\u6790&#xff0c;\u800c\u662f\u4f1a\u76f4\u63a5\u89e3\u6790\u4e3a\u4e00\u4e2a\u666e\u901a\u7684JSONObject&#xff0c;\u8fd9\u5c31\u5bfc\u81f4\u89e3\u6790\u51fa\u6765\u7684\u5bf9\u8c61\u65e0\u6cd5\u8f6c\u6362\u4e3a\u6211\u4eec\u9700\u8981\u7684\u5b9e\u4f53\u7c7b\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\u662f\u4fee\u6539\u914d\u7f6e\u7c7b\u4e0b\u9762\u7684\u89e3\u7801\u5668&#xff0c;\u589e\u52a0\u53c2\u6570Feature.SupportAutoType&#xff0c;\u8fd9\u6837\u5c31\u5f3a\u5236\u8ba9fastjson\u53bb\u81ea\u52a8\u89e3\u6790\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u4e86\u3002<\/p>\n<p>  private final Decoder&lt;Object&gt; decoder &#061; (buf, state) -&gt;<br \/>\n                JSON.parseObject(new ByteBufInputStream(buf), Object.class, Feature.SupportAutoType);<\/p>\n<h3 style=\"background-color:transparent\">2.\u6d3b\u52a8\u7ed3\u675f\u540e\u6e05\u7406\u7f13\u5b58<\/h3>\n<p>\u76ee\u524d\u6211\u4eec\u7684\u7f13\u5b58\u5168\u90e8\u662f\u6301\u4e45\u5316\u7684&#xff0c;\u6ca1\u6709\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4&#xff0c;\u8fd9\u5c31\u5bfc\u81f4\u5373\u4f7f\u6d3b\u52a8\u90fd\u5df2\u7ecf\u7ed3\u675f\u4e86&#xff0c;\u4f46\u662f\u8fd9\u4e2a\u8fc7\u671f\u6d3b\u52a8\u7684\u7f13\u5b58\u8fd8\u5b58\u5728Redis\u91cc\u9762\u5360\u5730\u65b9&#xff0c;\u6240\u4ee5\u6211\u4eec\u5e94\u5f53\u5c06\u7b56\u7565\u90e8\u5206\u7684\u952e\u503c\u5bf9&#xff08;sku\u5e93\u5b58\u548c\u5956\u54c1\u5e93\u5b58&#xff09;\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u81f3\u6d3b\u52a8\u7ed3\u675f&#xff0c;\u57fa\u4e8e\u5b89\u5168\u6027\u8003\u8651&#xff0c;\u6211\u4eec\u4f1a\u591a\u5ef6\u957f\u4e00\u5929&#xff0c;\u4e5f\u5c31\u662f\u5728\u6d3b\u52a8\u7ed3\u675f\u540e\u4e00\u5929\u6e05\u7406\u3002<\/p>\n<p>\u65e2\u7136\u662f\u5728\u6d3b\u52a8\u7ed3\u675f\u540e\u4e00\u5929\u6e05\u7406&#xff0c;\u90a3\u5fc5\u7136\u8981\u5148\u77e5\u9053\u6d3b\u52a8\u591a\u4e45\u7ed3\u675f&#xff0c;\u524d\u9762\u6211\u4eec\u5728\u5199\u7b56\u7565\u65f6\u6ca1\u6709\u8003\u8651\u5230\u8fd9\u4e00\u70b9&#xff0c;\u56e0\u6b64\u73b0\u5728\u8981\u5c06endDateTime\u4f5c\u4e3a\u53c2\u6570\u900f\u4f20\u8fdb\u53bb\u3002<\/p>\n<p>\u4e8e\u662f\u8981\u4fee\u6539\u62bd\u5956\u56e0\u5b50\u5b9e\u4f53\u7c7b&#xff1a;<\/p>\n<p>RaffleAwardEntity raffleAwardEntity &#061; raffleStrategy.performRaffle(raffleFactorEntity);<\/p>\n<p>\/**<br \/>\n * &#064;author \u5370\u4e1c\u5347<br \/>\n * &#064;description \u62bd\u5956\u56e0\u5b50\u5b9e\u4f53<br \/>\n * &#064;create 2026-04-10 11:12<br \/>\n *\/<br \/>\n&#064;Data<br \/>\n&#064;Builder<br \/>\n&#064;AllArgsConstructor<br \/>\n&#064;NoArgsConstructor<br \/>\npublic class RaffleFactorEntity {<br \/>\n    \/**<br \/>\n     * \u7528\u6237id<br \/>\n     *\/<br \/>\n    private String userId;<br \/>\n    \/**<br \/>\n     * \u7b56\u7565id<br \/>\n     *\/<br \/>\n    private Long strategyId;<br \/>\n    \/**<br \/>\n     * \u7ed3\u675f\u65f6\u95f4<br \/>\n     *\/<br \/>\n    private Date endDateTime;<br \/>\n}<\/p>\n<p>\u81ea\u7136\u7684&#xff0c;\u6574\u4e2a\u8c03\u7528\u94fe\u4ece\u4e0a\u5c42\u7684\u6d3b\u52a8Controller\u5230\u6a21\u677f\u7c7b\u4e2d\u7684performRaffle&#xff0c;\u518d\u5230\u89c4\u5219\u6811\u7684\u6263\u51cf\u5e93\u5b58\u8282\u70b9&#xff0c;\u6700\u540e\u5728\u4ed3\u50a8\u4e2d\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4\u3002\u8fd9\u6574\u4e2a\u8c03\u7528\u94fe\u5f88\u590d\u6742&#xff0c;\u57fa\u672c\u4e0a\u8981\u4ece\u6d3b\u52a8\u5230\u62bd\u5956\u5168\u90e8\u900f\u4f20\u4e00\u904d\u3002<\/p>\n<p>&#064;Override<br \/>\n    public Boolean subtractionAwardStock(String cacheKey, Date endDateTime) {<br \/>\n        long surplus &#061; redisService.decr(cacheKey);<br \/>\n        if (surplus &lt; 0) {<br \/>\n            redisService.setValue(cacheKey, 0);<br \/>\n            return false;<br \/>\n        }<br \/>\n        String lockKey &#061; cacheKey &#043; Constants.UNDERLINE &#043; surplus;<\/p>\n<p>        Boolean lock &#061; false;<br \/>\n        if (null !&#061; endDateTime) {<br \/>\n            long expireMills &#061; endDateTime.getTime() &#8211; System.currentTimeMillis() &#043; TimeUnit.DAYS.toMillis(1);<br \/>\n            lock &#061; redisService.setNx(lockKey, expireMills, TimeUnit.MILLISECONDS);<br \/>\n        } else {<br \/>\n            lock &#061; redisService.setNx(lockKey);<br \/>\n        }<\/p>\n<p>        if (!lock) {<br \/>\n            log.info(&#034;\u7b56\u7565\u5956\u54c1\u5e93\u5b58\u52a0\u9501\u5931\u8d25&#xff1a;{}&#034;, lockKey);<br \/>\n        }<br \/>\n        return lock;<\/p>\n<p>    }<\/p>\n<p>\u800csku\u7684\u5e93\u5b58\u7f13\u5b58\u6211\u4eec\u524d\u9762\u5df2\u7ecf\u5199\u4e86&#xff0c;\u4e0a\u9762\u8fd9\u4e2a\u548csku\u7684\u57fa\u672c\u4e0a\u7c7b\u4f3c\u3002<\/p>\n<p>\u8fd9\u91cc\u5176\u5b9e\u8fd8\u53ef\u4ee5\u4f18\u5316&#xff0c;\u6240\u6709\u7684\u5bf9\u5e94\u6d3b\u52a8\u7684\u7f13\u5b58\u5176\u5b9e\u90fd\u53ef\u4ee5\u6e05\u7406&#xff0c;\u4f46\u662f\u9664\u53bbsku\u5e93\u5b58\u9501\u548caward\u5e93\u5b58\u9501&#xff0c;\u5176\u4f59\u7684\u5269\u4e0b\u7684\u5e76\u4e0d\u591a&#xff0c;\u53ea\u6709\u5956\u54c1\u5217\u8868\u3001\u89c4\u5219\u6811\u3001\u6d3b\u52a8\u4fe1\u606f\u7b49\u7f13\u5b58&#xff0c;\u6700\u591a\u4e5f\u5c31\u5341\u6765\u4e2a&#xff0c;\u4f46\u662f\u8fd9\u4e24\u4e2a\u5e93\u5b58\u9501\u57fa\u672c\u4e0a\u548c\u5e93\u5b58\u91cf\u76f8\u5f53&#xff0c;\u6240\u4ee5\u8fd9\u91cc\u53ea\u6e05\u7406\u5e93\u5b58\u9501\u7f13\u5b58\u4e5f\u662f\u6ca1\u95ee\u9898\u7684\u3002<\/p>\n<\/p>\n<h3 style=\"background-color:transparent\">3.\u6b21\u6570\u9501\u663e\u793a\u4f18\u5316<\/h3>\n<p>\u524d\u9762\u6211\u4eec\u914d\u7f6e\u4e86\u5956\u54c1\u7684\u6b21\u6570\u9501\u89c4\u5219&#xff0c;\u8fd9\u91cc\u6211\u4eec\u5c31\u9700\u8981\u628a\u8fd9\u4e2a\u9501\u663e\u793a\u7ed9\u7528\u6237\u4e86&#xff0c;\u56e0\u6b64\u6211\u4eec\u9700\u8981\u544a\u8bc9\u7528\u6237\u8fd8\u6709\u591a\u5c11\u6b21\u8fd9\u4e2a\u5956\u54c1\u5c31\u80fd\u89e3\u9501&#xff0c;\u5e76\u4e14\u8981\u8ba9\u7528\u6237\u77e5\u9053\u8fd9\u4e2a\u5956\u54c1\u89e3\u9501\u6ca1\u6709\u3002<\/p>\n<p>\u4ece\u4e0a\u5411\u4e0b\u6539&#xff0c;\u9996\u5148\u54cd\u5e94\u7ed9\u524d\u7aef\u7684DTO\u4e2d\u5c31\u8981\u65b0\u589e\u4e09\u4e2a\u6b21\u6570\u9501\u76f8\u5173\u7684\u5b57\u6bb5&#xff1a;<\/p>\n<p>&#064;Data<br \/>\n&#064;Builder<br \/>\n&#064;NoArgsConstructor<br \/>\n&#064;AllArgsConstructor<br \/>\npublic class RaffleAwardListResponseDTO {<br \/>\n    \/\/\u5956\u54c1Id<br \/>\n    private Integer awardId;<br \/>\n    \/\/\u5956\u54c1\u6807\u9898<br \/>\n    private String awardTitle;<br \/>\n    \/\/\u5956\u54c1\u526f\u6807\u9898\u3010\u62bd\u59561\u6b21\u540e\u89e3\u9501\u3011<br \/>\n    private String awardSubtitle;<br \/>\n    \/\/\u6392\u5e8f\u7f16\u53f7<br \/>\n    private Integer sort;<br \/>\n    \/\/\u5956\u54c1\u6b21\u6570\u89c4\u5219 &#8211; \u62bd\u5956N\u6b21\u540e\u89e3\u9501&#xff0c;\u672a\u914d\u7f6e\u5219\u4e3a\u7a7a<br \/>\n    private Integer awardRuleLockCount;<br \/>\n    \/\/\u5956\u54c1\u662f\u5426\u89e3\u9501<br \/>\n    private Boolean isAwardUnlock;<br \/>\n    \/\/\u7b49\u5f85\u89e3\u9501\u6b21\u6570-\u89c4\u5219\u7684\u62bd\u5956N\u6b21\u89e3\u9501 &#8211; \u7528\u6237\u5df2\u7ecf\u62bd\u5956\u6b21\u6570<br \/>\n    private Integer waitUnlockCount;<br \/>\n}<\/p>\n<p>\u7531\u6b64\u6211\u4eec\u4e5f\u9700\u8981\u4fee\u6539\u5956\u54c1\u5217\u8868\u7684Controller\u63a5\u53e3&#xff1a;<\/p>\n<p>\/**<br \/>\n     * \u67e5\u8be2\u5956\u54c1\u5217\u8868<br \/>\n     * &lt;a href&#061;&#034;http:\/\/localhost:8091\/api\/v1\/raffle\/query_raffle_award_list&#034;&gt;\/api\/v1\/raffle\/query_raffle_award_list&lt;\/a&gt;<br \/>\n     * \u8bf7\u6c42\u53c2\u6570 raw json<br \/>\n     *<br \/>\n     * &#064;param request {&#034;strategyId&#034;:1000001}<br \/>\n     * &#064;return \u5956\u54c1\u5217\u8868<br \/>\n     *\/<br \/>\n    &#064;RequestMapping(value &#061; &#034;query_raffle_award_list&#034;, method &#061; RequestMethod.POST)<br \/>\n    &#064;Override<br \/>\n    public Response&lt;List&lt;RaffleAwardListResponseDTO&gt;&gt; queryRaffleAwardList(&#064;RequestBody RaffleAwardListRequestDTO request) {<br \/>\n        try {<br \/>\n            log.info(&#034;\u67e5\u8be2\u62bd\u5956\u5956\u54c1\u5217\u8868\u914d\u7f6e\u5f00\u59cb userId:{} activityId:{}&#034;, request.getUserId(), request.getActivityId());<br \/>\n            \/\/1.\u53c2\u6570\u6821\u9a8c<br \/>\n            if (StrUtil.isBlank(request.getUserId()) || null &#061;&#061; request.getActivityId()) {<br \/>\n                return Response.&lt;List&lt;RaffleAwardListResponseDTO&gt;&gt;builder()<br \/>\n                        .code(ResponseCode.ILLEGAL_PARAMETER.getCode())<br \/>\n                        .info(ResponseCode.ILLEGAL_PARAMETER.getInfo())<br \/>\n                        .build();<br \/>\n            }<\/p>\n<p>            \/\/2.\u67e5\u8be2\u5956\u54c1\u914d\u7f6e<br \/>\n            List&lt;StrategyAwardEntity&gt; strategyAwardEntities &#061; raffleAward.queryRaffleStrategyAwardListByActivityId(request.getActivityId());<br \/>\n            \/\/3.\u83b7\u53d6\u89c4\u5219\u914d\u7f6e<br \/>\n            String[] treeIds &#061; strategyAwardEntities.stream()<br \/>\n                    .map(StrategyAwardEntity::getRuleModels)<br \/>\n                    .filter(ruleModel -&gt; ruleModel !&#061; null &amp;&amp; !ruleModel.isEmpty())<br \/>\n                    .toArray(String[]::new);<\/p>\n<p>            \/\/4.\u67e5\u8be2\u89c4\u5219\u914d\u7f6e&#xff0c;\u83b7\u53d6\u5956\u54c1\u7684\u89e3\u9501\u89c4\u5219&#xff0c;\u62bd\u5956N\u6b21\u540e\u89e3\u9501<br \/>\n            Map&lt;String, Integer&gt; ruleLockCountMap &#061; raffleRule.queryAwardRuleLockCount(treeIds);<br \/>\n            \/\/5.\u67e5\u8be2\u62bd\u5956\u6b21\u6570 &#8211; \u7528\u6237\u5df2\u7ecf\u53c2\u4e0e\u62bd\u5956\u7684\u6b21\u6570<br \/>\n            Integer dayPartakeCount &#061; raffleActivityAccountQuotaService.queryRaffleActivityAccountDayPartakeCount(request.getActivityId(), request.getUserId());<\/p>\n<p>            \/\/6.\u904d\u5386\u586b\u5145\u6570\u636e<br \/>\n            List&lt;RaffleAwardListResponseDTO&gt; raffleAwardListResponseDTOS &#061; new ArrayList&lt;&gt;(strategyAwardEntities.size());<br \/>\n            for (StrategyAwardEntity strategyAward : strategyAwardEntities) {<br \/>\n                Integer awardRuleLockCount &#061; ruleLockCountMap.get(strategyAward.getRuleModels());<br \/>\n                raffleAwardListResponseDTOS.add(RaffleAwardListResponseDTO.builder()<br \/>\n                        .awardId(strategyAward.getAwardId())<br \/>\n                        .awardTitle(strategyAward.getAwardTitle())<br \/>\n                        .awardSubtitle(strategyAward.getAwardSubtitle())<br \/>\n                        .sort(strategyAward.getSort())<br \/>\n                        .awardRuleLockCount(awardRuleLockCount)<br \/>\n                        .isAwardUnlock(null &#061;&#061; awardRuleLockCount || dayPartakeCount &gt; awardRuleLockCount)<br \/>\n                        .waitUnlockCount(null &#061;&#061; awardRuleLockCount || awardRuleLockCount &lt;&#061; dayPartakeCount ? 0 : awardRuleLockCount &#8211; dayPartakeCount)<br \/>\n                        .build());<br \/>\n            }<br \/>\n            Response&lt;List&lt;RaffleAwardListResponseDTO&gt;&gt; response &#061; Response.&lt;List&lt;RaffleAwardListResponseDTO&gt;&gt;builder()<br \/>\n                    .code(ResponseCode.SUCCESS.getCode())<br \/>\n                    .info(ResponseCode.SUCCESS.getInfo())<br \/>\n                    .data(raffleAwardListResponseDTOS)<br \/>\n                    .build();<br \/>\n            log.info(&#034;\u67e5\u8be2\u62bd\u5956\u5956\u54c1\u5217\u8868\u914d\u7f6e\u5b8c\u6210 userId:{} activityId:{}&#034;, request.getUserId(), request.getActivityId());<br \/>\n            return response;<\/p>\n<p>        } catch (Exception e) {<br \/>\n            log.error(&#034;\u67e5\u8be2\u62bd\u5956\u5956\u54c1\u5217\u8868\u914d\u7f6e\u5931\u8d25 userId:{} activityId:{}&#034;, request.getUserId(), request.getActivityId(),e);<br \/>\n            return Response.&lt;List&lt;RaffleAwardListResponseDTO&gt;&gt;builder()<br \/>\n                    .code(ResponseCode.UN_ERROR.getCode())<br \/>\n                    .info(ResponseCode.UN_ERROR.getInfo())<br \/>\n                    .build();<br \/>\n        }<br \/>\n    }<\/p>\n<p>\u5176\u4e2d\u4e3b\u8981\u65b0\u589e\u7684\u662f\u4e0b\u9762\u8fd9\u6bb5\u903b\u8f91&#xff0c;\u672c\u8d28\u662f\u901a\u8fc7\u67e5\u8be2\u89c4\u5219\u914d\u7f6e&#xff0c;\u7b5b\u9009\u51fa\u6240\u6709\u6709\u6b21\u6570\u9501\u89c4\u5219\u7684\u5956\u54c1&#xff0c;\u7136\u540e\u6839\u636e\u914d\u7f6e\u7684\u9501\u6b21\u6570\u548c\u5f53\u65e5\u7528\u6237\u7684\u62bd\u5956\u6b21\u6570\u6765\u5224\u65ad\u662f\u5426\u89e3\u9501&#xff0c;\u6216\u8005\u8fd8\u6709\u51e0\u6b21\u89e3\u9501\u3002\u6ce8\u610f\u8fd9\u91cc\u6211\u4eec\u7684\u8bbe\u5b9a\u662f\u8fd9\u51e0\u4e2a\u5956\u54c1\u7684\u6b21\u6570\u9501\u6bcf\u65e5\u5237\u65b0&#xff0c;\u7528\u6237\u6bcf\u5929\u90fd\u8981\u62bd\u4e00\u5b9a\u6b21\u6570\u624d\u80fd\u91cd\u65b0\u89e3\u9501\u3002<\/p>\n<p>            \/\/2.\u67e5\u8be2\u5956\u54c1\u914d\u7f6e<br \/>\n            List&lt;StrategyAwardEntity&gt; strategyAwardEntities &#061; raffleAward.queryRaffleStrategyAwardListByActivityId(request.getActivityId());<br \/>\n            \/\/3.\u83b7\u53d6\u89c4\u5219\u914d\u7f6e<br \/>\n            String[] treeIds &#061; strategyAwardEntities.stream()<br \/>\n                    .map(StrategyAwardEntity::getRuleModels)<br \/>\n                    .filter(ruleModel -&gt; ruleModel !&#061; null &amp;&amp; !ruleModel.isEmpty())<br \/>\n                    .toArray(String[]::new);<\/p>\n<p>            \/\/4.\u67e5\u8be2\u89c4\u5219\u914d\u7f6e&#xff0c;\u83b7\u53d6\u5956\u54c1\u7684\u89e3\u9501\u89c4\u5219&#xff0c;\u62bd\u5956N\u6b21\u540e\u89e3\u9501<br \/>\n            Map&lt;String, Integer&gt; ruleLockCountMap &#061; raffleRule.queryAwardRuleLockCount(treeIds);<br \/>\n            \/\/5.\u67e5\u8be2\u62bd\u5956\u6b21\u6570 &#8211; \u7528\u6237\u5df2\u7ecf\u53c2\u4e0e\u62bd\u5956\u7684\u6b21\u6570<br \/>\n            Integer dayPartakeCount &#061; raffleActivityAccountQuotaService.queryRaffleActivityAccountDayPartakeCount(request.getActivityId(), request.getUserId());<\/p>\n<h2>\u4e09\u3001\u524d\u7aef\u5bf9\u63a5<\/h2>\n<p>http:\/\/localhost:3000\/?userId&#061;xiaofuge&#038;activityId&#061;100301<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1454\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260807102518-6a75b28e8bdc1.png\" width=\"2556\" \/><\/p>\n<p>\u7f13\u5b58\u4e2d\u4e5f\u751f\u6210\u4e86\u76f8\u5e94\u7684\u9501&#xff0c;\u5e76\u4e14\u6709\u8fc7\u671f\u65f6\u95f4\u4e86&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1522\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260807102520-6a75b29046f6c.png\" width=\"2557\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u524d\u8a00\u81f3\u6b64&#xff0c;\u6d3b\u52a8\u9886\u57df\u5c31\u57fa\u672c\u4e0a\u5b8c\u6210\u4e86&#xff0c;\u540e\u7eed\u8fd8\u6709\u4e00\u4e2a\u7528\u6237\u8fd4\u5229\u548c\u7ed3\u7b97&#xff0c;\u8fd9\u4e2a\u5728\u4e0b\u4e00\u8282\u5b9e\u73b0&#xff0c;\u8fd9\u4e00\u8282\u5148\u5bf9\u524d\u9762\u5199\u7684\u6d3b\u52a8\u9886\u57df\u548c\u7b56\u7565\u9886\u57df\u8fdb\u884c\u4f18\u5316&#xff0c;\u8c03\u6574\u4e00\u4e9b\u7ec6\u8282\u95ee\u9898&#xff0c;\u5e76\u4e14\u8865\u5145\u4e00\u90e8\u5206\u5185\u5bb9\u3002\u6700\u540e\u5bf9\u63a5\u524d\u7aef&#xff0c;\u524d\u540e\u7aef\u8054\u8c03\u3002\u4e8c\u3001\u7ec6\u8282\u4f18\u53161.Redis\u7f16\u7801\u95ee\u9898\u524d\u9762\u6211\u4eec\u5728Redis\u4e2d\u5b58\u50a8\u7684\u503c\u90fd\u662f\u5e8f\u5217\u5316\u540e\u7684\u4e71\u7801&#xff0c;\u6211\u4eec\u8fd8\u662f\u5e0c\u671b\u5b83\u53ef\u4ee5\u7528JSON\u683c\u5f0f\u5b58\u50a8&#xff0c;\u8fd9\u6837\u65e2\u65b9\u4fbf\u6211\u4eec\u8c03\u8bd5&#xff0c;\u4e5f\u4fbf<\/p>\n","protected":false},"author":2,"featured_media":91344,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7199,99,1271],"topic":[],"class_list":["post-91346","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-ddd","tag-java","tag-springboot"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/91346.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u524d\u8a00\u81f3\u6b64&#xff0c;\u6d3b\u52a8\u9886\u57df\u5c31\u57fa\u672c\u4e0a\u5b8c\u6210\u4e86&#xff0c;\u540e\u7eed\u8fd8\u6709\u4e00\u4e2a\u7528\u6237\u8fd4\u5229\u548c\u7ed3\u7b97&#xff0c;\u8fd9\u4e2a\u5728\u4e0b\u4e00\u8282\u5b9e\u73b0&#xff0c;\u8fd9\u4e00\u8282\u5148\u5bf9\u524d\u9762\u5199\u7684\u6d3b\u52a8\u9886\u57df\u548c\u7b56\u7565\u9886\u57df\u8fdb\u884c\u4f18\u5316&#xff0c;\u8c03\u6574\u4e00\u4e9b\u7ec6\u8282\u95ee\u9898&#xff0c;\u5e76\u4e14\u8865\u5145\u4e00\u90e8\u5206\u5185\u5bb9\u3002\u6700\u540e\u5bf9\u63a5\u524d\u7aef&#xff0c;\u524d\u540e\u7aef\u8054\u8c03\u3002\u4e8c\u3001\u7ec6\u8282\u4f18\u53161.Redis\u7f16\u7801\u95ee\u9898\u524d\u9762\u6211\u4eec\u5728Redis\u4e2d\u5b58\u50a8\u7684\u503c\u90fd\u662f\u5e8f\u5217\u5316\u540e\u7684\u4e71\u7801&#xff0c;\u6211\u4eec\u8fd8\u662f\u5e0c\u671b\u5b83\u53ef\u4ee5\u7528JSON\u683c\u5f0f\u5b58\u50a8&#xff0c;\u8fd9\u6837\u65e2\u65b9\u4fbf\u6211\u4eec\u8c03\u8bd5&#xff0c;\u4e5f\u4fbf\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/91346.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-07T10:25:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260807102518-6a75b28e8bdc1.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91346.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/91346.html\",\"name\":\"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-07T10:25:22+00:00\",\"dateModified\":\"2026-08-07T10:25:22+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/91346.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/91346.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/91346.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/91346.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u524d\u8a00\u81f3\u6b64&#xff0c;\u6d3b\u52a8\u9886\u57df\u5c31\u57fa\u672c\u4e0a\u5b8c\u6210\u4e86&#xff0c;\u540e\u7eed\u8fd8\u6709\u4e00\u4e2a\u7528\u6237\u8fd4\u5229\u548c\u7ed3\u7b97&#xff0c;\u8fd9\u4e2a\u5728\u4e0b\u4e00\u8282\u5b9e\u73b0&#xff0c;\u8fd9\u4e00\u8282\u5148\u5bf9\u524d\u9762\u5199\u7684\u6d3b\u52a8\u9886\u57df\u548c\u7b56\u7565\u9886\u57df\u8fdb\u884c\u4f18\u5316&#xff0c;\u8c03\u6574\u4e00\u4e9b\u7ec6\u8282\u95ee\u9898&#xff0c;\u5e76\u4e14\u8865\u5145\u4e00\u90e8\u5206\u5185\u5bb9\u3002\u6700\u540e\u5bf9\u63a5\u524d\u7aef&#xff0c;\u524d\u540e\u7aef\u8054\u8c03\u3002\u4e8c\u3001\u7ec6\u8282\u4f18\u53161.Redis\u7f16\u7801\u95ee\u9898\u524d\u9762\u6211\u4eec\u5728Redis\u4e2d\u5b58\u50a8\u7684\u503c\u90fd\u662f\u5e8f\u5217\u5316\u540e\u7684\u4e71\u7801&#xff0c;\u6211\u4eec\u8fd8\u662f\u5e0c\u671b\u5b83\u53ef\u4ee5\u7528JSON\u683c\u5f0f\u5b58\u50a8&#xff0c;\u8fd9\u6837\u65e2\u65b9\u4fbf\u6211\u4eec\u8c03\u8bd5&#xff0c;\u4e5f\u4fbf","og_url":"https:\/\/www.wsisp.com\/helps\/91346.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-07T10:25:22+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/08\/20260807102518-6a75b28e8bdc1.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/91346.html","url":"https:\/\/www.wsisp.com\/helps\/91346.html","name":"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-07T10:25:22+00:00","dateModified":"2026-08-07T10:25:22+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/91346.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/91346.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/91346.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5927\u8425\u9500\u5e73\u53f0 \u2014\u2014 \u7ec6\u8282\u4f18\u5316\u548c\u524d\u7aef\u5bf9\u63a5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=91346"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/91346\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/91344"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=91346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=91346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=91346"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=91346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}