Compare commits
No commits in common. 'b0cd824d30781fb2f3bda30d89f0b2a4f25e7c47' and '2f9635d4a0d721bd1200afbee4584ddaa1f64cd2' have entirely different histories.
b0cd824d30
...
2f9635d4a0
@ -0,0 +1,10 @@
|
|||||||
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
|
### Example user template template
|
||||||
|
### Example user template
|
||||||
|
|
||||||
|
# IntelliJ project files
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
out
|
||||||
|
gen
|
||||||
|
target
|
@ -0,0 +1,11 @@
|
|||||||
|
FROM nginx:alpine
|
||||||
|
|
||||||
|
COPY uidocker/conf.d /etc/nginx/conf.d
|
||||||
|
|
||||||
|
COPY src/main/ui /var/www/royalpay
|
||||||
|
|
||||||
|
COPY uidocker/upstream.conf.tpl /opt/upstream.conf.tpl
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
|
||||||
|
CMD envsubst < /opt/upstream.conf.tpl > /etc/nginx/conf.d/upstream.conf && cat /etc/nginx/conf.d/upstream.conf && exec nginx -g 'daemon off;'
|
Binary file not shown.
@ -0,0 +1,62 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
# @author:haloo#
|
||||||
|
#@func:pre-commit#
|
||||||
|
## cp ./checkstyle/pre-commit ./.git/hooks/
|
||||||
|
|
||||||
|
echo 避免NPE是程序员的基本修养
|
||||||
|
echo 开始style checking
|
||||||
|
|
||||||
|
wd=`pwd`
|
||||||
|
echo "当前工作目录:$wd"
|
||||||
|
|
||||||
|
# check-style版本号
|
||||||
|
check_style_version="checkstyle-8.38-all.jar"
|
||||||
|
check_style_xml_name="GeekCheckStyle.xml"
|
||||||
|
check_jar_path="$wd/checkstyle/$check_style_version"
|
||||||
|
check_xml_path="$wd/checkstyle/$check_style_xml_name"
|
||||||
|
|
||||||
|
## 清空temp文件
|
||||||
|
|
||||||
|
rm -f temp
|
||||||
|
|
||||||
|
is_err=0
|
||||||
|
errorCount=0
|
||||||
|
warnCount=0
|
||||||
|
|
||||||
|
## 查找add到git 缓冲区中,以.java后缀的文件
|
||||||
|
for file in `git status --porcelain | sed s/^...// | grep '\.java$'`; do
|
||||||
|
path="$wd/$file"
|
||||||
|
echo "检查文件: $path"
|
||||||
|
re=`java -jar $check_jar_path -c $check_xml_path $path >> temp`
|
||||||
|
|
||||||
|
warn=`cat temp | grep "WARN"`
|
||||||
|
if [[ $warn = *"WARN"* ]];then
|
||||||
|
echo "${warn}"
|
||||||
|
needle="WARN"
|
||||||
|
number_of_occurrences=$(grep -o "$needle" <<< "$warn" | wc -l)
|
||||||
|
((warnCount = warnCount + number_of_occurrences))
|
||||||
|
is_err=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
err=`cat temp | grep "ERROR"`
|
||||||
|
if [[ $err = *"ERROR"* ]];then
|
||||||
|
echo "${err}"
|
||||||
|
needle="ERROR"
|
||||||
|
number_of_occurrences=$(grep -o "$needle" <<< "$err" | wc -l)
|
||||||
|
((errorCount = errorCount + number_of_occurrences))
|
||||||
|
is_err=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "检查完成,祝你好运"
|
||||||
|
|
||||||
|
rm -f temp
|
||||||
|
|
||||||
|
if [ $is_err -ne 0 ];then
|
||||||
|
echo "出现了 $errorCount 个error"
|
||||||
|
echo "出现了 $warnCount 个warn"
|
||||||
|
echo "请先符合style才能提交"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "No Bug ,It is Good!!"
|
||||||
|
exit 0
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1,15 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIICXQIBAAKBgQC72cPSVWP66+5iDU+Yyg6ODfjDeb+nty90e5UtESIB1YOn4qaq
|
||||||
|
gjPiNgDZUDpaUhHKCW95U/V3pQi2FBbIj16z8uAAxVe+Uz45NlWhBIT9+4PY57oF
|
||||||
|
yLkaVCr/6Kwir/ql28cvwkhkbrQ2veOpGd7/W8UpMjWMyNuZGelEibmBKQIDAQAB
|
||||||
|
AoGABdjpd4qg6had/P9dEux3N4TH0Y3goV/aYk3Wfuihnlz/FCLB/VzAMLJtpFYS
|
||||||
|
+uzDEP7qMWSjp23Dr6dAbk3ILNQgogrJ4a4z9Uq9fVYt8lBo/T98hjR1xSXDJEQS
|
||||||
|
FsUw8XRbYGFOFxnLzlTjLix1b6+gmTJsKihbETMXBKRl/WECQQDkf0LRjoDCME4H
|
||||||
|
kgLzm4dq5iCPdJNQLOZT+xJsQy72/RNdnlbYJVO0E9NSo1oIpFtKA2C8z/BTnAUk
|
||||||
|
5nuLeac/AkEA0nYN1i4TZCyaB0MbGIgFU/dc7aIY/5QIY4oGrs//3CnqLDxU0Doa
|
||||||
|
yFEQAaZTINa7hy4aZqtPl7rdeYBPFwRllwJBAOIrCRNtbwtHTuT1ZJCGQKrR8Cau
|
||||||
|
p+WzG6TCnoCkm0cERvfic2lswQY8nW5tm/9z15xR7Z3WYLYRd5IHxP/QQXcCQQC1
|
||||||
|
fDveUAlEvvlr/cAl3VXK3Gp0OO4Zpsu9Gk88+/yFHFflIXl5vkFOMCj/YzAYB1Pa
|
||||||
|
9DSsCFowW2GU3sJU9OOtAkBB8WLs1AGsBRdMy9b2ucfeeCDjMip5deLCwX9jii/p
|
||||||
|
Am5f2ajaEkr60blSbG4sbK/EKZ2uENUZzKqcIje83TB8
|
||||||
|
-----END RSA PRIVATE KEY-----
|
@ -0,0 +1 @@
|
|||||||
|
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB
|
@ -0,0 +1,102 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"code": "hangzhou",
|
||||||
|
"name": "杭州海关",
|
||||||
|
"target": [
|
||||||
|
"HANGZHOU_ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "guangzhou",
|
||||||
|
"name": "广州海关",
|
||||||
|
"target": [
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "zhengzhou",
|
||||||
|
"name": "河南保税物流中心",
|
||||||
|
"target": [
|
||||||
|
"ZHENGZHOU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "xinzheng",
|
||||||
|
"name": "新郑综合保税区(空港)",
|
||||||
|
"target": [
|
||||||
|
"HENAN",
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "chongqing",
|
||||||
|
"name": "重庆海关",
|
||||||
|
"target": [
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "ningbo",
|
||||||
|
"name": "宁波",
|
||||||
|
"target": [
|
||||||
|
"NINGBO"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "shengzhen",
|
||||||
|
"name": "深圳海关",
|
||||||
|
"target": [
|
||||||
|
"SHENZHEN_ZS",
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "shanghai",
|
||||||
|
"name": "上海海关",
|
||||||
|
"target": [
|
||||||
|
"SHANGHAI_CBT"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "xian",
|
||||||
|
"name": "西安海关",
|
||||||
|
"target": [
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "NANSHAGJ",
|
||||||
|
"name": "南沙国检",
|
||||||
|
"target": [
|
||||||
|
"NANSHAGJ"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "tianjin",
|
||||||
|
"name": "天津海关",
|
||||||
|
"target": [
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "hefei",
|
||||||
|
"name": "合肥海关",
|
||||||
|
"target": [
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "suzhou",
|
||||||
|
"name": "苏州海关",
|
||||||
|
"target": [
|
||||||
|
"ZONGSHU"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"code": "guangzhouhuangpu",
|
||||||
|
"name": "广州黄埔海关",
|
||||||
|
"target": [
|
||||||
|
"GUANGZHOU_HUANGPU"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
cp checkstyle/pre-commit .git/hooks/
|
||||||
|
chmod +x .git/hooks/pre-commit
|
@ -1,38 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<groupId>org.example</groupId>
|
|
||||||
<artifactId>kafka</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.kafka</groupId>
|
|
||||||
<artifactId>kafka-clients</artifactId>
|
|
||||||
<version>3.2.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.rocketmq</groupId>
|
|
||||||
<artifactId>rocketmq-client</artifactId>
|
|
||||||
<version>4.9.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.rocketmq</groupId>
|
|
||||||
<artifactId>rocketmq-tools</artifactId>
|
|
||||||
<version>4.9.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.12</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,65 +0,0 @@
|
|||||||
package com.dalong.kafka.producer;
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.*;
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
|
||||||
import org.apache.kafka.common.TopicPartition;
|
|
||||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
public class CustomConsumer {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// 基础配置
|
|
||||||
Properties properties=new Properties();
|
|
||||||
properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,"192.168.37.131:9092");
|
|
||||||
properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
|
||||||
properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
|
||||||
|
|
||||||
properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG,"XXDD8");
|
|
||||||
properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"latest");
|
|
||||||
//自动提交时异步提交
|
|
||||||
properties.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,"true");
|
|
||||||
|
|
||||||
//设置分区策略
|
|
||||||
properties.setProperty(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,"org.apache.kafka.clients.consumer.RoundRobinAssignor");
|
|
||||||
|
|
||||||
// properties.setProperty(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG,"");
|
|
||||||
// properties.setProperty(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,"");
|
|
||||||
KafkaConsumer kafkaConsumer=new KafkaConsumer(properties);
|
|
||||||
kafkaConsumer.subscribe(Arrays.asList("dalong1"));
|
|
||||||
while (true) {
|
|
||||||
ConsumerRecords records = kafkaConsumer.poll(Duration.ofMillis(0));
|
|
||||||
|
|
||||||
if (!records.isEmpty()) {
|
|
||||||
System.out.println("======>partition:!isEmpty");
|
|
||||||
|
|
||||||
Set<TopicPartition> partitions= records.partitions();
|
|
||||||
for(TopicPartition partition:partitions){
|
|
||||||
List<ConsumerRecord<String,String>> recordStringList= records.records(partition);//每次poll的时候是取多个分区的数据
|
|
||||||
//分区获取数据
|
|
||||||
Iterator<ConsumerRecord<String,String>> iterator= recordStringList.iterator();
|
|
||||||
//kafka offset是按分区去维护的
|
|
||||||
while (iterator.hasNext()){
|
|
||||||
ConsumerRecord<String,String> consumerRecord= iterator.next();
|
|
||||||
int par= consumerRecord.partition();
|
|
||||||
long offset= consumerRecord.offset();
|
|
||||||
String v= consumerRecord.value();
|
|
||||||
String k=consumerRecord.key();
|
|
||||||
System.out.println("======>partition:"+partition+"===par:"+par+"====>k:"+k+"=====v:"+v+"===offset:"+offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// System.out.println("============"+records.count()+"==================");
|
|
||||||
// Iterator<ConsumerRecord> iterator = records.iterator();
|
|
||||||
// while (iterator.hasNext()) {
|
|
||||||
// ConsumerRecord consumerRecord = iterator.next();
|
|
||||||
// int p = consumerRecord.partition();
|
|
||||||
// long offset = consumerRecord.offset();
|
|
||||||
// System.out.println("=====>key: " + consumerRecord.key() + "===>partition:" + p + "==offset:" + offset+"=="+consumerRecord.value());
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.dalong.kafka.producer;
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerConfig;
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecord;
|
|
||||||
import org.apache.kafka.clients.consumer.ConsumerRecords;
|
|
||||||
import org.apache.kafka.clients.consumer.KafkaConsumer;
|
|
||||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class CustomConsumer2 {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// 基础配置
|
|
||||||
Properties properties=new Properties();
|
|
||||||
properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,"192.168.37.131:9092");
|
|
||||||
properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
|
||||||
properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
|
||||||
|
|
||||||
properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG,"XXDD6");
|
|
||||||
properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"latest");
|
|
||||||
//自动提交时异步提交
|
|
||||||
properties.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,"true");
|
|
||||||
//设置分区策略
|
|
||||||
properties.setProperty(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,"org.apache.kafka.clients.consumer.RoundRobinAssignor");
|
|
||||||
|
|
||||||
// properties.setProperty(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG,"");
|
|
||||||
// properties.setProperty(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,"");
|
|
||||||
KafkaConsumer kafkaConsumer=new KafkaConsumer(properties);
|
|
||||||
kafkaConsumer.subscribe(Arrays.asList("dalong1"));
|
|
||||||
while (true) {
|
|
||||||
ConsumerRecords records = kafkaConsumer.poll(Duration.ofMillis(0));
|
|
||||||
if (!records.isEmpty()) {
|
|
||||||
System.out.println("============》"+records.count()+"《==================");
|
|
||||||
Iterator<ConsumerRecord> iterator = records.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
ConsumerRecord consumerRecord = iterator.next();
|
|
||||||
int p = consumerRecord.partition();
|
|
||||||
long offset = consumerRecord.offset();
|
|
||||||
System.out.println("=====》》key: " + consumerRecord.key() + "===>partition:" + p + "==offset:" + offset+"=="+consumerRecord.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package com.dalong.kafka.producer;
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.consumer.*;
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
|
||||||
import org.apache.kafka.common.serialization.StringDeserializer;
|
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class CustomConsumer3 {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// 基础配置
|
|
||||||
Properties properties=new Properties();
|
|
||||||
properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,"192.168.37.131:9092");
|
|
||||||
properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
|
||||||
properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
|
|
||||||
|
|
||||||
properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG,"XXDD6");
|
|
||||||
properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"latest");
|
|
||||||
//自动提交时异步提交
|
|
||||||
properties.setProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,"true");
|
|
||||||
|
|
||||||
//设置分区策略
|
|
||||||
properties.setProperty(ConsumerConfig.PARTITION_ASSIGNMENT_STRATEGY_CONFIG,"org.apache.kafka.clients.consumer.RoundRobinAssignor");
|
|
||||||
|
|
||||||
// properties.setProperty(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG,"");
|
|
||||||
// properties.setProperty(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,"");
|
|
||||||
KafkaConsumer kafkaConsumer=new KafkaConsumer(properties);
|
|
||||||
kafkaConsumer.subscribe(Arrays.asList("dalong1"));
|
|
||||||
while (true) {
|
|
||||||
ConsumerRecords records = kafkaConsumer.poll(Duration.ofMillis(0));
|
|
||||||
if (!records.isEmpty()) {
|
|
||||||
System.out.println("============"+records.count()+"==================");
|
|
||||||
Iterator<ConsumerRecord> iterator = records.iterator();
|
|
||||||
while (iterator.hasNext()) {
|
|
||||||
ConsumerRecord consumerRecord = iterator.next();
|
|
||||||
int p = consumerRecord.partition();
|
|
||||||
long offset = consumerRecord.offset();
|
|
||||||
System.out.println("=====>key: " + consumerRecord.key() + "===>partition:" + p + "==offset:" + offset+"=="+consumerRecord.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.dalong.kafka.producer;
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.producer.KafkaProducer;
|
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
|
||||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class CustomProducer {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Properties properties=new Properties();
|
|
||||||
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,"192.168.37.132:9092");
|
|
||||||
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
|
|
||||||
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
|
|
||||||
//
|
|
||||||
properties.setProperty(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION,"5");
|
|
||||||
properties.setProperty(ProducerConfig.SEND_BUFFER_CONFIG,"32768");//32K 改成-1 使用系统的默认值
|
|
||||||
properties.setProperty(ProducerConfig.RECEIVE_BUFFER_CONFIG,"32768");
|
|
||||||
KafkaProducer<String,String> producer= new KafkaProducer<String,String>(properties);
|
|
||||||
for (int i=0;i<50;i++) {
|
|
||||||
producer.send(new ProducerRecord<>("dalong1", "dalong2eeeeesdd额1"+i));
|
|
||||||
}
|
|
||||||
producer.close();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.dalong.kafka.producer;
|
|
||||||
|
|
||||||
import org.apache.kafka.clients.producer.*;
|
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class CustomProducerCallback {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Properties properties=new Properties();
|
|
||||||
properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,"192.168.37.131:9092");
|
|
||||||
properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
|
|
||||||
properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
|
|
||||||
|
|
||||||
KafkaProducer<String,String> producer= new KafkaProducer<String,String>(properties);
|
|
||||||
for (int i=0;i<60;i++) {
|
|
||||||
producer.send(new ProducerRecord<String, String>("dalong1", i%6,"","对对对44=11144=55555" + i), new Callback() {
|
|
||||||
@Override
|
|
||||||
public void onCompletion(RecordMetadata recordMetadata, Exception e) {
|
|
||||||
System.out.println("=======主题:" + recordMetadata.topic() +"====分区:"+recordMetadata.partition()+ ", e = " + e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
producer.close();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
package com.dalong.rocketmq;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ConsumerMq {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx2");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("PartOrder","*");
|
|
||||||
consumer.setMessageModel(MessageModel.CLUSTERING);//集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式 同一个组里多个消费者都能消费到消息
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println(Thread.currentThread().getName()+"========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags);
|
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
package com.dalong.rocketmq;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ConsumerMq2 {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx2");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("wula","*");
|
|
||||||
// consumer.setMessageModel(MessageModel.CLUSTERING);//集群消费
|
|
||||||
consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式
|
|
||||||
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println("========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags);
|
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package com.dalong.rocketmq;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ConsumerMq3 {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx6");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876;192.168.37.131:9876");
|
|
||||||
consumer.subscribe("BALA2","*");
|
|
||||||
consumer.setConsumeMessageBatchMaxSize(1);
|
|
||||||
consumer.setMessageModel(MessageModel.CLUSTERING);//集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式 同一个组里多个消费者都能消费到消息
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println(System.currentTimeMillis()+":"+Thread.currentThread().getName()+"========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags);
|
|
||||||
|
|
||||||
try {
|
|
||||||
if( mes.getKeys().equals("KEY==2")){
|
|
||||||
int i=1/0;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package com.dalong.rocketmq;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
|
||||||
import org.apache.rocketmq.client.producer.SendResult;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class ExRocketMQ {
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
DefaultMQProducer producer = new DefaultMQProducer("ooxx5");
|
|
||||||
// 设置NameServer的地址
|
|
||||||
producer.setNamesrvAddr("192.168.37.133:9876;192.168.37.131:9876");
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
ArrayList<Message> list=new ArrayList<>();
|
|
||||||
for (int i=0;i<10;i++){
|
|
||||||
list.add(new Message("BALA2","TAGA","KEY=="+i,("message=="+i).getBytes()));
|
|
||||||
}
|
|
||||||
SendResult sendResult= producer.send(list);
|
|
||||||
System.out.println("=====》" + sendResult);
|
|
||||||
producer.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.dalong.rocketmq.batch;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BatchRocketConsumer {
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx4");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("BatchTopic","*");
|
|
||||||
consumer.setMessageModel(MessageModel.CLUSTERING);//默认集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式
|
|
||||||
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println("========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags+"延时:"+(mes.getStoreTimestamp()-mes.getBornTimestamp()));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.dalong.rocketmq.batch;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class BatchRocketProducer {
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
DefaultMQProducer producer = new DefaultMQProducer("ooxxk");
|
|
||||||
// 设置NameServer的地址
|
|
||||||
producer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
int total=10;
|
|
||||||
List<Message> mesList=new ArrayList<>();
|
|
||||||
for (int i=0;i<total;i++){
|
|
||||||
Message message=new Message("BatchTopic",("Batch==="+i).getBytes());
|
|
||||||
mesList.add(message);
|
|
||||||
}
|
|
||||||
producer.send(mesList);
|
|
||||||
producer.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.dalong.rocketmq.bean;
|
|
||||||
|
|
||||||
public class Order {
|
|
||||||
private long id;
|
|
||||||
private String des;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDes() {
|
|
||||||
return des;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDes(String des) {
|
|
||||||
this.des = des;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Order{" +
|
|
||||||
"id=" + id +
|
|
||||||
", des='" + des + '\'' +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package com.dalong.rocketmq.filter;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.MessageSelector;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FilterRocketConsumer {
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("sqlfilter2");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("FilterTopic", MessageSelector.bySql("dalong is not null and dalong between 0 and 5"));
|
|
||||||
consumer.setMessageModel(MessageModel.CLUSTERING);//默认集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式
|
|
||||||
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println("========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags+"延时:"+(mes.getStoreTimestamp()-mes.getBornTimestamp()));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package com.dalong.rocketmq.filter;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
|
||||||
import org.apache.rocketmq.client.producer.SendResult;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class FilterRocketProducer {
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
DefaultMQProducer producer = new DefaultMQProducer("ooxxz",false);
|
|
||||||
// 设置NameServer的地址
|
|
||||||
producer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
int total=10;
|
|
||||||
List<Message> mesList=new ArrayList<>();
|
|
||||||
for (int i=0;i<total;i++){
|
|
||||||
Message message=new Message("FilterTopic",("FilterTopic==="+i).getBytes());
|
|
||||||
message.putUserProperty("dalong",String.valueOf(i));
|
|
||||||
SendResult sendResult= producer.send(message);
|
|
||||||
System.out.println("args = " + sendResult);
|
|
||||||
}
|
|
||||||
producer.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
package com.dalong.rocketmq.order;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.*;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.consumer.ConsumeFromWhere;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class ConsumerInOrder {
|
|
||||||
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx4");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("PartOrder","*");
|
|
||||||
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
|
|
||||||
// consumer.setMessageModel(MessageModel.CLUSTERING);//集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式 同一个组里多个消费者都能消费到消息
|
|
||||||
|
|
||||||
consumer.registerMessageListener(new MessageListenerOrderly() {
|
|
||||||
Random round=new Random();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ConsumeOrderlyStatus consumeMessage(List<MessageExt> msgs, ConsumeOrderlyContext context) {
|
|
||||||
context.setAutoCommit(true);
|
|
||||||
for(MessageExt msg:msgs){
|
|
||||||
System.out.println(Thread.currentThread().getName()+"========>msgs = " + new String(msg.getBody()) + ", context = " + context);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
TimeUnit.MILLISECONDS.sleep(round.nextInt(300));
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT;
|
|
||||||
}
|
|
||||||
return ConsumeOrderlyStatus.SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,105 +0,0 @@
|
|||||||
package com.dalong.rocketmq.order;
|
|
||||||
|
|
||||||
import com.dalong.rocketmq.bean.Order;
|
|
||||||
import org.apache.rocketmq.client.exception.MQBrokerException;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
|
||||||
import org.apache.rocketmq.client.producer.MessageQueueSelector;
|
|
||||||
import org.apache.rocketmq.client.producer.SendResult;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
import org.apache.rocketmq.common.message.MessageQueue;
|
|
||||||
import org.apache.rocketmq.remoting.exception.RemotingException;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class OrderProducer {
|
|
||||||
public static void main(String[] args) throws MQClientException, MQBrokerException, RemotingException, InterruptedException {
|
|
||||||
DefaultMQProducer producer = new DefaultMQProducer("ooxx");
|
|
||||||
// 设置NameServer的地址
|
|
||||||
producer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
// send5(producer);
|
|
||||||
MessageQueue messageQueue=new MessageQueue("wula","broker-a",0);
|
|
||||||
for (int i=0;i<20;i++){
|
|
||||||
// Message message=new Message();
|
|
||||||
// message.setTopic("wula");
|
|
||||||
// message.setTags("taga");
|
|
||||||
// message.setBody(("bodyooxx==="+i).getBytes());
|
|
||||||
// message.setWaitStoreMsgOK(true);
|
|
||||||
List<Order> list= buildOrders();
|
|
||||||
for(int j=0;i<list.size();i++){
|
|
||||||
String body= list.get(j).toString();
|
|
||||||
Message message=new Message();
|
|
||||||
message.setTopic("PartOrder");
|
|
||||||
message.setTags(null);
|
|
||||||
message.setBody(body.getBytes());
|
|
||||||
message.setWaitStoreMsgOK(true);
|
|
||||||
SendResult sendResult=producer.send(message, new MessageQueueSelector() {
|
|
||||||
@Override
|
|
||||||
public MessageQueue select(List<MessageQueue> list, Message message, Object o) {
|
|
||||||
System.out.println("====>list = " + list + ", message = " + message + ", o = " + o);
|
|
||||||
long id=(Long)o;
|
|
||||||
long index= id%list.size();
|
|
||||||
return list.get((int)index);
|
|
||||||
}
|
|
||||||
}, list.get(i).getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
producer.shutdown();
|
|
||||||
}
|
|
||||||
private static List<Order> buildOrders(){
|
|
||||||
List<Order> orders=new ArrayList<>();
|
|
||||||
Order order=new Order();
|
|
||||||
order.setId(001);
|
|
||||||
order.setDes("创建");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(002);
|
|
||||||
order.setDes("创建");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(003);
|
|
||||||
order.setDes("创建");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(001);
|
|
||||||
order.setDes("付款");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(001);
|
|
||||||
order.setDes("推送");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(002);
|
|
||||||
order.setDes("付款");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(003);
|
|
||||||
order.setDes("付款");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(002);
|
|
||||||
order.setDes("推送");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
order=new Order();
|
|
||||||
order.setId(003);
|
|
||||||
order.setDes("推送");
|
|
||||||
orders.add(order);
|
|
||||||
|
|
||||||
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.dalong.rocketmq.schedule;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ScheduleRocketConsumer {
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx4");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("ScTopic","*");
|
|
||||||
consumer.setMessageModel(MessageModel.CLUSTERING);//默认集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式
|
|
||||||
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println("========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags+"延时:"+(mes.getStoreTimestamp()-mes.getBornTimestamp()));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.dalong.rocketmq.sendbrokername;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.exception.MQBrokerException;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.client.producer.DefaultMQProducer;
|
|
||||||
import org.apache.rocketmq.client.producer.SendResult;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
import org.apache.rocketmq.common.message.MessageQueue;
|
|
||||||
import org.apache.rocketmq.remoting.exception.RemotingException;
|
|
||||||
|
|
||||||
public class SendBrokerNameProducer {
|
|
||||||
public static void main(String[] args) throws MQClientException, MQBrokerException, RemotingException, InterruptedException {
|
|
||||||
DefaultMQProducer producer = new DefaultMQProducer("ooxx2");
|
|
||||||
// 设置NameServer的地址
|
|
||||||
producer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
// send5(producer);
|
|
||||||
for (int i=0;i<20;i++){
|
|
||||||
Message message=new Message();
|
|
||||||
message.setTopic("wula_3");
|
|
||||||
message.setTags("taga");
|
|
||||||
message.setBody(("bodyooxx==="+i).getBytes());
|
|
||||||
message.setWaitStoreMsgOK(true);
|
|
||||||
|
|
||||||
MessageQueue messageQueue=new MessageQueue("wula_3","broker-b",0);
|
|
||||||
SendResult sendResult=producer.send(message,messageQueue);
|
|
||||||
System.out.println(sendResult);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
producer.shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
package com.dalong.rocketmq.transaction;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.producer.LocalTransactionState;
|
|
||||||
import org.apache.rocketmq.client.producer.TransactionListener;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
|
|
||||||
public class TransactionListenerImpl implements TransactionListener {
|
|
||||||
@Override
|
|
||||||
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
|
|
||||||
String s= (String) arg;
|
|
||||||
System.out.println("=======>执行executeLocalTransaction:"+s);
|
|
||||||
return LocalTransactionState.UNKNOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
|
|
||||||
System.out.println("=======>检查checkLocalTransaction");
|
|
||||||
|
|
||||||
return LocalTransactionState.COMMIT_MESSAGE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.dalong.rocketmq.transaction;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.producer.LocalTransactionState;
|
|
||||||
import org.apache.rocketmq.client.producer.TransactionListener;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
|
|
||||||
public class TransactionListenerImpl2 implements TransactionListener {
|
|
||||||
@Override
|
|
||||||
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
|
|
||||||
System.out.println("=======>执行2executeLocalTransaction");
|
|
||||||
return LocalTransactionState.COMMIT_MESSAGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalTransactionState checkLocalTransaction(MessageExt msg) {
|
|
||||||
System.out.println("=======>检查2checkLocalTransaction");
|
|
||||||
|
|
||||||
return LocalTransactionState.COMMIT_MESSAGE;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package com.dalong.rocketmq.transaction;
|
|
||||||
|
|
||||||
import ch.qos.logback.core.util.TimeUtil;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.client.producer.SendResult;
|
|
||||||
import org.apache.rocketmq.client.producer.TransactionListener;
|
|
||||||
import org.apache.rocketmq.client.producer.TransactionMQProducer;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import java.util.concurrent.*;
|
|
||||||
|
|
||||||
public class TransactionProducer {
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
TransactionListener transactionListener=new TransactionListenerImpl();
|
|
||||||
|
|
||||||
TransactionMQProducer producer=new TransactionMQProducer("TransactionMQProducer3");
|
|
||||||
// producer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
producer.setNamesrvAddr("192.168.37.131:9876;192.168.37.133:9876");
|
|
||||||
|
|
||||||
ExecutorService executorService=new ThreadPoolExecutor(2,5,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<>(16),new ThreadFactory(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Thread newThread(Runnable r) {
|
|
||||||
Thread thread=new Thread(r);
|
|
||||||
thread.setName("=====>check-thread");
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
producer.setExecutorService(executorService);
|
|
||||||
producer.setTransactionListener(transactionListener);
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
|
|
||||||
Message message=new Message("TransactionProducer2"," A转钱B to==1》".getBytes());
|
|
||||||
SendResult sendResult= producer.sendMessageInTransaction(message,null);
|
|
||||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat();
|
|
||||||
System.out.println("===>sendResult:" + sendResult.getSendStatus()+":"+simpleDateFormat.format(new Date()));
|
|
||||||
// 让主线程等待,以便执行事务状态回查
|
|
||||||
for (int i = 0; i < 10000; i++) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
producer.shutdown();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package com.dalong.rocketmq.transaction;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.client.producer.SendResult;
|
|
||||||
import org.apache.rocketmq.client.producer.TransactionListener;
|
|
||||||
import org.apache.rocketmq.client.producer.TransactionMQProducer;
|
|
||||||
import org.apache.rocketmq.common.message.Message;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.concurrent.*;
|
|
||||||
|
|
||||||
public class TransactionProducer2 {
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
TransactionListener transactionListener=new TransactionListenerImpl2();
|
|
||||||
|
|
||||||
TransactionMQProducer producer=new TransactionMQProducer("TransactionMQProducer");
|
|
||||||
producer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
|
|
||||||
ExecutorService executorService=new ThreadPoolExecutor(2,5,100,TimeUnit.MILLISECONDS,new ArrayBlockingQueue<>(16),new ThreadFactory(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Thread newThread(Runnable r) {
|
|
||||||
Thread thread=new Thread(r);
|
|
||||||
thread.setName("=====>check-thread");
|
|
||||||
return thread;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
producer.setExecutorService(executorService);
|
|
||||||
producer.setTransactionListener(transactionListener);
|
|
||||||
// 启动Producer实例
|
|
||||||
producer.start();
|
|
||||||
|
|
||||||
Message message=new Message("TransactionProducer"," A转钱B to==2》".getBytes());
|
|
||||||
SendResult sendResult= producer.sendMessageInTransaction(message,null);
|
|
||||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat();
|
|
||||||
System.out.println("===>sendResult:" + sendResult.getSendStatus()+simpleDateFormat.format(new Date()));
|
|
||||||
// 让主线程等待,以便执行事务状态回查
|
|
||||||
for (int i = 0; i < 10000; i++) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
producer.shutdown();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package com.dalong.rocketmq.transaction;
|
|
||||||
|
|
||||||
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
|
|
||||||
import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
|
|
||||||
import org.apache.rocketmq.client.exception.MQClientException;
|
|
||||||
import org.apache.rocketmq.common.message.MessageExt;
|
|
||||||
import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TransactionRocketConsumer {
|
|
||||||
public static void main(String[] args) throws MQClientException {
|
|
||||||
// 集群消費
|
|
||||||
DefaultMQPushConsumer consumer=new DefaultMQPushConsumer("ooxx4");
|
|
||||||
consumer.setNamesrvAddr("192.168.37.133:9876");
|
|
||||||
consumer.subscribe("TransactionProducer","*");
|
|
||||||
consumer.setMessageModel(MessageModel.CLUSTERING);//默认集群消费
|
|
||||||
// consumer.setMessageModel(MessageModel.BROADCASTING);//广播模式
|
|
||||||
|
|
||||||
consumer.registerMessageListener(new MessageListenerConcurrently() {
|
|
||||||
@Override
|
|
||||||
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> list, ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
||||||
for(MessageExt mes:list){
|
|
||||||
String topic= mes.getTopic();
|
|
||||||
try {
|
|
||||||
String msgbody=new String(mes.getBody(),"UTF-8");
|
|
||||||
String tags=mes.getTags();
|
|
||||||
System.out.println("========》topic" + topic+"===>msgbody:"+msgbody+"===>tags:"+tags+"延时:"+(mes.getStoreTimestamp()-mes.getBornTimestamp()));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
consumer.start();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,80 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>msb-mall</artifactId>
|
|
||||||
<groupId>com.msb.mall</groupId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>mall-commons</artifactId>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
<version>1.18.24</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus</artifactId>
|
|
||||||
<version>3.4.3.4</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
|
||||||
<artifactId>httpcore</artifactId>
|
|
||||||
<version>4.4.14</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.validation</groupId>
|
|
||||||
<artifactId>validation-api</artifactId>
|
|
||||||
<version>1.1.0.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-lang</groupId>
|
|
||||||
<artifactId>commons-lang</artifactId>
|
|
||||||
<version>2.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.baomidou</groupId>
|
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
|
||||||
<version>3.3.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
|
||||||
<version>8.0.28</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-seata</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
|
||||||
<version>2.3.7.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
|
||||||
<version>2.2.8.RELEASE</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
</project>
|
|
@ -1,64 +0,0 @@
|
|||||||
///**
|
|
||||||
// * Copyright (c) 2016-2019 人人开源 All rights reserved.
|
|
||||||
// *
|
|
||||||
// * https://www.renren.io
|
|
||||||
// *
|
|
||||||
// * 版权所有,侵权必究!
|
|
||||||
// */
|
|
||||||
//
|
|
||||||
//package com.msb.mall.commons.exception;
|
|
||||||
//
|
|
||||||
//import io.renren.common.utils.R;
|
|
||||||
//import org.apache.shiro.authz.AuthorizationException;
|
|
||||||
//import org.slf4j.Logger;
|
|
||||||
//import org.slf4j.LoggerFactory;
|
|
||||||
//import org.springframework.dao.DuplicateKeyException;
|
|
||||||
//import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
||||||
//import org.springframework.web.bind.annotation.RestControllerAdvice;
|
|
||||||
//import org.springframework.web.servlet.NoHandlerFoundException;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 异常处理器
|
|
||||||
// *
|
|
||||||
// * @author Mark sunlightcs@gmail.com
|
|
||||||
// */
|
|
||||||
//@RestControllerAdvice
|
|
||||||
//public class RRExceptionHandler {
|
|
||||||
// private Logger logger = LoggerFactory.getLogger(getClass());
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 处理自定义异常
|
|
||||||
// */
|
|
||||||
// @ExceptionHandler(RRException.class)
|
|
||||||
// public R handleRRException(RRException e){
|
|
||||||
// R r = new R();
|
|
||||||
// r.put("code", e.getCode());
|
|
||||||
// r.put("msg", e.getMessage());
|
|
||||||
//
|
|
||||||
// return r;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @ExceptionHandler(NoHandlerFoundException.class)
|
|
||||||
// public R handlerNoFoundException(Exception e) {
|
|
||||||
// logger.error(e.getMessage(), e);
|
|
||||||
// return R.error(404, "路径不存在,请检查路径是否正确");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @ExceptionHandler(DuplicateKeyException.class)
|
|
||||||
// public R handleDuplicateKeyException(DuplicateKeyException e){
|
|
||||||
// logger.error(e.getMessage(), e);
|
|
||||||
// return R.error("数据库中已存在该记录");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @ExceptionHandler(AuthorizationException.class)
|
|
||||||
// public R handleAuthorizationException(AuthorizationException e){
|
|
||||||
// logger.error(e.getMessage(), e);
|
|
||||||
// return R.error("没有权限,请联系管理员授权");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @ExceptionHandler(Exception.class)
|
|
||||||
// public R handleException(Exception e){
|
|
||||||
// logger.error(e.getMessage(), e);
|
|
||||||
// return R.error();
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -1,31 +0,0 @@
|
|||||||
HELP.md
|
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
!**/src/main/**
|
|
||||||
!**/src/test/**
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
build/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2007-present the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.net.*;
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.channels.*;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
public class MavenWrapperDownloader {
|
|
||||||
|
|
||||||
private static final String WRAPPER_VERSION = "0.5.6";
|
|
||||||
/**
|
|
||||||
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
|
|
||||||
*/
|
|
||||||
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
|
|
||||||
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
|
|
||||||
* use instead of the default one.
|
|
||||||
*/
|
|
||||||
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
|
|
||||||
".mvn/wrapper/maven-wrapper.properties";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Path where the maven-wrapper.jar will be saved to.
|
|
||||||
*/
|
|
||||||
private static final String MAVEN_WRAPPER_JAR_PATH =
|
|
||||||
".mvn/wrapper/maven-wrapper.jar";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name of the property which should be used to override the default download url for the wrapper.
|
|
||||||
*/
|
|
||||||
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
|
|
||||||
|
|
||||||
public static void main(String args[]) {
|
|
||||||
System.out.println("- Downloader started");
|
|
||||||
File baseDirectory = new File(args[0]);
|
|
||||||
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
|
|
||||||
|
|
||||||
// If the maven-wrapper.properties exists, read it and check if it contains a custom
|
|
||||||
// wrapperUrl parameter.
|
|
||||||
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
|
|
||||||
String url = DEFAULT_DOWNLOAD_URL;
|
|
||||||
if (mavenWrapperPropertyFile.exists()) {
|
|
||||||
FileInputStream mavenWrapperPropertyFileInputStream = null;
|
|
||||||
try {
|
|
||||||
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
|
|
||||||
Properties mavenWrapperProperties = new Properties();
|
|
||||||
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
|
|
||||||
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (mavenWrapperPropertyFileInputStream != null) {
|
|
||||||
mavenWrapperPropertyFileInputStream.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Ignore ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("- Downloading from: " + url);
|
|
||||||
|
|
||||||
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
|
|
||||||
if (!outputFile.getParentFile().exists()) {
|
|
||||||
if (!outputFile.getParentFile().mkdirs()) {
|
|
||||||
System.out.println(
|
|
||||||
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
|
|
||||||
try {
|
|
||||||
downloadFileFromURL(url, outputFile);
|
|
||||||
System.out.println("Done");
|
|
||||||
System.exit(0);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
System.out.println("- Error downloading");
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
|
|
||||||
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
|
|
||||||
String username = System.getenv("MVNW_USERNAME");
|
|
||||||
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
|
|
||||||
Authenticator.setDefault(new Authenticator() {
|
|
||||||
@Override
|
|
||||||
protected PasswordAuthentication getPasswordAuthentication() {
|
|
||||||
return new PasswordAuthentication(username, password);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
URL website = new URL(urlString);
|
|
||||||
ReadableByteChannel rbc;
|
|
||||||
rbc = Channels.newChannel(website.openStream());
|
|
||||||
FileOutputStream fos = new FileOutputStream(destination);
|
|
||||||
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
|
|
||||||
fos.close();
|
|
||||||
rbc.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
|
||||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
|
@ -1,4 +0,0 @@
|
|||||||
# 工程简介
|
|
||||||
|
|
||||||
# 延伸阅读
|
|
||||||
|
|
@ -1,310 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
# or more contributor license agreements. See the NOTICE file
|
|
||||||
# distributed with this work for additional information
|
|
||||||
# regarding copyright ownership. The ASF licenses this file
|
|
||||||
# to you under the Apache License, Version 2.0 (the
|
|
||||||
# "License"); you may not use this file except in compliance
|
|
||||||
# with the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing,
|
|
||||||
# software distributed under the License is distributed on an
|
|
||||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
# KIND, either express or implied. See the License for the
|
|
||||||
# specific language governing permissions and limitations
|
|
||||||
# under the License.
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
# Maven Start Up Batch script
|
|
||||||
#
|
|
||||||
# Required ENV vars:
|
|
||||||
# ------------------
|
|
||||||
# JAVA_HOME - location of a JDK home dir
|
|
||||||
#
|
|
||||||
# Optional ENV vars
|
|
||||||
# -----------------
|
|
||||||
# M2_HOME - location of maven2's installed home dir
|
|
||||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
# e.g. to debug Maven itself, use
|
|
||||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
# ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
|
||||||
|
|
||||||
if [ -f /etc/mavenrc ] ; then
|
|
||||||
. /etc/mavenrc
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$HOME/.mavenrc" ] ; then
|
|
||||||
. "$HOME/.mavenrc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# OS specific support. $var _must_ be set to either true or false.
|
|
||||||
cygwin=false;
|
|
||||||
darwin=false;
|
|
||||||
mingw=false
|
|
||||||
case "`uname`" in
|
|
||||||
CYGWIN*) cygwin=true ;;
|
|
||||||
MINGW*) mingw=true;;
|
|
||||||
Darwin*) darwin=true
|
|
||||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
|
||||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
if [ -x "/usr/libexec/java_home" ]; then
|
|
||||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
|
||||||
else
|
|
||||||
export JAVA_HOME="/Library/Java/Home"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
if [ -r /etc/gentoo-release ] ; then
|
|
||||||
JAVA_HOME=`java-config --jre-home`
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$M2_HOME" ] ; then
|
|
||||||
## resolve links - $0 may be a link to maven's home
|
|
||||||
PRG="$0"
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
|
||||||
while [ -h "$PRG" ] ; do
|
|
||||||
ls=`ls -ld "$PRG"`
|
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
||||||
if expr "$link" : '/.*' > /dev/null; then
|
|
||||||
PRG="$link"
|
|
||||||
else
|
|
||||||
PRG="`dirname "$PRG"`/$link"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
M2_HOME=`dirname "$PRG"`/..
|
|
||||||
|
|
||||||
# make it fully qualified
|
|
||||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
|
||||||
|
|
||||||
cd "$saveddir"
|
|
||||||
# echo Using m2 at $M2_HOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $cygwin ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# For Mingw, ensure paths are in UNIX format before anything is touched
|
|
||||||
if $mingw ; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ]; then
|
|
||||||
javaExecutable="`which javac`"
|
|
||||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
|
||||||
# readlink(1) is not available as standard on Solaris 10.
|
|
||||||
readLink=`which readlink`
|
|
||||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
|
||||||
if $darwin ; then
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
|
||||||
else
|
|
||||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
|
||||||
fi
|
|
||||||
javaHome="`dirname \"$javaExecutable\"`"
|
|
||||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
|
||||||
JAVA_HOME="$javaHome"
|
|
||||||
export JAVA_HOME
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVACMD" ] ; then
|
|
||||||
if [ -n "$JAVA_HOME" ] ; then
|
|
||||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
|
||||||
# IBM's JDK on AIX uses strange locations for the executables
|
|
||||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
|
||||||
else
|
|
||||||
JAVACMD="$JAVA_HOME/bin/java"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
JAVACMD="`which java`"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -x "$JAVACMD" ] ; then
|
|
||||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
|
||||||
echo " We cannot execute $JAVACMD" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$JAVA_HOME" ] ; then
|
|
||||||
echo "Warning: JAVA_HOME environment variable is not set."
|
|
||||||
fi
|
|
||||||
|
|
||||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
|
||||||
|
|
||||||
# traverses directory structure from process work directory to filesystem root
|
|
||||||
# first directory with .mvn subdirectory is considered project base directory
|
|
||||||
find_maven_basedir() {
|
|
||||||
|
|
||||||
if [ -z "$1" ]
|
|
||||||
then
|
|
||||||
echo "Path not specified to find_maven_basedir"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
basedir="$1"
|
|
||||||
wdir="$1"
|
|
||||||
while [ "$wdir" != '/' ] ; do
|
|
||||||
if [ -d "$wdir"/.mvn ] ; then
|
|
||||||
basedir=$wdir
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
|
||||||
if [ -d "${wdir}" ]; then
|
|
||||||
wdir=`cd "$wdir/.."; pwd`
|
|
||||||
fi
|
|
||||||
# end of workaround
|
|
||||||
done
|
|
||||||
echo "${basedir}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# concatenates all lines of a file
|
|
||||||
concat_lines() {
|
|
||||||
if [ -f "$1" ]; then
|
|
||||||
echo "$(tr -s '\n' ' ' < "$1")"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
|
||||||
if [ -z "$BASE_DIR" ]; then
|
|
||||||
exit 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
##########################################################################################
|
|
||||||
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
||||||
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
||||||
##########################################################################################
|
|
||||||
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
|
||||||
fi
|
|
||||||
if [ -n "$MVNW_REPOURL" ]; then
|
|
||||||
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
|
||||||
else
|
|
||||||
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
|
||||||
fi
|
|
||||||
while IFS="=" read key value; do
|
|
||||||
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
|
||||||
esac
|
|
||||||
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Downloading from: $jarUrl"
|
|
||||||
fi
|
|
||||||
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
|
||||||
if $cygwin; then
|
|
||||||
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
if command -v wget > /dev/null; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found wget ... using wget"
|
|
||||||
fi
|
|
||||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
||||||
wget "$jarUrl" -O "$wrapperJarPath"
|
|
||||||
else
|
|
||||||
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
|
||||||
fi
|
|
||||||
elif command -v curl > /dev/null; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Found curl ... using curl"
|
|
||||||
fi
|
|
||||||
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
|
||||||
curl -o "$wrapperJarPath" "$jarUrl" -f
|
|
||||||
else
|
|
||||||
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo "Falling back to using Java to download"
|
|
||||||
fi
|
|
||||||
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
|
||||||
# For Cygwin, switch paths to Windows format before running javac
|
|
||||||
if $cygwin; then
|
|
||||||
javaClass=`cygpath --path --windows "$javaClass"`
|
|
||||||
fi
|
|
||||||
if [ -e "$javaClass" ]; then
|
|
||||||
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo " - Compiling MavenWrapperDownloader.java ..."
|
|
||||||
fi
|
|
||||||
# Compiling the Java class
|
|
||||||
("$JAVA_HOME/bin/javac" "$javaClass")
|
|
||||||
fi
|
|
||||||
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
|
||||||
# Running the downloader
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo " - Running MavenWrapperDownloader.java ..."
|
|
||||||
fi
|
|
||||||
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
##########################################################################################
|
|
||||||
# End of extension
|
|
||||||
##########################################################################################
|
|
||||||
|
|
||||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
|
||||||
if [ "$MVNW_VERBOSE" = true ]; then
|
|
||||||
echo $MAVEN_PROJECTBASEDIR
|
|
||||||
fi
|
|
||||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
|
||||||
|
|
||||||
# For Cygwin, switch paths to Windows format before running java
|
|
||||||
if $cygwin; then
|
|
||||||
[ -n "$M2_HOME" ] &&
|
|
||||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
|
||||||
[ -n "$JAVA_HOME" ] &&
|
|
||||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
|
||||||
[ -n "$CLASSPATH" ] &&
|
|
||||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
|
||||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
|
||||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Provide a "standardized" way to retrieve the CLI args that will
|
|
||||||
# work with both Windows and non-Windows executions.
|
|
||||||
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
|
||||||
export MAVEN_CMD_LINE_ARGS
|
|
||||||
|
|
||||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
exec "$JAVACMD" \
|
|
||||||
$MAVEN_OPTS \
|
|
||||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
|
||||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
|
||||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
|
@ -1,182 +0,0 @@
|
|||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
@REM or more contributor license agreements. See the NOTICE file
|
|
||||||
@REM distributed with this work for additional information
|
|
||||||
@REM regarding copyright ownership. The ASF licenses this file
|
|
||||||
@REM to you under the Apache License, Version 2.0 (the
|
|
||||||
@REM "License"); you may not use this file except in compliance
|
|
||||||
@REM with the License. You may obtain a copy of the License at
|
|
||||||
@REM
|
|
||||||
@REM https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
@REM
|
|
||||||
@REM Unless required by applicable law or agreed to in writing,
|
|
||||||
@REM software distributed under the License is distributed on an
|
|
||||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
@REM KIND, either express or implied. See the License for the
|
|
||||||
@REM specific language governing permissions and limitations
|
|
||||||
@REM under the License.
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
@REM Maven Start Up Batch script
|
|
||||||
@REM
|
|
||||||
@REM Required ENV vars:
|
|
||||||
@REM JAVA_HOME - location of a JDK home dir
|
|
||||||
@REM
|
|
||||||
@REM Optional ENV vars
|
|
||||||
@REM M2_HOME - location of maven2's installed home dir
|
|
||||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
|
||||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
|
||||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
|
||||||
@REM e.g. to debug Maven itself, use
|
|
||||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
|
||||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
|
||||||
@REM ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
|
||||||
@echo off
|
|
||||||
@REM set title of command window
|
|
||||||
title %0
|
|
||||||
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
|
||||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
|
||||||
|
|
||||||
@REM set %HOME% to equivalent of $HOME
|
|
||||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
|
||||||
|
|
||||||
@REM Execute a user defined script before this one
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
|
||||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
|
||||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
|
||||||
:skipRcPre
|
|
||||||
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
set ERROR_CODE=0
|
|
||||||
|
|
||||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
|
||||||
@setlocal
|
|
||||||
|
|
||||||
@REM ==== START VALIDATION ====
|
|
||||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME not found in your environment. >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:OkJHome
|
|
||||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
|
||||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
@REM ==== END VALIDATION ====
|
|
||||||
|
|
||||||
:init
|
|
||||||
|
|
||||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
|
||||||
@REM Fallback to current working directory if not found.
|
|
||||||
|
|
||||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
|
||||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
|
||||||
|
|
||||||
set EXEC_DIR=%CD%
|
|
||||||
set WDIR=%EXEC_DIR%
|
|
||||||
:findBaseDir
|
|
||||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
|
||||||
cd ..
|
|
||||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
|
||||||
set WDIR=%CD%
|
|
||||||
goto findBaseDir
|
|
||||||
|
|
||||||
:baseDirFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
goto endDetectBaseDir
|
|
||||||
|
|
||||||
:baseDirNotFound
|
|
||||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
|
||||||
cd "%EXEC_DIR%"
|
|
||||||
|
|
||||||
:endDetectBaseDir
|
|
||||||
|
|
||||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
|
||||||
|
|
||||||
@setlocal EnableExtensions EnableDelayedExpansion
|
|
||||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
|
||||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
|
||||||
|
|
||||||
:endReadAdditionalConfig
|
|
||||||
|
|
||||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|
||||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
|
||||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
|
||||||
|
|
||||||
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
|
||||||
|
|
||||||
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
|
||||||
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
|
||||||
)
|
|
||||||
|
|
||||||
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
|
||||||
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
|
||||||
if exist %WRAPPER_JAR% (
|
|
||||||
if "%MVNW_VERBOSE%" == "true" (
|
|
||||||
echo Found %WRAPPER_JAR%
|
|
||||||
)
|
|
||||||
) else (
|
|
||||||
if not "%MVNW_REPOURL%" == "" (
|
|
||||||
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
|
||||||
)
|
|
||||||
if "%MVNW_VERBOSE%" == "true" (
|
|
||||||
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
|
||||||
echo Downloading from: %DOWNLOAD_URL%
|
|
||||||
)
|
|
||||||
|
|
||||||
powershell -Command "&{"^
|
|
||||||
"$webclient = new-object System.Net.WebClient;"^
|
|
||||||
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
|
||||||
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
|
||||||
"}"^
|
|
||||||
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
|
||||||
"}"
|
|
||||||
if "%MVNW_VERBOSE%" == "true" (
|
|
||||||
echo Finished downloading %WRAPPER_JAR%
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@REM End of extension
|
|
||||||
|
|
||||||
@REM Provide a "standardized" way to retrieve the CLI args that will
|
|
||||||
@REM work with both Windows and non-Windows executions.
|
|
||||||
set MAVEN_CMD_LINE_ARGS=%*
|
|
||||||
|
|
||||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
|
||||||
if ERRORLEVEL 1 goto error
|
|
||||||
goto end
|
|
||||||
|
|
||||||
:error
|
|
||||||
set ERROR_CODE=1
|
|
||||||
|
|
||||||
:end
|
|
||||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
|
||||||
|
|
||||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
|
||||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
|
||||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
|
||||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
|
||||||
:skipRcPost
|
|
||||||
|
|
||||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
|
||||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
|
||||||
|
|
||||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
|
||||||
|
|
||||||
exit /B %ERROR_CODE%
|
|
@ -1,109 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>com.msb.mall</groupId>
|
|
||||||
<artifactId>mall-coupon</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<name>mall-coupon</name>
|
|
||||||
<description>mall-coupon</description>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
<spring-boot.version>2.3.7.RELEASE</spring-boot.version>
|
|
||||||
<spring-cloud.version>Hoxton.SR9</spring-cloud.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.msb.mall</groupId>
|
|
||||||
<artifactId>mall-commons</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>javax.validation</groupId>
|
|
||||||
<artifactId>validation-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
|
||||||
<version>2.2.6.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.junit.vintage</groupId>
|
|
||||||
<artifactId>junit-vintage-engine</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-dependencies</artifactId>
|
|
||||||
<version>${spring-cloud.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
|
||||||
<version>2.3.7.RELEASE</version>
|
|
||||||
<configuration>
|
|
||||||
<mainClass>com.msb.mall.coupon.MallCouponApplication</mainClass>
|
|
||||||
</configuration>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>repackage</id>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon;
|
|
||||||
|
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
||||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
|
||||||
@EnableDiscoveryClient
|
|
||||||
@MapperScan("com.msb.mall.coupon.dao")
|
|
||||||
public class MallCouponApplication {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(MallCouponApplication.class, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.datasource.ReadOnlyConnection;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponEntity;
|
|
||||||
import com.msb.mall.coupon.service.CouponService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/coupon")
|
|
||||||
public class CouponController {
|
|
||||||
@Autowired
|
|
||||||
private CouponService couponService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
@ReadOnlyConnection
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = couponService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
CouponEntity coupon = couponService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("coupon", coupon);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody CouponEntity coupon){
|
|
||||||
couponService.save(coupon);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody CouponEntity coupon){
|
|
||||||
couponService.updateById(coupon);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
couponService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponHistoryEntity;
|
|
||||||
import com.msb.mall.coupon.service.CouponHistoryService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券领取历史记录
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/couponhistory")
|
|
||||||
public class CouponHistoryController {
|
|
||||||
@Autowired
|
|
||||||
private CouponHistoryService couponHistoryService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = couponHistoryService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
CouponHistoryEntity couponHistory = couponHistoryService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("couponHistory", couponHistory);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody CouponHistoryEntity couponHistory){
|
|
||||||
couponHistoryService.save(couponHistory);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody CouponHistoryEntity couponHistory){
|
|
||||||
couponHistoryService.updateById(couponHistory);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
couponHistoryService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponSpuCategoryRelationEntity;
|
|
||||||
import com.msb.mall.coupon.service.CouponSpuCategoryRelationService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券分类关联
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/couponspucategoryrelation")
|
|
||||||
public class CouponSpuCategoryRelationController {
|
|
||||||
@Autowired
|
|
||||||
private CouponSpuCategoryRelationService couponSpuCategoryRelationService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = couponSpuCategoryRelationService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
CouponSpuCategoryRelationEntity couponSpuCategoryRelation = couponSpuCategoryRelationService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("couponSpuCategoryRelation", couponSpuCategoryRelation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody CouponSpuCategoryRelationEntity couponSpuCategoryRelation){
|
|
||||||
couponSpuCategoryRelationService.save(couponSpuCategoryRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody CouponSpuCategoryRelationEntity couponSpuCategoryRelation){
|
|
||||||
couponSpuCategoryRelationService.updateById(couponSpuCategoryRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
couponSpuCategoryRelationService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponSpuRelationEntity;
|
|
||||||
import com.msb.mall.coupon.service.CouponSpuRelationService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券与产品关联
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/couponspurelation")
|
|
||||||
public class CouponSpuRelationController {
|
|
||||||
@Autowired
|
|
||||||
private CouponSpuRelationService couponSpuRelationService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = couponSpuRelationService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
CouponSpuRelationEntity couponSpuRelation = couponSpuRelationService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("couponSpuRelation", couponSpuRelation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody CouponSpuRelationEntity couponSpuRelation){
|
|
||||||
couponSpuRelationService.save(couponSpuRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody CouponSpuRelationEntity couponSpuRelation){
|
|
||||||
couponSpuRelationService.updateById(couponSpuRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
couponSpuRelationService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.HomeAdvEntity;
|
|
||||||
import com.msb.mall.coupon.service.HomeAdvService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 首页轮播广告
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/homeadv")
|
|
||||||
public class HomeAdvController {
|
|
||||||
@Autowired
|
|
||||||
private HomeAdvService homeAdvService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = homeAdvService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
HomeAdvEntity homeAdv = homeAdvService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("homeAdv", homeAdv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody HomeAdvEntity homeAdv){
|
|
||||||
homeAdvService.save(homeAdv);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody HomeAdvEntity homeAdv){
|
|
||||||
homeAdvService.updateById(homeAdv);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
homeAdvService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.HomeSubjectSpuEntity;
|
|
||||||
import com.msb.mall.coupon.service.HomeSubjectSpuService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 专题商品
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/homesubjectspu")
|
|
||||||
public class HomeSubjectSpuController {
|
|
||||||
@Autowired
|
|
||||||
private HomeSubjectSpuService homeSubjectSpuService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = homeSubjectSpuService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
HomeSubjectSpuEntity homeSubjectSpu = homeSubjectSpuService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("homeSubjectSpu", homeSubjectSpu);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody HomeSubjectSpuEntity homeSubjectSpu){
|
|
||||||
homeSubjectSpuService.save(homeSubjectSpu);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody HomeSubjectSpuEntity homeSubjectSpu){
|
|
||||||
homeSubjectSpuService.updateById(homeSubjectSpu);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
homeSubjectSpuService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.MemberPriceEntity;
|
|
||||||
import com.msb.mall.coupon.service.MemberPriceService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品会员价格
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/memberprice")
|
|
||||||
public class MemberPriceController {
|
|
||||||
@Autowired
|
|
||||||
private MemberPriceService memberPriceService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = memberPriceService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
MemberPriceEntity memberPrice = memberPriceService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("memberPrice", memberPrice);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody MemberPriceEntity memberPrice){
|
|
||||||
memberPriceService.save(memberPrice);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody MemberPriceEntity memberPrice){
|
|
||||||
memberPriceService.updateById(memberPrice);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
memberPriceService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillPromotionEntity;
|
|
||||||
import com.msb.mall.coupon.service.SeckillPromotionService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀活动
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/seckillpromotion")
|
|
||||||
public class SeckillPromotionController {
|
|
||||||
@Autowired
|
|
||||||
private SeckillPromotionService seckillPromotionService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = seckillPromotionService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SeckillPromotionEntity seckillPromotion = seckillPromotionService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("seckillPromotion", seckillPromotion);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SeckillPromotionEntity seckillPromotion){
|
|
||||||
seckillPromotionService.save(seckillPromotion);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SeckillPromotionEntity seckillPromotion){
|
|
||||||
seckillPromotionService.updateById(seckillPromotion);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
seckillPromotionService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillSessionEntity;
|
|
||||||
import com.msb.mall.coupon.service.SeckillSessionService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀活动场次
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/seckillsession")
|
|
||||||
public class SeckillSessionController {
|
|
||||||
@Autowired
|
|
||||||
private SeckillSessionService seckillSessionService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = seckillSessionService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SeckillSessionEntity seckillSession = seckillSessionService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("seckillSession", seckillSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SeckillSessionEntity seckillSession){
|
|
||||||
seckillSessionService.save(seckillSession);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SeckillSessionEntity seckillSession){
|
|
||||||
seckillSessionService.updateById(seckillSession);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
seckillSessionService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillSkuNoticeEntity;
|
|
||||||
import com.msb.mall.coupon.service.SeckillSkuNoticeService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀商品通知订阅
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/seckillskunotice")
|
|
||||||
public class SeckillSkuNoticeController {
|
|
||||||
@Autowired
|
|
||||||
private SeckillSkuNoticeService seckillSkuNoticeService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = seckillSkuNoticeService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SeckillSkuNoticeEntity seckillSkuNotice = seckillSkuNoticeService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("seckillSkuNotice", seckillSkuNotice);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SeckillSkuNoticeEntity seckillSkuNotice){
|
|
||||||
seckillSkuNoticeService.save(seckillSkuNotice);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SeckillSkuNoticeEntity seckillSkuNotice){
|
|
||||||
seckillSkuNoticeService.updateById(seckillSkuNotice);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
seckillSkuNoticeService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillSkuRelationEntity;
|
|
||||||
import com.msb.mall.coupon.service.SeckillSkuRelationService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀活动商品关联
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/seckillskurelation")
|
|
||||||
public class SeckillSkuRelationController {
|
|
||||||
@Autowired
|
|
||||||
private SeckillSkuRelationService seckillSkuRelationService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = seckillSkuRelationService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SeckillSkuRelationEntity seckillSkuRelation = seckillSkuRelationService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("seckillSkuRelation", seckillSkuRelation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SeckillSkuRelationEntity seckillSkuRelation){
|
|
||||||
seckillSkuRelationService.save(seckillSkuRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SeckillSkuRelationEntity seckillSkuRelation){
|
|
||||||
seckillSkuRelationService.updateById(seckillSkuRelation);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
seckillSkuRelationService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SkuFullReductionEntity;
|
|
||||||
import com.msb.mall.coupon.service.SkuFullReductionService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品满减信息
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/skufullreduction")
|
|
||||||
public class SkuFullReductionController {
|
|
||||||
@Autowired
|
|
||||||
private SkuFullReductionService skuFullReductionService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = skuFullReductionService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SkuFullReductionEntity skuFullReduction = skuFullReductionService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("skuFullReduction", skuFullReduction);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SkuFullReductionEntity skuFullReduction){
|
|
||||||
skuFullReductionService.save(skuFullReduction);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SkuFullReductionEntity skuFullReduction){
|
|
||||||
skuFullReductionService.updateById(skuFullReduction);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
skuFullReductionService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SkuLadderEntity;
|
|
||||||
import com.msb.mall.coupon.service.SkuLadderService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品阶梯价格
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/skuladder")
|
|
||||||
public class SkuLadderController {
|
|
||||||
@Autowired
|
|
||||||
private SkuLadderService skuLadderService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = skuLadderService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SkuLadderEntity skuLadder = skuLadderService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("skuLadder", skuLadder);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SkuLadderEntity skuLadder){
|
|
||||||
skuLadderService.save(skuLadder);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SkuLadderEntity skuLadder){
|
|
||||||
skuLadderService.updateById(skuLadder);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
skuLadderService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,84 +0,0 @@
|
|||||||
package com.msb.mall.coupon.controller;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SpuBoundsEntity;
|
|
||||||
import com.msb.mall.coupon.service.SpuBoundsService;
|
|
||||||
import com.msb.mall.commons.util.PageUtils;
|
|
||||||
import com.msb.mall.commons.util.R;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品spu积分设置
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("coupon/spubounds")
|
|
||||||
public class SpuBoundsController {
|
|
||||||
@Autowired
|
|
||||||
private SpuBoundsService spuBoundsService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表
|
|
||||||
*/
|
|
||||||
@RequestMapping("/list")
|
|
||||||
public R list(@RequestParam Map<String, Object> params){
|
|
||||||
PageUtils page = spuBoundsService.queryPage(params);
|
|
||||||
|
|
||||||
return R.ok().put("page", page);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 信息
|
|
||||||
*/
|
|
||||||
@RequestMapping("/info/{id}")
|
|
||||||
public R info(@PathVariable("id") Long id){
|
|
||||||
SpuBoundsEntity spuBounds = spuBoundsService.getById(id);
|
|
||||||
|
|
||||||
return R.ok().put("spuBounds", spuBounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存
|
|
||||||
*/
|
|
||||||
@RequestMapping("/save")
|
|
||||||
public R save(@RequestBody SpuBoundsEntity spuBounds){
|
|
||||||
spuBoundsService.save(spuBounds);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改
|
|
||||||
*/
|
|
||||||
@RequestMapping("/update")
|
|
||||||
public R update(@RequestBody SpuBoundsEntity spuBounds){
|
|
||||||
spuBoundsService.updateById(spuBounds);
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除
|
|
||||||
*/
|
|
||||||
@RequestMapping("/delete")
|
|
||||||
public R delete(@RequestBody Long[] ids){
|
|
||||||
spuBoundsService.removeByIds(Arrays.asList(ids));
|
|
||||||
|
|
||||||
return R.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券信息
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface CouponDao extends BaseMapper<CouponEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponHistoryEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券领取历史记录
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface CouponHistoryDao extends BaseMapper<CouponHistoryEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponSpuCategoryRelationEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券分类关联
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface CouponSpuCategoryRelationDao extends BaseMapper<CouponSpuCategoryRelationEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.CouponSpuRelationEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 优惠券与产品关联
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface CouponSpuRelationDao extends BaseMapper<CouponSpuRelationEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.HomeAdvEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 首页轮播广告
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface HomeAdvDao extends BaseMapper<HomeAdvEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.HomeSubjectSpuEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 专题商品
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface HomeSubjectSpuDao extends BaseMapper<HomeSubjectSpuEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.MemberPriceEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品会员价格
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface MemberPriceDao extends BaseMapper<MemberPriceEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillPromotionEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀活动
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SeckillPromotionDao extends BaseMapper<SeckillPromotionEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillSessionEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀活动场次
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SeckillSessionDao extends BaseMapper<SeckillSessionEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillSkuNoticeEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀商品通知订阅
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SeckillSkuNoticeDao extends BaseMapper<SeckillSkuNoticeEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SeckillSkuRelationEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 秒杀活动商品关联
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SeckillSkuRelationDao extends BaseMapper<SeckillSkuRelationEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SkuFullReductionEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品满减信息
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SkuFullReductionDao extends BaseMapper<SkuFullReductionEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SkuLadderEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品阶梯价格
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SkuLadderDao extends BaseMapper<SkuLadderEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.dao;
|
|
||||||
|
|
||||||
import com.msb.mall.coupon.entity.SpuBoundsEntity;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品spu积分设置
|
|
||||||
*
|
|
||||||
* @author dalong
|
|
||||||
* @email 573607090@qq.com
|
|
||||||
* @date 2022-09-10 00:45:20
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface SpuBoundsDao extends BaseMapper<SpuBoundsEntity> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.msb.mall.coupon.datasource;
|
|
||||||
|
|
||||||
import com.zaxxer.hikari.HikariDataSource;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
||||||
import org.springframework.boot.jdbc.DataSourceBuilder;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
|
||||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@EnableTransactionManagement
|
|
||||||
public class DataSourceConfiguration {
|
|
||||||
|
|
||||||
@Bean(name = "masterDataSource")
|
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.master")
|
|
||||||
public DataSource masterDataSource() {
|
|
||||||
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean(name = "slaveDataSource")
|
|
||||||
@ConfigurationProperties(prefix = "spring.datasource.slave")
|
|
||||||
public DataSource slaveDataSource() {
|
|
||||||
return DataSourceBuilder.create().type(HikariDataSource.class).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Bean("routingDataSource")
|
|
||||||
@Primary
|
|
||||||
public AbstractRoutingDataSource roundRobinDataSouceProxy() {
|
|
||||||
ReadWriteSplitRoutingDataSource proxy = new ReadWriteSplitRoutingDataSource();
|
|
||||||
Map<Object, Object> targetDataResources = new HashMap<>();
|
|
||||||
DataSource masterDataSource = masterDataSource();
|
|
||||||
targetDataResources.put(DbContextHolder.DbType.MASTER, masterDataSource);
|
|
||||||
DataSource slaveDataSource = slaveDataSource();
|
|
||||||
targetDataResources.put(DbContextHolder.DbType.SLAVE, slaveDataSource);
|
|
||||||
proxy.setDefaultTargetDataSource(masterDataSource);//默认源
|
|
||||||
proxy.setTargetDataSources(targetDataResources);
|
|
||||||
return proxy;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.msb.mall.coupon.datasource;
|
|
||||||
|
|
||||||
public class DbContextHolder {
|
|
||||||
|
|
||||||
public enum DbType{
|
|
||||||
MASTER,SLAVE
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final ThreadLocal<DbType> contextHolder = new ThreadLocal<>();
|
|
||||||
|
|
||||||
public static void setDbType(DbType dbType){
|
|
||||||
if(dbType==null)throw new NullPointerException();
|
|
||||||
contextHolder.set(dbType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DbType getDbType(){
|
|
||||||
DbType dbType = contextHolder.get();
|
|
||||||
return dbType ==null? DbType.MASTER: dbType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void clearDbType(){
|
|
||||||
contextHolder.remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
package com.msb.mall.coupon.datasource;
|
|
||||||
|
|
||||||
|
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
|
||||||
import org.aspectj.lang.annotation.Around;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
|
||||||
import org.springframework.core.Ordered;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Aspect
|
|
||||||
@Component
|
|
||||||
public class ReadOnlyConnectionInterceptor implements Ordered {
|
|
||||||
|
|
||||||
@Around("@annotation(readOnlyConnection)")
|
|
||||||
public Object proceed(ProceedingJoinPoint proceedingJoinPoint, ReadOnlyConnection readOnlyConnection) throws Throwable {
|
|
||||||
try {
|
|
||||||
DbContextHolder.setDbType(DbContextHolder.DbType.SLAVE);
|
|
||||||
return proceedingJoinPoint.proceed();
|
|
||||||
} finally {
|
|
||||||
DbContextHolder.clearDbType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOrder() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.msb.mall.coupon.datasource;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class ReadWriteSplitRoutingDataSource extends AbstractRoutingDataSource {
|
|
||||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object determineCurrentLookupKey() {
|
|
||||||
return DbContextHolder.getDbType();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue