Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
|
60f7b7b3d0 |
|
@ -5,12 +5,15 @@
|
||||||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-common/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-gateway/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-kill/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-kill/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-payment/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-system/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-system/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-team/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-xxl/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/bwie-modules/src/main/resources" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="AliAccessStaticViaInstance" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliArrayNamingShouldHaveBracket" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliDeprecation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliEqualsAvoidNull" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliLongLiteralsEndingWithLowercaseL" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliMissingOverrideAnnotation" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AliWrapperTypeEquality" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,cn.hutool.http.HttpRequest,execute" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="MapOrSetKeyShouldOverrideHashCodeEquals" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
|
@ -4,8 +4,11 @@
|
||||||
<option name="originalFiles">
|
<option name="originalFiles">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/pom.xml" />
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
<option value="$PROJECT_DIR$/bwie-modules/bwie-kill/pom.xml" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,124 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
File diff suppressed because one or more lines are too long
|
@ -66,5 +66,55 @@
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--sentinel依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 阿里云上传图片 -->
|
||||||
|
<!-- aliyun OOS -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.15.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- aliyun OOS JDK高于9版本需要的依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- no more than 2.3.3-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- rabbitMQ -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 消息转换器 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
<version>2.9.10</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.rabbitmq</groupId>
|
||||||
|
<artifactId>amqp-client</artifactId>
|
||||||
|
<version>5.14.3</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
package com.bwie.kill;
|
package com.bwie.kill;
|
||||||
|
|
||||||
|
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalTime;
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
//@Import(value = {ThreadPoolExecutor.class})
|
||||||
public class KillApplication {
|
public class KillApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(KillApplication.class,args);
|
SpringApplication.run(KillApplication.class,args);
|
||||||
LocalDateTime localDateTime = LocalDateTime.now();
|
|
||||||
LocalDateTime with = localDateTime.with(LocalTime.of(0, 0, 0));
|
|
||||||
System.out.println(localDateTime.toLocalTime());
|
|
||||||
System.out.println(with.toLocalDate().toString()+" 00:00:00");
|
|
||||||
String localeString = new Date().toLocaleString();
|
|
||||||
System.out.println(localeString);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,178 @@
|
||||||
|
package com.bwie.kill.config;
|
||||||
|
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.*;
|
||||||
|
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.amqp.support.converter.MessageConverter;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @CLassName MqConfig
|
||||||
|
* @Description 描述
|
||||||
|
* @Author Meng.Wang
|
||||||
|
* @Date 2023/11/24 21:15
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@Log4j2
|
||||||
|
public class MqConfig implements RabbitTemplate.ReturnsCallback,RabbitTemplate.ConfirmCallback{
|
||||||
|
public static final String DXQUEUE = "DxQueue";
|
||||||
|
public static final String DXEXCHANGE = "DxExchange";
|
||||||
|
public static final String ROUTINGKEY = "RoutingKey";
|
||||||
|
|
||||||
|
//队列
|
||||||
|
public static final String FORMAL_QUEUE = "formal_queue";
|
||||||
|
public static final String DEAD_QUEUE = "dead_queue";
|
||||||
|
|
||||||
|
//交换机
|
||||||
|
public static final String FORMAL_EXCHANGE = "formal_exchange";
|
||||||
|
public static final String DEAD_EXCHANGE = "dead_exchaneg";
|
||||||
|
|
||||||
|
//路由key
|
||||||
|
public static final String FORMAL_ROUNTE_KEY = "formal_rounte_key";
|
||||||
|
public static final String DEAD_ROUNTE_KEY = "dead_route_key";
|
||||||
|
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
//创建消息转换器
|
||||||
|
@Bean
|
||||||
|
public MessageConverter messageConverter(){
|
||||||
|
return new Jackson2JsonMessageConverter();
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建队列
|
||||||
|
@Bean
|
||||||
|
public Queue queue(){
|
||||||
|
return new Queue(DXQUEUE,true);
|
||||||
|
}
|
||||||
|
//创建交换机
|
||||||
|
@Primary
|
||||||
|
@Bean
|
||||||
|
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory){
|
||||||
|
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
|
||||||
|
this.rabbitTemplate = rabbitTemplate;
|
||||||
|
rabbitTemplate.setMessageConverter(messageConverter());
|
||||||
|
rabbitTemplate();
|
||||||
|
return rabbitTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean("DxExchange")
|
||||||
|
public DirectExchange directExchange(){
|
||||||
|
return new DirectExchange(DXEXCHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rabbitTemplate(){
|
||||||
|
rabbitTemplate.setConfirmCallback(this);
|
||||||
|
rabbitTemplate.setReturnsCallback(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding binding(){
|
||||||
|
return BindingBuilder.bind(queue()).to(directExchange()).with(ROUTINGKEY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void confirm(CorrelationData correlationData, boolean b, String s) {
|
||||||
|
if(b){
|
||||||
|
log.info("{}消息到达交换机",correlationData.getId());
|
||||||
|
}else {
|
||||||
|
log.error("{}消息丢失",correlationData.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||||
|
log.error("{}消息未到达队列",returnedMessage.getMessage().getMessageProperties().getMessageId());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 普通队列交换机声明
|
||||||
|
* 交换机类型:topic:处理路由键,按模式匹配,向符合规则的队列投递消息
|
||||||
|
* name 交换机名称
|
||||||
|
* durable 是否持久化
|
||||||
|
* autoDelete 是否删除
|
||||||
|
* arguments 用于设置其他参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Exchange getFormalExchange(){
|
||||||
|
return new TopicExchange(FORMAL_EXCHANGE,true,false,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声明普通队列,并设置与死信队列联系
|
||||||
|
* name 队列名称
|
||||||
|
* durable 是否持久化
|
||||||
|
* exclusive 是否排外 如果是排外的,该队列 仅对首次声明它的连接(Connection)可见,是该Connection私有的,
|
||||||
|
* 类似于加锁,并在连接断开connection.close()时自动删除
|
||||||
|
* autoDelete 是否删除
|
||||||
|
* arguments 用于设置其他参数
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Queue getFormalQueue(){
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
//设置队列超时时间
|
||||||
|
map.put("x-message-ttl",1000*60*5);
|
||||||
|
//设置死信队列交换机
|
||||||
|
map.put("x-dead-letter-exchange",DEAD_EXCHANGE);
|
||||||
|
//设置死信队列路由key
|
||||||
|
map.put("x-dead-letter-routing-key",DEAD_ROUNTE_KEY);
|
||||||
|
return new Queue(FORMAL_QUEUE,true,false,false,map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将普通队列和交换机绑定
|
||||||
|
* destination:目标队列或交换器
|
||||||
|
* destinationType:DesdinationType指出目标是交换器还是对列
|
||||||
|
* exchange:交换机
|
||||||
|
* routingKey:路由key
|
||||||
|
* arguments:参数设置
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Binding bingFormalQueue(){
|
||||||
|
return new Binding(FORMAL_QUEUE, Binding.DestinationType.QUEUE,FORMAL_EXCHANGE,FORMAL_ROUNTE_KEY,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声明死信队列交换机
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Exchange getDeadExchange(){
|
||||||
|
return new TopicExchange(DEAD_EXCHANGE,true,false,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 声明死信队列
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Queue getDeadQueue(){
|
||||||
|
return new Queue(DEAD_QUEUE,true,false,false, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将死信队列和交换机绑定
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public Binding bingDeadQueue(){
|
||||||
|
return new Binding(DEAD_QUEUE, Binding.DestinationType.QUEUE,DEAD_EXCHANGE,DEAD_ROUNTE_KEY,null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.bwie.kill.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import java.util.concurrent.LinkedBlockingDeque;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liyachuang
|
||||||
|
* @Package:com.atguigu.gulimall.pms.config
|
||||||
|
* @Project:six-zuoye1
|
||||||
|
* @name:ThreadPoolExecutorConfig
|
||||||
|
* @Date:2024/3/3 16:02
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class ThreadPoolExecutorConfig {
|
||||||
|
@Bean
|
||||||
|
public ThreadPoolExecutor threadPoolExecutor(){
|
||||||
|
int coreSize = 3 * Runtime.getRuntime().availableProcessors();
|
||||||
|
int maxSize=coreSize+30;
|
||||||
|
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(coreSize, maxSize, 5, TimeUnit.SECONDS,
|
||||||
|
new LinkedBlockingDeque<>(100));
|
||||||
|
return threadPoolExecutor;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.bwie.kill.consumer;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
import com.bwie.kill.domain.request.KillConfigure;
|
||||||
|
import com.bwie.kill.service.KillOrderService;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.redisson.api.RSemaphore;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
@RabbitListener(queues = "dead_queue")
|
||||||
|
public class DeadConsumer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
@Autowired
|
||||||
|
private KillOrderService killOrderService;
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
private void getDeadQueue(String orderNum, Channel channel , Message message){
|
||||||
|
String messageId = message.getMessageProperties().getMessageId();
|
||||||
|
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||||
|
|
||||||
|
try {
|
||||||
|
//判断消息是否被消费过
|
||||||
|
if (!redisCache.hasKey(messageId)){
|
||||||
|
//查询该订单信息查看订单状态
|
||||||
|
KillOrder killOrder = killOrderService.getOne(new LambdaQueryWrapper<KillOrder>()
|
||||||
|
.eq(KillOrder::getOrderNum, orderNum));
|
||||||
|
//订单状态为1 待支付 意味着客户已经支付超时了 我们将他的支付状态改为失败
|
||||||
|
if (killOrder.getOrderItemState() == 1){
|
||||||
|
//获取订单时间
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String formatted = simpleDateFormat.format(killOrder.getCreateTime());
|
||||||
|
//拿到该商品的信号量
|
||||||
|
RSemaphore semaphore = redissonClient.getSemaphore(KillConfigure.KILL_GOODS_XHL + formatted + killOrder.getGoodsSkuId());
|
||||||
|
//执行信号量+1操作
|
||||||
|
semaphore.release();
|
||||||
|
//将订单状态改为失败
|
||||||
|
killOrder.setOrderItemState(3);
|
||||||
|
//执行修改操作
|
||||||
|
killOrderService.updateById(killOrder);
|
||||||
|
//消费过后消息存入redis 保证不重复消费
|
||||||
|
redisCache.setCacheObject(messageId,messageId,72L, TimeUnit.HOURS);
|
||||||
|
//ACK手动确认机制
|
||||||
|
channel.basicAck(deliveryTag,false);
|
||||||
|
} else {
|
||||||
|
redisCache.setCacheObject(messageId,messageId,72L, TimeUnit.HOURS);
|
||||||
|
channel.basicAck(deliveryTag,false);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
channel.basicReject(deliveryTag,false);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package com.bwie.kill.consumer;
|
||||||
|
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
import com.bwie.kill.domain.User;
|
||||||
|
import com.bwie.kill.domain.request.VoKillOrderRequest;
|
||||||
|
import com.bwie.kill.producer.OrderProducer;
|
||||||
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import com.bwie.kill.service.KillOrderService;
|
||||||
|
import com.bwie.kill.service.impl.KillGoodsServerServiceImpl;
|
||||||
|
import com.rabbitmq.client.Channel;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.Message;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
||||||
|
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
@RabbitListener(queues = "DxQueue")
|
||||||
|
public class OrderConsumer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
@Autowired
|
||||||
|
private KillOrderService killOrderService;
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsServerService killGoodsServerService;
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsServerServiceImpl killGoodsServerServiceImpl;
|
||||||
|
@Autowired
|
||||||
|
private OrderProducer orderProducer;
|
||||||
|
|
||||||
|
@RabbitHandler
|
||||||
|
private void getOrderMq(VoKillOrderRequest req, Channel channel , Message message){
|
||||||
|
String messageId = message.getMessageProperties().getMessageId();
|
||||||
|
long deliveryTag = message.getMessageProperties().getDeliveryTag();
|
||||||
|
log.info("messageId:"+messageId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!redisCache.hasKey(messageId)){
|
||||||
|
String killOrderNum = killGoodsServerService.getKillOrderNum();
|
||||||
|
User userInfo = killGoodsServerServiceImpl.getUserInfo();
|
||||||
|
KillOrder killOrder = KillOrder.builder()
|
||||||
|
.addrId(req.getAddrId())
|
||||||
|
.orderCount(req.getOrderCount())
|
||||||
|
.orderItemPrice(req.getOrderItemPrice())
|
||||||
|
.orderItemState(1)
|
||||||
|
.orderNum(killOrderNum)
|
||||||
|
.createTime(new Date())
|
||||||
|
.goodsSkuId(req.getGoodsSkuId())
|
||||||
|
.isDelete(1)
|
||||||
|
.userId(userInfo.getUserId())
|
||||||
|
.needPrice(req.getOrderItemPrice())
|
||||||
|
.userName(userInfo.getUserName())
|
||||||
|
.userTel(userInfo.getUserPhone())
|
||||||
|
.build();
|
||||||
|
orderProducer.getDeadQueue(killOrderNum);
|
||||||
|
killOrderService.save(killOrder);
|
||||||
|
redisCache.setCacheObject(messageId,messageId,72L, TimeUnit.HOURS);
|
||||||
|
channel.basicAck(deliveryTag,true);
|
||||||
|
}else {
|
||||||
|
channel.basicReject(deliveryTag,false);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +1,13 @@
|
||||||
package com.bwie.kill.controller;
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsIndexListRequest;
|
||||||
|
import com.bwie.kill.domain.request.VoKillOrderRequest;
|
||||||
import com.bwie.kill.service.KillGoodsServerService;
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/kill/server")
|
@RequestMapping("/kill/server")
|
||||||
|
@ -12,8 +16,20 @@ public class KillGoodsServerController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private KillGoodsServerService killGoodsServerService;
|
private KillGoodsServerService killGoodsServerService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/KillGoodsList")
|
||||||
|
public Result<VoKillGoodsIndexListRequest> getKillGoodsList(@RequestParam Long id) throws ExecutionException, InterruptedException {
|
||||||
|
return Result.success(
|
||||||
|
killGoodsServerService.getKillGoodsList(id)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/order")
|
||||||
|
public Result<String> getOrder(@RequestBody VoKillOrderRequest req){
|
||||||
|
return Result.success(
|
||||||
|
killGoodsServerService.getOrder(req)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,25 @@
|
||||||
package com.bwie.kill.controller;
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
import com.bwie.kill.service.KillOrderService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/kill/sku")
|
@RequestMapping("/kill/sku")
|
||||||
public class KillSkuAttrValueController {
|
public class KillSkuAttrValueController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillOrderService killOrderService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
private Result<KillOrder> getOrder(){
|
||||||
|
return Result.success(
|
||||||
|
killOrderService.getLLL()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.domain.request.VoIdentityRequest;
|
||||||
|
import com.bwie.kill.domain.request.VoMasterRequest;
|
||||||
|
import com.bwie.kill.service.MasterService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/master")
|
||||||
|
public class MasterController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MasterService masterService;
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/asMaster")
|
||||||
|
public Result<String> asMaster(@RequestBody VoMasterRequest req) throws ExecutionException, InterruptedException, IOException {
|
||||||
|
|
||||||
|
return Result.success(
|
||||||
|
masterService.getAsMaster(req)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.kill.pay.PayService;
|
||||||
|
import com.bwie.kill.service.PaymentService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/payment")
|
||||||
|
public class PaymentController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PaymentService paymentService;
|
||||||
|
|
||||||
|
@GetMapping("/pay")
|
||||||
|
public Result<String> getPayOrder(@RequestParam String type){
|
||||||
|
|
||||||
|
return Result.success(
|
||||||
|
paymentService.getPayOrder(type)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
package com.bwie.kill.controller;
|
package com.bwie.kill.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
import com.bwie.kill.service.KillConfigService;
|
import com.bwie.kill.service.KillConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -12,4 +14,9 @@ public class killController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private KillConfigService killConfigService;
|
private KillConfigService killConfigService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<String> getList(){
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,13 @@ public class KillConfig {
|
||||||
*/
|
*/
|
||||||
private Integer killStatus;
|
private Integer killStatus;
|
||||||
/**
|
/**
|
||||||
* 秒杀时段
|
* 秒杀K开始时段
|
||||||
*/
|
*/
|
||||||
private String killDate;
|
private Integer killStartTime;
|
||||||
|
/**
|
||||||
|
* 秒杀结束时段
|
||||||
|
*/
|
||||||
|
private Integer killEndTime;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.bwie.kill.domain;
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
@ -18,6 +21,7 @@ public class KillGoods {
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
*/
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
/**
|
||||||
* 秒杀配置表id
|
* 秒杀配置表id
|
||||||
|
@ -34,7 +38,7 @@ public class KillGoods {
|
||||||
/**
|
/**
|
||||||
* 商品id
|
* 商品id
|
||||||
*/
|
*/
|
||||||
private Long goodsSpuId;
|
private Long goodsSkuId;
|
||||||
/**
|
/**
|
||||||
* 商品名称
|
* 商品名称
|
||||||
*/
|
*/
|
||||||
|
@ -55,6 +59,14 @@ public class KillGoods {
|
||||||
* 秒杀价
|
* 秒杀价
|
||||||
*/
|
*/
|
||||||
private BigDecimal killPrice;
|
private BigDecimal killPrice;
|
||||||
|
/**
|
||||||
|
* 商品限量
|
||||||
|
*/
|
||||||
|
private Integer number;
|
||||||
|
/**
|
||||||
|
* 剩余商品限量
|
||||||
|
*/
|
||||||
|
private Integer lastNum;
|
||||||
/**
|
/**
|
||||||
* 活动简介
|
* 活动简介
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("kill_order")
|
||||||
|
public class KillOrder {
|
||||||
|
/**
|
||||||
|
* 秒杀订单ID
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 订单单号
|
||||||
|
*/
|
||||||
|
private String orderNum;
|
||||||
|
/**
|
||||||
|
* 用户名称
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
/**
|
||||||
|
* 用户手机号
|
||||||
|
*/
|
||||||
|
private String userTel;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 物品数量
|
||||||
|
*/
|
||||||
|
private Integer orderCount;
|
||||||
|
/**
|
||||||
|
* 地址id
|
||||||
|
*/
|
||||||
|
private Long addrId;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 逻辑删除(1.未删除2.已删除)
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderItemPrice;
|
||||||
|
/**
|
||||||
|
* 订单状态(1.待支付 2.支付成功3.支付失败4.已取消)
|
||||||
|
*/
|
||||||
|
private Integer orderItemState;
|
||||||
|
/**
|
||||||
|
* 用户需要支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal needPrice;
|
||||||
|
/**
|
||||||
|
* 物品ID
|
||||||
|
*/
|
||||||
|
private Long goodsSkuId;
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("master")
|
||||||
|
public class Master {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 团长ID
|
||||||
|
*/
|
||||||
|
private Long masterId;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 所属城市
|
||||||
|
*/
|
||||||
|
private String masterCity;
|
||||||
|
/**
|
||||||
|
* 团长账户
|
||||||
|
*/
|
||||||
|
private String masterAccount;
|
||||||
|
/**
|
||||||
|
* 自提点信息
|
||||||
|
*/
|
||||||
|
private String masterAddress;
|
||||||
|
/**
|
||||||
|
* 团长配送费
|
||||||
|
*/
|
||||||
|
private BigDecimal masterMoney;
|
||||||
|
/**
|
||||||
|
* 审核人姓名
|
||||||
|
*/
|
||||||
|
private String examinePeople;
|
||||||
|
/**
|
||||||
|
* 审核时间
|
||||||
|
*/
|
||||||
|
private Date examineTime;
|
||||||
|
/**
|
||||||
|
* 申请时间
|
||||||
|
*/
|
||||||
|
private Date applicationTime;
|
||||||
|
/**
|
||||||
|
* 审核状态1..待审核2审核通过3.审核不通过
|
||||||
|
*/
|
||||||
|
private Integer applicationStatus;
|
||||||
|
/**
|
||||||
|
* 活体视频
|
||||||
|
*/
|
||||||
|
private String movie;
|
||||||
|
/**
|
||||||
|
* 正面照
|
||||||
|
*/
|
||||||
|
private String faceImg;
|
||||||
|
/**
|
||||||
|
* 反面照
|
||||||
|
*/
|
||||||
|
private String backImg;
|
||||||
|
/**
|
||||||
|
* 等级id
|
||||||
|
*/
|
||||||
|
private Long masterLvId;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.bwie.kill.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("user")
|
||||||
|
public class User {
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户姓名
|
||||||
|
*/
|
||||||
|
private String userName;
|
||||||
|
/**
|
||||||
|
* 用户密码
|
||||||
|
*/
|
||||||
|
private String userPwd;
|
||||||
|
/**
|
||||||
|
* 用户手机号
|
||||||
|
*/
|
||||||
|
private String userPhone;
|
||||||
|
/**
|
||||||
|
* 角色
|
||||||
|
*/
|
||||||
|
private Integer userRole;
|
||||||
|
/**
|
||||||
|
* 用户等级
|
||||||
|
*/
|
||||||
|
private Integer userGrade;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
/**
|
||||||
|
* 逻辑字段 0未删除 1已删除
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
}
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ALiveEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* msg :
|
||||||
|
* success : true
|
||||||
|
* code : 200
|
||||||
|
* data : {"order_no":"588410148050046976","motions":{"score":0.9999746084213257,"motion":"BLINK","passed":true},"passed":true,"feature_image_id":"efdc743eda7744ce9be4080654deb4c1","hack_score":0.7475364208221436}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String msg;
|
||||||
|
private boolean success;
|
||||||
|
private int code;
|
||||||
|
private DataBean data;
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(DataBean data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataBean getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DataBean {
|
||||||
|
/**
|
||||||
|
* order_no : 588410148050046976
|
||||||
|
* motions : {"score":0.9999746084213257,"motion":"BLINK","passed":true}
|
||||||
|
* passed : true
|
||||||
|
* feature_image_id : efdc743eda7744ce9be4080654deb4c1
|
||||||
|
* hack_score : 0.7475364208221436
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String order_no;
|
||||||
|
private MotionsBean motions;
|
||||||
|
private boolean passed;
|
||||||
|
private String feature_image_id;
|
||||||
|
private double hack_score;
|
||||||
|
|
||||||
|
public String getOrder_no() {
|
||||||
|
return order_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder_no(String order_no) {
|
||||||
|
this.order_no = order_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MotionsBean getMotions() {
|
||||||
|
return motions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotions(MotionsBean motions) {
|
||||||
|
this.motions = motions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPassed() {
|
||||||
|
return passed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassed(boolean passed) {
|
||||||
|
this.passed = passed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFeature_image_id() {
|
||||||
|
return feature_image_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeature_image_id(String feature_image_id) {
|
||||||
|
this.feature_image_id = feature_image_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getHack_score() {
|
||||||
|
return hack_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHack_score(double hack_score) {
|
||||||
|
this.hack_score = hack_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MotionsBean {
|
||||||
|
/**
|
||||||
|
* score : 0.9999746084213257
|
||||||
|
* motion : BLINK
|
||||||
|
* passed : true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private double score;
|
||||||
|
private String motion;
|
||||||
|
private boolean passed;
|
||||||
|
|
||||||
|
public double getScore() {
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScore(double score) {
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMotion() {
|
||||||
|
return motion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMotion(String motion) {
|
||||||
|
this.motion = motion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPassed() {
|
||||||
|
return passed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassed(boolean passed) {
|
||||||
|
this.passed = passed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class IdentityResultVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* code : 200
|
||||||
|
* msg : 成功
|
||||||
|
* taskNo : 121312312321312321
|
||||||
|
* data : {"result":1,"desc":"不一致","sex":"男","birthday":"19940320","address":"杭州市西湖区余杭塘路"}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int code;
|
||||||
|
private String msg;
|
||||||
|
private String taskNo;
|
||||||
|
private DataBean data;
|
||||||
|
|
||||||
|
public int getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskNo() {
|
||||||
|
return taskNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskNo(String taskNo) {
|
||||||
|
this.taskNo = taskNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataBean getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData(DataBean data) {
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DataBean {
|
||||||
|
/**
|
||||||
|
* result : 1
|
||||||
|
* desc : 不一致
|
||||||
|
* sex : 男
|
||||||
|
* birthday : 19940320
|
||||||
|
* address : 杭州市西湖区余杭塘路
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int result;
|
||||||
|
private String desc;
|
||||||
|
private String sex;
|
||||||
|
private String birthday;
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
public int getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResult(int result) {
|
||||||
|
this.result = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesc(String desc) {
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBirthday() {
|
||||||
|
return birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirthday(String birthday) {
|
||||||
|
this.birthday = birthday;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class KillConfigure {
|
||||||
|
public static final String KILL_GOODS_KEY = "killGoodsKey";
|
||||||
|
|
||||||
|
public static final String KILL_GOODS_XHL = "killGoodsXHL";
|
||||||
|
|
||||||
|
public static final String KILL_CONFIG_LIST = "killConfigList";
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Data
|
||||||
|
public class OCRBackEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* config_str : {\"side\":\"back\"}
|
||||||
|
* start_date : 19700101
|
||||||
|
* end_date : 19800101
|
||||||
|
* issue : 杭州市公安局
|
||||||
|
* is_fake : false
|
||||||
|
* success : true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String config_str;
|
||||||
|
private String start_date;
|
||||||
|
private String end_date;
|
||||||
|
private String issue;
|
||||||
|
private boolean is_fake;
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
public void setConfig_str(String config_str) {
|
||||||
|
this.config_str = config_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStart_date(String start_date) {
|
||||||
|
this.start_date = start_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnd_date(String end_date) {
|
||||||
|
this.end_date = end_date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIssue(String issue) {
|
||||||
|
this.issue = issue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_fake(boolean is_fake) {
|
||||||
|
this.is_fake = is_fake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OCREntity {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,344 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class OcrResultVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* address : 浙江省杭州市余杭区文一西路969号
|
||||||
|
* config_str : {\"side\":\"face\"}
|
||||||
|
* face_rect : {"angle":-90,"center":{"x":952,"y":325.5},"size":{"height":181.99,"width":164.99}}
|
||||||
|
* card_region : [{"x":165,"y":657},{"x":534,"y":658},{"x":535,"y":31},{"x":165,"y":30}]
|
||||||
|
* face_rect_vertices : [{"x":1024.6600341796875,"y":336.629638671875},{"x":906.6610717773438,"y":336.14801025390625},{"x":907.1590576171875,"y":214.1490478515625},{"x":1025.157958984375,"y":214.63067626953125}]
|
||||||
|
* name : 张三
|
||||||
|
* nationality : 汉
|
||||||
|
* num : 1234567890
|
||||||
|
* sex : 男
|
||||||
|
* birth : 20000101
|
||||||
|
* is_fake : false
|
||||||
|
* warning : {"completeness_score":100,"is_copy":0,"is_reshoot":0,"quality_score":89.296059,"tamper_score":99.99968}
|
||||||
|
* success : true
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String address;
|
||||||
|
private String config_str;
|
||||||
|
private FaceRectBean face_rect;
|
||||||
|
private String name;
|
||||||
|
private String nationality;
|
||||||
|
private String num;
|
||||||
|
private String sex;
|
||||||
|
private String birth;
|
||||||
|
private boolean is_fake;
|
||||||
|
private WarningBean warning;
|
||||||
|
private boolean success;
|
||||||
|
private List<CardRegionBean> card_region;
|
||||||
|
private List<FaceRectVerticesBean> face_rect_vertices;
|
||||||
|
|
||||||
|
public String getAddress() {
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAddress(String address) {
|
||||||
|
this.address = address;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfig_str() {
|
||||||
|
return config_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfig_str(String config_str) {
|
||||||
|
this.config_str = config_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FaceRectBean getFace_rect() {
|
||||||
|
return face_rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFace_rect(FaceRectBean face_rect) {
|
||||||
|
this.face_rect = face_rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNationality() {
|
||||||
|
return nationality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNationality(String nationality) {
|
||||||
|
this.nationality = nationality;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNum() {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNum(String num) {
|
||||||
|
this.num = num;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSex() {
|
||||||
|
return sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSex(String sex) {
|
||||||
|
this.sex = sex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBirth() {
|
||||||
|
return birth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBirth(String birth) {
|
||||||
|
this.birth = birth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIs_fake() {
|
||||||
|
return is_fake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_fake(boolean is_fake) {
|
||||||
|
this.is_fake = is_fake;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WarningBean getWarning() {
|
||||||
|
return warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWarning(WarningBean warning) {
|
||||||
|
this.warning = warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<CardRegionBean> getCard_region() {
|
||||||
|
return card_region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCard_region(List<CardRegionBean> card_region) {
|
||||||
|
this.card_region = card_region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FaceRectVerticesBean> getFace_rect_vertices() {
|
||||||
|
return face_rect_vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFace_rect_vertices(List<FaceRectVerticesBean> face_rect_vertices) {
|
||||||
|
this.face_rect_vertices = face_rect_vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FaceRectBean {
|
||||||
|
/**
|
||||||
|
* angle : -90
|
||||||
|
* center : {"x":952,"y":325.5}
|
||||||
|
* size : {"height":181.99,"width":164.99}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int angle;
|
||||||
|
private CenterBean center;
|
||||||
|
private SizeBean size;
|
||||||
|
|
||||||
|
public int getAngle() {
|
||||||
|
return angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAngle(int angle) {
|
||||||
|
this.angle = angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CenterBean getCenter() {
|
||||||
|
return center;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCenter(CenterBean center) {
|
||||||
|
this.center = center;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SizeBean getSize() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSize(SizeBean size) {
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CenterBean {
|
||||||
|
/**
|
||||||
|
* x : 952
|
||||||
|
* y : 325.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int x;
|
||||||
|
private double y;
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(int x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(double y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SizeBean {
|
||||||
|
/**
|
||||||
|
* height : 181.99
|
||||||
|
* width : 164.99
|
||||||
|
*/
|
||||||
|
|
||||||
|
private double height;
|
||||||
|
private double width;
|
||||||
|
|
||||||
|
public double getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeight(double height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWidth(double width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class WarningBean {
|
||||||
|
/**
|
||||||
|
* completeness_score : 100
|
||||||
|
* is_copy : 0
|
||||||
|
* is_reshoot : 0
|
||||||
|
* quality_score : 89.296059
|
||||||
|
* tamper_score : 99.99968
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int completeness_score;
|
||||||
|
private int is_copy;
|
||||||
|
private int is_reshoot;
|
||||||
|
private double quality_score;
|
||||||
|
private double tamper_score;
|
||||||
|
|
||||||
|
public int getCompleteness_score() {
|
||||||
|
return completeness_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompleteness_score(int completeness_score) {
|
||||||
|
this.completeness_score = completeness_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIs_copy() {
|
||||||
|
return is_copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_copy(int is_copy) {
|
||||||
|
this.is_copy = is_copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIs_reshoot() {
|
||||||
|
return is_reshoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIs_reshoot(int is_reshoot) {
|
||||||
|
this.is_reshoot = is_reshoot;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getQuality_score() {
|
||||||
|
return quality_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuality_score(double quality_score) {
|
||||||
|
this.quality_score = quality_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getTamper_score() {
|
||||||
|
return tamper_score;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTamper_score(double tamper_score) {
|
||||||
|
this.tamper_score = tamper_score;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CardRegionBean {
|
||||||
|
/**
|
||||||
|
* x : 165
|
||||||
|
* y : 657
|
||||||
|
*/
|
||||||
|
|
||||||
|
private int x;
|
||||||
|
private int y;
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(int x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(int y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FaceRectVerticesBean {
|
||||||
|
/**
|
||||||
|
* x : 1024.6600341796875
|
||||||
|
* y : 336.629638671875
|
||||||
|
*/
|
||||||
|
|
||||||
|
private double x;
|
||||||
|
private double y;
|
||||||
|
|
||||||
|
public double getX() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(double x) {
|
||||||
|
this.x = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getY() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(double y) {
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VoIdentityRequest {
|
||||||
|
|
||||||
|
private MultipartFile aliveFile;
|
||||||
|
|
||||||
|
private MultipartFile faceFile;
|
||||||
|
|
||||||
|
private MultipartFile backFile;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String idCardNo;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VoKillGoodsIndexListRequest {
|
||||||
|
|
||||||
|
private List<KillGoods> killGoods;
|
||||||
|
|
||||||
|
private List<KillGoods> killGoodsOrder;
|
||||||
|
|
||||||
|
private List<KillConfig> killConfig;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VoKillOrderRequest {
|
||||||
|
|
||||||
|
private String userName;
|
||||||
|
private String userTel;
|
||||||
|
private Integer orderCount;
|
||||||
|
private Long addrId;
|
||||||
|
private BigDecimal orderItemPrice;
|
||||||
|
private Long goodsSkuId;
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.bwie.kill.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class VoMasterRequest {
|
||||||
|
|
||||||
|
private String masterCity;
|
||||||
|
|
||||||
|
private String masterAccount;
|
||||||
|
|
||||||
|
private String masterAddress;
|
||||||
|
|
||||||
|
private BigDecimal masterMoney;
|
||||||
|
|
||||||
|
private Long masterLvId;
|
||||||
|
|
||||||
|
private VoIdentityRequest voIdentityRequest;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.bwie.kill.job;
|
||||||
|
|
||||||
|
import cn.hutool.Hutool;
|
||||||
|
import cn.hutool.core.codec.Base62;
|
||||||
|
import cn.hutool.core.codec.Base64;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.bwie.kill.domain.request.ALiveEntity;
|
||||||
|
import com.bwie.kill.domain.request.IdentityResultVo;
|
||||||
|
import com.bwie.kill.domain.request.OCRBackEntity;
|
||||||
|
import com.bwie.kill.domain.request.OCREntity;
|
||||||
|
import com.bwie.kill.util.AliOssUtil;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class HttpConnect {
|
||||||
|
|
||||||
|
@Value("${aliyun.appCode}")
|
||||||
|
private String appCode;
|
||||||
|
@Value("${aliyun.indentityUrl}")
|
||||||
|
private String indentityUrl;
|
||||||
|
@Value("${aliyun.ocrUrl}")
|
||||||
|
private String ocrUrl;
|
||||||
|
@Value("${aliyun.aliveUrl}")
|
||||||
|
private String aliveUrl;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活体认证接口
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public ALiveEntity alive(MultipartFile file,String name) throws Exception {
|
||||||
|
String url = AliOssUtil.fileUpload(name, file.getInputStream());
|
||||||
|
HashMap<String,Object> map = new HashMap<>();
|
||||||
|
map.put("url",url);
|
||||||
|
map.put("motions","MOUTH");
|
||||||
|
String authorization = HttpUtil.createPost(aliveUrl).header("Authorization", "APPCODE " + appCode)
|
||||||
|
.form(map).execute().body();
|
||||||
|
|
||||||
|
ALiveEntity aLiveEntity = JSONObject.parseObject(authorization, ALiveEntity.class);
|
||||||
|
return aLiveEntity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份证实名认证
|
||||||
|
* @param name
|
||||||
|
* @param idCardNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public IdentityResultVo identity(String name ,String idCardNo){
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("name",name);
|
||||||
|
map.put("idCardNo",idCardNo);
|
||||||
|
String authorization = HttpUtil.createPost(indentityUrl).header("Authorization", "APPCODE " + appCode)
|
||||||
|
.form(map).execute().body();
|
||||||
|
return JSONObject.parseObject(authorization,IdentityResultVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ocr文字识别 身份证
|
||||||
|
* @param file
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public String ocr(MultipartFile file,String side) throws IOException {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("image", Base64.encode(file.getBytes()));
|
||||||
|
JSONObject childJson = new JSONObject();
|
||||||
|
childJson.put("side",side);
|
||||||
|
childJson.put("quality_info",false);
|
||||||
|
jsonObject.put("configure",childJson);
|
||||||
|
|
||||||
|
String authorization = HttpUtil.createPost(ocrUrl).header("Authorization", "APPCODE " + appCode)
|
||||||
|
.header("Content-Type", "application/json; charset=UTF-8")
|
||||||
|
.body(JSONObject.toJSONString(jsonObject))
|
||||||
|
.execute().body();
|
||||||
|
|
||||||
|
return authorization;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.bwie.kill.job;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.request.KillConfigure;
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.redisson.api.RSemaphore;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Log4j2
|
||||||
|
public class SyncKillGoodsJob {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsService killGoodsService;
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
@Autowired
|
||||||
|
private KillConfigService killConfigService;
|
||||||
|
|
||||||
|
public void syncKillGoods(){
|
||||||
|
|
||||||
|
//获得当日时间
|
||||||
|
Date date = new Date();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String today = sdf.format(date);
|
||||||
|
|
||||||
|
//获取活动当天的秒杀商品信息
|
||||||
|
List<KillGoods> list = killGoodsService.list(new LambdaQueryWrapper<KillGoods>()
|
||||||
|
.eq(KillGoods::getKillDate, today)
|
||||||
|
.eq(KillGoods::getActivityStatus, 1));
|
||||||
|
|
||||||
|
//获取秒杀配置信息
|
||||||
|
List<KillConfig> killConfigList = killConfigService.list();
|
||||||
|
|
||||||
|
//将秒杀信息存入redis
|
||||||
|
redisCache.setCacheList(KillConfigure.KILL_CONFIG_LIST,killConfigList);
|
||||||
|
|
||||||
|
//将活动当天的秒杀商品信息存入redis
|
||||||
|
redisCache.setCacheList(KillConfigure.KILL_GOODS_KEY+today,list);
|
||||||
|
redisCache.expire(KillConfigure.KILL_GOODS_KEY,72, TimeUnit.HOURS);
|
||||||
|
|
||||||
|
//将商品的库存同步到redisson的信号量,利用redisson信号量做商品的扣减库存
|
||||||
|
list.forEach(c->{
|
||||||
|
RSemaphore semaphore = redissonClient.getSemaphore(KillConfigure.KILL_GOODS_XHL + today + c.getGoodsSkuId());
|
||||||
|
semaphore.trySetPermits(c.getNumber());
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("凌晨同步当日秒杀商品");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.kill.job;
|
||||||
|
|
||||||
|
public class TestJob {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface KillOrderMapper extends BaseMapper<KillOrder> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.kill.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.kill.domain.Master;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MasterMapper extends BaseMapper<Master> {
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.bwie.kill.pay;
|
||||||
|
|
||||||
|
public interface PayService {
|
||||||
|
public String pay();
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.bwie.kill.pay.payImpl;
|
||||||
|
|
||||||
|
import com.bwie.kill.pay.PayService;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Component("alipay")
|
||||||
|
public class AliPayServiceImpl implements PayService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String pay() {
|
||||||
|
return "欢迎使用支付包支付";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.bwie.kill.pay.payImpl;
|
||||||
|
|
||||||
|
import com.bwie.kill.pay.PayService;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Component("Wechat")
|
||||||
|
public class WechatPayServiceImpl implements PayService {
|
||||||
|
@Override
|
||||||
|
public String pay() {
|
||||||
|
return "欢迎使用微信支付";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.bwie.kill.pay.payImpl;
|
||||||
|
|
||||||
|
import com.bwie.kill.pay.PayService;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Component("yinLian")
|
||||||
|
public class YinLianPayServiceImpl implements PayService {
|
||||||
|
@Override
|
||||||
|
public String pay() {
|
||||||
|
return "欢迎使用银联支付";
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.bwie.kill.producer;
|
||||||
|
|
||||||
|
import com.bwie.kill.config.MqConfig;
|
||||||
|
import com.bwie.kill.domain.request.VoKillOrderRequest;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
|
import org.springframework.amqp.core.MessageProperties;
|
||||||
|
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||||
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Log4j2
|
||||||
|
public class OrderProducer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RabbitTemplate rabbitTemplate;
|
||||||
|
|
||||||
|
@PostMapping("/mq")
|
||||||
|
public void getOrderMq(@RequestBody VoKillOrderRequest req){
|
||||||
|
rabbitTemplate.convertAndSend(MqConfig.DXEXCHANGE,MqConfig.ROUTINGKEY,req,message -> {
|
||||||
|
message.getMessageProperties().setMessageId(
|
||||||
|
UUID.randomUUID().toString()
|
||||||
|
);
|
||||||
|
return message;
|
||||||
|
},new CorrelationData(UUID.randomUUID().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/deadQueue")
|
||||||
|
public void getDeadQueue(@RequestParam String orderNum){
|
||||||
|
rabbitTemplate.convertAndSend(MqConfig.FORMAL_EXCHANGE,MqConfig.FORMAL_ROUNTE_KEY,orderNum,message -> {
|
||||||
|
message.getMessageProperties().setMessageId(
|
||||||
|
UUID.randomUUID().toString()
|
||||||
|
);
|
||||||
|
return message;
|
||||||
|
},new CorrelationData(UUID.randomUUID().toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.bwie.kill.domain.request.OcrResultVo;
|
||||||
|
import com.bwie.kill.domain.request.VoIdentityRequest;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public interface IdentityService {
|
||||||
|
|
||||||
|
public OcrResultVo getOCRInfo(MultipartFile file) throws IOException;
|
||||||
|
|
||||||
|
public String identity(VoIdentityRequest voIdentityRequest) throws ExecutionException, InterruptedException;
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,34 @@
|
||||||
package com.bwie.kill.service;
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.bwie.kill.domain.User;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsIndexListRequest;
|
||||||
|
import com.bwie.kill.domain.request.VoKillOrderRequest;
|
||||||
|
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
public interface KillGoodsServerService {
|
public interface KillGoodsServerService {
|
||||||
|
/**
|
||||||
|
* 秒杀列表
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
VoKillGoodsIndexListRequest getKillGoodsList(Long id) throws ExecutionException, InterruptedException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成订单
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getOrder(VoKillOrderRequest req);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成秒杀订单号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getKillOrderNum();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录人信息
|
||||||
|
*/
|
||||||
|
public User getUserInfo();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
|
||||||
|
public interface KillOrderService extends IService<KillOrder> {
|
||||||
|
|
||||||
|
public KillOrder getLLL();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.kill.domain.Master;
|
||||||
|
import com.bwie.kill.domain.request.VoIdentityRequest;
|
||||||
|
import com.bwie.kill.domain.request.VoMasterRequest;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
public interface MasterService extends IService<Master> {
|
||||||
|
/**
|
||||||
|
* 成为团长
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getAsMaster(VoMasterRequest req) throws ExecutionException, InterruptedException, IOException;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.bwie.kill.service;
|
||||||
|
|
||||||
|
public interface PaymentService {
|
||||||
|
/**
|
||||||
|
* 支付
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getPayOrder(String type);
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.bwie.kill.domain.request.ALiveEntity;
|
||||||
|
import com.bwie.kill.domain.request.IdentityResultVo;
|
||||||
|
import com.bwie.kill.domain.request.OcrResultVo;
|
||||||
|
import com.bwie.kill.domain.request.VoIdentityRequest;
|
||||||
|
import com.bwie.kill.job.HttpConnect;
|
||||||
|
import com.bwie.kill.service.IdentityService;
|
||||||
|
import com.bwie.kill.util.AliOssUtil;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class IdentityServiceImpl implements IdentityService {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpConnect httpConnect;
|
||||||
|
@Autowired
|
||||||
|
private ThreadPoolExecutor threadPoolExecutor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OcrResultVo getOCRInfo(MultipartFile file) throws IOException {
|
||||||
|
String side = "face";
|
||||||
|
String ocr = httpConnect.ocr(file, side);
|
||||||
|
return JSONObject.parseObject(ocr, OcrResultVo.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份校验
|
||||||
|
* @param voIdentityRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String identity(VoIdentityRequest voIdentityRequest) throws ExecutionException, InterruptedException {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//身份证正面认证
|
||||||
|
CompletableFuture<Boolean> f1 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
IdentityResultVo identity = httpConnect.identity(voIdentityRequest.getName(), voIdentityRequest.getIdCardNo());
|
||||||
|
return "成功".equals(identity.getMsg());
|
||||||
|
}, threadPoolExecutor);
|
||||||
|
|
||||||
|
//文字扫描身份证信息
|
||||||
|
CompletableFuture<OcrResultVo> f2 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
String side = "face";
|
||||||
|
String ocr = null;
|
||||||
|
try {
|
||||||
|
ocr = httpConnect.ocr(voIdentityRequest.getFaceFile(), side);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return JSONObject.parseObject(ocr, OcrResultVo.class);
|
||||||
|
}, threadPoolExecutor);
|
||||||
|
|
||||||
|
// CompletableFuture<String> f3 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
// String url = null;
|
||||||
|
// try {
|
||||||
|
// url = AliOssUtil.fileUpload(voIdentityRequest.getIdCardNo(), voIdentityRequest.getAliveFile().getInputStream());
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// return url;
|
||||||
|
// }, threadPoolExecutor);
|
||||||
|
//
|
||||||
|
// String url = f3.get();
|
||||||
|
|
||||||
|
//活体认证
|
||||||
|
CompletableFuture<Boolean> f3 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
ALiveEntity alive = null;
|
||||||
|
try {
|
||||||
|
alive = httpConnect.alive(voIdentityRequest.getAliveFile(),
|
||||||
|
voIdentityRequest.getName()+voIdentityRequest.getIdCardNo());
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return alive.isSuccess();
|
||||||
|
}, threadPoolExecutor);
|
||||||
|
|
||||||
|
CompletableFuture.allOf(f1,f2,f3).join();
|
||||||
|
|
||||||
|
Boolean getIdentity = f1.get();
|
||||||
|
OcrResultVo ocrResultVo = f2.get();
|
||||||
|
Boolean getALive = f3.get();
|
||||||
|
|
||||||
|
if ((getIdentity && getALive) && ocrResultVo.isSuccess()){
|
||||||
|
//用户认证成功
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ import com.bwie.kill.service.KillConfigService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class KillConfigServiceImpl extends ServiceImpl<KillConfigMapper, KillConfig>
|
public class KillConfigServiceImpl extends ServiceImpl<KillConfigMapper, KillConfig>
|
||||||
implements KillConfigService {
|
implements KillConfigService {
|
||||||
|
|
|
@ -1,9 +1,190 @@
|
||||||
package com.bwie.kill.service.impl;
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.bwie.common.constant.JwtConstants;
|
||||||
|
import com.bwie.common.constant.TokenConstants;
|
||||||
|
import com.bwie.common.redis.RedisCache;
|
||||||
|
import com.bwie.common.utils.JwtUtils;
|
||||||
|
import com.bwie.common.utils.StringUtils;
|
||||||
|
import com.bwie.kill.domain.KillConfig;
|
||||||
|
import com.bwie.kill.domain.KillGoods;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
import com.bwie.kill.domain.User;
|
||||||
|
import com.bwie.kill.domain.request.KillConfigure;
|
||||||
|
import com.bwie.kill.domain.request.VoKillGoodsIndexListRequest;
|
||||||
|
import com.bwie.kill.domain.request.VoKillOrderRequest;
|
||||||
|
import com.bwie.kill.producer.OrderProducer;
|
||||||
|
import com.bwie.kill.service.KillConfigService;
|
||||||
import com.bwie.kill.service.KillGoodsServerService;
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import com.bwie.kill.service.KillGoodsService;
|
||||||
|
import com.bwie.kill.service.KillOrderService;
|
||||||
|
import io.jsonwebtoken.Claims;
|
||||||
|
|
||||||
|
import org.redisson.Redisson;
|
||||||
|
import org.redisson.api.RLock;
|
||||||
|
import org.redisson.api.RSemaphore;
|
||||||
|
import org.redisson.api.RedissonClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static net.sf.jsqlparser.util.validation.metadata.NamedObject.user;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class KillGoodsServerServiceImpl implements KillGoodsServerService {
|
public class KillGoodsServerServiceImpl implements KillGoodsServerService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
@Autowired
|
||||||
|
private KillOrderService killOrderService;
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsService killGoodsService;
|
||||||
|
@Autowired
|
||||||
|
private KillConfigService killConfigService;
|
||||||
|
@Autowired
|
||||||
|
private RedissonClient redissonClient;
|
||||||
|
@Autowired
|
||||||
|
private OrderProducer orderProducer;
|
||||||
|
@Autowired
|
||||||
|
private ThreadPoolExecutor threadPoolExecutor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoKillGoodsIndexListRequest getKillGoodsList(Long id) throws ExecutionException, InterruptedException {
|
||||||
|
//获取当日时间的年月日
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String today = simpleDateFormat.format(new Date());
|
||||||
|
|
||||||
|
//创建一个CountDownLatch
|
||||||
|
CountDownLatch countDownLatch = new CountDownLatch(3);
|
||||||
|
//开启新线程 获取此时间段的秒杀商品
|
||||||
|
CompletableFuture<List<KillGoods>> f1 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
//去缓存里面拿取当日的秒杀商品
|
||||||
|
List<KillGoods> list = redisCache.getCacheList(KillConfigure.KILL_GOODS_KEY + today);
|
||||||
|
//线程执行结束countDown -1
|
||||||
|
countDownLatch.countDown();
|
||||||
|
return list.stream().filter(c -> c.getConfigId().equals(id)).collect(Collectors.toList());
|
||||||
|
}, threadPoolExecutor);
|
||||||
|
|
||||||
|
//获取商品秒杀配置表的数据
|
||||||
|
CompletableFuture<List<KillConfig>> f2 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
countDownLatch.countDown();
|
||||||
|
List<KillConfig> cacheList = redisCache.getCacheList(KillConfigure.KILL_CONFIG_LIST);
|
||||||
|
return cacheList;
|
||||||
|
}, threadPoolExecutor);
|
||||||
|
|
||||||
|
//获取实时热抢数据
|
||||||
|
CompletableFuture<ArrayList<KillGoods>> f3 = CompletableFuture.supplyAsync(() -> {
|
||||||
|
//拿到登录人信息 user
|
||||||
|
User user = getUserInfo();
|
||||||
|
|
||||||
|
//查询 当日支付成功该用户的秒杀订单
|
||||||
|
List<KillOrder> list = killOrderService.list(new LambdaQueryWrapper<KillOrder>()
|
||||||
|
.eq(KillOrder::getUserId, user.getUserId())
|
||||||
|
.eq(KillOrder::getOrderItemState, 2)
|
||||||
|
.ge(KillOrder::getCreateTime, today + " 00:00:00"));
|
||||||
|
|
||||||
|
List<KillGoods> cacheList = redisCache.getCacheList(KillConfigure.KILL_GOODS_KEY + today);
|
||||||
|
|
||||||
|
List<Long> longList = list.stream().map(KillOrder::getGoodsSkuId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
ArrayList<KillGoods> killGoods = new ArrayList<>();
|
||||||
|
for (Long l : longList) {
|
||||||
|
for (KillGoods goods : cacheList) {
|
||||||
|
if (l.equals(goods.getGoodsSkuId())) {
|
||||||
|
killGoods.add(goods);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
countDownLatch.countDown();
|
||||||
|
return killGoods;
|
||||||
|
}, threadPoolExecutor);
|
||||||
|
|
||||||
|
|
||||||
|
List<KillGoods> killGoods = f1.get();
|
||||||
|
List<KillConfig> killConfigs = f2.get();
|
||||||
|
ArrayList<KillGoods> killGoodsList = f3.get();
|
||||||
|
return VoKillGoodsIndexListRequest.builder()
|
||||||
|
.killGoodsOrder(killGoodsList)
|
||||||
|
.killGoods(killGoods)
|
||||||
|
.killConfig(killConfigs)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public User getUserInfo(){
|
||||||
|
//拿到登录人信息 user
|
||||||
|
String token = request.getHeader(TokenConstants.TOKEN);
|
||||||
|
Claims claims = JwtUtils.parseToken(token);
|
||||||
|
String userKey = JwtUtils.getUserKey(claims);
|
||||||
|
String cacheObject = redisCache.getCacheObject(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
||||||
|
return JSONObject.parseObject(cacheObject, User.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOrder(VoKillOrderRequest req) {
|
||||||
|
//获取登录人信息
|
||||||
|
User user = getUserInfo();
|
||||||
|
RLock lock = redissonClient.getLock("");
|
||||||
|
lock.lock();
|
||||||
|
lock.unlock();
|
||||||
|
//获取当前日期的年月日
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String today = simpleDateFormat.format(new Date());
|
||||||
|
//获取秒杀商品的信息
|
||||||
|
KillGoods killGoods = killGoodsService.getOne(new LambdaQueryWrapper<KillGoods>()
|
||||||
|
.eq(KillGoods::getGoodsSkuId, req.getGoodsSkuId()));
|
||||||
|
|
||||||
|
//根据活动开始日期判断是否在秒杀时段
|
||||||
|
Assert.isTrue(killGoods.getKillDate().equals(today),"未在秒杀时段");
|
||||||
|
|
||||||
|
//获取当前时间的 小时值
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("HH");
|
||||||
|
String nowTime = sdf.format(new Date());
|
||||||
|
//根据小时值 判断是否在当前秒杀时段 根据该秒杀配置的时段的结束时段判断 该商品是否在秒杀时段
|
||||||
|
KillConfig killConfig = killConfigService.getOne(new LambdaQueryWrapper<KillConfig>()
|
||||||
|
.eq(KillConfig::getId, killGoods.getConfigId()));
|
||||||
|
Assert.isTrue(killConfig.getKillEndTime() > Integer.parseInt(nowTime),"未在秒杀时段");
|
||||||
|
|
||||||
|
|
||||||
|
//判断该用户是否已经下过单
|
||||||
|
KillOrder killOrder = killOrderService.getOne(new LambdaQueryWrapper<KillOrder>()
|
||||||
|
.eq(KillOrder::getUserId, user.getUserId())
|
||||||
|
.eq(KillOrder::getGoodsSkuId, req.getGoodsSkuId())
|
||||||
|
.eq(KillOrder::getOrderItemState, 1)
|
||||||
|
.or().eq(KillOrder::getOrderItemState, 2));
|
||||||
|
Assert.isNull(killOrder,"不能重复下单");
|
||||||
|
|
||||||
|
//获取商品的信号量 操作库存数
|
||||||
|
RSemaphore semaphore = redissonClient.getSemaphore(KillConfigure.KILL_GOODS_XHL + today + req.getGoodsSkuId());
|
||||||
|
boolean tryAcquire = semaphore.tryAcquire();
|
||||||
|
if (tryAcquire){
|
||||||
|
//获取信号量成功
|
||||||
|
orderProducer.getOrderMq(req);
|
||||||
|
}else {
|
||||||
|
//获取信号量失败
|
||||||
|
//库存不足
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String getKillOrderNum(){
|
||||||
|
User userInfo = getUserInfo();
|
||||||
|
String sub = IdUtil.getSnowflake(1, 1).nextIdStr().substring(12);
|
||||||
|
return "MS"+DateUtil.format(new Date(), "yyyyMMddHHmmss") + sub + StringUtils.leftPad(String.valueOf(userInfo.getUserId()), 8, "0");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.K;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.kill.domain.KillOrder;
|
||||||
|
import com.bwie.kill.mapper.KillOrderMapper;
|
||||||
|
import com.bwie.kill.service.KillOrderService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class KillOrderServiceImpl extends ServiceImpl<KillOrderMapper, KillOrder>
|
||||||
|
implements KillOrderService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillOrderMapper killOrderMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KillOrder getLLL(){
|
||||||
|
KillOrder killOrder = killOrderMapper.selectById(1);
|
||||||
|
log.info(JSONObject.toJSONString(killOrder));
|
||||||
|
return killOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,4 +9,5 @@ import org.springframework.stereotype.Service;
|
||||||
@Service
|
@Service
|
||||||
public class KillSkuAttrValueServiceImpl extends ServiceImpl<KillSkuAttrValueMapper, KillSkuAttrValue>
|
public class KillSkuAttrValueServiceImpl extends ServiceImpl<KillSkuAttrValueMapper, KillSkuAttrValue>
|
||||||
implements KillSkuAttrValueService {
|
implements KillSkuAttrValueService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.kill.domain.Master;
|
||||||
|
import com.bwie.kill.domain.User;
|
||||||
|
import com.bwie.kill.domain.request.VoIdentityRequest;
|
||||||
|
import com.bwie.kill.domain.request.VoMasterRequest;
|
||||||
|
import com.bwie.kill.mapper.MasterMapper;
|
||||||
|
import com.bwie.kill.service.IdentityService;
|
||||||
|
import com.bwie.kill.service.KillGoodsServerService;
|
||||||
|
import com.bwie.kill.service.MasterService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MasterServiceImpl extends ServiceImpl<MasterMapper, Master>
|
||||||
|
implements MasterService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KillGoodsServerService killGoodsServerService;
|
||||||
|
@Autowired
|
||||||
|
private IdentityService identityService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAsMaster(VoMasterRequest req) throws ExecutionException, InterruptedException, IOException {
|
||||||
|
//判断申请人是否已经是团长职务
|
||||||
|
User userInfo = killGoodsServerService.getUserInfo();
|
||||||
|
|
||||||
|
Master master = this.getOne(
|
||||||
|
new LambdaQueryWrapper<Master>()
|
||||||
|
.eq(Master::getUserId, userInfo.getUserId())
|
||||||
|
.eq(Master::getApplicationStatus, 1)
|
||||||
|
.or()
|
||||||
|
.eq(Master::getApplicationStatus, 2)
|
||||||
|
);
|
||||||
|
Assert.notNull(master,"已经申请过团长请勿重复申请");
|
||||||
|
|
||||||
|
//审核 活体检测 身份认证是否通过
|
||||||
|
String identity = identityService.identity(req.getVoIdentityRequest());
|
||||||
|
String aliveFile = new String(req.getVoIdentityRequest().getAliveFile().getBytes(), StandardCharsets.UTF_8);
|
||||||
|
String faceFile = new String(req.getVoIdentityRequest().getFaceFile().getBytes(), StandardCharsets.UTF_8);
|
||||||
|
String backFile = new String(req.getVoIdentityRequest().getBackFile().getBytes(), StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
Master built = Master.builder()
|
||||||
|
.userId(userInfo.getUserId())
|
||||||
|
.masterCity(req.getMasterCity())
|
||||||
|
.masterAccount(req.getMasterAccount())
|
||||||
|
.masterAddress(req.getMasterAddress())
|
||||||
|
.masterMoney(req.getMasterMoney())
|
||||||
|
.examinePeople("曹恩宇")
|
||||||
|
.examineTime(new Date())
|
||||||
|
.applicationTime(new Date())
|
||||||
|
.applicationStatus(1)
|
||||||
|
.movie(aliveFile)
|
||||||
|
.faceImg(faceFile)
|
||||||
|
.backImg(backFile)
|
||||||
|
.masterLvId(req.getMasterLvId())
|
||||||
|
.createTime(new Date())
|
||||||
|
.isDelete(1)
|
||||||
|
.build();
|
||||||
|
if ("error".equals(identity)){
|
||||||
|
built.setApplicationStatus(3);
|
||||||
|
this.save(built);
|
||||||
|
//活体认证失败
|
||||||
|
throw new RuntimeException("活体认证失败,请重新上传");
|
||||||
|
}
|
||||||
|
|
||||||
|
//活体认证成功 团长认证成功
|
||||||
|
built.setApplicationStatus(2);
|
||||||
|
this.save(built);
|
||||||
|
return "success";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.bwie.kill.service.impl;
|
||||||
|
|
||||||
|
import com.bwie.kill.pay.PayService;
|
||||||
|
import com.bwie.kill.service.PaymentService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PaymentServiceImpl implements PaymentService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPayOrder(String type) {
|
||||||
|
|
||||||
|
PayService bean = (PayService) applicationContext.getBean(type);
|
||||||
|
String pay = bean.pay();
|
||||||
|
return pay;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.bwie.kill.util;
|
||||||
|
|
||||||
|
import com.aliyun.oss.ClientException;
|
||||||
|
import com.aliyun.oss.OSS;
|
||||||
|
import com.aliyun.oss.OSSClientBuilder;
|
||||||
|
import com.aliyun.oss.OSSException;
|
||||||
|
import com.aliyun.oss.model.PutObjectRequest;
|
||||||
|
import com.aliyun.oss.model.PutObjectResult;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class AliOssUtil {
|
||||||
|
private final static String ENDPOINT = "https://oss-cn-shanghai.aliyuncs.com";
|
||||||
|
// 从环境变量中获取访问凭证。运行本代码示例之前,请确保已设置环境变量OSS_ACCESS_KEY_ID和OSS_ACCESS_KEY_SECRET。
|
||||||
|
// EnvironmentVariableCredentialsProvider credentialsProvider = CredentialsProviderFactory.newEnvironmentVariableCredentialsProvider();
|
||||||
|
// 填写Bucket名称,例如examplebucket。
|
||||||
|
private final static String ACCESS_KEY_ID = "LTAI5tNbyFCgUq9HdbA2UKn5";
|
||||||
|
private final static String ACCESS_KEY_SECRET = "IkxMOSUJagCu3RAzMcNtwvnR6dLgqc";
|
||||||
|
private final static String BUCKET_NAME = "lyc-bucketone";
|
||||||
|
public static String fileUpload(String objectName, InputStream inputStream) throws Exception {
|
||||||
|
// 创建OSSClient实例。
|
||||||
|
OSS ossClient = new OSSClientBuilder().build(ENDPOINT, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
|
||||||
|
|
||||||
|
// 返回url地址
|
||||||
|
String url = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 填写字符串。
|
||||||
|
String content = "Hello OSS,你好世界";
|
||||||
|
|
||||||
|
// 创建PutObjectRequest对象。
|
||||||
|
//创建一个上传对象的请求
|
||||||
|
//bucketName: 代表要上传到的存储桶的名称。
|
||||||
|
//key: 代表要在存储桶中创建的对象的键(key),相当于文件的路径。
|
||||||
|
//input: 代表要上传的对象的输入流(InputStream),即要上传的文件的内容。
|
||||||
|
PutObjectRequest putObjectRequest = new PutObjectRequest(BUCKET_NAME, objectName, inputStream);
|
||||||
|
|
||||||
|
// 如果需要上传时设置存储类型和访问权限,请参考以下示例代码。
|
||||||
|
// ObjectMetadata metadata = new ObjectMetadata();
|
||||||
|
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString());
|
||||||
|
// metadata.setObjectAcl(CannedAccessControlList.Private);
|
||||||
|
// putObjectRequest.setMetadata(metadata);
|
||||||
|
|
||||||
|
// 上传字符串。
|
||||||
|
PutObjectResult result = ossClient.putObject(putObjectRequest);
|
||||||
|
|
||||||
|
// 返回url地址
|
||||||
|
url = "https://" + BUCKET_NAME + "." + ENDPOINT.substring(ENDPOINT.lastIndexOf("/") + 1) + "/" + objectName;
|
||||||
|
} catch (OSSException oe) {
|
||||||
|
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
||||||
|
+ "but was rejected with an error response for some reason.");
|
||||||
|
System.out.println("Error Message:" + oe.getErrorMessage());
|
||||||
|
System.out.println("Error Code:" + oe.getErrorCode());
|
||||||
|
System.out.println("Request ID:" + oe.getRequestId());
|
||||||
|
System.out.println("Host ID:" + oe.getHostId());
|
||||||
|
} catch (ClientException ce) {
|
||||||
|
System.out.println("Caught an ClientException, which means the client encountered "
|
||||||
|
+ "a serious internal problem while trying to communicate with OSS, "
|
||||||
|
+ "such as not being able to access the network.");
|
||||||
|
System.out.println("Error Message:" + ce.getMessage());
|
||||||
|
} finally {
|
||||||
|
if (ossClient != null) {
|
||||||
|
ossClient.shutdown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -16,6 +16,23 @@ spring:
|
||||||
profiles:
|
profiles:
|
||||||
# 环境配置
|
# 环境配置
|
||||||
active: dev
|
active: dev
|
||||||
|
rabbitmq:
|
||||||
|
host: 124.221.30.134
|
||||||
|
port: 5672
|
||||||
|
username: guest
|
||||||
|
password: guest
|
||||||
|
virtual-host: /
|
||||||
|
publisher-confirm-type: correlated #确认消息已发送到交换机(Exchange)
|
||||||
|
publisher-returns: true #确认消息已发送到队列(Queue)
|
||||||
|
listener:
|
||||||
|
simple:
|
||||||
|
prefetch: 1 # 每次只能获取一条,处理完成才能获取下一条
|
||||||
|
acknowledge-mode: manual # 设置消费端手动ack确认
|
||||||
|
retry:
|
||||||
|
enabled: true # 是否支持重试
|
||||||
|
template:
|
||||||
|
# 只要消息抵达Queue,就会异步发送优先回调return firm
|
||||||
|
mandatory: true
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
|
@ -29,3 +46,9 @@ spring:
|
||||||
# 共享配置
|
# 共享配置
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
|
||||||
|
aliyun:
|
||||||
|
appCode: fe039d38cebe4dcebd0eabc8d1c32fea
|
||||||
|
indentityUrl: https://jumdata.market.alicloudapi.com/idcard/validate
|
||||||
|
ocrUrl: https://cardnumber.market.alicloudapi.com
|
||||||
|
aliveUrl: https://life.shumaidata.com/checklife
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?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>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-modules</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>bwie-payment</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!-- 系统公共 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bwie</groupId>
|
||||||
|
<artifactId>bwie-common</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<!-- SpringBoot Web-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mybatis 依赖配置 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Pagehelper -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
<version>1.4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>druid-spring-boot-starter</artifactId>
|
||||||
|
<version>1.1.16</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alipay.sdk</groupId>
|
||||||
|
<artifactId>alipay-sdk-java</artifactId>
|
||||||
|
<version>4.34.0.ALL</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.3</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.bwie.payment;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.Import;
|
||||||
|
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@Import(value = ThreadPoolExecutor.class)
|
||||||
|
public class PaymentApplication {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(PaymentApplication.class,args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.bwie.payment.config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 📝 TODO
|
||||||
|
* 🕟 2024/4/8 10:04
|
||||||
|
* 👦 GMY
|
||||||
|
*/
|
||||||
|
public class AliPayTradeStatusConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易创建,等待买家付款。
|
||||||
|
*/
|
||||||
|
public static final String WAIT_BUYER_PAY = "WAIT_BUYER_PAY";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未付款交易超时关闭,或支付完成后全额退款。
|
||||||
|
*/
|
||||||
|
public static final String TRADE_CLOSED = "TRADE_CLOSED";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易支付成功。
|
||||||
|
*/
|
||||||
|
public static final String TRADE_SUCCESS = "TRADE_SUCCESS";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易结束,不可退款。
|
||||||
|
*/
|
||||||
|
public static final String TRADE_FINISHED = "TRADE_FINISHED";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.bwie.payment.config;
|
||||||
|
|
||||||
|
import com.alipay.api.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.PropertySource;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@PropertySource("classpath:application.properties")
|
||||||
|
public class AlipayClientConfig {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public AlipayClient alipayClient() throws AlipayApiException {
|
||||||
|
AlipayConfig alipayConfig = new AlipayConfig();
|
||||||
|
//设置网关地址
|
||||||
|
alipayConfig.setServerUrl(environment.getProperty("alipay.gateway-url"));
|
||||||
|
//设置应用ID
|
||||||
|
alipayConfig.setAppId(environment.getProperty("alipay.app-id"));
|
||||||
|
//设置应用私钥
|
||||||
|
alipayConfig.setPrivateKey(environment.getProperty("alipay.merchant-private-Key"));
|
||||||
|
//设置请求格式,固定值json
|
||||||
|
alipayConfig.setFormat(AlipayConstants.FORMAT_JSON);
|
||||||
|
//设置字符集
|
||||||
|
alipayConfig.setCharset(AlipayConstants.CHARSET_UTF8);
|
||||||
|
//设置签名类型
|
||||||
|
alipayConfig.setSignType(AlipayConstants.SIGN_TYPE_RSA2);
|
||||||
|
//设置支付宝公钥
|
||||||
|
alipayConfig.setAlipayPublicKey(environment.getProperty("alipay.alipay-public-Key"));
|
||||||
|
//实例化客户端
|
||||||
|
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||||
|
|
||||||
|
return alipayClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.bwie.payment.controller;
|
||||||
|
|
||||||
|
import com.bwie.common.result.Result;
|
||||||
|
import com.bwie.payment.service.PaymentService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/payment")
|
||||||
|
public class PaymentController {
|
||||||
|
|
||||||
|
private final PaymentService paymentService;
|
||||||
|
|
||||||
|
public PaymentController(PaymentService paymentService) {
|
||||||
|
this.paymentService = paymentService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付接口
|
||||||
|
* @param productId 订单号
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/pay")
|
||||||
|
public Result<String> getPayOrders(@RequestParam Long productId,@RequestParam String token){
|
||||||
|
return Result.success(
|
||||||
|
paymentService.getPayOrders(productId,token)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调接口
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/notify")
|
||||||
|
public Result<String> getNotify(HttpServletRequest request){
|
||||||
|
return Result.success(
|
||||||
|
paymentService.getNotify(request)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户发起退款待商家审核
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/createRefundOrder")
|
||||||
|
public Result<String> createRefundOrder(@RequestParam Long orderNo){
|
||||||
|
return Result.success(
|
||||||
|
paymentService.createRefundOrder(orderNo)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class AlipayNotifyParam implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
// 创建时间
|
||||||
|
private String gmt_create;
|
||||||
|
|
||||||
|
// 字符编码
|
||||||
|
private String charset;
|
||||||
|
|
||||||
|
// 支付时间
|
||||||
|
private Date gmt_payment;
|
||||||
|
|
||||||
|
// 通知时间
|
||||||
|
private String notify_time;
|
||||||
|
|
||||||
|
// 商品标题
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
// 签名
|
||||||
|
private String sign;
|
||||||
|
|
||||||
|
// 买家ID
|
||||||
|
private String buyer_id;
|
||||||
|
|
||||||
|
// 发票金额
|
||||||
|
private BigDecimal invoice_amount;
|
||||||
|
|
||||||
|
// 版本号
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
// 通知ID
|
||||||
|
private String notify_id;
|
||||||
|
|
||||||
|
// 资金账单列表
|
||||||
|
private String fund_bill_list;
|
||||||
|
|
||||||
|
// 通知类型
|
||||||
|
private String notify_type;
|
||||||
|
|
||||||
|
// 商户订单号
|
||||||
|
private String out_trade_no;
|
||||||
|
|
||||||
|
// 总金额
|
||||||
|
private BigDecimal total_amount;
|
||||||
|
|
||||||
|
// 交易状态
|
||||||
|
private String trade_status;
|
||||||
|
|
||||||
|
// 支付宝交易号
|
||||||
|
private String trade_no;
|
||||||
|
|
||||||
|
// 授权商户应用ID
|
||||||
|
private String auth_app_id;
|
||||||
|
|
||||||
|
// 实收金额
|
||||||
|
private BigDecimal receipt_amount;
|
||||||
|
|
||||||
|
// 积分抵扣金额
|
||||||
|
private BigDecimal point_amount;
|
||||||
|
|
||||||
|
// 买家实付金额
|
||||||
|
private BigDecimal buyer_pay_amount;
|
||||||
|
|
||||||
|
// 应用ID
|
||||||
|
private String app_id;
|
||||||
|
|
||||||
|
// 签名类型
|
||||||
|
private String sign_type;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("goods")
|
||||||
|
public class Goods {
|
||||||
|
private String title; //订单标题
|
||||||
|
|
||||||
|
private String orderNo; //商户订单编号
|
||||||
|
|
||||||
|
private Long userId; //用户ID
|
||||||
|
|
||||||
|
private Long productId; //支付商品id
|
||||||
|
|
||||||
|
private Integer totalFee; //订单金额(分)
|
||||||
|
|
||||||
|
private String codeUrl; //订单二维码链接
|
||||||
|
|
||||||
|
private String orderStatus; //订单状态
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房源表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("house")
|
||||||
|
public class House {
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Long id; //主键
|
||||||
|
private Long userId; //发布人id
|
||||||
|
private String title; //标题
|
||||||
|
private String estate; //小区
|
||||||
|
private Long houseTypeId; //发布类型id-- 2手房出售 有房出租 我想买房 租房 帮我找房
|
||||||
|
private Long addrId; //区域id
|
||||||
|
private Integer dictionaryTypeId; //房产类型字典id
|
||||||
|
private String houseAddr; //房源详细地址
|
||||||
|
private BigDecimal housePrice; //价格
|
||||||
|
private String roomType; //户型
|
||||||
|
private String orientation; //朝向
|
||||||
|
private String decorate; //装修
|
||||||
|
private String floor; //楼层
|
||||||
|
private Double acreage; //面积
|
||||||
|
private String sellingPoints; //核心卖点
|
||||||
|
private String mentality; //业主心态
|
||||||
|
private String serviceIntroduction; //服务介绍
|
||||||
|
private Integer managerStatus; //房源管理状态
|
||||||
|
private String source; //数据来源
|
||||||
|
private Integer houseOldNew; //房型类型 【0-新房 1-二手房 2-出租房】
|
||||||
|
private Long brokerId; //经纪人id
|
||||||
|
private Integer isSuccess; //是否交易成功【0-成功 1-失败】
|
||||||
|
private Integer verify; //是否验真【0-已验真 1-未验真】
|
||||||
|
private Integer isEs; //是否同步es【0-同步 1-未同步】
|
||||||
|
private Date createTime; //创建时间
|
||||||
|
private Date updateTime; //最近更新时间
|
||||||
|
private Integer isDelete; //逻辑删除字段
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单表
|
||||||
|
* @TableName ums_order
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName("oms_order")
|
||||||
|
public class OmsOrder implements Serializable {
|
||||||
|
/**
|
||||||
|
* 订单id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private Long orderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付名称
|
||||||
|
*/
|
||||||
|
private String payTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请id
|
||||||
|
*/
|
||||||
|
private Integer applyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal payMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单类型 1:买/租 2:售/租
|
||||||
|
*/
|
||||||
|
private Integer orderState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态 0:待支付 1:支付中 2:已支付 3:已取消 4:已过期
|
||||||
|
*/
|
||||||
|
private Integer payState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除标识(0:未删 1:删除)
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object that) {
|
||||||
|
if (this == that) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (that == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != that.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
OmsOrder other = (OmsOrder) that;
|
||||||
|
return (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
|
||||||
|
&& (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
|
||||||
|
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
|
||||||
|
&& (this.getApplyId() == null ? other.getApplyId() == null : this.getApplyId().equals(other.getApplyId()))
|
||||||
|
&& (this.getPayMoney() == null ? other.getPayMoney() == null : this.getPayMoney().equals(other.getPayMoney()))
|
||||||
|
&& (this.getOrderState() == null ? other.getOrderState() == null : this.getOrderState().equals(other.getOrderState()))
|
||||||
|
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
|
||||||
|
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
|
||||||
|
&& (this.getIsDelete() == null ? other.getIsDelete() == null : this.getIsDelete().equals(other.getIsDelete()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
|
||||||
|
result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
|
||||||
|
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
|
||||||
|
result = prime * result + ((getApplyId() == null) ? 0 : getApplyId().hashCode());
|
||||||
|
result = prime * result + ((getPayMoney() == null) ? 0 : getPayMoney().hashCode());
|
||||||
|
result = prime * result + ((getOrderState() == null) ? 0 : getOrderState().hashCode());
|
||||||
|
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
|
||||||
|
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
|
||||||
|
result = prime * result + ((getIsDelete() == null) ? 0 : getIsDelete().hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(getClass().getSimpleName());
|
||||||
|
sb.append(" [");
|
||||||
|
sb.append("Hash = ").append(hashCode());
|
||||||
|
sb.append(", orderId=").append(orderId);
|
||||||
|
sb.append(", orderNo=").append(orderNo);
|
||||||
|
sb.append(", userId=").append(userId);
|
||||||
|
sb.append(", applyId=").append(applyId);
|
||||||
|
sb.append(", payMoney=").append(payMoney);
|
||||||
|
sb.append(", orderState=").append(orderState);
|
||||||
|
sb.append(", createTime=").append(createTime);
|
||||||
|
sb.append(", updateTime=").append(updateTime);
|
||||||
|
sb.append(", isDelete=").append(isDelete);
|
||||||
|
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||||
|
sb.append("]");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付明细表
|
||||||
|
* @TableName oms_pay
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@TableName("oms_pay")
|
||||||
|
public class OmsPay implements Serializable {
|
||||||
|
/**
|
||||||
|
* 支付id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Integer payId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private long orderNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易凭证号
|
||||||
|
*/
|
||||||
|
private String tradeNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自己生成的支付流水单号
|
||||||
|
*/
|
||||||
|
private Long myTradeNo;
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal payMoney;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付时间
|
||||||
|
*/
|
||||||
|
private Date payTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付方式 1:微信 2:支付宝 3:银联
|
||||||
|
*/
|
||||||
|
private Integer payWay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付去向 商户appId
|
||||||
|
*/
|
||||||
|
private String payDirection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付状态 1待支付、2支付中、3支付成功、4支付失败
|
||||||
|
*/
|
||||||
|
private Integer payState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private Integer isDelete;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("oms_refund")
|
||||||
|
public class OmsRefund {
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
private String orderNo;
|
||||||
|
/**
|
||||||
|
* 退款理由
|
||||||
|
*/
|
||||||
|
private String refundReason;
|
||||||
|
/**
|
||||||
|
* 退款状态 0 退款中 1已结束
|
||||||
|
*/
|
||||||
|
private String refundState;
|
||||||
|
/**
|
||||||
|
* 退款结果
|
||||||
|
*/
|
||||||
|
private String refundResult;
|
||||||
|
/**
|
||||||
|
* 退款总金额
|
||||||
|
*/
|
||||||
|
private String refundFee;
|
||||||
|
/**
|
||||||
|
* 实际退款金额
|
||||||
|
*/
|
||||||
|
private String sendBackFee;
|
||||||
|
/**
|
||||||
|
* 发起人
|
||||||
|
*/
|
||||||
|
private String createUser;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private String createTime;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private String updateTime;
|
||||||
|
/**
|
||||||
|
* 删除标识
|
||||||
|
*/
|
||||||
|
private String isDelete;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package com.bwie.payment.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TableName("orders_info")
|
||||||
|
public class OrdersInfo {
|
||||||
|
private String title; //订单标题
|
||||||
|
|
||||||
|
private String orderNo; //商户订单编号
|
||||||
|
|
||||||
|
private Long userId; //用户ID
|
||||||
|
|
||||||
|
private Long productId; //支付商品id
|
||||||
|
|
||||||
|
private Integer totalFee; //订单金额(分)
|
||||||
|
|
||||||
|
private String codeUrl; //订单二维码链接
|
||||||
|
|
||||||
|
private String orderStatus; //订单状态
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.payment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.payment.domain.Goods;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface GoodsMapper extends BaseMapper<Goods> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.payment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.payment.domain.House;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public interface HouseMapper extends BaseMapper<House> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.payment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.payment.domain.OmsOrder;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface OmsOrderMapper extends BaseMapper<OmsOrder> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.payment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.payment.domain.OmsPay;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface OmsPayMapper extends BaseMapper<OmsPay> {
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.bwie.payment.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.bwie.payment.domain.OmsRefund;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface OmsRefundMapper extends BaseMapper<OmsRefund> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.payment.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.payment.domain.Goods;
|
||||||
|
|
||||||
|
public interface GoodsService extends IService<Goods> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.payment.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.payment.domain.House;
|
||||||
|
|
||||||
|
public interface HouseService extends IService<House> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.payment.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.payment.domain.OmsOrder;
|
||||||
|
|
||||||
|
public interface OmsOrderService extends IService<OmsOrder> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.payment.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.payment.domain.OmsPay;
|
||||||
|
|
||||||
|
public interface OmsPayService extends IService<OmsPay> {
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package com.bwie.payment.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.bwie.payment.domain.OmsRefund;
|
||||||
|
|
||||||
|
public interface OmsRefundService extends IService<OmsRefund> {
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.bwie.payment.service;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
public interface PaymentService {
|
||||||
|
/**
|
||||||
|
* 下单
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getPayOrders(Long productId,String token);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String getNotify(HttpServletRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成退款订单
|
||||||
|
* @param orderNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String createRefundOrder(Long orderNo);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.payment.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.payment.domain.Goods;
|
||||||
|
import com.bwie.payment.mapper.GoodsMapper;
|
||||||
|
import com.bwie.payment.service.GoodsService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods>
|
||||||
|
implements GoodsService {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.payment.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.payment.domain.House;
|
||||||
|
import com.bwie.payment.mapper.HouseMapper;
|
||||||
|
import com.bwie.payment.service.HouseService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class HouseServiceImpl extends ServiceImpl<HouseMapper, House>
|
||||||
|
implements HouseService {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.payment.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.payment.domain.OmsOrder;
|
||||||
|
import com.bwie.payment.mapper.OmsOrderMapper;
|
||||||
|
import com.bwie.payment.service.OmsOrderService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder>
|
||||||
|
implements OmsOrderService {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.payment.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.payment.domain.OmsPay;
|
||||||
|
import com.bwie.payment.mapper.OmsPayMapper;
|
||||||
|
import com.bwie.payment.service.OmsPayService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OmsPayServiceImpl extends ServiceImpl<OmsPayMapper, OmsPay>
|
||||||
|
implements OmsPayService {
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.bwie.payment.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.bwie.payment.domain.OmsRefund;
|
||||||
|
import com.bwie.payment.mapper.OmsRefundMapper;
|
||||||
|
import com.bwie.payment.service.OmsRefundService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class OmsRefundServiceImpl extends ServiceImpl<OmsRefundMapper, OmsRefund>
|
||||||
|
implements OmsRefundService {
|
||||||
|
}
|
|
@ -0,0 +1,376 @@
|
||||||
|
package com.bwie.payment.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alipay.api.AlipayApiException;
|
||||||
|
import com.alipay.api.AlipayClient;
|
||||||
|
import com.alipay.api.domain.AlipayTradeQueryModel;
|
||||||
|
import com.alipay.api.internal.util.AlipaySignature;
|
||||||
|
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
|
import com.alipay.api.request.AlipayTradeQueryRequest;
|
||||||
|
import com.alipay.api.request.AlipayTradeRefundRequest;
|
||||||
|
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||||
|
import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||||
|
import com.alipay.api.response.AlipayTradeRefundResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.bwie.payment.config.AliPayTradeStatusConstant;
|
||||||
|
import com.bwie.payment.domain.AlipayNotifyParam;
|
||||||
|
import com.bwie.payment.domain.OmsOrder;
|
||||||
|
import com.bwie.payment.domain.OmsPay;
|
||||||
|
import com.bwie.payment.service.*;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PaymentServiceImpl implements PaymentService {
|
||||||
|
|
||||||
|
private final String NOTIFY_URL = "http://48vabx.natappfree.cc";
|
||||||
|
private final String RETURN_URL = "http://localhost:9114/home/list";
|
||||||
|
@Autowired
|
||||||
|
private AlipayClient alipayClient;
|
||||||
|
@Autowired
|
||||||
|
private Environment environment;
|
||||||
|
@Autowired
|
||||||
|
private OmsOrderService omsOrderService;
|
||||||
|
@Autowired
|
||||||
|
private GoodsService goodsService;
|
||||||
|
@Autowired
|
||||||
|
private ThreadPoolExecutor threadPoolExecutor;
|
||||||
|
@Autowired
|
||||||
|
private HouseService houseService;
|
||||||
|
@Autowired
|
||||||
|
private OmsPayService omsPayService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下单支付
|
||||||
|
* @param productId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPayOrders(Long productId,String token) {
|
||||||
|
|
||||||
|
//生成订单
|
||||||
|
OmsOrder omsOrder = this.getOrdersInfo(productId);
|
||||||
|
|
||||||
|
//判断订单状态 避免重复支付
|
||||||
|
Assert.isTrue(omsOrder.getPayState() == 0 ,"已提交支付不可重复提交");
|
||||||
|
|
||||||
|
|
||||||
|
OmsPay omsPay = OmsPay.builder()
|
||||||
|
.orderNo(omsOrder.getOrderNo())
|
||||||
|
.payMoney(omsOrder.getPayMoney())
|
||||||
|
.userId(1)
|
||||||
|
.myTradeNo(IdUtil.getSnowflakeNextId())
|
||||||
|
.payTime(new Date())
|
||||||
|
.payWay(2)
|
||||||
|
.payDirection(environment.getProperty("alipay.seller-id"))
|
||||||
|
.payState(1)
|
||||||
|
.createTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 2. 创建 Request并设置Request参数
|
||||||
|
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); // 发送请求的 Request类
|
||||||
|
request.setNotifyUrl(NOTIFY_URL);
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", omsOrder.getOrderNo()); // 我们自己生成的订单编号,必须唯一不允许重复
|
||||||
|
BigDecimal divide = omsOrder.getPayMoney().divide(new BigDecimal("100"));
|
||||||
|
bizContent.put("total_amount", divide); // 订单的总金额
|
||||||
|
bizContent.put("subject", omsOrder.getPayTitle()); // 支付的名称
|
||||||
|
bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY"); // 固定配置
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
request.setReturnUrl(RETURN_URL + omsOrder.getUserId()); //支付完成后自动跳转到本地页面的路径
|
||||||
|
|
||||||
|
String form = "";
|
||||||
|
try {
|
||||||
|
AlipayTradePagePayResponse response = alipayClient.sdkExecute(request);
|
||||||
|
|
||||||
|
if (response.isSuccess()){
|
||||||
|
form = response.getBody();
|
||||||
|
omsOrder.setPayState(1);
|
||||||
|
omsOrderService.update(omsOrder,new LambdaQueryWrapper<OmsOrder>()
|
||||||
|
.eq(OmsOrder::getOrderNo,omsOrder.getOrderNo()));
|
||||||
|
omsPay.setPayState(2);
|
||||||
|
|
||||||
|
|
||||||
|
}else {
|
||||||
|
omsPay.setPayState(4);
|
||||||
|
throw new RuntimeException("创建交易订单失败");
|
||||||
|
}
|
||||||
|
} catch (AlipayApiException e) {
|
||||||
|
throw new RuntimeException("创建交易订单失败");
|
||||||
|
}
|
||||||
|
omsPayService.save(omsPay);
|
||||||
|
return form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款接口
|
||||||
|
* @param outTradeNo
|
||||||
|
* @param userId
|
||||||
|
* @param payMoney
|
||||||
|
* @param refundReason
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String refund(String outTradeNo, String userId, String payMoney, String refundReason){
|
||||||
|
|
||||||
|
OmsOrder omsOrder = omsOrderService.getOne(new LambdaQueryWrapper<OmsOrder>()
|
||||||
|
.eq(OmsOrder::getOrderNo, outTradeNo));
|
||||||
|
Assert.notNull(omsOrder,"未查询到订单");
|
||||||
|
|
||||||
|
try {
|
||||||
|
JSONObject bizContent = new JSONObject();
|
||||||
|
bizContent.put("out_trade_no", outTradeNo); //退款单号
|
||||||
|
bizContent.put("refund_amount", payMoney); //退款金额
|
||||||
|
bizContent.put("refund_reason", refundReason); //退款原因
|
||||||
|
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
||||||
|
request.setBizContent(bizContent.toString());
|
||||||
|
|
||||||
|
AlipayTradeRefundResponse response = alipayClient.execute(request);
|
||||||
|
if(response.isSuccess()){
|
||||||
|
//将相应的参数转为map集合
|
||||||
|
Map map = JSONObject.parseObject(response.getBody(), Map.class);
|
||||||
|
log.info("bodyMap=======>"+map);
|
||||||
|
HashMap<String,String> refundMap = (HashMap<String,String>) map.get("alipay_trade_refund_response");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("退款失败");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调失败主动去支付宝查询订单
|
||||||
|
* @param outTradeNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String audit(Long outTradeNo){
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 构造请求参数以调用接口
|
||||||
|
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
|
||||||
|
AlipayTradeQueryModel model = new AlipayTradeQueryModel();
|
||||||
|
|
||||||
|
// 设置订单支付时传入的商户订单号
|
||||||
|
model.setOutTradeNo(outTradeNo.toString());
|
||||||
|
|
||||||
|
// 设置查询选项
|
||||||
|
List<String> queryOptions = new ArrayList<String>();
|
||||||
|
queryOptions.add("trade_settle_info");
|
||||||
|
model.setQueryOptions(queryOptions);
|
||||||
|
|
||||||
|
// 设置支付宝交易号
|
||||||
|
// model.setTradeNo("2014112611001004680 073956707");
|
||||||
|
|
||||||
|
request.setBizModel(model);
|
||||||
|
AlipayTradeQueryResponse response = alipayClient.execute(request);
|
||||||
|
System.out.println(response.getBody());
|
||||||
|
|
||||||
|
if (response.isSuccess()) {
|
||||||
|
|
||||||
|
System.out.println("调用成功");
|
||||||
|
} else {
|
||||||
|
System.out.println("调用失败");
|
||||||
|
// sdk版本是"4.38.0.ALL"及以上,可以参考下面的示例获取诊断链接
|
||||||
|
// String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response);
|
||||||
|
// System.out.println(diagnosisUrl);
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getNotify(HttpServletRequest request) {
|
||||||
|
|
||||||
|
Map<String, String> params = convertRequestParamsToMap(request);
|
||||||
|
|
||||||
|
AlipayNotifyParam param = (AlipayNotifyParam) buildAlipayBo(params, AlipayNotifyParam.class);
|
||||||
|
|
||||||
|
String tradeStatus = param.getTrade_status();
|
||||||
|
log.info(param.getTrade_status());
|
||||||
|
|
||||||
|
String sign = params.get("sign");
|
||||||
|
String content = AlipaySignature.getSignCheckContentV1(params);
|
||||||
|
|
||||||
|
try {
|
||||||
|
boolean flag = AlipaySignature.rsa256CheckContent(content, sign, environment.getProperty("alipay.alipay-public-Key"), "UTF-8");
|
||||||
|
|
||||||
|
if (flag){
|
||||||
|
|
||||||
|
log.info("支付宝回调验证成功");
|
||||||
|
String subject = param.getSubject();//交易名称
|
||||||
|
String appId = param.getApp_id();//商户Appid 9021000135673575 9021000135673575
|
||||||
|
String tradeNo = param.getTrade_no();//支付宝交易凭证号
|
||||||
|
String outTradeNo = param.getOut_trade_no();//商户订单号
|
||||||
|
BigDecimal totalAmount = param.getTotal_amount();//交易金额
|
||||||
|
String buyerId = param.getBuyer_id();//买家在支付宝唯一id
|
||||||
|
Date payment = param.getGmt_payment();//买家付款时间
|
||||||
|
BigDecimal buyerPayAmount = param.getBuyer_pay_amount();//买家付款金额
|
||||||
|
|
||||||
|
OmsOrder omsOrder = this.check(tradeNo, appId, totalAmount);
|
||||||
|
OmsPay omsPay = omsPayService.getOne(new LambdaQueryWrapper<OmsPay>()
|
||||||
|
.eq(OmsPay::getOrderNo, omsOrder.getOrderNo())
|
||||||
|
.eq(OmsPay::getPayState,2));
|
||||||
|
omsPay.setUpdateTime(new Date());
|
||||||
|
omsPay.setTradeNo(tradeNo);
|
||||||
|
if (AliPayTradeStatusConstant.TRADE_SUCCESS.equals(tradeStatus)
|
||||||
|
|| AliPayTradeStatusConstant.TRADE_FINISHED.equals(tradeStatus)){
|
||||||
|
|
||||||
|
if (omsOrder.getPayState() != 1){
|
||||||
|
log.warn("重复回调[{}]",tradeNo);
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
//处理业务
|
||||||
|
omsPay.setPayState(3);
|
||||||
|
//修改交易流水为支付成功
|
||||||
|
omsPayService.updateById(omsPay);
|
||||||
|
|
||||||
|
omsOrder.setPayState(2);
|
||||||
|
omsOrderService.update(omsOrder,new LambdaQueryWrapper<OmsOrder>()
|
||||||
|
.eq(OmsOrder::getOrderNo,omsOrder.getOrderNo()));
|
||||||
|
|
||||||
|
}
|
||||||
|
if (AliPayTradeStatusConstant.TRADE_CLOSED.equals(tradeStatus)){
|
||||||
|
//订单超时修改状态
|
||||||
|
omsOrder.setPayState(4);
|
||||||
|
omsPay.setPayState(4);
|
||||||
|
omsOrderService.updateById(omsOrder);
|
||||||
|
omsPayService.updateById(omsPay);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else {
|
||||||
|
log.error("支付宝回调签名认证失败,signVerified=false, paramsJson:{}", params);
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("接口回调异常");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return "success";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createRefundOrder(Long orderNo) {
|
||||||
|
OmsOrder omsOrder = omsOrderService.getOne(new LambdaQueryWrapper<OmsOrder>()
|
||||||
|
.eq(OmsOrder::getOrderNo, orderNo));
|
||||||
|
|
||||||
|
Assert.notNull(omsOrder,"该订单不存在,无法创建退款订单");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回调参数校验
|
||||||
|
* @param tradeNo
|
||||||
|
* @param appId
|
||||||
|
* @param totalAmount
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public OmsOrder check(String tradeNo,String appId,BigDecimal totalAmount){
|
||||||
|
|
||||||
|
//利用订单编号查询订单
|
||||||
|
OmsOrder omsOrder = omsOrderService.getOne(new LambdaQueryWrapper<OmsOrder>()
|
||||||
|
.eq(OmsOrder::getOrderNo,tradeNo));
|
||||||
|
|
||||||
|
//若订单信息null则 抛出异常 校验失败
|
||||||
|
if (omsOrder == null) throw new RuntimeException("tradeNo 异常");
|
||||||
|
//将订单信息里面的支付金额于支付包请求的订单金额作比较,若不一致则校验失败
|
||||||
|
BigDecimal divide = omsOrder.getPayMoney().divide(new BigDecimal("100"));
|
||||||
|
if (divide.compareTo(totalAmount) != 0) throw new RuntimeException("支付金额异常");
|
||||||
|
|
||||||
|
//验证appid
|
||||||
|
if (environment.getProperty("alipay.app-id").equals(appId)) throw new RuntimeException("appId 不一致");
|
||||||
|
|
||||||
|
|
||||||
|
return omsOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将请求过来的参数转换为map
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static Map<String, String> convertRequestParamsToMap(HttpServletRequest request) {
|
||||||
|
//获取支付宝POST过来反馈信息,将异步通知中收到的待验证所有参数都存放到map中
|
||||||
|
Map< String , String > params = new HashMap < String , String > ();
|
||||||
|
Map requestParams = request.getParameterMap();
|
||||||
|
|
||||||
|
for(Iterator iter = requestParams.keySet().iterator();iter.hasNext();){
|
||||||
|
String name = (String)iter.next();
|
||||||
|
String[] values = (String [])requestParams.get(name);
|
||||||
|
String valueStr = "";
|
||||||
|
for(int i = 0;i < values.length;i ++ ){
|
||||||
|
valueStr = (i==values.length-1)?valueStr + values [i]:valueStr + values[i] + ",";
|
||||||
|
}
|
||||||
|
//乱码解决,这段代码在出现乱码时使用。
|
||||||
|
//valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
|
||||||
|
params.put (name,valueStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析 支付宝异步回调参数
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Object buildAlipayBo(Map<String, String> params, Class<?> source) {
|
||||||
|
String json = JSONObject.toJSONString(params);
|
||||||
|
return JSONObject.parseObject(json, source);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//生成订单
|
||||||
|
public OmsOrder getOrdersInfo(Long productId){
|
||||||
|
|
||||||
|
OmsOrder omsOrder = omsOrderService
|
||||||
|
.getOne(new LambdaQueryWrapper<OmsOrder>()
|
||||||
|
.eq(OmsOrder::getOrderNo, productId));
|
||||||
|
|
||||||
|
Assert.notNull(omsOrder,"订单号不存在");
|
||||||
|
// houseService.
|
||||||
|
// OrdersInfo info = new OrdersInfo();
|
||||||
|
// BeanUtils.copyProperties(info,goods);
|
||||||
|
// ordersInfoService.save(info);
|
||||||
|
// return info;
|
||||||
|
return omsOrder;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,461 @@
|
||||||
|
package com.bwie.payment.utils;//package com.bwie.payment.utils;
|
||||||
|
//
|
||||||
|
//import cn.hutool.json.JSONObject;
|
||||||
|
//import com.alipay.api.AlipayApiException;
|
||||||
|
//import com.alipay.api.AlipayClient;
|
||||||
|
//import com.alipay.api.DefaultAlipayClient;
|
||||||
|
//import com.alipay.api.domain.AlipayTradeQueryModel;
|
||||||
|
//import com.alipay.api.domain.AlipayTradeRefundModel;
|
||||||
|
//import com.alipay.api.internal.util.AlipaySignature;
|
||||||
|
//import com.alipay.api.request.AlipayDataDataserviceBillDownloadurlQueryRequest;
|
||||||
|
//import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
|
//import com.alipay.api.request.AlipayTradeQueryRequest;
|
||||||
|
//import com.alipay.api.request.AlipayTradeRefundRequest;
|
||||||
|
//import com.alipay.api.response.AlipayDataDataserviceBillDownloadurlQueryResponse;
|
||||||
|
//import com.alipay.api.response.AlipayTradeQueryResponse;
|
||||||
|
//import com.alipay.api.response.AlipayTradeRefundResponse;
|
||||||
|
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
//import com.damn.common.core.domain.entity.OmsOrder;
|
||||||
|
//import com.damn.common.core.domain.entity.OmsRefund;
|
||||||
|
//import com.damn.common.core.result.R;
|
||||||
|
//import com.damn.common.core.result.Result;
|
||||||
|
//import com.damn.common.core.utils.FileUtil;
|
||||||
|
//import com.damn.common.core.utils.JsonUtil;
|
||||||
|
//import com.damn.order.config.AliPayConfig;
|
||||||
|
//import com.damn.order.constant.AliPayTradeStatusConstant;
|
||||||
|
//import com.damn.order.pojo.bo.AlipayNotifyParam;
|
||||||
|
//import com.damn.order.service.AliPayService;
|
||||||
|
//import com.damn.order.service.OmsOrderService;
|
||||||
|
//import com.damn.order.service.OmsPayService;
|
||||||
|
//import com.damn.order.service.OmsRefundService;
|
||||||
|
//import lombok.extern.log4j.Log4j2;
|
||||||
|
//import org.joda.time.DateTime;
|
||||||
|
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.stereotype.Service;
|
||||||
|
//import org.springframework.core.env.Environment;
|
||||||
|
//import org.springframework.util.Assert;
|
||||||
|
//
|
||||||
|
//import javax.servlet.http.HttpServletRequest;
|
||||||
|
//import javax.servlet.http.HttpServletResponse;
|
||||||
|
//import java.io.File;
|
||||||
|
//import java.math.BigDecimal;
|
||||||
|
//import java.net.MalformedURLException;
|
||||||
|
//import java.sql.SQLException;
|
||||||
|
//import java.util.*;
|
||||||
|
//import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 📝 TODO 支付宝支付
|
||||||
|
// * 🕟 2024/3/29 18:39
|
||||||
|
// * 👦 Lxj
|
||||||
|
// */
|
||||||
|
//@Service("2")
|
||||||
|
//@Log4j2
|
||||||
|
//public class Alipay extends PayAbstract implements AliPayService {
|
||||||
|
//
|
||||||
|
// // 支付宝沙箱网关地址 https://openapi.alipay.com/gateway.do https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||||
|
// private static final String GATEWAY_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
|
||||||
|
// private static final String FORMAT = "JSON";
|
||||||
|
// private static final String CHARSET = "UTF-8";
|
||||||
|
// //签名方式
|
||||||
|
// private static final String SIGN_TYPE = "RSA2";
|
||||||
|
//
|
||||||
|
// private static final String RETURN_URL = "http://localhost:9201/generator/housingrent/rent/release/";
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private AliPayConfig aliPayConfig;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private OmsRefundService omsRefundService;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private OmsOrderService omsOrderService;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private ThreadPoolExecutor threadPoolExecutor;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private OmsPayService omsPayService;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private RabbitTemplate rabbitTemplate;
|
||||||
|
//
|
||||||
|
// @Autowired
|
||||||
|
// private Environment env;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 支付下单 业务
|
||||||
|
// *
|
||||||
|
// * @param orderNo 订单号
|
||||||
|
// * @param payMoney 支付金额
|
||||||
|
// * @param s 支付名称
|
||||||
|
// * @param userId 用户Id
|
||||||
|
// * @param httpResponse 响应
|
||||||
|
// * @return FORM表单
|
||||||
|
// */
|
||||||
|
// public R pay(String orderNo, BigDecimal payMoney, String s, Integer userId, HttpServletResponse httpResponse) {
|
||||||
|
// AlipayClient alipayClient = this.getAlipayClient();
|
||||||
|
//
|
||||||
|
// // 2. 创建 Request并设置Request参数
|
||||||
|
// AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); // 发送请求的 Request类
|
||||||
|
// request.setNotifyUrl(aliPayConfig.getNotifyUrl());
|
||||||
|
// JSONObject bizContent = new JSONObject();
|
||||||
|
// bizContent.set("out_trade_no", orderNo); // 我们自己生成的订单编号,必须唯一不允许重复
|
||||||
|
// bizContent.set("total_amount", payMoney); // 订单的总金额
|
||||||
|
// bizContent.set("subject", s); // 支付的名称
|
||||||
|
// bizContent.set("product_code", "FAST_INSTANT_TRADE_PAY"); // 固定配置
|
||||||
|
// request.setBizContent(bizContent.toString());
|
||||||
|
// request.setReturnUrl(RETURN_URL + userId); //支付完成后自动跳转到本地页面的路径
|
||||||
|
// // 执行请求,拿到响应的结果,返回给浏览器(支付宝官方提供的支付页面)
|
||||||
|
// String form = "";
|
||||||
|
// try {
|
||||||
|
// form = alipayClient.pageExecute(request).getBody(); // 调用SDK生成表单
|
||||||
|
// } catch (AlipayApiException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// HashMap<String, Object> stringStringHashMap = new HashMap<>();
|
||||||
|
// stringStringHashMap.put("data", form);
|
||||||
|
//
|
||||||
|
// return R.ok(stringStringHashMap);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 退款操作
|
||||||
|
// public Result refund(String outTradeNo, String userId, String payMoney, String subject, String refundReason) {
|
||||||
|
// OmsOrder omsOrder = omsOrderService.getOne(
|
||||||
|
// new LambdaQueryWrapper<OmsOrder>().eq(OmsOrder::getOrderNo, outTradeNo)
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// Assert.notEmpty((Collection<?>) omsOrder, "未查询到订单");
|
||||||
|
//
|
||||||
|
// //实例化客户端
|
||||||
|
// AlipayClient alipayClient = this.getAlipayClient();
|
||||||
|
//
|
||||||
|
// //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
|
||||||
|
// AlipayTradeRefundModel refundModel = new AlipayTradeRefundModel();
|
||||||
|
// refundModel.setTradeNo(outTradeNo);//订单号 商户支付的订单号
|
||||||
|
// refundModel.setRefundAmount(payMoney);//支付金额
|
||||||
|
// refundModel.setRefundReason(subject);//支付名称
|
||||||
|
// //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
|
||||||
|
// AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
|
||||||
|
// request.setBizModel(refundModel);
|
||||||
|
//
|
||||||
|
// AlipayTradeRefundResponse response = null;
|
||||||
|
// try {
|
||||||
|
// response = alipayClient.execute(request);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// log.error("支付宝退款错误![{}]", e.getMessage());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String msg = response.getMsg();//退款结果 Success
|
||||||
|
//
|
||||||
|
// //获取参数
|
||||||
|
// Map bodyMap = JsonUtil.parseObject(response.getBody(), Map.class);
|
||||||
|
//
|
||||||
|
// System.out.println("map = " + bodyMap);
|
||||||
|
// /*
|
||||||
|
// Business Failed
|
||||||
|
// {"alipay_trade_refund_response":{"msg":"Business Failed","code":"40004","sub_msg":"参数无效:退款金额格式错误","refund_fee":"0.00","sub_code":"ACQ.INVALID_PARAMETER","send_back_fee":"0.00"},"sign":"m9zMGV38157aUEgKc26ZcewcuN+PpR81F0ewCitO/hkkfzZyysivDlvMqi3GlIbW1aoIepsh99E2AsikeTblzKAseWM+i8KAigEwNR9sOLhuFNSjKcvakCEdikjzhDJJrzGP9tDVy8QK7At++Xh2SZaKqxDkQfTHMsMkfpTME2QJXfvfyPRu0bn9O6mtYtTeLAXVU8xaGoE3CyzTNScHSPFIqxs+54/aN1wxQnO4joi5cR4yOcv0R1JIa60uqP9wdUO9ol3zMVCkvfZr5M9tCa7guHnmWmrHa0PTQMuC9pjEfEMkLkGxk46+7lTue83kf54k7dtoLsPs2T1kkqo6Xw=="}
|
||||||
|
// */
|
||||||
|
// Map<String, String> responseMap = (Map<String, String>) bodyMap.get("alipay_trade_refund_response");
|
||||||
|
// String sign = bodyMap.get("sign").toString();
|
||||||
|
//
|
||||||
|
// String subMsg = responseMap.get("sub_msg");
|
||||||
|
// String code = responseMap.get("code");
|
||||||
|
// String refundFee = responseMap.get("refund_fee");//退款总金额
|
||||||
|
// String sendBackFee = responseMap.get("send_back_fee");//实际退回金额
|
||||||
|
//
|
||||||
|
// OmsRefund omsRefund = OmsRefund.builder()
|
||||||
|
// .orderNo(Long.valueOf(outTradeNo))
|
||||||
|
// .createUser(Integer.parseInt(userId))
|
||||||
|
// .refundReason(refundReason)
|
||||||
|
// .refundResult(msg)
|
||||||
|
// .refundFee(new BigDecimal(refundFee))
|
||||||
|
// .sendBackFee(new BigDecimal(sendBackFee))
|
||||||
|
// .refundState(1)
|
||||||
|
// .createTime(new Date())
|
||||||
|
// .build();
|
||||||
|
//
|
||||||
|
// //创建线程异步 添加数据库
|
||||||
|
// threadPoolExecutor.execute(() -> {
|
||||||
|
// omsRefundService.save(omsRefund);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// log.info("支付宝退款信息[{}]", subMsg);
|
||||||
|
//
|
||||||
|
// Result<Object> result = new Result<>();
|
||||||
|
//
|
||||||
|
// result.setMsg(subMsg);
|
||||||
|
// result.setCode(Integer.parseInt(code));
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询交易信息
|
||||||
|
// *
|
||||||
|
// * @param outTradeNo 订单号
|
||||||
|
// */
|
||||||
|
// public Result getTransaction(Long outTradeNo) {
|
||||||
|
// AlipayClient alipayClient = getAlipayClient();
|
||||||
|
// try {
|
||||||
|
// // 构造请求参数以调用接口
|
||||||
|
// AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
|
||||||
|
// AlipayTradeQueryModel model = new AlipayTradeQueryModel();
|
||||||
|
//
|
||||||
|
// // 设置订单支付时传入的商户订单号
|
||||||
|
// model.setOutTradeNo(String.valueOf(outTradeNo));
|
||||||
|
//
|
||||||
|
// // 设置查询选项
|
||||||
|
// List<String> queryOptions = new ArrayList<String>();
|
||||||
|
// queryOptions.add("trade_settle_info");
|
||||||
|
// model.setQueryOptions(queryOptions);
|
||||||
|
//
|
||||||
|
// // 设置支付宝交易号
|
||||||
|
//// model.setTradeNo("2014112611001004680 073956707");
|
||||||
|
//
|
||||||
|
// request.setBizModel(model);
|
||||||
|
// AlipayTradeQueryResponse response = alipayClient.execute(request);
|
||||||
|
//
|
||||||
|
// String code = response.getCode();
|
||||||
|
//
|
||||||
|
// if (response.isSuccess() && "10000".equals(code)) {
|
||||||
|
// return Result.success(response);
|
||||||
|
// } else {
|
||||||
|
// String subMsg = response.getSubMsg();
|
||||||
|
//
|
||||||
|
// return Result.error(code, subMsg);
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("订单查询失败:{}", e.getMessage());
|
||||||
|
// throw new RuntimeException("订单查询失败,请重试");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 支付宝成功回调
|
||||||
|
// * 3
|
||||||
|
// *
|
||||||
|
// * @param request
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public String payNotify(HttpServletRequest request) {
|
||||||
|
//
|
||||||
|
// Map<String, String> params = convertRequestParamsToMap(request);
|
||||||
|
//
|
||||||
|
// AlipayNotifyParam param = (AlipayNotifyParam) buildAlipayBo(params, AlipayNotifyParam.class);
|
||||||
|
//
|
||||||
|
// String tradeStatus = param.getTrade_status();
|
||||||
|
// log.info(tradeStatus);
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// String sign = params.get("sign");
|
||||||
|
// String content = AlipaySignature.getSignCheckContentV1(params);
|
||||||
|
//
|
||||||
|
// // 验证签名+
|
||||||
|
// boolean checkSignature = AlipaySignature.rsa256CheckContent(content, sign, aliPayConfig.getAlipayPublicKey(), "UTF-8");
|
||||||
|
//
|
||||||
|
// // 支付宝验签
|
||||||
|
// if (checkSignature) {
|
||||||
|
//
|
||||||
|
// //异步业务处理
|
||||||
|
// threadPoolExecutor.execute(() -> {
|
||||||
|
// try {
|
||||||
|
// log.info("支付宝回调签名认证成功");
|
||||||
|
//
|
||||||
|
// String subject = param.getSubject();//交易名称
|
||||||
|
// String appId = param.getApp_id();//商户Appid 9021000135673575 9021000135673575
|
||||||
|
// String tradeNo = param.getTrade_no();//支付宝交易凭证号
|
||||||
|
// String outTradeNo = param.getOut_trade_no();//商户订单号
|
||||||
|
// BigDecimal totalAmount = param.getTotal_amount();//交易金额
|
||||||
|
// String buyerId = param.getBuyer_id();//买家在支付宝唯一id
|
||||||
|
// Date payment = param.getGmt_payment();//买家付款时间
|
||||||
|
// BigDecimal buyerPayAmount = param.getBuyer_pay_amount();//买家付款金额
|
||||||
|
//
|
||||||
|
// OmsOrder omsOrder = this.check(outTradeNo, totalAmount, appId);
|
||||||
|
//
|
||||||
|
// if (AliPayTradeStatusConstant.TRADE_SUCCESS.equals(tradeStatus)
|
||||||
|
// || AliPayTradeStatusConstant.TRADE_FINISHED.equals(tradeStatus)) {
|
||||||
|
//
|
||||||
|
// if (omsOrder.getPayState() != 0) {
|
||||||
|
// log.warn("重复回调:[{}]", tradeNo);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //业务处理
|
||||||
|
// omsOrderService.businessSuccessHandle(Long.parseLong(outTradeNo),omsOrder,tradeNo,payment);
|
||||||
|
//
|
||||||
|
// } else if (AliPayTradeStatusConstant.TRADE_CLOSED.equals(tradeStatus)) {
|
||||||
|
//
|
||||||
|
// omsOrderService.businessExpireHandle(Long.parseLong(outTradeNo),omsOrder,tradeNo);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.error("业务处理异常:{},paramsJson:{}", e.getMessage(), param);
|
||||||
|
//
|
||||||
|
// if (e instanceof SQLException) {
|
||||||
|
// // sql错误
|
||||||
|
// log.error("SQLException:[{}]", e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// return "success";
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// log.error("支付宝回调签名认证失败,signVerified=false, paramsJson:{}", params);
|
||||||
|
// return "failure";
|
||||||
|
// }
|
||||||
|
// } catch (AlipayApiException e) {
|
||||||
|
// log.error("支付宝回调签名认证失败,signVerified=false, paramsJson:{}", params);
|
||||||
|
// return "failure";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// public void reconciliation(){
|
||||||
|
// AlipayClient alipayClient = getAlipayClient();
|
||||||
|
// try {
|
||||||
|
// AlipayDataDataserviceBillDownloadurlQueryRequest request = new AlipayDataDataserviceBillDownloadurlQueryRequest();
|
||||||
|
// JSONObject json = new JSONObject();
|
||||||
|
// json.put("bill_type", "trade");
|
||||||
|
// //昨天的数据
|
||||||
|
// json.put("bill_date", new DateTime().minusDays(1).toString("yyyy-MM-dd"));
|
||||||
|
// request.setBizContent(json.toString());
|
||||||
|
// AlipayDataDataserviceBillDownloadurlQueryResponse response = alipayClient
|
||||||
|
// .execute(request);
|
||||||
|
// if(response.isSuccess()){
|
||||||
|
// // 获取下载地址url
|
||||||
|
// String url = response.getBillDownloadUrl();
|
||||||
|
// // 设置下载后生成Zip目录
|
||||||
|
// String filePath = env.getProperty("file.path");
|
||||||
|
// String newZip = filePath + new Date().getTime() + ".zip";
|
||||||
|
// // 开始下载
|
||||||
|
// FileUtil.downloadNet(url, newZip);
|
||||||
|
// // 解压到指定目录
|
||||||
|
// FileUtil.unZip(newZip, env.getProperty("file.zip.path"));
|
||||||
|
// // 遍历文件 获取需要的汇整csv
|
||||||
|
//// File[] fs = new File(env.getProperty("file.zip.path")).listFiles();
|
||||||
|
//// RealIncom income = null;
|
||||||
|
//// for (File file : fs) {
|
||||||
|
//// if (file.getAbsolutePath().contains("汇总")) {
|
||||||
|
//// Double money = ReadCsv.getMoney("", file.getAbsolutePath());
|
||||||
|
//// income = new RealIncom();
|
||||||
|
//// income.setDate(new Date());
|
||||||
|
//// income.setMoney(money);
|
||||||
|
//// taskDao.insertTodayMoney(income);
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
// // 插入成功, 删除csv 文件
|
||||||
|
//// for (File file : fs) {
|
||||||
|
//// file.delete();
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// }else{
|
||||||
|
// //如果账单不存在, 插入一条空数据到数据库
|
||||||
|
//// RealIncom income= new RealIncom();
|
||||||
|
//// income.setDate(new Date());
|
||||||
|
//// income.setMoney(0.00);
|
||||||
|
//// taskDao.insertTodayMoney(income);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (response.isSuccess()) {
|
||||||
|
// System.out.println("调用成功");
|
||||||
|
// } else {
|
||||||
|
// System.out.println("调用失败");
|
||||||
|
// }
|
||||||
|
//// System.out.println(JSON.toJSONString(response));
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 在上述验证通过后商户必须根据支付宝不同类型的业务通知,正确的进行不同的业务处理,并且过滤重复的通知结果数据。
|
||||||
|
// * 在支付宝的业务通知中,只有交易通知状态为TRADE_SUCCESS或TRADE_FINISHED时,支付宝才会认定为买家付款成功。
|
||||||
|
// *
|
||||||
|
// * @param tradeNo 订单号
|
||||||
|
// * @param totalAmount 支付金额
|
||||||
|
// * @param appId appId
|
||||||
|
// * @throws AlipayApiException 异常
|
||||||
|
// */
|
||||||
|
// private OmsOrder check(String tradeNo, BigDecimal totalAmount, String appId) throws AlipayApiException {
|
||||||
|
// // 1、验证创建的订单号,
|
||||||
|
// OmsOrder omsOrder = omsOrderService.getOne(
|
||||||
|
// new LambdaQueryWrapper<OmsOrder>().eq(OmsOrder::getOrderNo, tradeNo)
|
||||||
|
// );
|
||||||
|
//
|
||||||
|
// if (omsOrder == null) throw new AlipayApiException("out_trade_no错误");
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // 2、判断total_amount
|
||||||
|
// if (omsOrder.getPayMoney().compareTo(totalAmount) != 0) throw new AlipayApiException("error total_amount");
|
||||||
|
//
|
||||||
|
// // 3、校验通知中的seller_id(或者seller_email)是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id/seller_email),
|
||||||
|
// // 第三步可根据实际情况省略
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // 4、验证app_id
|
||||||
|
// if (!appId.equals(aliPayConfig.getAppId())) throw new AlipayApiException("app_id不一致");
|
||||||
|
//
|
||||||
|
// return omsOrder;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 创建Client,通用SDK提供的Client,负责调用支付宝的API
|
||||||
|
// *
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// public AlipayClient getAlipayClient() {
|
||||||
|
// AlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, aliPayConfig.getAppId(),
|
||||||
|
// aliPayConfig.getAppPrivateKey(), FORMAT, CHARSET, aliPayConfig.getAlipayPublicKey(), SIGN_TYPE);
|
||||||
|
//
|
||||||
|
// return alipayClient;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 将request中的参数转换成Map
|
||||||
|
// *
|
||||||
|
// * @param request
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// private static Map<String, String> convertRequestParamsToMap(HttpServletRequest request) {
|
||||||
|
// Map<String, String> retMap = new HashMap<String, String>();
|
||||||
|
//
|
||||||
|
// Set<Map.Entry<String, String[]>> entrySet = request.getParameterMap().entrySet();
|
||||||
|
//
|
||||||
|
// for (Map.Entry<String, String[]> entry : entrySet) {
|
||||||
|
// String name = entry.getKey();
|
||||||
|
// String[] values = entry.getValue();
|
||||||
|
// int valLen = values.length;
|
||||||
|
//
|
||||||
|
// if (valLen == 1) {
|
||||||
|
// retMap.put(name, values[0]);
|
||||||
|
// } else if (valLen > 1) {
|
||||||
|
// StringBuilder sb = new StringBuilder();
|
||||||
|
// for (String val : values) {
|
||||||
|
// sb.append(",").append(val);
|
||||||
|
// }
|
||||||
|
// retMap.put(name, sb.toString().substring(1));
|
||||||
|
// } else {
|
||||||
|
// retMap.put(name, "");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return retMap;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 解析 支付宝异步回调参数
|
||||||
|
// *
|
||||||
|
// * @param params
|
||||||
|
// * @return
|
||||||
|
// */
|
||||||
|
// private Object buildAlipayBo(Map<String, String> params, Class<?> source) {
|
||||||
|
// String json = JsonUtil.toJSONString(params);
|
||||||
|
// return JsonUtil.parseObject(json, source);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//}
|
|
@ -0,0 +1,18 @@
|
||||||
|
#?????????
|
||||||
|
|
||||||
|
#??ID???APPID?????????APPID???????
|
||||||
|
alipay.app-id=9021000135696749
|
||||||
|
#??PID????????ID
|
||||||
|
alipay.seller-id=2088721033391474
|
||||||
|
#?????
|
||||||
|
alipay.gateway-url=https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||||
|
#???????PKCS8?XTRSA2??
|
||||||
|
alipay.merchant-private-Key=MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXF5CkRSWeyJe6D3gAclCXyw1GrRK+YrkCC4kUCif62qQpTlO6XDVWC76E/g9K+ISPhjI1DlbOh6D+h+Q28Jz/KJH+9KAXX2NRK3ssWGn+lxHLXV2qt+Xs0xuSDuu/jYfoxtX7EWo9pbkfEDjMIjrLjHRSANFv6CyUYer17kY1tjqIndaeLAxk0wWlShremzVQ6L9d1CpqOQ02bcAcoDmp4jzJkJJl45JBoa5Fg6S+J8HYZb4LbcK4Xu5BeaGaLQQvvE9Fxi7RGU33n5RKwZfEYzwr7CJ5KmjUUde4r0n4QQLUBmIH5aVydieWnBIklazV3SFqcwYDsTESF666BMudAgMBAAECggEAf0bbknWpPjvODG9RcFbb6zKiaWIMQxLYtI9RFu+DRD8AQMd5oqhgSa60/EUkTsxQprKuAqGkoHACP8friBhiuFLNwY8CeQ3ilRLivLVx/IP3+m8ZI2GsrzYaqIwnLYKk9YLh6JCABZRgAHnizpsbGjKkHhwQUYusWgauLiNdQ4qFy2RrHwD6RBz23T5nLFmtHJl1QPGcZ/FKKanRDPzJfOat+jbkq+1zeWXKdFcnVyO4KmJ3rVUX8Tvc+Hyoevv5JrkCuIiGIjXVejxjrc2w15EEPiHG9F4qXl3qlnHV8K1s4xV3XIHhf+IWcNTeSH2Xnz6IqTPEjlMb4mt/0GAtpQKBgQDN7lPshMENJz1bZOxcRVZ0kZM8P2D6JCmjgzmLv5jnuZYWFY2o3KSiUAsHqCQnp7hqhv6xDhKszHf0b/2rHzTiOkiF69/JVmks0BHycDFnWECbz2ow8OKyfznPaNr1qCF4pGBpcKroXbqUAs9+bTodgswAqOdaCVMijg6LlAQDXwKBgQC70+wTayCyFWOlE1H6cQiAQ0CGf12m/D5lOuY28Blxu2WQIfK75N/OMhWm+J+gMGcBvpzHy7/OgQz1E9tOZYs2Go68OcXn5OMJdpkGpjyPkdlx12LFxXwMNXoTIhUgVVtWTdDMFFPsMLgwnOVKzQlhenHCwj06Ki1poddVdiQugwKBgAm7PnoJ1/mgJhUgks7Vc/10N6n8MMABX3pbpCeHeVlR+ta2VAhrzNfiwnKtLnA1S9C06mpBiP5jdzO06x7gDaa3LGAvwlaIX9X/SynSxXLlx7/VMGZ5q6zVuEyl3tsHA/XohqnU6i6q5ztBWr7VuI5WdP9++9fUYvpaDjPoXbwvAoGBAJFDI9gcyOuRiT/4wjT7SETSPkwGouprOOJXfAZPCI6iDLk82BqitsgkigRZUjK0XGXIAj6vAEd4HQpJchmehNyyC2PdFobyyPffphezZzDt7oqRtk0YH4jdruyvNkGMYhhMFEhRDFqljz3hiZ+hFTkzVln2mR2r0vVX+k6ZEQB7AoGAQPAbPge3NXvdnJ2W8pEKOgcWgtEalc8Sp+pqPEXusT+/0HzRPYNbfKWfdeGQJK6CsOBD066iyFKf7IumZgvJl0U8NTXU413zw4fJDU0lMHaIVpk8uoOP1hExQW29w/hyFBTgemTjULSTXdrIc65ZnLzpHKqy/I6Vw0wn97iG4QI=
|
||||||
|
#????,????:https://openhome.alipa4.com/platform/keyManage.htm??APPID???????
|
||||||
|
alipay.alipay-public-Key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk79CYftaXsMdjKHBvoOWvtTnvvX/BfG5OA1ad5x+y3it8SOqua0xq3bZthnZdh5bVhUrkUPui+lpqx+NLWGd9g33CzNMz+qMm/WKSSX/hNvUM4kuS6NnXFXV/uxb1168TPubO/GfXogVYeWZFHhV2Vw8zy/cjqxUFZYwaK5Gc8zTky5/FLgMs9hTpgG21EtgSP8wiH1Bh/LfA59hsucejPZEA5o9yGAtSGKdw2C3/7Qj9Gvz3Pnu3l9zLjSqCpt8Y5mepRM+8jIVM/+ixSvF7YXuaXf5SlPdPidnKcfrxOM2ytmU6BndG83mim2ZkAqyKwpoD8JYsvvHjSw2EKw5cwIDAQAB
|
||||||
|
##?????????????
|
||||||
|
#alipay.content-key=
|
||||||
|
##????????????
|
||||||
|
#alipay.return-url=
|
||||||
|
#????????
|
||||||
|
alipay.notify-url=http://48vabx.natappfree.cc
|
|
@ -0,0 +1,38 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 9114
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
|
jackson:
|
||||||
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
time-zone: GMT+8
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: bwie-payment
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 124.221.30.134:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 124.221.30.134:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
|
||||||
|
#alipay:
|
||||||
|
# appId: 9021000135696749
|
||||||
|
# appPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXF5CkRSWeyJe6D3gAclCXyw1GrRK+YrkCC4kUCif62qQpTlO6XDVWC76E/g9K+ISPhjI1DlbOh6D+h+Q28Jz/KJH+9KAXX2NRK3ssWGn+lxHLXV2qt+Xs0xuSDuu/jYfoxtX7EWo9pbkfEDjMIjrLjHRSANFv6CyUYer17kY1tjqIndaeLAxk0wWlShremzVQ6L9d1CpqOQ02bcAcoDmp4jzJkJJl45JBoa5Fg6S+J8HYZb4LbcK4Xu5BeaGaLQQvvE9Fxi7RGU33n5RKwZfEYzwr7CJ5KmjUUde4r0n4QQLUBmIH5aVydieWnBIklazV3SFqcwYDsTESF666BMudAgMBAAECggEAf0bbknWpPjvODG9RcFbb6zKiaWIMQxLYtI9RFu+DRD8AQMd5oqhgSa60/EUkTsxQprKuAqGkoHACP8friBhiuFLNwY8CeQ3ilRLivLVx/IP3+m8ZI2GsrzYaqIwnLYKk9YLh6JCABZRgAHnizpsbGjKkHhwQUYusWgauLiNdQ4qFy2RrHwD6RBz23T5nLFmtHJl1QPGcZ/FKKanRDPzJfOat+jbkq+1zeWXKdFcnVyO4KmJ3rVUX8Tvc+Hyoevv5JrkCuIiGIjXVejxjrc2w15EEPiHG9F4qXl3qlnHV8K1s4xV3XIHhf+IWcNTeSH2Xnz6IqTPEjlMb4mt/0GAtpQKBgQDN7lPshMENJz1bZOxcRVZ0kZM8P2D6JCmjgzmLv5jnuZYWFY2o3KSiUAsHqCQnp7hqhv6xDhKszHf0b/2rHzTiOkiF69/JVmks0BHycDFnWECbz2ow8OKyfznPaNr1qCF4pGBpcKroXbqUAs9+bTodgswAqOdaCVMijg6LlAQDXwKBgQC70+wTayCyFWOlE1H6cQiAQ0CGf12m/D5lOuY28Blxu2WQIfK75N/OMhWm+J+gMGcBvpzHy7/OgQz1E9tOZYs2Go68OcXn5OMJdpkGpjyPkdlx12LFxXwMNXoTIhUgVVtWTdDMFFPsMLgwnOVKzQlhenHCwj06Ki1poddVdiQugwKBgAm7PnoJ1/mgJhUgks7Vc/10N6n8MMABX3pbpCeHeVlR+ta2VAhrzNfiwnKtLnA1S9C06mpBiP5jdzO06x7gDaa3LGAvwlaIX9X/SynSxXLlx7/VMGZ5q6zVuEyl3tsHA/XohqnU6i6q5ztBWr7VuI5WdP9++9fUYvpaDjPoXbwvAoGBAJFDI9gcyOuRiT/4wjT7SETSPkwGouprOOJXfAZPCI6iDLk82BqitsgkigRZUjK0XGXIAj6vAEd4HQpJchmehNyyC2PdFobyyPffphezZzDt7oqRtk0YH4jdruyvNkGMYhhMFEhRDFqljz3hiZ+hFTkzVln2mR2r0vVX+k6ZEQB7AoGAQPAbPge3NXvdnJ2W8pEKOgcWgtEalc8Sp+pqPEXusT+/0HzRPYNbfKWfdeGQJK6CsOBD066iyFKf7IumZgvJl0U8NTXU413zw4fJDU0lMHaIVpk8uoOP1hExQW29w/hyFBTgemTjULSTXdrIc65ZnLzpHKqy/I6Vw0wn97iG4QI=
|
||||||
|
# alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk79CYftaXsMdjKHBvoOWvtTnvvX/BfG5OA1ad5x+y3it8SOqua0xq3bZthnZdh5bVhUrkUPui+lpqx+NLWGd9g33CzNMz+qMm/WKSSX/hNvUM4kuS6NnXFXV/uxb1168TPubO/GfXogVYeWZFHhV2Vw8zy/cjqxUFZYwaK5Gc8zTky5/FLgMs9hTpgG21EtgSP8wiH1Bh/LfA59hsucejPZEA5o9yGAtSGKdw2C3/7Qj9Gvz3Pnu3l9zLjSqCpt8Y5mepRM+8jIVM/+ixSvF7YXuaXf5SlPdPidnKcfrxOM2ytmU6BndG83mim2ZkAqyKwpoD8JYsvvHjSw2EKw5cwIDAQAB
|
||||||
|
# notifyUrl: http://48vabx.natappfree.cc
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<module>bwie-system</module>
|
<module>bwie-system</module>
|
||||||
<module>bwie-xxl</module>
|
<module>bwie-xxl</module>
|
||||||
<module>bwie-team</module>
|
<module>bwie-team</module>
|
||||||
|
<module>bwie-payment</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
|
Loading…
Reference in New Issue