|
|
@@ -9,9 +9,12 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+import cn.hutool.system.UserInfo;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hpsf.Decimal;
|
|
|
import org.jeecg.annotation.ApiLogin;
|
|
|
import org.jeecg.com.util.ThirdSessionHolder;
|
|
|
@@ -37,7 +40,10 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import org.jeecg.modules.business.service.IBusMarketCouponsService;
|
|
|
import org.jeecg.modules.business.service.IBusMarketCouponsUsedService;
|
|
|
+import org.jeecg.modules.mall.entity.MallUserInfo;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.wxuser.service.IUserInfoService;
|
|
|
+import org.jeecg.modules.wxuser.service.impl.UserInfoServiceImpl;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
@@ -68,6 +74,8 @@ public class CouponsCashUsedController extends WebConfig {
|
|
|
private IBusMarketCouponsService busMarketCouponsService;
|
|
|
@Resource
|
|
|
private IBusMarketCouponsCashService busMarketCouponsCashService;
|
|
|
+ @Resource
|
|
|
+ private IUserInfoService userInfoService;
|
|
|
/**
|
|
|
* 获取我的可用优惠券分页列表查询
|
|
|
*
|
|
|
@@ -87,22 +95,26 @@ private IBusMarketCouponsCashService busMarketCouponsCashService;
|
|
|
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 -> {
|
|
|
- BusMarketCouponsCash coupons = busMarketCouponsCashService.getById(item.getCouponsId());
|
|
|
- if (coupons != null) {
|
|
|
- item.setBusMarketCouponsCash(coupons);
|
|
|
- }
|
|
|
- CouponsStatusEnum couponsStatusEnum = CouponsStatusEnum.val(item.getStatus());
|
|
|
- if (couponsStatusEnum != null) {
|
|
|
- item.setStatusName(couponsStatusEnum.getTitle());
|
|
|
- }
|
|
|
- });
|
|
|
- return Result.OK(pageList);
|
|
|
+ MallUserInfo mallUserInfo = userInfoService.getById(userId);
|
|
|
+ if (StringUtils.isNotBlank(mallUserInfo.getMobile())) {
|
|
|
+ LambdaQueryWrapper<BusMarketCouponsCashUsed> queryWrapper = QueryGenerator.initQueryWrapper(busMarketCouponsCashUsed, req.getParameterMap()).lambda();
|
|
|
+ queryWrapper.eq(BusMarketCouponsCashUsed::getMobile, mallUserInfo.getMobile());
|
|
|
+ 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 -> {
|
|
|
+ BusMarketCouponsCash coupons = busMarketCouponsCashService.getById(item.getCouponsId());
|
|
|
+ if (coupons != null) {
|
|
|
+ item.setBusMarketCouponsCash(coupons);
|
|
|
+ }
|
|
|
+ CouponsStatusEnum couponsStatusEnum = CouponsStatusEnum.val(item.getStatus());
|
|
|
+ if (couponsStatusEnum != null) {
|
|
|
+ item.setStatusName(couponsStatusEnum.getTitle());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+ return Result.OK(null);
|
|
|
}
|
|
|
}
|