自定义充值bug处理+pom引入rocket和rdisson+rocketmq配置+aes加密测试(前后端)

This commit is contained in:
wangh 2023-12-14 13:36:36 +08:00
parent e96aac959e
commit 1956d1a25b
9 changed files with 189 additions and 13 deletions

View File

@ -181,14 +181,15 @@
<el-input placeholder="请输入充值金额"
size="medium"
v-model.number="cardValueForm.amount"
@input="valueAmoutChange(cardValueForm.amount)">
@input="valueAmoutChange(cardValueForm.amount)"
>
<template slot="prepend">自定义</template>
<template slot="append"></template>
</el-input>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div style="display: flex;justify-content: space-between;margin: 20px 0">
@ -900,17 +901,24 @@ export default {
this.cardValueList = this.cardValueList.filter(item => {
return item.membershipLevel.includes(this.grade.name);
});
console.log("this.cardValueList",this.cardValueList)
this.rechargeCard(0);
}
},
valueAmoutChange(data) {
if(data == '' || data == null) {
data = 0
// this.cardValueForm.amount = null
this.$set(this.cardValueForm, 'amount', data);
console.log("data17.16",this.cardValueForm.amount)
if(!data) {
this.cardValueForm.amount = 0
}else {
this.cardValueForm.amount = data
}
this.cardValueForm.points = ''
this.cardValueForm.bidBalance =''
this.cardValueForm.giftBalance =''
@ -1053,6 +1061,10 @@ export default {
}
if (this.cardValueForm.amount != null) {
this.cardValueForm.rechargeType = 1
if (!this.cardValueForm.amount || this.cardValueForm.amount<0) {
this.$message.error('请选择输入自定义金额');
return
}
this.realyPayBills = this.cardValueForm.amount
} else {
this.cardValueForm.rechargeType = 0
@ -1118,8 +1130,8 @@ export default {
//
rechargeCard(index,item){
// console.log("index",index)
this.cardValueForm.amount = null,
console.log("index",index)
// this.cardValueForm.amount = null,
this.cardValueForm.rechargeType = 0
this.activeKey = index;
@ -1131,9 +1143,10 @@ export default {
this.cardValueForm.bidBalance = 0
// this.cardValueForm.bidBalance = 1
this.cardValueForm.amount = 0
// this.cardValueForm.amount = 0
}else {
if (this.cardValueList <= 0) return
let file={}
//
file = this.cardValueList[index]
@ -1186,6 +1199,11 @@ export default {
let userForm = this.form
if(!this.authCode && this.cardValueForm.paymentType != "CASH") {
this.$message.error('请先扫码');
return
}
if (this.flag === 1) {
// id
this.cardValueForm.mtUserId = userForm.id
@ -1323,10 +1341,31 @@ export default {
this.authCode = null
this.activeRecharge='balance',
this.cardValueForm = {}
this.iniz()
this.cardFuelDieselForm = {}
},
iniz() {
this.cardValueForm= {
cardValueId:'', // id
mtStaffId: '', //
realName: '',
staffMobile: '',
amount:'', //
bidBalance:'', //
rechargeBalance:'', //
giftBalance:'',//
points:'', //
growthValue:'', //
remark:'',
paymentType:'', //
royaltyType: '',//
percentageCommissions:null,
amountCommission:null,
rechargeType:'0'
}
},
//
submitForm: function() {
this.$refs["form"].validate(valid => {

View File

@ -1,6 +1,6 @@
# 数据库配置
spring.datasource.url=jdbc:mysql://192.168.1.5:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false&allowMultiQueries=true
spring.datasource.url=jdbc:mysql://192.168.1.3:3306/fuint-db?useUnicode=true&characterEncoding=UTF8&useSSL=false&allowMultiQueries=true
spring.datasource.username=root
spring.datasource.password=qqzcy@1014

View File

@ -84,6 +84,13 @@
<version>${mybatis-plus.version}</version>
</dependency>
<!--rocketmq-->
<!-- <dependency>-->
<!-- <groupId>org.apache.rocketmq</groupId>-->
<!-- <artifactId>rocketmq-spring-boot-starter</artifactId>-->
<!-- <version>2.1.1</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
@ -177,6 +184,8 @@
<version>2.1.0</version>
</dependency>
</dependencies>
<build>

View File

@ -1,5 +1,5 @@
# \u57FA\u672C\u914D\u7F6E
server.port=8080
server.port=8008
env.profile=dev
env.properties.path=D:/code/oilSystem/fuintBackend/configure/
@ -24,3 +24,49 @@ mybatis-plus.mapper-locations = classpath*:/mapper/*Mapper.xml,classpath*:com/fu
mybatis-plus.configuration.intercepts=com.example.MyInterceptor
# \u9ED8\u8BA4\u65F6\u95F4\u683C\u5F0F
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
##rocketmq????
#??????????
#rocketmq.producer.isOnOff=on
# ?????
rocketmq.name-server=47.95.206.185:9876
#rocketmq.producer.namesrvAddr=47.95.206.185:9876
rocketmq.producer.groupName=anran-producer-group
rocketmq.producer.group=anran-producer-group
rocketmq.producer.topic=anran-topic
# ????
rocketmq.producer.sync-tag=anran-sync-tags
# ????
rocketmq.producer.async-tag=anran-async-tags
#?????? ??1024*4(4M)
rocketmq.producer.maxMessageSize=4096
#????????,??3000
rocketmq.producer.sendMsgTimeout=3000
#?????????????2
rocketmq.producer.retryTimesWhenSendFailed=2
# ?????
rocketmq.consumer.group=anran-consumer-group
rocketmq.consumer.topic=anran-topic
# ?????????????? Topic????????????? Tag
rocketmq.consumer.tags=anran-sync-tags,anran-async-tags
####consumer
###??????????
#rocketmq.consumer.isOnOff=on
#rocketmq.consumer.groupName=${spring.application.name}
##mq?nameserver??
#rocketmq.consumer.namesrvAddr=127.0.0.1:9876
##??????????tags("*"????????????tags),???topic~tag1||tag2||tag3;topic2~*;
#rocketmq.consumer.topics=DemoTopic~*;
#rocketmq.consumer.consumeThreadMin=20
#rocketmq.consumer.consumeThreadMax=64
##???????????????1?
#rocketmq.consumer.consumeMessageBatchMaxSize=1

View File

@ -1,2 +1,64 @@
package PACKAGE_NAME;public class aes {
import com.fuint.fuintApplication;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
@RunWith(SpringJUnit4ClassRunner.class)
//@RunWith(SpringRunner.class)
@SpringBootTest(classes = fuintApplication.class)
@Transactional
public class aes {
public String ALGORITHM = "AES";
public static final String TRANSFORMATION = "AES/CBC/PKCS5Padding";
public static final String SECRET_KEY = "0123456789abcdef"; // 16位
public static final String IV = "0123456789abcdef"; // 16位
@Test
public void tt() throws Exception {
String originalData = "hello 123";
// 加密
String encryptedData = null;
try {
encryptedData = encrypt(originalData);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("Encrypted Data: " + encryptedData);
// 解密
String decryptedData = decrypt(encryptedData);
System.out.println("Decrypted Data: " + decryptedData);
}
public String encrypt(String data) throws Exception {
Cipher cipher = Cipher.getInstance(TRANSFORMATION);
SecretKeySpec keySpec = new SecretKeySpec(SECRET_KEY.getBytes(), ALGORITHM);
IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec);
byte[] encryptedBytes = cipher.doFinal(data.getBytes());
return Base64.getEncoder().encodeToString(encryptedBytes);
}
public String decrypt(String encryptedData) throws Exception {
Cipher cipher = Cipher.getInstance(TRANSFORMATION);
SecretKeySpec keySpec = new SecretKeySpec(SECRET_KEY.getBytes(), ALGORITHM);
IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes());
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
byte[] decodedBytes = Base64.getDecoder().decode(encryptedData);
return new String(cipher.doFinal(decodedBytes));
}
}

View File

@ -85,12 +85,20 @@
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<!-- Redisson 锁功能 -->
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>3.16.2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
@ -184,6 +192,12 @@
<version>2.2.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.alibaba.rocketmq</groupId>-->
<!-- <artifactId>rocketmq-client</artifactId>-->
<!-- <version>2.2.1</version>-->
<!-- </dependency>-->
<!-- 微信支付 SDK -->
<dependency>
<groupId>com.github.wxpay</groupId>

View File

@ -2,8 +2,8 @@
module.exports = {
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
baseUrl: 'http://192.168.0.196:8080/',
// baseUrl: 'http://192.168.1.6:8008/',
// baseUrl: 'http://192.168.0.196:8080/',
baseUrl: 'http://192.168.1.6:8008/',
// baseUrl: 'http://192.168.1.5:8002/cdJdc',
imagesUrl: 'http://www.nuoyunr.com/lananRsc',
// 应用信息

View File

@ -83,6 +83,11 @@
"readdirp": "~3.6.0"
}
},
"crypto-js": {
"version": "4.2.0",
"resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
},
"emojis-list": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",

View File

@ -2,6 +2,7 @@
"dependencies": {
"@dcloudio/uni-ui": "^1.4.28",
"bignumber.js": "^9.1.2",
"crypto-js": "^4.2.0",
"uview-ui": "^2.0.36"
},
"devDependencies": {