一键发券
This commit is contained in:
parent
32959d1641
commit
1e9cdce8c3
@ -1,16 +1,24 @@
|
||||
package com.fuint.business.marketingActivity.cardGift.controller;
|
||||
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||
import com.fuint.business.marketingActivity.cardGift.service.CardGiftService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -121,5 +129,69 @@ public class CardGiftController extends BaseController {
|
||||
public ResponseObject exchange(@Param("cardGift") CardGift cardGift) {
|
||||
return getSuccessResult(this.cardGiftService.exchange(cardGift));
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡模板下载
|
||||
* @param response
|
||||
* @param request
|
||||
*/
|
||||
@RequestMapping("/export")
|
||||
public void export(HttpServletResponse response, HttpServletRequest request) {
|
||||
|
||||
try {
|
||||
String filenames = "礼品卡导入示列";
|
||||
String userAgent = request.getHeader("User-Agent");
|
||||
if (userAgent.contains("MSIE") || userAgent.contains("Trident")) {
|
||||
filenames = URLEncoder.encode(filenames, "UTF-8");
|
||||
} else {
|
||||
filenames = new String(filenames.getBytes("UTF-8"), "ISO-8859-1");
|
||||
}
|
||||
response.setContentType("application/json.ms-exce");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.addHeader("Content-Disposition", "filename=" + filenames + ".xlsx");
|
||||
|
||||
CardGift cardGift = new CardGift();
|
||||
cardGift.setNumber("1234567890");
|
||||
cardGift.setCardPassword("123456");
|
||||
cardGift.setCardAmount(300.00);
|
||||
|
||||
List<CardGift> list = new ArrayList<>();
|
||||
list.add(cardGift);
|
||||
EasyExcel.write(response.getOutputStream(), CardGift.class).sheet("sheet").doWrite(list);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡模板导入
|
||||
*
|
||||
* @param multipartFile excel文件
|
||||
* @return 修改结果
|
||||
*/
|
||||
@RequestMapping("exchangeImport")
|
||||
public ResponseObject exchangeImport(MultipartFile multipartFile) throws IOException {
|
||||
return getSuccessResult(this.cardGiftService.exchangeImport(multipartFile));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询礼品卡面值金额
|
||||
* @param cardGift
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("selectGiftValue")
|
||||
public ResponseObject selectGiftValue(CardGift cardGift) {
|
||||
return getSuccessResult(this.cardGiftService.selectGiftValue(cardGift));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询礼品卡统计
|
||||
* @param cardGift
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("countGiftValue")
|
||||
public ResponseObject countGiftValue(CardGift cardGift) {
|
||||
return getSuccessResult(this.cardGiftService.countGiftValue(cardGift));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.marketingActivity.cardGift.entity;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
@ -23,9 +24,11 @@ public class CardGift extends Model<CardGift> {
|
||||
private Integer id;
|
||||
//批次号
|
||||
private String batchNumber;
|
||||
//礼品卡编号
|
||||
//卡号
|
||||
@ExcelProperty(value = "卡号")
|
||||
private String number;
|
||||
//兑换卡密
|
||||
//卡密
|
||||
@ExcelProperty(value = "卡密")
|
||||
private String cardPassword;
|
||||
//所属连锁店id
|
||||
private Integer chainStorId;
|
||||
@ -35,13 +38,14 @@ public class CardGift extends Model<CardGift> {
|
||||
private Integer storeId;
|
||||
//礼品卡状态 1:在用 2:挂失 3:停用
|
||||
private String status;
|
||||
//兑换功能状态 0:启用 1:禁用
|
||||
private String exchangeStatus;
|
||||
private String useStatus;
|
||||
private String sailStatus;
|
||||
//激活状态
|
||||
private String activateStatus;
|
||||
//生成数量
|
||||
private Integer quantity;
|
||||
//礼品卡金额
|
||||
//面值
|
||||
@ExcelProperty(value = "面值")
|
||||
private Double cardAmount;
|
||||
//礼品卡描述
|
||||
private String remark;
|
||||
@ -50,6 +54,15 @@ public class CardGift extends Model<CardGift> {
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
private Date sailTime;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
private Date effectiveTimeStart;
|
||||
//创建时间
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
private Date effectiveTimeEnd;
|
||||
//更新者
|
||||
private String updateBy;
|
||||
//更新时间
|
||||
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -15,5 +16,9 @@ import java.util.Map;
|
||||
public interface CardGiftMapper extends BaseMapper<CardGift> {
|
||||
|
||||
HashMap<String,Long> selectStatistics(Integer storeId);
|
||||
|
||||
List<CardGift> selectGiftValue(CardGift cardGift);
|
||||
|
||||
List<Map<String,Integer>> countGiftValue(CardGift cardGift);
|
||||
}
|
||||
|
||||
|
@ -30,5 +30,17 @@
|
||||
card_gift
|
||||
where store_id = #{store_id}
|
||||
</select>
|
||||
|
||||
<select id="selectGiftValue" resultType="com.fuint.business.marketingActivity.cardGift.entity.CardGift">
|
||||
select DISTINCT card_amount from card_gift
|
||||
where store_id = #{storeId}
|
||||
</select>
|
||||
|
||||
<select id="countGiftValue" resultType="java.util.HashMap">
|
||||
select card_amount cardAmount,count(id) count,SUM(card_amount) total
|
||||
from card_gift
|
||||
where store_id = #{storeId}
|
||||
group by card_amount
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
|
||||
import com.fuint.business.petrolStationManagement.entity.OilGun;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -52,5 +55,16 @@ public interface CardGiftService extends IService<CardGift> {
|
||||
* @return
|
||||
*/
|
||||
IPage selectAllRecords(Page page, CardGift cardGift);
|
||||
|
||||
/**
|
||||
* 礼品卡模板导入
|
||||
* @param multipartFile
|
||||
* @return
|
||||
*/
|
||||
Map<String,Integer> exchangeImport(MultipartFile multipartFile) throws IOException;
|
||||
|
||||
List<CardGift> selectGiftValue(CardGift cardGift);
|
||||
|
||||
List<Map<String,Integer>> countGiftValue(CardGift cardGift);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fuint.business.marketingActivity.cardGift.service.impl;
|
||||
|
||||
import com.alibaba.excel.EasyExcelFactory;
|
||||
import com.alipay.api.domain.LoginUserDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -13,18 +14,23 @@ import com.fuint.business.oilDepotConfiguration.service.OilDepotConfigService;
|
||||
import com.fuint.business.store.entity.MtStore;
|
||||
import com.fuint.business.store.service.StoreService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.listener.EasyExcelListener;
|
||||
import com.fuint.business.userManager.mapper.LJUserMapper;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@ -143,12 +149,18 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getRemark())){
|
||||
queryWrapper.like(CardGift::getRemark,cardGift.getRemark());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getActivateStatus())) {
|
||||
queryWrapper.eq(CardGift::getActivateStatus,cardGift.getActivateStatus());
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getUseStatus())) {
|
||||
queryWrapper.eq(CardGift::getUseStatus,cardGift.getUseStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getStatus())) {
|
||||
queryWrapper.eq(CardGift::getStatus,cardGift.getStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getStatus())) {
|
||||
queryWrapper.eq(CardGift::getSailStatus,cardGift.getSailStatus());
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(cardGift.getStatus())) {
|
||||
queryWrapper.eq(CardGift::getCardAmount,cardGift.getCardAmount());
|
||||
}
|
||||
queryWrapper.eq(CardGift::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
queryWrapper.orderByDesc(CardGift::getCreateTime);
|
||||
return page(page, queryWrapper);
|
||||
@ -212,5 +224,73 @@ public class CardGiftServiceImpl extends ServiceImpl<CardGiftMapper, CardGift> i
|
||||
queryWrapper.orderByDesc(CardGift::getUpdateTime);
|
||||
return page(page,queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼品卡模板导入
|
||||
* @param multipartFile
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Integer> exchangeImport(MultipartFile multipartFile) throws IOException {
|
||||
Map<String,Integer> map = new HashMap<>();
|
||||
int success = 0;
|
||||
int error = 0;
|
||||
int repeat = 0;
|
||||
int total = 0;
|
||||
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
//获取文件流
|
||||
InputStream inputStream = multipartFile.getInputStream();
|
||||
//实例化实现了AnalysisEventListener接口的类
|
||||
EasyExcelListener listener = new EasyExcelListener();
|
||||
|
||||
EasyExcelFactory.read(inputStream, CardGift.class, listener).headRowNumber(1).build().readAll();
|
||||
|
||||
//获取数据
|
||||
List<Object> list = listener.getDatas();
|
||||
total = list.size();
|
||||
if (list.size() >= 1) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CardGift cardGift = (CardGift) list.get(i);
|
||||
cardGift.setStoreId(nowAccountInfo.getStoreId());
|
||||
//去重
|
||||
LambdaQueryWrapper<CardGift> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardGift::getNumber,cardGift.getNumber());
|
||||
CardGift one = getOne(queryWrapper);
|
||||
if (one!=null){
|
||||
repeat += 1;
|
||||
}else {
|
||||
//使用mybatis-plus添加到数据库
|
||||
boolean save = save(cardGift);
|
||||
if (save==true){
|
||||
success++;
|
||||
}else {
|
||||
error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put("total",total);
|
||||
map.put("success",success);
|
||||
map.put("error",error);
|
||||
map.put("repeat",repeat);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CardGift> selectGiftValue(CardGift cardGift) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
cardGift.setStoreId(nowAccountInfo.getStoreId());
|
||||
List<CardGift> cardGifts = cardGiftMapper.selectGiftValue(cardGift);
|
||||
return cardGifts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Integer>> countGiftValue(CardGift cardGift) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
cardGift.setStoreId(nowAccountInfo.getStoreId());
|
||||
return cardGiftMapper.countGiftValue(cardGift);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,5 +124,16 @@ public class CardValueController extends BaseController {
|
||||
public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
|
||||
return getSuccessResult(this.cardValueService.removeByIds(idList));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("delById")
|
||||
public ResponseObject delById(@RequestParam("id") Long id) {
|
||||
return getSuccessResult(this.cardValueService.delById(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,10 +59,10 @@ public class CardValue extends Model<CardValue> {
|
||||
//活动进度
|
||||
private String activityProgress;
|
||||
//活动开始时间
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
//活动结束时间
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
//活动状态 1:启用 2:禁用
|
||||
private String activeStatus;
|
||||
|
@ -31,7 +31,7 @@
|
||||
<select id="selectFuleRecord"
|
||||
resultType="com.fuint.business.marketingActivity.cardValue.dto.CardValueRecordDTO">
|
||||
SELECT
|
||||
'升数卡' AS recordName,
|
||||
'囤油卡' AS recordName,
|
||||
mt_user_id mtUserId,
|
||||
recharge_balance rechargeBalance,
|
||||
income_litres obtain,
|
||||
@ -74,7 +74,7 @@
|
||||
recharge_balance rechargeBalance, bid_balance obtain, fringe_benefit oilName,royalty_type type,
|
||||
create_time createTime, chain_store_id chainStoreId, store_id storeId,pay_status payStatus FROM card_value_record
|
||||
UNION
|
||||
SELECT '升数卡' AS recordName,payment_type paymentType,mt_user_id mtUserId, recharge_balance rechargeBalance,
|
||||
SELECT '囤油卡' AS recordName,payment_type paymentType,mt_user_id mtUserId, recharge_balance rechargeBalance,
|
||||
income_litres obtain,oil_name oilName,type, create_time createTime, chain_store_id chainStoreId,
|
||||
store_id storeId,pay_status payStatus FROM card_fuel_record
|
||||
UNION
|
||||
|
@ -63,5 +63,12 @@ public interface CardValueService extends IService<CardValue> {
|
||||
* @return
|
||||
*/
|
||||
List<CardValueAppletVO> selectAllApplet(CardValue cardValue);
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
boolean delById(Long id);
|
||||
}
|
||||
|
||||
|
@ -233,6 +233,7 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
cardValueDTO.setStoreId(TokenUtil.getNowAccountInfo().getStoreId());
|
||||
cardValueDTO.setChainStoreId(storeService.getById(TokenUtil.getNowAccountInfo().getStoreId()).getChainStoreId());
|
||||
}
|
||||
cardValueDTO.setCreateBy(TokenUtil.getNowAccountInfo().getRealName());
|
||||
//新增折扣营销活动模板
|
||||
CardValue cardValue = new CardValue();
|
||||
cardValue.setStartTime(new Date());
|
||||
@ -266,6 +267,7 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
BeanUtils.copyProperties(cardValueDTO,cardValue);
|
||||
if (cardValueDTO.getIsonline().equals("1")){
|
||||
cardValue.setActiveStatus("2");
|
||||
cardValue.setUpdateBy(TokenUtil.getNowAccountInfo().getRealName());
|
||||
}
|
||||
update =updateById(cardValue);
|
||||
//更新子表数据
|
||||
@ -330,6 +332,24 @@ public class CardValueServiceImpl extends ServiceImpl<CardValueMapper, CardValue
|
||||
return appletVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean delById(Long id) {
|
||||
boolean flag = false;
|
||||
//1.先删除对应的优惠券兑换券
|
||||
CardValueVO oneById = getOneById(id);
|
||||
LambdaQueryWrapper<CardValueChild> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CardValueChild::getCardValueId,oneById.getId());
|
||||
flag = cardValueChildService.remove(queryWrapper);
|
||||
//2.删除储值卡
|
||||
flag = removeById(id);
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数组转字符串
|
||||
* @param array
|
||||
|
@ -53,10 +53,10 @@ public class CardValueVO extends Model<CardValue> {
|
||||
//活动进度
|
||||
private String activityProgress;
|
||||
//活动开始时间
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
|
||||
private Date startTime;
|
||||
//活动结束时间
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
|
||||
private Date endTime;
|
||||
//活动状态 1:启用 2:禁用
|
||||
private String activeStatus;
|
||||
|
@ -22,17 +22,17 @@
|
||||
</view>
|
||||
|
||||
<view class="but-box">
|
||||
<view class="huis">充值金额</view>
|
||||
<view class="huis">实付金额</view>
|
||||
<view class="">¥{{item.rechargeBalance}}</view>
|
||||
</view>
|
||||
|
||||
<view class="but-box" v-if="item.recordName == '储值卡'">
|
||||
<view class="huis">优惠合计</view>
|
||||
<view class="huis">充值金额</view>
|
||||
<view class="reds">¥{{item.obtain}}</view>
|
||||
</view>
|
||||
<view class="but-box" v-else>
|
||||
<view class="huis">所得升数</view>
|
||||
<view class="reds">{{item.obtain}}</view>
|
||||
<view class="reds">{{item.obtain}}L</view>
|
||||
</view>
|
||||
<view class="but-box">
|
||||
<view class="huis">订单时间</view>
|
||||
|
@ -20,7 +20,6 @@
|
||||
<view class="anniu" v-if="!flag">
|
||||
<span v-if="flag2">已签到</span>
|
||||
<span v-if="!flag2">未开通签到</span>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -42,8 +41,6 @@
|
||||
<view class="xanniu" @click="recharge">去充值</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
@ -47,8 +47,8 @@
|
||||
<view class="sizehei">¥{{item.rechargeBalance}}</view>
|
||||
</view>
|
||||
<view class="y-bt">
|
||||
<view class="sizehui">优惠合计</view>
|
||||
<view class="sizehong">¥{{item.obtain}}</view>
|
||||
<view class="sizehui">所得升数</view>
|
||||
<view class="sizehong">{{item.obtain}}L</view>
|
||||
</view>
|
||||
<view class="y-bt">
|
||||
<view class="sizehui">订单时间</view>
|
||||
@ -78,7 +78,7 @@
|
||||
mtUserId: '',
|
||||
storeId: '',
|
||||
chainStoreId: '',
|
||||
recordName: '升数卡',
|
||||
recordName: '囤油卡',
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user