| | |
| | | private RedPackegeSetService redPackegeSetService; |
| | | //获取当前生效的红包设置 |
| | | @ResponseBody |
| | | @GetMapping("/get") |
| | | @PostMapping("/get") |
| | | public R<BigDecimal> get(){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | RedPackegeSet one = redPackegeSetService.lambdaQuery().le(RedPackegeSet::getStartTime, now).ge(RedPackegeSet::getEndTime, now).one(); |
| | |
| | | @PostMapping("/addRedPackegeSet") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R<Void> addRedPackegeSet(@RequestBody RedPackegeSetDto redPackegeSets){ |
| | | redPackegeSetService.remove(null); |
| | | List<RedPackegeSet> redPackegeSetList = redPackegeSets.getRedPackegeSets(); |
| | | if (hasOverlap(redPackegeSetList)) { |
| | | R.fail("时间段存在重叠,请重新配置"); |
| | | return R.fail("时间段存在重叠,请重新配置"); |
| | | } |
| | | redPackegeSetService.remove(null); |
| | | redPackegeSetService.saveBatch(redPackegeSetList); |
| | | return R.ok(); |
| | | } |