|
|
@@ -0,0 +1,112 @@
|
|
|
+package org.jeecg.modules.bus.controller;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.constraints.DecimalMin;
|
|
|
+
|
|
|
+import annotation.ApiLogin;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
+import com.fasterxml.jackson.annotation.JsonFormat;
|
|
|
+import com.util.ThirdSessionHolder;
|
|
|
+import config.WebConfig;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.poi.hpsf.Decimal;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.util.TenantContextHolder;
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.business.dto.CouponsGenerateDto;
|
|
|
+import org.jeecg.modules.business.dto.PostDataDto;
|
|
|
+import org.jeecg.modules.business.dto.ProvideCouponsUsedDto;
|
|
|
+import org.jeecg.modules.business.entity.BusMarketCoupons;
|
|
|
+import org.jeecg.modules.business.entity.BusMarketCouponsCashUsed;
|
|
|
+import org.jeecg.modules.business.entity.BusMarketCouponsUsed;
|
|
|
+import org.jeecg.modules.business.entity.BusMarketMealCouponsUsed;
|
|
|
+import org.jeecg.modules.business.enums.CouponsStatusEnum;
|
|
|
+import org.jeecg.modules.business.service.IBusMarketCouponsCashUsedService;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.jeecg.modules.business.service.IBusMarketCouponsService;
|
|
|
+import org.jeecg.modules.business.service.IBusMarketCouponsUsedService;
|
|
|
+import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
+import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
+import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
|
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
|
|
|
+import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
+
|
|
|
+
|
|
|
+@Api(tags="优惠券")
|
|
|
+@RestController
|
|
|
+@AllArgsConstructor
|
|
|
+@RequestMapping("/mall-api/coupons-cash-used")
|
|
|
+@Slf4j
|
|
|
+public class CouponsCashUsedController extends WebConfig {
|
|
|
+ @Resource
|
|
|
+ private IBusMarketCouponsCashUsedService busMarketCouponsCashUsedService;
|
|
|
+ @Resource
|
|
|
+ private IBusMarketCouponsService busMarketCouponsService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取我的可用优惠券分页列表查询
|
|
|
+ *
|
|
|
+ * @param busMarketCouponsCashUsed
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取我的优惠券分页列表查询", notes = "获取我的优惠券分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ @ApiLogin
|
|
|
+ public Result<IPage<BusMarketCouponsCashUsed>> queryPageList(BusMarketCouponsCashUsed busMarketCouponsCashUsed,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ String tenantId = TenantContextHolder.getTenantId();
|
|
|
+ String userId = ThirdSessionHolder.getUserId();
|
|
|
+ LambdaQueryWrapper<BusMarketCouponsCashUsed> queryWrapper = QueryGenerator.initQueryWrapper(busMarketCouponsCashUsed, req.getParameterMap()).lambda();
|
|
|
+ queryWrapper.eq(BusMarketCouponsCashUsed::getUserid, userId);
|
|
|
+ queryWrapper.eq(BusMarketCouponsCashUsed::getTenantId, tenantId);
|
|
|
+ queryWrapper.eq(BusMarketCouponsCashUsed::getStatus, 1);
|
|
|
+ Page<BusMarketCouponsCashUsed> page = new Page<BusMarketCouponsCashUsed>(pageNo, pageSize);
|
|
|
+ IPage<BusMarketCouponsCashUsed> pageList = busMarketCouponsCashUsedService.page(page, queryWrapper);
|
|
|
+ pageList.getRecords().forEach(item -> {
|
|
|
+ BusMarketCoupons coupons = busMarketCouponsService.getById(item.getCouponsId());
|
|
|
+ if (coupons != null) {
|
|
|
+ item.setConponsName(coupons.getName());
|
|
|
+ }
|
|
|
+ CouponsStatusEnum couponsStatusEnum = CouponsStatusEnum.val(item.getStatus());
|
|
|
+ if (couponsStatusEnum != null) {
|
|
|
+ item.setStatusName(couponsStatusEnum.getTitle());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+}
|