生成二维码信息

This commit is contained in:
cun-nan 2023-12-23 18:17:19 +08:00
parent 8ab6707977
commit dd1a564f60
15 changed files with 337 additions and 15 deletions

View File

@ -315,7 +315,7 @@ public class FyPayServiceImpl implements FyPayService {
} }
@Override @Override
public Map<String, Object> applet(ReceiveParameter receiveParameter) throws Exception { public Map<String, Object> applet(ReceiveParameter receiveParameter) {
Map<String, Object> res = new HashMap<>(); Map<String, Object> res = new HashMap<>();
try { try {
// 查询商户配置信息 // 查询商户配置信息

View File

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService; import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController; import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject; import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -45,6 +47,21 @@ public class CardValueOrdersController extends BaseController {
return getSuccessResult(this.cardValueOrdersService.page(page, new QueryWrapper<>(cardValueOrders))); return getSuccessResult(this.cardValueOrdersService.page(page, new QueryWrapper<>(cardValueOrders)));
} }
/**
* 根据用户id分页查询所有数据
* @param pageNo
* @param pageSize
* @param cardValueOrders
* @return
*/
@GetMapping("/list")
public ResponseObject selectAllByUserId(@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardValueOrders") CardValueOrders cardValueOrders) {
Page page = new Page(pageNo, pageSize);
return getSuccessResult(this.cardValueOrdersService.selectCardValueOrders(page, cardValueOrders));
}
/** /**
* 通过主键查询单条数据 * 通过主键查询单条数据
* *

View File

@ -1,7 +1,10 @@
package com.fuint.business.marketingActivity.cardValueOrders.mapper; package com.fuint.business.marketingActivity.cardValueOrders.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import org.apache.ibatis.annotations.Param;
/** /**
* 储值卡订单表(CardValueOrders)表数据库访问层 * 储值卡订单表(CardValueOrders)表数据库访问层
@ -10,6 +13,12 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde
* @since 2023-12-22 15:57:44 * @since 2023-12-22 15:57:44
*/ */
public interface CardValueOrdersMapper extends BaseMapper<CardValueOrders> { public interface CardValueOrdersMapper extends BaseMapper<CardValueOrders> {
/**
* 根据用户id分页查询储值卡订单信息
* @param page
* @param order
* @return
*/
IPage<CardValueOrders> selectCardValueOrders(Page page,@Param("order") CardValueOrders order);
} }

View File

@ -0,0 +1,20 @@
<?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.cardValueOrders.mapper.CardValueOrdersMapper">
<sql id="selectOrders">
select * from card_value_orders
</sql>
<select id="selectCardValueOrders"
resultType="com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders">
<include refid="selectOrders"></include>
<where>
<if test="order.userId != null and order.userId != ''">
and user_id = #{order.userId}
</if>
<if test="order.status != null and order.status != ''">
and status = #{order.status}
</if>
</where>
order by pay_time desc
</select>
</mapper>

View File

@ -1,5 +1,7 @@
package com.fuint.business.marketingActivity.cardValueOrders.service; package com.fuint.business.marketingActivity.cardValueOrders.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.baomidou.mybatisplus.extension.service.IService;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
@ -10,6 +12,12 @@ import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrde
* @since 2023-12-22 15:57:44 * @since 2023-12-22 15:57:44
*/ */
public interface CardValueOrdersService extends IService<CardValueOrders> { public interface CardValueOrdersService extends IService<CardValueOrders> {
/**
* 根据用户id分页查询储值卡订单信息
* @param page
* @param order
* @return
*/
IPage<CardValueOrders> selectCardValueOrders(Page page, CardValueOrders order);
} }

View File

@ -1,9 +1,13 @@
package com.fuint.business.marketingActivity.cardValueOrders.service.impl; package com.fuint.business.marketingActivity.cardValueOrders.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper; import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders; import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService; import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -15,5 +19,11 @@ import org.springframework.stereotype.Service;
@Service("cardValueOrdersService") @Service("cardValueOrdersService")
public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMapper, CardValueOrders> implements CardValueOrdersService { public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMapper, CardValueOrders> implements CardValueOrdersService {
@Override
public IPage<CardValueOrders> selectCardValueOrders(Page page, CardValueOrders order) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
order.setUserId(nowAccountInfo.getId());
return baseMapper.selectCardValueOrders(page,order);
}
} }

View File

@ -39,6 +39,7 @@
<if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 --> <if test="order.params.endTime != null and order.params.endTime != ''"><!-- 结束时间检索 -->
and date_format(pay_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d') and date_format(pay_time,'%y%m%d') &lt;= date_format(#{order.params.endTime},'%y%m%d')
</if> </if>
order by pay_time desc
</where> </where>
</select> </select>
<select id="selectOilOrderByOrderNo" resultType="com.fuint.business.order.vo.OilOrderVo" <select id="selectOilOrderByOrderNo" resultType="com.fuint.business.order.vo.OilOrderVo"
@ -73,6 +74,7 @@
<if test="order.remark != null and order.remark != ''"> <if test="order.remark != null and order.remark != ''">
and remark = #{order.remark} and remark = #{order.remark}
</if> </if>
order by pay_time desc
</where> </where>
</select> </select>

View File

@ -534,6 +534,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
oilOrder.setOrderStatus(status); oilOrder.setOrderStatus(status);
if (status.equals("paid")){ if (status.equals("paid")){
oilOrder.setPayTime(new Date()); oilOrder.setPayTime(new Date());
this.updateGrowthValue(oilOrder.getPayAmount(),oilOrder.getUserId(), Integer.valueOf(oilOrder.getOils()),null,oilOrder.getStoreId());
} }
row = baseMapper.updateById(oilOrder); row = baseMapper.updateById(oilOrder);
} }
@ -617,6 +618,11 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
/** /**
* 修改用户成长值信息 * 修改用户成长值信息
* @param oilActualPay 实付金额
* @param userid 用户id
* @param oilId 油号
* @param refuelMoney 加油金信息
* @param storeId 店铺id
*/ */
private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId){ private void updateGrowthValue(Double oilActualPay,Integer userid,Integer oilId,String refuelMoney,Integer storeId){
if (oilId!=null){ if (oilId!=null){

View File

@ -0,0 +1,37 @@
package com.fuint.business.qrCode.controller;
import com.fuint.business.qrCode.service.QrCodeService;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 二维码信息 controller层
*/
@RestController
@RequestMapping("/business/qrCode")
public class QrCodeController extends BaseController {
@Autowired
private QrCodeService qrCodeService;
/**
* 生成条形码信息
* @return
*/
@GetMapping("/createBarCode")
public ResponseObject createBarCode(){
return getSuccessResult(qrCodeService.createUserBarCode());
}
/**
* 生成二维码信息
* @return
*/
@GetMapping("/createQrCode")
public ResponseObject createQrCode(){
return getSuccessResult(qrCodeService.createUserQrCode());
}
}

View File

@ -0,0 +1,15 @@
package com.fuint.business.qrCode.service;
public interface QrCodeService {
/**
* 生成条形码字符串信息
* @return
*/
String createUserBarCode();
/**
* 生成二维码字符串信息
* @return
*/
String createUserQrCode();
}

View File

@ -0,0 +1,67 @@
package com.fuint.business.qrCode.service.impl;
import com.fuint.business.qrCode.service.QrCodeService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.stereotype.Service;
import java.util.Random;
@Service
public class QrCodeServiceImpl implements QrCodeService {
/**
* 生成条码18位随机数 数字 第7位放用户id
* @return
*/
@Override
public String createUserBarCode() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Random random = new Random();
StringBuilder sb1 = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
for (int i = 0; i < 6; i++) {
sb1.append(random.nextInt(4));
}
for (int i = 0; i < 7; i++) {
sb2.append(random.nextInt(5));
}
String digits1 = sb1.toString();
String digits2 = sb2.toString();
int sum1 = 0;
int sum2 = 0;
for (int i = 0; i < digits1.length(); i++) {
int digit1 = Integer.parseInt(String.valueOf(digits1.charAt(i)));
if (i % 2 == 0) {
sum1 += digit1;
} else {
sum1 += digit1 * 3;
}
}
for (int i = 0; i < digits2.length(); i++) {
int digit2 = Integer.parseInt(String.valueOf(digits2.charAt(i)));
if (i % 2 == 0) {
sum2 += digit2;
} else {
sum2 += digit2 * 3;
}
}
int checksum1 = (4 - (sum1 % 4)) % 4;
int checksum2 = (5 - (sum2 % 5)) % 5;
String number = digits1 + checksum1 + "19" + nowAccountInfo.getId() + "19" + digits2 + checksum2;
return number;
}
@Override
public String createUserQrCode() {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
String start = RandomStringUtils.randomAlphanumeric(20);
String end = RandomStringUtils.randomAlphanumeric(22);
String number = start + "9E" + nowAccountInfo.getId() + "9E" + end;
return number;
}
}

View File

@ -206,8 +206,9 @@
<div class="center-left-wrap"> <div class="center-left-wrap">
<div class="wrap-box" v-for="item in payList" <div class="wrap-box" v-for="item in payList"
:key="item.dictValue" :key="item.dictValue"
:value="item.dictValue"> :value="item.dictValue"
<span @click="payMethod(item.dictValue)">{{ item.dictLabel }}</span> @click="payMethod(item.dictValue)">
<span>{{ item.dictLabel }}</span>
</div> </div>
<div class="wrap-box" > <div class="wrap-box" >
<span @click="addCredits">挂账</span> <span @click="addCredits">挂账</span>

View File

@ -4,6 +4,17 @@
<!--外层 --> <!--外层 -->
<!-- 顶部 --> <!-- 顶部 -->
<view class="conttainer-top"> <view class="conttainer-top">
<!-- 轮播图 -->
<!-- <view style="width: 100%;height: 300px;">
<swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
:duration="duration">
<swiper-item v-for="(item,index) in list1" :key="index">
<view class="swiper-item uni-bg-red">A</view>
<image :src="item"></image>
</swiper-item>
</swiper>
</view> -->
<!-- 标题 --> <!-- 标题 -->
<view class="top-title"> <view class="top-title">
出行服务 优惠加油 出行服务 优惠加油
@ -122,6 +133,10 @@
export default { export default {
data() { data() {
return { return {
indicatorDots: true,
autoplay: true,
interval: 2000,
duration: 500,
joinmsg: '', joinmsg: '',
msg: "1", msg: "1",
show: false, show: false,
@ -137,6 +152,11 @@
gbPrice: '0' gbPrice: '0'
}, },
list1: [
'http://47.95.206.185:83/topbj.png',
'http://47.95.206.185:83/centerbj.png',
'https://cdn.uviewui.com/uview/swiper/swiper1.png',
],
list3: [ list3: [
'http://47.95.206.185:83/topbj.png', 'http://47.95.206.185:83/topbj.png',
'http://47.95.206.185:83/centerbj.png', 'http://47.95.206.185:83/centerbj.png',

View File

@ -84,6 +84,7 @@
</template> </template>
<script> <script>
import request from '../../utils/request'
export default { export default {
data() { data() {
return { return {
@ -91,7 +92,7 @@
show: false, show: false,
option: { option: {
width: 670, // rpx width: 670, // rpx
height: 100, // rpx height: 150, // rpx
code: 'E57890543271985', // code: 'E57890543271985', //
}, },
options: { options: {
@ -101,11 +102,34 @@
} }
}, },
onLoad() {
this.getBarCode()
this.getQrCode()
},
components: { components: {
}, },
methods: { methods: {
//
getBarCode(){
request({
url: 'business/qrCode/createBarCode',
method: 'get',
}).then(res => {
// console.log(res,111)
this.option.code = res.data
})
},
//
getQrCode(){
request({
url: 'business/qrCode/createQrCode',
method: 'get',
}).then(res => {
// console.log(2222,res)
this.options.code = res.data
})
},
close() { close() {
console.log('弹出层收起'); console.log('弹出层收起');
this.show = false this.show = false

View File

@ -33,6 +33,10 @@
<view class="chengg">{{getPayName(payList,item.orderStatus)}}</view> <view class="chengg">{{getPayName(payList,item.orderStatus)}}</view>
</view> </view>
<view class="but-box">
<view class="huis">订单类型</view>
<view class="">油品订单</view>
</view>
<view class="but-box"> <view class="but-box">
<view class="huis">订单金额</view> <view class="huis">订单金额</view>
<view class="">{{item.orderAmount}}</view> <view class="">{{item.orderAmount}}</view>
@ -66,21 +70,25 @@
<view class="box-order" v-for="(item,index) in balanceList" :key="index"> <view class="box-order" v-for="(item,index) in balanceList" :key="index">
<view class="or-box-top"> <view class="or-box-top">
<view class="">{{getStoreName(storeList,item.storeId)}}</view> <view class="">{{getStoreName(storeList,item.storeId)}}</view>
<view class="chengg">{{getPayName(payList,item.orderStatus)}}</view> <view class="chengg">{{getPayName(payList,item.status)}}</view>
</view> </view>
<view class="but-box">
<view class="huis">订单类型</view>
<view class="">储值卡订单</view>
</view>
<view class="but-box"> <view class="but-box">
<view class="huis">订单金额</view> <view class="huis">订单金额</view>
<view class="">{{item.orderAmount}}</view> <view class="">{{item.amount}}</view>
</view> </view>
<view class="but-box"> <view class="but-box">
<view class="huis">优惠合计</view> <view class="huis">优惠合计</view>
<view class="reds">{{item.discountAmount}}</view> <view class="reds">{{item.discount}}</view>
</view> </view>
<view class="but-box"> <view class="but-box">
<view class="huis">订单时间</view> <view class="huis">订单时间</view>
<view class="" v-if="item.orderStatus=='paid'">{{parseTime(item.payTime)}}</view> <view class="" v-if="item.status=='paid'">{{parseTime(item.payTime)}}</view>
<view class="" v-else>{{item.createTime}}</view> <view class="" v-else>{{parseTime(item.createTime)}}</view>
</view> </view>
<view class="end-box" @click="goComment()"> <view class="end-box" @click="goComment()">
<view class="anniu"> <view class="anniu">
@ -122,6 +130,7 @@
list: [], list: [],
// //
balanceList:[], balanceList:[],
list1: [],
map: { map: {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@ -129,8 +138,14 @@
orderStatus: "", orderStatus: "",
remark: "", remark: "",
}, },
map1: {
page: 1,
pageSize: 10,
status: "",
},
// //
total: 0, total: 0,
total1: 0,
// //
storeList: [], storeList: [],
// //
@ -155,6 +170,7 @@
queryOrder() { queryOrder() {
let _this = this; let _this = this;
_this.list = []; _this.list = [];
_this.list1 = [];
if (_this.query == "") { if (_this.query == "") {
_this.list = _this.orderList _this.list = _this.orderList
} else { } else {
@ -173,6 +189,21 @@
} }
}) })
}) })
_this.storeList.forEach(item => {
_this.balanceList.forEach(item1 => {
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list1.push(item1)
}
return
}
if (item.name.includes(_this.query)) {
if (item1.storeId == item.id) {
_this.list1.push(item1)
}
}
})
})
} }
}, },
parseTime(dateTime) { parseTime(dateTime) {
@ -235,8 +266,14 @@
} else { } else {
this.status = "no-more" this.status = "no-more"
} }
if (this.balanceList.length < this.total1) {
this.map1.page++;
this.getBalanceOrder()
} else {
this.status = "no-more"
}
}, },
// //
getMyOrder() { getMyOrder() {
let _this = this; let _this = this;
request({ request({
@ -257,7 +294,32 @@
} }
_this.total = res.data.total _this.total = res.data.total
uni.hideLoading(); uni.hideLoading();
console.log(res,_this.map,_this.map.page) }
})
},
//
getBalanceOrder() {
let _this = this;
request({
url: "business/marketingActivity/activeExchange/cardValueOrders/list",
method: 'get',
params: _this.map1,
}).then((res) => {
console.log(res,uni.getStorageSync("userId"))
uni.showLoading({
title: '加载中'
});
if (res.code == 200) {
if (_this.map1.page == 1) {
_this.balanceList = res.data.records
_this.list1 = res.data.records
} else {
_this.balanceList = _this.balanceList.concat(res.data.records)
_this.list1 = _this.list.concat(res.data.records)
}
_this.total1 = res.data.total
uni.hideLoading();
} }
}) })
@ -273,6 +335,12 @@
remark: "", remark: "",
} }
this.getMyOrder() this.getMyOrder()
this.map1 = {
page: 1,
pageSize: 10,
status: "",
}
this.getBalanceOrder()
} else if (this.tapindex == 1) { } else if (this.tapindex == 1) {
this.map = { this.map = {
page: 1, page: 1,
@ -282,6 +350,12 @@
remark: "", remark: "",
} }
this.getMyOrder() this.getMyOrder()
this.map1 = {
page: 1,
pageSize: 10,
status: "unpaid",
}
this.getBalanceOrder()
} else if (this.tapindex == 2) { } else if (this.tapindex == 2) {
this.map = { this.map = {
page: 1, page: 1,
@ -291,15 +365,27 @@
remark: "", remark: "",
} }
this.getMyOrder() this.getMyOrder()
this.map1 = {
page: 1,
pageSize: 10,
status: "paid",
}
this.getBalanceOrder()
} else { } else {
this.map = { this.map = {
page: 1, page: 1,
pageSize: 10, pageSize: 10,
storeId: "", storeId: "",
orderStatus: "paid", orderStatus: "paid",
remark: "待评价", remark: "",
} }
this.getMyOrder() this.getMyOrder()
this.map1 = {
page: 1,
pageSize: 10,
status: "paid",
}
this.getBalanceOrder()
} }
}, },
goPayment(){ goPayment(){