Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e81550e9c2
|
|
@ -18,6 +18,7 @@ target/
|
|||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
*.jar
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
|
|
@ -31,3 +32,4 @@ build/
|
|||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/jars/
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package com.czg;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
|
|
@ -12,9 +12,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("com.czg.service.account.mapper")
|
||||
@EnableDubbo
|
||||
public class AccountApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AccountApplication.class, args);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import com.czg.service.account.feign.FeignSystemService;
|
||||
import com.czg.service.RedisService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
|
@ -14,18 +14,13 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/feign")
|
||||
public class FeignController {
|
||||
|
||||
@Resource
|
||||
private FeignSystemService feignSystemService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@DubboReference
|
||||
private SysParamsService sysParamsService;
|
||||
|
||||
@RequestMapping("/test")
|
||||
public String test() {
|
||||
String string = feignSystemService.testCall("sssss");
|
||||
System.out.println(string);
|
||||
redisService.set("sssss", string);
|
||||
return "test";
|
||||
SysParamsDTO test = sysParamsService.getParamsByCode2("test");
|
||||
return JSONObject.toJSONString(test);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.annotation.SaAdminCheckRole;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.account.dto.PageDTO;
|
||||
import com.czg.service.account.dto.register.MerchantRegisterDTO;
|
||||
import com.czg.service.account.entity.MerchantRegister;
|
||||
import com.czg.service.account.service.MerchantRegisterService;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 激活码管理
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/merchantRegister")
|
||||
public class MerchantRegisterController {
|
||||
@Resource
|
||||
private MerchantRegisterService merchantRegisterService;
|
||||
|
||||
|
||||
/**
|
||||
* 激活码列表
|
||||
* 权限标识: merchantRegister:list
|
||||
* @param pageDTO 分页参数
|
||||
* @param state 状态 0未激活 1已激活
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 激活码列表
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("merchantRegister:add")
|
||||
@GetMapping
|
||||
public CzgResult<Page<MerchantRegister>> get(PageDTO pageDTO, Integer state, String startTime, String endTime) {
|
||||
return CzgResult.success(merchantRegisterService.get(pageDTO, state, startTime, endTime));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成激活码
|
||||
* 权限标识: merchantRegister:add
|
||||
* @param merchantRegisterDTO 激活码信息
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("merchantRegister:add")
|
||||
@PostMapping
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated MerchantRegisterDTO merchantRegisterDTO) {
|
||||
return CzgResult.success(merchantRegisterService.add(merchantRegisterDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.annotation.SaAdminCheckRole;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.account.dto.shopinfo.ShopInfoAddDTO;
|
||||
import com.czg.service.account.service.ShopInfoService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
|
|
@ -21,9 +24,14 @@ public class ShopInfoController {
|
|||
this.shopInfoService = shopInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺添加
|
||||
* 权限标识: shopInfo:add
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("shopInfo:add")
|
||||
@PostMapping
|
||||
public CzgResult add() {
|
||||
return null;
|
||||
public CzgResult<?> add(@RequestBody @Validated ShopInfoAddDTO shopInfoAddDTO) {
|
||||
return CzgResult.success(shopInfoService.add(shopInfoAddDTO));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,18 +15,19 @@ spring:
|
|||
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
bootstrap:
|
||||
enabled: true
|
||||
data-id: system-server
|
||||
group: DEFAULT_GROUP
|
||||
auto-refresh: true
|
||||
server-addr: 101.37.12.135:8848
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
file-extension: yaml
|
||||
discovery:
|
||||
server-addr: 101.37.12.135:8848
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
|
||||
|
||||
dubbo:
|
||||
application:
|
||||
name: account-server
|
||||
qos-port: 22221
|
||||
qos-enable: true
|
||||
registry:
|
||||
address: nacos://101.37.12.135:8848 # Nacos 服务地址
|
||||
group: server
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
protocol:
|
||||
port: 9101
|
||||
|
||||
|
|
|
|||
|
|
@ -47,5 +47,40 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- spring boot 打包插件 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<executable>true</executable>
|
||||
<!-- <includeSystemScope>true</includeSystemScope>-->
|
||||
<outputDirectory>../../jars</outputDirectory>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,20 @@
|
|||
package com.czg;
|
||||
|
||||
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableTransactionManagement
|
||||
@MapperScan("com.czg.service.system.mapper")
|
||||
@EnableDubbo
|
||||
public class SystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.SysParamsDTO2;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
|
@ -12,8 +17,18 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/admin/feign")
|
||||
public class FeignController {
|
||||
|
||||
@Resource
|
||||
private SysParamsService sysParamsService;
|
||||
|
||||
@RequestMapping("/testCall/{name}")
|
||||
public String testCall(@PathVariable String name) {
|
||||
return "system-server:" + name;
|
||||
public CzgResult<SysParamsDTO2> testCall(@PathVariable String name) {
|
||||
return CzgResult.success(new SysParamsDTO2().setParamCode("system-server:" + name));
|
||||
}
|
||||
|
||||
@GetMapping("/sysParam/code/{code}")
|
||||
public SysParamsDTO getParamsByCode(@PathVariable String code) {
|
||||
CzgResult<SysParamsDTO> paramsByCode = sysParamsService.getParamsByCode(code);
|
||||
return paramsByCode.getData();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package com.czg.controller;
|
||||
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.system.dto.SysParamsDTO;
|
||||
import com.czg.service.system.service.SysParamsService;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
|
|||
|
|
@ -24,3 +24,15 @@ spring:
|
|||
discovery:
|
||||
server-addr: 101.37.12.135:8848
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
|
||||
dubbo:
|
||||
application:
|
||||
name: system-server
|
||||
qos-port: 22224
|
||||
qos-enable: true
|
||||
registry:
|
||||
address: nacos://101.37.12.135:8848 # Nacos 服务地址
|
||||
group: server
|
||||
namespace: 237e1905-0a66-4375-9bb6-a51c3c034aca
|
||||
protocol:
|
||||
port: 9401
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.exception;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.hutool.core.exceptions.ValidateException;
|
||||
import com.czg.resp.CzgRespCode;
|
||||
|
|
@ -31,6 +32,14 @@ public class CzgControllerAdvice {
|
|||
return CzgResult.failure(CzgRespCode.SYSTEM_ERROR);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = NotLoginException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public CzgResult<Object> notLoginErrorHandler(NotLoginException ex) {
|
||||
setErrorLog(ex);
|
||||
return CzgResult.failure(CzgRespCode.NOT_LOGIN);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@ExceptionHandler(value = NotPermissionException.class)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
<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.czg</groupId>
|
||||
<artifactId>cash-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cash-common-service</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>global-service</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-tools</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.service.system.dto;
|
||||
package com.czg.system.dto;
|
||||
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
|
|
@ -8,12 +8,14 @@ import jakarta.validation.constraints.NotNull;
|
|||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SysParamsDTO {
|
||||
public class SysParamsDTO implements Serializable {
|
||||
|
||||
@NotBlank(message = "参数编码不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String paramCode;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.czg.service.system.entity;
|
||||
package com.czg.system.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package com.czg.service.system.service;
|
||||
package com.czg.system.service;
|
||||
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.system.dto.SysParamsDTO;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.service.system.entity.SysParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -42,6 +42,7 @@ public interface SysParamsService extends IService<SysParams> {
|
|||
* @return 参数
|
||||
*/
|
||||
CzgResult<SysParamsDTO> getParamsByCode(String code);
|
||||
SysParamsDTO getParamsByCode2(String code);
|
||||
|
||||
/**
|
||||
* 根据参数类型获取参数
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.czg;
|
||||
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class SysParamsDTO2 {
|
||||
|
||||
@NotBlank(message = "参数编码不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private String paramCode;
|
||||
|
||||
@NotBlank(message = "参数值不能为空", groups = DefaultGroup.class)
|
||||
private String paramValue;
|
||||
|
||||
@NotNull(message = "参数类型不能为空", groups = {UpdateGroup.class, UpdateGroup.class})
|
||||
private Integer paramType;
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ import lombok.Getter;
|
|||
public enum CzgRespCode {
|
||||
SUCCESS(200, "操作成功"),
|
||||
FAILURE(500, "操作失败"),
|
||||
NOT_LOGIN(501, "登录失效"),
|
||||
SYSTEM_ERROR(555, "系统内部错误"),
|
||||
RECORD_NOT_EXIST(601, "记录不存在"),
|
||||
RECORD_EXISTED(602, "记录已存在"),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<module>cash-common-sa-token</module>
|
||||
<module>cash-common-redis</module>
|
||||
<module>cash-common-api-config</module>
|
||||
<module>cash-common-service</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@
|
|||
<cloud-starter-loadbalancer.version>4.2.0</cloud-starter-loadbalancer.version>
|
||||
<jedis.version>5.2.0</jedis.version>
|
||||
<spring-data-redis.version>3.4.2</spring-data-redis.version>
|
||||
<dubbo-spring.version>3.3.3</dubbo-spring.version>
|
||||
<dubbo-registry-nacos.version>3.3.3</dubbo-registry-nacos.version>
|
||||
<dubbo.version>3.3.3</dubbo.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
@ -109,6 +112,23 @@
|
|||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
<!-- Dubbo Spring Boot Starter -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
<version>${dubbo-spring.version}</version>
|
||||
</dependency>
|
||||
<!-- Nacos Discovery for Dubbo -->
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-nacos</artifactId>
|
||||
<version>${dubbo-registry-nacos.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>${dubbo.version}</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
|
|
@ -142,25 +162,6 @@
|
|||
<version>${cloud-starter-bootstrap.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--openfeign依赖-->
|
||||
<!--start-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<version>${cloud-starter-openfeign.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>commons-io</groupId>-->
|
||||
<!-- <artifactId>commons-io</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!--end-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
|
|
|
|||
|
|
@ -6,12 +6,15 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.czg.entity.CzgBaseReqParams;
|
||||
import com.czg.entity.CzgBaseRespParams;
|
||||
import com.czg.entity.req.*;
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.enums.CzgPayEnum;
|
||||
import com.czg.resp.CzgRespCode;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.MD5Util;
|
||||
import lombok.NonNull;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -34,8 +37,8 @@ public class CzgPayUtils {
|
|||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
public static CzgResult<Object> h5Pay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgH5PayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.H5PAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData));
|
||||
public static CzgResult<CzgH5PayResp> h5Pay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgH5PayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.H5PAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData), CzgH5PayResp.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -45,8 +48,8 @@ public class CzgPayUtils {
|
|||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
public static CzgResult<Object> jsPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgJsPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.JSPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData));
|
||||
public static CzgResult<CzgJsPayResp> jsPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgJsPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.JSPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData), CzgJsPayResp.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -56,8 +59,8 @@ public class CzgPayUtils {
|
|||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
public static CzgResult<Object> ltPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgLtPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.LTPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData));
|
||||
public static CzgResult<CzgLtPayResp> ltPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgLtPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.LTPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData), CzgLtPayResp.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -67,8 +70,8 @@ public class CzgPayUtils {
|
|||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
public static CzgResult<Object> scanPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgScanPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.SCANPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData));
|
||||
public static CzgResult<CzgScanPayResp> scanPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgScanPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.SCANPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData), CzgScanPayResp.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -78,8 +81,8 @@ public class CzgPayUtils {
|
|||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
public static CzgResult<Object> microPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgMicroPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.MICROPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData));
|
||||
public static CzgResult<CzgMicroPayResp> microPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgMicroPayReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.MICROPAY.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData), CzgMicroPayResp.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -91,12 +94,12 @@ public class CzgPayUtils {
|
|||
* @param payOrderId 平台订单号
|
||||
* @param mchOrderNo 商户订单号
|
||||
*/
|
||||
public static CzgResult<Object> queryPayOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret,
|
||||
String payOrderId, String mchOrderNo) {
|
||||
public static CzgResult<CzgBaseResp> queryPayOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret,
|
||||
String payOrderId, String mchOrderNo) {
|
||||
JSONObject queryPayOrder = new JSONObject();
|
||||
queryPayOrder.put("payOrderId", payOrderId);
|
||||
queryPayOrder.put("mchOrderNo", mchOrderNo);
|
||||
return sendCzg(domain.concat(CzgPayEnum.TRADE.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, queryPayOrder));
|
||||
return sendCzg(domain.concat(CzgPayEnum.TRADE.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, queryPayOrder), CzgBaseResp.class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -107,8 +110,8 @@ public class CzgPayUtils {
|
|||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
public static CzgResult<Object> refundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgRefundReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.REFUND.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData));
|
||||
public static CzgResult<CzgRefundResp> refundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgRefundReq bizData) {
|
||||
return sendCzg(domain.concat(CzgPayEnum.REFUND.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, bizData), CzgRefundResp.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -120,12 +123,12 @@ public class CzgPayUtils {
|
|||
* @param mchRefundNo 商户退款订单号 二选一
|
||||
* @param refundOrderId 平台退款订单号 二选一
|
||||
*/
|
||||
public static CzgResult<Object> queryRefundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret,
|
||||
String mchRefundNo, String refundOrderId) {
|
||||
public static CzgResult<CzgRefundResp> queryRefundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret,
|
||||
String mchRefundNo, String refundOrderId) {
|
||||
JSONObject queryPayOrder = new JSONObject();
|
||||
queryPayOrder.put("mchRefundNo", mchRefundNo);
|
||||
queryPayOrder.put("refundOrderId", refundOrderId);
|
||||
return sendCzg(domain.concat(CzgPayEnum.QUERY_REFUND.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, queryPayOrder));
|
||||
return sendCzg(domain.concat(CzgPayEnum.QUERY_REFUND.getUri()), CzgBaseReqParams.getInstance(appId, appSecret, queryPayOrder), CzgRefundResp.class);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -136,22 +139,20 @@ public class CzgPayUtils {
|
|||
* @param clazz 返回的实体类
|
||||
*/
|
||||
public static <T> T getCzg(String dataJsonStr, Class<T> clazz) {
|
||||
if (StrUtil.isNotEmpty(dataJsonStr)) {
|
||||
CzgBaseRespParams respParams = JSONObject.parseObject(dataJsonStr, CzgBaseRespParams.class);
|
||||
log.info("超掌柜交易请求响应,{}", respParams);
|
||||
if (!"000000".equals(respParams.getCode())) {
|
||||
log.error("超掌柜回调响应失败,{}", respParams);
|
||||
return null;
|
||||
}
|
||||
if (StrUtil.isNotBlank(respParams.getSign())) {
|
||||
if (!validateSign(respParams.getSign(), respParams.getBizData())) {
|
||||
log.error("超掌柜回调 验签失败,{}", respParams);
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(respParams.getBizData(), clazz);
|
||||
} else {
|
||||
AssertUtil.isBlank(dataJsonStr, "超掌柜交易 回调数据为空");
|
||||
CzgBaseRespParams respParams = JSONObject.parseObject(dataJsonStr, CzgBaseRespParams.class);
|
||||
log.info("超掌柜交易请求响应,{}", respParams);
|
||||
if (!"000000".equals(respParams.getCode())) {
|
||||
log.error("超掌柜回调响应失败,{}", respParams);
|
||||
return null;
|
||||
}
|
||||
if (StrUtil.isNotBlank(respParams.getSign())) {
|
||||
if (validateSign(respParams.getSign(), respParams.getBizData())) {
|
||||
log.error("超掌柜回调 验签失败,{}", respParams);
|
||||
}
|
||||
}
|
||||
return JSONObject.parseObject(respParams.getBizData(), clazz);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -161,11 +162,12 @@ public class CzgPayUtils {
|
|||
* @param params 参数实体
|
||||
* @return {
|
||||
* "code": "状态码", 200为成功
|
||||
* "data": "返回Json数据/返回错误描述",
|
||||
* "msg": "描述"
|
||||
* "data": "返回Json数据",
|
||||
* }
|
||||
*/
|
||||
private static CzgResult<Object> sendCzg(String url, CzgBaseReqParams params) {
|
||||
CzgResult<Object> result = CzgResult.success();
|
||||
private static <T> CzgResult<T> sendCzg(String url, CzgBaseReqParams params, Class<T> clazz) {
|
||||
CzgResult<T> result = CzgResult.success();
|
||||
Map<String, Object> reqMap = BeanUtil.beanToMap(params, false, false);
|
||||
params.setSign(MD5Util.md5AsHex(sortFields(new TreeMap<>(reqMap))));
|
||||
log.info("超掌柜交易请求参数,{}", params);
|
||||
|
|
@ -180,11 +182,11 @@ public class CzgPayUtils {
|
|||
result.setCode("000000".equals(respParams.getCode()) ? 200 : Integer.parseInt(respParams.getCode()));
|
||||
result.setMsg(respParams.getMsg());
|
||||
if ("000000".equals(respParams.getCode()) && StrUtil.isNotBlank(respParams.getSign())) {
|
||||
if (!validateSign(respParams.getSign(), respParams.getBizData())) {
|
||||
if (validateSign(respParams.getSign(), respParams.getBizData())) {
|
||||
result.setCode(CzgRespCode.FAILURE.getCode());
|
||||
result.setMsg("验签失败");
|
||||
}
|
||||
result.setData(respParams.getBizData());
|
||||
result.setData(JSONObject.parseObject(result.getData().toString(), clazz));
|
||||
}
|
||||
} else {
|
||||
result.setCode(resp.getStatus());
|
||||
|
|
@ -204,15 +206,12 @@ public class CzgPayUtils {
|
|||
/**
|
||||
* @param sign 签名
|
||||
* @param dataJsonStr 业务数据
|
||||
* @return true 验签通过 false 验签失败
|
||||
* @return false 验签通过 true 验签失败
|
||||
*/
|
||||
private static boolean validateSign(String sign, String dataJsonStr) {
|
||||
Map dataMap = JSONObject.parseObject(dataJsonStr, Map.class);
|
||||
Map<String, Object> dataMap = JSONObject.parseObject(dataJsonStr, new TypeReference<>() {});
|
||||
String newSign = MD5Util.md5AsHex(sortFields(new TreeMap<>(dataMap)));
|
||||
if (!sign.equals(newSign)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !StrUtil.equals(sign, newSign);
|
||||
}
|
||||
|
||||
private static String sortFields(TreeMap<String, Object> map) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.czg.entity.notify;
|
||||
|
||||
import com.czg.entity.resp.CzgBaseResp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CzgPayNotifyDTO extends CzgBaseResp {
|
||||
/**
|
||||
* 消息类型 String(30)
|
||||
* sft.trade.notify 支付通知
|
||||
* sft.refund.notify 退款通知
|
||||
* sft.division.notify 分账通知
|
||||
*/
|
||||
private String msgType;
|
||||
/**
|
||||
* 门店ID String(30)
|
||||
*/
|
||||
private String storeId;
|
||||
/**
|
||||
* 货币代码
|
||||
*/
|
||||
private String currency;
|
||||
private String subject;
|
||||
private String body;
|
||||
|
||||
|
||||
//非必填
|
||||
private String userId;
|
||||
/**
|
||||
* 支付成功时间
|
||||
* yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private String payTime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.czg.entity.notify;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class CzgRefundNotifyDTO {
|
||||
/**
|
||||
* 消息类型 String(30)
|
||||
* sft.trade.notify 支付通知
|
||||
* sft.refund.notify 退款通知
|
||||
* sft.division.notify 分账通知
|
||||
*/
|
||||
private String msgType;
|
||||
/**
|
||||
* 商户退款订单号 String(30)
|
||||
* 商户上送的退款订单号
|
||||
*/
|
||||
private String mchRefundNo;
|
||||
/**
|
||||
* 平台退款订单号 String(30)
|
||||
*
|
||||
*/
|
||||
private String refundOrderId;
|
||||
/**
|
||||
* 退款状态 String(10)
|
||||
* INIT:初始化
|
||||
* ING:退款中
|
||||
* SUCCESS:退款成功
|
||||
* FAIL:退款失败
|
||||
* CLOSE:退款关闭
|
||||
*/
|
||||
private String state;
|
||||
/**
|
||||
* 原平台交易单号 String(32)
|
||||
*/
|
||||
private String oriPayOrderId;
|
||||
/**
|
||||
* 商户号 String(30)
|
||||
*/
|
||||
private String mercNo;
|
||||
/**
|
||||
* 原订单交易金额
|
||||
* 单位 分
|
||||
*/
|
||||
private Long oriAmount;
|
||||
/**
|
||||
* 退款金额
|
||||
* 单位 分
|
||||
*/
|
||||
private Long refundAmt;
|
||||
/**
|
||||
* 退款原因
|
||||
*/
|
||||
private String refundReason;
|
||||
//非必填
|
||||
/**
|
||||
* 所属渠道 String(10)
|
||||
*/
|
||||
private String ifCode;
|
||||
/**
|
||||
* 备注 String(30)
|
||||
*/
|
||||
private String note;
|
||||
/**
|
||||
* 退款完成时间 String(20)
|
||||
* 格式:yyyy-MM-dd HH:mm:ss
|
||||
*/
|
||||
private String refundTime;
|
||||
/**
|
||||
* 自定义扩展参数 String(256)
|
||||
*/
|
||||
private String extParam;
|
||||
/**
|
||||
* 支付方式
|
||||
* WECHAT:微信
|
||||
* ALIPAY:支付宝
|
||||
* UNIONPAY:银联云闪付
|
||||
*/
|
||||
private String payType;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ public class CzgBaseResp {
|
|||
*/
|
||||
private Long amount;
|
||||
/**
|
||||
* String(32)
|
||||
* String (32)
|
||||
* 商户订单号
|
||||
*/
|
||||
private String mchOrderNo;
|
||||
|
|
@ -31,19 +31,19 @@ public class CzgBaseResp {
|
|||
/**
|
||||
* 订单状态
|
||||
* INIT - 订单初始化;
|
||||
* TRADE_AWAIT- 待支付;
|
||||
* TRADE_AWAIT - 待支付;
|
||||
* TRADE_SUCCESS - 支付成功;
|
||||
* TRADE_FAIL-支付失败;
|
||||
* TRADE_CANCEL-交易取消;
|
||||
* TRADE_REFUND-已退款;
|
||||
* TRADE_FAIL -支付失败;
|
||||
* TRADE_CANCEL -交易取消;
|
||||
* TRADE_REFUND -已退款;
|
||||
* REFUND_ING - 退款中;
|
||||
* TRADE_CLOSE-订单关闭
|
||||
* TRADE_CLOSE -订单关闭
|
||||
*/
|
||||
private String state;
|
||||
/**
|
||||
* 订单类型
|
||||
* 微信 WECHAT;
|
||||
* 支付宝 ALIPAY;
|
||||
* 微信 WECHAT
|
||||
* 支付宝 ALIPAY
|
||||
* 银联云闪付 UNIONPAY
|
||||
*/
|
||||
private String payType;
|
||||
|
|
@ -58,12 +58,12 @@ public class CzgBaseResp {
|
|||
//非必填范围
|
||||
/**
|
||||
* 发往渠道的流水号
|
||||
* 微信/支付宝订单详情中的商户单号
|
||||
* 微信 / 支付宝订单详情中的商户单号
|
||||
*/
|
||||
private String channelSendNo;
|
||||
/**
|
||||
* 渠道订单号
|
||||
* 微信/支付宝订单号
|
||||
* 微信 / 支付宝订单号
|
||||
*/
|
||||
private String channelTradeNo;
|
||||
/**
|
||||
|
|
@ -81,7 +81,7 @@ public class CzgBaseResp {
|
|||
*/
|
||||
private Long tradeFee;
|
||||
/**
|
||||
* 门店id
|
||||
* 门店 id
|
||||
*/
|
||||
private String storeId;
|
||||
/**
|
||||
|
|
@ -89,7 +89,13 @@ public class CzgBaseResp {
|
|||
*/
|
||||
private String subject;
|
||||
/**
|
||||
* 付款卡类型
|
||||
* 交易卡类型
|
||||
* 00:借记卡
|
||||
* 01:贷记卡
|
||||
* 02:零钱/余额
|
||||
* 03:花呗
|
||||
* 04:数字货币
|
||||
* 99:其他
|
||||
*/
|
||||
private String drType;
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.entity.resp;
|
||||
|
||||
import com.czg.entity.resp.pay.CzgH5PayInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
|
@ -9,6 +10,7 @@ import lombok.EqualsAndHashCode;
|
|||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CzgH5PayResp extends CzgBaseResp{
|
||||
public class CzgH5PayResp extends CzgBaseResp {
|
||||
|
||||
private CzgH5PayInfo payInfo;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.czg.entity.resp;
|
||||
|
||||
import com.czg.entity.resp.pay.CzgScanPayInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description H5支付响应参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CzgScanPayResp extends CzgBaseResp {
|
||||
|
||||
private CzgScanPayInfo payInfo;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.czg.dto;
|
||||
|
||||
import com.mybatisflex.core.mybatis.FlexConfiguration;
|
||||
import com.mybatisflex.spring.boot.ConfigurationCustomizer;
|
||||
import org.apache.ibatis.logging.stdout.StdOutImpl;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Configuration
|
||||
public class MyConfigurationCustomizer implements ConfigurationCustomizer {
|
||||
|
||||
@Override
|
||||
public void customize(FlexConfiguration configuration) {
|
||||
configuration.setLogImpl(StdOutImpl.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.czg.service.account.dto.register;
|
||||
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
public record MerchantRegisterDTO(
|
||||
@NotNull(message = "激活时长不能为空")
|
||||
@Min(1)
|
||||
Integer periodMonth,
|
||||
@NotNull(message = "数量不为空")
|
||||
@Min(1)
|
||||
@Max(10)
|
||||
Integer num
|
||||
) {
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.czg.service.account.dto.shopinfo;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
public record ShopInfoAddDTO(
|
||||
@NotEmpty(message = "店铺名称不为空")
|
||||
String shopName,
|
||||
@NotEmpty(message = "店铺类型不为空")
|
||||
String shopType,
|
||||
String chainName,
|
||||
@NotEmpty(message = "店铺logo不为空")
|
||||
String logo,
|
||||
@NotEmpty(message = "门头照不为空")
|
||||
String frontImg,
|
||||
@NotEmpty(message = "试用/正式不为空")
|
||||
String profiles,
|
||||
@NotEmpty(message = "激活码不为空")
|
||||
String activateCode,
|
||||
@NotEmpty(message = "登录账号不为空")
|
||||
String accountName,
|
||||
@NotEmpty(message = "登录密码不为空")
|
||||
String accountPwd,
|
||||
@NotEmpty(message = "经度不为空")
|
||||
String lat,
|
||||
@NotEmpty(message = "纬度不为空")
|
||||
String lng,
|
||||
@NotNull(message = "状态不为空")
|
||||
String detail,
|
||||
@NotNull(message = "角色id不为空")
|
||||
Long roleId,
|
||||
String address,
|
||||
String phone
|
||||
) {
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.czg.service.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 激活码 实体类。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_merchant_register")
|
||||
public class MerchantRegister implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 激活码
|
||||
*/
|
||||
private String registerCode;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private String shopId;
|
||||
|
||||
/**
|
||||
* 激活码金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 激活时长(月)
|
||||
*/
|
||||
private Integer periodMonth;
|
||||
|
||||
/**
|
||||
* 状态0未使用1已使用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_info")
|
||||
public class TbShopInfo implements Serializable {
|
||||
public class ShopInfo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -26,7 +26,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_staff")
|
||||
public class TbShopStaff implements Serializable {
|
||||
public class ShopStaff implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -26,7 +26,7 @@ import lombok.NoArgsConstructor;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_user")
|
||||
public class TbShopUser implements Serializable {
|
||||
public class ShopUser implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package com.czg.service.account.feign;
|
||||
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
/**
|
||||
* @author GYJoker
|
||||
*/
|
||||
@FeignClient("system-server")
|
||||
public interface FeignSystemService {
|
||||
@GetMapping("/admin/feign/testCall/{name}") // 使用 get 方式,调用服务提供者的 /call/{name} 接口
|
||||
String testCall(@PathVariable(value = "name") String name);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.service.account.entity.MerchantRegister;
|
||||
|
||||
/**
|
||||
* 激活码 映射层。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
public interface MerchantRegisterMapper extends BaseMapper<MerchantRegister> {
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.service.account.entity.ShopInfo;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.service.account.entity.TbShopInfo;
|
||||
|
||||
/**
|
||||
* 店铺信息 映射层。
|
||||
|
|
@ -9,6 +9,6 @@ import com.czg.service.account.entity.TbShopInfo;
|
|||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
public interface TbShopInfoMapper extends BaseMapper<TbShopInfo> {
|
||||
public interface ShopInfoMapper extends BaseMapper<ShopInfo> {
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.service.account.entity.ShopStaff;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.service.account.entity.TbShopStaff;
|
||||
|
||||
/**
|
||||
* 店铺员工 映射层。
|
||||
|
|
@ -9,6 +9,6 @@ import com.czg.service.account.entity.TbShopStaff;
|
|||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
public interface TbShopStaffMapper extends BaseMapper<TbShopStaff> {
|
||||
public interface ShopStaffMapper extends BaseMapper<ShopStaff> {
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.czg.service.account.entity.ShopUser;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.service.account.entity.TbShopUser;
|
||||
|
||||
/**
|
||||
* 商户储值会员 映射层。
|
||||
|
|
@ -9,6 +9,6 @@ import com.czg.service.account.entity.TbShopUser;
|
|||
* @author Administrator
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
public interface TbShopUserMapper extends BaseMapper<TbShopUser> {
|
||||
public interface ShopUserMapper extends BaseMapper<ShopUser> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.czg.service.account.service;
|
||||
|
||||
import com.czg.service.account.dto.PageDTO;
|
||||
import com.czg.service.account.dto.register.MerchantRegisterDTO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.service.account.entity.MerchantRegister;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 激活码 服务层。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
public interface MerchantRegisterService extends IService<MerchantRegister> {
|
||||
|
||||
Page<MerchantRegister> get(PageDTO pageDTO, Integer state, String startTime, String endTime);
|
||||
|
||||
Boolean add(MerchantRegisterDTO merchantRegisterDTO);
|
||||
}
|
||||
|
|
@ -1,7 +1,12 @@
|
|||
package com.czg.service.account.service;
|
||||
|
||||
import com.czg.service.account.dto.shopinfo.ShopInfoAddDTO;
|
||||
import com.czg.service.account.entity.ShopInfo;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
public interface ShopInfoService {
|
||||
public interface ShopInfoService extends IService<ShopInfo> {
|
||||
Object add(ShopInfoAddDTO shopInfoAddDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.account.service;
|
||||
|
||||
import com.czg.service.account.entity.ShopStaff;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.service.account.entity.TbShopStaff;
|
||||
|
||||
/**
|
||||
* 店铺员工 服务层。
|
||||
|
|
@ -9,6 +9,6 @@ import com.czg.service.account.entity.TbShopStaff;
|
|||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
public interface TbShopStaffService extends IService<TbShopStaff> {
|
||||
public interface ShopStaffService extends IService<ShopStaff> {
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.account.service;
|
||||
|
||||
import com.czg.service.account.entity.ShopUser;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.service.account.entity.TbShopUser;
|
||||
|
||||
/**
|
||||
* 商户储值会员 服务层。
|
||||
|
|
@ -9,6 +9,6 @@ import com.czg.service.account.entity.TbShopUser;
|
|||
* @author Administrator
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
public interface TbShopUserService extends IService<TbShopUser> {
|
||||
public interface ShopUserService extends IService<ShopUser> {
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
package com.czg.service.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.service.account.entity.TbShopInfo;
|
||||
|
||||
/**
|
||||
* 店铺信息 服务层。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
public interface TbShopInfoService extends IService<TbShopInfo> {
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.comparator.CompareUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
|
@ -13,15 +12,12 @@ import com.czg.service.account.entity.*;
|
|||
import com.czg.service.account.mapper.SysMenuMapper;
|
||||
import com.czg.service.account.service.*;
|
||||
import com.czg.service.account.vo.LoginVO;
|
||||
import com.mybatisflex.core.query.QueryChain;
|
||||
import com.wf.captcha.SpecCaptcha;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -35,9 +31,9 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
@Resource
|
||||
private TbShopStaffService shopStaffService;
|
||||
private ShopStaffService shopStaffService;
|
||||
@Resource
|
||||
private TbShopInfoService shopInfoService;
|
||||
private ShopInfoService shopInfoService;
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
@Resource
|
||||
|
|
@ -78,12 +74,12 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||
throw new RuntimeException("账户或密码错误");
|
||||
}
|
||||
|
||||
TbShopInfo shopInfo;
|
||||
ShopInfo shopInfo;
|
||||
// 商户员工登录
|
||||
if (loginDTO.loginType() == 1) {
|
||||
TbShopStaff shopStaff = shopStaffService.queryChain().eq(TbShopStaff::getStatus, 1)
|
||||
.eq(TbShopStaff::getIsManage, 1)
|
||||
.eq(TbShopStaff::getId, user.getId()).one();
|
||||
ShopStaff shopStaff = shopStaffService.queryChain().eq(ShopStaff::getStatus, 1)
|
||||
.eq(ShopStaff::getIsManage, 1)
|
||||
.eq(ShopStaff::getId, user.getId()).one();
|
||||
if (shopStaff == null) {
|
||||
throw new RuntimeException("账户未启用");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.service.account.dto.PageDTO;
|
||||
import com.czg.service.account.dto.register.MerchantRegisterDTO;
|
||||
import com.czg.service.account.entity.SysRole;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.entity.MerchantRegister;
|
||||
import com.czg.service.account.mapper.MerchantRegisterMapper;
|
||||
import com.czg.service.account.service.MerchantRegisterService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.mybatisflex.core.query.QueryMethods.column;
|
||||
|
||||
/**
|
||||
* 激活码 服务层实现。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-11
|
||||
*/
|
||||
@Service
|
||||
public class MerchantRegisterServiceImpl extends ServiceImpl<MerchantRegisterMapper, MerchantRegister> implements MerchantRegisterService{
|
||||
|
||||
@Override
|
||||
public Page<MerchantRegister> get(PageDTO pageDTO, Integer state, String startTime, String endTime) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
|
||||
if (state != null) {
|
||||
queryWrapper.eq(MerchantRegister::getStatus, state);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(startTime)) {
|
||||
queryWrapper.ge(MerchantRegister::getCreateTime, DateUtil.parse(startTime).toLocalDateTime());
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(endTime)) {
|
||||
queryWrapper.le(MerchantRegister::getCreateTime, DateUtil.parse(endTime).toLocalDateTime());
|
||||
}
|
||||
|
||||
return page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean add(MerchantRegisterDTO merchantRegisterDTO) {
|
||||
ArrayList<MerchantRegister> registers = new ArrayList<>();
|
||||
for (int i = 0; i < merchantRegisterDTO.num(); i++) {
|
||||
MerchantRegister tbMerchantRegister = new MerchantRegister();
|
||||
tbMerchantRegister.setRegisterCode(IdUtil.simpleUUID());
|
||||
tbMerchantRegister.setStatus(0);
|
||||
tbMerchantRegister.setPeriodMonth(merchantRegisterDTO.periodMonth());
|
||||
registers.add(tbMerchantRegister);
|
||||
}
|
||||
return saveBatch(registers);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,11 +1,78 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.service.account.service.ShopInfoService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.account.dto.shopinfo.ShopInfoAddDTO;
|
||||
import com.czg.service.account.entity.*;
|
||||
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||
import com.czg.service.account.service.*;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Service
|
||||
public class ShopInfoServiceImpl implements ShopInfoService {
|
||||
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
||||
@Resource
|
||||
private SysUserService sysUserService;
|
||||
@Resource
|
||||
private SysUsersRolesService sysUsersRolesService;
|
||||
@Resource
|
||||
private SysRoleService sysRoleService;
|
||||
@Resource
|
||||
private MerchantRegisterService merchantRegisterService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Object add(ShopInfoAddDTO shopInfoAddDTO) {
|
||||
long count = sysUserService.queryChain().eq(SysUser::getAccount, shopInfoAddDTO.accountName()).count();
|
||||
if (count > 0) {
|
||||
throw new CzgException("账户已存在");
|
||||
}
|
||||
|
||||
MerchantRegister merchantRegister = merchantRegisterService.queryChain().eq(MerchantRegister::getRegisterCode, shopInfoAddDTO.activateCode()).one();
|
||||
AssertUtil.isNull(merchantRegister, "激活码不存在");
|
||||
if (merchantRegister.getStatus() == 1) {
|
||||
throw new CzgException("激活码已使用");
|
||||
}
|
||||
|
||||
// 添加系统账号
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setAccount(shopInfoAddDTO.accountName());
|
||||
sysUser.setNickName(shopInfoAddDTO.shopName());
|
||||
sysUser.setPhone(shopInfoAddDTO.phone());
|
||||
sysUser.setStauts(1);
|
||||
sysUser.setCreateUserId(StpKit.ADMIN.getLoginIdAsLong());
|
||||
sysUserService.save(sysUser);
|
||||
sysUser.setPassword(SecureUtil.md5(sysUser.getId() + shopInfoAddDTO.accountPwd()));
|
||||
sysUserService.updateById(sysUser);
|
||||
|
||||
// 绑定角色
|
||||
long roleCount = sysRoleService.queryChain().eq(SysRole::getId, shopInfoAddDTO.roleId()).count();
|
||||
if (roleCount == 0) {
|
||||
throw new CzgException("角色不存在");
|
||||
}
|
||||
SysUsersRoles usersRoles = new SysUsersRoles();
|
||||
usersRoles.setUserId(sysUser.getId());
|
||||
usersRoles.setRoleId(shopInfoAddDTO.roleId());
|
||||
sysUsersRolesService.save(usersRoles);
|
||||
|
||||
// 保存店铺信息
|
||||
ShopInfo shopInfo = BeanUtil.copyProperties(shopInfoAddDTO, ShopInfo.class);
|
||||
shopInfo.setId(sysUser.getId());
|
||||
//设置激活码
|
||||
shopInfo.setStatus(1);
|
||||
shopInfo.setProfiles("release");
|
||||
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(), merchantRegister.getPeriodMonth()).toLocalDateTime());
|
||||
return save(shopInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.service.account.entity.ShopStaff;
|
||||
import com.czg.service.account.mapper.ShopStaffMapper;
|
||||
import com.czg.service.account.service.ShopStaffService;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 店铺员工 服务层实现。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
@Service
|
||||
public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff> implements ShopStaffService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.czg.service.account.entity.ShopUser;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.service.account.service.ShopUserService;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 商户储值会员 服务层实现。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Service
|
||||
public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> implements ShopUserService {
|
||||
|
||||
}
|
||||
|
|
@ -11,10 +11,7 @@ import com.czg.service.account.entity.SysMenu;
|
|||
import com.czg.service.account.entity.SysRolesMenus;
|
||||
import com.czg.service.account.service.SysMenuService;
|
||||
import com.czg.service.account.service.SysRolesMenusService;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryChain;
|
||||
import com.mybatisflex.core.query.QueryCondition;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.entity.SysRole;
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.entity.TbShopInfo;
|
||||
import com.czg.service.account.mapper.TbShopInfoMapper;
|
||||
import com.czg.service.account.service.TbShopInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 店铺信息 服务层实现。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
@Service
|
||||
public class TbShopInfoServiceImpl extends ServiceImpl<TbShopInfoMapper, TbShopInfo> implements TbShopInfoService{
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.entity.TbShopStaff;
|
||||
import com.czg.service.account.mapper.TbShopStaffMapper;
|
||||
import com.czg.service.account.service.TbShopStaffService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 店铺员工 服务层实现。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-10
|
||||
*/
|
||||
@Service
|
||||
public class TbShopStaffServiceImpl extends ServiceImpl<TbShopStaffMapper, TbShopStaff> implements TbShopStaffService{
|
||||
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.entity.TbShopUser;
|
||||
import com.czg.service.account.mapper.TbShopUserMapper;
|
||||
import com.czg.service.account.service.TbShopUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 商户储值会员 服务层实现。
|
||||
*
|
||||
* @author Administrator
|
||||
* @since 2025-02-08
|
||||
*/
|
||||
@Service
|
||||
public class TbShopUserServiceImpl extends ServiceImpl<TbShopUserMapper, TbShopUser> implements TbShopUserService{
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.account.vo;
|
||||
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import com.czg.service.account.entity.TbShopInfo;
|
||||
import com.czg.service.account.entity.ShopInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -13,6 +13,6 @@ public record LoginVO(
|
|||
// 登录类型
|
||||
Integer loginType,
|
||||
// 店铺信息
|
||||
TbShopInfo shopInfo
|
||||
ShopInfo shopInfo
|
||||
) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<?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.czg.service.account.mapper.MerchantRegisterMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.TbShopUserMapper">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopInfoMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.TbShopInfoMapper">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopStaffMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.TbShopStaffMapper">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopUserMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -68,8 +68,8 @@ public class Main {
|
|||
|
||||
//设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表
|
||||
globalConfig.getStrategyConfig()
|
||||
.setTablePrefix("")
|
||||
.setGenerateTable("sys_roles_menus");
|
||||
.setTablePrefix("tb")
|
||||
.setGenerateTable("tb_merchant_register");
|
||||
|
||||
//设置生成 entity 并启用 Lombok
|
||||
globalConfig.enableEntity()
|
||||
|
|
|
|||
|
|
@ -17,4 +17,11 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>czg-pay</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
package com.czg.service;
|
||||
|
||||
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||
import com.czg.entity.req.*;
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
import lombok.NonNull;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
public interface CzgPayService {
|
||||
/**
|
||||
* h5支付
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
CzgResult<CzgH5PayResp> h5Pay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgH5PayReq bizData);
|
||||
|
||||
/**
|
||||
* js支付
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
CzgResult<CzgJsPayResp> jsPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgJsPayReq bizData);
|
||||
|
||||
/**
|
||||
* 小程序支付
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
CzgResult<CzgLtPayResp> ltPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgLtPayReq bizData);
|
||||
|
||||
/**
|
||||
* PC扫码支付
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
CzgResult<CzgScanPayResp> scanPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgScanPayReq bizData);
|
||||
|
||||
/**
|
||||
* 聚合反扫
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
CzgResult<CzgMicroPayResp> microPay(@NonNull String domain,@NonNull String appId, @NonNull String appSecret, CzgMicroPayReq bizData);
|
||||
|
||||
/**
|
||||
* 订单查询
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
* @param payOrderId 平台订单号
|
||||
* @param mchOrderNo 商户订单号
|
||||
*/
|
||||
CzgResult<CzgBaseResp> queryPayOrder(@NonNull String domain,@NonNull String appId, @NonNull String appSecret,
|
||||
String payOrderId, String mchOrderNo);
|
||||
|
||||
|
||||
/**
|
||||
* 订单退款
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
*/
|
||||
CzgResult<CzgRefundResp> refundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgRefundReq bizData);
|
||||
|
||||
/**
|
||||
* 退款订单查询
|
||||
*
|
||||
* @param appId 应用id tb_shop_merchant 表中的 app_id
|
||||
* @param appSecret 应用密钥 tb_shop_merchant 表中的 app_secret
|
||||
* @param mchRefundNo 商户退款订单号 二选一
|
||||
* @param refundOrderId 平台退款订单号 二选一
|
||||
*/
|
||||
CzgResult<CzgRefundResp> queryRefundOrder(@NonNull String domain,@NonNull String appId, @NonNull String appSecret,
|
||||
String mchRefundNo, String refundOrderId);
|
||||
|
||||
|
||||
/**
|
||||
* 支付回调数据处理
|
||||
*
|
||||
* @param dataJsonStr 带解析数据
|
||||
*/
|
||||
CzgPayNotifyDTO getPayNotifyData(String dataJsonStr);
|
||||
/**
|
||||
* 退款回调数据处理
|
||||
*
|
||||
* @param dataJsonStr 带解析数据
|
||||
*/
|
||||
CzgRefundNotifyDTO getRefundNotifyData(String dataJsonStr);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
package com.czg.service.Impl;
|
||||
|
||||
import com.czg.CzgPayUtils;
|
||||
import com.czg.entity.notify.CzgPayNotifyDTO;
|
||||
import com.czg.entity.notify.CzgRefundNotifyDTO;
|
||||
import com.czg.entity.req.*;
|
||||
import com.czg.entity.resp.*;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.service.CzgPayService;
|
||||
import lombok.NonNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description 1
|
||||
*/
|
||||
@Service
|
||||
public class CzgPayServiceImpl implements CzgPayService {
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgH5PayResp> h5Pay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgH5PayReq bizData) {
|
||||
return CzgPayUtils.h5Pay(domain, appId, appSecret, bizData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgJsPayResp> jsPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgJsPayReq bizData) {
|
||||
return CzgPayUtils.jsPay(domain, appId, appSecret, bizData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgLtPayResp> ltPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgLtPayReq bizData) {
|
||||
return CzgPayUtils.ltPay(domain, appId, appSecret, bizData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgScanPayResp> scanPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgScanPayReq bizData) {
|
||||
return CzgPayUtils.scanPay(domain, appId, appSecret, bizData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgMicroPayResp> microPay(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgMicroPayReq bizData) {
|
||||
return CzgPayUtils.microPay(domain, appId, appSecret, bizData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgBaseResp> queryPayOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, String payOrderId, String mchOrderNo) {
|
||||
return CzgPayUtils.queryPayOrder(domain, appId, appSecret, payOrderId, mchOrderNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgRefundResp> refundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, CzgRefundReq bizData) {
|
||||
return CzgPayUtils.refundOrder(domain, appId, appSecret, bizData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<CzgRefundResp> queryRefundOrder(@NonNull String domain, @NonNull String appId, @NonNull String appSecret, String mchRefundNo, String refundOrderId) {
|
||||
return CzgPayUtils.queryRefundOrder(domain, appId, appSecret, mchRefundNo,refundOrderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgPayNotifyDTO getPayNotifyData(String dataJsonStr) {
|
||||
return CzgPayUtils.getCzg(dataJsonStr,CzgPayNotifyDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgRefundNotifyDTO getRefundNotifyData(String dataJsonStr) {
|
||||
return CzgPayUtils.getCzg(dataJsonStr,CzgRefundNotifyDTO.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -41,6 +41,12 @@
|
|||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.czg</groupId>
|
||||
<artifactId>cash-common-sa-token</artifactId>
|
||||
|
|
@ -51,18 +57,6 @@
|
|||
<artifactId>tomcat-embed-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<version>1.10.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.10.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
|
|
@ -90,28 +84,25 @@
|
|||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--openfeign依赖-->
|
||||
<!--start-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<!--end-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo-registry-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.czg.service.system.mapper;
|
||||
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.service.system.entity.SysParams;
|
||||
|
||||
/**
|
||||
* 映射层。
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@ package com.czg.service.system.service.impl;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.system.dto.SysParamsDTO;
|
||||
import com.czg.service.system.entity.SysParams;
|
||||
import com.czg.service.system.mapper.SysParamsMapper;
|
||||
import com.czg.service.system.service.SysParamsService;
|
||||
import com.czg.system.dto.SysParamsDTO;
|
||||
import com.czg.system.entity.SysParams;
|
||||
import com.czg.system.service.SysParamsService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -23,9 +23,9 @@ import java.util.List;
|
|||
* @author mac
|
||||
* @since 2025-02-07
|
||||
*/
|
||||
@Service
|
||||
@DubboService(interfaceClass = SysParamsService.class)
|
||||
@CacheConfig(cacheNames = "params")
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService{
|
||||
public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams> implements SysParamsService {
|
||||
|
||||
@Override
|
||||
public CzgResult<String> insertParams(SysParamsDTO paramsDTO) {
|
||||
|
|
@ -103,6 +103,17 @@ public class SysParamsServiceImpl extends ServiceImpl<SysParamsMapper, SysParams
|
|||
return CzgResult.success(sysParamsDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysParamsDTO getParamsByCode2(String code) {
|
||||
SysParams sysParams = getOne(new QueryWrapper().eq(SysParams::getParamCode, code));
|
||||
|
||||
if (sysParams == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return BeanUtil.toBean(sysParams, SysParamsDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CzgResult<List<SysParamsDTO>> getParamsByType(Integer type) {
|
||||
List<SysParams> sysParamsList = list(new QueryWrapper().eq(SysParams::getParamType, type));
|
||||
|
|
|
|||
Loading…
Reference in New Issue