推荐有礼

This commit is contained in:
齐天大圣 2024-03-01 14:16:48 +08:00
parent 1fe8922e14
commit 223a1908f3
17 changed files with 149 additions and 7 deletions

View File

@ -111,14 +111,24 @@ public class ActiveConsumptionController extends BaseController {
return getSuccessResult(this.activeConsumptionService.removeByIds(ids));
}
/**
* 删除数据
* @param ids
* @return
*/
@DeleteMapping("delById/{ids}")
public ResponseObject delete(@PathVariable Long ids) {
return getSuccessResult(this.activeConsumptionService.removeById(ids));
}
/**
* 删除数据
* @param ids
* @return
*/
@DeleteMapping("del")
public ResponseObject del(@RequestParam("ids") List<Long> ids) {
return getSuccessResult(activeConsumptionChildService.removeByIds(ids));
public ResponseObject del(@RequestParam("ids") Long ids) {
return getSuccessResult(activeConsumptionChildService.removeById(ids));
}
/**

View File

@ -6,6 +6,8 @@ import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsu
import com.fuint.business.marketingActivity.activeConsumption.entity.ActiveConsumptionChild;
import com.fuint.business.marketingActivity.activeConsumption.mapper.ActiveConsumptionChildMapper;
import com.fuint.business.marketingActivity.activeConsumption.service.ActiveConsumptionChildService;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
import com.fuint.business.marketingActivity.cardExchange.service.CardExchangeRecordService;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableCountVO;
@ -31,6 +33,8 @@ public class ActiveConsumptionChildServiceImpl extends ServiceImpl<ActiveConsump
private ActiveConsumptionChildMapper activeConsumptionChildMapper;
@Resource
private CardFavorableRecordService cardFavorableRecordService;
@Resource
private CardExchangeRecordService cardExchangeRecordService;
@Override
public List<ActiveConsumptionChild> selectList(Serializable id) {
return activeConsumptionChildMapper.selectConsumptionChilds(id);
@ -72,6 +76,24 @@ public class ActiveConsumptionChildServiceImpl extends ServiceImpl<ActiveConsump
cardFavorableCountVO.setCount(favorableRecords.size());
cardFavorableCountVO.setCountEd(b);
cardFavorableCountVO.setCountLd(a);
// 查询兑换券领取记录
int as = 0;
int bs = 0;
LambdaQueryWrapper<CardExchangeRecord> queryWrappers = new LambdaQueryWrapper<>();
queryWrappers.eq(CardExchangeRecord::getActiveId, id);
queryWrappers.eq(CardExchangeRecord::getStoreId, nowAccountInfo.getStoreId());
List<CardExchangeRecord> list = cardExchangeRecordService.list(queryWrappers);
for (CardExchangeRecord cardExchangeRecord : list) {
if (cardExchangeRecord.getStatus().equals("0")){
as+=1;
}else {
bs+=1;
}
}
cardFavorableCountVO.setCounts(favorableRecords.size());
cardFavorableCountVO.setCountEds(b);
cardFavorableCountVO.setCountLds(a);
return cardFavorableCountVO;
}
}

View File

@ -197,9 +197,9 @@ public class ActiveConsumptionServiceImpl extends ServiceImpl<ActiveConsumptionM
queryWrapper.eq(ActiveConsumptionChild::getActiveConsumptionId,id);
queryWrapper.orderByDesc(ActiveConsumptionChild::getCreateTime);
List<ActiveConsumptionChild> activeConsumptionChildList = activeConsumptionChildService.list(queryWrapper);
BeanUtils.copyProperties(consumption,activeConsumptionVO);
if (CollectionUtils.isNotEmpty(activeConsumptionChildList)){
//封装VO返回
BeanUtils.copyProperties(consumption,activeConsumptionVO);
activeConsumptionVO.setParticipationConditionMoney(consumption.getParticipationConditionMoney().toString());
activeConsumptionVO.setDieselUserLevel(consumption.getDieselUserLevel().split(","));
activeConsumptionVO.setGasolineUserLevel(consumption.getGasolineUserLevel().split(","));

View File

@ -17,6 +17,7 @@ import com.fuint.business.marketingActivity.activeDiscount.service.ActiveDiscoun
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountAppletVO;
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountPayVO;
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.userManager.service.LJUserGradeService;
@ -134,6 +135,16 @@ public class ActiveDiscountServiceImpl extends ServiceImpl<ActiveDiscountMapper,
activeDiscountVO.setAdaptOil(Arrays.stream(s.getAdaptOil().split(","))
.map(Integer::valueOf)
.toArray(Integer[]::new));
String oilName = "";
for (Integer integer : activeDiscountVO.getAdaptOil()) {
OilName oilNames = oilNameService.selectOilNameById(integer);
oilName += oilNames.getOilType() + "-"+oilNames.getOilName() + ",";
}
if (oilName.endsWith(",")) { // 判断字符串是否以逗号结尾
oilName = oilName.substring(0, oilName.length() - 1); // 截取去除最后一个字符之前的子串
}
activeDiscountVO.setAdaptOilss(oilName);
//获取会员等级
String str = "";
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){

View File

@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class ActiveDiscountVO implements Serializable{
//主键id
@TableId(type = IdType.AUTO)
@ -27,6 +29,7 @@ public class ActiveDiscountVO implements Serializable{
private Date activeEndTime;
//适用油品092# 1: 95# 298# 30# 4-10# 5 LNG 6CNG 7京92# 8京95# 9京0#
private String[] adaptOils;
private String adaptOilss;
private Integer[] adaptOil;
//适用会员类型 0:全部用户 1全部会员 2等级会员
private String adaptUserType;

View File

@ -16,6 +16,7 @@ import com.fuint.business.marketingActivity.activeFullminus.entity.ActiveFullmin
import com.fuint.business.marketingActivity.activeFullminus.service.ActiveFullminusService;
import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusAppletVO;
import com.fuint.business.marketingActivity.activeFullminus.vo.ActiveFullminusVO;
import com.fuint.business.petrolStationManagement.entity.OilName;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.userManager.service.LJUserGradeService;
@ -129,6 +130,16 @@ public class ActiveFullminusServiceImpl extends ServiceImpl<ActiveFullminusMappe
activeFullminusVO.setAdaptOil(Arrays.stream(s.getAdaptOil().split(","))
.map(Integer::valueOf)
.toArray(Integer[]::new));
String oilName = "";
for (Integer integer : activeFullminusVO.getAdaptOil()) {
OilName oilNames = oilNameService.selectOilNameById(integer);
oilName += oilNames.getOilType() + "-"+oilNames.getOilName() + ",";
}
if (oilName.endsWith(",")) { // 判断字符串是否以逗号结尾
oilName = oilName.substring(0, oilName.length() - 1); // 截取去除最后一个字符之前的子串
}
activeFullminusVO.setAdaptOilss(oilName);
//获取会员等级
String str = "";
if (ObjectUtils.isNotEmpty(s.getDieselUserLevel())){

View File

@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
@Data
public class ActiveFullminusVO implements Serializable {
//主键id
@TableId(type = IdType.AUTO)
@ -27,6 +29,7 @@ public class ActiveFullminusVO implements Serializable {
private Date activeEndTime;
//适用油品092# 1: 95# 298# 30# 4-10# 5 LNG 6CNG 7京92# 8京95# 9京0#
private String[] adaptOils;
private String adaptOilss;
private Integer[] adaptOil;
//适用会员类型 0:全部用户 1全部会员 2等级会员
private String adaptUserType;

View File

@ -1,6 +1,7 @@
package com.fuint.business.marketingActivity.cardExchange.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.convenienceSore.service.StockStatisticService;
import com.fuint.business.marketingActivity.cardExchange.dto.CardExchangeRecordDTO;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchangeRecord;
@ -15,6 +16,7 @@ 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.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -42,6 +44,8 @@ public class CardExchangeRecordController extends BaseController {
private CardExchangeService cardExchangeService;
@Resource
private LJOrderService ljOrderService;
@Resource
private StockStatisticService stockStatisticService;
/**
* 分页查询所有数据
@ -123,20 +127,22 @@ public class CardExchangeRecordController extends BaseController {
LJStaff ljStaff = iljStaffService.selectStaffById(nowAccountInfo.getStaffId());
cardExchangeRecord.setRealName(ljStaff.getRealName());
cardExchangeRecord.setStaffMobile(ljStaff.getMobile());
Integer cardExchangeId = cardExchangeRecord.getCardExchangeId();
CardExchangeRecord byId = cardExchangeRecordService.getById(cardExchangeRecord.getId());
Integer cardExchangeId = byId.getCardExchangeId();
CardExchange cardExchange = cardExchangeService.getById(cardExchangeId);
Integer giftId = cardExchange.getGiftId();
LJOrder ljOrder = new LJOrder();
ljOrder.setTerminal("pc");
ljOrder.setPayUser(cardExchangeRecord.getMobile());
ljOrder.setPayUser(byId.getMobile());
ljOrder.setStoreId(nowAccountInfo.getStoreId());
ljOrder.setUserId(cardExchangeRecord.getMtUserId());
ljOrder.setUserId(byId.getMtUserId());
ljOrder.setGoodsNum(1);
ljOrder.setPayType("0");
ljOrder.setStatus("paid");
ljOrder.setPayTime(new Date());
ljOrder.setStaffId(nowAccountInfo.getStaffId());
ljOrderService.addGoodOrder(ljOrder,giftId);
stockStatisticService.insertStockStatisticTrack(giftId,0.0,"核销兑换!",1);
return getSuccessResult(this.cardExchangeRecordService.updateById(cardExchangeRecord));
}

View File

@ -108,6 +108,15 @@ public class CardFavorableRecordController extends BaseController {
return getSuccessResult(this.cardFavorableRecordService.issueCardFavorable(cardFavorableAdnUserDTO));
}
/**
* 查询一键发券会员数接口
*
*/
@GetMapping("getAdaptUserList")
public ResponseObject getAdaptUserList(@Param("cardFavorableAdnUserDTO") CardFavorableAdnUserDTO cardFavorableAdnUserDTO) {
return getSuccessResult(this.cardFavorableRecordService.getAdaptUserList(cardFavorableAdnUserDTO));
}
/**
* 查询一键发券接口
*

View File

@ -8,6 +8,8 @@ import com.fuint.business.marketingActivity.cardFavorable.dto.CardFavorableAdnUs
import com.fuint.business.marketingActivity.cardFavorable.dto.IdListDTO;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRecord;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
import com.fuint.business.marketingActivity.cardFavorable.vo.LJUserVos;
import com.fuint.business.userManager.vo.LJUserVo;
import java.io.Serializable;
import java.util.List;
@ -76,5 +78,12 @@ public interface CardFavorableRecordService extends IService<CardFavorableRecord
CardFavorableAdnUserDTO getInfoById(Integer id);
int updateStatus(Integer id);
/**
* 查询一键发券会员数接口
* @param cardFavorableAdnUserDTO
* @return
*/
List<LJUserVos> getAdaptUserList(CardFavorableAdnUserDTO cardFavorableAdnUserDTO);
}

View File

@ -22,6 +22,7 @@ import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorableRe
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableRecordService;
import com.fuint.business.marketingActivity.cardFavorable.service.CardFavorableService;
import com.fuint.business.marketingActivity.cardFavorable.vo.CardFavorableRecordVO;
import com.fuint.business.marketingActivity.cardFavorable.vo.LJUserVos;
import com.fuint.business.petrolStationManagement.service.OilNameService;
import com.fuint.business.userManager.entity.LJUser;
import com.fuint.business.userManager.service.LJUserService;
@ -366,5 +367,30 @@ public class CardFavorableRecordServiceImpl extends ServiceImpl<CardFavorableRec
public int updateStatus(Integer id) {
return cardFavorableRecordMapper.updateStatus(id);
}
@Override
public List<LJUserVos> getAdaptUserList(CardFavorableAdnUserDTO cardFavorableAdnUserDTO) {
ArrayList<LJUserVos> ljUserVosList = new ArrayList<>();
List<Integer> gradeIds = cardFavorableAdnUserDTO.getGradeIds();
for (Integer gradeId : gradeIds) {
LJUserVo ljUserVo = new LJUserVo();
LJUserVos ljUserVos = new LJUserVos();
ljUserVo.setGradeId(gradeId);
List<LJUserVo> userLists = userService.getUserCountList(ljUserVo);
if (CollectionUtils.isNotEmpty(userLists)){
ljUserVos.setGradeName(userLists.get(0).getGradeName());
ljUserVos.setCountAll(userLists.size());
}
ljUserVo.setDays(cardFavorableAdnUserDTO.getDays());
List<LJUserVo> userListss = userService.getUserLists(ljUserVo);
ljUserVos.setCount(userListss.size());
if (ObjectUtils.isNotEmpty(ljUserVos.getCountAll()) && ObjectUtils.isNotEmpty(ljUserVos.getCount()) && ljUserVos.getCountAll()!=0){
ljUserVos.setRate(ljUserVos.getCount()/ljUserVos.getCountAll() + "%");
}
ljUserVosList.add(ljUserVos);
}
return ljUserVosList;
}
}

View File

@ -13,4 +13,11 @@ public class CardFavorableCountVO implements Serializable {
private Integer count;
private Integer countEd;
private Integer countLd;
/**
* 兑换券数量
*/
private Integer counts;
private Integer countEds;
private Integer countLds;
}

View File

@ -93,4 +93,5 @@ public interface LJUserMapper extends BaseMapper<LJUser> {
Integer userNum(Integer storeId);
List<LJUserVo> getUserCountList(LJUserVo user);
}

View File

@ -86,7 +86,9 @@
LEFT JOIN mt_user_balance mub ON mu.id = mub.mt_user_id
left join oil_order oo on mu.id = oo.user_id
<where>
oo.create_time &lt;= DATE_SUB(NOW(), INTERVAL ${user.days} DAY)
<if test="user.days != null and user.days != ''">
oo.create_time &lt;= DATE_SUB(NOW(), INTERVAL ${user.days} DAY)
</if>
<if test="user.chainStoreId != null and user.chainStoreId != ''">
and mub.chain_store_id = #{user.chainStoreId}
</if>
@ -286,6 +288,14 @@
limit 1
</select>
<select id="getUserCountList" resultType="com.fuint.business.userManager.vo.LJUserVo">
select mug.`name` gradeName,mug.id gradeId
from mt_user_balance mub
left join mt_user_grade mug on mub.grade_id = mug.id
where mug.id = #{gradeId}
and mub.store_id = #{storeId}
</select>
<select id="selectUserById" resultType="com.fuint.business.userManager.vo.LJUserVo"
parameterType="java.lang.Integer">

View File

@ -20,6 +20,7 @@ public interface LJUserService extends IService<LJUser> {
public IPage<LJUserVo> selectUserList(Page page, LJUserVo user);
public IPage<LJUserVo> getUserList(Page page, LJUserVo user);
public List<LJUserVo> getUserLists(LJUserVo user);
public List<LJUserVo> getUserCountList(LJUserVo user);
Integer userNum(Integer storeId);

View File

@ -35,6 +35,8 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
private UserBalanceService balanceService;
@Autowired
private ILJStoreService storeService;
@Resource
private LJUserMapper ljUserMapper;
/**
* 根据条件分页查询会员信息
@ -81,6 +83,15 @@ public class LJUserServiceImpl extends ServiceImpl<LJUserMapper, LJUser> impleme
return userLists;
}
@Override
public List<LJUserVo> getUserCountList(LJUserVo user) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Integer storeId = nowAccountInfo.getStoreId();
user.setStoreId(storeId);
List<LJUserVo> userCountList = ljUserMapper.getUserCountList(user);
return userCountList;
}
@Override
public Integer userNum(Integer storeId) {
// 构建查询条件

View File

@ -81,6 +81,8 @@ public class LJUserVo extends BaseEntity {
// 等级ID
private Integer gradeId;
private String gradeName;
// 储值卡
@ExcelProperty(value = "储值卡余额")
private Double cardBalance;