| | |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponPointStatisVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@Validated @RequestBody CreateCouponTemplatePointDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponTemplatePointDTO dto) { |
| | | // 信息校验 |
| | | dto.setId(id); |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/batch/expire") |
| | | @PostMapping("/batch/expire") |
| | | @ApiOperation(value = "批量下架", notes = "批量下架") |
| | | public ResponseEntity<ReturnDataDTO> expireBatch(BatchCouponTemplateDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> expireBatch(@RequestBody BatchCouponTemplateDTO dto) { |
| | | |
| | | |
| | | couponTemplateService.expireBatchCouponTemplate(dto); |
| | |
| | | |
| | | |
| | | |
| | | @PutMapping("/batch/active") |
| | | @PostMapping("/batch/active") |
| | | @ApiOperation(value = "批量发布", notes = "批量发布") |
| | | public ResponseEntity<ReturnDataDTO> activeBatch(BatchCouponTemplateDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> activeBatch(@RequestBody BatchCouponTemplateDTO dto) { |
| | | |
| | | couponTemplateService.activeBatchCouponTemplate(dto); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @DeleteMapping("/batch/del") |
| | | @PostMapping("/batch/del") |
| | | @ApiOperation(value = "批量删除", notes = "批量删除") |
| | | public ResponseEntity<ReturnDataDTO> deleteBatch(BatchCouponTemplateDTO dto) { |
| | | public ResponseEntity<ReturnDataDTO> deleteBatch(@RequestBody BatchCouponTemplateDTO dto) { |
| | | |
| | | couponTemplateService.deleteBatchCouponTemplate(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | |
| | | public ResponseEntity<ReturnDataDTO> statistics(QueryCouponStatisticsDTO dto) { |
| | | QueryCouponStatisticsBO queryCouponStatisticsBO=new QueryCouponStatisticsBO(); |
| | | BeanUtils.copyProperties(dto,queryCouponStatisticsBO); |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.statisCouponTemplatePoint(queryCouponStatisticsBO); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplatePointVO.class)); |
| | | CouponPointStatisVO vo = couponTemplateService.statisCouponTemplatePoint(queryCouponStatisticsBO); |
| | | return returnData(R.SUCCESS.getCode(), vo); |
| | | } |
| | | |
| | | @GetMapping("/active/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> activelist() { |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> activeList(QueryActivePointCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | QueryCouponDTO dto=new QueryCouponDTO(); |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplatePointVO.class)); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getPointList(dto), CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/active/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> activePage(Page page, QueryActivePointCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPointPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplatePointDTO dto){ |
| | | |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/exchange") |
| | | @ApiOperation(value = "小程序-积分优惠券兑换", notes = "小程序-积分优惠券兑换") |
| | | public ResponseEntity<ReturnDataDTO> exchangeCoupon(@Validated @RequestBody ExchangeCouponDTO dto) { |
| | | couponTemplateService.exchangeCoupon(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | } |