处理数据

This commit is contained in:
13405411873 2024-09-22 16:37:06 +08:00
parent f37cebec8c
commit 05c1363139
21 changed files with 608 additions and 29 deletions

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -276,19 +276,17 @@
</el-form-item>
</div>
<div>
<el-form-item label="赠送电子券" :label-width="formLabelWidth" prop="activeStatus">
<el-radio-group v-model="form.isonline" @input="changeIsOnline">
<el-radio label="0">不赠送</el-radio>
<el-radio label="1">赠送</el-radio>
</el-radio-group>
<el-form-item label="赠送优惠券" :label-width="formLabelWidth" >
<!-- <el-radio-group v-model="form.isonline" @input="changeIsOnline">-->
<!-- <el-radio label="0">不赠送</el-radio>-->
<!-- <el-radio label="1">赠送</el-radio>-->
<!-- </el-radio-group>-->
<el-button type="primary" style="margin-left: 30px" size="mini" @click="getlistFavorable()" >添加</el-button>
</el-form-item>
</div>
</el-form>
<!-- 赠送卡券-->
<!-- 选择优惠券-->
<div class="xh-box" >
<div style="margin: 10px 0px">
<el-table
:data="youhuiquanlist"
@ -355,6 +353,7 @@
</div>
</div>
<div class="box-popup">
<div class="dis-bit">附加特权</div>
<el-input

View File

@ -0,0 +1,92 @@
package com.fuint.business.marketingActivity.cardCoupon.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.ApiController;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
import static org.springframework.boot.actuate.autoconfigure.cloudfoundry.SecurityResponse.success;
/**
* 用户优惠卷表2024(CardCouponUser)表控制层
*
* @author makejava
* @since 2024-09-22 15:14:30
*/
@RestController
@RequestMapping("cardCouponUser")
public class CardCouponUserController extends BaseController {
/**
* 服务对象
*/
@Resource
private CardCouponUserService cardCouponUserService;
/**
* 分页查询所有数据
*
* @param page 分页对象
* @param cardCouponUser 查询实体
* @return 所有数据
*/
@GetMapping
public ResponseObject selectAll(Page<CardCouponUser> page, CardCouponUser cardCouponUser) {
return getSuccessResult(this.cardCouponUserService.page(page, new QueryWrapper<>(cardCouponUser)));
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
public ResponseObject selectOne(@PathVariable Serializable id) {
return getSuccessResult(this.cardCouponUserService.getById(id));
}
/**
* 新增数据
*
* @param cardCouponUser 实体对象
* @return 新增结果
*/
@PostMapping
public ResponseObject insert(@RequestBody CardCouponUser cardCouponUser) {
return getSuccessResult(this.cardCouponUserService.save(cardCouponUser));
}
/**
* 修改数据
*
* @param cardCouponUser 实体对象
* @return 修改结果
*/
@PutMapping
public ResponseObject update(@RequestBody CardCouponUser cardCouponUser) {
return getSuccessResult(this.cardCouponUserService.updateById(cardCouponUser));
}
/**
* 删除数据
*
* @param idList 主键结合
* @return 删除结果
*/
@DeleteMapping
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
return getSuccessResult(this.cardCouponUserService.removeByIds(idList));
}
}

View File

@ -4,6 +4,7 @@ import java.time.LocalTime;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -130,6 +131,9 @@ public class CardCoupon extends Model<CardCoupon> {
private String updateBy;
//更新时间
private Date updateTime;
//当次获取数量
@TableField(exist = false)
private Integer giftCardToatl;
}

View File

@ -0,0 +1,55 @@
package com.fuint.business.marketingActivity.cardCoupon.entity;
import java.util.Date;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import java.io.Serializable;
/**
* 用户优惠卷表2024(CardCouponUser)表实体类
*
* @author makejava
* @since 2024-09-22 15:14:30
*/
@Data
public class CardCouponUser extends Model<CardCouponUser> {
//主键id
private Integer id;
//所属连锁店id
private Integer chainStoreId;
//所属店铺id
private Integer storeId;
//会员id
private Integer mtUserId;
//会员手机号码
private String mobile;
//来源类型 1储值卡2囤油卡....
private String fromType;
//活动id
private Integer activeId;
//优惠券id
private Integer cardCouponId;
//有效期开始时间
private Date startTime;
//有效期结束时间
private Date endTime;
//0未使用1已核销
private String status;
//使用时间
private Date useTime;
//订单总表all order 的主键
private Integer orderId;
//创建者
private String createBy;
//创建时间
private Date createTime;
//更新者
private String updateBy;
//更新时间
private Date updateTime;
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.marketingActivity.cardCoupon.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
/**
* 用户优惠卷表2024(CardCouponUser)表数据库访问层
*
* @author makejava
* @since 2024-09-22 15:14:30
*/
public interface CardCouponUserMapper extends BaseMapper<CardCouponUser> {
}

View File

@ -0,0 +1,22 @@
package com.fuint.business.marketingActivity.cardCoupon.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
/**
* 用户优惠卷表2024(CardCouponUser)表服务接口
*
* @author makejava
* @since 2024-09-22 15:14:30
*/
public interface CardCouponUserService extends IService<CardCouponUser> {
/**
* 判断用户是否还能领取该优惠卷
* @param couponId 优惠卷id
* @param userId 用户主键
* @return true false 不能
*/
boolean userCanGet(Integer couponId,Integer userId);
}

View File

@ -0,0 +1,60 @@
package com.fuint.business.marketingActivity.cardCoupon.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.mapper.CardCouponUserMapper;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponService;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 用户优惠卷表2024(CardCouponUser)表服务实现类
*
* @author makejava
* @since 2024-09-22 15:14:30
*/
@Service("cardCouponUserService")
public class CardCouponUserServiceImpl extends ServiceImpl<CardCouponUserMapper, CardCouponUser> implements CardCouponUserService {
@Autowired
private CardCouponService cardCouponService;
/**
* 判断用户是否还能领取该优惠卷
* @param couponId 优惠卷id
* @param userId 用户主键
* @return true false 不能
*/
@Override
public boolean userCanGet(Integer couponId, Integer userId) {
CardCoupon cardCoupon = cardCouponService.getById(couponId);
if (cardCoupon.getTfTotal()<=cardCoupon.getTfTotal()){
//领取数量大于策略中的送出总量
return false;
}
String nowDate = DateUtil.format(new Date(), "yyyy-MM-dd");
LambdaQueryWrapper<CardCouponUser> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(CardCouponUser::getCardCouponId,couponId).eq(CardCouponUser::getMtUserId,userId);
List<CardCouponUser> list = this.list(queryWrapper);
if (CollectionUtil.isEmpty(list)){
list =new ArrayList<>();
}
if (list.size()>=cardCoupon.getGetNumLimit()){
//当前用户领取已到达上限
return false;
}
//获取当日获取数量
long count = list.stream().filter(it -> {
return DateUtil.format(it.getCreateTime(), "yyyy-MM-dd").equals(nowDate);
}).count();
return count < cardCoupon.getDayGetLimit();
}
}

View File

@ -69,6 +69,17 @@ public class CardValueController extends BaseController {
return getSuccessResult(this.cardValueService.selectAllApplet(cardValue));
}
/**
* 查询本站会员充值卡列表
* @param cardValue
* @return
*/
@GetMapping("cardValueList")
public ResponseObject cardValueList(@Param("cardValue") CardValue cardValue) {
return getSuccessResult(this.cardValueService.cardValueList(cardValue));
}
/**
* 通过主键查询单条数据
*
@ -90,7 +101,16 @@ public class CardValueController extends BaseController {
public ResponseObject selectById(@PathVariable Serializable id) {
return getSuccessResult(this.cardValueService.getOneById(id));
}
/**
* 获取使用时的详细信息
*
* @param cardValueId 主键
* @return 单条数据
*/
@GetMapping("/getCoupons")
public ResponseObject getCoupons(@RequestParam("userId") Integer userId,@RequestParam("cardValueId") Integer cardValueId) {
return getSuccessResult(this.cardValueService.getCoupons(userId,cardValueId));
}
/**
* 新增数据
*

View File

@ -3,12 +3,15 @@ package com.fuint.business.marketingActivity.cardValue.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 储值卡表(CardValue)表实体类
@ -87,6 +90,8 @@ public class CardValue extends Model<CardValue> {
//20240821追加字段
//活动名称
private String activeName;
@TableField(exist = false)
private List<CardCoupon> cardCoupons;
}

View File

@ -1,7 +1,11 @@
package com.fuint.business.marketingActivity.cardValue.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 储值卡子表(CardValueChild)表数据库访问层
@ -10,5 +14,6 @@ import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
* @since 2023-11-20 17:50:59
*/
public interface CardValueChildMapper extends BaseMapper<CardValueChild> {
List<CardCoupon> getByCardId(@Param("cardValueId") Integer cardValueId);
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuint.business.marketingActivity.cardValue.mapper.CardValueChildMapper">
<select id="getByCardId" resultType="com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon">
SELECT
cc.*,cvc.gift_card_total as giftCardToatl
FROM
card_value_child cvc
INNER JOIN card_coupon cc on cvc.vouchers_id = cc.id
where cvc.card_value_id = #{cardValueId} and cc.tf_total <![CDATA[ >]]> cc.tf_get_num
</select>
</mapper>

View File

@ -1,8 +1,11 @@
package com.fuint.business.marketingActivity.cardValue.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
import java.util.List;
/**
* 储值卡子表(CardValueChild)表服务接口
*
@ -10,5 +13,5 @@ import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
* @since 2023-11-20 17:51:06
*/
public interface CardValueChildService extends IService<CardValueChild> {
List<CardCoupon> getByCardId(Integer cardValueId);
}

View File

@ -3,6 +3,7 @@ package com.fuint.business.marketingActivity.cardValue.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardValue.dto.CardValueDTO;
import com.fuint.business.marketingActivity.cardValue.entity.CardValue;
import com.fuint.business.marketingActivity.cardValue.vo.CardValueAppletVO;
@ -43,6 +44,7 @@ public interface CardValueService extends IService<CardValue> {
* @return
*/
CardValueVO getOneById(Serializable id);
List<CardCoupon> getCoupons(Integer userId,Integer cardValueId);
/**
* 新增数据
@ -66,6 +68,8 @@ public interface CardValueService extends IService<CardValue> {
*/
List<CardValueAppletVO> selectAllApplet(CardValue cardValue);
List<CardValue> cardValueList (CardValue cardValue);
/**
* 删除数据
* @param id

View File

@ -1,11 +1,14 @@
package com.fuint.business.marketingActivity.cardValue.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardValue.entity.CardValueChild;
import com.fuint.business.marketingActivity.cardValue.mapper.CardValueChildMapper;
import com.fuint.business.marketingActivity.cardValue.service.CardValueChildService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 储值卡子表(CardValueChild)表服务实现类
*
@ -15,5 +18,9 @@ import org.springframework.stereotype.Service;
@Service("cardValueChildService")
public class CardValueChildServiceImpl extends ServiceImpl<CardValueChildMapper, CardValueChild> implements CardValueChildService {
@Override
public List<CardCoupon> getByCardId(Integer cardValueId) {
return baseMapper.getByCardId(cardValueId);
}
}

View File

@ -1,5 +1,6 @@
package com.fuint.business.marketingActivity.cardValue.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -15,6 +16,9 @@ import com.fuint.business.marketingActivity.activeConsumption.vo.ActiveConsumpti
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscount;
import com.fuint.business.marketingActivity.activeDiscount.entity.ActiveDiscountChild;
import com.fuint.business.marketingActivity.activeDiscount.vo.ActiveDiscountVO;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCoupon;
import com.fuint.business.marketingActivity.cardCoupon.entity.CardCouponUser;
import com.fuint.business.marketingActivity.cardCoupon.service.CardCouponUserService;
import com.fuint.business.marketingActivity.cardExchange.entity.CardExchange;
import com.fuint.business.marketingActivity.cardExchange.mapper.CardExchangeMapper;
import com.fuint.business.marketingActivity.cardFavorable.entity.CardFavorable;
@ -33,6 +37,7 @@ import com.fuint.business.member.service.ILJStaffService;
import com.fuint.business.store.service.StoreService;
import com.fuint.business.storeInformation.service.ILJStoreService;
import com.fuint.business.userManager.service.LJUserGradeService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.service.StaffService;
import com.fuint.common.util.TokenUtil;
import com.fuint.repository.mapper.MtStaffMapper;
@ -86,6 +91,8 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
@Autowired
private ILJStaffService staffService;
@Autowired
private CardCouponUserService cardCouponUserService;
/**
* 分页查询所有数据
* @param page
@ -313,6 +320,16 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
return cardValueVO;
}
@Override
public List<CardCoupon> getCoupons(Integer userId,Integer cardValueId) {
List<CardCoupon> cardCoupons = cardValueChildService.getByCardId(cardValueId);
//过滤
return cardCoupons.stream().filter(it -> {
return cardCouponUserService.userCanGet(it.getId(), userId);
}).collect(Collectors.toList());
}
/**
* 新增数据
* @param cardValueDTO
@ -525,6 +542,19 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
}).collect(Collectors.toList());
}
@Override
public List<CardValue> cardValueList(CardValue cardValue) {
//获取当前登录用户
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String nowTime = DateUtil.format(new Date(), "yyyy-MM-dd")+"00:00:00";
LambdaQueryWrapper<CardValue> queryWrapper =new LambdaQueryWrapper<>();
queryWrapper.eq(CardValue::getStoreId,nowAccountInfo.getStoreId()).eq(CardValue::getIsonline,"0").eq(CardValue::getActiveStatus,"1").and(it->{
return it.eq(CardValue::getActiveTime,"1").or().eq(CardValue::getActiveTime,"2")
.ge(CardValue::getStartTime,nowTime).le(CardValue::getEndTime,nowTime);
}).orderByAsc(CardValue::getRechargeBalance);
return this.list(queryWrapper);
}
/**
* 删除数据
* @param id

View File

@ -160,13 +160,13 @@
select zong.*, o2.oil_name
FROM (SELECT o1.*,
o2.oil_name as oil_name_id,
o2.oil_name as oilNameId,
o2.oil_type as oilType,
o2.oil_price as oilPrice
FROM oil_gun o1
LEFT JOIN oil_number o2 ON o1.number_id = o2.number_id
WHERE o1.store_id = #{storeId} and o1.status = '启用' ) as zong
LEFT JOIN oil_name as o2 on zong.oil_name_id = o2.id
LEFT JOIN oil_name as o2 on zong.oilNameId = o2.id
</select>

View File

@ -20,5 +20,6 @@ public class OilCashRegisterVo extends OilGun {
* 关联表 挂牌价
*/
private BigDecimal oilPrice;
private Integer oilNameId;
}

View File

@ -15,3 +15,17 @@ export function cashRegisterGoodsList() {
method: 'get',
})
}
export function cardValueList() {
return request({
url: '/business/marketingActivity/cardValue/cardValueList',
method: 'get',
})
}
export function getCoupons(param) {
return request({
url: '/business/marketingActivity/cardValue/getCoupons',
method: 'get',
params:param
})
}

View File

@ -403,7 +403,7 @@
width="910px"
center
>
<memberRecharge></memberRecharge>
<memberRecharge :userId="chooseVipUser.id" ref="rechargeRef"></memberRecharge>
<span slot="footer" class="dialog-footer">
<el-button @click="memberRecharge = false"> </el-button>
<el-button type="primary" @click="memberRecharge = false">确认充值</el-button>
@ -436,7 +436,7 @@ import refuelingAmount from './newHomeComponents/refuelingAmount.vue'
import {cashRegisterList, cashRegisterGoodsList} from '@/api/newHome/newHome.js'
import {QRCodeByStoreId} from "@/api/staff/qrcode";
import {userListByPhone} from "@/api/cashier/user";
import Vue from 'vue';
import { VueClipboard } from 'vue-clipboard2';
export default {
@ -846,6 +846,10 @@ export default {
},
addMemberRecharge() {
this.memberRecharge = true
this.$nextTick(res=>{
this.$refs.rechargeRef.getCardValueList();
})
},
changeBox() {
this.boxShow = !this.boxShow

View File

@ -1,7 +1,15 @@
<script >
import {cardValueList,getCoupons} from "@/api/newHome/newHome";
import {number} from "echarts/lib/export";
export default {
props: {
userId: number
},
data() {
return {
youhuiquanlist:[],
selectCard:{},
tabList:[
{
name:'电子储值卡',
@ -16,10 +24,6 @@ export default {
num:2
}
],
kangList:[
"充值5000元赠送500元",
"充值10000元赠送1500元"
],
tabIndex:0,
kIndex:0,
ruleForm: {
@ -42,15 +46,38 @@ export default {
price:[
{ required: true, message: '充值金额', trigger: 'change' }
],
}
},
cardList:[]
}
},
methods:{
setindex(index){
selectTab(index){
this.tabIndex = index
},
setIndex(index){
chooseActive(data,index){
this.kIndex = index
this.selectCard = data
console.log(this.selectCard)
},
getCardValueList(){
let that = this
cardValueList().then(res=>{
this.kIndex = 0
this.cardList = res.data
if (this.cardList&&this.cardList.length>0) {
console.log(70707)
that.getCouponList(this.cardList[0].id);
}
})
},
getCouponList(cardValueId){
console.log({userId:this.userId,cardValueId:cardValueId},72)
getCoupons({userId:this.userId,cardValueId:cardValueId}).then(res=>{
console.log(res,72)
})
}
}
}
@ -59,7 +86,7 @@ export default {
<template>
<div>
<div class="top-dd">
<div class="tab-dv" v-for="(item,index) in tabList" :key="index" :class="{ 'active' :tabIndex==index}" @click="setindex(index)" >
<div class="tab-dv" v-for="(item,index) in tabList" :key="index" :class="{ 'active' :tabIndex==index}" @click="selectTab(index)" >
{{item.name}}
</div>
</div>
@ -68,32 +95,104 @@ export default {
<el-form-item label="充值金额" prop="price" >
</el-form-item>
<div class="d-s">
<div class="k_kang" v-for="(item,index) in kangList" :key="index" @click="setIndex(index)" >
{{item}}
<div class="k_kang" v-for="(item,index) in cardList" :key="index" @click="chooseActive(item,index)" >
{{item.activeName}}
<img src="../imgs/r-j.png" class="p-img" v-if="kIndex == index" >
</div>
</div>
<el-form-item label="自定义充值本金" prop="region" >
<el-input v-model="ruleForm.text4" style="width: 330px">
<el-form-item label="充值本金" prop="region" >
<el-input v-model="selectCard.rechargeBalance" style="width: 330px">
<template slot="append"></template>
</el-input>
</el-form-item>
<div style="display: flex">
<el-form-item label="赠送金额" prop="text">
<el-input v-model="ruleForm.text1" style="width: 150px">
<el-input v-model="selectCard.giftBalance" style="width: 150px">
<template slot="append"></template>
</el-input>
</el-form-item>
<el-form-item label="赠送积分" prop="text">
<el-input v-model="ruleForm.text2" style="width: 150px">
<el-input v-model="selectCard.points" style="width: 150px">
<template slot="append">积分</template>
</el-input>
</el-form-item>
<el-form-item label="赠送成长值" prop="text">
<el-input v-model="ruleForm.text3" style="width: 150px">
<el-input v-model="selectCard.growthValue" style="width: 150px">
<template slot="append">成长值</template>
</el-input>
</el-form-item>
</div>
<el-form-item label="赠送优惠券" >
<el-button type="primary" style="margin-left: 30px" size="mini" @click="getlistFavorable()" >添加</el-button>
</el-form-item>
<!-- 选择优惠券-->
<div class="xh-box" >
<div style="margin: 10px 0px">
<el-table
:data="youhuiquanlist"
border
style="width: 100%">
<el-table-column
prop="giftCardName"
label="卡券名称"
width="0">
</el-table-column>
<el-table-column
prop="giftCardType"
label="券类型"
width="80">
<template slot-scope="scope">
<span v-if="scope.row.giftCardType == 0" >油品券</span>
<span v-if="scope.row.giftCardType == 1" >商品券</span>
<span v-if="scope.row.giftCardType == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="80">
<template slot-scope="scope">
<span>{{scope.row.giftCardDetail}}</span>
</template>
</el-table-column>
<el-table-column
prop="instruction"
label="使用说明"
width="0">
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" > {{scope.row.validityZero}} </span>
<span v-if="scope.row.timeType == 1" > {{scope.row.validityOne}} </span>
<span v-if="scope.row.timeType == 2" > {{scope.row.validityTwo}} </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="9999"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="deletedata(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-form-item label="提成员工" prop="region" >
<el-select v-model="ruleForm.region" placeholder="请选择提成员工" style="width: 330px">