| | |
| | | package com.matrix.system.activity.action; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.system.activity.dto.ActivitiesListDto; |
| | | import com.matrix.system.activity.dto.AddSignAwardSetDto; |
| | | import com.matrix.system.activity.dto.BeCloseDto; |
| | | import com.matrix.system.activity.dto.BeReadyDto; |
| | | import com.matrix.system.activity.dto.DelRowDto; |
| | | import com.matrix.core.tools.WebUtil; |
| | | import com.matrix.system.activity.dto.*; |
| | | import com.matrix.system.activity.service.ActivitySignAwardSetService; |
| | | import com.matrix.system.activity.vo.ActivitiesListVo; |
| | | import com.matrix.system.activity.vo.CouponVo; |
| | | import com.matrix.system.activity.vo.GoodsVo; |
| | | import com.matrix.system.activity.vo.SignReceiveListVo; |
| | | import com.matrix.system.common.bean.SysUsers; |
| | | import com.matrix.system.hive.action.util.QueryUtil; |
| | | import com.matrix.system.shopXcx.bean.ShopActivities; |
| | | import com.matrix.system.shopXcx.dao.ShopActivitiesDao; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @description 奖品设置表 |
| | |
| | | |
| | | @Autowired |
| | | private ActivitySignAwardSetService activitySignAwardSetService; |
| | | @Autowired |
| | | private ShopActivitiesDao shopActivitiesDao; |
| | | |
| | | /** |
| | | * 马上创建签到活动 |
| | | */ |
| | | @PostMapping(value = "/createSignAwardSet") |
| | | public @ResponseBody |
| | | AjaxResult createSignAwardSet() { |
| | | //获取当前登录人员信息 |
| | | SysUsers user = WebUtil.getSessionAttribute(MatrixConstance.LOGIN_KEY); |
| | | Long companyId = user.getCompanyId(); |
| | | //签到活动的唯一性 |
| | | List<ShopActivities> shopActivitiesDone = shopActivitiesDao.selectOneByCompanyIdAndActType(companyId,ShopActivities.ACTIVITIES_TYPE_SIGN); |
| | | if(CollUtil.isNotEmpty(shopActivitiesDone)){ |
| | | return new AjaxResult(AjaxResult.STATUS_FAIL, "签到活动已经创建,请去活动管理菜单查看"); |
| | | } |
| | | return new AjaxResult(AjaxResult.STATUS_SUCCESS, ""); |
| | | } |
| | | |
| | | /** |
| | | * 新增签到活动 |
| | |
| | | public @ResponseBody |
| | | AjaxResult addSignAwardSet(@RequestBody AddSignAwardSetDto addSignAwardSetDto) { |
| | | return activitySignAwardSetService.activitySignAwardSetService(addSignAwardSetDto); |
| | | } |
| | | |
| | | /** |
| | | * 查询优惠券 |
| | | */ |
| | | @ApiOperation(value = "查询优惠券") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "OK", response = CouponVo.class) |
| | | }) |
| | | @PostMapping(value = "/selectCouponList") |
| | | public @ResponseBody |
| | | AjaxResult selectCouponList(@RequestBody CouponDto couponDto) { |
| | | //设置用户公司ID |
| | | QueryUtil.setQueryLimitCom(couponDto); |
| | | //排序 |
| | | if(StringUtils.isBlank(couponDto.getSort())){ |
| | | couponDto.setSort("create_time"); |
| | | couponDto.setOrder("desc"); |
| | | } |
| | | Page<CouponVo> page = new Page(couponDto.getPageNum(), couponDto.getPageSize()); |
| | | IPage<CouponVo> rows = activitySignAwardSetService.selectCouponList(page,couponDto); |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 查询商品 |
| | | */ |
| | | @ApiOperation(value = "查询商品") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "OK", response = GoodsVo.class) |
| | | }) |
| | | @PostMapping(value = "/selectGoodsList") |
| | | public @ResponseBody |
| | | AjaxResult selectGoodsList(@RequestBody GoodsDto goodsDto) { |
| | | //设置用户公司ID |
| | | QueryUtil.setQueryLimitCom(goodsDto); |
| | | //排序 |
| | | if(StringUtils.isBlank(goodsDto.getSort())){ |
| | | goodsDto.setSort("create_time"); |
| | | goodsDto.setOrder("desc"); |
| | | } |
| | | Page<GoodsVo> page = new Page(goodsDto.getPageNum(), goodsDto.getPageSize()); |
| | | IPage<GoodsVo> rows = activitySignAwardSetService.selectGoodsList(page,goodsDto); |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | |
| | | AjaxResult beClose(@RequestBody BeCloseDto beCloseDto) { |
| | | return activitySignAwardSetService.beClose(beCloseDto); |
| | | } |
| | | |
| | | /** |
| | | * 活动统计 |
| | | */ |
| | | @ApiOperation(value = "活动统计") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "OK", response = SignReceiveListVo.class) |
| | | }) |
| | | @PostMapping(value = "/findSignReceiveList") |
| | | public @ResponseBody |
| | | AjaxResult findSignReceiveList(@RequestBody SignReceiveListDto signReceiveListDto) { |
| | | //设置用户公司ID |
| | | QueryUtil.setQueryLimitCom(signReceiveListDto); |
| | | //排序 |
| | | if(StringUtils.isBlank(signReceiveListDto.getSort())){ |
| | | signReceiveListDto.setSort("create_time"); |
| | | signReceiveListDto.setOrder("desc"); |
| | | } |
| | | Page<SignReceiveListVo> page = new Page(signReceiveListDto.getPageNum(), signReceiveListDto.getPageSize()); |
| | | IPage<SignReceiveListVo> rows = activitySignAwardSetService.findSignReceiveList(page,signReceiveListDto); |
| | | AjaxResult result = AjaxResult.buildSuccessInstance(rows.getRecords(),rows.getTotal()); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | *进入修改 |
| | | */ |
| | | @ApiOperation(value = "进入修改") |
| | | @PostMapping(value = "/findSignForUpdate") |
| | | public @ResponseBody |
| | | AjaxResult findSignForUpdate(@RequestBody SignForUpdateDto signForUpdateDto) { |
| | | return activitySignAwardSetService.findSignForUpdate(signForUpdateDto); |
| | | } |
| | | |
| | | /** |
| | | * 保存 |
| | | */ |
| | | @PostMapping(value = "/updateSignAwardSet") |
| | | public @ResponseBody |
| | | AjaxResult updateSignAwardSet(@RequestBody UpdateSignAwardSetDto updateSignAwardSetDto) { |
| | | return activitySignAwardSetService.updateSignAwardSet(updateSignAwardSetDto); |
| | | } |
| | | |
| | | |
| | | |