支付宝
parent
b8a2095bd4
commit
0ccf7932b6
|
@ -7,6 +7,8 @@
|
|||
<file url="file://$PROJECT_DIR$/bwie-common/src/main/resources" 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/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-Alipay/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-ali/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-ask/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-background/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/bwie-modules/bwie-chat/src/main/java" charset="UTF-8" />
|
||||
|
|
|
@ -12,6 +12,11 @@
|
|||
<option value="$PROJECT_DIR$/bwie-auth/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="ignoredFiles">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$/bwie-modules/bwie-ali/pom.xml" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
<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" />
|
||||
|
|
|
@ -11,6 +11,7 @@ import lombok.NoArgsConstructor;
|
|||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 房源表
|
||||
|
@ -48,4 +49,6 @@ public class House {
|
|||
private Date createTime; //创建时间
|
||||
private Date updateTime; //最近更新时间
|
||||
private Integer isDelete; //逻辑删除字段
|
||||
private Integer houseOldNew;
|
||||
private List<String> imageAddr;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
package com.bwie.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
@ -7,17 +6,14 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("house_images")
|
||||
public class HouseImages {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id; //id
|
||||
private Long houseId; //房型id
|
||||
private String imageAddr; //图片地址
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.bwie.common.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 订单表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Order {
|
||||
|
||||
private Long ordersId;//订单ID
|
||||
private String ordersNumber;//订单编号
|
||||
private Long userId;//支付人ID
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyyy-MM-dd HH:mm:ss")
|
||||
private Date ordersDate;//支付时间
|
||||
private String ordersWay;//支付方式
|
||||
private BigDecimal ordersPrice;//支付金额
|
||||
private Integer isDelete;//逻辑删除
|
||||
private Integer ordersStatus;//订单状态
|
||||
private Long houseId;//房源表ID
|
||||
private String userTel;//支付人手机号
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyyy-MM-dd HH:mm:ss")
|
||||
private Date udpDate;//最新更改订单时间
|
||||
}
|
|
@ -3,4 +3,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
|||
com.bwie.common.handler.GlobalExceptionHandle,\
|
||||
com.bwie.common.config.RedisConfig,\
|
||||
com.bwie.common.redis.RedisCache,\
|
||||
com.bwie.common.remote.factory.RemoteHouseFactory
|
||||
com.bwie.common.remote.factory.RemoteHouseFactory,\
|
||||
com.bwie.common.remote.factory.RemoteLoginFactory
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<?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-Alipay</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>
|
||||
</dependency>
|
||||
<!-- SpringBoot Web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--支付宝接口pom文件-->
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.39.2.ALL</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<!-- Mysql Connector -->
|
||||
<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>2.2.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<!-- test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,24 @@
|
|||
package com.bwie.alipay;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "alipay")
|
||||
@Data
|
||||
public class Alipay {
|
||||
|
||||
|
||||
private String privateKey;//私钥
|
||||
private String alipayPublicKey;//支付宝公钥
|
||||
private String appId;//商户ID
|
||||
private String notifyUrl;//
|
||||
private String returnUrl;//
|
||||
private String serverUrl;
|
||||
private String charset;
|
||||
private String signType;
|
||||
private BigDecimal ordersPrice;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.bwie.alipay;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.bwie.alipay.mapper")
|
||||
public class AlipayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AlipayApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.bwie.alipay;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "house")
|
||||
@Data
|
||||
public class HouseList {
|
||||
|
||||
private Long houseId;
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.bwie.alipay.controller;
|
||||
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
|
||||
import com.bwie.alipay.HouseList;
|
||||
import com.bwie.alipay.service.AlipayService;
|
||||
import com.bwie.common.domain.Order;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/alipay")
|
||||
public class AlipayController {
|
||||
@Autowired
|
||||
private AlipayService alipayService;
|
||||
@GetMapping("/alipayway")
|
||||
public Result alipay(){
|
||||
return alipayService.alipay();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.bwie.alipay.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
public interface AlipayMapper{
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.bwie.alipay.service;
|
||||
|
||||
import com.bwie.alipay.HouseList;
|
||||
import com.bwie.common.domain.Order;
|
||||
import com.bwie.common.result.Result;
|
||||
|
||||
public interface AlipayService {
|
||||
|
||||
public Result alipay();
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package com.bwie.alipay.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.AlipayConfig;
|
||||
import com.alipay.api.domain.AlipayTradePagePayModel;
|
||||
import com.alipay.api.internal.util.AlipaySignature;
|
||||
import com.alipay.api.response.AlipayTradePagePayResponse;
|
||||
import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.bwie.alipay.Alipay;
|
||||
import com.bwie.alipay.HouseList;
|
||||
import com.bwie.alipay.service.AlipayService;
|
||||
import com.bwie.common.domain.Order;
|
||||
import com.bwie.common.result.Result;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/alipay")
|
||||
public class AlipayServiceImpl implements AlipayService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private HouseList houseList;
|
||||
@Autowired
|
||||
private Alipay alipay;
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Result alipay(){
|
||||
Order order = new Order();
|
||||
order.setHouseId(houseList.getHouseId());
|
||||
order.setOrdersPrice(alipay.getOrdersPrice());
|
||||
AlipayConfig alipayConfig = new AlipayConfig();
|
||||
alipayConfig.setServerUrl(alipay.getServerUrl());
|
||||
alipayConfig.setAppId(alipay.getAppId());
|
||||
alipayConfig.setPrivateKey(alipay.getPrivateKey());
|
||||
alipayConfig.setAlipayPublicKey(alipay.getAlipayPublicKey());
|
||||
alipayConfig.setCharset(alipay.getCharset());
|
||||
alipayConfig.setSignType(alipay.getSignType());
|
||||
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
|
||||
AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
|
||||
request.setNotifyUrl(alipay.getNotifyUrl());
|
||||
request.setReturnUrl(alipay.getReturnUrl());
|
||||
AlipayTradePagePayModel model = new AlipayTradePagePayModel();
|
||||
String jsonString = JSON.toJSONString(order.getOrdersPrice());
|
||||
model.setTotalAmount(jsonString);
|
||||
String jsonString1 = JSON.toJSONString(order.getHouseId());
|
||||
model.setSubject(jsonString1);
|
||||
String sout = "2015";
|
||||
String our = RandomUtil.randomNumbers(13);
|
||||
String aa = sout+our;
|
||||
model.setOutTradeNo(aa);
|
||||
model.setProductCode("FAST_INSTANT_TRADE_PAY");
|
||||
request.setBizModel(model);
|
||||
order.setOrdersNumber(aa);
|
||||
|
||||
AlipayTradePagePayResponse response = alipayClient.pageExecute(request, "GET");
|
||||
// 如果需要返回GET请求,请使用
|
||||
// AlipayTradePagePayResponse response = alipayClient.pageExecute(request, "GET");
|
||||
String pageRedirectionData = response.getBody();
|
||||
System.out.println(pageRedirectionData);
|
||||
if (response.isSuccess()) {
|
||||
return Result.success("调用成功!!!!!");
|
||||
} else {
|
||||
return Result.error("调用失败!!!!!");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9008
|
||||
# Spring
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/xm_house?useSSL=false&serverTimezone=UTC
|
||||
username: root
|
||||
password: admin111.
|
||||
main:
|
||||
allow-circular-references: true
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
application:
|
||||
# 应用名称
|
||||
name: bwie-alipay
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 124.221.177.197:8848
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 124.221.177.197:8848
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
alipay:
|
||||
serverUrl: "https://openapi-sandbox.dl.alipaydev.com/gateway.do"
|
||||
charset: "UTF-8"
|
||||
signType: "RSA2"
|
||||
appId: "9021000135679979"
|
||||
privateKey: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx8r9WaFV7CujWc9AzpbgsCq8axYJWm4s7x2eDcJXC+qhDXWsFW0xDX+xs4JCuVJ54+FGiflB24BeqgFDLNOchtkocK65BJohG5ojVONHq/ciruqbzAD0W6x96h8fKqlVuvz3EotMXuejg5J1gbDRmgTvPx7mYq94TXjxt75CUEserThSMF0geB0DJhrPxNe5JLAPKA5pRXd2e6wDybi2yKL2s2j4YuaTgDZuNAnlBYAiV6Pk7WpFB06LtbGg7JiM+Jawn3N64fL/24d4VIzcJD3AxWbGDZAXtW9+XZtsDa8z6ik3OGpbrSKu+RK0jjWzT2ETHnb/BdhtDJzFBo4dnAgMBAAECggEBAKWvrWIqATVwof1Tlk8QhVxUklfuAP7dExYVA5fJ01fZhaQ7rjMtn+O3w+5YZb48QdXG+FPBIvCclMyHbzLVzkOAdJ6oOTamRwslCdDmd+ZCaH8lat8loLvfLs8q7+cPFD7qx/t30+7qhiAoHTSza1LqD6PWhkPV+w+zlbaS8d471COE8P7XyxouFZ70qe9Aa7uVLEClxQemviSqIYOuHTFkNjWMleQR48tL2HA2ifKpa309Ifnbf3kGktyNaiG7plC5x3gUU3dSQdWZpnRHq/wh65TBhJHgLrjsIPhnfB9mmwCMZ66EJiUKajuqlvEjC/J0dkduMO6uPLYzTkejxbkCgYEA4arhCQgLquzRJDk5pI94ZzBiSWXaP3JUzfYEHQbbzcNvRPZBYJLDBUXNRVReujjt6efIcyrCi1zD3XvHfN2QmaNubeD5yF7aObYPVwoxDCvqHzZDVbYd9ZUGR2yIa+jdkVc5py0vmyfyxLSx3RvMuSP+rYtzhCJbowQiCkN4XUMCgYEAyd3efuY/0f59XF2DBSu8vCEaer7Wkieit980VZm06jxwt/3b5UcRlknKpum32n+mGlbpu4M/r5Zbpta+uuWbx6ajbIjc43rMuElkK6cz5d6AUTm6AsOKq8ARQPh4F5pzI18vrNAQrNyVpxwDMXIdmyArHD0Dv4NeIjlwucCT2Q0CgYBTAXGoysbP5i+/bTUgrI0TF57vdIFkmP9MitNUgfNTqjFBYnsFtLX7OIOansABK3OHd/QpOG86p7J7w03LRgwsFwtFa101MH6Af9EAqQUFfxmsxV7bJhO7A0e9+dPsLUlibn0MWviJz5XieLx7ogAZkX3aA9NHpQOj4J9MuyiI1QKBgQC/NyIuNG5ZvWYEGzQjrsVtszHA+YqJEXBqGc0aFKoxgyUGtDoamdJH+Qg0SYl1OJsfshpfG7k02wlgJWSv5xVD7k45Xf9Wn5jSK/rt+skHQldsGXFgctelTx9I2tPvD8dmxyCC4ugYxi4gCEHiEYWHztXnPsiRHaAKbTyhR5EE9QKBgGQRjcds+qeZeNTKrwSPFG/KD8h/kI0jTnFfeKMm1WXfuXcadTavbaruGUihLzveO9/dsizKJm38Pc2j5xNyBxGYUdbSxGZtC5uNmYuIsR3u8gy2oT3qFBPaFp/Y1PoHzLu6QTAYeo8Cz0TG+U8ah/81O9JPzZWyrkGLHIp5XyKq"
|
||||
alipayPublicKey: "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkVyIo6qyxzk0YWnBo3ueKIpcpUPnrX0MuhdaUAoyJPtp19u2M67g8jSw7BWqppJ0Vso8sm7Px6VS3rOunlmgW5lyN0uMgy6+mE76gW8+2msjwR/DrzNL7aQn2idu9NgxxKk2BnLzajpR7W5Tk+sXmB9woLffbQ9hJW+SWJ6DnMtAbaB+3E/xaDO4o5yjTFbY063Vr2mgyt+PfK5i3unb3ffZj9jtqICWsDfpoY42fxxrRsKa3eLCJVO6sqUz3XLRex8WV7vcjtAuMsp6rFbwTPT5ELSYHXEY3uWuHHJChDE4eAKUpvavYj/hTZhlsOyTe1xPOAbnkAQ2B+kA+XHDRQIDAQAB"
|
||||
notifyUrl: "http://nrjjtd.natappfree.cc/nacos"
|
||||
returnUrl: "http://nrjjtd.natappfree.cc/nacos"
|
||||
ordersPrice: 99989
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.alipay.mapper.AlipayMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,13 @@
|
|||
package com.example.alipay;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class AlipayDemoApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
|
@ -18,55 +18,82 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<elasticsearch.version>7.17.0</elasticsearch.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 系统公共 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>bwie-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xin.altitude.cms.common</groupId>
|
||||
<artifactId>ucode-cms-common</artifactId>
|
||||
<version>1.3.4</version>
|
||||
</dependency>
|
||||
<!-- SpringBoot Web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</dependency>
|
||||
<!-- Druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<!-- Mysql Connector -->
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- Mybatis 依赖配置 -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Pagehelper -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.22.110.ALL</version>
|
||||
</dependency>
|
||||
<!-- test -->
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.7.20</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>bwie-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.0.20</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package com.bwie.ask.seriver;
|
||||
/**
|
||||
* 恶汉模式
|
||||
*/
|
||||
public class Test01 {
|
||||
//私有方法
|
||||
private Test01(){};
|
||||
//new 出来对象
|
||||
private static Test01 instance = new Test01();
|
||||
//返回new出啦的对象
|
||||
public static Test01 getInstance(){
|
||||
return instance;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.bwie.ask.seriver;
|
||||
|
||||
/**
|
||||
* 懒汉模式
|
||||
*/
|
||||
public class Test02 {
|
||||
//私有方法
|
||||
private Test02(){};
|
||||
//使用volatile 赋值为空
|
||||
private static volatile Test02 intanse = null;
|
||||
//静态方法双重判断
|
||||
public static Test02 getInstance(){
|
||||
if(intanse==null){
|
||||
synchronized (Test02.class){
|
||||
if(intanse==null){
|
||||
//创建对象
|
||||
intanse = new Test02();
|
||||
}
|
||||
}
|
||||
}
|
||||
//返回创建对象
|
||||
return intanse;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -132,5 +132,6 @@ public class EsListServiceImpl implements EsListService {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package com.bwie.es.sync;
|
||||
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.request.HouseEsRequest;
|
||||
|
||||
import com.bwie.common.remote.RemoteHouseService;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.es.service.EsListService;
|
||||
import com.bwie.es.service.EsService;
|
||||
|
||||
//import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -21,28 +21,47 @@ import java.util.List;
|
|||
public class SyncHouseData {
|
||||
|
||||
private final RemoteHouseService remoteHouseService;
|
||||
private final EsService esService;
|
||||
private final EsListService esService;
|
||||
|
||||
public SyncHouseData(RemoteHouseService remoteHouseService,
|
||||
EsService esService) {
|
||||
EsService esService, EsListService esService1) {
|
||||
this.remoteHouseService = remoteHouseService;
|
||||
this.esService = esService;
|
||||
this.esService = esService1;
|
||||
}
|
||||
|
||||
// @XxlJob("managementList")
|
||||
// @Scheduled(cron = "0/5 * * * * ?")
|
||||
// public void buySync(){
|
||||
// Result<List<AskBuy>> listResult = askBuyRentFeign.shouAll();
|
||||
// List<AskBuy> data = listResult.getData();
|
||||
// if(data!=null){
|
||||
// esAskBuyService.shouList(data);
|
||||
// }
|
||||
// System.out.println("定时器求购正常启动!!!!!!");
|
||||
//
|
||||
// Result<List<AskRent>> listResulta = askBuyRentFeign.shouList();
|
||||
// List<AskRent> dataa = listResulta.getData();
|
||||
// if(dataa!=null) {
|
||||
// esAskRentService.shouListt(dataa);
|
||||
// }
|
||||
// System.out.println("定时器求租正常启动!!!!!!");
|
||||
// }
|
||||
@Scheduled(cron = "0/5 * * * * ?")
|
||||
public void managementList(){
|
||||
Result<List<House>> shouall = remoteHouseService.shouall();
|
||||
List<House> data = shouall.getData();
|
||||
|
||||
if(data!=null){
|
||||
esService.managementSync(data);
|
||||
}
|
||||
log.info("房源管理未卖出同步定时器启动>>>>>>>>>>");
|
||||
}
|
||||
|
||||
@XxlJob("syncHouseData")
|
||||
public void syncHouseData(){
|
||||
Result<List<HouseEsRequest>> houseEsList = remoteHouseService.getHouseEsList();
|
||||
if (houseEsList.getData() != null){
|
||||
esService.syncHouse(houseEsList.getData());
|
||||
}
|
||||
log.info("同步定时器启动>>>>>>>>>>");
|
||||
}
|
||||
// @XxlJob("syncHouseData")
|
||||
// public void syncHouseData(){
|
||||
// Result<List<HouseEsRequest>> houseEsList = remoteHouseService.getHouseEsList();
|
||||
// if (houseEsList.getData() != null){
|
||||
// esService.syncHouse(houseEsList.getData());
|
||||
// }
|
||||
// log.info("同步定时器启动>>>>>>>>>>");
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ es:
|
|||
|
||||
# Tomcat
|
||||
server:
|
||||
port: 9006
|
||||
port: 9010
|
||||
# Spring
|
||||
spring:
|
||||
main:
|
||||
|
|
|
@ -32,20 +32,20 @@ public class AskBuySync {
|
|||
this.esAskBuyService = esAskBuyService;
|
||||
}
|
||||
|
||||
@Scheduled(cron = "0/5 * * * * ?")
|
||||
public void buySync(){
|
||||
Result<List<AskBuy>> listResult = askBuyRentFeign.shouAll();
|
||||
List<AskBuy> data = listResult.getData();
|
||||
if(data!=null){
|
||||
esAskBuyService.shouList(data);
|
||||
}
|
||||
System.out.println("定时器求购正常启动!!!!!!");
|
||||
|
||||
Result<List<AskRent>> listResulta = askBuyRentFeign.shouList();
|
||||
List<AskRent> dataa = listResulta.getData();
|
||||
if(dataa!=null) {
|
||||
esAskRentService.shouListt(dataa);
|
||||
}
|
||||
System.out.println("定时器求租正常启动!!!!!!");
|
||||
}
|
||||
// @Scheduled(cron = "0/5 * * * * ?")
|
||||
// public void buySync(){
|
||||
// Result<List<AskBuy>> listResult = askBuyRentFeign.shouAll();
|
||||
// List<AskBuy> data = listResult.getData();
|
||||
// if(data!=null){
|
||||
// esAskBuyService.shouList(data);
|
||||
// }
|
||||
// System.out.println("定时器求购正常启动!!!!!!");
|
||||
//
|
||||
// Result<List<AskRent>> listResulta = askBuyRentFeign.shouList();
|
||||
// List<AskRent> dataa = listResulta.getData();
|
||||
// if(dataa!=null) {
|
||||
// esAskRentService.shouListt(dataa);
|
||||
// }
|
||||
// System.out.println("定时器求租正常启动!!!!!!");
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -65,5 +65,17 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xuxueli</groupId>
|
||||
<artifactId>xxl-job-core</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bwie</groupId>
|
||||
<artifactId>bwie-Alipay</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.bwie.home.controller;
|
||||
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.Order;
|
||||
import com.bwie.common.domain.request.HouseEsRequest;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.home.job.Reptile;
|
||||
|
@ -32,7 +33,11 @@ public class HouseController {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
//添加订单表
|
||||
@PostMapping("/wayOrdersPayment")
|
||||
public Result wayOrdersPayment(@RequestBody Order order){
|
||||
return homeListService.wayOrdersPayment(order);
|
||||
}
|
||||
@GetMapping("/shouall")
|
||||
public Result<List<House>> shouall(){
|
||||
return homeListService.shouall();
|
||||
|
@ -43,4 +48,19 @@ public class HouseController {
|
|||
reptile.reptile(page);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/addTwoHouse")
|
||||
public Result addTwoHouse(@RequestBody House house){
|
||||
return homeListService.addTwoHouse(house);
|
||||
}
|
||||
|
||||
@GetMapping("/chaId")
|
||||
public Result<House> chaId(@RequestParam Integer houseId){
|
||||
return homeListService.chaId(houseId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie.home.feign;
|
||||
|
||||
import com.bwie.alipay.HouseList;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(value = "bwie-alipay",url = "http://127.0.0.1:9008")
|
||||
public interface AlipayFeign {
|
||||
@GetMapping("/alipay/alipayway")
|
||||
public Result alipay(@RequestParam HouseList houseList);
|
||||
}
|
|
@ -2,9 +2,22 @@ package com.bwie.home.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.Order;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HomeListMapper extends BaseMapper<House> {
|
||||
List<House> shouall();
|
||||
|
||||
Integer addTwoHouse(House house);
|
||||
|
||||
|
||||
void addImage(House house);
|
||||
|
||||
Integer addwayOrders(Order order);
|
||||
|
||||
|
||||
House chaId(Integer houseId);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.bwie.home.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.Order;
|
||||
import com.bwie.common.result.Result;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -10,4 +11,12 @@ import java.util.List;
|
|||
|
||||
public interface HomeListService extends IService<House> {
|
||||
public Result<List<House>> shouall();
|
||||
|
||||
public Result addTwoHouse(House house);//添加房源表
|
||||
|
||||
|
||||
public Result wayOrdersPayment(Order order);
|
||||
|
||||
public Result<House> chaId(Integer houseId);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.bwie.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.alipay.HouseList;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.domain.Order;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.home.feign.AlipayFeign;
|
||||
import com.bwie.home.mapper.HomeListMapper;
|
||||
import com.bwie.home.service.HomeListService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -12,8 +15,11 @@ import java.util.List;
|
|||
@Service
|
||||
public class HomeListServiceImpl extends ServiceImpl<HomeListMapper,House> implements HomeListService {
|
||||
private final HomeListMapper listMapper;
|
||||
public HomeListServiceImpl(HomeListMapper listMapper) {
|
||||
|
||||
private final AlipayFeign alipayFeign;
|
||||
public HomeListServiceImpl(HomeListMapper listMapper, AlipayFeign alipayFeign) {
|
||||
this.listMapper = listMapper;
|
||||
this.alipayFeign = alipayFeign;
|
||||
}
|
||||
@Override
|
||||
public Result<List<House>> shouall(){
|
||||
|
@ -21,6 +27,37 @@ public class HomeListServiceImpl extends ServiceImpl<HomeListMapper,House> imple
|
|||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result addTwoHouse(House house){
|
||||
Integer i = listMapper.addTwoHouse(house);
|
||||
if(house.getImageAddr()==null){
|
||||
listMapper.addImage(house);
|
||||
}
|
||||
return Result.success(i>0?200:500,i>0?"发布成功!!!!":"发布失败!!!!!");
|
||||
}
|
||||
|
||||
//支付订单
|
||||
@Override
|
||||
public Result wayOrdersPayment(Order order){
|
||||
Integer i = listMapper.addwayOrders(order);
|
||||
return Result.success(i>0?200:500,i>0?"订单添加成功":"订单添加失败!!!!!");
|
||||
}
|
||||
|
||||
|
||||
//查询内容
|
||||
@Override
|
||||
public Result<House> chaId(Integer houseId){
|
||||
House house = listMapper.chaId(houseId);
|
||||
HouseList houseList = new HouseList();
|
||||
houseList.setHouseId(house.getId());
|
||||
houseList.setOrdersPrice(house.getHousePrice());
|
||||
alipayFeign.alipay(houseList);
|
||||
if(house!=null){
|
||||
return Result.success(house,"对象传送成功!!!!!!!!!!");
|
||||
}
|
||||
return Result.error("查找的对象不存在,请重新尝试!!!!!!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
package com.bwie.home.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bwie.common.domain.House;
|
||||
import com.bwie.common.result.Result;
|
||||
import com.bwie.home.service.HomeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class HomeServiceImpl{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.bwie.home.mapper.HomeListMapper">
|
||||
<insert id="addTwoHouse" parameterType="com.bwie.common.domain.House" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO `xm_house`.`house` (`user_id`, `title`, `estate`, `house_type_id`, `addr_id`, `house_addr`, `dictionary_type_id`,
|
||||
`house_price`, `room_type`, `orientation`, `decorate`, `floor`, `acreage`, `selling_points`, `mentality`, `service_introduction`, `manager_status`,
|
||||
`source`, `house_old_new`, `broker_id`, `is_success`, `verify`, `is_es`, `create_time`, `update_time`, `is_delete`)
|
||||
VALUES (#{userId},#{title},#{estate},1,null,#{houseAddr},#{dictionaryTypeId},#{housePrice},#{roomType},#{orientation},#{decorate},#{floor}, #{acreage}
|
||||
,null,null,null,#{managerStatus},'贝壳网',1,1,1,0,0,#{createTime},null,0 );
|
||||
</insert>
|
||||
<insert id="addImage" parameterType="java.lang.Long">
|
||||
INSERT INTO `xm_house`.`house_images` (`house_id`, `image_addr`)
|
||||
VALUES
|
||||
<foreach collection="imageAddr" separator="," item="imageAddr">
|
||||
(#{id},#{imageAddr})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addwayOrders">
|
||||
INSERT INTO `xm_house`.`orders` (`orders_number`, `user_id`, `orders_date`, `orders_way`, `orders_price`, `is_delete`, `orders_status`, `house_id`, `user_tel`)
|
||||
VALUES (#{ordersNumber},1,now(),'支付宝',#{ordersPrice},,1,#{houseId},'17398472205');
|
||||
</insert>
|
||||
<select id="shouall" resultType="com.bwie.common.domain.House">
|
||||
select * from house where is_delete = 0 and is_success = 0
|
||||
</select>
|
||||
<select id="chaId" resultType="com.bwie.common.domain.House">
|
||||
select * from house where id = #{houseId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<modules>
|
||||
<module>bwie-system</module>
|
||||
<module>bwie-group</module>
|
||||
<module>bwie-Alipay</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
|
Loading…
Reference in New Issue