更新9.27

This commit is contained in:
许允枞 2024-09-27 10:34:28 +08:00
parent 1969b5c0db
commit 721d954017
5 changed files with 82 additions and 14 deletions

View File

@ -1,7 +1,8 @@
package com.fuint.business.marketingActivity.cardCoupon.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
@ -9,18 +10,23 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardGiftActive.entity.CardGiftActive;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.StringUtils;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/**
* 油站优惠卷表2024(CardCoupon)表控制层
@ -37,6 +43,9 @@ public class CardCouponController extends BaseController {
@Resource
private CardCouponService cardCouponService;
@Autowired
private OilNameService OilNameService;
/**
* 分页查询所有数据
*
@ -68,6 +77,36 @@ public class CardCouponController extends BaseController {
List<String> list = Arrays.asList(array);
cardCoupon.setProductIdList(list);
}
String oilNumber = cardCoupon.getOilNumber();
List<String> hxList = new ArrayList<>();
//判断是否可以与其他优惠券使用
if (ObjectUtil.isNotEmpty(cardCoupon.getUseWithOther())){
if ("1".equals(cardCoupon.getUseWithOther())){
hxList.add("可以与其他优惠券一起使用");
}else {
hxList.add("不可与其他优惠券一起使用");
}
}
//以逗号隔开
if (StrUtil.isNotEmpty(oilNumber)) {
String[] split = oilNumber.split(",");
List<String> list = Arrays.asList(split);
//转成integer集合
List<Integer> ids = list.stream().map(Integer::parseInt).collect(Collectors.toList());
List<OilName> oilNames = OilNameService.selectOilNameList(ids);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("以下油品油号可用:");
for (int i = 0; i < oilNames.size(); i++) {
if (i < oilNames.size() - 1) {
stringBuilder.append(oilNames.get(i).getOilName()).append("");
} else {
stringBuilder.append(oilNames.get(i).getOilName());
}
}
hxList.add(stringBuilder.toString());
}
cardCoupon.setHxList(hxList);
//获取支付方式
return getSuccessResult(cardCoupon);
}
@ -138,6 +177,7 @@ public class CardCouponController extends BaseController {
/**
* 上下架
*
* @param id
* @return
*/
@ -148,6 +188,7 @@ public class CardCouponController extends BaseController {
/**
* 分页查询可领取优惠券uniapp使用
*
* @param pageNo
* @param pageSize
* @param cardCoupon

View File

@ -141,6 +141,8 @@ public class CardCoupon extends Model<CardCoupon> {
private Integer giftCardTotal;
@TableField(exist = false)
private List<String> productIdList;
@TableField(exist = false)
private List<String> hxList;
}

View File

@ -16,6 +16,7 @@ import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapp
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponUniVo;
import com.fuint.business.marketingActivity.cardCoupon.vo.CardCouponVO;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.mapper.OilNameMapper;
import com.fuint.business.store.entity.MtStore;
import com.fuint.business.store.mapper.MtStoreMapper;
@ -133,7 +134,10 @@ public class CardCouponServiceImpl extends ServiceImpl<CardCouponMapper, CardCou
if (StrUtil.isNotEmpty(oilNumber)) {
String[] split = oilNumber.split(",");
List<String> list = Arrays.asList(split);
// list.stream().forEach(item -> {Integer.parseInt(item)});
//转成integer集合
List<Integer> ids = list.stream().map(Integer::parseInt).collect(Collectors.toList());
List<OilName> oilNames = oilNameMapper.selectList(new LambdaQueryWrapper<OilName>()
.in(OilName::getId, ids));
}
return null;
}

View File

@ -32,6 +32,13 @@ public interface OilNameService extends IService<OilName> {
*/
public OilName selectOilNameById(int id);
/**
* 根据ids查询油号信息
* @param ids
* @return
*/
public List<OilName> selectOilNameList(List<Integer> ids);
/**
* 根据油品名称查询油号信息
* @param oilName

View File

@ -2,6 +2,7 @@ package com.fuint.business.petrolStationManagement.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -45,6 +46,19 @@ public class OilNameServiceImpl extends ServiceImpl<OilNameMapper, OilName> impl
return oilName;
}
/**
* 根据ids查询油号信息
*
* @param ids
* @return
*/
@Override
public List<OilName> selectOilNameList(List<Integer> ids) {
List<OilName> oilNames = baseMapper.selectList(new LambdaQueryWrapper<OilName>()
.in(OilName::getId, ids));
return oilNames;
}
@Override
public OilName selectOilNameByOilName(String oilName) {
QueryWrapper queryWrapper = new QueryWrapper<>();