| @@ -49,13 +49,16 @@ public interface TtCouponService { | |||||
| @Async | @Async | ||||
| void collectCoupon(TenantEntity tenantEntity,Long memberId, Long id); | void collectCoupon(TenantEntity tenantEntity,Long memberId, Long id); | ||||
| void cancelCollect(Long memberId, Long id); | void cancelCollect(Long memberId, Long id); | ||||
| int getcollect(Long memberId, Long id); | |||||
| @Async | @Async | ||||
| void followMerchant(TenantEntity tenantEntity, Long memberId, Long id); | void followMerchant(TenantEntity tenantEntity, Long memberId, Long id); | ||||
| void cancelFollow(Long memberId, Long id); | void cancelFollow(Long memberId, Long id); | ||||
| int getfollow(Long memberId, Long id); | |||||
| ResultData auditPass(Long id); | ResultData auditPass(Long id); | ||||
| ResultData auditRejected(Long id); | ResultData auditRejected(Long id); | ||||
| } | } | ||||
| @@ -207,6 +207,14 @@ public class TtCouponServiceImpl implements TtCouponService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public int getcollect(Long memberId, Long id) { | |||||
| TtUserCollect userCollect = new TtUserCollect(); | |||||
| userCollect.setUserId(memberId); | |||||
| userCollect.setCouponId(id); | |||||
| return ttUserCollectMapper.selectCount(new QueryWrapper<>(userCollect)); | |||||
| } | |||||
| @Override | @Override | ||||
| public void followMerchant(TenantEntity tenantEntity, Long memberId, Long id) { | public void followMerchant(TenantEntity tenantEntity, Long memberId, Long id) { | ||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| @@ -232,6 +240,14 @@ public class TtCouponServiceImpl implements TtCouponService { | |||||
| int delete = ttUserFollowMapper.delete(new QueryWrapper<>(userFollow)); | int delete = ttUserFollowMapper.delete(new QueryWrapper<>(userFollow)); | ||||
| } | } | ||||
| @Override | |||||
| public int getfollow(Long memberId, Long id) { | |||||
| TtUserFollow userFollow = new TtUserFollow(); | |||||
| userFollow.setUserId(memberId); | |||||
| userFollow.setMerchernId(id); | |||||
| return ttUserFollowMapper.selectCount(new QueryWrapper<>(userFollow)); | |||||
| } | |||||
| @Override | @Override | ||||
| public ResultData auditPass(Long id) { | public ResultData auditPass(Long id) { | ||||
| TtCoupon byId = this.getById(id); | TtCoupon byId = this.getById(id); | ||||
| @@ -53,6 +53,29 @@ public class TtCouponController extends BaseController { | |||||
| return new ResultData(ttCouponService.detail(id)); | return new ResultData(ttCouponService.detail(id)); | ||||
| } | } | ||||
| @ApiOperation("是否收藏") | |||||
| @GetMapping("/iscollect") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData iscollect(@RequestParam Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] TtCouponController::iscollect"); | |||||
| if (id == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| int count = ttCouponService.getcollect(memberId,id); | |||||
| if(count > 0){ | |||||
| return new ResultData(true); | |||||
| }else{ | |||||
| return new ResultData(false); | |||||
| } | |||||
| } | |||||
| @ApiOperation("收藏") | @ApiOperation("收藏") | ||||
| @GetMapping("/collectCoupon") | @GetMapping("/collectCoupon") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @@ -93,6 +116,28 @@ public class TtCouponController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation("是否关注") | |||||
| @GetMapping("/isfollow") | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData isfollow(@RequestParam Long id) { | |||||
| logger.debug("[" + getIpAddr() + "] TtCouponController::isfollow"); | |||||
| if (id == null) { | |||||
| return new ResultData(ResultData.ERROR, "缺少id"); | |||||
| } | |||||
| Long memberId; | |||||
| try { | |||||
| memberId = getMemberId(); | |||||
| } catch (MallinkException e) { | |||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | |||||
| } | |||||
| int count = ttCouponService.getfollow(memberId,id); | |||||
| if(count > 0){ | |||||
| return new ResultData(true); | |||||
| }else{ | |||||
| return new ResultData(false); | |||||
| } | |||||
| } | |||||
| @ApiOperation("关注") | @ApiOperation("关注") | ||||
| @GetMapping("/followMerchant") | @GetMapping("/followMerchant") | ||||