|
@@ -2,12 +2,22 @@ package org.springblade.modules.ldt.mall.controller;
|
|
|
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.common.constant.SystemConstant;
|
|
import org.springblade.common.constant.SystemConstant;
|
|
|
|
|
+import org.springblade.core.mp.support.Condition;
|
|
|
|
|
+import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.tool.api.R;
|
|
import org.springblade.core.tool.api.R;
|
|
|
|
|
+import org.springblade.modules.ldt.activity.dto.ActivityDTO;
|
|
|
|
|
+import org.springblade.modules.ldt.activity.entity.Activity;
|
|
|
|
|
+import org.springblade.modules.ldt.activity.service.IActivityService;
|
|
|
|
|
+import org.springblade.modules.ldt.activityjoinrecord.entity.ActivityJoinRecord;
|
|
|
|
|
+import org.springblade.modules.ldt.activityjoinrecord.service.IActivityJoinRecordService;
|
|
|
import org.springblade.modules.ldt.billrecord.entity.BillRecord;
|
|
import org.springblade.modules.ldt.billrecord.entity.BillRecord;
|
|
|
import org.springblade.modules.ldt.billrecord.service.IBillRecordService;
|
|
import org.springblade.modules.ldt.billrecord.service.IBillRecordService;
|
|
|
import org.springblade.modules.ldt.mall.entity.Mall;
|
|
import org.springblade.modules.ldt.mall.entity.Mall;
|
|
@@ -38,7 +48,7 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("cyzh-ldt/app/mall")
|
|
@RequestMapping("cyzh-ldt/app/mall")
|
|
|
-@Api(value = "", tags = "商场管理app接口")
|
|
|
|
|
|
|
+@Api(value = "商场app接口", tags = "商场app接口")
|
|
|
public class AppMallController {
|
|
public class AppMallController {
|
|
|
|
|
|
|
|
private final IMallService mallService;
|
|
private final IMallService mallService;
|
|
@@ -47,6 +57,8 @@ public class AppMallController {
|
|
|
private final IShopService shopService;
|
|
private final IShopService shopService;
|
|
|
private final IMemberService memberService;
|
|
private final IMemberService memberService;
|
|
|
private final IBillRecordService billRecordService;
|
|
private final IBillRecordService billRecordService;
|
|
|
|
|
+ private final IActivityService activityService;
|
|
|
|
|
+ private final IActivityJoinRecordService activityJoinRecordService;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 通过手机获取商场信息
|
|
* 通过手机获取商场信息
|
|
@@ -195,9 +207,72 @@ public class AppMallController {
|
|
|
Assert.notNull(mall.getConsumeOnePoint(),"每消费一元赠送的积分数不能为空");
|
|
Assert.notNull(mall.getConsumeOnePoint(),"每消费一元赠送的积分数不能为空");
|
|
|
oldEntity.setPoint(mall.getPoint());
|
|
oldEntity.setPoint(mall.getPoint());
|
|
|
oldEntity.setPointValue(mall.getPointValue());
|
|
oldEntity.setPointValue(mall.getPointValue());
|
|
|
|
|
+ oldEntity.setConsumeOnePoint(mall.getConsumeOnePoint());
|
|
|
oldEntity.setIsOpenMember(SystemConstant.WHETHER.YES.getValue());
|
|
oldEntity.setIsOpenMember(SystemConstant.WHETHER.YES.getValue());
|
|
|
return R.status(mallService.updateById(oldEntity));
|
|
return R.status(mallService.updateById(oldEntity));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过商场id获取商场详情
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param mallId
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/getById")
|
|
|
|
|
+ @ApiOperation(value = "通过商场id获取商场详情", notes = "传入商场id")
|
|
|
|
|
+ public R<Mall> getById(@RequestParam Long mallId) {
|
|
|
|
|
+ return R.data(this.mallService.getById(mallId));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过商场id获取会员列表
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/getMembersByMallId")
|
|
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
|
|
+ @ApiOperation(value = "分页", notes = "传入member")
|
|
|
|
|
+ public R<IPage<Member>> getMembersByMallId(Member member, Query query) {
|
|
|
|
|
+ Assert.notNull(member.getMallId(),"商场id不能为空");
|
|
|
|
|
+ IPage<Member> pages = memberService.page(Condition.getPage(query), new QueryWrapper<>(new Member()).lambda()
|
|
|
|
|
+ .eq(Member::getMallId,member.getMallId()).eq(Member::getType,SystemConstant.MALLORSHOP.MALL.getValue())
|
|
|
|
|
+ .orderByDesc(Member::getPointValue));
|
|
|
|
|
+ return R.data(pages);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 通过商场id获取活动信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/getActivity")
|
|
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
|
|
+ @ApiOperation(value = "通过商场id获取活动信息", notes = "传入member")
|
|
|
|
|
+ public R<IPage<Activity>> getMembersByMallId(ActivityDTO activityDTO, Query query) {
|
|
|
|
|
+ Assert.notNull(activityDTO.getSelectType() == null,"查询类型字段不能为空");
|
|
|
|
|
+ Assert.notNull(activityDTO.getMallId(),"商场id不能为空");
|
|
|
|
|
+ IPage<Activity> pages = null;
|
|
|
|
|
+ if(activityDTO.getSelectType() == 1){//查询该商场发起的活动
|
|
|
|
|
+ pages = activityService.page(Condition.getPage(query), new QueryWrapper<>(new Activity()).lambda()
|
|
|
|
|
+ .eq(Activity::getSponsorType,SystemConstant.MALLORSHOP.MALL.getValue()).eq(Activity::getSponsorId,activityDTO.getMallId())
|
|
|
|
|
+ .orderByDesc(Activity::getCreateTime));
|
|
|
|
|
+ }else if(activityDTO.getSelectType() == 2){//可以参加的活动
|
|
|
|
|
+ //获取该商场下所有商户发布的活动
|
|
|
|
|
+ pages = this.activityService.getCanJoinActicityByMallId(Condition.getPage(query),activityDTO.getMallId());
|
|
|
|
|
+
|
|
|
|
|
+ }else if(activityDTO.getSelectType() == 3){//已参加的活动
|
|
|
|
|
+ //从活动参加记录表中获取
|
|
|
|
|
+ List<ActivityJoinRecord> activityJoinRecords = activityJoinRecordService.getBaseMapper().selectList(new QueryWrapper<>(new ActivityJoinRecord()).lambda()
|
|
|
|
|
+ .eq(ActivityJoinRecord::getJoinId, activityDTO.getSponsorId()).eq(ActivityJoinRecord::getJoinType, SystemConstant.MALLORSHOP.MALL.getValue()));
|
|
|
|
|
+ pages = new Page<>();
|
|
|
|
|
+ pages.setCurrent(query.getCurrent());
|
|
|
|
|
+ pages.setSize(query.getSize());
|
|
|
|
|
+ pages.setTotal(activityJoinRecords.size());
|
|
|
|
|
+ List<Long> activityIds = activityJoinRecords.stream().map(ActivityJoinRecord::getActivityId).collect(Collectors.toList());
|
|
|
|
|
+ activityIds = activityIds.subList((query.getCurrent()-1) * 10, query.getCurrent() * query.getSize());
|
|
|
|
|
+ List<Activity> activities = this.activityService.getBaseMapper().selectList(new QueryWrapper<>(new Activity())
|
|
|
|
|
+ .lambda().in(Activity::getId,activityIds));
|
|
|
|
|
+ pages.setRecords(activities);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return R.data(pages);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|