修改redis位置,添加同步品牌或校区接口
This commit is contained in:
parent
f20a744ec9
commit
5dd83e3997
@ -19,14 +19,13 @@ spring:
|
|||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
host: 106.52.49.102
|
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||||
#端口
|
#端口
|
||||||
port: 6333
|
port: 27714
|
||||||
#数据库
|
#数据库
|
||||||
#database: 10
|
database: 3
|
||||||
database: 0
|
|
||||||
#密码
|
#密码
|
||||||
password: Jambox.123*
|
password: Cpop2022@
|
||||||
#连接超时
|
#连接超时
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
jedis:
|
jedis:
|
||||||
|
|||||||
@ -20,13 +20,13 @@ spring:
|
|||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
host: 106.52.49.102
|
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||||
#端口
|
#端口
|
||||||
port: 6333
|
port: 27714
|
||||||
#数据库
|
#数据库
|
||||||
database: 0
|
database: 2
|
||||||
#密码
|
#密码
|
||||||
password: Jambox.123*
|
password: Cpop2022@
|
||||||
#连接超时
|
#连接超时
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
jedis:
|
jedis:
|
||||||
|
|||||||
@ -20,13 +20,13 @@ spring:
|
|||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
host: 106.52.49.102
|
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||||
#端口
|
#端口
|
||||||
port: 6333
|
port: 27714
|
||||||
#数据库
|
#数据库
|
||||||
database: 10
|
database: 3
|
||||||
#密码
|
#密码
|
||||||
password: Jambox.123*
|
password: Cpop2022@
|
||||||
#连接超时
|
#连接超时
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
jedis:
|
jedis:
|
||||||
|
|||||||
@ -4,7 +4,7 @@ cpop:
|
|||||||
profile: E:/Cpop/uploadPath
|
profile: E:/Cpop/uploadPath
|
||||||
jwt:
|
jwt:
|
||||||
#白名单
|
#白名单
|
||||||
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxCp/*,/wxCp/portal/*/registerCode
|
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxCp/*,/wxCp/portal/*/registerCode,/sysCommon/miniSyncBrandAndStore
|
||||||
gateway:
|
gateway:
|
||||||
rsa-keypair:
|
rsa-keypair:
|
||||||
# 公钥文件
|
# 公钥文件
|
||||||
@ -19,13 +19,13 @@ spring:
|
|||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
host: 106.52.49.102
|
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||||
#端口
|
#端口
|
||||||
port: 6333
|
port: 27714
|
||||||
#数据库
|
#数据库
|
||||||
database: 10
|
database: 1
|
||||||
#密码
|
#密码
|
||||||
password: Jambox.123*
|
password: Cpop2022@
|
||||||
#连接超时
|
#连接超时
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
jedis:
|
jedis:
|
||||||
|
|||||||
@ -4,7 +4,7 @@ cpop:
|
|||||||
profile: /root/cpop-union/cpop-oam/upload
|
profile: /root/cpop-union/cpop-oam/upload
|
||||||
jwt:
|
jwt:
|
||||||
#白名单
|
#白名单
|
||||||
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/*,/wxCp/portal/*/registerCode
|
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/*,/wxCp/portal/*/registerCode,/sysCommon/miniSyncBrandAndStore
|
||||||
#拦截
|
#拦截
|
||||||
gateway:
|
gateway:
|
||||||
rsa-keypair:
|
rsa-keypair:
|
||||||
@ -20,13 +20,13 @@ spring:
|
|||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
host: 106.52.49.102
|
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||||
#端口
|
#端口
|
||||||
port: 6333
|
port: 27714
|
||||||
#数据库
|
#数据库
|
||||||
database: 0
|
database: 0
|
||||||
#密码
|
#密码
|
||||||
password: Jambox.123*
|
password: Cpop2022@
|
||||||
#连接超时
|
#连接超时
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
lettuce:
|
lettuce:
|
||||||
|
|||||||
@ -4,7 +4,7 @@ cpop:
|
|||||||
profile: /root/cpop-union/cpop-mall/upload
|
profile: /root/cpop-union/cpop-mall/upload
|
||||||
jwt:
|
jwt:
|
||||||
#白名单
|
#白名单
|
||||||
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/portal/*/registerCode,/wxCp/*
|
whiteList: /websocket/*,/login,/getCaptcha,/profile/**,/doc.html,/webjars/**,/favicon.ico,/v2/api-docs/**,/swagger-resources,/wxOpen/receiveTicket,/wxOpen/*/callback,/wxOpen/bindOpenAccount/*,/wxCp/portal/*,/wxCp/portal/*/registerCode,/wxCp/*,/sysCommon/miniSyncBrandAndStore
|
||||||
#拦截
|
#拦截
|
||||||
gateway:
|
gateway:
|
||||||
rsa-keypair:
|
rsa-keypair:
|
||||||
@ -24,13 +24,13 @@ spring:
|
|||||||
#redis配置
|
#redis配置
|
||||||
redis:
|
redis:
|
||||||
#地址
|
#地址
|
||||||
host: 106.52.49.102
|
host: gz-crs-lv77ii2t.sql.tencentcdb.com
|
||||||
#端口
|
#端口
|
||||||
port: 6333
|
port: 27714
|
||||||
#数据库
|
#数据库
|
||||||
database: 5
|
database: 1
|
||||||
#密码
|
#密码
|
||||||
password: Jambox.123*
|
password: Cpop2022@
|
||||||
#连接超时
|
#连接超时
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
lettuce:
|
lettuce:
|
||||||
|
|||||||
31
Cpop-Pay/pom.xml
Normal file
31
Cpop-Pay/pom.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Union</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<artifactId>Cpop-Pay</artifactId>
|
||||||
|
<name>Cpop-Pay</name>
|
||||||
|
<description>Cpop-Pay</description>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<properties>
|
||||||
|
<java.version>17</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<!--核心包-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--微信支付-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.binarywang</groupId>
|
||||||
|
<artifactId>weixin-java-pay</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.cpop.pay.framewok.config.wxPay;
|
||||||
|
|
||||||
|
import com.cpop.common.utils.StringUtils;
|
||||||
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||||
|
import com.github.binarywang.wxpay.service.WxPayService;
|
||||||
|
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @Description:
|
||||||
|
* @create 2023-10-26 22:38
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnClass(WxPayService.class)
|
||||||
|
@EnableConfigurationProperties(WxPayProperties.class)
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class WxPayConfiguration {
|
||||||
|
private WxPayProperties properties;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean
|
||||||
|
public WxPayService wxService() {
|
||||||
|
WxPayConfig payConfig = new WxPayConfig();
|
||||||
|
payConfig.setAppId(StringUtils.trimToNull(this.properties.getAppId()));
|
||||||
|
payConfig.setMchId(StringUtils.trimToNull(this.properties.getMchId()));
|
||||||
|
payConfig.setMchKey(StringUtils.trimToNull(this.properties.getMchKey()));
|
||||||
|
//服务商模式微信支付
|
||||||
|
payConfig.setApiV3Key(this.properties.getApiV3Key());
|
||||||
|
payConfig.setCertSerialNo(this.properties.getCertSerialNo());
|
||||||
|
payConfig.setKeyPath(this.properties.getKeyPath());
|
||||||
|
payConfig.setPrivateKeyPath(this.properties.getPrivateKeyPath());
|
||||||
|
payConfig.setPrivateCertPath(this.properties.getPrivateCertPath());
|
||||||
|
//通知地址
|
||||||
|
payConfig.setNotifyUrl(this.properties.getNotifyUrl());
|
||||||
|
// 可以指定是否使用沙箱环境
|
||||||
|
payConfig.setUseSandboxEnv(false);
|
||||||
|
WxPayService wxPayService = new WxPayServiceImpl();
|
||||||
|
wxPayService.setConfig(payConfig);
|
||||||
|
return wxPayService;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package com.cpop.pay.framewok.config.wxPay;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @Description:
|
||||||
|
* @create 2023-10-26 22:39
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "wx.pay")
|
||||||
|
public class WxPayProperties {
|
||||||
|
/**
|
||||||
|
* 设置微信公众号或者小程序等的appid
|
||||||
|
*/
|
||||||
|
private String appId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付商户号
|
||||||
|
*/
|
||||||
|
private String mchId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付商户密钥
|
||||||
|
*/
|
||||||
|
private String mchKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apiclient_cert.p12文件的绝对路径,或者如果放在项目中,请以classpath:开头指定
|
||||||
|
*/
|
||||||
|
private String keyPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apiV3 秘钥值
|
||||||
|
*/
|
||||||
|
private String apiV3Key;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apiclient_key.pem证书文件的绝对路径或者以classpath:开头的类路径
|
||||||
|
*/
|
||||||
|
private String privateKeyPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apiclient_cert.pem证书文件的绝对路径或者以classpath:开头的类路径
|
||||||
|
*/
|
||||||
|
private String privateCertPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* apiV3 证书序列号值
|
||||||
|
*/
|
||||||
|
private String certSerialNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付通知地址
|
||||||
|
*/
|
||||||
|
private String notifyUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款通知
|
||||||
|
*/
|
||||||
|
private String notifyRefund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账账号
|
||||||
|
*/
|
||||||
|
private String sharingAccount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账账号名
|
||||||
|
*/
|
||||||
|
private String sharingAccountName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账通知
|
||||||
|
*/
|
||||||
|
private String notifySharing;
|
||||||
|
}
|
||||||
@ -0,0 +1,75 @@
|
|||||||
|
package com.cpop.pay.framewok.handler.wxPay;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.cpop.common.utils.StringUtils;
|
||||||
|
import com.cpop.core.base.exception.ServiceException;
|
||||||
|
import com.cpop.core.utils.SecurityUtils;
|
||||||
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||||
|
import com.github.binarywang.wxpay.service.WxPayService;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.core.row.Db;
|
||||||
|
import com.mybatisflex.core.row.Row;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @createTime 2023/10/27 15:47
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class WxPayHandler {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxPayService wxPayService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 获取微信支付service
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/27 15:53
|
||||||
|
* @return: com.github.binarywang.wxpay.service.WxPayService
|
||||||
|
*/
|
||||||
|
public WxPayService getWxPayService(){
|
||||||
|
//查询当前登陆用户所在品牌的商户id
|
||||||
|
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
|
||||||
|
if (loginUserInfo == null) {
|
||||||
|
//直接返回
|
||||||
|
return wxPayService;
|
||||||
|
}
|
||||||
|
String brandId = loginUserInfo.getString("brandId");
|
||||||
|
Row brand = Db.selectOneByQuery("cp_sys_brand", QueryWrapper.create().where("id = ?", brandId));
|
||||||
|
if (brand.isEmpty()) {
|
||||||
|
throw new ServiceException("当前品牌暂未开通微信支付,请联系相关客服");
|
||||||
|
}
|
||||||
|
//检查是否开启分账
|
||||||
|
if (!brand.getBoolean("isOpenSharing")) {
|
||||||
|
throw new ServiceException("当前商户暂未开启分账,请联系相关客服");
|
||||||
|
}
|
||||||
|
WxPayConfig payConfig = wxPayService.getConfig();
|
||||||
|
//子商户信息
|
||||||
|
payConfig.setSubMchId(StringUtils.trimToNull(brand.getString("wxMchId")));
|
||||||
|
// 可以指定是否使用沙箱环境
|
||||||
|
payConfig.setUseSandboxEnv(false);
|
||||||
|
wxPayService.setConfig(payConfig);
|
||||||
|
return wxPayService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @descriptions 根据商户appid或商户号获取对应微信支付接口
|
||||||
|
* @author DB
|
||||||
|
* @date 2023/10/18 10:34
|
||||||
|
* @param subAppId 子商户appid
|
||||||
|
* @param subMchId 子商户id
|
||||||
|
* @return: com.github.binarywang.wxpay.service.WxPayService
|
||||||
|
*/
|
||||||
|
public WxPayService getWxPayService(String subAppId, String subMchId) {
|
||||||
|
WxPayConfig payConfig = wxPayService.getConfig();
|
||||||
|
//子商户信息
|
||||||
|
payConfig.setSubAppId(StringUtils.trimToNull(subAppId));
|
||||||
|
payConfig.setSubMchId(StringUtils.trimToNull(subMchId));
|
||||||
|
// 可以指定是否使用沙箱环境
|
||||||
|
payConfig.setUseSandboxEnv(false);
|
||||||
|
wxPayService.setConfig(payConfig);
|
||||||
|
return wxPayService;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
Cpop-Pay/src/main/resources/application-pay.yml
Normal file
13
Cpop-Pay/src/main/resources/application-pay.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
wx:
|
||||||
|
#微信支付
|
||||||
|
pay:
|
||||||
|
#微信公众号或者小程序等的appid
|
||||||
|
appId: wx20853d18c455e874
|
||||||
|
#微信支付商户号
|
||||||
|
mchId: 1618884922
|
||||||
|
#微信支付商户密钥
|
||||||
|
mchKey: JamBox20230919174000000000000002
|
||||||
|
apiV3Key: JamBox20230919174000000000000002
|
||||||
|
#分账服务商账号
|
||||||
|
sharingAccount: 1618884922
|
||||||
|
sharingAccountName: 果酱盒子
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
package com.cpop.system.business.bo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.sql.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DB
|
||||||
|
* @version 1.0.0
|
||||||
|
* @since 2023-12-21 14:46
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "品牌与校区参数")
|
||||||
|
public class SyncBrandAndStoreBo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "品牌")
|
||||||
|
private BrandInfo brandInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校区
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "校区")
|
||||||
|
private StoreInfo storeInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class BrandInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云品牌id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "云品牌id")
|
||||||
|
private String brandCloudId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "品牌名")
|
||||||
|
private String brandName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校区信息
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public static class StoreInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云品牌id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "云校区id")
|
||||||
|
private String storeCloudId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺/校区名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "店铺/校区名")
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺/校区地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "店铺/校区地址")
|
||||||
|
private String storeAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "负责人")
|
||||||
|
private String personCharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "营业执照地址")
|
||||||
|
private String licenseAddr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "营业执照日期")
|
||||||
|
private Date licenseDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照公司名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "营业执照公司名")
|
||||||
|
private String licenseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照证书码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "营业执照证书码")
|
||||||
|
private String licenseCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照法人名
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "营业执照法人名")
|
||||||
|
private String licenseUserName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业执照图片地址
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "营业执照图片地址")
|
||||||
|
private String licensePicUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,8 @@ import com.cpop.core.config.ServerConfig;
|
|||||||
import com.cpop.core.handler.TencentCosHandler;
|
import com.cpop.core.handler.TencentCosHandler;
|
||||||
import com.cpop.core.utils.file.FileUploadUtils;
|
import com.cpop.core.utils.file.FileUploadUtils;
|
||||||
import com.cpop.core.utils.file.FileUtils;
|
import com.cpop.core.utils.file.FileUtils;
|
||||||
|
import com.cpop.system.business.bo.SyncBrandAndStoreBo;
|
||||||
|
import com.cpop.system.business.service.StoreService;
|
||||||
import com.cpop.system.business.vo.SysFileVo;
|
import com.cpop.system.business.vo.SysFileVo;
|
||||||
import com.qcloud.cos.model.UploadResult;
|
import com.qcloud.cos.model.UploadResult;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -13,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@ -37,6 +40,9 @@ public class SysCommonController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TencentCosHandler tencentCosHandler;
|
private TencentCosHandler tencentCosHandler;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreService storeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通用上传请求(单个)
|
* 通用上传请求(单个)
|
||||||
*/
|
*/
|
||||||
@ -82,4 +88,18 @@ public class SysCommonController {
|
|||||||
.setOriginalFilename(file.getOriginalFilename());
|
.setOriginalFilename(file.getOriginalFilename());
|
||||||
return R.ok(sysFileVo);
|
return R.ok(sysFileVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序同步品牌和校区
|
||||||
|
* @author DB
|
||||||
|
* @since 2023/12/21
|
||||||
|
* @param bo 请求参数
|
||||||
|
* @return R<SysFileVo>
|
||||||
|
*/
|
||||||
|
@ApiOperation("小程序同步品牌和校区")
|
||||||
|
@PostMapping("/miniSyncBrandAndStore")
|
||||||
|
public R<Void> miniSyncBrandAndStore(@RequestBody SyncBrandAndStoreBo bo) {
|
||||||
|
storeService.miniSyncBrandAndStore(bo);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.cpop.system.business.service;
|
package com.cpop.system.business.service;
|
||||||
|
|
||||||
import com.cpop.system.business.bo.StorePageBo;
|
import com.cpop.system.business.bo.StorePageBo;
|
||||||
|
import com.cpop.system.business.bo.SyncBrandAndStoreBo;
|
||||||
import com.cpop.system.business.vo.StorePageVo;
|
import com.cpop.system.business.vo.StorePageVo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
@ -21,4 +22,12 @@ public interface StoreService extends IService<Store> {
|
|||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
Page<StorePageVo> getStorePage(StorePageBo bo);
|
Page<StorePageVo> getStorePage(StorePageBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序同步品牌和校区
|
||||||
|
* @author DB
|
||||||
|
* @since 2023/12/21
|
||||||
|
* @param bo 请求参数
|
||||||
|
*/
|
||||||
|
void miniSyncBrandAndStore(SyncBrandAndStoreBo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,17 +7,34 @@
|
|||||||
*/
|
*/
|
||||||
package com.cpop.system.business.service.impl;
|
package com.cpop.system.business.service.impl;
|
||||||
|
|
||||||
|
import com.cpop.common.utils.bean.BeanUtils;
|
||||||
|
import com.cpop.core.base.entity.LoginUser;
|
||||||
import com.cpop.core.base.entity.PageDomain;
|
import com.cpop.core.base.entity.PageDomain;
|
||||||
|
import com.cpop.core.base.enums.SourceType;
|
||||||
|
import com.cpop.core.utils.SecurityUtils;
|
||||||
|
import com.cpop.core.utils.SpringUtils;
|
||||||
import com.cpop.core.utils.sql.SqlUtils;
|
import com.cpop.core.utils.sql.SqlUtils;
|
||||||
import com.cpop.system.business.bo.StorePageBo;
|
import com.cpop.system.business.bo.StorePageBo;
|
||||||
|
import com.cpop.system.business.bo.SyncBrandAndStoreBo;
|
||||||
|
import com.cpop.system.business.entity.Brand;
|
||||||
import com.cpop.system.business.entity.Store;
|
import com.cpop.system.business.entity.Store;
|
||||||
|
import com.cpop.system.business.entity.StoreLicense;
|
||||||
import com.cpop.system.business.mapper.StoreMapper;
|
import com.cpop.system.business.mapper.StoreMapper;
|
||||||
|
import com.cpop.system.business.service.BrandService;
|
||||||
|
import com.cpop.system.business.service.StoreLicenseService;
|
||||||
import com.cpop.system.business.service.StoreService;
|
import com.cpop.system.business.service.StoreService;
|
||||||
import com.cpop.system.business.vo.StorePageVo;
|
import com.cpop.system.business.vo.StorePageVo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.core.row.Db;
|
||||||
|
import com.mybatisflex.core.row.DbChain;
|
||||||
|
import com.mybatisflex.core.row.Row;
|
||||||
|
import com.mybatisflex.core.row.RowKey;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
import static com.cpop.system.business.entity.table.BrandTableDef.BRAND;
|
||||||
import static com.cpop.system.business.entity.table.StoreSignTableDef.STORE_SIGN;
|
import static com.cpop.system.business.entity.table.StoreSignTableDef.STORE_SIGN;
|
||||||
@ -52,4 +69,57 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
|
|||||||
.and(STORE.STORE_NAME.like(bo.getName())),
|
.and(STORE.STORE_NAME.like(bo.getName())),
|
||||||
StorePageVo.class);
|
StorePageVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序同步品牌和校区
|
||||||
|
* @author DB
|
||||||
|
* @since 2023/12/21
|
||||||
|
* @param bo 请求参数
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void miniSyncBrandAndStore(SyncBrandAndStoreBo bo) {
|
||||||
|
SyncBrandAndStoreBo.BrandInfo brandInfo = bo.getBrandInfo();
|
||||||
|
//查询品牌
|
||||||
|
Row brandExtend = DbChain.table("cp_j_brand_extend").where("brand_cloud_id = ?", brandInfo.getBrandCloudId()).one();
|
||||||
|
Brand brand;
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LoginUser loginUser = SecurityUtils.getInstance().getLoginUser();
|
||||||
|
BrandService brandService = SpringUtils.getBean(BrandService.class);
|
||||||
|
if (brandExtend.isEmpty()) {
|
||||||
|
brand = new Brand();
|
||||||
|
brand.setBrandName(brandInfo.getBrandName()).setSourceType(SourceType.JAMBOX.getName());
|
||||||
|
brandService.save(brand);
|
||||||
|
//保存拓展
|
||||||
|
RowKey brandKey = RowKey.SNOW_FLAKE_ID;
|
||||||
|
DbChain.table("cp_j_brand_extend")
|
||||||
|
.setId(brandKey)
|
||||||
|
.set("brand_id", brand.getId())
|
||||||
|
.set("brand_cloud_id", brandInfo.getBrandCloudId())
|
||||||
|
.set("create_time", now)
|
||||||
|
.set("update_time", now)
|
||||||
|
.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId())
|
||||||
|
.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId())
|
||||||
|
.save();
|
||||||
|
}else {
|
||||||
|
brand = brandService.getById(brandExtend.getString("brandId"));
|
||||||
|
}
|
||||||
|
Store store = BeanUtils.mapToClass(bo.getStoreInfo(), Store.class);
|
||||||
|
store.setBrandId(brand.getId()).setSourceType(SourceType.JAMBOX.getName());
|
||||||
|
this.save(store);
|
||||||
|
//拓展
|
||||||
|
SyncBrandAndStoreBo.StoreInfo storeInfo = bo.getStoreInfo();
|
||||||
|
Row row = Row.ofKey(RowKey.SNOW_FLAKE_ID);
|
||||||
|
row.set("store_cloud_id", storeInfo.getStoreCloudId());
|
||||||
|
row.set("store_id", store.getId());
|
||||||
|
row.set("create_time", now);
|
||||||
|
row.set("update_time", now);
|
||||||
|
row.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||||
|
row.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
|
||||||
|
Db.insert("cp_j_store_extend",row);
|
||||||
|
//营业执照
|
||||||
|
StoreLicense storeLicense = BeanUtils.mapToClass(bo.getStoreInfo(), StoreLicense.class);
|
||||||
|
storeLicense.setStoreId(store.getId());
|
||||||
|
SpringUtils.getBean(StoreLicenseService.class).save(storeLicense);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@ -28,6 +28,7 @@
|
|||||||
<module>Cpop-Mall/Cpop-Mall-Web</module>
|
<module>Cpop-Mall/Cpop-Mall-Web</module>
|
||||||
<module>Cpop-System</module>
|
<module>Cpop-System</module>
|
||||||
<module>Cpop-Mini</module>
|
<module>Cpop-Mini</module>
|
||||||
|
<module>Cpop-Pay</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -125,6 +126,11 @@
|
|||||||
<artifactId>Cpop-Mini</artifactId>
|
<artifactId>Cpop-Mini</artifactId>
|
||||||
<version>${cpop.version}</version>
|
<version>${cpop.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.cpop</groupId>
|
||||||
|
<artifactId>Cpop-Pay</artifactId>
|
||||||
|
<version>${cpop.version}</version>
|
||||||
|
</dependency>
|
||||||
<!--HikariCP-->
|
<!--HikariCP-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user