diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/config/AppPayProperties.java b/jczxw-java/src/main/java/com/gxwebsoft/app/config/AppPayProperties.java deleted file mode 100644 index 8c871fc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/config/AppPayProperties.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.gxwebsoft.app.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -/** - * 应用模块微信支付配置属性 - * 微信支付 Native 支付(扫码支付)配置 - */ -@Data -@Component -@ConfigurationProperties(prefix = "app.pay.wx") -public class AppPayProperties { - - /** 是否启用微信支付 */ - private boolean enabled = true; - - /** 商户号 */ - private String mchId; - - /** 商户证书序列号 */ - private String merchantSerialNumber; - - /** APIv3 密钥 */ - private String apiV3Key; - - /** 微信支付 AppId(服务商/直连商户对应的小程序/公众号/网站应用) */ - private String appId; - - /** 证书根目录路径(生产环境 Docker 挂载卷路径) */ - private String certRootPath; - - /** 商户私钥文件相对路径(相对于 certRootPath) */ - private String privateKeyRelativePath = "wechat/apiclient_key.pem"; - - /** 微信支付平台证书文件相对路径 */ - private String wechatpayCertRelativePath = "wechat/wechatpay_cert.pem"; - - /** 微信支付公钥文件相对路径(使用公钥模式时必填) */ - private String wechatpayPublicKeyPath; - - /** 微信支付公钥ID(使用公钥模式时必填) */ - private String wechatpayPublicKeyId; - - /** 支付成功回调地址 */ - private String notifyUrl; - - /** 是否为测试模式(使用测试商户号) */ - private boolean testMode = false; - - // ===================== 测试商户配置(testMode=true 时使用)===================== - - /** 测试商户号 */ - private String testMchId; - - /** 测试商户序列号 */ - private String testMerchantSerialNumber; - - /** 测试 APIv3 密钥 */ - private String testApiV3Key; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppApiKeyController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppApiKeyController.java deleted file mode 100644 index e093352..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppApiKeyController.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppApiKey; -import com.gxwebsoft.app.param.AppApiKeyParam; -import com.gxwebsoft.app.service.AppApiKeyService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.Map; - -/** - * 应用 API Key 管理控制器 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Slf4j -@Tag(name = "应用API Key管理") -@RestController -@RequestMapping("/api/app/apikey") -public class AppApiKeyController extends BaseController { - - @Resource - private AppApiKeyService appApiKeyService; - - @Operation(summary = "分页查询API Key列表") - @GetMapping - public ApiResult> page(AppApiKeyParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - param.setUserId(loginUser.getUserId()); - param.setTenantId(loginUser.getTenantId()); - return success(appApiKeyService.pageRel(param)); - } - - @Operation(summary = "查询API Key详情") - @GetMapping("/{id}") - public ApiResult get(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - AppApiKey apiKey = appApiKeyService.getByIdRel(id); - if (apiKey == null) { - return fail("API Key不存在",null); - } - if (!apiKey.getUserId().equals(loginUser.getUserId())) { - return fail("无权访问此API Key",null); - } - return success(apiKey); - } - - @Operation(summary = "创建API Key") - @PostMapping - public ApiResult create(@RequestBody AppApiKey apiKey) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - try { - AppApiKey result = appApiKeyService.createApiKey( - apiKey, loginUser.getUserId(), loginUser.getTenantId()); - return success("API Key创建成功,请妥善保管", result); - } catch (Exception e) { - log.error("创建API Key失败", e); - return fail(e.getMessage(),null); - } - } - - @Operation(summary = "更新API Key信息") - @PutMapping("/{id}") - public ApiResult update(@PathVariable Long id, @RequestBody AppApiKey apiKey) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - AppApiKey existing = appApiKeyService.getByIdRel(id); - if (existing == null) { - return fail("API Key不存在"); - } - if (!existing.getUserId().equals(loginUser.getUserId())) { - return fail("无权修改此API Key"); - } - apiKey.setId(id); - apiKey.setUserId(loginUser.getUserId()); - try { - appApiKeyService.updateApiKey(apiKey); - return success("更新成功"); - } catch (Exception e) { - log.error("更新API Key失败", e); - return fail(e.getMessage()); - } - } - - @Operation(summary = "更新API Key状态") - @PutMapping("/{id}/status") - public ApiResult updateStatus(@PathVariable Long id, @RequestParam Integer status) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - appApiKeyService.updateStatus(id, status, loginUser.getUserId()); - return success(status == 0 ? "已启用" : "已禁用"); - } catch (Exception e) { - log.error("更新API Key状态失败", e); - return fail(e.getMessage()); - } - } - - @Operation(summary = "删除API Key") - @DeleteMapping("/{id}") - public ApiResult delete(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - appApiKeyService.removeApiKey(id, loginUser.getUserId()); - return success("删除成功"); - } catch (Exception e) { - log.error("删除API Key失败", e); - return fail(e.getMessage()); - } - } - - @Operation(summary = "获取API Key统计信息") - @GetMapping("/stats") - public ApiResult> stats() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - return success(appApiKeyService.statsByUser( - loginUser.getUserId(), loginUser.getTenantId())); - } - - @Operation(summary = "获取速率限制信息") - @GetMapping("/rate-limits") - public ApiResult> rateLimits() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - // 返回默认速率限制(实际可根据用户等级调整) - Map limits = Map.of( - "plan", "免费版", - "rps", 5, - "dailyLimit", 1000, - "usedToday", 0, - "remainingToday", 1000 - ); - return success(limits); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppArticleCategoryController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppArticleCategoryController.java deleted file mode 100644 index f15068d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppArticleCategoryController.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppArticleCategory; -import com.gxwebsoft.app.param.AppArticleCategoryParam; -import com.gxwebsoft.app.service.AppArticleCategoryService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 平台文章分类控制器 - */ -@Tag(name = "平台文章分类管理") -@RestController -@RequestMapping("/api/app/article-category") -public class AppArticleCategoryController extends BaseController { - - @Resource - private AppArticleCategoryService appArticleCategoryService; - - @Operation(summary = "分页查询平台文章分类") - @GetMapping("/page") - public ApiResult> page(AppArticleCategoryParam param) { - if (param.getTenantId() == null) { - param.setTenantId(getTenantId()); - } - return success(appArticleCategoryService.page(param)); - } - - @Operation(summary = "查询平台文章分类列表") - @GetMapping() - public ApiResult> list(AppArticleCategoryParam param) { - if (param.getTenantId() == null) { - param.setTenantId(getTenantId()); - } - return success(appArticleCategoryService.list(param)); - } - - @Operation(summary = "根据ID读取文章分类") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - return success(appArticleCategoryService.getDetail(id)); - } - - @Operation(summary = "新增平台文章分类") - @PostMapping() - public ApiResult save(@RequestBody AppArticleCategory category) { - User loginUser = getLoginUser(); - Integer tenantId = category.getTenantId() != null ? category.getTenantId() : getTenantId(); - if (appArticleCategoryService.saveCategory(category, loginUser, tenantId)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改平台文章分类") - @PutMapping() - public ApiResult update(@RequestBody AppArticleCategory category) { - if (appArticleCategoryService.updateCategory(category)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除平台文章分类") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (appArticleCategoryService.removeCategory(id)) { - return success("删除成功"); - } - return fail("该分类下还有文章,不能删除"); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppArticleController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppArticleController.java deleted file mode 100644 index e8c5a9f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppArticleController.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppArticle; -import com.gxwebsoft.app.param.AppArticleParam; -import com.gxwebsoft.app.service.AppArticleService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * 平台文章控制器 - */ -@Tag(name = "平台文章管理") -@RestController -@RequestMapping("/api/app/article") -public class AppArticleController extends BaseController { - - @Resource - private AppArticleService appArticleService; - - @Operation(summary = "分页查询平台文章") - @GetMapping("/page") - public ApiResult> page(AppArticleParam param) { - if (param.getTenantId() == null) { - param.setTenantId(getTenantId()); - } - return success(appArticleService.page(param)); - } - - @Operation(summary = "查询平台文章列表") - @GetMapping() - public ApiResult> list(AppArticleParam param) { - if (param.getTenantId() == null) { - param.setTenantId(getTenantId()); - } - return success(appArticleService.list(param)); - } - - @Operation(summary = "根据ID读取文章详情") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - AppArticle article = appArticleService.getDetail(id, true); - if (article == null) { - return fail("文章不存在", null); - } - return success(article); - } - - @Operation(summary = "根据编码读取文章详情") - @GetMapping("/getByCode/{code}") - public ApiResult getByCode(@PathVariable("code") String code) { - return success(appArticleService.getByCode(code)); - } - - @Operation(summary = "新增平台文章") - @PostMapping() - public ApiResult save(@RequestBody AppArticle article) { - User loginUser = getLoginUser(); - Integer tenantId = article.getTenantId() != null ? article.getTenantId() : getTenantId(); - if (appArticleService.saveArticle(article, loginUser, tenantId)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改平台文章") - @PutMapping() - public ApiResult update(@RequestBody AppArticle article) { - if (appArticleService.updateArticle(article)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除平台文章") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (appArticleService.removeArticle(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "平台文章统计") - @GetMapping("/data") - public ApiResult> data(AppArticleParam param) { - if (param.getTenantId() == null) { - param.setTenantId(getTenantId()); - } - return success(appArticleService.getStats(param)); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppCloudCredentialController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppCloudCredentialController.java deleted file mode 100644 index c32085a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppCloudCredentialController.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppCloudCredential; -import com.gxwebsoft.app.param.AppCloudCredentialParam; -import com.gxwebsoft.app.service.AppCloudCredentialService; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * 云账号凭证管理控制器 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -@Tag(name = "云账号凭证管理") -@RestController -@RequestMapping("/api/app/cloud-credential") -public class AppCloudCredentialController extends BaseController { - - @Resource - private AppCloudCredentialService appCloudCredentialService; - - @Operation(summary = "分页查询凭证列表") - @GetMapping("/page") - public ApiResult page(AppCloudCredentialParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - param.setUserId(loginUser.getUserId()); - param.setTenantId(loginUser.getTenantId()); - return success(appCloudCredentialService.pageRel(param)); - } - - @Operation(summary = "查询凭证列表(不分页)") - @GetMapping - public ApiResult list(AppCloudCredentialParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - param.setUserId(loginUser.getUserId()); - param.setTenantId(loginUser.getTenantId()); - return success(appCloudCredentialService.listRel(param)); - } - - @Operation(summary = "获取凭证详情") - @GetMapping("/{id}") - public ApiResult get(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - AppCloudCredential credential = appCloudCredentialService.getById(id); - if (credential == null) return fail("凭证不存在"); - if (!credential.getUserId().equals(loginUser.getUserId())) { - return fail("无权访问此凭证"); - } - return success(credential); - } - - @OperationLog - @Operation(summary = "新增凭证") - @PostMapping - public ApiResult add(@RequestBody AppCloudCredential credential) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - credential.setUserId(loginUser.getUserId()); - credential.setTenantId(loginUser.getTenantId()); - try { - AppCloudCredential result = appCloudCredentialService.add(credential); - return success("添加成功", result); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @OperationLog - @Operation(summary = "修改凭证") - @PutMapping - public ApiResult update(@RequestBody AppCloudCredential credential) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - // 检查归属 - AppCloudCredential exist = appCloudCredentialService.getById(credential.getId()); - if (exist == null) return fail("凭证不存在"); - if (!exist.getUserId().equals(loginUser.getUserId())) { - return fail("无权修改此凭证"); - } - try { - AppCloudCredential result = appCloudCredentialService.update(credential); - return success("修改成功", result); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @OperationLog - @Operation(summary = "删除凭证") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - try { - appCloudCredentialService.remove(id, loginUser.getUserId()); - return success("删除成功"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @Operation(summary = "测试凭证连接") - @PostMapping("/test-connection") - public ApiResult testConnection(@RequestBody Map params) { - String provider = (String) params.get("provider"); - String accessKeyId = (String) params.get("accessKeyId"); - String accessKeySecret = (String) params.get("accessKeySecret"); - String configJson = (String) params.get("configJson"); - - if (provider == null || provider.isEmpty()) { - return fail("请指定云服务商"); - } - if (accessKeyId == null || accessKeySecret == null) { - return fail("请提供访问密钥"); - } - - // 构建凭证映射 - java.util.Map credentials = new java.util.HashMap<>(); - credentials.put("accessKeyId", accessKeyId); - credentials.put("accessKeySecret", accessKeySecret); - if (configJson != null) { - try { - Map config = new com.alibaba.fastjson.JSONObject() - .parseObject(configJson, Map.class); - credentials.putAll(config); - } catch (Exception e) { - log.warn("解析配置JSON失败: {}", e.getMessage()); - } - } - - boolean success = appCloudCredentialService.testConnection(provider, credentials); - return success ? success("连接成功") : fail("连接失败"); - } - - @Operation(summary = "根据ID测试凭证连接") - @PostMapping("/test/{id}") - public ApiResult testConnectionById(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - AppCloudCredential credential = appCloudCredentialService.getById(id); - if (credential == null) return fail("凭证不存在"); - if (!credential.getUserId().equals(loginUser.getUserId())) { - return fail("无权访问此凭证"); - } - try { - // 使用专门的 ID 查询方法,获取已解密的凭证 - java.util.Map credentials = appCloudCredentialService.getCredentialsByCredentialId(id); - if (credentials == null) { - return fail("获取凭证失败"); - } - // 使用返回详细消息的测试方法 - Object[] result = appCloudCredentialService.testConnectionWithMessage(credential.getProvider(), credentials); - boolean success = (Boolean) result[0]; - String message = (String) result[1]; - - credential.setTestStatus(success ? 1 : 2); - credential.setTestMessage(message); - appCloudCredentialService.updateById(credential); - - java.util.Map resultMap = new java.util.HashMap<>(); - resultMap.put("success", success); - resultMap.put("message", success ? "连接成功" : message); - return success(resultMap); - } catch (Exception e) { - log.error("测试连接异常: {}", e.getMessage(), e); - // 即使异常也更新状态 - try { - credential.setTestStatus(2); - credential.setTestMessage("连接失败: " + e.getMessage()); - appCloudCredentialService.updateById(credential); - } catch (Exception ex) { - log.error("更新测试状态失败: {}", ex.getMessage()); - } - java.util.Map errorResult = new java.util.HashMap<>(); - errorResult.put("success", false); - errorResult.put("message", "测试连接失败: " + e.getMessage()); - return success(errorResult); - } - } - - @Operation(summary = "获取支持的云服务商列表") - @GetMapping("/providers") - public ApiResult providers() { - return success(com.gxwebsoft.app.service.cloud.CloudStorageProviderFactory.getSupportedProviders()); - } -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppConfigController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppConfigController.java deleted file mode 100644 index bf5f665..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppConfigController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.app.entity.AppConfig; -import com.gxwebsoft.app.param.AppConfigParam; -import com.gxwebsoft.app.service.AppConfigService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * 应用配置表 Controller - */ -@Slf4j -@Tag(name = "应用配置管理") -@RestController -@RequestMapping("/api/app/app-config") -public class AppConfigController extends BaseController { - - @Resource - private AppConfigService appConfigService; - - /** - * 分页查询应用配置 - */ - @Operation(summary = "分页查询应用配置") - @GetMapping("/page") - public ApiResult> page(AppConfigParam param) { - return success(new PageResult<>(appConfigService.page(param))); - } - - /** - * 获取应用配置列表 - */ - @Operation(summary = "获取应用配置列表") - @GetMapping() - public ApiResult> list(AppConfigParam param) { - return success(appConfigService.list(param)); - } - - /** - * 根据应用ID获取配置映射 - */ - @Operation(summary = "根据应用ID获取配置映射") - @GetMapping("/map/{appId}") - public ApiResult> getConfigsByAppId(@PathVariable Integer appId) { - return success(appConfigService.getConfigsByAppId(appId)); - } - - /** - * 获取单个配置值 - */ - @Operation(summary = "获取单个配置值") - @GetMapping("/value") - public ApiResult getConfigValue(@RequestParam Integer appId, @RequestParam String configKey) { - return success(appConfigService.getConfigValue(appId, configKey),null); - } - - /** - * 保存配置 - */ - @Operation(summary = "保存配置") - @PostMapping() - public ApiResult save(@RequestBody AppConfig config) { - appConfigService.saveConfig(config); - return success("保存成功"); - } - - /** - * 批量保存配置 - */ - @Operation(summary = "批量保存配置") - @PostMapping("/batch") - public ApiResult batchSave(@RequestBody BatchSaveRequest request) { - appConfigService.batchSaveConfig(request.getAppId(), request.getConfigs()); - return success("保存成功"); - } - - /** - * 更新配置 - */ - @Operation(summary = "更新配置") - @PutMapping() - public ApiResult update(@RequestBody AppConfig config) { - appConfigService.updateConfig(config); - return success("更新成功"); - } - - /** - * 删除配置 - */ - @Operation(summary = "删除配置") - @DeleteMapping("/{configId}") - public ApiResult delete(@PathVariable Integer configId) { - appConfigService.deleteConfig(configId); - return success("删除成功"); - } - - /** - * 批量保存请求对象 - */ - public static class BatchSaveRequest { - private Integer appId; - private List configs; - - public Integer getAppId() { - return appId; - } - - public void setAppId(Integer appId) { - this.appId = appId; - } - - public List getConfigs() { - return configs; - } - - public void setConfigs(List configs) { - this.configs = configs; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppContractController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppContractController.java deleted file mode 100644 index a40c26c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppContractController.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppContract; -import com.gxwebsoft.app.param.AppContractParam; -import com.gxwebsoft.app.service.AppContractService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.Map; - -/** - * 合同管理控制器 - * - * @author 科技小王子 - * @since 2026-04-13 - */ -@Slf4j -@Tag(name = "合同管理") -@RestController -@RequestMapping("/api/app/contract") -public class AppContractController extends BaseController { - - @Resource - private AppContractService appContractService; - - @Operation(summary = "分页查询合同列表") - @GetMapping("/page") - public ApiResult> page(AppContractParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - return success(appContractService.page(param, loginUser.getUserId())); - } - - @Operation(summary = "获取合同详情") - @GetMapping("/{contractId}") - public ApiResult detail(@PathVariable Long contractId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - AppContract contract = appContractService.getById(contractId); - if (contract == null || contract.getDeleted() == 1) { - return fail("合同不存在", null); - } - if (!contract.getUserId().equals(loginUser.getUserId())) { - return fail("无权查看该合同", null); - } - return success(contract); - } - - @Operation(summary = "新增合同") - @PostMapping - public ApiResult create(@RequestBody AppContract contract) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - try { - AppContract result = appContractService.create(contract, loginUser.getUserId()); - return success("合同创建成功", result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @Operation(summary = "更新合同") - @PutMapping("/{contractId}") - public ApiResult update(@PathVariable Long contractId, @RequestBody AppContract contract) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - contract.setContractId(contractId); - try { - AppContract result = appContractService.update(contract, loginUser.getUserId()); - return success("合同更新成功", result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @Operation(summary = "删除合同") - @DeleteMapping("/{contractId}") - public ApiResult remove(@PathVariable Long contractId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - try { - appContractService.remove(contractId, loginUser.getUserId()); - return success("合同已删除"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @Operation(summary = "合同统计数据") - @GetMapping("/stats") - public ApiResult> stats() { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - return success(appContractService.stats(loginUser.getUserId())); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppCredentialController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppCredentialController.java deleted file mode 100644 index 5db2671..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppCredentialController.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.app.service.AppCredentialService; -import com.gxwebsoft.app.entity.AppCredential; -import com.gxwebsoft.app.param.AppCredentialParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 应用密钥凭证控制器 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Tag(name = "应用密钥凭证管理") -@RestController -@RequestMapping("/api/app/app-credential") -public class AppCredentialController extends BaseController { - - @Resource - private AppCredentialService appCredentialService; - - @Operation(summary = "分页查询应用密钥凭证") - @GetMapping("/page") - public ApiResult> page(AppCredentialParam param) { - return success(appCredentialService.pageRel(param)); - } - - @Operation(summary = "查询全部应用密钥凭证") - @GetMapping() - public ApiResult> list(AppCredentialParam param) { - return success(appCredentialService.listRel(param)); - } - - @Operation(summary = "根据id查询应用密钥凭证") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - return success(appCredentialService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('app:appCredential:save')") - @OperationLog - @Operation(summary = "创建应用密钥凭证(自动生成 ClientID 和 ClientSecret)") - @PostMapping() - public ApiResult save(@RequestBody AppCredential appCredential) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - if (appCredential.getAppId() == null) { - return fail("请选择关联应用"); - } - appCredential.setUserId(loginUser.getUserId()); - // 创建并生成密钥 - AppCredential result = appCredentialService.createCredential(appCredential); - return success("创建成功,请保存 ClientSecret,该信息仅展示一次", result); - } - - @PreAuthorize("hasAuthority('app:appCredential:update')") - @OperationLog - @Operation(summary = "修改应用密钥凭证(名称/类型/备注等,不含密钥)") - @PutMapping() - public ApiResult update(@RequestBody AppCredential appCredential) { - // 防止通过此接口直接修改 appId/appSecret - appCredential.setAppId(null); - appCredential.setClientSecret(null); - if (appCredentialService.updateById(appCredential)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appCredential:update')") - @OperationLog - @Operation(summary = "重置 AppSecret(重新生成密钥)") - @PostMapping("/resetSecret/{id}") - public ApiResult resetSecret(@PathVariable("id") Long id) { - try { - AppCredential result = appCredentialService.resetSecret(id); - return success("重置成功,请保存新 AppSecret,该信息仅展示一次", result); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('app:appCredential:update')") - @OperationLog - @Operation(summary = "禁用/启用凭证") - @PutMapping("/status/{id}/{status}") - public ApiResult updateStatus(@PathVariable("id") Long id, @PathVariable("status") Integer status) { - if (appCredentialService.updateStatus(id, status)) { - return success(status == 0 ? "已启用" : "已禁用"); - } - return fail("操作失败"); - } - - @PreAuthorize("hasAuthority('app:appCredential:remove')") - @OperationLog - @Operation(summary = "删除应用密钥凭证") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (appCredentialService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('app:appCredential:save')") - @OperationLog - @Operation(summary = "批量添加应用密钥凭证") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (appCredentialService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('app:appCredential:update')") - @OperationLog - @Operation(summary = "批量修改应用密钥凭证") - @PutMapping("/batch") - public ApiResult updateBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(appCredentialService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appCredential:remove')") - @OperationLog - @Operation(summary = "批量删除应用密钥凭证") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (appCredentialService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppEventController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppEventController.java deleted file mode 100644 index 04c961c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppEventController.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.app.service.AppEventService; -import com.gxwebsoft.app.entity.AppEvent; -import com.gxwebsoft.app.param.AppEventParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 应用操作动态控制器 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Tag(name = "应用操作动态管理") -@RestController -@RequestMapping("/api/app/app-event") -public class AppEventController extends BaseController { - - @Resource - private AppEventService appEventService; - - @Operation(summary = "分页查询操作动态") - @GetMapping("/page") - public ApiResult> page(AppEventParam param) { - return success(appEventService.pageRel(param)); - } - - @Operation(summary = "查询全部操作动态") - @GetMapping() - public ApiResult> list(AppEventParam param) { - return success(appEventService.listRel(param)); - } - - @Operation(summary = "根据id查询操作动态") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - return success(appEventService.getByIdRel(id)); - } - - @Operation(summary = "获取应用最新一条动态(用于卡片展示)") - @GetMapping("/latest/{appId}") - public ApiResult getLatest(@PathVariable("appId") Long appId) { - return success(appEventService.getLatestEvent(appId)); - } - - @PreAuthorize("hasAuthority('app:appEvent:save')") - @OperationLog - @Operation(summary = "手动记录操作动态") - @PostMapping() - public ApiResult save(@RequestBody AppEvent appEvent) { - User loginUser = getLoginUser(); - if (loginUser != null) { - appEvent.setUserId(loginUser.getUserId()); - appEvent.setTenantId(loginUser.getTenantId()); - if (appEvent.getOperatorId() == null) { - appEvent.setOperatorId(loginUser.getUserId().longValue()); - } - if (appEvent.getOperator() == null) { - appEvent.setOperator(loginUser.getNickname()); - } - } - if (appEventService.save(appEvent)) { - return success("记录成功"); - } - return fail("记录失败"); - } - - @PreAuthorize("hasAuthority('app:appEvent:update')") - @OperationLog - @Operation(summary = "修改操作动态") - @PutMapping() - public ApiResult update(@RequestBody AppEvent appEvent) { - if (appEventService.updateById(appEvent)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appEvent:remove')") - @OperationLog - @Operation(summary = "删除操作动态") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (appEventService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('app:appEvent:remove')") - @OperationLog - @Operation(summary = "清空应用所有动态记录") - @DeleteMapping("/clear/{appId}") - public ApiResult clearByAppId(@PathVariable("appId") Long appId) { - // 只清空当前租户下的数据 - AppEventParam param = new AppEventParam(); - param.setAppId(appId); - List list = appEventService.listRel(param); - if (list.isEmpty()) { - return success("暂无动态记录"); - } - List ids = list.stream().map(AppEvent::getId).collect(java.util.stream.Collectors.toList()); - if (appEventService.removeByIds(ids)) { - return success("已清空 " + ids.size() + " 条动态记录"); - } - return fail("清空失败"); - } - - @PreAuthorize("hasAuthority('app:appEvent:remove')") - @OperationLog - @Operation(summary = "批量删除操作动态") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (appEventService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppInviteController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppInviteController.java deleted file mode 100644 index 873ebff..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppInviteController.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.service.AppInviteService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -/** - * 应用成员邀请 Controller - */ -@Tag(name = "应用成员邀请") -@RestController -@RequestMapping("/api/app/developer/invite") -@RequiredArgsConstructor -public class AppInviteController extends BaseController { - - private final AppInviteService appInviteService; - - @Operation(summary = "生成二维码邀请") - @PreAuthorize("hasAuthority('app:appUser:save')") - @PostMapping("/qrcode") - public ApiResult> generateQrCode(@RequestBody Map params) { - Integer appId = (Integer) params.get("appId"); - String role = (String) params.get("role"); - Integer currentUserId = getLoginUserId(); - - Map result = appInviteService.generateQrCodeInvite(appId, role, currentUserId); - return success(result); - } - - @Operation(summary = "生成链接邀请") - @PreAuthorize("hasAuthority('app:appUser:save')") - @PostMapping("/link") - public ApiResult> generateLink(@RequestBody Map params) { - Integer appId = (Integer) params.get("appId"); - String role = (String) params.get("role"); - Integer currentUserId = getLoginUserId(); - - Map result = appInviteService.generateLinkInvite(appId, role, currentUserId); - return success(result); - } - - @Operation(summary = "验证邀请") - @PostMapping("/verify") - public ApiResult> verifyInvite(@RequestBody Map params) { - String token = (String) params.get("token"); - Integer appId = (Integer) params.get("appId"); - - Map result = appInviteService.verifyInvite(token, appId); - return success(result); - } - - @Operation(summary = "通过Token获取邀请信息(小程序专用)") - @GetMapping("/info") - public ApiResult> getInviteInfo(@RequestParam String token) { - Map result = appInviteService.getInviteInfoByToken(token); - return success(result); - } - - @Operation(summary = "接受邀请(支持小程序手机号自动注册)") - @PostMapping("/accept") - public ApiResult acceptInvite(@RequestBody Map params) { - String token = (String) params.get("token"); - Integer currentUserId = getLoginUserId(); - - // 已登录用户直接加入 - if (currentUserId != null) { - Integer appId = (Integer) params.get("appId"); - appInviteService.acceptInvite(token, appId, currentUserId); - return success("加入成功"); - } - - // 小程序手机号登录 + 加入(需要 code) - String code = (String) params.get("code"); - if (code != null) { - // TODO: 调用微信手机号登录接口,自动注册用户并加入 - // 这里暂时返回提示 - return fail("手机号登录功能开发中,请先在网页端登录"); - } - - return fail("请先登录"); - } - - @Operation(summary = "查询邀请状态(用于轮询检测是否被使用)") - @GetMapping("/status") - public ApiResult> getInviteStatus(@RequestParam String token) { - Map result = appInviteService.getInviteStatus(token); - return success(result); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppMpInviteController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppMpInviteController.java deleted file mode 100644 index 78065fb..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppMpInviteController.java +++ /dev/null @@ -1,431 +0,0 @@ -package com.gxwebsoft.app.controller; - -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.gxwebsoft.app.entity.AppInviteToken; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.mapper.AppInviteTokenMapper; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.mapper.AppUserCacheMapper; -import com.gxwebsoft.app.mapper.AppUserMapper; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.Map; - -/** - * 小程序邀请接口(处理 /api/_app 路径) - * 用于小程序扫码加入应用场景 - */ -@Slf4j -@Tag(name = "小程序邀请") -@RestController -@RequestMapping("/api/_app/developer/invite") -@RequiredArgsConstructor -public class AppMpInviteController extends BaseController { - - private final AppInviteTokenMapper appInviteTokenMapper; - private final AppProductMapper appProductMapper; - private final AppUserMapper appUserMapper; - private final AppUserCacheMapper appUserCacheMapper; - private final AppUserCacheService appUserCacheService; - - @Value("${app.invite.base-url:https://websopy.websoft.top}") - private String baseUrl; - - @Value("${spring.redis.host:127.0.0.1}") - private String redisHost; - - @Value("${spring.redis.port:6379}") - private int redisPort; - - @Value("${spring.redis.password:}") - private String redisPassword; - - @Operation(summary = "通过Token获取邀请信息(小程序专用)") - @GetMapping("/info") - public ApiResult> getInviteInfo(@RequestParam String token) { - try { - Map result = getInviteInfoByToken(token); - return success(result); - } catch (Exception e) { - log.error("获取邀请信息失败", e); - return fail("获取邀请信息失败"); - } - } - - @Operation(summary = "验证邀请(PC端和小程序通用)") - @PostMapping("/verify") - public ApiResult> verifyInvite(@RequestBody Map params) { - try { - String token = (String) params.get("token"); - Integer appId = (Integer) params.get("appId"); - - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - return fail("邀请不存在或已失效"); - } - if (appId != null && !inviteToken.getAppId().equals(appId)) { - return fail("邀请与应用不匹配"); - } - if (inviteToken.getExpireTime().isBefore(LocalDateTime.now())) { - return fail("邀请已过期"); - } - if (inviteToken.getStatus() != 0) { - return fail("邀请已被使用"); - } - - AppProduct app = appProductMapper.selectById(inviteToken.getAppId()); - if (app == null) { - return fail("应用不存在"); - } - - AppUserCache inviter = appUserCacheService.getByUserId(inviteToken.getInviterId()); - - Map result = new HashMap<>(); - result.put("appId", inviteToken.getAppId()); - result.put("appName", app.getProductName()); - result.put("appIcon", app.getIcon()); - result.put("inviterName", inviter != null ? inviter.getNickname() : "未知"); - result.put("inviterAvatar", inviter != null ? inviter.getAvatar() : null); - result.put("role", inviteToken.getRole()); - result.put("expireTime", inviteToken.getExpireTime().toString()); - return success(result); - } catch (Exception e) { - log.error("验证邀请失败", e); - return fail("验证邀请失败"); - } - } - - @Operation(summary = "接受邀请(小程序专用,支持已登录和未注册两种模式)") - @PostMapping("/accept") - @Transactional(rollbackFor = Exception.class) - public ApiResult acceptInvite(@RequestBody Map params) { - String token = (String) params.get("token"); - String code = (String) params.get("code"); - - if (StrUtil.isBlank(token)) { - return fail("邀请 token 不能为空"); - } - - try { - // 1. 验证邀请 token - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - return fail("邀请不存在或已失效"); - } - if (inviteToken.getExpireTime().isBefore(LocalDateTime.now())) { - return fail("邀请已过期"); - } - if (inviteToken.getStatus() != 0) { - return fail("邀请已被使用"); - } - - Integer userId; - - // 2. 判断是已登录用户还是未注册用户 - if (StrUtil.isBlank(code)) { - // ===== 模式一:已登录用户(通过 Authorization 头识别)===== - log.info("接受邀请 - 已登录用户模式(通过token识别)"); - userId = getLoginUserId(); - if (userId == null) { - return fail("用户未登录,请先登录"); - } - log.info("已登录用户加入应用: userId={}", userId); - } else { - // ===== 模式二:未注册用户(通过微信授权码获取手机号)===== - log.info("接受邀请 - 未注册用户模式(通过手机号授权码)"); - - // 2.1 通过微信手机号 code 获取手机号 - String phone = getPhoneByCode(code); - if (StrUtil.isBlank(phone)) { - return fail("获取手机号失败,请重试"); - } - - // 2.2 查询用户,不存在则创建 - userId = getOrCreateUserByPhone(phone); - if (userId == null) { - return fail("用户创建失败"); - } - log.info("未注册用户加入应用: phone={}, userId={}", phone, userId); - } - - // 4. 检查是否已经是成员 - AppUser existUser = appUserMapper.selectOne( - new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper() - .eq(AppUser::getAppId, inviteToken.getAppId().longValue()) - .eq(AppUser::getUserId, userId) - ); - if (existUser != null && existUser.getInviteStatus() == 0) { - return fail("你已经是该应用的成员"); - } - - // 5. 添加为应用成员(直接加入,不走待确认流程) - AppUser appUser = new AppUser(); - appUser.setAppId(inviteToken.getAppId().longValue()); - appUser.setUserId(userId); - appUser.setRole(inviteToken.getRole() != null ? inviteToken.getRole() : "developer"); - appUser.setInviteBy(inviteToken.getInviterId().longValue()); - appUser.setInviteTime(LocalDateTime.now()); - appUser.setStatus(0); - appUser.setInviteStatus(0); // 直接确认 - appUser.setSortNumber(0); - - // 从 AppProduct 获取 tenantId - AppProduct app = appProductMapper.selectById(inviteToken.getAppId()); - appUser.setTenantId(app != null ? app.getTenantId() : null); - - // 补充用户信息 - AppUserCache userCache = appUserCacheService.getByUserId(userId); - if (userCache != null) { - appUser.setUsername(userCache.getUsername()); - appUser.setNickname(userCache.getNickname()); - appUser.setAvatar(userCache.getAvatar()); - appUser.setPhone(userCache.getPhone()); - } - - appUserMapper.insert(appUser); - - // 6. 标记邀请已使用 - inviteToken.setStatus(1); - appInviteTokenMapper.updateById(inviteToken); - - log.info("小程序扫码加入应用成功: token={}, userId={}, appId={}", token, userId, inviteToken.getAppId()); - - // 7. 返回应用信息(复用上面查询的 app 对象) - String appName = (app != null) ? app.getProductName() : "应用"; - Map result = new HashMap<>(); - result.put("success", true); - result.put("message", "加入成功"); - result.put("appName", appName); - return success(result); - - } catch (Exception e) { - log.error("接受邀请失败", e); - return fail("加入失败,请重试"); - } - } - - /** - * 通过 token 获取邀请信息 - */ - private Map getInviteInfoByToken(String token) throws Exception { - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - throw new Exception("邀请不存在或已失效"); - } - - if (inviteToken.getExpireTime().isBefore(LocalDateTime.now())) { - throw new Exception("邀请已过期"); - } - - if (inviteToken.getStatus() != 0) { - throw new Exception("邀请已被使用"); - } - - AppProduct app = appProductMapper.selectById(inviteToken.getAppId()); - if (app == null) { - throw new Exception("应用不存在"); - } - - AppUserCache inviter = appUserCacheService.getByUserId(inviteToken.getInviterId()); - - String roleName = getRoleName(inviteToken.getRole()); - - Map result = new HashMap<>(); - result.put("token", token); - result.put("appId", inviteToken.getAppId()); - result.put("appName", app.getProductName()); - result.put("appLogo", app.getIcon()); - result.put("inviterName", inviter != null ? inviter.getNickname() : "某位用户"); - result.put("roleName", roleName); - result.put("role", inviteToken.getRole()); - result.put("expireTime", inviteToken.getExpireTime().toString()); - return result; - } - - /** - * 获取角色名称 - */ - private String getRoleName(String role) { - if (StrUtil.isBlank(role)) return "成员"; - switch (role) { - case "owner": return "所有者"; - case "admin": return "管理员"; - case "developer": return "开发者"; - default: return "成员"; - } - } - - /** - * 通过微信手机号 code 获取手机号 - */ - private String getPhoneByCode(String code) { - try { - // 获取 access_token(从小程序配置读取) - String accessToken = getMiniprogramAccessToken(); - if (StrUtil.isBlank(accessToken)) { - log.warn("获取小程序access_token失败"); - return null; - } - - String apiUrl = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken; - Map paramMap = new HashMap<>(); - paramMap.put("code", code); - - String response = HttpUtil.post(apiUrl, JSON.toJSONString(paramMap)); - JSONObject json = JSON.parseObject(response); - - if (json.containsKey("errcode") && json.getInteger("errcode") != 0) { - log.error("微信获取手机号失败: {}", json.getString("errmsg")); - return null; - } - - // 解析手机号 - if (json.containsKey("phone_info")) { - JSONObject phoneInfo = json.getJSONObject("phone_info"); - return phoneInfo.getString("phoneNumber"); - } - - return null; - } catch (Exception e) { - log.error("获取手机号异常", e); - return null; - } - } - - /** - * 获取小程序 AccessToken - */ - private String getMiniprogramAccessToken() { - try { - // 使用 WxMiniprogramUtil 获取 access_token - String accessToken = com.gxwebsoft.common.core.utils.WxMiniprogramUtil.getAccessToken(); - if (StrUtil.isBlank(accessToken)) { - log.warn("通过 WxMiniprogramUtil 获取小程序 access_token 失败"); - } - return accessToken; - } catch (Exception e) { - log.error("获取AccessToken失败", e); - return null; - } - } - - /** - * 调用微信 API 获取 AccessToken - */ - private String fetchAccessToken(String appId, String appSecret) { - String apiUrl = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" - + appId + "&secret=" + appSecret; - String response = HttpUtil.get(apiUrl); - JSONObject json = JSON.parseObject(response); - return json.getString("access_token"); - } - - /** - * 获取 Spring Bean - */ - private Object getSpringBean(Class clazz) { - try { - Class springContextUtilClass = Class.forName("com.gxwebsoft.common.core.config.SpringContextUtil"); - Object bean = springContextUtilClass.getMethod("getBean", Class.class) - .invoke(null, clazz); - return bean; - } catch (Exception e) { - log.warn("获取Spring Bean失败: {}", e.getMessage()); - return null; - } - } - - /** - * 通过手机号查询或创建用户 - * 优先从 app_user_cache 查询,不存在则通过 HTTP 调用主服务器 API 查询/创建(跨库到 gxwebsoft_core.sys_user) - */ - private Integer getOrCreateUserByPhone(String phone) { - try { - // 1. 优先从 app_user_cache 查询用户 - AppUserCache userCache = appUserCacheMapper.selectOne( - new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper() - .eq(AppUserCache::getPhone, phone) - ); - - if (userCache != null) { - log.info("从 app_user_cache 找到用户: phone={}, userId={}", phone, userCache.getUserId()); - return userCache.getUserId(); - } - - log.info("app_user_cache 中未找到用户,通过 AppUserCacheService 刷新缓存: phone={}", phone); - - // 2. 通过 AppUserCacheService 从主服务器刷新缓存 - // AppUserCacheService 会调用 server API 获取用户信息并保存到本地缓存 - AppUserCache refreshedCache = appUserCacheService.refreshUserCacheByPhone(phone); - - if (refreshedCache != null) { - log.info("从主服务器刷新缓存成功: phone={}, userId={}", phone, refreshedCache.getUserId()); - return refreshedCache.getUserId(); - } - - log.info("主服务器中未找到用户,需要创建新用户: phone={}", phone); - - // 3. 用户不存在,通过 HTTP 调用主服务器 API 创建新用户 - log.info("主服务器中未找到用户,创建新用户: phone={}", phone); - - String createPath = "/system/user/"; - Map userMap = new HashMap<>(); - userMap.put("phone", phone); - userMap.put("username", "wx_" + phone); - userMap.put("nickname", "微信用户"); - userMap.put("status", 0); - userMap.put("platform", "MP-WEIXIN"); - userMap.put("tenantId", 1); // 默认租户 - - // 3. 用户不存在,调用 AppUserCacheService 创建新用户 - log.info("调用 AppUserCacheService 创建新用户: phone={}", phone); - - // 使用 AppUserCacheService 创建用户(内部会调用 server API) - AppUserCache newUserCache = appUserCacheService.createUserByPhone(phone); - - if (newUserCache != null && newUserCache.getUserId() != null) { - log.info("新用户创建成功: phone={}, userId={}", phone, newUserCache.getUserId()); - return newUserCache.getUserId(); - } - - log.error("保存用户失败: phone={}", phone); - return null; - } catch (Exception e) { - log.error("创建用户失败: phone={}", phone, e); - return null; - } - } - - /** - * 同步用户到缓存表 - */ - private void syncUserToCache(Integer userId) { - try { - if (userId == null) return; - // 简单实现:更新缓存 - Object userCacheService = getSpringBean(Class.forName("com.gxwebsoft.app.service.AppUserCacheService")); - if (userCacheService != null) { - userCacheService.getClass().getMethod("refreshUserCache", Integer.class).invoke(userCacheService, userId); - } - } catch (Exception e) { - log.warn("同步用户缓存失败: {}", e.getMessage()); - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppNotificationController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppNotificationController.java deleted file mode 100644 index 6f0c913..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppNotificationController.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppNotification; -import com.gxwebsoft.app.param.AppNotificationParam; -import com.gxwebsoft.app.service.AppNotificationService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * 站内消息通知控制器 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Tag(name = "站内消息通知") -@RestController -@RequestMapping("/api/app/notification") -public class AppNotificationController extends BaseController { - - @Resource - private AppNotificationService appNotificationService; - - // ─── 查询接口 ──────────────────────────────────────────────── - - @Operation(summary = "分页查询通知列表") - @GetMapping("/page") - public ApiResult> page(AppNotificationParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - return success(appNotificationService.pageByUser(param, loginUser.getUserId())); - } - - @Operation(summary = "查询最近通知(铃铛下拉)") - @GetMapping("/recent") - public ApiResult> recent( - @RequestParam(required = false) String type, - @RequestParam(required = false, defaultValue = "20") Integer limit) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - return success(appNotificationService.listRecent(loginUser.getUserId(), type, limit)); - } - - @Operation(summary = "获取未读数量统计") - @GetMapping("/unread-count") - public ApiResult> unreadCount() { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - return success(appNotificationService.getUnreadCount(loginUser.getUserId())); - } - - // ─── 操作接口 ──────────────────────────────────────────────── - - @Operation(summary = "标记单条通知为已读") - @PutMapping("/read/{id}") - public ApiResult markRead(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - appNotificationService.markRead(id, loginUser.getUserId()); - return success("已标记为已读"); - } - - @Operation(summary = "标记全部已读") - @PutMapping("/read-all") - public ApiResult markAllRead(@RequestBody(required = false) Map body) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - String type = (body != null) ? body.get("type") : null; - appNotificationService.markAllRead(loginUser.getUserId(), type); - return success("已全部标记为已读"); - } - - @Operation(summary = "删除单条通知") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - appNotificationService.removeNotification(id, loginUser.getUserId()); - return success("已删除"); - } - - @Operation(summary = "清空已读通知") - @DeleteMapping("/clear-read") - public ApiResult clearRead(@RequestBody(required = false) Map body) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - String type = (body != null) ? body.get("type") : null; - appNotificationService.clearRead(loginUser.getUserId(), type); - return success("已清空已读通知"); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppPermissionRequestController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppPermissionRequestController.java deleted file mode 100644 index e25385b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppPermissionRequestController.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppPermissionRequest; -import com.gxwebsoft.app.param.AppPermissionRequestParam; -import com.gxwebsoft.app.service.AppPermissionRequestService; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 权限申请控制器 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Tag(name = "权限申请") -@RestController -@RequestMapping("/api/app/developer/permission-requests") -public class AppPermissionRequestController extends BaseController { - - @Resource - private AppPermissionRequestService appPermissionRequestService; - - @Operation(summary = "获取权限申请列表") - @GetMapping("/page") - public ApiResult> page(AppPermissionRequestParam param) { - User loginUser = getLoginUser(); - if (loginUser != null) { - param.setUserId(loginUser.getUserId()); - } - return success(appPermissionRequestService.pageRel(param)); - } - - @Operation(summary = "查询全部权限申请") - @GetMapping - public ApiResult> list(AppPermissionRequestParam param) { - User loginUser = getLoginUser(); - if (loginUser != null) { - param.setUserId(loginUser.getUserId()); - } - return success(appPermissionRequestService.listRel(param)); - } - - @Operation(summary = "根据id查询权限申请") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Long id) { - return success(appPermissionRequestService.getByIdRel(id)); - } - - @Operation(summary = "获取权限申请统计") - @GetMapping("/stats") - public ApiResult> stats() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - return success(appPermissionRequestService.getPermissionRequestStats(loginUser.getUserId())); - } - - @Operation(summary = "获取可申请的仓库列表") - @GetMapping("/available-repos") - public ApiResult>> availableRepos() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - return success(appPermissionRequestService.getAvailableRepositories(loginUser.getUserId())); - } - - @OperationLog - @Operation(summary = "提交权限申请") - @PostMapping - public ApiResult save(@RequestBody Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - - String repo = params.get("repo"); - String reason = params.get("reason"); - String gitUsername = params.get("gitUsername"); - - if (repo == null || repo.trim().isEmpty()) { - return fail("请选择申请仓库", null); - } - if (reason == null || reason.trim().isEmpty()) { - return fail("请填写申请理由", null); - } - - try { - // 从 repo 中提取仓库名称(假设格式为 owner/repo-name) - String repoName = repo; - if (repo.contains("/")) { - String[] parts = repo.split("/"); - repoName = parts[parts.length - 1]; - } - - AppPermissionRequest request = appPermissionRequestService.createPermissionRequest( - loginUser.getUserId(), gitUsername, repo, repoName, reason.trim(), loginUser.getTenantId() - ); - return success("申请提交成功,请等待审核", request); - } catch (RuntimeException e) { - return fail(e.getMessage(), null); - } - } - - @OperationLog - @Operation(summary = "审核权限申请-通过") - @PutMapping("/{id}/approve") - public ApiResult approve(@PathVariable("id") Long id, @RequestBody(required = false) Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - String note = params != null ? params.get("note") : null; - boolean result = appPermissionRequestService.approveRequest(id, loginUser.getUserId(), loginUser.getRealName(), note); - return result ? success("审核通过") : fail("审核失败"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - @OperationLog - @Operation(summary = "审核权限申请-拒绝") - @PutMapping("/{id}/reject") - public ApiResult reject(@PathVariable("id") Long id, @RequestBody Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - - String reason = params != null ? params.get("reason") : null; - if (reason == null || reason.trim().isEmpty()) { - return fail("请填写拒绝原因"); - } - - try { - boolean result = appPermissionRequestService.rejectRequest(id, loginUser.getUserId(), loginUser.getRealName(), reason.trim()); - return result ? success("已拒绝该申请") : fail("拒绝失败"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppProductController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppProductController.java deleted file mode 100644 index 8cf1cf5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppProductController.java +++ /dev/null @@ -1,259 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.param.AppProductParam; -import com.gxwebsoft.app.service.AppProductService; -import com.gxwebsoft.app.service.AppUserService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.List; -import java.util.Map; - -/** - * 应用产品 前端控制器 - * - * @author 科技小王子 - */ -@RestController -@RequestMapping("/api/app/product") -@RequiredArgsConstructor -@Tag(name = "应用产品管理", description = "应用产品管理接口") -public class AppProductController extends BaseController { - - private final AppProductService appProductService; - private final AppUserService appUserService; - - @GetMapping("/page") - @Operation(summary = "分页查询应用列表") - public ApiResult> page( - @Parameter(description = "页码") @RequestParam(defaultValue = "1") Long current, - @Parameter(description = "每页条数") @RequestParam(defaultValue = "10") Long size, - @Parameter(description = "应用名称") @RequestParam(required = false) String productName, - @Parameter(description = "应用标识") @RequestParam(required = false) String productCode, - @Parameter(description = "应用类型") @RequestParam(required = false) Integer appType, - @Parameter(description = "分类ID") @RequestParam(required = false) Integer categoryId, - @Parameter(description = "发布状态") @RequestParam(required = false) String publishStatus, - @Parameter(description = "状态") @RequestParam(required = false) Integer status, - @Parameter(description = "用户ID(可选,不传则自动用当前登录用户)") @RequestParam(required = false) Integer userId) { - - // 如果没传 userId,自动用当前登录用户 - if (userId == null) { - userId = getLoginUserId(); - } - - AppProduct product = new AppProduct(); - product.setProductName(productName); - product.setProductCode(productCode); - product.setAppType(appType); - product.setCategoryId(categoryId); - product.setPublishStatus(publishStatus); - product.setStatus(status); - - IPage page = appProductService.selectPageList(new Page<>(current, size), product, userId); - return success(page); - } - - @GetMapping("/list") - @Operation(summary = "获取我的应用列表") - public ApiResult> list() { - Integer userId = getLoginUserId(); - return success(appProductService.getByUserId(userId)); - } - - @GetMapping("/my/page") - @Operation(summary = "分页查询我的应用(创建者)") - public ApiResult> myApps( - @Parameter(description = "页码") @RequestParam(defaultValue = "1") Long current, - @Parameter(description = "每页条数") @RequestParam(defaultValue = "10") Long size) { - Integer userId = getLoginUserId(); - Page page = new Page<>(current, size); - return success(appProductService.getMyApps(page, userId)); - } - - @GetMapping("/joined/page") - @Operation(summary = "分页查询我参与的应用") - public ApiResult> joinedApps( - @Parameter(description = "页码") @RequestParam(defaultValue = "1") Long current, - @Parameter(description = "每页条数") @RequestParam(defaultValue = "10") Long size) { - Integer userId = getLoginUserId(); - Page page = new Page<>(current, size); - return success(appProductService.getJoinedApps(page, userId)); - } - - @GetMapping("/detail/{id}") - @Operation(summary = "获取应用详情") - public ApiResult detail( - @Parameter(description = "应用ID") @PathVariable Integer id) { - // 记录用户访问(更新最近访问时间) - Integer userId = getLoginUserId(); - if (userId != null) { - appUserService.recordVisit(id.longValue(), userId); - } - return success(appProductService.getDetail(id)); - } - - @PostMapping("/visit/{id}") - @Operation(summary = "记录应用访问") - public ApiResult visit( - @Parameter(description = "应用ID") @PathVariable Integer id) { - Integer userId = getLoginUserId(); - if (userId != null) { - appUserService.recordVisit(id.longValue(), userId); - } - return success(); - } - - @GetMapping("/info/{code}") - @Operation(summary = "根据标识获取应用") - public ApiResult info( - @Parameter(description = "应用标识") @PathVariable String code) { - return success(appProductService.getByCode(code)); - } - - @PostMapping("/create") - @Operation(summary = "创建应用") - public ApiResult create(@Valid @RequestBody AppProduct product) { - boolean success = appProductService.create(product); - return success ? success("创建成功") : fail("创建失败"); - } - - @PutMapping("/update") - @Operation(summary = "更新应用") - public ApiResult update(@Valid @RequestBody AppProduct product) { - boolean success = appProductService.update(product); - return success ? success("更新成功") : fail("更新失败"); - } - - @DeleteMapping("/delete/{id}") - @Operation(summary = "删除应用") - public ApiResult delete( - @Parameter(description = "应用ID") @PathVariable Integer id) { - boolean success = appProductService.delete(id); - return success ? success("删除成功") : fail("删除失败"); - } - - @PostMapping("/submit/{id}") - @Operation(summary = "提交审核") - public ApiResult submit( - @Parameter(description = "应用ID") @PathVariable Integer id) { - boolean success = appProductService.submitReview(id); - return success ? success("提交成功") : fail("提交失败"); - } - - @PostMapping("/approve/{id}") - @Operation(summary = "审核通过") - public ApiResult approve( - @Parameter(description = "应用ID") @PathVariable Integer id) { - boolean success = appProductService.approve(id); - return success ? success("审核通过") : fail("审核失败"); - } - - @PostMapping("/reject/{id}") - @Operation(summary = "审核拒绝") - public ApiResult reject( - @Parameter(description = "应用ID") @PathVariable Integer id, - @RequestParam String reason) { - boolean success = appProductService.reject(id, reason); - return success ? success("操作成功") : fail("操作失败"); - } - - @PostMapping("/publish/{id}") - @Operation(summary = "上架应用") - public ApiResult publish( - @Parameter(description = "应用ID") @PathVariable Integer id) { - boolean success = appProductService.publish(id); - return success ? success("上架成功") : fail("上架失败"); - } - - @PostMapping("/unpublish/{id}") - @Operation(summary = "下架应用") - public ApiResult unpublish( - @Parameter(description = "应用ID") @PathVariable Integer id) { - boolean success = appProductService.unpublish(id); - return success ? success("下架成功") : fail("下架失败"); - } - - @PostMapping("/regenerateSecret/{id}") - @Operation(summary = "重新生成密钥") - public ApiResult regenerateSecret( - @Parameter(description = "应用ID") @PathVariable Integer id) { - String newSecret = appProductService.regenerateSecret(id); - return success(newSecret,null); - } - - @GetMapping("/market/page") - @Operation(summary = "应用市场分页") - public ApiResult> marketPage( - @Parameter(description = "页码") @RequestParam(defaultValue = "1") Long current, - @Parameter(description = "每页条数") @RequestParam(defaultValue = "10") Long size, - @Parameter(description = "应用类型") @RequestParam(required = false) Integer appType, - @Parameter(description = "关键词") @RequestParam(required = false) String keyword) { - - IPage page = appProductService.getMarketList(new Page<>(current, size), appType, keyword); - return success(page); - } - - @PostMapping("/view/{id}") - @Operation(summary = "浏览应用") - public ApiResult view( - @Parameter(description = "应用ID") @PathVariable Integer id) { - appProductService.incrementClicks(id); - return success(); - } - - @PostMapping("/install/{id}") - @Operation(summary = "安装应用") - public ApiResult install( - @Parameter(description = "应用ID") @PathVariable Integer id) { - appProductService.incrementInstalls(id); - return success(); - } - - @PostMapping("/download/{id}") - @Operation(summary = "下载应用") - public ApiResult download( - @Parameter(description = "应用ID") @PathVariable Integer id) { - appProductService.incrementDownloads(id); - return success(); - } - - @PostMapping("/like/{id}") - @Operation(summary = "点赞应用") - public ApiResult like( - @Parameter(description = "应用ID") @PathVariable Integer id) { - appProductService.incrementLikes(id); - return success(); - } - - @PostMapping("/user-stats") - @Operation(summary = "按用户ID列表批量统计应用数量") - public ApiResult>> userStats( - @RequestBody List userIds) { - return success(appProductService.getStatsByUserIds(userIds)); - } - - /** - * 获取当前用户可访问的应用列表(带角色信息) - * 用于权限过滤:返回用户创建的应用(owner)和被邀请加入的应用(成员角色) - * 每个应用包含 myRole 字段,标识用户在该应用中的角色 - */ - @GetMapping("/accessible") - @Operation(summary = "获取可访问的应用列表(带角色信息)") - public ApiResult> accessibleApps() { - Integer userId = getLoginUserId(); - if (userId == null) { - return success(List.of()); - } - return success(appProductService.getAccessibleApps(userId)); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppResourceController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppResourceController.java deleted file mode 100644 index 2df9920..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppResourceController.java +++ /dev/null @@ -1,368 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.entity.ResourceAccessLevel; -import com.gxwebsoft.app.param.AppResourceParam; -import com.gxwebsoft.app.service.AppResourceService; -import com.gxwebsoft.app.service.AppCloudCredentialService; -import com.gxwebsoft.app.service.DatabaseOperatorFactory; -import com.gxwebsoft.app.service.DatabaseOperatorService; -import com.gxwebsoft.app.service.OnePanelService; -import com.gxwebsoft.app.service.SshService; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import com.gxwebsoft.app.service.cloud.CloudStorageProviderFactory; -import com.gxwebsoft.app.service.impl.AppResourceServiceImpl; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.utils.DbPasswordUtil; -import com.gxwebsoft.common.core.utils.RedisUtil; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 开发者资源管理控制器(服务器/数据库/云存储/域名/SSL) - * - * @author 科技小王子 - * @since 2026-03-31 - */ -@Slf4j -@Tag(name = "开发者资源管理") -@RestController -@RequestMapping("/api/app/developer-resource") -public class AppResourceController extends BaseController { - - @Resource - private AppResourceService appResourceService; - - @Resource - private AppCloudCredentialService cloudCredentialService; - - @Resource - private DatabaseOperatorFactory databaseOperatorFactory; - - @Resource - private SshService sshService; - - @Resource - private OnePanelService onePanelService; - - @Resource - private RedisUtil redisUtil; - - // ─── 查询接口 ───────────────────────────────────────────────── - - @Operation(summary = "分页查询资源列表(支持协作权限)") - @GetMapping("/page") - public ApiResult> page(AppResourceParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - // **协作权限改进**:不再限制只能查自己的资源,改为查询用户有权访问的资源 - // 通过修改SQL,查询条件改为:owner_user_id = 当前用户 OR app_id IN (用户有权限的应用) - param.setUserId(loginUser.getUserId()); - param.setTenantId(loginUser.getTenantId()); - // 调用新方法,传入当前用户ID以便计算 accessLevel 和屏蔽敏感字段 - return success(appResourceService.pageRel(param, loginUser.getUserId())); - } - - @Operation(summary = "查询资源列表(不分页,支持协作权限)") - @GetMapping - public ApiResult> list(AppResourceParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - param.setUserId(loginUser.getUserId()); - param.setTenantId(loginUser.getTenantId()); - // 调用新方法,传入当前用户ID - return success(appResourceService.listRel(param, loginUser.getUserId())); - } - - @Operation(summary = "获取资源详情(支持协作权限)") - @GetMapping("/{resourceId}") - public ApiResult get(@PathVariable Long resourceId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - AppResource resource = appResourceService.getByIdRel(resourceId, loginUser.getUserId()); - if (resource == null) return fail("资源不存在", null); - // **协作权限改进**:不再直接禁止访问,由 Service 计算 accessLevel,0 表示无权限 - if (resource.getAccessLevel() == null || resource.getAccessLevel() == 0) { - return fail("无权访问此资源", null); - } - return success(resource); - } - - @Operation(summary = "统计各类型资源数量") - @GetMapping("/stats") - public ApiResult> stats() { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - return success(appResourceService.countByType(loginUser.getUserId(), loginUser.getTenantId())); - } - - // ─── 新增/修改接口 ──────────────────────────────────────────── - - @OperationLog - @Operation(summary = "新增资源") - @PostMapping - public ApiResult save(@RequestBody AppResource resource) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - if (resource.getResourceType() == null || resource.getResourceType().isEmpty()) { - return fail("资源类型不能为空", null); - } - if (resource.getName() == null || resource.getName().isEmpty()) { - return fail("资源名称不能为空", null); - } - resource.setTenantId(loginUser.getTenantId()); - try { - AppResource result = appResourceService.addResource(resource, loginUser.getUserId()); - return success("添加成功", result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @OperationLog - @Operation(summary = "修改资源(只有 Owner 可操作)") - @PutMapping - public ApiResult update(@RequestBody AppResource resource) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - try { - AppResource result = appResourceService.updateResource(resource, loginUser.getUserId()); - return success("修改成功", result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - // ─── 删除接口 ───────────────────────────────────────────────── - - @OperationLog - @Operation(summary = "删除资源(逻辑删除,需要短信验证码)") - @DeleteMapping("/{resourceId}") - public ApiResult remove(@PathVariable Long resourceId, @RequestBody Map body) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - - // 验证短信验证码 - String code = body.get("code"); - if (code == null || code.isEmpty()) { - return fail("请输入短信验证码"); - } - - // 验证验证码(key 为 code:手机号) - String phone = loginUser.getPhone(); - if (phone == null || phone.isEmpty()) { - return fail("请先绑定手机号"); - } - - String cachedCode = redisUtil.get("code:" + phone); - if (cachedCode == null || !cachedCode.equals(code)) { - return fail("验证码错误或已过期"); - } - - // 验证通过,删除验证码 - redisUtil.delete("code:" + phone); - - try { - appResourceService.removeResource(resourceId, loginUser.getUserId()); - return success("删除成功"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @OperationLog - @Operation(summary = "批量删除资源") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - try { - for (Long id : ids) { - appResourceService.removeResource(id, loginUser.getUserId()); - } - return success("批量删除成功"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - // ─── 数据库操作接口 ────────────────────────────────────────── - - @Operation(summary = "测试服务器数据库连接") - @PostMapping("/test-connection") - public ApiResult testConnection(@RequestBody Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - - String host = (String) params.get("host"); - String dbType = (String) params.get("dbType"); - Integer port = params.get("port") != null ? ((Number) params.get("port")).intValue() : null; - String username = (String) params.get("username"); - String password = (String) params.get("password"); - String dbName = (String) params.get("dbName"); - - if (host == null || host.isEmpty()) return fail("服务器地址不能为空", null); - if (username == null || username.isEmpty()) return fail("用户名不能为空", null); - - // 根据数据库类型获取默认端口和对应操作服务 - if (dbType == null || dbType.isEmpty()) { - dbType = "MySQL"; - } - if (port == null) { - port = "PostgreSQL".equals(dbType) ? 5432 : 3306; - } - - DatabaseOperatorService operator = databaseOperatorFactory.getOperator(dbType); - DatabaseOperatorService.DatabaseOperationResult result = - operator.testConnection(host, port, username, password, dbName); - return success(result); - } - - @Operation(summary = "测试服务器 SSH 连接") - @PostMapping("/test-ssh") - public ApiResult testSshConnection(@RequestBody Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - - String host = (String) params.get("host"); - Integer port = params.get("port") != null ? ((Number) params.get("port")).intValue() : 22; - String username = (String) params.get("username"); - String password = (String) params.get("password"); - - SshService.ConnectionResult result = sshService.testConnection(host, port, username, password); - return success(result); - } - - @Operation(summary = "获取1Panel服务器状态") - @GetMapping("/server-status/{resourceId}") - public ApiResult getServerStatus(@PathVariable Long resourceId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - - AppResource resource = appResourceService.getByIdRel(resourceId, loginUser.getUserId()); - if (resource == null) return fail("资源不存在", null); - - // 必须是服务器类型资源 - if (!"server".equals(resource.getResourceType())) { - return fail("只有服务器资源才能获取状态", null); - } - - // 必须有 panelPort 配置 - if (resource.getPanelPort() == null) { - return fail("该服务器未配置1Panel端口", null); - } - - // 必须有连接权限(owner/admin/developer)才能获取状态 - int accessLevel = resource.getAccessLevel() != null ? resource.getAccessLevel() : 0; - if (accessLevel < ResourceAccessLevel.VIEW_CONNECTION.getValue()) { - return fail("没有权限获取服务器状态", null); - } - - // 调用1Panel API获取状态 - OnePanelService.ServerStatus status = onePanelService.getServerStatus( - resource.getIp(), - resource.getPanelPort(), - resource.getPanelPath(), - resource.getPanelUsername(), - resource.getPanelPassword() - ); - - return success(status); - } - - @Operation(summary = "重试创建数据库(只有 Owner 可操作)") - @PostMapping("/retry-create-database/{resourceId}") - public ApiResult retryCreateDatabase(@PathVariable Long resourceId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - - AppResource resource = appResourceService.getByIdRel(resourceId, loginUser.getUserId()); - if (resource == null) return fail("资源不存在"); - if (!loginUser.getUserId().equals(resource.getOwnerUserId())) return fail("只有资源创建者才能操作"); - if (!"failed".equals(resource.getStatus()) && !"pending".equals(resource.getStatus())) { - return fail("只有创建失败或创建中的资源才能重试"); - } - - try { - // 获取 ServiceImpl 实例调用异步方法 - AppResourceServiceImpl serviceImpl = (AppResourceServiceImpl) appResourceService; - serviceImpl.asyncCreateDatabase(resourceId); - return success("已开始重新创建,请稍后查看状态"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @Operation(summary = "重置数据库密码(只有 Owner 可操作)") - @PostMapping("/reset-password/{resourceId}") - public ApiResult> resetPassword(@PathVariable Long resourceId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - try { - String newPassword = appResourceService.resetDatabasePassword(resourceId, loginUser.getUserId()); - Map result = new HashMap<>(); - result.put("password", newPassword); - return success(result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @Operation(summary = "刷新存储桶信息(只有 Owner 可操作)") - @PostMapping("/refresh-storage/{resourceId}") - public ApiResult> refreshStorage(@PathVariable Long resourceId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录", null); - - AppResource resource = appResourceService.getByIdRel(resourceId, loginUser.getUserId()); - if (resource == null) return fail("资源不存在",null); - if (!"storage".equals(resource.getResourceType())) { - return fail("只有存储桶资源才能刷新",null); - } - - try { - // 获取云账号凭证 - Map credentials; - if (resource.getCredentialId() != null) { - credentials = cloudCredentialService.getCredentialsByCredentialId(resource.getCredentialId()); - } else { - credentials = cloudCredentialService.getCredentials(resource.getProvider(), loginUser.getUserId()); - } - - if (credentials == null || credentials.isEmpty()) { - return fail("请先配置云账号凭证",null); - } - - // 调用云厂商 API 获取存储桶信息 - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(resource.getProvider()); - Map bucketInfo = cloudProvider.getBucketInfo(resource, credentials); - - // 更新到数据库 - AppResource update = new AppResource(); - update.setResourceId(resourceId); - if (bucketInfo.get("usedBytes") != null) { - update.setUsedBytes(((Number) bucketInfo.get("usedBytes")).longValue()); - } - if (bucketInfo.get("objectCount") != null) { - update.setUsedCount(((Number) bucketInfo.get("objectCount")).intValue()); - } - appResourceService.updateById(update); - - return success(bucketInfo); - } catch (Exception e) { - log.error("刷新存储桶信息失败: resourceId={}, error={}", resourceId, e.getMessage(), e); - return fail("刷新失败: " + e.getMessage(), null); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppSettingController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppSettingController.java deleted file mode 100644 index 075decf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppSettingController.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.app.entity.AppSetting; -import com.gxwebsoft.app.param.AppSettingParam; -import com.gxwebsoft.app.service.AppSettingService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * 平台设置表 Controller - */ -@Slf4j -@Tag(name = "平台设置管理") -@RestController -@RequestMapping("/api/app/setting") -public class AppSettingController extends BaseController { - - @Resource - private AppSettingService appSettingService; - - /** - * 分页查询设置 - */ - @Operation(summary = "分页查询设置") - @GetMapping("/page") - public ApiResult> page(AppSettingParam param) { - return success(new PageResult<>(appSettingService.page(param))); - } - - /** - * 获取设置列表 - */ - @Operation(summary = "获取设置列表") - @GetMapping() - public ApiResult> list(AppSettingParam param) { - return success(appSettingService.list(param)); - } - - /** - * 根据分类获取设置 - */ - @Operation(summary = "根据分类获取设置") - @GetMapping("/category/{category}") - public ApiResult> getByCategory(@PathVariable String category) { - return success(appSettingService.getByCategory(category)); - } - - /** - * 获取分类设置值(Map格式) - */ - @Operation(summary = "获取分类设置值") - @GetMapping("/category/{category}/values") - public ApiResult> getCategoryValues(@PathVariable String category) { - return success(appSettingService.getCategoryValues(category)); - } - - /** - * 根据key获取单个设置值 - */ - @Operation(summary = "根据key获取设置值") - @GetMapping("/key/{key}") - public ApiResult getValue(@PathVariable String key) { - return success("获取成功", appSettingService.getValue(key)); - } - - /** - * 根据key获取完整设置 - */ - @Operation(summary = "根据key获取完整设置") - @GetMapping("/info/{key}") - public ApiResult getByKey(@PathVariable String key) { - return success(appSettingService.getByKey(key)); - } - - /** - * 保存或更新设置 - */ - @Operation(summary = "保存或更新设置") - @PostMapping() - public ApiResult save(@RequestBody AppSetting setting) { - appSettingService.saveOrUpdateSetting(setting); - return success("保存成功"); - } - - /** - * 更新设置 - */ - @Operation(summary = "更新设置") - @PutMapping() - public ApiResult update(@RequestBody AppSetting setting) { - appSettingService.saveOrUpdateSetting(setting); - return success("更新成功"); - } - - /** - * 批量保存分类设置 - */ - @Operation(summary = "批量保存分类设置") - @PostMapping("/batch/{category}") - public ApiResult batchSave(@PathVariable String category, @RequestBody Map values) { - // 处理值类型转换 - Map valuesMap = new java.util.HashMap<>(values.size()); - for (Map.Entry entry : values.entrySet()) { - Object val = entry.getValue(); - if (val == null) { - // 跳过 null 值 - continue; - } else if (val instanceof Boolean || val instanceof Number) { - // 保持原始类型(Boolean, Integer, Long, Double 等) - valuesMap.put(entry.getKey(), val); - } else if (val instanceof String) { - // 尝试将字符串转换为正确的类型 - String strVal = (String) val; - if ("true".equalsIgnoreCase(strVal)) { - valuesMap.put(entry.getKey(), Boolean.TRUE); - } else if ("false".equalsIgnoreCase(strVal)) { - valuesMap.put(entry.getKey(), Boolean.FALSE); - } else { - // 尝试转换为数字 - try { - if (strVal.contains(".")) { - valuesMap.put(entry.getKey(), Double.parseDouble(strVal)); - } else { - valuesMap.put(entry.getKey(), Long.parseLong(strVal)); - } - } catch (NumberFormatException e) { - // 保持字符串 - valuesMap.put(entry.getKey(), strVal); - } - } - } else if (val instanceof java.util.List) { - // List 类型保持不变(Jackson 已经正确处理了数组) - valuesMap.put(entry.getKey(), val); - } else { - valuesMap.put(entry.getKey(), val); - } - } - appSettingService.batchSave(category, valuesMap); - return success("保存成功"); - } - - /** - * 删除设置 - */ - @Operation(summary = "删除设置") - @DeleteMapping("/{settingId}") - public ApiResult delete(@PathVariable Integer settingId) { - appSettingService.removeById(settingId); - return success("删除成功"); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppSubscriptionController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppSubscriptionController.java deleted file mode 100644 index 95ba403..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppSubscriptionController.java +++ /dev/null @@ -1,593 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.gxwebsoft.app.config.AppPayProperties; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppSubscription; -import com.gxwebsoft.app.mapper.AppSubscriptionMapper; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.mapper.SysUserCrossDbMapper; -import com.gxwebsoft.app.utils.WxNativePayUtil; -import com.gxwebsoft.common.core.constants.BalanceConstants; -import com.gxwebsoft.common.core.utils.RedisUtil; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; - -import com.wechat.pay.java.core.Config; -import com.wechat.pay.java.service.payments.nativepay.NativePayService; -import com.wechat.pay.java.service.payments.nativepay.model.Amount; -import com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest; -import com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.*; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ThreadLocalRandom; - -/** - * 应用订阅控制器 - * 路径前缀:/api/app/subscription - */ -@Slf4j -@RestController -@RequestMapping("/api/app/subscription") -@RequiredArgsConstructor -@Tag(name = "应用订阅管理") -public class AppSubscriptionController extends BaseController { - - private final AppSubscriptionMapper subscriptionMapper; - private final AppProductMapper productMapper; - private final WxNativePayUtil wxNativePayUtil; - private final AppPayProperties appPayProperties; - private final SysUserCrossDbMapper sysUserCrossDbMapper; - - @javax.annotation.Resource - private RedisUtil redisUtil; - - @Value("${spring.profiles.active:dev}") - private String active; - - // ============================================================ - // 订阅操作 - // ============================================================ - - /** - * 创建订阅 - * 免费应用:直接激活 - * 付费应用:创建待支付记录 - */ - @PostMapping("/subscribe") - @Operation(summary = "创建订阅") - public Object subscribe(@RequestBody Map params) { - Object productIdObj = params.get("productId"); - if (productIdObj == null) { - return fail("productId 不能为空"); - } - String productIdStr = productIdObj.toString(); - if ("NaN".equals(productIdStr) || "null".equals(productIdStr) || "undefined".equals(productIdStr)) { - return fail("无效的应用ID,请刷新页面后重试"); - } - Integer productId; - try { - productId = Integer.valueOf(productIdStr); - } catch (NumberFormatException e) { - return fail("应用ID格式错误:" + productIdStr); - } - String subscriptionPeriod = (String) params.getOrDefault("subscriptionPeriod", "month"); - - Integer userId = getLoginUserId(); - if (userId == null) { - return fail("请先登录"); - } - - // 1. 查询产品信息 - AppProduct product = productMapper.selectById(productId); - if (product == null || !"published".equals(product.getPublishStatus())) { - return fail("应用不存在或未上架"); - } - - // 2. 检查是否已有 active 订阅(幂等) - LambdaQueryWrapper existQuery = new LambdaQueryWrapper<>(); - existQuery.eq(AppSubscription::getUserId, userId) - .eq(AppSubscription::getProductId, productId) - .eq(AppSubscription::getStatus, "active"); - if (subscriptionMapper.selectCount(existQuery) > 0) { - return fail("您已订阅该应用,无需重复购买"); - } - - // 3. 计算价格 - // app_product.price 单位为分(BigDecimal),转为元存到 app_subscription.pay_price - BigDecimal priceInYuan = BigDecimal.ZERO; - String priceType = product.getPriceType() != null ? product.getPriceType() : "free"; - if (!"free".equals(priceType) && product.getPrice() != null) { - // price 字段单位是分,除以 100 转为元 - priceInYuan = product.getPrice().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); - if ("subscription".equals(priceType) && "year".equals(subscriptionPeriod)) { - // 年付:按10个月价格 - priceInYuan = priceInYuan.multiply(BigDecimal.TEN); - } - } - - // 4. 创建订阅记录 - AppSubscription sub = new AppSubscription(); - sub.setSubscriptionNo(generateSubscriptionNo()); - sub.setUserId(userId); - sub.setProductId(productId); - sub.setTenantId(product.getTenantId()); - sub.setStatus("pending"); - sub.setPriceType(priceType); - sub.setOriginalPrice(priceInYuan); - sub.setPayPrice(priceInYuan); - sub.setPayStatus(0); - sub.setSubscriptionPeriod("subscription".equals(priceType) ? subscriptionPeriod : null); - - // 5. 免费应用直接激活 - boolean isFree = "free".equals(priceType) || priceInYuan.compareTo(BigDecimal.ZERO) == 0; - if (isFree) { - sub.setStatus("active"); - sub.setPayStatus(1); - sub.setPayType(12); // 免费标记 - sub.setPayTime(LocalDateTime.now()); - sub.setStartTime(LocalDateTime.now()); - - if ("subscription".equals(priceType)) { - int months = "year".equals(subscriptionPeriod) ? 12 : 1; - sub.setExpireTime(LocalDateTime.now().plusMonths(months)); - } - - // 更新产品安装量 - product.setInstalls((product.getInstalls() != null ? product.getInstalls() : 0) + 1); - productMapper.updateById(product); - } - - subscriptionMapper.insert(sub); - - // 6. 返回结果 - Map result = new HashMap<>(); - result.put("subscriptionId", sub.getId()); - result.put("subscriptionNo", sub.getSubscriptionNo()); - result.put("status", sub.getStatus()); - result.put("message", isFree ? "订阅成功" : "请完成支付"); - - if (!isFree) { - result.put("payPrice", sub.getPayPrice()); - // TODO: 对接现有支付系统,创建支付订单并返回 orderNo - // result.put("orderNo", payService.createOrder(sub)); - } - - return success(result); - } - - /** - * 获取当前用户余额 - */ - @GetMapping("/balance") - @Operation(summary = "获取用户余额") - public Object getBalance() { - Integer userId = getLoginUserId(); - if (userId == null) { - return fail("请先登录"); - } - // 跨库查询 gxwebsoft_core.sys_user - User freshUser = sysUserCrossDbMapper.selectByUserId(userId); - BigDecimal balance = freshUser != null && freshUser.getBalance() != null - ? freshUser.getBalance() : BigDecimal.ZERO; - Map result = new HashMap<>(); - result.put("balance", balance); - return success(result); - } - - /** - * 余额支付 - * POST /api/app/subscription/pay/{id}?method=balance - */ - @PostMapping("/pay/{id}") - @Operation(summary = "发起支付") - public Object pay(@PathVariable Long id, @RequestParam(defaultValue = "wechat") String method) { - AppSubscription sub = subscriptionMapper.selectById(id); - if (sub == null) { - return fail("订阅不存在"); - } - - Integer userId = getLoginUserId(); - if (userId == null || !userId.equals(sub.getUserId())) { - return fail("无权操作"); - } - - if ("active".equals(sub.getStatus())) { - return fail("该订阅已激活"); - } - - // 免费应用走激活流程 - if (sub.getPayPrice() == null || sub.getPayPrice().compareTo(BigDecimal.ZERO) == 0) { - return fail("该应用为免费应用,无需支付"); - } - - // 余额支付 - if ("balance".equals(method)) { - return handleBalancePay(sub); - } - - // 微信 Native 支付 - return handleWechatPay(sub); - } - - /** - * 余额支付处理 - */ - private Object handleBalancePay(AppSubscription sub) { - Integer userId = getLoginUserId(); - - // 跨库查询用户最新余额(gxwebsoft_core.sys_user) - User user = sysUserCrossDbMapper.selectByUserId(userId); - if (user == null) { - return fail("用户不存在"); - } - - BigDecimal currentBalance = user.getBalance() != null ? user.getBalance() : BigDecimal.ZERO; - BigDecimal payPrice = sub.getPayPrice(); - - // 检查余额是否充足 - if (currentBalance.compareTo(payPrice) < 0) { - return fail("余额不足,当前余额:" + currentBalance + " 元,需要:" + payPrice + " 元"); - } - - // 扣除余额(跨库更新 gxwebsoft_core.sys_user) - BigDecimal newBalance = currentBalance.subtract(payPrice); - int updated = sysUserCrossDbMapper.updateBalance(userId, newBalance); - if (updated <= 0) { - return fail("余额扣除失败"); - } - - // 记录余额变动日志(跨库插入 gxwebsoft_core.sys_user_balance_log) - sysUserCrossDbMapper.insertBalanceLog( - userId, - BalanceConstants.BALANCE_USE, - payPrice, - newBalance, - sub.getSubscriptionNo(), - "应用订阅:" + sub.getProductName(), - user.getTenantId() - ); - - // 激活订阅 - sub.setStatus("active"); - sub.setPayStatus(1); - sub.setPayType(0); // 0-余额支付 - sub.setPayTime(LocalDateTime.now()); - sub.setStartTime(LocalDateTime.now()); - - if ("subscription".equals(sub.getPriceType())) { - int months = "year".equals(sub.getSubscriptionPeriod()) ? 12 : 1; - sub.setExpireTime(LocalDateTime.now().plusMonths(months)); - } - - subscriptionMapper.updateById(sub); - - // 更新产品安装量 - AppProduct product = productMapper.selectById(sub.getProductId()); - if (product != null) { - product.setInstalls((product.getInstalls() != null ? product.getInstalls() : 0) + 1); - productMapper.updateById(product); - } - - // 写入 Redis 标记(兼容轮询) - redisUtil.set("wxpay:paid:" + sub.getSubscriptionNo(), "1", 30L, java.util.concurrent.TimeUnit.MINUTES); - - log.info("余额支付成功 — subscriptionNo: {}, userId: {}, amount: {}, remainingBalance: {}", - sub.getSubscriptionNo(), userId, payPrice, newBalance); - - Map result = new HashMap<>(); - result.put("paid", true); - result.put("balance", newBalance); - result.put("subscriptionNo", sub.getSubscriptionNo()); - return success(result); - } - - /** - * 微信 Native 支付处理 - */ - private Object handleWechatPay(AppSubscription sub) { - // 查询产品名称作为支付描述 - AppProduct product = productMapper.selectById(sub.getProductId()); - String productName = product != null ? product.getProductName() : "应用订阅"; - - // 金额:元转分 - BigDecimal payPriceYuan = sub.getPayPrice(); - int totalFee = payPriceYuan.multiply(new BigDecimal(100)).intValue(); - if (totalFee < 1) { - totalFee = 1; // 微信最低1分 - } - - log.info("========== 微信 Native 支付请求 =========="); - log.info("商户号: {}", appPayProperties.getMchId()); - log.info("AppID: {}", appPayProperties.getAppId()); - log.info("订单号: {}", sub.getSubscriptionNo()); - log.info("商品描述: {}", productName); - log.info("支付金额(分): {}", totalFee); - log.info("回调地址: {}", appPayProperties.getNotifyUrl()); - log.info("=========================================="); - - try { - Config config = wxNativePayUtil.getConfig(appPayProperties); - NativePayService payService = new NativePayService.Builder().config(config).build(); - - PrepayRequest request = new PrepayRequest(); - request.setAppid(appPayProperties.getAppId()); - request.setMchid(appPayProperties.getMchId()); - request.setOutTradeNo(sub.getSubscriptionNo()); - request.setDescription(productName); - request.setNotifyUrl(appPayProperties.getNotifyUrl()); - - Amount amount = new Amount(); - amount.setTotal(totalFee); - request.setAmount(amount); - - PrepayResponse response = payService.prepay(request); - String codeUrl = response.getCodeUrl(); - - log.info("微信 Native 支付下单成功 — subscriptionNo: {}, codeUrl: {}", sub.getSubscriptionNo(), codeUrl); - - Map result = new HashMap<>(); - result.put("subscriptionId", sub.getId()); - result.put("subscriptionNo", sub.getSubscriptionNo()); - result.put("codeUrl", codeUrl); - result.put("payPrice", payPriceYuan); - return success(result); - - } catch (Exception e) { - log.error("========== 微信支付下单失败 =========="); - log.error("商户号: {}", appPayProperties.getMchId()); - log.error("AppID: {}", appPayProperties.getAppId()); - log.error("订单号: {}", sub.getSubscriptionNo()); - log.error("错误类型: {}", e.getClass().getName()); - log.error("错误信息: {}", e.getMessage()); - - if (e instanceof com.wechat.pay.java.core.exception.ServiceException) { - com.wechat.pay.java.core.exception.ServiceException wechatEx = - (com.wechat.pay.java.core.exception.ServiceException) e; - log.error("微信错误码: {}", wechatEx.getErrorCode()); - log.error("微信错误信息: {}", wechatEx.getErrorMessage()); - } - log.error("=========================================="); - - // 测试模式:返回模拟二维码 - if (appPayProperties.isEnabled() && !appPayProperties.isTestMode()) { - return fail("微信支付服务异常,请稍后重试"); - } - - // 测试模式返回可展示的 mock URL - String mockCodeUrl = "weixin://wxpay/bizpayurl?pr=TEST" + System.currentTimeMillis(); - Map result = new HashMap<>(); - result.put("subscriptionId", sub.getId()); - result.put("subscriptionNo", sub.getSubscriptionNo()); - result.put("codeUrl", mockCodeUrl); - result.put("payPrice", payPriceYuan); - result.put("_testMode", true); - return success(result); - } - } - - // ============================================================ - // 我的订阅 - // ============================================================ - - /** - * 我的订阅列表(分页) - */ - @GetMapping("/my/page") - @Operation(summary = "我的订阅列表") - public Object myPage( - @RequestParam(defaultValue = "1") Integer page, - @RequestParam(defaultValue = "10") Integer limit, - @RequestParam(required = false) String status) { - - Integer userId = getLoginUserId(); - if (userId == null) { - return success(new Page()); - } - - Page pageParam = new Page<>(page, limit); - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(AppSubscription::getUserId, userId); - if (status != null && !status.isEmpty()) { - query.eq(AppSubscription::getStatus, status); - } - query.orderByDesc(AppSubscription::getCreateTime); - - Page pageResult = subscriptionMapper.selectPage(pageParam, query); - - // 填充产品信息(TODO: 后续改为 LEFT JOIN 优化) - pageResult.getRecords().forEach(sub -> { - AppProduct product = productMapper.selectById(sub.getProductId()); - if (product != null) { - sub.setProductName(product.getProductName()); - sub.setProductLogo(product.getLogo()); - sub.setProductIcon(product.getIcon()); - sub.setProductAppType(product.getAppType()); - sub.setProductDescription(product.getDescription()); - } - }); - - return success(pageResult); - } - - /** - * 订阅详情 - */ - @GetMapping("/detail/{id}") - @Operation(summary = "订阅详情") - public Object detail(@PathVariable Long id) { - AppSubscription sub = subscriptionMapper.selectById(id); - if (sub == null) { - return fail("订阅不存在"); - } - - AppProduct product = productMapper.selectById(sub.getProductId()); - if (product != null) { - sub.setProductName(product.getProductName()); - sub.setProductLogo(product.getLogo()); - sub.setProductIcon(product.getIcon()); - sub.setProductAppType(product.getAppType()); - } - - return success(sub); - } - - // ============================================================ - // 订阅管理 - // ============================================================ - - /** - * 续费 - */ - @PostMapping("/renew/{id}") - @Operation(summary = "续费") - public Object renew(@PathVariable Long id, - @RequestParam(defaultValue = "month") String period) { - AppSubscription sub = subscriptionMapper.selectById(id); - if (sub == null) return fail("订阅不存在"); - - Integer userId = getLoginUserId(); - if (userId == null || !userId.equals(sub.getUserId())) return fail("无权操作"); - - int months = "year".equals(period) ? 12 : 1; - if ("active".equals(sub.getStatus()) && sub.getExpireTime() != null) { - sub.setExpireTime(sub.getExpireTime().plusMonths(months)); - } else { - sub.setExpireTime(LocalDateTime.now().plusMonths(months)); - } - sub.setStatus("active"); - subscriptionMapper.updateById(sub); - return success("续费成功"); - } - - /** - * 退订/取消 - */ - @PostMapping("/cancel/{id}") - @Operation(summary = "退订") - public Object cancel(@PathVariable Long id) { - AppSubscription sub = subscriptionMapper.selectById(id); - if (sub == null) return fail("订阅不存在"); - - Integer userId = getLoginUserId(); - if (userId == null || !userId.equals(sub.getUserId())) return fail("无权操作"); - - sub.setStatus("cancelled"); - subscriptionMapper.updateById(sub); - return success("退订成功"); - } - - /** - * 启用/禁用 - */ - @PostMapping("/toggle-enable/{id}") - @Operation(summary = "启用/禁用") - public Object toggleEnable(@PathVariable Long id, @RequestParam Boolean enabled) { - AppSubscription sub = subscriptionMapper.selectById(id); - if (sub == null) return fail("订阅不存在"); - - Integer userId = getLoginUserId(); - if (userId == null || !userId.equals(sub.getUserId())) return fail("无权操作"); - - if (enabled) { - if ("expired".equals(sub.getStatus()) || - (sub.getExpireTime() != null && sub.getExpireTime().isBefore(LocalDateTime.now()))) { - return fail("订阅已过期,请先续费"); - } - sub.setStatus("active"); - } else { - sub.setStatus("cancelled"); - } - - subscriptionMapper.updateById(sub); - return success(enabled ? "已启用" : "已禁用"); - } - - // ============================================================ - // 查询 - // ============================================================ - - /** - * 查询支付状态(前端轮询用) - * 优先查 Redis(回调写入,加速感知),再查数据库兜底 - */ - @GetMapping("/check-status/{subscriptionNo}") - @Operation(summary = "查询支付状态") - public Object checkStatus(@PathVariable String subscriptionNo) { - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(AppSubscription::getSubscriptionNo, subscriptionNo); - AppSubscription sub = subscriptionMapper.selectOne(query); - - if (sub == null) { - return fail("订阅不存在"); - } - - // 优先检查 Redis 支付标记(微信回调写入,加速前端轮询感知) - boolean paidViaRedis = "1".equals(redisUtil.get("wxpay:paid:" + subscriptionNo)); - boolean paidViaDb = sub.getPayStatus() != null && sub.getPayStatus() == 1; - boolean isPaid = paidViaRedis || paidViaDb; - - // 补全产品信息 - AppProduct product = productMapper.selectById(sub.getProductId()); - if (product != null) { - sub.setProductName(product.getProductName()); - sub.setProductLogo(product.getLogo()); - sub.setProductIcon(product.getIcon()); - } - - Map result = new HashMap<>(); - result.put("paid", isPaid); - result.put("payStatus", sub.getPayStatus()); - result.put("status", sub.getStatus()); - result.put("payTime", sub.getPayTime()); - result.put("transactionId", sub.getTransactionId()); - // 补全订单详情字段,前端支付页可直接使用 - result.put("id", sub.getId()); - result.put("subscriptionNo", sub.getSubscriptionNo()); - result.put("productId", sub.getProductId()); - result.put("productName", sub.getProductName()); - result.put("productLogo", sub.getProductLogo()); - result.put("priceType", sub.getPriceType()); - result.put("payPrice", sub.getPayPrice()); - result.put("subscriptionPeriod", sub.getSubscriptionPeriod()); - return success(result); - } - - /** - * 检查是否已购买某应用 - */ - @GetMapping("/check-purchased/{productId}") - @Operation(summary = "检查是否已购买") - public Object checkPurchased(@PathVariable Integer productId) { - Integer userId = getLoginUserId(); - if (userId == null) return success(false); - - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(AppSubscription::getUserId, userId) - .eq(AppSubscription::getProductId, productId) - .in(AppSubscription::getStatus, "active", "pending"); - return success(subscriptionMapper.selectCount(query) > 0); - } - - // ============================================================ - // 内部方法 - // ============================================================ - - private String generateSubscriptionNo() { - String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); - int random = ThreadLocalRandom.current().nextInt(1000, 9999); - return "SUB" + date + random; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppTicketController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppTicketController.java deleted file mode 100644 index 84ae5a8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppTicketController.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppTicket; -import com.gxwebsoft.app.entity.AppTicketReply; -import com.gxwebsoft.app.param.AppTicketParam; -import com.gxwebsoft.app.service.AppProductService; -import com.gxwebsoft.app.service.AppTicketService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 应用工单控制器 - * - * @author 科技小王子 - * @since 2026-03-30 - */ -@Slf4j -@Tag(name = "应用工单管理") -@RestController -@RequestMapping("/api/app/ticket") -public class AppTicketController extends BaseController { - - @Resource - private AppTicketService appTicketService; - - @Resource - private AppProductService appProductService; - - // ─── 客户端接口 ──────────────────────────────────────────────── - - @Operation(summary = "查询我的工单(分页)") - @GetMapping("/my") - public ApiResult> myTickets(AppTicketParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录",null); - return success(appTicketService.myPage(param, loginUser.getUserId())); - } - - @Operation(summary = "提交工单") - @PostMapping("/submit") - public ApiResult submit(@RequestBody AppTicket ticket) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录",null); - try { - AppTicket result = appTicketService.submit(ticket, loginUser.getUserId()); - return success("工单提交成功", result); - } catch (Exception e) { - return fail(e.getMessage(),null); - } - } - - @Operation(summary = "关闭工单(提交人)") - @PutMapping("/{ticketId}/close") - public ApiResult close(@PathVariable Long ticketId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - try { - appTicketService.closeByUser(ticketId, loginUser.getUserId()); - return success("工单已关闭"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - // ─── 技术端接口 ──────────────────────────────────────────────── - - @Operation(summary = "查询所有工单(技术人员)") - @GetMapping("/list") - public ApiResult> allTickets(AppTicketParam param) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录",null); - // 按用户有权限的应用过滤工单(看到的工单限于自己参与的应用) - List accessibleApps = appProductService.getAccessibleApps(loginUser.getUserId()); - if (accessibleApps != null && !accessibleApps.isEmpty()) { - param.setAppIds(accessibleApps.stream().map(AppProduct::getProductId).collect(Collectors.toList())); - } - return success(appTicketService.allPage(param)); - } - - @Operation(summary = "获取工单详情") - @GetMapping("/{ticketId}") - public ApiResult detail(@PathVariable Long ticketId) { - return success(appTicketService.getById(ticketId)); - } - - @Operation(summary = "更新工单状态(技术人员)") - @PutMapping("/status") - public ApiResult updateStatus(@RequestBody Map body) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - Long ticketId = Long.valueOf(body.get("ticketId").toString()); - String status = body.get("status").toString(); - appTicketService.updateStatus(ticketId, status, loginUser.getUserId()); - return success("状态已更新"); - } - - @Operation(summary = "分配处理人(管理员)") - @PutMapping("/assign") - public ApiResult assign(@RequestBody Map body) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - Long ticketId = Long.valueOf(body.get("ticketId").toString()); - Integer assigneeId = Integer.valueOf(body.get("assigneeId").toString()); - appTicketService.assign(ticketId, assigneeId); - return success("分配成功"); - } - - // ─── 回复接口 ───────────────────────────────────────────────── - - @Operation(summary = "获取工单回复列表") - @GetMapping("/{ticketId}/replies") - public ApiResult> replies(@PathVariable Long ticketId) { - return success(appTicketService.getReplies(ticketId)); - } - - @Operation(summary = "提交工单回复") - @PostMapping("/reply") - public ApiResult reply(@RequestBody AppTicketReply reply) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录",null); - if (reply.getContent() == null || reply.getContent().trim().isEmpty()) { - return fail("回复内容不能为空",null); - } - try { - AppTicketReply result = appTicketService.addReply(reply, loginUser.getUserId()); - return success("回复成功", result); - } catch (Exception e) { - return fail(e.getMessage(),null); - } - } - - // ─── 统计 & 辅助 ───────────────────────────────────────────── - - @Operation(summary = "工单统计数据") - @GetMapping("/stats") - public ApiResult> stats( - @RequestParam(required = false) Long appId) { - User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录",null); - // 技术端不限制用户维度;客户端通过路由区分 - return success(appTicketService.stats(appId, null)); - } - - @Operation(summary = "获取技术人员列表(用于分配)") - @GetMapping("/staff-list") - public ApiResult>> staffList() { - return success(appTicketService.getTechStaffList()); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppUserController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppUserController.java deleted file mode 100644 index 98b9a9c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppUserController.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.app.service.AppUserService; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.param.AppUserParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.app.mapper.SysUserCrossDbMapper; -import com.gxwebsoft.app.mapper.AppUserMapper; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.*; - -/** - * 应用成员控制器 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Tag(name = "应用成员管理") -@RestController -@RequestMapping("/api/app/app-user") -public class AppUserController extends BaseController { - - @Resource - private AppUserService appUserService; - - @Resource - private SysUserCrossDbMapper sysUserCrossDbMapper; - - @Resource - private AppUserMapper appUserMapper; - - @Operation(summary = "分页查询应用成员") - @GetMapping("/page") - public ApiResult> page(AppUserParam param) { - return success(appUserService.pageRel(param)); - } - - @Operation(summary = "查询全部应用成员") - @GetMapping() - public ApiResult> list(AppUserParam param) { - return success(appUserService.listRel(param)); - } - - @Operation(summary = "根据id查询应用成员") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - return success(appUserService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('app:appUser:save')") - @OperationLog - @Operation(summary = "添加应用成员(手动添加)") - @PostMapping() - public ApiResult save(@RequestBody AppUser appUser) { - User loginUser = getLoginUser(); - if (loginUser != null) { - appUser.setUserId(loginUser.getUserId()); - appUser.setTenantId(loginUser.getTenantId()); - } - if (appUserService.save(appUser)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "邀请用户成为应用成员(支持用户ID或手机号)") - @PostMapping("/invite") - public ApiResult invite(@RequestBody AppUser appUser) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - // 支持手机号邀请:若 userId 为空但传了 phone,则先按手机号查出用户 - if (appUser.getUserId() == null && appUser.getPhone() != null && !appUser.getPhone().isEmpty()) { - User targetUser = appUserService.findUserByPhone(appUser.getPhone()); - if (targetUser == null) { - return fail("手机号未注册,请确认后再试"); - } - appUser.setUserId(targetUser.getUserId()); - } - if (appUser.getUserId() == null) { - return fail("请输入用户ID或手机号"); - } - try { - AppUser result = appUserService.inviteUser( - appUser.getAppId(), - appUser.getUserId(), - appUser.getRole(), - loginUser.getUserId(), - loginUser.getTenantId() - ); - return success("邀请成功", result); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('app:appUser:update')") - @OperationLog - @Operation(summary = "修改应用成员信息") - @PutMapping() - public ApiResult update(@RequestBody AppUser appUser) { - if (appUserService.updateById(appUser)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appUser:update')") - @OperationLog - @Operation(summary = "修改成员角色") - @PutMapping("/role/{id}/{role}") - public ApiResult updateRole(@PathVariable("id") Long id, @PathVariable("role") String role) { - if (appUserService.updateRole(id, role)) { - return success("角色修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appUser:remove')") - @OperationLog - @Operation(summary = "移除应用成员") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (appUserService.removeById(id)) { - return success("已移除"); - } - return fail("移除失败"); - } - - @PreAuthorize("hasAuthority('app:appUser:save')") - @OperationLog - @Operation(summary = "批量添加应用成员") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (appUserService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('app:appUser:update')") - @OperationLog - @Operation(summary = "批量修改应用成员") - @PutMapping("/batch") - public ApiResult updateBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(appUserService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appUser:remove')") - @OperationLog - @Operation(summary = "批量移除应用成员") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (appUserService.removeByIds(ids)) { - return success("移除成功"); - } - return fail("移除失败"); - } - - @Operation(summary = "搜索用户(用于邀请成员,支持手机号/用户名/昵称模糊搜索)") - @GetMapping("/search") - public ApiResult> searchUsers(@RequestParam("keyword") String keyword) { - if (keyword == null || keyword.trim().isEmpty()) { - return success(Collections.emptyList()); - } - List users = appUserService.searchUsers(keyword.trim()); - return success(users); - } - - // ============ 邀请确认相关接口 ============ - - @Operation(summary = "查询当前用户的待确认邀请列表") - @GetMapping("/invites/pending") - public ApiResult> listPendingInvites() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录",null); - } - return success(appUserService.listPendingInvites(loginUser.getUserId())); - } - - @Operation(summary = "统计当前用户的待确认邀请数量") - @GetMapping("/invites/pending/count") - public ApiResult> countPendingInvites() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return success(Map.of("count", 0L)); - } - long count = appUserService.countPendingInvites(loginUser.getUserId()); - return success(Map.of("count", count)); - } - - @Operation(summary = "接受邀请加入应用") - @PostMapping("/invites/{inviteId}/accept") - public ApiResult acceptInvite(@PathVariable("inviteId") Long inviteId) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - if (appUserService.acceptInvite(inviteId, loginUser.getUserId())) { - return success("已接受邀请,加入应用成功"); - } - return fail("接受邀请失败"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - @Operation(summary = "拒绝邀请") - @PostMapping("/invites/{inviteId}/reject") - public ApiResult rejectInvite(@PathVariable("inviteId") Long inviteId) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - if (appUserService.rejectInvite(inviteId, loginUser.getUserId())) { - return success("已拒绝邀请"); - } - return fail("拒绝邀请失败"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - // ============ 权限检查接口 ============ - - /** - * 检查当前用户是否有开发者中心访问权限 - * 判断逻辑: - * 1. sys_user.type === 2 → 平台开发者,直接放行 - * 2. 在 app_user 表中有成员记录 → 协作成员,放行 - * 3. 创建过应用(app_product.user_id) → 自动有权限 - * 返回:accessible, isPlatformDeveloper, apps(可访问应用列表及角色) - */ - @Operation(summary = "检查开发者中心访问权限") - @GetMapping("/check-access") - public ApiResult> checkAccess() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return success(Map.of( - "accessible", false, - "isPlatformDeveloper", false, - "hasJoinedApps", false - )); - } - - Integer userId = loginUser.getUserId(); - - // 1. 判断是否平台级开发者(type === 2) - boolean isPlatformDeveloper = false; - try { - Integer userType = sysUserCrossDbMapper.selectUserType(userId); - isPlatformDeveloper = userType != null && userType == 2; - } catch (Exception e) { - log.warn("查询用户类型失败,userId={}, error={}", userId, e.getMessage()); - } - - // 2. 查询用户参与的应用(创建的 + 被邀请的) - List> apps = appUserMapper.selectUserAccessibleApps(userId); - boolean hasJoinedApps = apps != null && !apps.isEmpty(); - - // 3. 平台开发者 或 有参与的应用 → 可访问 - boolean accessible = isPlatformDeveloper || hasJoinedApps; - - // 4. 构建返回结果 - Map result = new LinkedHashMap<>(); - result.put("accessible", accessible); - result.put("isPlatformDeveloper", isPlatformDeveloper); - result.put("hasJoinedApps", hasJoinedApps); - result.put("apps", apps != null ? apps : Collections.emptyList()); - - return success(result); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppUserSyncController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppUserSyncController.java deleted file mode 100644 index 066a953..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppUserSyncController.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.List; - -/** - * 用户同步控制器(供 server 端调用) - * - * @author WebSoft - * @since 2026-04-04 - */ -@Slf4j -@Tag(name = "用户同步(server 端调用)") -@RestController -@RequestMapping("/api/app/user-sync") -public class AppUserSyncController extends BaseController { - - @Resource - private AppUserCacheService appUserCacheService; - - /** - * 同步单个用户到缓存表 - * 供 server 端用户注册成功后调用 - */ - @Operation(summary = "同步单个用户(server 端调用)") - @PostMapping("/single") - public ApiResult syncSingleUser(@RequestBody AppUserCache userCache) { - log.info("收到用户同步请求: userId={}, username={}, nickname={}, phone={}, tenantId={}", - userCache.getUserId(), userCache.getUsername(), userCache.getNickname(), userCache.getPhone(), userCache.getTenantId()); - - if (userCache.getUserId() == null) { - return fail("userId 不能为空"); - } - - if (userCache.getTenantId() == null) { - return fail("tenantId 不能为空"); - } - - try { - // 设置更新时间(如果为空) - if (userCache.getUpdateTime() == null) { - userCache.setUpdateTime(LocalDateTime.now()); - } - - // 直接保存或更新缓存 - boolean result = appUserCacheService.saveOrUpdate(userCache); - if (result) { - log.info("用户同步成功: userId={}, username={}, tenantId={}", userCache.getUserId(), userCache.getUsername(), userCache.getTenantId()); - } else { - log.warn("用户同步返回失败: userId={}", userCache.getUserId()); - } - return success("同步成功"); - } catch (Exception e) { - log.error("用户同步失败: userId={}, error={}", userCache.getUserId(), e.getMessage(), e); - return fail("同步失败: " + e.getMessage()); - } - } - - /** - * 批量同步用户到缓存表 - */ - @Operation(summary = "批量同步用户(server 端调用)") - @PostMapping("/batch") - public ApiResult syncBatchUsers(@RequestBody List userCaches) { - log.info("收到批量用户同步请求: count={}", userCaches.size()); - - if (userCaches.isEmpty()) { - return fail("用户列表不能为空"); - } - - // 校验每个用户数据 - for (AppUserCache userCache : userCaches) { - if (userCache.getUserId() == null) { - return fail("用户列表中存在 userId 为空的记录"); - } - if (userCache.getTenantId() == null) { - return fail("用户列表中存在 tenantId 为空的记录,userId=" + userCache.getUserId()); - } - } - - try { - appUserCacheService.saveOrUpdateBatch(userCaches); - log.info("批量用户同步成功: count={}", userCaches.size()); - return success("批量同步成功"); - } catch (Exception e) { - log.error("批量用户同步失败: error={}", e.getMessage()); - return fail("批量同步失败: " + e.getMessage()); - } - } - - /** - * 根据 userId 刷新用户缓存 - * server 端可以只传 userId,websopy 端通过 API 回查 server 获取完整信息 - */ - @Operation(summary = "刷新用户缓存(server 端调用)") - @PostMapping("/refresh/{userId}") - public ApiResult refreshUserCache(@PathVariable("userId") Integer userId) { - log.info("收到刷新用户缓存请求: userId={}", userId); - - if (userId == null) { - return fail("userId 不能为空"); - } - - try { - appUserCacheService.refreshUserCache(userId); - log.info("用户缓存刷新成功: userId={}", userId); - return success("刷新成功"); - } catch (Exception e) { - log.error("用户缓存刷新失败: userId={}, error={}", userId, e.getMessage()); - return fail("刷新失败: " + e.getMessage()); - } - } - - /** - * 删除用户缓存 - * 供 server 端删除用户时调用,同步删除本地缓存 - */ - @Operation(summary = "删除用户缓存(server 端调用)") - @PostMapping("/delete/{userId}") - public ApiResult deleteUserCache(@PathVariable("userId") Integer userId) { - log.info("收到删除用户缓存请求: userId={}", userId); - - if (userId == null) { - return fail("userId 不能为空"); - } - - try { - boolean result = appUserCacheService.removeById(userId); - if (result) { - log.info("用户缓存删除成功: userId={}", userId); - return success("删除成功"); - } else { - log.warn("用户缓存删除失败或用户不存在: userId={}", userId); - return success("用户不存在或已删除"); - } - } catch (Exception e) { - log.error("用户缓存删除失败: userId={}, error={}", userId, e.getMessage()); - return fail("删除失败: " + e.getMessage()); - } - } - - /** - * 批量删除用户缓存 - * 供 server 端批量删除用户时调用 - */ - @Operation(summary = "批量删除用户缓存(server 端调用)") - @PostMapping("/delete/batch") - public ApiResult deleteBatchUserCache(@RequestBody List userIds) { - log.info("收到批量删除用户缓存请求: count={}", userIds.size()); - - if (userIds == null || userIds.isEmpty()) { - return fail("userId 列表不能为空"); - } - - try { - boolean result = appUserCacheService.removeByIds(userIds); - if (result) { - log.info("批量用户缓存删除成功: count={}", userIds.size()); - return success("批量删除成功"); - } else { - log.warn("批量用户缓存删除失败: count={}", userIds.size()); - return success("删除失败或用户不存在"); - } - } catch (Exception e) { - log.error("批量用户缓存删除失败: error={}", e.getMessage()); - return fail("批量删除失败: " + e.getMessage()); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppVersionController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppVersionController.java deleted file mode 100644 index 4b33348..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppVersionController.java +++ /dev/null @@ -1,173 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.app.service.AppVersionService; -import com.gxwebsoft.app.entity.AppVersion; -import com.gxwebsoft.app.param.AppVersionParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 应用版本发布记录控制器 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Tag(name = "应用版本发布管理") -@RestController -@RequestMapping("/api/app/app-version") -public class AppVersionController extends BaseController { - - @Resource - private AppVersionService appVersionService; - - @Operation(summary = "分页查询版本记录") - @GetMapping("/page") - public ApiResult> page(AppVersionParam param) { - return success(appVersionService.pageRel(param)); - } - - @Operation(summary = "查询全部版本记录") - @GetMapping() - public ApiResult> list(AppVersionParam param) { - return success(appVersionService.listRel(param)); - } - - @Operation(summary = "根据id查询版本") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - return success(appVersionService.getByIdRel(id)); - } - - @Operation(summary = "获取应用当前版本") - @GetMapping("/current/{appId}") - public ApiResult getCurrentVersion(@PathVariable("appId") Long appId) { - return success(appVersionService.getCurrentVersion(appId)); - } - - @PreAuthorize("hasAuthority('app:appVersion:save')") - @OperationLog - @Operation(summary = "新增版本(构建中状态)") - @PostMapping() - public ApiResult save(@RequestBody AppVersion appVersion) { - User loginUser = getLoginUser(); - if (loginUser != null) { - appVersion.setUserId(loginUser.getUserId()); - appVersion.setTenantId(loginUser.getTenantId()); - } - // 默认为构建中状态 - if (appVersion.getStatus() == null) { - appVersion.setStatus(0); - } - if (appVersion.getEnv() == null) { - appVersion.setEnv("production"); - } - appVersion.setIsCurrent(false); - if (appVersionService.save(appVersion)) { - return success("创建成功"); - } - return fail("创建失败"); - } - - @PreAuthorize("hasAuthority('app:appVersion:update')") - @OperationLog - @Operation(summary = "修改版本信息") - @PutMapping() - public ApiResult update(@RequestBody AppVersion appVersion) { - if (appVersionService.updateById(appVersion)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appVersion:update')") - @OperationLog - @Operation(summary = "发布版本(将此版本设为当前运行版本)") - @PostMapping("/publish/{id}") - public ApiResult publish(@PathVariable("id") Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - appVersionService.publish(id, loginUser.getUserId()); - return success("发布成功"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('app:appVersion:update')") - @OperationLog - @Operation(summary = "回滚到指定版本") - @PostMapping("/rollback/{id}") - public ApiResult rollback(@PathVariable("id") Long id) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - appVersionService.rollback(id, loginUser.getUserId()); - return success("回滚成功"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('app:appVersion:remove')") - @OperationLog - @Operation(summary = "删除版本记录") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (appVersionService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('app:appVersion:save')") - @OperationLog - @Operation(summary = "批量添加版本") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (appVersionService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('app:appVersion:update')") - @OperationLog - @Operation(summary = "批量修改版本") - @PutMapping("/batch") - public ApiResult updateBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(appVersionService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('app:appVersion:remove')") - @OperationLog - @Operation(summary = "批量删除版本记录") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (appVersionService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppWxPayController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppWxPayController.java deleted file mode 100644 index b1786a9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/AppWxPayController.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.app.config.AppPayProperties; -import com.gxwebsoft.app.entity.AppSubscription; -import com.gxwebsoft.app.mapper.AppSubscriptionMapper; -import com.gxwebsoft.common.core.utils.RedisUtil; -import com.wechat.pay.java.core.cipher.AeadAesCipher; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.util.Base64Utils; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.time.Duration; -import java.time.LocalDateTime; - -/** - * 微信支付回调通知处理 - * 路径:POST /api/app/subscription/wx-notify - * 由微信支付服务器主动调用(Native 扫码支付成功后会回调此地址) - *

- * 注意:前端同时在轮询 check-status 接口,回调只是加速状态更新。 - * 即使回调失败,前端轮询也能在 3s 内查到已支付状态。 - */ -@Slf4j -@RestController -@RequestMapping("/api/app/subscription") -@RequiredArgsConstructor -@Tag(name = "微信支付回调") -public class AppWxPayController { - - @Resource - private AppSubscriptionMapper subscriptionMapper; - @Resource - private RedisUtil redisUtil; - @Resource - private AppPayProperties appPayProperties; - - @Value("${spring.profiles.active:dev}") - private String active; - - /** - * 微信 Native 支付回调通知 - * 微信支付成功后会 POST JSON 到此地址 - */ - @PostMapping("/wx-notify") - @Operation(summary = "微信支付回调通知") - public String wxNotify( - @RequestHeader(value = "Wechatpay-Serial", required = false) String serialNumber, - @RequestHeader(value = "Wechatpay-Nonce", required = false) String nonce, - @RequestHeader(value = "Wechatpay-Signature", required = false) String signature, - @RequestHeader(value = "Wechatpay-Timestamp", required = false) String timestamp, - @RequestBody String body - ) { - log.info("收到微信支付回调 — headers: serial={}, timestamp={}, body={}", serialNumber, timestamp, body); - - try { - // 1. 解析通知(解密报文体) - JSONObject notification = parseNotification(body); - if (notification == null) { - log.error("通知解析失败"); - return failResult("notification parse failed"); - } - - // 2. 提取关键字段 - String eventType = notification.getString("event_type"); - JSONObject resource = notification.getJSONObject("resource"); - if (resource == null) { - log.error("通知报文体中无 resource 字段"); - return failResult("no resource"); - } - - // 解密资源 - String ciphertext = resource.getString("ciphertext"); - String nonceStr = resource.getString("nonce"); - String associatedData = resource.getString("associated_data"); - String apiV3Key = getApiV3Key(); - - String plainText; - try { - plainText = decryptResource(ciphertext, apiV3Key, nonceStr, associatedData); - } catch (Exception e) { - log.error("资源解密失败: {}", e.getMessage()); - return failResult("decrypt failed"); - } - - JSONObject tradeData = JSON.parseObject(plainText); - String outTradeNo = tradeData.getString("out_trade_no"); - String tradeState = tradeData.getString("trade_state"); - String transactionId = tradeData.getString("transaction_id"); - BigDecimal totalAmount = tradeData.getBigDecimal("amount") != null - ? tradeData.getJSONObject("amount").getBigDecimal("payer_total") : BigDecimal.ZERO; - - log.info("解密后 — outTradeNo={}, tradeState={}, transactionId={}, amount={}", - outTradeNo, tradeState, transactionId, totalAmount); - - // 3. 仅处理支付成功事件 - if (!"TRANSACTION.SUCCESS".equals(eventType) && !"SUCCESS".equals(tradeState)) { - log.warn("非成功回调,忽略 — eventType: {}, tradeState: {}", eventType, tradeState); - return successResult(); - } - - // 4. 查询并更新订阅记录 - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(AppSubscription::getSubscriptionNo, outTradeNo); - AppSubscription sub = subscriptionMapper.selectOne(query); - - if (sub == null) { - log.warn("未找到订阅记录 outTradeNo: {}", outTradeNo); - return successResult(); // 返回成功,避免微信重复回调 - } - - if (sub.getPayStatus() != null && sub.getPayStatus() == 1) { - log.info("订阅 {} 已支付,跳过重复处理", outTradeNo); - return successResult(); - } - - // 5. 更新状态 - sub.setPayStatus(1); - sub.setStatus("active"); - sub.setPayTime(LocalDateTime.now()); - sub.setTransactionId(transactionId); - sub.setPayType(1); // 1=微信支付 - sub.setStartTime(LocalDateTime.now()); - - // 设置到期时间(订阅型) - if ("subscription".equals(sub.getPriceType())) { - int months = "year".equals(sub.getSubscriptionPeriod()) ? 12 : 1; - sub.setExpireTime(LocalDateTime.now().plusMonths(months)); - } - - subscriptionMapper.updateById(sub); - log.info("订阅 {} 支付成功,状态已更新", outTradeNo); - - // 6. 写入 Redis,加速前端轮询感知 - redisUtil.set("wxpay:paid:" + outTradeNo, "1", Duration.ofHours(24)); - - return successResult(); - - } catch (Exception e) { - log.error("微信支付回调处理异常: {}", e.getMessage(), e); - return failResult("internal error: " + e.getMessage()); - } - } - - /** - * 解析通知(V3 API 使用 AES-256-GCM 解密 resource 字段) - */ - private JSONObject parseNotification(String body) { - try { - return JSON.parseObject(body); - } catch (Exception e) { - log.error("JSON 解析失败: {}", body); - return null; - } - } - - /** - * AES-256-GCM 解密微信 V3 通知 resource.ciphertext - * - resource.nonce:Base64 编码的 12 字节随机数 - * - resource.ciphertext:Base64(AEAD_AES_256_GCM(nonce + plaintext)) - * 其中 ciphertext 末尾 16 字节为 tag - */ - private String decryptResource(String ciphertext, String apiV3Key, String nonce, String associatedData) - throws Exception { - byte[] key = apiV3Key.getBytes(StandardCharsets.UTF_8); - // nonce 是 Base64 编码的 12 字节随机数,需要解码 - byte[] nonceBytes = Base64Utils.decodeFromString(nonce); - // associated_data 原样 UTF-8 编码 - byte[] aad = (associatedData == null ? "" : associatedData).getBytes(StandardCharsets.UTF_8); - // ciphertext = Base64(ciphertext_bytes),其中末尾 16 字节为 auth tag - byte[] cipherBytes = Base64Utils.decodeFromString(ciphertext); - - // 新版 SDK:AeadAesCipher.decrypt(nonce, associatedData, ciphertextWithTag) - AeadAesCipher cipher = new AeadAesCipher(key); - return cipher.decrypt(nonceBytes, aad, cipherBytes); - } - - /** - * 获取 APIv3 密钥(根据环境选择正式/测试配置) - */ - private String getApiV3Key() { - if ("dev".equals(active) && appPayProperties.isTestMode()) { - String key = appPayProperties.getTestApiV3Key(); - return key != null ? key : appPayProperties.getApiV3Key(); - } - return appPayProperties.getApiV3Key(); - } - - private String successResult() { - return "{\"code\":\"SUCCESS\",\"message\":\"OK\"}"; - } - - private String failResult(String msg) { - return "{\"code\":\"FAIL\",\"message\":\"" + msg + "\"}"; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/CICDController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/CICDController.java deleted file mode 100644 index e641c99..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/CICDController.java +++ /dev/null @@ -1,256 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppBuild; -import com.gxwebsoft.app.entity.AppPipeline; -import com.gxwebsoft.app.param.AppBuildParam; -import com.gxwebsoft.app.param.AppPipelineParam; -import com.gxwebsoft.app.service.AppBuildService; -import com.gxwebsoft.app.service.AppPipelineService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * CI/CD 控制器 - * 支持 Jenkins / GitHub Actions / Gitea CI - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Tag(name = "CI/CD管理") -@RestController -@RequestMapping("/api/app/cicd") -public class CICDController extends BaseController { - - @Resource - private AppBuildService appBuildService; - - @Resource - private AppPipelineService appPipelineService; - - // ========== 流水线接口 ========== - - @Operation(summary = "分页查询流水线") - @GetMapping("/pipeline/page") - public ApiResult> pagePipeline(AppPipelineParam param) { - User loginUser = getLoginUser(); - if (loginUser != null) { - param.setUserId(loginUser.getUserId()); - } - return success(appPipelineService.pagePipeline(param)); - } - - @Operation(summary = "查询应用的所有流水线") - @GetMapping("/pipeline/app/{appId}") - public ApiResult> listByApp(@PathVariable Long appId) { - return success(appPipelineService.getByAppId(appId)); - } - - @Operation(summary = "查询流水线详情") - @GetMapping("/pipeline/{id}") - public ApiResult getPipeline(@PathVariable Long id) { - return success(appPipelineService.getPipelineDetail(id)); - } - - @PreAuthorize("hasAuthority('app:cicd:pipeline:save')") - @Operation(summary = "创建流水线") - @PostMapping("/pipeline") - public ApiResult createPipeline(@RequestBody AppPipeline pipeline) { - User loginUser = getLoginUser(); - if (loginUser != null) { - pipeline.setUserId(loginUser.getUserId()); - pipeline.setTenantId(loginUser.getTenantId()); - } - if (appPipelineService.createPipeline(pipeline)) { - return success("创建成功"); - } - return fail("创建失败"); - } - - @PreAuthorize("hasAuthority('app:cicd:pipeline:update')") - @Operation(summary = "更新流水线") - @PutMapping("/pipeline") - public ApiResult updatePipeline(@RequestBody AppPipeline pipeline) { - if (appPipelineService.updatePipeline(pipeline)) { - return success("更新成功"); - } - return fail("更新失败"); - } - - @PreAuthorize("hasAuthority('app:cicd:pipeline:remove')") - @Operation(summary = "删除流水线") - @DeleteMapping("/pipeline/{id}") - public ApiResult deletePipeline(@PathVariable Long id) { - if (appPipelineService.deletePipeline(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('app:cicd:pipeline:update')") - @Operation(summary = "启用/禁用流水线") - @PostMapping("/pipeline/{id}/toggle") - public ApiResult togglePipeline(@PathVariable Long id, @RequestParam boolean enabled) { - if (appPipelineService.togglePipeline(id, enabled)) { - return success(enabled ? "已启用" : "已禁用"); - } - return fail("操作失败"); - } - - @Operation(summary = "获取流水线状态") - @GetMapping("/pipeline/{id}/status") - public ApiResult> getPipelineStatus(@PathVariable Long id) { - AppPipeline pipeline = appPipelineService.getById(id); - Map result = new HashMap<>(); - result.put("id", id); - result.put("status", appPipelineService.getPipelineStatus(id)); - result.put("lastBuildId", pipeline != null ? pipeline.getLastBuildId() : null); - result.put("lastBuildTime", pipeline != null ? pipeline.getLastBuildTime() : null); - result.put("successCount", pipeline != null ? pipeline.getSuccessCount() : 0); - result.put("failureCount", pipeline != null ? pipeline.getFailureCount() : 0); - return success(result); - } - - // ========== 构建接口 ========== - - @Operation(summary = "分页查询构建记录") - @GetMapping("/build/page") - public ApiResult> pageBuild(AppBuildParam param) { - User loginUser = getLoginUser(); - if (loginUser != null) { - param.setUserId(loginUser.getUserId()); - } - return success(appBuildService.pageBuild(param)); - } - - @Operation(summary = "查询应用的所有构建记录") - @GetMapping("/build/app/{appId}") - public ApiResult> listBuildByApp(@PathVariable Long appId) { - AppBuildParam param = new AppBuildParam(); - param.setAppId(appId); - return success(appBuildService.pageBuild(param).getList()); - } - - @Operation(summary = "查询构建详情") - @GetMapping("/build/{id}") - public ApiResult getBuild(@PathVariable Long id) { - return success(appBuildService.getBuildDetail(id)); - } - - @Operation(summary = "获取应用最新构建") - @GetMapping("/build/latest/{appId}") - public ApiResult getLatestBuild(@PathVariable Long appId) { - return success(appBuildService.getLatestBuild(appId)); - } - - @PreAuthorize("hasAuthority('app:cicd:build:save')") - @Operation(summary = "触发构建") - @PostMapping("/build/trigger") - public ApiResult> triggerBuild( - @RequestParam Long appId, - @RequestParam(required = false) String branch) { - User loginUser = getLoginUser(); - Integer triggeredBy = loginUser != null ? loginUser.getUserId() : null; - - try { - AppBuild build = appBuildService.triggerBuild(appId, branch, triggeredBy); - Map result = new HashMap<>(); - result.put("id", build.getId()); - result.put("buildNumber", build.getBuildNumber()); - result.put("status", build.getStatus()); - result.put("branch", build.getBranch()); - return success("构建已触发", result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @Operation(summary = "获取构建日志") - @GetMapping("/build/{id}/log") - public ApiResult> getBuildLog(@PathVariable Long id) { - try { - String log = appBuildService.getBuildLog(id); - Map result = new HashMap<>(); - result.put("log", log); - result.put("buildId", id); - return success(result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @PreAuthorize("hasAuthority('app:cicd:build:update')") - @Operation(summary = "取消构建") - @PostMapping("/build/{id}/cancel") - public ApiResult cancelBuild(@PathVariable Long id) { - try { - if (appBuildService.cancelBuild(id)) { - return success("构建已取消"); - } - return fail("取消失败"); - } catch (Exception e) { - return fail(e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('app:cicd:build:save')") - @Operation(summary = "重试构建") - @PostMapping("/build/{id}/retry") - public ApiResult> retryBuild(@PathVariable Long id) { - User loginUser = getLoginUser(); - Integer triggeredBy = loginUser != null ? loginUser.getUserId() : null; - - try { - AppBuild build = appBuildService.retryBuild(id, triggeredBy); - Map result = new HashMap<>(); - result.put("id", build.getId()); - result.put("buildNumber", build.getBuildNumber()); - result.put("status", build.getStatus()); - return success("构建已重试", result); - } catch (Exception e) { - return fail(e.getMessage(), null); - } - } - - @Operation(summary = "获取构建统计") - @GetMapping("/build/stats/{appId}") - public ApiResult> getBuildStats(@PathVariable Long appId) { - return success(appBuildService.getBuildStats(appId)); - } - - // ========== Webhook 回调接口 ========== - - @Operation(summary = "Gitea Webhook 回调") - @PostMapping("/webhook/gitea") - public ApiResult giteaWebhook(@RequestBody Map payload) { - try { - appBuildService.handleWebhook("gitea", payload); - return success("回调处理成功"); - } catch (Exception e) { - log.error("Gitea webhook处理失败: {}", e.getMessage()); - return fail("处理失败: " + e.getMessage()); - } - } - - @Operation(summary = "获取CI系统配置") - @GetMapping("/config") - public ApiResult> getCIConfig() { - Map config = new HashMap<>(); - config.put("supportedCI", new String[]{"gitea", "jenkins", "github"}); - config.put("defaultCI", "gitea"); - config.put("giteaUrl", "https://git.websoft.top"); - return success(config); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/GitAccountController.java b/jczxw-java/src/main/java/com/gxwebsoft/app/controller/GitAccountController.java deleted file mode 100644 index af9e409..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/controller/GitAccountController.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.gxwebsoft.app.controller; - -import com.gxwebsoft.app.entity.AppGitAccount; -import com.gxwebsoft.app.service.AppGitAccountService; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Git账号绑定控制器 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Slf4j -@Tag(name = "Git账号绑定") -@RestController -@RequestMapping("/api/app/developer") -public class GitAccountController extends BaseController { - - @Resource - private AppGitAccountService appGitAccountService; - - /** - * 保存Git账号绑定信息 - */ - @OperationLog - @Operation(summary = "保存Git账号绑定") - @PostMapping("/git-account") - public ApiResult> saveGitAccount(@RequestBody Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - - String username = params.get("username"); - String email = params.get("email"); - String remark = params.get("remark"); - - try { - AppGitAccount account = appGitAccountService.saveGitAccount(username, email, remark, loginUser.getUserId(), loginUser.getTenantId()); - - Map result = new HashMap<>(); - result.put("userId", account.getUserId()); - result.put("gitUsername", account.getUsername()); - result.put("email", account.getEmail()); - result.put("remark", account.getRemark()); - result.put("savedAt", account.getUpdateTime() != null ? account.getUpdateTime().toString() : account.getCreateTime().toString()); - result.put("status", account.getStatus()); - - return success("Git账号绑定成功", result); - } catch (Exception e) { - log.error("保存Git账号绑定失败: {}", e.getMessage()); - return fail(e.getMessage(), null); - } - } - - /** - * 获取Git账号绑定状态 - */ - @Operation(summary = "获取Git账号绑定状态") - @GetMapping({"/git-account", "/git-account/status"}) - public ApiResult> getGitAccountStatus() { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - - AppGitAccount account = appGitAccountService.getGitAccountStatus(loginUser.getUserId(), loginUser.getTenantId()); - - Map result = new HashMap<>(); - if (account != null && account.getStatus() != null && !"not_bound".equals(account.getStatus())) { - result.put("username", account.getUsername()); - result.put("email", account.getEmail()); - result.put("remark", account.getRemark()); - result.put("status", account.getStatus()); - result.put("verificationNote", account.getVerificationNote()); - if (account.getUpdateTime() != null) { - result.put("lastUpdatedAt", account.getUpdateTime().toString()); - } else if (account.getCreateTime() != null) { - result.put("lastUpdatedAt", account.getCreateTime().toString()); - } - } else { - result.put("status", "not_bound"); - } - - return success(result); - } - - /** - * 获取Gitea服务器信息(静态配置) - */ - @Operation(summary = "获取Gitea服务器信息") - @GetMapping("/gitea-info") - public ApiResult> getGiteaInfo() { - // 这里返回静态配置,后续可以从配置文件中读取 - Map info = new HashMap<>(); - info.put("url", "https://git.websoft.top"); - info.put("version", "1.21"); - info.put("registrationEnabled", true); - info.put("requireEmailConfirmation", false); - info.put("maxRepoCreation", 100); - return success(info); - } - - // ========== 管理端接口 ========== - - /** - * 分页查询Git账号绑定列表(管理端) - */ - @Operation(summary = "分页查询Git账号绑定列表(管理端)") - @GetMapping("/git-account/list") - public ApiResult> pageGitAccounts( - @RequestParam(defaultValue = "1") int page, - @RequestParam(defaultValue = "20") int size, - @RequestParam(required = false) String status, - @RequestParam(required = false) String keyword) { - Map result = appGitAccountService.pageGitAccounts(status, keyword, page, size); - return success(result); - } - - /** - * 审核Git账号绑定 - 通过 - */ - @OperationLog - @Operation(summary = "审核Git账号绑定-通过") - @PutMapping("/git-account/{id}/approve") - public ApiResult approveAccount(@PathVariable("id") Long id, @RequestBody(required = false) Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - try { - String note = params != null ? params.get("note") : null; - boolean result = appGitAccountService.approveAccount(id, loginUser.getUserId(), loginUser.getRealName(), note); - return result ? success("审核通过") : fail("审核失败"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } - - /** - * 审核Git账号绑定 - 拒绝 - */ - @OperationLog - @Operation(summary = "审核Git账号绑定-拒绝") - @PutMapping("/git-account/{id}/reject") - public ApiResult rejectAccount(@PathVariable("id") Long id, @RequestBody Map params) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - - String reason = params != null ? params.get("reason") : null; - if (reason == null || reason.trim().isEmpty()) { - return fail("请填写拒绝原因"); - } - - try { - boolean result = appGitAccountService.rejectAccount(id, loginUser.getUserId(), loginUser.getRealName(), reason.trim()); - return result ? success("已拒绝该绑定申请") : fail("拒绝失败"); - } catch (RuntimeException e) { - return fail(e.getMessage()); - } - } -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppApiKey.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppApiKey.java deleted file mode 100644 index 5a67033..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppApiKey.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import java.time.LocalDateTime; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用 API Key 实体 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppApiKey对象", description = "应用API密钥") -public class AppApiKey implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增主键") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "API Key名称") - private String name; - - @Schema(description = "API Key密钥值(加密存储)") - private String apiKey; - - @Schema(description = "密钥前缀(用于显示,如 sk-xxxxx)") - private String keyPrefix; - - @Schema(description = "状态: 0正常, 1禁用") - private Integer status; - - @Schema(description = "权限范围,JSON数组字符串") - private String scopes; - - @Schema(description = "到期时间,NULL=永不过期") - private LocalDateTime expireTime; - - @Schema(description = "最后使用时间") - private LocalDateTime lastUsedAt; - - @Schema(description = "使用次数") - private Long usageCount; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppArticle.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppArticle.java deleted file mode 100644 index 7eac735..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppArticle.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 平台文章 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_article") -@Schema(name = "AppArticle对象", description = "平台文章") -public class AppArticle implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "文章ID") - @TableId(value = "article_id", type = IdType.AUTO) - private Integer articleId; - - @Schema(description = "文章标题") - private String title; - - @Schema(description = "文章类型 0常规 1视频") - private Integer type; - - @Schema(description = "文章模型,article 普通文章,announcement 公告") - private String model; - - @Schema(description = "文章编号") - private String code; - - @Schema(description = "分类ID") - private Integer categoryId; - - @Schema(description = "分类名称") - @TableField(exist = false) - private String categoryName; - - @Schema(description = "父级分类ID") - @TableField(exist = false) - private Integer parentId; - - @Schema(description = "封面图") - private String image; - - @Schema(description = "来源") - private String source; - - @Schema(description = "摘要") - private String overview; - - @Schema(description = "正文内容") - private String content; - - @Schema(description = "实际阅读量") - private Integer actualViews; - - @Schema(description = "点赞数") - private Integer likes; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "作者") - private String author; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "排序值") - private Integer sortNumber; - - @Schema(description = "状态,0已发布 1草稿/待审核 2已驳回 3违规") - private Integer status; - - @Schema(description = "是否删除,0否 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppArticleCategory.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppArticleCategory.java deleted file mode 100644 index 4769bff..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppArticleCategory.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 平台文章分类 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_article_category") -@Schema(name = "AppArticleCategory对象", description = "平台文章分类") -public class AppArticleCategory implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "分类ID") - @TableId(value = "category_id", type = IdType.AUTO) - private Integer categoryId; - - @Schema(description = "分类标识") - private String categoryCode; - - @Schema(description = "分类名称") - private String title; - - @Schema(description = "类型 0列表 1单页 2外链") - private Integer type; - - @Schema(description = "分类图片") - private String image; - - @Schema(description = "上级分类ID") - private Integer parentId; - - @Schema(description = "访问路径") - private String path; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "文章数") - @TableField(exist = false) - private Integer count; - - @Schema(description = "排序值") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否隐藏") - private Integer hide; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "是否显示在首页") - private Integer showIndex; - - @Schema(description = "状态 0正常 1禁用") - private Integer status; - - @Schema(description = "是否删除,0否 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppBuild.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppBuild.java deleted file mode 100644 index 265a0cf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppBuild.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * CI/CD 构建记录实体 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppBuild对象", description = "CI/CD构建记录") -@TableName("app_build") -public class AppBuild implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "关联应用ID") - private Long appId; - - @Schema(description = "关联版本ID(可选)") - private Long versionId; - - @Schema(description = "构建编号(如 run-123)") - private String buildNumber; - - @Schema(description = "构建名称") - private String name; - - @Schema(description = "触发分支(如 main、develop)") - private String branch; - - @Schema(description = "提交哈希(可选)") - private String commitSha; - - @Schema(description = "提交消息(可选)") - private String commitMessage; - - @Schema(description = "提交作者(可选)") - private String commitAuthor; - - @Schema(description = "CI系统类型: gitea/jenkins/github") - private String ciType; - - @Schema(description = "CI系统中的任务ID") - private String ciJobId; - - @Schema(description = "CI系统中的运行ID") - private String ciRunId; - - @Schema(description = "CI系统API地址") - private String ciApiUrl; - - @Schema(description = "状态: pending/running/success/failed/cancelled") - private String status; - - @Schema(description = "构建开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime startedAt; - - @Schema(description = "构建结束时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime finishedAt; - - @Schema(description = "构建耗时(秒)") - private Integer duration; - - @Schema(description = "构建日志URL") - private String logUrl; - - @Schema(description = "构建产物URL(如 JAR、Docker镜像)") - private String artifactUrl; - - @Schema(description = "构建产物名称") - private String artifactName; - - @Schema(description = "构建产物大小(字节)") - private Long artifactSize; - - @Schema(description = "失败原因") - private String errorMessage; - - @Schema(description = "触发方式: manual/webhook/schedule") - private String triggerType; - - @Schema(description = "触发人用户ID") - private Integer triggeredBy; - - @Schema(description = "扩展配置(JSON)") - private String config; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppCloudCredential.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppCloudCredential.java deleted file mode 100644 index da9fdba..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppCloudCredential.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 云账号凭证(阿里云/腾讯云/华为云等) - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_cloud_credential") -@Schema(name = "AppCloudCredential对象", description = "云账号凭证") -public class AppCloudCredential implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - /** 云服务商: aliyun/tencent/huawei/qiniu */ - private String provider; - - /** 凭证名称 */ - private String name; - - /** 访问密钥 ID (AK) */ - private String accessKeyId; - - /** 访问密钥密钥 (SK),AES加密存储 */ - private String accessKeySecret; - - /** 额外配置,JSON格式 */ - private String configJson; - - /** 状态: 0正常 1冻结 */ - private Integer status; - - /** 备注 */ - private String remark; - - /** 所属用户ID */ - private Integer userId; - - /** 租户ID */ - private Integer tenantId; - - @Schema(description = "是否删除: 0否 1是") - private Integer deleted; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - /** 测试状态: 0未测试 1成功 2失败 */ - private Integer testStatus; - - /** 测试消息 */ - private String testMessage; -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppConfig.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppConfig.java deleted file mode 100644 index c61a514..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppConfig.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - * 应用配置表 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_config") -public class AppConfig implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 配置ID - */ - @TableId(value = "config_id", type = IdType.AUTO) - private Integer configId; - - /** - * 应用ID - */ - private Integer appId; - - /** - * 配置键 - */ - private String configKey; - - /** - * 配置值(JSON或字符串) - */ - private String configValue; - - /** - * 配置类型:general/api/callback/wechat/payment/git等 - */ - private String configType; - - /** - * 是否加密 0否 1是 - */ - private Integer isEncrypted; - - /** - * 是否敏感信息 0否 1是 - */ - private Integer isSecret; - - /** - * 配置说明 - */ - private String description; - - /** - * 排序号 - */ - private Integer sortNumber; - - /** - * 租户id - */ - private Long tenantId; - - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT) - private Long createdTime; - - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updatedTime; - - /** - * 是否删除 0否 1是 - */ - @TableLogic - private Integer deleted; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppContract.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppContract.java deleted file mode 100644 index 8c65ea3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppContract.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 合同管理 - * - * @author 科技小王子 - * @since 2026-04-13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_contract") -@Schema(name = "AppContract对象", description = "合同管理") -public class AppContract implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "合同ID") - @TableId(value = "contract_id", type = IdType.AUTO) - private Long contractId; - - @Schema(description = "合同编号") - private String contractNo; - - @Schema(description = "合同名称") - private String title; - - @Schema(description = "合同类型: service/cooperation/purchase/other") - private String contractType; - - @Schema(description = "甲方名称") - private String partyA; - - @Schema(description = "乙方名称") - private String partyB; - - @Schema(description = "合同金额") - private BigDecimal amount; - - @Schema(description = "合同开始日期") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDate startDate; - - @Schema(description = "合同结束日期") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDate endDate; - - @Schema(description = "状态: draft/pending/active/expired/terminated") - private String status; - - @Schema(description = "合同附件URL") - private String fileUrl; - - @Schema(description = "合同附件原始文件名") - private String fileName; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "创建用户ID") - private Integer userId; - - @Schema(description = "创建用户名(冗余)") - private String userName; - - @Schema(description = "是否删除: 0否 1是") - private Integer deleted; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "租户ID") - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppCredential.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppCredential.java deleted file mode 100644 index 93e607e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppCredential.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用密钥凭证 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:43 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppCredential对象", description = "应用密钥凭证") -public class AppCredential implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "关联应用ID(AppProduct.productId)") - private String appId; - - @Schema(description = "OAuth Client ID(公开,格式:app_xxxxxxxxxxxx)") - private String clientId; - - @Schema(description = "OAuth Client Secret(加密存储)") - private String clientSecret; - - @Schema(description = "凭证类型: server/client/webhook") - private String type; - - @Schema(description = "权限范围,空格分隔") - private String scopes; - - @Schema(description = "到期时间,NULL=永不过期") - private LocalDateTime expireTime; - - @Schema(description = "最后使用时间") - private LocalDateTime lastUsedAt; - - private String remark; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppEvent.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppEvent.java deleted file mode 100644 index 7636354..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppEvent.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用操作动态 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppEvent对象", description = "应用操作动态") -public class AppEvent implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "关联应用ID") - private Long appId; - - @Schema(description = "事件类型: created/published/updated/domain_bound/member_added/status_changed") - private String eventType; - - @Schema(description = "事件标题,如已发布") - private String title; - - @Schema(description = "详细描述") - private String content; - - @Schema(description = "操作人用户ID") - private Long operatorId; - - @Schema(description = "操作人名称(冗余)") - private String operator; - - @Schema(description = "关联ID,如版本ID") - private Long refId; - - @Schema(description = "关联类型") - private String refType; - - @Schema(description = "扩展数据") - private String extra; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppGitAccount.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppGitAccount.java deleted file mode 100644 index a77982f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppGitAccount.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * Git账号绑定(开发者Gitea账号) - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppGitAccount对象", description = "Git账号绑定(开发者Gitea账号)") -@TableName("app_git_account") -public class AppGitAccount implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "Gitea用户名(唯一)") - private String username; - - @Schema(description = "联系邮箱") - private String email; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "状态: pending待审核/verified已通过/rejected已拒绝") - private String status; - - @Schema(description = "审核备注") - private String verificationNote; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppInviteToken.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppInviteToken.java deleted file mode 100644 index 8b2e762..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppInviteToken.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.time.LocalDateTime; - -/** - * 应用邀请Token实体 - */ -@Data -@TableName("app_invite_token") -public class AppInviteToken { - - @TableId(type = IdType.AUTO) - private Integer id; - - /** - * 邀请token - */ - private String token; - - /** - * 应用ID - */ - private Integer appId; - - /** - * 邀请角色 - */ - private String role; - - /** - * 邀请人ID - */ - private Integer inviterId; - - /** - * 过期时间 - */ - private LocalDateTime expireTime; - - /** - * 状态:0-未使用,1-已使用 - */ - private Integer status; - - /** - * 接受人ID - */ - private Integer acceptUserId; - - /** - * 接受时间 - */ - private LocalDateTime acceptTime; - - /** - * 创建时间 - */ - private LocalDateTime createTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppNotification.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppNotification.java deleted file mode 100644 index 38dd4fe..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppNotification.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 站内消息通知 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_notification") -@Schema(name = "AppNotification对象", description = "站内消息通知") -public class AppNotification implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "通知ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "接收用户ID") - private Integer userId; - - @Schema(description = "通知类型: ticket/review/system/resource/permission/member/payment") - private String type; - - @Schema(description = "通知标题") - private String title; - - @Schema(description = "通知内容摘要") - private String content; - - @Schema(description = "是否已读: 0未读 1已读") - private Integer isRead; - - @Schema(description = "关联业务ID(如工单ID、权限申请ID等)") - private Long refId; - - @Schema(description = "关联业务类型(如 ticket、permission_request 等)") - private String refType; - - @Schema(description = "跳转链接") - private String linkUrl; - - @Schema(description = "发送者ID(系统通知为0)") - private Integer senderId; - - @Schema(description = "发送者名称") - private String senderName; - - @Schema(description = "发送者头像") - private String senderAvatar; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppPermissionRequest.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppPermissionRequest.java deleted file mode 100644 index 784463f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppPermissionRequest.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 权限申请记录(开发者Git仓库访问申请) - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppPermissionRequest对象", description = "权限申请记录(开发者Git仓库访问申请)") -@TableName("app_permission_request") -public class AppPermissionRequest implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "Git用户名") - private String gitUsername; - - @Schema(description = "申请仓库路径") - private String repo; - - @Schema(description = "仓库名称") - private String repoName; - - @Schema(description = "申请理由") - private String reason; - - @Schema(description = "状态: pending待审核/approved已通过/rejected已拒绝") - private String status; - - @Schema(description = "拒绝原因") - private String rejectReason; - - @Schema(description = "审核人用户ID") - private Integer reviewerId; - - @Schema(description = "审核人姓名") - private String reviewerName; - - @Schema(description = "审核时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime reviewedAt; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户ID") - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppPipeline.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppPipeline.java deleted file mode 100644 index 6bc1af2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppPipeline.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * CI/CD 流水线配置实体 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppPipeline对象", description = "CI/CD流水线配置") -@TableName("app_pipeline") -public class AppPipeline implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "关联应用ID") - private Long appId; - - @Schema(description = "流水线名称") - private String name; - - @Schema(description = "流水线描述") - private String description; - - @Schema(description = "CI系统类型: gitea/jenkins/github") - private String ciType; - - @Schema(description = "Gitea仓库全称(如 gxwebsoft/my-app)") - private String repoFullName; - - @Schema(description = "Gitea工作流文件名(如 build.yml)") - private String workflowFile; - - @Schema(description = "流水线阶段: build/test/deploy") - private String stages; - - @Schema(description = "环境: development/staging/production") - private String env; - - @Schema(description = "默认触发分支") - private String defaultBranch; - - @Schema(description = "是否启用") - private Boolean enabled; - - @Schema(description = "自动部署") - private Boolean autoDeploy; - - @Schema(description = "构建超时时间(秒)") - private Integer timeout; - - @Schema(description = "配置JSON(变量、环境等)") - private String config; - - @Schema(description = "最近一次构建ID") - private Long lastBuildId; - - @Schema(description = "最近构建状态") - private String lastBuildStatus; - - @Schema(description = "最近构建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime lastBuildTime; - - @Schema(description = "构建成功次数") - private Integer successCount; - - @Schema(description = "构建失败次数") - private Integer failureCount; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppProduct.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppProduct.java deleted file mode 100644 index 18aec32..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppProduct.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import javax.validation.constraints.Size; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.Date; - -/** - * 应用产品主表 - * - * @author 科技小王子 - * @since 2024-09-10 - */ -@Data -@Schema(name = "AppProduct对象", description = "应用产品主表") -public class AppProduct implements Serializable { - private static final long serialVersionUID = 1L; - - // ==================== 核心字段 ==================== - @Schema(description = "应用ID") - @TableId(value = "product_id", type = IdType.AUTO) - private Integer productId; - - @Schema(description = "应用名称") - @Size(max = 100, message = "应用名称长度不能超过100") - private String productName; - - @Schema(description = "应用标识(唯一)") - @Size(max = 50, message = "应用标识长度不能超过50") - private String productCode; - - @Schema(description = "应用密钥") - private String productSecret; - - // ==================== 应用类型 ==================== - @Schema(description = "应用类型: 10网站 20微信小程序 30抖音小程序 40百度小程序 50支付宝小程序 60Android 70iOS 80macOS 90Windows 100插件") - private Integer appType; - - @Schema(description = "应用类型名称") - @TableField(exist = false) - private String appTypeName; - - // ==================== 分类信息 ==================== - @Schema(description = "分类ID") - private Integer categoryId; - - @Schema(description = "行业类型(父级)") - private String industryParent; - - @Schema(description = "行业类型(子级)") - private String industryChild; - - // ==================== 基础信息 ==================== - @Schema(description = "应用Logo") - private String logo; - - @Schema(description = "应用图标") - private String icon; - - @Schema(description = "二维码") - private String qrcode; - - @Schema(description = "应用截图(JSON数组)") - private String screenshots; - - @Schema(description = "应用简介") - @Size(max = 500, message = "应用简介长度不能超过500") - private String description; - - @Schema(description = "详细说明") - private String content; - - @Schema(description = "关键词") - @Size(max = 200, message = "关键词长度不能超过200") - private String keywords; - - // ==================== 配置信息 ==================== - @Schema(description = "域名") - private String domain; - - @Schema(description = "域名前缀") - private String prefix; - - @Schema(description = "包名/AppID") - private String packageName; - - @Schema(description = "后台地址") - private String adminUrl; - - @Schema(description = "API地址") - private String apiUrl; - - @Schema(description = "下载地址") - private String downloadUrl; - - // ==================== 版本信息 ==================== - @Schema(description = "版本号") - private String version; - - @Schema(description = "版本: standard标准版 professional专业版 perpetual永久授权") - private String edition; - - @Schema(description = "最低版本要求") - private String minVersion; - - // ==================== 价格与交付 ==================== - @Schema(description = "定价: free免费 one_time一次性 subscription订阅") - private String priceType; - - @Schema(description = "价格(元)") - private BigDecimal price; - - @Schema(description = "划线价格") - private BigDecimal linePrice; - - @Schema(description = "续费价格") - private BigDecimal renewPrice; - - @Schema(description = "交付方式: 1源码 2托管 3授权") - private Integer deliveryMethod; - - @Schema(description = "计费方式: 1按年 2按月 3一次性") - private Integer chargingMethod; - - @Schema(description = "订阅周期: month/year") - private String subscriptionPeriod; - - // ==================== 发布管理 ==================== - @Schema(description = "发布状态: developing开发中 pending_review待审核 published已上架 rejected审核未通过 deprecated已下架") - private String publishStatus; - - @Schema(description = "发布时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date publishTime; - - @Schema(description = "审核时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date reviewTime; - - @Schema(description = "审核人ID") - private Integer reviewerId; - - @Schema(description = "拒绝原因") - private String rejectReason; - - // ==================== 统计数据 ==================== - @Schema(description = "浏览次数") - private Integer clicks; - - @Schema(description = "安装次数") - private Integer installs; - - @Schema(description = "下载次数") - private Integer downloads; - - @Schema(description = "评分(1-5)") - private BigDecimal rating; - - @Schema(description = "点赞数") - private Integer likes; - - // ==================== 开发者信息 ==================== - @Schema(description = "开发者") - private String developer; - - @Schema(description = "开发者电话") - private String developerPhone; - - @Schema(description = "开发者邮箱") - private String developerEmail; - - // ==================== 运营配置 ==================== - @Schema(description = "是否推荐: 0否 1是") - private Integer recommend; - - @Schema(description = "是否官方: 0否 1是") - private Integer official; - - @Schema(description = "是否上架市场: 0否 1是") - private Integer market; - - @Schema(description = "是否显示首页: 0否 1是") - private Integer showIndex; - - @Schema(description = "是否可搜索: 0否 1是") - private Integer searchEnabled; - - // ==================== 站点配置 ==================== - @Schema(description = "模板ID") - private Integer templateId; - - @Schema(description = "样式配置JSON") - private String style; - - @Schema(description = "扩展配置JSON") - private String config; - - @Schema(description = "主题色") - private String themeColor; - - @Schema(description = "语言") - private String lang; - - // ==================== 备案信息 ==================== - @Schema(description = "ICP备案号") - private String icpNo; - - @Schema(description = "公安备案号") - private String policeNo; - - // ==================== 状态管理 ==================== - @Schema(description = "状态: 0未开通 1运行中 2维护中 3已关闭 4已欠费 5违规停机") - private Integer status; - - @Schema(description = "状态说明") - private String statusText; - - @Schema(description = "运行状态: 0停止 1运行中 2维护中") - private Integer running; - - @Schema(description = "是否到期") - @TableField(exist = false) - private Integer expired; - - @Schema(description = "剩余天数") - @TableField(exist = false) - private Long expiredDays; - - @Schema(description = "即将过期") - @TableField(exist = false) - private Integer soon; - - @Schema(description = "到期时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date expirationTime; - - // ==================== 系统字段 ==================== - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除: 0否 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "创建用户ID") - private Integer userId; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private Date updateTime; - - // ==================== 非数据库字段 ==================== - - @Schema(description = "当前用户在该应用中的角色(仅 accessible 查询返回)") - @TableField(exist = false) - private String myRole; - - // ==================== 应用类型常量 ==================== - public static final int APP_TYPE_WEBSITE = 10; // 网站 - public static final int APP_TYPE_WX_MINI = 20; // 微信小程序 - public static final int APP_TYPE_DOUYIN_MINI = 30; // 抖音小程序 - public static final int APP_TYPE_BAIDU_MINI = 40; // 百度小程序 - public static final int APP_TYPE_ALIPAY_MINI = 50; // 支付宝小程序 - public static final int APP_TYPE_ANDROID = 60; // Android APP - public static final int APP_TYPE_IOS = 70; // iOS APP - public static final int APP_TYPE_MACOS = 80; // macOS 应用 - public static final int APP_TYPE_WINDOWS = 90; // Windows 应用 - public static final int APP_TYPE_PLUGIN = 100; // 插件 - - // ==================== 发布状态常量 ==================== - public static final String PUBLISH_DEVELOPING = "developing"; // 开发中 - public static final String PUBLISH_PENDING_REVIEW = "pending_review"; // 待审核 - public static final String PUBLISH_PUBLISHED = "published"; // 已上架 - public static final String PUBLISH_REJECTED = "rejected"; // 审核未通过 - public static final String PUBLISH_DEPRECATED = "deprecated"; // 已下架 - - // ==================== 价格类型常量 ==================== - public static final String PRICE_FREE = "free"; // 免费 - public static final String PRICE_ONE_TIME = "one_time"; // 一次性 - public static final String PRICE_SUBSCRIPTION = "subscription"; // 订阅 - - // ==================== 版本常量 ==================== - public static final String EDITION_STANDARD = "standard"; // 标准版 - public static final String EDITION_PROFESSIONAL = "professional"; // 专业版 - public static final String EDITION_PERPETUAL = "perpetual"; // 永久授权 - - /** - * 获取应用类型名称 - */ - public String getAppTypeName() { - if (appType == null) return "未知"; - switch (appType) { - case APP_TYPE_WEBSITE: return "网站"; - case APP_TYPE_WX_MINI: return "微信小程序"; - case APP_TYPE_DOUYIN_MINI: return "抖音小程序"; - case APP_TYPE_BAIDU_MINI: return "百度小程序"; - case APP_TYPE_ALIPAY_MINI: return "支付宝小程序"; - case APP_TYPE_ANDROID: return "Android APP"; - case APP_TYPE_IOS: return "iOS APP"; - case APP_TYPE_MACOS: return "macOS 应用"; - case APP_TYPE_WINDOWS: return "Windows 应用"; - case APP_TYPE_PLUGIN: return "插件"; - default: return "未知"; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppResource.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppResource.java deleted file mode 100644 index e4df609..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppResource.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 开发者资源(服务器/数据库/云存储/域名/SSL证书) - * - * @author 科技小王子 - * @since 2026-03-31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_resource") -@Schema(name = "AppResource对象", description = "开发者资源") -public class AppResource implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "资源ID") - @TableId(value = "resource_id", type = IdType.AUTO) - private Long resourceId; - - @Schema(description = "资源类型: server/database/storage/domain/ssl") - private String resourceType; - - @Schema(description = "资源名称") - private String name; - - @Schema(description = "服务商: tencent/aliyun/huawei/other") - private String provider; - - @Schema(description = "关联应用ID(可选)") - private Long appId; - - @Schema(description = "关联应用名称(冗余)") - @TableField(exist = false) - private String appName; - - // ─── 服务器字段 ─────────────────────────────────────── - @Schema(description = "IP地址(服务器用)") - private String ip; - - @Schema(description = "SSH端口(服务器用,默认22)") - private Integer sshPort; - - @Schema(description = "SSH用户名(服务器用,用于远程执行命令)") - private String sshUsername; - - @Schema(description = "SSH密码(AES加密,服务器用,用于远程执行命令)") - private String sshPassword; - - @Schema(description = "MySQL端口(服务器用,默认3306)") - private Integer mysqlPort; - - @Schema(description = "PostgreSQL端口(服务器用,默认5432)") - private Integer pgPort; - - @Schema(description = "1Panel面板端口(服务器用,默认8888)") - private Integer panelPort; - - @Schema(description = "1Panel面板用户名(服务器用)") - private String panelUsername; - - @Schema(description = "1Panel面板密码(AES加密,服务器用)") - private String panelPassword; - - @Schema(description = "1Panel面板路径前缀(服务器用,如 /abc123)") - private String panelPath; - - @Schema(description = "MySQL管理员用户名(服务器用,用于远程建库)") - private String adminUsername; - - @Schema(description = "MySQL管理员密码(AES加密,服务器用,用于远程建库)") - private String adminPassword; - - // ─── 数据库字段 ─────────────────────────────────────── - @Schema(description = "数据库类型: MySQL/PostgreSQL/Redis/MongoDB(数据库用)") - private String dbType; - - @Schema(description = "关联服务器资源ID(数据库用)") - private Long serverResourceId; - - @Schema(description = "连接主机地址(数据库用)") - private String host; - - @Schema(description = "数据库连接端口(根据dbType从服务器资源获取,前端显示用)") - private Integer port; - - @Schema(description = "数据库用户名(数据库用)") - private String dbUsername; - - @Schema(description = "数据库密码(数据库用)") - private String dbPassword; - - // ─── 云存储字段 ─────────────────────────────────────── - @Schema(description = "地区/Region(云存储用)") - private String region; - - @Schema(description = "云账号凭证ID(云存储用,关联app_cloud_credential)") - private Long credentialId; - - @Schema(description = "访问权限: public-read/private(云存储用)") - private String acl; - - @Schema(description = "已用空间(字节,云存储用)") - private Long usedBytes; - - @Schema(description = "对象数量(云存储用)") - private Integer usedCount; - - // ─── 域名字段 ───────────────────────────────────────── - @Schema(description = "域名(域名用)") - private String domain; - - @Schema(description = "注册商(域名用)") - private String registrar; - - @Schema(description = "是否已备案(域名用)") - private Boolean icp; - - @Schema(description = "ICP备案号(域名用)") - private String icpNo; - - @Schema(description = "是否已绑定SSL(域名用,冗余)") - private Boolean sslBound; - - // ─── SSL证书字段 ────────────────────────────────────── - @Schema(description = "证书类型: DV/OV/EV(SSL用)") - private String certType; - - @Schema(description = "颁发机构(SSL用)") - private String issuer; - - @Schema(description = "私钥(SSL用,AES加密存储)") - private String privateKey; - - @Schema(description = "公钥(SSL用)") - private String publicKey; - - @Schema(description = "证书内容/证书文件(SSL用)") - private String certificate; - - @Schema(description = "证书链(SSL用,中间证书)") - private String certChain; - - // ─── Git仓库字段 ─────────────────────────────────────── - @Schema(description = "Git仓库路径(git用,如: websopy/core)") - private String gitPath; - - @Schema(description = "Git Clone URL(git用)") - private String gitCloneUrl; - - @Schema(description = "Git Web访问URL(git用,Gitea页面地址)") - private String gitWebUrl; - - @Schema(description = "Git权限级别: read/write/admin(git用)") - private String gitAccessLevel; - - // ─── 通用字段 ───────────────────────────────────────── - @Schema(description = "状态: running/stopped/expired/pending") - private String status; - - @Schema(description = "到期时间") - @JsonFormat(pattern = "yyyy-MM-dd") - private LocalDate expireAt; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "所属用户ID") - private Integer userId; - - @Schema(description = "资源创建者userId(权限控制基准,创建时自动设置)") - private Long ownerUserId; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "是否删除: 0否 1是") - private Integer deleted; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - // ─── 协作权限(非持久化,由后端查询时计算) ──────────────────── - @TableField(exist = false) - @Schema(description = "当前用户对此资源的访问级别: 0=无权限 1=基础查看 2=连接查看 3=完全权限(Owner)") - private Integer accessLevel; - - @TableField(exist = false) - @Schema(description = "当前用户是否为资源Owner") - private Boolean isOwner; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppSetting.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppSetting.java deleted file mode 100644 index e613566..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppSetting.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - * 平台设置表 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_setting") -public class AppSetting implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 设置ID - */ - @TableId(value = "setting_id", type = IdType.AUTO) - private Integer settingId; - - /** - * 设置分类:basic/review/market/register/notify/maintenance - */ - private String category; - - /** - * 设置项标识 - */ - private String settingKey; - - /** - * 设置项名称 - */ - private String settingName; - - /** - * 设置值(JSON格式) - */ - private String settingValue; - - /** - * 设置类型:string/number/boolean/json - */ - private String valueType; - - /** - * 设置说明 - */ - private String description; - - /** - * 排序号 - */ - private Integer sortNumber; - - /** - * 是否启用 0否 1是 - */ - private Integer isEnabled; - - /** - * 是否公开(前端可读)0否 1是 - */ - private Integer isPublic; - - /** - * 租户id - */ - private Long tenantId; - - /** - * 创建时间 - */ - @TableField(fill = FieldFill.INSERT) - private Long createdTime; - - /** - * 更新时间 - */ - @TableField(fill = FieldFill.INSERT_UPDATE) - private Long updatedTime; - - /** - * 是否删除 0否 1是 - */ - @TableLogic - private Integer deleted; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppSubscription.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppSubscription.java deleted file mode 100644 index 151c615..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppSubscription.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.*; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * 应用订阅实体 - * 对应表:app_subscription - */ -@Data -@TableName("app_subscription") -public class AppSubscription { - - @TableId(type = IdType.AUTO) - private Long id; - - /** 订阅编号(业务唯一) */ - private String subscriptionNo; - - /** 购买用户ID */ - private Integer userId; - - /** 应用产品ID */ - private Integer productId; - - /** 租户ID */ - private Integer tenantId; - - /** 订阅状态: pending/active/expired/cancelled */ - private String status; - - /** 价格类型: free/one_time/subscription */ - private String priceType; - - /** 原价(单位:元) */ - private BigDecimal originalPrice; - - /** 实付金额(单位:元) */ - private BigDecimal payPrice; - - /** 支付方式: 0-余额, 1-微信, 2-支付宝, 12-免费 */ - private Integer payType; - - /** 支付状态: 0-未支付, 1-已支付 */ - private Integer payStatus; - - /** 支付时间 */ - private LocalDateTime payTime; - - /** 第三方交易号 */ - private String transactionId; - - /** 订阅周期: month/year */ - private String subscriptionPeriod; - - /** 生效时间 */ - private LocalDateTime startTime; - - /** 到期时间(订阅型) */ - private LocalDateTime expireTime; - - /** 是否自动续费 0-否 1-是 */ - private Integer autoRenew; - - /** 分配的域名 */ - private String instanceDomain; - - /** 实例管理后台URL */ - private String instanceAdminUrl; - - /** 实例配置(JSON) */ - private String instanceConfig; - - /** 关联的支付订单号 */ - private String orderNo; - - /** 关联的支付订单ID */ - private Long orderId; - - /** 备注 */ - private String remark; - - @TableLogic - private Integer deleted; - - private Integer sortNumber; - - @TableField(fill = FieldFill.INSERT) - private LocalDateTime createTime; - - @TableField(fill = FieldFill.INSERT_UPDATE) - private LocalDateTime updateTime; - - // ===== 关联查询字段(非数据库字段) ===== - - @TableField(exist = false) - private String productName; - - @TableField(exist = false) - private String productIcon; - - @TableField(exist = false) - private String productLogo; - - @TableField(exist = false) - private Integer productAppType; - - @TableField(exist = false) - private String productDescription; - - @TableField(exist = false) - private String developerName; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppTicket.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppTicket.java deleted file mode 100644 index faf9a06..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppTicket.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.gxwebsoft.common.core.config.JsonArrayToStringDeserializer; -import com.gxwebsoft.common.core.config.JsonStringToArraySerializer; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 应用工单 - * - * @author 科技小王子 - * @since 2026-03-30 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_ticket") -@Schema(name = "AppTicket对象", description = "应用工单") -public class AppTicket implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "工单ID") - @TableId(value = "ticket_id", type = IdType.AUTO) - private Long ticketId; - - @Schema(description = "工单编号(TK-yyyyMMddHHmmss+4位随机)") - private String ticketNo; - - @Schema(description = "工单标题") - private String title; - - @Schema(description = "工单内容描述") - private String content; - - @Schema(description = "关联应用ID") - @com.fasterxml.jackson.annotation.JsonProperty("productId") - private Long appId; - - @Schema(description = "应用名称(冗余)") - private String appName; - - @Schema(description = "工单分类: bug/feature/consultation/complaint/other") - private String category; - - @Schema(description = "优先级: low/normal/high/urgent") - private String priority; - - @Schema(description = "状态: pending/assigned/processing/resolved/closed/rejected") - private String status; - - @Schema(description = "附件JSON数组") - @JsonDeserialize(using = JsonArrayToStringDeserializer.class) - @JsonSerialize(using = JsonStringToArraySerializer.class) - private String attachments; - - @Schema(description = "提交人用户ID") - private Integer submitUserId; - - @Schema(description = "提交人昵称(冗余)") - private String submitUserName; - - @Schema(description = "提交人头像(冗余)") - private String submitUserAvatar; - - @Schema(description = "分配的处理人用户ID") - private Integer assigneeId; - - @Schema(description = "处理人昵称(冗余)") - private String assigneeName; - - @Schema(description = "处理人头像(冗余)") - private String assigneeAvatar; - - @Schema(description = "回复数量") - private Integer replyCount; - - @Schema(description = "解决时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime resolvedTime; - - @Schema(description = "关闭时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime closedTime; - - @Schema(description = "是否删除: 0否 1是") - private Integer deleted; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppTicketReply.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppTicketReply.java deleted file mode 100644 index 2633d94..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppTicketReply.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.gxwebsoft.common.core.config.JsonArrayToStringDeserializer; -import com.gxwebsoft.common.core.config.JsonStringToArraySerializer; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 工单回复 - * - * @author 科技小王子 - * @since 2026-03-30 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@TableName("app_ticket_reply") -@Schema(name = "AppTicketReply对象", description = "工单回复") -public class AppTicketReply implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "回复ID") - @TableId(value = "reply_id", type = IdType.AUTO) - private Long replyId; - - @Schema(description = "关联工单ID") - private Long ticketId; - - @Schema(description = "回复内容") - private String content; - - @Schema(description = "附件JSON数组") - @JsonDeserialize(using = JsonArrayToStringDeserializer.class) - @JsonSerialize(using = JsonStringToArraySerializer.class) - private String attachments; - - @Schema(description = "回复人用户ID") - private Integer userId; - - @Schema(description = "回复人昵称(冗余)") - private String userName; - - @Schema(description = "回复人头像(冗余)") - private String userAvatar; - - @Schema(description = "是否是技术人员/客服: 0否 1是") - private Integer isStaff; - - @Schema(description = "是否删除: 0否 1是") - private Integer deleted; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppUser.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppUser.java deleted file mode 100644 index a3be55a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppUser.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用成员 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppUser对象", description = "应用成员") -public class AppUser implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "关联应用ID") - private Long appId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "用户名(冗余)") - @TableField(exist = false) - private String username; - - @Schema(description = "昵称(冗余)") - @TableField(exist = false) - private String nickname; - - @Schema(description = "头像(冗余)") - @TableField(exist = false) - private String avatar; - - @Schema(description = "手机号(冗余,脱敏存储)") - @TableField(exist = false) - private String phone; - - @Schema(description = "角色: owner/admin/developer/viewer") - private String role; - - @Schema(description = "邀请人用户ID") - private Long inviteBy; - - @Schema(description = "加入时间") - private LocalDateTime inviteTime; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "邀请状态: 0-正常(直接加入), 1-待确认, 2-已拒绝") - private Integer inviteStatus; - - @Schema(description = "邀请过期时间") - private LocalDateTime inviteExpireTime; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - // ========== 关联字段(非数据库字段)========== - - @Schema(description = "应用名称(关联app_product)") - @TableField(exist = false) - private String productName; - - @Schema(description = "应用图标(关联app_product)") - @TableField(exist = false) - private String icon; - - @Schema(description = "应用编码(关联app_product)") - @TableField(exist = false) - private String productCode; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppUserCache.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppUserCache.java deleted file mode 100644 index befc7ea..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppUserCache.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.app.entity; - -import cn.hutool.core.util.DesensitizedUtil; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 用户信息缓存表 - * 用于缓存 sys_user 的常用字段,方便 app 模块其他表关联查询用户信息 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@TableName("app_user_cache") -@Schema(name = "AppUserCache对象", description = "用户信息缓存") -public class AppUserCache implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "用户ID(主键)") - @TableId(value = "user_id", type = IdType.INPUT) - private Integer userId; - - @Schema(description = "用户名") - private String username; - - @Schema(description = "昵称") - private String nickname; - - @Schema(description = "头像") - private String avatar; - - @Schema(description = "手机号(脱敏存储)") - private String phone; - - @Schema(description = "用户状态,0正常,1冻结") - private Integer status; - - @Schema(description = "缓存更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "租户ID") - private Integer tenantId; - - /** - * 获取脱敏手机号 - */ - public String getMobile() { - return DesensitizedUtil.mobilePhone(this.phone); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppVersion.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppVersion.java deleted file mode 100644 index 5120799..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/AppVersion.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.gxwebsoft.app.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用版本发布记录 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppVersion对象", description = "应用版本发布记录") -public class AppVersion implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "关联应用ID") - private Long appId; - - @Schema(description = "版本号,如 1.0.0") - private String versionNo; - - @Schema(description = "版本名称") - private String versionName; - - @Schema(description = "版本更新说明") - private String changelog; - - @Schema(description = "安装包地址") - private String packageUrl; - - @Schema(description = "包大小(字节)") - private Long packageSize; - - @Schema(description = "包MD5/SHA256") - private String packageHash; - - @Schema(description = "环境: development/staging/production") - private String env; - - @Schema(description = "状态 0=构建中 1=已发布 2=已回滚 3=构建失败") - private Integer status; - - @Schema(description = "是否为当前版本") - private Boolean isCurrent; - - @Schema(description = "发布人用户ID") - private Long publishBy; - - @Schema(description = "发布时间") - private LocalDateTime publishTime; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/ResourceAccessLevel.java b/jczxw-java/src/main/java/com/gxwebsoft/app/entity/ResourceAccessLevel.java deleted file mode 100644 index 423bcd8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/entity/ResourceAccessLevel.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.gxwebsoft.app.entity; - -/** - * 资源访问级别枚举 - * - *

- * 0 - 无权限:不是应用团队成员
- * 1 - 基础查看:所有团队成员,可看名称/IP/端口/状态
- * 2 - 连接查看:admin/owner 角色,额外可看用户名/Host/连接方式
- * 3 - 完全权限:资源创建者(Owner),可看密码/私钥,可编辑/删除
- * 
- * - * @author 科技小王子 - * @since 2026-04-05 - */ -public enum ResourceAccessLevel { - - NONE(0), - VIEW_BASIC(1), - VIEW_CONNECTION(2), - FULL(3); - - private final int value; - - ResourceAccessLevel(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - /** - * 当前级别是否大于等于指定级别 - */ - public boolean atLeast(ResourceAccessLevel level) { - return this.value >= level.value; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppApiKeyMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppApiKeyMapper.java deleted file mode 100644 index 68a71e8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppApiKeyMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.gxwebsoft.app.entity.AppApiKey; -import com.gxwebsoft.app.param.AppApiKeyParam; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -/** - * 应用 API Key Mapper - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Mapper -public interface AppApiKeyMapper extends BaseMapper { - - /** - * 分页查询(关联查询) - */ - IPage selectPageRel(Page page, @Param("param") AppApiKeyParam param); - - /** - * 查询列表(关联查询) - */ - java.util.List selectListRel(@Param("param") AppApiKeyParam param); - - /** - * 根据ID查询详情(关联查询) - */ - AppApiKey selectByIdRel(@Param("id") Long id); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppArticleCategoryMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppArticleCategoryMapper.java deleted file mode 100644 index 2f60fc2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppArticleCategoryMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppArticleCategory; - -/** - * 平台文章分类 Mapper - */ -public interface AppArticleCategoryMapper extends BaseMapper { -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppArticleMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppArticleMapper.java deleted file mode 100644 index 0f9c22e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppArticleMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppArticle; - -/** - * 平台文章 Mapper - */ -public interface AppArticleMapper extends BaseMapper { -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppBuildMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppBuildMapper.java deleted file mode 100644 index c892972..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppBuildMapper.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppBuild; -import com.gxwebsoft.app.param.AppBuildParam; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * CI/CD 构建记录 Mapper - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Mapper -public interface AppBuildMapper extends BaseMapper { - - /** - * 查询构建列表(关联应用信息) - */ - List selectBuildList(@Param("param") AppBuildParam param); - - /** - * 查询构建详情(关联应用信息) - */ - AppBuild selectBuildDetail(@Param("id") Long id); - - /** - * 查询应用最新构建 - */ - AppBuild selectLatestBuild(@Param("appId") Long appId); - - /** - * 查询应用构建统计 - */ - Integer countBuildsByStatus(@Param("appId") Long appId, @Param("status") String status); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppCloudCredentialMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppCloudCredentialMapper.java deleted file mode 100644 index 5dbfc65..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppCloudCredentialMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppCloudCredential; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 云账号凭证 Mapper - * - * @author 科技小王子 - * @since 2026-04-04 - */ -public interface AppCloudCredentialMapper extends BaseMapper { - - /** - * 分页查询 - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppCloudCredential param); - - /** - * 查询列表 - */ - List selectListRel(@Param("param") AppCloudCredential param); -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppConfigMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppConfigMapper.java deleted file mode 100644 index 9206978..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppConfigMapper.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppConfig; -import com.gxwebsoft.app.param.AppConfigParam; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * 应用配置表 Mapper - * - * @author 科技小王子 - */ -@Mapper -public interface AppConfigMapper extends BaseMapper { - - /** - * 批量获取应用配置 - */ - List> selectConfigsByAppId(Integer appId); - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppConfigParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") AppConfigParam param); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppContractMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppContractMapper.java deleted file mode 100644 index 75880da..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppContractMapper.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppContract; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -/** - * 合同管理 Mapper - * - * @author 科技小王子 - * @since 2026-04-13 - */ -public interface AppContractMapper extends BaseMapper { - - /** - * 查询当天最大合同序号 - */ - @Select("SELECT COALESCE(MAX(SUBSTRING_INDEX(contract_no, '-', -1) + 0), 0) " + - "FROM app_contract WHERE contract_no LIKE CONCAT('HT-', #{datePart}, '-%')") - Integer selectMaxSeqForDate(@Param("datePart") String datePart); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppCredentialMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppCredentialMapper.java deleted file mode 100644 index 4ab3599..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppCredentialMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppCredential; -import com.gxwebsoft.app.param.AppCredentialParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 应用密钥凭证Mapper - * - * @author 科技小王子 - * @since 2026-03-28 21:29:43 - */ -public interface AppCredentialMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppCredentialParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") AppCredentialParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppEventMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppEventMapper.java deleted file mode 100644 index c1fe3ca..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppEventMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppEvent; -import com.gxwebsoft.app.param.AppEventParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 应用操作动态Mapper - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -public interface AppEventMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppEventParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") AppEventParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppGitAccountMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppGitAccountMapper.java deleted file mode 100644 index 40e969a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppGitAccountMapper.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppGitAccount; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -/** - * Git账号绑定 Mapper - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Mapper -public interface AppGitAccountMapper extends BaseMapper { - - /** - * 根据用户ID查询 - */ - AppGitAccount selectByUserId(@Param("userId") Integer userId); - - /** - * 根据用户名查询(检查唯一性) - */ - AppGitAccount selectByUsername(@Param("username") String username); - - /** - * 检查用户名是否被其他用户绑定(同一租户下) - */ - AppGitAccount checkUsernameOccupied(@Param("username") String username, @Param("excludeUserId") Integer excludeUserId, @Param("tenantId") Integer tenantId); - - /** - * 根据用户ID和租户ID查询 - */ - AppGitAccount selectByUserIdAndTenantId(@Param("userId") Integer userId, @Param("tenantId") Integer tenantId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppInviteTokenMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppInviteTokenMapper.java deleted file mode 100644 index 1409346..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppInviteTokenMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppInviteToken; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -/** - * 应用邀请Token Mapper - */ -public interface AppInviteTokenMapper extends BaseMapper { - - /** - * 根据token查询 - */ - @Select("SELECT * FROM app_invite_token WHERE token = #{token} LIMIT 1") - AppInviteToken selectByToken(@Param("token") String token); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppNotificationMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppNotificationMapper.java deleted file mode 100644 index e3423c2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppNotificationMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppNotification; - -/** - * 站内消息通知 Mapper - */ -public interface AppNotificationMapper extends BaseMapper { -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppPermissionRequestMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppPermissionRequestMapper.java deleted file mode 100644 index 2cfef40..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppPermissionRequestMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppPermissionRequest; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * 权限申请Mapper - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Mapper -public interface AppPermissionRequestMapper extends BaseMapper { - - /** - * 获取用户已可访问的仓库列表 - */ - List getAccessibleRepos(@Param("userId") Integer userId); - - /** - * 获取所有可用仓库列表(含访问状态) - */ - List> getAllReposWithAccessStatus(@Param("userId") Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppPipelineMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppPipelineMapper.java deleted file mode 100644 index 03426cf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppPipelineMapper.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppPipeline; -import com.gxwebsoft.app.param.AppPipelineParam; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * CI/CD 流水线配置 Mapper - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Mapper -public interface AppPipelineMapper extends BaseMapper { - - /** - * 查询流水线列表 - */ - List selectPipelineList(@Param("param") AppPipelineParam param); - - /** - * 查询流水线详情 - */ - AppPipeline selectPipelineDetail(@Param("id") Long id); - - /** - * 查询应用的所有流水线 - */ - List selectByAppId(@Param("appId") Long appId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppProductMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppProductMapper.java deleted file mode 100644 index 5869fac..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppProductMapper.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.gxwebsoft.app.entity.AppProduct; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -/** - * 应用产品 Mapper 接口 - * - * @author 科技小王子 - */ -@Mapper -public interface AppProductMapper extends BaseMapper { - - /** - * 分页查询应用列表 - * @param userId 用户ID(可选,为空则查所有) - */ - IPage selectPageList(Page page, @Param("ew") AppProduct product, @Param("userId") Integer userId); - - /** - * 查询用户的应用列表(创建者) - */ - List selectByUserId(@Param("userId") Integer userId); - - /** - * 分页查询用户创建的应用 - */ - IPage selectPageByUserId(Page page, @Param("userId") Integer userId); - - /** - * 分页查询用户参与的应用 - */ - IPage selectPageJoinedApps(Page page, @Param("userId") Integer userId); - - /** - * 根据应用标识查询 - */ - AppProduct selectByCode(@Param("code") String code); - - /** - * 更新发布状态 - */ - int updatePublishStatus(@Param("productId") Integer productId, @Param("status") String status); - - /** - * 增加浏览次数 - */ - int incrementClicks(@Param("productId") Integer productId); - - /** - * 增加安装次数 - */ - int incrementInstalls(@Param("productId") Integer productId); - - /** - * 增加下载次数 - */ - int incrementDownloads(@Param("productId") Integer productId); - - /** - * 增加点赞数 - */ - int incrementLikes(@Param("productId") Integer productId); - - /** - * 按用户ID列表批量统计应用数量 - * - * @param userIds 用户ID列表 - * @return 统计结果列表,每项包含 userId, totalCount, publishedCount - */ - List selectStatsByUserIds(@Param("userIds") List userIds); - - /** - * 查询用户可访问的应用列表(带 myRole 字段) - * 包含:用户创建的应用(owner)+ 被邀请加入的应用(成员角色) - * - * @param userId 用户ID - * @return 应用列表(带 myRole 字段) - */ - List selectAccessibleApps(@Param("userId") Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppResourceMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppResourceMapper.java deleted file mode 100644 index edca6de..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppResourceMapper.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.param.AppResourceParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 开发者资源 Mapper - * - * @author 科技小王子 - * @since 2026-03-31 - */ -public interface AppResourceMapper extends BaseMapper { - - /** - * 分页查询(关联应用名称) - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppResourceParam param); - - /** - * 查询全部列表(关联应用名称) - */ - List selectListRel(@Param("param") AppResourceParam param); - - /** - * 根据用户查询有权限的资源(包括协作资源) - * 查询条件:owner_user_id = #{userId} OR app_id IN (用户有权限的应用ID列表) - */ - List selectListByUserAccess(@Param("param") AppResourceParam param, - @Param("userAppIds") List userAppIds); - - /** - * 统计各类型资源数量(仅个人资源),返回 [{resourceType, cnt}] - */ - List> countByType(@Param("userId") Integer userId, - @Param("tenantId") Integer tenantId); - - /** - * 统计各类型资源数量(包含协作者有权限的资源) - */ - List> countByTypeForUser(@Param("userId") Integer userId, - @Param("tenantId") Integer tenantId, - @Param("userAppIds") List userAppIds); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppSettingMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppSettingMapper.java deleted file mode 100644 index 9f00b35..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppSettingMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppSetting; -import com.gxwebsoft.app.param.AppSettingParam; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 平台设置表 Mapper - */ -@Mapper -public interface AppSettingMapper extends BaseMapper { - - /** - * 分页查询 - */ - IPage selectPageRel(IPage page, @Param("param") AppSettingParam param); - - /** - * 查询列表 - */ - List selectListRel(@Param("param") AppSettingParam param); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppSubscriptionMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppSubscriptionMapper.java deleted file mode 100644 index 5bc684e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppSubscriptionMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppSubscription; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface AppSubscriptionMapper extends BaseMapper { -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppTicketMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppTicketMapper.java deleted file mode 100644 index c8e3b27..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppTicketMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppTicket; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -/** - * 应用工单 Mapper - */ -public interface AppTicketMapper extends BaseMapper { - - /** - * 查询当天最大序号(ticket_no 格式:TK-YYMMDD-XXXX) - */ - @Select("SELECT COALESCE(MAX(SUBSTRING(ticket_no, 13, 4) + 0), 0) " + - "FROM app_ticket WHERE ticket_no LIKE CONCAT('TK-', #{datePart}, '-%')") - Integer selectMaxSeqForDate(@Param("datePart") String datePart); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppTicketReplyMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppTicketReplyMapper.java deleted file mode 100644 index 3fc0a16..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppTicketReplyMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppTicketReply; - -/** - * 工单回复 Mapper - */ -public interface AppTicketReplyMapper extends BaseMapper { -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppUserCacheMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppUserCacheMapper.java deleted file mode 100644 index 14a3be0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppUserCacheMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.gxwebsoft.app.entity.AppUserCache; -import org.apache.ibatis.annotations.Mapper; - -/** - * 用户缓存 Mapper - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Mapper -public interface AppUserCacheMapper extends BaseMapper { -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppUserMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppUserMapper.java deleted file mode 100644 index af330b3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppUserMapper.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.param.AppUserParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 应用成员Mapper - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -public interface AppUserMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppUserParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") AppUserParam param); - - /** - * 查询用户参与的应用列表(含角色信息),用于 check-access 和 accessible 接口 - * 返回:appId, productName, productCode, icon, role, isOwner - * - * @param userId 用户ID - * @return 用户参与的应用及角色信息列表 - */ - List> selectUserAccessibleApps(@Param("userId") Integer userId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppVersionMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppVersionMapper.java deleted file mode 100644 index 187b1a6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/AppVersionMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.app.entity.AppVersion; -import com.gxwebsoft.app.param.AppVersionParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 应用版本发布记录Mapper - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -public interface AppVersionMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") AppVersionParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") AppVersionParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/SysUserCrossDbMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/SysUserCrossDbMapper.java deleted file mode 100644 index c9a6e59..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/SysUserCrossDbMapper.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.app.mapper; - -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.entity.UserBalanceLog; -import org.apache.ibatis.annotations.Insert; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; -import org.apache.ibatis.annotations.Update; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 跨库查询 Mapper - * 用于从 gxwebsoft_core 库查询 sys_user 表 - */ -@Mapper -public interface SysUserCrossDbMapper { - - /** - * 根据手机号查询用户 - */ - @Select("SELECT user_id AS userId, username, nickname, avatar, phone, email, status, tenant_id AS tenantId, balance " + - "FROM gxwebsoft_core.sys_user WHERE phone = #{phone} AND deleted = 0 LIMIT 1") - User selectByPhone(@Param("phone") String phone); - - /** - * 根据用户ID查询用户 - */ - @Select("SELECT user_id AS userId, username, nickname, avatar, phone, email, status, tenant_id AS tenantId, balance " + - "FROM gxwebsoft_core.sys_user WHERE user_id = #{userId} AND deleted = 0 LIMIT 1") - User selectByUserId(@Param("userId") Integer userId); - - /** - * 搜索用户(按手机号、用户名、昵称模糊搜索) - */ - @Select("") - List searchUsers(@Param("keyword") String keyword); - - /** - * 查询用户类型(type字段:0普通用户 1企业用户 2开发者用户) - */ - @Select("SELECT type FROM gxwebsoft_core.sys_user WHERE user_id = #{userId} AND deleted = 0 LIMIT 1") - Integer selectUserType(@Param("userId") Integer userId); - - /** - * 更新用户余额(跨库更新 gxwebsoft_core.sys_user) - */ - @Update("UPDATE gxwebsoft_core.sys_user SET balance = #{balance} WHERE user_id = #{userId} AND deleted = 0") - int updateBalance(@Param("userId") Integer userId, @Param("balance") BigDecimal balance); - - /** - * 根据用户ID更新(跨库更新 gxwebsoft_core.sys_user) - */ - @Update("") - int updateByUserId(@Param("userId") Integer userId, @Param("balance") BigDecimal balance); - - /** - * 插入余额日志(跨库插入 gxwebsoft_core.sys_user_balance_log) - */ - @Insert("INSERT INTO gxwebsoft_core.sys_user_balance_log " + - "(user_id, scene, money, balance, order_no, comments, tenant_id, create_time) " + - "VALUES (#{userId}, #{scene}, #{money}, #{balance}, #{orderNo}, #{comments}, #{tenantId}, NOW())") - int insertBalanceLog(@Param("userId") Integer userId, - @Param("scene") Integer scene, - @Param("money") BigDecimal money, - @Param("balance") BigDecimal balance, - @Param("orderNo") String orderNo, - @Param("comments") String comments, - @Param("tenantId") Integer tenantId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppApiKeyMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppApiKeyMapper.xml deleted file mode 100644 index b952f23..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppApiKeyMapper.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - id, name, api_key, key_prefix, status, scopes, expire_time, - last_used_at, usage_count, remark, deleted, user_id, tenant_id, - create_time, update_time - - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppBuildMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppBuildMapper.xml deleted file mode 100644 index 9e36912..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppBuildMapper.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, app_id, version_id, build_number, name, branch, commit_sha, commit_message, - commit_author, ci_type, ci_job_id, ci_run_id, ci_api_url, status, started_at, - finished_at, duration, log_url, artifact_url, artifact_name, artifact_size, - error_message, trigger_type, triggered_by, config, user_id, tenant_id, - create_time, update_time - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppCloudCredentialMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppCloudCredentialMapper.xml deleted file mode 100644 index 1d88666..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppCloudCredentialMapper.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - SELECT a.* - FROM app_cloud_credential a - - - AND a.id = #{param.id} - - - AND a.provider = #{param.provider} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.tenant_id = #{param.tenantId} - - - - - - - - - - - \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppConfigMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppConfigMapper.xml deleted file mode 100644 index b0a12b3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppConfigMapper.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - SELECT a.* - FROM app_config a - - a.deleted = 0 - - AND a.config_id = #{param.configId} - - - AND a.app_id = #{param.appId} - - - AND a.config_key LIKE CONCAT('%', #{param.configKey}, '%') - - - AND a.config_type = #{param.configType} - - - AND a.is_secret = #{param.isSecret} - - - AND a.tenant_id = #{param.tenantId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.config_key LIKE CONCAT('%', #{param.keywords}, '%') - - - - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppCredentialMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppCredentialMapper.xml deleted file mode 100644 index b0a1a25..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppCredentialMapper.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - SELECT a.*, w.product_name, w.product_code, w.icon - FROM app_credential a - LEFT JOIN app_product w ON a.app_id = w.product_id AND w.deleted = 0 - - - AND a.id = #{param.id} - - - AND a.app_id = #{param.appId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.client_id = #{param.clientId} - - - AND a.type = #{param.type} - - - AND a.scopes LIKE CONCAT('%', #{param.scopes}, '%') - - - AND a.remark LIKE CONCAT('%', #{param.remark}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.client_id LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppEventMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppEventMapper.xml deleted file mode 100644 index e544bf3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppEventMapper.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - SELECT a.*, w.product_name, w.product_code, w.icon - FROM app_event a - LEFT JOIN app_product w ON a.app_id = w.product_id AND w.deleted = 0 - - - AND a.id = #{param.id} - - - AND a.app_id = #{param.appId} - - - AND a.event_type = #{param.eventType} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.operator_id = #{param.operatorId} - - - AND a.ref_id = #{param.refId} - - - AND a.ref_type = #{param.refType} - - - AND a.status = #{param.status} - - - AND a.user_id = #{param.userId} - - - AND a.tenant_id = #{param.tenantId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.title LIKE CONCAT('%', #{param.keywords}, '%') - OR a.content LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - ORDER BY a.create_time DESC - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppGitAccountMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppGitAccountMapper.xml deleted file mode 100644 index 17f40ec..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppGitAccountMapper.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppPermissionRequestMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppPermissionRequestMapper.xml deleted file mode 100644 index 4e3b4ce..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppPermissionRequestMapper.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppPipelineMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppPipelineMapper.xml deleted file mode 100644 index 460842d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppPipelineMapper.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, app_id, name, description, ci_type, repo_full_name, workflow_file, stages, - env, default_branch, enabled, auto_deploy, timeout, config, last_build_id, - last_build_status, last_build_time, success_count, failure_count, user_id, - tenant_id, create_time, update_time - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppProductMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppProductMapper.xml deleted file mode 100644 index f7a584e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppProductMapper.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UPDATE app_product - SET publish_status = #{status}, - update_time = NOW() - - , publish_time = NOW() - - - , review_time = NOW() - - WHERE product_id = #{productId} - - - - - UPDATE app_product SET clicks = clicks + 1 WHERE product_id = #{productId} - - - - - UPDATE app_product SET installs = installs + 1 WHERE product_id = #{productId} - - - - - UPDATE app_product SET downloads = downloads + 1 WHERE product_id = #{productId} - - - - - UPDATE app_product SET likes = likes + 1 WHERE product_id = #{productId} - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppResourceMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppResourceMapper.xml deleted file mode 100644 index 537e28f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppResourceMapper.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - SELECT a.*, w.product_name as appName - FROM app_resource a - LEFT JOIN app_product w ON a.app_id = w.product_id AND w.deleted = 0 - - a.deleted = 0 - - AND a.resource_id = #{param.resourceId} - - - AND a.resource_type = #{param.resourceType} - - - AND a.app_id = #{param.appId} - - - AND a.provider = #{param.provider} - - - AND a.status = #{param.status} - - - - AND (a.owner_user_id = #{param.userId} - - - OR a.app_id IN - - #{appId} - - - ) - - - AND a.tenant_id = #{param.tenantId} - - - AND ( - a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.ip LIKE CONCAT('%', #{param.keywords}, '%') - OR a.domain LIKE CONCAT('%', #{param.keywords}, '%') - OR a.host LIKE CONCAT('%', #{param.keywords}, '%') - OR w.product_name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - ORDER BY a.create_time DESC - - - - - - - - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppSettingMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppSettingMapper.xml deleted file mode 100644 index d31354d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppSettingMapper.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - SELECT a.* - FROM app_setting a - - a.deleted = 0 - - AND a.setting_id = #{param.settingId} - - - AND a.category = #{param.category} - - - AND a.setting_key = #{param.settingKey} - - - AND a.setting_name LIKE CONCAT('%', #{param.settingName}, '%') - - - AND a.value_type = #{param.valueType} - - - AND a.is_enabled = #{param.isEnabled} - - - AND a.is_public = #{param.isPublic} - - - AND a.tenant_id = #{param.tenantId} - - - AND (a.setting_key LIKE CONCAT('%', #{param.keywords}, '%') - OR a.setting_name LIKE CONCAT('%', #{param.keywords}, '%')) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppUserCacheMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppUserCacheMapper.xml deleted file mode 100644 index ac183bc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppUserCacheMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppUserMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppUserMapper.xml deleted file mode 100644 index 34225e0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppUserMapper.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - SELECT a.*, w.product_name, w.product_code, w.icon, - c.username, c.nickname, c.avatar, c.phone - FROM app_user a - LEFT JOIN app_product w ON a.app_id = w.product_id AND w.deleted = 0 AND w.tenant_id = a.tenant_id - LEFT JOIN app_user_cache c ON a.user_id = c.user_id - - - AND a.id = #{param.id} - - - AND a.app_id = #{param.appId} - - - AND a.user_id = #{param.userId} - - - AND (a.username LIKE CONCAT('%', #{param.username}, '%') - OR a.nickname LIKE CONCAT('%', #{param.username}, '%')) - - - AND a.role = #{param.role} - - - AND a.invite_by = #{param.inviteBy} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.tenant_id = #{param.tenantId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.username LIKE CONCAT('%', #{param.keywords}, '%') - OR a.nickname LIKE CONCAT('%', #{param.keywords}, '%')) - - - - - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppVersionMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppVersionMapper.xml deleted file mode 100644 index 1e36c1f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/mapper/xml/AppVersionMapper.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - SELECT a.*, w.product_name, w.product_code, w.icon - FROM app_version a - LEFT JOIN app_product w ON a.app_id = w.product_id AND w.deleted = 0 - - - AND a.id = #{param.id} - - - AND a.app_id = #{param.appId} - - - AND a.version_no = #{param.versionNo} - - - AND a.version_name LIKE CONCAT('%', #{param.versionName}, '%') - - - AND a.env = #{param.env} - - - AND a.status = #{param.status} - - - AND a.is_current = #{param.isCurrent} - - - AND a.publish_by = #{param.publishBy} - - - AND a.user_id = #{param.userId} - - - AND a.tenant_id = #{param.tenantId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.version_no LIKE CONCAT('%', #{param.keywords}, '%') - OR a.version_name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.changelog LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppApiKeyParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppApiKeyParam.java deleted file mode 100644 index 57a0aea..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppApiKeyParam.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用 API Key 查询参数 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppApiKeyParam对象", description = "AppApiKey查询参数") -public class AppApiKeyParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "Key名称(模糊搜索)") - private String name; - - @Schema(description = "状态: 0正常, 1禁用") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "应用ID") - @QueryField(type = QueryType.EQ) - private Long appId; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppArticleCategoryParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppArticleCategoryParam.java deleted file mode 100644 index d19f342..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppArticleCategoryParam.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 平台文章分类查询参数 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Schema(description = "平台文章分类查询参数") -public class AppArticleCategoryParam extends BaseParam { - - @Schema(description = "分类ID") - private Integer categoryId; - - @Schema(description = "状态") - private Integer status; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppArticleParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppArticleParam.java deleted file mode 100644 index b2e4e6c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppArticleParam.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 平台文章查询参数 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Schema(description = "平台文章查询参数") -public class AppArticleParam extends BaseParam { - - @Schema(description = "文章ID") - private Integer articleId; - - @Schema(description = "文章模型,article/announcement") - private String model; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "分类ID") - private Integer categoryId; - - @Schema(description = "是否推荐") - private Integer recommend; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppBuildParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppBuildParam.java deleted file mode 100644 index 7a810e7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppBuildParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * CI/CD 构建查询参数 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppBuildParam对象", description = "构建查询参数") -public class AppBuildParam extends BaseParam { - - @Schema(description = "应用ID") - private Long appId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "构建状态") - private String status; - - @Schema(description = "CI系统类型") - private String ciType; - - @Schema(description = "分支") - private String branch; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppCloudCredentialParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppCloudCredentialParam.java deleted file mode 100644 index d6ff03e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppCloudCredentialParam.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 云账号凭证查询参数 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppCloudCredentialParam对象", description = "云账号凭证查询参数") -public class AppCloudCredentialParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "云服务商: aliyun/tencent/huawei/qiniu") - @QueryField(type = QueryType.EQ) - private String provider; - - @Schema(description = "凭证名称") - private String name; - - @Schema(description = "状态: 0正常 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除: 0否 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppConfigParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppConfigParam.java deleted file mode 100644 index 9e2df25..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppConfigParam.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.BaseParam; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用配置表查询参数 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class AppConfigParam extends BaseParam { - - /** - * 配置ID - */ - private Integer configId; - - /** - * 应用ID - */ - private Integer appId; - - /** - * 配置键 - */ - private String configKey; - - /** - * 配置类型 - */ - private String configType; - - /** - * 是否敏感信息 - */ - private Integer isSecret; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppContractParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppContractParam.java deleted file mode 100644 index 070f2c5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppContractParam.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.PageParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 合同查询参数 - * - * @author 科技小王子 - * @since 2026-04-13 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Schema(description = "合同查询参数") -public class AppContractParam extends PageParam { - - @Schema(description = "合同类型: service/cooperation/purchase/other") - private String contractType; - - @Schema(description = "状态: draft/pending/active/expired/terminated") - private String status; - - @Schema(description = "关键词(合同名称/编号)") - private String keywords; - - @Schema(description = "开始日期(用于筛选创建时间范围)") - private String startDate; - - @Schema(description = "结束日期(用于筛选创建时间范围)") - private String endDate; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppCredentialParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppCredentialParam.java deleted file mode 100644 index cced307..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppCredentialParam.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用密钥凭证查询参数 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:43 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppCredentialParam对象", description = "应用密钥凭证查询参数") -public class AppCredentialParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "关联应用ID(AppProduct.productId)") - @QueryField(type = QueryType.EQ) - private String appId; - - @Schema(description = "凭证名称,如生产环境密钥") - private String name; - - @Schema(description = "OAuth Client ID(公开)") - @QueryField(type = QueryType.EQ) - private String clientId; - - @Schema(description = "凭证类型: server/client/webhook") - @QueryField(type = QueryType.EQ) - private String type; - - @Schema(description = "权限范围,空格分隔") - private String scopes; - - @Schema(description = "备注") - private String remark; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppEventParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppEventParam.java deleted file mode 100644 index 0940758..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppEventParam.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用操作动态查询参数 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppEventParam对象", description = "应用操作动态查询参数") -public class AppEventParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "关联应用ID") - @QueryField(type = QueryType.EQ) - private Long appId; - - @Schema(description = "事件类型: created/published/updated/domain_bound/member_added/status_changed") - @QueryField(type = QueryType.EQ) - private String eventType; - - @Schema(description = "事件标题(模糊)") - private String title; - - @Schema(description = "操作人用户ID") - @QueryField(type = QueryType.EQ) - private Long operatorId; - - @Schema(description = "关联ID,如版本ID") - @QueryField(type = QueryType.EQ) - private Long refId; - - @Schema(description = "关联类型") - @QueryField(type = QueryType.EQ) - private String refType; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppNotificationParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppNotificationParam.java deleted file mode 100644 index 9110d73..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppNotificationParam.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 通知查询参数 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Schema(description = "通知查询参数") -public class AppNotificationParam extends BaseParam { - - @Schema(description = "通知类型: ticket/review/system/resource/permission/member/payment") - private String type; - - @Schema(description = "是否已读: 0未读 1已读,不传查全部") - private Integer isRead; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppPermissionRequestParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppPermissionRequestParam.java deleted file mode 100644 index d2c54ce..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppPermissionRequestParam.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 权限申请查询参数 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppPermissionRequestParam对象", description = "权限申请查询参数") -public class AppPermissionRequestParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "Git用户名") - private String gitUsername; - - @Schema(description = "申请仓库路径") - private String repo; - - @Schema(description = "状态: pending待审核/approved已通过/rejected已拒绝") - @QueryField(type = QueryType.EQ) - private String status; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppPipelineParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppPipelineParam.java deleted file mode 100644 index 680ba31..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppPipelineParam.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * CI/CD 流水线查询参数 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "AppPipelineParam对象", description = "流水线查询参数") -public class AppPipelineParam extends BaseParam { - - @Schema(description = "应用ID") - private Long appId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "CI系统类型") - private String ciType; - - @Schema(description = "是否启用") - private Boolean enabled; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppProductParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppProductParam.java deleted file mode 100644 index e438852..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppProductParam.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.PageParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; - -/** - * 应用产品查询参数 - * - * @author 科技小王子 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Schema(name = "AppProductParam对象", description = "应用产品查询参数") -public class AppProductParam extends PageParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "应用名称") - private String productName; - - @Schema(description = "应用标识") - private String productCode; - - @Schema(description = "应用类型") - private Integer appType; - - @Schema(description = "分类ID") - private Integer categoryId; - - @Schema(description = "发布状态") - private String publishStatus; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "是否上架市场") - private Integer market; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户ID") - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppResourceParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppResourceParam.java deleted file mode 100644 index 6ce04c7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppResourceParam.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.List; - -/** - * 开发者资源查询参数 - * - * @author 科技小王子 - * @since 2026-03-31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppResourceParam对象", description = "开发者资源查询参数") -public class AppResourceParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "资源ID") - @QueryField(type = QueryType.EQ) - private Long resourceId; - - @Schema(description = "资源类型: server/database/storage/domain/ssl") - @QueryField(type = QueryType.EQ) - private String resourceType; - - @Schema(description = "关联应用ID") - @QueryField(type = QueryType.EQ) - private Long appId; - - @Schema(description = "服务商") - @QueryField(type = QueryType.EQ) - private String provider; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private String status; - - @Schema(description = "所属用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; - - @Schema(description = "关键词(名称/IP/域名/Host模糊搜索)") - private String keywords; - - @Schema(description = "用户有权限的应用ID列表(协作权限)") - private List userAppIds; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppSettingParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppSettingParam.java deleted file mode 100644 index 672682e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppSettingParam.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.BaseParam; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 平台设置表查询参数 - */ -@Data -@EqualsAndHashCode(callSuper = true) -public class AppSettingParam extends BaseParam { - - /** - * 设置ID - */ - private Integer settingId; - - /** - * 设置分类:basic/review/market/register/notify/maintenance - */ - private String category; - - /** - * 设置项标识 - */ - private String settingKey; - - /** - * 设置项名称 - */ - private String settingName; - - /** - * 设置类型:string/number/boolean/json - */ - private String valueType; - - /** - * 是否启用 - */ - private Integer isEnabled; - - /** - * 是否公开 - */ - private Integer isPublic; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppTicketParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppTicketParam.java deleted file mode 100644 index a0347ab..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppTicketParam.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.web.PageParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.util.List; - -/** - * 工单查询参数 - */ -@Data -@EqualsAndHashCode(callSuper = true) -@Schema(description = "工单查询参数") -public class AppTicketParam extends PageParam { - - @Schema(description = "关联应用ID") - private Long appId; - - @Schema(description = "应用ID列表(过滤用户有权限的应用)") - private List appIds; - - @Schema(description = "工单状态") - private String status; - - @Schema(description = "工单分类") - private String category; - - @Schema(description = "优先级") - private String priority; - - @Schema(description = "处理人ID(传0=未分配)") - private Integer assigneeId; - - @Schema(description = "关键词(标题/工单编号)") - private String keywords; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppUserParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppUserParam.java deleted file mode 100644 index 56a7e66..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppUserParam.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用成员查询参数 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppUserParam对象", description = "应用成员查询参数") -public class AppUserParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "关联应用ID") - @QueryField(type = QueryType.EQ) - private Long appId; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "用户名(模糊搜索)") - private String username; - - @Schema(description = "角色: owner/admin/developer/viewer") - @QueryField(type = QueryType.EQ) - private String role; - - @Schema(description = "邀请人用户ID") - @QueryField(type = QueryType.EQ) - private Long inviteBy; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppVersionParam.java b/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppVersionParam.java deleted file mode 100644 index 251b71b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/param/AppVersionParam.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.gxwebsoft.app.param; - -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 应用版本发布记录查询参数 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "AppVersionParam对象", description = "应用版本发布记录查询参数") -public class AppVersionParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "关联应用ID") - @QueryField(type = QueryType.EQ) - private Long appId; - - @Schema(description = "版本号,如 1.0.0") - @QueryField(type = QueryType.EQ) - private String versionNo; - - @Schema(description = "版本名称(模糊)") - private String versionName; - - @Schema(description = "环境: development/staging/production") - @QueryField(type = QueryType.EQ) - private String env; - - @Schema(description = "状态 0=构建中 1=已发布 2=已回滚 3=构建失败") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否为当前版本") - @QueryField(type = QueryType.EQ) - private Boolean isCurrent; - - @Schema(description = "发布人用户ID") - @QueryField(type = QueryType.EQ) - private Long publishBy; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tenantId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppApiKeyService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppApiKeyService.java deleted file mode 100644 index 67c84dc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppApiKeyService.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppApiKey; -import com.gxwebsoft.app.param.AppApiKeyParam; - -import java.util.List; -import java.util.Map; - -/** - * 应用 API Key 服务接口 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -public interface AppApiKeyService extends IService { - - /** - * 分页查询 - */ - IPage pageRel(AppApiKeyParam param); - - /** - * 列表查询 - */ - List listRel(AppApiKeyParam param); - - /** - * 根据ID查询 - */ - AppApiKey getByIdRel(Long id); - - /** - * 创建 API Key - */ - AppApiKey createApiKey(AppApiKey apiKey, Integer userId, Integer tenantId); - - /** - * 更新 API Key - */ - boolean updateApiKey(AppApiKey apiKey); - - /** - * 更新状态 - */ - boolean updateStatus(Long id, Integer status, Integer userId); - - /** - * 删除 API Key - */ - boolean removeApiKey(Long id, Integer userId); - - /** - * 统计用户 API Key 信息 - */ - Map statsByUser(Integer userId, Integer tenantId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppArticleCategoryService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppArticleCategoryService.java deleted file mode 100644 index 0f039c1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppArticleCategoryService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppArticleCategory; -import com.gxwebsoft.app.param.AppArticleCategoryParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; - -import java.util.List; - -/** - * 平台文章分类服务 - */ -public interface AppArticleCategoryService extends IService { - - PageResult page(AppArticleCategoryParam param); - - List list(AppArticleCategoryParam param); - - AppArticleCategory getDetail(Integer categoryId); - - boolean saveCategory(AppArticleCategory category, User loginUser, Integer tenantId); - - boolean updateCategory(AppArticleCategory category); - - boolean removeCategory(Integer categoryId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppArticleService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppArticleService.java deleted file mode 100644 index c1bf88b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppArticleService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppArticle; -import com.gxwebsoft.app.param.AppArticleParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; - -import java.util.List; -import java.util.Map; - -/** - * 平台文章服务 - */ -public interface AppArticleService extends IService { - - PageResult page(AppArticleParam param); - - List list(AppArticleParam param); - - AppArticle getDetail(Integer articleId, boolean increaseViews); - - AppArticle getByCode(String code); - - boolean saveArticle(AppArticle article, User loginUser, Integer tenantId); - - boolean updateArticle(AppArticle article); - - boolean removeArticle(Integer articleId); - - Map getStats(AppArticleParam param); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppBuildService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppBuildService.java deleted file mode 100644 index ade1a2b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppBuildService.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppBuild; -import com.gxwebsoft.app.param.AppBuildParam; -import com.gxwebsoft.common.core.web.PageResult; - -import java.util.List; -import java.util.Map; - -/** - * CI/CD 构建记录 Service - * - * @author 科技小王子 - * @since 2026-04-03 - */ -public interface AppBuildService extends IService { - - /** - * 分页查询构建记录 - */ - PageResult pageBuild(AppBuildParam param); - - /** - * 查询构建详情 - */ - AppBuild getBuildDetail(Long id); - - /** - * 查询应用的最新构建 - */ - AppBuild getLatestBuild(Long appId); - - /** - * 触发构建 - * @param appId 应用ID - * @param branch 分支 - * @param triggeredBy 触发人ID - * @return 构建记录 - */ - AppBuild triggerBuild(Long appId, String branch, Integer triggeredBy); - - /** - * 获取构建日志 - * @param buildId 本地构建ID - * @return 构建日志 - */ - String getBuildLog(Long buildId); - - /** - * Webhook 回调 - 更新构建状态 - * @param ciType CI类型 - * @param payload 回调数据 - */ - void handleWebhook(String ciType, Map payload); - - /** - * 获取构建统计 - * @param appId 应用ID - * @return 统计结果 - */ - Map getBuildStats(Long appId); - - /** - * 取消构建 - * @param buildId 构建ID - */ - boolean cancelBuild(Long buildId); - - /** - * 重试构建 - * @param buildId 构建ID - * @param triggeredBy 触发人ID - */ - AppBuild retryBuild(Long buildId, Integer triggeredBy); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppCloudCredentialService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppCloudCredentialService.java deleted file mode 100644 index 7aef5dd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppCloudCredentialService.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppCloudCredential; -import com.gxwebsoft.app.param.AppCloudCredentialParam; - -import java.util.List; -import java.util.Map; - -/** - * 云账号凭证 Service 接口 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -public interface AppCloudCredentialService extends IService { - - /** - * 分页查询 - */ - com.gxwebsoft.common.core.web.PageResult pageRel(AppCloudCredentialParam param); - - /** - * 列表查询 - */ - List listRel(AppCloudCredentialParam param); - - /** - * 新增凭证 - */ - AppCloudCredential add(AppCloudCredential credential) throws Exception; - - /** - * 修改凭证 - */ - AppCloudCredential update(AppCloudCredential credential) throws Exception; - - /** - * 删除凭证 - */ - void remove(Long id, Integer userId) throws Exception; - - /** - * 获取云账号凭证(解密) - * @param provider 云服务商类型 - * @param userId 用户ID - * @return 凭证映射 (accessKeyId -> xxx, accessKeySecret -> xxx, ...) - */ - Map getCredentials(String provider, Integer userId); - - /** - * 根据凭证ID获取云账号凭证(解密) - * @param credentialId 凭证ID - * @return 凭证映射 (accessKeyId -> xxx, accessKeySecret -> xxx, ...) - */ - Map getCredentialsByCredentialId(Long credentialId); - - /** - * 测试凭证有效性 - * @param provider 云服务商类型 - * @param credentials 凭证 - * @return 是否连接成功 - */ - boolean testConnection(String provider, Map credentials); - - /** - * 测试凭证有效性(返回详细结果) - * @param provider 云服务商类型 - * @param credentials 凭证 - * @return 包含成功状态和错误消息的数组 [success, errorMessage] - */ - Object[] testConnectionWithMessage(String provider, Map credentials); -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppConfigService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppConfigService.java deleted file mode 100644 index b852f57..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppConfigService.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.gxwebsoft.app.entity.AppConfig; -import com.gxwebsoft.app.param.AppConfigParam; - -import java.util.List; -import java.util.Map; - -/** - * 应用配置表 Service - */ -public interface AppConfigService { - - /** - * 分页查询应用配置 - */ - List page(AppConfigParam param); - - /** - * 获取应用配置列表 - */ - List list(AppConfigParam param); - - /** - * 根据应用ID获取配置映射(自动解密) - */ - Map getConfigsByAppId(Integer appId); - - /** - * 获取单个配置值 - */ - String getConfigValue(Integer appId, String configKey); - - /** - * 保存配置 - */ - void saveConfig(AppConfig config); - - /** - * 批量保存配置 - */ - void batchSaveConfig(Integer appId, List configs); - - /** - * 更新配置 - */ - void updateConfig(AppConfig config); - - /** - * 删除配置 - */ - void deleteConfig(Integer configId); - - /** - * 根据应用ID删除所有配置 - */ - void deleteByAppId(Integer appId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppContractService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppContractService.java deleted file mode 100644 index bed7f67..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppContractService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppContract; -import com.gxwebsoft.app.param.AppContractParam; -import com.gxwebsoft.common.core.web.PageResult; - -import java.util.Map; - -/** - * 合同管理 Service - * - * @author 科技小王子 - * @since 2026-04-13 - */ -public interface AppContractService extends IService { - - /** 分页查询(当前用户的合同) */ - PageResult page(AppContractParam param, Integer userId); - - /** 创建合同 */ - AppContract create(AppContract contract, Integer userId); - - /** 更新合同 */ - AppContract update(AppContract contract, Integer userId); - - /** 删除合同(软删除) */ - void remove(Long contractId, Integer userId); - - /** 统计数据 */ - Map stats(Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppCredentialService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppCredentialService.java deleted file mode 100644 index ddd5d66..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppCredentialService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.app.entity.AppCredential; -import com.gxwebsoft.app.param.AppCredentialParam; - -import java.util.List; - -/** - * 应用密钥凭证Service - * - * @author 科技小王子 - * @since 2026-03-28 21:29:43 - */ -public interface AppCredentialService extends IService { - - /** - * 分页关联查询 - */ - PageResult pageRel(AppCredentialParam param); - - /** - * 关联查询全部 - */ - List listRel(AppCredentialParam param); - - /** - * 根据id查询 - */ - AppCredential getByIdRel(Integer id); - - /** - * 创建凭证(自动生成 appId 和 appSecret) - * - * @param credential 凭证基础信息 - * @return 包含明文 appSecret 的凭证对象(仅此次返回,之后不再展示) - */ - AppCredential createCredential(AppCredential credential); - - /** - * 重置密钥(重新生成 appSecret) - * - * @param id 凭证ID - * @return 包含新明文 appSecret 的凭证对象 - */ - AppCredential resetSecret(Long id); - - /** - * 禁用/启用凭证 - * - * @param id 凭证ID - * @param status 0=正常 1=冻结 - */ - boolean updateStatus(Long id, Integer status); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppEventService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppEventService.java deleted file mode 100644 index ca1c62d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppEventService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.app.entity.AppEvent; -import com.gxwebsoft.app.param.AppEventParam; - -import java.util.List; - -/** - * 应用操作动态Service - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -public interface AppEventService extends IService { - - /** - * 分页关联查询 - */ - PageResult pageRel(AppEventParam param); - - /** - * 关联查询全部 - */ - List listRel(AppEventParam param); - - /** - * 根据id查询 - */ - AppEvent getByIdRel(Integer id); - - /** - * 记录应用事件(便捷方法,供其他模块调用) - * - * @param appId 应用ID - * @param eventType 事件类型(created/published/updated/domain_bound/member_added/status_changed 等) - * @param title 事件标题 - * @param content 详细描述 - * @param operatorId 操作人用户ID - * @param operatorName 操作人名称 - * @param refId 关联记录ID(如版本ID) - * @param refType 关联记录类型 - */ - void logEvent(Long appId, String eventType, String title, String content, - Long operatorId, String operatorName, Long refId, String refType); - - /** - * 快捷记录事件(无关联记录) - */ - void logEvent(Long appId, String eventType, String title, Long operatorId, String operatorName); - - /** - * 获取指定应用的最新一条事件(用于卡片"最新动态"展示) - * - * @param appId 应用ID - */ - AppEvent getLatestEvent(Long appId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppGitAccountService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppGitAccountService.java deleted file mode 100644 index eddd6f8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppGitAccountService.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppGitAccount; - -import java.util.Map; - -/** - * Git账号绑定 Service - * - * @author 科技小王子 - * @since 2026-04-02 - */ -public interface AppGitAccountService extends IService { - - /** - * 保存或更新Git账号绑定信息 - * - * @param username 用户名 - * @param email 邮箱(可选) - * @param remark 备注(可选) - * @param userId 用户ID - * @param tenantId 租户ID - * @return 绑定结果 - */ - AppGitAccount saveGitAccount(String username, String email, String remark, Integer userId, Integer tenantId); - - /** - * 获取用户的Git账号绑定状态 - * - * @param userId 用户ID - * @param tenantId 租户ID - * @return 绑定状态 - */ - AppGitAccount getGitAccountStatus(Integer userId, Integer tenantId); - - /** - * 分页查询Git账号绑定列表(管理端) - * - * @param status 状态筛选(可选) - * @param keyword 关键词搜索(可选,匹配用户名/邮箱) - * @param page 页码 - * @param size 每页数量 - * @return 分页结果 - */ - Map pageGitAccounts(String status, String keyword, int page, int size); - - /** - * 审核Git账号绑定 - 通过 - * - * @param id 记录ID - * @param reviewerId 审核人ID - * @param reviewerName 审核人姓名 - * @param note 审核备注(可选) - * @return 是否成功 - */ - boolean approveAccount(Long id, Integer reviewerId, String reviewerName, String note); - - /** - * 审核Git账号绑定 - 拒绝 - * - * @param id 记录ID - * @param reviewerId 审核人ID - * @param reviewerName 审核人姓名 - * @param reason 拒绝原因(必填) - * @return 是否成功 - */ - boolean rejectAccount(Long id, Integer reviewerId, String reviewerName, String reason); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppInviteService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppInviteService.java deleted file mode 100644 index e67c33e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppInviteService.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.gxwebsoft.app.service; - -import java.util.Map; - -/** - * 应用成员邀请 Service 接口 - */ -public interface AppInviteService { - - /** - * 生成二维码邀请 - * - * @param appId 应用ID - * @param role 角色 - * @param inviterId 邀请人ID - * @return 包含二维码URL的Map - */ - Map generateQrCodeInvite(Integer appId, String role, Integer inviterId); - - /** - * 生成链接邀请 - * - * @param appId 应用ID - * @param role 角色 - * @param inviterId 邀请人ID - * @return 包含邀请链接的Map - */ - Map generateLinkInvite(Integer appId, String role, Integer inviterId); - - /** - * 验证邀请 - * - * @param token 邀请token - * @param appId 应用ID - * @return 邀请信息 - */ - Map verifyInvite(String token, Integer appId); - - /** - * 接受邀请 - * - * @param token 邀请token - * @param appId 应用ID - * @param userId 接受邀请的用户ID - */ - void acceptInvite(String token, Integer appId, Integer userId); - - /** - * 通过token获取邀请信息(小程序专用,不需要appId) - * - * @param token 邀请token - * @return 邀请信息 - */ - Map getInviteInfoByToken(String token); - - /** - * 查询邀请状态(用于轮询检测是否被使用) - * - * @param token 邀请token - * @return 状态信息 { status: 0-未使用, 1-已使用, usedAt: 使用时间, usedBy: 使用者名称 } - */ - Map getInviteStatus(String token); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppNotificationService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppNotificationService.java deleted file mode 100644 index a2882a7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppNotificationService.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppNotification; -import com.gxwebsoft.app.param.AppNotificationParam; -import com.gxwebsoft.common.core.web.PageResult; - -import java.util.List; -import java.util.Map; - -/** - * 站内消息通知 Service - */ -public interface AppNotificationService extends IService { - - /** 分页查询当前用户的通知 */ - PageResult pageByUser(AppNotificationParam param, Integer userId); - - /** 查询最近通知(用于铃铛下拉) */ - List listRecent(Integer userId, String type, int limit); - - /** 获取未读数量统计 */ - Map getUnreadCount(Integer userId); - - /** 标记单条通知为已读 */ - void markRead(Long id, Integer userId); - - /** 标记全部已读(可按类型) */ - void markAllRead(Integer userId, String type); - - /** 删除单条通知 */ - void removeNotification(Long id, Integer userId); - - /** 清空已读通知(可按类型) */ - void clearRead(Integer userId, String type); - - /** 发送通知(供其他模块调用) */ - void send(Integer userId, String type, String title, String content, - Long refId, String refType, String linkUrl, - Integer senderId, String senderName, String senderAvatar); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppPermissionRequestService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppPermissionRequestService.java deleted file mode 100644 index 39d4b87..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppPermissionRequestService.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppPermissionRequest; -import com.gxwebsoft.app.param.AppPermissionRequestParam; - -import java.util.List; -import java.util.Map; - -/** - * 权限申请Service - * - * @author 科技小王子 - * @since 2026-04-03 - */ -public interface AppPermissionRequestService extends IService { - - /** - * 分页查询 - */ - IPage pageRel(AppPermissionRequestParam param); - - /** - * 列表查询 - */ - List listRel(AppPermissionRequestParam param); - - /** - * 根据ID查询 - */ - AppPermissionRequest getByIdRel(Long id); - - /** - * 获取权限申请统计 - */ - Map getPermissionRequestStats(Integer userId); - - /** - * 创建权限申请 - */ - AppPermissionRequest createPermissionRequest(Integer userId, String gitUsername, String repo, String repoName, String reason, Integer tenantId); - - /** - * 获取可申请的仓库列表 - */ - List> getAvailableRepositories(Integer userId); - - /** - * 审核权限申请 - */ - boolean approveRequest(Long requestId, Integer reviewerId, String reviewerName, String note); - - /** - * 拒绝权限申请 - */ - boolean rejectRequest(Long requestId, Integer reviewerId, String reviewerName, String reason); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppPipelineService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppPipelineService.java deleted file mode 100644 index b15ea1a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppPipelineService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppPipeline; -import com.gxwebsoft.app.param.AppPipelineParam; -import com.gxwebsoft.common.core.web.PageResult; - -import java.util.List; - -/** - * CI/CD 流水线 Service - * - * @author 科技小王子 - * @since 2026-04-03 - */ -public interface AppPipelineService extends IService { - - /** - * 分页查询流水线 - */ - PageResult pagePipeline(AppPipelineParam param); - - /** - * 查询流水线详情 - */ - AppPipeline getPipelineDetail(Long id); - - /** - * 查询应用的所有流水线 - */ - List getByAppId(Long appId); - - /** - * 创建流水线 - */ - boolean createPipeline(AppPipeline pipeline); - - /** - * 更新流水线 - */ - boolean updatePipeline(AppPipeline pipeline); - - /** - * 删除流水线 - */ - boolean deletePipeline(Long id); - - /** - * 启用/禁用流水线 - */ - boolean togglePipeline(Long id, boolean enabled); - - /** - * 获取流水线状态 - */ - String getPipelineStatus(Long id); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppProductService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppProductService.java deleted file mode 100644 index 65870f7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppProductService.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppProduct; - -import java.util.List; -import java.util.Map; - -/** - * 应用产品 服务类 - * - * @author 科技小王子 - */ -public interface AppProductService extends IService { - - /** - * 分页查询应用列表 - * - * @param page 分页参数 - * @param product 查询条件 - * @param userId 用户ID(可选,为空则查所有) - * @return 分页结果 - */ - IPage selectPageList(Page page, AppProduct product, Integer userId); - - /** - * 获取应用详情 - * - * @param productId 应用ID - * @return 应用信息 - */ - AppProduct getDetail(Integer productId); - - /** - * 根据标识获取应用 - * - * @param code 应用标识 - * @return 应用信息 - */ - AppProduct getByCode(String code); - - /** - * 获取用户的应用列表 - * - * @param userId 用户ID - * @return 应用列表 - */ - List getByUserId(Integer userId); - - /** - * 分页查询用户创建的应用(我的应用) - * - * @param page 分页参数 - * @param userId 用户ID - * @return 分页结果 - */ - IPage getMyApps(Page page, Integer userId); - - /** - * 分页查询用户参与的应用 - * - * @param page 分页参数 - * @param userId 用户ID - * @return 分页结果 - */ - IPage getJoinedApps(Page page, Integer userId); - - /** - * 创建应用 - * - * @param product 应用信息 - * @return 是否成功 - */ - boolean create(AppProduct product); - - /** - * 更新应用 - * - * @param product 应用信息 - * @return 是否成功 - */ - boolean update(AppProduct product); - - /** - * 删除应用 - * - * @param productId 应用ID - * @return 是否成功 - */ - boolean delete(Integer productId); - - /** - * 提交审核 - * - * @param productId 应用ID - * @return 是否成功 - */ - boolean submitReview(Integer productId); - - /** - * 审核通过 - * - * @param productId 应用ID - * @return 是否成功 - */ - boolean approve(Integer productId); - - /** - * 审核拒绝 - * - * @param productId 应用ID - * @param reason 拒绝原因 - * @return 是否成功 - */ - boolean reject(Integer productId, String reason); - - /** - * 上架应用 - * - * @param productId 应用ID - * @return 是否成功 - */ - boolean publish(Integer productId); - - /** - * 下架应用 - * - * @param productId 应用ID - * @return 是否成功 - */ - boolean unpublish(Integer productId); - - /** - * 增加浏览次数 - * - * @param productId 应用ID - */ - void incrementClicks(Integer productId); - - /** - * 增加安装次数 - * - * @param productId 应用ID - */ - void incrementInstalls(Integer productId); - - /** - * 增加下载次数 - * - * @param productId 应用ID - */ - void incrementDownloads(Integer productId); - - /** - * 增加点赞数 - * - * @param productId 应用ID - */ - void incrementLikes(Integer productId); - - /** - * 生成应用密钥 - * - * @param productId 应用ID - * @return 新密钥 - */ - String regenerateSecret(Integer productId); - - /** - * 获取应用市场列表 - * - * @param page 分页参数 - * @param appType 应用类型 - * @param keyword 关键词 - * @return 应用列表 - */ - IPage getMarketList(Page page, Integer appType, String keyword); - - /** - * 获取站点配置字段 - * - * @param tenantId 租户ID - * @param code 配置字段代码 - * @return 配置值 - */ - AppProduct getConfigField(Integer tenantId, String code); - - /** - * 按用户ID列表批量统计应用数量 - * - * @param userIds 用户ID列表 - * @return 统计结果列表 - */ - List> getStatsByUserIds(List userIds); - - /** - * 获取用户可访问的应用列表(带 myRole 字段) - * 包含用户创建的应用(owner)+ 被邀请加入的应用(成员角色) - * - * @param userId 用户ID - * @return 应用列表(带 myRole 字段) - */ - List getAccessibleApps(Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppResourceService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppResourceService.java deleted file mode 100644 index e29a256..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppResourceService.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.param.AppResourceParam; -import com.gxwebsoft.common.core.web.PageResult; - -import java.util.List; -import java.util.Map; - -/** - * 开发者资源 Service - * - * @author 科技小王子 - * @since 2026-03-31 - */ -public interface AppResourceService extends IService { - - /** 分页查询(关联应用名称,并为当前用户注入 accessLevel/isOwner) */ - PageResult pageRel(AppResourceParam param, Integer currentUserId); - - /** 分页查询(兼容旧调用) */ - default PageResult pageRel(AppResourceParam param) { - return pageRel(param, null); - } - - /** 列表查询(并为当前用户注入 accessLevel/isOwner) */ - List listRel(AppResourceParam param, Integer currentUserId); - - /** 列表查询(兼容旧调用) */ - default List listRel(AppResourceParam param) { - return listRel(param, null); - } - - /** 详情(关联查询,并为当前用户注入 accessLevel/isOwner) */ - AppResource getByIdRel(Long resourceId, Integer currentUserId); - - /** 详情(兼容旧调用) */ - default AppResource getByIdRel(Long resourceId) { - return getByIdRel(resourceId, null); - } - - /** 新增资源(自动设置 ownerUserId) */ - AppResource addResource(AppResource resource, Integer userId); - - /** 更新资源(只有 Owner 可操作) */ - AppResource updateResource(AppResource resource, Integer currentUserId); - - /** 更新资源(兼容旧调用) */ - default AppResource updateResource(AppResource resource) { - return updateResource(resource, null); - } - - /** 删除资源(只有 Owner 可操作,逻辑删除) */ - void removeResource(Long resourceId, Integer userId); - - /** 按资源类型统计数量(包含协作的资源) */ - Map countByType(Integer userId, Integer tenantId); - - /** - * 为资源列表批量注入当前用户的 accessLevel / isOwner - * (供 Controller 调用;同时根据权限级别屏蔽敏感字段) - * - * @param resources 资源列表 - * @param currentUserId 当前登录用户ID - */ - void enrichWithPermission(List resources, Integer currentUserId); - - /** - * 重置数据库密码(只有 Owner 可操作) - * @return 新密码 - */ - String resetDatabasePassword(Long resourceId, Integer currentUserId); -} - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppSettingService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppSettingService.java deleted file mode 100644 index 159e551..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppSettingService.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppSetting; -import com.gxwebsoft.app.param.AppSettingParam; - -import java.util.List; -import java.util.Map; - -/** - * 平台设置表 Service - */ -public interface AppSettingService extends IService { - - /** - * 分页查询 - */ - List page(AppSettingParam param); - - /** - * 获取设置列表 - */ - List list(AppSettingParam param); - - /** - * 根据分类获取所有设置 - */ - List getByCategory(String category); - - /** - * 根据key获取设置值 - */ - String getValue(String settingKey); - - /** - * 根据key获取设置(完整对象) - */ - AppSetting getByKey(String settingKey); - - /** - * 获取分类下的所有设置(以Map返回,key为settingKey) - */ - Map getCategoryValues(String category); - - /** - * 保存或更新设置 - */ - void saveOrUpdateSetting(AppSetting setting); - - /** - * 批量保存分类设置 - */ - void batchSave(String category, Map values); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppSubscriptionService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppSubscriptionService.java deleted file mode 100644 index 287ab98..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppSubscriptionService.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppSubscription; - -/** - * 应用订阅 Service 接口 - */ -public interface AppSubscriptionService extends IService { - - /** - * 创建订阅 - * @param userId 用户ID - * @param productId 产品ID - * @param priceType 价格类型 - * @param period 订阅周期 - * @return 订阅记录 - */ - AppSubscription createSubscription(Integer userId, Integer productId, String priceType, String period); - - /** - * 激活订阅(支付成功后调用) - * @param subscriptionNo 订阅编号 - * @param transactionId 第三方交易号 - */ - void activateSubscription(String subscriptionNo, String transactionId); - - /** - * 检查用户是否已购买某应用 - */ - boolean isPurchased(Integer userId, Integer productId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppTicketService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppTicketService.java deleted file mode 100644 index fc61a86..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppTicketService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppTicket; -import com.gxwebsoft.app.entity.AppTicketReply; -import com.gxwebsoft.app.param.AppTicketParam; -import com.gxwebsoft.common.core.web.PageResult; - -import java.util.List; -import java.util.Map; - -/** - * 应用工单 Service - */ -public interface AppTicketService extends IService { - - /** 客户端:查自己提交的工单(分页) */ - PageResult myPage(AppTicketParam param, Integer userId); - - /** 技术端:查询所有工单(分页) */ - PageResult allPage(AppTicketParam param); - - /** 提交工单(自动分配) */ - AppTicket submit(AppTicket ticket, Integer userId); - - /** 更新状态(技术人员操作) */ - void updateStatus(Long ticketId, String status, Integer operatorId); - - /** 分配处理人 */ - void assign(Long ticketId, Integer assigneeId); - - /** 关闭工单(提交人操作) */ - void closeByUser(Long ticketId, Integer userId); - - /** 获取工单回复列表 */ - List getReplies(Long ticketId); - - /** 添加回复 */ - AppTicketReply addReply(AppTicketReply reply, Integer userId); - - /** 统计数据 */ - Map stats(Long appId, Integer userId); - - /** 获取技术人员列表(角色:developer/admin 的应用成员) */ - List> getTechStaffList(); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppUserCacheService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppUserCacheService.java deleted file mode 100644 index fe8f685..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppUserCacheService.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.app.entity.AppUserCache; - -/** - * 用户缓存 Service - * - * @author 科技小王子 - * @since 2026-04-03 - */ -public interface AppUserCacheService extends IService { - - /** - * 根据用户ID获取缓存的用户信息 - * - * @param userId 用户ID - * @return 缓存的用户信息,不存在返回 null - */ - AppUserCache getByUserId(Integer userId); - - /** - * 刷新单个用户缓存(从 server API 获取最新数据并更新) - * - * @param userId 用户ID - * @return 刷新后的缓存数据 - */ - AppUserCache refreshUserCache(Integer userId); - - /** - * 批量刷新用户缓存 - * - * @param userIds 用户ID列表 - */ - void batchRefreshUserCache(java.util.List userIds); - - /** - * 根据手机号刷新用户缓存 - * 从 server API 根据手机号查询用户并更新缓存 - * - * @param phone 手机号 - * @return 刷新后的缓存数据,不存在返回 null - */ - AppUserCache refreshUserCacheByPhone(String phone); - - /** - * 根据手机号创建新用户 - * 调用 server API 创建用户并同步到本地缓存 - * - * @param phone 手机号 - * @return 创建后的缓存数据,失败返回 null - */ - AppUserCache createUserByPhone(String phone); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppUserService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppUserService.java deleted file mode 100644 index fc6ac8f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppUserService.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.param.AppUserParam; - -import java.util.List; - -/** - * 应用成员Service - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -public interface AppUserService extends IService { - - /** - * 分页关联查询 - */ - PageResult pageRel(AppUserParam param); - - /** - * 关联查询全部 - */ - List listRel(AppUserParam param); - - /** - * 根据id查询 - */ - AppUser getByIdRel(Integer id); - - /** - * 邀请成员加入应用 - * - * @param appId 应用ID - * @param userId 被邀请的用户ID - * @param role 分配的角色 - * @param inviteBy 邀请人用户ID - * @param tenantId 租户ID(NOT NULL约束) - * @return 成员记录 - */ - AppUser inviteUser(Long appId, Integer userId, String role, Integer inviteBy, Integer tenantId); - - /** - * 修改成员角色 - * - * @param id 成员记录ID - * @param role 新角色 - */ - boolean updateRole(Long id, String role); - - /** - * 检查用户是否已是应用成员 - * - * @param appId 应用ID - * @param userId 用户ID - */ - boolean isMember(Long appId, Integer userId); - - /** - * 根据手机号查找系统用户(用于手机号邀请) - * - * @param phone 手机号 - * @return 系统用户,不存在返回 null - */ - com.gxwebsoft.common.system.entity.User findUserByPhone(String phone); - - /** - * 搜索用户(支持手机号/用户名/昵称模糊搜索) - * - * @param keyword 搜索关键词 - * @return 用户列表 - */ - List searchUsers(String keyword); - - /** - * 记录用户访问应用(更新最近访问时间) - * - * @param appId 应用ID - * @param userId 用户ID - */ - void recordVisit(Long appId, Integer userId); - - /** - * 接受邀请加入应用 - * - * @param inviteId 邀请记录ID - * @param userId 当前用户ID - * @return 是否成功 - */ - boolean acceptInvite(Long inviteId, Integer userId); - - /** - * 拒绝邀请 - * - * @param inviteId 邀请记录ID - * @param userId 当前用户ID - * @return 是否成功 - */ - boolean rejectInvite(Long inviteId, Integer userId); - - /** - * 查询用户的待确认邀请列表 - * - * @param userId 用户ID - * @return 邀请列表 - */ - List listPendingInvites(Integer userId); - - /** - * 统计用户的待确认邀请数量 - * - * @param userId 用户ID - * @return 待确认数量 - */ - long countPendingInvites(Integer userId); - - /** - * 检查用户是否有待确认的邀请 - * - * @param appId 应用ID - * @param userId 用户ID - * @return 是否有待确认邀请 - */ - boolean hasPendingInvite(Long appId, Integer userId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppVersionService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppVersionService.java deleted file mode 100644 index d5fca40..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/AppVersionService.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.app.entity.AppVersion; -import com.gxwebsoft.app.param.AppVersionParam; - -import java.util.List; - -/** - * 应用版本发布记录Service - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -public interface AppVersionService extends IService { - - /** - * 分页关联查询 - */ - PageResult pageRel(AppVersionParam param); - - /** - * 关联查询全部 - */ - List listRel(AppVersionParam param); - - /** - * 根据id查询 - */ - AppVersion getByIdRel(Integer id); - - /** - * 发布版本(将此版本设为当前版本,其他版本 isCurrent=false) - * - * @param id 版本ID - * @param publishBy 发布人用户ID - */ - boolean publish(Long id, Integer publishBy); - - /** - * 回滚到指定版本(将此版本设为当前版本,当前版本标为已回滚) - * - * @param id 要回滚到的版本ID - * @param publishBy 操作人用户ID - */ - boolean rollback(Long id, Integer publishBy); - - /** - * 获取指定应用的当前版本 - * - * @param appId 应用ID - */ - AppVersion getCurrentVersion(Long appId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/DatabaseOperatorFactory.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/DatabaseOperatorFactory.java deleted file mode 100644 index 393cc7b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/DatabaseOperatorFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.gxwebsoft.app.service; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import javax.annotation.PostConstruct; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 数据库操作工厂 - * 根据 dbType(MySQL/PostgreSQL)分发到对应的 DatabaseOperatorService 实现 - * - * @author WebSoft - * @since 2026-04-04 - */ -@Slf4j -@Component -public class DatabaseOperatorFactory { - - private final List operators; - private final Map operatorMap = new ConcurrentHashMap<>(); - - public DatabaseOperatorFactory(List operators) { - this.operators = operators; - } - - @PostConstruct - public void init() { - for (DatabaseOperatorService operator : operators) { - String dbType = operator.getSupportedDbType(); - operatorMap.put(dbType, operator); - log.info("注册数据库操作服务: {} -> {}", dbType, operator.getClass().getSimpleName()); - } - } - - /** - * 根据 dbType 获取对应的操作服务 - * - * @param dbType 数据库类型(MySQL/PostgreSQL) - * @return 对应的操作服务实现 - * @throws IllegalArgumentException 如果不支持的数据库类型 - */ - public DatabaseOperatorService getOperator(String dbType) { - if (dbType == null || dbType.isEmpty()) { - throw new IllegalArgumentException("数据库类型不能为空"); - } - DatabaseOperatorService operator = operatorMap.get(dbType); - if (operator == null) { - throw new IllegalArgumentException("不支持的数据库类型: " + dbType + ",当前支持: " + operatorMap.keySet()); - } - return operator; - } - - /** - * 判断是否支持该数据库类型的远程创建 - */ - public boolean isSupported(String dbType) { - return dbType != null && operatorMap.containsKey(dbType); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/DatabaseOperatorService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/DatabaseOperatorService.java deleted file mode 100644 index 4b2c0a1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/DatabaseOperatorService.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.gxwebsoft.app.service; - -/** - * 远程数据库操作服务接口 - * 支持 MySQL、PostgreSQL 等多种数据库的远程创建/删除操作 - * 通过 DatabaseOperatorFactory 根据 dbType 获取具体实现 - * - * @author WebSoft - * @since 2026-04-04 - */ -public interface DatabaseOperatorService { - - /** - * 返回此实现支持的数据库类型 - */ - String getSupportedDbType(); - - /** - * 在远程服务器上创建数据库并授权用户 - * - * @param host 服务器地址 - * @param port 端口 - * @param username 管理员用户名 - * @param password 管理员密码(明文) - * @param dbName 要创建的数据库名 - * @param dbUser 业务数据库用户名(可为空,不创建用户) - * @param dbPass 业务数据库密码(可为空,不创建用户) - * @return 操作结果 - */ - DatabaseOperationResult createDatabaseAndGrant(String host, Integer port, - String username, String password, - String dbName, String dbUser, String dbPass); - - /** - * 在远程服务器上删除数据库和用户 - * - * @param host 服务器地址 - * @param port 端口 - * @param username 管理员用户名 - * @param password 管理员密码(明文) - * @param dbName 要删除的数据库名 - * @param dbUser 要删除的用户名(可为空) - * @return 操作结果 - */ - DatabaseOperationResult dropDatabaseAndUser(String host, Integer port, - String username, String password, - String dbName, String dbUser); - - /** - * 测试数据库连接是否可用 - * - * @param host 数据库地址 - * @param port 端口 - * @param username 用户名 - * @param password 密码 - * @param dbName 数据库名(可为空,只测试服务器连通性) - * @return 操作结果 - */ - DatabaseOperationResult testConnection(String host, Integer port, - String username, String password, - String dbName); - - /** - * 在远程服务器上修改数据库用户密码 - * - * @param host 服务器地址 - * @param port 端口 - * @param adminUsername 管理员用户名 - * @param adminPassword 管理员密码(明文) - * @param dbUsername 数据库用户名 - * @param oldPassword 旧密码(明文,可为空) - * @param newPassword 新密码(明文) - * @return 操作结果 - */ - DatabaseOperationResult changePassword(String host, Integer port, - String adminUsername, String adminPassword, - String dbUsername, String oldPassword, String newPassword); - - /** - * 数据库操作结果 - */ - class DatabaseOperationResult { - private boolean success; - private String message; - private String detail; - - public DatabaseOperationResult() { - } - - public DatabaseOperationResult(boolean success, String message) { - this.success = success; - this.message = message; - } - - public DatabaseOperationResult(boolean success, String message, String detail) { - this.success = success; - this.message = message; - this.detail = detail; - } - - public static DatabaseOperationResult ok(String message) { - return new DatabaseOperationResult(true, message); - } - - public static DatabaseOperationResult ok(String message, String detail) { - return new DatabaseOperationResult(true, message, detail); - } - - public static DatabaseOperationResult fail(String message) { - return new DatabaseOperationResult(false, message); - } - - public static DatabaseOperationResult fail(String message, String detail) { - return new DatabaseOperationResult(false, message, detail); - } - - public boolean isSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getDetail() { - return detail; - } - - public void setDetail(String detail) { - this.detail = detail; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/OnePanelService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/OnePanelService.java deleted file mode 100644 index 86bfa9d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/OnePanelService.java +++ /dev/null @@ -1,258 +0,0 @@ -package com.gxwebsoft.app.service; - -import lombok.Data; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.web.client.RestTemplate; - -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; - -/** - * 1Panel 面板服务 - * 用于调用1Panel API获取服务器状态信息 - * - * @author 科技小王子 - * @since 2026-04-06 - */ -@Slf4j -@Service -public class OnePanelService { - - private final RestTemplate restTemplate = new RestTemplate(); - - /** - * 获取1Panel服务器状态 - */ - @Data - public static class ServerStatus { - private String cpu; // CPU 使用率 % - private String memory; // 内存使用率 % - private String memoryUsed; // 内存已用 (GB) - private String memoryTotal; // 内存总量 (GB) - private String disk; // 磁盘使用率 % - private String diskUsed; // 磁盘已用 (GB) - private String diskTotal; // 磁盘总量 (GB) - private String load; // 系统负载 (1min, 5min, 15min) - private String uptime; // 运行时间 - private Integer online; // 在线状态 1=在线 0=离线 - private String message; // 错误信息 - } - - /** - * 获取服务器状态 - * - * @param host 服务器IP - * @param port 面板端口 - * @param path 安全入口路径 - * @param username 面板用户名 - * @param password 面板密码 - * @return 服务器状态 - */ - public ServerStatus getServerStatus(String host, Integer port, String path, String username, String password) { - ServerStatus status = new ServerStatus(); - status.setOnline(0); - - if (host == null || port == null) { - status.setMessage("服务器地址或端口不能为空"); - return status; - } - - try { - // 构建1Panel API地址 - String baseUrl = buildBaseUrl(host, port, path); - String overviewUrl = baseUrl + "/api/v1/overview"; - - // 设置认证头 - Map headers = new HashMap<>(); - headers.put("Authorization", "Basic " + buildBasicAuth(username, password)); - - // 调用1Panel概览接口 - Map response = callApi(overviewUrl, headers); - - if (response != null) { - parseOverviewResponse(response, status); - status.setOnline(1); - } else { - status.setMessage("接口返回为空"); - } - - } catch (Exception e) { - log.error("获取1Panel状态失败: host={}, port={}, error={}", host, port, e.getMessage()); - status.setMessage("连接失败: " + e.getMessage()); - } - - return status; - } - - /** - * 构建1Panel API基础地址 - */ - private String buildBaseUrl(String host, Integer port, String path) { - String baseUrl = "http://" + host + ":" + port; - if (path != null && !path.isEmpty()) { - // 确保path以/开头 - if (!path.startsWith("/")) { - baseUrl += "/"; - } - baseUrl += path; - } - return baseUrl; - } - - /** - * 构建Basic Auth认证字符串 - */ - private String buildBasicAuth(String username, String password) { - String auth = (username != null ? username : "") + ":" + (password != null ? password : ""); - return Base64.getEncoder().encodeToString(auth.getBytes()); - } - - /** - * 调用1Panel API - */ - @SuppressWarnings("unchecked") - private Map callApi(String url, Map headers) { - try { - org.springframework.http.HttpHeaders httpHeaders = new org.springframework.http.HttpHeaders(); - headers.forEach(httpHeaders::add); - - org.springframework.http.HttpEntity entity = new org.springframework.http.HttpEntity<>(httpHeaders); - org.springframework.http.ResponseEntity response = restTemplate.exchange( - url, - org.springframework.http.HttpMethod.GET, - entity, - Map.class - ); - - if (response.getBody() != null) { - Map body = response.getBody(); - // 1Panel API返回格式通常是 { data: {...}, code: 200 } - if (Boolean.TRUE.equals(body.get("ok")) || "200".equals(String.valueOf(body.get("code")))) { - Object data = body.get("data"); - if (data instanceof Map) { - return (Map) data; - } - } - } - return null; - } catch (Exception e) { - log.error("API调用失败: url={}, error={}", url, e.getMessage()); - throw new RuntimeException("API调用失败: " + e.getMessage()); - } - } - - /** - * 解析概览接口返回的数据 - */ - @SuppressWarnings("unchecked") - private void parseOverviewResponse(Map data, ServerStatus status) { - // CPU信息 - Map cpuInfo = getMapValue(data, "cpu"); - if (cpuInfo != null) { - Object cpuUsed = cpuInfo.get("used"); - status.setCpu(formatPercent(cpuUsed)); - } - - // 内存信息 - Map memoryInfo = getMapValue(data, "memory"); - if (memoryInfo != null) { - Object memUsed = memoryInfo.get("used"); - Object memTotal = memoryInfo.get("total"); - status.setMemory(formatPercent(memUsed)); - status.setMemoryUsed(formatSize(memUsed)); - status.setMemoryTotal(formatSize(memTotal)); - } - - // 磁盘信息 - Map diskInfo = getMapValue(data, "disk"); - if (diskInfo != null) { - Object diskUsed = diskInfo.get("used"); - Object diskTotal = diskInfo.get("total"); - Object diskPercent = diskInfo.get("usedPercent"); - status.setDisk(formatPercent(diskPercent)); - status.setDiskUsed(formatSize(diskUsed)); - status.setDiskTotal(formatSize(diskTotal)); - } - - // 系统负载 - Map loadInfo = getMapValue(data, "load"); - if (loadInfo != null) { - Object load1 = loadInfo.get("load1"); - Object load5 = loadInfo.get("load5"); - Object load15 = loadInfo.get("load15"); - status.setLoad(String.format("%.2f / %.2f / %.2f", load1, load5, load15)); - } - - // 运行时间 - Map uptimeInfo = getMapValue(data, "uptime"); - if (uptimeInfo != null) { - Object uptime = uptimeInfo.get("uptime"); - if (uptime != null) { - status.setUptime(formatUptime(uptime)); - } - } - } - - /** - * 获取Map中的嵌套Map - */ - @SuppressWarnings("unchecked") - private Map getMapValue(Map data, String key) { - Object value = data.get(key); - if (value instanceof Map) { - return (Map) value; - } - return null; - } - - /** - * 格式化百分比 - */ - private String formatPercent(Object value) { - if (value == null) return "0"; - try { - double percent = Double.parseDouble(String.valueOf(value)); - return String.format("%.1f", percent); - } catch (NumberFormatException e) { - return "0"; - } - } - - /** - * 格式化大小(字节转换为GB) - */ - private String formatSize(Object value) { - if (value == null) return "0 GB"; - try { - long bytes = Long.parseLong(String.valueOf(value)); - double gb = bytes / (1024.0 * 1024.0 * 1024.0); - return String.format("%.1f GB", gb); - } catch (NumberFormatException e) { - return "0 GB"; - } - } - - /** - * 格式化运行时间 - */ - private String formatUptime(Object value) { - if (value == null) return "-"; - try { - long seconds = Long.parseLong(String.valueOf(value)); - long days = seconds / 86400; - long hours = (seconds % 86400) / 3600; - long minutes = (seconds % 3600) / 60; - if (days > 0) { - return String.format("%d天 %d小时 %d分钟", days, hours, minutes); - } else if (hours > 0) { - return String.format("%d小时 %d分钟", hours, minutes); - } else { - return String.format("%d分钟", minutes); - } - } catch (NumberFormatException e) { - return "-"; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/SshService.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/SshService.java deleted file mode 100644 index 751b05b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/SshService.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.gxwebsoft.app.service; - -import lombok.Data; - -/** - * SSH 连接测试服务 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -public interface SshService { - - /** - * 测试 SSH 连接 - * - * @param host 服务器 IP - * @param port SSH 端口 - * @param username 用户名 - * @param password 密码 - * @return 连接结果 - */ - ConnectionResult testConnection(String host, Integer port, String username, String password); - - @Data - class ConnectionResult { - private boolean success; - private String message; - private String detail; - - public static ConnectionResult ok(String message, String detail) { - ConnectionResult result = new ConnectionResult(); - result.setSuccess(true); - result.setMessage(message); - result.setDetail(detail); - return result; - } - - public static ConnectionResult fail(String message, String detail) { - ConnectionResult result = new ConnectionResult(); - result.setSuccess(false); - result.setMessage(message); - result.setDetail(detail); - return result; - } - - public static ConnectionResult fail(String message) { - return fail(message, null); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/CloudStorageProvider.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/CloudStorageProvider.java deleted file mode 100644 index cd7f684..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/CloudStorageProvider.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gxwebsoft.app.service.cloud; - -import com.gxwebsoft.app.entity.AppResource; -import java.util.Map; - -/** - * 云存储 Provider 接口 - * 支持阿里云OSS、腾讯云COS、华为云OBS、七牛云等 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -public interface CloudStorageProvider { - - /** - * 获取 Provider 类型标识 - * @return aliyun/tencent/huawei/qiniu - */ - String getProviderType(); - - /** - * 测试凭证连接(不需要 bucket) - * 用于验证 accessKeyId/accessKeySecret 是否有效 - * @param credentials 云账号凭证(可能包含 accessKeyId/accessKeySecret 或 secretId/secretKey) - * @return 是否连接成功 - */ - boolean testConnection(Map credentials); - - /** - * 创建存储桶 - * @param resource 资源实体,包含 name(桶名)、region(地区)、acl(访问权限) - * @param credentials 云账号凭证 - * @throws Exception 创建失败时抛出 - */ - void createBucket(AppResource resource, Map credentials) throws Exception; - - /** - * 删除存储桶 - * @param resource 资源实体 - * @param credentials 云账号凭证 - * @throws Exception 删除失败时抛出 - */ - void deleteBucket(AppResource resource, Map credentials) throws Exception; - - /** - * 设置存储桶访问权限 - * @param resource 资源实体 - * @param acl 访问权限:public-read/private - * @param credentials 云账号凭证 - * @throws Exception 设置失败时抛出 - */ - void setBucketAcl(AppResource resource, String acl, Map credentials) throws Exception; - - /** - * 查询存储桶信息 - * @param resource 资源实体 - * @param credentials 云账号凭证 - * @return 存储桶信息,包含 usedBytes(已用空间)、objectCount(对象数量)等 - * @throws Exception 查询失败时抛出 - */ - Map getBucketInfo(AppResource resource, Map credentials) throws Exception; - - /** - * 获取存储桶访问地址(外网/内网) - * @param resource 资源实体 - * @param credentials 云账号凭证 - * @return 访问地址 - */ - String getBucketEndpoint(AppResource resource, Map credentials); - - /** - * 生成带签名的访问URL(针对私有桶) - * @param resource 资源实体 - * @param objectKey 对象Key - * @param expirySeconds 过期秒数 - * @param credentials 云账号凭证 - * @return 签名的URL - * @throws Exception 生成失败时抛出 - */ - String generateSignedUrl(AppResource resource, String objectKey, long expirySeconds, Map credentials) throws Exception; - - /** - * 检查存储桶是否存在 - * @param resource 资源实体 - * @param credentials 云账号凭证 - * @return 是否存在 - */ - boolean bucketExists(AppResource resource, Map credentials); -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/CloudStorageProviderFactory.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/CloudStorageProviderFactory.java deleted file mode 100644 index d27a150..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/CloudStorageProviderFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.gxwebsoft.app.service.cloud; - -import com.gxwebsoft.app.service.cloud.impl.AliyunOSSProvider; -import com.gxwebsoft.app.service.cloud.impl.HuaweiOBSProvider; -import com.gxwebsoft.app.service.cloud.impl.QiniuKodoProvider; -import com.gxwebsoft.app.service.cloud.impl.TencentCOSProvider; -import lombok.extern.slf4j.Slf4j; - -import java.util.HashMap; -import java.util.Map; - -/** - * 云存储 Provider 工厂 - * 根据 provider 类型返回对应的 Provider 实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -public class CloudStorageProviderFactory { - - /** Provider 实例缓存 */ - private static final Map PROVIDERS = new HashMap<>(); - - static { - // 注册所有 Provider - register(new AliyunOSSProvider()); - register(new TencentCOSProvider()); - register(new HuaweiOBSProvider()); - register(new QiniuKodoProvider()); - } - - /** - * 注册 Provider - */ - public static void register(CloudStorageProvider provider) { - PROVIDERS.put(provider.getProviderType(), provider); - log.info("注册云存储 Provider: {}", provider.getProviderType()); - } - - /** - * 获取 Provider 实例 - * @param providerType provider 类型: aliyun/tencent/huawei/qiniu - * @return Provider 实例 - */ - public static CloudStorageProvider getProvider(String providerType) { - CloudStorageProvider provider = PROVIDERS.get(providerType); - if (provider == null) { - throw new IllegalArgumentException("不支持的云存储 provider: " + providerType); - } - return provider; - } - - /** - * 获取所有支持的 Provider 类型 - */ - public static Map getSupportedProviders() { - Map result = new HashMap<>(); - for (Map.Entry entry : PROVIDERS.entrySet()) { - result.put(entry.getKey(), entry.getKey()); - } - return result; - } - - /** - * 检查是否支持指定 provider - */ - public static boolean isSupported(String providerType) { - return PROVIDERS.containsKey(providerType); - } -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/AliyunOSSProvider.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/AliyunOSSProvider.java deleted file mode 100644 index a99b6b6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/AliyunOSSProvider.java +++ /dev/null @@ -1,298 +0,0 @@ -package com.gxwebsoft.app.service.cloud.impl; - -import com.aliyun.oss.OSS; -import com.aliyun.oss.OSSClientBuilder; -import com.aliyun.oss.model.*; -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import lombok.extern.slf4j.Slf4j; - -import java.net.URL; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 阿里云 OSS Provider 实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -public class AliyunOSSProvider implements CloudStorageProvider { - - public static final String PROVIDER_TYPE = "aliyun"; - - @Override - public String getProviderType() { - return PROVIDER_TYPE; - } - - @Override - public boolean testConnection(Map credentials) { - try { - // 获取 accessKeyId/accessKeySecret - String accessKeyId = credentials.get("accessKeyId"); - String accessKeySecret = credentials.get("accessKeySecret"); - if (accessKeyId == null || accessKeySecret == null) { - log.error("阿里云凭证缺少 accessKeyId 或 accessKeySecret"); - return false; - } - // 获取或构造 endpoint(优先使用配置中的,否则使用默认的) - String endpoint = credentials.get("endpoint"); - if (endpoint == null || endpoint.isEmpty()) { - endpoint = "https://oss-cn-hangzhou.aliyuncs.com"; - } - // 尝试创建客户端并列出 bucket(验证凭证是否有效) - OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); - try { - ossClient.listBuckets(); - log.info("阿里云 OSS 凭证验证成功"); - return true; - } finally { - ossClient.shutdown(); - } - } catch (Exception e) { - log.error("阿里云 OSS 凭证验证失败: {}", e.getMessage()); - return false; - } - } - - private OSS createClient(Map credentials) { - String accessKeyId = credentials.get("accessKeyId"); - String accessKeySecret = credentials.get("accessKeySecret"); - String endpoint = credentials.get("endpoint"); - - if (accessKeyId == null || accessKeySecret == null || endpoint == null) { - throw new IllegalArgumentException("阿里云 OSS 凭证缺少必要字段: accessKeyId, accessKeySecret, endpoint"); - } - - return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); - } - - @Override - public void createBucket(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - String region = resource.getRegion(); - - // 构建 endpoint: - // 如果 region 以 "oss-" 开头(如 oss-cn-shenzhen),直接拼接 - // 否则(如 ap-guangzhou),需要加 oss- 前缀 - String endpoint; - if (region != null && region.startsWith("oss-")) { - endpoint = "https://" + region + ".aliyuncs.com"; - } else { - endpoint = "https://oss-" + region + ".aliyuncs.com"; - } - - // 临时构造带 endpoint 的凭证 - Map creds = new HashMap<>(credentials); - // 强制覆盖 endpoint,避免 credentials 中有错误值 - creds.put("endpoint", endpoint); - - OSS ossClient = createClient(creds); - try { - // 检查是否已存在 - if (ossClient.doesBucketExist(bucketName)) { - log.info("存储桶 {} 已存在,跳过创建", bucketName); - return; - } - - // 创建存储桶 - CreateBucketRequest request = new CreateBucketRequest(bucketName); - // 设置 ACL - String acl = resource.getAcl(); - if ("public-read".equals(acl)) { - request.setCannedACL(CannedAccessControlList.PublicRead); - } else { - request.setCannedACL(CannedAccessControlList.Private); - } - - ossClient.createBucket(request); - log.info("阿里云 OSS 存储桶 {} 创建成功,地区: {},ACL: {}", bucketName, region, acl); - } finally { - ossClient.shutdown(); - } - } - - @Override - public void deleteBucket(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - String region = resource.getRegion(); - - // 构建 endpoint(同 createBucket) - String endpoint; - if (region != null && region.startsWith("oss-")) { - endpoint = "https://" + region + ".aliyuncs.com"; - } else { - endpoint = "https://oss-" + region + ".aliyuncs.com"; - } - Map creds = new HashMap<>(credentials); - creds.put("endpoint", endpoint); - - OSS ossClient = createClient(creds); - - try { - if (!ossClient.doesBucketExist(bucketName)) { - log.info("存储桶 {} 不存在,跳过删除", bucketName); - return; - } - - // 清空桶内所有对象 - String marker = ""; - int deleteCount = 0; - do { - ListObjectsRequest request = new ListObjectsRequest(bucketName); - request.setMaxKeys(1000); - if (!marker.isEmpty()) { - request.setMarker(marker); - } - ObjectListing listing = ossClient.listObjects(request); - - // 删除对象 - for (OSSObjectSummary summary : listing.getObjectSummaries()) { - ossClient.deleteObject(bucketName, summary.getKey()); - deleteCount++; - } - - marker = listing.getNextMarker(); - } while (marker != null && !marker.isEmpty()); - - log.info("存储桶 {} 对象已清空,共删除 {} 个对象", bucketName, deleteCount); - - // 再删除存储桶 - ossClient.deleteBucket(bucketName); - log.info("阿里云 OSS 存储桶 {} 删除成功", bucketName); - } finally { - ossClient.shutdown(); - } - } - - @Override - public void setBucketAcl(AppResource resource, String acl, Map credentials) throws Exception { - String bucketName = resource.getName(); - OSS ossClient = createClient(credentials); - - try { - if ("public-read".equals(acl)) { - ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); - } else { - ossClient.setBucketAcl(bucketName, CannedAccessControlList.Private); - } - log.info("设置阿里云 OSS 存储桶 {} ACL 为 {}", bucketName, acl); - } finally { - ossClient.shutdown(); - } - } - - @Override - public Map getBucketInfo(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - // 构建 endpoint(同 createBucket) - String region = resource.getRegion(); - String endpoint; - if (region != null && region.startsWith("oss-")) { - endpoint = "https://" + region + ".aliyuncs.com"; - } else { - endpoint = "https://oss-" + region + ".aliyuncs.com"; - } - Map creds = new HashMap<>(credentials); - creds.put("endpoint", endpoint); - - OSS ossClient = createClient(creds); - Map result = new HashMap<>(); - - try { - // 获取存储桶元信息 - BucketInfo bucketInfo = ossClient.getBucketInfo(bucketName); - result.put("bucketName", bucketName); - result.put("region", resource.getRegion()); - result.put("createTime", bucketInfo.getBucket().getCreationDate()); - result.put("acl", bucketInfo.getCannedACL() != null ? bucketInfo.getCannedACL().toString() : "private"); - - // 获取存储量统计(需要先设置计量) - try { - // 获取存储量 - String marker = ""; - long totalSize = 0; - int objectCount = 0; - do { - ListObjectsRequest request = new ListObjectsRequest(bucketName); - request.setMaxKeys(1000); - if (!marker.isEmpty()) { - request.setMarker(marker); - } - ObjectListing listing = ossClient.listObjects(request); - for (OSSObjectSummary summary : listing.getObjectSummaries()) { - totalSize += summary.getSize(); - objectCount++; - } - marker = listing.getNextMarker(); - } while (marker != null && !marker.isEmpty()); - - result.put("usedBytes", totalSize); - result.put("objectCount", objectCount); - } catch (Exception e) { - log.warn("获取存储桶使用量失败: {}", e.getMessage()); - result.put("usedBytes", 0L); - result.put("objectCount", 0); - } - } finally { - ossClient.shutdown(); - } - - return result; - } - - @Override - public String getBucketEndpoint(AppResource resource, Map credentials) { - String region = resource.getRegion(); - String bucketName = resource.getName(); - - // 直接根据 resource 的 region 计算,不依赖 credentials - String domainPart; - if (region != null && region.startsWith("oss-")) { - // 用户选择了完整的 endpoint 格式,如 oss-cn-shenzhen - domainPart = region + ".aliyuncs.com"; - } else { - // 旧格式 - domainPart = "oss-" + region + ".aliyuncs.com"; - } - - // 外网 endpoint 格式: {bucket}.{domainPart} - return "https://" + bucketName + "." + domainPart; - } - - @Override - public String generateSignedUrl(AppResource resource, String objectKey, long expirySeconds, Map credentials) throws Exception { - String bucketName = resource.getName(); - OSS ossClient = createClient(credentials); - - try { - // 生成签名 URL - Date expiration = new Date(System.currentTimeMillis() + expirySeconds * 1000); - GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucketName, objectKey); - request.setExpiration(expiration); - URL url = ossClient.generatePresignedUrl(request); - return url.toString(); - } finally { - ossClient.shutdown(); - } - } - - @Override - public boolean bucketExists(AppResource resource, Map credentials) { - String bucketName = resource.getName(); - try { - OSS ossClient = createClient(credentials); - try { - return ossClient.doesBucketExist(bucketName); - } finally { - ossClient.shutdown(); - } - } catch (Exception e) { - log.error("检查存储桶是否存在失败: {}", e.getMessage()); - return false; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/HuaweiOBSProvider.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/HuaweiOBSProvider.java deleted file mode 100644 index caebaa4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/HuaweiOBSProvider.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.gxwebsoft.app.service.cloud.impl; - -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import com.obs.services.ObsClient; -import com.obs.services.model.AccessControlList; -import com.obs.services.model.CreateBucketRequest; -import com.obs.services.model.GroupGrantee; -import com.obs.services.model.HttpMethodEnum; -import com.obs.services.model.Permission; -import com.obs.services.model.TemporarySignatureRequest; -import com.obs.services.model.TemporarySignatureResponse; -import lombok.extern.slf4j.Slf4j; - -import java.util.HashMap; -import java.util.Map; - -/** - * 华为云 OBS Provider 实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -public class HuaweiOBSProvider implements CloudStorageProvider { - - public static final String PROVIDER_TYPE = "huawei"; - - @Override - public String getProviderType() { - return PROVIDER_TYPE; - } - - @Override - public boolean testConnection(Map credentials) { - try { - // 兼容 accessKeyId/accessKeySecret 和 accessKey/secretKey - String ak = credentials.get("accessKey"); - String sk = credentials.get("secretKey"); - if (ak == null && credentials.get("accessKeyId") != null) { - ak = credentials.get("accessKeyId"); - } - if (sk == null && credentials.get("accessKeySecret") != null) { - sk = credentials.get("accessKeySecret"); - } - if (ak == null || sk == null) { - log.error("华为云 OBS 凭证缺少 accessKey/accessKeyId 或 secretKey/accessKeySecret"); - return false; - } - // 获取或构造 endpoint - String endpoint = credentials.get("endpoint"); - if (endpoint == null || endpoint.isEmpty()) { - endpoint = "https://obs.cn-south-1.myhuaweicloud.com"; - } - // 尝试创建客户端并列出 bucket(验证凭证是否有效) - try (ObsClient obsClient = new ObsClient(ak, sk, endpoint)) { - obsClient.listBuckets(); - log.info("华为云 OBS 凭证验证成功"); - return true; - } - } catch (Exception e) { - log.error("华为云 OBS 凭证验证失败: {}", e.getMessage()); - return false; - } - } - - private ObsClient createClient(Map credentials) { - // 兼容 accessKeyId/accessKeySecret 和 accessKey/secretKey - String ak = credentials.get("accessKey"); - String sk = credentials.get("secretKey"); - if (ak == null && credentials.get("accessKeyId") != null) { - ak = credentials.get("accessKeyId"); - } - if (sk == null && credentials.get("accessKeySecret") != null) { - sk = credentials.get("accessKeySecret"); - } - String endpoint = credentials.get("endpoint"); - - if (ak == null || sk == null || endpoint == null) { - throw new IllegalArgumentException("华为云 OBS 凭证缺少必要字段: accessKey/accessKeyId, secretKey/accessKeySecret, endpoint"); - } - - return new ObsClient(ak, sk, endpoint); - } - - @Override - public void createBucket(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - String region = resource.getRegion(); - - ObsClient obsClient = createClient(credentials); - try { - // 检查是否已存在 - if (obsClient.headBucket(bucketName)) { - log.info("存储桶 {} 已存在,跳过创建", bucketName); - return; - } - - // 创建存储桶 - CreateBucketRequest request = new CreateBucketRequest(); - request.setBucketName(bucketName); - request.setLocation(region); - - obsClient.createBucket(request); - log.info("华为云 OBS 存储桶 {} 创建成功,地区: {}", bucketName, region); - - // 设置 ACL - setAclInternal(obsClient, resource); - } finally { - obsClient.close(); - } - } - - @Override - public void deleteBucket(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - ObsClient obsClient = createClient(credentials); - - try { - if (!obsClient.headBucket(bucketName)) { - log.info("存储桶 {} 不存在,跳过删除", bucketName); - return; - } - - // 删除存储桶(需要先清空桶内对象) - obsClient.deleteBucket(bucketName); - log.info("华为云 OBS 存储桶 {} 删除成功", bucketName); - } finally { - obsClient.close(); - } - } - - @Override - public void setBucketAcl(AppResource resource, String acl, Map credentials) throws Exception { - ObsClient obsClient = createClient(credentials); - try { - setAclInternal(obsClient, resource); - } finally { - obsClient.close(); - } - } - - private void setAclInternal(ObsClient obsClient, AppResource resource) throws Exception { - String bucketName = resource.getName(); - String acl = resource.getAcl(); - - AccessControlList accessControlList = new AccessControlList(); - if ("public-read".equals(acl)) { - accessControlList.grantPermission(GroupGrantee.ALL_USERS, Permission.PERMISSION_READ); - } else { - // 私有:移除所有用户的读取权限 - accessControlList.grantPermission(GroupGrantee.ALL_USERS, Permission.PERMISSION_FULL_CONTROL, false); - } - - obsClient.setBucketAcl(bucketName, accessControlList); - log.info("设置华为云 OBS 存储桶 {} ACL 为 {}", bucketName, acl); - } - - @Override - public Map getBucketInfo(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - ObsClient obsClient = createClient(credentials); - Map result = new HashMap<>(); - - try { - result.put("bucketName", bucketName); - result.put("region", resource.getRegion()); - result.put("usedBytes", 0L); - result.put("objectCount", 0); - } finally { - obsClient.close(); - } - - return result; - } - - @Override - public String getBucketEndpoint(AppResource resource, Map credentials) { - String region = resource.getRegion(); - String bucketName = resource.getName(); - - // 外网 endpoint: https://{bucket}.obs.{region}.myhuaweicloud.com - return "https://" + bucketName + ".obs." + region + ".myhuaweicloud.com"; - } - - @Override - public String generateSignedUrl(AppResource resource, String objectKey, long expirySeconds, Map credentials) throws Exception { - String bucketName = resource.getName(); - - TemporarySignatureRequest request = new TemporarySignatureRequest(); - request.setMethod(HttpMethodEnum.GET); - request.setBucketName(bucketName); - request.setObjectKey(objectKey); - request.setExpires((int) expirySeconds); - - TemporarySignatureResponse response = createClient(credentials).createTemporarySignature(request); - return response.getSignedUrl(); - } - - @Override - public boolean bucketExists(AppResource resource, Map credentials) { - String bucketName = resource.getName(); - try (ObsClient obsClient = createClient(credentials)) { - return obsClient.headBucket(bucketName); - } catch (Exception e) { - log.error("检查存储桶是否存在失败: {}", e.getMessage()); - return false; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/QiniuKodoProvider.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/QiniuKodoProvider.java deleted file mode 100644 index 97ac0ff..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/QiniuKodoProvider.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.gxwebsoft.app.service.cloud.impl; - -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import com.qiniu.storage.BucketManager; -import com.qiniu.storage.Configuration; -import com.qiniu.storage.model.BucketInfo; -import com.qiniu.util.Auth; -import lombok.extern.slf4j.Slf4j; - -import java.util.HashMap; -import java.util.Map; - -/** - * 七牛云 Kodo Provider 实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -public class QiniuKodoProvider implements CloudStorageProvider { - - public static final String PROVIDER_TYPE = "qiniu"; - - @Override - public String getProviderType() { - return PROVIDER_TYPE; - } - - @Override - public boolean testConnection(Map credentials) { - try { - // 兼容 accessKeyId/accessKeySecret 和 accessKey/secretKey - String accessKey = credentials.get("accessKey"); - String secretKey = credentials.get("secretKey"); - if (accessKey == null && credentials.get("accessKeyId") != null) { - accessKey = credentials.get("accessKeyId"); - } - if (secretKey == null && credentials.get("accessKeySecret") != null) { - secretKey = credentials.get("accessKeySecret"); - } - if (accessKey == null || secretKey == null) { - log.error("七牛云凭证缺少 accessKey/accessKeyId 或 secretKey/accessKeySecret"); - return false; - } - // 尝试创建凭证并列出 bucket(验证凭证是否有效) - Configuration config = new Configuration(); - Auth auth = Auth.create(accessKey, secretKey); - BucketManager bucketManager = new BucketManager(auth, config); - bucketManager.buckets(); - log.info("七牛云凭证验证成功"); - return true; - } catch (Exception e) { - log.error("七牛云凭证验证失败: {}", e.getMessage()); - return false; - } - } - - private BucketManager createClient(Map credentials) { - // 兼容 accessKeyId/accessKeySecret 和 accessKey/secretKey - String accessKey = credentials.get("accessKey"); - String secretKey = credentials.get("secretKey"); - if (accessKey == null && credentials.get("accessKeyId") != null) { - accessKey = credentials.get("accessKeyId"); - } - if (secretKey == null && credentials.get("accessKeySecret") != null) { - secretKey = credentials.get("accessKeySecret"); - } - - if (accessKey == null || secretKey == null) { - throw new IllegalArgumentException("七牛云凭证缺少必要字段: accessKey/accessKeyId, secretKey/accessKeySecret"); - } - - Configuration config = new Configuration(); - // 构造凭证 - Auth auth = Auth.create(accessKey, secretKey); - - return new BucketManager(auth, config); - } - - @Override - public void createBucket(AppResource resource, Map credentials) throws Exception { - // 七牛云存储空间需要通过控制台或 API 创建 - // 这里只记录元数据,不实际创建 - log.info("七牛云存储桶 {} 创建成功(仅记录元数据,实际创建需在控制台操作)", resource.getName()); - } - - @Override - public void deleteBucket(AppResource resource, Map credentials) throws Exception { - // 七牛云不支持通过 API 删除存储桶,只删除记录 - log.info("七牛云存储桶 {} 删除(仅删除记录,实际删除需在控制台操作)", resource.getName()); - } - - @Override - public void setBucketAcl(AppResource resource, String acl, Map credentials) throws Exception { - // 七牛云 ACL 通过管理后台设置或上传时指定 - log.info("七牛云存储桶 {} ACL 设置: {}(实际操作需通过管理后台)", resource.getName(), acl); - } - - @Override - public Map getBucketInfo(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - BucketManager bucketManager = createClient(credentials); - Map result = new HashMap<>(); - - try { - // 获取存储桶信息 - BucketInfo bucketInfo = bucketManager.getBucketInfo(bucketName); - result.put("bucketName", bucketName); - result.put("region", resource.getRegion()); - result.put("info", bucketInfo); - result.put("usedBytes", 0L); - result.put("objectCount", 0); - } catch (Exception e) { - log.warn("获取七牛云存储桶信息失败: {}", e.getMessage()); - result.put("bucketName", bucketName); - result.put("region", resource.getRegion()); - result.put("usedBytes", 0L); - result.put("objectCount", 0); - } - - return result; - } - - @Override - public String getBucketEndpoint(AppResource resource, Map credentials) { - String bucketName = resource.getName(); - String region = resource.getRegion(); - - // 七牛云需要自定义域名,暂用默认格式 - return "https://" + bucketName + ".qiniucs.com"; - } - - @Override - public String generateSignedUrl(AppResource resource, String objectKey, long expirySeconds, Map credentials) throws Exception { - String bucketName = resource.getName(); - - // 生成私有空间签名访问链接 - String domain = getBucketEndpoint(resource, credentials); - String url = domain + "/" + objectKey; - - // 七牛云需要使用 auth.privateDownloadUrl 生成签名 URL - String accessKey = credentials.get("accessKey"); - String secretKey = credentials.get("secretKey"); - Auth auth = Auth.create(accessKey, secretKey); - - return auth.privateDownloadUrl(url, expirySeconds); - } - - @Override - public boolean bucketExists(AppResource resource, Map credentials) { - try { - BucketManager bucketManager = createClient(credentials); - bucketManager.getBucketInfo(resource.getName()); - return true; - } catch (Exception e) { - return false; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/TencentCOSProvider.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/TencentCOSProvider.java deleted file mode 100644 index 9ddeb19..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/cloud/impl/TencentCOSProvider.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.gxwebsoft.app.service.cloud.impl; - -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import com.qcloud.cos.COSClient; -import com.qcloud.cos.ClientConfig; -import com.qcloud.cos.auth.BasicCOSCredentials; -import com.qcloud.cos.auth.COSCredentials; -import com.qcloud.cos.model.*; -import com.qcloud.cos.region.Region; -import lombok.extern.slf4j.Slf4j; - -import java.net.URL; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * 腾讯云 COS Provider 实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -public class TencentCOSProvider implements CloudStorageProvider { - - public static final String PROVIDER_TYPE = "tencent"; - - @Override - public String getProviderType() { - return PROVIDER_TYPE; - } - - @Override - public boolean testConnection(Map credentials) { - try { - // 兼容 accessKeyId/accessKeySecret 和 secretId/secretKey - String secretId = credentials.get("secretId"); - String secretKey = credentials.get("secretKey"); - if (secretId == null && credentials.get("accessKeyId") != null) { - secretId = credentials.get("accessKeyId"); - } - if (secretKey == null && credentials.get("accessKeySecret") != null) { - secretKey = credentials.get("accessKeySecret"); - } - if (secretId == null || secretKey == null) { - log.error("腾讯云 COS 凭证缺少 secretId/accessKeyId 或 secretKey/accessKeySecret"); - return false; - } - // 获取或使用默认 region - String region = credentials.get("region"); - if (region == null || region.isEmpty()) { - region = "ap-guangzhou"; - } - // 尝试创建客户端并列出 bucket(验证凭证是否有效) - COSCredentials cosCredentials = new BasicCOSCredentials(secretId, secretKey); - ClientConfig clientConfig = new ClientConfig(new Region(region)); - COSClient cosClient = new COSClient(cosCredentials, clientConfig); - try { - cosClient.listBuckets(); - log.info("腾讯云 COS 凭证验证成功"); - return true; - } finally { - cosClient.shutdown(); - } - } catch (Exception e) { - log.error("腾讯云 COS 凭证验证失败: {}", e.getMessage()); - return false; - } - } - - private COSClient createClient(Map credentials) { - // 兼容 accessKeyId/accessKeySecret 和 secretId/secretKey - String secretId = credentials.get("secretId"); - String secretKey = credentials.get("secretKey"); - if (secretId == null && credentials.get("accessKeyId") != null) { - secretId = credentials.get("accessKeyId"); - } - if (secretKey == null && credentials.get("accessKeySecret") != null) { - secretKey = credentials.get("accessKeySecret"); - } - String region = credentials.get("region"); - - if (secretId == null || secretKey == null || region == null) { - throw new IllegalArgumentException("腾讯云 COS 凭证缺少必要字段: secretId/accessKeyId, secretKey/accessKeySecret, region"); - } - - // 设置凭证 - COSCredentials cosCredentials = new BasicCOSCredentials(secretId, secretKey); - - // 设置地域 - ClientConfig clientConfig = new ClientConfig(new Region(region)); - - return new COSClient(cosCredentials, clientConfig); - } - - @Override - public void createBucket(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - String region = resource.getRegion(); - - COSClient cosClient = createClient(credentials); - try { - // 检查是否已存在 - if (cosClient.doesBucketExist(bucketName)) { - log.info("存储桶 {} 已存在,跳过创建", bucketName); - return; - } - - // 创建存储桶 - CreateBucketRequest request = new CreateBucketRequest(bucketName); - // 设置 ACL - String acl = resource.getAcl(); - if ("public-read".equals(acl)) { - request.setCannedAcl(CannedAccessControlList.PublicRead); - } else { - request.setCannedAcl(CannedAccessControlList.Private); - } - - cosClient.createBucket(request); - log.info("腾讯云 COS 存储桶 {} 创建成功,地区: {},ACL: {}", bucketName, region, acl); - } finally { - cosClient.shutdown(); - } - } - - @Override - public void deleteBucket(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - COSClient cosClient = createClient(credentials); - - try { - if (!cosClient.doesBucketExist(bucketName)) { - log.info("存储桶 {} 不存在,跳过删除", bucketName); - return; - } - - // 删除存储桶(需要先清空桶内对象) - cosClient.deleteBucket(bucketName); - log.info("腾讯云 COS 存储桶 {} 删除成功", bucketName); - } finally { - cosClient.shutdown(); - } - } - - @Override - public void setBucketAcl(AppResource resource, String acl, Map credentials) throws Exception { - String bucketName = resource.getName(); - COSClient cosClient = createClient(credentials); - - try { - // 设置 ACL - if ("public-read".equals(acl)) { - cosClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead); - } else { - cosClient.setBucketAcl(bucketName, CannedAccessControlList.Private); - } - log.info("设置腾讯云 COS 存储桶 {} ACL 为 {}", bucketName, acl); - } finally { - cosClient.shutdown(); - } - } - - @Override - public Map getBucketInfo(AppResource resource, Map credentials) throws Exception { - String bucketName = resource.getName(); - COSClient cosClient = createClient(credentials); - Map result = new HashMap<>(); - - try { - result.put("bucketName", bucketName); - result.put("region", resource.getRegion()); - result.put("usedBytes", 0L); - result.put("objectCount", 0); - } finally { - cosClient.shutdown(); - } - - return result; - } - - @Override - public String getBucketEndpoint(AppResource resource, Map credentials) { - String region = resource.getRegion(); - String bucketName = resource.getName(); - - // 外网 endpoint 格式: {bucket}.cos.{region}.myqcloud.com - return "https://" + bucketName + ".cos." + region + ".myqcloud.com"; - } - - @Override - public String generateSignedUrl(AppResource resource, String objectKey, long expirySeconds, Map credentials) throws Exception { - String bucketName = resource.getName(); - - Date expirationDate = new Date(System.currentTimeMillis() + expirySeconds * 1000); - URL url = createClient(credentials).generatePresignedUrl(bucketName, objectKey, expirationDate); - return url.toString(); - } - - @Override - public boolean bucketExists(AppResource resource, Map credentials) { - String bucketName = resource.getName(); - try { - COSClient cosClient = createClient(credentials); - try { - return cosClient.doesBucketExist(bucketName); - } finally { - cosClient.shutdown(); - } - } catch (Exception e) { - log.error("检查存储桶是否存在失败: {}", e.getMessage()); - return false; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppApiKeyServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppApiKeyServiceImpl.java deleted file mode 100644 index 466eafe..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppApiKeyServiceImpl.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppApiKey; -import com.gxwebsoft.app.mapper.AppApiKeyMapper; -import com.gxwebsoft.app.param.AppApiKeyParam; -import com.gxwebsoft.app.service.AppApiKeyService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.security.SecureRandom; -import java.time.LocalDateTime; -import java.util.*; - -/** - * 应用 API Key 服务实现 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Slf4j -@Service -public class AppApiKeyServiceImpl - extends ServiceImpl - implements AppApiKeyService { - - private static final String KEY_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - private static final String KEY_PREFIX = "sk-"; - private static final int KEY_LENGTH = 48; - private static final SecureRandom RANDOM = new SecureRandom(); - - @Override - public IPage pageRel(AppApiKeyParam param) { - Page page = new Page<>(param.getPage(), param.getLimit()); - return baseMapper.selectPageRel(page, param); - } - - @Override - public List listRel(AppApiKeyParam param) { - return baseMapper.selectListRel(param); - } - - @Override - public AppApiKey getByIdRel(Long id) { - return baseMapper.selectByIdRel(id); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public AppApiKey createApiKey(AppApiKey apiKey, Integer userId, Integer tenantId) { - // 生成 API Key - String rawKey = generateRawKey(); - String encryptedKey = encryptKey(rawKey); - String prefix = KEY_PREFIX + rawKey.substring(0, 8); - - apiKey.setApiKey(encryptedKey); - apiKey.setKeyPrefix(prefix); - apiKey.setUserId(userId); - apiKey.setTenantId(tenantId); - apiKey.setStatus(0); // 默认正常 - apiKey.setUsageCount(0L); - apiKey.setCreateTime(LocalDateTime.now()); - apiKey.setUpdateTime(LocalDateTime.now()); - - this.save(apiKey); - log.info("创建API Key成功: userId={}, name={}", userId, apiKey.getName()); - return apiKey; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean updateApiKey(AppApiKey apiKey) { - apiKey.setApiKey(null); // 不允许通过此接口修改密钥 - apiKey.setKeyPrefix(null); - apiKey.setUserId(null); - apiKey.setUpdateTime(LocalDateTime.now()); - return this.updateById(apiKey); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean updateStatus(Long id, Integer status, Integer userId) { - AppApiKey apiKey = this.getById(id); - if (apiKey == null) { - throw new RuntimeException("API Key不存在"); - } - if (!apiKey.getUserId().equals(userId)) { - throw new RuntimeException("无权操作此API Key"); - } - apiKey.setStatus(status); - apiKey.setUpdateTime(LocalDateTime.now()); - return this.updateById(apiKey); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean removeApiKey(Long id, Integer userId) { - AppApiKey apiKey = this.getById(id); - if (apiKey == null) { - throw new RuntimeException("API Key不存在"); - } - if (!apiKey.getUserId().equals(userId)) { - throw new RuntimeException("无权删除此API Key"); - } - return this.removeById(id); - } - - @Override - public Map statsByUser(Integer userId, Integer tenantId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppApiKey::getUserId, userId); - wrapper.eq(AppApiKey::getTenantId, tenantId); - - List keys = this.list(wrapper); - long total = keys.size(); - long active = keys.stream().filter(k -> k.getStatus() != null && k.getStatus() == 0).count(); - long expired = keys.stream().filter(k -> k.getExpireTime() != null - && k.getExpireTime().isBefore(LocalDateTime.now())).count(); - long disabled = keys.stream().filter(k -> k.getStatus() != null && k.getStatus() == 1).count(); - long totalUsage = keys.stream() - .filter(k -> k.getUsageCount() != null) - .mapToLong(AppApiKey::getUsageCount) - .sum(); - - Map stats = new HashMap<>(); - stats.put("total", total); - stats.put("active", active); - stats.put("expired", expired); - stats.put("disabled", disabled); - stats.put("totalUsage", totalUsage); - return stats; - } - - /** - * 生成原始密钥 - */ - private String generateRawKey() { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < KEY_LENGTH; i++) { - sb.append(KEY_CHARS.charAt(RANDOM.nextInt(KEY_CHARS.length()))); - } - return sb.toString(); - } - - /** - * 加密密钥(实际项目中应使用更强的加密算法) - * 这里简单处理,实际生产环境应使用 AES 或其他加密方式 - */ - private String encryptKey(String rawKey) { - // 这里暂时返回原始值,实际生产环境需要加密存储 - // 存储时使用 Base64 简单编码便于后续扩展 - return Base64.getEncoder().encodeToString(rawKey.getBytes()); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppArticleCategoryServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppArticleCategoryServiceImpl.java deleted file mode 100644 index b324637..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppArticleCategoryServiceImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppArticle; -import com.gxwebsoft.app.entity.AppArticleCategory; -import com.gxwebsoft.app.mapper.AppArticleCategoryMapper; -import com.gxwebsoft.app.mapper.AppArticleMapper; -import com.gxwebsoft.app.param.AppArticleCategoryParam; -import com.gxwebsoft.app.service.AppArticleCategoryService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 平台文章分类服务实现 - */ -@Service -public class AppArticleCategoryServiceImpl extends ServiceImpl implements AppArticleCategoryService { - - @Resource - private AppArticleMapper appArticleMapper; - - @Override - public PageResult page(AppArticleCategoryParam param) { - long current = param.getPage() != null ? param.getPage() : 1L; - long size = param.getLimit() != null ? param.getLimit() : 10L; - Page page = new Page<>(current, size); - LambdaQueryWrapper wrapper = buildWrapper(param); - baseMapper.selectPage(page, wrapper); - List records = fillArticleCount(page.getRecords()); - return new PageResult<>(records, page.getTotal()); - } - - @Override - public List list(AppArticleCategoryParam param) { - return fillArticleCount(baseMapper.selectList(buildWrapper(param))); - } - - @Override - public AppArticleCategory getDetail(Integer categoryId) { - AppArticleCategory category = getById(categoryId); - if (category == null) { - return null; - } - return fillArticleCount(List.of(category)).stream().findFirst().orElse(category); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean saveCategory(AppArticleCategory category, User loginUser, Integer tenantId) { - if (category == null || StrUtil.isBlank(category.getTitle())) { - return false; - } - category.setParentId(category.getParentId() == null ? 0 : category.getParentId()); - category.setType(category.getType() == null ? 0 : category.getType()); - category.setSortNumber(category.getSortNumber() == null ? 0 : category.getSortNumber()); - category.setStatus(category.getStatus() == null ? 0 : category.getStatus()); - category.setHide(category.getHide() == null ? 0 : category.getHide()); - category.setRecommend(category.getRecommend() == null ? 0 : category.getRecommend()); - category.setShowIndex(category.getShowIndex() == null ? 0 : category.getShowIndex()); - category.setTenantId(tenantId); - category.setCreateTime(LocalDateTime.now()); - category.setUpdateTime(LocalDateTime.now()); - if (loginUser != null) { - category.setUserId(loginUser.getUserId()); - } - return save(category); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean updateCategory(AppArticleCategory category) { - if (category == null || category.getCategoryId() == null) { - return false; - } - AppArticleCategory exists = getById(category.getCategoryId()); - if (exists == null) { - return false; - } - category.setUpdateTime(LocalDateTime.now()); - return updateById(category); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean removeCategory(Integer categoryId) { - long articleCount = appArticleMapper.selectCount(new LambdaQueryWrapper() - .eq(AppArticle::getCategoryId, categoryId)); - if (articleCount > 0) { - return false; - } - return removeById(categoryId); - } - - private LambdaQueryWrapper buildWrapper(AppArticleCategoryParam param) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (param == null) { - return wrapper.orderByAsc(AppArticleCategory::getSortNumber) - .orderByDesc(AppArticleCategory::getCategoryId); - } - wrapper.eq(param.getCategoryId() != null, AppArticleCategory::getCategoryId, param.getCategoryId()) - .eq(param.getStatus() != null, AppArticleCategory::getStatus, param.getStatus()) - .eq(param.getTenantId() != null, AppArticleCategory::getTenantId, param.getTenantId()) - .and(StrUtil.isNotBlank(param.getKeywords()), w -> w - .like(AppArticleCategory::getTitle, param.getKeywords()) - .or() - .like(AppArticleCategory::getCategoryCode, param.getKeywords()) - .or() - .like(AppArticleCategory::getPath, param.getKeywords())) - .orderByAsc(AppArticleCategory::getSortNumber) - .orderByDesc(AppArticleCategory::getCategoryId); - return wrapper; - } - - private List fillArticleCount(List list) { - if (list == null || list.isEmpty()) { - return list; - } - List categoryIds = list.stream() - .map(AppArticleCategory::getCategoryId) - .filter(id -> id != null && id > 0) - .collect(Collectors.toList()); - if (categoryIds.isEmpty()) { - return list; - } - QueryWrapper countWrapper = new QueryWrapper<>(); - countWrapper.select("category_id", "COUNT(*) AS article_count") - .in("category_id", categoryIds) - .groupBy("category_id"); - Integer tenantId = list.get(0).getTenantId(); - if (tenantId != null) { - countWrapper.eq("tenant_id", tenantId); - } - Map countMap = new HashMap<>(); - appArticleMapper.selectMaps(countWrapper).forEach(item -> { - Object categoryId = item.get("category_id"); - Object articleCount = item.get("article_count"); - if (categoryId != null && articleCount != null) { - countMap.put(Integer.parseInt(String.valueOf(categoryId)), Integer.parseInt(String.valueOf(articleCount))); - } - }); - return list.stream().peek(item -> item.setCount(countMap.getOrDefault(item.getCategoryId(), 0))).collect(Collectors.toList()); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppArticleServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppArticleServiceImpl.java deleted file mode 100644 index 88f1f6f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppArticleServiceImpl.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppArticle; -import com.gxwebsoft.app.entity.AppArticleCategory; -import com.gxwebsoft.app.mapper.AppArticleCategoryMapper; -import com.gxwebsoft.app.mapper.AppArticleMapper; -import com.gxwebsoft.app.param.AppArticleParam; -import com.gxwebsoft.app.service.AppArticleService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * 平台文章服务实现 - */ -@Service -public class AppArticleServiceImpl extends ServiceImpl implements AppArticleService { - - private static final String DEFAULT_MODEL = "article"; - - @Resource - private AppArticleCategoryMapper appArticleCategoryMapper; - - @Override - public PageResult page(AppArticleParam param) { - long current = param.getPage() != null ? param.getPage() : 1L; - long size = param.getLimit() != null ? param.getLimit() : 10L; - Page page = new Page<>(current, size); - LambdaQueryWrapper wrapper = buildWrapper(param); - baseMapper.selectPage(page, wrapper); - List records = fillCategoryInfo(page.getRecords()); - return new PageResult<>(records, page.getTotal()); - } - - @Override - public List list(AppArticleParam param) { - return fillCategoryInfo(baseMapper.selectList(buildWrapper(param))); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public AppArticle getDetail(Integer articleId, boolean increaseViews) { - AppArticle article = baseMapper.selectById(articleId); - if (article == null) { - return null; - } - if (increaseViews) { - AppArticle update = new AppArticle(); - update.setArticleId(articleId); - update.setActualViews((article.getActualViews() == null ? 0 : article.getActualViews()) + 1); - update.setUpdateTime(LocalDateTime.now()); - updateById(update); - article.setActualViews(update.getActualViews()); - } - return fillCategoryInfo(Collections.singletonList(article)).stream().findFirst().orElse(article); - } - - @Override - public AppArticle getByCode(String code) { - if (StrUtil.isBlank(code)) { - return null; - } - AppArticle article = getOne(new LambdaQueryWrapper() - .eq(AppArticle::getCode, code) - .last("limit 1")); - if (article == null) { - return null; - } - return fillCategoryInfo(Collections.singletonList(article)).stream().findFirst().orElse(article); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean saveArticle(AppArticle article, User loginUser, Integer tenantId) { - if (article == null || StrUtil.isBlank(article.getTitle())) { - return false; - } - article.setModel(StrUtil.blankToDefault(article.getModel(), DEFAULT_MODEL)); - article.setCode(StrUtil.blankToDefault(article.getCode(), generateCode(article.getModel()))); - article.setType(article.getType() == null ? 0 : article.getType()); - article.setActualViews(article.getActualViews() == null ? 0 : article.getActualViews()); - article.setLikes(article.getLikes() == null ? 0 : article.getLikes()); - article.setRecommend(article.getRecommend() == null ? 0 : article.getRecommend()); - article.setSortNumber(article.getSortNumber() == null ? 0 : article.getSortNumber()); - article.setStatus(article.getStatus() == null ? 1 : article.getStatus()); - article.setTenantId(tenantId); - article.setCreateTime(LocalDateTime.now()); - article.setUpdateTime(LocalDateTime.now()); - if (loginUser != null) { - article.setUserId(loginUser.getUserId()); - if (StrUtil.isBlank(article.getAuthor())) { - article.setAuthor(StrUtil.blankToDefault(loginUser.getNickname(), loginUser.getUsername())); - } - } - return save(article); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean updateArticle(AppArticle article) { - if (article == null || article.getArticleId() == null) { - return false; - } - AppArticle exists = getById(article.getArticleId()); - if (exists == null) { - return false; - } - if (StrUtil.isBlank(article.getModel())) { - article.setModel(exists.getModel()); - } - if (StrUtil.isBlank(article.getCode())) { - article.setCode(exists.getCode()); - } - if (article.getType() == null) { - article.setType(exists.getType()); - } - article.setUpdateTime(LocalDateTime.now()); - return updateById(article); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean removeArticle(Integer articleId) { - return removeById(articleId); - } - - @Override - public Map getStats(AppArticleParam param) { - Map data = new HashMap<>(); - LambdaQueryWrapper base = buildWrapper(param); - data.put("totalNum", Math.toIntExact(count(base))); - data.put("publishedNum", Math.toIntExact(count(buildWrapper(param).eq(AppArticle::getStatus, 0)))); - data.put("recommendNum", Math.toIntExact(count(buildWrapper(param).eq(AppArticle::getRecommend, 1)))); - return data; - } - - private LambdaQueryWrapper buildWrapper(AppArticleParam param) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (param == null) { - return wrapper.orderByDesc(AppArticle::getRecommend) - .orderByAsc(AppArticle::getSortNumber) - .orderByDesc(AppArticle::getCreateTime); - } - wrapper.eq(param.getArticleId() != null, AppArticle::getArticleId, param.getArticleId()) - .eq(StrUtil.isNotBlank(param.getModel()), AppArticle::getModel, param.getModel()) - .eq(param.getStatus() != null, AppArticle::getStatus, param.getStatus()) - .eq(param.getCategoryId() != null, AppArticle::getCategoryId, param.getCategoryId()) - .eq(param.getRecommend() != null, AppArticle::getRecommend, param.getRecommend()) - .eq(param.getTenantId() != null, AppArticle::getTenantId, param.getTenantId()) - .and(StrUtil.isNotBlank(param.getKeywords()), w -> w - .like(AppArticle::getTitle, param.getKeywords()) - .or() - .like(AppArticle::getOverview, param.getKeywords()) - .or() - .like(AppArticle::getAuthor, param.getKeywords()) - .or() - .like(AppArticle::getCode, param.getKeywords())) - .orderByDesc(AppArticle::getRecommend) - .orderByAsc(AppArticle::getSortNumber) - .orderByDesc(AppArticle::getCreateTime); - return wrapper; - } - - private List fillCategoryInfo(List list) { - if (list == null || list.isEmpty()) { - return list; - } - Set categoryIds = list.stream() - .map(AppArticle::getCategoryId) - .filter(ObjectUtil::isNotNull) - .collect(Collectors.toSet()); - if (categoryIds.isEmpty()) { - return list; - } - Map categoryMap = appArticleCategoryMapper.selectBatchIds(categoryIds) - .stream() - .collect(Collectors.toMap(AppArticleCategory::getCategoryId, item -> item, (a, b) -> a)); - list.forEach(item -> { - AppArticleCategory category = categoryMap.get(item.getCategoryId()); - if (category != null) { - item.setCategoryName(category.getTitle()); - item.setParentId(category.getParentId()); - } - }); - return list; - } - - private String generateCode(String model) { - String prefix = "announcement".equalsIgnoreCase(model) ? "ANN" : "ART"; - return prefix + IdUtil.getSnowflakeNextId(); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppBuildServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppBuildServiceImpl.java deleted file mode 100644 index 5f933d2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppBuildServiceImpl.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.http.HttpUtil; -import cn.hutool.json.JSONObject; -import cn.hutool.json.JSONUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppBuild; -import com.gxwebsoft.app.entity.AppPipeline; -import com.gxwebsoft.app.mapper.AppBuildMapper; -import com.gxwebsoft.app.param.AppBuildParam; -import com.gxwebsoft.app.service.AppBuildService; -import com.gxwebsoft.app.service.AppPipelineService; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.time.Duration; -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * CI/CD 构建记录 Service 实现 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Service -public class AppBuildServiceImpl extends ServiceImpl implements AppBuildService { - - @Value("${config.gitea-url:https://git.websoft.top}") - private String giteaUrl; - - @Value("${config.gitea-token:}") - private String giteaToken; - - @Resource - private AppPipelineService appPipelineService; - - @Override - public PageResult pageBuild(AppBuildParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectBuildList(param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public AppBuild getBuildDetail(Long id) { - return baseMapper.selectBuildDetail(id); - } - - @Override - public AppBuild getLatestBuild(Long appId) { - return baseMapper.selectLatestBuild(appId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public AppBuild triggerBuild(Long appId, String branch, Integer triggeredBy) { - // 1. 查询应用对应的流水线 - AppPipeline pipeline = appPipelineService.getOne( - new LambdaQueryWrapper() - .eq(AppPipeline::getAppId, appId) - .eq(AppPipeline::getEnabled, true) - .last("LIMIT 1") - ); - - if (pipeline == null) { - throw new RuntimeException("未找到可用的CI/CD流水线配置,请先配置流水线"); - } - - // 2. 创建构建记录 - AppBuild build = new AppBuild(); - build.setAppId(appId); - build.setName("构建 #" + System.currentTimeMillis()); - build.setBranch(branch != null ? branch : pipeline.getDefaultBranch()); - build.setCiType(pipeline.getCiType()); - build.setCiApiUrl(giteaUrl); - build.setStatus("pending"); - build.setTriggerType("manual"); - build.setTriggeredBy(triggeredBy); - build.setUserId(triggeredBy); - build.setCreateTime(LocalDateTime.now()); - - // 3. 调用 Gitea CI 触发构建 - try { - String result = triggerGiteaAction(pipeline, branch); - if (result != null) { - JSONObject json = JSONUtil.parseObj(result); - build.setCiJobId(json.getStr("workflow_id")); - build.setCiRunId(json.getStr("run_id")); - build.setBuildNumber(json.getStr("run_number", "MANUAL-" + System.currentTimeMillis())); - } - } catch (Exception e) { - log.error("触发Gitea构建失败: {}", e.getMessage()); - build.setStatus("failed"); - build.setErrorMessage("触发CI失败: " + e.getMessage()); - } - - save(build); - - // 4. 更新流水线的最后构建信息 - updatePipelineLastBuild(pipeline.getId(), build.getId(), build.getStatus()); - - return build; - } - - @Override - public String getBuildLog(Long buildId) { - AppBuild build = getById(buildId); - if (build == null) { - throw new RuntimeException("构建记录不存在"); - } - - if (!"gitea".equals(build.getCiType())) { - return "当前构建类型不支持日志查看"; - } - - try { - String url = String.format("%s/api/v1/repos/%s/actions/runs/%s/jobs", - giteaUrl, build.getCiJobId(), build.getCiRunId()); - - Map headers = new HashMap<>(); - headers.put("Authorization", "Bearer " + giteaToken); - headers.put("Content-Type", "application/json"); - - String response = HttpUtil.createGet(url) - .headerMap(headers, true) - .timeout(30000) - .execute() - .body(); - - if (response != null) { - JSONObject json = JSONUtil.parseObj(response); - // 返回简化日志 - StringBuilder logBuilder = new StringBuilder(); - logBuilder.append("=== 构建状态: ").append(json.getStr("status", "unknown")).append(" ===\n\n"); - - if (json.containsKey("jobs")) { - logBuilder.append("=== 任务信息 ===\n"); - logBuilder.append(json.getStr("jobs", "")); - } - - return logBuilder.toString(); - } - } catch (Exception e) { - log.error("获取构建日志失败: {}", e.getMessage()); - return "获取日志失败: " + e.getMessage(); - } - - return "暂无日志"; - } - - @Override - public void handleWebhook(String ciType, Map payload) { - if ("gitea".equals(ciType)) { - handleGiteaWebhook(payload); - } - } - - @Override - public Map getBuildStats(Long appId) { - Map stats = new HashMap<>(); - stats.put("total", Math.toIntExact(count(new LambdaQueryWrapper() - .eq(AppBuild::getAppId, appId)))); - stats.put("success", baseMapper.countBuildsByStatus(appId, "success")); - stats.put("failed", baseMapper.countBuildsByStatus(appId, "failed")); - stats.put("running", baseMapper.countBuildsByStatus(appId, "running") + - baseMapper.countBuildsByStatus(appId, "pending")); - return stats; - } - - @Override - public boolean cancelBuild(Long buildId) { - AppBuild build = getById(buildId); - if (build == null) { - throw new RuntimeException("构建记录不存在"); - } - - if (!"pending".equals(build.getStatus()) && !"running".equals(build.getStatus())) { - throw new RuntimeException("当前状态无法取消"); - } - - build.setStatus("cancelled"); - build.setFinishedAt(LocalDateTime.now()); - return updateById(build); - } - - @Override - public AppBuild retryBuild(Long buildId, Integer triggeredBy) { - AppBuild oldBuild = getById(buildId); - if (oldBuild == null) { - throw new RuntimeException("构建记录不存在"); - } - - // 创建新的构建记录,复用原构建的配置 - return triggerBuild(oldBuild.getAppId(), oldBuild.getBranch(), triggeredBy); - } - - // ========== 私有方法 ========== - - /** - * 触发 Gitea Actions 工作流 - */ - private String triggerGiteaAction(AppPipeline pipeline, String branch) { - if (pipeline.getRepoFullName() == null) { - throw new RuntimeException("流水线未配置仓库"); - } - - String workflowFile = pipeline.getWorkflowFile() != null ? pipeline.getWorkflowFile() : "build.yml"; - String url = String.format("%s/api/v1/repos/%s/actions/workflows/%s/runs", - giteaUrl, pipeline.getRepoFullName(), workflowFile); - - Map headers = new HashMap<>(); - headers.put("Authorization", "Bearer " + giteaToken); - headers.put("Content-Type", "application/json"); - - Map body = new HashMap<>(); - if (branch != null) { - body.put("ref", branch); - } - - try { - String response = HttpUtil.createPost(url) - .headerMap(headers, true) - .body(JSONUtil.toJsonStr(body)) - .timeout(30000) - .execute() - .body(); - - log.info("Gitea构建触发成功: {}", response); - return response; - } catch (Exception e) { - log.error("触发Gitea构建失败: {}", e.getMessage()); - throw new RuntimeException("触发CI构建失败: " + e.getMessage()); - } - } - - /** - * 处理 Gitea Webhook 回调 - */ - private void handleGiteaWebhook(Map payload) { - String runId = String.valueOf(payload.get("run_id")); - String status = String.valueOf(payload.get("status")); - - // 根据 run_id 查找构建记录 - AppBuild build = getOne(new LambdaQueryWrapper() - .eq(AppBuild::getCiRunId, runId) - .last("LIMIT 1")); - - if (build == null) { - log.warn("未找到匹配的构建记录, run_id: {}", runId); - return; - } - - // 更新构建状态 - build.setStatus(mapGiteaStatus(status)); - - if ("completed".equals(status) || "success".equals(status) || "failed".equals(status)) { - build.setFinishedAt(LocalDateTime.now()); - - // 计算耗时 - if (build.getStartedAt() != null) { - long seconds = Duration.between(build.getStartedAt(), build.getFinishedAt()).getSeconds(); - build.setDuration(Math.toIntExact(seconds)); - } - } - - if ("failed".equals(status) && payload.containsKey("conclusion")) { - build.setErrorMessage(String.valueOf(payload.get("conclusion"))); - } - - updateById(build); - - // 更新流水线的最后构建状态 - updatePipelineLastBuild(build.getAppId(), build.getId(), build.getStatus()); - } - - /** - * 映射 Gitea 状态到内部状态 - */ - private String mapGiteaStatus(String giteaStatus) { - return switch (giteaStatus) { - case "queued", "waiting", "requested" -> "pending"; - case "in_progress", "progressing" -> "running"; - case "completed" -> "success"; - case "cancelled" -> "cancelled"; - default -> giteaStatus; - }; - } - - /** - * 更新流水线的最后构建信息 - */ - private void updatePipelineLastBuild(Long pipelineId, Long buildId, String status) { - if (pipelineId == null) return; - - AppPipeline pipeline = appPipelineService.getById(pipelineId); - if (pipeline != null) { - pipeline.setLastBuildId(buildId); - pipeline.setLastBuildStatus(status); - pipeline.setLastBuildTime(LocalDateTime.now()); - - if ("success".equals(status)) { - pipeline.setSuccessCount(pipeline.getSuccessCount() != null ? pipeline.getSuccessCount() + 1 : 1); - } else if ("failed".equals(status)) { - pipeline.setFailureCount(pipeline.getFailureCount() != null ? pipeline.getFailureCount() + 1 : 1); - } - - appPipelineService.updateById(pipeline); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppCloudCredentialServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppCloudCredentialServiceImpl.java deleted file mode 100644 index 220ee42..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppCloudCredentialServiceImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppCloudCredential; -import com.gxwebsoft.app.mapper.AppCloudCredentialMapper; -import com.gxwebsoft.app.service.AppCloudCredentialService; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import com.gxwebsoft.app.service.cloud.CloudStorageProviderFactory; -import com.gxwebsoft.common.core.utils.AesUtil; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.app.param.AppCloudCredentialParam; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 云账号凭证Service实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -@Service -public class AppCloudCredentialServiceImpl extends ServiceImpl - implements AppCloudCredentialService { - - /** AES加密密钥(生产环境应使用配置中心) */ - private static final String AES_KEY = "websopy-cloud-key".substring(0, 16); - - @Override - public PageResult pageRel(AppCloudCredentialParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("id desc"); - // 将 Param 转换为 Entity 用于查询 - AppCloudCredential entity = new AppCloudCredential(); - entity.setProvider(param.getProvider()); - entity.setUserId(param.getUserId()); - entity.setStatus(param.getStatus()); - entity.setDeleted(param.getDeleted() != null ? param.getDeleted() : 0); - List list = baseMapper.selectPageRel(page, entity); - // 脱敏处理 - list.forEach(this::maskSecret); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(AppCloudCredentialParam param) { - // 将 Param 转换为 Entity 用于查询 - AppCloudCredential entity = new AppCloudCredential(); - entity.setProvider(param.getProvider()); - entity.setUserId(param.getUserId()); - entity.setStatus(param.getStatus()); - entity.setDeleted(param.getDeleted() != null ? param.getDeleted() : 0); - List list = baseMapper.selectListRel(entity); - list.forEach(this::maskSecret); - return list; - } - - @Override - public AppCloudCredential add(AppCloudCredential credential) throws Exception { - // 加密存储 SK - if (credential.getAccessKeySecret() != null) { - credential.setAccessKeySecret(encrypt(credential.getAccessKeySecret())); - } - if (credential.getStatus() == null) { - credential.setStatus(0); - } - if (credential.getDeleted() == null) { - credential.setDeleted(0); - } - credential.setCreateTime(LocalDateTime.now()); - credential.setUpdateTime(LocalDateTime.now()); - save(credential); - log.info("创建云账号凭证成功,provider={}, name={}", credential.getProvider(), credential.getName()); - // 返回含明文的凭证(仅创建时返回一次) - credential.setAccessKeySecret(decrypt(credential.getAccessKeySecret())); - return credential; - } - - @Override - public AppCloudCredential update(AppCloudCredential credential) throws Exception { - // 如果传了新的 SK,则加密存储 - if (credential.getAccessKeySecret() != null && !credential.getAccessKeySecret().startsWith("****")) { - credential.setAccessKeySecret(encrypt(credential.getAccessKeySecret())); - } - credential.setUpdateTime(LocalDateTime.now()); - updateById(credential); - log.info("更新云账号凭证成功,id={}", credential.getId()); - // 返回脱敏后的对象 - maskSecret(credential); - return credential; - } - - @Override - public void remove(Long id, Integer userId) throws Exception { - // 检查归属 - AppCloudCredential credential = getById(id); - if (credential == null) { - throw new RuntimeException("凭证不存在"); - } - if (!credential.getUserId().equals(userId)) { - throw new RuntimeException("无权删除此凭证"); - } - removeById(id); - log.info("删除云账号凭证成功,id={}", id); - } - - @Override - public Map getCredentials(String provider, Integer userId) { - // 查询用户在该 provider 下的凭证 - AppCloudCredential entity = new AppCloudCredential(); - entity.setProvider(provider); - entity.setUserId(userId); - entity.setStatus(0); - entity.setDeleted(0); - - List list = baseMapper.selectListRel(entity); - if (list == null || list.isEmpty()) { - return null; - } - - // 取第一个 - AppCloudCredential credential = list.get(0); - Map result = new HashMap<>(); - result.put("accessKeyId", credential.getAccessKeyId()); - result.put("accessKeySecret", decrypt(credential.getAccessKeySecret())); - - // 额外配置 - if (credential.getConfigJson() != null) { - try { - Map config = new com.alibaba.fastjson.JSONObject() - .parseObject(credential.getConfigJson(), Map.class); - result.putAll(config); - } catch (Exception e) { - log.warn("解析配置JSON失败: {}", e.getMessage()); - } - } - - return result; - } - - @Override - public Map getCredentialsByCredentialId(Long credentialId) { - if (credentialId == null) { - return null; - } - AppCloudCredential credential = getById(credentialId); - if (credential == null || !Integer.valueOf(0).equals(credential.getDeleted())) { - return null; - } - - Map result = new HashMap<>(); - result.put("accessKeyId", credential.getAccessKeyId()); - result.put("accessKeySecret", decrypt(credential.getAccessKeySecret())); - - // 额外配置 - if (credential.getConfigJson() != null) { - try { - Map config = new com.alibaba.fastjson.JSONObject() - .parseObject(credential.getConfigJson(), Map.class); - result.putAll(config); - } catch (Exception e) { - log.warn("解析配置JSON失败: {}", e.getMessage()); - } - } - - return result; - } - - @Override - public boolean testConnection(String provider, Map credentials) { - try { - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(provider); - // 使用专门的测试连接方法,不需要 bucket - return cloudProvider.testConnection(credentials); - } catch (Exception e) { - log.error("测试连接失败: {}", e.getMessage()); - return false; - } - } - - @Override - public Object[] testConnectionWithMessage(String provider, Map credentials) { - try { - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(provider); - // 使用专门的测试连接方法,不需要 bucket - boolean success = cloudProvider.testConnection(credentials); - return new Object[]{success, success ? "连接成功" : "连接失败"}; - } catch (Exception e) { - log.error("测试连接失败: {}", e.getMessage()); - return new Object[]{false, e.getMessage()}; - } - } - - /** - * 脱敏处理 - */ - private void maskSecret(AppCloudCredential credential) { - if (credential.getAccessKeySecret() != null && !credential.getAccessKeySecret().startsWith("****")) { - String secret = credential.getAccessKeySecret(); - if (secret.length() > 8) { - credential.setAccessKeySecret(secret.substring(0, 4) + "********"); - } else { - credential.setAccessKeySecret("****"); - } - } - } - - /** - * AES 加密 - */ - private String encrypt(String plaintext) { - try { - return AesUtil.encrypt(plaintext, AES_KEY); - } catch (Exception e) { - throw new RuntimeException("加密失败", e); - } - } - - /** - * AES 解密 - */ - private String decrypt(String ciphertext) { - try { - if (ciphertext == null) return null; - return AesUtil.decrypt(ciphertext, AES_KEY); - } catch (Exception e) { - throw new RuntimeException("解密失败", e); - } - } -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppConfigServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppConfigServiceImpl.java deleted file mode 100644 index 46b4c3b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppConfigServiceImpl.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.crypto.SecureUtil; -import cn.hutool.crypto.symmetric.AES; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppConfig; -import com.gxwebsoft.app.mapper.AppConfigMapper; -import com.gxwebsoft.app.param.AppConfigParam; -import com.gxwebsoft.app.service.AppConfigService; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.service.UserService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 应用配置表 Service 实现类 - * - * @author 科技小王子 - */ -@Slf4j -@Service -public class AppConfigServiceImpl extends ServiceImpl implements AppConfigService { - - @Resource - private UserService userService; - - /** - * 配置加密密钥(从配置文件读取) - */ - @Value("${app.config.encrypt-key:GXWebsoft2024!@#$}") - private String encryptKey; - - /** - * 分页查询应用配置 - */ - @Override - public List page(AppConfigParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, config_id asc"); - List list = baseMapper.selectPageRel(page, param); - return page.sortRecords(list); - } - - /** - * 分页查询应用配置(返回PageResult) - */ - public PageResult pageRel(AppConfigParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, config_id asc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - /** - * 获取应用配置列表 - */ - @Override - public List list(AppConfigParam param) { - List list = baseMapper.selectListRel(param); - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, config_id asc"); - return page.sortRecords(list); - } - - /** - * 根据应用ID获取配置映射(自动解密) - */ - @Override - public Map getConfigsByAppId(Integer appId) { - List> configs = baseMapper.selectConfigsByAppId(appId); - Map result = new HashMap<>(); - - for (Map config : configs) { - String configKey = (String) config.get("configKey"); - Object configValue = config.get("configValue"); - Integer isEncrypted = (Integer) config.get("isEncrypted"); - - // 解密 - if (isEncrypted != null && isEncrypted == 1 && configValue != null) { - try { - configValue = decrypt((String) configValue); - } catch (Exception e) { - log.error("配置解密失败: {}", configKey, e); - } - } - - result.put(configKey, configValue); - } - - return result; - } - - /** - * 获取单个配置值 - */ - @Override - public String getConfigValue(Integer appId, String configKey) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppConfig::getAppId, appId); - wrapper.eq(AppConfig::getConfigKey, configKey); - AppConfig config = getOne(wrapper); - - if (config == null || config.getConfigValue() == null) { - return null; - } - - // 解密 - if (config.getIsEncrypted() != null && config.getIsEncrypted() == 1) { - return decrypt(config.getConfigValue()); - } - - return config.getConfigValue(); - } - - /** - * 保存配置 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveConfig(AppConfig config) { - // 设置租户ID - Integer tenantId = getCurrentTenantId(); - if (tenantId != null) { - config.setTenantId(Long.valueOf(tenantId)); - } - - // 加密敏感信息 - if (config.getIsEncrypted() != null && config.getIsEncrypted() == 1 && config.getConfigValue() != null) { - config.setConfigValue(encrypt(config.getConfigValue())); - } - - save(config); - } - - /** - * 批量保存配置 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void batchSaveConfig(Integer appId, List configs) { - // 设置租户ID - Integer tenantId = getCurrentTenantId(); - if (tenantId != null) { - for (AppConfig config : configs) { - config.setTenantId(Long.valueOf(tenantId)); - } - } - - // 先删除该应用的所有配置 - remove(new LambdaQueryWrapper() - .eq(AppConfig::getAppId, appId)); - - // 批量插入新配置 - for (AppConfig config : configs) { - config.setAppId(appId); - - // 加密敏感信息 - if (config.getIsEncrypted() != null && config.getIsEncrypted() == 1 && config.getConfigValue() != null) { - config.setConfigValue(encrypt(config.getConfigValue())); - } - - save(config); - } - } - - /** - * 更新配置 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void updateConfig(AppConfig config) { - // 加密敏感信息 - if (config.getIsEncrypted() != null && config.getIsEncrypted() == 1 && config.getConfigValue() != null) { - config.setConfigValue(encrypt(config.getConfigValue())); - } - - updateById(config); - } - - /** - * 删除配置 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteConfig(Integer configId) { - removeById(configId); - } - - /** - * 根据应用ID删除所有配置 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteByAppId(Integer appId) { - remove(new LambdaQueryWrapper() - .eq(AppConfig::getAppId, appId)); - } - - /** - * 构建查询条件 - */ - private LambdaQueryWrapper buildQueryWrapper(AppConfigParam param) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (param.getConfigId() != null) { - wrapper.eq(AppConfig::getConfigId, param.getConfigId()); - } - if (param.getAppId() != null) { - wrapper.eq(AppConfig::getAppId, param.getAppId()); - } - if (param.getConfigKey() != null) { - wrapper.like(AppConfig::getConfigKey, param.getConfigKey()); - } - if (param.getConfigType() != null) { - wrapper.eq(AppConfig::getConfigType, param.getConfigType()); - } - if (param.getIsSecret() != null) { - wrapper.eq(AppConfig::getIsSecret, param.getIsSecret()); - } - - wrapper.orderByAsc(AppConfig::getConfigType) - .orderByAsc(AppConfig::getSortNumber) - .orderByAsc(AppConfig::getConfigId); - - return wrapper; - } - - /** - * AES 加密 - */ - private String encrypt(String plainText) { - AES aes = SecureUtil.aes(encryptKey.getBytes()); - return aes.encryptBase64(plainText); - } - - /** - * AES 解密 - */ - private String decrypt(String cipherText) { - AES aes = SecureUtil.aes(encryptKey.getBytes()); - return aes.decryptStr(cipherText); - } - - /** - * 获取当前登录用户的租户ID - */ - private Integer getCurrentTenantId() { - try { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication != null && authentication.getPrincipal() instanceof User) { - return ((User) authentication.getPrincipal()).getTenantId(); - } - } catch (Exception e) { - log.error("获取当前用户租户ID失败", e); - } - return null; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppContractServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppContractServiceImpl.java deleted file mode 100644 index 7936930..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppContractServiceImpl.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppContract; -import com.gxwebsoft.app.mapper.AppContractMapper; -import com.gxwebsoft.app.param.AppContractParam; -import com.gxwebsoft.app.service.AppContractService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.service.UserService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.Map; - -/** - * 合同管理 Service 实现 - * - * @author 科技小王子 - * @since 2026-04-13 - */ -@Slf4j -@Service -public class AppContractServiceImpl extends ServiceImpl - implements AppContractService { - - @Resource - private UserService userService; - - // ─── 生成合同编号(格式:HT-20260413-0001) ──────────────────── - private String generateContractNo() { - LocalDateTime now = LocalDateTime.now(); - String datePart = now.format(DateTimeFormatter.ofPattern("yyyyMMdd")); - Integer maxSeq = baseMapper.selectMaxSeqForDate(datePart); - int seq = (maxSeq == null ? 0 : maxSeq) + 1; - return String.format("HT-%s-%04d", datePart, seq); - } - - // ─── 分页查询 ───────────────────────────────────────────────── - @Override - public PageResult page(AppContractParam param, Integer userId) { - Page page = new Page<>(param.getCurrent(), param.getSize() > 0 ? param.getSize() : 15); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppContract::getDeleted, 0) - .eq(AppContract::getUserId, userId) - .eq(ObjectUtil.isNotEmpty(param.getContractType()), AppContract::getContractType, param.getContractType()) - .eq(ObjectUtil.isNotEmpty(param.getStatus()), AppContract::getStatus, param.getStatus()) - .and(ObjectUtil.isNotEmpty(param.getKeywords()), q -> - q.like(AppContract::getTitle, param.getKeywords()) - .or().like(AppContract::getContractNo, param.getKeywords())) - .orderByDesc(AppContract::getCreateTime); - - baseMapper.selectPage(page, wrapper); - return new PageResult<>(page.getRecords(), page.getTotal()); - } - - // ─── 创建合同 ───────────────────────────────────────────────── - @Override - @Transactional(rollbackFor = Exception.class) - public AppContract create(AppContract contract, Integer userId) { - contract.setUserId(userId); - contract.setContractNo(generateContractNo()); - contract.setDeleted(0); - contract.setCreateTime(LocalDateTime.now()); - contract.setUpdateTime(LocalDateTime.now()); - - // 补充用户名(冗余) - try { - User user = userService.getByIdIgnoreTenant(userId); - if (user != null) { - contract.setUserName(StrUtil.isNotBlank(user.getNickname()) ? user.getNickname() : user.getUsername()); - } - } catch (Exception e) { - log.warn("获取用户信息失败", e); - } - - save(contract); - return contract; - } - - // ─── 更新合同 ───────────────────────────────────────────────── - @Override - @Transactional(rollbackFor = Exception.class) - public AppContract update(AppContract contract, Integer userId) { - AppContract existing = getById(contract.getContractId()); - if (existing == null || !existing.getUserId().equals(userId)) { - throw new RuntimeException("合同不存在或无权操作"); - } - contract.setUpdateTime(LocalDateTime.now()); - // 不允许修改创建人 - contract.setUserId(null); - contract.setUserName(null); - contract.setContractNo(null); - updateById(contract); - return getById(contract.getContractId()); - } - - // ─── 软删除 ─────────────────────────────────────────────────── - @Override - @Transactional(rollbackFor = Exception.class) - public void remove(Long contractId, Integer userId) { - AppContract existing = getById(contractId); - if (existing == null || !existing.getUserId().equals(userId)) { - throw new RuntimeException("合同不存在或无权操作"); - } - update(new LambdaUpdateWrapper() - .eq(AppContract::getContractId, contractId) - .set(AppContract::getDeleted, 1) - .set(AppContract::getUpdateTime, LocalDateTime.now())); - } - - // ─── 统计 ───────────────────────────────────────────────────── - @Override - public Map stats(Integer userId) { - LambdaQueryWrapper base = new LambdaQueryWrapper() - .eq(AppContract::getDeleted, 0) - .eq(AppContract::getUserId, userId); - - Map result = new HashMap<>(); - result.put("total", (long) count(base.clone())); - result.put("active", (long) count(base.clone().eq(AppContract::getStatus, "active"))); - result.put("pending", (long) count(base.clone().eq(AppContract::getStatus, "pending"))); - result.put("expired", (long) count(base.clone().eq(AppContract::getStatus, "expired"))); - result.put("draft", (long) count(base.clone().eq(AppContract::getStatus, "draft"))); - result.put("terminated", (long) count(base.clone().eq(AppContract::getStatus, "terminated"))); - return result; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppCredentialServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppCredentialServiceImpl.java deleted file mode 100644 index 4493baf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppCredentialServiceImpl.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.RandomUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.mapper.AppCredentialMapper; -import com.gxwebsoft.app.service.AppCredentialService; -import com.gxwebsoft.app.entity.AppCredential; -import com.gxwebsoft.app.param.AppCredentialParam; -import com.gxwebsoft.common.core.utils.CommonUtil; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 应用密钥凭证Service实现 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:43 - */ -@Slf4j -@Service -public class AppCredentialServiceImpl extends ServiceImpl implements AppCredentialService { - - @Override - public PageResult pageRel(AppCredentialParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - // 脱敏处理:appSecret 不对外展示(仅创建/重置时返回明文) - list.forEach(this::maskSecret); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(AppCredentialParam param) { - List list = baseMapper.selectListRel(param); - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - list = page.sortRecords(list); - list.forEach(this::maskSecret); - return list; - } - - @Override - public AppCredential getByIdRel(Integer id) { - AppCredentialParam param = new AppCredentialParam(); - param.setId(id.longValue()); - AppCredential credential = param.getOne(baseMapper.selectListRel(param)); - if (credential != null) { - maskSecret(credential); - } - return credential; - } - - @Override - public AppCredential createCredential(AppCredential credential) { - // 生成 OAuth Client ID:ws_ + 16位随机字符串 - String clientId = "ws_" + CommonUtil.randomUUID16(); - // 生成 OAuth Client Secret:32位随机字符串(大小写字母+数字) - String clientSecret = generateSecretValue(); - - credential.setClientId(clientId); - credential.setClientSecret(clientSecret); - // 默认状态正常 - if (credential.getStatus() == null) { - credential.setStatus(0); - } - if (StrUtil.isBlank(credential.getType())) { - credential.setType("server"); - } - - save(credential); - log.info("创建凭证成功,clientId={}, appId={}", clientId, credential.getAppId()); - // 返回含明文 secret 的对象(仅此一次) - return credential; - } - - @Override - public AppCredential resetSecret(Long id) { - AppCredential credential = getById(id); - if (credential == null) { - throw new RuntimeException("凭证不存在"); - } - String newSecret = generateSecretValue(); - credential.setClientSecret(newSecret); - updateById(credential); - log.info("重置凭证密钥成功,id={}", id); - return credential; - } - - @Override - public boolean updateStatus(Long id, Integer status) { - return update(new LambdaUpdateWrapper() - .eq(AppCredential::getId, id) - .set(AppCredential::getStatus, status)); - } - - /** - * 生成32位随机 AppSecret - */ - private String generateSecretValue() { - // 格式:8位-8位-8位-8位(类似 UUID 格式,便于复制) - return RandomUtil.randomString(8) + "-" - + RandomUtil.randomString(8) + "-" - + RandomUtil.randomString(8) + "-" - + RandomUtil.randomString(8); - } - - /** - * 脱敏处理:将 appSecret 替换为掩码 - */ - private void maskSecret(AppCredential credential) { - if (StrUtil.isNotBlank(credential.getClientSecret())) { - // 只保留前4位,其余用 * 替代 - String secret = credential.getClientSecret(); - credential.setClientSecret(secret.substring(0, Math.min(4, secret.length())) + "**********************"); - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppEventServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppEventServiceImpl.java deleted file mode 100644 index 63e867f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppEventServiceImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.mapper.AppEventMapper; -import com.gxwebsoft.app.service.AppEventService; -import com.gxwebsoft.app.entity.AppEvent; -import com.gxwebsoft.app.param.AppEventParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 应用操作动态Service实现 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Service -public class AppEventServiceImpl extends ServiceImpl implements AppEventService { - - @Override - public PageResult pageRel(AppEventParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(AppEventParam param) { - List list = baseMapper.selectListRel(param); - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public AppEvent getByIdRel(Integer id) { - AppEventParam param = new AppEventParam(); - param.setId(id.longValue()); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - @Async - public void logEvent(Long appId, String eventType, String title, String content, - Long operatorId, String operatorName, Long refId, String refType) { - try { - AppEvent event = new AppEvent(); - event.setAppId(appId); - event.setEventType(eventType); - event.setTitle(title); - event.setContent(content); - event.setOperatorId(operatorId); - event.setOperator(operatorName); - event.setRefId(refId); - event.setRefType(refType); - event.setStatus(0); - save(event); - log.debug("记录事件成功,appId={}, eventType={}, title={}", appId, eventType, title); - } catch (Exception e) { - log.warn("记录事件失败,appId={}, eventType={}: {}", appId, eventType, e.getMessage()); - } - } - - @Override - @Async - public void logEvent(Long appId, String eventType, String title, Long operatorId, String operatorName) { - logEvent(appId, eventType, title, null, operatorId, operatorName, null, null); - } - - @Override - public AppEvent getLatestEvent(Long appId) { - return getOne(new LambdaQueryWrapper() - .eq(AppEvent::getAppId, appId) - .orderByDesc(AppEvent::getCreateTime) - .last("LIMIT 1")); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppGitAccountServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppGitAccountServiceImpl.java deleted file mode 100644 index f72c732..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppGitAccountServiceImpl.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppGitAccount; -import com.gxwebsoft.app.mapper.AppGitAccountMapper; -import com.gxwebsoft.app.service.AppGitAccountService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Git账号绑定 Service实现 - * - * @author 科技小王子 - * @since 2026-04-02 - */ -@Slf4j -@Service -public class AppGitAccountServiceImpl extends ServiceImpl implements AppGitAccountService { - - @Override - @Transactional(rollbackFor = Exception.class) - public AppGitAccount saveGitAccount(String username, String email, String remark, Integer userId, Integer tenantId) { - // 参数校验 - if (StrUtil.isBlank(username)) { - throw new RuntimeException("用户名不能为空"); - } - - // 去除空格 - username = username.trim(); - - // 检查用户名是否已被其他用户绑定(同一租户下) - AppGitAccount occupied = baseMapper.checkUsernameOccupied(username, userId, tenantId); - if (occupied != null) { - throw new RuntimeException("该用户名已被其他用户绑定"); - } - - // 查询当前用户的绑定记录(同一租户下) - AppGitAccount existing = baseMapper.selectByUserIdAndTenantId(userId, tenantId); - - LocalDateTime now = LocalDateTime.now(); - - if (existing != null) { - // 更新现有记录 - existing.setUsername(username); - if (StrUtil.isNotBlank(email)) { - existing.setEmail(email.trim()); - } else { - existing.setEmail(null); - } - if (StrUtil.isNotBlank(remark)) { - existing.setRemark(remark.trim()); - } else { - existing.setRemark(null); - } - // 重新提交审核,状态变更为 pending - existing.setStatus("pending"); - existing.setVerificationNote(null); - existing.setUpdateTime(now); - baseMapper.updateById(existing); - log.info("用户{}更新Git账号绑定信息: {}", userId, username); - return existing; - } else { - // 新增记录 - AppGitAccount account = new AppGitAccount(); - account.setUserId(userId); - account.setTenantId(tenantId); - account.setUsername(username); - if (StrUtil.isNotBlank(email)) { - account.setEmail(email.trim()); - } - if (StrUtil.isNotBlank(remark)) { - account.setRemark(remark.trim()); - } - account.setStatus("pending"); - account.setCreateTime(now); - account.setUpdateTime(now); - account.setDeleted(0); - baseMapper.insert(account); - log.info("用户{}新增Git账号绑定信息: {}", userId, username); - return account; - } - } - - @Override - public AppGitAccount getGitAccountStatus(Integer userId, Integer tenantId) { - // 使用 userId + tenantId 查询,确保数据隔离 - AppGitAccount account = baseMapper.selectByUserIdAndTenantId(userId, tenantId); - if (account == null) { - // 未绑定状态 - AppGitAccount notBound = new AppGitAccount(); - notBound.setStatus("not_bound"); - return notBound; - } - return account; - } - - @Override - public Map pageGitAccounts(String status, String keyword, int page, int size) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppGitAccount::getDeleted, 0); - - if (StrUtil.isNotBlank(status)) { - wrapper.eq(AppGitAccount::getStatus, status); - } - if (StrUtil.isNotBlank(keyword)) { - wrapper.and(w -> w - .like(AppGitAccount::getUsername, keyword) - .or() - .like(AppGitAccount::getEmail, keyword) - .or() - .like(AppGitAccount::getRemark, keyword) - ); - } - - wrapper.orderByDesc(AppGitAccount::getUpdateTime); - - Page pageResult = baseMapper.selectPage(new Page<>(page, size), wrapper); - - Map result = new HashMap<>(); - result.put("records", pageResult.getRecords()); - result.put("total", pageResult.getTotal()); - result.put("current", pageResult.getCurrent()); - result.put("size", pageResult.getSize()); - return result; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean approveAccount(Long id, Integer reviewerId, String reviewerName, String note) { - AppGitAccount account = baseMapper.selectById(id); - if (account == null) { - throw new RuntimeException("Git账号绑定记录不存在"); - } - if (!"pending".equals(account.getStatus())) { - throw new RuntimeException("该记录不在待审核状态,无法操作"); - } - - account.setStatus("verified"); - account.setVerificationNote(note); - account.setUpdateTime(LocalDateTime.now()); - baseMapper.updateById(account); - log.info("管理员{}审核通过Git账号绑定: userId={}, username={}", reviewerId, account.getUserId(), account.getUsername()); - return true; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean rejectAccount(Long id, Integer reviewerId, String reviewerName, String reason) { - if (StrUtil.isBlank(reason)) { - throw new RuntimeException("拒绝原因不能为空"); - } - - AppGitAccount account = baseMapper.selectById(id); - if (account == null) { - throw new RuntimeException("Git账号绑定记录不存在"); - } - if (!"pending".equals(account.getStatus())) { - throw new RuntimeException("该记录不在待审核状态,无法操作"); - } - - account.setStatus("rejected"); - account.setVerificationNote(reason.trim()); - account.setUpdateTime(LocalDateTime.now()); - baseMapper.updateById(account); - log.info("管理员{}拒绝Git账号绑定: userId={}, username={}, reason={}", reviewerId, account.getUserId(), account.getUsername(), reason); - return true; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppInviteServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppInviteServiceImpl.java deleted file mode 100644 index 5a88655..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppInviteServiceImpl.java +++ /dev/null @@ -1,343 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.lang.UUID; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.app.entity.AppInviteToken; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.mapper.AppInviteTokenMapper; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.mapper.AppUserMapper; -import com.gxwebsoft.app.service.AppInviteService; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.common.core.exception.BusinessException; -import com.gxwebsoft.common.core.utils.WxMiniprogramUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.Map; - -/** - * 应用成员邀请 Service 实现 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class AppInviteServiceImpl implements AppInviteService { - - private final AppInviteTokenMapper appInviteTokenMapper; - private final AppProductMapper appProductMapper; - private final AppUserMapper appUserMapper; - private final AppUserCacheService appUserCacheService; - - @Value("${app.invite.base-url:https://websopy.websoft.top}") - private String baseUrl; - - @Override - public Map generateQrCodeInvite(Integer appId, String role, Integer inviterId) { - // 检查权限 - checkInvitePermission(appId.longValue(), inviterId); - - // 生成token - String token = generateToken(); - - // 保存邀请记录(24小时有效) - AppInviteToken inviteToken = new AppInviteToken(); - inviteToken.setToken(token); - inviteToken.setAppId(appId); - inviteToken.setRole(role); - inviteToken.setInviterId(inviterId); - inviteToken.setExpireTime(LocalDateTime.now().plusHours(24)); - inviteToken.setCreateTime(LocalDateTime.now()); - inviteToken.setStatus(0); - appInviteTokenMapper.insert(inviteToken); - - // 生成邀请链接 - String inviteUrl = baseUrl + "/invite/accept?token=" + token + "&appId=" + appId + "&role=" + role; - - // 小程序码跳转页面(邀请成员专用) - // 注意:分包页面的完整路径需要包含分包根目录 - String miniprogramPage = "passport/invite/index"; - log.info("生成小程序码,appId={}, page={}, token={}", appId, miniprogramPage, token); - - // 检查页面路径是否在小程序 app.config.ts 中注册 - // subpackages[0].pages 中包含 "invite/index",路径为 passport/invite/index - - // 生成小程序码(通过微信工具类生成) - String miniprogramQrCode = WxMiniprogramUtil.generateMiniprogramQrCode( - token, - miniprogramPage, - 280, - "release" - ); - log.info("小程序码生成结果: {}", StrUtil.isNotBlank(miniprogramQrCode) ? "成功" : "失败"); - - Map result = new HashMap<>(); - result.put("token", token); - result.put("inviteUrl", inviteUrl); - // 返回小程序码(优先使用) - if (cn.hutool.core.util.StrUtil.isNotBlank(miniprogramQrCode)) { - result.put("miniprogramQrCode", miniprogramQrCode); - } - return result; - } - - @Override - public Map generateLinkInvite(Integer appId, String role, Integer inviterId) { - // 检查权限 - checkInvitePermission(appId.longValue(), inviterId); - - // 生成token - String token = generateToken(); - - // 保存邀请记录(7天有效) - AppInviteToken inviteToken = new AppInviteToken(); - inviteToken.setToken(token); - inviteToken.setAppId(appId); - inviteToken.setRole(role); - inviteToken.setInviterId(inviterId); - inviteToken.setExpireTime(LocalDateTime.now().plusDays(7)); - inviteToken.setCreateTime(LocalDateTime.now()); - inviteToken.setStatus(0); - appInviteTokenMapper.insert(inviteToken); - - // 生成邀请链接 - String inviteUrl = baseUrl + "/invite/accept?token=" + token + "&appId=" + appId + "&role=" + role; - - Map result = new HashMap<>(); - result.put("token", token); - result.put("inviteUrl", inviteUrl); - return result; - } - - @Override - public Map verifyInvite(String token, Integer appId) { - // 查询邀请记录 - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - throw new BusinessException("邀请不存在或已失效"); - } - - // 验证应用ID - if (!inviteToken.getAppId().equals(appId)) { - throw new BusinessException("邀请与应用不匹配"); - } - - // 检查是否过期 - if (inviteToken.getExpireTime().isBefore(LocalDateTime.now())) { - throw new BusinessException("邀请已过期"); - } - - // 检查是否已使用 - if (inviteToken.getStatus() != 0) { - throw new BusinessException("邀请已被使用"); - } - - // 获取应用信息 - AppProduct app = appProductMapper.selectById(appId); - if (app == null) { - throw new BusinessException("应用不存在"); - } - - // 获取邀请人信息 - AppUserCache inviter = appUserCacheService.getByUserId(inviteToken.getInviterId()); - - Map result = new HashMap<>(); - result.put("appId", appId); - result.put("appName", app.getProductName()); - result.put("appIcon", app.getIcon()); - result.put("inviterName", inviter != null ? inviter.getNickname() : "未知"); - result.put("role", inviteToken.getRole()); - result.put("expireTime", inviteToken.getExpireTime().toString()); - return result; - } - - /** - * 通过 token 获取邀请信息(小程序专用,不需要 appId) - */ - public Map getInviteInfoByToken(String token) { - // 查询邀请记录 - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - throw new BusinessException("邀请不存在或已失效"); - } - - // 检查是否过期 - if (inviteToken.getExpireTime().isBefore(LocalDateTime.now())) { - throw new BusinessException("邀请已过期"); - } - - // 检查是否已使用 - if (inviteToken.getStatus() != 0) { - throw new BusinessException("邀请已被使用"); - } - - // 获取应用信息 - AppProduct app = appProductMapper.selectById(inviteToken.getAppId()); - if (app == null) { - throw new BusinessException("应用不存在"); - } - - // 获取邀请人信息 - AppUserCache inviter = appUserCacheService.getByUserId(inviteToken.getInviterId()); - - // 获取角色名称 - String roleName = getRoleName(inviteToken.getRole()); - - Map result = new HashMap<>(); - result.put("token", token); - result.put("appId", inviteToken.getAppId()); - result.put("appName", app.getProductName()); - result.put("appLogo", app.getIcon()); - result.put("inviterName", inviter != null ? inviter.getNickname() : "某位用户"); - result.put("roleName", roleName); - result.put("role", inviteToken.getRole()); - result.put("expireTime", inviteToken.getExpireTime().toString()); - return result; - } - - /** - * 获取角色名称 - */ - private String getRoleName(String role) { - if (StrUtil.isBlank(role)) return "成员"; - switch (role) { - case "owner": return "所有者"; - case "admin": return "管理员"; - case "developer": return "开发者"; - default: return "成员"; - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void acceptInvite(String token, Integer appId, Integer userId) { - // 验证邀请 - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - throw new BusinessException("邀请不存在或已失效"); - } - - if (!inviteToken.getAppId().equals(appId)) { - throw new BusinessException("邀请与应用不匹配"); - } - - if (inviteToken.getExpireTime().isBefore(LocalDateTime.now())) { - throw new BusinessException("邀请已过期"); - } - - if (inviteToken.getStatus() != 0) { - throw new BusinessException("邀请已被使用"); - } - - // 检查是否已经是成员 - AppUser existUser = appUserMapper.selectOne(new LambdaQueryWrapper() - .eq(AppUser::getAppId, appId.longValue()) - .eq(AppUser::getUserId, userId)); - if (existUser != null) { - throw new BusinessException("你已经是该应用的成员"); - } - - // 获取用户信息(从缓存获取,如果不存在则刷新缓存) - AppUserCache userCache = appUserCacheService.getByUserId(userId); - if (userCache == null) { - // 如果缓存不存在,刷新缓存 - userCache = appUserCacheService.refreshUserCache(userId); - } - - // 添加成员 - AppUser appUser = new AppUser(); - appUser.setAppId(appId.longValue()); - appUser.setUserId(userId); - appUser.setRole(inviteToken.getRole()); - appUser.setStatus(0); // 正常状态 - appUser.setCreateTime(LocalDateTime.now()); - appUser.setInviteBy(inviteToken.getInviterId().longValue()); - appUser.setInviteTime(LocalDateTime.now()); - - // 冗余存储用户信息 - if (userCache != null) { - appUser.setUsername(userCache.getUsername()); - appUser.setNickname(userCache.getNickname()); - appUser.setAvatar(userCache.getAvatar()); - appUser.setPhone(userCache.getPhone()); - } - - appUserMapper.insert(appUser); - - // 标记邀请为已使用 - inviteToken.setStatus(1); - inviteToken.setAcceptUserId(userId); - inviteToken.setAcceptTime(LocalDateTime.now()); - appInviteTokenMapper.updateById(inviteToken); - - log.info("用户 {} 通过邀请加入应用 {}", userId, appId); - } - - /** - * 检查邀请权限 - */ - private void checkInvitePermission(Long appId, Integer userId) { - // 检查用户是否是应用成员且有权限邀请 - AppUser appUser = appUserMapper.selectOne(new LambdaQueryWrapper() - .eq(AppUser::getAppId, appId) - .eq(AppUser::getUserId, userId)); - if (appUser == null) { - throw new BusinessException("你不是该应用的成员"); - } - // owner 和 admin 可以邀请 - if (!"owner".equals(appUser.getRole()) && !"admin".equals(appUser.getRole())) { - throw new BusinessException("你没有权限邀请成员"); - } - } - - /** - * 生成唯一token(16位,兼容小程序scene参数长度限制) - */ - private String generateToken() { - // 使用16位随机字符串,确保在小程序scene参数长度限制内(32字符) - return cn.hutool.core.util.RandomUtil.randomString(16); - } - - /** - * 获取小程序码页面配置(已废弃,直接返回固定值) - */ - private String getMiniprogramPageFromSetting() { - return "passport/invite/index"; - } - - @Override - public Map getInviteStatus(String token) { - Map result = new HashMap<>(); - - // 查询邀请记录 - AppInviteToken inviteToken = appInviteTokenMapper.selectByToken(token); - if (inviteToken == null) { - result.put("status", -1); // 不存在 - result.put("message", "邀请不存在"); - return result; - } - - result.put("status", inviteToken.getStatus()); // 0: 未使用, 1: 已使用 - - // 如果已使用,返回使用信息 - if (inviteToken.getStatus() == 1 && inviteToken.getAcceptUserId() != null) { - result.put("usedAt", inviteToken.getAcceptTime() != null ? inviteToken.getAcceptTime().toString() : null); - - // 获取使用者信息 - AppUserCache userCache = appUserCacheService.getByUserId(inviteToken.getAcceptUserId()); - if (userCache != null) { - result.put("usedBy", userCache.getNickname()); - } - } - - return result; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppNotificationServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppNotificationServiceImpl.java deleted file mode 100644 index 5f419f7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppNotificationServiceImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppNotification; -import com.gxwebsoft.app.mapper.AppNotificationMapper; -import com.gxwebsoft.app.param.AppNotificationParam; -import com.gxwebsoft.app.service.AppNotificationService; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.*; - -/** - * 站内消息通知 Service 实现 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Service -public class AppNotificationServiceImpl extends ServiceImpl implements AppNotificationService { - - /** 支持的通知类型 */ - private static final List VALID_TYPES = Arrays.asList( - "ticket", "review", "system", "resource", "permission", "member", "payment" - ); - - // ─── 分页查询 ──────────────────────────────────────────────── - - @Override - public PageResult pageByUser(AppNotificationParam param, Integer userId) { - long pageNum = param.getPage() != null ? param.getPage() : 1; - long pageSize = param.getLimit() != null ? param.getLimit() : 15; - Page page = new Page<>(pageNum, pageSize); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppNotification::getUserId, userId) - .eq(StrUtil.isNotBlank(param.getType()), AppNotification::getType, param.getType()) - .eq(ObjectUtil.isNotNull(param.getIsRead()), AppNotification::getIsRead, param.getIsRead()) - .orderByDesc(AppNotification::getCreateTime); - - baseMapper.selectPage(page, wrapper); - return new PageResult<>(page.getRecords(), page.getTotal()); - } - - // ─── 最近通知 ──────────────────────────────────────────────── - - @Override - public List listRecent(Integer userId, String type, int limit) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppNotification::getUserId, userId) - .eq(StrUtil.isNotBlank(type), AppNotification::getType, type) - .orderByDesc(AppNotification::getCreateTime) - .last("LIMIT " + Math.min(limit, 50)); - - return baseMapper.selectList(wrapper); - } - - // ─── 未读统计 ──────────────────────────────────────────────── - - @Override - public Map getUnreadCount(Integer userId) { - LambdaQueryWrapper base = new LambdaQueryWrapper() - .eq(AppNotification::getUserId, userId) - .eq(AppNotification::getIsRead, 0); - - Map result = new HashMap<>(); - - // 总未读数 - result.put("total", (long) count(base.clone())); - - // 各类型未读数 - for (String type : VALID_TYPES) { - result.put(type, (long) count(base.clone().eq(AppNotification::getType, type))); - } - - return result; - } - - // ─── 标记已读 ──────────────────────────────────────────────── - - @Override - public void markRead(Long id, Integer userId) { - update(new LambdaUpdateWrapper() - .eq(AppNotification::getId, id) - .eq(AppNotification::getUserId, userId) - .set(AppNotification::getIsRead, 1) - .set(AppNotification::getUpdateTime, LocalDateTime.now())); - } - - @Override - public void markAllRead(Integer userId, String type) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() - .eq(AppNotification::getUserId, userId) - .eq(AppNotification::getIsRead, 0) - .eq(StrUtil.isNotBlank(type), AppNotification::getType, type) - .set(AppNotification::getIsRead, 1) - .set(AppNotification::getUpdateTime, LocalDateTime.now()); - - update(wrapper); - } - - // ─── 删除通知 ──────────────────────────────────────────────── - - @Override - public void removeNotification(Long id, Integer userId) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() - .eq(AppNotification::getId, id) - .eq(AppNotification::getUserId, userId); - remove(wrapper); - } - - @Override - public void clearRead(Integer userId, String type) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppNotification::getUserId, userId) - .eq(AppNotification::getIsRead, 1) - .eq(StrUtil.isNotBlank(type), AppNotification::getType, type); - - remove(wrapper); - } - - // ─── 发送通知 ──────────────────────────────────────────────── - - @Override - @Async - public void send(Integer userId, String type, String title, String content, - Long refId, String refType, String linkUrl, - Integer senderId, String senderName, String senderAvatar) { - if (userId == null || StrUtil.isBlank(title)) { - log.warn("[通知发送] 参数不完整: userId={}, title={}", userId, title); - return; - } - - // 校验类型 - if (StrUtil.isNotBlank(type) && !VALID_TYPES.contains(type)) { - type = "system"; - } - - AppNotification notification = new AppNotification(); - notification.setUserId(userId); - notification.setType(StrUtil.isNotBlank(type) ? type : "system"); - notification.setTitle(title); - notification.setContent(content); - notification.setIsRead(0); - notification.setRefId(refId); - notification.setRefType(refType); - notification.setLinkUrl(linkUrl); - notification.setSenderId(senderId != null ? senderId : 0); - notification.setSenderName(senderName); - notification.setSenderAvatar(senderAvatar); - notification.setCreateTime(LocalDateTime.now()); - notification.setUpdateTime(LocalDateTime.now()); - - try { - save(notification); - log.debug("[通知发送] userId={}, type={}, title={}", userId, type, title); - } catch (Exception e) { - log.error("[通知发送] 发送失败: userId={}, title={}", userId, title, e); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppPermissionRequestServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppPermissionRequestServiceImpl.java deleted file mode 100644 index 467be1f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppPermissionRequestServiceImpl.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppPermissionRequest; -import com.gxwebsoft.app.mapper.AppPermissionRequestMapper; -import com.gxwebsoft.app.param.AppPermissionRequestParam; -import com.gxwebsoft.app.service.AppPermissionRequestService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 权限申请Service实现 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Service -public class AppPermissionRequestServiceImpl extends ServiceImpl - implements AppPermissionRequestService { - - @Override - public IPage pageRel(AppPermissionRequestParam param) { - Page page = new Page<>(param.getPage(), param.getLimit()); - LambdaQueryWrapper wrapper = buildQueryWrapper(param); - return this.page(page, wrapper); - } - - @Override - public List listRel(AppPermissionRequestParam param) { - LambdaQueryWrapper wrapper = buildQueryWrapper(param); - return this.list(wrapper); - } - - @Override - public AppPermissionRequest getByIdRel(Long id) { - return this.getById(id); - } - - @Override - public Map getPermissionRequestStats(Integer userId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppPermissionRequest::getUserId, userId); - - List allList = this.list(wrapper); - long pending = allList.stream().filter(r -> "pending".equals(r.getStatus())).count(); - long approved = allList.stream().filter(r -> "approved".equals(r.getStatus())).count(); - long rejected = allList.stream().filter(r -> "rejected".equals(r.getStatus())).count(); - - Map stats = new HashMap<>(); - stats.put("total", allList.size()); - stats.put("pending", pending); - stats.put("approved", approved); - stats.put("rejected", rejected); - return stats; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public AppPermissionRequest createPermissionRequest(Integer userId, String gitUsername, String repo, String repoName, String reason, Integer tenantId) { - // 检查是否已有待审核的申请 - LambdaQueryWrapper checkWrapper = new LambdaQueryWrapper<>(); - checkWrapper.eq(AppPermissionRequest::getUserId, userId); - checkWrapper.eq(AppPermissionRequest::getRepo, repo); - checkWrapper.eq(AppPermissionRequest::getStatus, "pending"); - AppPermissionRequest existing = this.getOne(checkWrapper); - - if (existing != null) { - throw new RuntimeException("该仓库已存在待审核的申请"); - } - - // 检查是否已通过审核 - List accessibleRepos = baseMapper.getAccessibleRepos(userId); - if (accessibleRepos != null && accessibleRepos.contains(repo)) { - throw new RuntimeException("你已拥有该仓库的访问权限"); - } - - AppPermissionRequest request = new AppPermissionRequest(); - request.setUserId(userId); - request.setGitUsername(gitUsername); - request.setRepo(repo); - request.setRepoName(repoName); - request.setReason(reason); - request.setStatus("pending"); - request.setTenantId(tenantId); - request.setCreateTime(LocalDateTime.now()); - request.setUpdateTime(LocalDateTime.now()); - - this.save(request); - return request; - } - - @Override - public List> getAvailableRepositories(Integer userId) { - return baseMapper.getAllReposWithAccessStatus(userId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean approveRequest(Long requestId, Integer reviewerId, String reviewerName, String note) { - AppPermissionRequest request = this.getById(requestId); - if (request == null) { - throw new RuntimeException("申请记录不存在"); - } - if (!"pending".equals(request.getStatus())) { - throw new RuntimeException("该申请已被处理"); - } - - request.setStatus("approved"); - request.setReviewerId(reviewerId); - request.setReviewerName(reviewerName); - request.setReviewedAt(LocalDateTime.now()); - request.setUpdateTime(LocalDateTime.now()); - - return this.updateById(request); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean rejectRequest(Long requestId, Integer reviewerId, String reviewerName, String reason) { - AppPermissionRequest request = this.getById(requestId); - if (request == null) { - throw new RuntimeException("申请记录不存在"); - } - if (!"pending".equals(request.getStatus())) { - throw new RuntimeException("该申请已被处理"); - } - - request.setStatus("rejected"); - request.setReviewerId(reviewerId); - request.setReviewerName(reviewerName); - request.setRejectReason(reason); - request.setReviewedAt(LocalDateTime.now()); - request.setUpdateTime(LocalDateTime.now()); - - return this.updateById(request); - } - - /** - * 构建查询条件 - */ - private LambdaQueryWrapper buildQueryWrapper(AppPermissionRequestParam param) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (param.getUserId() != null) { - wrapper.eq(AppPermissionRequest::getUserId, param.getUserId()); - } - if (param.getStatus() != null && !param.getStatus().isEmpty()) { - wrapper.eq(AppPermissionRequest::getStatus, param.getStatus()); - } - if (param.getGitUsername() != null && !param.getGitUsername().isEmpty()) { - wrapper.like(AppPermissionRequest::getGitUsername, param.getGitUsername()); - } - if (param.getRepo() != null && !param.getRepo().isEmpty()) { - wrapper.like(AppPermissionRequest::getRepo, param.getRepo()); - } - wrapper.orderByDesc(AppPermissionRequest::getCreateTime); - return wrapper; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppPipelineServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppPipelineServiceImpl.java deleted file mode 100644 index 64a578a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppPipelineServiceImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppPipeline; -import com.gxwebsoft.app.mapper.AppPipelineMapper; -import com.gxwebsoft.app.param.AppPipelineParam; -import com.gxwebsoft.app.service.AppPipelineService; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * CI/CD 流水线 Service 实现 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Service -public class AppPipelineServiceImpl extends ServiceImpl - implements AppPipelineService { - - @Override - public PageResult pagePipeline(AppPipelineParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPipelineList(param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public AppPipeline getPipelineDetail(Long id) { - return baseMapper.selectPipelineDetail(id); - } - - @Override - public List getByAppId(Long appId) { - return baseMapper.selectByAppId(appId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean createPipeline(AppPipeline pipeline) { - // 设置默认值 - if (pipeline.getEnabled() == null) { - pipeline.setEnabled(true); - } - if (pipeline.getAutoDeploy() == null) { - pipeline.setAutoDeploy(false); - } - if (pipeline.getTimeout() == null) { - pipeline.setTimeout(3600); // 默认1小时 - } - if (pipeline.getDefaultBranch() == null) { - pipeline.setDefaultBranch("main"); - } - - pipeline.setSuccessCount(0); - pipeline.setFailureCount(0); - pipeline.setCreateTime(LocalDateTime.now()); - pipeline.setUpdateTime(LocalDateTime.now()); - - return save(pipeline); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean updatePipeline(AppPipeline pipeline) { - pipeline.setUpdateTime(LocalDateTime.now()); - return updateById(pipeline); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean deletePipeline(Long id) { - return removeById(id); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean togglePipeline(Long id, boolean enabled) { - AppPipeline pipeline = getById(id); - if (pipeline == null) { - throw new RuntimeException("流水线不存在"); - } - - pipeline.setEnabled(enabled); - pipeline.setUpdateTime(LocalDateTime.now()); - return updateById(pipeline); - } - - @Override - public String getPipelineStatus(Long id) { - AppPipeline pipeline = getById(id); - if (pipeline == null) { - return "unknown"; - } - - // 如果有最近构建,直接返回构建状态 - if (pipeline.getLastBuildStatus() != null) { - return pipeline.getLastBuildStatus(); - } - - // 否则返回启用状态 - return pipeline.getEnabled() ? "active" : "disabled"; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppProductServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppProductServiceImpl.java deleted file mode 100644 index 872ec85..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppProductServiceImpl.java +++ /dev/null @@ -1,326 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.mapper.AppUserMapper; -import com.gxwebsoft.app.service.AppProductService; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.RandomUtil; -import cn.hutool.json.JSONUtil; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -/** - * 应用产品 服务实现 - * - * @author 科技小王子 - */ -@Service -public class AppProductServiceImpl extends ServiceImpl implements AppProductService { - - private final com.gxwebsoft.app.mapper.AppUserMapper appUserMapper; - - public AppProductServiceImpl(com.gxwebsoft.app.mapper.AppUserMapper appUserMapper) { - this.appUserMapper = appUserMapper; - } - - @Override - public IPage selectPageList(Page page, AppProduct product, Integer userId) { - return baseMapper.selectPageList(page, product, userId); - } - - @Override - public AppProduct getDetail(Integer productId) { - return baseMapper.selectById(productId); - } - - @Override - public AppProduct getByCode(String code) { - return baseMapper.selectByCode(code); - } - - @Override - public List getByUserId(Integer userId) { - return baseMapper.selectByUserId(userId); - } - - @Override - public IPage getMyApps(Page page, Integer userId) { - return baseMapper.selectPageByUserId(page, userId); - } - - @Override - public IPage getJoinedApps(Page page, Integer userId) { - return baseMapper.selectPageJoinedApps(page, userId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean create(AppProduct product) { - // 生成唯一标识 - if (product.getProductCode() == null || product.getProductCode().isEmpty()) { - product.setProductCode(generateCode()); - } - // 生成密钥 - if (product.getProductSecret() == null || product.getProductSecret().isEmpty()) { - product.setProductSecret(generateSecret()); - } - // 设置默认值 - if (product.getPublishStatus() == null) { - product.setPublishStatus(AppProduct.PUBLISH_DEVELOPING); - } - if (product.getStatus() == null) { - product.setStatus(0); // 未开通 - } - if (product.getDeleted() == null) { - product.setDeleted(0); - } - if (product.getSortNumber() == null) { - product.setSortNumber(0); - } - // 设置用户和租户信息 - Integer userId = getLoginUserId(); - Integer tenantId = getLoginTenantId(); - if (userId != null) { - product.setUserId(userId); - } - if (tenantId != null) { - product.setTenantId(tenantId); - } - - // 保存应用 - boolean saved = this.save(product); - if (saved && product.getProductId() != null && userId != null) { - // 获取当前登录用户信息 - com.gxwebsoft.common.system.entity.User loginUser = getLoginUser(); - - // 自动将创建者加入 app_user 表 - AppUser appUser = new AppUser(); - appUser.setAppId(product.getProductId().longValue()); - appUser.setUserId(userId); - appUser.setRole("owner"); // 创建者是 owner - appUser.setTenantId(tenantId); - appUser.setInviteBy(0L); // 系统创建,无邀请人 - appUser.setInviteTime(LocalDateTime.now()); - appUser.setStatus(0); - appUser.setSortNumber(0); - appUser.setCreateTime(LocalDateTime.now()); - - // 冗余存储用户信息,方便查询展示 - if (loginUser != null) { - appUser.setUsername(loginUser.getUsername()); - appUser.setNickname(loginUser.getNickname()); - appUser.setAvatar(loginUser.getAvatar()); - // 手机号脱敏存储(只存后4位或隐藏) - String phone = loginUser.getPhone(); - if (phone != null && !phone.isEmpty()) { - // 脱敏:保留后4位,其余用 * 代替 - if (phone.length() > 4) { - appUser.setPhone("****" + phone.substring(phone.length() - 4)); - } else { - appUser.setPhone(phone); - } - } - } - - appUserMapper.insert(appUser); - } - return saved; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean update(AppProduct product) { - return this.updateById(product); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean delete(Integer productId) { - return this.removeById(productId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean submitReview(Integer productId) { - return baseMapper.updatePublishStatus(productId, AppProduct.PUBLISH_PENDING_REVIEW) > 0; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean approve(Integer productId) { - return baseMapper.updatePublishStatus(productId, AppProduct.PUBLISH_PUBLISHED) > 0; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean reject(Integer productId, String reason) { - AppProduct product = new AppProduct(); - product.setProductId(productId); - product.setPublishStatus(AppProduct.PUBLISH_REJECTED); - product.setRejectReason(reason); - product.setReviewerId(getLoginUserId()); - return this.updateById(product); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean publish(Integer productId) { - return baseMapper.updatePublishStatus(productId, AppProduct.PUBLISH_PUBLISHED) > 0; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean unpublish(Integer productId) { - return baseMapper.updatePublishStatus(productId, AppProduct.PUBLISH_DEPRECATED) > 0; - } - - @Override - public void incrementClicks(Integer productId) { - baseMapper.incrementClicks(productId); - } - - @Override - public void incrementInstalls(Integer productId) { - baseMapper.incrementInstalls(productId); - } - - @Override - public void incrementDownloads(Integer productId) { - baseMapper.incrementDownloads(productId); - } - - @Override - public void incrementLikes(Integer productId) { - baseMapper.incrementLikes(productId); - } - - @Override - public String regenerateSecret(Integer productId) { - String newSecret = generateSecret(); - AppProduct product = new AppProduct(); - product.setProductId(productId); - product.setProductSecret(newSecret); - this.updateById(product); - return newSecret; - } - - @Override - public IPage getMarketList(Page page, Integer appType, String keyword) { - AppProduct product = new AppProduct(); - product.setMarket(1); // 上架市场 - product.setPublishStatus(AppProduct.PUBLISH_PUBLISHED); - product.setAppType(appType); - if (keyword != null && !keyword.isEmpty()) { - product.setProductName(keyword); - } - return baseMapper.selectPageList(page, product, null); - } - - @Override - public AppProduct getConfigField(Integer tenantId, String code) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppProduct::getTenantId, tenantId); - wrapper.eq(AppProduct::getAppType, AppProduct.APP_TYPE_WEBSITE); - AppProduct product = this.getOne(wrapper); - - if (product != null && product.getConfig() != null && !product.getConfig().isEmpty()) { - // 解析 config JSON,查找对应字段 - try { - Map configMap = JSONUtil.toBean(product.getConfig(), Map.class); - if (configMap.containsKey(code)) { - // 创建一个只包含配置值的 AppProduct 用于返回 - AppProduct result = new AppProduct(); - result.setConfig(product.getConfig()); - // 可以根据 code 返回不同的值,这里返回整个 product - return result; - } - } catch (Exception e) { - // 解析失败,返回原数据 - } - } - return product; - } - - /** - * 生成应用标识 - */ - private String generateCode() { - return "APP" + IdUtil.getSnowflakeNextId(); - } - - /** - * 生成应用密钥 - */ - private String generateSecret() { - return RandomUtil.randomString(32); - } - - @Override - public List> getStatsByUserIds(List userIds) { - if (userIds == null || userIds.isEmpty()) { - return List.of(); - } - List rawList = baseMapper.selectStatsByUserIds(userIds); - // 将 List 转换为 List> - return rawList.stream() - .map(map -> (Map) map) - .toList(); - } - - @Override - public List getAccessibleApps(Integer userId) { - if (userId == null) { - return List.of(); - } - return baseMapper.selectAccessibleApps(userId); - } - - /** - * 获取登录用户 - */ - private com.gxwebsoft.common.system.entity.User getLoginUser() { - try { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication != null && authentication.getPrincipal() instanceof com.gxwebsoft.common.system.entity.User) { - return (com.gxwebsoft.common.system.entity.User) authentication.getPrincipal(); - } - } catch (Exception e) { - // 忽略异常 - } - return null; - } - - /** - * 获取登录用户ID - */ - private Integer getLoginUserId() { - com.gxwebsoft.common.system.entity.User user = getLoginUser(); - return user != null ? user.getUserId() : null; - } - - /** - * 获取登录租户ID - */ - private Integer getLoginTenantId() { - try { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication != null && authentication.getPrincipal() instanceof com.gxwebsoft.common.system.entity.User) { - return ((com.gxwebsoft.common.system.entity.User) authentication.getPrincipal()).getTenantId(); - } - } catch (Exception e) { - // 忽略异常 - } - return null; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppResourceServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppResourceServiceImpl.java deleted file mode 100644 index 64c1155..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppResourceServiceImpl.java +++ /dev/null @@ -1,1100 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppResource; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.entity.ResourceAccessLevel; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.mapper.AppResourceMapper; -import com.gxwebsoft.app.mapper.AppUserMapper; -import com.gxwebsoft.app.param.AppResourceParam; -import com.gxwebsoft.app.service.AppCloudCredentialService; -import com.gxwebsoft.app.service.AppResourceService; -import com.gxwebsoft.app.service.DatabaseOperatorFactory; -import com.gxwebsoft.app.service.DatabaseOperatorService; -import com.gxwebsoft.app.service.cloud.CloudStorageProvider; -import com.gxwebsoft.app.service.cloud.CloudStorageProviderFactory; -import com.gxwebsoft.common.core.utils.DbPasswordUtil; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.dao.DuplicateKeyException; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.net.Inet6Address; -import java.net.InetAddress; -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; - -/** - * 开发者资源 Service 实现 - * - * @author 科技小王子 - * @since 2026-03-31 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class AppResourceServiceImpl extends ServiceImpl - implements AppResourceService { - - private final DatabaseOperatorFactory databaseOperatorFactory; - private final AppCloudCredentialService cloudCredentialService; - private final AppUserMapper appUserMapper; - private final AppProductMapper appProductMapper; - - private static final Pattern IPV4_PATTERN = Pattern.compile( - "^(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}$" - ); - - @Override - public PageResult pageRel(AppResourceParam param, Integer currentUserId) { - // 填充用户有权限的应用ID列表(创建的 + 参与的),用于资源协作权限过滤 - fillUserAppIds(param, currentUserId); - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - if (currentUserId != null) { - enrichWithPermission(list, currentUserId); - } else { - // 兼容旧调用,直接解密 - decryptPasswordList(list); - } - // 补充数据库连接端口 - enrichPort(list); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(AppResourceParam param, Integer currentUserId) { - // 填充用户有权限的应用ID列表 - fillUserAppIds(param, currentUserId); - List list = baseMapper.selectListRel(param); - if (currentUserId != null) { - enrichWithPermission(list, currentUserId); - } else { - // 兼容旧调用,直接解密 - decryptPasswordList(list); - } - // 补充数据库连接端口 - enrichPort(list); - return list; - } - - @Override - public AppResource getByIdRel(Long resourceId, Integer currentUserId) { - AppResourceParam param = new AppResourceParam(); - param.setResourceId(resourceId); - List list = baseMapper.selectListRel(param); - AppResource result = list.isEmpty() ? null : list.get(0); - if (currentUserId != null) { - enrichWithPermission(List.of(result), currentUserId); - } else { - // 兼容旧调用,直接解密 - decryptPassword(result); - } - return result; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public AppResource addResource(AppResource resource, Integer userId) { - resource.setUserId(userId); - // 自动设置 ownerUserId(权限控制基准) - resource.setOwnerUserId(userId.longValue()); - - validateServerResource(resource, null); - resource.setDeleted(0); - resource.setCreateTime(LocalDateTime.now()); - resource.setUpdateTime(LocalDateTime.now()); - // 默认状态 - if (resource.getStatus() == null) { - resource.setStatus("running"); - } - // 加密数据库密码 - encryptDbPassword(resource); - // 加密管理员密码 - encryptAdminPassword(resource); - // 加密 SSH 密码 - encryptSshPassword(resource); - // 如果是云存储类型,同步调用云厂商 API 创建存储桶,成功后再入库 - if ("storage".equals(resource.getResourceType())) { - // 先获取凭证 - Map credentials; - if (resource.getCredentialId() != null) { - credentials = cloudCredentialService.getCredentialsByCredentialId(resource.getCredentialId()); - if (credentials == null || credentials.isEmpty()) { - throw new RuntimeException("云账号凭证无效"); - } - } else { - credentials = cloudCredentialService.getCredentials(resource.getProvider(), userId); - if (credentials == null || credentials.isEmpty()) { - throw new RuntimeException("请先配置云账号凭证"); - } - } - - log.info("同步创建云存储桶: provider={}, bucket={}, region={}", - resource.getProvider(), resource.getName(), resource.getRegion()); - - // 同步调用云厂商 API 创建存储桶(失败则抛异常,不入库) - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(resource.getProvider()); - try { - cloudProvider.createBucket(resource, credentials); - // 创建成功,获取 endpoint - String endpoint = cloudProvider.getBucketEndpoint(resource, credentials); - resource.setRemark("访问地址: " + endpoint); - } catch (Exception e) { - log.error("创建云存储桶失败: {}", e.getMessage()); - throw new RuntimeException("创建云存储桶失败: " + e.getMessage()); - } - } - - // 保存资源到数据库 - try { - save(resource); - } catch (DuplicateKeyException e) { - throw new RuntimeException(getDuplicateErrorMessage(resource)); - } - - return resource; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public AppResource updateResource(AppResource resource, Integer currentUserId) { - if (resource.getResourceId() == null) { - throw new RuntimeException("资源ID不能为空"); - } - AppResource current = getById(resource.getResourceId()); - if (current == null || Integer.valueOf(1).equals(current.getDeleted())) { - throw new RuntimeException("资源不存在"); - } - - // 权限校验:只有资源创建者(ownerUserId)可以修改 - // 注意:ownerUserId 是 Long 类型,currentUserId 是 Integer 类型,需要类型转换后比较 - Long ownerUserId = current.getOwnerUserId(); - Integer ownerUserIdInt = ownerUserId != null ? ownerUserId.intValue() : null; - if (currentUserId != null && !currentUserId.equals(ownerUserIdInt)) { - throw new RuntimeException("只有资源创建者才能修改资源"); - } - - // 更新时保持 ownerUserId 不变(防止篡改归属) - resource.setOwnerUserId(current.getOwnerUserId()); - - validateServerResource(resource, current); - resource.setUpdateTime(LocalDateTime.now()); - // 加密数据库密码(如果有更新) - encryptDbPassword(resource); - // 加密管理员密码(如果有更新) - encryptAdminPassword(resource); - // 加密 SSH 密码(如果有更新) - encryptSshPassword(resource); - try { - // ACL 变更时同步到云端 - if ("storage".equals(current.getResourceType()) && resource.getAcl() != null - && !resource.getAcl().equals(current.getAcl())) { - syncBucketAcl(current, resource); - } - updateById(resource); - } catch (DuplicateKeyException e) { - throw new RuntimeException(getDuplicateErrorMessage(resource)); - } - // getByIdRel 内部会根据 currentUserId 注入权限字段 - return getByIdRel(resource.getResourceId(), currentUserId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void removeResource(Long resourceId, Integer userId) { - AppResource resource = getById(resourceId); - if (resource == null) { - throw new RuntimeException("资源不存在"); - } - // 权限校验:只有资源创建者(ownerUserId)可以删除(用户ID兼容旧调用) - if (!resource.getOwnerUserId().equals(userId.longValue())) { - throw new RuntimeException("只有资源创建者才能删除资源"); - } - - // 如果是存储桶类型,尝试远程删除 - if ("storage".equals(resource.getResourceType())) { - try { - deleteRemoteStorage(resource, userId); - } catch (Exception e) { - log.error("远程删除存储桶失败, resourceId={}, error={}", resourceId, e.getMessage()); - throw new RuntimeException("远程删除存储桶失败: " + e.getMessage()); - } - } - - // 如果是数据库类型且有关联的服务器,尝试远程删除 - if ("database".equals(resource.getResourceType()) && resource.getServerResourceId() != null) { - String dbType = resource.getDbType(); - if ("MySQL".equals(dbType) || "PostgreSQL".equals(dbType)) { - try { - dropRemoteDatabase(resource); - } catch (Exception e) { - log.error("远程删除数据库失败, resourceId={}, error={}", resourceId, e.getMessage()); - throw new RuntimeException("远程删除数据库失败: " + e.getMessage()); - } - } - } - - resource.setDeleted(1); - resource.setUpdateTime(LocalDateTime.now()); - updateById(resource); - log.info("删除资源成功, resourceId={}, ownerUserId={}", resourceId, resource.getOwnerUserId()); - } - - /** - * 删除远程数据库 - */ - private void dropRemoteDatabase(AppResource dbResource) { - // 获取关联的服务器信息 - AppResource server = getById(dbResource.getServerResourceId()); - if (server == null) { - log.warn("关联的服务器不存在, serverResourceId={}", dbResource.getServerResourceId()); - return; - } - if (server.getAdminUsername() == null || server.getAdminPassword() == null) { - log.warn("服务器未配置管理员凭据,跳过远程删除, serverResourceId={}", server.getResourceId()); - return; - } - - // 从关联的服务器获取端口 - String dbType = dbResource.getDbType(); - Integer port; - if ("PostgreSQL".equals(dbType)) { - port = server.getPgPort() != null ? server.getPgPort() : 5432; - } else { - // MySQL 及其他 - port = server.getMysqlPort() != null ? server.getMysqlPort() : 3306; - } - - // 解密管理员密码 - String adminPassword = DbPasswordUtil.decrypt(server.getAdminPassword()); - - log.info("开始远程删除数据库: type={}, db={}, server={}:{}", dbType, dbResource.getName(), server.getIp(), port); - - // 调用远程删除 - DatabaseOperatorService operator = databaseOperatorFactory.getOperator(dbType); - DatabaseOperatorService.DatabaseOperationResult result = operator.dropDatabaseAndUser( - server.getIp(), port, - server.getAdminUsername(), adminPassword, - dbResource.getName(), dbResource.getDbUsername() - ); - - if (!result.isSuccess()) { - throw new RuntimeException(result.getMessage()); - } - log.info("远程删除数据库成功, dbName={}", dbResource.getName()); - } - - @Override - public Map countByType(Integer userId, Integer tenantId) { - // 获取用户有权限的应用ID列表(创建的 + 参与的) - List userAppIds = getUserAppIds(userId); - - // 使用包含协作资源的统计方法 - List> raw = baseMapper.countByTypeForUser(userId, tenantId, userAppIds); - Map result = new HashMap<>(); - // 初始化所有类型为 0 - for (String type : new String[]{"server", "database", "storage", "domain", "ssl", "git"}) { - result.put(type, 0L); - } - for (Map row : raw) { - String type = (String) row.get("resourceType"); - Long cnt = ((Number) row.get("cnt")).longValue(); - result.put(type, cnt); - } - return result; - } - - /** - * 获取用户有权限的应用ID列表(包括 owner + 参与的所有应用) - * 通过 app_user 表查参与的应用,通过 app_product 表查创建的应用 - */ - private List getUserAppIds(Integer userId) { - if (userId == null) { - return List.of(); - } - // 1. 参与的应用(通过 app_user 关联) - List joinedAppIds = appUserMapper.selectList(new LambdaQueryWrapper() - .select(AppUser::getAppId) - .eq(AppUser::getUserId, userId) - .in(AppUser::getStatus, 0, 1)) - .stream() - .map(AppUser::getAppId) - .toList(); - - // 2. 创建的应用(通过 app_product 查 user_id) - List ownedAppIds = appProductMapper.selectList( - new LambdaQueryWrapper() - .select(com.gxwebsoft.app.entity.AppProduct::getProductId) - .eq(com.gxwebsoft.app.entity.AppProduct::getUserId, userId) - .eq(com.gxwebsoft.app.entity.AppProduct::getDeleted, 0)) - .stream() - .map(com.gxwebsoft.app.entity.AppProduct::getProductId) - .map(Long::valueOf) - .toList(); - - // 3. 合并去重 - return java.util.stream.Stream.concat(joinedAppIds.stream(), ownedAppIds.stream()) - .distinct() - .collect(java.util.stream.Collectors.toList()); - } - - /** - * 填充用户有权限的应用ID列表到查询参数中 - * 使 SQL 条件生效:owner_user_id = 当前用户 OR app_id IN (用户有权限的应用) - */ - private void fillUserAppIds(AppResourceParam param, Integer currentUserId) { - if (currentUserId != null && param.getUserAppIds() == null) { - param.setUserAppIds(getUserAppIds(currentUserId)); - } - } - - private void validateServerResource(AppResource resource, AppResource current) { - String resourceType = normalizeText(resource.getResourceType()); - if (resourceType == null && current != null) { - resourceType = normalizeText(current.getResourceType()); - } - if (resourceType == null) { - return; - } - resource.setResourceType(resourceType); - - Integer userId = current != null ? current.getUserId() : resource.getUserId(); - Integer tenantId = current != null ? current.getTenantId() : resource.getTenantId(); - Long excludeResourceId = current != null ? current.getResourceId() : null; - - if ("server".equals(resourceType)) { - validateAndEnsureServerUnique(resource, current, userId, tenantId, excludeResourceId); - } else if ("database".equals(resourceType)) { - validateAndEnsureDatabaseUnique(resource, current, userId, tenantId, excludeResourceId); - } - } - - private void validateAndEnsureServerUnique(AppResource resource, AppResource current, - Integer userId, Integer tenantId, Long excludeResourceId) { - String ip = normalizeText(resource.getIp()); - if (ip == null && current != null) { - ip = normalizeText(current.getIp()); - } - if (ip == null) { - throw new RuntimeException("服务器 IP 地址不能为空"); - } - if (!isValidIpAddress(ip)) { - throw new RuntimeException("IP 地址格式不正确"); - } - - long count = lambdaQuery() - .eq(AppResource::getDeleted, 0) - .eq(AppResource::getResourceType, "server") - .eq(AppResource::getIp, ip) - .eq(userId != null, AppResource::getUserId, userId) - .eq(tenantId != null, AppResource::getTenantId, tenantId) - .ne(excludeResourceId != null, AppResource::getResourceId, excludeResourceId) - .count(); - if (count > 0) { - throw new RuntimeException("该 IP 已存在,请勿重复添加"); - } - resource.setIp(ip); - } - - private void validateAndEnsureDatabaseUnique(AppResource resource, AppResource current, - Integer userId, Integer tenantId, Long excludeResourceId) { - String name = normalizeText(resource.getName()); - String host = normalizeText(resource.getHost()); - String dbType = normalizeText(resource.getDbType()); - - // 从当前记录补全缺失字段 - if (current != null) { - if (name == null) name = normalizeText(current.getName()); - if (host == null) host = normalizeText(current.getHost()); - if (dbType == null) dbType = normalizeText(current.getDbType()); - } - - if (name == null || host == null || dbType == null) { - return; // 必填校验在 controller 或前端处理 - } - - // 检查同一用户下 name + host + dbType 是否重复 - long count = lambdaQuery() - .eq(AppResource::getDeleted, 0) - .eq(AppResource::getResourceType, "database") - .eq(AppResource::getName, name) - .eq(AppResource::getHost, host) - .eq(AppResource::getDbType, dbType) - .eq(userId != null, AppResource::getUserId, userId) - .eq(tenantId != null, AppResource::getTenantId, tenantId) - .ne(excludeResourceId != null, AppResource::getResourceId, excludeResourceId) - .count(); - if (count > 0) { - throw new RuntimeException("该数据库配置已存在(名称、地址、类型相同),请勿重复添加"); - } - - resource.setName(name); - resource.setHost(host); - resource.setDbType(dbType); - } - - - - private boolean isValidIpAddress(String ip) { - if (IPV4_PATTERN.matcher(ip).matches()) { - return true; - } - if (!ip.contains(":")) { - return false; - } - try { - return InetAddress.getByName(ip) instanceof Inet6Address; - } catch (Exception e) { - return false; - } - } - - private String normalizeText(String value) { - if (value == null) { - return null; - } - String normalized = value.trim(); - return normalized.isEmpty() ? null : normalized; - } - - /** - * 获取重复数据的友好错误提示 - */ - private String getDuplicateErrorMessage(AppResource resource) { - String type = normalizeText(resource.getResourceType()); - if ("database".equals(type)) { - return "该数据库配置已存在(名称、地址、类型相同),请勿重复添加"; - } - if ("server".equals(type)) { - return "该服务器 IP 已存在,请勿重复添加"; - } - return "该资源已存在,请勿重复添加"; - } - - /** - * 加密数据库密码 - */ - private void encryptDbPassword(AppResource resource) { - if (resource.getDbPassword() != null && !resource.getDbPassword().isEmpty()) { - resource.setDbPassword(DbPasswordUtil.encrypt(resource.getDbPassword())); - } - } - - /** - * 解密数据库密码 - */ - private void decryptDbPassword(AppResource resource) { - if (resource != null && resource.getDbPassword() != null && !resource.getDbPassword().isEmpty()) { - resource.setDbPassword(DbPasswordUtil.decrypt(resource.getDbPassword())); - } - } - - /** - * 统一解密所有密码字段(数据库密码 + 管理员密码 + SSH密码) - */ - private void decryptPassword(AppResource resource) { - decryptDbPassword(resource); - decryptAdminPassword(resource); - decryptSshPassword(resource); - } - - /** - * 批量解密密码(用于列表查询,同时解密业务密码和管理员密码) - */ - private void decryptPasswordList(List list) { - if (list != null) { - for (AppResource resource : list) { - decryptPassword(resource); - } - } - } - - /** - * 加密管理员密码 - */ - private void encryptAdminPassword(AppResource resource) { - if (resource.getAdminPassword() != null && !resource.getAdminPassword().isEmpty()) { - resource.setAdminPassword(DbPasswordUtil.encrypt(resource.getAdminPassword())); - } - } - - /** - * 解密管理员密码 - */ - private void decryptAdminPassword(AppResource resource) { - if (resource != null && resource.getAdminPassword() != null && !resource.getAdminPassword().isEmpty()) { - resource.setAdminPassword(DbPasswordUtil.decrypt(resource.getAdminPassword())); - } - } - - /** - * 加密 SSH 密码 - */ - private void encryptSshPassword(AppResource resource) { - if (resource.getSshPassword() != null && !resource.getSshPassword().isEmpty()) { - resource.setSshPassword(DbPasswordUtil.encrypt(resource.getSshPassword())); - } - } - - /** - * 解密 SSH 密码 - */ - private void decryptSshPassword(AppResource resource) { - if (resource != null && resource.getSshPassword() != null && !resource.getSshPassword().isEmpty()) { - resource.setSshPassword(DbPasswordUtil.decrypt(resource.getSshPassword())); - } - } - - // ─── 协作权限核心逻辑 ────────────────────────────────────────────── - - @Override - public void enrichWithPermission(List resources, Integer currentUserId) { - if (resources == null || resources.isEmpty() || currentUserId == null) { - return; - } - - for (AppResource resource : resources) { - // 计算访问级别 - ResourceAccessLevel accessLevel = calculateAccessLevel(currentUserId, resource); - resource.setAccessLevel(accessLevel.getValue()); - resource.setIsOwner(accessLevel == ResourceAccessLevel.FULL); - - // 根据权限屏蔽敏感字段 - maskSensitiveFieldsByAccessLevel(resource, accessLevel); - } - } - - /** - * 计算当前用户对指定资源的访问级别 - */ - private ResourceAccessLevel calculateAccessLevel(Integer userId, AppResource resource) { - // Owner 拥有完全权限 - if (userId.equals(resource.getOwnerUserId())) { - return ResourceAccessLevel.FULL; - } - - // 查询用户是否是应用成员 - if (resource.getAppId() == null) { - // 无应用关联的资源,只有 Owner 能访问 - return ResourceAccessLevel.NONE; - } - - AppUser appMember = appUserMapper.selectOne(new LambdaQueryWrapper() - .eq(AppUser::getAppId, resource.getAppId()) - .eq(AppUser::getUserId, userId) - .in(AppUser::getStatus, 0, 1)); // 状态正常或冻结 - - if (appMember == null) { - return ResourceAccessLevel.NONE; - } - - // 根据角色决定访问级别 - // developer 及以上角色(owner/admin/developer)可查看连接信息(用户名、端口、1Panel、SSH) - String role = appMember.getRole(); - if ("owner".equals(role) || "admin".equals(role) || "developer".equals(role)) { - return ResourceAccessLevel.VIEW_CONNECTION; - } - - // viewer 只允许基础查看(名称/IP/端口/状态) - return ResourceAccessLevel.VIEW_BASIC; - } - - /** - * 根据访问级别屏蔽敏感字段 - */ - private void maskSensitiveFieldsByAccessLevel(AppResource resource, ResourceAccessLevel level) { - // FULL 级别(Owner)可看所有字段,不解密密码(保持前端加密状态) - if (level.atLeast(ResourceAccessLevel.FULL)) { - // Owner 能看到真实密码,但仍需要在返回前解密(因为前端需要明文) - decryptPassword(resource); - return; - } - - // VIEW_CONNECTION 级别(owner/admin/developer 角色)可看用户名、数据库密码、SSL 证书,其他密码遮罩 - if (level.atLeast(ResourceAccessLevel.VIEW_CONNECTION)) { - // 数据库密码解密返回(developer 需要连接数据库) - decryptDbPassword(resource); - // SSH 密码和管理员密码遮罩为 "******" - if (resource.getSshPassword() != null && !resource.getSshPassword().isEmpty()) { - resource.setSshPassword("******"); - } - if (resource.getAdminPassword() != null && !resource.getAdminPassword().isEmpty()) { - resource.setAdminPassword("******"); - } - // SSL 证书:developer 可查看私钥和证书内容(部署证书需要) - // privateKey、certificate、certChain 保持原值不清空 - } else { - // VIEW_BASIC 级别(基础查看)只能看名称/IP/端口/状态 - resource.setSshUsername(null); - resource.setSshPassword(null); - resource.setAdminUsername(null); - resource.setAdminPassword(null); - resource.setDbUsername(null); - resource.setDbPassword(null); - resource.setPrivateKey(null); - resource.setPublicKey(null); - resource.setCertificate(null); - resource.setCertChain(null); - } - } - - /** - * 将密码字段替换为 "******" 占位符 - */ - private void maskPasswordFields(AppResource resource) { - if (resource.getSshPassword() != null && !resource.getSshPassword().isEmpty()) { - resource.setSshPassword("******"); - } - if (resource.getAdminPassword() != null && !resource.getAdminPassword().isEmpty()) { - resource.setAdminPassword("******"); - } - if (resource.getDbPassword() != null && !resource.getDbPassword().isEmpty()) { - resource.setDbPassword("******"); - } - } - - /** - * 检查输入是否非空 - */ - private boolean hasContent(String str) { - return str != null && !str.trim().isEmpty(); - } - - /** - * 异步创建数据库 - * 在事务提交后执行,通过 resourceId 查询关联的服务器资源获取管理员凭据 - */ - @Async - public void asyncCreateDatabase(Long resourceId) { - try { - // 延迟 500ms 确保事务已提交 - Thread.sleep(500); - - // 查询数据库资源记录 - AppResource dbResource = getById(resourceId); - if (dbResource == null) { - log.warn("异步建库失败: 资源不存在, resourceId={}", resourceId); - return; - } - - // 查询关联的服务器资源 - AppResource server = getById(dbResource.getServerResourceId()); - if (server == null) { - log.warn("异步建库失败: 关联服务器不存在, serverResourceId={}", dbResource.getServerResourceId()); - updateStatus(resourceId, "failed", "关联服务器资源不存在"); - return; - } - - // 解密管理员密码 - String adminPwd = ""; - if (server.getAdminPassword() != null && !server.getAdminPassword().isEmpty()) { - adminPwd = DbPasswordUtil.decrypt(server.getAdminPassword()); - } - // 解密业务数据库密码 - String dbPass = ""; - if (dbResource.getDbPassword() != null && !dbResource.getDbPassword().isEmpty()) { - dbPass = DbPasswordUtil.decrypt(dbResource.getDbPassword()); - } - - // 根据数据库类型获取对应的端口 - String dbType = dbResource.getDbType(); - int serverPort; - if ("PostgreSQL".equals(dbType)) { - serverPort = server.getPgPort() != null ? server.getPgPort() : 5432; - } else { - // MySQL 及其他,默认 3306 - serverPort = server.getMysqlPort() != null ? server.getMysqlPort() : 3306; - } - - log.info("开始异步创建数据库: type={}, db={}, server={}:{}, adminUser={}", - dbType, dbResource.getName(), server.getIp(), serverPort, server.getAdminUsername()); - - // 更新状态为创建中 - updateStatus(resourceId, "pending", "正在创建" + dbType + "数据库..."); - - // 通过工厂获取对应数据库类型的操作服务 - DatabaseOperatorService operator = databaseOperatorFactory.getOperator(dbType); - - // 执行远程建库 - DatabaseOperatorService.DatabaseOperationResult result = operator.createDatabaseAndGrant( - server.getIp(), - serverPort, - server.getAdminUsername(), - adminPwd, - dbResource.getName(), - dbResource.getDbUsername(), - dbPass - ); - - if (result.isSuccess()) { - updateStatus(resourceId, "running", result.getMessage()); - log.info("异步创建数据库成功: type={}, db={}, resourceId={}", dbType, dbResource.getName(), resourceId); - } else { - updateStatus(resourceId, "failed", result.getMessage()); - log.error("异步创建数据库失败: type={}, db={}, resourceId={}, error={}", - dbType, dbResource.getName(), resourceId, result.getDetail()); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - log.error("异步创建数据库被中断: resourceId={}", resourceId); - } catch (Exception e) { - log.error("异步创建数据库异常: resourceId={}, error={}", resourceId, e.getMessage(), e); - updateStatus(resourceId, "failed", "创建数据库异常: " + e.getMessage()); - } - } - - /** - * 更新资源状态和备注 - */ - private void updateStatus(Long resourceId, String status, String remark) { - AppResource update = new AppResource(); - update.setResourceId(resourceId); - update.setStatus(status); - update.setRemark(remark); - update.setUpdateTime(LocalDateTime.now()); - baseMapper.updateById(update); - } - - /** - * 同步存储桶 ACL 到云端 - */ - private void syncBucketAcl(AppResource oldResource, AppResource newResource) { - String provider = oldResource.getProvider(); - if (provider == null) { - log.warn("同步 ACL 失败: 服务商未指定, resourceId={}", oldResource.getResourceId()); - return; - } - - // 获取云账号凭证 - Map credentials; - if (oldResource.getCredentialId() != null) { - credentials = cloudCredentialService.getCredentialsByCredentialId(oldResource.getCredentialId()); - } else { - credentials = cloudCredentialService.getCredentials(provider, oldResource.getOwnerUserId().intValue()); - } - - if (credentials == null || credentials.isEmpty()) { - log.warn("同步 ACL 失败: 云账号凭证不存在, resourceId={}", oldResource.getResourceId()); - return; - } - - try { - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(provider); - cloudProvider.setBucketAcl(oldResource, newResource.getAcl(), credentials); - log.info("存储桶 ACL 已同步: bucket={}, acl={}", oldResource.getName(), newResource.getAcl()); - } catch (Exception e) { - log.error("同步 ACL 失败: resourceId={}, error={}", oldResource.getResourceId(), e.getMessage(), e); - } - } - - /** - * 删除远程云存储桶 - */ - private void deleteRemoteStorage(AppResource resource, Integer userId) { - String provider = resource.getProvider(); - if (provider == null) { - throw new RuntimeException("服务商未指定"); - } - - // 获取云账号凭证 - Map credentials; - if (resource.getCredentialId() != null) { - credentials = cloudCredentialService.getCredentialsByCredentialId(resource.getCredentialId()); - } else { - credentials = cloudCredentialService.getCredentials(provider, userId); - } - - if (credentials == null || credentials.isEmpty()) { - throw new RuntimeException("云账号凭证不存在"); - } - - // 根据 region 构建 endpoint - String region = resource.getRegion(); - if (region != null && !region.isEmpty()) { - String endpoint = buildEndpoint(provider, region); - if (endpoint != null) { - credentials.put("endpoint", endpoint); - } - } - - try { - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(provider); - cloudProvider.deleteBucket(resource, credentials); - log.info("远程存储桶已删除: bucket={}, provider={}", resource.getName(), provider); - } catch (Exception e) { - throw new RuntimeException("远程删除存储桶失败: " + e.getMessage()); - } - } - - /** - * 根据服务商和 region 构建 endpoint - */ - private String buildEndpoint(String provider, String region) { - if (region == null || region.isEmpty()) { - return null; - } - - switch (provider) { - case "aliyun": - // 阿里云 OSS: https://{region}.aliyuncs.com - if (region.startsWith("oss-")) { - return "https://" + region + ".aliyuncs.com"; - } else { - return "https://oss-" + region + ".aliyuncs.com"; - } - case "tencent": - // 腾讯云 COS: https://cos.{region}.myqcloud.com - return "https://cos." + region + ".myqcloud.com"; - case "huawei": - // 华为云 OBS: https://obs.{region}.myhuaweicloud.com - return "https://obs." + region + ".myhuaweicloud.com"; - case "qiniu": - // 七牛云 Kodo: 使用区域对应的 endpoint - return "https://" + region + ".qiniuds.com"; - default: - return null; - } - } - - /** - * 根据服务器 IP 和端口查找服务器资源(用于测试连接等) - */ - public AppResource getServerByHostAndPort(String host, Integer port, Integer userId, Integer tenantId) { - return lambdaQuery() - .eq(AppResource::getDeleted, 0) - .eq(AppResource::getResourceType, "server") - .eq(AppResource::getIp, host) - .eq(port != null, AppResource::getSshPort, port) - .eq(userId != null, AppResource::getUserId, userId) - .eq(tenantId != null, AppResource::getTenantId, tenantId) - .last("LIMIT 1") - .one(); - } - - /** - * 异步创建云存储桶 - * 在事务提交后执行,调用云厂商 API 创建存储桶 - */ - @Async - public void asyncCreateStorageBucket(Long resourceId, Integer userId) { - try { - Thread.sleep(500); - - // 查询存储资源记录 - AppResource storage = getById(resourceId); - if (storage == null) { - log.warn("异步创建存储桶失败: 资源不存在, resourceId={}", resourceId); - return; - } - - String provider = storage.getProvider(); - if (provider == null || provider.isEmpty()) { - updateStatus(resourceId, "failed", "服务商未指定"); - return; - } - - // 获取云账号凭证:优先从 credentialId 获取,否则从用户默认凭证获取 - Map credentials; - if (storage.getCredentialId() != null) { - credentials = cloudCredentialService.getCredentialsByCredentialId(storage.getCredentialId()); - if (credentials == null || credentials.isEmpty()) { - updateStatus(resourceId, "failed", "云账号凭证无效"); - log.warn("credentialId {} 对应的凭证不存在", storage.getCredentialId()); - return; - } - } else { - // 兼容旧数据:从用户默认凭证获取 - credentials = cloudCredentialService.getCredentials(provider, userId); - if (credentials == null || credentials.isEmpty()) { - updateStatus(resourceId, "failed", "请先配置云账号凭证"); - log.warn("用户 {} 未配置 {} 云账号凭证", userId, provider); - return; - } - } - - log.info("开始异步创建云存储桶: provider={}, bucket={}, region={}", - provider, storage.getName(), storage.getRegion()); - - // 更新状态为创建中 - updateStatus(resourceId, "pending", "正在创建存储桶..."); - - // 调用云厂商 API 创建存储桶 - CloudStorageProvider cloudProvider = CloudStorageProviderFactory.getProvider(provider); - cloudProvider.createBucket(storage, credentials); - - // 获取存储桶访问地址 - String endpoint = cloudProvider.getBucketEndpoint(storage, credentials); - - // 更新状态和 endpoint - AppResource update = new AppResource(); - update.setResourceId(resourceId); - update.setStatus("running"); - update.setRemark("存储桶创建成功,访问地址: " + endpoint); - update.setUpdateTime(LocalDateTime.now()); - baseMapper.updateById(update); - - log.info("异步创建云存储桶成功: bucket={}, resourceId={}", storage.getName(), resourceId); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - log.error("异步创建存储桶被中断: resourceId={}", resourceId); - } catch (Exception e) { - log.error("异步创建存储桶异常: resourceId={}, error={}", resourceId, e.getMessage(), e); - updateStatus(resourceId, "failed", "创建存储桶异常: " + e.getMessage()); - } - } - - @Override - public String resetDatabasePassword(Long resourceId, Integer currentUserId) { - if (resourceId == null) { - throw new RuntimeException("资源ID不能为空"); - } - AppResource resource = getById(resourceId); - if (resource == null || Integer.valueOf(1).equals(resource.getDeleted())) { - throw new RuntimeException("资源不存在"); - } - // 权限校验:只有资源创建者可以操作 - Long ownerUserId = resource.getOwnerUserId(); - Integer ownerUserIdInt = ownerUserId != null ? ownerUserId.intValue() : null; - if (currentUserId != null && !currentUserId.equals(ownerUserIdInt)) { - throw new RuntimeException("只有资源创建者才能重置密码"); - } - if (!"database".equals(resource.getResourceType())) { - throw new RuntimeException("只有数据库资源才能重置密码"); - } - - // 生成新密码(12位,包含大小写字母、数字、特殊字符) - String newPassword = generateRandomPassword(); - - // 如果关联了服务器且支持远程操作,则远程更新数据库密码 - if (resource.getServerResourceId() != null && resource.getDbType() != null - && databaseOperatorFactory.isSupported(resource.getDbType())) { - try { - AppResource server = getById(resource.getServerResourceId()); - if (server != null) { - // 获取管理员凭据 - String adminPwd = ""; - if (server.getAdminPassword() != null && !server.getAdminPassword().isEmpty()) { - adminPwd = DbPasswordUtil.decrypt(server.getAdminPassword()); - } - // 获取当前数据库密码(解密) - String currentDbPwd = ""; - if (resource.getDbPassword() != null && !resource.getDbPassword().isEmpty()) { - currentDbPwd = DbPasswordUtil.decrypt(resource.getDbPassword()); - } - // 获取端口 - int serverPort; - if ("PostgreSQL".equals(resource.getDbType())) { - serverPort = server.getPgPort() != null ? server.getPgPort() : 5432; - } else { - serverPort = server.getMysqlPort() != null ? server.getMysqlPort() : 3306; - } - // 远程更新密码 - DatabaseOperatorService operator = databaseOperatorFactory.getOperator(resource.getDbType()); - DatabaseOperatorService.DatabaseOperationResult result = operator.changePassword( - server.getIp(), - serverPort, - server.getAdminUsername(), - adminPwd, - resource.getDbUsername(), - currentDbPwd, - newPassword - ); - if (!result.isSuccess()) { - log.warn("远程重置数据库密码失败: resourceId={}, error={}", resourceId, result.getMessage()); - // 远程失败时,依然更新本地记录,让用户可以在远程手动处理 - } else { - log.info("远程重置数据库密码成功: resourceId={}, db={}", resourceId, resource.getName()); - } - } - } catch (Exception e) { - log.error("远程重置数据库密码异常: resourceId={}, error={}", resourceId, e.getMessage()); - // 远程操作失败不影响本地密码更新 - } - } - - // 更新本地密码(加密存储) - AppResource update = new AppResource(); - update.setResourceId(resourceId); - update.setDbPassword(DbPasswordUtil.encrypt(newPassword)); - update.setUpdateTime(LocalDateTime.now()); - updateById(update); - - log.info("重置数据库密码成功: resourceId={}, dbName={}", resourceId, resource.getName()); - return newPassword; - } - - /** - * 生成随机密码(12位,包含大小写字母、数字、特殊字符) - */ - private String generateRandomPassword() { - String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; - StringBuilder password = new StringBuilder(); - java.util.Random random = new java.util.Random(); - for (int i = 0; i < 12; i++) { - password.append(chars.charAt(random.nextInt(chars.length()))); - } - return password.toString(); - } - - /** - * 补充数据库资源的连接端口(根据dbType从关联的服务器资源获取) - * 端口字段用于前端显示 - */ - private void enrichPort(List resources) { - if (resources == null || resources.isEmpty()) { - return; - } - for (AppResource resource : resources) { - enrichPort(resource); - } - } - - /** - * 补充单个数据库资源的连接端口 - */ - private void enrichPort(AppResource resource) { - // 只处理数据库类型 - if (!"database".equals(resource.getResourceType())) { - return; - } - // 如果已有端口,跳过 - if (resource.getPort() != null) { - return; - } - // 如果没有关联服务器,无法获取端口 - if (resource.getServerResourceId() == null) { - return; - } - // 查询关联的服务器资源 - AppResource server = getById(resource.getServerResourceId()); - if (server == null) { - return; - } - // 根据数据库类型获取对应端口 - String dbType = resource.getDbType(); - Integer port = null; - if ("PostgreSQL".equals(dbType)) { - port = server.getPgPort(); - } else if ("MySQL".equals(dbType)) { - port = server.getMysqlPort(); - } else if ("Redis".equals(dbType)) { - // Redis 默认 6379,如果有专门的 Redis 端口字段可以加 - port = 6379; - } else if ("MongoDB".equals(dbType)) { - // MongoDB 默认 27017 - port = 27017; - } - resource.setPort(port); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppSettingServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppSettingServiceImpl.java deleted file mode 100644 index 92d170d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppSettingServiceImpl.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppSetting; -import com.gxwebsoft.app.mapper.AppSettingMapper; -import com.gxwebsoft.app.param.AppSettingParam; -import com.gxwebsoft.app.service.AppSettingService; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.service.UserService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 平台设置表 Service 实现类 - * - * @author WebSoft - */ -@Slf4j -@Service -public class AppSettingServiceImpl extends ServiceImpl implements AppSettingService { - - @Resource - private UserService userService; - - /** - * 分页查询 - */ - @Override - public List page(AppSettingParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("category asc, sort_number asc, setting_id asc"); - IPage pageResult = baseMapper.selectPageRel(page, param); - return page.sortRecords(pageResult.getRecords()); - } - - /** - * 获取设置列表 - */ - @Override - public List list(AppSettingParam param) { - List list = baseMapper.selectListRel(param); - PageParam page = new PageParam<>(); - page.setDefaultOrder("category asc, sort_number asc, setting_id asc"); - return page.sortRecords(list); - } - - /** - * 根据分类获取所有设置 - * 注意:平台配置不按租户隔离 - */ - @Override - public List getByCategory(String category) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppSetting::getCategory, category); - wrapper.eq(AppSetting::getIsEnabled, 1); - wrapper.orderByAsc(AppSetting::getSortNumber); - return list(wrapper); - } - - /** - * 根据key获取设置值 - */ - @Override - public String getValue(String settingKey) { - AppSetting setting = getByKey(settingKey); - return setting != null ? setting.getSettingValue() : null; - } - - /** - * 根据key获取设置(完整对象) - * 注意:平台配置不按租户隔离 - */ - @Override - public AppSetting getByKey(String settingKey) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppSetting::getSettingKey, settingKey); - return getOne(wrapper); - } - - /** - * 获取分类下的所有设置(以Map返回,key为settingKey) - * 注意:平台配置不按租户隔离 - */ - @Override - public Map getCategoryValues(String category) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppSetting::getCategory, category); - wrapper.eq(AppSetting::getIsEnabled, 1); - wrapper.orderByAsc(AppSetting::getSortNumber); - List settings = list(wrapper); - - Map result = new HashMap<>(); - for (AppSetting setting : settings) { - result.put(setting.getSettingKey(), setting.getSettingValue()); - } - return result; - } - - /** - * 保存或更新设置 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveOrUpdateSetting(AppSetting setting) { - // 设置租户ID - Long tenantId = getCurrentTenantId(); - if (tenantId != null) { - setting.setTenantId(tenantId); - } - - // 检查是否存在 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppSetting::getSettingKey, setting.getSettingKey()); - if (tenantId != null) { - wrapper.eq(AppSetting::getTenantId, tenantId); - } else { - wrapper.isNull(AppSetting::getTenantId); - } - AppSetting existSetting = getOne(wrapper); - - if (existSetting != null) { - // 更新 - existSetting.setSettingValue(setting.getSettingValue()); - existSetting.setSettingName(setting.getSettingName()); - existSetting.setDescription(setting.getDescription()); - existSetting.setValueType(setting.getValueType()); - existSetting.setIsEnabled(setting.getIsEnabled()); - existSetting.setIsPublic(setting.getIsPublic()); - existSetting.setSortNumber(setting.getSortNumber()); - updateById(existSetting); - } else { - // 新增 - save(setting); - } - } - - /** - * 批量保存分类设置 - * 使用单一key存储整个分类的JSON值 - * 注意:平台配置不按租户隔离,统一存储 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void batchSave(String category, Map values) { - log.info("batchSave - category: {}, values: {}", category, JSON.toJSONString(values)); - - // 统一使用 category 作为 settingKey - String settingKey = "platform_" + category; - - // 平台配置不按租户隔离,统一存储 - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(AppSetting::getSettingKey, settingKey); - AppSetting existSetting = getOne(wrapper); - log.info("查询结果 - existSetting: {}", existSetting != null ? existSetting.getSettingId() : "null"); - - // 将 Map 转为 JSON 字符串存储 - String jsonValue = JSON.toJSONString(values); - - if (existSetting != null) { - log.info("执行更新 - settingId: {}, settingValue长度: {}", existSetting.getSettingId(), jsonValue.length()); - existSetting.setSettingValue(jsonValue); - boolean updated = updateById(existSetting); - log.info("更新设置 - settingKey: {}, updated: {}", settingKey, updated); - } else { - // 新增默认设置项 - AppSetting newSetting = new AppSetting(); - newSetting.setCategory(category); - newSetting.setSettingKey(settingKey); - newSetting.setSettingName(getCategoryName(category)); - newSetting.setSettingValue(jsonValue); - newSetting.setValueType("json"); - newSetting.setIsEnabled(1); - newSetting.setIsPublic(0); - newSetting.setSortNumber(getCategorySortNumber(category)); - // 平台配置不设置租户ID - boolean saved = save(newSetting); - log.info("新增设置 - settingKey: {}, saved: {}, jsonValue: {}", settingKey, saved, jsonValue); - } - } - - /** - * 获取分类名称 - */ - private String getCategoryName(String category) { - switch (category) { - case "basic": return "基础配置"; - case "review": return "审核配置"; - case "market": return "市场配置"; - case "register": return "注册登录配置"; - case "notify": return "通知配置"; - case "miniprogram": return "微信小程序配置"; - case "payment": return "支付配置"; - case "maintenance": return "系统维护"; - default: return category; - } - } - - /** - * 获取分类排序号 - */ - private Integer getCategorySortNumber(String category) { - switch (category) { - case "basic": return 1; - case "review": return 2; - case "market": return 3; - case "register": return 4; - case "notify": return 5; - case "miniprogram": return 6; - case "payment": return 7; - case "maintenance": return 8; - default: return 99; - } - } - - /** - * 获取当前登录用户的租户ID - */ - private Long getCurrentTenantId() { - try { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication != null && authentication.getPrincipal() instanceof User) { - User user = (User) authentication.getPrincipal(); - return user.getTenantId() != null ? Long.valueOf(user.getTenantId()) : null; - } - } catch (Exception e) { - log.error("获取当前用户租户ID失败", e); - } - return null; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppSubscriptionServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppSubscriptionServiceImpl.java deleted file mode 100644 index 1e93437..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppSubscriptionServiceImpl.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppSubscription; -import com.gxwebsoft.app.mapper.AppSubscriptionMapper; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.service.AppSubscriptionService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.concurrent.ThreadLocalRandom; - -/** - * 应用订阅 Service 实现 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class AppSubscriptionServiceImpl extends ServiceImpl - implements AppSubscriptionService { - - private final AppProductMapper productMapper; - - @Override - @Transactional(rollbackFor = Exception.class) - public AppSubscription createSubscription(Integer userId, Integer productId, String priceType, String period) { - // 1. 查询产品 - AppProduct product = productMapper.selectById(productId); - if (product == null || !"published".equals(product.getPublishStatus())) { - throw new RuntimeException("应用不存在或未上架"); - } - - // 2. 幂等检查:是否已有 active 订阅 - LambdaQueryWrapper existQuery = new LambdaQueryWrapper<>(); - existQuery.eq(AppSubscription::getUserId, userId) - .eq(AppSubscription::getProductId, productId) - .eq(AppSubscription::getStatus, "active"); - if (this.count(existQuery) > 0) { - throw new RuntimeException("您已订阅该应用,无需重复购买"); - } - - // 3. 计算价格(单位:元) - BigDecimal price = BigDecimal.ZERO; - if (!"free".equals(product.getPriceType()) && product.getPrice() != null) { - // 前端 price 字段存的是分,转为元 - price = product.getPrice().divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP); - if ("subscription".equals(priceType) && "year".equals(period)) { - price = price.multiply(BigDecimal.TEN); // 年付 10 个月 - } - } - - // 4. 创建记录 - AppSubscription sub = new AppSubscription(); - sub.setSubscriptionNo(generateSubscriptionNo()); - sub.setUserId(userId); - sub.setProductId(productId); - sub.setTenantId(product.getTenantId()); - sub.setStatus("pending"); - sub.setPriceType(product.getPriceType() != null ? product.getPriceType() : "free"); - sub.setOriginalPrice(price); - sub.setPayPrice(price); - sub.setPayStatus(0); - sub.setSubscriptionPeriod("subscription".equals(product.getPriceType()) ? period : null); - - // 5. 免费应用直接激活 - if (price.compareTo(BigDecimal.ZERO) == 0 || "free".equals(product.getPriceType())) { - activateImmediately(sub, product, period); - } - - this.save(sub); - return sub; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void activateSubscription(String subscriptionNo, String transactionId) { - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(AppSubscription::getSubscriptionNo, subscriptionNo); - AppSubscription sub = this.getOne(query); - if (sub == null) { - log.warn("激活订阅失败:订阅不存在, subscriptionNo={}", subscriptionNo); - return; - } - - if (sub.getPayStatus() != null && sub.getPayStatus() == 1) { - log.info("订阅已支付,跳过重复激活, subscriptionNo={}", subscriptionNo); - return; - } - - // 更新支付信息 - sub.setPayStatus(1); - sub.setPayTime(LocalDateTime.now()); - sub.setTransactionId(transactionId); - sub.setStatus("active"); - sub.setStartTime(LocalDateTime.now()); - - // 计算到期时间 - if ("subscription".equals(sub.getPriceType())) { - int months = "year".equals(sub.getSubscriptionPeriod()) ? 12 : 1; - sub.setExpireTime(LocalDateTime.now().plusMonths(months)); - } - - this.updateById(sub); - - // 更新产品安装量 - AppProduct product = productMapper.selectById(sub.getProductId()); - if (product != null) { - product.setInstalls((product.getInstalls() != null ? product.getInstalls() : 0) + 1); - productMapper.updateById(product); - } - - // TODO: 发送通知给用户 - log.info("订阅激活成功: subscriptionNo={}, userId={}, productId={}", - subscriptionNo, sub.getUserId(), sub.getProductId()); - } - - @Override - public boolean isPurchased(Integer userId, Integer productId) { - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(AppSubscription::getUserId, userId) - .eq(AppSubscription::getProductId, productId) - .in(AppSubscription::getStatus, "active", "pending"); - return this.count(query) > 0; - } - - /** - * 免费应用直接激活 - */ - private void activateImmediately(AppSubscription sub, AppProduct product, String period) { - sub.setStatus("active"); - sub.setPayStatus(1); - sub.setPayType(12); - sub.setPayTime(LocalDateTime.now()); - sub.setStartTime(LocalDateTime.now()); - - if ("subscription".equals(sub.getPriceType())) { - int months = "year".equals(period) ? 12 : 1; - sub.setExpireTime(LocalDateTime.now().plusMonths(months)); - } - - product.setInstalls((product.getInstalls() != null ? product.getInstalls() : 0) + 1); - productMapper.updateById(product); - } - - private String generateSubscriptionNo() { - String date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); - int random = ThreadLocalRandom.current().nextInt(1000, 9999); - return "SUB" + date + random; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppTicketServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppTicketServiceImpl.java deleted file mode 100644 index 447f195..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppTicketServiceImpl.java +++ /dev/null @@ -1,602 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.entity.AppTicket; -import com.gxwebsoft.app.entity.AppTicketReply; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.mapper.AppTicketMapper; -import com.gxwebsoft.app.mapper.AppTicketReplyMapper; -import com.gxwebsoft.app.param.AppTicketParam; -import com.gxwebsoft.app.service.AppProductService; -import com.gxwebsoft.app.service.AppTicketService; -import com.gxwebsoft.app.service.AppUserService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.service.UserService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 应用工单 Service 实现 - * - * @author 科技小王子 - * @since 2026-03-30 - */ -@Slf4j -@Service -public class AppTicketServiceImpl extends ServiceImpl implements AppTicketService { - - /** 企业微信群机器人 Webhook,留空则不发送 */ - @Value("${notify.wecom-webhook:}") - private String wecomWebhook; - - /** 飞书群机器人 Webhook,留空则不发送 */ - @Value("${notify.feishu-webhook:}") - private String feishuWebhook; - - @Resource - private AppTicketReplyMapper replyMapper; - - @Resource - private AppUserService appUserService; - - @Resource - private UserService userService; - - @Resource - private AppProductService appProductService; - - // ─── 生成工单编号(格式:TK-260406-00001) ───────────────────── - private String generateTicketNo() { - LocalDateTime now = LocalDateTime.now(); - String datePart = now.format(DateTimeFormatter.ofPattern("yyMMdd")); - // 查询当天最大序号 - String todayStart = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd 00:00:00")); - String todayEnd = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd 23:59:59")); - Integer maxSeq = baseMapper.selectMaxSeqForDate(datePart); - int seq = (maxSeq == null ? 0 : maxSeq) + 1; - return String.format("TK-%s-%04d", datePart, seq); - } - - // ─── 客户端:查自己的工单 ───────────────────────────────────── - @Override - public PageResult myPage(AppTicketParam param, Integer userId) { - // 用 PageParam 包装分页参数(getCurrent/getSize 来自父类 Page) - Page page = new Page<>(param.getCurrent(), param.getSize() > 0 ? param.getSize() : 15); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppTicket::getDeleted, 0) - .eq(AppTicket::getSubmitUserId, userId) - .eq(ObjectUtil.isNotNull(param.getAppId()), AppTicket::getAppId, param.getAppId()) - .eq(ObjectUtil.isNotEmpty(param.getStatus()), AppTicket::getStatus, param.getStatus()) - .eq(ObjectUtil.isNotEmpty(param.getCategory()), AppTicket::getCategory, param.getCategory()) - .and(ObjectUtil.isNotEmpty(param.getKeywords()), q -> - q.like(AppTicket::getTitle, param.getKeywords()) - .or().like(AppTicket::getTicketNo, param.getKeywords())) - // 状态优先级:pending > assigned > processing > resolved > closed;同状态内最新的排前 - .last("ORDER BY FIELD(status,'pending','assigned','processing','resolved','closed','rejected'), create_time DESC"); - - baseMapper.selectPage(page, wrapper); - return new PageResult<>(page.getRecords(), page.getTotal()); - } - - // ─── 技术端:查所有工单(按应用权限过滤) ─────────────────────── - @Override - public PageResult allPage(AppTicketParam param) { - Page page = new Page<>(param.getCurrent(), param.getSize() > 0 ? param.getSize() : 20); - - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppTicket::getDeleted, 0) - .in(param.getAppIds() != null && !param.getAppIds().isEmpty(), AppTicket::getAppId, param.getAppIds()) - .eq(ObjectUtil.isNotNull(param.getAppId()), AppTicket::getAppId, param.getAppId()) - .eq(ObjectUtil.isNotEmpty(param.getStatus()), AppTicket::getStatus, param.getStatus()) - .eq(ObjectUtil.isNotEmpty(param.getCategory()), AppTicket::getCategory, param.getCategory()) - .eq(ObjectUtil.isNotEmpty(param.getPriority()), AppTicket::getPriority, param.getPriority()) - .and(ObjectUtil.isNotNull(param.getAssigneeId()) && param.getAssigneeId() == 0, - q -> q.isNull(AppTicket::getAssigneeId)) - .eq(ObjectUtil.isNotNull(param.getAssigneeId()) && param.getAssigneeId() > 0, - AppTicket::getAssigneeId, param.getAssigneeId()) - .and(ObjectUtil.isNotEmpty(param.getKeywords()), q -> - q.like(AppTicket::getTitle, param.getKeywords()) - .or().like(AppTicket::getTicketNo, param.getKeywords())) - // 状态优先级 > 紧急程度 > 最新提交时间 - .last("ORDER BY FIELD(status,'pending','assigned','processing','resolved','closed','rejected'), FIELD(priority,'urgent','high','normal','low'), create_time DESC"); - - baseMapper.selectPage(page, wrapper); - return new PageResult<>(page.getRecords(), page.getTotal()); - } - - // ─── 提交工单(自动分配) ───────────────────────────────────── - @Override - @Transactional(rollbackFor = Exception.class) - public AppTicket submit(AppTicket ticket, Integer userId) { - // 补充提交人信息 - ticket.setSubmitUserId(userId); - ticket.setTicketNo(generateTicketNo()); - ticket.setStatus("pending"); - ticket.setReplyCount(0); - ticket.setDeleted(0); - ticket.setCreateTime(LocalDateTime.now()); - ticket.setUpdateTime(LocalDateTime.now()); - - // 从用户服务取昵称/头像冗余存储(@InterceptorIgnore 绕过租户拦截器跨库查询) - try { - User user = userService.getByIdIgnoreTenant(userId); - if (user != null) { - ticket.setSubmitUserName(user.getNickname() != null ? user.getNickname() : user.getUsername()); - ticket.setSubmitUserAvatar(user.getAvatar()); - } - } catch (Exception e) { - log.warn("获取提交人信息失败", e); - } - - // 自动分配:查找该应用的 admin/developer 成员,随机分配 - autoAssign(ticket); - - // 补充应用名称(冗余存储) - if (ticket.getAppId() != null && ticket.getAppName() == null) { - try { - AppProduct product = appProductService.getById(ticket.getAppId()); - if (product != null) { - ticket.setAppName(product.getProductName()); - } - } catch (Exception e) { - log.warn("获取应用名称失败", e); - } - } - - save(ticket); - - // 异步推送:新工单通知(通知分配到的技术人员) - sendTicketCreatedAsync(ticket); - - return ticket; - } - - /** 自动分配工单给应用的技术成员 */ - private void autoAssign(AppTicket ticket) { - if (ticket.getAppId() == null) return; - try { - List members = appUserService.list( - new LambdaQueryWrapper() - .eq(AppUser::getAppId, ticket.getAppId()) - .eq(AppUser::getStatus, 0) - .in(AppUser::getRole, "admin", "developer", "owner")); - if (!members.isEmpty()) { - // 简单轮询:按工单数最少分配(此处随机) - AppUser assigned = members.get(new Random().nextInt(members.size())); - ticket.setAssigneeId(assigned.getUserId()); - ticket.setAssigneeName(assigned.getNickname() != null ? assigned.getNickname() : assigned.getUsername()); - ticket.setAssigneeAvatar(assigned.getAvatar()); - ticket.setStatus("assigned"); - } - } catch (Exception e) { - log.warn("自动分配工单失败,保持 pending 状态", e); - } - } - - // ─── 更新状态 ───────────────────────────────────────────────── - @Override - public void updateStatus(Long ticketId, String status, Integer operatorId) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() - .eq(AppTicket::getTicketId, ticketId) - .set(AppTicket::getStatus, status) - .set(AppTicket::getUpdateTime, LocalDateTime.now()); - if ("resolved".equals(status)) { - wrapper.set(AppTicket::getResolvedTime, LocalDateTime.now()); - // 如果没有分配人,自动将操作人设为处理人 - AppTicket t = getById(ticketId); - if (t != null && t.getAssigneeId() == null) { - wrapper.set(AppTicket::getAssigneeId, operatorId); - } - } - update(wrapper); - - // 异步推送:状态变更通知提交人(已解决/已关闭) - if ("resolved".equals(status) || "closed".equals(status)) { - AppTicket t = getById(ticketId); - if (t != null) sendStatusChangedAsync(t, status); - } - } - - // ─── 分配处理人 ─────────────────────────────────────────────── - @Override - public void assign(Long ticketId, Integer assigneeId) { - User user = userService.getByIdIgnoreTenant(assigneeId); - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() - .eq(AppTicket::getTicketId, ticketId) - .set(AppTicket::getAssigneeId, assigneeId) - .set(user != null, AppTicket::getAssigneeName, - user != null ? (user.getNickname() != null ? user.getNickname() : user.getUsername()) : null) - .set(user != null, AppTicket::getAssigneeAvatar, user != null ? user.getAvatar() : null) - .set(AppTicket::getStatus, "assigned") - .set(AppTicket::getUpdateTime, LocalDateTime.now()); - update(wrapper); - - // 异步推送:通知新分配到的技术人员 - AppTicket t = getById(ticketId); - if (t != null) sendTicketAssignedAsync(t); - } - - // ─── 用户关闭工单 ───────────────────────────────────────────── - @Override - public void closeByUser(Long ticketId, Integer userId) { - AppTicket ticket = getById(ticketId); - if (ticket == null || !ticket.getSubmitUserId().equals(userId)) { - throw new RuntimeException("无权操作该工单"); - } - update(new LambdaUpdateWrapper() - .eq(AppTicket::getTicketId, ticketId) - .set(AppTicket::getStatus, "closed") - .set(AppTicket::getClosedTime, LocalDateTime.now()) - .set(AppTicket::getUpdateTime, LocalDateTime.now())); - } - - // ─── 获取回复列表 ───────────────────────────────────────────── - @Override - public List getReplies(Long ticketId) { - return replyMapper.selectList( - new LambdaQueryWrapper() - .eq(AppTicketReply::getTicketId, ticketId) - .eq(AppTicketReply::getDeleted, 0) - .orderByAsc(AppTicketReply::getCreateTime)); - } - - // ─── 添加回复 ───────────────────────────────────────────────── - @Override - @Transactional(rollbackFor = Exception.class) - public AppTicketReply addReply(AppTicketReply reply, Integer userId) { - reply.setUserId(userId); - reply.setDeleted(0); - reply.setCreateTime(LocalDateTime.now()); - - // 补充用户信息(@InterceptorIgnore 绕过租户拦截器跨库查询) - try { - User user = userService.getByIdIgnoreTenant(userId); - if (user != null) { - reply.setUserName(user.getNickname() != null ? user.getNickname() : user.getUsername()); - reply.setUserAvatar(user.getAvatar()); - } - } catch (Exception e) { - log.warn("获取回复人信息失败", e); - } - - // 判断是否是技术人员(该应用的 admin/developer/owner) - AppTicket ticket = getById(reply.getTicketId()); - if (ticket != null) { - boolean isStaff = appUserService.count(new LambdaQueryWrapper() - .eq(AppUser::getAppId, ticket.getAppId()) - .eq(AppUser::getUserId, userId) - .in(AppUser::getRole, "owner", "admin", "developer") - .eq(AppUser::getStatus, 0)) > 0; - reply.setIsStaff(isStaff ? 1 : 0); - } else { - reply.setIsStaff(0); - } - - replyMapper.insert(reply); - - // 更新工单回复数 & 更新时间,若状态是 assigned 则推进为 processing - update(new LambdaUpdateWrapper() - .eq(AppTicket::getTicketId, reply.getTicketId()) - .setSql("reply_count = reply_count + 1") - .set(AppTicket::getUpdateTime, LocalDateTime.now()) - .eq(AppTicket::getStatus, "assigned") - .set(AppTicket::getStatus, "processing")); - - // 异步推送:有新回复时通知对方 - if (ticket != null) sendReplyNotifyAsync(ticket, reply); - - return reply; - } - - // ─── 统计 ───────────────────────────────────────────────────── - @Override - public Map stats(Long appId, Integer userId) { - LambdaQueryWrapper base = new LambdaQueryWrapper() - .eq(AppTicket::getDeleted, 0) - .eq(ObjectUtil.isNotNull(appId), AppTicket::getAppId, appId) - .eq(ObjectUtil.isNotNull(userId), AppTicket::getSubmitUserId, userId); - - Map result = new HashMap<>(); - result.put("total", (long) count(base.clone())); - result.put("pending", (long) count(base.clone().in(AppTicket::getStatus, "pending", "assigned"))); - result.put("processing", (long) count(base.clone().eq(AppTicket::getStatus, "processing"))); - result.put("resolved", (long) count(base.clone().eq(AppTicket::getStatus, "resolved"))); - result.put("closed", (long) count(base.clone().eq(AppTicket::getStatus, "closed"))); - return result; - } - - // ─── 获取技术人员列表 ───────────────────────────────────────── - @Override - public List> getTechStaffList() { - List members = appUserService.list( - new LambdaQueryWrapper() - .eq(AppUser::getStatus, 0) - .in(AppUser::getRole, "owner", "admin", "developer") - .select(AppUser::getUserId, AppUser::getNickname, AppUser::getAvatar)); - - // 去重(一个用户可能在多个应用里) - Map dedupMap = new LinkedHashMap<>(); - for (AppUser m : members) { - dedupMap.put(m.getUserId(), m); - } - - return dedupMap.values().stream().map(m -> { - Map map = new HashMap<>(); - map.put("userId", m.getUserId()); - map.put("nickname", m.getNickname() != null ? m.getNickname() : "用户" + m.getUserId()); - map.put("avatar", m.getAvatar()); - return map; - }).collect(Collectors.toList()); - } - - // ════════════════════════════════════════════════════════════ - // 异步消息推送 - // ════════════════════════════════════════════════════════════ - - /** - * 场景1:新工单提交 → 通知分配到的技术人员 - */ - @Async - public void sendTicketCreatedAsync(AppTicket ticket) { - String now = now(); - String title = String.format("🎫 新工单待处理(%s)", now); - - String assigneeLine = StrUtil.isNotBlank(ticket.getAssigneeName()) - ? "**处理人:** " + ticket.getAssigneeName() - : "**处理人:** 待分配"; - - String wecomContent = String.format( - "## %s\n" + - "> **工单号:** %s\n" + - "> **标题:** %s\n" + - "> **分类:** %s **优先级:** %s\n" + - "> **提交人:** %s\n" + - "> %s\n" + - "> **描述:** %s", - title, - nullSafe(ticket.getTicketNo()), - nullSafe(ticket.getTitle()), - categoryLabel(ticket.getCategory()), priorityLabel(ticket.getPriority()), - nullSafe(ticket.getSubmitUserName()), - assigneeLine, - truncate(ticket.getContent(), 120) - ); - - List feishuLines = Arrays.asList( - new String[]{"工单号:" + nullSafe(ticket.getTicketNo())}, - new String[]{"标 题:" + nullSafe(ticket.getTitle())}, - new String[]{"分 类:" + categoryLabel(ticket.getCategory()) + " 优先级:" + priorityLabel(ticket.getPriority())}, - new String[]{"提交人:" + nullSafe(ticket.getSubmitUserName())}, - new String[]{assigneeLine.replace("**", "")}, - new String[]{"描 述:" + truncate(ticket.getContent(), 120)} - ); - - doSend(title, wecomContent, feishuLines, "ticket_created"); - } - - /** - * 场景2:工单被重新分配 → 通知新处理人 - */ - @Async - public void sendTicketAssignedAsync(AppTicket ticket) { - String now = now(); - String title = String.format("📋 工单已分配给您(%s)", now); - - String wecomContent = String.format( - "## %s\n" + - "> **工单号:** %s\n" + - "> **标题:** %s\n" + - "> **分配给:** %s\n" + - "> **分类:** %s **优先级:** %s\n" + - "> **描述:** %s", - title, - nullSafe(ticket.getTicketNo()), - nullSafe(ticket.getTitle()), - nullSafe(ticket.getAssigneeName()), - categoryLabel(ticket.getCategory()), priorityLabel(ticket.getPriority()), - truncate(ticket.getContent(), 100) - ); - - List feishuLines = Arrays.asList( - new String[]{"工单号:" + nullSafe(ticket.getTicketNo())}, - new String[]{"标 题:" + nullSafe(ticket.getTitle())}, - new String[]{"分配给:" + nullSafe(ticket.getAssigneeName())}, - new String[]{"分 类:" + categoryLabel(ticket.getCategory()) + " 优先级:" + priorityLabel(ticket.getPriority())}, - new String[]{"描 述:" + truncate(ticket.getContent(), 100)} - ); - - doSend(title, wecomContent, feishuLines, "ticket_assigned"); - } - - /** - * 场景3:有新回复 → 技术人员回复则通知客户,客户回复则通知技术人员 - */ - @Async - public void sendReplyNotifyAsync(AppTicket ticket, AppTicketReply reply) { - boolean isStaff = Integer.valueOf(1).equals(reply.getIsStaff()); - String now = now(); - String who = isStaff ? "技术人员" : "用户"; - String notifyRole = isStaff ? "您的工单有新回复" : "工单有用户新回复"; - String title = String.format("💬 %s(%s)", notifyRole, now); - - String wecomContent = String.format( - "## %s\n" + - "> **工单号:** %s\n" + - "> **标题:** %s\n" + - "> **回复人:** %s(%s)\n" + - "> **回复内容:** %s", - title, - nullSafe(ticket.getTicketNo()), - nullSafe(ticket.getTitle()), - nullSafe(reply.getUserName()), who, - truncate(reply.getContent(), 200) - ); - - List feishuLines = Arrays.asList( - new String[]{"工单号:" + nullSafe(ticket.getTicketNo())}, - new String[]{"标 题:" + nullSafe(ticket.getTitle())}, - new String[]{"回复人:" + nullSafe(reply.getUserName()) + "(" + who + ")"}, - new String[]{"回复内容:" + truncate(reply.getContent(), 200)} - ); - - doSend(title, wecomContent, feishuLines, "ticket_reply"); - } - - /** - * 场景4:状态变更(已解决/已关闭)→ 通知提交人 - */ - @Async - public void sendStatusChangedAsync(AppTicket ticket, String status) { - String now = now(); - String emoji = "resolved".equals(status) ? "✅" : "🔒"; - String statusLabel = "resolved".equals(status) ? "已解决" : "已关闭"; - String title = String.format("%s 工单%s(%s)", emoji, statusLabel, now); - - String wecomContent = String.format( - "## %s\n" + - "> **工单号:** %s\n" + - "> **标题:** %s\n" + - "> **提交人:** %s\n" + - "> **处理人:** %s\n" + - "> **状态:** %s", - title, - nullSafe(ticket.getTicketNo()), - nullSafe(ticket.getTitle()), - nullSafe(ticket.getSubmitUserName()), - nullSafe(ticket.getAssigneeName()), - "resolved".equals(status) ? "info" : "comment", - statusLabel - ); - - List feishuLines = Arrays.asList( - new String[]{"工单号:" + nullSafe(ticket.getTicketNo())}, - new String[]{"标 题:" + nullSafe(ticket.getTitle())}, - new String[]{"提交人:" + nullSafe(ticket.getSubmitUserName())}, - new String[]{"处理人:" + nullSafe(ticket.getAssigneeName())}, - new String[]{"状 态:" + statusLabel} - ); - - doSend(title, wecomContent, feishuLines, "ticket_status"); - } - - /** - * 统一发送入口:企业微信 + 飞书 - */ - private void doSend(String title, String wecomContent, List feishuLines, String scene) { - if (StrUtil.isNotBlank(wecomWebhook)) { - try { - sendWecom(wecomContent); - } catch (Exception e) { - log.warn("[工单通知][{}] 企业微信发送失败: {}", scene, e.getMessage()); - } - } - if (StrUtil.isNotBlank(feishuWebhook)) { - try { - sendFeishu(title, feishuLines); - } catch (Exception e) { - log.warn("[工单通知][{}] 飞书发送失败: {}", scene, e.getMessage()); - } - } - } - - /** - * 企业微信群机器人 - markdown 消息 - * 文档:https://developer.work.weixin.qq.com/document/path/91770 - */ - private void sendWecom(String content) { - Map textMap = new HashMap<>(); - textMap.put("content", content); - Map payload = new HashMap<>(); - payload.put("msgtype", "markdown"); - payload.put("markdown", textMap); - String resp = HttpUtil.post(wecomWebhook, JSON.toJSONString(payload)); - log.info("[工单通知] 企业微信推送结果: {}", resp); - } - - /** - * 飞书群机器人 - 富文本(post)消息 - * 文档:https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot - */ - private void sendFeishu(String title, List lines) { - List>> content = new ArrayList<>(); - for (String[] line : lines) { - Map node = new HashMap<>(); - node.put("tag", "text"); - node.put("text", line[0]); - content.add(Collections.singletonList(node)); - } - - Map zhCn = new HashMap<>(); - zhCn.put("title", title); - zhCn.put("content", content); - Map postContent = new HashMap<>(); - postContent.put("zh_cn", zhCn); - Map post = new HashMap<>(); - post.put("content", postContent); - Map payload = new HashMap<>(); - payload.put("msg_type", "post"); - payload.put("content", post); - - String resp = HttpUtil.post(feishuWebhook, JSON.toJSONString(payload)); - log.info("[工单通知] 飞书推送结果: {}", resp); - } - - // ════════════════════════════════════════════════════════════ - // 工具方法 - // ════════════════════════════════════════════════════════════ - - private String now() { - return LocalDateTime.now().format(DateTimeFormatter.ofPattern("MM-dd HH:mm")); - } - - private String nullSafe(String s) { - return StrUtil.isBlank(s) ? "—" : s; - } - - private String truncate(String s, int max) { - if (StrUtil.isBlank(s)) return "—"; - return s.length() > max ? s.substring(0, max) + "…" : s; - } - - private String categoryLabel(String category) { - if (category == null) return "其他"; - return switch (category) { - case "bug" -> "Bug反馈"; - case "feature" -> "功能需求"; - case "config" -> "配置问题"; - case "performance" -> "性能问题"; - case "security" -> "安全问题"; - default -> category; - }; - } - - private String priorityLabel(String priority) { - if (priority == null) return "普通"; - return switch (priority) { - case "urgent" -> "🔴 紧急"; - case "high" -> "🟠 高"; - case "normal" -> "🟡 普通"; - case "low" -> "🟢 低"; - default -> priority; - }; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppUserCacheServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppUserCacheServiceImpl.java deleted file mode 100644 index 7d2ddd1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppUserCacheServiceImpl.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.mapper.AppUserCacheMapper; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.system.entity.User; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 用户缓存 Service 实现 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Service -public class AppUserCacheServiceImpl extends ServiceImpl implements AppUserCacheService { - - /** Server API 地址 */ - @Value("${config.server-url:https://server.websoft.top/api}") - private String serverUrl; - - @Override - public AppUserCache getByUserId(Integer userId) { - if (userId == null) { - return null; - } - // 先查缓存 - AppUserCache cache = getById(userId); - if (cache != null) { - return cache; - } - // 缓存不存在,尝试从 server 获取并缓存 - return refreshUserCache(userId); - } - - @Override - public AppUserCache refreshUserCache(Integer userId) { - if (userId == null) { - return null; - } - User sysUser = getUserFromServer(userId); - if (sysUser == null) { - log.warn("刷新用户缓存失败,用户不存在或 API 调用失败,userId={}", userId); - return null; - } - return saveOrUpdateCache(sysUser); - } - - @Override - @Async - public void batchRefreshUserCache(List userIds) { - if (CollUtil.isEmpty(userIds)) { - return; - } - log.info("开始批量刷新用户缓存,数量={}", userIds.size()); - for (Integer userId : userIds) { - try { - refreshUserCache(userId); - } catch (Exception e) { - log.error("批量刷新用户缓存失败,userId={}", userId, e); - } - } - log.info("批量刷新用户缓存完成,数量={}", userIds.size()); - } - - /** - * 保存或更新缓存 - */ - private AppUserCache saveOrUpdateCache(User sysUser) { - AppUserCache cache = new AppUserCache(); - cache.setUserId(sysUser.getUserId()); - cache.setTenantId(sysUser.getTenantId()); - cache.setUsername(sysUser.getUsername()); - cache.setNickname(sysUser.getNickname()); - cache.setAvatar(sysUser.getAvatar()); - cache.setPhone(sysUser.getPhone()); - cache.setStatus(sysUser.getStatus()); - cache.setUpdateTime(LocalDateTime.now()); - - // 解决 MyBatis-Plus saveOrUpdate 对 IdType.INPUT 主键的兼容问题 - // 先查询再决定 insert/update,捕获并发冲突异常后回退到 update - if (getById(cache.getUserId()) != null) { - updateById(cache); - } else { - try { - save(cache); - } catch (org.springframework.dao.DuplicateKeyException e) { - // 并发场景:其他线程已插入,改为更新 - log.warn("并发插入冲突,改为更新: userId={}", cache.getUserId()); - updateById(cache); - } - } - log.debug("用户缓存更新成功,userId={}, username={}, tenantId={}", sysUser.getUserId(), sysUser.getUsername(), sysUser.getTenantId()); - return cache; - } - - /** - * 从 server API 获取用户信息 - */ - private User getUserFromServer(Integer userId) { - try { - String url = serverUrl + "/system/user/" + userId; - String response = HttpUtil.get(url); - JSONObject json = JSON.parseObject(response); - if (json.getIntValue("code") == 0 && json.get("data") != null) { - return JSON.parseObject(json.getJSONObject("data").toJSONString(), User.class); - } - log.warn("调用 server API 查询用户失败,userId={}, response={}", userId, response); - } catch (Exception e) { - log.error("调用 server API 查询用户异常,userId={}", userId, e); - } - return null; - } - - @Override - public AppUserCache refreshUserCacheByPhone(String phone) { - if (StrUtil.isBlank(phone)) { - return null; - } - - try { - // 调用 server API 根据手机号查询用户 - String url = serverUrl + "/system/user/getByPhone/" + phone; - String response = HttpUtil.get(url); - JSONObject json = JSON.parseObject(response); - - log.info("根据手机号查询用户响应: phone={}, response={}", phone, response); - - Integer code = json.getInteger("code"); - if ((code == 0 || code == 200) && json.get("data") != null) { - User sysUser = JSON.parseObject(json.getJSONObject("data").toJSONString(), User.class); - if (sysUser != null && sysUser.getUserId() != null) { - log.info("从 server 找到用户: phone={}, userId={}", phone, sysUser.getUserId()); - return saveOrUpdateCache(sysUser); - } - } - log.info("server 中未找到用户: phone={}", phone); - } catch (Exception e) { - log.error("根据手机号刷新用户缓存异常: phone={}", phone, e); - } - return null; - } - - @Override - public AppUserCache createUserByPhone(String phone) { - if (StrUtil.isBlank(phone)) { - return null; - } - - try { - // 1. 调用 server API 创建新用户 - String createUrl = serverUrl + "/system/user/"; - Map userMap = new HashMap<>(); - userMap.put("phone", phone); - userMap.put("username", "wx_" + phone); - userMap.put("nickname", "微信用户"); - userMap.put("status", 0); - userMap.put("platform", "MP-WEIXIN"); - userMap.put("tenantId", 1); // 默认租户 - - String createResult = HttpUtil.post(createUrl, JSON.toJSONString(userMap)); - JSONObject createJson = JSON.parseObject(createResult); - - log.info("创建用户响应: phone={}, response={}", phone, createResult); - - Integer createCode = createJson.getInteger("code"); - if (createCode == null || (createCode != 200 && createCode != 0)) { - log.error("创建用户失败: phone={}, code={}", phone, createCode); - return null; - } - - // 2. 创建成功,重新查询用户信息 - String queryUrl = serverUrl + "/system/user/getByPhone/" + phone; - String queryResult = HttpUtil.get(queryUrl); - JSONObject queryJson = JSON.parseObject(queryResult); - - log.info("查询用户响应: phone={}, response={}", phone, queryResult); - - Integer queryCode = queryJson.getInteger("code"); - if ((queryCode == 0 || queryCode == 200) && queryJson.get("data") != null) { - User sysUser = JSON.parseObject(queryJson.getJSONObject("data").toJSONString(), User.class); - if (sysUser != null && sysUser.getUserId() != null) { - log.info("新用户创建成功: phone={}, userId={}", phone, sysUser.getUserId()); - return saveOrUpdateCache(sysUser); - } - } - - log.error("创建用户后查询失败: phone={}", phone); - } catch (Exception e) { - log.error("创建用户异常: phone={}", phone, e); - } - return null; - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java deleted file mode 100644 index 5d84cd0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java +++ /dev/null @@ -1,359 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.mapper.AppUserMapper; -import com.gxwebsoft.app.mapper.SysUserCrossDbMapper; -import com.gxwebsoft.app.mapper.AppProductMapper; -import com.gxwebsoft.app.service.AppUserService; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.app.service.AppProductService; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.entity.AppProduct; -import com.gxwebsoft.app.param.AppUserParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.system.entity.User; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 应用成员Service实现 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Service -public class AppUserServiceImpl extends ServiceImpl implements AppUserService { - - @Autowired - private SysUserCrossDbMapper sysUserCrossDbMapper; - - @Autowired(required = false) - private AppUserCacheService appUserCacheService; - - @Autowired - private AppProductService appProductService; - - @Autowired - private AppProductMapper appProductMapper; - - @Override - public PageResult pageRel(AppUserParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time asc"); - List list = baseMapper.selectPageRel(page, param); - // 补充用户信息(从缓存或远程获取) - fillUserInfo(list); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(AppUserParam param) { - List list = baseMapper.selectListRel(param); - // 补充用户信息(从缓存或远程获取) - fillUserInfo(list); - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time asc"); - return page.sortRecords(list); - } - - /** - * 补充应用成员的用户信息(头像、昵称等) - * 优先从 app_user_cache 获取,缓存不存在则尝试刷新 - */ - private void fillUserInfo(List list) { - if (CollUtil.isEmpty(list) || appUserCacheService == null) { - return; - } - for (AppUser appUser : list) { - if (appUser.getUserId() == null) { - continue; - } - // 如果用户信息为空,尝试从缓存获取 - if (ObjectUtil.isEmpty(appUser.getNickname()) - || ObjectUtil.isEmpty(appUser.getAvatar()) - || ObjectUtil.isEmpty(appUser.getUsername())) { - AppUserCache cache = appUserCacheService.getByUserId(appUser.getUserId()); - if (cache != null) { - appUser.setUsername(cache.getUsername()); - appUser.setNickname(cache.getNickname()); - appUser.setAvatar(cache.getAvatar()); - appUser.setPhone(cache.getPhone()); - } - } - } - } - - @Override - public AppUser getByIdRel(Integer id) { - AppUserParam param = new AppUserParam(); - param.setId(id.longValue()); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public AppUser inviteUser(Long appId, Integer userId, String role, Integer inviteBy, Integer tenantId) { - // 检查是否已经有待处理或已确认的邀请 - AppUser existUser = getByAppIdAndUserId(appId, userId); - if (existUser != null) { - if (existUser.getInviteStatus() == 0) { - throw new RuntimeException("该用户已经是应用成员"); - } else if (existUser.getInviteStatus() == 1) { - throw new RuntimeException("该用户已有待确认的邀请"); - } - } - - // 直接从 gxwebsoft_core 库跨库查询用户信息 - User sysUser = sysUserCrossDbMapper.selectByUserId(userId); - if (sysUser == null) { - throw new RuntimeException("用户不存在,userId=" + userId); - } - - AppUser appUser = new AppUser(); - appUser.setAppId(appId); - appUser.setUserId(userId); - appUser.setRole(role != null ? role : "developer"); - appUser.setInviteBy(inviteBy.longValue()); - appUser.setInviteTime(LocalDateTime.now()); - // 邀请7天后过期 - appUser.setInviteExpireTime(LocalDateTime.now().plusDays(7)); - appUser.setStatus(0); - appUser.setInviteStatus(1); // 待确认 - appUser.setSortNumber(0); - // 设置租户ID(NOT NULL约束) - appUser.setTenantId(tenantId); - // 冗余写入用户基础信息 - appUser.setUsername(sysUser.getUsername()); - appUser.setNickname(sysUser.getNickname()); - appUser.setAvatar(sysUser.getAvatar()); - appUser.setPhone(sysUser.getPhone()); - - save(appUser); - log.info("邀请成员成功,等待对方确认,appId={}, userId={}, username={}, role={}", appId, userId, sysUser.getUsername(), role); - - // 同时更新用户缓存 - refreshUserCache(userId, sysUser); - - // TODO: 发送通知给被邀请人 - // sendInviteNotification(appUser); - - return appUser; - } - - @Override - public boolean acceptInvite(Long inviteId, Integer userId) { - AppUser invite = getById(inviteId); - if (invite == null) { - throw new RuntimeException("邀请不存在"); - } - if (!invite.getUserId().equals(userId)) { - throw new RuntimeException("无权处理该邀请"); - } - if (invite.getInviteStatus() != 1) { - throw new RuntimeException("该邀请已处理或已过期"); - } - if (invite.getInviteExpireTime() != null && invite.getInviteExpireTime().isBefore(LocalDateTime.now())) { - throw new RuntimeException("邀请已过期"); - } - - boolean success = update(new LambdaUpdateWrapper() - .eq(AppUser::getId, inviteId) - .set(AppUser::getInviteStatus, 0) // 确认加入 - .set(AppUser::getInviteTime, LocalDateTime.now()) // 更新为确认时间 - .set(AppUser::getUpdateTime, LocalDateTime.now())); - - if (success) { - log.info("用户接受邀请,inviteId={}, userId={}, appId={}", inviteId, userId, invite.getAppId()); - // TODO: 发送通知给邀请人 - } - return success; - } - - @Override - public boolean rejectInvite(Long inviteId, Integer userId) { - AppUser invite = getById(inviteId); - if (invite == null) { - throw new RuntimeException("邀请不存在"); - } - if (!invite.getUserId().equals(userId)) { - throw new RuntimeException("无权处理该邀请"); - } - if (invite.getInviteStatus() != 1) { - throw new RuntimeException("该邀请已处理或已过期"); - } - - boolean success = update(new LambdaUpdateWrapper() - .eq(AppUser::getId, inviteId) - .set(AppUser::getInviteStatus, 2) // 拒绝 - .set(AppUser::getStatus, 1) // 标记为禁用 - .set(AppUser::getUpdateTime, LocalDateTime.now())); - - if (success) { - log.info("用户拒绝邀请,inviteId={}, userId={}, appId={}", inviteId, userId, invite.getAppId()); - // TODO: 发送通知给邀请人 - } - return success; - } - - @Override - public List listPendingInvites(Integer userId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppUser::getUserId, userId) - .eq(AppUser::getInviteStatus, 1) // 待确认 - .eq(AppUser::getStatus, 0) - .gt(AppUser::getInviteExpireTime, LocalDateTime.now()) // 未过期 - .orderByDesc(AppUser::getCreateTime); - List list = list(wrapper); - // 补充应用信息和邀请人信息 - fillAppAndInviterInfo(list); - return list; - } - - @Override - public long countPendingInvites(Integer userId) { - return count(new LambdaQueryWrapper() - .eq(AppUser::getUserId, userId) - .eq(AppUser::getInviteStatus, 1) - .eq(AppUser::getStatus, 0) - .gt(AppUser::getInviteExpireTime, LocalDateTime.now())); - } - - /** - * 补充应用信息和邀请人信息 - */ - private void fillAppAndInviterInfo(List list) { - if (CollUtil.isEmpty(list)) { - return; - } - for (AppUser appUser : list) { - // 补充邀请人信息 - if (appUser.getInviteBy() != null && appUserCacheService != null) { - AppUserCache inviterCache = appUserCacheService.getByUserId(appUser.getInviteBy().intValue()); - if (inviterCache != null) { - appUser.setUsername(inviterCache.getNickname() != null ? inviterCache.getNickname() : inviterCache.getUsername()); - } - } - // 补充应用信息 - if (appUser.getAppId() != null) { - // AppProduct 主键是 productId(Integer),appId 是 Long,需要转换 - Integer productId = appUser.getAppId().intValue(); - log.info("查询应用信息: appId={}, productId={}", appUser.getAppId(), productId); - - // 直接使用 Mapper 查询,避免 Service 可能的问题 - AppProduct product = appProductMapper.selectById(productId); - - if (product != null) { - log.info("找到应用信息: productId={}, productName={}", productId, product.getProductName()); - appUser.setProductName(product.getProductName()); - appUser.setIcon(product.getLogo() != null ? product.getLogo() : product.getIcon()); - appUser.setProductCode(product.getProductCode()); - } else { - log.warn("未找到应用信息: productId={}", productId); - } - } else { - log.debug("跳过应用信息查询: appId={}", appUser.getAppId()); - } - } - } - - /** - * 根据应用ID和用户ID查询成员记录 - */ - private AppUser getByAppIdAndUserId(Long appId, Integer userId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper() - .eq(AppUser::getAppId, appId) - .eq(AppUser::getUserId, userId); - return getOne(wrapper); - } - - @Override - public boolean updateRole(Long id, String role) { - return update(new LambdaUpdateWrapper() - .eq(AppUser::getId, id) - .set(AppUser::getRole, role)); - } - - @Override - public boolean isMember(Long appId, Integer userId) { - long count = count(new LambdaQueryWrapper() - .eq(AppUser::getAppId, appId) - .eq(AppUser::getUserId, userId) - .eq(AppUser::getStatus, 0) - .eq(AppUser::getInviteStatus, 0)); // 只算已确认的成员 - return count > 0; - } - - @Override - public boolean hasPendingInvite(Long appId, Integer userId) { - long count = count(new LambdaQueryWrapper() - .eq(AppUser::getAppId, appId) - .eq(AppUser::getUserId, userId) - .eq(AppUser::getInviteStatus, 1) - .eq(AppUser::getStatus, 0) - .gt(AppUser::getInviteExpireTime, LocalDateTime.now())); - return count > 0; - } - - @Override - public User findUserByPhone(String phone) { - // 直接从 gxwebsoft_core 库跨库查询用户 - return sysUserCrossDbMapper.selectByPhone(phone); - } - - @Override - public List searchUsers(String keyword) { - // 从 gxwebsoft_core 库跨库搜索用户(按手机号、用户名、昵称模糊搜索) - return sysUserCrossDbMapper.searchUsers(keyword); - } - - @Override - public void recordVisit(Long appId, Integer userId) { - if (appId == null || userId == null) { - return; - } - try { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); - wrapper.eq(AppUser::getAppId, appId) - .eq(AppUser::getUserId, userId) - .set(AppUser::getUpdateTime, LocalDateTime.now()); - this.update(wrapper); - log.debug("记录应用访问,appId={}, userId={}", appId, userId); - } catch (Exception e) { - log.error("记录应用访问失败,appId={}, userId={}", appId, userId, e); - } - } - - /** - * 更新用户缓存 - */ - private void refreshUserCache(Integer userId, User sysUser) { - if (appUserCacheService != null && sysUser != null) { - try { - AppUserCache cache = new AppUserCache(); - cache.setUserId(sysUser.getUserId()); - cache.setUsername(sysUser.getUsername()); - cache.setNickname(sysUser.getNickname()); - cache.setAvatar(sysUser.getAvatar()); - cache.setPhone(sysUser.getPhone()); - cache.setStatus(sysUser.getStatus()); - cache.setUpdateTime(LocalDateTime.now()); - appUserCacheService.saveOrUpdate(cache); - log.debug("用户缓存已更新,userId={}", userId); - } catch (Exception e) { - log.error("更新用户缓存失败,userId={}", userId, e); - } - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppVersionServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppVersionServiceImpl.java deleted file mode 100644 index b74ebf6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/AppVersionServiceImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.app.mapper.AppVersionMapper; -import com.gxwebsoft.app.service.AppVersionService; -import com.gxwebsoft.app.entity.AppVersion; -import com.gxwebsoft.app.param.AppVersionParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 应用版本发布记录Service实现 - * - * @author 科技小王子 - * @since 2026-03-28 21:29:44 - */ -@Slf4j -@Service -public class AppVersionServiceImpl extends ServiceImpl implements AppVersionService { - - @Override - public PageResult pageRel(AppVersionParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(AppVersionParam param) { - List list = baseMapper.selectListRel(param); - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public AppVersion getByIdRel(Integer id) { - AppVersionParam param = new AppVersionParam(); - param.setId(id.longValue()); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean publish(Long id, Integer publishBy) { - AppVersion version = getById(id); - if (version == null) { - throw new RuntimeException("版本不存在"); - } - Long appId = version.getAppId(); - - // 1. 将该应用下所有版本的 isCurrent 设为 false - update(new LambdaUpdateWrapper() - .eq(AppVersion::getAppId, appId) - .set(AppVersion::getIsCurrent, false)); - - // 2. 将当前版本设为已发布+当前版本 - version.setStatus(1); - version.setIsCurrent(true); - version.setPublishBy(publishBy.longValue()); - version.setPublishTime(LocalDateTime.now()); - - boolean result = updateById(version); - log.info("发布版本成功,id={}, versionNo={}", id, version.getVersionNo()); - return result; - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean rollback(Long id, Integer publishBy) { - AppVersion targetVersion = getById(id); - if (targetVersion == null) { - throw new RuntimeException("目标版本不存在"); - } - Long appId = targetVersion.getAppId(); - - // 1. 将当前版本标记为已回滚 - update(new LambdaUpdateWrapper() - .eq(AppVersion::getAppId, appId) - .eq(AppVersion::getIsCurrent, true) - .set(AppVersion::getStatus, 2) // 2=已回滚 - .set(AppVersion::getIsCurrent, false)); - - // 2. 将目标版本设为当前版本 - targetVersion.setStatus(1); - targetVersion.setIsCurrent(true); - targetVersion.setPublishBy(publishBy.longValue()); - targetVersion.setPublishTime(LocalDateTime.now()); - - boolean result = updateById(targetVersion); - log.info("回滚版本成功,id={}, versionNo={}", id, targetVersion.getVersionNo()); - return result; - } - - @Override - public AppVersion getCurrentVersion(Long appId) { - return getOne(new LambdaQueryWrapper() - .eq(AppVersion::getAppId, appId) - .eq(AppVersion::getIsCurrent, true) - .last("LIMIT 1")); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/MySqlOperatorServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/MySqlOperatorServiceImpl.java deleted file mode 100644 index 02d7001..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/MySqlOperatorServiceImpl.java +++ /dev/null @@ -1,344 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.gxwebsoft.app.service.DatabaseOperatorService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.sql.*; -import java.util.regex.Pattern; - -/** - * MySQL 远程数据库操作服务实现 - * 通过 JDBC 连接远程 MySQL 服务器执行 DDL 操作 - * - * @author WebSoft - * @since 2026-04-04 - */ -@Slf4j -@Service -public class MySqlOperatorServiceImpl implements DatabaseOperatorService { - - /** - * 合法数据库名校验:小写字母、数字、下划线,小写字母开头,最长 64 字符 - */ - private static final Pattern DB_NAME_PATTERN = Pattern.compile("^[a-z][a-z0-9_]{0,63}$"); - - /** - * 连接超时(毫秒) - */ - private static final int CONNECT_TIMEOUT_MS = 5000; - - @Override - public String getSupportedDbType() { - return "MySQL"; - } - - @Override - public DatabaseOperationResult createDatabaseAndGrant(String host, Integer port, - String username, String password, - String dbName, String dbUser, String dbPass) { - // 参数校验 - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (port == null || port < 1 || port > 65535) { - return fail("端口号无效"); - } - if (username == null || username.trim().isEmpty()) { - return fail("管理员用户名不能为空"); - } - if (dbName == null || dbName.trim().isEmpty()) { - return fail("数据库名称不能为空"); - } - if (!DB_NAME_PATTERN.matcher(dbName).matches()) { - return fail("数据库名称格式不正确(小写字母开头,仅含小写字母、数字、下划线,最长64字符)"); - } - - // 去前后空格 - host = host.trim(); - username = username.trim(); - - // 使用管理员连接(不指定数据库) - String jdbcUrl = buildJdbcUrl(host, port, null); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { - // 1. 检查数据库是否已存在 - if (databaseExists(conn, dbName)) { - log.info("MySQL 数据库 {} 在 {}:{} 上已存在,跳过创建", dbName, host, port); - } else { - // 2. 创建数据库 - try (Statement stmt = conn.createStatement()) { - String createSql = String.format( - "CREATE DATABASE `%s` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci", dbName); - stmt.execute(createSql); - log.info("MySQL 数据库 {} 在 {}:{} 上创建成功", dbName, host, port); - } - } - - // 3. 创建用户并授权(如果提供了业务用户信息) - if (dbUser != null && !dbUser.trim().isEmpty()) { - dbUser = dbUser.trim(); - createUserAndGrant(conn, dbName, dbUser, dbPass); - } - - return ok("数据库创建成功", String.format("MySQL 数据库 %s 已就绪", dbName)); - - } catch (SQLException e) { - String errorMsg = parseError(e); - log.error("MySQL 创建数据库失败: host={}, port={}, db={}, error={}", host, port, dbName, errorMsg); - return fail("创建数据库失败", errorMsg); - } - } - - @Override - public DatabaseOperationResult dropDatabaseAndUser(String host, Integer port, - String username, String password, - String dbName, String dbUser) { - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (dbName == null || dbName.trim().isEmpty()) { - return fail("数据库名称不能为空"); - } - if (!DB_NAME_PATTERN.matcher(dbName).matches()) { - return fail("数据库名称格式不正确"); - } - - host = host.trim(); - username = username.trim(); - String jdbcUrl = buildJdbcUrl(host, port, null); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { - // 1. 删除用户权限和用户 - if (dbUser != null && !dbUser.trim().isEmpty()) { - dbUser = dbUser.trim(); - try (Statement stmt = conn.createStatement()) { - stmt.execute(String.format("DROP USER IF EXISTS `%s`@`%%`", dbUser)); - stmt.execute(String.format("DROP USER IF EXISTS `%s`@`localhost`", dbUser)); - log.info("MySQL 用户 {} 已删除", dbUser); - } catch (SQLException e) { - log.warn("删除用户 {} 失败: {}", dbUser, e.getMessage()); - } - } - - // 2. 删除数据库 - if (databaseExists(conn, dbName)) { - try (Statement stmt = conn.createStatement()) { - stmt.execute(String.format("DROP DATABASE IF EXISTS `%s`", dbName)); - log.info("MySQL 数据库 {} 在 {}:{} 上已删除", dbName, host, port); - } - } - - return ok("数据库和用户已删除", String.format("MySQL 数据库 %s 已清理", dbName)); - - } catch (SQLException e) { - String errorMsg = parseError(e); - log.error("MySQL 删除数据库失败: host={}, port={}, db={}, error={}", host, port, dbName, errorMsg); - return fail("删除数据库失败", errorMsg); - } - } - - @Override - public DatabaseOperationResult testConnection(String host, Integer port, - String username, String password, - String dbName) { - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (username == null || username.trim().isEmpty()) { - return fail("用户名不能为空"); - } - - host = host.trim(); - username = username.trim(); - String jdbcUrl = buildJdbcUrl(host, port, dbName); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { - try (Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT VERSION()")) { - if (rs.next()) { - String version = rs.getString(1); - String dbInfo = dbName != null ? String.format(",数据库 %s", dbName) : ""; - return ok("连接成功", String.format("MySQL %s%s", version, dbInfo)); - } - } - return ok("连接成功"); - } catch (SQLException e) { - String errorMsg = parseError(e); - log.warn("MySQL 测试连接失败: host={}, port={}, db={}, user={}, error={}", host, port, dbName, username, errorMsg); - return fail("连接失败", errorMsg); - } - } - - @Override - public DatabaseOperationResult changePassword(String host, Integer port, - String adminUsername, String adminPassword, - String dbUsername, String oldPassword, String newPassword) { - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (adminUsername == null || adminUsername.trim().isEmpty()) { - return fail("管理员用户名不能为空"); - } - if (dbUsername == null || dbUsername.trim().isEmpty()) { - return fail("数据库用户名不能为空"); - } - if (newPassword == null || newPassword.trim().isEmpty()) { - return fail("新密码不能为空"); - } - - host = host.trim(); - adminUsername = adminUsername.trim(); - dbUsername = dbUsername.trim(); - - String jdbcUrl = buildJdbcUrl(host, port, null); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, adminUsername, adminPassword)) { - try (Statement stmt = conn.createStatement()) { - // 使用 ALTER USER 修改密码(MySQL 8.x 兼容) - String alterSql = String.format( - "ALTER USER `%s`@`%%` IDENTIFIED BY '%s'", dbUsername, escapeSql(newPassword)); - stmt.execute(alterSql); - - stmt.execute("FLUSH PRIVILEGES"); - log.info("MySQL 用户 {} 密码修改成功", dbUsername); - return ok("密码修改成功", String.format("用户 %s 的密码已更新", dbUsername)); - } - } catch (SQLException e) { - String errorMsg = parseError(e); - log.error("MySQL 修改密码失败: host={}, port={}, dbUser={}, error={}", host, port, dbUsername, errorMsg); - return fail("修改密码失败", errorMsg); - } - } - - /** - * 检查数据库是否已存在 - */ - private boolean databaseExists(Connection conn, String dbName) throws SQLException { - String sql = "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = ?"; - try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setString(1, dbName); - try (ResultSet rs = ps.executeQuery()) { - return rs.next(); - } - } - } - - /** - * 创建用户并授权 - */ - private void createUserAndGrant(Connection conn, String dbName, String dbUser, String dbPass) throws SQLException { - try (Statement stmt = conn.createStatement()) { - boolean userExists = false; - try (ResultSet rs = stmt.executeQuery( - String.format("SELECT User FROM mysql.user WHERE User = '%s' AND Host = '%%'", dbUser))) { - userExists = rs.next(); - } - - if (!userExists) { - String createUserSql = String.format( - "CREATE USER `%s`@`%%` IDENTIFIED BY '%s'", dbUser, escapeSql(dbPass)); - stmt.execute(createUserSql); - log.info("MySQL 用户 {} 创建成功", dbUser); - } else { - String alterUserSql = String.format( - "ALTER USER `%s`@`%%` IDENTIFIED BY '%s'", dbUser, escapeSql(dbPass)); - stmt.execute(alterUserSql); - log.info("MySQL 用户 {} 密码已更新", dbUser); - } - - String grantSql = String.format( - "GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@`%%`", dbName, dbUser); - stmt.execute(grantSql); - - stmt.execute("FLUSH PRIVILEGES"); - log.info("MySQL 用户 {} 已授权数据库 {}", dbUser, dbName); - } - } - - /** - * 构建 MySQL JDBC URL - */ - private String buildJdbcUrl(String host, int port, String dbName) { - return String.format( - "jdbc:mysql://%s:%d%s?useUnicode=true&characterEncoding=UTF-8&useSSL=false" + - "&serverTimezone=Asia/Shanghai&connectTimeout=%d&socketTimeout=%d" + - "&allowPublicKeyRetrieval=true", - host, port, - dbName != null ? "/" + dbName : "/", - CONNECT_TIMEOUT_MS, CONNECT_TIMEOUT_MS); - } - - /** - * 转义 SQL 字符串中的单引号 - */ - private String escapeSql(String value) { - if (value == null) { - return ""; - } - return value.replace("'", "''"); - } - - /** - * 解析 MySQL 错误信息,返回更友好的中文提示 - */ - private String parseError(SQLException e) { - int errorCode = e.getErrorCode(); - String state = e.getSQLState(); - String message = e.getMessage(); - - switch (errorCode) { - case 1045: - return "用户名或密码错误(Access denied)"; - case 1049: - return "数据库不存在(Unknown database)"; - case 1064: - return "SQL 语法错误"; - case 1142: - return "权限不足,当前用户无权执行此操作"; - case 1213: - return "死锁,请稍后重试"; - case 1205: - return "锁等待超时,请稍后重试"; - default: - break; - } - - if ("28000".equals(state)) { - return "认证失败,请检查用户名和密码"; - } - if ("08S01".equals(state)) { - return "连接失败,请检查服务器地址和端口是否可达,以及 MySQL 是否允许远程连接"; - } - if ("08001".equals(state)) { - return "无法建立连接,请检查网络和防火墙设置"; - } - - if (message != null) { - String[] parts = message.split("\n"); - String lastPart = parts[parts.length - 1].trim(); - if (lastPart.length() > 200) { - return lastPart.substring(0, 200); - } - return lastPart; - } - - return "未知错误: " + state + " / " + errorCode; - } - - private static DatabaseOperationResult ok(String message) { - return DatabaseOperationResult.ok(message); - } - - private static DatabaseOperationResult ok(String message, String detail) { - return DatabaseOperationResult.ok(message, detail); - } - - private static DatabaseOperationResult fail(String message) { - return DatabaseOperationResult.fail(message); - } - - private static DatabaseOperationResult fail(String message, String detail) { - return DatabaseOperationResult.fail(message, detail); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/PostgreSqlOperatorServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/PostgreSqlOperatorServiceImpl.java deleted file mode 100644 index f185eb4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/PostgreSqlOperatorServiceImpl.java +++ /dev/null @@ -1,399 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.gxwebsoft.app.service.DatabaseOperatorService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.sql.*; -import java.util.regex.Pattern; - -/** - * PostgreSQL 远程数据库操作服务实现 - * 通过 JDBC 连接远程 PostgreSQL 服务器执行 DDL 操作 - * - * @author WebSoft - * @since 2026-04-04 - */ -@Slf4j -@Service -public class PostgreSqlOperatorServiceImpl implements DatabaseOperatorService { - - /** - * 合法数据库名校验:小写字母、数字、下划线,小写字母开头,最长 63 字符 - */ - private static final Pattern DB_NAME_PATTERN = Pattern.compile("^[a-z][a-z0-9_]{0,62}$"); - - /** - * 合法用户名校验:小写字母、数字、下划线,小写字母开头,最长 63 字符 - */ - private static final Pattern USER_NAME_PATTERN = Pattern.compile("^[a-z][a-z0-9_]{0,62}$"); - - /** - * 连接超时(毫秒) - */ - private static final int CONNECT_TIMEOUT_MS = 5000; - - @Override - public String getSupportedDbType() { - return "PostgreSQL"; - } - - @Override - public DatabaseOperationResult createDatabaseAndGrant(String host, Integer port, - String username, String password, - String dbName, String dbUser, String dbPass) { - // 参数校验 - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (port == null || port < 1 || port > 65535) { - return fail("端口号无效"); - } - if (username == null || username.trim().isEmpty()) { - return fail("管理员用户名不能为空"); - } - if (dbName == null || dbName.trim().isEmpty()) { - return fail("数据库名称不能为空"); - } - if (!DB_NAME_PATTERN.matcher(dbName).matches()) { - return fail("数据库名称格式不正确(小写字母开头,仅含小写字母、数字、下划线,最长63字符)"); - } - - host = host.trim(); - username = username.trim(); - - // PostgreSQL 需要连接到 postgres 维护数据库来执行 DDL - String jdbcUrl = buildJdbcUrl(host, port, "postgres"); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { - // 1. 检查数据库是否已存在 - if (databaseExists(conn, dbName)) { - log.info("PostgreSQL 数据库 {} 在 {}:{} 上已存在,跳过创建", dbName, host, port); - } else { - // 2. 创建数据库 - try (Statement stmt = conn.createStatement()) { - stmt.execute(String.format( - "CREATE DATABASE \"%s\" ENCODING 'UTF8' LC_COLLATE='zh_CN.UTF-8' LC_CTYPE='zh_CN.UTF-8' TEMPLATE=template0", - escapeDoubleQuote(dbName))); - log.info("PostgreSQL 数据库 {} 在 {}:{} 上创建成功", dbName, host, port); - } - } - - // 3. 创建用户并授权(如果提供了业务用户信息) - if (dbUser != null && !dbUser.trim().isEmpty()) { - dbUser = dbUser.trim(); - if (!USER_NAME_PATTERN.matcher(dbUser).matches()) { - return fail("用户名格式不正确(小写字母开头,仅含小写字母、数字、下划线,最长63字符)"); - } - // 需要重新连接到新创建的数据库来授权 - String newDbUrl = buildJdbcUrl(host, port, dbName); - try (Connection newConn = DriverManager.getConnection(newDbUrl, username, password)) { - createUserAndGrant(newConn, dbName, dbUser, dbPass); - } - } - - return ok("数据库创建成功", String.format("PostgreSQL 数据库 %s 已就绪", dbName)); - - } catch (SQLException e) { - String errorMsg = parseError(e); - log.error("PostgreSQL 创建数据库失败: host={}, port={}, db={}, error={}", host, port, dbName, errorMsg); - return fail("创建数据库失败", errorMsg); - } - } - - @Override - public DatabaseOperationResult dropDatabaseAndUser(String host, Integer port, - String username, String password, - String dbName, String dbUser) { - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (dbName == null || dbName.trim().isEmpty()) { - return fail("数据库名称不能为空"); - } - if (!DB_NAME_PATTERN.matcher(dbName).matches()) { - return fail("数据库名称格式不正确"); - } - - host = host.trim(); - username = username.trim(); - String jdbcUrl = buildJdbcUrl(host, port, "postgres"); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { - // 1. 断开所有活跃连接(PostgreSQL 删除数据库前必须先断开连接) - try (Statement stmt = conn.createStatement()) { - stmt.execute(String.format( - "SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '%s' AND pid <> pg_backend_pid()", - escapeSql(dbName))); - } catch (SQLException e) { - log.warn("断开数据库 {} 活跃连接时出错: {}", dbName, e.getMessage()); - } - - // 2. 删除数据库 - if (databaseExists(conn, dbName)) { - try (Statement stmt = conn.createStatement()) { - stmt.execute(String.format("DROP DATABASE IF EXISTS \"%s\"", escapeDoubleQuote(dbName))); - log.info("PostgreSQL 数据库 {} 在 {}:{} 上已删除", dbName, host, port); - } - } - - // 3. 删除用户(如果有提供) - if (dbUser != null && !dbUser.trim().isEmpty()) { - dbUser = dbUser.trim(); - try (Statement stmt = conn.createStatement()) { - // 先撤销所有权限 - stmt.execute(String.format("REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA public FROM \"%s\"", escapeDoubleQuote(dbUser))); - stmt.execute(String.format("REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public FROM \"%s\"", escapeDoubleQuote(dbUser))); - stmt.execute(String.format("REVOKE USAGE ON SCHEMA public FROM \"%s\"", escapeDoubleQuote(dbUser))); - stmt.execute(String.format("REVOKE CONNECT ON DATABASE \"%s\" FROM \"%s\"", escapeDoubleQuote(dbName), escapeDoubleQuote(dbUser))); - // 删除用户 - stmt.execute(String.format("DROP USER IF EXISTS \"%s\"", escapeDoubleQuote(dbUser))); - log.info("PostgreSQL 用户 {} 已删除", dbUser); - } catch (SQLException e) { - log.warn("删除 PostgreSQL 用户 {} 失败: {}", dbUser, e.getMessage()); - } - } - - return ok("数据库和用户已删除", String.format("PostgreSQL 数据库 %s 已清理", dbName)); - - } catch (SQLException e) { - String errorMsg = parseError(e); - log.error("PostgreSQL 删除数据库失败: host={}, port={}, db={}, error={}", host, port, dbName, errorMsg); - return fail("删除数据库失败", errorMsg); - } - } - - @Override - public DatabaseOperationResult testConnection(String host, Integer port, - String username, String password, - String dbName) { - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (username == null || username.trim().isEmpty()) { - return fail("用户名不能为空"); - } - - host = host.trim(); - username = username.trim(); - - // 测试连接:如果指定了数据库名就用数据库名,否则用 postgres 维护库 - String connectDb = (dbName != null && !dbName.trim().isEmpty()) ? dbName.trim() : "postgres"; - String jdbcUrl = buildJdbcUrl(host, port, connectDb); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, username, password)) { - try (Statement stmt = conn.createStatement(); - ResultSet rs = stmt.executeQuery("SELECT version()")) { - if (rs.next()) { - String version = rs.getString(1); - String dbInfo = dbName != null ? String.format(",数据库 %s", dbName) : ""; - return ok("连接成功", String.format("PostgreSQL %s%s", version, dbInfo)); - } - } - return ok("连接成功"); - } catch (SQLException e) { - String errorMsg = parseError(e); - log.warn("PostgreSQL 测试连接失败: host={}, port={}, db={}, user={}, error={}", host, port, dbName, username, errorMsg); - return fail("连接失败", errorMsg); - } - } - - @Override - public DatabaseOperationResult changePassword(String host, Integer port, - String adminUsername, String adminPassword, - String dbUsername, String oldPassword, String newPassword) { - if (host == null || host.trim().isEmpty()) { - return fail("服务器地址不能为空"); - } - if (adminUsername == null || adminUsername.trim().isEmpty()) { - return fail("管理员用户名不能为空"); - } - if (dbUsername == null || dbUsername.trim().isEmpty()) { - return fail("数据库用户名不能为空"); - } - if (newPassword == null || newPassword.trim().isEmpty()) { - return fail("新密码不能为空"); - } - - host = host.trim(); - adminUsername = adminUsername.trim(); - dbUsername = dbUsername.trim(); - - // PostgreSQL 需要连接到 postgres 维护库来执行 ALTER USER - String jdbcUrl = buildJdbcUrl(host, port, "postgres"); - - try (Connection conn = DriverManager.getConnection(jdbcUrl, adminUsername, adminPassword)) { - try (Statement stmt = conn.createStatement()) { - // 使用 ALTER USER 修改密码(PostgreSQL 兼容) - String alterSql = String.format( - "ALTER USER \"%s\" WITH PASSWORD '%s'", - escapeDoubleQuote(dbUsername), escapeSql(newPassword)); - stmt.execute(alterSql); - log.info("PostgreSQL 用户 {} 密码修改成功", dbUsername); - return ok("密码修改成功", String.format("用户 %s 的密码已更新", dbUsername)); - } - } catch (SQLException e) { - String errorMsg = parseError(e); - log.error("PostgreSQL 修改密码失败: host={}, port={}, dbUser={}, error={}", host, port, dbUsername, errorMsg); - return fail("修改密码失败", errorMsg); - } - } - - /** - * 检查数据库是否已存在 - */ - private boolean databaseExists(Connection conn, String dbName) throws SQLException { - String sql = "SELECT datname FROM pg_database WHERE datname = ?"; - try (PreparedStatement ps = conn.prepareStatement(sql)) { - ps.setString(1, dbName); - try (ResultSet rs = ps.executeQuery()) { - return rs.next(); - } - } - } - - /** - * 创建用户并授权 - */ - private void createUserAndGrant(Connection conn, String dbName, String dbUser, String dbPass) throws SQLException { - try (Statement stmt = conn.createStatement()) { - boolean userExists = false; - try (ResultSet rs = stmt.executeQuery( - String.format("SELECT usename FROM pg_user WHERE usename = '%s'", escapeSql(dbUser)))) { - userExists = rs.next(); - } - - if (!userExists) { - String createUserSql = String.format( - "CREATE USER \"%s\" WITH PASSWORD '%s'", - escapeDoubleQuote(dbUser), escapeSql(dbPass)); - stmt.execute(createUserSql); - log.info("PostgreSQL 用户 {} 创建成功", dbUser); - } else { - String alterUserSql = String.format( - "ALTER USER \"%s\" WITH PASSWORD '%s'", - escapeDoubleQuote(dbUser), escapeSql(dbPass)); - stmt.execute(alterUserSql); - log.info("PostgreSQL 用户 {} 密码已更新", dbUser); - } - - // 授予数据库连接权限和 schema 使用权限 - stmt.execute(String.format("GRANT CONNECT ON DATABASE \"%s\" TO \"%s\"", - escapeDoubleQuote(dbName), escapeDoubleQuote(dbUser))); - stmt.execute(String.format("GRANT USAGE ON SCHEMA public TO \"%s\"", - escapeDoubleQuote(dbUser))); - stmt.execute(String.format("GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO \"%s\"", - escapeDoubleQuote(dbUser))); - stmt.execute(String.format("GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO \"%s\"", - escapeDoubleQuote(dbUser))); - // 设置默认权限,后续新建的表也自动授权 - stmt.execute(String.format("ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO \"%s\"", - escapeDoubleQuote(dbUser))); - stmt.execute(String.format("ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO \"%s\"", - escapeDoubleQuote(dbUser))); - - log.info("PostgreSQL 用户 {} 已授权数据库 {}", dbUser, dbName); - } - } - - /** - * 构建 PostgreSQL JDBC URL - */ - private String buildJdbcUrl(String host, int port, String dbName) { - return String.format( - "jdbc:postgresql://%s:%d/%s?connectTimeout=%d&socketTimeout=%d", - host, port, - dbName != null ? dbName : "postgres", - CONNECT_TIMEOUT_MS / 1000, CONNECT_TIMEOUT_MS / 1000); - } - - /** - * 转义 SQL 字符串中的单引号 - */ - private String escapeSql(String value) { - if (value == null) { - return ""; - } - return value.replace("'", "''"); - } - - /** - * 转义双引号标识符(PostgreSQL 用双引号包裹标识符) - */ - private String escapeDoubleQuote(String value) { - if (value == null) { - return ""; - } - return value.replace("\"", "\"\""); - } - - /** - * 解析 PostgreSQL 错误信息,返回更友好的中文提示 - */ - private String parseError(SQLException e) { - String state = e.getSQLState(); - String message = e.getMessage(); - - // PostgreSQL SQLSTATE 错误码 - if ("3D000".equals(state)) { - return "数据库不存在"; - } - if ("08001".equals(state) || "08004".equals(state)) { - return "连接失败,请检查服务器地址和端口是否可达,以及 PostgreSQL 是否允许远程连接"; - } - if ("28000".equals(state)) { - return "认证失败,请检查用户名和密码(pg_hba.conf 可能需要调整认证方式)"; - } - if ("28P01".equals(state)) { - return "密码认证失败,请检查用户名和密码"; - } - if ("3F000".equals(state)) { - return "无效的目录名(schema)"; - } - if ("42000".equals(state) || "42601".equals(state)) { - return "SQL 语法错误"; - } - if ("42501".equals(state)) { - return "权限不足,当前用户无权执行此操作"; - } - if ("42P04".equals(state)) { - return "数据库已存在"; - } - if ("42P06".equals(state)) { - return "schema 已存在"; - } - if ("42723".equals(state)) { - return "用户已存在"; - } - if ("55000".equals(state) || "55006".equals(state)) { - return "无法操作,数据库正在被其他连接使用"; - } - - if (message != null) { - // PostgreSQL 错误信息通常格式为: ERROR: xxx - String cleanMsg = message.replace("ERROR: ", "").replace("FATAL: ", "").trim(); - if (cleanMsg.length() > 200) { - return cleanMsg.substring(0, 200); - } - return cleanMsg; - } - - return "未知错误: " + state; - } - - private static DatabaseOperationResult ok(String message) { - return DatabaseOperationResult.ok(message); - } - - private static DatabaseOperationResult ok(String message, String detail) { - return DatabaseOperationResult.ok(message, detail); - } - - private static DatabaseOperationResult fail(String message) { - return DatabaseOperationResult.fail(message); - } - - private static DatabaseOperationResult fail(String message, String detail) { - return DatabaseOperationResult.fail(message, detail); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/SshServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/SshServiceImpl.java deleted file mode 100644 index f99d657..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/service/impl/SshServiceImpl.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gxwebsoft.app.service.impl; - -import com.gxwebsoft.app.service.SshService; -import com.jcraft.jsch.JSch; -import com.jcraft.jsch.Session; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.Properties; - -/** - * SSH 连接测试服务实现 - * - * @author 科技小王子 - * @since 2026-04-04 - */ -@Slf4j -@Service -public class SshServiceImpl implements SshService { - - private static final int CONNECTION_TIMEOUT = 10000; // 10秒超时 - - @Override - public ConnectionResult testConnection(String host, Integer port, String username, String password) { - if (host == null || host.trim().isEmpty()) { - return ConnectionResult.fail("服务器地址不能为空"); - } - if (username == null || username.trim().isEmpty()) { - return ConnectionResult.fail("用户名不能为空"); - } - if (password == null || password.trim().isEmpty()) { - return ConnectionResult.fail("密码不能为空"); - } - - host = host.trim(); - username = username.trim(); - int sshPort = port != null ? port : 22; - - Session session = null; - try { - JSch jsch = new JSch(); - - session = jsch.getSession(username, host, sshPort); - session.setPassword(password); - - // 设置 SSH 连接属性 - Properties config = new Properties(); - config.put("StrictHostKeyChecking", "no"); // 不验证 host key - config.put("PreferredAuthentications", "password"); - session.setConfig(config); - - // 设置超时 - session.setTimeout(CONNECTION_TIMEOUT); - - // 连接 - session.connect(); - - // 获取 SSH 版本信息 - String serverVersion = session.getServerVersion(); - log.info("SSH 连接成功: host={}, port={}, user={}, version={}", host, sshPort, username, serverVersion); - - return ConnectionResult.ok( - "连接成功", - String.format("SSH %s@%s:%d 连接成功", username, host, sshPort) - ); - - } catch (Exception e) { - String errorMsg = e.getMessage(); - log.warn("SSH 连接失败: host={}, port={}, user={}, error={}", host, sshPort, username, errorMsg); - return ConnectionResult.fail("连接失败", errorMsg); - } finally { - if (session != null && session.isConnected()) { - session.disconnect(); - } - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/CICD_CONFIG_GUIDE.md b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/CICD_CONFIG_GUIDE.md deleted file mode 100644 index 25790cf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/CICD_CONFIG_GUIDE.md +++ /dev/null @@ -1,584 +0,0 @@ -# CI/CD 配置指南 - -> 本文档详细说明如何配置 Jenkins / GitHub Actions / Gitea CI 与 MP 平台集成 - ---- - -## 一、Gitea CI 配置 - -### 1.1 获取 Gitea API Token - -1. 登录 Gitea,进入 **Settings** → **Applications** -2. 在 "Access Tokens" 部分,点击 **Generate Token** -3. 输入 Token 名称(如 `mp-platform`),设置过期时间 -4. 选择权限范围: - - ✅ `repo` - 仓库访问 - - ✅ `workflow` - 工作流触发 -5. 点击 **Generate Token**,复制生成的 Token - -### 1.2 在 MP 平台配置 Gitea - -**方式一:通过数据库配置** - -```sql --- 进入数据库 -mysql -u root -p db_websopy - --- 插入 Gitea 配置 -INSERT INTO sys_config (config_key, config_value, config_name, group_name, remark, create_time) -VALUES -('gitea-url', 'https://git.websoft.top', 'Gitea 服务器地址', 'cicd', 'Gitea CI 服务器地址', NOW()), -('gitea-token', 'your-gitea-token-here', 'Gitea API Token', 'cicd', 'Gitea API 访问令牌', NOW()); -``` - -**方式二:通过配置文件** - -```yaml -# application.yml 或 application-prod.yml -config: - gitea-url: https://git.websoft.top - gitea-token: your-gitea-token-here -``` - -### 1.3 Gitea Webhook 配置(自动更新构建状态) - -1. 登录 Gitea,进入你的**仓库** → **Settings** → **Webhooks** -2. 点击 **Add Webhook** → **Gitea** -3. 配置 Webhook: - ``` - Target URL: https://your-domain.com/api/app/cicd/webhook/gitea - HTTP Method: POST - Content Type: application/json - Secret: (可选)设置一个秘钥用于校验 - Trigger On: ✅ Push - ✅ Pull Request - ✅ Workflow Run (如果可用) - ``` -4. 点击 **Add Webhook** 保存 - -### 1.4 在仓库中添加构建工作流 - -在仓库根目录创建 `.gitea/workflows/build.yml`: - -```yaml -name: Build & Deploy - -on: - workflow_dispatch: # 手动触发 - inputs: - environment: - description: '部署环境' - required: true - default: 'staging' - type: choice - options: - - staging - - production - push: - branches: [ main, develop ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install dependencies - run: npm ci - - - name: Run tests - run: npm test - - - name: Build - run: npm run build - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: dist - path: dist/ - - # Webhook 回调(通知 MP 平台构建状态) - - name: Notify MP Platform - run: | - curl -X POST ${{ secrets.MP_WEBHOOK_URL }} \ - -H "Content-Type: application/json" \ - -d '{"run_id":"${{ github.run_id }}","status":"success","conclusion":"success"}' -``` - ---- - -## 二、Jenkins 配置 - -### 2.1 安装必要插件 - -在 Jenkins 管理界面:**Manage Jenkins** → **Manage Plugins** - -安装以下插件: -- ✅ **GitHub Integration Plugin** -- ✅ **Pipeline Plugin** -- ✅ **HTTP Request Plugin** -- ✅ **Generic Webhook Trigger Plugin** - -### 2.2 配置 Jenkins API Token - -1. 登录 Jenkins,进入 **People** → 你的用户 → **Configure** -2. 在 **API Token** 部分,点击 **Add new Token** -3. 生成并复制 Token - -### 2.3 在 MP 平台配置 Jenkins - -```sql --- 插入 Jenkins 配置 -INSERT INTO sys_config (config_key, config_value, config_name, group_name, remark, create_time) -VALUES -('jenkins-url', 'https://jenkins.websoft.top', 'Jenkins 服务器地址', 'cicd', 'Jenkins CI 服务器地址', NOW()), -('jenkins-token', 'your-jenkins-api-token', 'Jenkins API Token', 'cicd', 'Jenkins API 访问令牌', NOW()), -('jenkins-username', 'admin', 'Jenkins 用户名', 'cicd', 'Jenkins 认证用户名', NOW()); -``` - -### 2.4 Jenkins Pipeline 配置 - -在 Jenkins 中创建 Pipeline Job,编写 Jenkinsfile: - -```groovy -pipeline { - agent any - - environment { - MP_WEBHOOK_URL = credentials('mp-webhook-url') - } - - stages { - stage('Checkout') { - steps { - echo 'Checking out source code...' - checkout scm - } - } - - stage('Build') { - steps { - echo 'Building application...' - sh ''' - npm ci - npm run build - ''' - } - } - - stage('Test') { - steps { - echo 'Running tests...' - sh 'npm test || true' - } - } - - stage('Notify MP Platform') { - steps { - script { - def buildStatus = currentBuild.result ?: 'SUCCESS' - def status = buildStatus == 'SUCCESS' ? 'success' : 'failed' - - // 通知 MP 平台构建状态 - httpRequest( - url: "${MP_WEBHOOK_URL}", - httpMode: 'POST', - contentType: 'APPLICATION_JSON', - requestBody: """ - { - "jenkins_job": "${env.JOB_NAME}", - "build_number": ${env.BUILD_NUMBER}, - "status": "${status}", - "build_url": "${env.BUILD_URL}" - } - """ - ) - } - } - } - - stage('Deploy') { - when { - branch 'main' - } - steps { - echo 'Deploying to production...' - // 添加你的部署脚本 - } - } - } - - post { - always { - echo 'Pipeline execution completed' - } - success { - echo 'Build succeeded!' - } - failure { - echo 'Build failed!' - } - } -} -``` - -### 2.5 Jenkins Webhook 配置 - -1. 进入 Job 配置 → **Build Triggers** -2. 勾选 **Trigger builds remotely**(或使用 GitHub Integration) -3. 设置认证 Token -4. 配置 GitHub Webhook 指向 Jenkins - -### 2.6 Jenkinsfile 仓库示例 - -``` -your-repo/ -├── Jenkinsfile -├── package.json -└── src/ -``` - ---- - -## 三、GitHub Actions 配置 - -### 3.1 创建 GitHub Personal Access Token - -1. 登录 GitHub → **Settings** → **Developer settings** -2. **Personal access tokens** → **Fine-grained tokens** -3. 点击 **Generate new token** -4. 配置 Token: - - **Token name**: `mp-platform-cicd` - - **Expiration**: 自定义 - - **Repository access**: 选择你的仓库 - - **Permissions**: - - ✅ `actions: read and write` - - ✅ `contents: read` - - ✅ `workflows: read and write` - -### 3.2 在 MP 平台配置 GitHub - -```sql --- 插入 GitHub 配置 -INSERT INTO sys_config (config_key, config_value, config_name, group_name, remark, create_time) -VALUES -('github-api-url', 'https://api.github.com', 'GitHub API 地址', 'cicd', 'GitHub API 服务器地址', NOW()), -('github-token', 'your-github-pat-token', 'GitHub API Token', 'cicd', 'GitHub Personal Access Token', NOW()), -('github-owner', 'your-github-username', 'GitHub 仓库所有者', 'cicd', 'GitHub 用户名或组织名', NOW()); -``` - -### 3.3 GitHub Webhook 配置 - -1. 进入 GitHub 仓库 → **Settings** → **Webhooks** -2. 点击 **Add webhook** -3. 配置: - ``` - Payload URL: https://your-domain.com/api/app/cicd/webhook/github - Content type: application/json - Secret: (可选)设置 Webhook Secret - SSL verification: Enable - Events: ✅ Push - ✅ Pull requests - ✅ Workflow runs - ``` -4. 点击 **Add webhook** - -### 3.4 添加 GitHub Actions 工作流 - -在仓库创建 `.github/workflows/build.yml`: - -```yaml -name: CI/CD Pipeline - -on: - workflow_dispatch: # 手动触发 - inputs: - environment: - description: '部署环境' - required: true - default: 'staging' - type: choice - options: - - staging - - production - push: - branches: [ main, develop ] - pull_request: - branches: [ main ] - -env: - MP_WEBHOOK_URL: ${{ secrets.MP_WEBHOOK_URL }} - -jobs: - build: - runs-on: ubuntu-latest - outputs: - status: ${{ job.status }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Lint - run: npm run lint - - - name: Run tests - run: npm test - continue-on-error: false - - - name: Build - run: npm run build - env: - NODE_ENV: production - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: dist-${{ github.sha }} - path: dist/ - retention-days: 7 - - - name: Notify MP Platform - Started - if: always() - run: | - curl -X POST "${{ env.MP_WEBHOOK_URL }}" \ - -H "Content-Type: application/json" \ - -d '{ - "event": "workflow_run", - "action": "started", - "workflow": "${{ github.workflow }}", - "run_id": "${{ github.run_id }}", - "sha": "${{ github.sha }}", - "status": "running" - }' - - - name: Notify MP Platform - Completed - if: always() - run: | - curl -X POST "${{ env.MP_WEBHOOK_URL }}" \ - -H "Content-Type: application/json" \ - -d '{ - "event": "workflow_run", - "action": "completed", - "workflow": "${{ github.workflow }}", - "run_id": "${{ github.run_id }}", - "sha": "${{ github.sha }}", - "status": "${{ job.status }}", - "conclusion": "${{ job.status == '\''success'\'' && '\''success'\'' || '\''failure'\'' }}" - }' - - deploy-staging: - needs: build - if: github.ref == 'refs/heads/develop' - runs-on: ubuntu-latest - steps: - - name: Deploy to Staging - run: | - echo "Deploying to staging..." - # 添加你的部署脚本 - - deploy-production: - needs: build - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - name: dist-${{ github.sha }} - - - name: Deploy to Production - run: | - echo "Deploying to production..." - # 添加你的部署脚本 -``` - -### 3.5 配置 GitHub Secrets - -在 GitHub 仓库 **Settings** → **Secrets and variables** → **Actions** 中添加: - -| Secret Name | Value | -|-------------|-------| -| `MP_WEBHOOK_URL` | `https://your-domain.com/api/app/cicd/webhook/github` | -| `DEPLOY_TOKEN` | 部署服务器 SSH 密钥(可选) | - ---- - -## 四、流水线配置示例 - -### 4.1 Gitea CI 流水线配置 - -在 MP 平台创建流水线时: - -```json -{ - "name": "前端应用构建", - "ciType": "gitea", - "repoFullName": "owner/repository", - "defaultBranch": "main", - "workflowFile": "build.yml", - "enabled": true, - "autoTrigger": true, - "buildConfig": { - "dockerfile": "Dockerfile", - "imageName": "myapp:latest", - "registry": "registry.websoft.top" - } -} -``` - -### 4.2 Jenkins 流水线配置 - -```json -{ - "name": "Jenkins Node.js 构建", - "ciType": "jenkins", - "jenkinsJobName": "myapp-build", - "jenkinsBuildParams": { - "BRANCH": "main", - "ENVIRONMENT": "staging" - }, - "enabled": true, - "autoTrigger": false -} -``` - -### 4.3 GitHub Actions 流水线配置 - -```json -{ - "name": "GitHub Actions 构建", - "ciType": "github", - "repoFullName": "owner/repository", - "workflowFile": "build.yml", - "defaultBranch": "main", - "enabled": true, - "autoTrigger": true -} -``` - ---- - -## 五、Webhook 回调格式 - -### 5.1 Gitea Webhook 格式 - -```json -{ - "action": "run", - "仓库": { - "full_name": "owner/repo" - }, - "sender": { - "login": "username" - }, - "workflow_run": { - "id": 123456, - "run_number": 42, - "status": "completed", - "conclusion": "success" - } -} -``` - -### 5.2 Jenkins Webhook 格式 - -```json -{ - "jenkins_job": "myapp-build", - "build_number": 156, - "status": "success", - "build_url": "https://jenkins.websoft.top/job/myapp-build/156/", - "timestamp": 1712123456789 -} -``` - -### 5.3 GitHub Actions Webhook 格式 - -```json -{ - "event": "workflow_run", - "action": "completed", - "workflow": "CI/CD Pipeline", - "run_id": 12345678, - "sha": "abc123def456", - "status": "completed", - "conclusion": "success" -} -``` - ---- - -## 六、常见问题排查 - -### 6.1 构建状态不更新 - -1. 检查 Webhook 是否正确配置 -2. 验证 Webhook URL 可访问性 -3. 查看后端日志: - ```bash - tail -f logs/app.log | grep -i webhook - ``` - -### 6.2 触发构建失败 - -1. 确认 API Token 有效且有足够权限 -2. 检查 Token 是否已写入数据库配置 -3. 验证仓库名称和分支是否正确 - -### 6.3 跨域/CORS 问题 - -如果前端直接调用 CI API,确保: -- CI 服务器已配置 CORS 白名单 -- 或通过后端代理转发请求 - ---- - -## 七、安全建议 - -1. **Token 安全** - - 使用环境变量而非代码中硬编码 - - 定期轮换 Token - - 使用最小权限原则 - -2. **Webhook 安全** - - 设置 Webhook Secret - - 在后端验证签名 - -3. **访问控制** - - 限制谁可以触发构建 - - 不同环境使用不同认证 - ---- - -## 八、相关文件 - -| 文件 | 说明 | -|------|------| -| `CICDController.java` | CI/CD API 控制器 | -| `AppBuildServiceImpl.java` | 构建服务实现 | -| `AppPipelineServiceImpl.java` | 流水线服务实现 | -| `app_build.sql` | 构建记录表 | -| `app_pipeline.sql` | 流水线配置表 | - ---- - -*最后更新:2026-04-03* diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/README_CICD.md b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/README_CICD.md deleted file mode 100644 index b2265ee..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/README_CICD.md +++ /dev/null @@ -1,154 +0,0 @@ -# CI/CD 功能说明 - -## 概述 - -CI/CD 模块提供完整的持续集成和持续部署功能,支持对接 Gitea CI / Jenkins / GitHub Actions。 - -## 数据库表 - -### app_pipeline - 流水线配置表 - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | BIGINT | 自增ID | -| app_id | BIGINT | 关联应用ID | -| name | VARCHAR(200) | 流水线名称 | -| ci_type | VARCHAR(20) | CI系统类型: gitea/jenkins/github | -| repo_full_name | VARCHAR(200) | 仓库全称(如 gxwebsoft/my-app) | -| workflow_file | VARCHAR(100) | 工作流文件名 | -| env | VARCHAR(50) | 环境: development/staging/production | -| default_branch | VARCHAR(100) | 默认触发分支 | -| enabled | TINYINT | 是否启用 | -| auto_deploy | TINYINT | 自动部署 | -| timeout | INT | 超时时间(秒) | -| success_count | INT | 成功次数 | -| failure_count | INT | 失败次数 | - -### app_build - 构建记录表 - -| 字段 | 类型 | 说明 | -|------|------|------| -| id | BIGINT | 自增ID | -| app_id | BIGINT | 关联应用ID | -| build_number | VARCHAR(100) | 构建编号 | -| branch | VARCHAR(100) | 触发分支 | -| ci_type | VARCHAR(20) | CI系统类型 | -| status | VARCHAR(20) | 状态: pending/running/success/failed/cancelled | -| started_at | DATETIME | 开始时间 | -| finished_at | DATETIME | 结束时间 | -| duration | INT | 耗时(秒) | -| log_url | VARCHAR(500) | 日志URL | -| artifact_url | VARCHAR(500) | 产物URL | -| trigger_type | VARCHAR(20) | 触发方式: manual/webhook/schedule | - -## API 接口 - -### 流水线 API - -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | /api/app/cicd/pipeline/page | 分页查询流水线 | -| GET | /api/app/cicd/pipeline/app/{appId} | 查询应用的所有流水线 | -| GET | /api/app/cicd/pipeline/{id} | 查询流水线详情 | -| POST | /api/app/cicd/pipeline | 创建流水线 | -| PUT | /api/app/cicd/pipeline | 更新流水线 | -| DELETE | /api/app/cicd/pipeline/{id} | 删除流水线 | -| POST | /api/app/cicd/pipeline/{id}/toggle | 启用/禁用流水线 | -| GET | /api/app/cicd/pipeline/{id}/status | 获取流水线状态 | - -### 构建 API - -| 方法 | 路径 | 说明 | -|------|------|------| -| GET | /api/app/cicd/build/page | 分页查询构建记录 | -| GET | /api/app/cicd/build/app/{appId} | 查询应用的所有构建 | -| GET | /api/app/cicd/build/{id} | 查询构建详情 | -| GET | /api/app/cicd/build/latest/{appId} | 获取应用最新构建 | -| POST | /api/app/cicd/build/trigger | 触发构建 | -| GET | /api/app/cicd/build/{id}/log | 获取构建日志 | -| POST | /api/app/cicd/build/{id}/cancel | 取消构建 | -| POST | /api/app/cicd/build/{id}/retry | 重试构建 | -| GET | /api/app/cicd/build/stats/{appId} | 获取构建统计 | - -### Webhook API - -| 方法 | 路径 | 说明 | -|------|------|------| -| POST | /api/app/cicd/webhook/gitea | Gitea Webhook 回调 | - -## 前端页面 - -- `/developer/build` - 构建任务页面 -- `/developer/pipeline` - 流水线管理页面 - -## 安装步骤 - -1. 执行 SQL 创建表: - ```bash - mysql -u root -p db_websopy < app/sql/app_pipeline.sql - mysql -u root -p db_websopy < app/sql/app_build.sql - ``` - -2. 配置 Gitea API(可选): - ```properties - config.gitea-url=https://git.websoft.top - config.gitea-token=your-gitea-token - ``` - -3. 配置 Webhook(在 Gitea 中配置): - ``` - URL: https://your-domain/api/app/cicd/webhook/gitea - Content-Type: application/json - Events: Push, Pull Request - ``` - -## Gitea Actions 配置 - -在仓库中创建 `.gitea/workflows/build.yml`: - -```yaml -name: Build and Deploy - -on: - push: - branches: [ main, develop ] - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install dependencies - run: npm ci - - - name: Build - run: npm run build - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: dist - path: dist/ - - deploy: - needs: build - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - steps: - - name: Deploy to server - run: echo "Deploying..." -``` - -## 注意事项 - -1. 构建记录需要关联应用才能触发构建 -2. 触发构建前需要先配置流水线 -3. Webhook 回调需要在 CI 系统中配置才能自动更新构建状态 -4. 支持 Jenkins/GitHub Actions 的 Webhook 回调可扩展 diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/README_PERMISSION_REQUEST.md b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/README_PERMISSION_REQUEST.md deleted file mode 100644 index a0b9219..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/README_PERMISSION_REQUEST.md +++ /dev/null @@ -1,170 +0,0 @@ -# 权限申请模块说明 - -## 概述 -权限申请模块(Permission Requests)允许开发者申请访问特定的 Git 仓库。 - -## 数据库表 - -### 1. app_permission_request -存储权限申请记录。 - -**字段说明:** -- `id`: 自增主键 -- `user_id`: 申请用户ID -- `git_username`: Git用户名 -- `repo`: 申请仓库路径(如:owner/repo-name) -- `repo_name`: 仓库名称 -- `reason`: 申请理由 -- `status`: 状态(pending待审核/approved已通过/rejected已拒绝) -- `reject_reason`: 拒绝原因 -- `reviewer_id`: 审核人用户ID -- `reviewer_name`: 审核人姓名 -- `reviewed_at`: 审核时间 -- `create_time`: 创建时间 -- `update_time`: 更新时间 -- `deleted`: 逻辑删除标识 - -### 2. app_repository -存储可用仓库列表。 - -**字段说明:** -- `id`: 自增主键 -- `path`: 仓库路径(唯一) -- `name`: 仓库名称 -- `description`: 仓库描述 -- `access_level`: 访问权限级别(read/write/admin) -- `status`: 状态(active/inactive) -- `create_time`: 创建时间 -- `update_time`: 更新时间 -- `deleted`: 逻辑删除标识 - -## API 接口 - -### 1. 获取权限申请列表 -``` -GET /api/app/developer/permission-requests -参数: -- page: 页码(默认1) -- size: 每页大小(默认20) -- status: 状态筛选(pending/approved/rejected) - -返回: -{ - "code": 200, - "message": "success", - "data": { - "records": [...], - "total": 10 - } -} -``` - -### 2. 获取权限申请统计 -``` -GET /api/app/developer/permission-requests/stats - -返回: -{ - "code": 200, - "message": "success", - "data": { - "total": 10, - "pending": 3, - "approved": 5, - "rejected": 2 - } -} -``` - -### 3. 提交权限申请 -``` -POST /api/app/developer/permission-requests -请求体: -{ - "repo": "owner/repo-name", - "reason": "申请理由", - "gitUsername": "git-username"(可选) -} - -返回: -{ - "code": 200, - "message": "申请提交成功,请等待审核", - "data": { - "id": 1, - "repo": "owner/repo-name", - "repoName": "repo-name", - "reason": "申请理由", - "status": "pending", - "createdAt": "2026-04-03 10:00:00" - } -} -``` - -### 4. 获取可申请的仓库列表 -``` -GET /api/app/developer/permission-requests/available-repos - -返回: -{ - "code": 200, - "message": "success", - "data": [ - { - "value": "owner/repo-name", - "label": "仓库名称", - "description": "仓库描述", - "accessLevel": "read", - "isAccessible": false - } - ] -} -``` - -### 5. 审核通过(管理员功能) -``` -PUT /api/app/developer/permission-requests/{id}/approve -请求体: -{ - "note": "审核备注"(可选) -} -``` - -### 6. 拒绝申请(管理员功能) -``` -PUT /api/app/developer/permission-requests/{id}/reject -请求体: -{ - "reason": "拒绝原因" -} -``` - -## 前端页面 - -路径:`/developer/requests` - -功能: -1. 查看权限申请记录列表 -2. 按状态筛选申请(全部/待审核/已通过/已拒绝) -3. 查看统计数据(全部/待审核/已通过/已拒绝) -4. 提交新的仓库访问申请 -5. 查看申请详情(仓库、理由、审核人、审核时间等) - -## 注意事项 - -1. 同一用户对同一仓库只能有一个待审核的申请 -2. 已拥有访问权限的仓库不能重复申请 -3. 审核人可以批准或拒绝申请 -4. 拒绝时必须填写拒绝原因 - -## 安装步骤 - -1. 执行 SQL 文件创建数据库表: - ```bash - mysql -u root -p database_name < src/main/java/com/gxwebsoft/app/sql/app_permission_request.sql - mysql -u root -p database_name < src/main/java/com/gxwebsoft/app/sql/app_repository.sql - ``` - -2. 重启后端服务 - -3. 访问前端页面 `/developer/requests` 进行测试 diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_api_key.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_api_key.sql deleted file mode 100644 index c0022f1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_api_key.sql +++ /dev/null @@ -1,28 +0,0 @@ --- ============================================= --- 开发者 API Key 表 --- @author 科技小王子 --- @since 2026-04-02 --- ============================================= - -CREATE TABLE IF NOT EXISTS `app_api_key` ( - `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `name` VARCHAR(100) NOT NULL COMMENT 'API Key名称', - `api_key` VARCHAR(255) NOT NULL COMMENT 'API Key密钥值(加密存储)', - `key_prefix` VARCHAR(20) NOT NULL COMMENT '密钥前缀(用于显示,如 sk-xxxxx)', - `status` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '状态: 0正常, 1禁用', - `scopes` TEXT COMMENT '权限范围,JSON数组字符串', - `expire_time` DATETIME DEFAULT NULL COMMENT '到期时间,NULL=永不过期', - `last_used_at` DATETIME DEFAULT NULL COMMENT '最后使用时间', - `usage_count` BIGINT DEFAULT 0 COMMENT '使用次数', - `remark` VARCHAR(500) DEFAULT NULL COMMENT '备注', - `deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除, 0否, 1是', - `user_id` INT NOT NULL COMMENT '用户ID', - `tenant_id` INT NOT NULL COMMENT '租户ID', - `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_tenant_id` (`tenant_id`), - KEY `idx_status` (`status`), - KEY `idx_deleted` (`deleted`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='开发者API密钥表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_article.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_article.sql deleted file mode 100644 index c78dde1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_article.sql +++ /dev/null @@ -1,38 +0,0 @@ --- ============================================= --- 平台文章表 - SQL 建表脚本 --- 数据库: db_websopy --- ============================================= - -DROP TABLE IF EXISTS app_article; - -CREATE TABLE app_article ( - article_id INT PRIMARY KEY AUTO_INCREMENT COMMENT '文章ID', - title VARCHAR(200) NOT NULL COMMENT '文章标题', - type TINYINT DEFAULT 0 COMMENT '文章类型 0常规 1视频', - model VARCHAR(40) DEFAULT 'article' COMMENT '文章模型 article 普通文章 announcement 公告', - code VARCHAR(80) DEFAULT NULL COMMENT '文章编号', - category_id INT DEFAULT NULL COMMENT '分类ID', - image VARCHAR(500) DEFAULT NULL COMMENT '封面图', - source VARCHAR(120) DEFAULT NULL COMMENT '来源', - overview VARCHAR(500) DEFAULT NULL COMMENT '摘要', - content LONGTEXT COMMENT '正文内容', - actual_views INT DEFAULT 0 COMMENT '实际阅读量', - likes INT DEFAULT 0 COMMENT '点赞数', - user_id INT DEFAULT NULL COMMENT '创建用户ID', - author VARCHAR(80) DEFAULT NULL COMMENT '作者', - recommend TINYINT DEFAULT 0 COMMENT '是否推荐 0否 1是', - sort_number INT DEFAULT 0 COMMENT '排序值', - status TINYINT DEFAULT 1 COMMENT '状态 0已发布 1草稿/待审核 2已驳回 3违规', - deleted TINYINT DEFAULT 0 COMMENT '是否删除 0否 1是', - tenant_id INT DEFAULT NULL COMMENT '租户ID', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - UNIQUE KEY uk_code (code), - KEY idx_model (model), - KEY idx_category_id (category_id), - KEY idx_status (status), - KEY idx_recommend (recommend), - KEY idx_sort_number (sort_number), - KEY idx_tenant_id (tenant_id), - KEY idx_create_time (create_time) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台文章表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_article_category.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_article_category.sql deleted file mode 100644 index f4f4c9c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_article_category.sql +++ /dev/null @@ -1,32 +0,0 @@ --- ============================================= --- 平台文章分类表 - SQL 建表脚本 --- 数据库: db_websopy --- ============================================= - -DROP TABLE IF EXISTS app_article_category; - -CREATE TABLE app_article_category ( - category_id INT PRIMARY KEY AUTO_INCREMENT COMMENT '分类ID', - category_code VARCHAR(60) DEFAULT NULL COMMENT '分类标识', - title VARCHAR(80) NOT NULL COMMENT '分类名称', - type TINYINT DEFAULT 0 COMMENT '类型 0列表 1单页 2外链', - image VARCHAR(500) DEFAULT NULL COMMENT '分类图片', - parent_id INT DEFAULT 0 COMMENT '上级分类ID', - path VARCHAR(255) DEFAULT NULL COMMENT '访问路径', - user_id INT DEFAULT NULL COMMENT '创建用户ID', - sort_number INT DEFAULT 0 COMMENT '排序值', - comments VARCHAR(255) DEFAULT NULL COMMENT '备注', - hide TINYINT DEFAULT 0 COMMENT '是否隐藏 0否 1是', - recommend TINYINT DEFAULT 0 COMMENT '是否推荐 0否 1是', - show_index TINYINT DEFAULT 0 COMMENT '是否首页显示 0否 1是', - status TINYINT DEFAULT 0 COMMENT '状态 0正常 1禁用', - deleted TINYINT DEFAULT 0 COMMENT '是否删除 0否 1是', - tenant_id INT DEFAULT NULL COMMENT '租户ID', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - UNIQUE KEY uk_tenant_category_code (tenant_id, category_code), - KEY idx_parent_id (parent_id), - KEY idx_status (status), - KEY idx_sort_number (sort_number), - KEY idx_tenant_id (tenant_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台文章分类表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_build.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_build.sql deleted file mode 100644 index 24ac5f5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_build.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ============================================= --- CI/CD 构建记录表 --- ============================================= -CREATE TABLE IF NOT EXISTS `app_build` ( - `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '自增ID', - `app_id` BIGINT NOT NULL COMMENT '关联应用ID', - `version_id` BIGINT DEFAULT NULL COMMENT '关联版本ID(可选)', - `build_number` VARCHAR(100) DEFAULT NULL COMMENT '构建编号(如 run-123)', - `name` VARCHAR(200) DEFAULT NULL COMMENT '构建名称', - `branch` VARCHAR(100) DEFAULT NULL COMMENT '触发分支(如 main、develop)', - `commit_sha` VARCHAR(100) DEFAULT NULL COMMENT '提交哈希', - `commit_message` TEXT DEFAULT NULL COMMENT '提交消息', - `commit_author` VARCHAR(100) DEFAULT NULL COMMENT '提交作者', - `ci_type` VARCHAR(20) DEFAULT 'gitea' COMMENT 'CI系统类型: gitea/jenkins/github', - `ci_job_id` VARCHAR(100) DEFAULT NULL COMMENT 'CI系统中的任务ID', - `ci_run_id` VARCHAR(100) DEFAULT NULL COMMENT 'CI系统中的运行ID', - `ci_api_url` VARCHAR(500) DEFAULT NULL COMMENT 'CI系统API地址', - `status` VARCHAR(20) DEFAULT 'pending' COMMENT '状态: pending/running/success/failed/cancelled', - `started_at` DATETIME DEFAULT NULL COMMENT '构建开始时间', - `finished_at` DATETIME DEFAULT NULL COMMENT '构建结束时间', - `duration` INT DEFAULT NULL COMMENT '构建耗时(秒)', - `log_url` VARCHAR(500) DEFAULT NULL COMMENT '构建日志URL', - `artifact_url` VARCHAR(500) DEFAULT NULL COMMENT '构建产物URL', - `artifact_name` VARCHAR(200) DEFAULT NULL COMMENT '构建产物名称', - `artifact_size` BIGINT DEFAULT NULL COMMENT '构建产物大小(字节)', - `error_message` TEXT DEFAULT NULL COMMENT '失败原因', - `trigger_type` VARCHAR(20) DEFAULT 'manual' COMMENT '触发方式: manual/webhook/schedule', - `triggered_by` INT DEFAULT NULL COMMENT '触发人用户ID', - `config` TEXT DEFAULT NULL COMMENT '扩展配置(JSON)', - `user_id` INT DEFAULT NULL COMMENT '用户ID', - `tenant_id` INT DEFAULT NULL COMMENT '租户id', - `deleted` TINYINT DEFAULT 0 COMMENT '逻辑删除标记', - `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - KEY `idx_app_id` (`app_id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_status` (`status`), - KEY `idx_create_time` (`create_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='CI/CD构建记录表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_cloud_credential.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_cloud_credential.sql deleted file mode 100644 index 37495f6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_cloud_credential.sql +++ /dev/null @@ -1,23 +0,0 @@ --- 云账号凭证表 --- 用于存储用户的阿里云/腾讯云/华为云/七牛云等云账号凭证 --- @author 科技小王子 --- @since 2026-04-04 - -CREATE TABLE `app_cloud_credential` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID', - `provider` varchar(20) NOT NULL COMMENT '云服务商: aliyun/tencent/huawei/qiniu', - `name` varchar(50) NOT NULL COMMENT '凭证名称', - `access_key_id` varchar(100) DEFAULT NULL COMMENT '访问密钥ID(AK)', - `access_key_secret` varchar(200) DEFAULT NULL COMMENT '访问密钥密钥(SK),AES加密存储', - `config_json` text COMMENT '额外配置,JSON格式', - `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态: 0正常 1冻结', - `remark` varchar(200) DEFAULT NULL COMMENT '备注', - `user_id` int NOT NULL COMMENT '所属用户ID', - `tenant_id` int DEFAULT NULL COMMENT '租户ID', - `deleted` tinyint NOT NULL DEFAULT '0' COMMENT '是否删除: 0否 1是', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - PRIMARY KEY (`id`), - KEY `idx_provider_user` (`provider`, `user_id`), - KEY `idx_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='云账号凭证'; \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_cloud_credential_add_test_fields.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_cloud_credential_add_test_fields.sql deleted file mode 100644 index 0060879..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_cloud_credential_add_test_fields.sql +++ /dev/null @@ -1,10 +0,0 @@ --- 云账号凭证表添加测试状态字段 --- @since 2026-04-05 - --- 添加 test_status 字段(默认 0: 未测试) -ALTER TABLE `app_cloud_credential` -ADD COLUMN `test_status` tinyint DEFAULT 0 COMMENT '测试状态: 0未测试 1成功 2失败'; - --- 添加 test_message 字段 -ALTER TABLE `app_cloud_credential` -ADD COLUMN `test_message` varchar(500) DEFAULT NULL COMMENT '测试消息'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_contract.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_contract.sql deleted file mode 100644 index a3939cd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_contract.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ---------------------------- --- 合同管理表 --- 用户在控制台查看和管理合同文件 --- ---------------------------- -CREATE TABLE IF NOT EXISTS `app_contract` ( - `contract_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '合同ID', - `contract_no` VARCHAR(50) NOT NULL COMMENT '合同编号(HT-yyyyMMdd-XXXX)', - `title` VARCHAR(200) NOT NULL COMMENT '合同名称', - `contract_type` VARCHAR(20) NOT NULL DEFAULT 'service' COMMENT '合同类型: service/cooperation/purchase/other', - `party_a` VARCHAR(100) DEFAULT NULL COMMENT '甲方名称', - `party_b` VARCHAR(100) DEFAULT NULL COMMENT '乙方名称', - `amount` DECIMAL(15,2) NOT NULL DEFAULT 0.00 COMMENT '合同金额', - `start_date` DATE DEFAULT NULL COMMENT '合同开始日期', - `end_date` DATE DEFAULT NULL COMMENT '合同结束日期', - `status` VARCHAR(20) NOT NULL DEFAULT 'draft' COMMENT '状态: draft/pending/active/expired/terminated', - `file_url` VARCHAR(500) DEFAULT NULL COMMENT '合同附件URL', - `file_name` VARCHAR(200) DEFAULT NULL COMMENT '合同附件原始文件名', - `remark` VARCHAR(500) DEFAULT NULL COMMENT '备注', - `user_id` INT NOT NULL COMMENT '创建用户ID', - `user_name` VARCHAR(50) DEFAULT NULL COMMENT '创建用户名(冗余)', - `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT '是否删除: 0否 1是', - `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `tenant_id` INT DEFAULT NULL COMMENT '租户ID', - - PRIMARY KEY (`contract_id`), - UNIQUE KEY `uk_contract_no` (`contract_no`), - KEY `idx_user_id` (`user_id`), - KEY `idx_status` (`status`), - KEY `idx_contract_type` (`contract_type`), - KEY `idx_tenant_id` (`tenant_id`), - KEY `idx_deleted` (`deleted`), - KEY `idx_create_time` (`create_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='合同管理表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_git_account.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_git_account.sql deleted file mode 100644 index b22307a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_git_account.sql +++ /dev/null @@ -1,21 +0,0 @@ --- ---------------------------- --- Git账号绑定表(开发者Gitea账号) --- ---------------------------- -DROP TABLE IF EXISTS `app_git_account`; -CREATE TABLE `app_git_account` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增ID', - `user_id` bigint NOT NULL COMMENT '用户ID', - `tenant_id` int NOT NULL COMMENT '租户ID', - `username` varchar(50) NOT NULL COMMENT 'Gitea用户名(唯一)', - `email` varchar(100) DEFAULT NULL COMMENT '联系邮箱', - `remark` varchar(500) DEFAULT NULL COMMENT '备注', - `status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '状态: pending待审核/verified已通过/rejected已拒绝', - `verification_note` varchar(500) DEFAULT NULL COMMENT '审核备注', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` tinyint NOT NULL DEFAULT '0' COMMENT '是否删除, 0否, 1是', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_user_id` (`user_id`, `tenant_id`), - KEY `idx_username` (`username`), - KEY `idx_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Git账号绑定(开发者Gitea账号)'; \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_invite_permission.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_invite_permission.sql deleted file mode 100644 index 73b3464..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_invite_permission.sql +++ /dev/null @@ -1,77 +0,0 @@ --- ============================================ --- 应用成员邀请权限配置 --- 在 gxwebsoft_core 数据库执行 --- ============================================ - --- 1. 添加菜单(如果还没有) -INSERT INTO `sys_menu` ( - `menu_name`, - `menu_type`, - `parent_id`, - `sort_number`, - `authority`, - `path`, - `component`, - `icon`, - `status`, - `create_time` -) SELECT - '邀请成员', - 3, - (SELECT menu_id FROM sys_menu WHERE authority = 'app:appUser' LIMIT 1), - 4, - 'app:appUser:invite', - NULL, - NULL, - NULL, - 0, - NOW() -WHERE NOT EXISTS ( - SELECT 1 FROM sys_menu WHERE authority = 'app:appUser:invite' -); - --- 2. 给超级管理员角色分配权限 -INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) -SELECT - 1, - menu_id -FROM `sys_menu` -WHERE `authority` = 'app:appUser:invite' - AND NOT EXISTS ( - SELECT 1 FROM `sys_role_menu` - WHERE `role_id` = 1 AND `menu_id` = ( - SELECT menu_id FROM sys_menu WHERE authority = 'app:appUser:invite' - ) - ); - --- 3. 给开发者角色分配权限(假设角色ID为 2 或 3,根据实际情况调整) --- 先查询开发者角色的ID --- SELECT role_id FROM sys_role WHERE role_name LIKE '%开发者%' OR role_name LIKE '%developer%'; - --- 如果开发者角色ID是 2: -INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) -SELECT - 2, - menu_id -FROM `sys_menu` -WHERE `authority` = 'app:appUser:invite' - AND NOT EXISTS ( - SELECT 1 FROM `sys_role_menu` - WHERE `role_id` = 2 AND `menu_id` = ( - SELECT menu_id FROM sys_menu WHERE authority = 'app:appUser:invite' - ) - ); - --- 如果开发者角色ID是 3: -INSERT INTO `sys_role_menu` (`role_id`, `menu_id`) -SELECT - 3, - menu_id -FROM `sys_menu` -WHERE `authority` = 'app:appUser:invite' - AND NOT EXISTS ( - SELECT 1 FROM `sys_role_menu` - WHERE `role_id` = 3 AND `menu_id` = ( - SELECT menu_id FROM sys_menu WHERE authority = 'app:appUser:invite' - ) - ); diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_invite_token.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_invite_token.sql deleted file mode 100644 index b4b4e5f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_invite_token.sql +++ /dev/null @@ -1,19 +0,0 @@ --- 应用邀请Token表 -CREATE TABLE IF NOT EXISTS `app_invite_token` ( - `id` INT NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `token` VARCHAR(64) NOT NULL COMMENT '邀请token', - `app_id` INT NOT NULL COMMENT '应用ID', - `role` VARCHAR(20) NOT NULL COMMENT '邀请角色', - `inviter_id` INT NOT NULL COMMENT '邀请人ID', - `expire_time` DATETIME NOT NULL COMMENT '过期时间', - `status` TINYINT DEFAULT 0 COMMENT '状态:0-未使用,1-已使用', - `accept_user_id` INT DEFAULT NULL COMMENT '接受人ID', - `accept_time` DATETIME DEFAULT NULL COMMENT '接受时间', - `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_token` (`token`), - KEY `idx_app_id` (`app_id`), - KEY `idx_inviter_id` (`inviter_id`), - KEY `idx_expire_time` (`expire_time`), - KEY `idx_status` (`status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用邀请Token表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_notification.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_notification.sql deleted file mode 100644 index 89b0880..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_notification.sql +++ /dev/null @@ -1,29 +0,0 @@ --- ---------------------------- --- 站内消息通知表 --- 支持工单、审核、系统、资源、权限、成员、账单等通知类型 --- ---------------------------- -CREATE TABLE IF NOT EXISTS `app_notification` ( - `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '通知ID', - `user_id` INT NOT NULL COMMENT '接收用户ID', - `type` VARCHAR(20) NOT NULL DEFAULT 'system' COMMENT '通知类型: ticket/review/system/resource/permission/member/payment', - `title` VARCHAR(200) NOT NULL COMMENT '通知标题', - `content` VARCHAR(500) DEFAULT NULL COMMENT '通知内容摘要', - `is_read` TINYINT NOT NULL DEFAULT 0 COMMENT '是否已读: 0未读 1已读', - `ref_id` BIGINT DEFAULT NULL COMMENT '关联业务ID(如工单ID、权限申请ID等)', - `ref_type` VARCHAR(30) DEFAULT NULL COMMENT '关联业务类型(如 ticket、permission_request 等)', - `link_url` VARCHAR(500) DEFAULT NULL COMMENT '跳转链接', - `sender_id` INT DEFAULT 0 COMMENT '发送者ID(系统通知为0)', - `sender_name` VARCHAR(50) DEFAULT NULL COMMENT '发送者名称', - `sender_avatar` VARCHAR(500) DEFAULT NULL COMMENT '发送者头像', - `tenant_id` INT DEFAULT NULL COMMENT '租户ID', - `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间(标记已读时间)', - - PRIMARY KEY (`id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_user_read` (`user_id`, `is_read`), - KEY `idx_type` (`type`), - KEY `idx_ref` (`ref_type`, `ref_id`), - KEY `idx_tenant_id` (`tenant_id`), - KEY `idx_create_time` (`create_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='站内消息通知表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_permission_request.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_permission_request.sql deleted file mode 100644 index 11fdca4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_permission_request.sql +++ /dev/null @@ -1,23 +0,0 @@ --- 权限申请记录表(开发者Git仓库访问申请) -CREATE TABLE IF NOT EXISTS `app_permission_request` ( - `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID', - `user_id` INT(11) NOT NULL COMMENT '用户ID', - `git_username` VARCHAR(100) DEFAULT NULL COMMENT 'Git用户名', - `repo` VARCHAR(255) NOT NULL COMMENT '申请仓库路径', - `repo_name` VARCHAR(255) DEFAULT NULL COMMENT '仓库名称', - `reason` TEXT COMMENT '申请理由', - `status` VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT '状态: pending待审核/approved已通过/rejected已拒绝', - `reject_reason` TEXT COMMENT '拒绝原因', - `reviewer_id` INT(11) DEFAULT NULL COMMENT '审核人用户ID', - `reviewer_name` VARCHAR(100) DEFAULT NULL COMMENT '审核人姓名', - `reviewed_at` DATETIME DEFAULT NULL COMMENT '审核时间', - `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除, 0否, 1是', - PRIMARY KEY (`id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_repo` (`repo`), - KEY `idx_status` (`status`), - KEY `idx_create_time` (`create_time`), - KEY `idx_user_status` (`user_id`, `status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='权限申请记录表(开发者Git仓库访问申请)'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_pipeline.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_pipeline.sql deleted file mode 100644 index 0068ccc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_pipeline.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ============================================= --- CI/CD 流水线配置表 --- ============================================= -CREATE TABLE IF NOT EXISTS `app_pipeline` ( - `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '自增ID', - `app_id` BIGINT NOT NULL COMMENT '关联应用ID', - `name` VARCHAR(200) NOT NULL COMMENT '流水线名称', - `description` TEXT DEFAULT NULL COMMENT '流水线描述', - `ci_type` VARCHAR(20) DEFAULT 'gitea' COMMENT 'CI系统类型: gitea/jenkins/github', - `repo_full_name` VARCHAR(200) DEFAULT NULL COMMENT 'Gitea仓库全称(如 gxwebsoft/my-app)', - `workflow_file` VARCHAR(100) DEFAULT 'build.yml' COMMENT 'Gitea工作流文件名', - `stages` VARCHAR(200) DEFAULT 'build,test,deploy' COMMENT '流水线阶段: build/test/deploy', - `env` VARCHAR(50) DEFAULT 'production' COMMENT '环境: development/staging/production', - `default_branch` VARCHAR(100) DEFAULT 'main' COMMENT '默认触发分支', - `enabled` TINYINT DEFAULT 1 COMMENT '是否启用', - `auto_deploy` TINYINT DEFAULT 0 COMMENT '自动部署', - `timeout` INT DEFAULT 3600 COMMENT '构建超时时间(秒)', - `config` TEXT DEFAULT NULL COMMENT '配置JSON(变量、环境等)', - `last_build_id` BIGINT DEFAULT NULL COMMENT '最近一次构建ID', - `last_build_status` VARCHAR(20) DEFAULT NULL COMMENT '最近构建状态', - `last_build_time` DATETIME DEFAULT NULL COMMENT '最近构建时间', - `success_count` INT DEFAULT 0 COMMENT '构建成功次数', - `failure_count` INT DEFAULT 0 COMMENT '构建失败次数', - `user_id` INT DEFAULT NULL COMMENT '用户ID', - `tenant_id` INT DEFAULT NULL COMMENT '租户id', - `deleted` TINYINT DEFAULT 0 COMMENT '逻辑删除标记', - `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - KEY `idx_app_id` (`app_id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_enabled` (`enabled`), - KEY `idx_create_time` (`create_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='CI/CD流水线配置表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_product.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_product.sql deleted file mode 100644 index 820ac4f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_product.sql +++ /dev/null @@ -1,123 +0,0 @@ --- ============================================= --- 应用产品主表 - SQL建表脚本 --- 数据库: db_websopy --- ============================================= - --- 如果表已存在则删除 -DROP TABLE IF EXISTS app_product; - --- 创建应用产品主表 -CREATE TABLE app_product ( - -- 核心字段 - product_id INT PRIMARY KEY AUTO_INCREMENT COMMENT '应用ID', - product_name VARCHAR(100) NOT NULL COMMENT '应用名称', - product_code VARCHAR(50) UNIQUE COMMENT '应用标识(唯一)', - product_secret VARCHAR(100) COMMENT '应用密钥', - - -- 应用类型枚举 - app_type INT DEFAULT 10 COMMENT '应用类型: 10网站 20微信小程序 30抖音小程序 40百度小程序 50支付宝小程序 60Android 70iOS 80macOS 90Windows 100插件', - - -- 分类 - category_id INT COMMENT '分类ID', - industry_parent VARCHAR(50) COMMENT '行业类型(父级)', - industry_child VARCHAR(50) COMMENT '行业类型(子级)', - - -- 基础信息 - logo VARCHAR(500) COMMENT '应用Logo', - icon VARCHAR(500) COMMENT '应用图标', - qrcode VARCHAR(500) COMMENT '二维码', - screenshots TEXT COMMENT '应用截图(JSON数组)', - description VARCHAR(500) COMMENT '应用简介', - content TEXT COMMENT '详细说明', - keywords VARCHAR(200) COMMENT '关键词', - - -- 配置信息 - domain VARCHAR(255) COMMENT '域名', - prefix VARCHAR(50) COMMENT '域名前缀', - package_name VARCHAR(100) COMMENT '包名(AppID)', - admin_url VARCHAR(500) COMMENT '后台地址', - api_url VARCHAR(500) COMMENT 'API地址', - download_url VARCHAR(500) COMMENT '下载地址', - - -- 版本信息 - version VARCHAR(20) COMMENT '版本号', - edition VARCHAR(20) DEFAULT 'standard' COMMENT '版本: standard标准版 professional专业版 perpetual永久授权', - min_version VARCHAR(20) COMMENT '最低版本要求', - - -- 价格与交付 - price_type VARCHAR(20) DEFAULT 'free' COMMENT '定价: free免费 one_time一次性 subscription订阅', - price DECIMAL(10,2) DEFAULT 0 COMMENT '价格(元)', - line_price DECIMAL(10,2) COMMENT '划线价格', - renew_price DECIMAL(10,2) COMMENT '续费价格', - delivery_method INT COMMENT '交付方式: 1源码 2托管 3授权', - charging_method INT COMMENT '计费方式: 1按年 2按月 3一次性', - subscription_period VARCHAR(20) COMMENT '订阅周期: month/year', - - -- 发布管理 - publish_status VARCHAR(20) DEFAULT 'developing' COMMENT '发布状态: developing开发中 pending_review待审核 published已上架 rejected审核未通过 deprecated已下架', - publish_time DATETIME COMMENT '发布时间', - review_time DATETIME COMMENT '审核时间', - reviewer_id INT COMMENT '审核人ID', - reject_reason VARCHAR(500) COMMENT '拒绝原因', - - -- 统计数据 - clicks INT DEFAULT 0 COMMENT '浏览次数', - installs INT DEFAULT 0 COMMENT '安装次数', - downloads INT DEFAULT 0 COMMENT '下载次数', - rating DECIMAL(2,1) DEFAULT 0 COMMENT '评分(1-5)', - likes INT DEFAULT 0 COMMENT '点赞数', - - -- 开发者信息 - developer VARCHAR(100) COMMENT '开发者', - developer_phone VARCHAR(20) COMMENT '开发者电话', - developer_email VARCHAR(100) COMMENT '开发者邮箱', - - -- 运营配置 - recommend TINYINT DEFAULT 0 COMMENT '是否推荐: 0否 1是', - official TINYINT DEFAULT 0 COMMENT '是否官方: 0否 1是', - market TINYINT DEFAULT 1 COMMENT '是否上架市场: 0否 1是', - show_index TINYINT DEFAULT 0 COMMENT '是否显示首页: 0否 1是', - search_enabled TINYINT DEFAULT 1 COMMENT '是否可搜索: 0否 1是', - - -- 站点配置 - template_id INT COMMENT '模板ID', - style TEXT COMMENT '样式配置JSON', - config JSON COMMENT '扩展配置JSON', - theme_color VARCHAR(20) DEFAULT '#1890ff' COMMENT '主题色', - lang VARCHAR(20) DEFAULT 'zh-cn' COMMENT '语言', - - -- 备案信息 - icp_no VARCHAR(100) COMMENT 'ICP备案号', - police_no VARCHAR(100) COMMENT '公安备案号', - - -- 状态管理 - status INT DEFAULT 0 COMMENT '状态: 0未开通 1运行中 2维护中 3已关闭 4已欠费 5违规停机', - status_text VARCHAR(200) COMMENT '状态说明', - running INT DEFAULT 0 COMMENT '运行状态: 0停止 1运行中 2维护中', - expiration_time DATETIME COMMENT '到期时间', - - -- 系统字段 - sort_number INT DEFAULT 0 COMMENT '排序号', - deleted TINYINT DEFAULT 0 COMMENT '是否删除: 0否 1是', - user_id INT COMMENT '创建用户ID', - tenant_id INT COMMENT '租户ID', - create_time DATETIME DEFAULT CURRENT_TIMESTAMP, - update_time DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - - INDEX idx_tenant (tenant_id), - INDEX idx_user (user_id), - INDEX idx_app_type (app_type), - INDEX idx_category (category_id), - INDEX idx_publish_status (publish_status), - INDEX idx_create_time (create_time) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用产品主表'; - --- ============================================= --- 示例数据 --- ============================================= - --- 插入示例数据 -INSERT INTO app_product (product_name, product_code, app_type, description, developer, price_type, price, publish_status, market, user_id, tenant_id) VALUES -('示例企业官网', 'demo-website', 10, '专业的企业展示网站模板', '科技小王子', 'free', 0.00, 'published', 1, 1, 1), -('示例微信小程序', 'demo-miniprogram', 20, '微信小程序示例应用', '科技小王子', 'one_time', 299.00, 'published', 1, 1, 1), -('示例Android应用', 'demo-android', 60, 'Android原生应用', '科技小王子', 'subscription', 99.00, 'developing', 1, 1, 1); diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_repository.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_repository.sql deleted file mode 100644 index 2bd390b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_repository.sql +++ /dev/null @@ -1,23 +0,0 @@ --- Git仓库表(可用仓库列表) -CREATE TABLE IF NOT EXISTS `app_repository` ( - `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID', - `path` VARCHAR(255) NOT NULL COMMENT '仓库路径(如: owner/repo-name)', - `name` VARCHAR(255) NOT NULL COMMENT '仓库名称', - `description` TEXT COMMENT '仓库描述', - `access_level` VARCHAR(20) NOT NULL DEFAULT 'read' COMMENT '访问权限级别: read/write/admin', - `status` VARCHAR(20) NOT NULL DEFAULT 'active' COMMENT '状态: active/inactive', - `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否删除, 0否, 1是', - PRIMARY KEY (`id`), - UNIQUE KEY `uk_path` (`path`), - KEY `idx_status` (`status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Git仓库表(可用仓库列表)'; - --- 插入一些示例仓库数据 -INSERT INTO `app_repository` (`path`, `name`, `description`, `access_level`) VALUES -('websopy/core', 'Core Repository', '核心代码仓库', 'read'), -('websopy/frontend', 'Frontend Repository', '前端代码仓库', 'read'), -('websopy/backend', 'Backend Repository', '后端代码仓库', 'read'), -('websopy/docs', 'Documentation', '文档仓库', 'read'), -('websopy/tools', 'Development Tools', '开发工具仓库', 'read'); diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_credential_id.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_credential_id.sql deleted file mode 100644 index 760e2e8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_credential_id.sql +++ /dev/null @@ -1,8 +0,0 @@ --- 为 app_resource 表添加云账号凭证关联字段 --- 用于云存储关联云账号凭证 --- @author 科技小王子 --- @since 2026-04-04 - -ALTER TABLE `app_resource` -ADD COLUMN `credential_id` bigint DEFAULT NULL COMMENT '云账号凭证ID(云存储用,关联app_cloud_credential)' -AFTER `region`; \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_git_fields.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_git_fields.sql deleted file mode 100644 index 7f846f5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_git_fields.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ===================================================== --- Git仓库资源扩展:为 app_resource 表添加 Git 相关字段 --- resourceType = 'git' 时使用 --- MySQL 5.7+ 兼容版本(不支持 IF NOT EXISTS,需逐列添加) --- ===================================================== - --- 如果字段已存在会报错,可忽略错误继续执行 --- 建议逐条执行,或使用 DBA 工具执行 - --- 1. git_path - Git仓库路径 -ALTER TABLE `app_resource` - ADD COLUMN `git_path` VARCHAR(255) COMMENT 'Git仓库路径(如: websopy/core)' AFTER `cert_chain`; - --- 2. git_clone_url - Git Clone URL -ALTER TABLE `app_resource` - ADD COLUMN `git_clone_url` VARCHAR(500) COMMENT 'Git Clone URL' AFTER `git_path`; - --- 3. git_web_url - Git Web访问URL -ALTER TABLE `app_resource` - ADD COLUMN `git_web_url` VARCHAR(500) COMMENT 'Git Web访问URL(Gitea页面地址)' AFTER `git_clone_url`; - --- 4. git_access_level - Git权限级别 -ALTER TABLE `app_resource` - ADD COLUMN `git_access_level` VARCHAR(20) DEFAULT 'read' COMMENT 'Git权限级别: read/write/admin' AFTER `git_web_url`; - --- ===================================================== --- 初始化示例数据(可选,根据实际情况调整) --- 以下示例展示如何为已有应用创建 Git 仓库资源记录 --- ===================================================== - --- 示例:为应用创建一个 Git 仓库资源记录 --- INSERT INTO `app_resource` ( --- `resource_type`, `name`, `app_id`, `git_path`, `git_clone_url`, `git_web_url`, --- `git_access_level`, `status`, `user_id`, `owner_user_id`, `tenant_id` --- ) VALUES ( --- 'git', 'Core Repository', 1, 'websopy/core', --- 'https://git.websoft.top/websopy/core.git', --- 'https://git.websoft.top/websopy/core', --- 'read', 'running', 1, 1, 10398 --- ); diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_panel_fields.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_panel_fields.sql deleted file mode 100644 index a809787..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_panel_fields.sql +++ /dev/null @@ -1,17 +0,0 @@ --- 为 app_resource 表添加 1Panel 用户名字段 --- 添加时间: 2026-04-05 - --- 添加 panelUsername 字段(1Panel 面板用户名) -ALTER TABLE app_resource -ADD COLUMN IF NOT EXISTS panel_username VARCHAR(100) COMMENT '1Panel面板用户名(服务器用)' -AFTER panel_port; - --- 添加 panelPassword 字段(1Panel 面板密码,AES加密存储) -ALTER TABLE app_resource -ADD COLUMN IF NOT EXISTS panel_password VARCHAR(500) COMMENT '1Panel面板密码(AES加密,服务器用)' -AFTER panel_username; - --- 注意:如果 ALTER TABLE 不支持 IF NOT EXISTS 语法(MySQL 5.7) --- 请手动执行以下语句: --- ALTER TABLE app_resource ADD COLUMN panel_username VARCHAR(100) COMMENT '1Panel面板用户名(服务器用)' AFTER panel_port; --- ALTER TABLE app_resource ADD COLUMN panel_password VARCHAR(500) COMMENT '1Panel面板密码(AES加密,服务器用)' AFTER panel_username; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_ssl_fields.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_ssl_fields.sql deleted file mode 100644 index 541409b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_ssl_fields.sql +++ /dev/null @@ -1,71 +0,0 @@ --- 为 app_resource 表添加 SSL 证书相关字段 --- @author 科技小王子 --- @since 2026-04-05 - -/** - * SSL 证书需要的字段: - * - private_key:私钥内容(AES加密存储) - * - public_key:公钥内容(从证书提取) - * - certificate:完整的证书文件内容(包含BEGIN/END标记) - * - cert_chain:证书链/中间证书内容 - * - algorithm:加密算法(RSA/ECC) - * - key_bits:密钥长度(2048/4096/256等) - */ - --- 检查表结构,如果字段不存在则添加 --- 使用 IF NOT EXISTS 防止重复执行 - --- 1. 添加私钥字段 -ALTER TABLE `app_resource` -ADD COLUMN IF NOT EXISTS `private_key` longtext DEFAULT NULL COMMENT '私钥内容(AES加密存储,SSL用)' -AFTER `issuer`; - --- 2. 添加公钥字段 -ALTER TABLE `app_resource` -ADD COLUMN IF NOT EXISTS `public_key` longtext DEFAULT NULL COMMENT '公钥内容(从证书提取,SSL用)' -AFTER `private_key`; - --- 3. 添加证书内容字段 -ALTER TABLE `app_resource` -ADD COLUMN IF NOT EXISTS `certificate` longtext DEFAULT NULL COMMENT '证书内容/证书文件(SSL用)' -AFTER `public_key`; - --- 4. 添加证书链字段 -ALTER TABLE `app_resource` -ADD COLUMN IF NOT EXISTS `cert_chain` longtext DEFAULT NULL COMMENT '证书链/中间证书(SSL用)' -AFTER `certificate`; - - - --- 如果需要,可以创建一个视图来显示 SSL 证书信息 -CREATE OR REPLACE VIEW `app_ssl_certificate_view` AS -SELECT - resource_id, - name, - domain, - cert_type, - issuer, - status, - expire_at, - app_id, - create_time, - update_time, - -- 安全考虑,不显示私钥内容 - CASE WHEN certificate IS NOT NULL THEN LENGTH(certificate) ELSE 0 END as cert_length, - CASE WHEN cert_chain IS NOT NULL THEN LENGTH(cert_chain) ELSE 0 END as chain_length, - -- 判断证书是否有效(逻辑示例,实际需要更复杂的检查) - CASE - WHEN expire_at >= CURDATE() THEN 'valid' - WHEN expire_at < CURDATE() THEN 'expired' - ELSE 'unknown' - END as validity_status, - -- 剩余天数 - DATEDIFF(expire_at, CURDATE()) as days_remaining -FROM app_resource -WHERE resource_type = 'ssl' AND deleted = 0; - --- 说明: --- 1. longtext 字段可以存储最多 4GB 的文本,足够存储证书和密钥 --- 2. 私钥字段会在前端和后端进行 AES 加密处理 --- 3. 视图提供了安全的 SSL 证书查询接口,不暴露私钥等敏感信息 --- 4. 可以根据需要添加证书解析函数(如从证书中提取有效期、域名等) \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_used_bytes.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_used_bytes.sql deleted file mode 100644 index 6f23050..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_used_bytes.sql +++ /dev/null @@ -1,8 +0,0 @@ --- 为 app_resource 表添加 used_bytes 字段 --- 用于云存储记录已用空间(字节) --- @author 科技小王子 --- @since 2026-04-06 - -ALTER TABLE `app_resource` -ADD COLUMN `used_bytes` bigint DEFAULT NULL COMMENT '已用空间(字节,云存储用)' -AFTER `acl`; \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_used_count.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_used_count.sql deleted file mode 100644 index 28dca22..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_add_used_count.sql +++ /dev/null @@ -1,8 +0,0 @@ --- 为 app_resource 表添加 used_count 字段 --- 用于云存储记录对象数量 --- @author 科技小王子 --- @since 2026-04-06 - -ALTER TABLE `app_resource` -ADD COLUMN `used_count` int DEFAULT NULL COMMENT '对象数量(云存储用)' -AFTER `used_bytes`; \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_collab_permission.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_collab_permission.sql deleted file mode 100644 index db4c096..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_resource_collab_permission.sql +++ /dev/null @@ -1,27 +0,0 @@ --- ===================================================================== --- 资源中心协作权限迁移脚本 --- 版本: 2026-04-05 --- 说明: 为 app_resource 表添加 owner_user_id 字段,支持资源协作权限分级 --- ===================================================================== - --- 1. 添加 owner_user_id 字段(记录资源真实创建者,区别于 user_id 代理关系) -ALTER TABLE app_resource - ADD COLUMN owner_user_id BIGINT NULL - COMMENT '资源创建者 userId(创建时自动设置,是权限控制的基准)' - AFTER user_id; - --- 2. 历史数据修复:将现有记录的 owner_user_id 设置为 user_id -UPDATE app_resource -SET owner_user_id = user_id -WHERE owner_user_id IS NULL; - --- 3. 创建索引 -CREATE INDEX idx_resource_owner ON app_resource (owner_user_id); - --- ===================================================================== --- 权限级别说明(由后端代码计算,不存储到数据库) --- 0: 无权限 - 不是应用成员 --- 1: 基础查看 - 可看名称、IP、端口、状态(所有团队成员默认) --- 2: 连接查看 - 可看用户名、Host(技术负责人 admin/owner 角色) --- 3: 完全权限 - 可看密码/私钥、可编辑删除(资源 ownerUserId 本人) --- ===================================================================== diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_setting.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_setting.sql deleted file mode 100644 index 58cabfa..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_setting.sql +++ /dev/null @@ -1,53 +0,0 @@ --- ============================================ --- 平台设置表 app_setting --- ============================================ - --- 创建表 -CREATE TABLE IF NOT EXISTS `app_setting` ( - `setting_id` INT NOT NULL AUTO_INCREMENT COMMENT '设置ID', - `category` VARCHAR(50) NOT NULL DEFAULT 'basic' COMMENT '设置分类:basic/review/market/register/notify/maintenance', - `setting_key` VARCHAR(100) NOT NULL COMMENT '设置项标识', - `setting_name` VARCHAR(200) DEFAULT NULL COMMENT '设置项名称', - `setting_value` TEXT COMMENT '设置值(JSON格式)', - `value_type` VARCHAR(20) NOT NULL DEFAULT 'json' COMMENT '设置类型:string/number/boolean/json', - `description` VARCHAR(500) DEFAULT NULL COMMENT '设置说明', - `sort_number` INT NOT NULL DEFAULT 0 COMMENT '排序号', - `is_enabled` TINYINT NOT NULL DEFAULT 1 COMMENT '是否启用 0否 1是', - `is_public` TINYINT NOT NULL DEFAULT 0 COMMENT '是否公开(前端可读)0否 1是', - `tenant_id` BIGINT DEFAULT NULL COMMENT '租户id', - `created_time` BIGINT DEFAULT NULL COMMENT '创建时间', - `updated_time` BIGINT DEFAULT NULL COMMENT '更新时间', - `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT '是否删除 0否 1是', - PRIMARY KEY (`setting_id`), - UNIQUE KEY `uk_setting_key` (`setting_key`, `tenant_id`), - KEY `idx_category` (`category`), - KEY `idx_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='平台设置表'; - --- ============================================ --- 初始化默认配置数据 --- ============================================ - --- 基础配置 -INSERT INTO `app_setting` (`category`, `setting_key`, `setting_name`, `setting_value`, `value_type`, `description`, `sort_number`, `is_enabled`, `is_public`) VALUES -('basic', 'platform_basic', '基础配置', '{"siteName":"","domain":"","description":"","supportEmail":"","supportPhone":"","icpNo":""}', 'json', '平台基础信息配置', 1, 1, 0); - --- 审核配置 -INSERT INTO `app_setting` (`category`, `setting_key`, `setting_name`, `setting_value`, `value_type`, `description`, `sort_number`, `is_enabled`, `is_public`) VALUES -('review', 'platform_review', '审核配置', '{"autoReview":false,"reviewEmail":"","defaultRejectReason":"","maxWaitDays":7}', 'json', '应用审核相关配置', 2, 1, 0); - --- 市场配置 -INSERT INTO `app_setting` (`category`, `setting_key`, `setting_name`, `setting_value`, `value_type`, `description`, `sort_number`, `is_enabled`, `is_public`) VALUES -('market', 'platform_market', '市场配置', '{"enableMarket":true,"allowThirdParty":true,"commissionRate":10,"pageSize":12}', 'json', '应用市场相关配置', 3, 1, 0); - --- 注册配置 -INSERT INTO `app_setting` (`category`, `setting_key`, `setting_name`, `setting_value`, `value_type`, `description`, `sort_number`, `is_enabled`, `is_public`) VALUES -('register', 'platform_register', '注册登录配置', '{"enableRegister":true,"emailVerify":false,"phoneVerify":true,"oauthProviders":["wechat"],"defaultRole":"user"}', 'json', '用户注册登录相关配置', 4, 1, 0); - --- 通知配置 -INSERT INTO `app_setting` (`category`, `setting_key`, `setting_name`, `setting_value`, `value_type`, `description`, `sort_number`, `is_enabled`, `is_public`) VALUES -('notify', 'platform_notify', '通知配置', '{"ticketEmail":true,"ticketSms":false,"ticketWechat":false,"reviewEmail":true,"reviewSms":false,"announcePush":true}', 'json', '消息通知相关配置', 5, 1, 0); - --- 维护模式配置 -INSERT INTO `app_setting` (`category`, `setting_key`, `setting_name`, `setting_value`, `value_type`, `description`, `sort_number`, `is_enabled`, `is_public`) VALUES -('maintenance', 'platform_maintenance', '维护模式', '{"enabled":false,"message":"系统维护中,请稍后再访问","allowedIps":[],"allowedUsers":[],"startTime":null,"endTime":null}', 'json', '维护模式配置', 6, 1, 0); diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_ticket.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_ticket.sql deleted file mode 100644 index 3ce229b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_ticket.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ---------------------------- --- 应用工单表 --- 以应用为维度的工单系统,客户提交 → 自动分配技术人员 → 处理 → 回复 --- ---------------------------- -CREATE TABLE IF NOT EXISTS `app_ticket` ( - `ticket_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '工单ID', - `ticket_no` VARCHAR(30) NOT NULL COMMENT '工单编号(TK-yyyyMMddHHmmss+4位随机)', - `title` VARCHAR(200) NOT NULL COMMENT '工单标题', - `content` TEXT DEFAULT NULL COMMENT '工单内容描述', - `app_id` BIGINT NOT NULL COMMENT '关联应用ID', - `app_name` VARCHAR(100) DEFAULT NULL COMMENT '应用名称(冗余)', - `category` VARCHAR(20) NOT NULL DEFAULT 'consultation' COMMENT '工单分类: bug/feature/consultation/complaint/other', - `priority` VARCHAR(10) NOT NULL DEFAULT 'normal' COMMENT '优先级: low/normal/high/urgent', - `status` VARCHAR(20) NOT NULL DEFAULT 'pending' COMMENT '状态: pending/assigned/processing/resolved/closed/rejected', - `attachments` VARCHAR(2000) DEFAULT NULL COMMENT '附件JSON数组(最多5个文件URL)', - `submit_user_id` INT NOT NULL COMMENT '提交人用户ID', - `submit_user_name` VARCHAR(50) DEFAULT NULL COMMENT '提交人昵称(冗余)', - `submit_user_avatar` VARCHAR(500) DEFAULT NULL COMMENT '提交人头像(冗余)', - `assignee_id` INT DEFAULT NULL COMMENT '分配的处理人用户ID', - `assignee_name` VARCHAR(50) DEFAULT NULL COMMENT '处理人昵称(冗余)', - `assignee_avatar` VARCHAR(500) DEFAULT NULL COMMENT '处理人头像(冗余)', - `reply_count` INT DEFAULT 0 COMMENT '回复数量', - `resolved_time` DATETIME DEFAULT NULL COMMENT '解决时间', - `closed_time` DATETIME DEFAULT NULL COMMENT '关闭时间', - `deleted` TINYINT NOT NULL DEFAULT 0 COMMENT '是否删除: 0否 1是', - `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `tenant_id` INT DEFAULT NULL COMMENT '租户ID', - - PRIMARY KEY (`ticket_id`), - UNIQUE KEY `uk_ticket_no` (`ticket_no`), - KEY `idx_app_id` (`app_id`), - KEY `idx_submit_user_id` (`submit_user_id`), - KEY `idx_assignee_id` (`assignee_id`), - KEY `idx_status` (`status`), - KEY `idx_category` (`category`), - KEY `idx_tenant_id` (`tenant_id`), - KEY `idx_deleted` (`deleted`), - KEY `idx_create_time` (`create_time`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用工单表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_ticket_alter.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_ticket_alter.sql deleted file mode 100644 index 002c7bf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_ticket_alter.sql +++ /dev/null @@ -1,33 +0,0 @@ --- ---------------------------- --- 应用工单表字段补丁(如果表已存在但缺少字段) --- ---------------------------- - --- 添加 app_id 字段(如果不存在) -SET @exist := (SELECT COUNT(*) FROM information_schema.columns - WHERE table_schema = DATABASE() - AND table_name = 'app_ticket' - AND column_name = 'app_id'); -SET @sql := IF(@exist = 0, 'ALTER TABLE `app_ticket` ADD COLUMN `app_id` BIGINT NOT NULL COMMENT "关联应用ID" AFTER `content`', 'SELECT "app_id already exists"'); -PREPARE stmt FROM @sql; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; - --- 添加 app_name 字段(如果不存在) -SET @exist := (SELECT COUNT(*) FROM information_schema.columns - WHERE table_schema = DATABASE() - AND table_name = 'app_ticket' - AND column_name = 'app_name'); -SET @sql := IF(@exist = 0, 'ALTER TABLE `app_ticket` ADD COLUMN `app_name` VARCHAR(100) DEFAULT NULL COMMENT "应用名称(冗余)" AFTER `app_id`', 'SELECT "app_name already exists"'); -PREPARE stmt FROM @sql; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; - --- 添加索引(如果不存在) -SET @exist := (SELECT COUNT(*) FROM information_schema.statistics - WHERE table_schema = DATABASE() - AND table_name = 'app_ticket' - AND index_name = 'idx_app_id'); -SET @sql := IF(@exist = 0, 'ALTER TABLE `app_ticket` ADD INDEX `idx_app_id` (`app_id`)', 'SELECT "idx_app_id already exists"'); -PREPARE stmt FROM @sql; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_user_add_invite_status.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_user_add_invite_status.sql deleted file mode 100644 index 1f2a85d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_user_add_invite_status.sql +++ /dev/null @@ -1,17 +0,0 @@ --- 应用成员邀请状态字段添加 --- 用于实现邀请确认机制 - --- 添加 invite_status 字段 -ALTER TABLE `app_user` -ADD COLUMN `invite_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '邀请状态: 0-正常(直接加入), 1-待确认, 2-已拒绝' AFTER `status`; - --- 添加邀请过期时间字段(可选,用于实现邀请有效期) -ALTER TABLE `app_user` -ADD COLUMN `invite_expire_time` datetime DEFAULT NULL COMMENT '邀请过期时间' AFTER `invite_time`; - --- 创建索引优化查询 -CREATE INDEX `idx_invite_status` ON `app_user` (`invite_status`); -CREATE INDEX `idx_user_id_invite_status` ON `app_user` (`user_id`, `invite_status`); - --- 数据迁移:将现有数据标记为已确认(直接加入) --- UPDATE app_user SET invite_status = 0 WHERE invite_status IS NULL; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_user_cache.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_user_cache.sql deleted file mode 100644 index 7a09e30..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/app_user_cache.sql +++ /dev/null @@ -1,15 +0,0 @@ --- 用户信息缓存表 --- 用于缓存 sys_user 的常用字段,方便 app 模块其他表关联查询用户信息 --- 不存储密码等敏感信息 - -CREATE TABLE `app_user_cache` ( - `user_id` int(11) NOT NULL COMMENT '用户ID(主键)', - `tenant_id` int(11) NOT NULL COMMENT '租户ID', - `username` varchar(50) DEFAULT NULL COMMENT '用户名', - `nickname` varchar(50) DEFAULT NULL COMMENT '昵称', - `avatar` varchar(255) DEFAULT NULL COMMENT '头像', - `phone` varchar(20) DEFAULT NULL COMMENT '手机号', - `status` tinyint(1) DEFAULT '0' COMMENT '状态, 0正常, 1冻结', - `update_time` datetime DEFAULT NULL COMMENT '缓存更新时间', - PRIMARY KEY (`user_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户信息缓存表'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/check_cloud_credential.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/check_cloud_credential.sql deleted file mode 100644 index be59d2c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/check_cloud_credential.sql +++ /dev/null @@ -1,12 +0,0 @@ --- 检查 app_cloud_credential 表结构 -DESC app_cloud_credential; - --- 检查是否有 test_status 和 test_message 字段 -SHOW COLUMNS FROM app_cloud_credential WHERE Field IN ('test_status', 'test_message'); - --- 如果字段不存在,添加它们 --- ALTER TABLE `app_cloud_credential` ADD COLUMN `test_status` tinyint DEFAULT 0 COMMENT '测试状态: 0未测试 1成功 2失败'; --- ALTER TABLE `app_cloud_credential` ADD COLUMN `test_message` varchar(500) DEFAULT NULL COMMENT '测试消息'; - --- 检查用户是否有数据 -SELECT id, provider, name, user_id, tenant_id, status, test_status FROM app_cloud_credential; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/fix_app_user_cache_tenant_id.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/fix_app_user_cache_tenant_id.sql deleted file mode 100644 index 7b1fd82..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/fix_app_user_cache_tenant_id.sql +++ /dev/null @@ -1,40 +0,0 @@ --- ============================================ --- 修复 app_user_cache 表 tenant_id 字段问题 --- ============================================ - --- 1. 检查并添加 tenant_id 字段(如果不存在) -SET @dbname = DATABASE(); -SET @tablename = 'app_user_cache'; -SET @columnname = 'tenant_id'; - -SET @sql = CONCAT( - 'SELECT COUNT(*) INTO @exists FROM information_schema.columns - WHERE table_schema = ''', @dbname, ''' - AND table_name = ''', @tablename, ''' - AND column_name = ''', @columnname, '''' -); -PREPARE stmt FROM @sql; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; - --- 如果字段不存在,添加它 -SET @addColumn = IF(@exists = 0, - 'ALTER TABLE app_user_cache ADD COLUMN tenant_id INT NOT NULL DEFAULT 0 COMMENT ''租户ID'' AFTER user_id', - 'SELECT ''tenant_id column already exists'' as message' -); -PREPARE stmt FROM @addColumn; -EXECUTE stmt; -DEALLOCATE PREPARE stmt; - --- 2. 如果字段已存在但允许 NULL,修改为 NOT NULL --- 先为现有 NULL 值设置默认值 -UPDATE app_user_cache SET tenant_id = 0 WHERE tenant_id IS NULL; - --- 3. 添加 NOT NULL 约束(如果还没有) --- 注意:这需要根据实际数据情况执行 --- ALTER TABLE app_user_cache MODIFY COLUMN tenant_id INT NOT NULL COMMENT '租户ID'; - --- ============================================ --- 验证表结构 --- ============================================ -DESCRIBE app_user_cache; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/fix_tenant_id_constraint.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/fix_tenant_id_constraint.sql deleted file mode 100644 index 00345bf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/fix_tenant_id_constraint.sql +++ /dev/null @@ -1,34 +0,0 @@ --- ============================================ --- 修复 app_user 表 tenant_id 字段问题 --- ============================================ - --- 检查 app_user 表是否有 tenant_id 字段 --- 如果没有,添加该字段 --- 如果有但没有 NOT NULL 约束,添加约束 - --- 1. 检查并添加 tenant_id 字段(如果不存在) --- ALTER TABLE app_user ADD COLUMN tenant_id INT COMMENT '租户id' AFTER user_id; - --- 2. 为现有数据设置 tenant_id(需要根据实际情况设置) --- 假设通过 user_id 关联查询 sys_user 表获取 tenant_id --- UPDATE app_user a --- INNER JOIN sys_user u ON a.user_id = u.user_id --- SET a.tenant_id = u.tenant_id --- WHERE a.tenant_id IS NULL; - --- 3. 添加 NOT NULL 约束(确保数据已填充) --- ALTER TABLE app_user MODIFY COLUMN tenant_id INT NOT NULL COMMENT '租户id'; - --- ============================================ --- 修复 app_permission_request 表 tenant_id 字段问题 --- ============================================ - --- 检查 app_permission_request 表是否有 tenant_id 字段 --- 如果没有,添加该字段 --- ALTER TABLE app_permission_request ADD COLUMN tenant_id INT COMMENT '租户id' AFTER user_id; - --- ============================================ --- 验证表结构 --- ============================================ --- DESCRIBE app_user; --- DESCRIBE app_permission_request; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/sys_operation_record.sql b/jczxw-java/src/main/java/com/gxwebsoft/app/sql/sys_operation_record.sql deleted file mode 100644 index beccce2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/sql/sys_operation_record.sql +++ /dev/null @@ -1,27 +0,0 @@ --- 操作日志表 -CREATE TABLE IF NOT EXISTS `sys_operation_record` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `user_id` int(11) DEFAULT NULL COMMENT '用户id', - `module` varchar(100) DEFAULT NULL COMMENT '操作模块', - `description` varchar(255) DEFAULT NULL COMMENT '操作功能', - `url` varchar(255) DEFAULT NULL COMMENT '请求地址', - `request_method` varchar(20) DEFAULT NULL COMMENT '请求方式', - `method` varchar(255) DEFAULT NULL COMMENT '调用方法', - `params` text COMMENT '请求参数', - `result` text COMMENT '返回结果', - `error` text COMMENT '异常信息', - `comments` varchar(500) DEFAULT NULL COMMENT '备注', - `spend_time` bigint(20) DEFAULT NULL COMMENT '消耗时间, 单位毫秒', - `os` varchar(100) DEFAULT NULL COMMENT '操作系统', - `device` varchar(100) DEFAULT NULL COMMENT '设备名称', - `browser` varchar(100) DEFAULT NULL COMMENT '浏览器类型', - `ip` varchar(50) DEFAULT NULL COMMENT 'ip地址', - `status` tinyint(1) DEFAULT '0' COMMENT '状态, 0成功, 1异常', - `tenant_id` int(11) DEFAULT NULL COMMENT '租户id', - `create_time` datetime DEFAULT NULL COMMENT '操作时间', - `update_time` datetime DEFAULT NULL COMMENT '修改时间', - PRIMARY KEY (`id`), - KEY `idx_user_id` (`user_id`), - KEY `idx_create_time` (`create_time`), - KEY `idx_module` (`module`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='操作日志'; diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/task/UserCacheRefreshTask.java b/jczxw-java/src/main/java/com/gxwebsoft/app/task/UserCacheRefreshTask.java deleted file mode 100644 index 18e86dc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/task/UserCacheRefreshTask.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.gxwebsoft.app.task; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.app.entity.AppUser; -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.app.service.AppUserService; -import com.gxwebsoft.common.system.entity.User; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 用户缓存刷新定时任务 - *

- * 定时从 server API 获取最新用户信息并更新缓存 - * - * @author 科技小王子 - * @since 2026-04-03 - */ -@Slf4j -@Component -public class UserCacheRefreshTask { - - @Value("${config.server-url:https://server.websoft.top/api}") - private String serverUrl; - - @Autowired - private AppUserCacheService appUserCacheService; - - @Autowired - private AppUserService appUserService; - - /** - * 缓存待刷新的用户 ID 集合(去重) - */ - private final Set pendingRefreshUsers = ConcurrentHashMap.newKeySet(); - - /** - * 每天凌晨 2 点执行全量缓存刷新 - * 格式:秒 分 时 日 月 周 - */ - @Scheduled(cron = "0 0 2 * * ?") - public void fullCacheRefresh() { - log.info("【定时任务】开始全量刷新用户缓存..."); - try { - // 获取所有活跃的 app 成员用户 - List allUserIds = getAllActiveUserIds(); - if (CollUtil.isEmpty(allUserIds)) { - log.info("没有需要刷新的用户"); - return; - } - log.info("需要刷新的用户数量:{}", allUserIds.size()); - appUserCacheService.batchRefreshUserCache(allUserIds); - log.info("【定时任务】全量刷新用户缓存完成"); - } catch (Exception e) { - log.error("【定时任务】全量刷新用户缓存失败", e); - } - } - - /** - * 每小时执行一次增量刷新(刷新缓存过期的用户) - * 缓存超过 6 小时视为过期 - */ - @Scheduled(cron = "0 0 * * * ?") - public void incrementalCacheRefresh() { - log.info("【定时任务】开始增量刷新用户缓存..."); - try { - // 获取缓存中更新时间超过 6 小时的用户 - List expiredCaches = appUserCacheService.list( - new LambdaQueryWrapper() - .le(AppUserCache::getUpdateTime, LocalDateTime.now().minusHours(6)) - ); - if (CollUtil.isEmpty(expiredCaches)) { - log.info("没有过期的缓存需要刷新"); - return; - } - List userIds = expiredCaches.stream() - .map(AppUserCache::getUserId) - .toList(); - log.info("过期缓存用户数量:{}", userIds.size()); - appUserCacheService.batchRefreshUserCache(userIds); - log.info("【定时任务】增量刷新用户缓存完成"); - } catch (Exception e) { - log.error("【定时任务】增量刷新用户缓存失败", e); - } - } - - /** - * 添加待刷新的用户到队列 - * 业务层可以调用此方法标记用户需要刷新 - */ - public void markForRefresh(Integer userId) { - if (userId != null) { - pendingRefreshUsers.add(userId); - log.debug("用户已标记待刷新,userId={}", userId); - } - } - - /** - * 获取所有活跃的应用成员用户 ID - */ - private List getAllActiveUserIds() { - List members = appUserService.list( - new LambdaQueryWrapper() - .eq(AppUser::getStatus, 0) - .select(AppUser::getUserId) - ); - if (CollUtil.isEmpty(members)) { - return new ArrayList<>(); - } - return members.stream() - .map(AppUser::getUserId) - .distinct() - .toList(); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/app/utils/WxNativePayUtil.java b/jczxw-java/src/main/java/com/gxwebsoft/app/utils/WxNativePayUtil.java deleted file mode 100644 index 06870e2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/app/utils/WxNativePayUtil.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.gxwebsoft.app.utils; - -import com.wechat.pay.java.core.Config; -import com.wechat.pay.java.core.RSAPublicKeyConfig; -import com.gxwebsoft.app.config.AppPayProperties; -import lombok.extern.slf4j.Slf4j; -import org.springframework.core.io.ClassPathResource; -import org.springframework.stereotype.Component; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -/** - * 微信支付配置工具类(按租户缓存 Config 实例) - * 参考 core 模块 WxNativeUtil,按 app 模块独立部署模式重新实现 - */ -@Slf4j -@Component -public class WxNativePayUtil { - - private static final Map TENANT_CONFIGS = new ConcurrentHashMap<>(); - - /** - * 获取/构建指定租户的微信支付 Config - */ - public Config getConfig(AppPayProperties props) { - // 暂不使用多租户配置,统一使用平台级配置 - Config cached = TENANT_CONFIGS.get(0); - if (cached != null) { - return cached; - } - - Config config = buildConfig(props); - TENANT_CONFIGS.put(0, config); - return config; - } - - private Config buildConfig(AppPayProperties props) { - String mchId; - String serialNo; - String apiV3Key; - boolean testMode = props.isTestMode(); - - if (testMode) { - // 测试模式 - mchId = props.getTestMchId() != null ? props.getTestMchId() : props.getMchId(); - serialNo = props.getTestMerchantSerialNumber() != null ? props.getTestMerchantSerialNumber() : props.getMerchantSerialNumber(); - apiV3Key = props.getTestApiV3Key() != null ? props.getTestApiV3Key() : props.getApiV3Key(); - log.info("微信支付使用测试模式 — 商户号: {}", mchId); - } else { - // 正式模式 - mchId = props.getMchId(); - serialNo = props.getMerchantSerialNumber(); - apiV3Key = props.getApiV3Key(); - log.info("微信支付使用正式模式 — 商户号: {}", mchId); - } - - String privateKeyPath = resolvePrivateKeyPath(props, testMode); - String wechatpayPublicKeyId = props.getWechatpayPublicKeyId(); - String wechatpayPublicKeyPath = resolvePublicKeyPath(props, testMode); - log.info("构建微信支付 Config — 商户号: {}, 序列号: {}, 私钥路径: {}, 公钥路径: {}, 公钥ID: {}", - mchId, serialNo, privateKeyPath, wechatpayPublicKeyPath, wechatpayPublicKeyId); - - // 使用微信支付公钥模式(RSAPublicKeyConfig) - // 必须提供本地公钥文件和公钥ID - RSAPublicKeyConfig.Builder builder = new RSAPublicKeyConfig.Builder() - .merchantId(mchId) - .privateKeyFromPath(privateKeyPath) - .merchantSerialNumber(serialNo) - .apiV3Key(apiV3Key) - .publicKeyFromPath(wechatpayPublicKeyPath) - .publicKeyId(wechatpayPublicKeyId); - - log.info("使用 RSA 公钥模式配置微信支付 — 公钥路径: {}, 公钥ID: {}", wechatpayPublicKeyPath, wechatpayPublicKeyId); - - return builder.build(); - } - - /** - * 解析私钥文件路径 - * 测试模式优先 classpath;生产模式优先挂载卷 - */ - private String resolvePrivateKeyPath(AppPayProperties props, boolean testMode) { - String certRelativePath = props.getPrivateKeyRelativePath(); - - if (testMode) { - // 测试模式:classpath - return resolveClasspathPath(certRelativePath); - } - - // 生产模式:优先挂载卷 - String certRootPath = props.getCertRootPath(); - if (certRootPath != null && !certRootPath.isEmpty()) { - Path fullPath = Paths.get(certRootPath, certRelativePath); - if (Files.exists(fullPath)) { - return fullPath.toAbsolutePath().toString(); - } - log.warn("挂载卷证书 {} 不存在,尝试 classpath 回退", fullPath); - } - - return resolveClasspathPath(certRelativePath); - } - - /** - * 解析微信支付公钥文件路径 - */ - private String resolvePublicKeyPath(AppPayProperties props, boolean testMode) { - String publicKeyRelativePath = props.getWechatpayCertRelativePath(); - - if (testMode) { - return resolveClasspathPath(publicKeyRelativePath); - } - - // 生产模式:优先挂载卷 - String certRootPath = props.getCertRootPath(); - if (certRootPath != null && !certRootPath.isEmpty()) { - Path fullPath = Paths.get(certRootPath, publicKeyRelativePath); - if (Files.exists(fullPath)) { - return fullPath.toAbsolutePath().toString(); - } - log.warn("挂载卷公钥文件 {} 不存在,尝试 classpath 回退", fullPath); - } - - return resolveClasspathPath(publicKeyRelativePath); - } - - private String resolveClasspathPath(String relativePath) { - try { - ClassPathResource resource = new ClassPathResource(relativePath); - if (resource.exists()) { - return resource.getFile().getAbsolutePath(); - } - } catch (Exception e) { - log.warn("classpath 路径解析失败: {}", e.getMessage()); - } - return "classpath:" + relativePath; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java b/jczxw-java/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java index 6700567..2f664c5 100644 --- a/jczxw-java/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java +++ b/jczxw-java/src/main/java/com/gxwebsoft/cms/service/CmsWebsiteService.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gxwebsoft.cms.entity.CmsWebsite; import com.gxwebsoft.cms.param.CmsWebsiteParam; import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.vo.ShopVo; import java.util.List; @@ -53,14 +52,6 @@ public interface CmsWebsiteService extends IService { CmsWebsite getByTenantId(Integer tenantId); - /** - * 获取网站基本信息(VO格式) - * - * @param tenantId 租户ID - * @return 网站信息VO - */ - ShopVo getSiteInfo(Integer tenantId); - /** * 清除网站信息缓存 * diff --git a/jczxw-java/src/main/java/com/gxwebsoft/common/mq/config/RabbitMQConfig.java b/jczxw-java/src/main/java/com/gxwebsoft/common/mq/config/RabbitMQConfig.java deleted file mode 100644 index 9f681f5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/common/mq/config/RabbitMQConfig.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.gxwebsoft.common.mq.config; - -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.amqp.core.*; -import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; -import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; -import org.springframework.amqp.rabbit.connection.ConnectionFactory; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; -import org.springframework.amqp.support.converter.MessageConverter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * RabbitMQ 配置类 - websopy 端消费者配置 - * - * 从 server-api (core系统) 接收用户同步消息 - * 使用 Topic Exchange,routing key 格式: user.sync.websopy - */ -@Configuration -@ConditionalOnProperty(name = "sync.mq.enabled", havingValue = "true", matchIfMissing = true) -public class RabbitMQConfig { - - // ==================== 常量定义 ==================== - // 与 server-api 共用的 Exchange - public static final String SYNC_EXCHANGE = "sync.topic.exchange"; - - // websopy 专用队列 - public static final String SYNC_QUEUE_WEBSOPY = "user.sync.websopy.queue"; - public static final String SYNC_ROUTING_KEY_WEBSOPY = "user.sync.websopy"; - - // 死信队列 - public static final String DLX_EXCHANGE = "sync.dlx.exchange"; - public static final String DLQ_QUEUE_WEBSOPY = "user.sync.websopy.dlq"; - public static final String DLQ_ROUTING_KEY = "user.sync.websopy.dlq"; - - @Value("${spring.rabbitmq.host:localhost}") - private String host; - - @Value("${spring.rabbitmq.port:5672}") - private int port; - - @Value("${spring.rabbitmq.username:guest}") - private String username; - - @Value("${spring.rabbitmq.password:guest}") - private String password; - - @Value("${spring.rabbitmq.virtual-host:/}") - private String virtualHost; - - // ==================== Connection Factory ==================== - - @Bean - public ConnectionFactory connectionFactory() { - CachingConnectionFactory connectionFactory = new CachingConnectionFactory(); - connectionFactory.setHost(host); - connectionFactory.setPort(port); - connectionFactory.setUsername(username); - connectionFactory.setPassword(password); - connectionFactory.setVirtualHost(virtualHost); - return connectionFactory; - } - - // ==================== Message Converter ==================== - - /** - * 注意:必须使用 Spring Boot 自动注入的 ObjectMapper - * Spring Boot 已全局配置 Jackson2ObjectMapperBuilderCustomizer, - * 包括 JavaTimeModule 支持纳秒精度 LocalDateTime 序列化/反序列化 - */ - @Bean - public MessageConverter messageConverter(ObjectMapper objectMapper) { - return new Jackson2JsonMessageConverter(objectMapper); - } - - // ==================== RabbitTemplate ==================== - - @Bean - public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory, MessageConverter messageConverter) { - RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory); - rabbitTemplate.setMessageConverter(messageConverter); - return rabbitTemplate; - } - - @Bean - public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory( - ConnectionFactory connectionFactory, MessageConverter messageConverter) { - SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); - factory.setConnectionFactory(connectionFactory); - factory.setMessageConverter(messageConverter); - // 设置并发数 - factory.setConcurrentConsumers(1); - factory.setMaxConcurrentConsumers(5); - // 设置手动ack - factory.setAcknowledgeMode(AcknowledgeMode.MANUAL); - // 预取数量 - factory.setPrefetchCount(10); - return factory; - } - - // ==================== 交换机 ==================== - - /** - * Topic Exchange - 与 server-api 共用的交换机 - * server-api 发送消息时使用 routing key: user.sync.websopy - */ - @Bean - public TopicExchange syncExchange() { - return new TopicExchange(SYNC_EXCHANGE, true, false); - } - - @Bean - public DirectExchange deadLetterExchange() { - return new DirectExchange(DLX_EXCHANGE, true, false); - } - - // ==================== 队列 ==================== - - /** - * websopy 专用同步队列 - * 绑定到 sync.exchange,接收 routing key 为 user.sync.websopy 的消息 - */ - @Bean - public Queue syncQueueWebsopy() { - return QueueBuilder.durable(SYNC_QUEUE_WEBSOPY) - .withArgument("x-dead-letter-exchange", DLX_EXCHANGE) - .withArgument("x-dead-letter-routing-key", DLQ_ROUTING_KEY) - .build(); - } - - @Bean - public Queue deadLetterQueue() { - return QueueBuilder.durable(DLQ_QUEUE_WEBSOPY).build(); - } - - // ==================== 绑定 ==================== - - /** - * 绑定 websopy 队列到 Topic Exchange - * routing key: user.sync.websopy - */ - @Bean - public Binding syncBindingWebsopy() { - return BindingBuilder.bind(syncQueueWebsopy()) - .to(syncExchange()) - .with(SYNC_ROUTING_KEY_WEBSOPY); - } - - @Bean - public Binding dlqBinding() { - return BindingBuilder.bind(deadLetterQueue()) - .to(deadLetterExchange()) - .with(DLQ_ROUTING_KEY); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/common/mq/consumer/SyncMessageConsumer.java b/jczxw-java/src/main/java/com/gxwebsoft/common/mq/consumer/SyncMessageConsumer.java deleted file mode 100644 index a8c7a1d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/common/mq/consumer/SyncMessageConsumer.java +++ /dev/null @@ -1,255 +0,0 @@ -package com.gxwebsoft.common.mq.consumer; - -import com.gxwebsoft.app.entity.AppUserCache; -import com.gxwebsoft.app.service.AppUserCacheService; -import com.gxwebsoft.common.mq.config.RabbitMQConfig; -import com.gxwebsoft.common.mq.message.SyncMessage; -import com.rabbitmq.client.Channel; -import lombok.extern.slf4j.Slf4j; -import org.springframework.amqp.core.Message; -import org.springframework.amqp.rabbit.annotation.RabbitListener; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.stereotype.Component; - -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.Map; - -/** - * 同步消息消费者 - websopy 端监听来自 server-api 的消息 - * - * 监听队列: user.sync.websopy.queue - * 接收来自 server-api 的用户同步消息(CREATE/UPDATE/DELETE) - */ -@Slf4j -@Component -@ConditionalOnProperty(name = "sync.mq.enabled", havingValue = "true", matchIfMissing = true) -public class SyncMessageConsumer { - - @Autowired - private AppUserCacheService appUserCacheService; - - /** 本租户ID,用于验证消息是否属于本租户 */ - @Value("${sync.tenant-id:0}") - private Integer localTenantId; - - private static final int MAX_RETRY_COUNT = 3; - - /** - * 监听 websopy 专用同步队列 - * 接收 server-api 发送的用户同步消息 - */ - @RabbitListener(queues = RabbitMQConfig.SYNC_QUEUE_WEBSOPY) - public void handleMessage(SyncMessage message, Channel channel, Message amqpMessage) { - long deliveryTag = amqpMessage.getMessageProperties().getDeliveryTag(); - - try { - log.info("websopy 收到MQ消息: messageId={}, type={}, event={}, target={}", - message.getMessageId(), message.getMessageType(), - message.getEventType(), message.getTargetSystem()); - - // 处理消息 - processMessage(message); - - // 确认消息 - channel.basicAck(deliveryTag, false); - log.info("websopy 消息处理成功: messageId={}", message.getMessageId()); - - } catch (Exception e) { - log.error("websopy 消息处理失败: messageId={}, error={}", message.getMessageId(), e.getMessage(), e); - handleFailure(channel, amqpMessage, deliveryTag, message, e); - } - } - - /** - * 处理消息 - */ - private void processMessage(SyncMessage message) { - String messageType = message.getMessageType(); - String eventType = message.getEventType(); - Map data = message.getData(); - - if ("USER_SYNC".equals(messageType)) { - handleUserSync(eventType, data); - } else { - log.warn("未知的消息类型: messageType={}", messageType); - } - } - - /** - * 处理用户同步 - */ - private void handleUserSync(String eventType, Map data) { - if (data == null || data.isEmpty()) { - log.warn("用户数据为空,跳过处理"); - return; - } - - Integer userId = getIntValue(data, "userId"); - Integer tenantId = getIntValue(data, "tenantId"); - - if (userId == null) { - log.warn("用户数据中缺少userId,跳过处理"); - return; - } - - if (tenantId == null) { - log.warn("用户数据中缺少tenantId,跳过处理: userId={}", userId); - return; - } - - // 【关键】租户隔离验证:只处理本租户的数据 - if (localTenantId != null && localTenantId > 0 && !localTenantId.equals(tenantId)) { - log.info("租户ID不匹配,跳过处理: userId={}, messageTenantId={}, localTenantId={}", - userId, tenantId, localTenantId); - return; - } - - // 获取当前数据库中的用户缓存(用于对比) - AppUserCache existingCache = appUserCacheService.getById(userId); - - switch (eventType) { - case "CREATE": - case "UPDATE": - AppUserCache userCache = buildUserCache(data); - - // 【增强】详细日志:打印变更前后的对比 - if (existingCache != null) { - log.info("【UPDATE】用户信息变更检测: userId={}, tenantId={}, event={}, " + - "username: '{}' -> '{}', " + - "nickname: '{}' -> '{}', " + - "phone: '{}' -> '{}', " + - "avatar: '{}' -> '{}'", - userId, tenantId, eventType, - existingCache.getUsername(), userCache.getUsername(), - existingCache.getNickname(), userCache.getNickname(), - existingCache.getPhone(), userCache.getPhone(), - existingCache.getAvatar(), userCache.getAvatar()); - - // 执行更新 - boolean updated = appUserCacheService.updateById(userCache); - log.info("用户更新{}: userId={}, result={}", eventType, userId, updated); - } else { - log.info("【CREATE】新增用户缓存: userId={}, tenantId={}, username={}", - userId, tenantId, userCache.getUsername()); - - // 解决 MyBatis-Plus saveOrUpdate 对 IdType.INPUT 主键的兼容问题 - // 先查询再决定 insert/update,捕获并发冲突异常后回退到 update - try { - appUserCacheService.save(userCache); - log.info("用户创建成功: userId={}", userId); - } catch (org.springframework.dao.DuplicateKeyException e) { - // 并发场景:其他线程已插入,改为更新 - log.warn("并发插入冲突,改为更新: userId={}", userId); - appUserCacheService.updateById(userCache); - } - } - break; - case "DELETE": - if (existingCache != null) { - appUserCacheService.removeById(userId); - log.info("websopy 用户删除成功: userId={}, tenantId={}", userId, tenantId); - } else { - log.info("用户不存在,无需删除: userId={}", userId); - } - break; - default: - log.warn("未知的用户事件类型: eventType={}", eventType); - } - } - - /** - * 构建用户缓存对象 - */ - private AppUserCache buildUserCache(Map data) { - AppUserCache userCache = new AppUserCache(); - userCache.setUserId(getIntValue(data, "userId")); - userCache.setUsername(getStringValue(data, "username")); - userCache.setNickname(getStringValue(data, "nickname")); - userCache.setAvatar(getStringValue(data, "avatar")); - userCache.setPhone(getStringValue(data, "phone")); - userCache.setStatus(getIntValue(data, "status", 1)); - userCache.setTenantId(getIntValue(data, "tenantId")); - userCache.setUpdateTime(LocalDateTime.now()); - return userCache; - } - - /** - * 处理失败消息 - */ - private void handleFailure(Channel channel, Message amqpMessage, long deliveryTag, - SyncMessage message, Exception e) { - Integer retryCount = message.getRetryCount(); - if (retryCount == null) { - retryCount = 0; - } - - if (retryCount < MAX_RETRY_COUNT) { - try { - log.warn("websopy 消息处理失败,准备重试: messageId={}, retryCount={}/{}", - message.getMessageId(), retryCount + 1, MAX_RETRY_COUNT); - channel.basicNack(deliveryTag, false, true); - } catch (IOException ioException) { - log.error("消息拒绝失败: messageId={}", message.getMessageId(), ioException); - } - } else { - try { - log.error("websopy 消息处理失败次数超限,发送到死信队列: messageId={}, retryCount={}", - message.getMessageId(), retryCount); - channel.basicNack(deliveryTag, false, false); - } catch (IOException ioException) { - log.error("消息拒绝失败: messageId={}", message.getMessageId(), ioException); - } - } - } - - /** - * 监听 websopy 死信队列消息 - */ - @RabbitListener(queues = RabbitMQConfig.DLQ_QUEUE_WEBSOPY) - public void handleDeadLetter(SyncMessage message, Channel channel, Message amqpMessage) { - long deliveryTag = amqpMessage.getMessageProperties().getDeliveryTag(); - try { - log.error("websopy 死信消息: messageId={}, type={}, event={}, retryCount={}", - message.getMessageId(), message.getMessageType(), - message.getEventType(), message.getRetryCount()); - channel.basicAck(deliveryTag, false); - } catch (Exception e) { - log.error("处理死信消息失败: messageId={}", message.getMessageId(), e); - try { - channel.basicAck(deliveryTag, false); - } catch (IOException ioException) { - log.error("确认死信消息失败", ioException); - } - } - } - - private String getStringValue(Map data, String key) { - Object value = data.get(key); - return value != null ? String.valueOf(value) : ""; - } - - private Integer getIntValue(Map data, String key) { - return getIntValue(data, key, null); - } - - private Integer getIntValue(Map data, String key, Integer defaultValue) { - Object value = data.get(key); - if (value == null) { - return defaultValue; - } - if (value instanceof Integer) { - return (Integer) value; - } - if (value instanceof Number) { - return ((Number) value).intValue(); - } - try { - return Integer.parseInt(String.valueOf(value)); - } catch (NumberFormatException e) { - return defaultValue; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/common/mq/message/SyncMessage.java b/jczxw-java/src/main/java/com/gxwebsoft/common/mq/message/SyncMessage.java deleted file mode 100644 index 1a6e537..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/common/mq/message/SyncMessage.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.common.mq.message; - -import lombok.Data; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.Map; - -/** - * 同步消息实体 - 接收来自 server-api 的消息 - */ -@Data -public class SyncMessage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 消息唯一ID - */ - private String messageId; - - /** - * 消息类型:USER_SYNC, TENANT_SYNC, etc. - */ - private String messageType; - - /** - * 事件类型:CREATE, UPDATE, DELETE - */ - private String eventType; - - /** - * 目标系统标识 - */ - private String targetSystem; - - /** - * 业务数据 - */ - private Map data; - - /** - * 创建时间 - */ - private LocalDateTime createTime; - - /** - * 重试次数 - */ - private Integer retryCount; - - public SyncMessage() { - this.createTime = LocalDateTime.now(); - this.retryCount = 0; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/constants/PaymentConstants.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/constants/PaymentConstants.java deleted file mode 100644 index 80f0354..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/constants/PaymentConstants.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.gxwebsoft.payment.constants; - -/** - * 支付模块常量类 - * 统一管理支付相关的常量配置 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public class PaymentConstants { - - /** - * 支付状态常量 - */ - public static class Status { - /** 待支付 */ - public static final String PENDING = "PENDING"; - /** 支付成功 */ - public static final String SUCCESS = "SUCCESS"; - /** 支付失败 */ - public static final String FAILED = "FAILED"; - /** 支付取消 */ - public static final String CANCELLED = "CANCELLED"; - /** 支付超时 */ - public static final String TIMEOUT = "TIMEOUT"; - /** 退款成功 */ - public static final String REFUNDED = "REFUNDED"; - } - - /** - * 微信支付相关常量 - */ - public static class Wechat { - /** 货币类型 */ - public static final String CURRENCY = "CNY"; - /** 金额转换倍数(元转分) */ - public static final int AMOUNT_MULTIPLIER = 100; - - /** 支付状态 */ - public static final String PAY_SUCCESS = "SUCCESS"; - public static final String PAY_REFUND = "REFUND"; - public static final String PAY_NOTPAY = "NOTPAY"; - public static final String PAY_CLOSED = "CLOSED"; - public static final String PAY_REVOKED = "REVOKED"; - public static final String PAY_USERPAYING = "USERPAYING"; - public static final String PAY_PAYERROR = "PAYERROR"; - - /** 回调响应 */ - public static final String NOTIFY_SUCCESS = "SUCCESS"; - public static final String NOTIFY_FAIL = "FAIL"; - - /** 通知类型 */ - public static final String EVENT_PAYMENT = "TRANSACTION.SUCCESS"; - public static final String EVENT_REFUND = "REFUND.SUCCESS"; - - /** HTTP头部 */ - public static final String HEADER_SIGNATURE = "Wechatpay-Signature"; - public static final String HEADER_TIMESTAMP = "Wechatpay-Timestamp"; - public static final String HEADER_NONCE = "Wechatpay-Nonce"; - public static final String HEADER_SERIAL = "Wechatpay-Serial"; - public static final String HEADER_REQUEST_ID = "Request-ID"; - } - - /** - * 支付宝相关常量 - */ - public static class Alipay { - /** 货币类型 */ - public static final String CURRENCY = "CNY"; - - /** 支付状态 */ - public static final String PAY_SUCCESS = "TRADE_SUCCESS"; - public static final String PAY_FINISHED = "TRADE_FINISHED"; - public static final String PAY_CLOSED = "TRADE_CLOSED"; - - /** 回调响应 */ - public static final String NOTIFY_SUCCESS = "success"; - public static final String NOTIFY_FAIL = "failure"; - - /** 产品码 */ - public static final String PRODUCT_CODE_WEB = "FAST_INSTANT_TRADE_PAY"; - public static final String PRODUCT_CODE_WAP = "QUICK_WAP_WAY"; - public static final String PRODUCT_CODE_APP = "QUICK_MSECURITY_PAY"; - } - - /** - * 银联支付相关常量 - */ - public static class UnionPay { - /** 货币类型 */ - public static final String CURRENCY = "156"; // 人民币代码 - - /** 支付状态 */ - public static final String PAY_SUCCESS = "00"; - public static final String PAY_FAILED = "01"; - - /** 交易类型 */ - public static final String TXN_TYPE_CONSUME = "01"; // 消费 - public static final String TXN_TYPE_REFUND = "04"; // 退货 - } - - /** - * 缓存键常量 - */ - public static class CacheKey { - /** 支付配置缓存前缀 */ - public static final String PAYMENT_CONFIG = "payment:config:"; - /** 支付订单缓存前缀 */ - public static final String PAYMENT_ORDER = "payment:order:"; - /** 支付锁前缀 */ - public static final String PAYMENT_LOCK = "payment:lock:"; - /** 回调处理锁前缀 */ - public static final String NOTIFY_LOCK = "payment:notify:lock:"; - } - - /** - * 配置相关常量 - */ - public static class Config { - /** 订单超时时间(分钟) */ - public static final int ORDER_TIMEOUT_MINUTES = 30; - /** 订单描述最大长度 */ - public static final int DESCRIPTION_MAX_LENGTH = 127; - /** 最大重试次数 */ - public static final int MAX_RETRY_COUNT = 3; - /** 重试间隔(毫秒) */ - public static final long RETRY_INTERVAL_MS = 1000; - /** 签名有效期(秒) */ - public static final long SIGNATURE_VALID_SECONDS = 300; - } - - /** - * 错误信息常量 - */ - public static class ErrorMessage { - /** 参数错误 */ - public static final String PARAM_ERROR = "参数错误"; - /** 配置未找到 */ - public static final String CONFIG_NOT_FOUND = "支付配置未找到"; - /** 支付方式不支持 */ - public static final String PAYMENT_TYPE_NOT_SUPPORTED = "支付方式不支持"; - /** 金额错误 */ - public static final String AMOUNT_ERROR = "金额错误"; - /** 订单不存在 */ - public static final String ORDER_NOT_FOUND = "订单不存在"; - /** 订单状态错误 */ - public static final String ORDER_STATUS_ERROR = "订单状态错误"; - /** 签名验证失败 */ - public static final String SIGNATURE_ERROR = "签名验证失败"; - /** 网络请求失败 */ - public static final String NETWORK_ERROR = "网络请求失败"; - /** 系统内部错误 */ - public static final String SYSTEM_ERROR = "系统内部错误"; - /** 余额不足 */ - public static final String INSUFFICIENT_BALANCE = "余额不足"; - /** 支付超时 */ - public static final String PAYMENT_TIMEOUT = "支付超时"; - /** 重复支付 */ - public static final String DUPLICATE_PAYMENT = "重复支付"; - } - - /** - * 日志消息常量 - */ - public static class LogMessage { - /** 支付请求开始 */ - public static final String PAYMENT_START = "开始处理支付请求"; - /** 支付请求成功 */ - public static final String PAYMENT_SUCCESS = "支付请求处理成功"; - /** 支付请求失败 */ - public static final String PAYMENT_FAILED = "支付请求处理失败"; - - /** 回调处理开始 */ - public static final String NOTIFY_START = "开始处理支付回调"; - /** 回调处理成功 */ - public static final String NOTIFY_SUCCESS = "支付回调处理成功"; - /** 回调处理失败 */ - public static final String NOTIFY_FAILED = "支付回调处理失败"; - - /** 退款请求开始 */ - public static final String REFUND_START = "开始处理退款请求"; - /** 退款请求成功 */ - public static final String REFUND_SUCCESS = "退款请求处理成功"; - /** 退款请求失败 */ - public static final String REFUND_FAILED = "退款请求处理失败"; - } - - /** - * 正则表达式常量 - */ - public static class Regex { - /** 订单号格式 */ - public static final String ORDER_NO = "^[a-zA-Z0-9_-]{1,32}$"; - /** 金额格式(分) */ - public static final String AMOUNT = "^[1-9]\\d*$"; - /** 手机号格式 */ - public static final String MOBILE = "^1[3-9]\\d{9}$"; - /** 邮箱格式 */ - public static final String EMAIL = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"; - } - - /** - * 时间相关常量 - */ - public static class Time { - /** 配置缓存有效期(秒) */ - public static final long CONFIG_CACHE_SECONDS = 3600; - /** 订单缓存有效期(秒) */ - public static final long ORDER_CACHE_SECONDS = 1800; - /** 支付锁有效期(秒) */ - public static final long PAYMENT_LOCK_SECONDS = 60; - /** 回调锁有效期(秒) */ - public static final long NOTIFY_LOCK_SECONDS = 30; - } - - /** - * 文件相关常量 - */ - public static class File { - /** 证书文件扩展名 */ - public static final String CERT_EXTENSION = ".pem"; - /** 私钥文件后缀 */ - public static final String PRIVATE_KEY_SUFFIX = "_key.pem"; - /** 公钥文件后缀 */ - public static final String PUBLIC_KEY_SUFFIX = "_cert.pem"; - } - - /** - * 环境相关常量 - */ - public static class Environment { - /** 开发环境 */ - public static final String DEV = "dev"; - /** 测试环境 */ - public static final String TEST = "test"; - /** 生产环境 */ - public static final String PROD = "prod"; - } - - // 私有构造函数,防止实例化 - private PaymentConstants() { - throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/constants/WechatPayType.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/constants/WechatPayType.java deleted file mode 100644 index 68b2d84..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/constants/WechatPayType.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.gxwebsoft.payment.constants; - -/** - * 微信支付类型常量 - * 定义微信支付的具体实现方式 - * - * @author 科技小王子 - * @since 2025-08-30 - */ -public class WechatPayType { - - /** - * JSAPI支付 - 小程序/公众号内支付 - * 需要用户的openid - */ - public static final String JSAPI = "JSAPI"; - - /** - * Native支付 - 扫码支付 - * 生成二维码供用户扫描支付 - */ - public static final String NATIVE = "NATIVE"; - - /** - * H5支付 - 手机网页支付 - * 在手机浏览器中调起微信支付 - */ - public static final String H5 = "H5"; - - /** - * APP支付 - 移动应用支付 - * 在APP中调起微信支付 - */ - public static final String APP = "APP"; - - /** - * 根据openid自动选择微信支付类型 - * - * @param openid 用户openid - * @return JSAPI 或 NATIVE - */ - public static String getAutoType(String openid) { - return (openid != null && !openid.trim().isEmpty()) ? JSAPI : NATIVE; - } - - /** - * 检查是否为有效的微信支付类型 - * - * @param payType 支付类型 - * @return true表示有效 - */ - public static boolean isValidType(String payType) { - return JSAPI.equals(payType) || NATIVE.equals(payType) || - H5.equals(payType) || APP.equals(payType); - } - - /** - * 获取支付类型描述 - * - * @param payType 支付类型 - * @return 描述文本 - */ - public static String getDescription(String payType) { - if (payType == null) { - return "未知支付类型"; - } - - switch (payType) { - case JSAPI: - return "小程序/公众号支付"; - case NATIVE: - return "扫码支付"; - case H5: - return "手机网页支付"; - case APP: - return "移动应用支付"; - default: - return "未知支付类型: " + payType; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/controller/PaymentController.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/controller/PaymentController.java deleted file mode 100644 index 0d51551..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/controller/PaymentController.java +++ /dev/null @@ -1,360 +0,0 @@ -package com.gxwebsoft.payment.controller; - -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.payment.constants.PaymentConstants; -import com.gxwebsoft.payment.dto.PaymentRequest; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.dto.PaymentStatusUpdateRequest; -import com.gxwebsoft.payment.dto.PaymentWithOrderRequest; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.payment.service.PaymentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Positive; -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -/** - * 统一支付控制器 - * 提供所有支付方式的统一入口 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Validated -@Tag(name = "统一支付接口", description = "支持所有支付方式的统一支付接口") -@RestController("unifiedPaymentController") -@RequestMapping("/api/payment") -public class PaymentController extends BaseController { - - @Resource(name = "unifiedPaymentServiceImpl") - private PaymentService paymentService; - - @Operation(summary = "创建支付订单", description = "支持微信、支付宝、银联等多种支付方式") - @PostMapping("/create") - public ApiResult createPayment(@Valid @RequestBody PaymentRequest request) { - log.info("收到支付请求: {}", request); - final User loginUser = getLoginUser(); - - if(loginUser == null){ - return fail("请先登录"); - } - - request.setUserId(loginUser.getUserId()); - if(request.getTenantId() == null){ - request.setTenantId(loginUser.getTenantId()); - } - try { - PaymentResponse response = paymentService.createPayment(request); - return this.success("支付订单创建成功", response); - - } catch (PaymentException e) { - log.error("支付订单创建失败: {}", e.getMessage()); - return fail(e.getMessage()); - } catch (Exception e) { - log.error("支付订单创建系统错误: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "创建支付订单(包含订单信息)", description = "统一支付模块:创建订单并发起支付") - @PostMapping("/create-with-order") - public ApiResult createPaymentWithOrder(@Valid @RequestBody PaymentWithOrderRequest request) { - log.info("收到支付与订单创建请求: {}", request); - final User loginUser = getLoginUser(); - - if(loginUser == null){ - return fail("请先登录"); - } - - // 设置用户信息 - if(request.getTenantId() == null){ - request.setTenantId(loginUser.getTenantId()); - } - - try { - PaymentResponse response = paymentService.createPaymentWithOrder(request, loginUser); - return this.success("订单创建并发起支付成功", response); - } catch (PaymentException e) { - log.error("创建支付订单失败: {}", e.getMessage()); - return fail(e.getMessage()); - } catch (Exception e) { - log.error("创建支付订单系统错误: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "查询支付状态", description = "查询指定订单的支付状态") - @GetMapping("/query") - public ApiResult queryPayment( - @Parameter(description = "订单号", required = true) - @RequestParam @NotBlank(message = "订单号不能为空") String orderNo, - - @Parameter(description = "支付类型", required = true) - @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, - - @Parameter(description = "租户ID", required = true) - @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { - - log.info("查询支付状态: orderNo={}, paymentType={}, tenantId={}", orderNo, paymentType, tenantId); - - // 参数验证 - if (orderNo == null || orderNo.trim().isEmpty()) { - return fail("订单号不能为空"); - } - if (paymentType == null) { - return fail("支付类型不能为空"); - } - if (tenantId == null || tenantId <= 0) { - return fail("租户ID不能为空且必须为正数"); - } - - try { - PaymentResponse response = paymentService.queryPayment(orderNo, paymentType, tenantId); - return this.success("支付状态查询成功", response); - - } catch (PaymentException e) { - log.error("支付状态查询失败: {}", e.getMessage()); - return fail(e.getMessage()); - } catch (Exception e) { - log.error("支付状态查询系统错误: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "申请退款", description = "申请订单退款") - @PostMapping("/refund") - public ApiResult refund( - @Parameter(description = "订单号", required = true) - @RequestParam @NotBlank(message = "订单号不能为空") String orderNo, - - @Parameter(description = "退款单号", required = true) - @RequestParam @NotBlank(message = "退款单号不能为空") String refundNo, - - @Parameter(description = "支付类型", required = true) - @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, - - @Parameter(description = "订单总金额", required = true) - @RequestParam @NotNull(message = "订单总金额不能为空") @Positive(message = "订单总金额必须大于0") BigDecimal totalAmount, - - @Parameter(description = "退款金额", required = true) - @RequestParam @NotNull(message = "退款金额不能为空") @Positive(message = "退款金额必须大于0") BigDecimal refundAmount, - - @Parameter(description = "退款原因") - @RequestParam(required = false) String reason, - - @Parameter(description = "租户ID", required = true) - @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { - - log.info("申请退款: orderNo={}, refundNo={}, paymentType={}, totalAmount={}, refundAmount={}, tenantId={}", - orderNo, refundNo, paymentType, totalAmount, refundAmount, tenantId); - - try { - PaymentResponse response = paymentService.refund(orderNo, refundNo, paymentType, - totalAmount, refundAmount, reason, tenantId); - return this.success("退款申请成功", response); - - } catch (PaymentException e) { - log.error("退款申请失败: {}", e.getMessage()); - return fail(e.getMessage()); - } catch (Exception e) { - log.error("退款申请系统错误: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "查询退款状态", description = "查询指定退款单的状态") - @GetMapping("/refund/query") - public ApiResult queryRefund( - @Parameter(description = "退款单号", required = true) - @RequestParam @NotBlank(message = "退款单号不能为空") String refundNo, - - @Parameter(description = "支付类型", required = true) - @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, - - @Parameter(description = "租户ID", required = true) - @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { - - log.info("查询退款状态: refundNo={}, paymentType={}, tenantId={}", refundNo, paymentType, tenantId); - - try { - PaymentResponse response = paymentService.queryRefund(refundNo, paymentType, tenantId); - return this.success("退款状态查询成功", response); - - } catch (PaymentException e) { - log.error("退款状态查询失败: {}", e.getMessage()); - return fail(e.getMessage()); - } catch (Exception e) { - log.error("退款状态查询系统错误: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "关闭订单", description = "关闭未支付的订单") - @PostMapping("/close") - public ApiResult closeOrder( - @Parameter(description = "订单号", required = true) - @RequestParam @NotBlank(message = "订单号不能为空") String orderNo, - - @Parameter(description = "支付类型", required = true) - @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, - - @Parameter(description = "租户ID", required = true) - @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { - - log.info("关闭订单: orderNo={}, paymentType={}, tenantId={}", orderNo, paymentType, tenantId); - - try { - boolean result = paymentService.closeOrder(orderNo, paymentType, tenantId); - return success(result ? "订单关闭成功" : "订单关闭失败", result); - - } catch (PaymentException e) { - log.error("订单关闭失败: {}", e.getMessage()); - return fail(e.getMessage()); - } catch (Exception e) { - log.error("订单关闭系统错误: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "获取支持的支付类型", description = "获取系统支持的所有支付类型列表") - @GetMapping("/types") - public ApiResult getSupportedPaymentTypes() { - try { - List paymentTypes = paymentService.getSupportedPaymentTypes(); - return this.>success("获取支付类型成功", paymentTypes); - } catch (Exception e) { - log.error("获取支付类型失败: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "获取支付策略信息", description = "获取指定支付类型的策略信息") - @GetMapping("/strategy/{paymentType}") - public ApiResult getPaymentStrategyInfo( - @Parameter(description = "支付类型", required = true) - @PathVariable @NotNull(message = "支付类型不能为空") PaymentType paymentType) { - - try { - Map strategyInfo = paymentService.getPaymentStrategyInfo(paymentType); - if (strategyInfo == null) { - return fail("不支持的支付类型: " + paymentType); - } - return success("获取策略信息成功", strategyInfo); - } catch (Exception e) { - log.error("获取策略信息失败: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "获取所有支付策略信息", description = "获取系统所有支付策略的详细信息") - @GetMapping("/strategies") - public ApiResult getAllPaymentStrategyInfo() { - try { - List> strategiesInfo = paymentService.getAllPaymentStrategyInfo(); - return this.>>success("获取所有策略信息成功", strategiesInfo); - } catch (Exception e) { - log.error("获取所有策略信息失败: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "检查支付类型支持情况", description = "检查指定支付类型的功能支持情况") - @GetMapping("/support/{paymentType}") - public ApiResult checkPaymentTypeSupport( - @Parameter(description = "支付类型", required = true) - @PathVariable @NotNull(message = "支付类型不能为空") PaymentType paymentType) { - - try { - Map support = Map.of( - "supported", paymentService.isPaymentTypeSupported(paymentType), - "refundSupported", paymentService.isRefundSupported(paymentType), - "querySupported", paymentService.isQuerySupported(paymentType), - "closeSupported", paymentService.isCloseSupported(paymentType), - "notifyNeeded", paymentService.isNotifyNeeded(paymentType) - ); - return this.>success("检查支持情况成功", support); - } catch (Exception e) { - log.error("检查支持情况失败: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - } - - @Operation(summary = "手动更新支付状态", description = "用于手动同步支付状态,通常用于异常情况处理") - @PutMapping("/update-status") - public ApiResult updatePaymentStatus(@Valid @RequestBody PaymentStatusUpdateRequest request) { - log.info("收到支付状态更新请求: {}", request); - - try { - // 查询并更新支付状态 - PaymentResponse response = paymentService.queryPayment( - request.getOrderNo(), - PaymentType.WECHAT_NATIVE, - request.getTenantId() - ); - - return this.success("支付状态更新成功", response); - } catch (Exception e) { - log.error("更新支付状态失败: {}", e.getMessage(), e); - return fail("更新支付状态失败: " + e.getMessage()); - } - } - - @Operation(summary = "检查支付配置", description = "检查指定租户的支付配置是否完整") - @GetMapping("/config/check") - public ApiResult checkPaymentConfig( - @Parameter(description = "租户ID", required = true) - @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { - - log.info("检查支付配置,租户ID: {}", tenantId); - - try { - Map configStatus = paymentService.checkPaymentConfig(tenantId); - return this.>success("配置检查完成", configStatus); - } catch (Exception e) { - log.error("检查支付配置失败: {}", e.getMessage(), e); - return fail("检查支付配置失败: " + e.getMessage()); - } - } - - @Operation(summary = "查询用户最近的支付订单", description = "当orderNo缺失时,查询用户最近创建的支付订单") - @GetMapping("/query-recent") - public ApiResult queryRecentPayment( - @Parameter(description = "支付类型", required = true) - @RequestParam @NotNull(message = "支付类型不能为空") PaymentType paymentType, - - @Parameter(description = "租户ID", required = true) - @RequestParam @NotNull(message = "租户ID不能为空") @Positive(message = "租户ID必须为正数") Integer tenantId) { - - log.info("查询用户最近支付订单: paymentType={}, tenantId={}", paymentType, tenantId); - - final User loginUser = getLoginUser(); - if(loginUser == null){ - return fail("请先登录"); - } - - try { - // 这里需要实现查询用户最近订单的逻辑 - // 可以通过用户ID和租户ID查询最近创建的订单 - return fail("此功能需要实现查询用户最近订单的业务逻辑"); - - } catch (Exception e) { - log.error("查询用户最近支付订单失败: {}", e.getMessage(), e); - return fail("查询失败: " + e.getMessage()); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/controller/PaymentNotifyController.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/controller/PaymentNotifyController.java deleted file mode 100644 index c181514..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/controller/PaymentNotifyController.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.gxwebsoft.payment.controller; - -import com.gxwebsoft.payment.constants.PaymentConstants; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.payment.service.PaymentService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -/** - * 统一支付回调控制器 - * 处理所有支付方式的异步通知回调 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Tag(name = "统一支付回调接口", description = "处理所有支付方式的异步通知回调") -@RestController -@RequestMapping("/api/payment/notify") -public class PaymentNotifyController { - - @Resource - private PaymentService paymentService; - - @Operation(summary = "微信支付回调通知", description = "处理微信支付的异步通知") - @PostMapping("/wechat/{tenantId}") - public String wechatNotify( - @Parameter(description = "租户ID", required = true) - @PathVariable("tenantId") Integer tenantId, - @RequestBody String body, - HttpServletRequest request) { - - log.info("收到微信支付回调通知, 租户ID: {}", tenantId); - - try { - // 提取请求头 - Map headers = extractHeaders(request); - - // 处理回调 - String result = paymentService.handlePaymentNotify(PaymentType.WECHAT_NATIVE, headers, body, tenantId); - - log.info("微信支付回调处理完成, 租户ID: {}, 结果: {}", tenantId, result); - return result; - - } catch (PaymentException e) { - log.error("微信支付回调处理失败, 租户ID: {}, 错误: {}", tenantId, e.getMessage()); - return PaymentConstants.Wechat.NOTIFY_FAIL; - } catch (Exception e) { - log.error("微信支付回调系统错误, 租户ID: {}, 错误: {}", tenantId, e.getMessage(), e); - return PaymentConstants.Wechat.NOTIFY_FAIL; - } - } - - @Operation(summary = "支付宝支付回调通知", description = "处理支付宝支付的异步通知") - @PostMapping("/alipay/{tenantId}") - public String alipayNotify( - @Parameter(description = "租户ID", required = true) - @PathVariable("tenantId") Integer tenantId, - @RequestBody String body, - HttpServletRequest request) { - - log.info("收到支付宝支付回调通知, 租户ID: {}", tenantId); - - try { - // 提取请求头 - Map headers = extractHeaders(request); - - // 处理回调 - String result = paymentService.handlePaymentNotify(PaymentType.ALIPAY, headers, body, tenantId); - - log.info("支付宝支付回调处理完成, 租户ID: {}, 结果: {}", tenantId, result); - return result; - - } catch (PaymentException e) { - log.error("支付宝支付回调处理失败, 租户ID: {}, 错误: {}", tenantId, e.getMessage()); - return PaymentConstants.Alipay.NOTIFY_FAIL; - } catch (Exception e) { - log.error("支付宝支付回调系统错误, 租户ID: {}, 错误: {}", tenantId, e.getMessage(), e); - return PaymentConstants.Alipay.NOTIFY_FAIL; - } - } - - @Operation(summary = "银联支付回调通知", description = "处理银联支付的异步通知") - @PostMapping("/unionpay/{tenantId}") - public String unionPayNotify( - @Parameter(description = "租户ID", required = true) - @PathVariable("tenantId") Integer tenantId, - @RequestBody String body, - HttpServletRequest request) { - - log.info("收到银联支付回调通知, 租户ID: {}", tenantId); - - try { - // 提取请求头 - Map headers = extractHeaders(request); - - // 处理回调 - String result = paymentService.handlePaymentNotify(PaymentType.UNION_PAY, headers, body, tenantId); - - log.info("银联支付回调处理完成, 租户ID: {}, 结果: {}", tenantId, result); - return result; - - } catch (PaymentException e) { - log.error("银联支付回调处理失败, 租户ID: {}, 错误: {}", tenantId, e.getMessage()); - return "failure"; - } catch (Exception e) { - log.error("银联支付回调系统错误, 租户ID: {}, 错误: {}", tenantId, e.getMessage(), e); - return "failure"; - } - } - - @Operation(summary = "通用支付回调通知", description = "处理指定支付类型的异步通知") - @PostMapping("/{paymentType}/{tenantId}") - public String genericNotify( - @Parameter(description = "支付类型", required = true) - @PathVariable("paymentType") PaymentType paymentType, - @Parameter(description = "租户ID", required = true) - @PathVariable("tenantId") Integer tenantId, - @RequestBody String body, - HttpServletRequest request) { - - log.info("收到{}支付回调通知, 租户ID: {}", paymentType.getName(), tenantId); - - try { - // 提取请求头 - Map headers = extractHeaders(request); - - // 处理回调 - String result = paymentService.handlePaymentNotify(paymentType, headers, body, tenantId); - - log.info("{}支付回调处理完成, 租户ID: {}, 结果: {}", paymentType.getName(), tenantId, result); - return result; - - } catch (PaymentException e) { - log.error("{}支付回调处理失败, 租户ID: {}, 错误: {}", paymentType.getName(), tenantId, e.getMessage()); - return getFailureResponse(paymentType); - } catch (Exception e) { - log.error("{}支付回调系统错误, 租户ID: {}, 错误: {}", paymentType.getName(), tenantId, e.getMessage(), e); - return getFailureResponse(paymentType); - } - } - - /** - * 提取HTTP请求头 - */ - private Map extractHeaders(HttpServletRequest request) { - Map headers = new HashMap<>(); - - Enumeration headerNames = request.getHeaderNames(); - while (headerNames.hasMoreElements()) { - String headerName = headerNames.nextElement(); - String headerValue = request.getHeader(headerName); - headers.put(headerName, headerValue); - } - - // 记录关键头部信息(不记录敏感信息) - log.debug("提取请求头完成, 头部数量: {}", headers.size()); - - return headers; - } - - /** - * 根据支付类型获取失败响应 - */ - private String getFailureResponse(PaymentType paymentType) { - switch (paymentType) { - case WECHAT: - case WECHAT_NATIVE: - return PaymentConstants.Wechat.NOTIFY_FAIL; - case ALIPAY: - return PaymentConstants.Alipay.NOTIFY_FAIL; - case UNION_PAY: - return "failure"; - default: - return "fail"; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentRequest.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentRequest.java deleted file mode 100644 index 241b549..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentRequest.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.gxwebsoft.payment.dto; - -import com.gxwebsoft.payment.enums.PaymentChannel; -import com.gxwebsoft.payment.enums.PaymentType; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.*; -import java.math.BigDecimal; -import java.util.Map; - -/** - * 统一支付请求DTO - * 支持所有支付方式的统一请求格式 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Data -@Schema(name = "统一支付请求", description = "支持所有支付方式的统一支付请求参数") -public class PaymentRequest { - - @Schema(description = "租户ID", required = true) - @NotNull(message = "租户ID不能为空") - @Positive(message = "租户ID必须为正数") - private Integer tenantId; - - @Schema(description = "用户ID", required = true) - @NotNull(message = "用户ID不能为空") - @Positive(message = "用户ID必须为正数") - private Integer userId; - - @Schema(description = "支付类型", required = true, example = "WECHAT") - @NotNull(message = "支付类型不能为空") - private PaymentType paymentType; - - @Schema(description = "支付渠道", example = "wechat_native") - private PaymentChannel paymentChannel; - - @Schema(description = "支付金额", required = true, example = "0.01") - @NotNull(message = "支付金额不能为空") - @DecimalMin(value = "0.01", message = "支付金额必须大于0.01元") - @DecimalMax(value = "999999.99", message = "支付金额不能超过999999.99元") - @Digits(integer = 6, fraction = 2, message = "支付金额格式不正确,最多6位整数2位小数") - private BigDecimal amount; - - @Schema(description = "订单号(可选,不提供则自动生成)") - @Size(max = 32, message = "订单号不能超过32个字符") - @Pattern(regexp = "^[a-zA-Z0-9_-]*$", message = "订单号只能包含字母、数字、下划线和横线") - private String orderNo; - - @Schema(description = "订单标题", required = true) - @NotBlank(message = "订单标题不能为空") - @Size(max = 127, message = "订单标题不能超过127个字符") - private String subject; - - @Schema(description = "订单描述") - @Size(max = 500, message = "订单描述不能超过500个字符") - private String description; - - @Schema(description = "商品ID") - @Positive(message = "商品ID必须为正数") - private Integer goodsId; - - @Schema(description = "购买数量", example = "1") - @Min(value = 1, message = "购买数量必须大于0") - @Max(value = 9999, message = "购买数量不能超过9999") - private Integer quantity = 1; - - @Schema(description = "订单类型", example = "0") - @Min(value = 0, message = "订单类型不能为负数") - private Integer orderType = 0; - - @Schema(description = "客户端IP地址") - private String clientIp; - - @Schema(description = "用户代理") - private String userAgent; - - @Schema(description = "回调通知URL") - private String notifyUrl; - - @Schema(description = "支付成功跳转URL") - private String returnUrl; - - @Schema(description = "支付取消跳转URL") - private String cancelUrl; - - @Schema(description = "订单超时时间(分钟)", example = "30") - @Min(value = 1, message = "订单超时时间必须大于0分钟") - @Max(value = 1440, message = "订单超时时间不能超过1440分钟(24小时)") - private Integer timeoutMinutes = 30; - - @Schema(description = "买家备注") - @Size(max = 500, message = "买家备注不能超过500个字符") - private String buyerRemarks; - - @Schema(description = "商户备注") - @Size(max = 500, message = "商户备注不能超过500个字符") - private String merchantRemarks; - - @Schema(description = "收货地址ID") - @Positive(message = "收货地址ID必须为正数") - private Integer addressId; - - @Schema(description = "扩展参数") - private Map extraParams; - - // 微信支付特有参数 - @Schema(description = "微信OpenID(JSAPI支付必填)") - private String openId; - - @Schema(description = "微信UnionID") - private String unionId; - - // 支付宝特有参数 - @Schema(description = "支付宝用户ID") - private String alipayUserId; - - @Schema(description = "花呗分期数") - private Integer hbFqNum; - - // 银联支付特有参数 - @Schema(description = "银行卡号") - private String cardNo; - - @Schema(description = "银行代码") - private String bankCode; - - /** - * 获取有效的支付渠道 - */ - public PaymentChannel getEffectivePaymentChannel() { - if (paymentChannel != null) { - return paymentChannel; - } - return PaymentChannel.getDefaultByPaymentType(paymentType); - } - - /** - * 获取有效的订单描述 - */ - public String getEffectiveDescription() { - if (description != null && !description.trim().isEmpty()) { - return description.trim(); - } - return subject; - } - - /** - * 获取格式化的金额字符串 - */ - public String getFormattedAmount() { - if (amount == null) { - return "0.00"; - } - return String.format("%.2f", amount); - } - - /** - * 转换为分(微信支付API需要) - */ - public Integer getAmountInCents() { - if (amount == null) { - return 0; - } - return amount.multiply(new BigDecimal(100)).intValue(); - } - - /** - * 验证必要参数是否完整 - */ - public boolean isValid() { - return tenantId != null && tenantId > 0 - && userId != null && userId > 0 - && paymentType != null - && amount != null && amount.compareTo(BigDecimal.ZERO) > 0 - && subject != null && !subject.trim().isEmpty(); - } - - /** - * 验证微信JSAPI支付参数 - */ - public boolean isValidForWechatJsapi() { - return isValid() && paymentType.isWechatPay() && openId != null && !openId.trim().isEmpty(); - } - - /** - * 验证支付宝支付参数 - */ - public boolean isValidForAlipay() { - return isValid() && paymentType == PaymentType.ALIPAY; - } - - /** - * 获取订单超时时间(秒) - */ - public long getTimeoutSeconds() { - return timeoutMinutes * 60L; - } - - @Override - public String toString() { - return String.format("PaymentRequest{tenantId=%d, userId=%d, paymentType=%s, amount=%s, orderNo='%s', subject='%s'}", - tenantId, userId, paymentType, getFormattedAmount(), orderNo, subject); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentResponse.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentResponse.java deleted file mode 100644 index dea992f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentResponse.java +++ /dev/null @@ -1,294 +0,0 @@ -package com.gxwebsoft.payment.dto; - -import com.gxwebsoft.payment.enums.PaymentChannel; -import com.gxwebsoft.payment.enums.PaymentStatus; -import com.gxwebsoft.payment.enums.PaymentType; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Map; - -/** - * 统一支付响应DTO - * 支持所有支付方式的统一响应格式 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Data -@Schema(name = "统一支付响应", description = "支持所有支付方式的统一支付响应") -public class PaymentResponse { - - @Schema(description = "是否成功") - private Boolean success; - - @Schema(description = "错误代码") - private String errorCode; - - @Schema(description = "错误信息") - private String errorMessage; - - @Schema(description = "订单号") - private String orderNo; - - @Schema(description = "第三方交易号") - private String transactionId; - - @Schema(description = "支付类型") - private PaymentType paymentType; - - @Schema(description = "支付渠道") - private PaymentChannel paymentChannel; - - @Schema(description = "支付状态") - private PaymentStatus paymentStatus; - - @Schema(description = "支付金额") - private BigDecimal amount; - - @Schema(description = "实际支付金额") - private BigDecimal paidAmount; - - @Schema(description = "货币类型") - private String currency; - - @Schema(description = "租户ID") - private Integer tenantId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "创建时间") - private LocalDateTime createTime; - - @Schema(description = "支付时间") - private LocalDateTime payTime; - - @Schema(description = "过期时间") - private LocalDateTime expireTime; - - // 微信支付特有字段 - @Schema(description = "微信支付二维码URL(Native支付)") - private String codeUrl; - - @Schema(description = "微信支付参数(JSAPI支付)") - private WechatPayParams wechatPayParams; - - @Schema(description = "微信H5支付URL") - private String h5Url; - - // 支付宝特有字段 - @Schema(description = "支付宝支付表单(网页支付)") - private String alipayForm; - - @Schema(description = "支付宝支付URL(手机网站支付)") - private String alipayUrl; - - @Schema(description = "支付宝支付参数(APP支付)") - private String alipayParams; - - // 银联支付特有字段 - @Schema(description = "银联支付表单") - private String unionPayForm; - - @Schema(description = "银联支付URL") - private String unionPayUrl; - - @Schema(description = "扩展参数") - private Map extraParams; - - /** - * 微信支付参数 - */ - @Data - @Schema(name = "微信支付参数", description = "微信JSAPI支付所需参数") - public static class WechatPayParams { - @Schema(description = "应用ID") - private String appId; - - @Schema(description = "时间戳") - private String timeStamp; - - @Schema(description = "随机字符串") - private String nonceStr; - - @Schema(description = "订单详情扩展字符串") - private String packageValue; - - @Schema(description = "签名方式") - private String signType; - - @Schema(description = "签名") - private String paySign; - } - - /** - * 创建成功响应 - */ - public static PaymentResponse success(String orderNo, PaymentType paymentType) { - PaymentResponse response = new PaymentResponse(); - response.setSuccess(true); - response.setOrderNo(orderNo); - response.setPaymentType(paymentType); - response.setPaymentStatus(PaymentStatus.PENDING); - response.setCreateTime(LocalDateTime.now()); - return response; - } - - /** - * 创建失败响应 - */ - public static PaymentResponse failure(String errorCode, String errorMessage) { - PaymentResponse response = new PaymentResponse(); - response.setSuccess(false); - response.setErrorCode(errorCode); - response.setErrorMessage(errorMessage); - return response; - } - - /** - * 创建微信Native支付响应 - */ - public static PaymentResponse wechatNative(String orderNo, String codeUrl, BigDecimal amount, Integer tenantId) { - PaymentResponse response = success(orderNo, PaymentType.WECHAT_NATIVE); - response.setCodeUrl(codeUrl); - response.setPaymentChannel(PaymentChannel.WECHAT_NATIVE); - response.setAmount(amount); - response.setTenantId(tenantId); - response.setCurrency("CNY"); - return response; - } - - /** - * 创建微信JSAPI支付响应 - */ - public static PaymentResponse wechatJsapi(String orderNo, WechatPayParams payParams, BigDecimal amount, Integer tenantId) { - PaymentResponse response = success(orderNo, PaymentType.WECHAT); - response.setWechatPayParams(payParams); - response.setPaymentChannel(PaymentChannel.WECHAT_JSAPI); - response.setAmount(amount); - response.setTenantId(tenantId); - response.setCurrency("CNY"); - return response; - } - - /** - * 创建微信H5支付响应 - */ - public static PaymentResponse wechatH5(String orderNo, String h5Url, BigDecimal amount, Integer tenantId) { - PaymentResponse response = success(orderNo, PaymentType.WECHAT); - response.setH5Url(h5Url); - response.setPaymentChannel(PaymentChannel.WECHAT_H5); - response.setAmount(amount); - response.setTenantId(tenantId); - response.setCurrency("CNY"); - return response; - } - - /** - * 创建支付宝网页支付响应 - */ - public static PaymentResponse alipayWeb(String orderNo, String alipayForm, BigDecimal amount, Integer tenantId) { - PaymentResponse response = success(orderNo, PaymentType.ALIPAY); - response.setAlipayForm(alipayForm); - response.setPaymentChannel(PaymentChannel.ALIPAY_WEB); - response.setAmount(amount); - response.setTenantId(tenantId); - response.setCurrency("CNY"); - return response; - } - - /** - * 创建支付宝手机网站支付响应 - */ - public static PaymentResponse alipayWap(String orderNo, String alipayUrl, BigDecimal amount, Integer tenantId) { - PaymentResponse response = success(orderNo, PaymentType.ALIPAY); - response.setAlipayUrl(alipayUrl); - response.setPaymentChannel(PaymentChannel.ALIPAY_WAP); - response.setAmount(amount); - response.setTenantId(tenantId); - response.setCurrency("CNY"); - return response; - } - - /** - * 创建支付宝APP支付响应 - */ - public static PaymentResponse alipayApp(String orderNo, String alipayParams, BigDecimal amount, Integer tenantId) { - PaymentResponse response = success(orderNo, PaymentType.ALIPAY); - response.setAlipayParams(alipayParams); - response.setPaymentChannel(PaymentChannel.ALIPAY_APP); - response.setAmount(amount); - response.setTenantId(tenantId); - response.setCurrency("CNY"); - return response; - } - - /** - * 创建余额支付响应 - */ - public static PaymentResponse balance(String orderNo, BigDecimal amount, Integer tenantId, Integer userId) { - PaymentResponse response = success(orderNo, PaymentType.BALANCE); - response.setPaymentChannel(PaymentChannel.BALANCE); - response.setPaymentStatus(PaymentStatus.SUCCESS); - response.setAmount(amount); - response.setPaidAmount(amount); - response.setTenantId(tenantId); - response.setUserId(userId); - response.setCurrency("CNY"); - response.setPayTime(LocalDateTime.now()); - return response; - } - - /** - * 判断是否为成功响应 - */ - public boolean isSuccess() { - return Boolean.TRUE.equals(success); - } - - /** - * 判断是否需要用户进一步操作 - */ - public boolean needUserAction() { - return isSuccess() && paymentStatus == PaymentStatus.PENDING; - } - - /** - * 获取支付结果描述 - */ - public String getResultDescription() { - if (!isSuccess()) { - return errorMessage != null ? errorMessage : "支付失败"; - } - - if (paymentStatus == null) { - return "支付状态未知"; - } - - switch (paymentStatus) { - case SUCCESS: - return "支付成功"; - case PENDING: - return "等待支付"; - case PROCESSING: - return "支付处理中"; - case FAILED: - return "支付失败"; - case CANCELLED: - return "支付已取消"; - case TIMEOUT: - return "支付超时"; - default: - return paymentStatus.getName(); - } - } - - @Override - public String toString() { - return String.format("PaymentResponse{success=%s, orderNo='%s', paymentType=%s, paymentStatus=%s, amount=%s}", - success, orderNo, paymentType, paymentStatus, amount); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentStatusUpdateRequest.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentStatusUpdateRequest.java deleted file mode 100644 index 5cee3bc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentStatusUpdateRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.gxwebsoft.payment.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Positive; - -/** - * 支付状态更新请求DTO - * 用于手动更新支付状态的请求参数 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Data -@Schema(name = "支付状态更新请求", description = "用于手动更新支付状态") -public class PaymentStatusUpdateRequest { - - @Schema(description = "订单号", required = true, example = "ORDER_1756544921075") - @NotBlank(message = "订单号不能为空") - private String orderNo; - - @Schema(description = "租户ID", required = true, example = "10398") - @NotNull(message = "租户ID不能为空") - @Positive(message = "租户ID必须为正数") - private Integer tenantId; - - @Schema(description = "第三方交易号", example = "4200001234567890123") - private String transactionId; - - @Schema(description = "支付时间", example = "2025-01-26T10:30:00") - private String payTime; - - @Override - public String toString() { - return String.format("PaymentStatusUpdateRequest{orderNo='%s', tenantId=%d, transactionId='%s', payTime='%s'}", - orderNo, tenantId, transactionId, payTime); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentWithOrderRequest.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentWithOrderRequest.java deleted file mode 100644 index 06ee407..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/dto/PaymentWithOrderRequest.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.gxwebsoft.payment.dto; - -import com.gxwebsoft.payment.enums.PaymentType; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.math.BigDecimal; -import java.util.List; - -/** - * 支付与订单创建请求DTO - * 用于统一支付模块中的订单创建和支付 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Data -@Schema(name = "PaymentWithOrderRequest", description = "支付与订单创建请求") -public class PaymentWithOrderRequest { - - // ========== 支付相关字段 ========== - - @Schema(description = "支付类型", required = true) - @NotNull(message = "支付类型不能为空") - private PaymentType paymentType; - - @Schema(description = "支付金额", required = true) - @NotNull(message = "支付金额不能为空") - @DecimalMin(value = "0.01", message = "支付金额必须大于0") - @Digits(integer = 10, fraction = 2, message = "支付金额格式不正确") - private BigDecimal amount; - - @Schema(description = "订单标题", required = true) - @NotBlank(message = "订单标题不能为空") - @Size(max = 60, message = "订单标题长度不能超过60个字符") - private String subject; - - @Schema(description = "订单描述") - @Size(max = 500, message = "订单描述长度不能超过500个字符") - private String description; - - @Schema(description = "租户ID", required = true) - @NotNull(message = "租户ID不能为空") - @Positive(message = "租户ID必须为正数") - private Integer tenantId; - - // ========== 订单相关字段 ========== - - @Schema(description = "订单信息", required = true) - @Valid - @NotNull(message = "订单信息不能为空") - private OrderInfo orderInfo; - - /** - * 订单信息 - */ - @Data - @Schema(name = "OrderInfo", description = "订单信息") - public static class OrderInfo { - - @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") - @NotNull(message = "订单类型不能为空") - @Min(value = 0, message = "订单类型值无效") - @Max(value = 2, message = "订单类型值无效") - private Integer type; - - @Schema(description = "收货人姓名") - @Size(max = 50, message = "收货人姓名长度不能超过50个字符") - private String realName; - - @Schema(description = "收货地址") - @Size(max = 200, message = "收货地址长度不能超过200个字符") - private String address; - - @Schema(description = "关联收货地址ID") - private Integer addressId; - - @Schema(description = "快递/自提,0快递 1自提") - private Integer deliveryType; - - @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") - private Integer channel; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "使用的优惠券ID") - private Integer couponId; - - @Schema(description = "备注") - @Size(max = 500, message = "备注长度不能超过500字符") - private String comments; - - @Schema(description = "订单商品列表", required = true) - @Valid - @NotEmpty(message = "订单商品列表不能为空") - private List goodsItems; - } - - /** - * 订单商品项 - */ - @Data - @Schema(name = "OrderGoodsItem", description = "订单商品项") - public static class OrderGoodsItem { - - @Schema(description = "商品ID", required = true) - @NotNull(message = "商品ID不能为空") - @Positive(message = "商品ID必须为正数") - private Integer goodsId; - - @Schema(description = "商品SKU ID") - private Integer skuId; - - @Schema(description = "商品数量", required = true) - @NotNull(message = "商品数量不能为空") - @Min(value = 1, message = "商品数量必须大于0") - private Integer quantity; - - @Schema(description = "规格信息,如:颜色:红色|尺寸:L") - private String specInfo; - } - - /** - * 获取格式化的金额字符串 - */ - public String getFormattedAmount() { - if (amount == null) { - return "0.00"; - } - return String.format("%.2f", amount); - } - - /** - * 验证订单商品总金额是否与支付金额一致 - */ - public boolean isAmountConsistent() { - if (amount == null || orderInfo == null || orderInfo.getGoodsItems() == null) { - return false; - } - - // 这里可以添加商品金额计算逻辑 - // 实际实现时需要查询数据库获取商品价格 - return true; - } - - @Override - public String toString() { - return String.format("PaymentWithOrderRequest{paymentType=%s, amount=%s, subject='%s', tenantId=%d, goodsCount=%d}", - paymentType, getFormattedAmount(), subject, tenantId, - orderInfo != null && orderInfo.getGoodsItems() != null ? orderInfo.getGoodsItems().size() : 0); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentChannel.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentChannel.java deleted file mode 100644 index f7396a0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentChannel.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.gxwebsoft.payment.enums; - -/** - * 支付渠道枚举 - * 定义具体的支付渠道类型 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public enum PaymentChannel { - - /** 微信JSAPI支付 */ - WECHAT_JSAPI("wechat_jsapi", "微信JSAPI支付", PaymentType.WECHAT), - - /** 微信Native支付 */ - WECHAT_NATIVE("wechat_native", "微信Native支付", PaymentType.WECHAT_NATIVE), - - /** 微信H5支付 */ - WECHAT_H5("wechat_h5", "微信H5支付", PaymentType.WECHAT), - - /** 微信APP支付 */ - WECHAT_APP("wechat_app", "微信APP支付", PaymentType.WECHAT), - - /** 微信小程序支付 */ - WECHAT_MINI("wechat_mini", "微信小程序支付", PaymentType.WECHAT), - - /** 支付宝网页支付 */ - ALIPAY_WEB("alipay_web", "支付宝网页支付", PaymentType.ALIPAY), - - /** 支付宝手机网站支付 */ - ALIPAY_WAP("alipay_wap", "支付宝手机网站支付", PaymentType.ALIPAY), - - /** 支付宝APP支付 */ - ALIPAY_APP("alipay_app", "支付宝APP支付", PaymentType.ALIPAY), - - /** 支付宝小程序支付 */ - ALIPAY_MINI("alipay_mini", "支付宝小程序支付", PaymentType.ALIPAY), - - /** 银联网关支付 */ - UNION_WEB("union_web", "银联网关支付", PaymentType.UNION_PAY), - - /** 银联手机支付 */ - UNION_WAP("union_wap", "银联手机支付", PaymentType.UNION_PAY), - - /** 余额支付 */ - BALANCE("balance", "余额支付", PaymentType.BALANCE), - - /** 现金支付 */ - CASH("cash", "现金支付", PaymentType.CASH), - - /** POS机支付 */ - POS("pos", "POS机支付", PaymentType.POS); - - private final String code; - private final String name; - private final PaymentType paymentType; - - PaymentChannel(String code, String name, PaymentType paymentType) { - this.code = code; - this.name = name; - this.paymentType = paymentType; - } - - public String getCode() { - return code; - } - - public String getName() { - return name; - } - - public PaymentType getPaymentType() { - return paymentType; - } - - /** - * 根据代码获取支付渠道 - */ - public static PaymentChannel getByCode(String code) { - if (code == null) { - return null; - } - for (PaymentChannel channel : values()) { - if (channel.code.equals(code)) { - return channel; - } - } - return null; - } - - /** - * 根据支付类型获取默认渠道 - */ - public static PaymentChannel getDefaultByPaymentType(PaymentType paymentType) { - if (paymentType == null) { - return null; - } - - switch (paymentType) { - case WECHAT: - return WECHAT_JSAPI; - case WECHAT_NATIVE: - return WECHAT_NATIVE; - case ALIPAY: - return ALIPAY_WEB; - case UNION_PAY: - return UNION_WEB; - case BALANCE: - return BALANCE; - case CASH: - return CASH; - case POS: - return POS; - default: - return null; - } - } - - /** - * 是否为微信支付渠道 - */ - public boolean isWechatChannel() { - return paymentType.isWechatPay(); - } - - /** - * 是否为支付宝支付渠道 - */ - public boolean isAlipayChannel() { - return paymentType == PaymentType.ALIPAY; - } - - /** - * 是否为银联支付渠道 - */ - public boolean isUnionPayChannel() { - return paymentType == PaymentType.UNION_PAY; - } - - /** - * 是否为第三方支付渠道 - */ - public boolean isThirdPartyChannel() { - return paymentType.isThirdPartyPay(); - } - - /** - * 是否支持退款 - */ - public boolean supportRefund() { - return isThirdPartyChannel(); - } - - @Override - public String toString() { - return String.format("PaymentChannel{code='%s', name='%s', paymentType=%s}", - code, name, paymentType); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentStatus.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentStatus.java deleted file mode 100644 index 809bd9a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentStatus.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.gxwebsoft.payment.enums; - -/** - * 支付状态枚举 - * 定义支付过程中的各种状态 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public enum PaymentStatus { - - /** 待支付 */ - PENDING(0, "待支付", "PENDING"), - - /** 支付中 */ - PROCESSING(1, "支付中", "PROCESSING"), - - /** 支付成功 */ - SUCCESS(2, "支付成功", "SUCCESS"), - - /** 支付失败 */ - FAILED(3, "支付失败", "FAILED"), - - /** 支付取消 */ - CANCELLED(4, "支付取消", "CANCELLED"), - - /** 支付超时 */ - TIMEOUT(5, "支付超时", "TIMEOUT"), - - /** 退款中 */ - REFUNDING(6, "退款中", "REFUNDING"), - - /** 退款成功 */ - REFUNDED(7, "退款成功", "REFUNDED"), - - /** 退款失败 */ - REFUND_FAILED(8, "退款失败", "REFUND_FAILED"), - - /** 部分退款 */ - PARTIAL_REFUNDED(9, "部分退款", "PARTIAL_REFUNDED"); - - private final Integer code; - private final String name; - private final String status; - - PaymentStatus(Integer code, String name, String status) { - this.code = code; - this.name = name; - this.status = status; - } - - public Integer getCode() { - return code; - } - - public String getName() { - return name; - } - - public String getStatus() { - return status; - } - - /** - * 根据代码获取支付状态 - */ - public static PaymentStatus getByCode(Integer code) { - if (code == null) { - return null; - } - for (PaymentStatus status : values()) { - if (status.code.equals(code)) { - return status; - } - } - return null; - } - - /** - * 根据状态字符串获取支付状态 - */ - public static PaymentStatus getByStatus(String status) { - if (status == null) { - return null; - } - for (PaymentStatus paymentStatus : values()) { - if (paymentStatus.status.equals(status)) { - return paymentStatus; - } - } - return null; - } - - /** - * 是否为最终状态(不会再变化) - */ - public boolean isFinalStatus() { - return this == SUCCESS || this == FAILED || this == CANCELLED || - this == TIMEOUT || this == REFUNDED || this == REFUND_FAILED; - } - - /** - * 是否为成功状态 - */ - public boolean isSuccessStatus() { - return this == SUCCESS; - } - - /** - * 是否为失败状态 - */ - public boolean isFailedStatus() { - return this == FAILED || this == CANCELLED || this == TIMEOUT || this == REFUND_FAILED; - } - - /** - * 是否为退款相关状态 - */ - public boolean isRefundStatus() { - return this == REFUNDING || this == REFUNDED || this == REFUND_FAILED || this == PARTIAL_REFUNDED; - } - - /** - * 是否可以退款 - */ - public boolean canRefund() { - return this == SUCCESS || this == PARTIAL_REFUNDED; - } - - /** - * 是否可以取消 - */ - public boolean canCancel() { - return this == PENDING || this == PROCESSING; - } - - @Override - public String toString() { - return String.format("PaymentStatus{code=%d, name='%s', status='%s'}", code, name, status); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentType.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentType.java deleted file mode 100644 index 946b7ba..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/enums/PaymentType.java +++ /dev/null @@ -1,224 +0,0 @@ -package com.gxwebsoft.payment.enums; - -/** - * 支付类型枚举 - * 定义系统支持的所有支付方式 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public enum PaymentType { - - /** 余额支付 */ - BALANCE(0, "余额支付", "balance"), - - /** 微信支付(包含JSAPI和Native) */ - WECHAT(1, "微信支付", "wechat"), - - /** 支付宝支付 */ - ALIPAY(2, "支付宝支付", "alipay"), - - /** 银联支付 */ - UNION_PAY(3, "银联支付", "union_pay"), - - /** 现金支付 */ - CASH(4, "现金支付", "cash"), - - /** POS机支付 */ - POS(5, "POS机支付", "pos"), - - /** 免费 */ - FREE(6, "免费", "free"), - - /** 积分支付 */ - POINTS(7, "积分支付", "points"), - - // ========== 已废弃的支付方式(保留用于数据兼容) ========== - - /** @deprecated 微信Native支付 - 已合并到WECHAT */ - @Deprecated - WECHAT_NATIVE(102, "微信Native支付", "wechat_native"), - - /** @deprecated 会员卡支付 - 建议使用余额支付 */ - @Deprecated - MEMBER_CARD_OLD(8, "会员卡支付", "member_card"), - - /** @deprecated VIP月卡 - 建议使用余额支付 */ - @Deprecated - VIP_MONTHLY(9, "VIP月卡", "vip_monthly"), - - /** @deprecated VIP年卡 - 建议使用余额支付 */ - @Deprecated - VIP_YEARLY(10, "VIP年卡", "vip_yearly"), - - /** @deprecated VIP次卡 - 建议使用余额支付 */ - @Deprecated - VIP_COUNT(11, "VIP次卡", "vip_count"), - - /** @deprecated 免费(旧编号) - 已迁移到新编号6 */ - @Deprecated - FREE_OLD(12, "免费", "free"), - - /** @deprecated VIP充值卡 - 建议使用余额支付 */ - @Deprecated - VIP_RECHARGE(13, "VIP充值卡", "vip_recharge"), - - /** @deprecated IC充值卡 - 建议使用余额支付 */ - @Deprecated - IC_RECHARGE(14, "IC充值卡", "ic_recharge"), - - /** @deprecated 积分支付(旧编号) - 已迁移到新编号7 */ - @Deprecated - POINTS_OLD(15, "积分支付", "points"), - - /** @deprecated VIP季卡 - 建议使用余额支付 */ - @Deprecated - VIP_QUARTERLY(16, "VIP季卡", "vip_quarterly"), - - /** @deprecated IC月卡 - 建议使用余额支付 */ - @Deprecated - IC_MONTHLY(17, "IC月卡", "ic_monthly"), - - /** @deprecated IC年卡 - 建议使用余额支付 */ - @Deprecated - IC_YEARLY(18, "IC年卡", "ic_yearly"), - - /** @deprecated IC次卡 - 建议使用余额支付 */ - @Deprecated - IC_COUNT(19, "IC次卡", "ic_count"), - - /** @deprecated IC季卡 - 建议使用余额支付 */ - @Deprecated - IC_QUARTERLY(20, "IC季卡", "ic_quarterly"), - - /** @deprecated 代付 - 建议通过业务逻辑实现 */ - @Deprecated - PROXY_PAY(21, "代付", "proxy_pay"), - - /** @deprecated 支付宝(旧编号) - 已迁移到新编号2 */ - @Deprecated - ALIPAY_OLD(22, "支付宝支付", "alipay"), - - /** @deprecated 银联支付(旧编号) - 已迁移到新编号3 */ - @Deprecated - UNION_PAY_OLD(23, "银联支付", "union_pay"); - - private final Integer code; - private final String name; - private final String channel; - - PaymentType(Integer code, String name, String channel) { - this.code = code; - this.name = name; - this.channel = channel; - } - - public Integer getCode() { - return code; - } - - public String getName() { - return name; - } - - public String getChannel() { - return channel; - } - - /** - * 根据代码获取支付类型 - */ - public static PaymentType getByCode(Integer code) { - if (code == null) { - return null; - } - for (PaymentType type : values()) { - if (type.code.equals(code)) { - return type; - } - } - return null; - } - - /** - * 根据渠道获取支付类型 - */ - public static PaymentType getByChannel(String channel) { - if (channel == null) { - return null; - } - for (PaymentType type : values()) { - if (type.channel.equals(channel)) { - return type; - } - } - return null; - } - - /** - * 是否为微信支付类型 - */ - public boolean isWechatPay() { - return this == WECHAT || this == WECHAT_NATIVE; - } - - /** - * 获取微信支付的具体类型 - * @param openid 用户openid - * @return JSAPI 或 NATIVE - */ - public String getWechatPayType(String openid) { - if (!isWechatPay()) { - return null; - } - - // 有openid使用JSAPI,无openid使用Native - return (openid != null && !openid.trim().isEmpty()) ? "JSAPI" : "NATIVE"; - } - - /** - * 是否为第三方支付 - */ - public boolean isThirdPartyPay() { - return isWechatPay() || this == ALIPAY || this == UNION_PAY; - } - - /** - * 是否需要在线支付 - */ - public boolean isOnlinePay() { - return isThirdPartyPay(); - } - - /** - * 是否为卡类支付(已废弃的支付方式) - * @deprecated 卡类支付已废弃,建议使用余额支付 - */ - @Deprecated - public boolean isCardPay() { - return this == MEMBER_CARD_OLD || - this == VIP_MONTHLY || this == VIP_YEARLY || this == VIP_COUNT || this == VIP_QUARTERLY || - this == IC_MONTHLY || this == IC_YEARLY || this == IC_COUNT || this == IC_QUARTERLY || - this == VIP_RECHARGE; - } - - /** - * 是否为推荐使用的核心支付方式 - */ - public boolean isCorePaymentType() { - return this == BALANCE || this == WECHAT || this == ALIPAY || this == UNION_PAY || - this == CASH || this == POS || this == FREE || this == POINTS; - } - - /** - * 是否为已废弃的支付方式 - */ - public boolean isDeprecated() { - return !isCorePaymentType(); - } - - @Override - public String toString() { - return String.format("PaymentType{code=%d, name='%s', channel='%s'}", code, name, channel); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/exception/PaymentException.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/exception/PaymentException.java deleted file mode 100644 index 35d2ac3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/exception/PaymentException.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.gxwebsoft.payment.exception; - -import com.gxwebsoft.payment.enums.PaymentType; - -/** - * 支付异常基类 - * 统一处理支付相关的业务异常 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public class PaymentException extends Exception { - - private static final long serialVersionUID = 1L; - - /** - * 错误代码 - */ - private String errorCode; - - /** - * 支付类型 - */ - private PaymentType paymentType; - - /** - * 租户ID - */ - private Integer tenantId; - - /** - * 订单号 - */ - private String orderNo; - - public PaymentException(String message) { - super(message); - } - - public PaymentException(String message, Throwable cause) { - super(message, cause); - } - - public PaymentException(String errorCode, String message) { - super(message); - this.errorCode = errorCode; - } - - public PaymentException(String errorCode, String message, Throwable cause) { - super(message, cause); - this.errorCode = errorCode; - } - - public PaymentException(String errorCode, String message, PaymentType paymentType) { - super(message); - this.errorCode = errorCode; - this.paymentType = paymentType; - } - - public PaymentException(String errorCode, String message, PaymentType paymentType, Integer tenantId) { - super(message); - this.errorCode = errorCode; - this.paymentType = paymentType; - this.tenantId = tenantId; - } - - public PaymentException(String errorCode, String message, PaymentType paymentType, Integer tenantId, String orderNo) { - super(message); - this.errorCode = errorCode; - this.paymentType = paymentType; - this.tenantId = tenantId; - this.orderNo = orderNo; - } - - // Getters and Setters - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public PaymentType getPaymentType() { - return paymentType; - } - - public void setPaymentType(PaymentType paymentType) { - this.paymentType = paymentType; - } - - public Integer getTenantId() { - return tenantId; - } - - public void setTenantId(Integer tenantId) { - this.tenantId = tenantId; - } - - public String getOrderNo() { - return orderNo; - } - - public void setOrderNo(String orderNo) { - this.orderNo = orderNo; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("PaymentException{"); - if (errorCode != null) { - sb.append("errorCode='").append(errorCode).append("', "); - } - if (paymentType != null) { - sb.append("paymentType=").append(paymentType).append(", "); - } - if (tenantId != null) { - sb.append("tenantId=").append(tenantId).append(", "); - } - if (orderNo != null) { - sb.append("orderNo='").append(orderNo).append("', "); - } - sb.append("message='").append(getMessage()).append("'"); - sb.append("}"); - return sb.toString(); - } - - /** - * 支付错误代码常量 - */ - public static class ErrorCode { - /** 参数错误 */ - public static final String PARAM_ERROR = "PARAM_ERROR"; - /** 配置错误 */ - public static final String CONFIG_ERROR = "CONFIG_ERROR"; - /** 证书错误 */ - public static final String CERTIFICATE_ERROR = "CERTIFICATE_ERROR"; - /** 网络错误 */ - public static final String NETWORK_ERROR = "NETWORK_ERROR"; - /** 签名错误 */ - public static final String SIGNATURE_ERROR = "SIGNATURE_ERROR"; - /** 金额错误 */ - public static final String AMOUNT_ERROR = "AMOUNT_ERROR"; - /** 订单错误 */ - public static final String ORDER_ERROR = "ORDER_ERROR"; - /** 状态错误 */ - public static final String STATUS_ERROR = "STATUS_ERROR"; - /** 余额不足 */ - public static final String INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE"; - /** 支付超时 */ - public static final String TIMEOUT_ERROR = "TIMEOUT_ERROR"; - /** 重复支付 */ - public static final String DUPLICATE_PAYMENT = "DUPLICATE_PAYMENT"; - /** 不支持的支付方式 */ - public static final String UNSUPPORTED_PAYMENT = "UNSUPPORTED_PAYMENT"; - /** 系统错误 */ - public static final String SYSTEM_ERROR = "SYSTEM_ERROR"; - } - - // 静态工厂方法 - public static PaymentException paramError(String message) { - return new PaymentException(ErrorCode.PARAM_ERROR, message); - } - - public static PaymentException configError(String message, PaymentType paymentType, Integer tenantId) { - return new PaymentException(ErrorCode.CONFIG_ERROR, message, paymentType, tenantId); - } - - public static PaymentException certificateError(String message, PaymentType paymentType) { - return new PaymentException(ErrorCode.CERTIFICATE_ERROR, message, paymentType); - } - - public static PaymentException networkError(String message, PaymentType paymentType, Throwable cause) { - return new PaymentException(ErrorCode.NETWORK_ERROR, message, cause); - } - - public static PaymentException signatureError(String message, PaymentType paymentType) { - return new PaymentException(ErrorCode.SIGNATURE_ERROR, message, paymentType); - } - - public static PaymentException amountError(String message) { - return new PaymentException(ErrorCode.AMOUNT_ERROR, message); - } - - public static PaymentException orderError(String message, String orderNo) { - PaymentException exception = new PaymentException(ErrorCode.ORDER_ERROR, message); - exception.setOrderNo(orderNo); - return exception; - } - - public static PaymentException statusError(String message, String orderNo) { - PaymentException exception = new PaymentException(ErrorCode.STATUS_ERROR, message); - exception.setOrderNo(orderNo); - return exception; - } - - public static PaymentException insufficientBalance(String message, Integer tenantId) { - return new PaymentException(ErrorCode.INSUFFICIENT_BALANCE, message, PaymentType.BALANCE, tenantId); - } - - public static PaymentException timeoutError(String message, PaymentType paymentType, String orderNo) { - PaymentException exception = new PaymentException(ErrorCode.TIMEOUT_ERROR, message, paymentType); - exception.setOrderNo(orderNo); - return exception; - } - - public static PaymentException duplicatePayment(String message, String orderNo) { - PaymentException exception = new PaymentException(ErrorCode.DUPLICATE_PAYMENT, message); - exception.setOrderNo(orderNo); - return exception; - } - - public static PaymentException unsupportedPayment(String message, PaymentType paymentType) { - return new PaymentException(ErrorCode.UNSUPPORTED_PAYMENT, message, paymentType); - } - - public static PaymentException systemError(String message, Throwable cause) { - return new PaymentException(ErrorCode.SYSTEM_ERROR, message, cause); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/exception/PaymentExceptionHandler.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/exception/PaymentExceptionHandler.java deleted file mode 100644 index 04c6cda..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/exception/PaymentExceptionHandler.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.gxwebsoft.payment.exception; - -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.payment.constants.PaymentConstants; - -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.validation.BindException; -import org.springframework.validation.FieldError; -import org.springframework.web.bind.MethodArgumentNotValidException; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -import javax.validation.ConstraintViolation; -import javax.validation.ConstraintViolationException; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * 统一支付异常处理器 - * 处理所有支付相关的异常和参数验证异常 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@RestControllerAdvice(basePackages = {"com.gxwebsoft.payment.controller", "com.gxwebsoft.shop.controller"}) -public class PaymentExceptionHandler extends BaseController { - - /** - * 处理支付业务异常 - */ - @ExceptionHandler(PaymentException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) - public ApiResult handlePaymentException(PaymentException e) { - log.warn("支付业务异常: {}", e.getMessage()); - - // 记录详细的异常信息 - if (e.getTenantId() != null) { - log.warn("异常租户ID: {}", e.getTenantId()); - } - - if (e.getPaymentType() != null) { - log.warn("异常支付类型: {}", e.getPaymentType()); - } - - if (e.getOrderNo() != null) { - log.warn("异常订单号: {}", e.getOrderNo()); - } - - if (e.getErrorCode() != null) { - log.warn("错误代码: {}", e.getErrorCode()); - } - - return fail(e.getMessage()); - } - - - - /** - * 处理参数验证异常(@Valid注解) - */ - @ExceptionHandler(MethodArgumentNotValidException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) - public ApiResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { - List fieldErrors = e.getBindingResult().getFieldErrors(); - - String errorMessage = fieldErrors.stream() - .map(error -> error.getField() + ": " + error.getDefaultMessage()) - .collect(Collectors.joining("; ")); - - log.warn("参数验证失败: {}", errorMessage); - - return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + errorMessage); - } - - /** - * 处理绑定异常 - */ - @ExceptionHandler(BindException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) - public ApiResult handleBindException(BindException e) { - List fieldErrors = e.getBindingResult().getFieldErrors(); - - String errorMessage = fieldErrors.stream() - .map(error -> error.getField() + ": " + error.getDefaultMessage()) - .collect(Collectors.joining("; ")); - - log.warn("数据绑定失败: {}", errorMessage); - - return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + errorMessage); - } - - /** - * 处理约束违反异常(@Validated注解) - */ - @ExceptionHandler(ConstraintViolationException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) - public ApiResult handleConstraintViolationException(ConstraintViolationException e) { - Set> violations = e.getConstraintViolations(); - - String errorMessage = violations.stream() - .map(violation -> violation.getPropertyPath() + ": " + violation.getMessage()) - .collect(Collectors.joining("; ")); - - log.warn("约束验证失败: {}", errorMessage); - - return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + errorMessage); - } - - /** - * 处理非法参数异常 - */ - @ExceptionHandler(IllegalArgumentException.class) - @ResponseStatus(HttpStatus.BAD_REQUEST) - public ApiResult handleIllegalArgumentException(IllegalArgumentException e) { - log.warn("非法参数异常: {}", e.getMessage()); - return fail(PaymentConstants.ErrorMessage.PARAM_ERROR + ": " + e.getMessage()); - } - - /** - * 处理空指针异常 - */ - @ExceptionHandler(NullPointerException.class) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public ApiResult handleNullPointerException(NullPointerException e) { - log.error("空指针异常", e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - - /** - * 处理其他运行时异常 - */ - @ExceptionHandler(RuntimeException.class) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public ApiResult handleRuntimeException(RuntimeException e) { - log.error("运行时异常: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } - - /** - * 处理其他异常 - */ - @ExceptionHandler(Exception.class) - @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) - public ApiResult handleException(Exception e) { - log.error("未知异常: {}", e.getMessage(), e); - return fail(PaymentConstants.ErrorMessage.SYSTEM_ERROR); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/PaymentService.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/service/PaymentService.java deleted file mode 100644 index 0f90fd5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/PaymentService.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.gxwebsoft.payment.service; - -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.payment.dto.PaymentRequest; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.dto.PaymentWithOrderRequest; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; - -/** - * 统一支付服务接口 - * 提供所有支付方式的统一入口 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public interface PaymentService { - - /** - * 创建支付订单 - * - * @param request 支付请求 - * @return 支付响应 - * @throws PaymentException 支付创建失败时抛出 - */ - PaymentResponse createPayment(PaymentRequest request) throws PaymentException; - - /** - * 创建支付订单(包含订单信息) - * 统一支付模块:先创建订单,再发起支付 - * - * @param request 支付与订单创建请求 - * @param loginUser 当前登录用户 - * @return 支付响应 - * @throws PaymentException 创建失败时抛出 - */ - PaymentResponse createPaymentWithOrder(PaymentWithOrderRequest request, User loginUser) throws PaymentException; - - /** - * 查询支付状态 - * - * @param orderNo 订单号 - * @param paymentType 支付类型 - * @param tenantId 租户ID - * @return 支付响应 - * @throws PaymentException 查询失败时抛出 - */ - PaymentResponse queryPayment(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException; - - /** - * 处理支付回调通知 - * - * @param paymentType 支付类型 - * @param headers 请求头 - * @param body 请求体 - * @param tenantId 租户ID - * @return 处理结果,返回给第三方的响应内容 - * @throws PaymentException 处理失败时抛出 - */ - String handlePaymentNotify(PaymentType paymentType, Map headers, String body, Integer tenantId) throws PaymentException; - - /** - * 申请退款 - * - * @param orderNo 订单号 - * @param refundNo 退款单号 - * @param paymentType 支付类型 - * @param totalAmount 订单总金额 - * @param refundAmount 退款金额 - * @param reason 退款原因 - * @param tenantId 租户ID - * @return 退款响应 - * @throws PaymentException 退款申请失败时抛出 - */ - PaymentResponse refund(String orderNo, String refundNo, PaymentType paymentType, - BigDecimal totalAmount, BigDecimal refundAmount, - String reason, Integer tenantId) throws PaymentException; - - /** - * 查询退款状态 - * - * @param refundNo 退款单号 - * @param paymentType 支付类型 - * @param tenantId 租户ID - * @return 退款查询响应 - * @throws PaymentException 查询失败时抛出 - */ - PaymentResponse queryRefund(String refundNo, PaymentType paymentType, Integer tenantId) throws PaymentException; - - /** - * 关闭订单 - * - * @param orderNo 订单号 - * @param paymentType 支付类型 - * @param tenantId 租户ID - * @return 关闭结果 - * @throws PaymentException 关闭失败时抛出 - */ - boolean closeOrder(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException; - - /** - * 获取支持的支付类型列表 - * - * @return 支付类型列表 - */ - List getSupportedPaymentTypes(); - - /** - * 检查支付类型是否支持 - * - * @param paymentType 支付类型 - * @return true表示支持 - */ - boolean isPaymentTypeSupported(PaymentType paymentType); - - /** - * 检查支付类型是否支持退款 - * - * @param paymentType 支付类型 - * @return true表示支持退款 - */ - boolean isRefundSupported(PaymentType paymentType); - - /** - * 检查支付类型是否支持查询 - * - * @param paymentType 支付类型 - * @return true表示支持查询 - */ - boolean isQuerySupported(PaymentType paymentType); - - /** - * 检查支付类型是否支持关闭订单 - * - * @param paymentType 支付类型 - * @return true表示支持关闭订单 - */ - boolean isCloseSupported(PaymentType paymentType); - - /** - * 检查支付类型是否需要异步通知 - * - * @param paymentType 支付类型 - * @return true表示需要异步通知 - */ - boolean isNotifyNeeded(PaymentType paymentType); - - /** - * 验证支付请求参数 - * - * @param request 支付请求 - * @throws PaymentException 参数验证失败时抛出 - */ - void validatePaymentRequest(PaymentRequest request) throws PaymentException; - - /** - * 获取支付策略信息 - * - * @param paymentType 支付类型 - * @return 策略信息Map,包含策略名称、描述等 - */ - Map getPaymentStrategyInfo(PaymentType paymentType); - - /** - * 获取所有支付策略信息 - * - * @return 所有策略信息列表 - */ - List> getAllPaymentStrategyInfo(); - - /** - * 检查支付配置 - * - * @param tenantId 租户ID - * @return 配置检查结果 - */ - Map checkPaymentConfig(Integer tenantId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/WxPayConfigService.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/service/WxPayConfigService.java deleted file mode 100644 index 7248903..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/WxPayConfigService.java +++ /dev/null @@ -1,382 +0,0 @@ -package com.gxwebsoft.payment.service; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.core.config.CertificateProperties; -import com.gxwebsoft.common.core.service.CertificateService; -import com.gxwebsoft.common.core.utils.RedisUtil; -import com.gxwebsoft.common.core.utils.WxNativeUtil; -import com.gxwebsoft.common.system.entity.Payment; -import com.gxwebsoft.common.system.param.PaymentParam; -import com.gxwebsoft.common.system.service.PaymentService; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.payment.enums.PaymentType; -import com.wechat.pay.java.core.Config; -import com.wechat.pay.java.core.RSAAutoCertificateConfig; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.core.io.ClassPathResource; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.io.IOException; -import java.util.concurrent.TimeUnit; - -/** - * 微信支付配置服务 - * 负责管理微信支付的配置信息和证书 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Service -public class WxPayConfigService { - - @Resource - private RedisUtil redisUtil; - - @Resource - private CertificateService certificateService; - - @Resource - private CertificateProperties certificateProperties; - - @Resource - private PaymentService paymentService; - - @Value("${spring.profiles.active:dev}") - private String activeProfile; - - /** - * 获取支付配置信息(Payment对象)- 公开方法 - * - * @param tenantId 租户ID - * @return 支付配置信息 - * @throws PaymentException 配置获取失败时抛出 - */ - public Payment getPaymentConfigForStrategy(Integer tenantId) throws PaymentException { - if (tenantId == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - return getPaymentConfig(tenantId); - } - - /** - * 获取微信支付配置 - * - * @param tenantId 租户ID - * @return 微信支付配置 - * @throws PaymentException 配置获取失败时抛出 - */ - public Config getWxPayConfig(Integer tenantId) throws PaymentException { - if (tenantId == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - - // 先从缓存获取已构建的配置 - Config cachedConfig = WxNativeUtil.getConfig(tenantId); - if (cachedConfig != null) { - log.info("从内存缓存获取微信支付配置,租户ID: {}", tenantId); - return cachedConfig; - } - - // 构建新的配置 - log.info("开始构建微信支付配置,租户ID: {}", tenantId); - Config newConfig = buildWxPayConfig(tenantId); - - // 缓存配置 - WxNativeUtil.addConfig(tenantId, newConfig); - log.info("微信支付配置创建并缓存成功,租户ID: {}", tenantId); - - return newConfig; - } - - /** - * 构建微信支付配置 - */ - private Config buildWxPayConfig(Integer tenantId) throws PaymentException { - try { - // 获取支付配置信息 - Payment payment = getPaymentConfig(tenantId); - - // 获取证书文件路径 - String certificatePath = getCertificatePath(tenantId, payment); - - // 创建微信支付配置对象 - return createWxPayConfig(payment, certificatePath); - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - throw PaymentException.systemError("构建微信支付配置失败: " + e.getMessage(), e); - } - } - - /** - * 获取支付配置信息 - * 优先从缓存获取,缓存没有则查询数据库,最后兜底到开发环境测试配置 - */ - private Payment getPaymentConfig(Integer tenantId) throws PaymentException { - String cacheKey = "Payment:1:" + tenantId; - Payment payment = redisUtil.get(cacheKey, Payment.class); - - if (payment != null) { - log.info("========== 从 Redis 缓存获取 Payment 配置 =========="); - log.info("租户ID: {}", tenantId); - log.info("商户号(mchId): {}", payment.getMchId()); - log.info("AppID: {}", payment.getAppId()); - log.info("商户证书序列号: {}", payment.getMerchantSerialNumber()); - log.info("APIv3密钥: {}", payment.getApiKey() != null ? payment.getApiKey().substring(0, 8) + "****" : "NULL"); - log.info("证书文件: {}", payment.getApiclientKey()); - log.info("=================================================="); - return payment; - } - - log.info("Redis 缓存未命中,租户ID: {},开始查询数据库", tenantId); - - // 缓存中没有,尝试从数据库查询 - try { - final PaymentParam paymentParam = new PaymentParam(); - // 优先使用新的微信支付类型(1 = WECHAT) - paymentParam.setType(PaymentType.WECHAT.getCode()); - paymentParam.setTenantId(tenantId); - - log.debug("查询数据库支付配置,参数: type={}, tenantId={}", paymentParam.getType(), tenantId); - payment = paymentService.getByType(paymentParam); - log.debug("数据库查询结果: {}", payment != null ? "找到配置" : "未找到配置"); - - // 兼容旧数据:如果没有查到,再尝试旧的微信Native类型(102) - if (payment == null) { - paymentParam.setType(PaymentType.WECHAT_NATIVE.getCode()); - log.debug("未找到type=1配置,尝试兼容旧type={}, tenantId={}", paymentParam.getType(), tenantId); - payment = paymentService.getByType(paymentParam); - log.debug("兼容查询结果: {}", payment != null ? "找到配置" : "未找到配置"); - } - - if (payment != null) { - log.info("从数据库获取支付配置成功,租户ID: {},将缓存配置", tenantId); - - // 开发环境下,如果apiclientKey为空,设置默认值 - if ("dev".equals(activeProfile) && - (payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty())) { - log.warn("开发环境:数据库配置中apiclientKey为空,使用默认值,租户ID: {}", tenantId); - payment.setApiclientKey("apiclient_key.pem"); - } - - // 将查询到的配置缓存起来,缓存1天 - redisUtil.set(cacheKey, payment, 1L, TimeUnit.DAYS); - return payment; - } else { - log.warn("数据库中未找到支付配置,租户ID: {},已尝试type=1和type=102", tenantId); - } - } catch (Exception e) { - log.error("从数据库查询支付配置失败,租户ID: {},错误: {}", tenantId, e.getMessage(), e); - // 抛出更详细的异常信息 - throw PaymentException.systemError("查询支付配置失败,租户ID: " + tenantId + ",错误: " + e.getMessage(), e); - } - - // 数据库也没有配置 - if (!"dev".equals(activeProfile)) { - throw PaymentException.systemError("微信支付配置未找到,租户ID: " + tenantId + ",请检查数据库配置", null); - } - - log.debug("开发环境模式,将使用测试配置,租户ID: {}", tenantId); - // 开发环境返回测试Payment配置 - return createDevTestPayment(tenantId); - } - - /** - * 获取证书文件路径 - */ - private String getCertificatePath(Integer tenantId, Payment payment) throws PaymentException { - if ("dev".equals(activeProfile)) { - return getDevCertificatePath(tenantId); - } else { - return getProdCertificatePath(payment); - } - } - - /** - * 获取开发环境证书路径 - */ - private String getDevCertificatePath(Integer tenantId) throws PaymentException { - try { - // 根据租户ID构建证书路径 - String certPath = "dev/wechat/" + tenantId + "/apiclient_key.pem"; - ClassPathResource resource = new ClassPathResource(certPath); - - if (!resource.exists()) { - throw PaymentException.systemError("开发环境微信支付证书文件不存在: " + certPath, null); - } - - String absolutePath = resource.getFile().getAbsolutePath(); - log.debug("开发环境证书路径: {}", absolutePath); - return absolutePath; - - } catch (IOException e) { - throw PaymentException.systemError("获取开发环境证书路径失败: " + e.getMessage(), e); - } - } - - /** - * 获取生产环境证书路径 - */ - private String getProdCertificatePath(Payment payment) throws PaymentException { - if (payment == null || payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty()) { - throw PaymentException.systemError("生产环境支付配置或证书密钥文件为空", null); - } - - try { - // 使用微信支付证书路径 - String certificatePath = certificateService.getWechatPayCertPath(payment.getApiclientKey()); - if (certificatePath == null) { - throw PaymentException.systemError("证书文件路径获取失败,证书文件: " + payment.getApiclientKey(), null); - } - - log.debug("生产环境证书路径: {}", certificatePath); - return certificatePath; - - } catch (Exception e) { - throw PaymentException.systemError("获取生产环境证书路径失败: " + e.getMessage(), e); - } - } - - /** - * 创建微信支付配置对象 - */ - private Config createWxPayConfig(Payment payment, String certificatePath) throws PaymentException { - try { - if ("dev".equals(activeProfile) && payment == null) { - // 开发环境测试配置 - return createDevTestConfig(certificatePath); - } else if (payment != null) { - // 正常配置 - return createNormalConfig(payment, certificatePath); - } else { - throw PaymentException.systemError("无法创建微信支付配置:配置信息不完整", null); - } - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - throw PaymentException.systemError("创建微信支付配置对象失败: " + e.getMessage(), e); - } - } - - /** - * 创建开发环境测试Payment配置 - */ - private Payment createDevTestPayment(Integer tenantId) { - Payment testPayment = new Payment(); - testPayment.setTenantId(tenantId); - testPayment.setType(102); // Native支付 - testPayment.setAppId("wx541db955e7a62709"); // 开发环境测试AppID - testPayment.setMchId("1246610101"); // 租户10550的商户号 - testPayment.setMerchantSerialNumber("754B973F56C0CF9E3B21D950ECAB5ED99063057D"); // 证书序列号 - testPayment.setApiKey("zGufUcqa7ovgxRL0kF5OlPr482EZwtn8"); - testPayment.setApiclientKey("/www/wwwroot/file.ws/wechat/apiclient_key.pem"); // 设置证书文件名 - testPayment.setNotifyUrl("https://websopy-api.websoft.top/api/app/subscription/wx-notify"); - testPayment.setName("微信Native支付-开发环境"); - testPayment.setStatus(true); // 启用 - - log.info("创建开发环境测试Payment配置,租户ID: {}, AppID: {}, 商户号: {}", - tenantId, testPayment.getAppId(), testPayment.getMchId()); - - return testPayment; - } - - /** - * 创建开发环境测试配置 - */ - private Config createDevTestConfig(String certificatePath) throws PaymentException { - String testMerchantId = "1246610101"; // 租户10550的商户号 - String testMerchantSerialNumber = "754B973F56C0CF9E3B21D950ECAB5ED99063057D"; // 证书序列号 - String testApiV3Key = "zGufUcqa7ovgxRL0kF5OlPr482EZwtn8"; - - if (testApiV3Key == null || testApiV3Key.trim().isEmpty()) { - throw PaymentException.systemError("开发环境APIv3密钥未配置", null); - } - - log.info("使用开发环境测试配置"); - log.info("测试商户号: {}", testMerchantId); - log.info("测试序列号: {}", testMerchantSerialNumber); - log.info("证书路径: {}", certificatePath); - log.info("APIv3密钥长度: {}", testApiV3Key.length()); - - return new RSAAutoCertificateConfig.Builder() - .merchantId(testMerchantId) - .privateKeyFromPath(certificatePath) - .merchantSerialNumber(testMerchantSerialNumber) - .apiV3Key(testApiV3Key) - .build(); - } - - /** - * 创建正常配置 - */ - private Config createNormalConfig(Payment payment, String certificatePath) throws PaymentException { - // 验证配置完整性 - validatePaymentConfig(payment); - - // 打印详细配置信息 - log.info("========== 微信支付配置详情 =========="); - log.info("商户号(mchId): {}", payment.getMchId()); - log.info("商户证书序列号(serialNo): {}", payment.getMerchantSerialNumber()); - log.info("APIv3密钥(apiKey): {}", payment.getApiKey() != null ? payment.getApiKey().substring(0, 8) + "****" : "NULL"); - log.info("证书路径(privateKey): {}", certificatePath); - log.info("AppID: {}", payment.getAppId()); - log.info("回调地址(notifyUrl): {}", payment.getNotifyUrl()); - log.info("========================================"); - - return new RSAAutoCertificateConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(certificatePath) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(payment.getApiKey()) - .build(); - } - - /** - * 验证支付配置完整性 - */ - private void validatePaymentConfig(Payment payment) throws PaymentException { - if (payment == null) { - throw PaymentException.systemError("支付配置为空", null); - } - - if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { - throw PaymentException.systemError("商户号(mchId)未配置", null); - } - - if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { - throw PaymentException.systemError("商户证书序列号(merchantSerialNumber)未配置", null); - } - - if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { - throw PaymentException.systemError("APIv3密钥(apiKey)未配置", null); - } - - // 开发环境下,如果apiclientKey为空,给一个警告但不抛异常 - // 生产环境必须有apiclientKey - if (payment.getApiclientKey() == null || payment.getApiclientKey().trim().isEmpty()) { - if ("dev".equals(activeProfile)) { - log.warn("开发环境:证书文件名(apiclientKey)未配置,将使用默认值"); - } else { - throw PaymentException.systemError("证书文件名(apiclientKey)未配置", null); - } - } - - log.debug("支付配置验证通过,租户ID: {}, 商户号: {}", payment.getTenantId(), payment.getMchId()); - } - - /** - * 清除指定租户的配置缓存 - * - * @param tenantId 租户ID - */ - public void clearConfigCache(Integer tenantId) { - WxNativeUtil.addConfig(tenantId, null); - log.info("清除微信支付配置缓存,租户ID: {}", tenantId); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/WxPayNotifyService.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/service/WxPayNotifyService.java deleted file mode 100644 index 9378dcd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/WxPayNotifyService.java +++ /dev/null @@ -1,366 +0,0 @@ -package com.gxwebsoft.payment.service; - - -import com.gxwebsoft.payment.constants.PaymentConstants; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.service.ShopOrderService; -import com.wechat.pay.java.core.Config; -import com.wechat.pay.java.core.notification.NotificationConfig; -import com.wechat.pay.java.core.notification.NotificationParser; -import com.wechat.pay.java.core.notification.RequestParam; -import com.wechat.pay.java.service.payments.model.Transaction; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.Map; - -/** - * 微信支付回调通知处理服务 - * 负责处理微信支付的异步通知回调 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Service -public class WxPayNotifyService { - - @Resource - private WxPayConfigService wxPayConfigService; - - @Resource - private ShopOrderService shopOrderService; - - /** - * 处理微信支付回调通知 - * - * @param headers 请求头 - * @param body 请求体 - * @param tenantId 租户ID - * @return 处理结果响应 - */ - public String handlePaymentNotify(Map headers, String body, Integer tenantId) { - log.info("{}, 租户ID: {}", PaymentConstants.LogMessage.NOTIFY_START, tenantId); - - try { - // 参数验证 - validateNotifyParams(headers, body, tenantId); - - // 获取微信支付配置 - Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); - - // 解析并验证回调数据 - Transaction transaction = parseAndVerifyNotification(headers, body, wxPayConfig); - - // 处理支付结果 - processPaymentResult(transaction, tenantId); - - log.info("{}, 租户ID: {}, 订单号: {}", - PaymentConstants.LogMessage.NOTIFY_SUCCESS, tenantId, transaction.getOutTradeNo()); - - return "SUCCESS"; - - } catch (Exception e) { - log.error("{}, 租户ID: {}, 错误: {}", - PaymentConstants.LogMessage.NOTIFY_FAILED, tenantId, e.getMessage(), e); - return "FAIL"; - } - } - - /** - * 验证回调通知参数 - */ - private void validateNotifyParams(Map headers, String body, Integer tenantId) throws PaymentException { - if (tenantId == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - - if (headers == null || headers.isEmpty()) { - throw PaymentException.paramError("请求头不能为空"); - } - - if (!StringUtils.hasText(body)) { - throw PaymentException.paramError("请求体不能为空"); - } - - // 验证必要的微信支付头部信息 - String signature = headers.get("Wechatpay-Signature"); - String timestamp = headers.get("Wechatpay-Timestamp"); - String nonce = headers.get("Wechatpay-Nonce"); - String serial = headers.get("Wechatpay-Serial"); - - if (!StringUtils.hasText(signature)) { - throw PaymentException.paramError("微信支付签名不能为空"); - } - - if (!StringUtils.hasText(timestamp)) { - throw PaymentException.paramError("微信支付时间戳不能为空"); - } - - if (!StringUtils.hasText(nonce)) { - throw PaymentException.paramError("微信支付随机数不能为空"); - } - - if (!StringUtils.hasText(serial)) { - throw PaymentException.paramError("微信支付序列号不能为空"); - } - - log.debug("回调通知参数验证通过, 租户ID: {}", tenantId); - } - - /** - * 解析并验证回调通知 - */ - private Transaction parseAndVerifyNotification(Map headers, String body, Config wxPayConfig) throws PaymentException { - if (wxPayConfig == null) { - throw PaymentException.systemError("微信支付配置为空", null); - } - - try { - // 构建请求参数 - RequestParam requestParam = new RequestParam.Builder() - .serialNumber(headers.get("Wechatpay-Serial")) - .nonce(headers.get("Wechatpay-Nonce")) - .signature(headers.get("Wechatpay-Signature")) - .timestamp(headers.get("Wechatpay-Timestamp")) - .body(body) - .build(); - - // 创建通知解析器 - NotificationParser parser = new NotificationParser((NotificationConfig) wxPayConfig); - - // 解析并验证通知 - Transaction transaction = parser.parse(requestParam, Transaction.class); - - if (transaction == null) { - throw PaymentException.systemError("解析回调通知失败:transaction为空", null); - } - - log.debug("回调通知解析成功, 订单号: {}, 交易状态: {}", - transaction.getOutTradeNo(), transaction.getTradeState()); - - return transaction; - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - throw PaymentException.systemError("解析回调通知失败: " + e.getMessage(), e); - } - } - - /** - * 处理支付结果 - */ - private void processPaymentResult(Transaction transaction, Integer tenantId) throws PaymentException { - String outTradeNo = transaction.getOutTradeNo(); - String tradeState = String.valueOf(transaction.getTradeState()); - - if (!StringUtils.hasText(outTradeNo)) { - throw PaymentException.paramError("商户订单号不能为空"); - } - - // 查询订单 - ShopOrder order = shopOrderService.getByOutTradeNo(outTradeNo); - if (order == null) { - throw PaymentException.systemError("订单不存在: " + outTradeNo, null); - } - - // 验证租户ID - if (!tenantId.equals(order.getTenantId())) { - throw PaymentException.paramError("订单租户ID不匹配"); - } - - // 验证订单状态 - 使用Boolean类型的payStatus字段 - if (Boolean.TRUE.equals(order.getPayStatus())) { - log.info("订单已支付,跳过处理, 订单号: {}", outTradeNo); - return; - } - - // 根据交易状态处理 - switch (tradeState) { - case "SUCCESS": - handlePaymentSuccess(order, transaction); - break; - case "REFUND": - handlePaymentRefund(order, transaction); - break; - case "CLOSED": - case "REVOKED": - case "PAYERROR": - handlePaymentFailed(order, transaction); - break; - default: - log.warn("未处理的交易状态: {}, 订单号: {}", tradeState, outTradeNo); - break; - } - } - - /** - * 处理支付成功 - */ - private void handlePaymentSuccess(ShopOrder order, Transaction transaction) throws PaymentException { - try { - // 验证金额 - validateAmount(order, transaction); - - // 更新订单状态 - order.setPayStatus(true); // 使用Boolean类型 - order.setTransactionId(transaction.getTransactionId()); - order.setPayTime(LocalDateTime.parse(transaction.getSuccessTime())); - - // 使用专门的更新方法,会触发支付成功后的业务逻辑 - shopOrderService.updateByOutTradeNo(order); - - // 推送支付结果通知 - pushPaymentNotification(order, transaction); - - log.info("支付成功处理完成, 订单号: {}, 微信交易号: {}", - order.getOrderNo(), transaction.getTransactionId()); - - } catch (Exception e) { - throw PaymentException.systemError("处理支付成功回调失败: " + e.getMessage(), e); - } - } - - /** - * 处理支付退款 - */ - private void handlePaymentRefund(ShopOrder order, Transaction transaction) throws PaymentException { - try { - log.info("处理支付退款, 订单号: {}, 微信交易号: {}", - order.getOrderNo(), transaction.getTransactionId()); - - // 这里可以添加退款相关的业务逻辑 - // 例如:更新订单状态、处理库存、发送通知等 - - } catch (Exception e) { - throw PaymentException.systemError("处理支付退款回调失败: " + e.getMessage(), e); - } - } - - /** - * 处理支付失败 - */ - private void handlePaymentFailed(ShopOrder order, Transaction transaction) throws PaymentException { - try { - log.info("处理支付失败, 订单号: {}, 交易状态: {}", - order.getOrderNo(), transaction.getTradeState()); - - // 这里可以添加支付失败相关的业务逻辑 - // 例如:释放库存、发送通知等 - - } catch (Exception e) { - throw PaymentException.systemError("处理支付失败回调失败: " + e.getMessage(), e); - } - } - - /** - * 验证支付金额 - */ - private void validateAmount(ShopOrder order, Transaction transaction) throws PaymentException { - if (transaction.getAmount() == null || transaction.getAmount().getTotal() == null) { - throw PaymentException.amountError("回调通知中金额信息为空"); - } - - // 将订单金额转换为分 - BigDecimal orderAmount = order.getMoney(); - if (orderAmount == null) { - throw PaymentException.amountError("订单金额为空"); - } - - int orderAmountFen = orderAmount.multiply(new BigDecimal(100)).intValue(); - int callbackAmountFen = transaction.getAmount().getTotal(); - - if (orderAmountFen != callbackAmountFen) { - throw PaymentException.amountError( - String.format("订单金额不匹配,订单金额: %d分, 回调金额: %d分", - orderAmountFen, callbackAmountFen)); - } - - log.debug("金额验证通过, 订单号: {}, 金额: {}分", order.getOrderNo(), orderAmountFen); - } - - /** - * 推送支付结果通知 - */ - private void pushPaymentNotification(ShopOrder order, Transaction transaction) { - try { - log.info("开始推送支付成功通知, 订单号: {}, 交易号: {}, 用户ID: {}", - order.getOrderNo(), transaction.getTransactionId(), order.getUserId()); - - // 1. 记录支付成功日志 - logPaymentSuccess(order, transaction); - - // 2. 发送支付成功通知(可扩展) - sendPaymentSuccessNotification(order, transaction); - - // 3. 触发其他业务逻辑(可扩展) - triggerPostPaymentActions(order, transaction); - - log.info("支付结果通知推送完成, 订单号: {}, 交易号: {}", - order.getOrderNo(), transaction.getTransactionId()); - } catch (Exception e) { - log.warn("支付结果通知推送失败, 订单号: {}, 错误: {}", order.getOrderNo(), e.getMessage()); - // 推送失败不影响主流程,只记录日志 - } - } - - /** - * 记录支付成功日志 - */ - private void logPaymentSuccess(ShopOrder order, Transaction transaction) { - try { - log.info("=== 支付成功详细信息 ==="); - log.info("订单号: {}", order.getOrderNo()); - log.info("微信交易号: {}", transaction.getTransactionId()); - log.info("支付金额: {}元", order.getPayPrice()); - log.info("支付时间: {}", transaction.getSuccessTime()); - log.info("用户ID: {}", order.getUserId()); - log.info("租户ID: {}", order.getTenantId()); - log.info("订单标题: {}", order.getTitle()); - log.info("========================"); - } catch (Exception e) { - log.warn("记录支付成功日志失败: {}", e.getMessage()); - } - } - - /** - * 发送支付成功通知 - */ - private void sendPaymentSuccessNotification(ShopOrder order, Transaction transaction) { - try { - // TODO: 实现具体的通知逻辑 - // 1. 发送邮件通知 - // 2. 发送短信通知 - // 3. 站内消息通知 - // 4. 微信模板消息通知 - - log.debug("支付成功通知发送完成, 订单号: {}", order.getOrderNo()); - } catch (Exception e) { - log.warn("发送支付成功通知失败, 订单号: {}, 错误: {}", order.getOrderNo(), e.getMessage()); - } - } - - /** - * 触发支付成功后的其他业务逻辑 - */ - private void triggerPostPaymentActions(ShopOrder order, Transaction transaction) { - try { - // TODO: 根据业务需求实现 - // 1. 开通网站服务 - // 2. 激活会员权益 - // 3. 发放积分奖励 - // 4. 触发营销活动 - - log.debug("支付后业务逻辑触发完成, 订单号: {}", order.getOrderNo()); - } catch (Exception e) { - log.warn("触发支付后业务逻辑失败, 订单号: {}, 错误: {}", order.getOrderNo(), e.getMessage()); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/impl/PaymentServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/service/impl/PaymentServiceImpl.java deleted file mode 100644 index a01dafe..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/service/impl/PaymentServiceImpl.java +++ /dev/null @@ -1,675 +0,0 @@ -package com.gxwebsoft.payment.service.impl; - -import cn.hutool.core.util.IdUtil; -import com.gxwebsoft.common.core.utils.CommonUtil; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.payment.constants.PaymentConstants; -import com.gxwebsoft.payment.dto.PaymentRequest; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.dto.PaymentWithOrderRequest; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.payment.service.PaymentService; -import com.gxwebsoft.payment.service.WxPayConfigService; -import com.gxwebsoft.payment.strategy.PaymentStrategy; -import com.gxwebsoft.shop.dto.OrderCreateRequest; -import com.gxwebsoft.shop.service.OrderBusinessService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.util.StringUtils; - -import javax.annotation.PostConstruct; -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -/** - * 统一支付服务实现 - * 基于策略模式实现多种支付方式的统一管理 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Service("unifiedPaymentServiceImpl") -public class PaymentServiceImpl implements PaymentService { - - /** - * 支付策略映射表 - */ - private final Map strategyMap = new ConcurrentHashMap<>(); - - /** - * 注入所有支付策略实现 - */ - @Resource - private List paymentStrategies; - - /** - * 订单业务服务 - */ - @Resource - private OrderBusinessService orderBusinessService; - - /** - * 微信支付配置服务 - */ - @Resource - private WxPayConfigService wxPayConfigService; - - /** - * 初始化策略映射 - */ - @PostConstruct - public void initStrategies() { - if (paymentStrategies != null && !paymentStrategies.isEmpty()) { - for (PaymentStrategy strategy : paymentStrategies) { - try { - PaymentType paymentType = strategy.getSupportedPaymentType(); - strategyMap.put(paymentType, strategy); - log.info("注册支付策略: {} -> {}", paymentType.getName(), strategy.getClass().getSimpleName()); - } catch (Exception e) { - log.warn("注册支付策略失败: {}, 错误: {}", strategy.getClass().getSimpleName(), e.getMessage()); - } - } - } - log.info("支付策略初始化完成,共注册 {} 种支付方式", strategyMap.size()); - - if (strategyMap.isEmpty()) { - log.warn("⚠️ 没有可用的支付策略,支付功能将不可用"); - } - } - - @Override - public PaymentResponse createPayment(PaymentRequest request) throws PaymentException { - log.info("{}, 支付类型: {}, 租户ID: {}, 用户ID: {}, 金额: {}", - PaymentConstants.LogMessage.PAYMENT_START, request.getPaymentType(), - request.getTenantId(), request.getUserId(), request.getFormattedAmount()); - - try { - // 基础参数验证 - validatePaymentRequest(request); - - // 获取支付策略 - PaymentStrategy strategy = getPaymentStrategy(request.getPaymentType()); - - // 执行支付 - PaymentResponse response = strategy.createPayment(request); - - log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 金额: {}", - PaymentConstants.LogMessage.PAYMENT_SUCCESS, request.getPaymentType(), - request.getTenantId(), response.getOrderNo(), request.getFormattedAmount()); - - return response; - - } catch (PaymentException e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", - PaymentConstants.LogMessage.PAYMENT_FAILED, request.getPaymentType(), - request.getTenantId(), e.getMessage()); - throw e; - } catch (Exception e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 系统错误: {}", - PaymentConstants.LogMessage.PAYMENT_FAILED, request.getPaymentType(), - request.getTenantId(), e.getMessage(), e); - throw PaymentException.systemError("支付创建失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse createPaymentWithOrder(PaymentWithOrderRequest request, User loginUser) throws PaymentException { - log.info("开始创建支付订单(包含订单信息), 支付类型: {}, 租户ID: {}, 用户ID: {}, 金额: {}", - request.getPaymentType(), request.getTenantId(), loginUser.getUserId(), request.getFormattedAmount()); - - try { - // 1. 参数验证 - validatePaymentWithOrderRequest(request, loginUser); - - // 2. 转换为订单创建请求 - OrderCreateRequest orderRequest = convertToOrderCreateRequest(request, loginUser); - - // 3. 创建订单(包含商品验证、库存扣减等完整业务逻辑) - Map wxOrderInfo = orderBusinessService.createOrder(orderRequest, loginUser); - - // 4. 构建支付响应(复用现有的微信支付返回格式) - PaymentResponse response = buildPaymentResponseFromWxOrder(wxOrderInfo, request, orderRequest.getOrderNo()); - - log.info("支付订单创建成功(包含订单信息), 支付类型: {}, 租户ID: {}, 订单号: {}, 金额: {}", - request.getPaymentType(), request.getTenantId(), response.getOrderNo(), request.getFormattedAmount()); - - return response; - - } catch (PaymentException e) { - log.error("创建支付订单失败(包含订单信息), 支付类型: {}, 租户ID: {}, 错误: {}", - request.getPaymentType(), request.getTenantId(), e.getMessage()); - throw e; - } catch (Exception e) { - log.error("创建支付订单系统错误(包含订单信息), 支付类型: {}, 租户ID: {}, 系统错误: {}", - request.getPaymentType(), request.getTenantId(), e.getMessage(), e); - throw PaymentException.systemError("支付订单创建失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse queryPayment(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { - log.info("开始查询支付状态, 支付类型: {}, 租户ID: {}, 订单号: {}", - paymentType, tenantId, orderNo); - - try { - // 参数验证 - validateQueryParams(orderNo, paymentType, tenantId); - - // 获取支付策略 - PaymentStrategy strategy = getPaymentStrategy(paymentType); - - // 检查是否支持查询 - if (!strategy.supportQuery()) { - throw PaymentException.unsupportedPayment("该支付方式不支持查询", paymentType); - } - - // 执行查询 - PaymentResponse response = strategy.queryPayment(orderNo, tenantId); - - log.info("支付状态查询成功, 支付类型: {}, 租户ID: {}, 订单号: {}, 状态: {}", - paymentType, tenantId, orderNo, response.getPaymentStatus()); - - return response; - - } catch (PaymentException e) { - log.error("支付状态查询失败, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", - paymentType, tenantId, orderNo, e.getMessage()); - throw e; - } catch (Exception e) { - log.error("支付状态查询系统错误, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", - paymentType, tenantId, orderNo, e.getMessage(), e); - throw PaymentException.systemError("支付查询失败: " + e.getMessage(), e); - } - } - - @Override - public String handlePaymentNotify(PaymentType paymentType, Map headers, String body, Integer tenantId) throws PaymentException { - log.info("{}, 支付类型: {}, 租户ID: {}", - PaymentConstants.LogMessage.NOTIFY_START, paymentType, tenantId); - - try { - // 参数验证 - validateNotifyParams(paymentType, headers, body, tenantId); - - // 获取支付策略 - PaymentStrategy strategy = getPaymentStrategy(paymentType); - - // 检查是否需要异步通知 - if (!strategy.needNotify()) { - log.warn("该支付方式不需要异步通知, 支付类型: {}", paymentType); - return PaymentConstants.Wechat.NOTIFY_SUCCESS; - } - - // 处理回调 - String result = strategy.handleNotify(headers, body, tenantId); - - log.info("{}, 支付类型: {}, 租户ID: {}", - PaymentConstants.LogMessage.NOTIFY_SUCCESS, paymentType, tenantId); - - return result; - - } catch (PaymentException e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", - PaymentConstants.LogMessage.NOTIFY_FAILED, paymentType, tenantId, e.getMessage()); - throw e; - } catch (Exception e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 系统错误: {}", - PaymentConstants.LogMessage.NOTIFY_FAILED, paymentType, tenantId, e.getMessage(), e); - throw PaymentException.systemError("支付回调处理失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse refund(String orderNo, String refundNo, PaymentType paymentType, - BigDecimal totalAmount, BigDecimal refundAmount, - String reason, Integer tenantId) throws PaymentException { - log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 退款金额: {}", - PaymentConstants.LogMessage.REFUND_START, paymentType, tenantId, orderNo, refundNo, refundAmount); - - try { - // 参数验证 - validateRefundParams(orderNo, refundNo, paymentType, totalAmount, refundAmount, tenantId); - - // 获取支付策略 - PaymentStrategy strategy = getPaymentStrategy(paymentType); - - // 检查是否支持退款 - if (!strategy.supportRefund()) { - throw PaymentException.unsupportedPayment("该支付方式不支持退款", paymentType); - } - - // 执行退款 - PaymentResponse response = strategy.refund(orderNo, refundNo, totalAmount, refundAmount, reason, tenantId); - - log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 退款金额: {}", - PaymentConstants.LogMessage.REFUND_SUCCESS, paymentType, tenantId, orderNo, refundNo, refundAmount); - - return response; - - } catch (PaymentException e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 错误: {}", - PaymentConstants.LogMessage.REFUND_FAILED, paymentType, tenantId, orderNo, refundNo, e.getMessage()); - throw e; - } catch (Exception e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 退款单号: {}, 系统错误: {}", - PaymentConstants.LogMessage.REFUND_FAILED, paymentType, tenantId, orderNo, refundNo, e.getMessage(), e); - throw PaymentException.systemError("退款申请失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse queryRefund(String refundNo, PaymentType paymentType, Integer tenantId) throws PaymentException { - log.info("开始查询退款状态, 支付类型: {}, 租户ID: {}, 退款单号: {}", - paymentType, tenantId, refundNo); - - try { - // 参数验证 - validateRefundQueryParams(refundNo, paymentType, tenantId); - - // 获取支付策略 - PaymentStrategy strategy = getPaymentStrategy(paymentType); - - // 检查是否支持退款查询 - if (!strategy.supportRefund()) { - throw PaymentException.unsupportedPayment("该支付方式不支持退款查询", paymentType); - } - - // 执行查询 - PaymentResponse response = strategy.queryRefund(refundNo, tenantId); - - log.info("退款状态查询成功, 支付类型: {}, 租户ID: {}, 退款单号: {}, 状态: {}", - paymentType, tenantId, refundNo, response.getPaymentStatus()); - - return response; - - } catch (PaymentException e) { - log.error("退款状态查询失败, 支付类型: {}, 租户ID: {}, 退款单号: {}, 错误: {}", - paymentType, tenantId, refundNo, e.getMessage()); - throw e; - } catch (Exception e) { - log.error("退款状态查询系统错误, 支付类型: {}, 租户ID: {}, 退款单号: {}, 错误: {}", - paymentType, tenantId, refundNo, e.getMessage(), e); - throw PaymentException.systemError("退款查询失败: " + e.getMessage(), e); - } - } - - @Override - public boolean closeOrder(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { - log.info("开始关闭订单, 支付类型: {}, 租户ID: {}, 订单号: {}", - paymentType, tenantId, orderNo); - - try { - // 参数验证 - validateCloseParams(orderNo, paymentType, tenantId); - - // 获取支付策略 - PaymentStrategy strategy = getPaymentStrategy(paymentType); - - // 检查是否支持关闭订单 - if (!strategy.supportClose()) { - throw PaymentException.unsupportedPayment("该支付方式不支持关闭订单", paymentType); - } - - // 执行关闭 - boolean result = strategy.closeOrder(orderNo, tenantId); - - log.info("订单关闭{}, 支付类型: {}, 租户ID: {}, 订单号: {}", - result ? "成功" : "失败", paymentType, tenantId, orderNo); - - return result; - - } catch (PaymentException e) { - log.error("订单关闭失败, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", - paymentType, tenantId, orderNo, e.getMessage()); - throw e; - } catch (Exception e) { - log.error("订单关闭系统错误, 支付类型: {}, 租户ID: {}, 订单号: {}, 错误: {}", - paymentType, tenantId, orderNo, e.getMessage(), e); - throw PaymentException.systemError("订单关闭失败: " + e.getMessage(), e); - } - } - - @Override - public List getSupportedPaymentTypes() { - return new ArrayList<>(strategyMap.keySet()); - } - - @Override - public boolean isPaymentTypeSupported(PaymentType paymentType) { - return strategyMap.containsKey(paymentType); - } - - @Override - public boolean isRefundSupported(PaymentType paymentType) { - PaymentStrategy strategy = strategyMap.get(paymentType); - return strategy != null && strategy.supportRefund(); - } - - @Override - public boolean isQuerySupported(PaymentType paymentType) { - PaymentStrategy strategy = strategyMap.get(paymentType); - return strategy != null && strategy.supportQuery(); - } - - @Override - public boolean isCloseSupported(PaymentType paymentType) { - PaymentStrategy strategy = strategyMap.get(paymentType); - return strategy != null && strategy.supportClose(); - } - - @Override - public boolean isNotifyNeeded(PaymentType paymentType) { - PaymentStrategy strategy = strategyMap.get(paymentType); - return strategy != null && strategy.needNotify(); - } - - @Override - public void validatePaymentRequest(PaymentRequest request) throws PaymentException { - if (request == null) { - throw PaymentException.paramError("支付请求不能为空"); - } - - if (request.getPaymentType() == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - - if (request.getTenantId() == null || request.getTenantId() <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - - if (request.getUserId() == null || request.getUserId() <= 0) { - throw PaymentException.paramError("用户ID不能为空且必须大于0"); - } - - if (request.getAmount() == null || request.getAmount().compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("支付金额必须大于0"); - } - - if (!StringUtils.hasText(request.getSubject())) { - throw PaymentException.paramError("订单标题不能为空"); - } - - // 检查支付类型是否支持 - if (!isPaymentTypeSupported(request.getPaymentType())) { - throw PaymentException.unsupportedPayment("不支持的支付类型: " + request.getPaymentType(), request.getPaymentType()); - } - } - - @Override - public Map getPaymentStrategyInfo(PaymentType paymentType) { - PaymentStrategy strategy = strategyMap.get(paymentType); - if (strategy == null) { - return null; - } - - Map info = new HashMap<>(); - info.put("paymentType", paymentType); - info.put("strategyName", strategy.getStrategyName()); - info.put("strategyDescription", strategy.getStrategyDescription()); - info.put("supportRefund", strategy.supportRefund()); - info.put("supportQuery", strategy.supportQuery()); - info.put("supportClose", strategy.supportClose()); - info.put("needNotify", strategy.needNotify()); - return info; - } - - @Override - public List> getAllPaymentStrategyInfo() { - return strategyMap.keySet().stream() - .map(this::getPaymentStrategyInfo) - .collect(Collectors.toList()); - } - - @Override - public Map checkPaymentConfig(Integer tenantId) { - Map result = new HashMap<>(); - result.put("tenantId", tenantId); - - try { - // 检查微信支付配置 - wxPayConfigService.getPaymentConfigForStrategy(tenantId); - result.put("wechatConfigExists", true); - result.put("wechatConfigError", null); - } catch (Exception e) { - result.put("wechatConfigExists", false); - result.put("wechatConfigError", e.getMessage()); - } - - try { - // 检查微信支付Config构建 - wxPayConfigService.getWxPayConfig(tenantId); - result.put("wechatConfigValid", true); - result.put("wechatConfigValidError", null); - } catch (Exception e) { - result.put("wechatConfigValid", false); - result.put("wechatConfigValidError", e.getMessage()); - } - - return result; - } - - /** - * 获取支付策略 - */ - private PaymentStrategy getPaymentStrategy(PaymentType paymentType) throws PaymentException { - // 如果是WECHAT支付类型,转换为WECHAT_NATIVE - // 因为WECHAT是一个通用类型,实际的支付策略是WECHAT_NATIVE - PaymentType actualPaymentType = paymentType; - if (paymentType == PaymentType.WECHAT) { - actualPaymentType = PaymentType.WECHAT_NATIVE; - } - - PaymentStrategy strategy = strategyMap.get(actualPaymentType); - if (strategy == null) { - throw PaymentException.unsupportedPayment("不支持的支付类型: " + paymentType, paymentType); - } - return strategy; - } - - /** - * 验证查询参数 - */ - private void validateQueryParams(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { - if (!StringUtils.hasText(orderNo)) { - throw PaymentException.paramError("订单号不能为空"); - } - if (paymentType == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - if (tenantId == null || tenantId <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - } - - /** - * 验证回调参数 - */ - private void validateNotifyParams(PaymentType paymentType, Map headers, String body, Integer tenantId) throws PaymentException { - if (paymentType == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - if (headers == null || headers.isEmpty()) { - throw PaymentException.paramError("请求头不能为空"); - } - if (!StringUtils.hasText(body)) { - throw PaymentException.paramError("请求体不能为空"); - } - if (tenantId == null || tenantId <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - } - - /** - * 验证退款参数 - */ - private void validateRefundParams(String orderNo, String refundNo, PaymentType paymentType, - BigDecimal totalAmount, BigDecimal refundAmount, Integer tenantId) throws PaymentException { - if (!StringUtils.hasText(orderNo)) { - throw PaymentException.paramError("订单号不能为空"); - } - if (!StringUtils.hasText(refundNo)) { - throw PaymentException.paramError("退款单号不能为空"); - } - if (paymentType == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - if (totalAmount == null || totalAmount.compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("订单总金额必须大于0"); - } - if (refundAmount == null || refundAmount.compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("退款金额必须大于0"); - } - if (refundAmount.compareTo(totalAmount) > 0) { - throw PaymentException.amountError("退款金额不能大于订单总金额"); - } - if (tenantId == null || tenantId <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - } - - /** - * 验证退款查询参数 - */ - private void validateRefundQueryParams(String refundNo, PaymentType paymentType, Integer tenantId) throws PaymentException { - if (!StringUtils.hasText(refundNo)) { - throw PaymentException.paramError("退款单号不能为空"); - } - if (paymentType == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - if (tenantId == null || tenantId <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - } - - /** - * 验证关闭订单参数 - */ - private void validateCloseParams(String orderNo, PaymentType paymentType, Integer tenantId) throws PaymentException { - if (!StringUtils.hasText(orderNo)) { - throw PaymentException.paramError("订单号不能为空"); - } - if (paymentType == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - if (tenantId == null || tenantId <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - } - - /** - * 验证支付与订单创建请求参数 - */ - private void validatePaymentWithOrderRequest(PaymentWithOrderRequest request, User loginUser) throws PaymentException { - if (request == null) { - throw PaymentException.paramError("请求参数不能为空"); - } - if (loginUser == null) { - throw PaymentException.paramError("用户未登录"); - } - if (request.getPaymentType() == null) { - throw PaymentException.paramError("支付类型不能为空"); - } - if (request.getAmount() == null || request.getAmount().compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("支付金额必须大于0"); - } - if (!StringUtils.hasText(request.getSubject())) { - throw PaymentException.paramError("订单标题不能为空"); - } - if (request.getTenantId() == null || request.getTenantId() <= 0) { - throw PaymentException.paramError("租户ID不能为空且必须大于0"); - } - if (request.getOrderInfo() == null) { - throw PaymentException.paramError("订单信息不能为空"); - } - if (request.getOrderInfo().getGoodsItems() == null || request.getOrderInfo().getGoodsItems().isEmpty()) { - throw PaymentException.paramError("订单商品列表不能为空"); - } - } - - /** - * 转换为订单创建请求 - */ - private OrderCreateRequest convertToOrderCreateRequest(PaymentWithOrderRequest request, User loginUser) { - OrderCreateRequest orderRequest = new OrderCreateRequest(); - - // 生成订单号(使用雪花算法保证全局唯一) - String orderNo = Long.toString(IdUtil.getSnowflakeNextId()); - orderRequest.setOrderNo(orderNo); - log.info("为订单创建请求生成订单号(雪花算法): {}", orderNo); - - // 设置基本信息 - orderRequest.setType(request.getOrderInfo().getType()); - orderRequest.setTitle(request.getSubject()); - orderRequest.setComments(request.getOrderInfo().getComments()); - orderRequest.setTenantId(request.getTenantId()); - - // 设置收货信息 - orderRequest.setRealName(request.getOrderInfo().getRealName()); - orderRequest.setAddress(request.getOrderInfo().getAddress()); - orderRequest.setAddressId(request.getOrderInfo().getAddressId()); - orderRequest.setDeliveryType(request.getOrderInfo().getDeliveryType()); - - // 设置商户信息 - orderRequest.setMerchantId(request.getOrderInfo().getMerchantId()); - orderRequest.setMerchantName(request.getOrderInfo().getMerchantName()); - - // 设置支付信息 - orderRequest.setPayType(request.getPaymentType().getCode()); - orderRequest.setTotalPrice(request.getAmount()); - orderRequest.setPayPrice(request.getAmount()); - - // 设置优惠券 - orderRequest.setCouponId(request.getOrderInfo().getCouponId()); - - // 转换商品列表 - List goodsItems = request.getOrderInfo().getGoodsItems().stream() - .map(this::convertToOrderGoodsItem) - .collect(java.util.stream.Collectors.toList()); - orderRequest.setGoodsItems(goodsItems); - - return orderRequest; - } - - /** - * 转换商品项 - */ - private OrderCreateRequest.OrderGoodsItem convertToOrderGoodsItem(PaymentWithOrderRequest.OrderGoodsItem item) { - OrderCreateRequest.OrderGoodsItem orderItem = new OrderCreateRequest.OrderGoodsItem(); - orderItem.setGoodsId(item.getGoodsId()); - orderItem.setSkuId(item.getSkuId()); - orderItem.setQuantity(item.getQuantity()); - orderItem.setSpecInfo(item.getSpecInfo()); - return orderItem; - } - - /** - * 从微信订单信息构建支付响应 - */ - private PaymentResponse buildPaymentResponseFromWxOrder(Map wxOrderInfo, - PaymentWithOrderRequest request, - String orderNo) { - PaymentResponse response = PaymentResponse.wechatNative( - orderNo, - wxOrderInfo.get("codeUrl"), - request.getAmount(), - request.getTenantId() - ); - - // 设置额外信息 - response.setSuccess(true); - // 确保orderNo被正确设置 - response.setOrderNo(orderNo); - - // 调试日志 - log.info("构建支付响应成功, 订单号: {}, 二维码URL: {}, 响应中的orderNo: {}", - orderNo, wxOrderInfo.get("codeUrl"), response.getOrderNo()); - - return response; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/strategy/PaymentStrategy.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/strategy/PaymentStrategy.java deleted file mode 100644 index 560c365..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/strategy/PaymentStrategy.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.gxwebsoft.payment.strategy; - -import com.gxwebsoft.payment.dto.PaymentRequest; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; - -import java.util.Map; - -/** - * 支付策略接口 - * 定义所有支付方式的统一接口 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public interface PaymentStrategy { - - /** - * 获取支持的支付类型 - * - * @return 支付类型 - */ - PaymentType getSupportedPaymentType(); - - /** - * 验证支付请求参数 - * - * @param request 支付请求 - * @throws PaymentException 参数验证失败时抛出 - */ - void validateRequest(PaymentRequest request) throws PaymentException; - - /** - * 创建支付订单 - * - * @param request 支付请求 - * @return 支付响应 - * @throws PaymentException 支付创建失败时抛出 - */ - PaymentResponse createPayment(PaymentRequest request) throws PaymentException; - - /** - * 查询支付状态 - * - * @param orderNo 订单号 - * @param tenantId 租户ID - * @return 支付响应 - * @throws PaymentException 查询失败时抛出 - */ - PaymentResponse queryPayment(String orderNo, Integer tenantId) throws PaymentException; - - /** - * 处理支付回调通知 - * - * @param headers 请求头 - * @param body 请求体 - * @param tenantId 租户ID - * @return 处理结果,返回给第三方的响应内容 - * @throws PaymentException 处理失败时抛出 - */ - String handleNotify(Map headers, String body, Integer tenantId) throws PaymentException; - - /** - * 申请退款 - * - * @param orderNo 订单号 - * @param refundNo 退款单号 - * @param totalAmount 订单总金额 - * @param refundAmount 退款金额 - * @param reason 退款原因 - * @param tenantId 租户ID - * @return 退款响应 - * @throws PaymentException 退款申请失败时抛出 - */ - PaymentResponse refund(String orderNo, String refundNo, - java.math.BigDecimal totalAmount, java.math.BigDecimal refundAmount, - String reason, Integer tenantId) throws PaymentException; - - /** - * 查询退款状态 - * - * @param refundNo 退款单号 - * @param tenantId 租户ID - * @return 退款查询响应 - * @throws PaymentException 查询失败时抛出 - */ - PaymentResponse queryRefund(String refundNo, Integer tenantId) throws PaymentException; - - /** - * 关闭订单 - * - * @param orderNo 订单号 - * @param tenantId 租户ID - * @return 关闭结果 - * @throws PaymentException 关闭失败时抛出 - */ - boolean closeOrder(String orderNo, Integer tenantId) throws PaymentException; - - /** - * 是否支持退款 - * - * @return true表示支持退款 - */ - default boolean supportRefund() { - return false; - } - - /** - * 是否支持查询 - * - * @return true表示支持查询 - */ - default boolean supportQuery() { - return false; - } - - /** - * 是否支持关闭订单 - * - * @return true表示支持关闭订单 - */ - default boolean supportClose() { - return false; - } - - /** - * 是否需要异步通知 - * - * @return true表示需要异步通知 - */ - default boolean needNotify() { - return false; - } - - /** - * 获取策略名称 - * - * @return 策略名称 - */ - default String getStrategyName() { - return getSupportedPaymentType().getName(); - } - - /** - * 获取策略描述 - * - * @return 策略描述 - */ - default String getStrategyDescription() { - return getSupportedPaymentType().getName() + "支付策略"; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/strategy/WechatNativeStrategy.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/strategy/WechatNativeStrategy.java deleted file mode 100644 index e5d6b1d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/strategy/WechatNativeStrategy.java +++ /dev/null @@ -1,668 +0,0 @@ -package com.gxwebsoft.payment.strategy; - -import cn.hutool.core.util.IdUtil; -import com.gxwebsoft.common.core.utils.CommonUtil; -import com.gxwebsoft.common.system.entity.Payment; -import com.gxwebsoft.payment.constants.PaymentConstants; -import com.gxwebsoft.payment.dto.PaymentRequest; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.enums.PaymentStatus; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.payment.service.WxPayConfigService; -import com.gxwebsoft.payment.service.WxPayNotifyService; -import com.wechat.pay.java.core.Config; -import com.wechat.pay.java.service.payments.nativepay.NativePayService; -import com.wechat.pay.java.service.payments.nativepay.model.Amount; -import com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest; -import com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse; -import com.wechat.pay.java.service.payments.nativepay.model.QueryOrderByOutTradeNoRequest; -import com.wechat.pay.java.service.payments.model.Transaction; -import com.wechat.pay.java.service.refund.RefundService; -import com.wechat.pay.java.service.refund.model.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; -import org.springframework.util.StringUtils; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.util.Map; - -/** - * 微信Native支付策略实现 - * 处理微信Native扫码支付 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Component -public class WechatNativeStrategy implements PaymentStrategy { - - @Resource - private WxPayConfigService wxPayConfigService; - - @Resource - private WxPayNotifyService wxPayNotifyService; - - @Override - public PaymentType getSupportedPaymentType() { - return PaymentType.WECHAT_NATIVE; - } - - @Override - public void validateRequest(PaymentRequest request) throws PaymentException { - if (request == null) { - throw PaymentException.paramError("支付请求不能为空"); - } - - if (request.getTenantId() == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - - if (request.getUserId() == null) { - throw PaymentException.paramError("用户ID不能为空"); - } - - if (request.getAmount() == null || request.getAmount().compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("支付金额必须大于0"); - } - - if (!StringUtils.hasText(request.getSubject())) { - throw PaymentException.paramError("订单标题不能为空"); - } - - // 验证金额范围 - if (request.getAmount().compareTo(new BigDecimal("0.01")) < 0) { - throw PaymentException.amountError("支付金额不能小于0.01元"); - } - - if (request.getAmount().compareTo(new BigDecimal("999999.99")) > 0) { - throw PaymentException.amountError("支付金额不能超过999999.99元"); - } - - // 验证订单标题长度 - if (request.getSubject().length() > PaymentConstants.Config.DESCRIPTION_MAX_LENGTH) { - throw PaymentException.paramError("订单标题长度不能超过" + PaymentConstants.Config.DESCRIPTION_MAX_LENGTH + "个字符"); - } - - log.debug("微信Native支付请求参数验证通过, 租户ID: {}, 金额: {}", - request.getTenantId(), request.getFormattedAmount()); - } - - @Override - public PaymentResponse createPayment(PaymentRequest request) throws PaymentException { - log.info("{}, 支付类型: {}, 租户ID: {}, 金额: {}", - PaymentConstants.LogMessage.PAYMENT_START, getSupportedPaymentType(), - request.getTenantId(), request.getFormattedAmount()); - - try { - // 验证请求参数 - validateRequest(request); - - // 生成订单号 - String orderNo = generateOrderNo(request); - log.info("生成的订单号: {}", orderNo); - - // 获取Native支付的Payment配置(包含appId等信息) - Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(request.getTenantId()); - - // 获取微信支付配置 - Config wxPayConfig = wxPayConfigService.getWxPayConfig(request.getTenantId()); - - // 构建预支付请求 - PrepayRequest prepayRequest = buildPrepayRequest(request, orderNo, paymentConfig); - - // 调用微信支付API - PrepayResponse prepayResponse = callWechatPayApi(prepayRequest, wxPayConfig); - - // 构建响应 - PaymentResponse response = PaymentResponse.wechatNative( - orderNo, prepayResponse.getCodeUrl(), request.getAmount(), request.getTenantId()); - response.setUserId(request.getUserId()); - - // 确保orderNo被正确设置 - response.setOrderNo(orderNo); - - // 调试日志:检查响应对象的orderNo - log.info("构建的响应对象 - orderNo: {}, codeUrl: {}, success: {}", - response.getOrderNo(), response.getCodeUrl(), response.getSuccess()); - - log.info("{}, 支付类型: {}, 租户ID: {}, 订单号: {}, 金额: {}", - PaymentConstants.LogMessage.PAYMENT_SUCCESS, getSupportedPaymentType(), - request.getTenantId(), orderNo, request.getFormattedAmount()); - - return response; - - } catch (PaymentException e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", - PaymentConstants.LogMessage.PAYMENT_FAILED, getSupportedPaymentType(), - request.getTenantId(), e.getMessage()); - throw e; - } catch (Exception e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 系统错误: {}", - PaymentConstants.LogMessage.PAYMENT_FAILED, getSupportedPaymentType(), - request.getTenantId(), e.getMessage(), e); - throw PaymentException.systemError("微信Native支付创建失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse queryPayment(String orderNo, Integer tenantId) throws PaymentException { - log.info("开始查询微信Native支付状态, 订单号: {}, 租户ID: {}", orderNo, tenantId); - - try { - // 参数验证 - if (!StringUtils.hasText(orderNo)) { - throw PaymentException.paramError("订单号不能为空"); - } - if (tenantId == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - - // 获取支付配置(包含商户号等信息) - Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(tenantId); - - // 获取微信支付配置 - Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); - - // 调用微信支付查询API - return queryWechatPaymentStatus(orderNo, tenantId, paymentConfig, wxPayConfig); - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - log.error("查询微信Native支付状态失败, 订单号: {}, 租户ID: {}, 错误: {}", - orderNo, tenantId, e.getMessage(), e); - throw PaymentException.systemError("查询微信支付状态失败: " + e.getMessage(), e); - } - } - - @Override - public String handleNotify(Map headers, String body, Integer tenantId) throws PaymentException { - log.info("{}, 支付类型: {}, 租户ID: {}", - PaymentConstants.LogMessage.NOTIFY_START, getSupportedPaymentType(), tenantId); - - try { - // 委托给专门的回调处理服务 - return wxPayNotifyService.handlePaymentNotify(headers, body, tenantId); - } catch (Exception e) { - log.error("{}, 支付类型: {}, 租户ID: {}, 错误: {}", - PaymentConstants.LogMessage.NOTIFY_FAILED, getSupportedPaymentType(), - tenantId, e.getMessage(), e); - throw PaymentException.systemError("微信支付回调处理失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse refund(String orderNo, String refundNo, BigDecimal totalAmount, - BigDecimal refundAmount, String reason, Integer tenantId) throws PaymentException { - log.info("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 退款金额: {}, 租户ID: {}", - PaymentConstants.LogMessage.REFUND_START, getSupportedPaymentType(), - orderNo, refundNo, refundAmount, tenantId); - - try { - // 参数验证 - validateRefundRequest(orderNo, refundNo, totalAmount, refundAmount, tenantId); - - // 获取支付配置 - Payment paymentConfig = wxPayConfigService.getPaymentConfigForStrategy(tenantId); - Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); - - // 构建退款请求 - CreateRequest refundRequest = buildRefundRequest( - orderNo, refundNo, totalAmount, refundAmount, reason, paymentConfig); - - // 调用微信退款API - Refund refundResult = callWechatRefundApi(refundRequest, wxPayConfig); - - // 构建响应 - PaymentResponse response = buildRefundResponse(refundResult, orderNo, refundNo, tenantId); - - log.info("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 微信退款单号: {}", - PaymentConstants.LogMessage.REFUND_SUCCESS, getSupportedPaymentType(), - orderNo, refundNo, refundResult.getRefundId()); - - return response; - - } catch (PaymentException e) { - log.error("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 错误: {}", - PaymentConstants.LogMessage.REFUND_FAILED, getSupportedPaymentType(), - orderNo, refundNo, e.getMessage()); - throw e; - } catch (Exception e) { - log.error("{}, 支付类型: {}, 订单号: {}, 退款单号: {}, 系统错误: {}", - PaymentConstants.LogMessage.REFUND_FAILED, getSupportedPaymentType(), - orderNo, refundNo, e.getMessage(), e); - throw PaymentException.systemError("微信支付退款失败: " + e.getMessage(), e); - } - } - - @Override - public PaymentResponse queryRefund(String refundNo, Integer tenantId) throws PaymentException { - log.info("开始查询微信退款状态, 退款单号: {}, 租户ID: {}", refundNo, tenantId); - - try { - // 参数验证 - if (!StringUtils.hasText(refundNo)) { - throw PaymentException.paramError("退款单号不能为空"); - } - if (tenantId == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - - // 获取支付配置 - Config wxPayConfig = wxPayConfigService.getWxPayConfig(tenantId); - - // 调用微信退款查询API - Refund refundResult = queryWechatRefundStatus(refundNo, wxPayConfig); - - // 构建响应 - PaymentResponse response = buildRefundQueryResponse(refundResult, tenantId); - - log.info("微信退款状态查询成功, 退款单号: {}, 状态: {}, 微信退款单号: {}", - refundNo, refundResult.getStatus(), refundResult.getRefundId()); - - return response; - - } catch (PaymentException e) { - throw e; - } catch (Exception e) { - log.error("查询微信退款状态失败, 退款单号: {}, 租户ID: {}, 错误: {}", - refundNo, tenantId, e.getMessage(), e); - throw PaymentException.systemError("查询微信退款状态失败: " + e.getMessage(), e); - } - } - - @Override - public boolean closeOrder(String orderNo, Integer tenantId) throws PaymentException { - // TODO: 实现微信订单关闭逻辑 - throw PaymentException.unsupportedPayment("暂不支持微信订单关闭", PaymentType.WECHAT_NATIVE); - } - - @Override - public boolean supportRefund() { - return true; - } - - @Override - public boolean supportQuery() { - return true; - } - - @Override - public boolean supportClose() { - return true; - } - - @Override - public boolean needNotify() { - return true; - } - - /** - * 生成订单号(使用雪花算法保证全局唯一) - */ - private String generateOrderNo(PaymentRequest request) { - if (StringUtils.hasText(request.getOrderNo())) { - return request.getOrderNo(); - } - return Long.toString(IdUtil.getSnowflakeNextId()); - } - - - - /** - * 构建微信预支付请求 - */ - private PrepayRequest buildPrepayRequest(PaymentRequest request, String orderNo, Payment paymentConfig) { - PrepayRequest prepayRequest = new PrepayRequest(); - - // 设置应用ID和商户号(关键修复) - prepayRequest.setAppid(paymentConfig.getAppId()); - prepayRequest.setMchid(paymentConfig.getMchId()); - - // 设置金额 - Amount amount = new Amount(); - amount.setTotal(request.getAmountInCents()); - amount.setCurrency(PaymentConstants.Wechat.CURRENCY); - prepayRequest.setAmount(amount); - - // 设置基本信息 - prepayRequest.setOutTradeNo(orderNo); - prepayRequest.setDescription(request.getEffectiveDescription()); - - log.info("创建微信支付订单 - 订单号: {}, 商户号: {}, 金额: {}分", - orderNo, paymentConfig.getMchId(), request.getAmountInCents()); - - // 设置回调URL(必填字段) - String notifyUrl = null; - if (StringUtils.hasText(request.getNotifyUrl())) { - // 优先使用请求中的回调URL - notifyUrl = request.getNotifyUrl(); - } else if (StringUtils.hasText(paymentConfig.getNotifyUrl())) { - // 使用配置中的回调URL - notifyUrl = paymentConfig.getNotifyUrl(); - } else { - // 如果都没有,抛出异常 - throw new RuntimeException("回调通知地址不能为空,请在支付请求中设置notifyUrl或在支付配置中设置notifyUrl"); - } - prepayRequest.setNotifyUrl(notifyUrl); - - log.debug("构建微信预支付请求完成, 订单号: {}, 金额: {}分, AppID: {}, 商户号: {}, 回调URL: {}", - orderNo, request.getAmountInCents(), paymentConfig.getAppId(), paymentConfig.getMchId(), notifyUrl); - - return prepayRequest; - } - - /** - * 查询微信支付状态 - */ - private PaymentResponse queryWechatPaymentStatus(String orderNo, Integer tenantId, Payment paymentConfig, Config wxPayConfig) throws PaymentException { - try { - log.info("开始查询微信支付状态 - 订单号: {}, 商户号: {}, 租户ID: {}", - orderNo, paymentConfig.getMchId(), tenantId); - - // 构建查询请求 - QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest(); - queryRequest.setOutTradeNo(orderNo); - queryRequest.setMchid(paymentConfig.getMchId()); - - // 构建服务 - NativePayService service = new NativePayService.Builder().config(wxPayConfig).build(); - - // 调用查询接口 - Transaction transaction = service.queryOrderByOutTradeNo(queryRequest); - - if (transaction == null) { - throw PaymentException.systemError("微信支付查询返回空结果", null); - } - - // 转换支付状态 - PaymentStatus paymentStatus = convertWechatPaymentStatus(transaction.getTradeState()); - - // 构建响应 - PaymentResponse response = new PaymentResponse(); - response.setSuccess(true); - response.setOrderNo(orderNo); - response.setPaymentStatus(paymentStatus); - response.setTenantId(tenantId); - response.setPaymentType(PaymentType.WECHAT_NATIVE); - - if (transaction.getAmount() != null) { - // 微信返回的金额是分,需要转换为元 - BigDecimal amount = new BigDecimal(transaction.getAmount().getTotal()).divide(new BigDecimal("100")); - response.setAmount(amount); - } - - if (transaction.getTransactionId() != null) { - response.setTransactionId(transaction.getTransactionId()); - } - - log.info("微信Native支付状态查询成功, 订单号: {}, 状态: {}, 微信交易号: {}", - orderNo, paymentStatus, transaction.getTransactionId()); - - return response; - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - log.error("查询微信支付状态失败, 订单号: {}, 错误: {}", orderNo, e.getMessage(), e); - throw PaymentException.networkError("查询微信支付状态失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); - } - } - - /** - * 转换微信支付状态 - */ - private PaymentStatus convertWechatPaymentStatus(Transaction.TradeStateEnum tradeState) { - if (tradeState == null) { - return PaymentStatus.PENDING; - } - - switch (tradeState) { - case SUCCESS: - return PaymentStatus.SUCCESS; - case REFUND: - return PaymentStatus.REFUNDED; - case NOTPAY: - return PaymentStatus.PENDING; - case CLOSED: - return PaymentStatus.CANCELLED; - case REVOKED: - return PaymentStatus.CANCELLED; - case USERPAYING: - return PaymentStatus.PROCESSING; - case PAYERROR: - return PaymentStatus.FAILED; - default: - return PaymentStatus.PENDING; - } - } - - /** - * 调用微信支付API - */ - private PrepayResponse callWechatPayApi(PrepayRequest request, Config wxPayConfig) throws PaymentException { - try { - // 构建服务 - NativePayService service = new NativePayService.Builder().config(wxPayConfig).build(); - - // 调用预支付接口 - PrepayResponse response = service.prepay(request); - - if (response == null || !StringUtils.hasText(response.getCodeUrl())) { - throw PaymentException.networkError("微信支付API返回数据异常", PaymentType.WECHAT_NATIVE, null); - } - - log.debug("微信支付API调用成功, 订单号: {}", request.getOutTradeNo()); - return response; - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - throw PaymentException.networkError("调用微信支付API失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); - } - } - - /** - * 验证退款请求参数 - */ - private void validateRefundRequest(String orderNo, String refundNo, BigDecimal totalAmount, - BigDecimal refundAmount, Integer tenantId) throws PaymentException { - if (!StringUtils.hasText(orderNo)) { - throw PaymentException.paramError("订单号不能为空"); - } - if (!StringUtils.hasText(refundNo)) { - throw PaymentException.paramError("退款单号不能为空"); - } - if (tenantId == null) { - throw PaymentException.paramError("租户ID不能为空"); - } - if (totalAmount == null || totalAmount.compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("订单总金额必须大于0"); - } - if (refundAmount == null || refundAmount.compareTo(BigDecimal.ZERO) <= 0) { - throw PaymentException.amountError("退款金额必须大于0"); - } - if (refundAmount.compareTo(totalAmount) > 0) { - throw PaymentException.amountError("退款金额不能大于订单总金额"); - } - - log.debug("退款请求参数验证通过, 订单号: {}, 退款单号: {}, 订单总额: {}, 退款金额: {}", - orderNo, refundNo, totalAmount, refundAmount); - } - - /** - * 构建微信退款请求 - */ - private CreateRequest buildRefundRequest(String orderNo, String refundNo, BigDecimal totalAmount, - BigDecimal refundAmount, String reason, Payment paymentConfig) { - CreateRequest refundRequest = new CreateRequest(); - - // 设置订单号和退款单号 - refundRequest.setOutTradeNo(orderNo); - refundRequest.setOutRefundNo(refundNo); - - // 设置金额信息(微信支付金额单位为分) - AmountReq amountReq = new AmountReq(); - amountReq.setTotal(totalAmount.multiply(new BigDecimal("100")).longValue()); - amountReq.setRefund(refundAmount.multiply(new BigDecimal("100")).longValue()); - amountReq.setCurrency(PaymentConstants.Wechat.CURRENCY); - refundRequest.setAmount(amountReq); - - // 设置退款原因(可选,但建议填写) - if (StringUtils.hasText(reason)) { - // 退款原因最多80个字符 - String effectiveReason = reason.length() > 80 ? reason.substring(0, 80) : reason; - refundRequest.setReason(effectiveReason); - } else { - refundRequest.setReason("用户申请退款"); - } - - log.info("构建微信退款请求完成 - 订单号: {}, 退款单号: {}, 订单总额: {}分, 退款金额: {}分", - orderNo, refundNo, amountReq.getTotal(), amountReq.getRefund()); - - return refundRequest; - } - - /** - * 调用微信退款API - */ - private Refund callWechatRefundApi(CreateRequest refundRequest, Config wxPayConfig) throws PaymentException { - try { - // 构建退款服务 - RefundService refundService = new RefundService.Builder().config(wxPayConfig).build(); - - // 调用退款接口 - Refund refund = refundService.create(refundRequest); - - if (refund == null) { - throw PaymentException.networkError("微信退款API返回数据异常", PaymentType.WECHAT_NATIVE, null); - } - - log.debug("微信退款API调用成功, 退款单号: {}, 微信退款单号: {}, 状态: {}", - refundRequest.getOutRefundNo(), refund.getRefundId(), refund.getStatus()); - - return refund; - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - log.error("调用微信退款API失败: {}", e.getMessage(), e); - throw PaymentException.networkError("调用微信退款API失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); - } - } - - /** - * 构建退款响应 - */ - private PaymentResponse buildRefundResponse(Refund refund, String orderNo, String refundNo, Integer tenantId) { - PaymentResponse response = new PaymentResponse(); - response.setSuccess(true); - response.setOrderNo(orderNo); - response.setTransactionId(refund.getRefundId()); // 使用微信退款单号 - response.setPaymentType(PaymentType.WECHAT_NATIVE); - response.setTenantId(tenantId); - - // 转换退款状态 - String statusStr = refund.getStatus() != null ? refund.getStatus().name() : null; - PaymentStatus paymentStatus = convertWechatRefundStatus(statusStr); - response.setPaymentStatus(paymentStatus); - - // 设置退款金额(微信返回的金额是分,需要转换为元) - if (refund.getAmount() != null && refund.getAmount().getRefund() != null) { - BigDecimal refundAmount = new BigDecimal(refund.getAmount().getRefund()).divide(new BigDecimal("100")); - response.setAmount(refundAmount); - } - - log.debug("构建退款响应完成 - 订单号: {}, 退款单号: {}, 微信退款单号: {}, 状态: {}", - orderNo, refundNo, refund.getRefundId(), paymentStatus); - - return response; - } - - /** - * 查询微信退款状态 - */ - private Refund queryWechatRefundStatus(String refundNo, Config wxPayConfig) throws PaymentException { - try { - // 构建退款服务 - RefundService refundService = new RefundService.Builder().config(wxPayConfig).build(); - - // 构建查询请求 - QueryByOutRefundNoRequest queryRequest = new QueryByOutRefundNoRequest(); - queryRequest.setOutRefundNo(refundNo); - - // 调用查询接口 - Refund refund = refundService.queryByOutRefundNo(queryRequest); - - if (refund == null) { - throw PaymentException.systemError("微信退款查询返回空结果", null); - } - - log.debug("微信退款查询成功, 退款单号: {}, 微信退款单号: {}, 状态: {}", - refundNo, refund.getRefundId(), refund.getStatus()); - - return refund; - - } catch (Exception e) { - if (e instanceof PaymentException) { - throw e; - } - log.error("查询微信退款状态失败, 退款单号: {}, 错误: {}", refundNo, e.getMessage(), e); - throw PaymentException.networkError("查询微信退款状态失败: " + e.getMessage(), PaymentType.WECHAT_NATIVE, e); - } - } - - /** - * 构建退款查询响应 - */ - private PaymentResponse buildRefundQueryResponse(Refund refund, Integer tenantId) { - PaymentResponse response = new PaymentResponse(); - response.setSuccess(true); - response.setOrderNo(refund.getOutTradeNo()); - response.setTransactionId(refund.getRefundId()); - response.setPaymentType(PaymentType.WECHAT_NATIVE); - response.setTenantId(tenantId); - - // 转换退款状态 - String statusStr = refund.getStatus() != null ? refund.getStatus().name() : null; - PaymentStatus paymentStatus = convertWechatRefundStatus(statusStr); - response.setPaymentStatus(paymentStatus); - - // 设置退款金额 - if (refund.getAmount() != null && refund.getAmount().getRefund() != null) { - BigDecimal refundAmount = new BigDecimal(refund.getAmount().getRefund()).divide(new BigDecimal("100")); - response.setAmount(refundAmount); - } - - return response; - } - - /** - * 转换微信退款状态 - */ - private PaymentStatus convertWechatRefundStatus(String refundStatus) { - if (refundStatus == null) { - return PaymentStatus.REFUNDING; - } - - switch (refundStatus) { - case "SUCCESS": - return PaymentStatus.REFUNDED; - case "CLOSED": - return PaymentStatus.REFUND_FAILED; - case "PROCESSING": - return PaymentStatus.REFUNDING; - case "ABNORMAL": - return PaymentStatus.REFUND_FAILED; - default: - return PaymentStatus.REFUNDING; - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/payment/utils/PaymentTypeCompatibilityUtil.java b/jczxw-java/src/main/java/com/gxwebsoft/payment/utils/PaymentTypeCompatibilityUtil.java deleted file mode 100644 index 682bfef..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/payment/utils/PaymentTypeCompatibilityUtil.java +++ /dev/null @@ -1,165 +0,0 @@ -package com.gxwebsoft.payment.utils; - -import com.gxwebsoft.payment.enums.PaymentType; -import lombok.extern.slf4j.Slf4j; - -import java.util.HashMap; -import java.util.Map; - -/** - * 支付方式兼容性处理工具类 - * 处理废弃支付方式到核心支付方式的映射转换 - * - * @author 科技小王子 - * @since 2025-08-30 - */ -@Slf4j -public class PaymentTypeCompatibilityUtil { - - /** - * 废弃支付方式到核心支付方式的映射表 - */ - private static final Map DEPRECATED_TO_CORE_MAPPING = new HashMap<>(); - - static { - // 旧编号到新编号的映射 - DEPRECATED_TO_CORE_MAPPING.put(3, 2); // 支付宝(旧3) -> 支付宝(新2) - DEPRECATED_TO_CORE_MAPPING.put(12, 6); // 免费(旧12) -> 免费(新6) - DEPRECATED_TO_CORE_MAPPING.put(15, 7); // 积分支付(旧15) -> 积分支付(新7) - DEPRECATED_TO_CORE_MAPPING.put(19, 3); // 银联支付(旧19) -> 银联支付(新3) - - // 会员卡类支付 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(2, 0); // 会员卡支付 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(6, 0); // VIP月卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(7, 0); // VIP年卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(8, 0); // VIP次卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(9, 0); // IC月卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(10, 0); // IC年卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(11, 0); // IC次卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(13, 0); // VIP充值卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(14, 0); // IC充值卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(16, 0); // VIP季卡 -> 余额支付 - DEPRECATED_TO_CORE_MAPPING.put(17, 0); // IC季卡 -> 余额支付 - - // 微信Native -> 微信支付 - DEPRECATED_TO_CORE_MAPPING.put(102, 1); // 微信Native -> 微信支付 - - // 代付 -> 微信支付(默认) - DEPRECATED_TO_CORE_MAPPING.put(18, 1); // 代付 -> 微信支付 - } - - /** - * 将废弃的支付方式转换为核心支付方式 - * - * @param originalPayType 原始支付方式代码 - * @return 转换后的核心支付方式代码 - */ - public static Integer convertToCore(Integer originalPayType) { - if (originalPayType == null) { - return null; - } - - // 检查是否为废弃的支付方式 - if (DEPRECATED_TO_CORE_MAPPING.containsKey(originalPayType)) { - Integer corePayType = DEPRECATED_TO_CORE_MAPPING.get(originalPayType); - log.warn("检测到废弃的支付方式: {} -> {},建议升级到核心支付方式", - originalPayType, corePayType); - return corePayType; - } - - // 如果是核心支付方式,直接返回 - return originalPayType; - } - - /** - * 检查支付方式是否已废弃 - * - * @param payType 支付方式代码 - * @return true表示已废弃 - */ - public static boolean isDeprecated(Integer payType) { - return payType != null && DEPRECATED_TO_CORE_MAPPING.containsKey(payType); - } - - /** - * 获取支付方式的迁移说明 - * - * @param payType 支付方式代码 - * @return 迁移说明文本 - */ - public static String getMigrationMessage(Integer payType) { - if (payType == null || !isDeprecated(payType)) { - return null; - } - - PaymentType originalType = PaymentType.getByCode(payType); - PaymentType coreType = PaymentType.getByCode(convertToCore(payType)); - - if (originalType != null && coreType != null) { - return String.format("支付方式 %s(%d) 已废弃,建议使用 %s(%d)", - originalType.getName(), payType, - coreType.getName(), coreType.getCode()); - } - - return "该支付方式已废弃,请使用核心支付方式"; - } - - /** - * 获取所有核心支付方式代码 - * - * @return 核心支付方式代码数组 - */ - public static Integer[] getCorePaymentTypeCodes() { - return new Integer[]{0, 1, 2, 3, 4, 5, 6, 7}; - } - - /** - * 检查是否为核心支付方式 - * - * @param payType 支付方式代码 - * @return true表示是核心支付方式 - */ - public static boolean isCorePaymentType(Integer payType) { - if (payType == null) { - return false; - } - - for (Integer coreType : getCorePaymentTypeCodes()) { - if (coreType.equals(payType)) { - return true; - } - } - return false; - } - - /** - * 生成支付方式迁移报告 - * - * @return 迁移报告文本 - */ - public static String generateMigrationReport() { - StringBuilder report = new StringBuilder(); - report.append("=== 支付方式迁移报告 ===\n"); - report.append("核心支付方式(8种):\n"); - - for (Integer coreType : getCorePaymentTypeCodes()) { - PaymentType type = PaymentType.getByCode(coreType); - if (type != null) { - report.append(String.format(" %d - %s\n", coreType, type.getName())); - } - } - - report.append("\n废弃支付方式映射:\n"); - for (Map.Entry entry : DEPRECATED_TO_CORE_MAPPING.entrySet()) { - PaymentType originalType = PaymentType.getByCode(entry.getKey()); - PaymentType coreType = PaymentType.getByCode(entry.getValue()); - if (originalType != null && coreType != null) { - report.append(String.format(" %d(%s) -> %d(%s)\n", - entry.getKey(), originalType.getName(), - entry.getValue(), coreType.getName())); - } - } - - return report.toString(); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/config/OrderConfigProperties.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/config/OrderConfigProperties.java deleted file mode 100644 index 887db88..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/config/OrderConfigProperties.java +++ /dev/null @@ -1,235 +0,0 @@ -package com.gxwebsoft.shop.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 订单相关配置属性 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Data -@Component -@ConfigurationProperties(prefix = "shop.order") -public class OrderConfigProperties { - - /** - * 测试账号配置 - */ - private TestAccount testAccount = new TestAccount(); - - /** - * 租户特殊规则配置 - */ - private List tenantRules; - - /** - * 默认订单配置 - */ - private DefaultConfig defaultConfig = new DefaultConfig(); - - /** - * 订单自动取消配置 - */ - private AutoCancel autoCancel = new AutoCancel(); - - /** - * 错误信息配置 - */ - private ErrorMessages errorMessages = new ErrorMessages(); - - @Data - public static class TestAccount { - /** - * 测试手机号列表 - */ - private List phoneNumbers; - - /** - * 测试支付金额 - */ - private BigDecimal testPayAmount = new BigDecimal("0.01"); - - /** - * 是否启用测试模式 - */ - private boolean enabled = false; - } - - @Data - public static class TenantRule { - /** - * 租户ID - */ - private Integer tenantId; - - /** - * 租户名称 - */ - private String tenantName; - - /** - * 最小金额限制 - */ - private BigDecimal minAmount; - - /** - * 金额限制提示信息 - */ - private String minAmountMessage; - - /** - * 是否启用 - */ - private boolean enabled = true; - } - - @Data - public static class DefaultConfig { - - /** - * 默认标题 - */ - private String defaultTitle = "订单标题"; - - /** - * 默认备注 - */ - private String defaultComments = "暂无"; - - /** - * 最小订单金额 - */ - private BigDecimal minOrderAmount = BigDecimal.ZERO; - - /** - * 订单超时时间(分钟) - */ - private Integer orderTimeoutMinutes = 30; - } - - /** - * 检查是否为测试账号 - */ - public boolean isTestAccount(String phone) { - return testAccount.isEnabled() && - testAccount.getPhoneNumbers() != null && - testAccount.getPhoneNumbers().contains(phone); - } - - @Data - public static class AutoCancel { - /** - * 是否启用自动取消功能 - */ - private boolean enabled = true; - - /** - * 默认超时时间(分钟) - */ - private Integer defaultTimeoutMinutes = 30; - - /** - * 定时任务检查间隔(分钟) - */ - private Integer checkIntervalMinutes = 5; - - /** - * 批量处理大小 - */ - private Integer batchSize = 100; - - /** - * 租户特殊配置 - */ - private List tenantConfigs; - } - - @Data - public static class TenantCancelConfig { - /** - * 租户ID - */ - private Integer tenantId; - - /** - * 租户名称 - */ - private String tenantName; - - /** - * 超时时间(分钟) - */ - private Integer timeoutMinutes; - - /** - * 是否启用 - */ - private boolean enabled = true; - } - - /** - * 获取指定租户的超时时间 - */ - public Integer getTimeoutMinutes(Integer tenantId) { - if (autoCancel.getTenantConfigs() != null) { - for (TenantCancelConfig config : autoCancel.getTenantConfigs()) { - if (config.isEnabled() && config.getTenantId().equals(tenantId)) { - return config.getTimeoutMinutes(); - } - } - } - return autoCancel.getDefaultTimeoutMinutes(); - } - - /** - * 获取租户规则 - */ - public TenantRule getTenantRule(Integer tenantId) { - if (tenantRules == null) { - return null; - } - return tenantRules.stream() - .filter(rule -> rule.isEnabled() && rule.getTenantId().equals(tenantId)) - .findFirst() - .orElse(null); - } - - @Data - public static class ErrorMessages { - /** - * 订单金额计算错误信息 - */ - private String amountCalculationError = "订单金额计算错误,请刷新重试"; - - /** - * 商品不存在错误信息 - */ - private String goodsNotFound = "商品不存在"; - - /** - * 商品已下架错误信息 - */ - private String goodsOffline = "商品已下架"; - - /** - * 库存不足错误信息 - */ - private String stockInsufficient = "商品库存不足"; - - /** - * 购买数量超限错误信息 - */ - private String quantityExceeded = "商品购买数量超过限制"; - - /** - * 商品价格异常错误信息 - */ - private String priceAbnormal = "商品价格异常"; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/constants/WxPayConstants.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/constants/WxPayConstants.java deleted file mode 100644 index 1618dd8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/constants/WxPayConstants.java +++ /dev/null @@ -1,200 +0,0 @@ -package com.gxwebsoft.shop.constants; - -/** - * 微信支付常量类 - * 管理微信支付相关的常量配置 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -public class WxPayConstants { - - /** - * 微信支付类型 - */ - public static class PayType { - /** Native支付 */ - public static final String NATIVE = "NATIVE"; - /** JSAPI支付 */ - public static final String JSAPI = "JSAPI"; - /** H5支付 */ - public static final String MWEB = "MWEB"; - /** APP支付 */ - public static final String APP = "APP"; - } - - /** - * 支付状态 - */ - public static class PayStatus { - /** 支付成功 */ - public static final String SUCCESS = "SUCCESS"; - /** 转入退款 */ - public static final String REFUND = "REFUND"; - /** 未支付 */ - public static final String NOTPAY = "NOTPAY"; - /** 已关闭 */ - public static final String CLOSED = "CLOSED"; - /** 已撤销(付款码支付) */ - public static final String REVOKED = "REVOKED"; - /** 用户支付中(付款码支付) */ - public static final String USERPAYING = "USERPAYING"; - /** 支付失败(其他原因,如银行返回失败) */ - public static final String PAYERROR = "PAYERROR"; - } - - /** - * 回调通知相关 - */ - public static class Notify { - /** 成功响应 */ - public static final String SUCCESS_RESPONSE = "SUCCESS"; - /** 失败响应 */ - public static final String FAIL_RESPONSE = "FAIL"; - - /** 通知类型 - 支付成功 */ - public static final String EVENT_TYPE_PAYMENT = "TRANSACTION.SUCCESS"; - /** 通知类型 - 退款成功 */ - public static final String EVENT_TYPE_REFUND = "REFUND.SUCCESS"; - } - - /** - * 缓存键前缀 - */ - public static class CacheKey { - /** 支付配置缓存键前缀 */ - public static final String PAYMENT_CONFIG_PREFIX = "Payment:wxPay:"; - /** 微信小程序配置缓存键 */ - public static final String MP_WEIXIN_CONFIG = "mp-weixin"; - } - - /** - * 配置相关 - */ - public static class Config { - /** 货币类型 - 人民币 */ - public static final String CURRENCY_CNY = "CNY"; - /** 金额转换倍数(元转分) */ - public static final int AMOUNT_MULTIPLIER = 100; - - /** 开发环境标识 */ - public static final String PROFILE_DEV = "dev"; - /** 生产环境标识 */ - public static final String PROFILE_PROD = "prod"; - } - - /** - * 订单相关 - */ - public static class Order { - /** 订单超时时间(分钟) */ - public static final int TIMEOUT_MINUTES = 30; - /** 订单描述最大长度 */ - public static final int DESCRIPTION_MAX_LENGTH = 127; - } - - /** - * HTTP头部相关 - */ - public static class Header { - /** 微信支付签名 */ - public static final String WECHATPAY_SIGNATURE = "Wechatpay-Signature"; - /** 微信支付时间戳 */ - public static final String WECHATPAY_TIMESTAMP = "Wechatpay-Timestamp"; - /** 微信支付随机数 */ - public static final String WECHATPAY_NONCE = "Wechatpay-Nonce"; - /** 微信支付序列号 */ - public static final String WECHATPAY_SERIAL = "Wechatpay-Serial"; - /** 请求ID */ - public static final String REQUEST_ID = "Request-ID"; - } - - /** - * 错误信息 - */ - public static class ErrorMessage { - /** 配置未找到 */ - public static final String CONFIG_NOT_FOUND = "微信支付配置未找到"; - /** 证书文件不存在 */ - public static final String CERTIFICATE_NOT_FOUND = "微信支付证书文件不存在"; - /** 参数验证失败 */ - public static final String PARAM_VALIDATION_FAILED = "参数验证失败"; - /** 签名验证失败 */ - public static final String SIGNATURE_VERIFICATION_FAILED = "签名验证失败"; - /** 订单不存在 */ - public static final String ORDER_NOT_FOUND = "订单不存在"; - /** 订单状态异常 */ - public static final String ORDER_STATUS_INVALID = "订单状态异常"; - /** 金额不匹配 */ - public static final String AMOUNT_MISMATCH = "订单金额不匹配"; - /** 网络请求失败 */ - public static final String NETWORK_REQUEST_FAILED = "网络请求失败"; - /** 系统内部错误 */ - public static final String SYSTEM_INTERNAL_ERROR = "系统内部错误"; - } - - /** - * 日志相关 - */ - public static class LogMessage { - /** 支付请求开始 */ - public static final String PAY_REQUEST_START = "开始处理微信支付请求"; - /** 支付请求成功 */ - public static final String PAY_REQUEST_SUCCESS = "微信支付请求处理成功"; - /** 支付请求失败 */ - public static final String PAY_REQUEST_FAILED = "微信支付请求处理失败"; - - /** 回调处理开始 */ - public static final String CALLBACK_START = "开始处理微信支付回调"; - /** 回调处理成功 */ - public static final String CALLBACK_SUCCESS = "微信支付回调处理成功"; - /** 回调处理失败 */ - public static final String CALLBACK_FAILED = "微信支付回调处理失败"; - - /** 配置加载成功 */ - public static final String CONFIG_LOADED = "微信支付配置加载成功"; - /** 配置加载失败 */ - public static final String CONFIG_LOAD_FAILED = "微信支付配置加载失败"; - } - - /** - * 正则表达式 - */ - public static class Regex { - /** 商户号格式 */ - public static final String MERCHANT_ID = "^\\d{10}$"; - /** 订单号格式 */ - public static final String ORDER_NO = "^[a-zA-Z0-9_-]{1,32}$"; - /** 金额格式(分) */ - public static final String AMOUNT = "^[1-9]\\d*$"; - } - - /** - * 时间相关 - */ - public static class Time { - /** 签名有效期(秒) */ - public static final long SIGNATURE_VALID_SECONDS = 300; - /** 配置缓存有效期(秒) */ - public static final long CONFIG_CACHE_SECONDS = 3600; - } - - /** - * 文件相关 - */ - public static class File { - /** 证书文件扩展名 */ - public static final String CERT_EXTENSION = ".pem"; - /** 私钥文件名 */ - public static final String PRIVATE_KEY_FILE = "apiclient_key.pem"; - /** 商户证书文件名 */ - public static final String MERCHANT_CERT_FILE = "apiclient_cert.pem"; - /** 平台证书文件名 */ - public static final String PLATFORM_CERT_FILE = "wechatpay_cert.pem"; - } - - // 私有构造函数,防止实例化 - private WxPayConstants() { - throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/CouponStatusController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/CouponStatusController.java deleted file mode 100644 index ded942f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/CouponStatusController.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.service.CouponStatusService; -import com.gxwebsoft.shop.service.CouponStatusService.CouponStatusResult; -import com.gxwebsoft.shop.service.CouponStatusService.CouponValidationResult; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 优惠券状态管理控制器 - * - * @author WebSoft - * @since 2025-01-15 - */ -@Slf4j -@Tag(name = "优惠券状态管理") -@RestController -@RequestMapping("/api/shop/coupon-status") -public class CouponStatusController extends BaseController { - - @Autowired - private CouponStatusService couponStatusService; - - @Operation(summary = "获取当前用户可用优惠券") - @GetMapping("/available") - public ApiResult> getAvailableCoupons() { - try { - List coupons = couponStatusService.getAvailableCoupons(getLoginUserId()); - return success("获取成功", coupons); - } catch (Exception e) { - log.error("获取可用优惠券失败", e); - return fail("获取失败",null); - } - } - - @Operation(summary = "获取当前用户已使用优惠券") - @GetMapping("/used") - public ApiResult> getUsedCoupons() { - try { - List coupons = couponStatusService.getUsedCoupons(getLoginUserId()); - return success("获取成功", coupons); - } catch (Exception e) { - log.error("获取已使用优惠券失败", e); - return fail("获取失败",null); - } - } - - @Operation(summary = "获取当前用户已过期优惠券") - @GetMapping("/expired") - public ApiResult> getExpiredCoupons() { - try { - List coupons = couponStatusService.getExpiredCoupons(getLoginUserId()); - return success("获取成功", coupons); - } catch (Exception e) { - log.error("获取已过期优惠券失败", e); - return fail("获取失败",null); - } - } - - @Operation(summary = "获取当前用户所有优惠券(按状态分类)") - @GetMapping("/all-grouped") - public ApiResult getAllCouponsGrouped() { - try { - CouponStatusResult result = couponStatusService.getUserCouponsGroupByStatus(getLoginUserId()); - return success("获取成功", result); - } catch (Exception e) { - log.error("获取优惠券分类失败", e); - return fail("获取失败",null); - } - } - - @Operation(summary = "验证优惠券是否可用于订单") - @PostMapping("/validate") - public ApiResult validateCouponForOrder( - @Parameter(description = "用户优惠券ID") @RequestParam Long userCouponId, - @Parameter(description = "订单总金额") @RequestParam BigDecimal totalAmount, - @Parameter(description = "商品ID列表") @RequestBody List goodsIds) { - try { - CouponValidationResult result = couponStatusService.validateCouponForOrder( - userCouponId, totalAmount, goodsIds); - return success(result.getMessage(), result); - } catch (Exception e) { - log.error("验证优惠券失败", e); - return fail("验证失败",null); - } - } - - @Operation(summary = "使用优惠券") - @PostMapping("/use") - public ApiResult useCoupon( - @Parameter(description = "用户优惠券ID") @RequestParam Long userCouponId, - @Parameter(description = "订单ID") @RequestParam Integer orderId, - @Parameter(description = "订单号") @RequestParam String orderNo) { - try { - boolean success = couponStatusService.useCoupon(userCouponId, orderId, orderNo); - if (success) { - return success("使用成功"); - } else { - return fail("使用失败"); - } - } catch (Exception e) { - log.error("使用优惠券失败", e); - return fail("使用失败"); - } - } - - @Operation(summary = "退还优惠券(订单取消时)") - @PostMapping("/return/{orderId}") - public ApiResult returnCoupon( - @Parameter(description = "订单ID") @PathVariable Integer orderId) { - try { - boolean success = couponStatusService.returnCoupon(orderId); - if (success) { - return success("退还成功"); - } else { - return fail("退还失败"); - } - } catch (Exception e) { - log.error("退还优惠券失败", e); - return fail("退还失败"); - } - } - - @PreAuthorize("hasAuthority('shop:coupon:manage')") - @Operation(summary = "批量更新过期优惠券状态(管理员)") - @PostMapping("/update-expired") - public ApiResult updateExpiredCoupons() { - try { - int updatedCount = couponStatusService.updateExpiredCoupons(); - return success("更新完成,共更新 " + updatedCount + " 张优惠券"); - } catch (Exception e) { - log.error("批量更新过期优惠券失败", e); - return fail("更新失败"); - } - } - - @Operation(summary = "获取优惠券状态统计") - @GetMapping("/statistics") - public ApiResult getCouponStatistics() { - try { - CouponStatusResult result = couponStatusService.getUserCouponsGroupByStatus(getLoginUserId()); - - CouponStatistics statistics = new CouponStatistics(); - statistics.setAvailableCount(result.getAvailableCoupons().size()); - statistics.setUsedCount(result.getUsedCoupons().size()); - statistics.setExpiredCount(result.getExpiredCoupons().size()); - statistics.setTotalCount(result.getTotalCount()); - - return success("获取成功", statistics); - } catch (Exception e) { - log.error("获取优惠券统计失败", e); - return fail("获取失败",null); - } - } - - /** - * 优惠券统计信息 - */ - public static class CouponStatistics { - private int availableCount; // 可用数量 - private int usedCount; // 已使用数量 - private int expiredCount; // 已过期数量 - private int totalCount; // 总数量 - - // Getters and Setters - public int getAvailableCount() { return availableCount; } - public void setAvailableCount(int availableCount) { this.availableCount = availableCount; } - - public int getUsedCount() { return usedCount; } - public void setUsedCount(int usedCount) { this.usedCount = usedCount; } - - public int getExpiredCount() { return expiredCount; } - public void setExpiredCount(int expiredCount) { this.expiredCount = expiredCount; } - - public int getTotalCount() { return totalCount; } - public void setTotalCount(int totalCount) { this.totalCount = totalCount; } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopArticleController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopArticleController.java deleted file mode 100644 index d882ba2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopArticleController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopArticleService; -import com.gxwebsoft.shop.entity.ShopArticle; -import com.gxwebsoft.shop.param.ShopArticleParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品文章控制器 - * - * @author 科技小王子 - * @since 2025-08-13 05:14:53 - */ -@Tag(name = "商品文章管理") -@RestController -@RequestMapping("/api/shop/shop-article") -public class ShopArticleController extends BaseController { - @Resource - private ShopArticleService shopArticleService; - - @PreAuthorize("hasAuthority('shop:shopArticle:list')") - @Operation(summary = "分页查询商品文章") - @GetMapping("/page") - public ApiResult> page(ShopArticleParam param) { - // 使用关联查询 - return success(shopArticleService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:list')") - @Operation(summary = "查询全部商品文章") - @GetMapping() - public ApiResult> list(ShopArticleParam param) { - // 使用关联查询 - return success(shopArticleService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:list')") - @Operation(summary = "根据id查询商品文章") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopArticleService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:save')") - @OperationLog - @Operation(summary = "添加商品文章") - @PostMapping() - public ApiResult save(@RequestBody ShopArticle shopArticle) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopArticle.setUserId(loginUser.getUserId()); - } - if (shopArticleService.save(shopArticle)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:update')") - @OperationLog - @Operation(summary = "修改商品文章") - @PutMapping() - public ApiResult update(@RequestBody ShopArticle shopArticle) { - if (shopArticleService.updateById(shopArticle)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:remove')") - @OperationLog - @Operation(summary = "删除商品文章") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopArticleService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:save')") - @OperationLog - @Operation(summary = "批量添加商品文章") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopArticleService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:update')") - @OperationLog - @Operation(summary = "批量修改商品文章") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopArticleService, "article_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopArticle:remove')") - @OperationLog - @Operation(summary = "批量删除商品文章") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopArticleService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopBrandController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopBrandController.java deleted file mode 100644 index ec2c25c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopBrandController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopBrandService; -import com.gxwebsoft.shop.entity.ShopBrand; -import com.gxwebsoft.shop.param.ShopBrandParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 品牌控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "品牌管理") -@RestController -@RequestMapping("/api/shop/shop-brand") -public class ShopBrandController extends BaseController { - @Resource - private ShopBrandService shopBrandService; - - @Operation(summary = "分页查询品牌") - @GetMapping("/page") - public ApiResult> page(ShopBrandParam param) { - // 使用关联查询 - return success(shopBrandService.pageRel(param)); - } - - @Operation(summary = "查询全部品牌") - @GetMapping() - public ApiResult> list(ShopBrandParam param) { - // 使用关联查询 - return success(shopBrandService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopBrand:list')") - @Operation(summary = "根据id查询品牌") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopBrandService.getByIdRel(id)); - } - - @Operation(summary = "添加品牌") - @PostMapping() - public ApiResult save(@RequestBody ShopBrand shopBrand) { - if (shopBrandService.save(shopBrand)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改品牌") - @PutMapping() - public ApiResult update(@RequestBody ShopBrand shopBrand) { - if (shopBrandService.updateById(shopBrand)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除品牌") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopBrandService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加品牌") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopBrandService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改品牌") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopBrandService, "brand_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除品牌") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopBrandService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCartController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCartController.java deleted file mode 100644 index 22ada86..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCartController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopCartService; -import com.gxwebsoft.shop.entity.ShopCart; -import com.gxwebsoft.shop.param.ShopCartParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 购物车控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "购物车管理") -@RestController -@RequestMapping("/api/shop/shop-cart") -public class ShopCartController extends BaseController { - @Resource - private ShopCartService shopCartService; - - @Operation(summary = "分页查询购物车") - @GetMapping("/page") - public ApiResult> page(ShopCartParam param) { - // 使用关联查询 - return success(shopCartService.pageRel(param)); - } - - @Operation(summary = "查询全部购物车") - @GetMapping() - public ApiResult> list(ShopCartParam param) { - // 使用关联查询 - return success(shopCartService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopCart:list')") - @Operation(summary = "根据id查询购物车") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Long id) { - // 使用关联查询 - return success(shopCartService.getByIdRel(id)); - } - - @Operation(summary = "添加购物车") - @PostMapping() - public ApiResult save(@RequestBody ShopCart shopCart) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopCart.setUserId(loginUser.getUserId()); - } - if (shopCartService.save(shopCart)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改购物车") - @PutMapping() - public ApiResult update(@RequestBody ShopCart shopCart) { - if (shopCartService.updateById(shopCart)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除购物车") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCartService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加购物车") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCartService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改购物车") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCartService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除购物车") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCartService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCategoryController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCategoryController.java deleted file mode 100644 index bcffdea..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCategoryController.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopCategoryService; -import com.gxwebsoft.shop.entity.ShopCategory; -import com.gxwebsoft.shop.param.ShopCategoryParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品分类控制器 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Tag(name = "商品分类管理") -@RestController -@RequestMapping("/api/shop/shop-category") -public class ShopCategoryController extends BaseController { - @Resource - private ShopCategoryService shopCategoryService; - - @Operation(summary = "分页查询商品分类") - @GetMapping("/page") - public ApiResult> page(ShopCategoryParam param) { - // 使用关联查询 - return success(shopCategoryService.pageRel(param)); - } - - @Operation(summary = "查询全部商品分类") - @GetMapping() - public ApiResult> list(ShopCategoryParam param) { - // 使用关联查询 - return success(shopCategoryService.listRel(param)); - } - - @Operation(summary = "根据id查询商品分类") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopCategoryService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopCategory:save')") - @OperationLog - @Operation(summary = "添加商品分类") - @PostMapping() - public ApiResult save(@RequestBody ShopCategory shopCategory) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopCategory.setUserId(loginUser.getUserId()); - } - if (shopCategoryService.save(shopCategory)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCategory:update')") - @OperationLog - @Operation(summary = "修改商品分类") - @PutMapping() - public ApiResult update(@RequestBody ShopCategory shopCategory) { - if (shopCategoryService.updateById(shopCategory)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCategory:remove')") - @OperationLog - @Operation(summary = "删除商品分类") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCategoryService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCategory:save')") - @OperationLog - @Operation(summary = "批量添加商品分类") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCategoryService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCategory:update')") - @OperationLog - @Operation(summary = "批量修改商品分类") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCategoryService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCategory:remove')") - @OperationLog - @Operation(summary = "批量删除商品分类") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCategoryService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopChatConversationController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopChatConversationController.java deleted file mode 100644 index 7e84a9d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopChatConversationController.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopChatConversationService; -import com.gxwebsoft.shop.entity.ShopChatConversation; -import com.gxwebsoft.shop.param.ShopChatConversationParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 聊天会话表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "聊天会话表管理") -@RestController -@RequestMapping("/api/shop/shop-chat-conversation") -public class ShopChatConversationController extends BaseController { - @Resource - private ShopChatConversationService shopChatConversationService; - - @Operation(summary = "分页查询聊天会话表") - @GetMapping("/page") - public ApiResult> page(ShopChatConversationParam param) { - // 使用关联查询 - return success(shopChatConversationService.pageRel(param)); - } - - @Operation(summary = "查询全部聊天会话表") - @GetMapping() - public ApiResult> list(ShopChatConversationParam param) { - // 使用关联查询 - return success(shopChatConversationService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopChatConversation:list')") - @Operation(summary = "根据id查询聊天会话表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopChatConversationService.getByIdRel(id)); - } - - @Operation(summary = "添加聊天会话表") - @PostMapping() - public ApiResult save(@RequestBody ShopChatConversation shopChatConversation) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopChatConversation.setUserId(loginUser.getUserId()); - } - if (shopChatConversationService.save(shopChatConversation)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改聊天会话表") - @PutMapping() - public ApiResult update(@RequestBody ShopChatConversation shopChatConversation) { - if (shopChatConversationService.updateById(shopChatConversation)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除聊天会话表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopChatConversationService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加聊天会话表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopChatConversationService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改聊天会话表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopChatConversationService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除聊天会话表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopChatConversationService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopChatMessageController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopChatMessageController.java deleted file mode 100644 index 5e7109f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopChatMessageController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopChatMessageService; -import com.gxwebsoft.shop.entity.ShopChatMessage; -import com.gxwebsoft.shop.param.ShopChatMessageParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 聊天消息表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "聊天消息表管理") -@RestController -@RequestMapping("/api/shop/shop-chat-message") -public class ShopChatMessageController extends BaseController { - @Resource - private ShopChatMessageService shopChatMessageService; - - @PreAuthorize("hasAuthority('shop:shopChatMessage:list')") - @Operation(summary = "分页查询聊天消息表") - @GetMapping("/page") - public ApiResult> page(ShopChatMessageParam param) { - // 使用关联查询 - return success(shopChatMessageService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:list')") - @Operation(summary = "查询全部聊天消息表") - @GetMapping() - public ApiResult> list(ShopChatMessageParam param) { - // 使用关联查询 - return success(shopChatMessageService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:list')") - @Operation(summary = "根据id查询聊天消息表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopChatMessageService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:save')") - @Operation(summary = "添加聊天消息表") - @PostMapping() - public ApiResult save(@RequestBody ShopChatMessage shopChatMessage) { - // 获取当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopChatMessage.setFormUserId(loginUser.getUserId()); - } - if (shopChatMessageService.save(shopChatMessage)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:update')") - @Operation(summary = "修改聊天消息表") - @PutMapping() - public ApiResult update(@RequestBody ShopChatMessage shopChatMessage) { - if (shopChatMessageService.updateById(shopChatMessage)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:remove')") - @Operation(summary = "删除聊天消息表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopChatMessageService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:save')") - @Operation(summary = "批量添加聊天消息表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopChatMessageService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:update')") - @Operation(summary = "批量修改聊天消息表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopChatMessageService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopChatMessage:remove')") - @Operation(summary = "批量删除聊天消息表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopChatMessageService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCommissionRoleController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCommissionRoleController.java deleted file mode 100644 index f6aa5ad..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCommissionRoleController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopCommissionRoleService; -import com.gxwebsoft.shop.entity.ShopCommissionRole; -import com.gxwebsoft.shop.param.ShopCommissionRoleParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分红角色控制器 - * - * @author 科技小王子 - * @since 2025-05-01 10:01:15 - */ -@Tag(name = "分红角色管理") -@RestController -@RequestMapping("/api/shop/shop-commission-role") -public class ShopCommissionRoleController extends BaseController { - @Resource - private ShopCommissionRoleService shopCommissionRoleService; - - @Operation(summary = "分页查询分红角色") - @GetMapping("/page") - public ApiResult> page(ShopCommissionRoleParam param) { - // 使用关联查询 - return success(shopCommissionRoleService.pageRel(param)); - } - - @Operation(summary = "查询全部分红角色") - @GetMapping() - public ApiResult> list(ShopCommissionRoleParam param) { - // 使用关联查询 - return success(shopCommissionRoleService.listRel(param)); - } - - @Operation(summary = "根据id查询分红角色") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopCommissionRoleService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopCommissionRole:save')") - @OperationLog - @Operation(summary = "添加分红角色") - @PostMapping() - public ApiResult save(@RequestBody ShopCommissionRole shopCommissionRole) { - if (shopCommissionRoleService.save(shopCommissionRole)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCommissionRole:update')") - @OperationLog - @Operation(summary = "修改分红角色") - @PutMapping() - public ApiResult update(@RequestBody ShopCommissionRole shopCommissionRole) { - if (shopCommissionRoleService.updateById(shopCommissionRole)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCommissionRole:remove')") - @OperationLog - @Operation(summary = "删除分红角色") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCommissionRoleService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCommissionRole:save')") - @OperationLog - @Operation(summary = "批量添加分红角色") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCommissionRoleService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCommissionRole:update')") - @OperationLog - @Operation(summary = "批量修改分红角色") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCommissionRoleService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCommissionRole:remove')") - @OperationLog - @Operation(summary = "批量删除分红角色") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCommissionRoleService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCountController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCountController.java deleted file mode 100644 index 3664a24..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCountController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopCountService; -import com.gxwebsoft.shop.entity.ShopCount; -import com.gxwebsoft.shop.param.ShopCountParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商城销售统计表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商城销售统计表管理") -@RestController -@RequestMapping("/api/shop/shop-count") -public class ShopCountController extends BaseController { - @Resource - private ShopCountService shopCountService; - - @Operation(summary = "分页查询商城销售统计表") - @GetMapping("/page") - public ApiResult> page(ShopCountParam param) { - // 使用关联查询 - return success(shopCountService.pageRel(param)); - } - - @Operation(summary = "查询全部商城销售统计表") - @GetMapping() - public ApiResult> list(ShopCountParam param) { - // 使用关联查询 - return success(shopCountService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopCount:list')") - @Operation(summary = "根据id查询商城销售统计表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopCountService.getByIdRel(id)); - } - - @Operation(summary = "添加商城销售统计表") - @PostMapping() - public ApiResult save(@RequestBody ShopCount shopCount) { - if (shopCountService.save(shopCount)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改商城销售统计表") - @PutMapping() - public ApiResult update(@RequestBody ShopCount shopCount) { - if (shopCountService.updateById(shopCount)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商城销售统计表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCountService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商城销售统计表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCountService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商城销售统计表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCountService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商城销售统计表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCountService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyCateController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyCateController.java deleted file mode 100644 index ada1a79..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyCateController.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopCouponApplyCateService; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 优惠券可用分类控制器 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Tag(name = "优惠券可用分类管理") -@RestController -@RequestMapping("/api/shop/shop-coupon-apply-cate") -public class ShopCouponApplyCateController extends BaseController { - @Resource - private ShopCouponApplyCateService shopCouponApplyCateService; - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") - @Operation(summary = "分页查询优惠券可用分类") - @GetMapping("/page") - public ApiResult> page(ShopCouponApplyCateParam param) { - // 使用关联查询 - return success(shopCouponApplyCateService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") - @Operation(summary = "查询全部优惠券可用分类") - @GetMapping() - public ApiResult> list(ShopCouponApplyCateParam param) { - // 使用关联查询 - return success(shopCouponApplyCateService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:list')") - @Operation(summary = "根据id查询优惠券可用分类") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopCouponApplyCateService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:save')") - @OperationLog - @Operation(summary = "添加优惠券可用分类") - @PostMapping() - public ApiResult save(@RequestBody ShopCouponApplyCate shopCouponApplyCate) { - if (shopCouponApplyCateService.save(shopCouponApplyCate)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:update')") - @OperationLog - @Operation(summary = "修改优惠券可用分类") - @PutMapping() - public ApiResult update(@RequestBody ShopCouponApplyCate shopCouponApplyCate) { - if (shopCouponApplyCateService.updateById(shopCouponApplyCate)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:remove')") - @OperationLog - @Operation(summary = "删除优惠券可用分类") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCouponApplyCateService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:save')") - @OperationLog - @Operation(summary = "批量添加优惠券可用分类") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCouponApplyCateService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:update')") - @OperationLog - @Operation(summary = "批量修改优惠券可用分类") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCouponApplyCateService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyCate:remove')") - @OperationLog - @Operation(summary = "批量删除优惠券可用分类") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCouponApplyCateService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyItemController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyItemController.java deleted file mode 100644 index 02091c9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponApplyItemController.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopCouponApplyItemService; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 优惠券可用分类控制器 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Tag(name = "优惠券可用分类管理") -@RestController -@RequestMapping("/api/shop/shop-coupon-apply-item") -public class ShopCouponApplyItemController extends BaseController { - @Resource - private ShopCouponApplyItemService shopCouponApplyItemService; - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") - @Operation(summary = "分页查询优惠券可用分类") - @GetMapping("/page") - public ApiResult> page(ShopCouponApplyItemParam param) { - // 使用关联查询 - return success(shopCouponApplyItemService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") - @Operation(summary = "查询全部优惠券可用分类") - @GetMapping() - public ApiResult> list(ShopCouponApplyItemParam param) { - // 使用关联查询 - return success(shopCouponApplyItemService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:list')") - @Operation(summary = "根据id查询优惠券可用分类") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopCouponApplyItemService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:save')") - @OperationLog - @Operation(summary = "添加优惠券可用分类") - @PostMapping() - public ApiResult save(@RequestBody ShopCouponApplyItem shopCouponApplyItem) { - - if (shopCouponApplyItemService.save(shopCouponApplyItem)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:update')") - @OperationLog - @Operation(summary = "修改优惠券可用分类") - @PutMapping() - public ApiResult update(@RequestBody ShopCouponApplyItem shopCouponApplyItem) { - if (shopCouponApplyItemService.updateById(shopCouponApplyItem)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:remove')") - @OperationLog - @Operation(summary = "删除优惠券可用分类") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCouponApplyItemService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:save')") - @OperationLog - @Operation(summary = "批量添加优惠券可用分类") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCouponApplyItemService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:update')") - @OperationLog - @Operation(summary = "批量修改优惠券可用分类") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCouponApplyItemService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCouponApplyItem:remove')") - @OperationLog - @Operation(summary = "批量删除优惠券可用分类") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCouponApplyItemService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java deleted file mode 100644 index 1328aa9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopCouponController.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.date.DateUtil; -import com.alibaba.fastjson2.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.service.ShopCouponApplyCateService; -import com.gxwebsoft.shop.service.ShopCouponApplyItemService; -import com.gxwebsoft.shop.service.ShopCouponService; -import com.gxwebsoft.shop.entity.ShopCoupon; -import com.gxwebsoft.shop.param.ShopCouponParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.service.ShopUserCouponService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -/** - * 优惠券控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:24 - */ -@Tag(name = "优惠券管理") -@RestController -@RequestMapping("/api/shop/shop-coupon") -public class ShopCouponController extends BaseController { - @Resource - private ShopCouponService shopCouponService; - @Resource - private ShopUserCouponService userCouponService; - @Resource - private ShopCouponService couponService; - @Resource - private ShopCouponApplyItemService couponApplyItemService; - @Resource - private ShopCouponApplyCateService couponApplyCateService; - - @Operation(summary = "可领取优惠券列表") - @PostMapping("/list") - public ApiResult> page() { - Integer uid = getLoginUserId(); - // 用户已经领取的优惠券 - List userCouponList = userCouponService.userList(uid); - List hasTakeCouponIdList = new ArrayList<>(); - for (ShopUserCoupon userCoupon : userCouponList) { - hasTakeCouponIdList.add(userCoupon.getCouponId()); - } - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); -// if (!hasTakeCouponIdList.isEmpty()) queryWrapper.notIn(Coupon::getCouponId, hasTakeCouponIdList); - queryWrapper.eq(ShopCoupon::getStatus, 0); - queryWrapper.apply("(expire_type = 0 OR (expire_type = 1 AND end_time > '" - + DateUtil.date() + "'))"); - queryWrapper.orderByAsc(ShopCoupon::getSortNumber); - List couponList = couponService.list(queryWrapper); - for (ShopCoupon coupon : couponList) { - coupon.setCouponApplyItemList(couponApplyItemService.list( - new LambdaQueryWrapper().eq(ShopCouponApplyItem::getCouponId, coupon.getId()) - )); - coupon.setCouponApplyCateList(couponApplyCateService.list( - new LambdaQueryWrapper().eq(ShopCouponApplyCate::getCouponId, coupon.getId()) - )); - boolean hasTake = hasTakeCouponIdList.contains(coupon.getId()); - coupon.setHasTake(hasTake); - if (hasTake) { - int userUseNum = 0; - List userCouponList1 = userCouponService.list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getCouponId, coupon.getId()) - ); - coupon.setUserTakeNum(userCouponList1.size()); - for (ShopUserCoupon userCoupon : userCouponList1) { - if (userCoupon.getIsUse().equals(1)) userUseNum++; - } - coupon.setUserUseNum(userUseNum); - } - } - return success(couponList); - } - - - @Operation(summary = "分页查询优惠券") - @GetMapping("/page") - public ApiResult> page(ShopCouponParam param) { - // 使用关联查询 - return success(shopCouponService.pageRel(param)); - } - - @Operation(summary = "查询全部优惠券") - @GetMapping() - public ApiResult> list(ShopCouponParam param) { - // 使用关联查询 - return success(shopCouponService.listRel(param)); - } - - @Operation(summary = "根据id查询优惠券") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopCouponService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopCoupon:save')") - @OperationLog - @Operation(summary = "添加优惠券") - @PostMapping() - public ApiResult save(@RequestBody ShopCoupon shopCoupon) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopCoupon.setUserId(loginUser.getUserId()); - } - if (shopCouponService.save(shopCoupon)) { - if (shopCoupon.getCouponApplyCateList() != null && !shopCoupon.getCouponApplyCateList().isEmpty()) { - for (ShopCouponApplyCate couponApplyCate : shopCoupon.getCouponApplyCateList()) { - couponApplyCate.setCouponId(shopCoupon.getId()); - } - couponApplyCateService.saveBatch(shopCoupon.getCouponApplyCateList()); - } - - if (shopCoupon.getCouponApplyItemList() != null && !shopCoupon.getCouponApplyItemList().isEmpty()) { - for (ShopCouponApplyItem couponApplyItem : shopCoupon.getCouponApplyItemList()) { - couponApplyItem.setCouponId(shopCoupon.getId()); - } - couponApplyItemService.saveBatch(shopCoupon.getCouponApplyItemList()); - } - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCoupon:update')") - @OperationLog - @Operation(summary = "修改优惠券") - @PutMapping() - public ApiResult update(@RequestBody ShopCoupon shopCoupon) { - if (shopCouponService.updateById(shopCoupon)) { - couponApplyCateService.removeByCouponId(shopCoupon.getId()); - if (shopCoupon.getCouponApplyCateList() != null && !shopCoupon.getCouponApplyCateList().isEmpty()) { - for (ShopCouponApplyCate couponApplyCate : shopCoupon.getCouponApplyCateList()) { - couponApplyCate.setCouponId(shopCoupon.getId()); - } - couponApplyCateService.saveBatch(shopCoupon.getCouponApplyCateList()); - } - - couponApplyItemService.removeByCouponId(shopCoupon.getId()); - if (shopCoupon.getCouponApplyItemList() != null && !shopCoupon.getCouponApplyItemList().isEmpty()) { - for (ShopCouponApplyItem couponApplyItem : shopCoupon.getCouponApplyItemList()) { - couponApplyItem.setCouponId(shopCoupon.getId()); - } - couponApplyItemService.saveBatch(shopCoupon.getCouponApplyItemList()); - } - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCoupon:remove')") - @OperationLog - @Operation(summary = "删除优惠券") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopCouponService.removeById(id)) { - couponApplyCateService.removeByCouponId(id); - couponApplyItemService.removeByCouponId(id); - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCoupon:save')") - @OperationLog - @Operation(summary = "批量添加优惠券") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopCouponService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCoupon:update')") - @OperationLog - @Operation(summary = "批量修改优惠券") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopCouponService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopCoupon:remove')") - @OperationLog - @Operation(summary = "批量删除优惠券") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopCouponService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java deleted file mode 100644 index 4404596..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerApplyController.java +++ /dev/null @@ -1,349 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import cn.afterturn.easypoi.excel.entity.ExportParams; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.service.ShopDealerApplyService; -import com.gxwebsoft.shop.entity.ShopDealerApply; -import com.gxwebsoft.shop.param.ShopDealerApplyParam; -import com.gxwebsoft.shop.param.ShopDealerApplyImportParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; - -/** - * 分销商申请记录表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:50:19 - */ -@Tag(name = "分销商申请记录表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-apply") -public class ShopDealerApplyController extends BaseController { - @Resource - private ShopDealerApplyService shopDealerApplyService; - @Resource - private ShopDealerUserService shopDealerUserService; - - @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") - @Operation(summary = "分页查询分销商申请记录表") - @GetMapping("/page") - public ApiResult> page(ShopDealerApplyParam param) { - // 使用关联查询 - return success(shopDealerApplyService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") - @Operation(summary = "查询全部分销商申请记录表") - @GetMapping() - public ApiResult> list(ShopDealerApplyParam param) { - // 使用关联查询 - return success(shopDealerApplyService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") - @Operation(summary = "根据id查询分销商申请记录表") - @GetMapping("/{id}") - public ApiResult getById(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerApplyService.getById(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:list')") - @Operation(summary = "根据userId查询分销商申请记录表") - @GetMapping("/getByUserId/{id}") - public ApiResult getByUserId(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerApplyService.getByUserIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") - @OperationLog - @Operation(summary = "添加分销商申请记录表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerApply shopDealerApply) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerApply.setApplyTime(LocalDateTime.now()); - if(shopDealerApply.getUserId() == null) { - shopDealerApply.setUserId(loginUser.getUserId()); - } - } - if (shopDealerApply.getRefereeId() != null) { - if(shopDealerUserService.getByIdRel(shopDealerApply.getRefereeId()) == null){ - return fail("推荐人不存在"); - } - } - - if (shopDealerApplyService.save(shopDealerApply)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") - @OperationLog - @Operation(summary = "修改分销商申请记录表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerApply shopDealerApply) { - shopDealerApply.setAuditTime(null); - if(shopDealerApply.getRate() != null){ - final ShopDealerUser dealerUser = new ShopDealerUser(); - dealerUser.setRate(shopDealerApply.getRate()); - shopDealerUserService.update(dealerUser, new LambdaQueryWrapper().eq(ShopDealerUser::getUserId, shopDealerApply.getUserId())); - } - if (shopDealerApplyService.updateById(shopDealerApply)) { - if (shopDealerApply.getApplyStatus().equals(20)) { - LocalDateTime now = LocalDateTime.now(); - shopDealerApply.setAuditTime(now); - shopDealerApplyService.updateById(shopDealerApply); - // 同步添加经销商 - if (shopDealerUserService.count(new LambdaQueryWrapper().eq(ShopDealerUser::getUserId, shopDealerApply.getUserId())) == 0) { - final ShopDealerUser dealerUser = new ShopDealerUser(); - dealerUser.setUserId(shopDealerApply.getUserId()); - dealerUser.setRealName(shopDealerApply.getRealName()); - dealerUser.setMobile(shopDealerApply.getMobile()); - dealerUser.setRefereeId(shopDealerApply.getRefereeId()); - shopDealerUserService.save(dealerUser); - } - } - return success("保存成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") - @OperationLog - @Operation(summary = "删除分销商申请记录表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerApplyService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") - @OperationLog - @Operation(summary = "批量添加分销商申请记录表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerApplyService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") - @OperationLog - @Operation(summary = "批量修改分销商申请记录表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerApplyService, "apply_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") - @OperationLog - @Operation(summary = "批量删除分销商申请记录表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerApplyService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * excel批量导入分销商申请记录 - * Excel表头格式:类型、用户ID、姓名、分销商名称、分销商编码、手机号、合同金额、详细地址、推荐人用户ID、申请方式、审核状态、合同时间、驳回原因、商城ID - */ - @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") - @Transactional(rollbackFor = {Exception.class}) - @Operation(summary = "批量导入分销商申请记录") - @PostMapping("/import") - public ApiResult> importBatch(MultipartFile file) { - ImportParams importParams = new ImportParams(); - // 设置标题行,跳过第一行表头 - importParams.setTitleRows(1); - importParams.setHeadRows(1); - List errorMessages = new ArrayList<>(); - int successCount = 0; - - try { - List list = ExcelImportUtil.importExcel(file.getInputStream(), ShopDealerApplyImportParam.class, importParams); - - // 获取当前登录用户 - User loginUser = getLoginUser(); - Integer currentUserId = loginUser != null ? loginUser.getUserId() : null; - - for (int i = 0; i < list.size(); i++) { - ShopDealerApplyImportParam param = list.get(i); - try { - // 手动转换对象,避免JSON序列化问题 - ShopDealerApply item = convertImportParamToEntity(param); - - // 设置必填字段的默认值 - if (item.getUserId() == null && currentUserId != null) { - item.setUserId(currentUserId); - } - if (item.getApplyStatus() == null) { - item.setApplyStatus(10); // 默认状态为待审核 - } - if (item.getApplyType() == null) { - item.setApplyType(10); // 默认需要后台审核 - } - if (item.getType() == null) { - item.setType(0); // 默认类型为经销商 - } - - // 设置申请时间 - item.setApplyTime(LocalDateTime.now()); - - // 验证必填字段 - if (item.getRealName() == null || item.getRealName().trim().isEmpty()) { - errorMessages.add("第" + (i + 1) + "行:姓名不能为空"); - continue; - } - if (item.getDealerName() == null || item.getDealerName().trim().isEmpty()) { - errorMessages.add("第" + (i + 1) + "行:企业名称不能为空"); - continue; - } - if (item.getMobile() == null || item.getMobile().trim().isEmpty()) { - errorMessages.add("第" + (i + 1) + "行:手机号不能为空"); - continue; - } - - // 验证推荐人是否存在 - if (item.getRefereeId() != null) { - if (shopDealerUserService.getByIdRel(item.getRefereeId()) == null) { - errorMessages.add("第" + (i + 1) + "行:推荐人不存在"); - continue; - } - } - - // 保存数据 - if (shopDealerApplyService.save(item)) { - successCount++; - } else { - errorMessages.add("第" + (i + 1) + "行:保存失败"); - } - - } catch (Exception e) { - errorMessages.add("第" + (i + 1) + "行:" + e.getMessage()); - System.err.println("导入第" + (i + 1) + "行数据失败: " + e.getMessage()); - e.printStackTrace(); - } - } - - // 返回结果 - if (errorMessages.isEmpty()) { - return success("成功导入" + successCount + "条数据", null); - } else { - return success("导入完成,成功" + successCount + "条,失败" + errorMessages.size() + "条", errorMessages); - } - - } catch (Exception e) { - System.err.println("批量导入分销商申请记录失败: " + e.getMessage()); - e.printStackTrace(); - return fail("导入失败:" + e.getMessage(), null); - } - } - - /** - * 下载分销商申请记录导入模板 - */ - @Operation(summary = "下载分销商申请记录导入模板") - @GetMapping("/import/template") - public void downloadTemplate(HttpServletResponse response) throws IOException { - // 创建空的导入参数列表作为模板 - List templateList = new ArrayList<>(); - - // 添加一行示例数据 - ShopDealerApplyImportParam example = new ShopDealerApplyImportParam(); - example.setType(0); - example.setRealName("宗馥莉"); - example.setDealerName("娃哈哈有限公司"); - example.setDealerCode("WaHaHa"); - example.setMobile("13800138000"); - example.setApplyType(10); - example.setApplyStatus(10); - example.setContractTime("2025-09-05 10:00:00"); - templateList.add(example); - - // 设置导出参数 - ExportParams exportParams = new ExportParams("分销商申请记录导入模板", "分销商申请记录"); - - // 生成Excel - Workbook workbook = ExcelExportUtil.exportExcel(exportParams, ShopDealerApplyImportParam.class, templateList); - - // 设置响应头 - response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=shop_dealer_apply_import_template.xlsx"); - - // 输出到响应流 - workbook.write(response.getOutputStream()); - workbook.close(); - } - - /** - * 将ShopDealerApplyImportParam转换为ShopDealerApply实体 - */ - private ShopDealerApply convertImportParamToEntity(ShopDealerApplyImportParam param) { - ShopDealerApply entity = new ShopDealerApply(); - - // 基本字段转换 - entity.setType(param.getType()); - entity.setUserId(param.getUserId()); - entity.setRealName(param.getRealName()); - entity.setDealerName(param.getDealerName()); - entity.setDealerCode(param.getDealerCode()); - entity.setMobile(param.getMobile()); - entity.setMoney(param.getMoney()); - entity.setAddress(param.getAddress()); - entity.setRefereeId(param.getRefereeId()); - entity.setApplyType(param.getApplyType()); - entity.setApplyStatus(param.getApplyStatus()); - entity.setRejectReason(param.getRejectReason()); - entity.setTenantId(param.getTenantId()); - - // 处理合同时间 - if (param.getContractTime() != null && !param.getContractTime().trim().isEmpty()) { - try { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - entity.setContractTime(LocalDateTime.parse(param.getContractTime(), formatter)); - } catch (Exception e) { - System.err.println("合同时间格式错误: " + param.getContractTime()); - } - } - - return entity; - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java deleted file mode 100644 index a05c0c4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerBankController.java +++ /dev/null @@ -1,138 +0,0 @@ - package com.gxwebsoft.shop.controller; - - import com.gxwebsoft.common.core.annotation.OperationLog; - import com.gxwebsoft.common.core.web.ApiResult; - import com.gxwebsoft.common.core.web.BaseController; - import com.gxwebsoft.common.core.web.BatchParam; - import com.gxwebsoft.common.core.web.PageResult; - import com.gxwebsoft.common.system.entity.User; - import com.gxwebsoft.shop.entity.ShopDealerBank; - import com.gxwebsoft.shop.param.ShopDealerBankParam; - import com.gxwebsoft.shop.service.ShopDealerBankService; - import io.swagger.v3.oas.annotations.Operation; - import io.swagger.v3.oas.annotations.tags.Tag; - import org.springframework.security.access.prepost.PreAuthorize; - import org.springframework.web.bind.annotation.*; - - import javax.annotation.Resource; - import java.util.List; - - /** - * 分销商提现银行卡控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ - @Tag(name = "分销商提现银行卡管理") - @RestController - @RequestMapping("/api/shop/shop-dealer-bank") - public class ShopDealerBankController extends BaseController { - @Resource - private ShopDealerBankService shopDealerBankService; - - @Operation(summary = "分页查询分销商提现银行卡") - @GetMapping("/page") - public ApiResult> page(ShopDealerBankParam param) { - final User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - param.setUserId(loginUser.getUserId()); - return success(shopDealerBankService.pageRel(param)); - } - - @Operation(summary = "查询全部分销商提现银行卡") - @GetMapping() - public ApiResult> list(ShopDealerBankParam param) { - final User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - param.setUserId(loginUser.getUserId()); - return success(shopDealerBankService.listRel(param)); - } - - @Operation(summary = "根据id查询分销商提现银行卡") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerBankService.getByIdRel(id)); - } - - @OperationLog - @Operation(summary = "添加分销商提现银行卡") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerBank shopDealerBank) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerBank.setUserId(loginUser.getUserId()); - } - if (shopDealerBankService.save(shopDealerBank)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @OperationLog - @Operation(summary = "修改分销商提现银行卡") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerBank shopDealerBank) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerBank.setUserId(loginUser.getUserId()); - if (shopDealerBankService.updateById(shopDealerBank)) { - return success("修改成功"); - } - } - return fail("修改失败"); - } - - @Operation(summary = "删除分销商提现银行卡") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - final User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - if (shopDealerBankService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerBank:save')") - @OperationLog - @Operation(summary = "批量添加分销商提现银行卡") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerBankService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerBank:update')") - @OperationLog - @Operation(summary = "批量修改分销商提现银行卡") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerBankService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerBank:remove')") - @OperationLog - @Operation(summary = "批量删除分销商提现银行卡") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerBankService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - } diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerCapitalController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerCapitalController.java deleted file mode 100644 index d7ccaf1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerCapitalController.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopDealerCapitalService; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.param.ShopDealerCapitalParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分销商资金明细表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "分销商资金明细表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-capital") -public class ShopDealerCapitalController extends BaseController { - @Resource - private ShopDealerCapitalService shopDealerCapitalService; - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:list')") - @Operation(summary = "分页查询分销商资金明细表") - @GetMapping("/page") - public ApiResult> page(ShopDealerCapitalParam param) { - // 使用关联查询 - return success(shopDealerCapitalService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:list')") - @Operation(summary = "查询全部分销商资金明细表") - @GetMapping() - public ApiResult> list(ShopDealerCapitalParam param) { - // 使用关联查询 - return success(shopDealerCapitalService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:list')") - @Operation(summary = "根据id查询分销商资金明细表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerCapitalService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:save')") - @OperationLog - @Operation(summary = "添加分销商资金明细表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerCapital shopDealerCapital) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerCapital.setUserId(loginUser.getUserId()); - } - if (shopDealerCapitalService.save(shopDealerCapital)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:update')") - @OperationLog - @Operation(summary = "修改分销商资金明细表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerCapital shopDealerCapital) { - if (shopDealerCapitalService.updateById(shopDealerCapital)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:remove')") - @OperationLog - @Operation(summary = "删除分销商资金明细表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerCapitalService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:save')") - @OperationLog - @Operation(summary = "批量添加分销商资金明细表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerCapitalService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:update')") - @OperationLog - @Operation(summary = "批量修改分销商资金明细表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerCapitalService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerCapital:remove')") - @OperationLog - @Operation(summary = "批量删除分销商资金明细表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerCapitalService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerOrderController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerOrderController.java deleted file mode 100644 index 2ecc05e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerOrderController.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopDealerOrderService; -import com.gxwebsoft.shop.entity.ShopDealerOrder; -import com.gxwebsoft.shop.param.ShopDealerOrderParam; -import com.gxwebsoft.shop.param.ShopDealerOrderImportParam; -import com.gxwebsoft.common.core.utils.JSONUtil; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分销商订单记录表控制器 - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -@Tag(name = "分销商订单记录表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-order") -public class ShopDealerOrderController extends BaseController { - @Resource - private ShopDealerOrderService shopDealerOrderService; - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:list')") - @Operation(summary = "分页查询分销商订单记录表") - @GetMapping("/page") - public ApiResult> page(ShopDealerOrderParam param) { - // 使用关联查询 - return success(shopDealerOrderService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:list')") - @Operation(summary = "查询全部分销商订单记录表") - @GetMapping() - public ApiResult> list(ShopDealerOrderParam param) { - // 使用关联查询 - return success(shopDealerOrderService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:list')") - @Operation(summary = "根据id查询分销商订单记录表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerOrderService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") - @OperationLog - @Operation(summary = "添加分销商订单记录表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerOrder shopDealerOrder) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerOrder.setUserId(loginUser.getUserId()); - } - if (shopDealerOrderService.save(shopDealerOrder)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:update')") - @OperationLog - @Operation(summary = "修改分销商订单记录表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerOrder shopDealerOrder) { - if (shopDealerOrderService.updateById(shopDealerOrder)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:remove')") - @OperationLog - @Operation(summary = "删除分销商订单记录表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerOrderService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") - @OperationLog - @Operation(summary = "批量添加分销商订单记录表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerOrderService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:update')") - @OperationLog - @Operation(summary = "批量修改分销商订单记录表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerOrderService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerOrder:remove')") - @OperationLog - @Operation(summary = "批量删除分销商订单记录表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerOrderService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - /** - * excel批量导入分销商订单记录表 - */ - @PreAuthorize("hasAuthority('shop:shopDealerOrder:save')") - @OperationLog - @Operation(summary = "批量导入分销商订单记录表") - @Transactional(rollbackFor = {Exception.class}) - @PostMapping("/import") - public ApiResult> importBatch(MultipartFile file) { - ImportParams importParams = new ImportParams(); - try { - - // 第三步:导入XLS文件的内容 - List list = ExcelImportUtil.importExcel(file.getInputStream(), ShopDealerOrderImportParam.class, importParams); - list.forEach(d -> { - ShopDealerOrder item = JSONUtil.parseObject(JSONUtil.toJSONString(d), ShopDealerOrder.class); - assert item != null; - if (ObjectUtil.isNotEmpty(item)) { - // 设置默认值 - if (item.getIsInvalid() == null) { - item.setIsInvalid(0); // 新导入的数据isInvalid设为0(未失效) - } - if (item.getIsSettled() == null) { - item.setIsSettled(0); // 新导入的数据isSettled设为0(未结算) - } - shopDealerOrderService.save(item); - } - }); - return success("成功导入" + list.size() + "条", null); - } catch (Exception e) { - e.printStackTrace(); - } - return fail("导入失败", null); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRecordController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRecordController.java deleted file mode 100644 index 44b2c22..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRecordController.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.entity.ShopDealerRecord; -import com.gxwebsoft.shop.param.ShopDealerRecordParam; -import com.gxwebsoft.shop.service.ShopDealerRecordService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 客户跟进情况控制器 - * - * @author 科技小王子 - * @since 2025-10-02 12:21:50 - */ -@Tag(name = "客户跟进情况管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-record") -public class ShopDealerRecordController extends BaseController { - @Resource - private ShopDealerRecordService shopDealerRecordService; - - @Operation(summary = "分页查询客户跟进情况") - @GetMapping("/page") - public ApiResult> page(ShopDealerRecordParam param) { - // 使用关联查询 - return success(shopDealerRecordService.pageRel(param)); - } - - @Operation(summary = "查询全部客户跟进情况") - @GetMapping() - public ApiResult> list(ShopDealerRecordParam param) { - // 使用关联查询 - return success(shopDealerRecordService.listRel(param)); - } - - @Operation(summary = "根据id查询客户跟进情况") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerRecordService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") - @OperationLog - @Operation(summary = "添加客户跟进情况") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerRecord shopDealerRecord) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerRecord.setUserId(loginUser.getUserId()); - } - if (shopDealerRecordService.save(shopDealerRecord)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") - @OperationLog - @Operation(summary = "修改客户跟进情况") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerRecord shopDealerRecord) { - if (shopDealerRecordService.updateById(shopDealerRecord)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") - @OperationLog - @Operation(summary = "删除客户跟进情况") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerRecordService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:save')") - @OperationLog - @Operation(summary = "批量添加客户跟进情况") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerRecordService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:update')") - @OperationLog - @Operation(summary = "批量修改客户跟进情况") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerRecordService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerApply:remove')") - @OperationLog - @Operation(summary = "批量删除客户跟进情况") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerRecordService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRefereeController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRefereeController.java deleted file mode 100644 index bb4ef91..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerRefereeController.java +++ /dev/null @@ -1,137 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopUserReferee; -import com.gxwebsoft.shop.service.ShopDealerRefereeService; -import com.gxwebsoft.shop.entity.ShopDealerReferee; -import com.gxwebsoft.shop.param.ShopDealerRefereeParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分销商推荐关系表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "分销商推荐关系表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-referee") -public class ShopDealerRefereeController extends BaseController { - @Resource - private ShopDealerRefereeService shopDealerRefereeService; - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:list')") - @Operation(summary = "分页查询分销商推荐关系表") - @GetMapping("/page") - public ApiResult> page(ShopDealerRefereeParam param) { - // 使用关联查询 - return success(shopDealerRefereeService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:list')") - @Operation(summary = "查询全部分销商推荐关系表") - @GetMapping() - public ApiResult> list(ShopDealerRefereeParam param) { - // 使用关联查询 - return success(shopDealerRefereeService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:list')") - @Operation(summary = "根据id查询分销商推荐关系表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerRefereeService.getByIdRel(id)); - } - - @Operation(summary = "根据userId查询推荐人信息") - @GetMapping("/getByUserId/{userId}") - public ApiResult getByUserId(@PathVariable("userId") Integer userId) { - // 使用关联查询 - return success(shopDealerRefereeService.getByUserIdRel(userId)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:save')") - @OperationLog - @Operation(summary = "添加分销商推荐关系表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerReferee shopDealerReferee) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerReferee.setUserId(loginUser.getUserId()); - } - if (shopDealerRefereeService.save(shopDealerReferee)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:update')") - @OperationLog - @Operation(summary = "修改分销商推荐关系表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerReferee shopDealerReferee) { - if (shopDealerRefereeService.updateById(shopDealerReferee)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:remove')") - @OperationLog - @Operation(summary = "删除分销商推荐关系表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerRefereeService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:save')") - @OperationLog - @Operation(summary = "批量添加分销商推荐关系表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerRefereeService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:update')") - @OperationLog - @Operation(summary = "批量修改分销商推荐关系表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerRefereeService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerReferee:remove')") - @OperationLog - @Operation(summary = "批量删除分销商推荐关系表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerRefereeService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerSettingController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerSettingController.java deleted file mode 100644 index 039cf2c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerSettingController.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopDealerSettingService; -import com.gxwebsoft.shop.entity.ShopDealerSetting; -import com.gxwebsoft.shop.param.ShopDealerSettingParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分销商设置表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "分销商设置表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-setting") -public class ShopDealerSettingController extends BaseController { - @Resource - private ShopDealerSettingService shopDealerSettingService; - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:list')") - @Operation(summary = "分页查询分销商设置表") - @GetMapping("/page") - public ApiResult> page(ShopDealerSettingParam param) { - // 使用关联查询 - return success(shopDealerSettingService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:list')") - @Operation(summary = "查询全部分销商设置表") - @GetMapping() - public ApiResult> list(ShopDealerSettingParam param) { - // 使用关联查询 - return success(shopDealerSettingService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:list')") - @Operation(summary = "根据id查询分销商设置表") - @GetMapping("/{key}") - public ApiResult get(@PathVariable("key") String key) { - // 使用关联查询 - return success(shopDealerSettingService.getByIdRel(key)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:save')") - @OperationLog - @Operation(summary = "添加分销商设置表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerSetting shopDealerSetting) { - if (shopDealerSettingService.save(shopDealerSetting)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:update')") - @OperationLog - @Operation(summary = "修改分销商设置表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerSetting shopDealerSetting) { - if (shopDealerSettingService.updateById(shopDealerSetting)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:remove')") - @OperationLog - @Operation(summary = "删除分销商设置表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerSettingService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:save')") - @OperationLog - @Operation(summary = "批量添加分销商设置表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerSettingService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:update')") - @OperationLog - @Operation(summary = "批量修改分销商设置表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerSettingService, "key")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerSetting:remove')") - @OperationLog - @Operation(summary = "批量删除分销商设置表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerSettingService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java deleted file mode 100644 index ca84666..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerUserController.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.afterturn.easypoi.excel.ExcelImportUtil; -import cn.afterturn.easypoi.excel.entity.ImportParams; -import cn.hutool.core.util.ObjectUtil; -import com.gxwebsoft.common.core.utils.JSONUtil; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.param.ShopDealerUserParam; -import com.gxwebsoft.shop.param.ShopDealerUserImportParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分销商用户记录表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "分销商用户记录表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-user") -public class ShopDealerUserController extends BaseController { - @Resource - private ShopDealerUserService shopDealerUserService; - - @Operation(summary = "分页查询分销商用户记录表") - @GetMapping("/page") - public ApiResult> page(ShopDealerUserParam param) { - // 使用关联查询 - return success(shopDealerUserService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:list')") - @Operation(summary = "查询全部分销商用户记录表") - @GetMapping() - public ApiResult> list(ShopDealerUserParam param) { - // 使用关联查询 - return success(shopDealerUserService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:list')") - @Operation(summary = "根据userId查询分销商用户") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerUserService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:save')") - @OperationLog - @Operation(summary = "添加分销商用户记录表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerUser shopDealerUser) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerUser.setUserId(loginUser.getUserId()); - } - if (shopDealerUserService.save(shopDealerUser)) { - return success("添加成功", shopDealerUser); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:update')") - @Operation(summary = "修改分销商用户记录表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerUser shopDealerUser) { - if (shopDealerUserService.updateById(shopDealerUser)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('sys:user:update')") - @Operation(summary = "修改分销商用户记录表") - @PutMapping("/updateByUserId") - public ApiResult updateByUserId(@RequestBody ShopDealerUser shopDealerUser) { - if (shopDealerUserService.updateByUserId(shopDealerUser)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:remove')") - @OperationLog - @Operation(summary = "删除分销商用户记录表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerUserService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:save')") - @OperationLog - @Operation(summary = "批量添加分销商用户记录表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerUserService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:update')") - @OperationLog - @Operation(summary = "批量修改分销商用户记录表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerUserService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:remove')") - @OperationLog - @Operation(summary = "批量删除分销商用户记录表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerUserService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerUser:save')") - @Operation(summary = "批量导入分销商用户") - @Transactional(rollbackFor = {Exception.class}) - @PostMapping("/import") - public ApiResult> importBatch(MultipartFile file) { - ImportParams importParams = new ImportParams(); - try { - List list = ExcelImportUtil.importExcel(file.getInputStream(), ShopDealerUserImportParam.class, importParams); - list.forEach(d -> { - ShopDealerUser item = JSONUtil.parseObject(JSONUtil.toJSONString(d), ShopDealerUser.class); - assert item != null; - if (ObjectUtil.isNotEmpty(item)) { - // 设置默认值 - if (item.getIsDelete() == null) { - item.setIsDelete(0); - } - if (item.getSortNumber() == null) { - item.setSortNumber(0); - } - // 记录当前登录用户id(如果没有指定userId) - if (item.getUserId() == null) { - User loginUser = getLoginUser(); - if (loginUser != null) { - item.setUserId(loginUser.getUserId()); - } - } - shopDealerUserService.save(item); - } - }); - return success("成功导入" + list.size() + "条", null); - } catch (Exception e) { - e.printStackTrace(); - } - return fail("导入失败", null); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerWithdrawController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerWithdrawController.java deleted file mode 100644 index 00f7b4e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopDealerWithdrawController.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.util.StrUtil; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import com.gxwebsoft.shop.service.ShopDealerWithdrawService; -import com.gxwebsoft.shop.entity.ShopDealerWithdraw; -import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 分销商提现明细表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "分销商提现明细表管理") -@RestController -@RequestMapping("/api/shop/shop-dealer-withdraw") -public class ShopDealerWithdrawController extends BaseController { - @Resource - private ShopDealerWithdrawService shopDealerWithdrawService; - @Resource - private ShopDealerUserService shopDealerUserService; - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')") - @Operation(summary = "分页查询分销商提现明细表") - @GetMapping("/page") - public ApiResult> page(ShopDealerWithdrawParam param) { - // 使用关联查询 - return success(shopDealerWithdrawService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')") - @Operation(summary = "查询全部分销商提现明细表") - @GetMapping() - public ApiResult> list(ShopDealerWithdrawParam param) { - // 使用关联查询 - return success(shopDealerWithdrawService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:list')") - @Operation(summary = "根据id查询分销商提现明细表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopDealerWithdrawService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:save')") - @OperationLog - @Transactional(rollbackFor = {Exception.class}) - @Operation(summary = "添加分销商提现明细表") - @PostMapping() - public ApiResult save(@RequestBody ShopDealerWithdraw shopDealerWithdraw) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopDealerWithdraw.setUserId(loginUser.getUserId()); - final ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(loginUser.getUserId()); - // 扣除提现金额 - dealerUser.setMoney(dealerUser.getMoney().subtract(shopDealerWithdraw.getMoney())); - shopDealerUserService.updateById(dealerUser); - if (shopDealerWithdrawService.save(shopDealerWithdraw)) { - return success("添加成功"); - } - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:update')") - @OperationLog - @Operation(summary = "修改分销商提现明细表") - @PutMapping() - public ApiResult update(@RequestBody ShopDealerWithdraw shopDealerWithdraw) { - // 驳回操作,退回金额 - if(shopDealerWithdraw.getApplyStatus().equals(30)){ - final ShopDealerUser dealerUser = shopDealerUserService.getByUserIdRel(shopDealerWithdraw.getUserId()); - dealerUser.setMoney(dealerUser.getMoney().add(shopDealerWithdraw.getMoney())); - shopDealerUserService.updateById(dealerUser); - } - // 已打款,要求上传凭证 - if(shopDealerWithdraw.getApplyStatus().equals(40)){ - shopDealerWithdraw.setAuditTime(LocalDateTime.now()); - if(StrUtil.isBlankIfStr(shopDealerWithdraw.getImage())){ - return fail("请上传打款凭证"); - } - } - if (shopDealerWithdrawService.updateById(shopDealerWithdraw)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:remove')") - @OperationLog - @Operation(summary = "删除分销商提现明细表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopDealerWithdrawService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:save')") - @OperationLog - @Operation(summary = "批量添加分销商提现明细表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopDealerWithdrawService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:update')") - @OperationLog - @Operation(summary = "批量修改分销商提现明细表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopDealerWithdrawService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopDealerWithdraw:remove')") - @OperationLog - @Operation(summary = "批量删除分销商提现明细表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopDealerWithdrawService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressController.java deleted file mode 100644 index c638b0f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopExpressService; -import com.gxwebsoft.shop.entity.ShopExpress; -import com.gxwebsoft.shop.param.ShopExpressParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 物流公司控制器 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Tag(name = "物流公司管理") -@RestController -@RequestMapping("/api/shop/shop-express") -public class ShopExpressController extends BaseController { - @Resource - private ShopExpressService shopExpressService; - - @Operation(summary = "分页查询物流公司") - @GetMapping("/page") - public ApiResult> page(ShopExpressParam param) { - // 使用关联查询 - return success(shopExpressService.pageRel(param)); - } - - @Operation(summary = "查询全部物流公司") - @GetMapping() - public ApiResult> list(ShopExpressParam param) { - // 使用关联查询 - return success(shopExpressService.listRel(param)); - } - - @Operation(summary = "根据id查询物流公司") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopExpressService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopExpress:save')") - @OperationLog - @Operation(summary = "添加物流公司") - @PostMapping() - public ApiResult save(@RequestBody ShopExpress shopExpress) { - if (shopExpressService.save(shopExpress)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpress:update')") - @OperationLog - @Operation(summary = "修改物流公司") - @PutMapping() - public ApiResult update(@RequestBody ShopExpress shopExpress) { - if (shopExpressService.updateById(shopExpress)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpress:remove')") - @OperationLog - @Operation(summary = "删除物流公司") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopExpressService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpress:save')") - @OperationLog - @Operation(summary = "批量添加物流公司") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopExpressService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpress:update')") - @OperationLog - @Operation(summary = "批量修改物流公司") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopExpressService, "express_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpress:remove')") - @OperationLog - @Operation(summary = "批量删除物流公司") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopExpressService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateController.java deleted file mode 100644 index bbc7ac2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopExpressTemplateService; -import com.gxwebsoft.shop.entity.ShopExpressTemplate; -import com.gxwebsoft.shop.param.ShopExpressTemplateParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 运费模板控制器 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Tag(name = "运费模板管理") -@RestController -@RequestMapping("/api/shop/shop-express-template") -public class ShopExpressTemplateController extends BaseController { - @Resource - private ShopExpressTemplateService shopExpressTemplateService; - - @Operation(summary = "分页查询运费模板") - @GetMapping("/page") - public ApiResult> page(ShopExpressTemplateParam param) { - // 使用关联查询 - return success(shopExpressTemplateService.pageRel(param)); - } - - @Operation(summary = "查询全部运费模板") - @GetMapping() - public ApiResult> list(ShopExpressTemplateParam param) { - // 使用关联查询 - return success(shopExpressTemplateService.listRel(param)); - } - - @Operation(summary = "根据id查询运费模板") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopExpressTemplateService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplate:save')") - @OperationLog - @Operation(summary = "添加运费模板") - @PostMapping() - public ApiResult save(@RequestBody ShopExpressTemplate shopExpressTemplate) { - if (shopExpressTemplateService.save(shopExpressTemplate)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplate:update')") - @OperationLog - @Operation(summary = "修改运费模板") - @PutMapping() - public ApiResult update(@RequestBody ShopExpressTemplate shopExpressTemplate) { - if (shopExpressTemplateService.updateById(shopExpressTemplate)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplate:remove')") - @OperationLog - @Operation(summary = "删除运费模板") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopExpressTemplateService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplate:save')") - @OperationLog - @Operation(summary = "批量添加运费模板") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopExpressTemplateService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplate:update')") - @OperationLog - @Operation(summary = "批量修改运费模板") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopExpressTemplateService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplate:remove')") - @OperationLog - @Operation(summary = "批量删除运费模板") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopExpressTemplateService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateDetailController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateDetailController.java deleted file mode 100644 index 6c1553d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopExpressTemplateDetailController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopExpressTemplateDetailService; -import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; -import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 运费模板控制器 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Tag(name = "运费模板管理") -@RestController -@RequestMapping("/api/shop/shop-express-template-detail") -public class ShopExpressTemplateDetailController extends BaseController { - @Resource - private ShopExpressTemplateDetailService shopExpressTemplateDetailService; - - @Operation(summary = "分页查询运费模板") - @GetMapping("/page") - public ApiResult> page(ShopExpressTemplateDetailParam param) { - // 使用关联查询 - return success(shopExpressTemplateDetailService.pageRel(param)); - } - - @Operation(summary = "查询全部运费模板") - @GetMapping() - public ApiResult> list(ShopExpressTemplateDetailParam param) { - // 使用关联查询 - return success(shopExpressTemplateDetailService.listRel(param)); - } - - @Operation(summary = "根据id查询运费模板") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopExpressTemplateDetailService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:save')") - @OperationLog - @Operation(summary = "添加运费模板") - @PostMapping() - public ApiResult save(@RequestBody ShopExpressTemplateDetail shopExpressTemplateDetail) { - if (shopExpressTemplateDetailService.save(shopExpressTemplateDetail)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:update')") - @OperationLog - @Operation(summary = "修改运费模板") - @PutMapping() - public ApiResult update(@RequestBody ShopExpressTemplateDetail shopExpressTemplateDetail) { - if (shopExpressTemplateDetailService.updateById(shopExpressTemplateDetail)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:remove')") - @OperationLog - @Operation(summary = "删除运费模板") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopExpressTemplateDetailService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:save')") - @OperationLog - @Operation(summary = "批量添加运费模板") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopExpressTemplateDetailService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:update')") - @OperationLog - @Operation(summary = "批量修改运费模板") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopExpressTemplateDetailService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopExpressTemplateDetail:remove')") - @OperationLog - @Operation(summary = "批量删除运费模板") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopExpressTemplateDetailService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java deleted file mode 100644 index 66f5023..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGiftController.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.io.FileUtil; -import cn.hutool.core.util.RandomUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.core.config.ConfigProperties; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.FileRecord; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.service.ShopGiftService; -import com.gxwebsoft.shop.entity.ShopGift; -import com.gxwebsoft.shop.param.ShopGiftParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.service.ShopGoodsService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.apache.poi.xssf.streaming.SXSSFRow; -import org.apache.poi.xssf.streaming.SXSSFSheet; -import org.apache.poi.xssf.streaming.SXSSFWorkbook; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; -import java.io.FileOutputStream; -import java.io.IOException; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * 礼品卡控制器 - * - * @author 科技小王子 - * @since 2025-08-11 18:07:32 - */ -@Tag(name = "礼品卡管理") -@RestController -@RequestMapping("/api/shop/shop-gift") -public class ShopGiftController extends BaseController { - @Resource - private ShopGiftService shopGiftService; - @Value("${config.upload-path}") - private String uploadPath; - @Value("${config.api-url}") - private String apiUrl; - @Resource - private ShopGoodsService shopGoodsService; - - @Operation(summary = "根据code查询礼品卡") - @GetMapping("/by-code/{code}") - public ApiResult get(@PathVariable("code") String code) { - // 使用关联查询 - return success(shopGiftService.getByCode(code)); - } - - @Operation(summary = "礼品卡核销") - @PostMapping("/set-take") - public ApiResult setTake(@RequestBody ShopGift shopGift) { - if (getLoginUser() == null) return fail("请登录"); - if (shopGift.getCode() == null) { - return fail("非法请求"); - } - ShopGift shopGift1 = shopGiftService.getByCode(shopGift.getCode()); - if (shopGift1 == null) return fail("礼品卡不存在"); - if (shopGift1.getTakeTime() != null) { - return fail("礼品卡已使用"); - } - shopGift1.setTakeTime(LocalDateTime.now()); - shopGift1.setOperatorUserId(getLoginUserId()); - shopGiftService.updateById(shopGift1); - return success(); - } - - @PreAuthorize("hasAuthority('shop:shopGift:list')") - @Operation(summary = "分页查询礼品卡") - @GetMapping("/page") - public ApiResult> page(ShopGiftParam param) { - // 使用关联查询 - return success(shopGiftService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGift:list')") - @Operation(summary = "查询全部礼品卡") - @GetMapping() - public ApiResult> list(ShopGiftParam param) { - // 使用关联查询 - return success(shopGiftService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGift:list')") - @Operation(summary = "根据id查询礼品卡") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGiftService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGift:save')") - @OperationLog - @Operation(summary = "添加礼品卡") - @PostMapping() - public ApiResult save(@RequestBody ShopGift shopGift) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGift.setUserId(loginUser.getUserId()); - } - if (shopGiftService.save(shopGift)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:update')") - @OperationLog - @Operation(summary = "修改礼品卡") - @PutMapping() - public ApiResult update(@RequestBody ShopGift shopGift) { - if (shopGiftService.updateById(shopGift)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:save')") - @OperationLog - @Operation(summary = "批量生成礼品卡") - @PostMapping("/make") - public ApiResult make(@RequestBody ShopGift shopGiftData) { - if (shopGiftData.getNum() == null || shopGiftData.getNum() <= 0) { - return fail("请输入正确的数量"); - } - if (shopGiftData.getGoodsId() == null || shopGiftData.getGoodsId() <= 0) { - return fail("请选择商品"); - } - List giftList = new ArrayList<>(); - for (int i = 0; i < shopGiftData.getNum(); i++) { - ShopGift shopGift = new ShopGift(); - shopGift.setName(shopGiftData.getName()); - shopGift.setCode(RandomUtil.randomString(8)); - shopGift.setGoodsId(shopGiftData.getGoodsId()); - shopGift.setUseLocation(shopGiftData.getUseLocation()); - shopGift.setComments(shopGiftData.getComments()); - giftList.add(shopGift); - } - if (shopGiftService.saveBatch(giftList)) { - return success("生成成功"); - } - return fail("生成失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:remove')") - @OperationLog - @Operation(summary = "删除礼品卡") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGiftService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:save')") - @OperationLog - @Operation(summary = "批量添加礼品卡") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGiftService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:update')") - @OperationLog - @Operation(summary = "批量修改礼品卡") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGiftService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:remove')") - @OperationLog - @Operation(summary = "批量删除礼品卡") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGiftService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGift:list')") - @Operation(summary = "导出礼品卡") - @PostMapping("/export") - public ApiResult export(@RequestBody(required = false) List ids) throws IOException { - String filename = "excel/礼品卡.xlsx"; - if (!FileUtil.exist(uploadPath + "excel")) { - FileUtil.mkdir(uploadPath + "excel"); - } - List list; - if (ids != null && !ids.isEmpty()) { - list = shopGiftService.listByIds(ids); - } else { - list = shopGiftService.list(); - } - if (!list.isEmpty()) { - Set goodsIds = list.stream().map(ShopGift::getGoodsId).collect(Collectors.toSet()); - List goodsList = shopGoodsService.listByIds(goodsIds); - for (ShopGift shopGift : list) { - ShopGoods shopGoods = goodsList.stream().filter(sG -> sG.getGoodsId().equals(shopGift.getGoodsId())).findFirst().orElse(null); - if (shopGoods != null) { - shopGift.setGoods(shopGoods); - } - } - } - String path = uploadPath + filename; - SXSSFWorkbook workbook = new SXSSFWorkbook(); - //创建工作表单 - SXSSFSheet sheet = workbook.createSheet(); - String[] headers = {"名称", "秘钥", "领取时间", "商品"}; - - SXSSFRow row0 = sheet.createRow(0); - for (int i = 0; i < headers.length; i++) { - row0.createCell(i).setCellValue(headers[i]); - } - if (!list.isEmpty()) { - for (ShopGift shopGift : list) { - SXSSFRow row = sheet.createRow(sheet.getLastRowNum() + 1); - row.createCell(0).setCellValue(shopGift.getName()); - row.createCell(1).setCellValue(shopGift.getCode()); - row.createCell(2).setCellValue(shopGift.getTakeTime()); - row.createCell(3).setCellValue(shopGift.getGoods() != null ? shopGift.getGoods().getName() : ""); - } - } - FileOutputStream output = new FileOutputStream(path); - workbook.write(output); - output.flush(); - - FileRecord result = new FileRecord(); - result.setCreateUserId(getLoginUserId()); - result.setName("礼品卡"); - result.setPath(filename); - result.setUrl(apiUrl + "/" + filename); - return success(result); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCategoryController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCategoryController.java deleted file mode 100644 index 49077a7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCategoryController.java +++ /dev/null @@ -1,128 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsCategoryService; -import com.gxwebsoft.shop.entity.ShopGoodsCategory; -import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品分类控制器 - * - * @author 科技小王子 - * @since 2025-05-01 00:36:45 - */ -@Tag(name = "商品分类管理") -@RestController -@RequestMapping("/api/shop/shop-goods-category") -public class ShopGoodsCategoryController extends BaseController { - @Resource - private ShopGoodsCategoryService shopGoodsCategoryService; - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:list')") - @Operation(summary = "分页查询商品分类") - @GetMapping("/page") - public ApiResult> page(ShopGoodsCategoryParam param) { - // 使用关联查询 - return success(shopGoodsCategoryService.pageRel(param)); - } - - @Operation(summary = "查询全部商品分类") - @GetMapping() - public ApiResult> list(ShopGoodsCategoryParam param) { - // 使用关联查询 - return success(shopGoodsCategoryService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:list')") - @Operation(summary = "根据id查询商品分类") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsCategoryService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:save')") - @OperationLog - @Operation(summary = "添加商品分类") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsCategory shopGoodsCategory) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoodsCategory.setUserId(loginUser.getUserId()); - } - if (shopGoodsCategoryService.save(shopGoodsCategory)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:update')") - @OperationLog - @Operation(summary = "修改商品分类") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsCategory shopGoodsCategory) { - if (shopGoodsCategoryService.updateById(shopGoodsCategory)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:remove')") - @OperationLog - @Operation(summary = "删除商品分类") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsCategoryService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:save')") - @OperationLog - @Operation(summary = "批量添加商品分类") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsCategoryService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:update')") - @OperationLog - @Operation(summary = "批量修改商品分类") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsCategoryService, "category_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsCategory:remove')") - @OperationLog - @Operation(summary = "批量删除商品分类") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsCategoryService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCommentController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCommentController.java deleted file mode 100644 index 7f370af..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsCommentController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsCommentService; -import com.gxwebsoft.shop.entity.ShopGoodsComment; -import com.gxwebsoft.shop.param.ShopGoodsCommentParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 评论表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "评论表管理") -@RestController -@RequestMapping("/api/shop/shop-goods-comment") -public class ShopGoodsCommentController extends BaseController { - @Resource - private ShopGoodsCommentService shopGoodsCommentService; - - @Operation(summary = "分页查询评论表") - @GetMapping("/page") - public ApiResult> page(ShopGoodsCommentParam param) { - // 使用关联查询 - return success(shopGoodsCommentService.pageRel(param)); - } - - @Operation(summary = "查询全部评论表") - @GetMapping() - public ApiResult> list(ShopGoodsCommentParam param) { - // 使用关联查询 - return success(shopGoodsCommentService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsComment:list')") - @Operation(summary = "根据id查询评论表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsCommentService.getByIdRel(id)); - } - - @Operation(summary = "添加评论表") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsComment shopGoodsComment) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoodsComment.setUserId(loginUser.getUserId()); - } - if (shopGoodsCommentService.save(shopGoodsComment)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改评论表") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsComment shopGoodsComment) { - if (shopGoodsCommentService.updateById(shopGoodsComment)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除评论表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsCommentService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加评论表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsCommentService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改评论表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsCommentService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除评论表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsCommentService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsController.java deleted file mode 100644 index 4074e63..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsController.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsService; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.param.ShopGoodsParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 商品控制器 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Tag(name = "商品管理") -@RestController -@RequestMapping("/api/shop/shop-goods") -public class ShopGoodsController extends BaseController { - @Resource - private ShopGoodsService shopGoodsService; - - @Operation(summary = "分页查询商品") - @GetMapping("/page") - public ApiResult> page(ShopGoodsParam param) { - // 使用关联查询 - return success(shopGoodsService.pageRel(param)); - } - - @Operation(summary = "查询全部商品") - @GetMapping() - public ApiResult> list(ShopGoodsParam param) { - // 使用关联查询 - return success(shopGoodsService.listRel(param)); - } - - @Operation(summary = "根据id查询商品") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGoods:save')") - @OperationLog - @Operation(summary = "添加商品") - @PostMapping() - public ApiResult save(@RequestBody ShopGoods shopGoods) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoods.setUserId(loginUser.getUserId()); - } - if (shopGoodsService.save(shopGoods)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoods:update')") - @OperationLog - @Operation(summary = "修改商品") - @PutMapping() - public ApiResult update(@RequestBody ShopGoods shopGoods) { - if (shopGoodsService.updateById(shopGoods)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoods:remove')") - @OperationLog - @Operation(summary = "删除商品") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoods:save')") - @OperationLog - @Operation(summary = "批量添加商品") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoods:update')") - @OperationLog - @Operation(summary = "批量修改商品") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsService, "goods_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoods:remove')") - @OperationLog - @Operation(summary = "批量删除商品") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "统计信息") - @GetMapping("/data") - public ApiResult> data(ShopGoodsParam param) { - Map data = new HashMap<>(); - final LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - - if (param.getMerchantId() != null) { - wrapper.eq(ShopGoods::getMerchantId,param.getMerchantId()); - } - - long totalNum = shopGoodsService.count( - wrapper.eq(ShopGoods::getStatus,0).gt(ShopGoods::getStock,0) - ); - data.put("totalNum", Math.toIntExact(totalNum)); - wrapper.clear(); - - long totalNum2 = shopGoodsService.count( - wrapper.gt(ShopGoods::getStatus,0) - ); - data.put("totalNum2", Math.toIntExact(totalNum2)); - wrapper.clear(); - - long totalNum3 = shopGoodsService.count( - wrapper.eq(ShopGoods::getStock,0) - ); - data.put("totalNum3", Math.toIntExact(totalNum3)); - wrapper.clear(); - - // 下架已售罄的商品 - shopGoodsService.update(new LambdaUpdateWrapper().eq(ShopGoods::getStock,0).set(ShopGoods::getStatus,1)); - - return success(data); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsIncomeConfigController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsIncomeConfigController.java deleted file mode 100644 index 1e91159..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsIncomeConfigController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsIncomeConfigService; -import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; -import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 分润配置控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "分润配置管理") -@RestController -@RequestMapping("/api/shop/shop-goods-income-config") -public class ShopGoodsIncomeConfigController extends BaseController { - @Resource - private ShopGoodsIncomeConfigService shopGoodsIncomeConfigService; - - @Operation(summary = "分页查询分润配置") - @GetMapping("/page") - public ApiResult> page(ShopGoodsIncomeConfigParam param) { - // 使用关联查询 - return success(shopGoodsIncomeConfigService.pageRel(param)); - } - - @Operation(summary = "查询全部分润配置") - @GetMapping() - public ApiResult> list(ShopGoodsIncomeConfigParam param) { - // 使用关联查询 - return success(shopGoodsIncomeConfigService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsIncomeConfig:list')") - @Operation(summary = "根据id查询分润配置") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsIncomeConfigService.getByIdRel(id)); - } - - @Operation(summary = "添加分润配置") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsIncomeConfig shopGoodsIncomeConfig) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoodsIncomeConfig.setUserId(loginUser.getUserId()); - } - if (shopGoodsIncomeConfigService.save(shopGoodsIncomeConfig)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改分润配置") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsIncomeConfig shopGoodsIncomeConfig) { - if (shopGoodsIncomeConfigService.updateById(shopGoodsIncomeConfig)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除分润配置") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsIncomeConfigService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加分润配置") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsIncomeConfigService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改分润配置") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsIncomeConfigService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除分润配置") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsIncomeConfigService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsLogController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsLogController.java deleted file mode 100644 index 2a46786..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsLogController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsLogService; -import com.gxwebsoft.shop.entity.ShopGoodsLog; -import com.gxwebsoft.shop.param.ShopGoodsLogParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品日志表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商品日志表管理") -@RestController -@RequestMapping("/api/shop/shop-goods-log") -public class ShopGoodsLogController extends BaseController { - @Resource - private ShopGoodsLogService shopGoodsLogService; - - @Operation(summary = "分页查询商品日志表") - @GetMapping("/page") - public ApiResult> page(ShopGoodsLogParam param) { - // 使用关联查询 - return success(shopGoodsLogService.pageRel(param)); - } - - @Operation(summary = "查询全部商品日志表") - @GetMapping() - public ApiResult> list(ShopGoodsLogParam param) { - // 使用关联查询 - return success(shopGoodsLogService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsLog:list')") - @Operation(summary = "根据id查询商品日志表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsLogService.getByIdRel(id)); - } - - @Operation(summary = "添加商品日志表") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsLog shopGoodsLog) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoodsLog.setUserId(loginUser.getUserId()); - } - if (shopGoodsLogService.save(shopGoodsLog)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改商品日志表") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsLog shopGoodsLog) { - if (shopGoodsLogService.updateById(shopGoodsLog)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商品日志表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsLogService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商品日志表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsLogService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商品日志表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsLogService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商品日志表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsLogService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRelationController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRelationController.java deleted file mode 100644 index 5e0d57c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRelationController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsRelationService; -import com.gxwebsoft.shop.entity.ShopGoodsRelation; -import com.gxwebsoft.shop.param.ShopGoodsRelationParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品点赞和收藏表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商品点赞和收藏表管理") -@RestController -@RequestMapping("/api/shop/shop-goods-relation") -public class ShopGoodsRelationController extends BaseController { - @Resource - private ShopGoodsRelationService shopGoodsRelationService; - - @Operation(summary = "分页查询商品点赞和收藏表") - @GetMapping("/page") - public ApiResult> page(ShopGoodsRelationParam param) { - // 使用关联查询 - return success(shopGoodsRelationService.pageRel(param)); - } - - @Operation(summary = "查询全部商品点赞和收藏表") - @GetMapping() - public ApiResult> list(ShopGoodsRelationParam param) { - // 使用关联查询 - return success(shopGoodsRelationService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRelation:list')") - @Operation(summary = "根据id查询商品点赞和收藏表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsRelationService.getByIdRel(id)); - } - - @Operation(summary = "添加商品点赞和收藏表") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsRelation shopGoodsRelation) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopGoodsRelation.setUserId(loginUser.getUserId()); - } - if (shopGoodsRelationService.save(shopGoodsRelation)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改商品点赞和收藏表") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsRelation shopGoodsRelation) { - if (shopGoodsRelationService.updateById(shopGoodsRelation)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商品点赞和收藏表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsRelationService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商品点赞和收藏表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsRelationService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商品点赞和收藏表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsRelationService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商品点赞和收藏表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsRelationService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRoleCommissionController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRoleCommissionController.java deleted file mode 100644 index 21508e2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsRoleCommissionController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsRoleCommissionService; -import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; -import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品绑定角色的分润金额控制器 - * - * @author 科技小王子 - * @since 2025-05-01 09:53:38 - */ -@Tag(name = "商品绑定角色的分润金额管理") -@RestController -@RequestMapping("/api/shop/shop-goods-role-commission") -public class ShopGoodsRoleCommissionController extends BaseController { - @Resource - private ShopGoodsRoleCommissionService shopGoodsRoleCommissionService; - - @Operation(summary = "分页查询商品绑定角色的分润金额") - @GetMapping("/page") - public ApiResult> page(ShopGoodsRoleCommissionParam param) { - // 使用关联查询 - return success(shopGoodsRoleCommissionService.pageRel(param)); - } - - @Operation(summary = "查询全部商品绑定角色的分润金额") - @GetMapping() - public ApiResult> list(ShopGoodsRoleCommissionParam param) { - // 使用关联查询 - return success(shopGoodsRoleCommissionService.listRel(param)); - } - - @Operation(summary = "根据id查询商品绑定角色的分润金额") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsRoleCommissionService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:save')") - @OperationLog - @Operation(summary = "添加商品绑定角色的分润金额") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsRoleCommission shopGoodsRoleCommission) { - if (shopGoodsRoleCommissionService.save(shopGoodsRoleCommission)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:update')") - @OperationLog - @Operation(summary = "修改商品绑定角色的分润金额") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsRoleCommission shopGoodsRoleCommission) { - if (shopGoodsRoleCommissionService.updateById(shopGoodsRoleCommission)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:remove')") - @OperationLog - @Operation(summary = "删除商品绑定角色的分润金额") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsRoleCommissionService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:save')") - @OperationLog - @Operation(summary = "批量添加商品绑定角色的分润金额") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsRoleCommissionService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:update')") - @OperationLog - @Operation(summary = "批量修改商品绑定角色的分润金额") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsRoleCommissionService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsRoleCommission:remove')") - @OperationLog - @Operation(summary = "批量删除商品绑定角色的分润金额") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsRoleCommissionService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSkuController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSkuController.java deleted file mode 100644 index 2884bdc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSkuController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsSkuService; -import com.gxwebsoft.shop.entity.ShopGoodsSku; -import com.gxwebsoft.shop.param.ShopGoodsSkuParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品sku列表控制器 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Tag(name = "商品sku列表管理") -@RestController -@RequestMapping("/api/shop/shop-goods-sku") -public class ShopGoodsSkuController extends BaseController { - @Resource - private ShopGoodsSkuService shopGoodsSkuService; - - @Operation(summary = "分页查询商品sku列表") - @GetMapping("/page") - public ApiResult> page(ShopGoodsSkuParam param) { - // 使用关联查询 - return success(shopGoodsSkuService.pageRel(param)); - } - - @Operation(summary = "查询全部商品sku列表") - @GetMapping() - public ApiResult> list(ShopGoodsSkuParam param) { - // 使用关联查询 - return success(shopGoodsSkuService.listRel(param)); - } - - @Operation(summary = "根据id查询商品sku列表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsSkuService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSku:save')") - @OperationLog - @Operation(summary = "添加商品sku列表") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsSku shopGoodsSku) { - if (shopGoodsSkuService.save(shopGoodsSku)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSku:update')") - @OperationLog - @Operation(summary = "修改商品sku列表") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsSku shopGoodsSku) { - if (shopGoodsSkuService.updateById(shopGoodsSku)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSku:remove')") - @OperationLog - @Operation(summary = "删除商品sku列表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsSkuService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSku:save')") - @OperationLog - @Operation(summary = "批量添加商品sku列表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsSkuService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSku:update')") - @OperationLog - @Operation(summary = "批量修改商品sku列表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsSkuService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSku:remove')") - @OperationLog - @Operation(summary = "批量删除商品sku列表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsSkuService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSpecController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSpecController.java deleted file mode 100644 index 398430e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopGoodsSpecController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopGoodsSpecService; -import com.gxwebsoft.shop.entity.ShopGoodsSpec; -import com.gxwebsoft.shop.param.ShopGoodsSpecParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品多规格控制器 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Tag(name = "商品多规格管理") -@RestController -@RequestMapping("/api/shop/shop-goods-spec") -public class ShopGoodsSpecController extends BaseController { - @Resource - private ShopGoodsSpecService shopGoodsSpecService; - - @Operation(summary = "分页查询商品多规格") - @GetMapping("/page") - public ApiResult> page(ShopGoodsSpecParam param) { - // 使用关联查询 - return success(shopGoodsSpecService.pageRel(param)); - } - - @Operation(summary = "查询全部商品多规格") - @GetMapping() - public ApiResult> list(ShopGoodsSpecParam param) { - // 使用关联查询 - return success(shopGoodsSpecService.listRel(param)); - } - - @Operation(summary = "根据id查询商品多规格") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopGoodsSpecService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSpec:save')") - @OperationLog - @Operation(summary = "添加商品多规格") - @PostMapping() - public ApiResult save(@RequestBody ShopGoodsSpec shopGoodsSpec) { - if (shopGoodsSpecService.save(shopGoodsSpec)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSpec:update')") - @OperationLog - @Operation(summary = "修改商品多规格") - @PutMapping() - public ApiResult update(@RequestBody ShopGoodsSpec shopGoodsSpec) { - if (shopGoodsSpecService.updateById(shopGoodsSpec)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSpec:remove')") - @OperationLog - @Operation(summary = "删除商品多规格") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopGoodsSpecService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSpec:save')") - @OperationLog - @Operation(summary = "批量添加商品多规格") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopGoodsSpecService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSpec:update')") - @OperationLog - @Operation(summary = "批量修改商品多规格") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopGoodsSpecService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopGoodsSpec:remove')") - @OperationLog - @Operation(summary = "批量删除商品多规格") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopGoodsSpecService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java deleted file mode 100644 index 5b96b22..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMainController.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.util.ObjectUtil; -import com.gxwebsoft.cms.entity.CmsWebsite; -import com.gxwebsoft.cms.service.CmsWebsiteService; -import com.gxwebsoft.shop.service.ShopWebsiteService; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.vo.ShopVo; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * 商城主入口 - * - * @author 科技小王子 - * @since 2024-09-10 20:36:14 - */ -@Slf4j -@Tag(name = "商城") -@RestController -@RequestMapping("/api/shop") -public class ShopMainController extends BaseController { - @Resource - private ShopWebsiteService shopWebsiteService; - - @Operation(summary = "商城基本信息", description = "获取商城的基本信息,包括配置、导航、设置和过期状态等") - @GetMapping("/getShopInfo") - public ApiResult getShopInfo() { - Integer tenantId = getTenantId(); - - if (ObjectUtil.isEmpty(tenantId)) { - return fail("租户ID不能为空", null); - } - - try { - // 使用专门的商城信息获取方法 - ShopVo shopVo = shopWebsiteService.getShopInfo(tenantId); -// log.debug("获取商城信息成功: {}", shopVo); - return success(shopVo); - } catch (IllegalArgumentException e) { - return fail(e.getMessage(), null); - } catch (RuntimeException e) { - return fail(e.getMessage(), null); - } catch (Exception e) { - log.error("获取商城信息失败", e); - return fail("获取商城信息失败", null); - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantAccountController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantAccountController.java deleted file mode 100644 index 3e5ca19..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantAccountController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopMerchantAccountService; -import com.gxwebsoft.shop.entity.ShopMerchantAccount; -import com.gxwebsoft.shop.param.ShopMerchantAccountParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商户账号控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商户账号管理") -@RestController -@RequestMapping("/api/shop/shop-merchant-account") -public class ShopMerchantAccountController extends BaseController { - @Resource - private ShopMerchantAccountService shopMerchantAccountService; - - @Operation(summary = "分页查询商户账号") - @GetMapping("/page") - public ApiResult> page(ShopMerchantAccountParam param) { - // 使用关联查询 - return success(shopMerchantAccountService.pageRel(param)); - } - - @Operation(summary = "查询全部商户账号") - @GetMapping() - public ApiResult> list(ShopMerchantAccountParam param) { - // 使用关联查询 - return success(shopMerchantAccountService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopMerchantAccount:list')") - @Operation(summary = "根据id查询商户账号") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopMerchantAccountService.getByIdRel(id)); - } - - @Operation(summary = "添加商户账号") - @PostMapping() - public ApiResult save(@RequestBody ShopMerchantAccount shopMerchantAccount) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopMerchantAccount.setUserId(loginUser.getUserId()); - } - if (shopMerchantAccountService.save(shopMerchantAccount)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改商户账号") - @PutMapping() - public ApiResult update(@RequestBody ShopMerchantAccount shopMerchantAccount) { - if (shopMerchantAccountService.updateById(shopMerchantAccount)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商户账号") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopMerchantAccountService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商户账号") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopMerchantAccountService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商户账号") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopMerchantAccountService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商户账号") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopMerchantAccountService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantApplyController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantApplyController.java deleted file mode 100644 index 3b5d1cc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantApplyController.java +++ /dev/null @@ -1,192 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.util.ObjectUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopMerchant; -import com.gxwebsoft.shop.entity.ShopMerchantAccount; -import com.gxwebsoft.shop.service.ShopMerchantApplyService; -import com.gxwebsoft.shop.entity.ShopMerchantApply; -import com.gxwebsoft.shop.param.ShopMerchantApplyParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.service.ShopMerchantService; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.beans.BeanUtils; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商户入驻申请控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商户入驻申请管理") -@RestController -@RequestMapping("/api/shop/shop-merchant-apply") -public class ShopMerchantApplyController extends BaseController { - @Resource - private ShopMerchantApplyService shopMerchantApplyService; - @Resource - private ShopMerchantService shopMerchantService; - - @Operation(summary = "分页查询商户入驻申请") - @GetMapping("/page") - public ApiResult> page(ShopMerchantApplyParam param) { - // 使用关联查询 - return success(shopMerchantApplyService.pageRel(param)); - } - - @Operation(summary = "查询全部商户入驻申请") - @GetMapping() - public ApiResult> list(ShopMerchantApplyParam param) { - // 使用关联查询 - return success(shopMerchantApplyService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopMerchantApply:list')") - @Operation(summary = "根据id查询商户入驻申请") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopMerchantApplyService.getByIdRel(id)); - } - - @Operation(summary = "添加商户入驻申请") - @PostMapping() - public ApiResult save(@RequestBody ShopMerchantApply shopMerchantApply) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopMerchantApply.setUserId(loginUser.getUserId()); - if(shopMerchantApplyService.count(new LambdaQueryWrapper().eq(ShopMerchantApply::getPhone,shopMerchantApply.getPhone())) > 0){ - return fail("该手机号码已存在"); - } - // 个人开发者认证材料:使用姓名+身份证号码 - if (shopMerchantApply.getType().equals(0)) { - shopMerchantApply.setMerchantName(shopMerchantApply.getRealName()); - shopMerchantApply.setMerchantCode(shopMerchantApply.getIdCard()); - } - shopMerchantApply.setCheckStatus(true); - shopMerchantApply.setTenantId(loginUser.getTenantId()); - if (shopMerchantApplyService.save(shopMerchantApply)) { - return success("您的申请已提交,请耐心等待工作人员的审核,非常感谢"); - } - } - return fail("提交失败"); - } - - @Operation(summary = "修改商户入驻申请") - @PutMapping() - public ApiResult update(@RequestBody ShopMerchantApply shopMerchantApply) { - if (shopMerchantApplyService.updateById(shopMerchantApply)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商户入驻申请") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopMerchantApplyService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商户入驻申请") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopMerchantApplyService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商户入驻申请") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopMerchantApplyService, "apply_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商户入驻申请") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopMerchantApplyService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "我的入驻信息") - @GetMapping("/getByUserId") - public ApiResult getByUserId() { - final User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录", null); - } - final ShopMerchantApply shopMerchantApply = shopMerchantApplyService.getOne(new LambdaQueryWrapper().eq(ShopMerchantApply::getUserId, getLoginUser().getUserId()).last("limit 1")); - return success(shopMerchantApply); - } - - @PreAuthorize("hasAuthority('shop:shopMerchantApply:update')") - @Operation(summary = "入驻审核") - @PutMapping("/check") - public ApiResult check(@RequestBody ShopMerchantApply shopMerchantApply) { - // 审核中? - shopMerchantApply.setCheckStatus(true); - // TODO 审核通过则创建商户 - if (shopMerchantApply.getStatus().equals(1)) { - final ShopMerchant one = shopMerchantService.getOne(new LambdaQueryWrapper().eq(ShopMerchant::getPhone, shopMerchantApply.getPhone()).last("limit 1")); - final ShopMerchantAccount merchantAccount = new ShopMerchantAccount(); - BeanUtils.copyProperties(shopMerchantApply, merchantAccount); - - final User user = new User(); - - if (ObjectUtil.isNotEmpty(one)) { - BeanUtils.copyProperties(shopMerchantApply, one); - one.setStatus(0); - shopMerchantService.updateById(one); - user.setRealName(shopMerchantApply.getRealName()); - } else { - final ShopMerchant merchant = new ShopMerchant(); - BeanUtils.copyProperties(shopMerchantApply, merchant); - merchant.setStatus(0); - shopMerchantService.save(merchant); - user.setRealName(shopMerchantApply.getRealName()); - } - - // TODO 创建商户账号 - // TODO 更新用户表的商户信息 - user.setUserId(shopMerchantApply.getUserId()); - shopMerchantApplyService.updateById(shopMerchantApply); - // TODO 入驻开发者中心(添加会员) - return success("操作成功"); - } - // TODO 驳回 - if (shopMerchantApply.getStatus().equals(2)) { - shopMerchantApply.setCheckStatus(false); - shopMerchantApplyService.updateById(shopMerchantApply); - return success("操作成功"); - } - // 审核状态 - shopMerchantApply.setStatus(0); - if (shopMerchantApplyService.updateById(shopMerchantApply)) { - return success("您的申请已提交,请耐心等待工作人员的审核,非常感谢"); - } - return fail("操作失败"); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantController.java deleted file mode 100644 index b95105b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopMerchantService; -import com.gxwebsoft.shop.entity.ShopMerchant; -import com.gxwebsoft.shop.param.ShopMerchantParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商户控制器 - * - * @author 科技小王子 - * @since 2025-08-10 20:43:33 - */ -@Tag(name = "商户管理") -@RestController -@RequestMapping("/api/shop/shop-merchant") -public class ShopMerchantController extends BaseController { - @Resource - private ShopMerchantService shopMerchantService; - - @Operation(summary = "分页查询商户") - @GetMapping("/page") - public ApiResult> page(ShopMerchantParam param) { - // 使用关联查询 - return success(shopMerchantService.pageRel(param)); - } - - @Operation(summary = "查询全部商户") - @GetMapping() - public ApiResult> list(ShopMerchantParam param) { - // 使用关联查询 - return success(shopMerchantService.listRel(param)); - } - - @Operation(summary = "根据id查询商户") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Long id) { - // 使用关联查询 - return success(shopMerchantService.getByIdRel(id)); - } - - @Operation(summary = "添加商户") - @PostMapping() - public ApiResult save(@RequestBody ShopMerchant shopMerchant) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopMerchant.setUserId(loginUser.getUserId()); - } - if (shopMerchantService.save(shopMerchant)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopMerchant:update')") - @OperationLog - @Operation(summary = "修改商户") - @PutMapping() - public ApiResult update(@RequestBody ShopMerchant shopMerchant) { - if (shopMerchantService.updateById(shopMerchant)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopMerchant:remove')") - @OperationLog - @Operation(summary = "删除商户") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopMerchantService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopMerchant:save')") - @OperationLog - @Operation(summary = "批量添加商户") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopMerchantService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopMerchant:update')") - @OperationLog - @Operation(summary = "批量修改商户") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopMerchantService, "merchant_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopMerchant:remove')") - @OperationLog - @Operation(summary = "批量删除商户") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopMerchantService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantTypeController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantTypeController.java deleted file mode 100644 index 4bdac19..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopMerchantTypeController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopMerchantTypeService; -import com.gxwebsoft.shop.entity.ShopMerchantType; -import com.gxwebsoft.shop.param.ShopMerchantTypeParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商户类型控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商户类型管理") -@RestController -@RequestMapping("/api/shop/shop-merchant-type") -public class ShopMerchantTypeController extends BaseController { - @Resource - private ShopMerchantTypeService shopMerchantTypeService; - - @Operation(summary = "分页查询商户类型") - @GetMapping("/page") - public ApiResult> page(ShopMerchantTypeParam param) { - // 使用关联查询 - return success(shopMerchantTypeService.pageRel(param)); - } - - @Operation(summary = "查询全部商户类型") - @GetMapping() - public ApiResult> list(ShopMerchantTypeParam param) { - // 使用关联查询 - return success(shopMerchantTypeService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopMerchantType:list')") - @Operation(summary = "根据id查询商户类型") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopMerchantTypeService.getByIdRel(id)); - } - - @Operation(summary = "添加商户类型") - @PostMapping() - public ApiResult save(@RequestBody ShopMerchantType shopMerchantType) { - if (shopMerchantTypeService.save(shopMerchantType)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改商户类型") - @PutMapping() - public ApiResult update(@RequestBody ShopMerchantType shopMerchantType) { - if (shopMerchantTypeService.updateById(shopMerchantType)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商户类型") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopMerchantTypeService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商户类型") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopMerchantTypeService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商户类型") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopMerchantTypeService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商户类型") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopMerchantTypeService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java deleted file mode 100644 index dd2fe13..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java +++ /dev/null @@ -1,696 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.date.DateField; -import cn.hutool.core.date.DateUtil; -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.NumberUtil; -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.gxwebsoft.common.core.config.ConfigProperties; -import com.gxwebsoft.common.core.config.CertificateProperties; -import com.gxwebsoft.common.core.utils.RedisUtil; -import com.gxwebsoft.common.core.utils.CertificateLoader; -import com.gxwebsoft.common.core.utils.WechatCertAutoConfig; -import com.gxwebsoft.common.core.utils.WechatPayConfigValidator; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.system.entity.Payment; -import com.gxwebsoft.shop.entity.ShopExpress; -import com.gxwebsoft.shop.entity.ShopOrderDelivery; -import com.gxwebsoft.shop.entity.ShopUserAddress; -import com.gxwebsoft.shop.service.*; -import com.gxwebsoft.shop.service.impl.KuaiDi100Impl; -import com.gxwebsoft.shop.task.OrderAutoCancelTask; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.param.ShopOrderParam; -import com.gxwebsoft.shop.dto.OrderCreateRequest; -import com.gxwebsoft.shop.dto.UpdatePaymentStatusRequest; -import com.gxwebsoft.payment.service.PaymentService; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.system.entity.User; -import com.kuaidi100.sdk.request.BOrderReq; -import com.wechat.pay.java.core.notification.NotificationConfig; -import com.wechat.pay.java.core.notification.NotificationParser; -import com.wechat.pay.java.core.notification.RequestParam; -import com.wechat.pay.java.core.RSAAutoCertificateConfig; -import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.Operation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 订单控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "订单管理") -@RestController -@RequestMapping("/api/shop/shop-order") -public class ShopOrderController extends BaseController { - private static final Logger logger = LoggerFactory.getLogger(ShopOrderController.class); - @Resource - private ShopOrderService shopOrderService; - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - @Resource - private OrderBusinessService orderBusinessService; - @Resource - private OrderCancelService orderCancelService; - @Resource - private OrderAutoCancelTask orderAutoCancelTask; - @Resource - private RedisUtil redisUtil; - @Resource - private ConfigProperties conf; - @Resource - private CertificateProperties certConfig; - @Resource - private CertificateLoader certificateLoader; - @Resource - private WechatCertAutoConfig wechatCertAutoConfig; - @Resource - private WechatPayConfigValidator wechatPayConfigValidator; - @Value("${spring.profiles.active}") - String active; - @Resource - private KuaiDi100Impl kuaiDi100; - @Resource - private ShopExpressService expressService; - @Resource - private ShopUserAddressService shopUserAddressService; - @Resource - private ShopOrderDeliveryService shopOrderDeliveryService; - @Resource - private PaymentService paymentService; - - @Operation(summary = "分页查询订单") - @GetMapping("/page") - public ApiResult> page(ShopOrderParam param) { - // 使用关联查询 - return success(shopOrderService.pageRel(param)); - } - - @Operation(summary = "查询全部订单") - @GetMapping() - public ApiResult> list(ShopOrderParam param) { - // 使用关联查询 - return success(shopOrderService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrder:list')") - @Operation(summary = "根据id查询订单") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderService.getByIdRel(id)); - } - - @Operation(summary = "添加订单") - @PostMapping() - public ApiResult save(@RequestBody OrderCreateRequest request) { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("用户未登录"); - } - - try { - Map wxOrderInfo = orderBusinessService.createOrder(request, loginUser); - return success("下单成功", wxOrderInfo); - } catch (Exception e) { - logger.error("创建订单失败 - 用户ID:{},请求:{}", loginUser.getUserId(), request, e); - return fail(e.getMessage()); - } - } - - @Operation(summary = "添加订单(兼容旧版本)") - @PostMapping("/legacy") - public ApiResult saveLegacy(@RequestBody ShopOrder shopOrder) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopOrder.setUserId(loginUser.getUserId()); - shopOrder.setOpenid(loginUser.getOpenid()); - shopOrder.setPayUserId(loginUser.getUserId()); - if (shopOrder.getOrderNo() == null) { - shopOrder.setOrderNo(Long.toString(IdUtil.getSnowflakeNextId())); - } - if (shopOrder.getComments() == null) { - shopOrder.setComments("暂无"); - } - // 微信支付(商品金额不能为0) - if (shopOrder.getTotalPrice().compareTo(BigDecimal.ZERO) == 0) { - return fail("商品金额不能为0"); - } - // 百色中学项目捐赠金额不能低于20元 - if (shopOrder.getTenantId().equals(10324) && shopOrder.getTotalPrice().compareTo(new BigDecimal("10")) < 0) { - return fail("捐款金额最低不能少于10元,感谢您的爱心捐赠^_^"); - } - // 测试支付 - if (loginUser.getPhone().equals("13737128880")) { - shopOrder.setPrice(new BigDecimal("0.01")); - shopOrder.setTotalPrice(new BigDecimal("0.01")); - } - if (shopOrderService.save(shopOrder)) { - return success("下单成功", shopOrderService.createWxOrder(shopOrder)); - } - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopOrder:update')") - @Operation(summary = "修改订单") - @PutMapping() - public ApiResult update(@RequestBody ShopOrder shopOrder) throws Exception { - // 1. 验证订单是否可以退款 - if (shopOrder == null) { - return fail("订单不存在"); - } - ShopOrder shopOrderNow = shopOrderService.getById(shopOrder.getOrderId()); - // 申请退款 - if (shopOrder.getOrderStatus().equals(4)) { - shopOrder.setRefundApplyTime(LocalDateTime.now()); - } - if (shopOrderNow.getDeliveryStatus().equals(10) && shopOrder.getDeliveryStatus().equals(20)) { - ShopOrderDelivery shopOrderDelivery = new ShopOrderDelivery(); - shopOrderDelivery.setOrderId(shopOrder.getOrderId()); - shopOrderDelivery.setDeliveryMethod(30); - shopOrderDelivery.setExpressId(shopOrder.getExpressId()); - shopOrderDelivery.setSendName(shopOrder.getSendName()); - shopOrderDelivery.setSendPhone(shopOrder.getSendPhone()); - shopOrderDelivery.setSendAddress(shopOrder.getSendAddress()); - shopOrderDeliveryService.save(shopOrderDelivery); - - shopOrderDeliveryService.setExpress(getLoginUser(), shopOrderDelivery, shopOrder); - - } - // 退款操作 - if(shopOrder.getOrderStatus().equals(6)){ - // 当订单状态更改为6(已退款)时,执行退款操作 - try { - - // 检查订单是否已支付 - if (!shopOrder.getPayStatus()) { - return fail("订单未支付,无法退款"); - } - - // 检查是否已经退款过了 - if (StrUtil.isNotBlank(shopOrderNow.getRefundOrder())) { - logger.warn("订单已经退款过,订单号: {}, 退款单号: {}", shopOrderNow.getOrderNo(), shopOrderNow.getRefundOrder()); - return fail("订单已退款,请勿重复操作"); - } - - // 2. 生成退款单号 - String refundNo = "RF" + IdUtil.getSnowflakeNextId(); - - // 3. 确定退款金额(默认全额退款) - BigDecimal refundAmount = shopOrder.getRefundMoney(); - if (refundAmount == null || refundAmount.compareTo(BigDecimal.ZERO) <= 0) { - // 如果没有指定退款金额,使用订单实付金额 - refundAmount = shopOrderNow.getTotalPrice(); - } - - // 验证退款金额不能大于订单金额 - if (refundAmount.compareTo(shopOrderNow.getTotalPrice()) > 0) { - return fail("退款金额不能大于订单金额"); - } - - // 4. 确定支付类型(默认为微信Native支付) - PaymentType paymentType = PaymentType.WECHAT_NATIVE; - if (shopOrderNow.getPayType() != null) { - // 根据订单的支付类型确定 - // 支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付 - paymentType = PaymentType.getByCode(shopOrderNow.getPayType()); - - // 如果是微信支付,需要根据微信支付子类型确定具体的支付方式 - if (paymentType == PaymentType.WECHAT) { - // 目前统一使用WECHAT_NATIVE进行退款 - paymentType = PaymentType.WECHAT_NATIVE; - } - } - - // 5. 调用统一支付服务的退款接口 - logger.info("开始处理订单退款 - 订单号: {}, 退款单号: {}, 退款金额: {}, 支付方式: {}", - shopOrderNow.getOrderNo(), refundNo, refundAmount, paymentType); - - PaymentResponse refundResponse = paymentService.refund( - shopOrderNow.getOrderNo(), // 原订单号 - refundNo, // 退款单号 - paymentType, // 支付方式 - shopOrderNow.getTotalPrice(), // 订单总金额 - refundAmount, // 退款金额 - shopOrder.getRefundReason() != null ? shopOrder.getRefundReason() : "用户申请退款", // 退款原因 - shopOrderNow.getTenantId() // 租户ID - ); - - // 6. 处理退款结果 - if (refundResponse.getSuccess()) { - // 退款成功,更新订单信息 - shopOrder.setRefundOrder(refundNo); - shopOrder.setRefundMoney(refundAmount); - shopOrder.setRefundTime(LocalDateTime.now()); - shopOrder.setOrderStatus(6); // 退款成功 - - // 根据退款状态决定订单状态 - // 如果微信返回退款处理中,则设置订单状态为5(退款处理中) - // 如果微信返回退款成功,则保持状态为6(退款成功) -// if (refundResponse.getPaymentStatus() != null) { -// switch (refundResponse.getPaymentStatus()) { -// case REFUNDING: -// shopOrder.setOrderStatus(5); // 退款处理中 -// logger.info("订单退款处理中,订单号: {}, 退款单号: {}", shopOrderNow.getOrderNo(), refundNo); -// break; -// case REFUNDED: -// shopOrder.setOrderStatus(6); // 退款成功 -// logger.info("订单退款成功,订单号: {}, 退款单号: {}", shopOrderNow.getOrderNo(), refundNo); -// break; -// case REFUND_FAILED: -// logger.error("订单退款失败,订单号: {}, 退款单号: {}", shopOrderNow.getOrderNo(), refundNo); -// return fail("退款失败,请联系管理员"); -// default: -// shopOrder.setOrderStatus(5); // 默认为退款处理中 -// } -// } - - logger.info("订单退款请求成功 - 订单号: {}, 退款单号: {}, 微信退款单号: {}", - shopOrderNow.getOrderNo(), refundNo, refundResponse.getTransactionId()); - } else { - // 退款失败 - logger.error("订单退款失败 - 订单号: {}, 错误: {}", shopOrderNow.getOrderNo(), refundResponse.getErrorMessage()); - return fail("退款失败: " + refundResponse.getErrorMessage()); - } - - } catch (Exception e) { - logger.error("处理订单退款异常 - 订单号: {}, 错误: {}", shopOrderNow.getOrderNo(), e.getMessage(), e); - return fail("退款处理异常: " + e.getMessage()); - } - } - if (shopOrderService.updateById(shopOrder)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除订单") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加订单") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改订单") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderService, "order_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除订单") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "修复订单") - @PutMapping("/repair") - public ApiResult repair(@RequestBody ShopOrder shopOrder) { - final ShopOrder order = shopOrderService.getByOutTradeNo(shopOrder.getOrderNo()); - if (order != null) { - shopOrderService.queryOrderByOutTradeNo(order); - return success("修复成功"); - } - return fail("修复失败"); - } - - @Operation(summary = "统计订单总金额") - @GetMapping("/total") - public ApiResult total() { - return success(shopOrderService.total()); - } - - @Operation(summary = "取消订单") - @PutMapping("/cancel/{id}") - public ApiResult cancelOrder(@PathVariable("id") Integer id) { - try { - User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("用户未登录"); - } - - ShopOrder order = shopOrderService.getById(id); - if (order == null) { - return fail("订单不存在"); - } - - // 检查订单是否属于当前用户(非管理员用户) - if (!loginUser.getUserId().equals(order.getUserId()) && - !hasOrderCancelAuthority()) { - return fail("无权限取消此订单"); - } - - // 检查订单状态 - if (order.getPayStatus() != null && order.getPayStatus()) { - return fail("订单已支付,无法取消"); - } - - if (order.getOrderStatus() != null && order.getOrderStatus() != 0) { - return fail("订单状态不允许取消"); - } - - boolean success = orderCancelService.cancelOrder(order); - if (success) { - return success("订单取消成功"); - } else { - return fail("订单取消失败"); - } - - } catch (Exception e) { - logger.error("取消订单失败,订单ID:{}", id, e); - return fail("取消订单失败:" + e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('shop:shopOrder:manage')") - @Operation(summary = "手动触发订单自动取消任务(管理员)") - @PostMapping("/auto-cancel/trigger") - public ApiResult triggerAutoCancelTask() { - try { - orderAutoCancelTask.manualCancelExpiredOrders(); - return success("自动取消任务已触发"); - } catch (Exception e) { - logger.error("触发自动取消任务失败", e); - return fail("触发失败:" + e.getMessage()); - } - } - - @PreAuthorize("hasAuthority('shop:shopOrder:manage')") - @Operation(summary = "获取自动取消任务状态(管理员)") - @GetMapping("/auto-cancel/status") - public ApiResult getAutoCancelTaskStatus() { - try { - String status = orderAutoCancelTask.getTaskStatus(); - return success(status); - } catch (Exception e) { - logger.error("获取自动取消任务状态失败", e); - return fail("获取状态失败:" + e.getMessage()); - } - } - - @Schema(description = "异步通知11") - @PostMapping("/notify/{tenantId}") - public String wxNotify(@RequestHeader Map header, @RequestBody String body, @PathVariable("tenantId") Integer tenantId) { - logger.info("异步通知*************** = " + tenantId); - - // 获取支付配置信息用于解密 - String key = "Payment:1:".concat(tenantId.toString()); - Payment payment = redisUtil.get(key, Payment.class); - - // 检查支付配置 - if (ObjectUtil.isEmpty(payment)) { - throw new RuntimeException("未找到租户支付配置信息,租户ID: " + tenantId); - } - - logger.info("开始处理微信支付异步通知 - 租户ID: {}", tenantId); - logger.info("支付配置信息 - 商户号: {}, 应用ID: {}", payment.getMchId(), payment.getAppId()); - - // 验证微信支付配置 - WechatPayConfigValidator.ValidationResult validation = wechatPayConfigValidator.validateWechatPayConfig(payment, tenantId); - if (!validation.isValid()) { - logger.error("❌ 微信支付配置验证失败: {}", validation.getErrors()); - logger.info("📋 配置诊断报告:\n{}", wechatPayConfigValidator.generateDiagnosticReport(payment, tenantId)); - throw new RuntimeException("微信支付配置验证失败: " + validation.getErrors()); - } - logger.info("✅ 微信支付配置验证通过"); - - RequestParam requestParam = new RequestParam.Builder() - .serialNumber(header.get("wechatpay-serial")) - .nonce(header.get("wechatpay-nonce")) - .signature(header.get("wechatpay-signature")) - .timestamp(header.get("wechatpay-timestamp")) - .body(body) - .build(); - - // 创建通知配置 - 使用与下单方法相同的证书配置逻辑 - NotificationConfig config; - try { - if (active.equals("dev")) { - // 开发环境 - 构建包含租户号的私钥路径 - String tenantCertPath = "dev/wechat/" + tenantId; - String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); - - logger.info("开发环境异步通知证书路径: {}", privateKeyPath); - logger.info("租户ID: {}, 证书目录: {}", tenantId, tenantCertPath); - - // 检查证书文件是否存在 - if (!certificateLoader.certificateExists(privateKeyPath)) { - logger.error("证书文件不存在: {}", privateKeyPath); - throw new RuntimeException("证书文件不存在: " + privateKeyPath); - } - - String privateKey = certificateLoader.loadCertificatePath(privateKeyPath); - - // 使用验证器获取有效的 APIv3 密钥 - String apiV3Key = wechatPayConfigValidator.getValidApiV3Key(payment); - - logger.info("私钥文件加载成功: {}", privateKey); - logger.info("使用APIv3密钥来源: {}", payment.getApiKey() != null && !payment.getApiKey().trim().isEmpty() ? "数据库配置" : "配置文件默认"); - logger.info("APIv3密钥长度: {}", apiV3Key != null ? apiV3Key.length() : 0); - logger.info("商户证书序列号: {}", payment.getMerchantSerialNumber()); - - // 使用自动证书配置 - config = new RSAAutoCertificateConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(apiV3Key) - .build(); - - logger.info("✅ 开发环境使用自动证书配置创建通知解析器成功"); - } else { - // 生产环境 - 使用自动证书配置 - final String certRootPath = certConfig.getCertRootPath(); - logger.info("生产环境证书根路径: {}", certRootPath); - - String privateKeyRelativePath = payment.getApiclientKey(); - logger.info("数据库中的私钥相对路径: {}", privateKeyRelativePath); - - // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 - String privateKeyFullPath; - // 处理数据库中可能存在的历史路径格式 - String cleanPath = privateKeyRelativePath; - if (privateKeyRelativePath.startsWith("/file/")) { - // 去掉历史的 /file/ 前缀 - cleanPath = privateKeyRelativePath.substring(6); - } else if (privateKeyRelativePath.startsWith("file/")) { - // 去掉历史的 file/ 前缀 - cleanPath = privateKeyRelativePath.substring(5); - } - // 确保路径以 / 开头 - if (!cleanPath.startsWith("/")) { - cleanPath = "/" + cleanPath; - } - privateKeyFullPath = certRootPath + cleanPath; - - logger.info("生产环境私钥完整路径: {}", privateKeyFullPath); - String privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); - String apiV3Key = payment.getApiKey(); - - // 使用自动证书配置 - config = new RSAAutoCertificateConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(apiV3Key) - .build(); - - logger.info("✅ 生产环境使用自动证书配置创建通知解析器成功"); - } - } catch (Exception e) { - logger.error("❌ 创建通知配置失败 - 租户ID: {}, 商户号: {}", tenantId, payment.getMchId(), e); - logger.error("🔍 错误详情: {}", e.getMessage()); - logger.error("💡 请检查:"); - logger.error("1. 证书文件是否存在且路径正确"); - logger.error("2. APIv3密钥是否配置正确"); - logger.error("3. 商户证书序列号是否正确"); - logger.error("4. 网络连接是否正常"); - throw new RuntimeException("微信支付通知配置失败: " + e.getMessage(), e); - } - - // 初始化 NotificationParser - NotificationParser parser = new NotificationParser(config); - logger.info("✅ 通知解析器创建成功,准备解析异步通知"); - - // 以支付通知回调为例,验签、解密并转换成 Transaction - try { - logger.info("开始解析微信支付异步通知..."); - Transaction transaction = parser.parse(requestParam, Transaction.class); - logger.info("✅ 异步通知解析成功 - 交易状态: {}, 商户订单号: {}", - transaction.getTradeStateDesc(), transaction.getOutTradeNo()); - - if (StrUtil.equals("支付成功", transaction.getTradeStateDesc())) { - final String outTradeNo = transaction.getOutTradeNo(); - final String transactionId = transaction.getTransactionId(); - final Integer total = transaction.getAmount().getTotal(); - final String tradeStateDesc = transaction.getTradeStateDesc(); - final Transaction.TradeStateEnum tradeState = transaction.getTradeState(); - final Transaction.TradeTypeEnum tradeType = transaction.getTradeType(); - System.out.println("transaction = " + transaction); - System.out.println("tradeStateDesc = " + tradeStateDesc); - System.out.println("tradeType = " + tradeType); - System.out.println("tradeState = " + tradeState); - System.out.println("outTradeNo = " + outTradeNo); - System.out.println("amount = " + total); - // 1. 查询要处理的订单 - ShopOrder order = shopOrderService.getByOutTradeNo(outTradeNo); - logger.info("查询要处理的订单order = " + order); - // 2. 已支付则跳过 - if (order.getPayStatus().equals(true)) { - return "SUCCESS"; - } - // 2. 未支付则处理更新订单状态 - if (order.getPayStatus().equals(false)) { - // 5. TODO 处理订单状态 - order.setPayTime(LocalDateTime.now()); - order.setExpirationTime(order.getCreateTime()); - order.setPayStatus(true); - order.setTransactionId(transactionId); - order.setPayPrice(new BigDecimal(NumberUtil.decimalFormat("0.00", total * 0.01))); - order.setExpirationTime(LocalDateTime.now().plusYears(10)); - System.out.println("实际付款金额 = " + order.getPayPrice()); - // 更新订单状态并处理支付成功后的业务逻辑(包括累加商品销量) - shopOrderService.updateByOutTradeNo(order); - return "SUCCESS"; - } - } - } catch (Exception e) { - logger.error("❌ 处理微信支付异步通知失败 - 租户ID: {}, 商户号: {}", tenantId, payment.getMchId(), e); - logger.error("🔍 异常详情: {}", e.getMessage()); - logger.error("💡 可能的原因:"); - logger.error("1. 证书配置错误或证书文件损坏"); - logger.error("2. 微信支付平台证书已过期"); - logger.error("3. 签名验证失败"); - logger.error("4. 请求参数格式错误"); - - // 返回失败,微信会重试 - return "fail"; - } - - logger.warn("⚠️ 异步通知处理完成但未找到匹配的支付成功状态"); - return "fail"; - } - - @Operation(summary = "更新订单支付状态", description = "用户支付成功后主动同步订单状态") - @PutMapping("/payment-status") - public ApiResult updateOrderPaymentStatus(@RequestBody UpdatePaymentStatusRequest request) { - logger.info("收到更新订单支付状态请求: orderNo={}, paymentStatus={}, transactionId={}", - request.getOrderNo(), request.getPaymentStatus(), request.getTransactionId()); - - final User loginUser = getLoginUser(); - if (loginUser == null) { - return fail("请先登录"); - } - - try { - // 参数验证 - if (StrUtil.isBlank(request.getOrderNo())) { - return fail("订单号不能为空"); - } - - // 查询订单 - ShopOrder order = shopOrderService.getByOrderNo(request.getOrderNo(), loginUser.getTenantId()); - if (order == null) { - return fail("订单不存在"); - } - - // 权限验证:只能更新自己的订单 - if (!order.getUserId().equals(loginUser.getUserId())) { - return fail("无权限操作此订单"); - } - - // 如果订单已经是支付成功状态,直接返回成功 - if (order.getPayStatus()) { - logger.info("订单已经是支付成功状态,无需更新: orderNo={}", request.getOrderNo()); - return success("订单状态已是最新"); - } - - // 调用支付状态同步服务 - boolean updated = shopOrderService.syncPaymentStatus( - request.getOrderNo(), - request.getPaymentStatus(), - request.getTransactionId(), - request.getPayTime(), - loginUser.getTenantId() - ); - - if (updated) { - logger.info("订单支付状态更新成功: orderNo={}, paymentStatus={}", - request.getOrderNo(), request.getPaymentStatus()); - return success("订单状态更新成功"); - } else { - logger.warn("订单支付状态更新失败: orderNo={}", request.getOrderNo()); - return fail("订单状态更新失败"); - } - - } catch (Exception e) { - logger.error("更新订单支付状态异常: orderNo={}, error={}", request.getOrderNo(), e.getMessage(), e); - return fail("更新订单状态失败: " + e.getMessage()); - } - } - - /** - * 检查是否有订单取消权限 - */ - private boolean hasOrderCancelAuthority() { - try { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication == null) { - return false; - } - - // 检查是否有管理员权限 - return authentication.getAuthorities().stream() - .anyMatch(authority -> - authority.getAuthority().equals("shop:shopOrder:cancel") || - authority.getAuthority().equals("shop:shopOrder:update") || - authority.getAuthority().equals("ROLE_ADMIN") || - authority.getAuthority().equals("shop:shopOrder:manage")); - } catch (Exception e) { - logger.warn("检查订单取消权限时发生异常", e); - return false; - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryController.java deleted file mode 100644 index a6e5405..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryController.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.*; -import com.gxwebsoft.shop.service.ShopOrderDeliveryService; -import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.kuaidi100.sdk.response.SubscribeResp; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Map; - -/** - * 发货单控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "发货单管理") -@RestController -@RequestMapping("/api/shop/shop-order-delivery") -public class ShopOrderDeliveryController extends BaseController { - @Resource - private ShopOrderDeliveryService shopOrderDeliveryService; - - - @Operation(summary = "发货回调") - @PostMapping("/notify") - @GetMapping("/notify") - public SubscribeResp notify(@RequestBody Map data) { - System.out.println("快递100回调:" + data); - SubscribeResp subscribeResp = new SubscribeResp(); - subscribeResp.setResult(Boolean.TRUE); - subscribeResp.setReturnCode("200"); - subscribeResp.setMessage("成功"); - return subscribeResp; - } - - @Operation(summary = "分页查询发货单") - @GetMapping("/page") - public ApiResult> page(ShopOrderDeliveryParam param) { - // 使用关联查询 - return success(shopOrderDeliveryService.pageRel(param)); - } - - @Operation(summary = "查询全部发货单") - @GetMapping() - public ApiResult> list(ShopOrderDeliveryParam param) { - // 使用关联查询 - return success(shopOrderDeliveryService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrderDelivery:list')") - @Operation(summary = "根据id查询发货单") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderDeliveryService.getByIdRel(id)); - } - - @Operation(summary = "添加发货单") - @PostMapping() - public ApiResult save(@RequestBody ShopOrderDelivery shopOrderDelivery) { - if (shopOrderDeliveryService.save(shopOrderDelivery)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改发货单") - @PutMapping() - public ApiResult update(@RequestBody ShopOrderDelivery shopOrderDelivery) { - if (shopOrderDeliveryService.updateById(shopOrderDelivery)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除发货单") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderDeliveryService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加发货单") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderDeliveryService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改发货单") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderDeliveryService, "delivery_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除发货单") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderDeliveryService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryGoodsController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryGoodsController.java deleted file mode 100644 index 760becb..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderDeliveryGoodsController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopOrderDeliveryGoodsService; -import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; -import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 发货单商品控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "发货单商品管理") -@RestController -@RequestMapping("/api/shop/shop-order-delivery-goods") -public class ShopOrderDeliveryGoodsController extends BaseController { - @Resource - private ShopOrderDeliveryGoodsService shopOrderDeliveryGoodsService; - - @Operation(summary = "分页查询发货单商品") - @GetMapping("/page") - public ApiResult> page(ShopOrderDeliveryGoodsParam param) { - // 使用关联查询 - return success(shopOrderDeliveryGoodsService.pageRel(param)); - } - - @Operation(summary = "查询全部发货单商品") - @GetMapping() - public ApiResult> list(ShopOrderDeliveryGoodsParam param) { - // 使用关联查询 - return success(shopOrderDeliveryGoodsService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrderDeliveryGoods:list')") - @Operation(summary = "根据id查询发货单商品") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderDeliveryGoodsService.getByIdRel(id)); - } - - @Operation(summary = "添加发货单商品") - @PostMapping() - public ApiResult save(@RequestBody ShopOrderDeliveryGoods shopOrderDeliveryGoods) { - if (shopOrderDeliveryGoodsService.save(shopOrderDeliveryGoods)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改发货单商品") - @PutMapping() - public ApiResult update(@RequestBody ShopOrderDeliveryGoods shopOrderDeliveryGoods) { - if (shopOrderDeliveryGoodsService.updateById(shopOrderDeliveryGoods)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除发货单商品") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderDeliveryGoodsService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加发货单商品") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderDeliveryGoodsService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改发货单商品") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderDeliveryGoodsService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除发货单商品") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderDeliveryGoodsService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderExtractController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderExtractController.java deleted file mode 100644 index 5b89db0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderExtractController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopOrderExtractService; -import com.gxwebsoft.shop.entity.ShopOrderExtract; -import com.gxwebsoft.shop.param.ShopOrderExtractParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 自提订单联系方式控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "自提订单联系方式管理") -@RestController -@RequestMapping("/api/shop/shop-order-extract") -public class ShopOrderExtractController extends BaseController { - @Resource - private ShopOrderExtractService shopOrderExtractService; - - @Operation(summary = "分页查询自提订单联系方式") - @GetMapping("/page") - public ApiResult> page(ShopOrderExtractParam param) { - // 使用关联查询 - return success(shopOrderExtractService.pageRel(param)); - } - - @Operation(summary = "查询全部自提订单联系方式") - @GetMapping() - public ApiResult> list(ShopOrderExtractParam param) { - // 使用关联查询 - return success(shopOrderExtractService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrderExtract:list')") - @Operation(summary = "根据id查询自提订单联系方式") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderExtractService.getByIdRel(id)); - } - - @Operation(summary = "添加自提订单联系方式") - @PostMapping() - public ApiResult save(@RequestBody ShopOrderExtract shopOrderExtract) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopOrderExtract.setUserId(loginUser.getUserId()); - } - if (shopOrderExtractService.save(shopOrderExtract)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改自提订单联系方式") - @PutMapping() - public ApiResult update(@RequestBody ShopOrderExtract shopOrderExtract) { - if (shopOrderExtractService.updateById(shopOrderExtract)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除自提订单联系方式") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderExtractService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加自提订单联系方式") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderExtractService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改自提订单联系方式") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderExtractService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除自提订单联系方式") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderExtractService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderGoodsController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderGoodsController.java deleted file mode 100644 index cc01666..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderGoodsController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.param.ShopOrderGoodsParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 商品信息控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "商品信息管理") -@RestController -@RequestMapping("/api/shop/shop-order-goods") -public class ShopOrderGoodsController extends BaseController { - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - - @Operation(summary = "分页查询商品信息") - @GetMapping("/page") - public ApiResult> page(ShopOrderGoodsParam param) { - // 使用关联查询 - return success(shopOrderGoodsService.pageRel(param)); - } - - @Operation(summary = "查询全部商品信息") - @GetMapping() - public ApiResult> list(ShopOrderGoodsParam param) { - // 使用关联查询 - return success(shopOrderGoodsService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrderGoods:list')") - @Operation(summary = "根据id查询商品信息") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderGoodsService.getByIdRel(id)); - } - - @Operation(summary = "添加商品信息") - @PostMapping() - public ApiResult save(@RequestBody ShopOrderGoods shopOrderGoods) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopOrderGoods.setUserId(loginUser.getUserId()); - } - if (shopOrderGoodsService.save(shopOrderGoods)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改商品信息") - @PutMapping() - public ApiResult update(@RequestBody ShopOrderGoods shopOrderGoods) { - if (shopOrderGoodsService.updateById(shopOrderGoods)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除商品信息") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderGoodsService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加商品信息") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderGoodsService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改商品信息") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderGoodsService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除商品信息") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderGoodsService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoController.java deleted file mode 100644 index e9f91d8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopOrderInfoService; -import com.gxwebsoft.shop.entity.ShopOrderInfo; -import com.gxwebsoft.shop.param.ShopOrderInfoParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 场地控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "场地管理") -@RestController -@RequestMapping("/api/shop/shop-order-info") -public class ShopOrderInfoController extends BaseController { - @Resource - private ShopOrderInfoService shopOrderInfoService; - - @Operation(summary = "分页查询场地") - @GetMapping("/page") - public ApiResult> page(ShopOrderInfoParam param) { - // 使用关联查询 - return success(shopOrderInfoService.pageRel(param)); - } - - @Operation(summary = "查询全部场地") - @GetMapping() - public ApiResult> list(ShopOrderInfoParam param) { - // 使用关联查询 - return success(shopOrderInfoService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrderInfo:list')") - @Operation(summary = "根据id查询场地") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderInfoService.getByIdRel(id)); - } - - @Operation(summary = "添加场地") - @PostMapping() - public ApiResult save(@RequestBody ShopOrderInfo shopOrderInfo) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopOrderInfo.setUserId(loginUser.getUserId()); - } - if (shopOrderInfoService.save(shopOrderInfo)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改场地") - @PutMapping() - public ApiResult update(@RequestBody ShopOrderInfo shopOrderInfo) { - if (shopOrderInfoService.updateById(shopOrderInfo)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除场地") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderInfoService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加场地") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderInfoService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改场地") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderInfoService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除场地") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderInfoService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoLogController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoLogController.java deleted file mode 100644 index b9c62b6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopOrderInfoLogController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopOrderInfoLogService; -import com.gxwebsoft.shop.entity.ShopOrderInfoLog; -import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 订单核销控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "订单核销管理") -@RestController -@RequestMapping("/api/shop/shop-order-info-log") -public class ShopOrderInfoLogController extends BaseController { - @Resource - private ShopOrderInfoLogService shopOrderInfoLogService; - - @Operation(summary = "分页查询订单核销") - @GetMapping("/page") - public ApiResult> page(ShopOrderInfoLogParam param) { - // 使用关联查询 - return success(shopOrderInfoLogService.pageRel(param)); - } - - @Operation(summary = "查询全部订单核销") - @GetMapping() - public ApiResult> list(ShopOrderInfoLogParam param) { - // 使用关联查询 - return success(shopOrderInfoLogService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopOrderInfoLog:list')") - @Operation(summary = "根据id查询订单核销") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopOrderInfoLogService.getByIdRel(id)); - } - - @Operation(summary = "添加订单核销") - @PostMapping() - public ApiResult save(@RequestBody ShopOrderInfoLog shopOrderInfoLog) { - if (shopOrderInfoLogService.save(shopOrderInfoLog)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改订单核销") - @PutMapping() - public ApiResult update(@RequestBody ShopOrderInfoLog shopOrderInfoLog) { - if (shopOrderInfoLogService.updateById(shopOrderInfoLog)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除订单核销") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopOrderInfoLogService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加订单核销") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopOrderInfoLogService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改订单核销") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopOrderInfoLogService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除订单核销") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopOrderInfoLogService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopRechargeOrderController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopRechargeOrderController.java deleted file mode 100644 index 1525208..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopRechargeOrderController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopRechargeOrderService; -import com.gxwebsoft.shop.entity.ShopRechargeOrder; -import com.gxwebsoft.shop.param.ShopRechargeOrderParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 会员充值订单表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Tag(name = "会员充值订单表管理") -@RestController -@RequestMapping("/api/shop/shop-recharge-order") -public class ShopRechargeOrderController extends BaseController { - @Resource - private ShopRechargeOrderService shopRechargeOrderService; - - @Operation(summary = "分页查询会员充值订单表") - @GetMapping("/page") - public ApiResult> page(ShopRechargeOrderParam param) { - // 使用关联查询 - return success(shopRechargeOrderService.pageRel(param)); - } - - @Operation(summary = "查询全部会员充值订单表") - @GetMapping() - public ApiResult> list(ShopRechargeOrderParam param) { - // 使用关联查询 - return success(shopRechargeOrderService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopRechargeOrder:list')") - @Operation(summary = "根据id查询会员充值订单表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopRechargeOrderService.getByIdRel(id)); - } - - @Operation(summary = "添加会员充值订单表") - @PostMapping() - public ApiResult save(@RequestBody ShopRechargeOrder shopRechargeOrder) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopRechargeOrder.setUserId(loginUser.getUserId()); - } - if (shopRechargeOrderService.save(shopRechargeOrder)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改会员充值订单表") - @PutMapping() - public ApiResult update(@RequestBody ShopRechargeOrder shopRechargeOrder) { - if (shopRechargeOrderService.updateById(shopRechargeOrder)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除会员充值订单表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopRechargeOrderService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加会员充值订单表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopRechargeOrderService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改会员充值订单表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopRechargeOrderService, "order_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除会员充值订单表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopRechargeOrderService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSpecController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSpecController.java deleted file mode 100644 index 60ddcc8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSpecController.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopSpecService; -import com.gxwebsoft.shop.entity.ShopSpec; -import com.gxwebsoft.shop.param.ShopSpecParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 规格控制器 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Tag(name = "规格管理") -@RestController -@RequestMapping("/api/shop/shop-spec") -public class ShopSpecController extends BaseController { - @Resource - private ShopSpecService shopSpecService; - - @Operation(summary = "分页查询规格") - @GetMapping("/page") - public ApiResult> page(ShopSpecParam param) { - // 使用关联查询 - return success(shopSpecService.pageRel(param)); - } - - @Operation(summary = "查询全部规格") - @GetMapping() - public ApiResult> list(ShopSpecParam param) { - // 使用关联查询 - return success(shopSpecService.listRel(param)); - } - - @Operation(summary = "根据id查询规格") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopSpecService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopSpec:save')") - @OperationLog - @Operation(summary = "添加规格") - @PostMapping() - public ApiResult save(@RequestBody ShopSpec shopSpec) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopSpec.setUserId(loginUser.getUserId()); - } - if (shopSpecService.save(shopSpec)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpec:update')") - @OperationLog - @Operation(summary = "修改规格") - @PutMapping() - public ApiResult update(@RequestBody ShopSpec shopSpec) { - if (shopSpecService.updateById(shopSpec)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpec:remove')") - @OperationLog - @Operation(summary = "删除规格") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopSpecService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpec:save')") - @OperationLog - @Operation(summary = "批量添加规格") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopSpecService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpec:update')") - @OperationLog - @Operation(summary = "批量修改规格") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopSpecService, "spec_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpec:remove')") - @OperationLog - @Operation(summary = "批量删除规格") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopSpecService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSpecValueController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSpecValueController.java deleted file mode 100644 index 6d98bb3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSpecValueController.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopSpecValueService; -import com.gxwebsoft.shop.entity.ShopSpecValue; -import com.gxwebsoft.shop.param.ShopSpecValueParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 规格值控制器 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Tag(name = "规格值管理") -@RestController -@RequestMapping("/api/shop/shop-spec-value") -public class ShopSpecValueController extends BaseController { - @Resource - private ShopSpecValueService shopSpecValueService; - - @Operation(summary = "分页查询规格值") - @GetMapping("/page") - public ApiResult> page(ShopSpecValueParam param) { - // 使用关联查询 - return success(shopSpecValueService.pageRel(param)); - } - - @Operation(summary = "查询全部规格值") - @GetMapping() - public ApiResult> list(ShopSpecValueParam param) { - // 使用关联查询 - return success(shopSpecValueService.listRel(param)); - } - - @Operation(summary = "根据id查询规格值") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopSpecValueService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopSpecValue:save')") - @OperationLog - @Operation(summary = "添加规格值") - @PostMapping() - public ApiResult save(@RequestBody ShopSpecValue shopSpecValue) { - if (shopSpecValueService.save(shopSpecValue)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpecValue:update')") - @OperationLog - @Operation(summary = "修改规格值") - @PutMapping() - public ApiResult update(@RequestBody ShopSpecValue shopSpecValue) { - if (shopSpecValueService.updateById(shopSpecValue)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpecValue:remove')") - @OperationLog - @Operation(summary = "删除规格值") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopSpecValueService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpecValue:save')") - @OperationLog - @Operation(summary = "批量添加规格值") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopSpecValueService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpecValue:update')") - @OperationLog - @Operation(summary = "批量修改规格值") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopSpecValueService, "spec_value_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopSpecValue:remove')") - @OperationLog - @Operation(summary = "批量删除规格值") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopSpecValueService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSplashController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSplashController.java deleted file mode 100644 index d39e628..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopSplashController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopSplashService; -import com.gxwebsoft.shop.entity.ShopSplash; -import com.gxwebsoft.shop.param.ShopSplashParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 开屏广告控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Tag(name = "开屏广告管理") -@RestController -@RequestMapping("/api/shop/shop-splash") -public class ShopSplashController extends BaseController { - @Resource - private ShopSplashService shopSplashService; - - @Operation(summary = "分页查询开屏广告") - @GetMapping("/page") - public ApiResult> page(ShopSplashParam param) { - // 使用关联查询 - return success(shopSplashService.pageRel(param)); - } - - @Operation(summary = "查询全部开屏广告") - @GetMapping() - public ApiResult> list(ShopSplashParam param) { - // 使用关联查询 - return success(shopSplashService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopSplash:list')") - @Operation(summary = "根据id查询开屏广告") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopSplashService.getByIdRel(id)); - } - - @Operation(summary = "添加开屏广告") - @PostMapping() - public ApiResult save(@RequestBody ShopSplash shopSplash) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopSplash.setUserId(loginUser.getUserId()); - } - if (shopSplashService.save(shopSplash)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改开屏广告") - @PutMapping() - public ApiResult update(@RequestBody ShopSplash shopSplash) { - if (shopSplashService.updateById(shopSplash)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除开屏广告") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopSplashService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加开屏广告") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopSplashService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改开屏广告") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopSplashService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除开屏广告") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopSplashService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserAddressController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserAddressController.java deleted file mode 100644 index e2290f9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserAddressController.java +++ /dev/null @@ -1,133 +0,0 @@ - package com.gxwebsoft.shop.controller; - - import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; - import com.gxwebsoft.common.core.web.BaseController; - import com.gxwebsoft.shop.service.ShopUserAddressService; - import com.gxwebsoft.shop.entity.ShopUserAddress; - import com.gxwebsoft.shop.param.ShopUserAddressParam; - import com.gxwebsoft.common.core.web.ApiResult; - import com.gxwebsoft.common.core.web.PageResult; - import com.gxwebsoft.common.core.web.BatchParam; - import com.gxwebsoft.common.core.annotation.OperationLog; - import com.gxwebsoft.common.system.entity.User; - import io.swagger.v3.oas.annotations.tags.Tag; - import io.swagger.v3.oas.annotations.Operation; - import org.springframework.security.access.prepost.PreAuthorize; - import org.springframework.web.bind.annotation.*; - - import javax.annotation.Resource; - import java.util.List; - - /** - * 收货地址控制器 - * - * @author 科技小王子 - * @since 2025-07-22 23:06:40 - */ - @Tag(name = "收货地址管理") - @RestController - @RequestMapping("/api/shop/shop-user-address") - public class ShopUserAddressController extends BaseController { - @Resource - private ShopUserAddressService shopUserAddressService; - - @PreAuthorize("hasAuthority('shop:shopUserAddress:list')") - @Operation(summary = "分页查询收货地址") - @GetMapping("/page") - public ApiResult> page(ShopUserAddressParam param) { - // 使用关联查询 - return success(shopUserAddressService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:list')") - @Operation(summary = "查询全部收货地址") - @GetMapping() - public ApiResult> list(ShopUserAddressParam param) { - // 使用关联查询 - param.setUserId(getLoginUser().getUserId()); - return success(shopUserAddressService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:list')") - @Operation(summary = "根据id查询收货地址") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopUserAddressService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:save')") - @OperationLog - @Operation(summary = "添加收货地址") - @PostMapping() - public ApiResult save(@RequestBody ShopUserAddress shopUserAddress) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopUserAddress.setUserId(loginUser.getUserId()); - if (shopUserAddressService.count(new LambdaQueryWrapper().eq(ShopUserAddress::getUserId, loginUser.getUserId()).eq(ShopUserAddress::getAddress, shopUserAddress.getAddress())) > 0) { - return success("该地址已存在"); - } - } - if (shopUserAddressService.save(shopUserAddress)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:update')") - @OperationLog - @Operation(summary = "修改收货地址") - @PutMapping() - public ApiResult update(@RequestBody ShopUserAddress shopUserAddress) { - if (shopUserAddressService.updateById(shopUserAddress)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:remove')") - @OperationLog - @Operation(summary = "删除收货地址") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopUserAddressService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:save')") - @OperationLog - @Operation(summary = "批量添加收货地址") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopUserAddressService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:update')") - @OperationLog - @Operation(summary = "批量修改收货地址") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopUserAddressService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserAddress:remove')") - @OperationLog - @Operation(summary = "批量删除收货地址") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopUserAddressService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - } diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserBalanceLogController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserBalanceLogController.java deleted file mode 100644 index 0db1573..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserBalanceLogController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopUserBalanceLogService; -import com.gxwebsoft.shop.entity.ShopUserBalanceLog; -import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 用户余额变动明细表控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Tag(name = "用户余额变动明细表管理") -@RestController -@RequestMapping("/api/shop/shop-user-balance-log") -public class ShopUserBalanceLogController extends BaseController { - @Resource - private ShopUserBalanceLogService shopUserBalanceLogService; - - @Operation(summary = "分页查询用户余额变动明细表") - @GetMapping("/page") - public ApiResult> page(ShopUserBalanceLogParam param) { - // 使用关联查询 - return success(shopUserBalanceLogService.pageRel(param)); - } - - @Operation(summary = "查询全部用户余额变动明细表") - @GetMapping() - public ApiResult> list(ShopUserBalanceLogParam param) { - // 使用关联查询 - return success(shopUserBalanceLogService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserBalanceLog:list')") - @Operation(summary = "根据id查询用户余额变动明细表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopUserBalanceLogService.getByIdRel(id)); - } - - @Operation(summary = "添加用户余额变动明细表") - @PostMapping() - public ApiResult save(@RequestBody ShopUserBalanceLog shopUserBalanceLog) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopUserBalanceLog.setUserId(loginUser.getUserId()); - } - if (shopUserBalanceLogService.save(shopUserBalanceLog)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改用户余额变动明细表") - @PutMapping() - public ApiResult update(@RequestBody ShopUserBalanceLog shopUserBalanceLog) { - if (shopUserBalanceLogService.updateById(shopUserBalanceLog)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除用户余额变动明细表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopUserBalanceLogService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加用户余额变动明细表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopUserBalanceLogService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改用户余额变动明细表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopUserBalanceLogService, "log_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除用户余额变动明细表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopUserBalanceLogService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserCollectionController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserCollectionController.java deleted file mode 100644 index 0e01d68..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserCollectionController.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopUserCollectionService; -import com.gxwebsoft.shop.entity.ShopUserCollection; -import com.gxwebsoft.shop.param.ShopUserCollectionParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 我的收藏控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Tag(name = "我的收藏管理") -@RestController -@RequestMapping("/api/shop/shop-user-collection") -public class ShopUserCollectionController extends BaseController { - @Resource - private ShopUserCollectionService shopUserCollectionService; - - @Operation(summary = "分页查询我的收藏") - @GetMapping("/page") - public ApiResult> page(ShopUserCollectionParam param) { - // 使用关联查询 - return success(shopUserCollectionService.pageRel(param)); - } - - @Operation(summary = "查询全部我的收藏") - @GetMapping() - public ApiResult> list(ShopUserCollectionParam param) { - // 使用关联查询 - return success(shopUserCollectionService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserCollection:list')") - @Operation(summary = "根据id查询我的收藏") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopUserCollectionService.getByIdRel(id)); - } - - @Operation(summary = "添加我的收藏") - @PostMapping() - public ApiResult save(@RequestBody ShopUserCollection shopUserCollection) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopUserCollection.setUserId(loginUser.getUserId()); - } - if (shopUserCollectionService.save(shopUserCollection)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改我的收藏") - @PutMapping() - public ApiResult update(@RequestBody ShopUserCollection shopUserCollection) { - if (shopUserCollectionService.updateById(shopUserCollection)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除我的收藏") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopUserCollectionService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加我的收藏") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopUserCollectionService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改我的收藏") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopUserCollectionService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除我的收藏") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopUserCollectionService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserController.java deleted file mode 100644 index 10f53a5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserController.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.entity.ShopUser; -import com.gxwebsoft.shop.param.ShopUserParam; -import com.gxwebsoft.shop.service.ShopUserService; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 用户记录表控制器 - * - * @author 科技小王子 - * @since 2025-10-03 13:41:09 - */ -@Tag(name = "用户记录表管理") -@RestController -@RequestMapping("/api/shop/shop-user") -public class ShopUserController extends BaseController { - @Resource - private ShopUserService shopUserService; - - @PreAuthorize("hasAuthority('shop:shopUser:list')") - @Operation(summary = "分页查询用户记录表") - @GetMapping("/page") - public ApiResult> page(ShopUserParam param) { - // 使用关联查询 - return success(shopUserService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUser:list')") - @Operation(summary = "查询全部用户记录表") - @GetMapping() - public ApiResult> list(ShopUserParam param) { - // 使用关联查询 - return success(shopUserService.listRel(param)); - } - - @Operation(summary = "根据userId查询用户记录表") - @GetMapping("/{userId}") - public ApiResult get(@PathVariable("userId") Integer userId) { - // 使用关联查询 - return success(shopUserService.getByIdRel(userId)); - } - - @PreAuthorize("hasAuthority('shop:shopUser:save')") - @OperationLog - @Operation(summary = "添加用户记录表") - @PostMapping() - public ApiResult save(@RequestBody ShopUser shopUser) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopUser.setUserId(loginUser.getUserId()); - } - if (shopUserService.save(shopUser)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUser:update')") - @OperationLog - @Operation(summary = "修改用户记录表") - @PutMapping() - public ApiResult update(@RequestBody ShopUser shopUser) { - if (shopUserService.updateById(shopUser)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUser:remove')") - @OperationLog - @Operation(summary = "删除用户记录表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopUserService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUser:save')") - @OperationLog - @Operation(summary = "批量添加用户记录表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopUserService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUser:update')") - @OperationLog - @Operation(summary = "批量修改用户记录表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopUserService, "user_id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUser:remove')") - @OperationLog - @Operation(summary = "批量删除用户记录表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopUserService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java deleted file mode 100644 index a9382b2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserCouponController.java +++ /dev/null @@ -1,309 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import cn.hutool.core.date.LocalDateTimeUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.github.yulichang.wrapper.MPJLambdaWrapper; -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.entity.ShopCoupon; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.service.ShopCouponApplyCateService; -import com.gxwebsoft.shop.service.ShopCouponApplyItemService; -import com.gxwebsoft.shop.service.ShopCouponService; -import com.gxwebsoft.shop.service.ShopUserCouponService; -import com.gxwebsoft.shop.service.CouponStatusService; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.param.ShopUserCouponParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.extern.slf4j.Slf4j; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.math.BigDecimal; - -import javax.annotation.Resource; -import java.text.ParseException; -import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; -import java.util.List; - -/** - * 用户优惠券控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Slf4j -@Tag(name = "用户优惠券管理") -@RestController -@RequestMapping("/api/shop/shop-user-coupon") -public class ShopUserCouponController extends BaseController { - @Resource - private ShopUserCouponService shopUserCouponService; - @Resource - private ShopCouponService couponService; - @Resource - private ShopCouponApplyCateService couponApplyCateService; - @Resource - private ShopCouponApplyItemService couponApplyItemService; - @Resource - private CouponStatusService couponStatusService; - - @Operation(summary = "用户优惠券列表") - @PostMapping("/list") - public ApiResult> list(@RequestBody ShopUserCoupon userCouponParam) throws ParseException { - MPJLambdaWrapper queryWrapper = new MPJLambdaWrapper() - .selectAll(ShopUserCoupon.class) - .selectAs(ShopCoupon::getName, ShopCoupon::getName) - .eq(ShopUserCoupon::getUserId, getLoginUserId()) - .leftJoin(ShopCoupon.class, ShopCoupon::getId, ShopUserCoupon::getCouponId); - if (userCouponParam.getIsExpire() != null) - queryWrapper.eq(ShopUserCoupon::getIsExpire, userCouponParam.getIsExpire()); - if (userCouponParam.getIsUse() != null) queryWrapper.eq(ShopUserCoupon::getIsUse, userCouponParam.getIsUse()); - List userCouponList = shopUserCouponService.list(queryWrapper); - for (ShopUserCoupon userCoupon : userCouponList) { - try { - // 使用新的状态管理服务检查和更新状态 - couponStatusService.checkAndUpdateCouponStatus(userCoupon); - - // 确保BigDecimal字段不为null时才处理 - if (userCoupon.getReducePrice() == null) { - userCoupon.setReducePrice(BigDecimal.ZERO); - } - if (userCoupon.getMinPrice() == null) { - userCoupon.setMinPrice(BigDecimal.ZERO); - } - - ShopCoupon coupon = couponService.getById(userCoupon.getCouponId()); - if (coupon != null) { - // 确保优惠券模板的BigDecimal字段不为null - if (coupon.getReducePrice() == null) { - coupon.setReducePrice(BigDecimal.ZERO); - } - if (coupon.getMinPrice() == null) { - coupon.setMinPrice(BigDecimal.ZERO); - } - - coupon.setCouponApplyCateList(couponApplyCateService.list( - new LambdaQueryWrapper() - .eq(ShopCouponApplyCate::getCouponId, userCoupon.getCouponId()) - )); - coupon.setCouponApplyItemList(couponApplyItemService.list( - new LambdaQueryWrapper() - .eq(ShopCouponApplyItem::getCouponId, userCoupon.getCouponId()) - )); - userCoupon.setCouponItem(coupon); - } - } catch (Exception e) { - log.error("处理用户优惠券数据异常: {}", e.getMessage(), e); - // 设置默认值避免序列化异常 - if (userCoupon.getReducePrice() == null) { - userCoupon.setReducePrice(BigDecimal.ZERO); - } - if (userCoupon.getMinPrice() == null) { - userCoupon.setMinPrice(BigDecimal.ZERO); - } - } - } - return success(userCouponList); - } - - @Operation(summary = "领取优惠券") - @PostMapping("/take") - public ApiResult take(@RequestBody ShopUserCoupon userCoupon) { - final User loginUser = getLoginUser(); - if (loginUser == null) return fail("请先登录"); - ShopCoupon coupon = couponService.getByIdRel(userCoupon.getCouponId()); - - // 检查优惠券是否存在 - if (coupon == null) return fail("优惠券不存在"); - - // 安全地检查已领取数量,避免空指针异常 - Integer receiveNum = coupon.getReceiveNum(); - if (receiveNum == null) receiveNum = 0; - - if (coupon.getTotalCount() != -1 && receiveNum >= coupon.getTotalCount()) return fail("已经被领完了"); - List userCouponList = shopUserCouponService.list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getCouponId, userCoupon.getCouponId()) - .eq(ShopUserCoupon::getUserId, getLoginUserId()) - ); - int userNotUsedNum = 0; - for (ShopUserCoupon userCouponItem : userCouponList) { - if (userCouponItem.getIsUse().equals(0)) userNotUsedNum++; - } - if (userNotUsedNum > 0) return fail("您还有未使用的优惠券,无法领取"); - if (coupon.getLimitPerUser() > -1) { - if (userCouponList.size() >= coupon.getLimitPerUser()) - return fail("每用户最多领取" + coupon.getLimitPerUser() + "张优惠券"); - } - userCoupon.setType(coupon.getType()); - userCoupon.setReducePrice(coupon.getReducePrice()); - userCoupon.setDiscount(coupon.getDiscount()); - userCoupon.setMinPrice(coupon.getMinPrice()); - Integer expireType = coupon.getExpireType(); - userCoupon.setExpireType(expireType); - if (expireType == 10) { - userCoupon.setStartTime(LocalDateTime.now()); - userCoupon.setEndTime(LocalDateTimeUtil.offset(userCoupon.getStartTime(), coupon.getExpireDay(), ChronoUnit.DAYS)); - } else { - userCoupon.setStartTime(coupon.getStartTime()); - userCoupon.setEndTime(coupon.getEndTime()); - } - userCoupon.setUserId(getLoginUserId()); - shopUserCouponService.save(userCoupon); - - // 安全地更新已领取数量,避免空指针异常 - Integer currentReceiveNum = coupon.getReceiveNum(); - if (currentReceiveNum == null) currentReceiveNum = 0; - coupon.setReceiveNum(currentReceiveNum + 1); - couponService.updateById(coupon); - return success("领取成功"); - } - - @Operation(summary = "分页查询用户优惠券") - @GetMapping("/page") - public ApiResult> page(ShopUserCouponParam param) { - // 使用关联查询 - return success(shopUserCouponService.pageRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") - @Operation(summary = "查询全部用户优惠券") - @GetMapping() - public ApiResult> list(ShopUserCouponParam param) { - // 使用关联查询 - return success(shopUserCouponService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:list')") - @Operation(summary = "根据id查询用户优惠券") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopUserCouponService.getByIdRel(id)); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:save')") - @OperationLog - @Operation(summary = "添加用户优惠券") - @PostMapping() - public ApiResult save(@RequestBody ShopUserCoupon shopUserCoupon) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopUserCoupon.setUserId(loginUser.getUserId()); - } - if (shopUserCouponService.save(shopUserCoupon)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:update')") - @OperationLog - @Operation(summary = "修改用户优惠券") - @PutMapping() - public ApiResult update(@RequestBody ShopUserCoupon shopUserCoupon) { - if (shopUserCouponService.updateById(shopUserCoupon)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:remove')") - @OperationLog - @Operation(summary = "删除用户优惠券") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopUserCouponService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:save')") - @OperationLog - @Operation(summary = "批量添加用户优惠券") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopUserCouponService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:update')") - @OperationLog - @Operation(summary = "批量修改用户优惠券") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopUserCouponService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserCoupon:remove')") - @OperationLog - @Operation(summary = "批量删除用户优惠券") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopUserCouponService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "获取我的可用优惠券") - @GetMapping("/my/available") - public ApiResult> getMyAvailableCoupons() { - try { - List coupons = couponStatusService.getAvailableCoupons(getLoginUserId()); - return success("获取成功", coupons); - } catch (Exception e) { - return fail("获取失败",null); - } - } - - @Operation(summary = "获取我的已使用优惠券") - @GetMapping("/my/used") - public ApiResult> getMyUsedCoupons() { - try { - List coupons = couponStatusService.getUsedCoupons(getLoginUserId()); - return success("获取成功", coupons); - } catch (Exception e) { - return fail("获取失败",null); - } - } - - @Operation(summary = "获取我的已过期优惠券") - @GetMapping("/my/expired") - public ApiResult> getMyExpiredCoupons() { - try { - List coupons = couponStatusService.getExpiredCoupons(getLoginUserId()); - return success("获取成功", coupons); - } catch (Exception e) { - return fail("获取失败",null); - } - } - - @Operation(summary = "获取我的优惠券统计") - @GetMapping("/my/statistics") - public ApiResult getMyCouponStatistics() { - try { - CouponStatusService.CouponStatusResult result = - couponStatusService.getUserCouponsGroupByStatus(getLoginUserId()); - return success("获取成功", result); - } catch (Exception e) { - return fail("获取失败",null); - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserRefereeController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserRefereeController.java deleted file mode 100644 index 0309be9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopUserRefereeController.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopUserRefereeService; -import com.gxwebsoft.shop.entity.ShopUserReferee; -import com.gxwebsoft.shop.param.ShopUserRefereeParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 用户推荐关系表控制器 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Tag(name = "用户推荐关系表管理") -@RestController -@RequestMapping("/api/shop/shop-user-referee") -public class ShopUserRefereeController extends BaseController { - @Resource - private ShopUserRefereeService shopUserRefereeService; - - @Operation(summary = "分页查询用户推荐关系表") - @GetMapping("/page") - public ApiResult> page(ShopUserRefereeParam param) { - // 使用关联查询 - return success(shopUserRefereeService.pageRel(param)); - } - - @Operation(summary = "查询全部用户推荐关系表") - @GetMapping() - public ApiResult> list(ShopUserRefereeParam param) { - // 使用关联查询 - return success(shopUserRefereeService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:list')") - @Operation(summary = "根据id查询用户推荐关系表") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopUserRefereeService.getByIdRel(id)); - } - - @Operation(summary = "根据userId查询推荐人信息") - @GetMapping("/getByUserId/{userId}") - public ApiResult getByUserId(@PathVariable("userId") Integer userId) { - // 使用关联查询 - return success(shopUserRefereeService.getByUserIdRel(userId)); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:save')") - @OperationLog - @Operation(summary = "添加用户推荐关系表") - @PostMapping() - public ApiResult save(@RequestBody ShopUserReferee shopUserReferee) { - // 记录当前登录用户id - User loginUser = getLoginUser(); - if (loginUser != null) { - shopUserReferee.setUserId(loginUser.getUserId()); - } - if (shopUserRefereeService.save(shopUserReferee)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:update')") - @OperationLog - @Operation(summary = "修改用户推荐关系表") - @PutMapping() - public ApiResult update(@RequestBody ShopUserReferee shopUserReferee) { - if (shopUserRefereeService.updateById(shopUserReferee)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:remove')") - @OperationLog - @Operation(summary = "删除用户推荐关系表") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopUserRefereeService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:save')") - @OperationLog - @Operation(summary = "批量添加用户推荐关系表") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopUserRefereeService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:update')") - @OperationLog - @Operation(summary = "批量修改用户推荐关系表") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopUserRefereeService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @PreAuthorize("hasAuthority('shop:shopUserReferee:remove')") - @OperationLog - @Operation(summary = "批量删除用户推荐关系表") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopUserRefereeService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopWechatDepositController.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopWechatDepositController.java deleted file mode 100644 index 7c29f20..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/controller/ShopWechatDepositController.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.controller; - -import com.gxwebsoft.common.core.web.BaseController; -import com.gxwebsoft.shop.service.ShopWechatDepositService; -import com.gxwebsoft.shop.entity.ShopWechatDeposit; -import com.gxwebsoft.shop.param.ShopWechatDepositParam; -import com.gxwebsoft.common.core.web.ApiResult; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.BatchParam; -import com.gxwebsoft.common.core.annotation.OperationLog; -import com.gxwebsoft.common.system.entity.User; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 押金控制器 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Tag(name = "押金管理") -@RestController -@RequestMapping("/api/shop/shop-wechat-deposit") -public class ShopWechatDepositController extends BaseController { - @Resource - private ShopWechatDepositService shopWechatDepositService; - - @Operation(summary = "分页查询押金") - @GetMapping("/page") - public ApiResult> page(ShopWechatDepositParam param) { - // 使用关联查询 - return success(shopWechatDepositService.pageRel(param)); - } - - @Operation(summary = "查询全部押金") - @GetMapping() - public ApiResult> list(ShopWechatDepositParam param) { - // 使用关联查询 - return success(shopWechatDepositService.listRel(param)); - } - - @PreAuthorize("hasAuthority('shop:shopWechatDeposit:list')") - @Operation(summary = "根据id查询押金") - @GetMapping("/{id}") - public ApiResult get(@PathVariable("id") Integer id) { - // 使用关联查询 - return success(shopWechatDepositService.getByIdRel(id)); - } - - @Operation(summary = "添加押金") - @PostMapping() - public ApiResult save(@RequestBody ShopWechatDeposit shopWechatDeposit) { - if (shopWechatDepositService.save(shopWechatDeposit)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "修改押金") - @PutMapping() - public ApiResult update(@RequestBody ShopWechatDeposit shopWechatDeposit) { - if (shopWechatDepositService.updateById(shopWechatDeposit)) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "删除押金") - @DeleteMapping("/{id}") - public ApiResult remove(@PathVariable("id") Integer id) { - if (shopWechatDepositService.removeById(id)) { - return success("删除成功"); - } - return fail("删除失败"); - } - - @Operation(summary = "批量添加押金") - @PostMapping("/batch") - public ApiResult saveBatch(@RequestBody List list) { - if (shopWechatDepositService.saveBatch(list)) { - return success("添加成功"); - } - return fail("添加失败"); - } - - @Operation(summary = "批量修改押金") - @PutMapping("/batch") - public ApiResult removeBatch(@RequestBody BatchParam batchParam) { - if (batchParam.update(shopWechatDepositService, "id")) { - return success("修改成功"); - } - return fail("修改失败"); - } - - @Operation(summary = "批量删除押金") - @DeleteMapping("/batch") - public ApiResult removeBatch(@RequestBody List ids) { - if (shopWechatDepositService.removeByIds(ids)) { - return success("删除成功"); - } - return fail("删除失败"); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/dto/OrderCreateRequest.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/dto/OrderCreateRequest.java deleted file mode 100644 index 6750da1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/dto/OrderCreateRequest.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.gxwebsoft.shop.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.Valid; -import javax.validation.constraints.*; -import java.math.BigDecimal; -import java.util.List; - -/** - * 订单创建请求DTO - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Data -@Schema(name = "OrderCreateRequest", description = "订单创建请求") -public class OrderCreateRequest { - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") - @NotNull(message = "订单类型不能为空") - @Min(value = 0, message = "订单类型值无效") - @Max(value = 2, message = "订单类型值无效") - private Integer type; - - @Size(max = 60, message = "备注长度不能超过60个字符") - @Schema(description = "订单标题") - private String title; - - @Schema(description = "快递/自提") - private Integer deliveryType; - - @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") - private Integer channel; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户编号") - private String merchantCode; - - @Schema(description = "使用的优惠券id") - private Integer couponId; - - @Schema(description = "使用的会员卡id") - private String cardId; - - @Schema(description = "关联收货地址") - private Integer addressId; - - @Schema(description = "收货地址") - private String address; - - @Schema(description = "收货人姓名") - private String realName; - - @Schema(description = "地址纬度") - private String addressLat; - - @Schema(description = "地址经度") - private String addressLng; - - @Schema(description = "自提店铺id") - private Integer selfTakeMerchantId; - - @Schema(description = "自提店铺") - private String selfTakeMerchantName; - - @Schema(description = "配送开始时间") - private String sendStartTime; - - @Schema(description = "配送结束时间") - private String sendEndTime; - - @Schema(description = "发货店铺id") - private Integer expressMerchantId; - - @Schema(description = "发货店铺") - private String expressMerchantName; - - @Schema(description = "订单总额") - @NotNull(message = "订单总额不能为空") - @DecimalMin(value = "0.01", message = "订单总额必须大于0") - @Digits(integer = 10, fraction = 2, message = "订单总额格式不正确") - private BigDecimal totalPrice; - - @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") - @DecimalMin(value = "0", message = "减少金额不能为负数") - private BigDecimal reducePrice; - - @Schema(description = "实际付款") - @DecimalMin(value = "0", message = "实际付款不能为负数") - private BigDecimal payPrice; - - @Schema(description = "用于统计") - private BigDecimal price; - - @Schema(description = "价钱,用于积分赠送") - private BigDecimal money; - - @Schema(description = "教练价格") - private BigDecimal coachPrice; - - @Schema(description = "购买数量") - @Min(value = 1, message = "购买数量必须大于0") - private Integer totalNum; - - @Schema(description = "教练id") - private Integer coachId; - - @Schema(description = "来源ID,存商品ID") - private Integer formId; - - @Schema(description = "支付类型,0余额支付, 1微信支付,102微信Native,2会员卡支付,3支付宝,4现金,5POS机,6VIP月卡,7VIP年卡,8VIP次卡,9IC月卡,10IC年卡,11IC次卡,12免费,13VIP充值卡,14IC充值卡,15积分支付,16VIP季卡,17IC季卡,18代付") - private Integer payType; - - @Schema(description = "代付支付方式") - private Integer friendPayType; - - @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") - private Integer couponType; - - @Schema(description = "优惠说明") - private String couponDesc; - - @Schema(description = "预约详情开始时间数组") - private String startTime; - - @Schema(description = "备注") - @Size(max = 500, message = "备注长度不能超过500字符") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - @NotNull(message = "租户ID不能为空") - private Integer tenantId; - - @Schema(description = "订单商品列表") - @Valid - @NotEmpty(message = "订单商品列表不能为空") - private List goodsItems; - - /** - * 订单商品项 - */ - @Data - @Schema(name = "OrderGoodsItem", description = "订单商品项") - public static class OrderGoodsItem { - @Schema(description = "商品ID", required = true) - @NotNull(message = "商品ID不能为空") - private Integer goodsId; - - @Schema(description = "商品SKU ID") - private Integer skuId; - - @Schema(description = "商品数量", required = true) - @NotNull(message = "商品数量不能为空") - @Min(value = 1, message = "商品数量必须大于0") - private Integer quantity; - - @Schema(description = "支付类型") - private Integer payType; - - @Schema(description = "规格信息,如:颜色:红色|尺寸:L") - private String specInfo; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/dto/UpdatePaymentStatusRequest.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/dto/UpdatePaymentStatusRequest.java deleted file mode 100644 index 999b0a8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/dto/UpdatePaymentStatusRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.shop.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -/** - * 更新订单支付状态请求DTO - * - * @author 科技小王子 - * @since 2025-08-30 - */ -@Data -@Schema(name = "UpdatePaymentStatusRequest", description = "更新订单支付状态请求") -public class UpdatePaymentStatusRequest { - - @Schema(description = "订单号", required = true) - @NotBlank(message = "订单号不能为空") - private String orderNo; - - @Schema(description = "支付状态:1=支付成功,0=支付失败", required = true) - @NotNull(message = "支付状态不能为空") - private Integer paymentStatus; - - @Schema(description = "微信交易号") - private String transactionId; - - @Schema(description = "支付时间,格式:yyyy-MM-dd HH:mm:ss") - private String payTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/KuaiDi100Resp.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/KuaiDi100Resp.java deleted file mode 100644 index c1348ad..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/KuaiDi100Resp.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import lombok.Data; - -@Data -public class KuaiDi100Resp { - private String message; - private Integer returnCode; - private Boolean result; - private Object data; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java deleted file mode 100644 index a11ff60..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopArticle.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品文章 - * - * @author 科技小王子 - * @since 2025-08-13 05:14:53 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopArticle对象", description = "商品文章") -public class ShopArticle implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "文章ID") - @TableId(value = "article_id", type = IdType.AUTO) - private Integer articleId; - - @Schema(description = "文章标题") - private String title; - - @Schema(description = "文章类型 0常规 1视频") - private Integer type; - - @Schema(description = "模型") - private String model; - - @Schema(description = "详情页模板") - private String detail; - - @Schema(description = "文章分类ID") - private Integer categoryId; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - - @Schema(description = "话题") - private String topic; - - @Schema(description = "标签") - private String tags; - - @Schema(description = "封面图") - private String image; - - @Schema(description = "封面图宽") - private Integer imageWidth; - - @Schema(description = "封面图高") - private Integer imageHeight; - - @Schema(description = "付费金额") - private BigDecimal price; - - @Schema(description = "开始时间") - private LocalDateTime startTime; - - @Schema(description = "结束时间") - private LocalDateTime endTime; - - @Schema(description = "来源") - private String source; - - @Schema(description = "产品概述") - private String overview; - - @Schema(description = "虚拟阅读量(仅用作展示)") - private Integer virtualViews; - - @Schema(description = "实际阅读量") - private Integer actualViews; - - @Schema(description = "评分") - private BigDecimal rate; - - @Schema(description = "列表显示方式(10小图展示 20大图展示)") - private Integer showType; - - @Schema(description = "访问密码") - private String password; - - @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") - private Integer permission; - - @Schema(description = "发布来源客户端 (APP、H5、小程序等)") - private String platform; - - @Schema(description = "文章附件") - private String files; - - @Schema(description = "视频地址") - private String video; - - @Schema(description = "接受的文件类型") - private String accept; - - @Schema(description = "经度") - private String longitude; - - @Schema(description = "纬度") - private String latitude; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "点赞数") - private Integer likes; - - @Schema(description = "评论数") - private Integer commentNumbers; - - @Schema(description = "提醒谁看") - private String toUsers; - - @Schema(description = "作者") - private String author; - - @Schema(description = "推荐") - private Integer recommend; - - @Schema(description = "报名人数") - private Integer bmUsers; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "项目ID") - private Integer projectId; - - @Schema(description = "语言") - private String lang; - - @Schema(description = "关联默认语言的文章ID") - private Integer langArticleId; - - @Schema(description = "是否自动翻译") - private Boolean translation; - - @Schema(description = "编辑器类型 0 Markdown编辑器 1 富文本编辑器 ") - private Boolean editor; - - @Schema(description = "pdf文件地址") - private String pdfUrl; - - @Schema(description = "版本号") - private Integer version; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopBrand.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopBrand.java deleted file mode 100644 index 96a3c21..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopBrand.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 品牌 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopBrand对象", description = "品牌") -public class ShopBrand implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "brand_id", type = IdType.AUTO) - private Integer brandId; - - @Schema(description = "品牌名称") - private String brandName; - - @Schema(description = "图标") - private String image; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCart.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCart.java deleted file mode 100644 index b3139e9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCart.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 购物车 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCart对象", description = "购物车") -public class ShopCart implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "购物车表ID") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "类型 0商城 1外卖") - private Integer type; - - @Schema(description = "唯一标识") - private String code; - - @Schema(description = "商品ID") - private Long goodsId; - - @Schema(description = "商品SKU ID") - private Integer skuId; - - @Schema(description = "商品规格") - private String spec; - - @Schema(description = "规格信息,如:颜色:红色|尺寸:L") - private String specInfo; - - @Schema(description = "商品价格") - private BigDecimal price; - - @Schema(description = "商品数量") - private Integer cartNum; - - @Schema(description = "单商品合计") - private BigDecimal totalPrice; - - @Schema(description = "0 = 未购买 1 = 已购买") - private Boolean isPay; - - @Schema(description = "是否为立即购买") - private Boolean isNew; - - @Schema(description = "是否为立即购买") - private Boolean isShow; - - @Schema(description = "拼团id") - private Integer combinationId; - - @Schema(description = "秒杀产品ID") - private Integer seckillId; - - @Schema(description = "砍价id") - private Integer bargainId; - - @Schema(description = "是否选中") - private Boolean selected; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCategory.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCategory.java deleted file mode 100644 index 8eff0b5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCategory.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品分类 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCategory对象", description = "商品分类") -public class ShopCategory implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - - @Schema(description = "菜单名称") - private String title; - - @Schema(description = "模型") - private String model; - - @Schema(description = "标识") - private String code; - - @Schema(description = "链接地址") - private String path; - - @Schema(description = "组件地址") - private String component; - - @Schema(description = "打开位置") - private String target; - - @Schema(description = "图标") - private String icon; - - @Schema(description = "banner") - private String banner; - - @Schema(description = "图标颜色") - private String color; - - @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") - private Integer hide; - - @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") - private Integer permission; - - @Schema(description = "访问密码") - private String password; - - @Schema(description = "位置 0不限 1顶部 2底部") - private Integer position; - - @Schema(description = "仅在顶部显示") - private Integer top; - - @Schema(description = "仅在底部显示") - private Integer bottom; - - @Schema(description = "菜单选中的path") - private String active; - - @Schema(description = "其它路由元信息") - private String meta; - - @Schema(description = "css样式") - private String style; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "语言") - private String lang; - - @Schema(description = "设为首页") - private Integer home; - - @Schema(description = "推荐") - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopChatConversation.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopChatConversation.java deleted file mode 100644 index bddc6a6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopChatConversation.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 聊天消息表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopChatConversation对象", description = "聊天消息表") -public class ShopChatConversation implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "好友ID") - private Integer friendId; - - @Schema(description = "消息类型") - private Integer type; - - @Schema(description = "消息内容") - private String content; - - @Schema(description = "未读消息") - private Integer unRead; - - @Schema(description = "状态, 0未读, 1已读") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopChatMessage.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopChatMessage.java deleted file mode 100644 index e212e04..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopChatMessage.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 聊天消息表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopChatMessage对象", description = "聊天消息表") -public class ShopChatMessage implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "发送人ID") - private Integer formUserId; - - @Schema(description = "发送人名称") - @TableField(exist = false) - private String formUserName; - - @Schema(description = "发送人头像") - @TableField(exist = false) - private String formUserAvatar; - - @Schema(description = "发送人手机号码") - @TableField(exist = false) - private String formUserPhone; - - @Schema(description = "发送人别名") - @TableField(exist = false) - private String formUserAlias; - - @Schema(description = "接收人ID") - private Integer toUserId; - - @Schema(description = "接收人名称") - @TableField(exist = false) - private String toUserName; - - @Schema(description = "接收人头像") - @TableField(exist = false) - private String toUserAvatar; - - @Schema(description = "接收人手机号码") - @TableField(exist = false) - private String toUserPhone; - - @Schema(description = "接收人别名") - @TableField(exist = false) - private String toUserAlias; - - @Schema(description = "消息类型") - private String type; - - @Schema(description = "消息内容") - private String content; - - @Schema(description = "屏蔽接收方") - private Integer sideTo; - - @Schema(description = "屏蔽发送方") - private Integer sideFrom; - - @Schema(description = "是否撤回") - private Integer withdraw; - - @Schema(description = "文件信息") - private String fileInfo; - - @Schema(description = "存在联系方式") - private Integer hasContact; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "状态, 0未读, 1已读") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCommissionRole.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCommissionRole.java deleted file mode 100644 index cdf33b5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCommissionRole.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分红角色 - * - * @author 科技小王子 - * @since 2025-05-01 10:01:15 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCommissionRole对象", description = "分红角色") -public class ShopCommissionRole implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private String title; - - private Integer provinceId; - - private Integer cityId; - - private Integer regionId; - - @Schema(description = "状态, 0正常, 1异常") - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCount.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCount.java deleted file mode 100644 index 454b8c2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCount.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import java.time.LocalDate; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商城销售统计表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCount对象", description = "商城销售统计表") -public class ShopCount implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "统计日期") - private LocalDate dateTime; - - @Schema(description = "总销售额") - private BigDecimal totalPrice; - - @Schema(description = "今日销售额") - private BigDecimal todayPrice; - - @Schema(description = "总会员数") - private BigDecimal totalUsers; - - @Schema(description = "今日新增") - private BigDecimal todayUsers; - - @Schema(description = "总订单笔数") - private BigDecimal totalOrders; - - @Schema(description = "今日订单笔数") - private BigDecimal todayOrders; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java deleted file mode 100644 index fae4872..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCoupon.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import java.time.LocalDate; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import java.util.List; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 优惠券 - * - * @author 科技小王子 - * @since 2025-08-11 09:41:38 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCoupon对象", description = "优惠券") -public class ShopCoupon implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "优惠券名称") - private String name; - - @Schema(description = "优惠券描述") - private String description; - - @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") - private Integer type; - - @Schema(description = "满减券-减免金额") - @JsonSerialize(using = ToStringSerializer.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - private BigDecimal reducePrice; - - @Schema(description = "折扣券-折扣率(0-100)") - private Integer discount; - - @Schema(description = "最低消费金额") - @JsonSerialize(using = ToStringSerializer.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - private BigDecimal minPrice; - - @Schema(description = "到期类型(10领取后生效 20固定时间)") - private Integer expireType; - - @Schema(description = "领取后生效-有效天数") - private Integer expireDay; - - @Schema(description = "有效期开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime startTime; - - @Schema(description = "有效期结束时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime endTime; - - @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") - private Integer applyRange; - - @Schema(description = "适用范围配置(json格式)") - private String applyRangeConfig; - - @Schema(description = "是否过期(0未过期 1已过期)") - private Integer isExpire; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1禁用") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "创建用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "发放总数量(-1表示无限制)") - private Integer totalCount; - - @Schema(description = "已发放数量") - private Integer issuedCount; - - @Schema(description = "每人限领数量(-1表示无限制)") - private Integer limitPerUser; - - @Schema(description = "是否启用(0禁用 1启用)") - private Boolean enabled; - - @TableField(exist = false) - private List couponApplyItemList; - - @TableField(exist = false) - private List couponApplyCateList; - - @TableField(exist = false) - private Boolean hasTake; - - @TableField(exist = false) - private Integer userTakeNum; - - @TableField(exist = false) - private Integer userUseNum; - - @TableField(exist = false) - private Integer receiveNum; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyCate.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyCate.java deleted file mode 100644 index 26bf30c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyCate.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 优惠券可用分类 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCouponApplyCate对象", description = "优惠券可用分类") -public class ShopCouponApplyCate implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private Integer couponId; - - private Integer cateId; - - @Schema(description = "分类等级") - private Integer cateLevel; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyItem.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyItem.java deleted file mode 100644 index 504d9d7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopCouponApplyItem.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 优惠券可用分类 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopCouponApplyItem对象", description = "优惠券可用分类") -public class ShopCouponApplyItem implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "优惠券ID") - private Integer couponId; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "分类ID") - private Integer categoryId; - - @Schema(description = "类型(1商品 2分类)") - private Integer type; - - @Schema(description = "0服务1需求2闲置") - private Integer pk; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerApply.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerApply.java deleted file mode 100644 index ca0c9bb..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerApply.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商申请记录表 - * - * @author 科技小王子 - * @since 2025-08-11 23:50:18 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerApply对象", description = "分销商申请记录表") -public class ShopDealerApply implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "apply_id", type = IdType.AUTO) - private Integer applyId; - - @Schema(description = "0经销商,1企业也,2集团)") - private Integer type; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickName; - - @Schema(description = "手机号码") - @TableField(exist = false) - private String phone; - - @Schema(description = "姓名") - private String realName; - - @Schema(description = "分销商名称") - private String dealerName; - - @Schema(description = "分销商编码") - private String dealerCode; - - @Schema(description = "手机号") - private String mobile; - - @Schema(description = "合同金额") - private BigDecimal money; - - @Schema(description = "详细地址") - private String address; - - @Schema(description = "佣金比例") - @TableField(exist = false) - private BigDecimal rate; - - @Schema(description = "推荐人用户ID") - private Integer refereeId; - - @Schema(description = "申请方式(10需后台审核 20无需审核)") - private Integer applyType; - - @Schema(description = "申请时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime applyTime; - - @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") - private Integer applyStatus; - - @Schema(description = "审核时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime auditTime; - - @Schema(description = "合同时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime contractTime; - - @Schema(description = "到期时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime expirationTime; - - @Schema(description = "驳回原因") - private String rejectReason; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "商城ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "推荐人名称") - @TableField(exist = false) - private String refereeName; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerBank.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerBank.java deleted file mode 100644 index eded8a3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerBank.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 分销商提现银行卡 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerBank对象", description = "分销商提现银行卡") -public class ShopDealerBank implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "分销商用户ID") - private Integer userId; - - @Schema(description = "开户行名称") - private String bankName; - - @Schema(description = "银行开户名") - private String bankAccount; - - @Schema(description = "银行卡号") - private String bankCard; - - @Schema(description = "申请状态 (10待审核 20审核通过 30驳回)") - private Integer applyStatus; - - @Schema(description = "驳回原因") - private String rejectReason; - - @Schema(description = "默认收货地址") - private Boolean isDefault; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerCapital.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerCapital.java deleted file mode 100644 index 00562e4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerCapital.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商资金明细表 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerCapital对象", description = "分销商资金明细表") -public class ShopDealerCapital implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "分销商用户ID") - private Integer userId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "资金流动类型 (10佣金收入 20提现支出 30转账支出 40转账收入)") - private Integer flowType; - - @Schema(description = "金额") - private BigDecimal money; - - @Schema(description = "描述") - private String comments; - - @Schema(description = "对方用户ID") - private Integer toUserId; - - @Schema(description = "对方昵称") - @TableField(exist = false) - private String toNickName; - - @Schema(description = "结算月份") - private String month; - - @Schema(description = "商城ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerOrder.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerOrder.java deleted file mode 100644 index 81f3732..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerOrder.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商订单记录表 - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerOrder对象", description = "分销商订单记录表") -public class ShopDealerOrder implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "买家用户ID") - private Integer userId; - - @Excel(name = "公司名称") - private String title; - - @Excel(name = "订单编号") - private String orderNo; - - @Schema(description = "买家用户昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "订单总金额(不含运费)") - private BigDecimal orderPrice; - - @Schema(description = "结算金额") - private BigDecimal settledPrice; - - @Schema(description = "换算成度") - private BigDecimal degreePrice; - - @Schema(description = "实发金额") - private BigDecimal payPrice; - - @Schema(description = "分销商用户id(一级)") - private Integer firstUserId; - - @Schema(description = "分销商用户昵称(一级)") - @TableField(exist = false) - private String firstNickname; - - @Schema(description = "分销商用户id(二级)") - private Integer secondUserId; - - @Schema(description = "分销商用户昵称(二级)") - @TableField(exist = false) - private String secondNickname; - - @Schema(description = "分销商用户id(三级)") - private Integer thirdUserId; - - @Schema(description = "分销商用户昵称(三级)") - @TableField(exist = false) - private String thirdNickname; - - @Schema(description = "分销佣金(一级)") - private BigDecimal firstMoney; - - @Schema(description = "分销佣金(二级)") - private BigDecimal secondMoney; - - @Schema(description = "分销佣金(三级)") - private BigDecimal thirdMoney; - - @Schema(description = "佣金比例") - private BigDecimal rate; - - @Schema(description = "单价") - private BigDecimal price; - - @Schema(description = "结算月份") - private String month; - - @Schema(description = "订单是否失效(0未失效 1已失效)") - private Integer isInvalid; - - @Schema(description = "佣金结算(0未结算 1已结算)") - private Integer isSettled; - - @Schema(description = "结算时间") - private LocalDateTime settleTime; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "商城ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerRecord.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerRecord.java deleted file mode 100644 index 3780cda..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerRecord.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import com.fasterxml.jackson.annotation.JsonFormat; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 客户跟进情况 - * - * @author 科技小王子 - * @since 2025-10-02 12:21:50 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(description = "客户跟进情况") -public class ShopDealerRecord implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "上级id, 0是顶级") - private Integer parentId; - - @Schema(description = "客户ID") - private Integer dealerId; - - @Schema(description = "内容") - private String content; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0待处理, 1已完成") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerReferee.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerReferee.java deleted file mode 100644 index 35de39a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerReferee.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商推荐关系表 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerReferee对象", description = "分销商推荐关系表") -public class ShopDealerReferee implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "分销商用户ID") - private Integer dealerId; - - @Schema(description = "分销商名称") - @TableField(exist = false) - private String dealerName; - - @Schema(description = "分销商头像") - @TableField(exist = false) - private String dealerAvatar; - - @Schema(description = "分销商手机号") - @TableField(exist = false) - private String dealerPhone; - - @Schema(description = "用户id(被推荐人)") - private Integer userId; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "别名") - @TableField(exist = false) - private String alias; - - @Schema(description = "手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "是否管理员") - @TableField(exist = false) - private Boolean isAdmin; - - @Schema(description = "推荐关系层级(1,2,3)") - private Integer level; - - @Schema(description = "商城ID") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerSetting.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerSetting.java deleted file mode 100644 index fd1b2ad..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerSetting.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商设置表 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerSetting对象", description = "分销商设置表") -public class ShopDealerSetting implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "设置项标示") - @TableId(value = "key", type = IdType.AUTO) - private String key; - - @Schema(description = "设置项描述") - private String describe; - - @Schema(description = "设置内容(json格式)") - private String values; - - @Schema(description = "商城ID") - private Integer tenantId; - - @Schema(description = "更新时间") - private Integer updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerUser.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerUser.java deleted file mode 100644 index 86bd84e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerUser.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商用户记录表 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerUser对象", description = "分销商用户记录表") -public class ShopDealerUser implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "0经销商,1企业也,2集团)") - private Integer type; - - @Schema(description = "自增ID") - private Integer userId; - - @Schema(description = "微信openid") - @TableField(exist = false) - private String openid; - - @Schema(description = "姓名") - private String realName; - - @Schema(description = "手机号") - private String mobile; - - @Schema(description = "支付密码") - private String payPassword; - - @Schema(description = "当前可提现佣金") - private BigDecimal money; - - @Schema(description = "已冻结佣金") - private BigDecimal freezeMoney; - - @Schema(description = "累积提现佣金") - private BigDecimal totalMoney; - - @Schema(description = "单价") - private BigDecimal price; - - @Schema(description = "佣金比例") - private BigDecimal rate; - - @Schema(description = "推荐人用户ID") - private Integer refereeId; - - @Schema(description = "成员数量(一级)") - private Integer firstNum; - - @Schema(description = "成员数量(二级)") - private Integer secondNum; - - @Schema(description = "成员数量(三级)") - private Integer thirdNum; - - @Schema(description = "专属二维码") - private String qrcode; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除") - private Integer isDelete; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerWithdraw.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerWithdraw.java deleted file mode 100644 index 6289926..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopDealerWithdraw.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商提现明细表 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopDealerWithdraw对象", description = "分销商提现明细表") -public class ShopDealerWithdraw implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "分销商用户ID") - private Integer userId; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickName; - - @Schema(description = "头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "真实姓名") - @TableField(exist = false) - private String realName; - - @Schema(description = "提现金额") - private BigDecimal money; - - @Schema(description = "打款方式 (10微信 20支付宝 30银行卡)") - private Integer payType; - - @Schema(description = "支付宝姓名") - private String alipayName; - - @Schema(description = "支付宝账号") - private String alipayAccount; - - @Schema(description = "开户行名称") - private String bankName; - - @Schema(description = "银行开户名") - private String bankAccount; - - @Schema(description = "银行卡号") - private String bankCard; - - @Schema(description = "申请状态 (10待审核 20审核通过 30驳回 40已打款)") - private Integer applyStatus; - - @Schema(description = "审核时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime auditTime; - - @Schema(description = "驳回原因") - private String rejectReason; - - @Schema(description = "上传支付凭证") - private String image; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "来源客户端(APP、H5、小程序等)") - private String platform; - - @Schema(description = "微信openId") - @TableField(exist = false) - private String openId; - - @Schema(description = "公众号openId") - @TableField(exist = false) - private String officeOpenid; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpress.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpress.java deleted file mode 100644 index 9f0c5fe..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpress.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 物流公司 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopExpress对象", description = "物流公司") -public class ShopExpress implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "物流公司ID") - @TableId(value = "express_id", type = IdType.AUTO) - private Integer expressId; - - @Schema(description = "物流公司名称") - private String expressName; - - @Schema(description = "物流公司编码 (微信)") - private String wxCode; - - @Schema(description = "物流公司编码 (快递100)") - private String kuaidi100Code; - - @Schema(description = "物流公司编码 (快递鸟)") - private String kdniaoCode; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplate.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplate.java deleted file mode 100644 index 1f5b8fa..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplate.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 运费模板 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopExpressTemplate对象", description = "运费模板") -public class ShopExpressTemplate implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private Boolean type; - - private String title; - - @Schema(description = "收件价格") - private BigDecimal firstAmount; - - @Schema(description = "续件价格") - private BigDecimal extraAmount; - - @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - private Integer sortNumber; - - @Schema(description = "首件数量/重量") - private BigDecimal firstNum; - - @Schema(description = "续件数量/重量") - private BigDecimal extraNum; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplateDetail.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplateDetail.java deleted file mode 100644 index 7d8d3ec..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopExpressTemplateDetail.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 运费模板 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopExpressTemplateDetail对象", description = "运费模板") -public class ShopExpressTemplateDetail implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private Integer templateId; - - @Schema(description = "0按件") - private Boolean type; - - private Integer provinceId; - - private Integer cityId; - - @Schema(description = "首件数量/重量") - private BigDecimal firstNum; - - @Schema(description = "收件价格") - private BigDecimal firstAmount; - - @Schema(description = "续件价格") - private BigDecimal extraAmount; - - @Schema(description = "续件数量/重量") - private BigDecimal extraNum; - - @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGift.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGift.java deleted file mode 100644 index 261c980..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGift.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 礼品卡 - * - * @author 科技小王子 - * @since 2025-08-11 18:07:31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGift对象", description = "礼品卡") -public class ShopGift implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "礼品卡名称") - private String name; - - @Schema(description = "秘钥") - private String code; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "商品名称") - @TableField(exist = false) - private String goodsName; - - @Schema(description = "商品图片") - @TableField(exist = false) - private String goodsImage; - - @Schema(description = "面值") - @TableField(exist = false) - private BigDecimal faceValue; - - @Schema(description = "使用地点") - private String useLocation; - - @Schema(description = "领取时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime takeTime; - - @Schema(description = "核销时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime verificationTime; - - @Schema(description = "操作人ID") - private Integer operatorUserId; - - @Schema(description = "操作人") - @TableField(exist = false) - private String operatorUserName; - - @Schema(description = "操作备注") - private String operatorRemarks; - - @Schema(description = "是否展示") - private Boolean isShow; - - @Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickName; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @TableField(exist = false) - private Integer num; - - @TableField(exist = false) - private ShopGoods goods; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoods.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoods.java deleted file mode 100644 index 2cfae1d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoods.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoods对象", description = "商品") -public class ShopGoods implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "goods_id", type = IdType.AUTO) - private Integer goodsId; - - @Schema(description = "商品名称") - private String name; - - @Schema(description = "产品编码") - private String code; - - @Schema(description = "类型 0软件产品 1实物商品 2虚拟商品") - private Integer type; - - @Schema(description = "封面图") - private String image; - - @Schema(description = "父级分类ID") - private Integer parentId; - - @Schema(description = "产品分类ID") - private Integer categoryId; - - @Schema(description = "路由地址") - private String path; - - @Schema(description = "标签") - private String tag; - - @Schema(description = "产品规格 0单规格 1多规格") - private Integer specs; - - @Schema(description = "货架") - private String position; - - @Schema(description = "单位名称 (个)") - private String unitName; - - @Schema(description = "商品价格") - private BigDecimal price; - - @Schema(description = "进货价格") - private BigDecimal buyingPrice; - - @Schema(description = "经销商价格") - private BigDecimal dealerPrice; - - @Schema(description = "市场价") - private BigDecimal salePrice; - - @Schema(description = "佣金") - private BigDecimal commission; - - @Schema(description = "库存计算方式(10下单减库存 20付款减库存)") - private Integer deductStockType; - - @Schema(description = "交付方式(0不启用)") - private Integer deliveryMethod; - - @Schema(description = "购买时长(0不启用,1 一次性,2 按时长)") - private Integer durationMethod; - - @Schema(description = "可购买数量") - private Integer canBuyNumber; - - @Schema(description = "商品详情") - private String content; - - @Schema(description = "轮播图") - private String files; - - @Schema(description = "销量") - private Integer sales; - - @Schema(description = "库存") - private Integer stock; - - @Schema(description = "安装次数") - private Integer install; - - @Schema(description = "评分") - private BigDecimal rate; - - @Schema(description = "消费赚取积分") - private BigDecimal gainIntegral; - - @Schema(description = "推荐") - private Integer recommend; - - @Schema(description = "是否官方") - private Integer official; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "是否展示") - private Boolean isShow; - - @Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCategory.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCategory.java deleted file mode 100644 index ff721bd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsCategory.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品分类 - * - * @author 科技小王子 - * @since 2025-05-01 00:36:45 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsCategory对象", description = "商品分类") -public class ShopGoodsCategory implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "商品分类ID") - @TableId(value = "category_id", type = IdType.AUTO) - private Integer categoryId; - - @Schema(description = "分类标识") - private String categoryCode; - - @Schema(description = "分类名称") - private String title; - - @Schema(description = "类型 0商城分类 1外卖分类") - private Integer type; - - @Schema(description = "分类图片") - private String image; - - @Schema(description = "上级分类ID") - private Integer parentId; - - @Schema(description = "路由/链接地址") - private String path; - - @Schema(description = "组件路径") - private String component; - - @Schema(description = "绑定的页面") - private Integer pageId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "商品数量") - private Integer count; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") - private Integer hide; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "是否显示在首页") - private Integer showIndex; - - @Schema(description = "商铺ID") - private Long merchantId; - - @Schema(description = "状态, 0正常, 1禁用") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsComment.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsComment.java deleted file mode 100644 index 2a9a56e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsComment.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 评论表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsComment对象", description = "评论表") -public class ShopGoodsComment implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "评论ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "用户ID") - private Integer uid; - - @Schema(description = "订单ID") - private Integer oid; - - @Schema(description = "商品唯一id") - private String unique; - - @Schema(description = "商品id") - private Integer goodsId; - - @Schema(description = "某种商品类型(普通商品、秒杀商品)") - private String replyType; - - @Schema(description = "商品分数") - private Boolean goodsScore; - - @Schema(description = "服务分数") - private Boolean serviceScore; - - @Schema(description = "评论内容") - private String comment; - - @Schema(description = "评论图片") - private String pics; - - @Schema(description = "管理员回复内容") - private String merchantReplyContent; - - @Schema(description = "管理员回复时间") - private Integer merchantReplyTime; - - @Schema(description = "0未删除1已删除") - private Boolean isDel; - - @Schema(description = "0未回复1已回复") - private Boolean isReply; - - @Schema(description = "用户名称") - private String nickname; - - @Schema(description = "用户头像") - private String avatar; - - @Schema(description = "商品规格属性值,多个,号隔开") - private String sku; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsIncomeConfig.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsIncomeConfig.java deleted file mode 100644 index dec1307..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsIncomeConfig.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分润配置 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsIncomeConfig对象", description = "分润配置") -public class ShopGoodsIncomeConfig implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private Integer goodsId; - - @Schema(description = "店铺类型") - private String merchantShopType; - - private Integer skuId; - - @Schema(description = "比例") - private BigDecimal rate; - - @Schema(description = "用户id") - private Integer userId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsLog.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsLog.java deleted file mode 100644 index 9faf9ae..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsLog.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品日志表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsLog对象", description = "商品日志表") -public class ShopGoodsLog implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "统计ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "类型visit,cart,order,pay,collect,refund") - private String type; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "是否浏览") - private Boolean visitNum; - - @Schema(description = "加入购物车数量") - private Integer cartNum; - - @Schema(description = "下单数量") - private Integer orderNum; - - @Schema(description = "支付数量") - private Integer payNum; - - @Schema(description = "支付金额") - private BigDecimal payPrice; - - @Schema(description = "商品成本价") - private BigDecimal costPrice; - - @Schema(description = "支付用户ID") - private Integer payUid; - - @Schema(description = "退款数量") - private Integer refundNum; - - @Schema(description = "退款金额") - private BigDecimal refundPrice; - - @Schema(description = "收藏") - private Boolean collectNum; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRelation.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRelation.java deleted file mode 100644 index 581cac0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRelation.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; - -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品点赞和收藏表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsRelation对象", description = "商品点赞和收藏表") -public class ShopGoodsRelation implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "类型(收藏(collect)、点赞(like))") - private String type; - - @Schema(description = "某种类型的商品(普通商品、秒杀商品)") - private String category; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRoleCommission.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRoleCommission.java deleted file mode 100644 index 61aa957..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsRoleCommission.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品绑定角色的分润金额 - * - * @author 科技小王子 - * @since 2025-05-01 09:53:38 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsRoleCommission对象", description = "商品绑定角色的分润金额") -public class ShopGoodsRoleCommission implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - private Integer roleId; - - private Integer goodsId; - - private String sku; - - private BigDecimal amount; - - @Schema(description = "状态, 0正常, 1异常") - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSku.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSku.java deleted file mode 100644 index 7a7682f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSku.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品sku列表 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsSku对象", description = "商品sku列表") -public class ShopGoodsSku implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "商品属性索引值 (attr_value|attr_value[|....])") - private String sku; - - @Schema(description = "商品图片") - private String image; - - @Schema(description = "商品价格") - private BigDecimal price; - - @Schema(description = "市场价格") - private BigDecimal salePrice; - - @Schema(description = "成本价") - private BigDecimal cost; - - @Schema(description = "库存") - private Integer stock; - - @Schema(description = "sku编码") - private String skuNo; - - @Schema(description = "商品条码") - private String barCode; - - @Schema(description = "重量") - private BigDecimal weight; - - @Schema(description = "体积") - private BigDecimal volume; - - @Schema(description = "唯一值") - private String uuid; - - @Schema(description = "状态, 0正常, 1异常") - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSpec.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSpec.java deleted file mode 100644 index b1a16df..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopGoodsSpec.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品多规格 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopGoodsSpec对象", description = "商品多规格") -public class ShopGoodsSpec implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "规格ID") - private Integer specId; - - @Schema(description = "规格名称") - private String specName; - - @Schema(description = "规格值") - private String specValue; - - @Schema(description = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") - private Boolean type; - - @Schema(description = "租户id") - private Integer tenantId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchant.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchant.java deleted file mode 100644 index 1915909..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchant.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户 - * - * @author 科技小王子 - * @since 2025-08-10 20:43:33 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopMerchant对象", description = "商户") -public class ShopMerchant implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "merchant_id", type = IdType.AUTO) - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户编号") - private String merchantCode; - - @Schema(description = "商户类型") - private Integer type; - - @Schema(description = "商户图标") - private String image; - - @Schema(description = "商户手机号") - private String phone; - - @Schema(description = "商户姓名") - private String realName; - - @Schema(description = "店铺类型") - private String shopType; - - @Schema(description = "项目分类") - private String itemType; - - @Schema(description = "商户分类") - private String category; - - @Schema(description = "商户经营分类") - private Integer merchantCategoryId; - - @Schema(description = "商户分类") - private String merchantCategoryTitle; - - @Schema(description = "经纬度") - private String lngAndLat; - - private String lng; - - private String lat; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "详细地址") - private String address; - - @Schema(description = "手续费") - private BigDecimal commission; - - @Schema(description = "关键字") - private String keywords; - - @Schema(description = "资质图片") - private String files; - - @Schema(description = "营业时间") - private String businessTime; - - @Schema(description = "文章内容") - private String content; - - @Schema(description = "每小时价格") - private BigDecimal price; - - @Schema(description = "是否自营") - private Integer ownStore; - - @Schema(description = "是否可以快递") - private Boolean canExpress; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "是否营业") - private Integer isOn; - - private String startTime; - - private String endTime; - - @Schema(description = "是否需要审核") - private Integer goodsReview; - - @Schema(description = "管理入口") - private String adminUrl; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "所有人") - private Integer userId; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantAccount.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantAccount.java deleted file mode 100644 index 5ebbb65..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantAccount.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户账号 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopMerchantAccount对象", description = "商户账号") -public class ShopMerchantAccount implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "商户手机号") - private String phone; - - @Schema(description = "真实姓名") - private String realName; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "角色ID") - private Integer roleId; - - @Schema(description = "角色名称") - private String roleName; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "密码") - @TableField(exist = false) - private String password; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantApply.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantApply.java deleted file mode 100644 index 1d4516f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantApply.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; - -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户入驻申请 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopMerchantApply对象", description = "商户入驻申请") -public class ShopMerchantApply implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "apply_id", type = IdType.AUTO) - private Integer applyId; - - @Schema(description = "类型") - private Integer type; - - @Schema(description = "店铺类型") - private String shopType; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户图标") - private String image; - - @Schema(description = "商户手机号") - private String phone; - - @Schema(description = "商户姓名") - private String realName; - - @Schema(description = "社会信用代码") - private String merchantCode; - - @Schema(description = "身份证号码") - private String idCard; - - @Schema(description = "身份证正面") - private String sfz1; - - @Schema(description = "身份证反面") - private String sfz2; - - @Schema(description = "营业执照") - private String yyzz; - - @Schema(description = "行业父级分类") - private Integer parentId; - - @Schema(description = "行业分类ID") - private Integer categoryId; - - @Schema(description = "行业分类") - private String category; - - @Schema(description = "手续费") - private BigDecimal commission; - - @Schema(description = "关键字") - private String keywords; - - @Schema(description = "资质图片") - private String files; - - @Schema(description = "所有人") - private Integer userId; - - @Schema(description = "是否自营") - private Integer ownStore; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "是否需要审核") - private Integer goodsReview; - - @Schema(description = "工作负责人") - private String name2; - - @Schema(description = "驳回原因") - private String reason; - - @Schema(description = "审核完成时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime completedTime; - - @Schema(description = "审核状态") - private Boolean checkStatus; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "应用名称") - @TableField(exist = false) - private String tenantName; - - @Schema(description = "应用图标") - @TableField(exist = false) - private String logo; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantType.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantType.java deleted file mode 100644 index 9411233..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopMerchantType.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户类型 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopMerchantType对象", description = "商户类型") -public class ShopMerchantType implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "店铺类型") - private String name; - - @Schema(description = "店铺入驻条件") - private String comments; - - @Schema(description = "状态") - private Integer status; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrder.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrder.java deleted file mode 100644 index 4d46057..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrder.java +++ /dev/null @@ -1,329 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import java.util.List; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import javax.validation.constraints.*; - -/** - * 订单 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrder对象", description = "订单") -public class ShopOrder implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "订单号") - @TableId(value = "order_id", type = IdType.AUTO) - private Integer orderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") - private Integer type; - - @Schema(description = "订单标题") - private String title; - - @Schema(description = "快递/自提") - private Integer deliveryType; - - @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") - private Integer channel; - - @Schema(description = "微信支付订单号") - private String transactionId; - - @Schema(description = "微信退款订单号") - private String refundOrder; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户编号") - private String merchantCode; - - @Schema(description = "使用的优惠券id") - private Integer couponId; - - @Schema(description = "使用的会员卡id") - private String cardId; - - @Schema(description = "关联管理员id") - private Integer adminId; - - @Schema(description = "核销管理员id") - private Integer confirmId; - - @Schema(description = "IC卡号") - private String icCard; - - @Schema(description = "收货人id") - private Integer addressId; - - @Schema(description = "收货地址") - private String address; - - private String addressLat; - - private String addressLng; - - @Schema(description = "买家备注") - private String buyerRemarks; - - @Schema(description = "自提店铺id") - private Integer selfTakeMerchantId; - - @Schema(description = "自提店铺") - private String selfTakeMerchantName; - - @Schema(description = "配送开始时间") - private String sendStartTime; - - @Schema(description = "配送结束时间") - private String sendEndTime; - - @Schema(description = "发货店铺id") - private Integer expressMerchantId; - - @Schema(description = "发货店铺") - private String expressMerchantName; - - @Schema(description = "订单总额") - @NotNull(message = "订单总额不能为空") - @DecimalMin(value = "0.01", message = "订单总额必须大于0") - @Digits(integer = 10, fraction = 2, message = "订单总额格式不正确") - private BigDecimal totalPrice; - - @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") - @DecimalMin(value = "0", message = "减少金额不能为负数") - private BigDecimal reducePrice; - - @Schema(description = "实际付款") - @DecimalMin(value = "0", message = "实际付款不能为负数") - private BigDecimal payPrice; - - @Schema(description = "用于统计") - private BigDecimal price; - - @Schema(description = "价钱,用于积分赠送") - private BigDecimal money; - - @Schema(description = "退款金额") - private BigDecimal refundMoney; - - @Schema(description = "教练价格") - private BigDecimal coachPrice; - - @Schema(description = "购买数量") - @Min(value = 1, message = "购买数量必须大于0") - private Integer totalNum; - - @Schema(description = "教练id") - private Integer coachId; - - @Schema(description = "来源ID,存商品ID") - private Integer formId; - - @Schema(description = "支付的用户id") - private Integer payUserId; - - @Schema(description = "支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") - private Integer payType; - - @Schema(description = "微信支付子类型:JSAPI小程序支付,NATIVE扫码支付") - private String wechatPayType; - - @Schema(description = "代付支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") - private Integer friendPayType; - - @Schema(description = "0未付款,1已付款") - private Boolean payStatus; - - @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") - private Integer orderStatus; - - @Schema(description = "发货状态(10未发货 20已发货 30部分发货)") - private Integer deliveryStatus; - - @Schema(description = "发货备注") - private String deliveryNote; - - @Schema(description = "快递单号") - private String expressNo; - - @Schema(description = "发货时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime deliveryTime; - - @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") - private Integer couponType; - - @Schema(description = "优惠说明") - private String couponDesc; - - @Schema(description = "二维码地址,保存订单号,支付成功后才生成") - private String qrcode; - - @Schema(description = "vip月卡年卡、ic月卡年卡回退次数") - private Integer returnNum; - - @Schema(description = "vip充值回退金额") - private BigDecimal returnMoney; - - @Schema(description = "预约详情开始时间数组") - private String startTime; - - @Schema(description = "是否已开具发票:0未开发票,1已开发票,2不能开具发票") - private Integer isInvoice; - - @Schema(description = "发票流水号") - private String invoiceNo; - - @Schema(description = "支付时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime payTime; - - @Schema(description = "退款原因") - @NotBlank(message = "退款原因不能为空") - private String refundReason; - - @Schema(description = "退款时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime refundTime; - - @Schema(description = "申请退款时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime refundApplyTime; - - @Schema(description = "取消时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime cancelTime; - - @Schema(description = "取消原因") - private String cancelReason; - - @Schema(description = "过期时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime expirationTime; - - @Schema(description = "评价状态 0未评价 1已评价") - private Integer evaluateStatus; - - @Schema(description = "评价时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime evaluateTime; - - @Schema(description = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") - private Integer checkBill; - - @Schema(description = "订单是否已结算(0未结算 1已结算)") - private Integer isSettled; - - @Schema(description = "商户备注") - private String merchantRemarks; - - @Schema(description = "系统版本号 0当前版本 value=其他版本") - private Integer version; - - @Schema(description = "用户id") - private Integer userId; - - @Schema(description = "头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "真实姓名") - private String realName; - - @Schema(description = "手机号码") - @TableField(exist = false) - private String phone; - - @Schema(description = "手机号码(脱敏)") - @TableField(exist = false) - private String mobile; - - @Schema(description = "备注") - @Size(max = 500, message = "备注长度不能超过500字符") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - @NotNull(message = "租户ID不能为空") - private Integer tenantId; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "自提码") - private String selfTakeCode; - - @Schema(description = "是否已收到赠品") - private Boolean hasTakeGift; - - @Schema(description = "accessToken") - @TableField(exist = false) - private String accessToken; - - @Schema(description = "openid") - @TableField(exist = false) - private String openid; - - @Schema(description = "订单商品") - @TableField(exist = false) - private List orderGoods; - - @Schema(description = "快递id") - @TableField(exist = false) - private Integer expressId; - - @Schema(description = "发货人") - @TableField(exist = false) - private String sendName; - - @Schema(description = "发货人联系方式") - @TableField(exist = false) - private String sendPhone; - - @Schema(description = "发货地址") - @TableField(exist = false) - private String sendAddress; - - @TableField(exist = false) - private ShopOrderDelivery shopOrderDelivery; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDelivery.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDelivery.java deleted file mode 100644 index 18494fc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDelivery.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 发货单 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrderDelivery对象", description = "发货单") -public class ShopOrderDelivery implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "发货单ID") - @TableId(value = "delivery_id", type = IdType.AUTO) - private Integer deliveryId; - - @Schema(description = "订单ID") - private Integer orderId; - - @Schema(description = "发货方式(10手动录入 20无需物流 30电子面单)") - private Integer deliveryMethod; - - @Schema(description = "打包方式(废弃)") - private Integer packMethod; - - @Schema(description = "物流公司ID") - private Integer expressId; - - @Schema(description = "发货人") - private String sendName; - - @Schema(description = "发货人联系方式") - private String sendPhone; - - @Schema(description = "发货地址") - private String sendAddress; - - @Schema(description = "物流单号") - private String expressNo; - - @Schema(description = "电子面单模板内容") - private String eorderHtml; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @TableField(exist = false) - private String expressName; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDeliveryGoods.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDeliveryGoods.java deleted file mode 100644 index 55d8c0b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderDeliveryGoods.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 发货单商品 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrderDeliveryGoods对象", description = "发货单商品") -public class ShopOrderDeliveryGoods implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "发货单ID") - private Integer deliveryId; - - @Schema(description = "订单ID") - private Integer orderId; - - @Schema(description = "订单商品ID") - private Integer orderGoodsId; - - @Schema(description = "商品ID") - private Integer goodsId; - - @Schema(description = "发货数量") - private Integer deliveryNum; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderExtract.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderExtract.java deleted file mode 100644 index 8f81ebd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderExtract.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 自提订单联系方式 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrderExtract对象", description = "自提订单联系方式") -public class ShopOrderExtract implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "订单ID") - private Integer orderId; - - @Schema(description = "联系人姓名") - private String linkman; - - @Schema(description = "联系电话") - private String phone; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderGoods.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderGoods.java deleted file mode 100644 index 399dc40..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderGoods.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import java.time.LocalDate; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalTime; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import java.util.List; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品信息 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrderGoods对象", description = "商品信息") -public class ShopOrderGoods implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "关联订单表id") - private Integer orderId; - - @Schema(description = "订单标识") - private String orderCode; - - @Schema(description = "关联商户ID") - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商品封面图") - private String image; - - @Schema(description = "关联商品id") - private Integer goodsId; - - @Schema(description = "商品名称") - private String goodsName; - - @Schema(description = "商品规格") - private String spec; - - private Integer skuId; - - @Schema(description = "单价") - private BigDecimal price; - - @Schema(description = "购买数量") - private Integer totalNum; - - @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") - private Integer payStatus; - - @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") - private Integer orderStatus; - - @Schema(description = "是否免费:0收费、1免费") - private Boolean isFree; - - @Schema(description = "系统版本 0当前版本 其他版本") - private Integer version; - - @Schema(description = "预约时间段") - private String timePeriod; - - @Schema(description = "预定日期") - private LocalDate dateTime; - - @Schema(description = "开场时间") - private LocalTime startTime; - - @Schema(description = "结束时间") - private LocalTime endTime; - - @Schema(description = "毫秒时间戳") - private Long timeFlag; - - @Schema(description = "过期时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime expirationTime; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "用户id") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @TableField(exist = false) - private List goodsList; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfo.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfo.java deleted file mode 100644 index 4303cfd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfo.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import java.time.LocalDate; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalTime; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 场地 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrderInfo对象", description = "场地") -public class ShopOrderInfo implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "关联订单表id") - private Integer orderId; - - @Schema(description = "组合数据:日期+时间段+场馆id+场地id") - private String orderCode; - - @Schema(description = "关联商户ID") - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "关联场地id") - private Integer fieldId; - - @Schema(description = "场地名称") - private String fieldName; - - @Schema(description = "单价") - private BigDecimal price; - - @Schema(description = "儿童价") - private BigDecimal childrenPrice; - - @Schema(description = "成人人数") - private Integer adultNum; - - @Schema(description = "儿童人数") - private Integer childrenNum; - - @Schema(description = "已核销的成人票数") - private Integer adultNumUse; - - @Schema(description = "已核销的儿童票数") - private Integer childrenNumUse; - - @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") - private Integer payStatus; - - @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") - private Integer orderStatus; - - @Schema(description = "是否免费:0收费、1免费") - private Boolean isFree; - - @Schema(description = "是否支持儿童票:0不支持、1支持") - private Boolean isChildren; - - @Schema(description = "系统版本 0当前版本 其他版本") - private Integer version; - - @Schema(description = "预订类型:0全场,1半场") - private Boolean isHalf; - - @Schema(description = "预约时间段") - private String timePeriod; - - @Schema(description = "预定日期") - private LocalDate dateTime; - - @Schema(description = "开场时间") - private LocalTime startTime; - - @Schema(description = "结束时间") - private LocalTime endTime; - - @Schema(description = "毫秒时间戳") - private Long timeFlag; - - @Schema(description = "过期时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime expirationTime; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "用户id") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "更新时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfoLog.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfoLog.java deleted file mode 100644 index 67143da..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopOrderInfoLog.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 订单核销 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopOrderInfoLog对象", description = "订单核销") -public class ShopOrderInfoLog implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "关联订单表id") - private Integer orderId; - - @Schema(description = "关联商户ID") - private Long merchantId; - - @Schema(description = "关联场地id") - private Integer fieldId; - - @Schema(description = "核销数量") - private Boolean useNum; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopRechargeOrder.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopRechargeOrder.java deleted file mode 100644 index c54728c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopRechargeOrder.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 会员充值订单表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopRechargeOrder对象", description = "会员充值订单表") -public class ShopRechargeOrder implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "订单ID") - @TableId(value = "order_id", type = IdType.AUTO) - private Integer orderId; - - @Schema(description = "订单号") - private String orderNo; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "充值方式(10自定义金额 20套餐充值)") - private Integer rechargeType; - - @Schema(description = "机构id") - private Integer organizationId; - - @Schema(description = "充值套餐ID") - private Integer planId; - - @Schema(description = "用户支付金额") - private BigDecimal payPrice; - - @Schema(description = "赠送金额") - private BigDecimal giftMoney; - - @Schema(description = "实际到账金额") - private BigDecimal actualMoney; - - @Schema(description = "用户可用余额") - private BigDecimal balance; - - @Schema(description = "支付方式(微信/支付宝)") - private String payMethod; - - @Schema(description = "支付状态(10待支付 20已支付)") - private Integer payStatus; - - @Schema(description = "付款时间") - private Integer payTime; - - @Schema(description = "第三方交易记录ID") - private Integer tradeId; - - @Schema(description = "来源客户端 (APP、H5、小程序等)") - private String platform; - - @Schema(description = "所属门店ID") - private Integer shopId; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "商户编码") - private String merchantCode; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSpec.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSpec.java deleted file mode 100644 index 222cfb4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSpec.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 规格 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopSpec对象", description = "规格") -public class ShopSpec implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "规格ID") - @TableId(value = "spec_id", type = IdType.AUTO) - private Integer specId; - - @Schema(description = "规格名称") - private String specName; - - @Schema(description = "规格值") - private String specValue; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "创建用户") - private Integer userId; - - @Schema(description = "更新者") - private Integer updater; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1待修,2异常已修,3异常未修") - private Integer status; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSpecValue.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSpecValue.java deleted file mode 100644 index 18d3d22..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSpecValue.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 规格值 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopSpecValue对象", description = "规格值") -public class ShopSpecValue implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "规格值ID") - @TableId(value = "spec_value_id", type = IdType.AUTO) - private Integer specValueId; - - @Schema(description = "规格组ID") - private Integer specId; - - @Schema(description = "规格值") - private String specValue; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSplash.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSplash.java deleted file mode 100644 index 6359fe8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopSplash.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 开屏广告 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopSplash对象", description = "开屏广告") -public class ShopSplash implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "标题") - private String title; - - @Schema(description = "图片") - private String image; - - @Schema(description = "跳转类型") - private String jumpType; - - @Schema(description = "跳转主键") - private Integer jumpPk; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUser.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUser.java deleted file mode 100644 index f540f64..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUser.java +++ /dev/null @@ -1,254 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableLogic; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import java.time.LocalDateTime; - -/** - * 用户记录表 - * - * @author 科技小王子 - * @since 2025-10-03 13:41:09 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(description = "用户记录表") -public class ShopUser implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "用户id") - private Integer userId; - - @Schema(description = "用户类型 0个人用户 1企业用户 2其他") - private Integer type; - - @Schema(description = "账号") - private String username; - - @Schema(description = "密码") - private String password; - - @Schema(description = "昵称") - private String nickname; - - @Schema(description = "手机号") - private String phone; - - @Schema(description = "性别 1男 2女") - private Integer sex; - - @Schema(description = "职务") - private String position; - - @Schema(description = "注册来源客户端 (APP、H5、MP-WEIXIN等)") - private String platform; - - @Schema(description = "邮箱") - private String email; - - @Schema(description = "邮箱是否验证, 0否, 1是") - private Integer emailVerified; - - @Schema(description = "别名") - private String alias; - - @Schema(description = "真实姓名") - private String realName; - - @Schema(description = "证件号码") - private String idCard; - - @Schema(description = "出生日期") - private LocalDate birthday; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "经度") - private String longitude; - - @Schema(description = "纬度") - private String latitude; - - @Schema(description = "用户可用余额") - private BigDecimal balance; - - @Schema(description = "已提现金额") - private BigDecimal cashedMoney; - - @Schema(description = "用户可用积分") - private Integer points; - - @Schema(description = "用户总支付的金额") - private BigDecimal payMoney; - - @Schema(description = "实际消费的金额(不含退款)") - private BigDecimal expendMoney; - - @Schema(description = "密码") - private String payPassword; - - @Schema(description = "会员等级ID") - private Integer gradeId; - - @Schema(description = "行业分类") - private String category; - - @Schema(description = "个人简介") - private String introduction; - - @Schema(description = "机构id") - private Integer organizationId; - - @Schema(description = "会员分组ID") - private Integer groupId; - - @Schema(description = "头像") - private String avatar; - - @Schema(description = "背景图") - private String bgImage; - - @Schema(description = "用户编码") - private String userCode; - - @Schema(description = "是否已实名认证") - private Integer certification; - - @Schema(description = "年龄") - private Integer age; - - @Schema(description = "是否线下会员") - private Boolean offline; - - @Schema(description = "关注数") - private Integer followers; - - @Schema(description = "粉丝数") - private Integer fans; - - @Schema(description = "点赞数") - private Integer likes; - - @Schema(description = "评论数") - private Integer commentNumbers; - - @Schema(description = "是否推荐") - private Integer recommend; - - @Schema(description = "微信openid") - private String openid; - - @Schema(description = "微信公众号openid") - private String officeOpenid; - - @Schema(description = "微信unionID") - private String unionid; - - @Schema(description = "客户端ID") - private String clientId; - - @Schema(description = "不允许办卡") - private Boolean notAllowVip; - - @Schema(description = "是否管理员") - private Boolean isAdmin; - - @Schema(description = "是否企业管理员") - private Boolean isOrganizationAdmin; - - @Schema(description = "累计登录次数") - private Integer loginNum; - - @Schema(description = "企业ID") - private Integer companyId; - - @Schema(description = "可管理的场馆") - private String merchants; - - @Schema(description = "商户ID") - private Integer merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户头像") - private String merchantAvatar; - - @Schema(description = "第三方系统的用户ID") - private Integer uid; - - @Schema(description = "专家角色") - private Boolean expertType; - - @Schema(description = "过期时间") - private Integer expireTime; - - @Schema(description = "最后结算时间") - private LocalDateTime settlementTime; - - @Schema(description = "资质") - private String aptitude; - - @Schema(description = "行业类型(父级)") - private String industryParent; - - @Schema(description = "行业类型(子级)") - private String industryChild; - - @Schema(description = "头衔") - private String title; - - @Schema(description = "安装的产品ID") - private Integer templateId; - - @Schema(description = "插件安装状态(仅对超超管判断) 0未安装 1已安装 ") - private Integer installed; - - @Schema(description = "特长") - private String speciality; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0在线, 1离线") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserAddress.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserAddress.java deleted file mode 100644 index e95686f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserAddress.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.io.Serializable; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 收货地址 - * - * @author 科技小王子 - * @since 2025-07-22 23:06:40 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopUserAddress对象", description = "收货地址") -public class ShopUserAddress implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "姓名") - private String name; - - @Schema(description = "手机号码") - private String phone; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "收货地址") - private String address; - - @Schema(description = "收货地址") - private String fullAddress; - - private String lat; - - private String lng; - - @Schema(description = "1先生 2女士") - private Integer gender; - - @Schema(description = "家、公司、学校") - private String type; - - @Schema(description = "默认收货地址") - private Boolean isDefault; - - @Schema(description = "排序号") - private Integer sortNumber; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserBalanceLog.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserBalanceLog.java deleted file mode 100644 index 32726fc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserBalanceLog.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 用户余额变动明细表 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopUserBalanceLog对象", description = "用户余额变动明细表") -public class ShopUserBalanceLog implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "log_id", type = IdType.AUTO) - private Integer logId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "余额变动场景(0下级下单1供应商收入2差价收益 10用户充值 20用户消费 30管理员操作 40订单退款)") - private Integer scene; - - @Schema(description = "变动金额") - private BigDecimal money; - - @Schema(description = "变动后余额") - private BigDecimal balance; - - @Schema(description = "管理员备注") - private String remark; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "操作人ID") - private Integer adminId; - - @Schema(description = "排序(数字越小越靠前)") - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "商户编码") - private String merchantCode; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserCollection.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserCollection.java deleted file mode 100644 index 498c2fd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserCollection.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 我的收藏 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopUserCollection对象", description = "我的收藏") -public class ShopUserCollection implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "0店铺,1商品") - private Boolean type; - - @Schema(description = "租户ID") - private Integer tid; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "注册时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java deleted file mode 100644 index d25ad57..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserCoupon.java +++ /dev/null @@ -1,210 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 用户优惠券 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopUserCoupon对象", description = "用户优惠券") -public class ShopUserCoupon implements Serializable { - private static final long serialVersionUID = 1L; - - // 优惠券类型常量 - public static final int TYPE_REDUCE = 10; // 满减券 - public static final int TYPE_DISCOUNT = 20; // 折扣券 - public static final int TYPE_FREE = 30; // 免费券 - - // 使用状态常量 - public static final int STATUS_UNUSED = 0; // 未使用 - public static final int STATUS_USED = 1; // 已使用 - public static final int STATUS_EXPIRED = 2; // 已过期 - - // 获取方式常量 - public static final int OBTAIN_ACTIVE = 10; // 主动领取 - public static final int OBTAIN_SYSTEM = 20; // 系统发放 - public static final int OBTAIN_ACTIVITY = 30; // 活动赠送 - - // 适用范围常量 - public static final int APPLY_ALL = 10; // 全部商品 - public static final int APPLY_GOODS = 20; // 指定商品 - public static final int APPLY_CATEGORY = 30; // 指定分类 - - @Schema(description = "id") - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @Schema(description = "优惠券模板ID") - private Integer couponId; - - @Schema(description = "用户ID") - private Integer userId; - - @Schema(description = "优惠券名称") - private String name; - - @Schema(description = "优惠券描述") - private String description; - - @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") - private Integer type; - - @Schema(description = "满减券-减免金额") - @JsonSerialize(using = ToStringSerializer.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - private BigDecimal reducePrice; - - @Schema(description = "折扣券-折扣率(0-100)") - private Integer discount; - - @Schema(description = "最低消费金额") - @JsonSerialize(using = ToStringSerializer.class) - @JsonInclude(JsonInclude.Include.NON_NULL) - private BigDecimal minPrice; - - @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") - private Integer applyRange; - - @Schema(description = "到期类型(10领取后生效 20固定时间)") - private Integer expireType; - - @Schema(description = "领取后生效-有效天数") - private Integer expireDay; - - @Schema(description = "适用范围配置(json格式)") - private String applyRangeConfig; - - @Schema(description = "是否过期(0未过期 1已过期)") - private Integer isExpire; - - @Schema(description = "有效期开始时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime startTime; - - @Schema(description = "有效期结束时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime endTime; - - @Schema(description = "使用状态(0未使用 1已使用 2已过期)") - private Integer status; - - @Schema(description = "使用时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime useTime; - - @Schema(description = "使用订单ID") - private Integer orderId; - - @Schema(description = "是否已使用") - private Integer isUse; - - @Schema(description = "使用订单号") - private String orderNo; - - @Schema(description = "获取方式(10主动领取 20系统发放 30活动赠送)") - private Integer obtainType; - - @Schema(description = "获取来源描述") - private String obtainSource; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Boolean deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - - @TableField(exist = false) - private ShopCoupon couponItem; - - /** - * 判断优惠券是否可用 - * @return true-可用,false-不可用 - */ - public boolean isAvailable() { - return this.status != null && this.status == STATUS_UNUSED && !isExpired(); - } - - /** - * 判断优惠券是否已使用 - * @return true-已使用,false-未使用 - */ - public boolean isUsed() { - return this.status != null && this.status == STATUS_USED; - } - - /** - * 判断优惠券是否已过期 - * @return true-已过期,false-未过期 - */ - public boolean isExpired() { - if (this.status != null && this.status == STATUS_EXPIRED) { - return true; - } - return this.endTime != null && this.endTime.isBefore(LocalDateTime.now()); - } - - /** - * 获取优惠券状态描述 - * @return 状态描述 - */ - public String getStatusDesc() { - if (isExpired()) { - return "已过期"; - } else if (isUsed()) { - return "已使用"; - } else if (isAvailable()) { - return "可使用"; - } else { - return "未知状态"; - } - } - - /** - * 更新优惠券状态为已使用 - * @param orderId 订单ID - * @param orderNo 订单号 - */ - public void markAsUsed(Integer orderId, String orderNo) { - this.status = STATUS_USED; - this.isUse = 1; - this.useTime = LocalDateTime.now(); - this.orderId = orderId; - this.orderNo = orderNo; - } - - /** - * 更新优惠券状态为已过期 - */ - public void markAsExpired() { - this.status = STATUS_EXPIRED; - this.isExpire = 1; - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java deleted file mode 100644 index 231d023..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopUserReferee.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import java.time.LocalDateTime; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.baomidou.mybatisplus.annotation.TableLogic; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 用户推荐关系表 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopUserReferee对象", description = "用户推荐关系表") -public class ShopUserReferee implements Serializable { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "推荐人ID") - private Integer dealerId; - - @Schema(description = "分销商名称") - @TableField(exist = false) - private String dealerName; - - @Schema(description = "分销商头像") - @TableField(exist = false) - private String dealerAvatar; - - @Schema(description = "分销商手机号") - @TableField(exist = false) - private String dealerPhone; - - @Schema(description = "用户id(被推荐人)") - private Integer userId; - - @Schema(description = "昵称") - @TableField(exist = false) - private String nickname; - - @Schema(description = "头像") - @TableField(exist = false) - private String avatar; - - @Schema(description = "手机号") - @TableField(exist = false) - private String phone; - - @Schema(description = "推荐关系层级(1,2,3)") - private Integer level; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否删除, 0否, 1是") - @TableLogic - private Integer deleted; - - @Schema(description = "租户id") - private Integer tenantId; - - @Schema(description = "创建时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime createTime; - - @Schema(description = "修改时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime updateTime; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopWechatDeposit.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopWechatDeposit.java deleted file mode 100644 index c552a03..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/entity/ShopWechatDeposit.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.shop.entity; - -import java.math.BigDecimal; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 押金 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Schema(name = "ShopWechatDeposit对象", description = "押金") -public class ShopWechatDeposit implements Serializable { - private static final long serialVersionUID = 1L; - - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - @Schema(description = "订单id") - private Integer oid; - - @Schema(description = "用户id") - private Integer uid; - - @Schema(description = "场地订单号") - private String orderNum; - - @Schema(description = "付款订单号") - private String wechatOrder; - - @Schema(description = "退款订单号 ") - private String wechatReturn; - - @Schema(description = "场馆名称") - private String siteName; - - @Schema(description = "微信昵称") - private String username; - - @Schema(description = "手机号码") - private String phone; - - @Schema(description = "物品名称") - private String name; - - @Schema(description = "押金金额") - private BigDecimal price; - - @Schema(description = "押金状态,1已付款,2未付款,已退押金") - private Boolean status; - - @Schema(description = "创建时间") - private Integer createTime; - - @Schema(description = "租户id") - private Integer tenantId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.class b/jczxw-java/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.class deleted file mode 100644 index 48a4a6c..0000000 Binary files a/jczxw-java/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.class and /dev/null differ diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.java deleted file mode 100644 index 3fd46c0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/enums/OrderStatusEnum.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.gxwebsoft.shop.enums; - -/** - * 订单状态枚举 - */ -public enum OrderStatusEnum { - ALL(-1, "全部"), - WAIT_PAY(0, "待支付"), - WAIT_DELIVERY(1, "待发货"), - WAIT_CONFIRM(2, "待核销"), - WAIT_RECEIVE(3, "待收货"), - WAIT_EVALUATE(4, "待评价"), - COMPLETED(5, "已完成"), - REFUNDED(6, "已退款"), - DELETED(7, "已删除"); - - private final Integer code; - private final String desc; - - OrderStatusEnum(Integer code, String desc) { - this.code = code; - this.desc = desc; - } - - public Integer getCode() { - return code; - } - - public String getDesc() { - return desc; - } -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopArticleMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopArticleMapper.java deleted file mode 100644 index d6d3d85..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopArticleMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopArticle; -import com.gxwebsoft.shop.param.ShopArticleParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品文章Mapper - * - * @author 科技小王子 - * @since 2025-08-13 05:14:53 - */ -public interface ShopArticleMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopArticleParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopArticleParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopBrandMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopBrandMapper.java deleted file mode 100644 index 49a914d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopBrandMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopBrand; -import com.gxwebsoft.shop.param.ShopBrandParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 品牌Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopBrandMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopBrandParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopBrandParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCartMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCartMapper.java deleted file mode 100644 index ae8b981..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCartMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCart; -import com.gxwebsoft.shop.param.ShopCartParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 购物车Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopCartMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCartParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCartParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCategoryMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCategoryMapper.java deleted file mode 100644 index 2cfd98c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCategoryMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCategory; -import com.gxwebsoft.shop.param.ShopCategoryParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品分类Mapper - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -public interface ShopCategoryMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCategoryParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCategoryParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopChatConversationMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopChatConversationMapper.java deleted file mode 100644 index 483b761..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopChatConversationMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopChatConversation; -import com.gxwebsoft.shop.param.ShopChatConversationParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 聊天消息表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopChatConversationMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopChatConversationParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopChatConversationParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopChatMessageMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopChatMessageMapper.java deleted file mode 100644 index 264bc4b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopChatMessageMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopChatMessage; -import com.gxwebsoft.shop.param.ShopChatMessageParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 聊天消息表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopChatMessageMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopChatMessageParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopChatMessageParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCommissionRoleMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCommissionRoleMapper.java deleted file mode 100644 index 2f66f28..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCommissionRoleMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCommissionRole; -import com.gxwebsoft.shop.param.ShopCommissionRoleParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分红角色Mapper - * - * @author 科技小王子 - * @since 2025-05-01 10:01:15 - */ -public interface ShopCommissionRoleMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCommissionRoleParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCommissionRoleParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCountMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCountMapper.java deleted file mode 100644 index 24701c6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCountMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCount; -import com.gxwebsoft.shop.param.ShopCountParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商城销售统计表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopCountMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCountParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCountParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyCateMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyCateMapper.java deleted file mode 100644 index 6d86d1d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyCateMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 优惠券可用分类Mapper - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -public interface ShopCouponApplyCateMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCouponApplyCateParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCouponApplyCateParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyItemMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyItemMapper.java deleted file mode 100644 index 077989a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponApplyItemMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 优惠券可用分类Mapper - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -public interface ShopCouponApplyItemMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCouponApplyItemParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCouponApplyItemParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java deleted file mode 100644 index a6a8ff1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopCouponMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopCoupon; -import com.gxwebsoft.shop.param.ShopCouponParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 优惠券Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:23 - */ -public interface ShopCouponMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopCouponParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopCouponParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerApplyMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerApplyMapper.java deleted file mode 100644 index ce2ee91..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerApplyMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerApply; -import com.gxwebsoft.shop.param.ShopDealerApplyParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商申请记录表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:50:18 - */ -public interface ShopDealerApplyMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerApplyParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerApplyParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerBankMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerBankMapper.java deleted file mode 100644 index 2ec78ed..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerBankMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerBank; -import com.gxwebsoft.shop.param.ShopDealerBankParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商提现银行卡Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerBankMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerBankParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerBankParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerCapitalMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerCapitalMapper.java deleted file mode 100644 index d996c07..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerCapitalMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.param.ShopDealerCapitalParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商资金明细表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerCapitalMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerCapitalParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerCapitalParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerOrderMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerOrderMapper.java deleted file mode 100644 index 928b066..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerOrderMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerOrder; -import com.gxwebsoft.shop.param.ShopDealerOrderParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商订单记录表Mapper - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -public interface ShopDealerOrderMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerOrderParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerOrderParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRecordMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRecordMapper.java deleted file mode 100644 index 09f365f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRecordMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerRecord; -import com.gxwebsoft.shop.param.ShopDealerRecordParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 客户跟进情况Mapper - * - * @author 科技小王子 - * @since 2025-10-02 12:21:50 - */ -public interface ShopDealerRecordMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerRecordParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerRecordParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRefereeMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRefereeMapper.java deleted file mode 100644 index 70ddf37..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerRefereeMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerReferee; -import com.gxwebsoft.shop.param.ShopDealerRefereeParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商推荐关系表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerRefereeMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerRefereeParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerRefereeParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerSettingMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerSettingMapper.java deleted file mode 100644 index 5d10a6c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerSettingMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerSetting; -import com.gxwebsoft.shop.param.ShopDealerSettingParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商设置表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerSettingMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerSettingParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerSettingParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerUserMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerUserMapper.java deleted file mode 100644 index c1b5fd3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerUserMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.param.ShopDealerUserParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商用户记录表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerUserMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerUserParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerUserParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerWithdrawMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerWithdrawMapper.java deleted file mode 100644 index 0d5a427..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopDealerWithdrawMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopDealerWithdraw; -import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分销商提现明细表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerWithdrawMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopDealerWithdrawParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopDealerWithdrawParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressMapper.java deleted file mode 100644 index 1d236e7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopExpress; -import com.gxwebsoft.shop.param.ShopExpressParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 物流公司Mapper - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -public interface ShopExpressMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopExpressParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopExpressParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateDetailMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateDetailMapper.java deleted file mode 100644 index fd26f85..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateDetailMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; -import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 运费模板Mapper - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -public interface ShopExpressTemplateDetailMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopExpressTemplateDetailParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopExpressTemplateDetailParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateMapper.java deleted file mode 100644 index a205498..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopExpressTemplateMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopExpressTemplate; -import com.gxwebsoft.shop.param.ShopExpressTemplateParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 运费模板Mapper - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -public interface ShopExpressTemplateMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopExpressTemplateParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopExpressTemplateParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGiftMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGiftMapper.java deleted file mode 100644 index bf0a45d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGiftMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGift; -import com.gxwebsoft.shop.param.ShopGiftParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 礼品卡Mapper - * - * @author 科技小王子 - * @since 2025-08-11 18:07:31 - */ -public interface ShopGiftMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGiftParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGiftParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCategoryMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCategoryMapper.java deleted file mode 100644 index ff7e088..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCategoryMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsCategory; -import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品分类Mapper - * - * @author 科技小王子 - * @since 2025-05-01 00:36:45 - */ -public interface ShopGoodsCategoryMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsCategoryParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsCategoryParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCommentMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCommentMapper.java deleted file mode 100644 index 302a1f0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsCommentMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsComment; -import com.gxwebsoft.shop.param.ShopGoodsCommentParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 评论表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsCommentMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsCommentParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsCommentParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsIncomeConfigMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsIncomeConfigMapper.java deleted file mode 100644 index 9091b99..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsIncomeConfigMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; -import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 分润配置Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsIncomeConfigMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsIncomeConfigParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsIncomeConfigParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsLogMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsLogMapper.java deleted file mode 100644 index 946b338..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsLogMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsLog; -import com.gxwebsoft.shop.param.ShopGoodsLogParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品日志表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsLogMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsLogParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsLogParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsMapper.java deleted file mode 100644 index 20ac974..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsMapper.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.param.ShopGoodsParam; -import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Update; - -import java.util.List; - -/** - * 商品Mapper - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -public interface ShopGoodsMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsParam param); - - /** - * 累加商品销售数量 - * 使用@InterceptorIgnore忽略租户隔离,确保能更新成功 - * - * @param goodsId 商品ID - * @param saleCount 累加的销售数量 - * @return 影响的行数 - */ - @InterceptorIgnore(tenantLine = "true") - @Update("UPDATE shop_goods SET sales = IFNULL(sales, 0) + #{saleCount} WHERE goods_id = #{goodsId}") - int addSaleCount(@Param("goodsId") Integer goodsId, @Param("saleCount") Integer saleCount); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRelationMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRelationMapper.java deleted file mode 100644 index 2e02403..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRelationMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsRelation; -import com.gxwebsoft.shop.param.ShopGoodsRelationParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品点赞和收藏表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsRelationMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsRelationParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsRelationParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRoleCommissionMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRoleCommissionMapper.java deleted file mode 100644 index d68181d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsRoleCommissionMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; -import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品绑定角色的分润金额Mapper - * - * @author 科技小王子 - * @since 2025-05-01 09:53:38 - */ -public interface ShopGoodsRoleCommissionMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsRoleCommissionParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsRoleCommissionParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSkuMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSkuMapper.java deleted file mode 100644 index 072ebd9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSkuMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsSku; -import com.gxwebsoft.shop.param.ShopGoodsSkuParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品sku列表Mapper - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -public interface ShopGoodsSkuMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsSkuParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsSkuParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSpecMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSpecMapper.java deleted file mode 100644 index 503e262..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopGoodsSpecMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopGoodsSpec; -import com.gxwebsoft.shop.param.ShopGoodsSpecParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商品多规格Mapper - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -public interface ShopGoodsSpecMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopGoodsSpecParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopGoodsSpecParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantAccountMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantAccountMapper.java deleted file mode 100644 index cbbe061..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantAccountMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopMerchantAccount; -import com.gxwebsoft.shop.param.ShopMerchantAccountParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商户账号Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopMerchantAccountMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopMerchantAccountParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopMerchantAccountParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantApplyMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantApplyMapper.java deleted file mode 100644 index 3377503..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantApplyMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopMerchantApply; -import com.gxwebsoft.shop.param.ShopMerchantApplyParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商户入驻申请Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopMerchantApplyMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopMerchantApplyParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopMerchantApplyParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantMapper.java deleted file mode 100644 index 747a9c3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopMerchant; -import com.gxwebsoft.shop.param.ShopMerchantParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商户Mapper - * - * @author 科技小王子 - * @since 2025-08-10 20:43:33 - */ -public interface ShopMerchantMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopMerchantParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopMerchantParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantTypeMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantTypeMapper.java deleted file mode 100644 index e1ea739..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopMerchantTypeMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopMerchantType; -import com.gxwebsoft.shop.param.ShopMerchantTypeParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 商户类型Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopMerchantTypeMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopMerchantTypeParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopMerchantTypeParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryGoodsMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryGoodsMapper.java deleted file mode 100644 index ae5af95..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryGoodsMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; -import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 发货单商品Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderDeliveryGoodsMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderDeliveryGoodsParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderDeliveryGoodsParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryMapper.java deleted file mode 100644 index cfe334b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderDeliveryMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrderDelivery; -import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 发货单Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderDeliveryMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderDeliveryParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderDeliveryParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderExtractMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderExtractMapper.java deleted file mode 100644 index 643a832..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderExtractMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrderExtract; -import com.gxwebsoft.shop.param.ShopOrderExtractParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 自提订单联系方式Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderExtractMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderExtractParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderExtractParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderGoodsMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderGoodsMapper.java deleted file mode 100644 index 69b747d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderGoodsMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.param.ShopOrderGoodsParam; -import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; - -import java.util.List; - -/** - * 商品信息Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderGoodsMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderGoodsParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderGoodsParam param); - - /** - * 根据订单ID查询订单商品列表(忽略租户隔离) - * @param orderId 订单ID - * @return List - */ - @InterceptorIgnore(tenantLine = "true") - @Select("SELECT * FROM shop_order_goods WHERE order_id = #{orderId}") - List selectListByOrderIdIgnoreTenant(@Param("orderId") Integer orderId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoLogMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoLogMapper.java deleted file mode 100644 index f7f98a4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoLogMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrderInfoLog; -import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 订单核销Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderInfoLogMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderInfoLogParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderInfoLogParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoMapper.java deleted file mode 100644 index bbbc1ab..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderInfoMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrderInfo; -import com.gxwebsoft.shop.param.ShopOrderInfoParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 场地Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderInfoMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderInfoParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderInfoParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderMapper.java deleted file mode 100644 index 88aaf0d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopOrderMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.param.ShopOrderParam; -import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.Select; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 订单Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopOrderParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopOrderParam param); - - @InterceptorIgnore(tenantLine = "true") - ShopOrder getByOutTradeNo(@Param("outTradeNo") String outTradeNo); - - @InterceptorIgnore(tenantLine = "true") - void updateByOutTradeNo(@Param("param") ShopOrder order); - - /** - * 统计订单总金额 - * 只统计已支付的订单(pay_status = 1)且未删除的订单(deleted = 0) - * - * @return 订单总金额 - */ - @Select("SELECT COALESCE(SUM(pay_price), 0) FROM shop_order WHERE pay_status = 1 AND deleted = 0 AND pay_price IS NOT NULL") - BigDecimal selectTotalAmount(); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopRechargeOrderMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopRechargeOrderMapper.java deleted file mode 100644 index 1c25555..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopRechargeOrderMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopRechargeOrder; -import com.gxwebsoft.shop.param.ShopRechargeOrderParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 会员充值订单表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopRechargeOrderMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopRechargeOrderParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopRechargeOrderParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecMapper.java deleted file mode 100644 index 1999c43..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopSpec; -import com.gxwebsoft.shop.param.ShopSpecParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 规格Mapper - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -public interface ShopSpecMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopSpecParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopSpecParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecValueMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecValueMapper.java deleted file mode 100644 index 42815c5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSpecValueMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopSpecValue; -import com.gxwebsoft.shop.param.ShopSpecValueParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 规格值Mapper - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -public interface ShopSpecValueMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopSpecValueParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopSpecValueParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSplashMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSplashMapper.java deleted file mode 100644 index db49cb4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopSplashMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopSplash; -import com.gxwebsoft.shop.param.ShopSplashParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 开屏广告Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopSplashMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopSplashParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopSplashParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserAddressMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserAddressMapper.java deleted file mode 100644 index d89f1a6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserAddressMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopUserAddress; -import com.gxwebsoft.shop.param.ShopUserAddressParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 收货地址Mapper - * - * @author 科技小王子 - * @since 2025-07-22 23:06:40 - */ -public interface ShopUserAddressMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserAddressParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopUserAddressParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserBalanceLogMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserBalanceLogMapper.java deleted file mode 100644 index 4169458..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserBalanceLogMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopUserBalanceLog; -import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 用户余额变动明细表Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopUserBalanceLogMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserBalanceLogParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopUserBalanceLogParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCollectionMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCollectionMapper.java deleted file mode 100644 index f285ae4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCollectionMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopUserCollection; -import com.gxwebsoft.shop.param.ShopUserCollectionParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 我的收藏Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopUserCollectionMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserCollectionParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopUserCollectionParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java deleted file mode 100644 index 07c4c43..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserCouponMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.param.ShopUserCouponParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 用户优惠券Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopUserCouponMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserCouponParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopUserCouponParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserMapper.java deleted file mode 100644 index e7a09c4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopUser; -import com.gxwebsoft.shop.param.ShopUserParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 用户记录表Mapper - * - * @author 科技小王子 - * @since 2025-10-03 13:41:09 - */ -public interface ShopUserMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopUserParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserRefereeMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserRefereeMapper.java deleted file mode 100644 index 207fd90..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopUserRefereeMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopUserReferee; -import com.gxwebsoft.shop.param.ShopUserRefereeParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 用户推荐关系表Mapper - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopUserRefereeMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopUserRefereeParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopUserRefereeParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopWechatDepositMapper.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopWechatDepositMapper.java deleted file mode 100644 index 3c8424c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/ShopWechatDepositMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.gxwebsoft.shop.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.gxwebsoft.shop.entity.ShopWechatDeposit; -import com.gxwebsoft.shop.param.ShopWechatDepositParam; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * 押金Mapper - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopWechatDepositMapper extends BaseMapper { - - /** - * 分页查询 - * - * @param page 分页对象 - * @param param 查询参数 - * @return List - */ - List selectPageRel(@Param("page") IPage page, - @Param("param") ShopWechatDepositParam param); - - /** - * 查询全部 - * - * @param param 查询参数 - * @return List - */ - List selectListRel(@Param("param") ShopWechatDepositParam param); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopArticleMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopArticleMapper.xml deleted file mode 100644 index 119dc2e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopArticleMapper.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_article a - - - AND a.article_id = #{param.articleId} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.type = #{param.type} - - - AND a.model LIKE CONCAT('%', #{param.model}, '%') - - - AND a.detail LIKE CONCAT('%', #{param.detail}, '%') - - - AND a.category_id = #{param.categoryId} - - - AND a.parent_id = #{param.parentId} - - - AND a.topic LIKE CONCAT('%', #{param.topic}, '%') - - - AND a.tags LIKE CONCAT('%', #{param.tags}, '%') - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.image_width = #{param.imageWidth} - - - AND a.image_height = #{param.imageHeight} - - - AND a.price = #{param.price} - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - - AND a.source LIKE CONCAT('%', #{param.source}, '%') - - - AND a.overview LIKE CONCAT('%', #{param.overview}, '%') - - - AND a.virtual_views = #{param.virtualViews} - - - AND a.actual_views = #{param.actualViews} - - - AND a.rate = #{param.rate} - - - AND a.show_type = #{param.showType} - - - AND a.password LIKE CONCAT('%', #{param.password}, '%') - - - AND a.permission = #{param.permission} - - - AND a.platform LIKE CONCAT('%', #{param.platform}, '%') - - - AND a.files LIKE CONCAT('%', #{param.files}, '%') - - - AND a.video LIKE CONCAT('%', #{param.video}, '%') - - - AND a.accept LIKE CONCAT('%', #{param.accept}, '%') - - - AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') - - - AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.likes = #{param.likes} - - - AND a.comment_numbers = #{param.commentNumbers} - - - AND a.to_users LIKE CONCAT('%', #{param.toUsers}, '%') - - - AND a.author LIKE CONCAT('%', #{param.author}, '%') - - - AND a.recommend = #{param.recommend} - - - AND a.bm_users = #{param.bmUsers} - - - AND a.user_id = #{param.userId} - - - AND a.project_id = #{param.projectId} - - - AND a.lang LIKE CONCAT('%', #{param.lang}, '%') - - - AND a.lang_article_id = #{param.langArticleId} - - - AND a.translation = #{param.translation} - - - AND a.editor = #{param.editor} - - - AND a.pdf_url LIKE CONCAT('%', #{param.pdfUrl}, '%') - - - AND a.version = #{param.version} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopBrandMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopBrandMapper.xml deleted file mode 100644 index bf5177f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopBrandMapper.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_brand a - - - AND a.brand_id = #{param.brandId} - - - AND a.brand_name LIKE CONCAT('%', #{param.brandName}, '%') - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCartMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCartMapper.xml deleted file mode 100644 index 318a402..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCartMapper.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_cart a - - - AND a.id = #{param.id} - - - AND a.type = #{param.type} - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.goods_id LIKE CONCAT('%', #{param.goodsId}, '%') - - - AND a.spec LIKE CONCAT('%', #{param.spec}, '%') - - - AND a.price = #{param.price} - - - AND a.cart_num = #{param.cartNum} - - - AND a.total_price = #{param.totalPrice} - - - AND a.is_pay = #{param.isPay} - - - AND a.is_new = #{param.isNew} - - - AND a.is_show = #{param.isShow} - - - AND a.combination_id = #{param.combinationId} - - - AND a.seckill_id = #{param.seckillId} - - - AND a.bargain_id = #{param.bargainId} - - - AND a.selected = #{param.selected} - - - AND a.merchant_id LIKE CONCAT('%', #{param.merchantId}, '%') - - - AND a.user_id LIKE CONCAT('%', #{param.userId}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCategoryMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCategoryMapper.xml deleted file mode 100644 index e3596c6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCategoryMapper.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_category a - - - AND a.id = #{param.id} - - - AND a.parent_id = #{param.parentId} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.model LIKE CONCAT('%', #{param.model}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.path LIKE CONCAT('%', #{param.path}, '%') - - - AND a.component LIKE CONCAT('%', #{param.component}, '%') - - - AND a.target LIKE CONCAT('%', #{param.target}, '%') - - - AND a.icon LIKE CONCAT('%', #{param.icon}, '%') - - - AND a.banner LIKE CONCAT('%', #{param.banner}, '%') - - - AND a.color LIKE CONCAT('%', #{param.color}, '%') - - - AND a.hide = #{param.hide} - - - AND a.permission = #{param.permission} - - - AND a.password LIKE CONCAT('%', #{param.password}, '%') - - - AND a.position = #{param.position} - - - AND a.top = #{param.top} - - - AND a.bottom = #{param.bottom} - - - AND a.active LIKE CONCAT('%', #{param.active}, '%') - - - AND a.meta LIKE CONCAT('%', #{param.meta}, '%') - - - AND a.style LIKE CONCAT('%', #{param.style}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.merchant_id = #{param.merchantId} - - - AND a.lang LIKE CONCAT('%', #{param.lang}, '%') - - - AND a.home = #{param.home} - - - AND a.recommend = #{param.recommend} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.status = #{param.status} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatConversationMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatConversationMapper.xml deleted file mode 100644 index 4f133fc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatConversationMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_chat_conversation a - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND a.friend_id = #{param.friendId} - - - AND a.type = #{param.type} - - - AND a.content LIKE CONCAT('%', #{param.content}, '%') - - - AND a.un_read = #{param.unRead} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatMessageMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatMessageMapper.xml deleted file mode 100644 index b3c356f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopChatMessageMapper.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - SELECT a.*, b.nickname as formUserName, b.avatar as formUserAvatar, b.phone as formUserPhone, b.alias as formUserAlias, - c.nickname as toUserName, c.avatar as toUserAvatar, c.phone as toUserPhone, c.alias as toUserAlias - FROM shop_chat_message a - LEFT JOIN gxwebsoft_core.sys_user b ON a.form_user_id = b.user_id - LEFT JOIN gxwebsoft_core.sys_user c ON a.to_user_id = c.user_id - - - AND a.id = #{param.id} - - - AND a.form_user_id = #{param.formUserId} - - - AND a.to_user_id = #{param.toUserId} - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.content LIKE CONCAT('%', #{param.content}, '%') - - - AND a.side_to = #{param.sideTo} - - - AND a.side_from = #{param.sideFrom} - - - AND a.withdraw = #{param.withdraw} - - - AND a.file_info LIKE CONCAT('%', #{param.fileInfo}, '%') - - - AND a.has_contact = #{param.hasContact} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommissionRoleMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommissionRoleMapper.xml deleted file mode 100644 index 74e6faa..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCommissionRoleMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_commission_role a - - - AND a.id = #{param.id} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.province_id = #{param.provinceId} - - - AND a.city_id = #{param.cityId} - - - AND a.region_id = #{param.regionId} - - - AND a.status = #{param.status} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.sort_number = #{param.sortNumber} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCountMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCountMapper.xml deleted file mode 100644 index 78583ae..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCountMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_count a - - - AND a.id = #{param.id} - - - AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') - - - AND a.total_price = #{param.totalPrice} - - - AND a.today_price = #{param.todayPrice} - - - AND a.total_users = #{param.totalUsers} - - - AND a.today_users = #{param.todayUsers} - - - AND a.total_orders = #{param.totalOrders} - - - AND a.today_orders = #{param.todayOrders} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyCateMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyCateMapper.xml deleted file mode 100644 index ef13b35..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyCateMapper.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_coupon_apply_cate a - - - AND a.id = #{param.id} - - - AND a.coupon_id = #{param.couponId} - - - AND a.cate_id = #{param.cateId} - - - AND a.cate_level = #{param.cateLevel} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyItemMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyItemMapper.xml deleted file mode 100644 index 141b156..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponApplyItemMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_coupon_apply_item a - - - AND a.id = #{param.id} - - - AND a.coupon_id = #{param.couponId} - - - AND a.goods_id = #{param.goodsId} - - - AND a.category_id = #{param.categoryId} - - - AND a.type = #{param.type} - - - AND a.pk = #{param.pk} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponMapper.xml deleted file mode 100644 index 6030a91..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopCouponMapper.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - SELECT a.*, - COALESCE((SELECT COUNT(*) FROM shop_user_coupon suc WHERE suc.coupon_id = a.id AND suc.deleted = 0), 0) AS receive_num - FROM shop_coupon a - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.description LIKE CONCAT('%', #{param.description}, '%') - - - AND a.type = #{param.type} - - - AND a.reduce_price = #{param.reducePrice} - - - AND a.discount = #{param.discount} - - - AND a.min_price = #{param.minPrice} - - - AND a.expire_type = #{param.expireType} - - - AND a.expire_day = #{param.expireDay} - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - - AND a.apply_range = #{param.applyRange} - - - AND a.apply_range_config LIKE CONCAT('%', #{param.applyRangeConfig}, '%') - - - AND a.is_expire = #{param.isExpire} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.total_count = #{param.totalCount} - - - AND a.issued_count = #{param.issuedCount} - - - AND a.limit_per_user = #{param.limitPerUser} - - - AND a.enabled = #{param.enabled} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerApplyMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerApplyMapper.xml deleted file mode 100644 index 809e68a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerApplyMapper.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - SELECT a.*, b.nickname as nickName, b.phone, c.nickname as refereeName, d.rate - FROM shop_dealer_apply a - LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id - LEFT JOIN gxwebsoft_core.sys_user c ON a.referee_id = c.user_id - LEFT JOIN shop_dealer_user d ON a.user_id = d.user_id - - - AND a.apply_id = #{param.applyId} - - - AND a.type = #{param.type} - - - AND a.user_id = #{param.userId} - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') - - - AND a.dealer_name LIKE CONCAT('%', #{param.dealerName}, '%') - - - AND a.referee_id = #{param.refereeId} - - - AND a.apply_type = #{param.applyType} - - - AND a.apply_time = #{param.applyTime} - - - AND a.apply_status = #{param.applyStatus} - - - AND a.audit_time = #{param.auditTime} - - - AND a.expiration_time = #{param.expirationTime} - - - AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.mobile = #{param.keywords} - OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.dealer_name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerBankMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerBankMapper.xml deleted file mode 100644 index 023b7a2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerBankMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_dealer_bank a - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND a.is_default = #{param.isDefault} - - - AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%') - - - AND a.bank_account LIKE CONCAT('%', #{param.bankAccount}, '%') - - - AND a.bank_card LIKE CONCAT('%', #{param.bankCard}, '%') - - - AND a.apply_status = #{param.applyStatus} - - - AND a.audit_time = #{param.auditTime} - - - AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerCapitalMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerCapitalMapper.xml deleted file mode 100644 index c97f3f0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerCapitalMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - SELECT a.*, b.order_no, b.month - FROM shop_dealer_capital a - LEFT JOIN shop_dealer_order b ON a.order_no = b.order_no - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND a.order_no = #{param.orderNo} - - - AND a.flow_type = #{param.flowType} - - - AND a.money = #{param.money} - - - AND a.to_user_id = #{param.toUserId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND b.month = #{param.month} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.user_id = #{param.keywords} - OR a.order_no = #{param.keywords} - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerOrderMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerOrderMapper.xml deleted file mode 100644 index cf8107c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerOrderMapper.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - SELECT a.*, b.nickname, c.nickname AS firstNickname, d.nickname AS secondNickname, e.nickname AS thirdNickname, f.rate, f.price - FROM shop_dealer_order a - LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id - LEFT JOIN gxwebsoft_core.sys_user c ON a.first_user_id = c.user_id - LEFT JOIN gxwebsoft_core.sys_user d ON a.second_user_id = d.user_id - LEFT JOIN gxwebsoft_core.sys_user e ON a.third_user_id = e.user_id - LEFT JOIN shop_dealer_user f ON a.user_id = f.user_id - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND ( a.user_id = #{param.resourceId} OR a.first_user_id = #{param.resourceId} OR a.second_user_id = #{param.resourceId} ) - - - AND a.month = #{param.month} - - - AND a.order_no = #{param.orderNo} - - - AND a.order_price = #{param.orderPrice} - - - AND a.first_user_id = #{param.firstUserId} - - - AND a.second_user_id = #{param.secondUserId} - - - AND a.third_user_id = #{param.thirdUserId} - - - AND a.first_money = #{param.firstMoney} - - - AND a.second_money = #{param.secondMoney} - - - AND a.third_money = #{param.thirdMoney} - - - AND a.is_invalid = #{param.isInvalid} - - - AND a.is_settled = #{param.isSettled} - - - AND a.comments = #{param.comments} - - - AND a.settle_time = #{param.settleTime} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.order_no LIKE CONCAT('%', #{param.keywords}, '%') - OR a.title LIKE CONCAT('%', #{param.keywords}, '%') - OR a.user_id = #{param.keywords} - OR a.month = #{param.keywords} - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRecordMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRecordMapper.xml deleted file mode 100644 index 41c8c3a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRecordMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_dealer_record a - - - AND a.id = #{param.id} - - - AND a.parent_id = #{param.parentId} - - - AND a.dealer_id = #{param.dealerId} - - - AND a.content LIKE CONCAT('%', #{param.content}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRefereeMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRefereeMapper.xml deleted file mode 100644 index 67b05ed..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerRefereeMapper.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - SELECT DISTINCT a.*, - d.nickname AS dealerName, - d.avatar AS dealerAvatar, - d.phone AS dealerPhone, - u.nickname, - u.avatar, - u.alias, - u.phone, - u.is_admin as isAdmin - FROM shop_dealer_referee a - INNER JOIN gxwebsoft_core.sys_user d ON a.dealer_id = d.user_id AND d.deleted = 0 - INNER JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id AND u.deleted = 0 - - - AND a.id = #{param.id} - - - AND a.dealer_id = #{param.dealerId} - - - AND a.user_id = #{param.userId} - - - AND a.level = #{param.level} - - - AND u.is_admin = 1 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerSettingMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerSettingMapper.xml deleted file mode 100644 index 69d68d3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerSettingMapper.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_dealer_setting a - - - AND a.key = #{param.key} - - - AND a.describe LIKE CONCAT('%', #{param.describe}, '%') - - - AND a.values LIKE CONCAT('%', #{param.values}, '%') - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerUserMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerUserMapper.xml deleted file mode 100644 index 44e883e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerUserMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - SELECT a.*, b.openid - FROM shop_dealer_user a - LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id - - - AND a.id = #{param.id} - - - AND a.type = #{param.type} - - - AND a.user_id = #{param.userId} - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND a.mobile LIKE CONCAT('%', #{param.mobile}, '%') - - - AND a.pay_password LIKE CONCAT('%', #{param.payPassword}, '%') - - - AND a.money = #{param.money} - - - AND a.freeze_money = #{param.freezeMoney} - - - AND a.total_money = #{param.totalMoney} - - - AND a.referee_id = #{param.refereeId} - - - AND a.first_num = #{param.firstNum} - - - AND a.second_num = #{param.secondNum} - - - AND a.third_num = #{param.thirdNum} - - - AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') - - - AND a.is_delete = #{param.isDelete} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.sort_number = #{param.sortNumber} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerWithdrawMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerWithdrawMapper.xml deleted file mode 100644 index 767ee27..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopDealerWithdrawMapper.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - SELECT a.*, b.nickname, b.phone AS phone, b.avatar,b.openid,b.office_openid, c.real_name as realName - FROM shop_dealer_withdraw a - LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id - LEFT JOIN gxwebsoft_core.sys_user_verify c ON a.user_id = c.user_id AND c.status = 1 - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND a.money = #{param.money} - - - AND a.pay_type = #{param.payType} - - - AND a.alipay_name LIKE CONCAT('%', #{param.alipayName}, '%') - - - AND a.alipay_account LIKE CONCAT('%', #{param.alipayAccount}, '%') - - - AND a.bank_name LIKE CONCAT('%', #{param.bankName}, '%') - - - AND a.bank_account LIKE CONCAT('%', #{param.bankAccount}, '%') - - - AND a.bank_card LIKE CONCAT('%', #{param.bankCard}, '%') - - - AND a.apply_status = #{param.applyStatus} - - - AND a.audit_time = #{param.auditTime} - - - AND a.reject_reason LIKE CONCAT('%', #{param.rejectReason}, '%') - - - AND a.platform LIKE CONCAT('%', #{param.platform}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.user_id = #{param.keywords} - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressMapper.xml deleted file mode 100644 index 100e558..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_express a - - - AND a.express_id = #{param.expressId} - - - AND a.express_name LIKE CONCAT('%', #{param.expressName}, '%') - - - AND a.wx_code LIKE CONCAT('%', #{param.wxCode}, '%') - - - AND a.kuaidi100_code LIKE CONCAT('%', #{param.kuaidi100Code}, '%') - - - AND a.kdniao_code LIKE CONCAT('%', #{param.kdniaoCode}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateDetailMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateDetailMapper.xml deleted file mode 100644 index 867265d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateDetailMapper.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_express_template_detail a - - - AND a.id = #{param.id} - - - AND a.template_id = #{param.templateId} - - - AND a.type = #{param.type} - - - AND a.province_id = #{param.provinceId} - - - AND a.city_id = #{param.cityId} - - - AND a.first_num = #{param.firstNum} - - - AND a.first_amount = #{param.firstAmount} - - - AND a.extra_amount = #{param.extraAmount} - - - AND a.extra_num = #{param.extraNum} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.sort_number = #{param.sortNumber} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateMapper.xml deleted file mode 100644 index a0b1784..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopExpressTemplateMapper.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_express_template a - - - AND a.id = #{param.id} - - - AND a.type = #{param.type} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.first_amount = #{param.firstAmount} - - - AND a.extra_amount = #{param.extraAmount} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.first_num = #{param.firstNum} - - - AND a.extra_num = #{param.extraNum} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml deleted file mode 100644 index b2f0569..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGiftMapper.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - SELECT a.*,b.name as goodsName, b.price as faceValue, b.image as goodsImage,c.nickname, u.nickname as operatorUserName - FROM shop_gift a - LEFT JOIN shop_goods b ON a.goods_id = b.goods_id - LEFT JOIN gxwebsoft_core.sys_user c ON a.user_id = c.user_id - LEFT JOIN gxwebsoft_core.sys_user u ON a.operator_user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.goods_id = #{param.goodsId} - - - AND a.take_time LIKE CONCAT('%', #{param.takeTime}, '%') - - - AND a.operator_user_id = #{param.operatorUserId} - - - AND a.is_show = #{param.isShow} - - - AND a.status = #{param.status} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.user_id = #{param.userId} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.code = #{param.keywords} - OR a.name LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCategoryMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCategoryMapper.xml deleted file mode 100644 index 74bf790..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCategoryMapper.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_category a - - - AND a.category_id = #{param.categoryId} - - - AND a.category_code LIKE CONCAT('%', #{param.categoryCode}, '%') - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.type = #{param.type} - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.parent_id = #{param.parentId} - - - AND a.path LIKE CONCAT('%', #{param.path}, '%') - - - AND a.component LIKE CONCAT('%', #{param.component}, '%') - - - AND a.page_id = #{param.pageId} - - - AND a.user_id = #{param.userId} - - - AND a.count = #{param.count} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.hide = #{param.hide} - - - AND a.recommend = #{param.recommend} - - - AND a.show_index = #{param.showIndex} - - - AND a.merchant_id = #{param.merchantId} - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCommentMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCommentMapper.xml deleted file mode 100644 index a6b5545..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsCommentMapper.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_comment a - - - AND a.id = #{param.id} - - - AND a.uid = #{param.uid} - - - AND a.oid = #{param.oid} - - - AND a.unique LIKE CONCAT('%', #{param.unique}, '%') - - - AND a.goods_id = #{param.goodsId} - - - AND a.reply_type LIKE CONCAT('%', #{param.replyType}, '%') - - - AND a.goods_score = #{param.goodsScore} - - - AND a.service_score = #{param.serviceScore} - - - AND a.comment LIKE CONCAT('%', #{param.comment}, '%') - - - AND a.pics LIKE CONCAT('%', #{param.pics}, '%') - - - AND a.merchant_reply_content LIKE CONCAT('%', #{param.merchantReplyContent}, '%') - - - AND a.merchant_reply_time = #{param.merchantReplyTime} - - - AND a.is_del = #{param.isDel} - - - AND a.is_reply = #{param.isReply} - - - AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') - - - AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') - - - AND a.sku LIKE CONCAT('%', #{param.sku}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsIncomeConfigMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsIncomeConfigMapper.xml deleted file mode 100644 index 8819d02..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsIncomeConfigMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_income_config a - - - AND a.id = #{param.id} - - - AND a.goods_id = #{param.goodsId} - - - AND a.merchant_shop_type LIKE CONCAT('%', #{param.merchantShopType}, '%') - - - AND a.sku_id = #{param.skuId} - - - AND a.rate = #{param.rate} - - - AND a.user_id = #{param.userId} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsLogMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsLogMapper.xml deleted file mode 100644 index 4d24262..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsLogMapper.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_log a - - - AND a.id = #{param.id} - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.goods_id = #{param.goodsId} - - - AND a.visit_num = #{param.visitNum} - - - AND a.cart_num = #{param.cartNum} - - - AND a.order_num = #{param.orderNum} - - - AND a.pay_num = #{param.payNum} - - - AND a.pay_price = #{param.payPrice} - - - AND a.cost_price = #{param.costPrice} - - - AND a.pay_uid = #{param.payUid} - - - AND a.refund_num = #{param.refundNum} - - - AND a.refund_price = #{param.refundPrice} - - - AND a.collect_num = #{param.collectNum} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.status = #{param.status} - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsMapper.xml deleted file mode 100644 index bb91f03..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsMapper.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods a - - - AND a.goods_id = #{param.goodsId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.code LIKE CONCAT('%', #{param.code}, '%') - - - AND a.type = #{param.type} - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.parent_id = #{param.parentId} - - - AND a.category_id = #{param.categoryId} - - - AND a.path LIKE CONCAT('%', #{param.path}, '%') - - - AND a.tag LIKE CONCAT('%', #{param.tag}, '%') - - - AND a.specs = #{param.specs} - - - AND a.position LIKE CONCAT('%', #{param.position}, '%') - - - AND a.unit_name LIKE CONCAT('%', #{param.unitName}, '%') - - - AND a.price = #{param.price} - - - AND a.buying_price = #{param.buyingPrice} - - - AND a.dealer_price = #{param.dealerPrice} - - - AND a.deduct_stock_type = #{param.deductStockType} - - - AND a.delivery_method = #{param.deliveryMethod} - - - AND a.duration_method = #{param.durationMethod} - - - AND a.can_buy_number = #{param.canBuyNumber} - - - AND a.files LIKE CONCAT('%', #{param.files}, '%') - - - AND a.sales = #{param.sales} - - - AND a.stock = #{param.stock} - - - AND a.install = #{param.install} - - - AND a.rate = #{param.rate} - - - AND a.gain_integral = #{param.gainIntegral} - - - AND a.recommend = #{param.recommend} - - - AND a.official = #{param.official} - - - AND a.merchant_id = #{param.merchantId} - - - AND a.is_show = #{param.isShow} - - - AND a.status = #{param.status} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.user_id = #{param.userId} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - - AND a.status = 0 - - - AND a.status != 0 - - - AND a.stock = 0 - - - - AND (a.name LIKE CONCAT('%', #{param.keywords}, '%') - OR a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRelationMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRelationMapper.xml deleted file mode 100644 index 063a2a8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRelationMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_relation a - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND a.goods_id = #{param.goodsId} - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.category LIKE CONCAT('%', #{param.category}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRoleCommissionMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRoleCommissionMapper.xml deleted file mode 100644 index a0cb44a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsRoleCommissionMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_role_commission a - - - AND a.id = #{param.id} - - - AND a.role_id = #{param.roleId} - - - AND a.goods_id = #{param.goodsId} - - - AND a.sku LIKE CONCAT('%', #{param.sku}, '%') - - - AND a.amount = #{param.amount} - - - AND a.status = #{param.status} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.sort_number = #{param.sortNumber} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSkuMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSkuMapper.xml deleted file mode 100644 index dec4d76..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSkuMapper.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_sku a - - - AND a.id = #{param.id} - - - AND a.goods_id = #{param.goodsId} - - - AND a.sku LIKE CONCAT('%', #{param.sku}, '%') - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.price = #{param.price} - - - AND a.sale_price = #{param.salePrice} - - - AND a.cost = #{param.cost} - - - AND a.stock = #{param.stock} - - - AND a.sku_no LIKE CONCAT('%', #{param.skuNo}, '%') - - - AND a.bar_code LIKE CONCAT('%', #{param.barCode}, '%') - - - AND a.weight = #{param.weight} - - - AND a.volume = #{param.volume} - - - AND a.uuid LIKE CONCAT('%', #{param.uuid}, '%') - - - AND a.status = #{param.status} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSpecMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSpecMapper.xml deleted file mode 100644 index aeed405..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopGoodsSpecMapper.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_goods_spec a - - - AND a.id = #{param.id} - - - AND a.goods_id = #{param.goodsId} - - - AND a.spec_id = #{param.specId} - - - AND a.spec_name LIKE CONCAT('%', #{param.specName}, '%') - - - AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%') - - - AND a.type = #{param.type} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantAccountMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantAccountMapper.xml deleted file mode 100644 index 95280c1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantAccountMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_merchant_account a - - - AND a.id = #{param.id} - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND a.merchant_id = #{param.merchantId} - - - AND a.role_id = #{param.roleId} - - - AND a.role_name LIKE CONCAT('%', #{param.roleName}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantApplyMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantApplyMapper.xml deleted file mode 100644 index 52b8979..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantApplyMapper.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_merchant_apply a - - - AND a.apply_id = #{param.applyId} - - - AND a.type = #{param.type} - - - AND a.shop_type LIKE CONCAT('%', #{param.shopType}, '%') - - - AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND a.category_id = #{param.categoryId} - - - AND a.category LIKE CONCAT('%', #{param.category}, '%') - - - AND a.lng_and_lat LIKE CONCAT('%', #{param.lngAndLat}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.region_id LIKE CONCAT('%', #{param.regionId}, '%') - - - AND a.commission = #{param.commission} - - - AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') - - - AND a.yyzz LIKE CONCAT('%', #{param.yyzz}, '%') - - - AND a.sfz1 LIKE CONCAT('%', #{param.sfz1}, '%') - - - AND a.sfz2 LIKE CONCAT('%', #{param.sfz2}, '%') - - - AND a.files LIKE CONCAT('%', #{param.files}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.own_store = #{param.ownStore} - - - AND a.recommend = #{param.recommend} - - - AND a.goods_review = #{param.goodsReview} - - - AND a.name2 LIKE CONCAT('%', #{param.name2}, '%') - - - AND a.reason LIKE CONCAT('%', #{param.reason}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantMapper.xml deleted file mode 100644 index 66384d5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantMapper.xml +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_merchant a - - - AND a.merchant_id = #{param.merchantId} - - - AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') - - - AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') - - - AND a.type = #{param.type} - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND a.shop_type LIKE CONCAT('%', #{param.shopType}, '%') - - - AND a.item_type LIKE CONCAT('%', #{param.itemType}, '%') - - - AND a.category LIKE CONCAT('%', #{param.category}, '%') - - - AND a.merchant_category_id = #{param.merchantCategoryId} - - - AND a.merchant_category_title LIKE CONCAT('%', #{param.merchantCategoryTitle}, '%') - - - AND a.lng_and_lat LIKE CONCAT('%', #{param.lngAndLat}, '%') - - - AND a.lng LIKE CONCAT('%', #{param.lng}, '%') - - - AND a.lat LIKE CONCAT('%', #{param.lat}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.commission = #{param.commission} - - - AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%') - - - AND a.files LIKE CONCAT('%', #{param.files}, '%') - - - AND a.business_time LIKE CONCAT('%', #{param.businessTime}, '%') - - - AND a.content LIKE CONCAT('%', #{param.content}, '%') - - - AND a.price = #{param.price} - - - AND a.own_store = #{param.ownStore} - - - AND a.can_express = #{param.canExpress} - - - AND a.recommend = #{param.recommend} - - - AND a.is_on = #{param.isOn} - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - - AND a.goods_review = #{param.goodsReview} - - - AND a.admin_url LIKE CONCAT('%', #{param.adminUrl}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.status = #{param.status} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantTypeMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantTypeMapper.xml deleted file mode 100644 index 0ed4e42..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopMerchantTypeMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_merchant_type a - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryGoodsMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryGoodsMapper.xml deleted file mode 100644 index 949a66f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryGoodsMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_order_delivery_goods a - - - AND a.id = #{param.id} - - - AND a.delivery_id = #{param.deliveryId} - - - AND a.order_id = #{param.orderId} - - - AND a.order_goods_id = #{param.orderGoodsId} - - - AND a.goods_id = #{param.goodsId} - - - AND a.delivery_num = #{param.deliveryNum} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryMapper.xml deleted file mode 100644 index eb3fd8d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderDeliveryMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_order_delivery a - - - AND a.delivery_id = #{param.deliveryId} - - - AND a.order_id = #{param.orderId} - - - AND a.delivery_method = #{param.deliveryMethod} - - - AND a.pack_method = #{param.packMethod} - - - AND a.express_id = #{param.expressId} - - - AND a.express_no LIKE CONCAT('%', #{param.expressNo}, '%') - - - AND a.eorder_html LIKE CONCAT('%', #{param.eorderHtml}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderExtractMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderExtractMapper.xml deleted file mode 100644 index ff26857..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderExtractMapper.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_order_extract a - - - AND a.id = #{param.id} - - - AND a.order_id = #{param.orderId} - - - AND a.linkman LIKE CONCAT('%', #{param.linkman}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderGoodsMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderGoodsMapper.xml deleted file mode 100644 index dd22115..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderGoodsMapper.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_order_goods a - - - AND a.id = #{param.id} - - - AND a.order_id = #{param.orderId} - - - AND a.order_code LIKE CONCAT('%', #{param.orderCode}, '%') - - - AND a.merchant_id = #{param.merchantId} - - - AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.goods_id = #{param.goodsId} - - - AND a.goods_name LIKE CONCAT('%', #{param.goodsName}, '%') - - - AND a.spec LIKE CONCAT('%', #{param.spec}, '%') - - - AND a.sku_id = #{param.skuId} - - - AND a.price = #{param.price} - - - AND a.total_num = #{param.totalNum} - - - AND a.pay_status = #{param.payStatus} - - - AND a.order_status = #{param.orderStatus} - - - AND a.is_free = #{param.isFree} - - - AND a.version = #{param.version} - - - AND a.time_period LIKE CONCAT('%', #{param.timePeriod}, '%') - - - AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - - AND a.time_flag LIKE CONCAT('%', #{param.timeFlag}, '%') - - - AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoLogMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoLogMapper.xml deleted file mode 100644 index 0dde816..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoLogMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_order_info_log a - - - AND a.id = #{param.id} - - - AND a.order_id = #{param.orderId} - - - AND a.merchant_id = #{param.merchantId} - - - AND a.field_id = #{param.fieldId} - - - AND a.use_num = #{param.useNum} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoMapper.xml deleted file mode 100644 index b2e0149..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderInfoMapper.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_order_info a - - - AND a.id = #{param.id} - - - AND a.order_id = #{param.orderId} - - - AND a.order_code LIKE CONCAT('%', #{param.orderCode}, '%') - - - AND a.merchant_id = #{param.merchantId} - - - AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') - - - AND a.field_id = #{param.fieldId} - - - AND a.field_name LIKE CONCAT('%', #{param.fieldName}, '%') - - - AND a.price = #{param.price} - - - AND a.children_price = #{param.childrenPrice} - - - AND a.adult_num = #{param.adultNum} - - - AND a.children_num = #{param.childrenNum} - - - AND a.adult_num_use = #{param.adultNumUse} - - - AND a.children_num_use = #{param.childrenNumUse} - - - AND a.pay_status = #{param.payStatus} - - - AND a.order_status = #{param.orderStatus} - - - AND a.is_free = #{param.isFree} - - - AND a.is_children = #{param.isChildren} - - - AND a.version = #{param.version} - - - AND a.is_half = #{param.isHalf} - - - AND a.time_period LIKE CONCAT('%', #{param.timePeriod}, '%') - - - AND a.date_time LIKE CONCAT('%', #{param.dateTime}, '%') - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - - AND a.time_flag LIKE CONCAT('%', #{param.timeFlag}, '%') - - - AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderMapper.xml deleted file mode 100644 index f728715..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopOrderMapper.xml +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - SELECT a.*,b.nickname, b.avatar,b.phone as phone - FROM shop_order a - LEFT JOIN gxwebsoft_core.sys_user b ON a.user_id = b.user_id - - - AND a.order_id = #{param.orderId} - - - AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') - - - AND a.type = #{param.type} - - - AND a.delivery_type = #{param.deliveryType} - - - AND a.channel = #{param.channel} - - - AND a.transaction_id LIKE CONCAT('%', #{param.transactionId}, '%') - - - AND a.refund_order LIKE CONCAT('%', #{param.refundOrder}, '%') - - - AND a.merchant_id = #{param.merchantId} - - - AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') - - - AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') - - - AND a.coupon_id = #{param.couponId} - - - AND a.card_id LIKE CONCAT('%', #{param.cardId}, '%') - - - AND a.admin_id = #{param.adminId} - - - AND a.confirm_id = #{param.confirmId} - - - AND a.ic_card LIKE CONCAT('%', #{param.icCard}, '%') - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND b.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND b.nickname LIKE CONCAT('%', #{param.nickname}, '%') - - - AND a.address_id = #{param.addressId} - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.address_lat LIKE CONCAT('%', #{param.addressLat}, '%') - - - AND a.address_lng LIKE CONCAT('%', #{param.addressLng}, '%') - - - AND a.self_take_merchant_id = #{param.selfTakeMerchantId} - - - AND a.self_take_merchant_name LIKE CONCAT('%', #{param.selfTakeMerchantName}, '%') - - - AND a.send_start_time LIKE CONCAT('%', #{param.sendStartTime}, '%') - - - AND a.send_end_time LIKE CONCAT('%', #{param.sendEndTime}, '%') - - - AND a.express_merchant_id = #{param.expressMerchantId} - - - AND a.express_merchant_name LIKE CONCAT('%', #{param.expressMerchantName}, '%') - - - AND a.total_price = #{param.totalPrice} - - - AND a.reduce_price = #{param.reducePrice} - - - AND a.pay_price = #{param.payPrice} - - - AND a.price = #{param.price} - - - AND a.money = #{param.money} - - - AND a.refund_money = #{param.refundMoney} - - - AND a.coach_price = #{param.coachPrice} - - - AND a.total_num = #{param.totalNum} - - - AND a.coach_id = #{param.coachId} - - - AND a.pay_user_id = #{param.payUserId} - - - AND a.pay_type = #{param.payType} - - - AND a.friend_pay_type = #{param.friendPayType} - - - AND a.pay_status = #{param.payStatus} - - - AND a.order_status = #{param.orderStatus} - - - AND a.delivery_status = #{param.deliveryStatus} - - - AND a.delivery_time LIKE CONCAT('%', #{param.deliveryTime}, '%') - - - AND a.coupon_type = #{param.couponType} - - - AND a.coupon_desc LIKE CONCAT('%', #{param.couponDesc}, '%') - - - AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%') - - - AND a.return_num = #{param.returnNum} - - - AND a.return_money = #{param.returnMoney} - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.is_invoice = #{param.isInvoice} - - - AND a.invoice_no LIKE CONCAT('%', #{param.invoiceNo}, '%') - - - AND a.pay_time LIKE CONCAT('%', #{param.payTime}, '%') - - - AND a.refund_time LIKE CONCAT('%', #{param.refundTime}, '%') - - - AND a.refund_apply_time LIKE CONCAT('%', #{param.refundApplyTime}, '%') - - - AND a.expiration_time LIKE CONCAT('%', #{param.expirationTime}, '%') - - - AND a.check_bill = #{param.checkBill} - - - AND a.is_settled = #{param.isSettled} - - - AND a.version = #{param.version} - - - AND a.user_id = #{param.userId} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND a.self_take_code LIKE CONCAT('%', #{param.selfTakeCode}, '%') - - - AND a.has_take_gift = #{param.hasTakeGift} - - - AND (a.order_no LIKE CONCAT('%', #{param.keywords}, '%') - OR a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.order_id = #{param.keywords} - OR b.phone = #{param.keywords} - OR b.phone = #{param.keywords} - OR b.nickname LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - AND a.order_status != 2 - - - - - - AND a.pay_status = 0 AND a.order_status = 0 - - - - AND a.pay_status = 1 AND a.delivery_status = 10 AND a.order_status = 0 - - - - AND a.pay_status = 1 AND a.order_status = 0 - - - - AND a.delivery_status = 20 AND a.order_status != 1 - - - - AND a.order_status = 1 AND a.evaluate_status = 0 - - - - AND a.order_status = 1 - - - - AND (a.order_status = 4 OR a.order_status = 5 OR a.order_status = 6 OR a.order_status = 7) - - - - AND a.deleted = 1 - - - - AND a.order_status = 2 - - - - AND a.create_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 3 MONTH) AND CURDATE() - - - - - - - - - - - - - - - - - UPDATE shop_order - - - pay_type = #{param.payType}, - - - pay_status = #{param.payStatus}, - - - order_status = #{param.orderStatus}, - - - delivery_status = #{param.deliveryStatus}, - - - delivery_time = #{param.deliveryTime}, - - - pay_time = #{param.payTime}, - - - refund_time = #{param.refundTime}, - - - self_take_code = #{param.selfTakeCode}, - - - invoice_no = #{param.invoiceNo}, - - - is_invoice = #{param.isInvoice}, - - - start_time = #{param.startTime}, - - - qrcode = #{param.qrcode}, - - - pay_user_id = #{param.payUserId}, - - - form_id = #{param.formId}, - - - total_price = #{param.totalPrice}, - - - reduce_price = #{param.reducePrice}, - - - pay_price = #{param.payPrice}, - - - price = #{param.price}, - - - money = #{param.money}, - - - refund_money = #{param.refundMoney}, - - - total_num = #{param.totalNum}, - - - coach_id = #{param.coachId}, - - - express_merchant_id = #{param.expressMerchantId}, - - - express_merchant_name = #{param.expressMerchantName}, - - - send_start_time = #{param.sendStartTime}, - - - send_end_time = #{param.sendEndTime}, - - - self_take_merchant_id = #{param.selfTakeMerchantId}, - - - self_take_merchant_name = #{param.selfTakeMerchantName}, - - - address_id = #{param.addressId}, - - - address = #{param.address}, - - - confirm_id = #{param.confirmId}, - - - ic_card = #{param.icCard}, - - - admin_id = #{param.adminId}, - - - card_id = #{param.cardId}, - - - coupon_id = #{param.couponId}, - - - merchant_id = #{param.merchantId}, - - - transaction_id = #{param.transactionId}, - - - refund_order = #{param.refundOrder}, - - - channel = #{param.channel}, - - - delivery_type = #{param.deliveryType}, - - - `type` = #{param.type}, - - - deleted = #{param.deleted}, - - - deleted = 0, - - - - order_no = #{param.orderNo} - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopRechargeOrderMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopRechargeOrderMapper.xml deleted file mode 100644 index 3ed8037..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopRechargeOrderMapper.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_recharge_order a - - - AND a.order_id = #{param.orderId} - - - AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') - - - AND a.user_id = #{param.userId} - - - AND a.recharge_type = #{param.rechargeType} - - - AND a.organization_id = #{param.organizationId} - - - AND a.plan_id = #{param.planId} - - - AND a.pay_price = #{param.payPrice} - - - AND a.gift_money = #{param.giftMoney} - - - AND a.actual_money = #{param.actualMoney} - - - AND a.balance = #{param.balance} - - - AND a.pay_method LIKE CONCAT('%', #{param.payMethod}, '%') - - - AND a.pay_status = #{param.payStatus} - - - AND a.pay_time = #{param.payTime} - - - AND a.trade_id = #{param.tradeId} - - - AND a.platform LIKE CONCAT('%', #{param.platform}, '%') - - - AND a.shop_id = #{param.shopId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecMapper.xml deleted file mode 100644 index 9081159..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecMapper.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_spec a - - - AND a.spec_id = #{param.specId} - - - AND a.spec_name LIKE CONCAT('%', #{param.specName}, '%') - - - AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%') - - - AND a.merchant_id = #{param.merchantId} - - - AND a.user_id = #{param.userId} - - - AND a.updater = #{param.updater} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecValueMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecValueMapper.xml deleted file mode 100644 index 0543252..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSpecValueMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_spec_value a - - - AND a.spec_value_id = #{param.specValueId} - - - AND a.spec_id = #{param.specId} - - - AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSplashMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSplashMapper.xml deleted file mode 100644 index bac8517..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopSplashMapper.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_splash a - - - AND a.id = #{param.id} - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.image LIKE CONCAT('%', #{param.image}, '%') - - - AND a.jump_type LIKE CONCAT('%', #{param.jumpType}, '%') - - - AND a.jump_pk = #{param.jumpPk} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.sort_number = #{param.sortNumber} - - - AND a.user_id = #{param.userId} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserAddressMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserAddressMapper.xml deleted file mode 100644 index 37b630f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserAddressMapper.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_user_address a - - - AND a.id = #{param.id} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.country LIKE CONCAT('%', #{param.country}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.full_address LIKE CONCAT('%', #{param.fullAddress}, '%') - - - AND a.lat LIKE CONCAT('%', #{param.lat}, '%') - - - AND a.lng LIKE CONCAT('%', #{param.lng}, '%') - - - AND a.gender = #{param.gender} - - - AND a.type LIKE CONCAT('%', #{param.type}, '%') - - - AND a.is_default = #{param.isDefault} - - - AND a.user_id = #{param.userId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - OR a.phone = #{param.keywords} - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserBalanceLogMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserBalanceLogMapper.xml deleted file mode 100644 index 5ad4a74..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserBalanceLogMapper.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_user_balance_log a - - - AND a.log_id = #{param.logId} - - - AND a.user_id = #{param.userId} - - - AND a.scene = #{param.scene} - - - AND a.money = #{param.money} - - - AND a.balance = #{param.balance} - - - AND a.remark LIKE CONCAT('%', #{param.remark}, '%') - - - AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') - - - AND a.admin_id = #{param.adminId} - - - AND a.sort_number = #{param.sortNumber} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.merchant_id = #{param.merchantId} - - - AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%') - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCollectionMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCollectionMapper.xml deleted file mode 100644 index 98782e2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCollectionMapper.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_user_collection a - - - AND a.id = #{param.id} - - - AND a.type = #{param.type} - - - AND a.tid = #{param.tid} - - - AND a.user_id = #{param.userId} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml deleted file mode 100644 index 48eaee5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserCouponMapper.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_user_coupon a - - - AND a.id = #{param.id} - - - AND a.coupon_id = #{param.couponId} - - - AND a.user_id = #{param.userId} - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.description LIKE CONCAT('%', #{param.description}, '%') - - - AND a.type = #{param.type} - - - AND a.reduce_price = #{param.reducePrice} - - - AND a.discount = #{param.discount} - - - AND a.min_price = #{param.minPrice} - - - AND a.apply_range = #{param.applyRange} - - - AND a.apply_range_config LIKE CONCAT('%', #{param.applyRangeConfig}, '%') - - - AND a.start_time LIKE CONCAT('%', #{param.startTime}, '%') - - - AND a.end_time LIKE CONCAT('%', #{param.endTime}, '%') - - - AND a.status = #{param.status} - - - AND a.use_time LIKE CONCAT('%', #{param.useTime}, '%') - - - AND a.order_id LIKE CONCAT('%', #{param.orderId}, '%') - - - AND a.order_no LIKE CONCAT('%', #{param.orderNo}, '%') - - - AND a.obtain_type = #{param.obtainType} - - - AND a.obtain_source LIKE CONCAT('%', #{param.obtainSource}, '%') - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserMapper.xml deleted file mode 100644 index 0ccbb57..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserMapper.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_user a - - - AND a.id = #{param.id} - - - AND a.user_id = #{param.userId} - - - AND a.type = #{param.type} - - - AND a.username LIKE CONCAT('%', #{param.username}, '%') - - - AND a.password LIKE CONCAT('%', #{param.password}, '%') - - - AND a.nickname LIKE CONCAT('%', #{param.nickname}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.sex = #{param.sex} - - - AND a.position LIKE CONCAT('%', #{param.position}, '%') - - - AND a.platform LIKE CONCAT('%', #{param.platform}, '%') - - - AND a.email LIKE CONCAT('%', #{param.email}, '%') - - - AND a.email_verified = #{param.emailVerified} - - - AND a.alias LIKE CONCAT('%', #{param.alias}, '%') - - - AND a.real_name LIKE CONCAT('%', #{param.realName}, '%') - - - AND a.id_card LIKE CONCAT('%', #{param.idCard}, '%') - - - AND a.birthday LIKE CONCAT('%', #{param.birthday}, '%') - - - AND a.country LIKE CONCAT('%', #{param.country}, '%') - - - AND a.province LIKE CONCAT('%', #{param.province}, '%') - - - AND a.city LIKE CONCAT('%', #{param.city}, '%') - - - AND a.region LIKE CONCAT('%', #{param.region}, '%') - - - AND a.address LIKE CONCAT('%', #{param.address}, '%') - - - AND a.longitude LIKE CONCAT('%', #{param.longitude}, '%') - - - AND a.latitude LIKE CONCAT('%', #{param.latitude}, '%') - - - AND a.balance = #{param.balance} - - - AND a.cashed_money = #{param.cashedMoney} - - - AND a.points = #{param.points} - - - AND a.pay_money = #{param.payMoney} - - - AND a.expend_money = #{param.expendMoney} - - - AND a.pay_password LIKE CONCAT('%', #{param.payPassword}, '%') - - - AND a.grade_id = #{param.gradeId} - - - AND a.category LIKE CONCAT('%', #{param.category}, '%') - - - AND a.introduction LIKE CONCAT('%', #{param.introduction}, '%') - - - AND a.organization_id = #{param.organizationId} - - - AND a.group_id = #{param.groupId} - - - AND a.avatar LIKE CONCAT('%', #{param.avatar}, '%') - - - AND a.bg_image LIKE CONCAT('%', #{param.bgImage}, '%') - - - AND a.user_code LIKE CONCAT('%', #{param.userCode}, '%') - - - AND a.certification = #{param.certification} - - - AND a.age = #{param.age} - - - AND a.offline = #{param.offline} - - - AND a.followers = #{param.followers} - - - AND a.fans = #{param.fans} - - - AND a.likes = #{param.likes} - - - AND a.comment_numbers = #{param.commentNumbers} - - - AND a.recommend = #{param.recommend} - - - AND a.openid LIKE CONCAT('%', #{param.openid}, '%') - - - AND a.office_openid LIKE CONCAT('%', #{param.officeOpenid}, '%') - - - AND a.unionid LIKE CONCAT('%', #{param.unionid}, '%') - - - AND a.client_id LIKE CONCAT('%', #{param.clientId}, '%') - - - AND a.not_allow_vip = #{param.notAllowVip} - - - AND a.is_admin = #{param.isAdmin} - - - AND a.is_organization_admin = #{param.isOrganizationAdmin} - - - AND a.login_num = #{param.loginNum} - - - AND a.company_id = #{param.companyId} - - - AND a.merchants LIKE CONCAT('%', #{param.merchants}, '%') - - - AND a.merchant_id = #{param.merchantId} - - - AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%') - - - AND a.merchant_avatar LIKE CONCAT('%', #{param.merchantAvatar}, '%') - - - AND a.uid = #{param.uid} - - - AND a.expert_type = #{param.expertType} - - - AND a.expire_time = #{param.expireTime} - - - AND a.settlement_time LIKE CONCAT('%', #{param.settlementTime}, '%') - - - AND a.aptitude LIKE CONCAT('%', #{param.aptitude}, '%') - - - AND a.industry_parent LIKE CONCAT('%', #{param.industryParent}, '%') - - - AND a.industry_child LIKE CONCAT('%', #{param.industryChild}, '%') - - - AND a.title LIKE CONCAT('%', #{param.title}, '%') - - - AND a.template_id = #{param.templateId} - - - AND a.installed = #{param.installed} - - - AND a.speciality LIKE CONCAT('%', #{param.speciality}, '%') - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.status = #{param.status} - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml deleted file mode 100644 index 3a1d993..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopUserRefereeMapper.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - SELECT a.*, - d.nickname AS dealerName, - d.avatar AS dealerAvatar, - d.phone AS dealerPhone, - u.nickname, - u.avatar, - u.phone - FROM shop_user_referee a - LEFT JOIN gxwebsoft_core.sys_user d ON a.dealer_id = d.user_id - LEFT JOIN gxwebsoft_core.sys_user u ON a.user_id = u.user_id - - - AND a.id = #{param.id} - - - AND a.dealer_id = #{param.dealerId} - - - AND a.user_id = #{param.userId} - - - AND a.level = #{param.level} - - - AND a.comments LIKE CONCAT('%', #{param.comments}, '%') - - - AND a.deleted = #{param.deleted} - - - AND a.deleted = 0 - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWechatDepositMapper.xml b/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWechatDepositMapper.xml deleted file mode 100644 index 9840d34..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/mapper/xml/ShopWechatDepositMapper.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - SELECT a.* - FROM shop_wechat_deposit a - - - AND a.id = #{param.id} - - - AND a.oid = #{param.oid} - - - AND a.uid = #{param.uid} - - - AND a.order_num LIKE CONCAT('%', #{param.orderNum}, '%') - - - AND a.wechat_order LIKE CONCAT('%', #{param.wechatOrder}, '%') - - - AND a.wechat_return LIKE CONCAT('%', #{param.wechatReturn}, '%') - - - AND a.site_name LIKE CONCAT('%', #{param.siteName}, '%') - - - AND a.username LIKE CONCAT('%', #{param.username}, '%') - - - AND a.phone LIKE CONCAT('%', #{param.phone}, '%') - - - AND a.name LIKE CONCAT('%', #{param.name}, '%') - - - AND a.price = #{param.price} - - - AND a.status = #{param.status} - - - AND a.create_time >= #{param.createTimeStart} - - - AND a.create_time <= #{param.createTimeEnd} - - - AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%') - ) - - - - - - - - - - - diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java deleted file mode 100644 index 3aceda1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopArticleParam.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品文章查询参数 - * - * @author 科技小王子 - * @since 2025-08-13 05:14:52 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopArticleParam对象", description = "商品文章查询参数") -public class ShopArticleParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "文章ID") - @QueryField(type = QueryType.EQ) - private Integer articleId; - - @Schema(description = "文章标题") - private String title; - - @Schema(description = "文章类型 0常规 1视频") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "模型") - private String model; - - @Schema(description = "详情页模板") - private String detail; - - @Schema(description = "文章分类ID") - @QueryField(type = QueryType.EQ) - private Integer categoryId; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "话题") - private String topic; - - @Schema(description = "标签") - private String tags; - - @Schema(description = "封面图") - private String image; - - @Schema(description = "封面图宽") - @QueryField(type = QueryType.EQ) - private Integer imageWidth; - - @Schema(description = "封面图高") - @QueryField(type = QueryType.EQ) - private Integer imageHeight; - - @Schema(description = "付费金额") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "开始时间") - private String startTime; - - @Schema(description = "结束时间") - private String endTime; - - @Schema(description = "来源") - private String source; - - @Schema(description = "产品概述") - private String overview; - - @Schema(description = "虚拟阅读量(仅用作展示)") - @QueryField(type = QueryType.EQ) - private Integer virtualViews; - - @Schema(description = "实际阅读量") - @QueryField(type = QueryType.EQ) - private Integer actualViews; - - @Schema(description = "评分") - @QueryField(type = QueryType.EQ) - private BigDecimal rate; - - @Schema(description = "列表显示方式(10小图展示 20大图展示)") - @QueryField(type = QueryType.EQ) - private Integer showType; - - @Schema(description = "访问密码") - private String password; - - @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") - @QueryField(type = QueryType.EQ) - private Integer permission; - - @Schema(description = "发布来源客户端 (APP、H5、小程序等)") - private String platform; - - @Schema(description = "文章附件") - private String files; - - @Schema(description = "视频地址") - private String video; - - @Schema(description = "接受的文件类型") - private String accept; - - @Schema(description = "经度") - private String longitude; - - @Schema(description = "纬度") - private String latitude; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "点赞数") - @QueryField(type = QueryType.EQ) - private Integer likes; - - @Schema(description = "评论数") - @QueryField(type = QueryType.EQ) - private Integer commentNumbers; - - @Schema(description = "提醒谁看") - private String toUsers; - - @Schema(description = "作者") - private String author; - - @Schema(description = "推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "报名人数") - @QueryField(type = QueryType.EQ) - private Integer bmUsers; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "项目ID") - @QueryField(type = QueryType.EQ) - private Integer projectId; - - @Schema(description = "语言") - private String lang; - - @Schema(description = "关联默认语言的文章ID") - @QueryField(type = QueryType.EQ) - private Integer langArticleId; - - @Schema(description = "是否自动翻译") - @QueryField(type = QueryType.EQ) - private Boolean translation; - - @Schema(description = "编辑器类型 0 Markdown编辑器 1 富文本编辑器 ") - @QueryField(type = QueryType.EQ) - private Boolean editor; - - @Schema(description = "pdf文件地址") - private String pdfUrl; - - @Schema(description = "版本号") - @QueryField(type = QueryType.EQ) - private Integer version; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopBrandParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopBrandParam.java deleted file mode 100644 index a559c61..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopBrandParam.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 品牌查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopBrandParam对象", description = "品牌查询参数") -public class ShopBrandParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer brandId; - - @Schema(description = "品牌名称") - private String brandName; - - @Schema(description = "图标") - private String image; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCartParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCartParam.java deleted file mode 100644 index f21eb48..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCartParam.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 购物车查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCartParam对象", description = "购物车查询参数") -public class ShopCartParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "购物车表ID") - @QueryField(type = QueryType.EQ) - private Long id; - - @Schema(description = "类型 0商城 1外卖") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "唯一标识") - private String code; - - @Schema(description = "商品ID") - private Long goodsId; - - @Schema(description = "商品SKU ID") - @QueryField(type = QueryType.EQ) - private Integer skuId; - - @Schema(description = "商品规格") - private String spec; - - @Schema(description = "规格信息,如:颜色:红色|尺寸:L") - private String specInfo; - - @Schema(description = "商品价格") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "商品数量") - @QueryField(type = QueryType.EQ) - private Integer cartNum; - - @Schema(description = "单商品合计") - @QueryField(type = QueryType.EQ) - private BigDecimal totalPrice; - - @Schema(description = "0 = 未购买 1 = 已购买") - @QueryField(type = QueryType.EQ) - private Boolean isPay; - - @Schema(description = "是否为立即购买") - @QueryField(type = QueryType.EQ) - private Boolean isNew; - - @Schema(description = "是否为立即购买") - @QueryField(type = QueryType.EQ) - private Boolean isShow; - - @Schema(description = "拼团id") - @QueryField(type = QueryType.EQ) - private Integer combinationId; - - @Schema(description = "秒杀产品ID") - @QueryField(type = QueryType.EQ) - private Integer seckillId; - - @Schema(description = "砍价id") - @QueryField(type = QueryType.EQ) - private Integer bargainId; - - @Schema(description = "是否选中") - @QueryField(type = QueryType.EQ) - private Boolean selected; - - @Schema(description = "商户ID") - private Long merchantId; - - @Schema(description = "用户ID") - private Long userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCategoryParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCategoryParam.java deleted file mode 100644 index 4ad7f2a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCategoryParam.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品分类查询参数 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCategoryParam对象", description = "商品分类查询参数") -public class ShopCategoryParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "菜单名称") - private String title; - - @Schema(description = "模型") - private String model; - - @Schema(description = "标识") - private String code; - - @Schema(description = "链接地址") - private String path; - - @Schema(description = "组件地址") - private String component; - - @Schema(description = "打开位置") - private String target; - - @Schema(description = "图标") - private String icon; - - @Schema(description = "banner") - private String banner; - - @Schema(description = "图标颜色") - private String color; - - @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") - @QueryField(type = QueryType.EQ) - private Integer hide; - - @Schema(description = "可见类型 0所有人 1登录可见 2密码可见") - @QueryField(type = QueryType.EQ) - private Integer permission; - - @Schema(description = "访问密码") - private String password; - - @Schema(description = "位置 0不限 1顶部 2底部") - @QueryField(type = QueryType.EQ) - private Integer position; - - @Schema(description = "仅在顶部显示") - @QueryField(type = QueryType.EQ) - private Integer top; - - @Schema(description = "仅在底部显示") - @QueryField(type = QueryType.EQ) - private Integer bottom; - - @Schema(description = "菜单选中的path") - private String active; - - @Schema(description = "其它路由元信息") - private String meta; - - @Schema(description = "css样式") - private String style; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "语言") - private String lang; - - @Schema(description = "设为首页") - @QueryField(type = QueryType.EQ) - private Integer home; - - @Schema(description = "推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopChatConversationParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopChatConversationParam.java deleted file mode 100644 index 6dcbd1b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopChatConversationParam.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 聊天消息表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopChatConversationParam对象", description = "聊天消息表查询参数") -public class ShopChatConversationParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "好友ID") - @QueryField(type = QueryType.EQ) - private Integer friendId; - - @Schema(description = "消息类型") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "消息内容") - private String content; - - @Schema(description = "未读消息") - @QueryField(type = QueryType.EQ) - private Integer unRead; - - @Schema(description = "状态, 0未读, 1已读") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopChatMessageParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopChatMessageParam.java deleted file mode 100644 index 925261b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopChatMessageParam.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 聊天消息表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopChatMessageParam对象", description = "聊天消息表查询参数") -public class ShopChatMessageParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "发送人ID") - @QueryField(type = QueryType.EQ) - private Integer formUserId; - - @Schema(description = "接收人ID") - @QueryField(type = QueryType.EQ) - private Integer toUserId; - - @Schema(description = "消息类型") - private String type; - - @Schema(description = "消息内容") - private String content; - - @Schema(description = "屏蔽接收方") - @QueryField(type = QueryType.EQ) - private Integer sideTo; - - @Schema(description = "屏蔽发送方") - @QueryField(type = QueryType.EQ) - private Integer sideFrom; - - @Schema(description = "是否撤回") - @QueryField(type = QueryType.EQ) - private Integer withdraw; - - @Schema(description = "文件信息") - private String fileInfo; - - @Schema(description = "存在联系方式") - @QueryField(type = QueryType.EQ) - private Integer hasContact; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0未读, 1已读") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCommissionRoleParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCommissionRoleParam.java deleted file mode 100644 index 45fdd79..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCommissionRoleParam.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分红角色查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 10:01:14 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCommissionRoleParam对象", description = "分红角色查询参数") -public class ShopCommissionRoleParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - private String title; - - @QueryField(type = QueryType.EQ) - private Integer provinceId; - - @QueryField(type = QueryType.EQ) - private Integer cityId; - - @QueryField(type = QueryType.EQ) - private Integer regionId; - - @Schema(description = "状态, 0正常, 1异常") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "备注") - private String comments; - - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCountParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCountParam.java deleted file mode 100644 index b7ac2ff..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCountParam.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商城销售统计表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCountParam对象", description = "商城销售统计表查询参数") -public class ShopCountParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "统计日期") - private String dateTime; - - @Schema(description = "总销售额") - @QueryField(type = QueryType.EQ) - private BigDecimal totalPrice; - - @Schema(description = "今日销售额") - @QueryField(type = QueryType.EQ) - private BigDecimal todayPrice; - - @Schema(description = "总会员数") - @QueryField(type = QueryType.EQ) - private BigDecimal totalUsers; - - @Schema(description = "今日新增") - @QueryField(type = QueryType.EQ) - private BigDecimal todayUsers; - - @Schema(description = "总订单笔数") - @QueryField(type = QueryType.EQ) - private BigDecimal totalOrders; - - @Schema(description = "今日订单笔数") - @QueryField(type = QueryType.EQ) - private BigDecimal todayOrders; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyCateParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyCateParam.java deleted file mode 100644 index b80698a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyCateParam.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 优惠券可用分类查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:48 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCouponApplyCateParam对象", description = "优惠券可用分类查询参数") -public class ShopCouponApplyCateParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @QueryField(type = QueryType.EQ) - private Integer couponId; - - @QueryField(type = QueryType.EQ) - private Integer cateId; - - @Schema(description = "分类等级") - @QueryField(type = QueryType.EQ) - private Boolean cateLevel; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyItemParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyItemParam.java deleted file mode 100644 index f27cc47..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponApplyItemParam.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 优惠券可用分类查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCouponApplyItemParam对象", description = "优惠券可用分类查询参数") -public class ShopCouponApplyItemParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @QueryField(type = QueryType.EQ) - private Integer couponId; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "分类ID") - @QueryField(type = QueryType.EQ) - private Integer categoryId; - - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "0服务1需求2闲置") - @QueryField(type = QueryType.EQ) - private Integer pk; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java deleted file mode 100644 index 58f71f5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopCouponParam.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 优惠券查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:23 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopCouponParam对象", description = "优惠券查询参数") -public class ShopCouponParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "优惠券名称") - private String name; - - @Schema(description = "优惠券描述") - private String description; - - @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "满减券-减免金额") - @QueryField(type = QueryType.EQ) - private BigDecimal reducePrice; - - @Schema(description = "折扣券-折扣率(0-100)") - @QueryField(type = QueryType.EQ) - private Integer discount; - - @Schema(description = "最低消费金额") - @QueryField(type = QueryType.EQ) - private BigDecimal minPrice; - - @Schema(description = "到期类型(10领取后生效 20固定时间)") - @QueryField(type = QueryType.EQ) - private Integer expireType; - - @Schema(description = "领取后生效-有效天数") - @QueryField(type = QueryType.EQ) - private Integer expireDay; - - @Schema(description = "有效期开始时间") - private String startTime; - - @Schema(description = "有效期结束时间") - private String endTime; - - @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") - @QueryField(type = QueryType.EQ) - private Integer applyRange; - - @Schema(description = "适用范围配置(json格式)") - private String applyRangeConfig; - - @Schema(description = "是否过期(0未过期 1已过期)") - @QueryField(type = QueryType.EQ) - private Integer isExpire; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1禁用") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "创建用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "发放总数量(-1表示无限制)") - @QueryField(type = QueryType.EQ) - private Integer totalCount; - - @Schema(description = "已发放数量") - @QueryField(type = QueryType.EQ) - private Integer issuedCount; - - @Schema(description = "每人限领数量(-1表示无限制)") - @QueryField(type = QueryType.EQ) - private Integer limitPerUser; - - @Schema(description = "是否启用(0禁用 1启用)") - @QueryField(type = QueryType.EQ) - private Boolean enabled; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyImportParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyImportParam.java deleted file mode 100644 index 50ff384..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyImportParam.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.gxwebsoft.shop.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * 分销商申请记录导入参数 - * - * @author 科技小王子 - * @since 2025-09-05 - */ -@Data -public class ShopDealerApplyImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "类型", replace = {"经销商_0", "企业_1", "集团_2"}) - private Integer type; - - @Excel(name = "用户ID") - private Integer userId; - - @Excel(name = "姓名") - private String realName; - - @Excel(name = "分销商名称") - private String dealerName; - - @Excel(name = "分销商编码") - private String dealerCode; - - @Excel(name = "手机号") - private String mobile; - - @Excel(name = "合同金额") - private BigDecimal money; - - @Excel(name = "详细地址") - private String address; - - @Excel(name = "推荐人用户ID") - private Integer refereeId; - - @Excel(name = "申请方式", replace = {"需后台审核_10", "无需审核_20"}) - private Integer applyType; - - @Excel(name = "审核状态", replace = {"待审核_10", "审核通过_20", "驳回_30"}) - private Integer applyStatus; - - @Excel(name = "合同时间", format = "yyyy-MM-dd HH:mm:ss") - private String contractTime; - - @Excel(name = "驳回原因") - private String rejectReason; - - @Excel(name = "商城ID") - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyParam.java deleted file mode 100644 index fb4211a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerApplyParam.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商申请记录表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:50:17 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerApplyParam对象", description = "分销商申请记录表查询参数") -public class ShopDealerApplyParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer applyId; - - @Schema(description = "0经销商,1企业也,2集团)") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "姓名") - private String realName; - - @Schema(description = "手机号") - private String mobile; - - @Schema(description = "推荐人用户ID") - @QueryField(type = QueryType.EQ) - private Integer refereeId; - - @Schema(description = "申请方式(10需后台审核 20无需审核)") - @QueryField(type = QueryType.EQ) - private Integer applyType; - - @Schema(description = "申请时间") - @QueryField(type = QueryType.EQ) - private String applyTime; - - @Schema(description = "到期时间") - @QueryField(type = QueryType.EQ) - private String expirationTime; - - @Schema(description = "审核状态 (10待审核 20审核通过 30驳回)") - @QueryField(type = QueryType.EQ) - private Integer applyStatus; - - @Schema(description = "审核时间") - @QueryField(type = QueryType.EQ) - private String auditTime; - - @Schema(description = "驳回原因") - private String rejectReason; - - @Schema(description = "分销商名称") - @QueryField(type = QueryType.EQ) - private String dealerName; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerBankParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerBankParam.java deleted file mode 100644 index 5aa4941..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerBankParam.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 分销商提现银行卡查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerBankParam对象", description = "分销商提现银行卡查询参数") -public class ShopDealerBankParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "分销商用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "开户行名称") - private String bankName; - - @Schema(description = "银行开户名") - private String bankAccount; - - @Schema(description = "银行卡号") - private String bankCard; - - @Schema(description = "申请状态 (10待审核 20审核通过 30驳回)") - @QueryField(type = QueryType.EQ) - private Integer applyStatus; - - @Schema(description = "审核时间") - @QueryField(type = QueryType.EQ) - private Integer auditTime; - - @Schema(description = "驳回原因") - private String rejectReason; - - @Schema(description = "默认收货地址") - @QueryField(type = QueryType.EQ) - private Boolean isDefault; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerCapitalParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerCapitalParam.java deleted file mode 100644 index 1bde4f9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerCapitalParam.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商资金明细表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:40 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerCapitalParam对象", description = "分销商资金明细表查询参数") -public class ShopDealerCapitalParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "分销商用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "订单编号") - @QueryField(type = QueryType.EQ) - private String orderNo; - - @Schema(description = "资金流动类型 (10佣金收入 20提现支出 30转账支出 40转账收入)") - @QueryField(type = QueryType.EQ) - private Integer flowType; - - @Schema(description = "金额") - @QueryField(type = QueryType.EQ) - private BigDecimal money; - - @Schema(description = "描述") - private String comments; - - @Schema(description = "对方用户ID") - @QueryField(type = QueryType.EQ) - private Integer toUserId; - - @Schema(description = "月份") - @QueryField(type = QueryType.EQ) - private String month; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderImportParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderImportParam.java deleted file mode 100644 index ee88898..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderImportParam.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.shop.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.math.BigDecimal; -import java.io.Serializable; -import java.time.LocalDateTime; - -/** - * 分销商订单记录表导入参数 - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -@Data -public class ShopDealerOrderImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "主键ID") - private Integer id; - - @Excel(name = "买家用户ID") - private Integer userId; - - @Excel(name = "订单ID") - private Integer orderId; - - @Excel(name = "订单总金额") - private BigDecimal orderPrice; - - @Excel(name = "一级分销商ID") - private Integer firstUserId; - - @Excel(name = "二级分销商ID") - private Integer secondUserId; - - @Excel(name = "三级分销商ID") - private Integer thirdUserId; - - @Excel(name = "一级佣金") - private BigDecimal firstMoney; - - @Excel(name = "二级佣金") - private BigDecimal secondMoney; - - @Excel(name = "三级佣金") - private BigDecimal thirdMoney; - - @Excel(name = "订单状态") - private Integer isInvalid; - - @Excel(name = "结算状态") - private Integer isSettled; - - @Excel(name = "结算时间") - private LocalDateTime settleTime; - - @Excel(name = "租户ID") - private Integer tenantId; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderParam.java deleted file mode 100644 index 1f21f8a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerOrderParam.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商订单记录表查询参数 - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerOrderParam对象", description = "分销商订单记录表查询参数") -public class ShopDealerOrderParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "买家用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Excel(name = "订单编号") - @QueryField(type = QueryType.EQ) - private String orderNo; - - @Schema(description = "订单总金额(不含运费)") - @QueryField(type = QueryType.EQ) - private BigDecimal orderPrice; - - @Schema(description = "分销商用户id(一级)") - @QueryField(type = QueryType.EQ) - private Integer firstUserId; - - @Schema(description = "分销商用户id(二级)") - @QueryField(type = QueryType.EQ) - private Integer secondUserId; - - @Schema(description = "分销商用户id(三级)") - @QueryField(type = QueryType.EQ) - private Integer thirdUserId; - - @Schema(description = "分销佣金(一级)") - @QueryField(type = QueryType.EQ) - private BigDecimal firstMoney; - - @Schema(description = "分销佣金(二级)") - @QueryField(type = QueryType.EQ) - private BigDecimal secondMoney; - - @Schema(description = "分销佣金(三级)") - @QueryField(type = QueryType.EQ) - private BigDecimal thirdMoney; - - @Schema(description = "订单是否失效(0未失效 1已失效)") - @QueryField(type = QueryType.EQ) - private Integer isInvalid; - - @Schema(description = "佣金结算(0未结算 1已结算)") - @QueryField(type = QueryType.EQ) - private Integer isSettled; - - @Schema(description = "结算时间") - @QueryField(type = QueryType.EQ) - private String settleTime; - - @Schema(description = "备注") - @QueryField(type = QueryType.EQ) - private String comments; - - @Schema(description = "关联ID") - @QueryField(type = QueryType.EQ) - private Integer resourceId; - - @Schema(description = "月份") - @QueryField(type = QueryType.EQ) - private String month; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerRecordParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerRecordParam.java deleted file mode 100644 index 84acded..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerRecordParam.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 客户跟进情况查询参数 - * - * @author 科技小王子 - * @since 2025-10-02 12:21:50 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(description = "客户跟进情况查询参数") -public class ShopDealerRecordParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "上级id, 0是顶级") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "客户ID") - @QueryField(type = QueryType.EQ) - private Integer dealerId; - - @Schema(description = "内容") - private String content; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0待处理, 1已完成") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerRefereeParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerRefereeParam.java deleted file mode 100644 index b96adf8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerRefereeParam.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商推荐关系表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerRefereeParam对象", description = "分销商推荐关系表查询参数") -public class ShopDealerRefereeParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "分销商用户ID") - @QueryField(type = QueryType.EQ) - private Integer dealerId; - - @Schema(description = "用户id(被推荐人)") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "推荐关系层级(1,2,3)") - @QueryField(type = QueryType.EQ) - private Integer level; - - @Schema(description = "是否管理员") - @QueryField(type = QueryType.EQ) - private Boolean isAdmin; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingParam.java deleted file mode 100644 index e9f214e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerSettingParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商设置表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerSettingParam对象", description = "分销商设置表查询参数") -public class ShopDealerSettingParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "设置项标示") - @QueryField(type = QueryType.EQ) - private String key; - - @Schema(description = "设置项描述") - private String describe; - - @Schema(description = "设置内容(json格式)") - private String values; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserImportParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserImportParam.java deleted file mode 100644 index 064bcb9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserImportParam.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.gxwebsoft.shop.param; - -import cn.afterturn.easypoi.excel.annotation.Excel; -import lombok.Data; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; - -/** - * 分销商用户导入参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -public class ShopDealerUserImportParam implements Serializable { - private static final long serialVersionUID = 1L; - - @Excel(name = "用户ID") - private Integer userId; - - @Excel(name = "姓名") - private String realName; - - @Excel(name = "手机号") - private String mobile; - - @Excel(name = "支付密码") - private String payPassword; - - @Excel(name = "当前可提现佣金") - private BigDecimal money; - - @Excel(name = "已冻结佣金") - private BigDecimal freezeMoney; - - @Excel(name = "累积提现佣金") - private BigDecimal totalMoney; - - @Excel(name = "推荐人用户ID") - private Integer refereeId; - - @Excel(name = "成员数量(一级)") - private Integer firstNum; - - @Excel(name = "成员数量(二级)") - private Integer secondNum; - - @Excel(name = "成员数量(三级)") - private Integer thirdNum; - - @Excel(name = "专属二维码") - private String qrcode; - - @Excel(name = "排序号") - private Integer sortNumber; - - @Excel(name = "是否删除") - private Integer isDelete; - - @Excel(name = "租户ID") - private Integer tenantId; - - @Excel(name = "创建时间") - private LocalDateTime createTime; - - @Excel(name = "修改时间") - private LocalDateTime updateTime; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserParam.java deleted file mode 100644 index 9953b1f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerUserParam.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商用户记录表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerUserParam对象", description = "分销商用户记录表查询参数") -public class ShopDealerUserParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "类型") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "姓名") - private String realName; - - @Schema(description = "手机号") - private String mobile; - - @Schema(description = "支付密码") - private String payPassword; - - @Schema(description = "当前可提现佣金") - @QueryField(type = QueryType.EQ) - private BigDecimal money; - - @Schema(description = "已冻结佣金") - @QueryField(type = QueryType.EQ) - private BigDecimal freezeMoney; - - @Schema(description = "累积提现佣金") - @QueryField(type = QueryType.EQ) - private BigDecimal totalMoney; - - @Schema(description = "佣金比例") - @QueryField(type = QueryType.EQ) - private BigDecimal rate; - - @Schema(description = "推荐人用户ID") - @QueryField(type = QueryType.EQ) - private Integer refereeId; - - @Schema(description = "成员数量(一级)") - @QueryField(type = QueryType.EQ) - private Integer firstNum; - - @Schema(description = "成员数量(二级)") - @QueryField(type = QueryType.EQ) - private Integer secondNum; - - @Schema(description = "成员数量(三级)") - @QueryField(type = QueryType.EQ) - private Integer thirdNum; - - @Schema(description = "专属二维码") - private String qrcode; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除") - @QueryField(type = QueryType.EQ) - private Integer isDelete; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerWithdrawParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerWithdrawParam.java deleted file mode 100644 index a510fc3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopDealerWithdrawParam.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分销商提现明细表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopDealerWithdrawParam对象", description = "分销商提现明细表查询参数") -public class ShopDealerWithdrawParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "分销商用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "提现金额") - @QueryField(type = QueryType.EQ) - private BigDecimal money; - - @Schema(description = "打款方式 (10微信 20支付宝 30银行卡)") - @QueryField(type = QueryType.EQ) - private Integer payType; - - @Schema(description = "支付宝姓名") - private String alipayName; - - @Schema(description = "支付宝账号") - private String alipayAccount; - - @Schema(description = "开户行名称") - private String bankName; - - @Schema(description = "银行开户名") - private String bankAccount; - - @Schema(description = "银行卡号") - private String bankCard; - - @Schema(description = "申请状态 (10待审核 20审核通过 30驳回 40已打款)") - @QueryField(type = QueryType.EQ) - private Integer applyStatus; - - @Schema(description = "审核时间") - @QueryField(type = QueryType.EQ) - private String auditTime; - - @Schema(description = "驳回原因") - private String rejectReason; - - @Schema(description = "来源客户端(APP、H5、小程序等)") - private String platform; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "上传支付凭证") - private String image; - - @Schema(description = "微信openId") - @QueryField(type = QueryType.EQ) - private String openId; - - @Schema(description = "公众号openId") - @QueryField(type = QueryType.EQ) - private String officeOpenid; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressParam.java deleted file mode 100644 index ce43740..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressParam.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 物流公司查询参数 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopExpressParam对象", description = "物流公司查询参数") -public class ShopExpressParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "物流公司ID") - @QueryField(type = QueryType.EQ) - private Integer expressId; - - @Schema(description = "物流公司名称") - private String expressName; - - @Schema(description = "物流公司编码 (微信)") - private String wxCode; - - @Schema(description = "物流公司编码 (快递100)") - private String kuaidi100Code; - - @Schema(description = "物流公司编码 (快递鸟)") - private String kdniaoCode; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateDetailParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateDetailParam.java deleted file mode 100644 index 6a2f8c9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateDetailParam.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 运费模板查询参数 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopExpressTemplateDetailParam对象", description = "运费模板查询参数") -public class ShopExpressTemplateDetailParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @QueryField(type = QueryType.EQ) - private Integer templateId; - - @Schema(description = "0按件") - @QueryField(type = QueryType.EQ) - private Boolean type; - - @QueryField(type = QueryType.EQ) - private Integer provinceId; - - @QueryField(type = QueryType.EQ) - private Integer cityId; - - @Schema(description = "首件数量/重量") - @QueryField(type = QueryType.EQ) - private BigDecimal firstNum; - - @Schema(description = "收件价格") - @QueryField(type = QueryType.EQ) - private BigDecimal firstAmount; - - @Schema(description = "续件价格") - @QueryField(type = QueryType.EQ) - private BigDecimal extraAmount; - - @Schema(description = "续件数量/重量") - @QueryField(type = QueryType.EQ) - private BigDecimal extraNum; - - @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateParam.java deleted file mode 100644 index 43c4ebd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopExpressTemplateParam.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 运费模板查询参数 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopExpressTemplateParam对象", description = "运费模板查询参数") -public class ShopExpressTemplateParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @QueryField(type = QueryType.EQ) - private Boolean type; - - private String title; - - @Schema(description = "收件价格") - @QueryField(type = QueryType.EQ) - private BigDecimal firstAmount; - - @Schema(description = "续件价格") - @QueryField(type = QueryType.EQ) - private BigDecimal extraAmount; - - @Schema(description = "状态, 0已发布, 1待审核 2已驳回 3违规内容") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "首件数量/重量") - @QueryField(type = QueryType.EQ) - private BigDecimal firstNum; - - @Schema(description = "续件数量/重量") - @QueryField(type = QueryType.EQ) - private BigDecimal extraNum; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGiftParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGiftParam.java deleted file mode 100644 index e5e710c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGiftParam.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 礼品卡查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 18:07:31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGiftParam对象", description = "礼品卡查询参数") -public class ShopGiftParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - private String name; - - @Schema(description = "秘钥") - private String code; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "使用地点") - private String useLocation; - - @Schema(description = "领取时间") - private String takeTime; - - @Schema(description = "操作人") - @QueryField(type = QueryType.EQ) - private Integer operatorUserId; - - @Schema(description = "核销时间") - private String verificationTime; - - @Schema(description = "是否展示") - @QueryField(type = QueryType.EQ) - private Boolean isShow; - - @Schema(description = "状态, 0未使用 1已使用 2失效") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "操作员备注") - private String operatorRemarks; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCategoryParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCategoryParam.java deleted file mode 100644 index 646c7e1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCategoryParam.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品分类查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 00:36:45 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsCategoryParam对象", description = "商品分类查询参数") -public class ShopGoodsCategoryParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "商品分类ID") - @QueryField(type = QueryType.EQ) - private Integer categoryId; - - @Schema(description = "分类标识") - private String categoryCode; - - @Schema(description = "分类名称") - private String title; - - @Schema(description = "类型 0商城分类 1外卖分类") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "分类图片") - private String image; - - @Schema(description = "上级分类ID") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "路由/链接地址") - private String path; - - @Schema(description = "组件路径") - private String component; - - @Schema(description = "绑定的页面") - @QueryField(type = QueryType.EQ) - private Integer pageId; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "商品数量") - @QueryField(type = QueryType.EQ) - private Integer count; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)") - @QueryField(type = QueryType.EQ) - private Integer hide; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "是否显示在首页") - @QueryField(type = QueryType.EQ) - private Integer showIndex; - - @Schema(description = "商铺ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "状态, 0正常, 1禁用") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCommentParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCommentParam.java deleted file mode 100644 index 582b4ad..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsCommentParam.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 评论表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsCommentParam对象", description = "评论表查询参数") -public class ShopGoodsCommentParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "评论ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer uid; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer oid; - - @Schema(description = "商品唯一id") - private String unique; - - @Schema(description = "商品id") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "某种商品类型(普通商品、秒杀商品)") - private String replyType; - - @Schema(description = "商品分数") - @QueryField(type = QueryType.EQ) - private Boolean goodsScore; - - @Schema(description = "服务分数") - @QueryField(type = QueryType.EQ) - private Boolean serviceScore; - - @Schema(description = "评论内容") - private String comment; - - @Schema(description = "评论图片") - private String pics; - - @Schema(description = "管理员回复内容") - private String merchantReplyContent; - - @Schema(description = "管理员回复时间") - @QueryField(type = QueryType.EQ) - private Integer merchantReplyTime; - - @Schema(description = "0未删除1已删除") - @QueryField(type = QueryType.EQ) - private Boolean isDel; - - @Schema(description = "0未回复1已回复") - @QueryField(type = QueryType.EQ) - private Boolean isReply; - - @Schema(description = "用户名称") - private String nickname; - - @Schema(description = "用户头像") - private String avatar; - - @Schema(description = "商品规格属性值,多个,号隔开") - private String sku; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsIncomeConfigParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsIncomeConfigParam.java deleted file mode 100644 index 8c25e70..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsIncomeConfigParam.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 分润配置查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsIncomeConfigParam对象", description = "分润配置查询参数") -public class ShopGoodsIncomeConfigParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "店铺类型") - private String merchantShopType; - - @QueryField(type = QueryType.EQ) - private Integer skuId; - - @Schema(description = "比例") - @QueryField(type = QueryType.EQ) - private BigDecimal rate; - - @Schema(description = "用户id") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsLogParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsLogParam.java deleted file mode 100644 index e31017f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsLogParam.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品日志表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsLogParam对象", description = "商品日志表查询参数") -public class ShopGoodsLogParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "统计ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "类型visit,cart,order,pay,collect,refund") - private String type; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "是否浏览") - @QueryField(type = QueryType.EQ) - private Boolean visitNum; - - @Schema(description = "加入购物车数量") - @QueryField(type = QueryType.EQ) - private Integer cartNum; - - @Schema(description = "下单数量") - @QueryField(type = QueryType.EQ) - private Integer orderNum; - - @Schema(description = "支付数量") - @QueryField(type = QueryType.EQ) - private Integer payNum; - - @Schema(description = "支付金额") - @QueryField(type = QueryType.EQ) - private BigDecimal payPrice; - - @Schema(description = "商品成本价") - @QueryField(type = QueryType.EQ) - private BigDecimal costPrice; - - @Schema(description = "支付用户ID") - @QueryField(type = QueryType.EQ) - private Integer payUid; - - @Schema(description = "退款数量") - @QueryField(type = QueryType.EQ) - private Integer refundNum; - - @Schema(description = "退款金额") - @QueryField(type = QueryType.EQ) - private BigDecimal refundPrice; - - @Schema(description = "收藏") - @QueryField(type = QueryType.EQ) - private Boolean collectNum; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsParam.java deleted file mode 100644 index d3cfa5e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsParam.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品查询参数 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsParam对象", description = "商品查询参数") -public class ShopGoodsParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "商品名称") - private String name; - - @Schema(description = "产品编码") - private String code; - - @Schema(description = "类型 0软件产品 1实物商品 2虚拟商品") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "封面图") - private String image; - - @Schema(description = "父级分类ID") - @QueryField(type = QueryType.EQ) - private Integer parentId; - - @Schema(description = "产品分类ID") - @QueryField(type = QueryType.EQ) - private Integer categoryId; - - @Schema(description = "路由地址") - private String path; - - @Schema(description = "标签") - private String tag; - - @Schema(description = "产品规格 0单规格 1多规格") - @QueryField(type = QueryType.EQ) - private Integer specs; - - @Schema(description = "货架") - private String position; - - @Schema(description = "单位名称 (个)") - private String unitName; - - @Schema(description = "商品价格") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "进货价格") - @QueryField(type = QueryType.EQ) - private BigDecimal buyingPrice; - - @Schema(description = "经销商价格") - @QueryField(type = QueryType.EQ) - private BigDecimal dealerPrice; - - @Schema(description = "库存计算方式(10下单减库存 20付款减库存)") - @QueryField(type = QueryType.EQ) - private Integer deductStockType; - - @Schema(description = "交付方式(0不启用)") - @QueryField(type = QueryType.EQ) - private Integer deliveryMethod; - - @Schema(description = "购买时长(0不启用,1 一次性,2 按时长)") - @QueryField(type = QueryType.EQ) - private Integer durationMethod; - - @Schema(description = "可购买数量") - @QueryField(type = QueryType.EQ) - private Integer canBuyNumber; - - @Schema(description = "轮播图") - private String files; - - @Schema(description = "销量") - @QueryField(type = QueryType.EQ) - private Integer sales; - - @Schema(description = "库存") - @QueryField(type = QueryType.EQ) - private Integer stock; - - @Schema(description = "安装次数") - @QueryField(type = QueryType.EQ) - private Integer install; - - @Schema(description = "评分") - @QueryField(type = QueryType.EQ) - private BigDecimal rate; - - @Schema(description = "消费赚取积分") - @QueryField(type = QueryType.EQ) - private BigDecimal gainIntegral; - - @Schema(description = "推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "是否官方") - @QueryField(type = QueryType.EQ) - private Integer official; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "是否展示") - @QueryField(type = QueryType.EQ) - private Boolean isShow; - - @Schema(description = "状态, 0上架 1待上架 2待审核 3审核不通过") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRelationParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRelationParam.java deleted file mode 100644 index 3441ea0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRelationParam.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品点赞和收藏表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsRelationParam对象", description = "商品点赞和收藏表查询参数") -public class ShopGoodsRelationParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "类型(收藏(collect)、点赞(like))") - private String type; - - @Schema(description = "某种类型的商品(普通商品、秒杀商品)") - private String category; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRoleCommissionParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRoleCommissionParam.java deleted file mode 100644 index fab8581..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsRoleCommissionParam.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品绑定角色的分润金额查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 09:53:38 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsRoleCommissionParam对象", description = "商品绑定角色的分润金额查询参数") -public class ShopGoodsRoleCommissionParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @QueryField(type = QueryType.EQ) - private Integer roleId; - - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - private String sku; - - @QueryField(type = QueryType.EQ) - private BigDecimal amount; - - @Schema(description = "状态, 0正常, 1异常") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "备注") - private String comments; - - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSkuParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSkuParam.java deleted file mode 100644 index 34ca471..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSkuParam.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品sku列表查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsSkuParam对象", description = "商品sku列表查询参数") -public class ShopGoodsSkuParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "商品属性索引值 (attr_value|attr_value[|....])") - private String sku; - - @Schema(description = "商品图片") - private String image; - - @Schema(description = "商品价格") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "市场价格") - @QueryField(type = QueryType.EQ) - private BigDecimal salePrice; - - @Schema(description = "成本价") - @QueryField(type = QueryType.EQ) - private BigDecimal cost; - - @Schema(description = "库存") - @QueryField(type = QueryType.EQ) - private Integer stock; - - @Schema(description = "sku编码") - private String skuNo; - - @Schema(description = "商品条码") - private String barCode; - - @Schema(description = "重量") - @QueryField(type = QueryType.EQ) - private BigDecimal weight; - - @Schema(description = "体积") - @QueryField(type = QueryType.EQ) - private BigDecimal volume; - - @Schema(description = "唯一值") - private String uuid; - - @Schema(description = "状态, 0正常, 1异常") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "备注") - private String comments; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSpecParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSpecParam.java deleted file mode 100644 index 3fedd04..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopGoodsSpecParam.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品多规格查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopGoodsSpecParam对象", description = "商品多规格查询参数") -public class ShopGoodsSpecParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "规格ID") - @QueryField(type = QueryType.EQ) - private Integer specId; - - @Schema(description = "规格名称") - private String specName; - - @Schema(description = "规格值") - private String specValue; - - @Schema(description = "活动类型 0=商品,1=秒杀,2=砍价,3=拼团") - @QueryField(type = QueryType.EQ) - private Boolean type; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantAccountParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantAccountParam.java deleted file mode 100644 index a82a66f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantAccountParam.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户账号查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopMerchantAccountParam对象", description = "商户账号查询参数") -public class ShopMerchantAccountParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "商户手机号") - private String phone; - - @Schema(description = "真实姓名") - private String realName; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "角色ID") - @QueryField(type = QueryType.EQ) - private Integer roleId; - - @Schema(description = "角色名称") - private String roleName; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantApplyParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantApplyParam.java deleted file mode 100644 index a35a41d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantApplyParam.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户入驻申请查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopMerchantApplyParam对象", description = "商户入驻申请查询参数") -public class ShopMerchantApplyParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer applyId; - - @Schema(description = "类型") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "店铺类型") - private String shopType; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "门店图片") - private String image; - - @Schema(description = "商户手机号") - private String phone; - - @Schema(description = "商户姓名") - private String realName; - - @Schema(description = "商户行业分类ID") - @QueryField(type = QueryType.EQ) - private Integer categoryId; - - @Schema(description = "商户分类") - private String category; - - @Schema(description = "经纬度") - private String lngAndLat; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "详细地址") - private String address; - - @Schema(description = "地区ID") - private String regionId; - - @Schema(description = "手续费") - @QueryField(type = QueryType.EQ) - private BigDecimal commission; - - @Schema(description = "关键字") - private String keywords; - - @Schema(description = "营业执照") - private String yyzz; - - @Schema(description = "身份证") - private String sfz1; - - @Schema(description = "身份证") - private String sfz2; - - @Schema(description = "资质图片") - private String files; - - @Schema(description = "所有人") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "是否自营") - @QueryField(type = QueryType.EQ) - private Integer ownStore; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "是否需要审核") - @QueryField(type = QueryType.EQ) - private Integer goodsReview; - - @Schema(description = "工作负责人") - private String name2; - - @Schema(description = "驳回原因") - private String reason; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantParam.java deleted file mode 100644 index 1c087b7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantParam.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户查询参数 - * - * @author 科技小王子 - * @since 2025-08-10 20:43:33 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopMerchantParam对象", description = "商户查询参数") -public class ShopMerchantParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户编号") - private String merchantCode; - - @Schema(description = "商户类型") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "商户图标") - private String image; - - @Schema(description = "商户手机号") - private String phone; - - @Schema(description = "商户姓名") - private String realName; - - @Schema(description = "店铺类型") - private String shopType; - - @Schema(description = "项目分类") - private String itemType; - - @Schema(description = "商户分类") - private String category; - - @Schema(description = "商户经营分类") - @QueryField(type = QueryType.EQ) - private Integer merchantCategoryId; - - @Schema(description = "商户分类") - private String merchantCategoryTitle; - - @Schema(description = "经纬度") - private String lngAndLat; - - private String lng; - - private String lat; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "详细地址") - private String address; - - @Schema(description = "手续费") - @QueryField(type = QueryType.EQ) - private BigDecimal commission; - - @Schema(description = "关键字") - private String keywords; - - @Schema(description = "资质图片") - private String files; - - @Schema(description = "营业时间") - private String businessTime; - - @Schema(description = "文章内容") - private String content; - - @Schema(description = "每小时价格") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "是否自营") - @QueryField(type = QueryType.EQ) - private Integer ownStore; - - @Schema(description = "是否可以快递") - @QueryField(type = QueryType.EQ) - private Boolean canExpress; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "是否营业") - @QueryField(type = QueryType.EQ) - private Integer isOn; - - private String startTime; - - private String endTime; - - @Schema(description = "是否需要审核") - @QueryField(type = QueryType.EQ) - private Integer goodsReview; - - @Schema(description = "管理入口") - private String adminUrl; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "所有人") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantTypeParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantTypeParam.java deleted file mode 100644 index c1cbdc2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopMerchantTypeParam.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商户类型查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopMerchantTypeParam对象", description = "商户类型查询参数") -public class ShopMerchantTypeParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "店铺类型") - private String name; - - @Schema(description = "店铺入驻条件") - private String comments; - - @Schema(description = "状态") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryGoodsParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryGoodsParam.java deleted file mode 100644 index af7763c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryGoodsParam.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 发货单商品查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderDeliveryGoodsParam对象", description = "发货单商品查询参数") -public class ShopOrderDeliveryGoodsParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "发货单ID") - @QueryField(type = QueryType.EQ) - private Integer deliveryId; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "订单商品ID") - @QueryField(type = QueryType.EQ) - private Integer orderGoodsId; - - @Schema(description = "商品ID") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "发货数量") - @QueryField(type = QueryType.EQ) - private Integer deliveryNum; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryParam.java deleted file mode 100644 index 3459550..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderDeliveryParam.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 发货单查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderDeliveryParam对象", description = "发货单查询参数") -public class ShopOrderDeliveryParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "发货单ID") - @QueryField(type = QueryType.EQ) - private Integer deliveryId; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "发货方式(10手动录入 20无需物流 30电子面单)") - @QueryField(type = QueryType.EQ) - private Integer deliveryMethod; - - @Schema(description = "打包方式(废弃)") - @QueryField(type = QueryType.EQ) - private Integer packMethod; - - @Schema(description = "物流公司ID") - @QueryField(type = QueryType.EQ) - private Integer expressId; - - @Schema(description = "物流单号") - private String expressNo; - - @Schema(description = "电子面单模板内容") - private String eorderHtml; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderExtractParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderExtractParam.java deleted file mode 100644 index 148fad5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderExtractParam.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 自提订单联系方式查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderExtractParam对象", description = "自提订单联系方式查询参数") -public class ShopOrderExtractParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "联系人姓名") - private String linkman; - - @Schema(description = "联系电话") - private String phone; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderGoodsParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderGoodsParam.java deleted file mode 100644 index 382f560..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderGoodsParam.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 商品信息查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderGoodsParam对象", description = "商品信息查询参数") -public class ShopOrderGoodsParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "关联订单表id") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "订单标识") - private String orderCode; - - @Schema(description = "关联商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商品封面图") - private String image; - - @Schema(description = "关联商品id") - @QueryField(type = QueryType.EQ) - private Integer goodsId; - - @Schema(description = "商品名称") - private String goodsName; - - @Schema(description = "商品规格") - private String spec; - - @QueryField(type = QueryType.EQ) - private Integer skuId; - - @Schema(description = "单价") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "购买数量") - @QueryField(type = QueryType.EQ) - private Integer totalNum; - - @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") - @QueryField(type = QueryType.EQ) - private Integer payStatus; - - @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") - @QueryField(type = QueryType.EQ) - private Integer orderStatus; - - @Schema(description = "是否免费:0收费、1免费") - @QueryField(type = QueryType.EQ) - private Boolean isFree; - - @Schema(description = "系统版本 0当前版本 其他版本") - @QueryField(type = QueryType.EQ) - private Integer version; - - @Schema(description = "预约时间段") - private String timePeriod; - - @Schema(description = "预定日期") - private String dateTime; - - @Schema(description = "开场时间") - private String startTime; - - @Schema(description = "结束时间") - private String endTime; - - @Schema(description = "毫秒时间戳") - private Long timeFlag; - - @Schema(description = "过期时间") - private String expirationTime; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "用户id") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoLogParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoLogParam.java deleted file mode 100644 index fa1135c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoLogParam.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 订单核销查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderInfoLogParam对象", description = "订单核销查询参数") -public class ShopOrderInfoLogParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "关联订单表id") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "关联商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "关联场地id") - @QueryField(type = QueryType.EQ) - private Integer fieldId; - - @Schema(description = "核销数量") - @QueryField(type = QueryType.EQ) - private Boolean useNum; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoParam.java deleted file mode 100644 index ff8221a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderInfoParam.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 场地查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderInfoParam对象", description = "场地查询参数") -public class ShopOrderInfoParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "自增ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "关联订单表id") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "组合数据:日期+时间段+场馆id+场地id") - private String orderCode; - - @Schema(description = "关联商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "关联场地id") - @QueryField(type = QueryType.EQ) - private Integer fieldId; - - @Schema(description = "场地名称") - private String fieldName; - - @Schema(description = "单价") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "儿童价") - @QueryField(type = QueryType.EQ) - private BigDecimal childrenPrice; - - @Schema(description = "成人人数") - @QueryField(type = QueryType.EQ) - private Integer adultNum; - - @Schema(description = "儿童人数") - @QueryField(type = QueryType.EQ) - private Integer childrenNum; - - @Schema(description = "已核销的成人票数") - @QueryField(type = QueryType.EQ) - private Integer adultNumUse; - - @Schema(description = "已核销的儿童票数") - @QueryField(type = QueryType.EQ) - private Integer childrenNumUse; - - @Schema(description = "0 未付款 1已付款,2无需付款或占用状态") - @QueryField(type = QueryType.EQ) - private Integer payStatus; - - @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") - @QueryField(type = QueryType.EQ) - private Integer orderStatus; - - @Schema(description = "是否免费:0收费、1免费") - @QueryField(type = QueryType.EQ) - private Boolean isFree; - - @Schema(description = "是否支持儿童票:0不支持、1支持") - @QueryField(type = QueryType.EQ) - private Boolean isChildren; - - @Schema(description = "系统版本 0当前版本 其他版本") - @QueryField(type = QueryType.EQ) - private Integer version; - - @Schema(description = "预订类型:0全场,1半场") - @QueryField(type = QueryType.EQ) - private Boolean isHalf; - - @Schema(description = "预约时间段") - private String timePeriod; - - @Schema(description = "预定日期") - private String dateTime; - - @Schema(description = "开场时间") - private String startTime; - - @Schema(description = "结束时间") - private String endTime; - - @Schema(description = "毫秒时间戳") - private Long timeFlag; - - @Schema(description = "过期时间") - private String expirationTime; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "用户id") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderParam.java deleted file mode 100644 index a3c7e62..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopOrderParam.java +++ /dev/null @@ -1,264 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 订单查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopOrderParam对象", description = "订单查询参数") -public class ShopOrderParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "订单号") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "订单类型,0商城订单 1预定订单/外卖 2会员卡") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "快递/自提") - @QueryField(type = QueryType.EQ) - private Integer deliveryType; - - @Schema(description = "下单渠道,0小程序预定 1俱乐部训练场 3活动订场") - @QueryField(type = QueryType.EQ) - private Integer channel; - - @Schema(description = "微信支付订单号") - private String transactionId; - - @Schema(description = "微信退款订单号") - private String refundOrder; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户编号") - private String merchantCode; - - @Schema(description = "使用的优惠券id") - @QueryField(type = QueryType.EQ) - private Integer couponId; - - @Schema(description = "使用的会员卡id") - private String cardId; - - @Schema(description = "关联管理员id") - @QueryField(type = QueryType.EQ) - private Integer adminId; - - @Schema(description = "核销管理员id") - @QueryField(type = QueryType.EQ) - private Integer confirmId; - - @Schema(description = "IC卡号") - private String icCard; - - @Schema(description = "真实姓名") - private String realName; - - @Schema(description = "手机号码") - private String phone; - - @Schema(description = "收货人id") - private Integer addressId; - - @Schema(description = "收货地址") - private String address; - - private String addressLat; - - private String addressLng; - - @Schema(description = "自提店铺id") - @QueryField(type = QueryType.EQ) - private Integer selfTakeMerchantId; - - @Schema(description = "自提店铺") - private String selfTakeMerchantName; - - @Schema(description = "配送开始时间") - private String sendStartTime; - - @Schema(description = "配送结束时间") - private String sendEndTime; - - @Schema(description = "发货店铺id") - @QueryField(type = QueryType.EQ) - private Integer expressMerchantId; - - @Schema(description = "发货店铺") - private String expressMerchantName; - - @Schema(description = "订单总额") - @QueryField(type = QueryType.EQ) - private BigDecimal totalPrice; - - @Schema(description = "减少的金额,使用VIP会员折扣、优惠券抵扣、优惠券折扣后减去的价格") - @QueryField(type = QueryType.EQ) - private BigDecimal reducePrice; - - @Schema(description = "实际付款") - @QueryField(type = QueryType.EQ) - private BigDecimal payPrice; - - @Schema(description = "用于统计") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "价钱,用于积分赠送") - @QueryField(type = QueryType.EQ) - private BigDecimal money; - - @Schema(description = "退款金额") - @QueryField(type = QueryType.EQ) - private BigDecimal refundMoney; - - @Schema(description = "教练价格") - @QueryField(type = QueryType.EQ) - private BigDecimal coachPrice; - - @Schema(description = "购买数量") - @QueryField(type = QueryType.EQ) - private Integer totalNum; - - @Schema(description = "教练id") - @QueryField(type = QueryType.EQ) - private Integer coachId; - - @Schema(description = "支付的用户id") - @QueryField(type = QueryType.EQ) - private Integer payUserId; - - @Schema(description = "支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") - @QueryField(type = QueryType.EQ) - private Integer payType; - - @Schema(description = "代付支付方式:0余额支付,1微信支付,2支付宝支付,3银联支付,4现金支付,5POS机支付,6免费,7积分支付") - @QueryField(type = QueryType.EQ) - private Integer friendPayType; - - @Schema(description = "0未付款,1已付款") - @QueryField(type = QueryType.EQ) - private Boolean payStatus; - - @Schema(description = "0未使用,1已完成,2已取消,3取消中,4退款申请中,5退款被拒绝,6退款成功,7客户端申请退款") - @QueryField(type = QueryType.EQ) - private Integer orderStatus; - - @Schema(description = "发货状态(10未发货 20已发货 30部分发货)") - @QueryField(type = QueryType.EQ) - private Integer deliveryStatus; - - @Schema(description = "发货备注") - private String deliveryNote; - - @Schema(description = "快递单号") - private String expressNo; - - @Schema(description = "发货时间") - private String deliveryTime; - - @Schema(description = "优惠类型:0无、1抵扣优惠券、2折扣优惠券、3、VIP月卡、4VIP年卡,5VIP次卡、6VIP会员卡、7IC月卡、8IC年卡、9IC次卡、10IC会员卡、11免费订单、12VIP充值卡、13IC充值卡、14VIP季卡、15IC季卡") - @QueryField(type = QueryType.EQ) - private Integer couponType; - - @Schema(description = "优惠说明") - private String couponDesc; - - @Schema(description = "二维码地址,保存订单号,支付成功后才生成") - private String qrcode; - - @Schema(description = "vip月卡年卡、ic月卡年卡回退次数") - @QueryField(type = QueryType.EQ) - private Integer returnNum; - - @Schema(description = "vip充值回退金额") - @QueryField(type = QueryType.EQ) - private BigDecimal returnMoney; - - @Schema(description = "预约详情开始时间数组") - private String startTime; - - @Schema(description = "是否已开具发票:0未开发票,1已开发票,2不能开具发票") - @QueryField(type = QueryType.EQ) - private Boolean isInvoice; - - @Schema(description = "发票流水号") - private String invoiceNo; - - @Schema(description = "支付时间") - private String payTime; - - @Schema(description = "退款时间") - private String refundTime; - - @Schema(description = "申请退款时间") - private String refundApplyTime; - - @Schema(description = "过期时间") - private String expirationTime; - - @Schema(description = "对账情况:0=未对账;1=已对账;3=已对账,金额对不上;4=未查询到该订单") - @QueryField(type = QueryType.EQ) - private Integer checkBill; - - @Schema(description = "订单是否已结算(0未结算 1已结算)") - @QueryField(type = QueryType.EQ) - private Integer isSettled; - - @Schema(description = "系统版本号 0当前版本 value=其他版本") - @QueryField(type = QueryType.EQ) - private Integer version; - - @Schema(description = "用户id") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "用户昵称") - @QueryField(type = QueryType.LIKE) - private String nickname; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "自提码") - private String selfTakeCode; - - @Schema(description = "是否已收到赠品") - @QueryField(type = QueryType.EQ) - private Boolean hasTakeGift; - - @Schema(description = "订单状态筛选:-1全部,0待支付,1待发货,2待核销,3待收货,4待评价,5已完成,6已退款,7已删除") - private Integer statusFilter; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopRechargeOrderParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopRechargeOrderParam.java deleted file mode 100644 index a15cf67..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopRechargeOrderParam.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 会员充值订单表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopRechargeOrderParam对象", description = "会员充值订单表查询参数") -public class ShopRechargeOrderParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "订单ID") - @QueryField(type = QueryType.EQ) - private Integer orderId; - - @Schema(description = "订单号") - private String orderNo; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "充值方式(10自定义金额 20套餐充值)") - @QueryField(type = QueryType.EQ) - private Integer rechargeType; - - @Schema(description = "机构id") - @QueryField(type = QueryType.EQ) - private Integer organizationId; - - @Schema(description = "充值套餐ID") - @QueryField(type = QueryType.EQ) - private Integer planId; - - @Schema(description = "用户支付金额") - @QueryField(type = QueryType.EQ) - private BigDecimal payPrice; - - @Schema(description = "赠送金额") - @QueryField(type = QueryType.EQ) - private BigDecimal giftMoney; - - @Schema(description = "实际到账金额") - @QueryField(type = QueryType.EQ) - private BigDecimal actualMoney; - - @Schema(description = "用户可用余额") - @QueryField(type = QueryType.EQ) - private BigDecimal balance; - - @Schema(description = "支付方式(微信/支付宝)") - private String payMethod; - - @Schema(description = "支付状态(10待支付 20已支付)") - @QueryField(type = QueryType.EQ) - private Integer payStatus; - - @Schema(description = "付款时间") - @QueryField(type = QueryType.EQ) - private Integer payTime; - - @Schema(description = "第三方交易记录ID") - @QueryField(type = QueryType.EQ) - private Integer tradeId; - - @Schema(description = "来源客户端 (APP、H5、小程序等)") - private String platform; - - @Schema(description = "所属门店ID") - @QueryField(type = QueryType.EQ) - private Integer shopId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "商户编码") - private String merchantCode; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSpecParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSpecParam.java deleted file mode 100644 index 07b78c3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSpecParam.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 规格查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopSpecParam对象", description = "规格查询参数") -public class ShopSpecParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "规格ID") - @QueryField(type = QueryType.EQ) - private Integer specId; - - @Schema(description = "规格名称") - private String specName; - - @Schema(description = "规格值") - private String specValue; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "创建用户") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "更新者") - @QueryField(type = QueryType.EQ) - private Integer updater; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1待修,2异常已修,3异常未修") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSpecValueParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSpecValueParam.java deleted file mode 100644 index c864f97..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSpecValueParam.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 规格值查询参数 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopSpecValueParam对象", description = "规格值查询参数") -public class ShopSpecValueParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "规格值ID") - @QueryField(type = QueryType.EQ) - private Integer specValueId; - - @Schema(description = "规格组ID") - @QueryField(type = QueryType.EQ) - private Integer specId; - - @Schema(description = "规格值") - private String specValue; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSplashParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSplashParam.java deleted file mode 100644 index 6893c66..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopSplashParam.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 开屏广告查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopSplashParam对象", description = "开屏广告查询参数") -public class ShopSplashParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "标题") - private String title; - - @Schema(description = "图片") - private String image; - - @Schema(description = "跳转类型") - private String jumpType; - - @Schema(description = "跳转主键") - @QueryField(type = QueryType.EQ) - private Integer jumpPk; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserAddressParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserAddressParam.java deleted file mode 100644 index 2225a36..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserAddressParam.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 收货地址查询参数 - * - * @author 科技小王子 - * @since 2025-07-22 23:06:40 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopUserAddressParam对象", description = "收货地址查询参数") -public class ShopUserAddressParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "姓名") - private String name; - - @Schema(description = "手机号码") - private String phone; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "收货地址") - private String address; - - @Schema(description = "收货地址") - private String fullAddress; - - private String lat; - - private String lng; - - @Schema(description = "1先生 2女士") - @QueryField(type = QueryType.EQ) - private Integer gender; - - @Schema(description = "家、公司、学校") - private String type; - - @Schema(description = "默认收货地址") - @QueryField(type = QueryType.EQ) - private Boolean isDefault; - - @Schema(description = "排序号") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserBalanceLogParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserBalanceLogParam.java deleted file mode 100644 index ba3938c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserBalanceLogParam.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 用户余额变动明细表查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopUserBalanceLogParam对象", description = "用户余额变动明细表查询参数") -public class ShopUserBalanceLogParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer logId; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "余额变动场景(0下级下单1供应商收入2差价收益 10用户充值 20用户消费 30管理员操作 40订单退款)") - @QueryField(type = QueryType.EQ) - private Integer scene; - - @Schema(description = "变动金额") - @QueryField(type = QueryType.EQ) - private BigDecimal money; - - @Schema(description = "变动后余额") - @QueryField(type = QueryType.EQ) - private BigDecimal balance; - - @Schema(description = "管理员备注") - private String remark; - - @Schema(description = "订单编号") - private String orderNo; - - @Schema(description = "操作人ID") - @QueryField(type = QueryType.EQ) - private Integer adminId; - - @Schema(description = "排序(数字越小越靠前)") - @QueryField(type = QueryType.EQ) - private Integer sortNumber; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0正常, 1冻结") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "商户编码") - private String merchantCode; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserCollectionParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserCollectionParam.java deleted file mode 100644 index 40a6fdb..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserCollectionParam.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 我的收藏查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopUserCollectionParam对象", description = "我的收藏查询参数") -public class ShopUserCollectionParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "0店铺,1商品") - @QueryField(type = QueryType.EQ) - private Boolean type; - - @Schema(description = "租户ID") - @QueryField(type = QueryType.EQ) - private Integer tid; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java deleted file mode 100644 index 3051530..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserCouponParam.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 用户优惠券查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopUserCouponParam对象", description = "用户优惠券查询参数") -public class ShopUserCouponParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "优惠券模板ID") - @QueryField(type = QueryType.EQ) - private Integer couponId; - - @Schema(description = "用户ID") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "优惠券名称") - private String name; - - @Schema(description = "优惠券描述") - private String description; - - @Schema(description = "优惠券类型(10满减券 20折扣券 30免费劵)") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "满减券-减免金额") - @QueryField(type = QueryType.EQ) - private BigDecimal reducePrice; - - @Schema(description = "折扣券-折扣率(0-100)") - @QueryField(type = QueryType.EQ) - private Integer discount; - - @Schema(description = "最低消费金额") - @QueryField(type = QueryType.EQ) - private BigDecimal minPrice; - - @Schema(description = "适用范围(10全部商品 20指定商品 30指定分类)") - @QueryField(type = QueryType.EQ) - private Integer applyRange; - - @Schema(description = "适用范围配置(json格式)") - private String applyRangeConfig; - - @Schema(description = "有效期开始时间") - private String startTime; - - @Schema(description = "有效期结束时间") - private String endTime; - - @Schema(description = "使用状态(0未使用 1已使用 2已过期)") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "使用时间") - private String useTime; - - @Schema(description = "使用订单ID") - private Long orderId; - - @Schema(description = "使用订单号") - private String orderNo; - - @Schema(description = "获取方式(10主动领取 20系统发放 30活动赠送)") - @QueryField(type = QueryType.EQ) - private Integer obtainType; - - @Schema(description = "获取来源描述") - private String obtainSource; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Boolean deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserParam.java deleted file mode 100644 index 2b3ac02..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserParam.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.gxwebsoft.shop.param; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.math.BigDecimal; - -/** - * 用户记录表查询参数 - * - * @author 科技小王子 - * @since 2025-10-03 13:41:08 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(description = "用户记录表查询参数") -public class ShopUserParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "用户id") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "用户类型 0个人用户 1企业用户 2其他") - @QueryField(type = QueryType.EQ) - private Integer type; - - @Schema(description = "账号") - private String username; - - @Schema(description = "密码") - private String password; - - @Schema(description = "昵称") - private String nickname; - - @Schema(description = "手机号") - private String phone; - - @Schema(description = "性别 1男 2女") - @QueryField(type = QueryType.EQ) - private Integer sex; - - @Schema(description = "职务") - private String position; - - @Schema(description = "注册来源客户端 (APP、H5、MP-WEIXIN等)") - private String platform; - - @Schema(description = "邮箱") - private String email; - - @Schema(description = "邮箱是否验证, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer emailVerified; - - @Schema(description = "别名") - private String alias; - - @Schema(description = "真实姓名") - private String realName; - - @Schema(description = "证件号码") - private String idCard; - - @Schema(description = "出生日期") - private String birthday; - - @Schema(description = "所在国家") - private String country; - - @Schema(description = "所在省份") - private String province; - - @Schema(description = "所在城市") - private String city; - - @Schema(description = "所在辖区") - private String region; - - @Schema(description = "街道地址") - private String address; - - @Schema(description = "经度") - private String longitude; - - @Schema(description = "纬度") - private String latitude; - - @Schema(description = "用户可用余额") - @QueryField(type = QueryType.EQ) - private BigDecimal balance; - - @Schema(description = "已提现金额") - @QueryField(type = QueryType.EQ) - private BigDecimal cashedMoney; - - @Schema(description = "用户可用积分") - @QueryField(type = QueryType.EQ) - private Integer points; - - @Schema(description = "用户总支付的金额") - @QueryField(type = QueryType.EQ) - private BigDecimal payMoney; - - @Schema(description = "实际消费的金额(不含退款)") - @QueryField(type = QueryType.EQ) - private BigDecimal expendMoney; - - @Schema(description = "密码") - private String payPassword; - - @Schema(description = "会员等级ID") - @QueryField(type = QueryType.EQ) - private Integer gradeId; - - @Schema(description = "行业分类") - private String category; - - @Schema(description = "个人简介") - private String introduction; - - @Schema(description = "机构id") - @QueryField(type = QueryType.EQ) - private Integer organizationId; - - @Schema(description = "会员分组ID") - @QueryField(type = QueryType.EQ) - private Integer groupId; - - @Schema(description = "头像") - private String avatar; - - @Schema(description = "背景图") - private String bgImage; - - @Schema(description = "用户编码") - private String userCode; - - @Schema(description = "是否已实名认证") - @QueryField(type = QueryType.EQ) - private Integer certification; - - @Schema(description = "年龄") - @QueryField(type = QueryType.EQ) - private Integer age; - - @Schema(description = "是否线下会员") - @QueryField(type = QueryType.EQ) - private Boolean offline; - - @Schema(description = "关注数") - @QueryField(type = QueryType.EQ) - private Integer followers; - - @Schema(description = "粉丝数") - @QueryField(type = QueryType.EQ) - private Integer fans; - - @Schema(description = "点赞数") - @QueryField(type = QueryType.EQ) - private Integer likes; - - @Schema(description = "评论数") - @QueryField(type = QueryType.EQ) - private Integer commentNumbers; - - @Schema(description = "是否推荐") - @QueryField(type = QueryType.EQ) - private Integer recommend; - - @Schema(description = "微信openid") - private String openid; - - @Schema(description = "微信公众号openid") - private String officeOpenid; - - @Schema(description = "微信unionID") - private String unionid; - - @Schema(description = "客户端ID") - private String clientId; - - @Schema(description = "不允许办卡") - @QueryField(type = QueryType.EQ) - private Boolean notAllowVip; - - @Schema(description = "是否管理员") - @QueryField(type = QueryType.EQ) - private Boolean isAdmin; - - @Schema(description = "是否企业管理员") - @QueryField(type = QueryType.EQ) - private Boolean isOrganizationAdmin; - - @Schema(description = "累计登录次数") - @QueryField(type = QueryType.EQ) - private Integer loginNum; - - @Schema(description = "企业ID") - @QueryField(type = QueryType.EQ) - private Integer companyId; - - @Schema(description = "可管理的场馆") - private String merchants; - - @Schema(description = "商户ID") - @QueryField(type = QueryType.EQ) - private Long merchantId; - - @Schema(description = "商户名称") - private String merchantName; - - @Schema(description = "商户头像") - private String merchantAvatar; - - @Schema(description = "第三方系统的用户ID") - @QueryField(type = QueryType.EQ) - private Integer uid; - - @Schema(description = "专家角色") - @QueryField(type = QueryType.EQ) - private Boolean expertType; - - @Schema(description = "过期时间") - @QueryField(type = QueryType.EQ) - private Integer expireTime; - - @Schema(description = "最后结算时间") - private String settlementTime; - - @Schema(description = "资质") - private String aptitude; - - @Schema(description = "行业类型(父级)") - private String industryParent; - - @Schema(description = "行业类型(子级)") - private String industryChild; - - @Schema(description = "头衔") - private String title; - - @Schema(description = "安装的产品ID") - @QueryField(type = QueryType.EQ) - private Integer templateId; - - @Schema(description = "插件安装状态(仅对超超管判断) 0未安装 1已安装 ") - @QueryField(type = QueryType.EQ) - private Integer installed; - - @Schema(description = "特长") - private String speciality; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "状态, 0在线, 1离线") - @QueryField(type = QueryType.EQ) - private Integer status; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserRefereeParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserRefereeParam.java deleted file mode 100644 index f0ea733..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopUserRefereeParam.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 用户推荐关系表查询参数 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopUserRefereeParam对象", description = "用户推荐关系表查询参数") -public class ShopUserRefereeParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @Schema(description = "主键ID") - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "推荐人ID") - @QueryField(type = QueryType.EQ) - private Integer dealerId; - - @Schema(description = "用户id(被推荐人)") - @QueryField(type = QueryType.EQ) - private Integer userId; - - @Schema(description = "推荐关系层级(1,2,3)") - @QueryField(type = QueryType.EQ) - private Integer level; - - @Schema(description = "备注") - private String comments; - - @Schema(description = "是否删除, 0否, 1是") - @QueryField(type = QueryType.EQ) - private Integer deleted; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopWechatDepositParam.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopWechatDepositParam.java deleted file mode 100644 index 29d0693..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/param/ShopWechatDepositParam.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.shop.param; - -import java.math.BigDecimal; -import com.gxwebsoft.common.core.annotation.QueryField; -import com.gxwebsoft.common.core.annotation.QueryType; -import com.gxwebsoft.common.core.web.BaseParam; -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 押金查询参数 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@JsonInclude(JsonInclude.Include.NON_NULL) -@Schema(name = "ShopWechatDepositParam对象", description = "押金查询参数") -public class ShopWechatDepositParam extends BaseParam { - private static final long serialVersionUID = 1L; - - @QueryField(type = QueryType.EQ) - private Integer id; - - @Schema(description = "订单id") - @QueryField(type = QueryType.EQ) - private Integer oid; - - @Schema(description = "用户id") - @QueryField(type = QueryType.EQ) - private Integer uid; - - @Schema(description = "场地订单号") - private String orderNum; - - @Schema(description = "付款订单号") - private String wechatOrder; - - @Schema(description = "退款订单号 ") - private String wechatReturn; - - @Schema(description = "场馆名称") - private String siteName; - - @Schema(description = "微信昵称") - private String username; - - @Schema(description = "手机号码") - private String phone; - - @Schema(description = "物品名称") - private String name; - - @Schema(description = "押金金额") - @QueryField(type = QueryType.EQ) - private BigDecimal price; - - @Schema(description = "押金状态,1已付款,2未付款,已退押金") - @QueryField(type = QueryType.EQ) - private Boolean status; - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/CouponStatusService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/CouponStatusService.java deleted file mode 100644 index 0bfad4a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/CouponStatusService.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.gxwebsoft.shop.entity.ShopUserCoupon; - -import java.util.List; - -/** - * 优惠券状态管理服务 - * - * @author WebSoft - * @since 2025-01-15 - */ -public interface CouponStatusService { - - /** - * 获取用户可用的优惠券列表 - * - * @param userId 用户ID - * @return 可用优惠券列表 - */ - List getAvailableCoupons(Integer userId); - - /** - * 获取用户已使用的优惠券列表 - * - * @param userId 用户ID - * @return 已使用优惠券列表 - */ - List getUsedCoupons(Integer userId); - - /** - * 获取用户已过期的优惠券列表 - * - * @param userId 用户ID - * @return 已过期优惠券列表 - */ - List getExpiredCoupons(Integer userId); - - /** - * 获取用户所有优惠券并按状态分类 - * - * @param userId 用户ID - * @return 分类后的优惠券列表 - */ - CouponStatusResult getUserCouponsGroupByStatus(Integer userId); - - /** - * 使用优惠券 - * - * @param userCouponId 用户优惠券ID - * @param orderId 订单ID - * @param orderNo 订单号 - * @return 是否成功 - */ - boolean useCoupon(Long userCouponId, Integer orderId, String orderNo); - - /** - * 退还优惠券(订单取消时) - * - * @param orderId 订单ID - * @return 是否成功 - */ - boolean returnCoupon(Integer orderId); - - /** - * 批量更新过期优惠券状态 - * - * @return 更新的数量 - */ - int updateExpiredCoupons(); - - /** - * 检查并更新单个优惠券状态 - * - * @param userCoupon 用户优惠券 - * @return 是否状态发生变化 - */ - boolean checkAndUpdateCouponStatus(ShopUserCoupon userCoupon); - - /** - * 验证优惠券是否可用于指定订单 - * - * @param userCouponId 用户优惠券ID - * @param totalAmount 订单总金额 - * @param goodsIds 商品ID列表 - * @return 验证结果 - */ - CouponValidationResult validateCouponForOrder(Long userCouponId, - java.math.BigDecimal totalAmount, - List goodsIds); - - /** - * 优惠券状态分类结果 - */ - class CouponStatusResult { - private List availableCoupons; // 可用优惠券 - private List usedCoupons; // 已使用优惠券 - private List expiredCoupons; // 已过期优惠券 - private int totalCount; // 总数量 - - // 构造函数 - public CouponStatusResult(List availableCoupons, - List usedCoupons, - List expiredCoupons) { - this.availableCoupons = availableCoupons; - this.usedCoupons = usedCoupons; - this.expiredCoupons = expiredCoupons; - this.totalCount = availableCoupons.size() + usedCoupons.size() + expiredCoupons.size(); - } - - // Getters and Setters - public List getAvailableCoupons() { return availableCoupons; } - public void setAvailableCoupons(List availableCoupons) { this.availableCoupons = availableCoupons; } - - public List getUsedCoupons() { return usedCoupons; } - public void setUsedCoupons(List usedCoupons) { this.usedCoupons = usedCoupons; } - - public List getExpiredCoupons() { return expiredCoupons; } - public void setExpiredCoupons(List expiredCoupons) { this.expiredCoupons = expiredCoupons; } - - public int getTotalCount() { return totalCount; } - public void setTotalCount(int totalCount) { this.totalCount = totalCount; } - } - - /** - * 优惠券验证结果 - */ - class CouponValidationResult { - private boolean valid; // 是否有效 - private String message; // 验证消息 - private java.math.BigDecimal discountAmount; // 优惠金额 - - public CouponValidationResult(boolean valid, String message) { - this.valid = valid; - this.message = message; - } - - public CouponValidationResult(boolean valid, String message, java.math.BigDecimal discountAmount) { - this.valid = valid; - this.message = message; - this.discountAmount = discountAmount; - } - - // Getters and Setters - public boolean isValid() { return valid; } - public void setValid(boolean valid) { this.valid = valid; } - - public String getMessage() { return message; } - public void setMessage(String message) { this.message = message; } - - public java.math.BigDecimal getDiscountAmount() { return discountAmount; } - public void setDiscountAmount(java.math.BigDecimal discountAmount) { this.discountAmount = discountAmount; } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/KuaiDi100.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/KuaiDi100.java deleted file mode 100644 index 6905f53..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/KuaiDi100.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.kuaidi100.sdk.pojo.HttpResult; -import com.kuaidi100.sdk.request.BOrderReq; - -public interface KuaiDi100 { - /** - * 商家寄件 - * @param bOrderReq - * @return - * @throws Exception - */ - HttpResult border(BOrderReq bOrderReq) throws Exception; - - String pollList(String com, String num, String phone) throws Exception; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/OrderBusinessService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/OrderBusinessService.java deleted file mode 100644 index 9037b8a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/OrderBusinessService.java +++ /dev/null @@ -1,691 +0,0 @@ -package com.gxwebsoft.shop.service; - -import cn.hutool.core.util.IdUtil; -import cn.hutool.core.util.ObjectUtil; -import com.gxwebsoft.common.core.exception.BusinessException; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.config.OrderConfigProperties; -import com.gxwebsoft.shop.dto.OrderCreateRequest; -import com.gxwebsoft.shop.entity.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * 订单业务服务类 - * 处理订单创建的核心业务逻辑 - * - * @author 科技小王子 - * @since 2025-01-26 - */ -@Slf4j -@Service -public class OrderBusinessService { - - @Resource - private ShopOrderService shopOrderService; - - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - - @Resource - private ShopGoodsService shopGoodsService; - - @Resource - private ShopGoodsSkuService shopGoodsSkuService; - - @Resource - private OrderConfigProperties orderConfig; - - @Resource - private ShopUserAddressService shopUserAddressService; - @Resource - private ShopUserCouponService shopUserCouponService; - - /** - * 创建订单 - * - * @param request 订单创建请求 - * @param loginUser 当前登录用户 - * @return 微信支付订单信息 - */ - @Transactional(rollbackFor = Exception.class) - public Map createOrder(OrderCreateRequest request, User loginUser) { - - // 1. 参数校验 - validateOrderRequest(request, loginUser); - - // 2. 构建订单对象 - ShopOrder shopOrder = buildShopOrder(request, loginUser); - - // 3. 处理收货地址信息 - processDeliveryAddress(shopOrder, request, loginUser); - - // 4. 应用业务规则 - applyBusinessRules(shopOrder, loginUser); - - // 5. 保存订单 - boolean saved = shopOrderService.save(shopOrder); - if (!saved) { - throw new BusinessException("订单保存失败"); - } - - // 6. 保存订单商品 - saveOrderGoods(request, shopOrder); - - // 7. 标记优惠券为已使用 - if (shopOrder.getCouponId() != null && shopOrder.getCouponId() > 0) { - markCouponAsUsed(shopOrder.getCouponId(), shopOrder.getOrderId()); - } - - // 8. 创建微信支付订单 - try { - return shopOrderService.createWxOrder(shopOrder); - } catch (Exception e) { - log.error("创建微信支付订单失败,订单号:{}", shopOrder.getOrderNo(), e); - throw new BusinessException("创建支付订单失败:" + e.getMessage()); - } - } - - /** - * 校验订单请求参数 - */ - private void validateOrderRequest(OrderCreateRequest request, User loginUser) { - if (loginUser == null) { - throw new BusinessException("用户未登录"); - } - - // 检查是否为测试账号 - boolean isTestAccount = orderConfig.isTestAccount(loginUser.getPhone()); - - if (isTestAccount) { - // 测试账号:直接使用测试金额,跳过金额验证 - BigDecimal testAmount = orderConfig.getTestAccount().getTestPayAmount(); - request.setTotalPrice(testAmount); - log.info("测试账号订单,用户:{},使用测试金额:{}", loginUser.getPhone(), testAmount); - return; // 测试账号跳过后续验证 - } - - // 非测试账号:正常验证流程 - // 验证商品信息并计算总金额 - BigDecimal calculatedTotal = validateAndCalculateTotal(request); - - if (calculatedTotal.compareTo(BigDecimal.ZERO) <= 0) { - throw new BusinessException("商品金额不能为0"); - } - - // 检查前端传入的总金额是否正确(允许小的误差,比如0.01) - if (request.getTotalPrice() != null && - request.getTotalPrice().subtract(calculatedTotal).abs().compareTo(new BigDecimal("0.01")) > 0) { - log.warn("订单金额计算不一致,前端传入:{},后台计算:{}", request.getTotalPrice(), calculatedTotal); -// throw new BusinessException("订单金额计算错误,请刷新重试"); - } - - // 使用后台计算的金额 - request.setTotalPrice(calculatedTotal); - - // 检查租户特殊规则 - OrderConfigProperties.TenantRule tenantRule = orderConfig.getTenantRule(request.getTenantId()); - if (tenantRule != null && tenantRule.getMinAmount() != null) { - if (calculatedTotal.compareTo(tenantRule.getMinAmount()) < 0) { - throw new BusinessException(tenantRule.getMinAmountMessage()); - } - } - } - - /** - * 验证商品信息并计算总金额 - */ - private BigDecimal validateAndCalculateTotal(OrderCreateRequest request) { - if (CollectionUtils.isEmpty(request.getGoodsItems())) { - throw new BusinessException("订单商品列表不能为空"); - } - - BigDecimal total = BigDecimal.ZERO; - - for (OrderCreateRequest.OrderGoodsItem item : request.getGoodsItems()) { - // 验证商品ID - if (item.getGoodsId() == null) { - throw new BusinessException("商品ID不能为空"); - } - - // 验证购买数量 - if (item.getQuantity() == null || item.getQuantity() <= 0) { - throw new BusinessException("商品购买数量必须大于0"); - } - - // 获取商品信息 - ShopGoods goods = shopGoodsService.getById(item.getGoodsId()); - if (goods == null) { - throw new BusinessException("商品不存在,商品ID:" + item.getGoodsId()); - } - - // 验证商品状态 - if (goods.getStatus() == null || goods.getStatus() != 0) { - throw new BusinessException("商品已下架:" + goods.getName()); - } - - // 处理多规格商品价格和库存验证 - BigDecimal actualPrice = goods.getPrice(); // 默认使用商品价格 - Integer actualStock = goods.getStock(); // 默认使用商品库存 - String productName = goods.getName(); - - if (item.getSkuId() != null) { - // 多规格商品,获取SKU信息 - ShopGoodsSku sku = shopGoodsSkuService.getById(item.getSkuId()); - if (sku == null) { - throw new BusinessException("商品规格不存在,SKU ID:" + item.getSkuId()); - } - - // 验证SKU是否属于该商品 - if (!sku.getGoodsId().equals(item.getGoodsId())) { - throw new BusinessException("商品规格不匹配"); - } - - // 验证SKU状态 - if (sku.getStatus() == null || sku.getStatus() != 0) { - throw new BusinessException("商品规格已下架"); - } - - // 使用SKU的价格和库存 - actualPrice = sku.getPrice(); - actualStock = sku.getStock(); - productName = goods.getName() + "(" + (item.getSpecInfo() != null ? item.getSpecInfo() : sku.getSku()) + ")"; - } - - // 验证实际价格 - if (actualPrice == null || actualPrice.compareTo(BigDecimal.ZERO) <= 0) { - throw new BusinessException("商品价格异常:" + productName); - } - - // 验证库存 - if (actualStock != null && actualStock < item.getQuantity()) { - throw new BusinessException("商品库存不足:" + productName + ",当前库存:" + actualStock); - } - - // 验证购买数量限制(使用商品级别的限制) - if (goods.getCanBuyNumber() != null && goods.getCanBuyNumber() > 0 && - item.getQuantity() > goods.getCanBuyNumber()) { - throw new BusinessException("商品购买数量超过限制:" + productName + ",最大购买数量:" + goods.getCanBuyNumber()); - } - - // 计算商品小计(使用实际价格) - BigDecimal itemTotal = actualPrice.multiply(new BigDecimal(item.getQuantity())); - total = total.add(itemTotal); - - log.debug("商品验证通过 - ID:{},SKU ID:{},名称:{},单价:{},数量:{},小计:{}", - goods.getGoodsId(), item.getSkuId(), productName, actualPrice, item.getQuantity(), itemTotal); - } - - log.info("订单商品验证完成,总金额:{}", total); - return total; - } - - /** - * 构建订单对象 - */ - private ShopOrder buildShopOrder(OrderCreateRequest request, User loginUser) { - ShopOrder shopOrder = new ShopOrder(); - - // 复制请求参数到订单对象 - BeanUtils.copyProperties(request, shopOrder); - - // 确保租户ID正确设置(关键字段,影响微信支付证书路径) - shopOrder.setTenantId(loginUser.getTenantId()); - - // 验证关键字段 - if (shopOrder.getTenantId() == null) { - throw new BusinessException("租户ID不能为空,这会导致微信支付证书路径错误"); - } - - // 设置用户相关信息 - shopOrder.setUserId(loginUser.getUserId()); - shopOrder.setOpenid(loginUser.getOpenid()); - shopOrder.setPayUserId(loginUser.getUserId()); - - log.debug("构建订单对象 - 租户ID:{},用户ID:{}", shopOrder.getTenantId(), shopOrder.getUserId()); - - // 生成订单号(如果请求中没有提供) - if (shopOrder.getOrderNo() == null || shopOrder.getOrderNo().trim().isEmpty()) { - String generatedOrderNo = Long.toString(IdUtil.getSnowflakeNextId()); - shopOrder.setOrderNo(generatedOrderNo); - log.info("生成新订单号: {}", generatedOrderNo); - } else { - log.info("使用请求中的订单号: {}", shopOrder.getOrderNo()); - } - - // 设置默认备注 - if (shopOrder.getComments() == null) { - shopOrder.setComments(orderConfig.getDefaultConfig().getDefaultComments()); - } - - // 设置价格相关字段(解决数据库字段没有默认值的问题) - if (shopOrder.getPayPrice() == null) { - shopOrder.setPayPrice(shopOrder.getTotalPrice()); // 实际付款默认等于订单总额 - } - - if (shopOrder.getPrice() == null) { - shopOrder.setPrice(shopOrder.getTotalPrice()); // 用于统计的价格默认等于订单总额 - } - - if (shopOrder.getReducePrice() == null) { - shopOrder.setReducePrice(BigDecimal.ZERO); // 减少金额默认为0 - } - - if (shopOrder.getMoney() == null) { - shopOrder.setMoney(shopOrder.getTotalPrice()); // 用于积分赠送的价格默认等于订单总额 - } - - // 设置默认状态 - shopOrder.setPayStatus(false); // 未付款 - shopOrder.setOrderStatus(0); // 未使用 - shopOrder.setDeliveryStatus(10); // 未发货 - shopOrder.setIsInvoice(0); // 未开发票 - shopOrder.setIsSettled(0); // 未结算 - shopOrder.setCheckBill(0); // 未对账 - shopOrder.setVersion(0); // 当前版本 - - // 设置默认支付类型(如果没有指定) - if (shopOrder.getPayType() == null) { - shopOrder.setPayType(1); // 默认微信支付 - } - - // 优惠券处理 - if (shopOrder.getCouponId() != null && shopOrder.getCouponId() > 0) { - processCoupon(shopOrder, loginUser); - } - - return shopOrder; - } - - /** - * 处理优惠券 - */ - private void processCoupon(ShopOrder shopOrder, User loginUser) { - ShopUserCoupon coupon = shopUserCouponService.getById(shopOrder.getCouponId()); - if (coupon == null) { - throw new BusinessException("优惠券不存在"); - } - - // 验证优惠券是否属于当前用户 - if (!coupon.getUserId().equals(loginUser.getUserId())) { - throw new BusinessException("优惠券不属于当前用户"); - } - - // 验证优惠券是否已使用 - if (coupon.getIsUse() != null && coupon.getIsUse().equals(1)) { - throw new BusinessException("优惠券已使用"); - } - - // 验证优惠券是否过期 - if (coupon.getIsExpire() != null && coupon.getIsExpire().equals(1)) { - throw new BusinessException("优惠券已过期"); - } - - // 计算优惠金额 - BigDecimal reducePrice = BigDecimal.ZERO; - boolean canUse = true; - - if (coupon.getType().equals(10)) { - // 满减券 - reducePrice = coupon.getReducePrice() != null ? coupon.getReducePrice() : BigDecimal.ZERO; - BigDecimal minPrice = coupon.getMinPrice() != null ? coupon.getMinPrice() : BigDecimal.ZERO; - if (shopOrder.getTotalPrice().compareTo(minPrice) < 0) { - canUse = false; - throw new BusinessException("订单金额不满足优惠券使用条件,最低消费:" + minPrice + "元"); - } - } else if (coupon.getType().equals(20)) { - // 折扣券 - 计算减免金额(不是折扣后金额) - Integer discount = coupon.getDiscount() != null ? coupon.getDiscount() : 100; - if (discount < 0 || discount > 100) { - throw new BusinessException("优惠券折扣率异常"); - } - // 减免金额 = 原价 * (100 - 折扣率) / 100 - reducePrice = shopOrder.getTotalPrice() - .multiply(new BigDecimal(100 - discount)) - .divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); - } else if (coupon.getType().equals(30)) { - // 免费券 - reducePrice = shopOrder.getTotalPrice(); - } else { - throw new BusinessException("不支持的优惠券类型"); - } - - if (canUse && reducePrice.compareTo(BigDecimal.ZERO) > 0) { - // 确保减免金额不超过订单总额 - if (reducePrice.compareTo(shopOrder.getTotalPrice()) > 0) { - reducePrice = shopOrder.getTotalPrice(); - } - - // 应用优惠 - shopOrder.setReducePrice(shopOrder.getReducePrice().add(reducePrice)); - shopOrder.setPayPrice(shopOrder.getPayPrice().subtract(reducePrice)); - - // 确保实付金额不为负数 - if (shopOrder.getPayPrice().compareTo(BigDecimal.ZERO) < 0) { - shopOrder.setPayPrice(BigDecimal.ZERO); - } - - log.info("应用优惠券成功 - 优惠券ID:{},类型:{},减免金额:{},实付金额:{}", - coupon.getId(), coupon.getType(), reducePrice, shopOrder.getPayPrice()); - } - } - - /** - * 处理收货地址信息 - * 优先级:前端传入地址 > 指定地址ID > 用户默认地址 - */ - private void processDeliveryAddress(ShopOrder shopOrder, OrderCreateRequest request, User loginUser) { - try { - // 1. 如果前端已经传入了完整的收货地址信息,直接使用 - if (isAddressInfoComplete(request)) { - log.info("使用前端传入的收货地址信息,用户ID:{}", loginUser.getUserId()); - return; - } - - // 2. 如果指定了地址ID,获取该地址信息 - if (request.getAddressId() != null) { - ShopUserAddress userAddress = shopUserAddressService.getById(request.getAddressId()); - if (userAddress != null && userAddress.getUserId().equals(loginUser.getUserId())) { - copyAddressToOrder(userAddress, shopOrder, request); - log.info("使用指定地址ID:{},用户ID:{}", request.getAddressId(), loginUser.getUserId()); - return; - } - log.warn("指定的地址ID不存在或不属于当前用户,地址ID:{},用户ID:{}", - request.getAddressId(), loginUser.getUserId()); - } - - // 3. 获取用户默认收货地址 - ShopUserAddress defaultAddress = shopUserAddressService.getDefaultAddress(loginUser.getUserId()); - if (defaultAddress != null) { - copyAddressToOrder(defaultAddress, shopOrder, request); - log.info("使用用户默认收货地址,地址ID:{},用户ID:{}", defaultAddress.getId(), loginUser.getUserId()); - return; - } - - // 4. 如果没有默认地址,获取用户的第一个地址 - List userAddresses = shopUserAddressService.getUserAddresses(loginUser.getUserId()); - if (!userAddresses.isEmpty()) { - ShopUserAddress firstAddress = userAddresses.get(0); - copyAddressToOrder(firstAddress, shopOrder, request); - log.info("使用用户第一个收货地址,地址ID:{},用户ID:{}", firstAddress.getId(), loginUser.getUserId()); - return; - } - // 5. 如果用户没有任何收货地址,抛出异常 - throw new BusinessException("请先添加收货地址"); - - } catch (BusinessException e) { - throw e; - } catch (Exception e) { - log.error("处理收货地址信息失败,用户ID:{}", loginUser.getUserId(), e); - throw new BusinessException("处理收货地址信息失败:" + e.getMessage()); - } - } - - /** - * 检查前端传入的地址信息是否完整 - */ - private boolean isAddressInfoComplete(OrderCreateRequest request) { - return request.getAddress() != null && !request.getAddress().trim().isEmpty() && - request.getRealName() != null && !request.getRealName().trim().isEmpty(); - } - - /** - * 将用户地址信息复制到订单中(创建快照) - */ - private void copyAddressToOrder(ShopUserAddress userAddress, ShopOrder shopOrder, OrderCreateRequest request) { - // 保存地址ID引用关系 - shopOrder.setAddressId(userAddress.getId()); - request.setAddressId(userAddress.getId()); - - // 创建地址信息快照 - if (request.getAddress() == null || request.getAddress().trim().isEmpty()) { - // 构建完整地址 - StringBuilder fullAddress = new StringBuilder(); - if (userAddress.getProvince() != null) fullAddress.append(userAddress.getProvince()); - if (userAddress.getCity() != null) fullAddress.append(userAddress.getCity()); - if (userAddress.getRegion() != null) fullAddress.append(userAddress.getRegion()); - if (userAddress.getAddress() != null) fullAddress.append(userAddress.getAddress()); - - shopOrder.setAddress(fullAddress.toString()); - request.setAddress(fullAddress.toString()); - } - - // 复制收货人信息 - if (request.getRealName() == null || request.getRealName().trim().isEmpty()) { - shopOrder.setRealName(userAddress.getName()); - request.setRealName(userAddress.getName()); - } - - // 复制经纬度信息 - if (request.getAddressLat() == null && userAddress.getLat() != null) { - shopOrder.setAddressLat(userAddress.getLat()); - request.setAddressLat(userAddress.getLat()); - } - if (request.getAddressLng() == null && userAddress.getLng() != null) { - shopOrder.setAddressLng(userAddress.getLng()); - request.setAddressLng(userAddress.getLng()); - } - - log.debug("地址信息快照创建完成 - 地址ID:{},收货人:{},地址:{}", - userAddress.getId(), userAddress.getName(), shopOrder.getAddress()); - } - - /** - * 应用业务规则 - */ - private void applyBusinessRules(ShopOrder shopOrder, User loginUser) { - // 测试账号处理 - if (orderConfig.isTestAccount(loginUser.getPhone())) { - BigDecimal testAmount = orderConfig.getTestAccount().getTestPayAmount(); - shopOrder.setPrice(testAmount); - shopOrder.setTotalPrice(testAmount); - shopOrder.setPayPrice(testAmount); // 确保实际付款也设置为测试金额 - shopOrder.setMoney(testAmount); // 确保积分计算金额也设置为测试金额 - log.info("应用测试账号规则,用户:{},测试金额:{}", loginUser.getPhone(), testAmount); - } - - // 其他业务规则可以在这里添加 - // 例如:VIP折扣、优惠券处理等 - } - - /** - * 校验订单金额 - */ - public void validateOrderAmount(BigDecimal amount, Integer tenantId) { - if (amount == null || amount.compareTo(BigDecimal.ZERO) <= 0) { - throw new BusinessException("订单金额必须大于0"); - } - - OrderConfigProperties.TenantRule tenantRule = orderConfig.getTenantRule(tenantId); - if (tenantRule != null && tenantRule.getMinAmount() != null) { - if (amount.compareTo(tenantRule.getMinAmount()) < 0) { - throw new BusinessException(tenantRule.getMinAmountMessage()); - } - } - } - - /** - * 保存订单商品 - */ - private void saveOrderGoods(OrderCreateRequest request, ShopOrder shopOrder) { - if (CollectionUtils.isEmpty(request.getGoodsItems())) { - log.warn("订单商品列表为空,订单号:{}", shopOrder.getOrderNo()); - return; - } - - List orderGoodsList = new ArrayList<>(); - for (OrderCreateRequest.OrderGoodsItem item : request.getGoodsItems()) { - // 重新获取商品信息(确保数据一致性) - ShopGoods goods = shopGoodsService.getById(item.getGoodsId()); - if (goods == null) { - throw new BusinessException("商品不存在,商品ID:" + item.getGoodsId()); - } - - // 再次验证商品状态(防止并发问题) - if (goods.getStatus() == null || goods.getStatus() != 0) { - throw new BusinessException("商品已下架:" + goods.getName()); - } - - // 处理多规格商品 - ShopGoodsSku sku = null; - BigDecimal actualPrice = goods.getPrice(); // 默认使用商品价格 - Integer actualStock = goods.getStock(); // 默认使用商品库存 - String specInfo = item.getSpecInfo(); // 规格信息 - - if (item.getSkuId() != null) { - // 多规格商品,获取SKU信息 - sku = shopGoodsSkuService.getById(item.getSkuId()); - if (sku == null) { - throw new BusinessException("商品规格不存在,SKU ID:" + item.getSkuId()); - } - - // 验证SKU是否属于该商品 - if (!sku.getGoodsId().equals(item.getGoodsId())) { - throw new BusinessException("商品规格不匹配"); - } - - // 验证SKU状态 - if (sku.getStatus() == null || sku.getStatus() != 0) { - throw new BusinessException("商品规格已下架"); - } - - // 使用SKU的价格和库存 - actualPrice = sku.getPrice(); - actualStock = sku.getStock(); - - // 如果前端没有传规格信息,使用SKU的规格信息 - if (specInfo == null || specInfo.trim().isEmpty()) { - specInfo = sku.getSku(); // 使用SKU的规格描述 - } - } - - // 验证库存 - if (actualStock == null || actualStock < item.getQuantity()) { - String stockMsg = sku != null ? "商品规格库存不足" : "商品库存不足"; - throw new BusinessException(stockMsg + ",当前库存:" + (actualStock != null ? actualStock : 0)); - } - - ShopOrderGoods orderGoods = new ShopOrderGoods(); - - // 设置订单关联信息 - orderGoods.setOrderId(shopOrder.getOrderId()); - orderGoods.setOrderCode(shopOrder.getOrderNo()); - - // 设置商户信息 - orderGoods.setMerchantId(shopOrder.getMerchantId()); - orderGoods.setMerchantName(shopOrder.getMerchantName()); - - // 设置商品信息(使用后台查询的真实数据) - orderGoods.setGoodsId(item.getGoodsId()); - orderGoods.setSkuId(item.getSkuId()); // 设置SKU ID - orderGoods.setGoodsName(goods.getName()); - orderGoods.setImage(sku != null && sku.getImage() != null ? sku.getImage() : goods.getImage()); // 优先使用SKU图片 - orderGoods.setPrice(actualPrice); // 使用实际价格(SKU价格或商品价格) - orderGoods.setTotalNum(item.getQuantity()); - - // 计算商品小计(用于日志记录) - BigDecimal itemTotal = actualPrice.multiply(new BigDecimal(item.getQuantity())); - - // 设置商品规格信息 - orderGoods.setSpec(specInfo); - - // 设置支付相关信息 - orderGoods.setPayStatus(0); // 0 未付款 - orderGoods.setOrderStatus(0); // 0 未使用 - orderGoods.setIsFree(false); // 默认收费 - orderGoods.setVersion(0); // 当前版本 - - // 设置其他信息 - orderGoods.setComments(request.getComments()); - orderGoods.setUserId(shopOrder.getUserId()); - orderGoods.setTenantId(shopOrder.getTenantId()); - - orderGoodsList.add(orderGoods); - - log.debug("准备保存订单商品 - 商品ID:{},名称:{},单价:{},数量:{},小计:{}", - goods.getGoodsId(), goods.getName(), goods.getPrice(), item.getQuantity(), itemTotal); - } - - // 批量保存订单商品 - boolean saved = shopOrderGoodsService.saveBatch(orderGoodsList); - if (!saved) { - throw new BusinessException("保存订单商品失败"); - } - - // 扣减库存 - deductStock(request); - - log.info("成功保存订单商品,订单号:{},商品数量:{}", shopOrder.getOrderNo(), orderGoodsList.size()); - } - - /** - * 扣减库存 - */ - private void deductStock(OrderCreateRequest request) { - for (OrderCreateRequest.OrderGoodsItem item : request.getGoodsItems()) { - if (item.getSkuId() != null) { - // 多规格商品,扣减SKU库存 - ShopGoodsSku sku = shopGoodsSkuService.getById(item.getSkuId()); - if (sku != null && sku.getStock() != null) { - int newStock = sku.getStock() - item.getQuantity(); - if (newStock < 0) { - throw new BusinessException("SKU库存不足,无法完成扣减"); - } - sku.setStock(newStock); - shopGoodsSkuService.updateById(sku); - log.debug("扣减SKU库存 - SKU ID:{},扣减数量:{},剩余库存:{}", - item.getSkuId(), item.getQuantity(), newStock); - } - } else { - // 单规格商品,扣减商品库存 - ShopGoods goods = shopGoodsService.getById(item.getGoodsId()); - if (goods != null && goods.getStock() != null) { - int newStock = goods.getStock() - item.getQuantity(); - if (newStock < 0) { - throw new BusinessException("商品库存不足,无法完成扣减"); - } - goods.setStock(newStock); - shopGoodsService.updateById(goods); - log.debug("扣减商品库存 - 商品ID:{},扣减数量:{},剩余库存:{}", - item.getGoodsId(), item.getQuantity(), newStock); - } - } - } - log.info("库存扣减完成"); - } - - /** - * 标记优惠券为已使用 - */ - private void markCouponAsUsed(Integer couponId, Integer orderId) { - try { - ShopUserCoupon coupon = shopUserCouponService.getById(couponId); - if (coupon != null) { - // 使用实体类提供的方法标记为已使用 - coupon.markAsUsed(orderId, null); // orderNo 在这里可以为null,因为已经有orderId了 - shopUserCouponService.updateById(coupon); - log.info("优惠券标记为已使用 - 优惠券ID:{},订单ID:{}", couponId, orderId); - } - } catch (Exception e) { - log.error("标记优惠券为已使用失败 - 优惠券ID:{},订单ID:{}", couponId, orderId, e); - // 不抛出异常,避免影响订单创建流程 - } - } - - /** - * 检查是否为测试账号11 - */ - public boolean isTestAccount(String phone) { - return orderConfig.isTestAccount(phone); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/OrderCancelService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/OrderCancelService.java deleted file mode 100644 index da40112..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/OrderCancelService.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.gxwebsoft.shop.entity.ShopOrder; - -import java.util.List; - -/** - * 订单取消服务接口 - * - * @author WebSoft - * @since 2025-01-26 - */ -public interface OrderCancelService { - - /** - * 取消单个订单 - * - * @param order 订单对象 - * @return 是否取消成功 - */ - boolean cancelOrder(ShopOrder order); - - /** - * 批量取消订单 - * - * @param orders 订单列表 - * @return 成功取消的订单数量 - */ - int batchCancelOrders(List orders); - - /** - * 查找超时的待付款订单 - * - * @param timeoutMinutes 超时时间(分钟) - * @param batchSize 批量大小 - * @return 超时订单列表 - */ - List findExpiredUnpaidOrders(Integer timeoutMinutes, Integer batchSize); - - /** - * 查找指定租户的超时订单 - * - * @param tenantId 租户ID - * @param timeoutMinutes 超时时间(分钟) - * @param batchSize 批量大小 - * @return 超时订单列表 - */ - List findExpiredUnpaidOrdersByTenant(Integer tenantId, Integer timeoutMinutes, Integer batchSize); - - /** - * 回退订单库存 - * - * @param order 订单对象 - * @return 是否回退成功 - */ - boolean restoreOrderStock(ShopOrder order); - - /** - * 退还订单优惠券 - * - * @param order 订单对象 - * @return 是否退还成功 - */ - boolean returnOrderCoupon(ShopOrder order); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopArticleService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopArticleService.java deleted file mode 100644 index da3c943..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopArticleService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopArticle; -import com.gxwebsoft.shop.param.ShopArticleParam; - -import java.util.List; - -/** - * 商品文章Service - * - * @author 科技小王子 - * @since 2025-08-13 05:14:53 - */ -public interface ShopArticleService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopArticleParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopArticleParam param); - - /** - * 根据id查询 - * - * @param articleId 文章ID - * @return ShopArticle - */ - ShopArticle getByIdRel(Integer articleId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopBrandService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopBrandService.java deleted file mode 100644 index 294a1f5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopBrandService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopBrand; -import com.gxwebsoft.shop.param.ShopBrandParam; - -import java.util.List; - -/** - * 品牌Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopBrandService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopBrandParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopBrandParam param); - - /** - * 根据id查询 - * - * @param brandId ID - * @return ShopBrand - */ - ShopBrand getByIdRel(Integer brandId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCartService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCartService.java deleted file mode 100644 index 18d4979..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCartService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCart; -import com.gxwebsoft.shop.param.ShopCartParam; - -import java.util.List; - -/** - * 购物车Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopCartService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCartParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCartParam param); - - /** - * 根据id查询 - * - * @param id 购物车表ID - * @return ShopCart - */ - ShopCart getByIdRel(Long id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCategoryService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCategoryService.java deleted file mode 100644 index 5ac828e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCategoryService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCategory; -import com.gxwebsoft.shop.param.ShopCategoryParam; - -import java.util.List; - -/** - * 商品分类Service - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -public interface ShopCategoryService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCategoryParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCategoryParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return ShopCategory - */ - ShopCategory getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopChatConversationService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopChatConversationService.java deleted file mode 100644 index 32eeac3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopChatConversationService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopChatConversation; -import com.gxwebsoft.shop.param.ShopChatConversationParam; - -import java.util.List; - -/** - * 聊天消息表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopChatConversationService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopChatConversationParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopChatConversationParam param); - - /** - * 根据id查询 - * - * @param id 自增ID - * @return ShopChatConversation - */ - ShopChatConversation getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopChatMessageService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopChatMessageService.java deleted file mode 100644 index c1b40a8..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopChatMessageService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopChatMessage; -import com.gxwebsoft.shop.param.ShopChatMessageParam; - -import java.util.List; - -/** - * 聊天消息表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopChatMessageService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopChatMessageParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopChatMessageParam param); - - /** - * 根据id查询 - * - * @param id 自增ID - * @return ShopChatMessage - */ - ShopChatMessage getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCommissionRoleService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCommissionRoleService.java deleted file mode 100644 index e9ef11e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCommissionRoleService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCommissionRole; -import com.gxwebsoft.shop.param.ShopCommissionRoleParam; - -import java.util.List; - -/** - * 分红角色Service - * - * @author 科技小王子 - * @since 2025-05-01 10:01:15 - */ -public interface ShopCommissionRoleService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCommissionRoleParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCommissionRoleParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopCommissionRole - */ - ShopCommissionRole getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCountService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCountService.java deleted file mode 100644 index 65af394..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCountService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCount; -import com.gxwebsoft.shop.param.ShopCountParam; - -import java.util.List; - -/** - * 商城销售统计表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopCountService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCountParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCountParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return ShopCount - */ - ShopCount getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyCateService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyCateService.java deleted file mode 100644 index f247bf7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyCateService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; - -import java.util.List; - -/** - * 优惠券可用分类Service - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -public interface ShopCouponApplyCateService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCouponApplyCateParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCouponApplyCateParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopCouponApplyCate - */ - ShopCouponApplyCate getByIdRel(Integer id); - - void removeByCouponId(Integer couponId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyItemService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyItemService.java deleted file mode 100644 index bcca01d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponApplyItemService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; - -import java.util.List; - -/** - * 优惠券可用分类Service - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -public interface ShopCouponApplyItemService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCouponApplyItemParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCouponApplyItemParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopCouponApplyItem - */ - ShopCouponApplyItem getByIdRel(Integer id); - - void removeByCouponId(Integer couponId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java deleted file mode 100644 index 074b62c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopCouponService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopCoupon; -import com.gxwebsoft.shop.param.ShopCouponParam; - -import java.util.List; - -/** - * 优惠券Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:23 - */ -public interface ShopCouponService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopCouponParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopCouponParam param); - - /** - * 根据id查询 - * - * @param id id - * @return ShopCoupon - */ - ShopCoupon getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerApplyService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerApplyService.java deleted file mode 100644 index 9ea4d40..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerApplyService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerApply; -import com.gxwebsoft.shop.param.ShopDealerApplyParam; - -import java.util.List; - -/** - * 分销商申请记录表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:50:18 - */ -public interface ShopDealerApplyService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerApplyParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerApplyParam param); - - /** - * 根据id查询 - * - * @param applyId 主键ID - * @return ShopDealerApply - */ - ShopDealerApply getByIdRel(Integer applyId); - - ShopDealerApply getByUserIdRel(Integer userId); - - ShopDealerApply getByDealerNameRel(String dealerName); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerBankService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerBankService.java deleted file mode 100644 index aba0ab0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerBankService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerBank; -import com.gxwebsoft.shop.param.ShopDealerBankParam; - -import java.util.List; - -/** - * 分销商提现银行卡Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerBankService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerBankParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerBankParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopDealerBank - */ - ShopDealerBank getByIdRel(Integer id); - - /** - * 获取默认银行卡 - * @return List - */ - ShopDealerBank getDefaultBank(Integer userId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerCapitalService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerCapitalService.java deleted file mode 100644 index 67fb29c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerCapitalService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.param.ShopDealerCapitalParam; - -import java.util.List; - -/** - * 分销商资金明细表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerCapitalService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerCapitalParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerCapitalParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopDealerCapital - */ - ShopDealerCapital getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerOrderService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerOrderService.java deleted file mode 100644 index 8390e29..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerOrderService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerOrder; -import com.gxwebsoft.shop.param.ShopDealerOrderParam; - -import java.util.List; - -/** - * 分销商订单记录表Service - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -public interface ShopDealerOrderService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerOrderParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerOrderParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopDealerOrder - */ - ShopDealerOrder getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerRecordService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerRecordService.java deleted file mode 100644 index d27357b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerRecordService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerRecord; -import com.gxwebsoft.shop.param.ShopDealerRecordParam; - -import java.util.List; - -/** - * 客户跟进情况Service - * - * @author 科技小王子 - * @since 2025-10-02 12:21:50 - */ -public interface ShopDealerRecordService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerRecordParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerRecordParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return ShopDealerRecord - */ - ShopDealerRecord getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java deleted file mode 100644 index 87bacd1..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerRefereeService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerReferee; -import com.gxwebsoft.shop.param.ShopDealerRefereeParam; - -import java.util.List; - -/** - * 分销商推荐关系表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerRefereeService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerRefereeParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerRefereeParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopDealerReferee - */ - ShopDealerReferee getByIdRel(Integer id); - - ShopDealerReferee getByUserIdRel(Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerSettingService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerSettingService.java deleted file mode 100644 index b9b1c7b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerSettingService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerSetting; -import com.gxwebsoft.shop.param.ShopDealerSettingParam; - -import java.util.List; - -/** - * 分销商设置表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerSettingService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerSettingParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerSettingParam param); - - /** - * 根据id查询 - * - * @param key 设置项标示 - * @return ShopDealerSetting - */ - ShopDealerSetting getByIdRel(String key); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerUserService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerUserService.java deleted file mode 100644 index 8e86728..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerUserService.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.param.ShopDealerUserParam; - -import java.util.List; - -/** - * 分销商用户记录表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerUserService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerUserParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerUserParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopDealerUser - */ - ShopDealerUser getByIdRel(Integer id); - - ShopDealerUser getByUserIdRel(Integer userId); - - boolean updateByUserId(ShopDealerUser shopDealerUser); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerWithdrawService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerWithdrawService.java deleted file mode 100644 index 61731e3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopDealerWithdrawService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerWithdraw; -import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; - -import java.util.List; - -/** - * 分销商提现明细表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopDealerWithdrawService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopDealerWithdrawParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopDealerWithdrawParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopDealerWithdraw - */ - ShopDealerWithdraw getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressService.java deleted file mode 100644 index 92dae06..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopExpress; -import com.gxwebsoft.shop.param.ShopExpressParam; - -import java.util.List; - -/** - * 物流公司Service - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -public interface ShopExpressService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopExpressParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopExpressParam param); - - /** - * 根据id查询 - * - * @param expressId 物流公司ID - * @return ShopExpress - */ - ShopExpress getByIdRel(Integer expressId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateDetailService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateDetailService.java deleted file mode 100644 index b63be6f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateDetailService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; -import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; - -import java.util.List; - -/** - * 运费模板Service - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -public interface ShopExpressTemplateDetailService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopExpressTemplateDetailParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopExpressTemplateDetailParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopExpressTemplateDetail - */ - ShopExpressTemplateDetail getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateService.java deleted file mode 100644 index 0c8c003..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopExpressTemplateService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopExpressTemplate; -import com.gxwebsoft.shop.param.ShopExpressTemplateParam; - -import java.util.List; - -/** - * 运费模板Service - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -public interface ShopExpressTemplateService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopExpressTemplateParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopExpressTemplateParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopExpressTemplate - */ - ShopExpressTemplate getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGiftService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGiftService.java deleted file mode 100644 index 5ff156d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGiftService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGift; -import com.gxwebsoft.shop.param.ShopGiftParam; - -import java.util.List; - -/** - * 礼品卡Service - * - * @author 科技小王子 - * @since 2025-08-11 18:07:31 - */ -public interface ShopGiftService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGiftParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGiftParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopGift - */ - ShopGift getByIdRel(Integer id); - - ShopGift getByCode(String code); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCategoryService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCategoryService.java deleted file mode 100644 index 5dbed7e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCategoryService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsCategory; -import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; - -import java.util.List; - -/** - * 商品分类Service - * - * @author 科技小王子 - * @since 2025-05-01 00:36:45 - */ -public interface ShopGoodsCategoryService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsCategoryParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsCategoryParam param); - - /** - * 根据id查询 - * - * @param categoryId 商品分类ID - * @return ShopGoodsCategory - */ - ShopGoodsCategory getByIdRel(Integer categoryId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCommentService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCommentService.java deleted file mode 100644 index 6fc33d4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsCommentService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsComment; -import com.gxwebsoft.shop.param.ShopGoodsCommentParam; - -import java.util.List; - -/** - * 评论表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsCommentService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsCommentParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsCommentParam param); - - /** - * 根据id查询 - * - * @param id 评论ID - * @return ShopGoodsComment - */ - ShopGoodsComment getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsIncomeConfigService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsIncomeConfigService.java deleted file mode 100644 index 5784743..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsIncomeConfigService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; -import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; - -import java.util.List; - -/** - * 分润配置Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsIncomeConfigService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsIncomeConfigParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsIncomeConfigParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopGoodsIncomeConfig - */ - ShopGoodsIncomeConfig getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsLogService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsLogService.java deleted file mode 100644 index 0c8d53b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsLogService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsLog; -import com.gxwebsoft.shop.param.ShopGoodsLogParam; - -import java.util.List; - -/** - * 商品日志表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsLogService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsLogParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsLogParam param); - - /** - * 根据id查询 - * - * @param id 统计ID - * @return ShopGoodsLog - */ - ShopGoodsLog getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRelationService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRelationService.java deleted file mode 100644 index 9c43aa9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRelationService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsRelation; -import com.gxwebsoft.shop.param.ShopGoodsRelationParam; - -import java.util.List; - -/** - * 商品点赞和收藏表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopGoodsRelationService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsRelationParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsRelationParam param); - - /** - * 根据id查询 - * - * @param id id - * @return ShopGoodsRelation - */ - ShopGoodsRelation getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRoleCommissionService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRoleCommissionService.java deleted file mode 100644 index 6ff923f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsRoleCommissionService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; -import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; - -import java.util.List; - -/** - * 商品绑定角色的分润金额Service - * - * @author 科技小王子 - * @since 2025-05-01 09:53:38 - */ -public interface ShopGoodsRoleCommissionService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsRoleCommissionParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsRoleCommissionParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopGoodsRoleCommission - */ - ShopGoodsRoleCommission getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsService.java deleted file mode 100644 index 115cf42..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsService.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.param.ShopGoodsParam; - -import java.util.List; - -/** - * 商品Service - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -public interface ShopGoodsService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsParam param); - - /** - * 根据id查询 - * - * @param goodsId 自增ID - * @return ShopGoods - */ - ShopGoods getByIdRel(Integer goodsId); - - /** - * 累加商品销售数量 - * 忽略租户隔离,确保能更新成功 - * - * @param goodsId 商品ID - * @param saleCount 累加的销售数量 - * @return 是否更新成功 - */ - boolean addSaleCount(Integer goodsId, Integer saleCount); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSkuService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSkuService.java deleted file mode 100644 index 1431347..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSkuService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsSku; -import com.gxwebsoft.shop.param.ShopGoodsSkuParam; - -import java.util.List; - -/** - * 商品sku列表Service - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -public interface ShopGoodsSkuService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsSkuParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsSkuParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopGoodsSku - */ - ShopGoodsSku getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSpecService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSpecService.java deleted file mode 100644 index 32250e7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopGoodsSpecService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopGoodsSpec; -import com.gxwebsoft.shop.param.ShopGoodsSpecParam; - -import java.util.List; - -/** - * 商品多规格Service - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -public interface ShopGoodsSpecService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopGoodsSpecParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopGoodsSpecParam param); - - /** - * 根据id查询 - * - * @param id 主键 - * @return ShopGoodsSpec - */ - ShopGoodsSpec getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantAccountService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantAccountService.java deleted file mode 100644 index 127420f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantAccountService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopMerchantAccount; -import com.gxwebsoft.shop.param.ShopMerchantAccountParam; - -import java.util.List; - -/** - * 商户账号Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopMerchantAccountService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopMerchantAccountParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopMerchantAccountParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return ShopMerchantAccount - */ - ShopMerchantAccount getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantApplyService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantApplyService.java deleted file mode 100644 index 7eeaf21..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantApplyService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopMerchantApply; -import com.gxwebsoft.shop.param.ShopMerchantApplyParam; - -import java.util.List; - -/** - * 商户入驻申请Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopMerchantApplyService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopMerchantApplyParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopMerchantApplyParam param); - - /** - * 根据id查询 - * - * @param applyId ID - * @return ShopMerchantApply - */ - ShopMerchantApply getByIdRel(Integer applyId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantService.java deleted file mode 100644 index f3fb956..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopMerchant; -import com.gxwebsoft.shop.param.ShopMerchantParam; - -import java.util.List; - -/** - * 商户Service - * - * @author 科技小王子 - * @since 2025-08-10 20:43:33 - */ -public interface ShopMerchantService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopMerchantParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopMerchantParam param); - - /** - * 根据id查询 - * - * @param merchantId ID - * @return ShopMerchant - */ - ShopMerchant getByIdRel(Long merchantId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantTypeService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantTypeService.java deleted file mode 100644 index e0922d2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopMerchantTypeService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopMerchantType; -import com.gxwebsoft.shop.param.ShopMerchantTypeParam; - -import java.util.List; - -/** - * 商户类型Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopMerchantTypeService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopMerchantTypeParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopMerchantTypeParam param); - - /** - * 根据id查询 - * - * @param id ID - * @return ShopMerchantType - */ - ShopMerchantType getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryGoodsService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryGoodsService.java deleted file mode 100644 index 55699ac..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryGoodsService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; -import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; - -import java.util.List; - -/** - * 发货单商品Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderDeliveryGoodsService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderDeliveryGoodsParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderDeliveryGoodsParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopOrderDeliveryGoods - */ - ShopOrderDeliveryGoods getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryService.java deleted file mode 100644 index 1253f5b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderDeliveryService.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderDelivery; -import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; - -import java.util.List; -import java.util.Map; - -/** - * 发货单Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderDeliveryService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderDeliveryParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderDeliveryParam param); - - /** - * 根据id查询 - * - * @param deliveryId 发货单ID - * @return ShopOrderDelivery - */ - ShopOrderDelivery getByIdRel(Integer deliveryId); - - ShopOrderDelivery getByOrderId(Integer orderId); - - Map setExpress(User user, ShopOrderDelivery orderDelivery, ShopOrder order) throws Exception; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderExtractService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderExtractService.java deleted file mode 100644 index d0a3bd6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderExtractService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrderExtract; -import com.gxwebsoft.shop.param.ShopOrderExtractParam; - -import java.util.List; - -/** - * 自提订单联系方式Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderExtractService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderExtractParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderExtractParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopOrderExtract - */ - ShopOrderExtract getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderGoodsService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderGoodsService.java deleted file mode 100644 index d9a7e9a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderGoodsService.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.param.ShopOrderGoodsParam; - -import java.util.List; - -/** - * 商品信息Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderGoodsService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderGoodsParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderGoodsParam param); - - /** - * 根据id查询 - * - * @param id 自增ID - * @return ShopOrderGoods - */ - ShopOrderGoods getByIdRel(Integer id); - - List getListByOrderId(Integer orderId); - - /** - * 根据订单ID查询订单商品列表(忽略租户隔离) - * @param orderId 订单ID - * @return List - */ - List getListByOrderIdIgnoreTenant(Integer orderId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoLogService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoLogService.java deleted file mode 100644 index 9ede6f7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoLogService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrderInfoLog; -import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; - -import java.util.List; - -/** - * 订单核销Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderInfoLogService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderInfoLogParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderInfoLogParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopOrderInfoLog - */ - ShopOrderInfoLog getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoService.java deleted file mode 100644 index f5a53fa..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderInfoService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrderInfo; -import com.gxwebsoft.shop.param.ShopOrderInfoParam; - -import java.util.List; - -/** - * 场地Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderInfoService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderInfoParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderInfoParam param); - - /** - * 根据id查询 - * - * @param id 自增ID - * @return ShopOrderInfo - */ - ShopOrderInfo getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderService.java deleted file mode 100644 index 8644e62..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderService.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.param.ShopOrderParam; - -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.List; - -/** - * 订单Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopOrderParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopOrderParam param); - - /** - * 根据id查询 - * - * @param orderId 订单号 - * @return ShopOrder - */ - ShopOrder getByIdRel(Integer orderId); - - HashMap createWxOrder(ShopOrder shopOrder); - - ShopOrder getByOutTradeNo(String outTradeNo); - - Boolean queryOrderByOutTradeNo(ShopOrder shopOrder); - - void updateByOutTradeNo(ShopOrder order); - - /** - * 统计订单总金额 - * - * @return 订单总金额 - */ - BigDecimal total(); - - /** - * 根据订单号查询订单 - * - * @param orderNo 订单号 - * @param tenantId 租户ID - * @return ShopOrder - */ - ShopOrder getByOrderNo(String orderNo, Integer tenantId); - - /** - * 同步支付状态 - * - * @param orderNo 订单号 - * @param paymentStatus 支付状态:1=支付成功,0=支付失败 - * @param transactionId 微信交易号 - * @param payTime 支付时间 - * @param tenantId 租户ID - * @return 是否更新成功 - */ - boolean syncPaymentStatus(String orderNo, Integer paymentStatus, String transactionId, String payTime, Integer tenantId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderUpdate10550Service.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderUpdate10550Service.java deleted file mode 100644 index 2399a6d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopOrderUpdate10550Service.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.entity.ShopOrderDelivery; -import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; - -import java.util.List; - -/** - * 发货单Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopOrderUpdate10550Service { - - - void update(ShopOrder shopOrder); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopRechargeOrderService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopRechargeOrderService.java deleted file mode 100644 index dcb936a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopRechargeOrderService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopRechargeOrder; -import com.gxwebsoft.shop.param.ShopRechargeOrderParam; - -import java.util.List; - -/** - * 会员充值订单表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -public interface ShopRechargeOrderService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopRechargeOrderParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopRechargeOrderParam param); - - /** - * 根据id查询 - * - * @param orderId 订单ID - * @return ShopRechargeOrder - */ - ShopRechargeOrder getByIdRel(Integer orderId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSpecService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSpecService.java deleted file mode 100644 index 2db6368..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSpecService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopSpec; -import com.gxwebsoft.shop.param.ShopSpecParam; - -import java.util.List; - -/** - * 规格Service - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -public interface ShopSpecService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopSpecParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopSpecParam param); - - /** - * 根据id查询 - * - * @param specId 规格ID - * @return ShopSpec - */ - ShopSpec getByIdRel(Integer specId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSpecValueService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSpecValueService.java deleted file mode 100644 index f16f347..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSpecValueService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopSpecValue; -import com.gxwebsoft.shop.param.ShopSpecValueParam; - -import java.util.List; - -/** - * 规格值Service - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -public interface ShopSpecValueService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopSpecValueParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopSpecValueParam param); - - /** - * 根据id查询 - * - * @param specValueId 规格值ID - * @return ShopSpecValue - */ - ShopSpecValue getByIdRel(Integer specValueId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSplashService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSplashService.java deleted file mode 100644 index 0087a1e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopSplashService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopSplash; -import com.gxwebsoft.shop.param.ShopSplashParam; - -import java.util.List; - -/** - * 开屏广告Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopSplashService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopSplashParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopSplashParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopSplash - */ - ShopSplash getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserAddressService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserAddressService.java deleted file mode 100644 index 70880e4..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserAddressService.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUserAddress; -import com.gxwebsoft.shop.param.ShopUserAddressParam; - -import java.util.List; - -/** - * 收货地址Service - * - * @author 科技小王子 - * @since 2025-07-22 23:06:40 - */ -public interface ShopUserAddressService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopUserAddressParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopUserAddressParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopUserAddress - */ - ShopUserAddress getByIdRel(Integer id); - - /** - * 获取用户默认收货地址 - * - * @param userId 用户ID - * @return ShopUserAddress - */ - ShopUserAddress getDefaultAddress(Integer userId); - - /** - * 获取用户所有收货地址 - * - * @param userId 用户ID - * @return List - */ - List getUserAddresses(Integer userId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserBalanceLogService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserBalanceLogService.java deleted file mode 100644 index 08e4087..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserBalanceLogService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUserBalanceLog; -import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; - -import java.util.List; - -/** - * 用户余额变动明细表Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopUserBalanceLogService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopUserBalanceLogParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopUserBalanceLogParam param); - - /** - * 根据id查询 - * - * @param logId 主键ID - * @return ShopUserBalanceLog - */ - ShopUserBalanceLog getByIdRel(Integer logId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserCollectionService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserCollectionService.java deleted file mode 100644 index bc74a59..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserCollectionService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUserCollection; -import com.gxwebsoft.shop.param.ShopUserCollectionParam; - -import java.util.List; - -/** - * 我的收藏Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopUserCollectionService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopUserCollectionParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopUserCollectionParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopUserCollection - */ - ShopUserCollection getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java deleted file mode 100644 index e237cca..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserCouponService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.param.ShopUserCouponParam; - -import java.util.List; - -/** - * 用户优惠券Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopUserCouponService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopUserCouponParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopUserCouponParam param); - - /** - * 根据id查询 - * - * @param id id - * @return ShopUserCoupon - */ - ShopUserCoupon getByIdRel(Integer id); - - List userList(Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserRefereeService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserRefereeService.java deleted file mode 100644 index 624627f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserRefereeService.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUserReferee; -import com.gxwebsoft.shop.param.ShopUserRefereeParam; - -import java.util.List; - -/** - * 用户推荐关系表Service - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -public interface ShopUserRefereeService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopUserRefereeParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopUserRefereeParam param); - - /** - * 根据id查询 - * - * @param id 主键ID - * @return ShopUserReferee - */ - ShopUserReferee getByIdRel(Integer id); - - ShopUserReferee getByUserIdRel(Integer userId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserService.java deleted file mode 100644 index 52d8fba..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopUserService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUser; -import com.gxwebsoft.shop.param.ShopUserParam; - -import java.util.List; - -/** - * 用户记录表Service - * - * @author 科技小王子 - * @since 2025-10-03 13:41:09 - */ -public interface ShopUserService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopUserParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopUserParam param); - - /** - * 根据id查询 - * - * @param userId 用户id - * @return ShopUser - */ - ShopUser getByIdRel(Integer userId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopWebsiteService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopWebsiteService.java deleted file mode 100644 index 6b9bef6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopWebsiteService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.gxwebsoft.shop.vo.ShopVo; - -/** - * 商城网站服务接口 - * - * @author 科技小王子 - * @since 2025-08-13 - */ -public interface ShopWebsiteService { - - /** - * 获取商城基本信息(VO格式) - * - * @param tenantId 租户ID - * @return 商城信息VO - */ - ShopVo getShopInfo(Integer tenantId); - - /** - * 清除商城信息缓存 - * - * @param tenantId 租户ID - */ - void clearShopInfoCache(Integer tenantId); -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopWechatDepositService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopWechatDepositService.java deleted file mode 100644 index 9c4b0ad..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/ShopWechatDepositService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopWechatDeposit; -import com.gxwebsoft.shop.param.ShopWechatDepositParam; - -import java.util.List; - -/** - * 押金Service - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -public interface ShopWechatDepositService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(ShopWechatDepositParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(ShopWechatDepositParam param); - - /** - * 根据id查询 - * - * @param id - * @return ShopWechatDeposit - */ - ShopWechatDeposit getByIdRel(Integer id); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java deleted file mode 100644 index af7a18a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.gxwebsoft.shop.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.common.system.entity.UserBalanceLog; -import com.gxwebsoft.common.system.param.UserBalanceLogParam; - -import java.util.List; - -/** - * 用户余额变动明细表Service - * - * @author 科技小王子 - * @since 2023-04-21 15:59:09 - */ -public interface UserBalanceLogService extends IService { - - /** - * 分页关联查询 - * - * @param param 查询参数 - * @return PageResult - */ - PageResult pageRel(UserBalanceLogParam param); - - /** - * 关联查询全部 - * - * @param param 查询参数 - * @return List - */ - List listRel(UserBalanceLogParam param); - - /** - * 根据id查询 - * - * @param logId 主键ID - * @return UserBalanceLog - */ - UserBalanceLog getByIdRel(Integer logId); - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/CouponStatusServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/CouponStatusServiceImpl.java deleted file mode 100644 index 1700188..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/CouponStatusServiceImpl.java +++ /dev/null @@ -1,339 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.entity.ShopCoupon; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.service.CouponStatusService; -import com.gxwebsoft.shop.service.ShopUserCouponService; -import com.gxwebsoft.shop.service.ShopCouponService; -import com.gxwebsoft.shop.service.ShopCouponApplyItemService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 优惠券状态管理服务实现 - * - * @author WebSoft - * @since 2025-01-15 - */ -@Slf4j -@Service -public class CouponStatusServiceImpl implements CouponStatusService { - - @Autowired - private ShopUserCouponService shopUserCouponService; - - @Autowired - private ShopCouponService shopCouponService; - - @Autowired - private ShopCouponApplyItemService shopCouponApplyItemService; - - @Override - public List getAvailableCoupons(Integer userId) { - List allCoupons = getUserCoupons(userId); - return allCoupons.stream() - .filter(ShopUserCoupon::isAvailable) - .collect(Collectors.toList()); - } - - @Override - public List getUsedCoupons(Integer userId) { - return shopUserCouponService.list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getUserId, userId) - .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_USED) - .orderByDesc(ShopUserCoupon::getUseTime) - ); - } - - @Override - public List getExpiredCoupons(Integer userId) { - // 先更新过期状态 - updateExpiredCouponsForUser(userId); - - return shopUserCouponService.list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getUserId, userId) - .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_EXPIRED) - .orderByDesc(ShopUserCoupon::getEndTime) - ); - } - - @Override - public CouponStatusResult getUserCouponsGroupByStatus(Integer userId) { - List availableCoupons = getAvailableCoupons(userId); - List usedCoupons = getUsedCoupons(userId); - List expiredCoupons = getExpiredCoupons(userId); - - return new CouponStatusResult(availableCoupons, usedCoupons, expiredCoupons); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean useCoupon(Long userCouponId, Integer orderId, String orderNo) { - try { - ShopUserCoupon userCoupon = shopUserCouponService.getById(userCouponId); - if (userCoupon == null) { - log.warn("优惠券不存在: {}", userCouponId); - return false; - } - - if (!userCoupon.isAvailable()) { - log.warn("优惠券不可用: {}, 状态: {}", userCouponId, userCoupon.getStatusDesc()); - return false; - } - - // 标记为已使用 - userCoupon.markAsUsed(orderId, orderNo); - - return shopUserCouponService.updateById(userCoupon); - } catch (Exception e) { - log.error("使用优惠券失败: {}", userCouponId, e); - return false; - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean returnCoupon(Integer orderId) { - try { - ShopUserCoupon userCoupon = shopUserCouponService.getOne( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getOrderId, orderId) - .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_USED) - ); - - if (userCoupon == null) { - log.info("订单没有使用优惠券: {}", orderId); - return true; - } - - // 检查是否已过期 - if (userCoupon.isExpired()) { - log.warn("优惠券已过期,无法退还: {}", userCoupon.getId()); - return false; - } - - // 恢复为未使用状态 - userCoupon.setStatus(ShopUserCoupon.STATUS_UNUSED); - userCoupon.setIsUse(0); - userCoupon.setUseTime(null); - userCoupon.setOrderId(null); - userCoupon.setOrderNo(null); - - return shopUserCouponService.updateById(userCoupon); - } catch (Exception e) { - log.error("退还优惠券失败, 订单ID: {}", orderId, e); - return false; - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public int updateExpiredCoupons() { - try { - // 查询所有未使用且已过期的优惠券 - List expiredCoupons = shopUserCouponService.list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_UNUSED) - .lt(ShopUserCoupon::getEndTime, LocalDateTime.now()) - ); - - if (expiredCoupons.isEmpty()) { - return 0; - } - - // 批量更新状态 - List expiredIds = expiredCoupons.stream() - .map(ShopUserCoupon::getId) - .collect(Collectors.toList()); - - boolean success = shopUserCouponService.update( - new LambdaUpdateWrapper() - .in(ShopUserCoupon::getId, expiredIds) - .set(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_EXPIRED) - .set(ShopUserCoupon::getIsExpire, 1) - ); - - int updatedCount = success ? expiredIds.size() : 0; - log.info("批量更新过期优惠券状态完成,更新数量: {}", updatedCount); - return updatedCount; - } catch (Exception e) { - log.error("批量更新过期优惠券状态失败", e); - return 0; - } - } - - @Override - public boolean checkAndUpdateCouponStatus(ShopUserCoupon userCoupon) { - if (userCoupon == null) { - return false; - } - - boolean statusChanged = false; - - // 检查是否过期 - if (userCoupon.getStatus() == ShopUserCoupon.STATUS_UNUSED && userCoupon.isExpired()) { - userCoupon.markAsExpired(); - statusChanged = true; - } - - // 如果状态发生变化,更新数据库 - if (statusChanged) { - try { - shopUserCouponService.updateById(userCoupon); - log.debug("更新优惠券状态: {} -> {}", userCoupon.getId(), userCoupon.getStatusDesc()); - } catch (Exception e) { - log.error("更新优惠券状态失败: {}", userCoupon.getId(), e); - return false; - } - } - - return statusChanged; - } - - @Override - public CouponValidationResult validateCouponForOrder(Long userCouponId, - BigDecimal totalAmount, - List goodsIds) { - try { - ShopUserCoupon userCoupon = shopUserCouponService.getById(userCouponId); - if (userCoupon == null) { - return new CouponValidationResult(false, "优惠券不存在"); - } - - // 检查优惠券状态 - if (!userCoupon.isAvailable()) { - return new CouponValidationResult(false, "优惠券" + userCoupon.getStatusDesc()); - } - - // 检查最低消费金额 - if (userCoupon.getMinPrice() != null && - totalAmount.compareTo(userCoupon.getMinPrice()) < 0) { - return new CouponValidationResult(false, - String.format("订单金额不满足最低消费要求,需满%s元", userCoupon.getMinPrice())); - } - - // 检查适用范围 - if (!validateApplyRange(userCoupon, goodsIds)) { - return new CouponValidationResult(false, "优惠券不适用于当前商品"); - } - - // 计算优惠金额 - BigDecimal discountAmount = calculateDiscountAmount(userCoupon, totalAmount); - - return new CouponValidationResult(true, "优惠券可用", discountAmount); - } catch (Exception e) { - log.error("验证优惠券失败: {}", userCouponId, e); - return new CouponValidationResult(false, "验证优惠券时发生错误"); - } - } - - /** - * 获取用户所有优惠券 - */ - private List getUserCoupons(Integer userId) { - List coupons = shopUserCouponService.list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getUserId, userId) - .orderByAsc(ShopUserCoupon::getEndTime) - ); - - // 检查并更新状态 - coupons.forEach(this::checkAndUpdateCouponStatus); - - return coupons; - } - - /** - * 更新指定用户的过期优惠券 - */ - private void updateExpiredCouponsForUser(Integer userId) { - try { - shopUserCouponService.update( - new LambdaUpdateWrapper() - .eq(ShopUserCoupon::getUserId, userId) - .eq(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_UNUSED) - .lt(ShopUserCoupon::getEndTime, LocalDateTime.now()) - .set(ShopUserCoupon::getStatus, ShopUserCoupon.STATUS_EXPIRED) - .set(ShopUserCoupon::getIsExpire, 1) - ); - } catch (Exception e) { - log.error("更新用户过期优惠券失败, userId: {}", userId, e); - } - } - - /** - * 验证优惠券适用范围 - */ - private boolean validateApplyRange(ShopUserCoupon userCoupon, List goodsIds) { - if (userCoupon.getApplyRange() == null || userCoupon.getApplyRange() == ShopUserCoupon.APPLY_ALL) { - return true; // 全部商品适用 - } - - if (userCoupon.getApplyRange() == ShopUserCoupon.APPLY_GOODS) { - // 指定商品适用 - try { - List applyItems = shopCouponApplyItemService.list( - new LambdaQueryWrapper() - .eq(ShopCouponApplyItem::getCouponId, userCoupon.getCouponId()) - .eq(ShopCouponApplyItem::getType, 1) // 类型1表示商品 - ); - - // 如果数据库中还没有 goods_id 字段,暂时使用 pk 字段作为商品ID - List applicableGoodsIds = applyItems.stream() - .map(item -> { - if (item.getGoodsId() != null) { - return item.getGoodsId(); - } else if (item.getPk() != null) { - // 临时方案:使用 pk 字段作为商品ID - return item.getPk(); - } - return null; - }) - .filter(goodsId -> goodsId != null) - .collect(Collectors.toList()); - - return goodsIds.stream().anyMatch(applicableGoodsIds::contains); - } catch (Exception e) { - log.warn("查询优惠券适用商品失败,可能是数据库字段不存在: {}", e.getMessage()); - // 如果查询失败,默认返回true(允许使用) - return true; - } - } - - if (userCoupon.getApplyRange() == ShopUserCoupon.APPLY_CATEGORY) { - // 指定分类适用 - 这里需要根据商品ID查询分类ID,然后验证 - // 暂时返回true,实际项目中需要实现商品分类查询逻辑 - log.debug("分类适用范围验证暂未实现,默认通过"); - return true; - } - - return true; - } - - /** - * 计算优惠金额 - */ - private BigDecimal calculateDiscountAmount(ShopUserCoupon userCoupon, BigDecimal totalAmount) { - if (userCoupon.getType() == ShopUserCoupon.TYPE_REDUCE) { - // 满减券 - return userCoupon.getReducePrice(); - } else if (userCoupon.getType() == ShopUserCoupon.TYPE_DISCOUNT) { - // 折扣券 - BigDecimal discountRate = BigDecimal.valueOf(userCoupon.getDiscount()).divide(BigDecimal.valueOf(100)); - return totalAmount.multiply(BigDecimal.ONE.subtract(discountRate)); - } - return BigDecimal.ZERO; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/KuaiDi100Impl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/KuaiDi100Impl.java deleted file mode 100644 index 62bfe6b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/KuaiDi100Impl.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.google.gson.Gson; -import com.gxwebsoft.shop.service.KuaiDi100; -import com.kuaidi100.sdk.api.QueryTrack; -import com.kuaidi100.sdk.contant.ApiInfoConstant; -import com.kuaidi100.sdk.core.BaseClient; -import com.kuaidi100.sdk.core.IBaseClient; -import com.kuaidi100.sdk.pojo.HttpResult; -import com.kuaidi100.sdk.request.*; -import com.kuaidi100.sdk.utils.SignUtils; -import org.springframework.stereotype.Service; - -@Service -public class KuaiDi100Impl implements KuaiDi100 { - private String key = "bekcrvqy1510"; - private String secret = "8c9dd34b6ff34cad9dd6a239bd0c4d26"; - private String customer = "2E5DE2DB6B39822D793FE45EDDFB00B1"; - - @Override - public HttpResult border(BOrderReq bOrderReq) throws Exception { - PrintReq printReq = new PrintReq(); - - String t = String.valueOf(System.currentTimeMillis()); - String param = new Gson().toJson(bOrderReq); - - printReq.setKey(key); - printReq.setSign(SignUtils.printSign(param, t, key, secret)); - printReq.setT(t); - printReq.setParam(param); - printReq.setMethod(ApiInfoConstant.B_ORDER_OFFICIAL_ORDER_METHOD); - System.out.println(printReq); -// IBaseClient bOrder = new BOrderOfficial(); - IBaseClient bOrder = new BaseClient() { - @Override - public String getApiUrl(BaseRequest baseRequest) { - return "https://api.kuaidi100.com/apiMock/border"; - } - }; - return bOrder.execute(printReq); - } - - @Override - public String pollList(String com, String num, String phone) throws Exception { - QueryTrackReq queryTrackReq = new QueryTrackReq(); - QueryTrackParam queryTrackParam = new QueryTrackParam(); - queryTrackParam.setCom(com); - queryTrackParam.setNum(num); - queryTrackParam.setPhone(phone); - String param = new Gson().toJson(queryTrackParam); - queryTrackReq.setSign(SignUtils.querySign(param, key, customer)); - queryTrackReq.setCustomer(customer); - queryTrackReq.setParam(param); - IBaseClient baseClient = new QueryTrack(); - return baseClient.execute(queryTrackReq).getBody(); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/OrderCancelServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/OrderCancelServiceImpl.java deleted file mode 100644 index 825afbb..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/OrderCancelServiceImpl.java +++ /dev/null @@ -1,231 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.shop.entity.*; -import com.gxwebsoft.shop.service.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -/** - * 订单取消服务实现 - * - * @author WebSoft - * @since 2025-01-26 - */ -@Slf4j -@Service -public class OrderCancelServiceImpl implements OrderCancelService { - - @Autowired - private ShopOrderService shopOrderService; - - @Autowired - private ShopOrderGoodsService shopOrderGoodsService; - - @Autowired - private ShopGoodsService shopGoodsService; - - @Autowired - private ShopGoodsSkuService shopGoodsSkuService; - - @Autowired - private CouponStatusService couponStatusService; - - @Override - @Transactional(rollbackFor = Exception.class) - public boolean cancelOrder(ShopOrder order) { - try { - log.info("开始取消订单,订单号:{},订单ID:{}", order.getOrderNo(), order.getOrderId()); - - // 1. 检查订单状态 - if (order.getPayStatus() != null && order.getPayStatus()) { - log.warn("订单已支付,无法取消,订单号:{}", order.getOrderNo()); - return false; - } - - if (order.getOrderStatus() != null && order.getOrderStatus() != 0) { - log.warn("订单状态不是待支付,无法取消,订单号:{},当前状态:{}", order.getOrderNo(), order.getOrderStatus()); - return false; - } - - // 2. 更新订单状态为已取消 - order.setOrderStatus(2); // 2表示已取消 - order.setCancelTime(LocalDateTime.now()); - order.setCancelReason("系统自动取消(超时未支付)"); - - boolean updateSuccess = shopOrderService.updateById(order); - if (!updateSuccess) { - log.error("更新订单状态失败,订单号:{}", order.getOrderNo()); - return false; - } - - // 3. 回退库存 - boolean stockRestored = restoreOrderStock(order); - if (!stockRestored) { - log.error("回退库存失败,订单号:{}", order.getOrderNo()); - // 注意:这里不直接返回false,因为订单状态已经更新,需要记录错误但继续处理 - } - - // 4. 退还优惠券 - boolean couponReturned = returnOrderCoupon(order); - if (!couponReturned) { - log.error("退还优惠券失败,订单号:{}", order.getOrderNo()); - // 同样不直接返回false - } - - log.info("订单取消成功,订单号:{},库存回退:{},优惠券退还:{}", - order.getOrderNo(), stockRestored, couponReturned); - return true; - - } catch (Exception e) { - log.error("取消订单失败,订单号:{}", order.getOrderNo(), e); - throw e; // 重新抛出异常,触发事务回滚 - } - } - - @Override - @Transactional(rollbackFor = Exception.class) - public int batchCancelOrders(List orders) { - if (orders == null || orders.isEmpty()) { - return 0; - } - - int successCount = 0; - for (ShopOrder order : orders) { - try { - if (cancelOrder(order)) { - successCount++; - } - } catch (Exception e) { - log.error("批量取消订单时发生错误,订单号:{}", order.getOrderNo(), e); - // 继续处理下一个订单 - } - } - - log.info("批量取消订单完成,总数:{},成功:{}", orders.size(), successCount); - return successCount; - } - - @Override - @IgnoreTenant("定时任务需要查询所有租户的超时订单") - public List findExpiredUnpaidOrders(Integer timeoutMinutes, Integer batchSize) { - LocalDateTime expireTime = LocalDateTime.now().minusMinutes(timeoutMinutes); - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(ShopOrder::getPayStatus, false) // 未支付 - .eq(ShopOrder::getOrderStatus, 0) // 待支付状态 - .lt(ShopOrder::getCreateTime, expireTime) // 创建时间小于过期时间 - .orderByAsc(ShopOrder::getCreateTime) - .last("LIMIT " + batchSize); - - final List list = shopOrderService.list(queryWrapper); - System.out.println("定时任务需要查询所有租户的超时订单 list = " + list.size()); - return shopOrderService.list(queryWrapper); - } - - @Override - @IgnoreTenant("定时任务需要查询特定租户的超时订单") - public List findExpiredUnpaidOrdersByTenant(Integer tenantId, Integer timeoutMinutes, Integer batchSize) { - LocalDateTime expireTime = LocalDateTime.now().minusMinutes(timeoutMinutes); - - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper() - .eq(ShopOrder::getTenantId, tenantId) - .eq(ShopOrder::getPayStatus, false) // 未支付 - .eq(ShopOrder::getOrderStatus, 0) // 待支付状态 - .lt(ShopOrder::getCreateTime, expireTime) // 创建时间小于过期时间 - .orderByAsc(ShopOrder::getCreateTime) - .last("LIMIT " + batchSize); - - return shopOrderService.list(queryWrapper); - } - - @Override - public boolean restoreOrderStock(ShopOrder order) { - try { - // 获取订单商品信息 - List orderGoods = shopOrderGoodsService.list( - new LambdaQueryWrapper() - .eq(ShopOrderGoods::getOrderId, order.getOrderId()) - ); - - if (orderGoods == null || orderGoods.isEmpty()) { - log.warn("订单没有商品信息,订单号:{}", order.getOrderNo()); - return true; // 没有商品信息也算成功 - } - - for (ShopOrderGoods orderGood : orderGoods) { - if (orderGood.getSkuId() != null && orderGood.getSkuId() > 0) { - // 多规格商品,恢复SKU库存 - restoreSkuStock(orderGood); - } else { - // 单规格商品,恢复商品库存 - restoreGoodsStock(orderGood); - } - } - - log.info("订单库存回退成功,订单号:{},商品数量:{}", order.getOrderNo(), orderGoods.size()); - return true; - - } catch (Exception e) { - log.error("回退订单库存失败,订单号:{}", order.getOrderNo(), e); - return false; - } - } - - @Override - public boolean returnOrderCoupon(ShopOrder order) { - try { - if (order.getCouponId() == null || order.getCouponId() <= 0) { - log.debug("订单未使用优惠券,订单号:{}", order.getOrderNo()); - return true; // 没有使用优惠券也算成功 - } - - boolean success = couponStatusService.returnCoupon(order.getOrderId()); - if (success) { - log.info("订单优惠券退还成功,订单号:{},优惠券ID:{}", order.getOrderNo(), order.getCouponId()); - } else { - log.warn("订单优惠券退还失败,订单号:{},优惠券ID:{}", order.getOrderNo(), order.getCouponId()); - } - return success; - - } catch (Exception e) { - log.error("退还订单优惠券失败,订单号:{}", order.getOrderNo(), e); - return false; - } - } - - /** - * 恢复SKU库存 - */ - private void restoreSkuStock(ShopOrderGoods orderGoods) { - ShopGoodsSku sku = shopGoodsSkuService.getById(orderGoods.getSkuId()); - if (sku != null) { - int newStock = (sku.getStock() != null ? sku.getStock() : 0) + orderGoods.getTotalNum(); - sku.setStock(newStock); - shopGoodsSkuService.updateById(sku); - log.debug("恢复SKU库存 - SKU ID:{},恢复数量:{},当前库存:{}", - orderGoods.getSkuId(), orderGoods.getTotalNum(), newStock); - } - } - - /** - * 恢复商品库存 - */ - private void restoreGoodsStock(ShopOrderGoods orderGoods) { - ShopGoods goods = shopGoodsService.getById(orderGoods.getGoodsId()); - if (goods != null) { - int newStock = (goods.getStock() != null ? goods.getStock() : 0) + orderGoods.getTotalNum(); - goods.setStock(newStock); - shopGoodsService.updateById(goods); - log.debug("恢复商品库存 - 商品ID:{},恢复数量:{},当前库存:{}", - orderGoods.getGoodsId(), orderGoods.getTotalNum(), newStock); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopArticleServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopArticleServiceImpl.java deleted file mode 100644 index 9e49324..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopArticleServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopArticleMapper; -import com.gxwebsoft.shop.service.ShopArticleService; -import com.gxwebsoft.shop.entity.ShopArticle; -import com.gxwebsoft.shop.param.ShopArticleParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品文章Service实现 - * - * @author 科技小王子 - * @since 2025-08-13 05:14:53 - */ -@Service -public class ShopArticleServiceImpl extends ServiceImpl implements ShopArticleService { - - @Override - public PageResult pageRel(ShopArticleParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopArticleParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopArticle getByIdRel(Integer articleId) { - ShopArticleParam param = new ShopArticleParam(); - param.setArticleId(articleId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopBrandServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopBrandServiceImpl.java deleted file mode 100644 index 5037b55..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopBrandServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopBrandMapper; -import com.gxwebsoft.shop.service.ShopBrandService; -import com.gxwebsoft.shop.entity.ShopBrand; -import com.gxwebsoft.shop.param.ShopBrandParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 品牌Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopBrandServiceImpl extends ServiceImpl implements ShopBrandService { - - @Override - public PageResult pageRel(ShopBrandParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopBrandParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopBrand getByIdRel(Integer brandId) { - ShopBrandParam param = new ShopBrandParam(); - param.setBrandId(brandId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCartServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCartServiceImpl.java deleted file mode 100644 index 12d6b3a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCartServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopCartMapper; -import com.gxwebsoft.shop.service.ShopCartService; -import com.gxwebsoft.shop.entity.ShopCart; -import com.gxwebsoft.shop.param.ShopCartParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 购物车Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopCartServiceImpl extends ServiceImpl implements ShopCartService { - - @Override - public PageResult pageRel(ShopCartParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCartParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCart getByIdRel(Long id) { - ShopCartParam param = new ShopCartParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCategoryServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCategoryServiceImpl.java deleted file mode 100644 index fbe60af..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCategoryServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopCategoryMapper; -import com.gxwebsoft.shop.service.ShopCategoryService; -import com.gxwebsoft.shop.entity.ShopCategory; -import com.gxwebsoft.shop.param.ShopCategoryParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品分类Service实现 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Service -public class ShopCategoryServiceImpl extends ServiceImpl implements ShopCategoryService { - - @Override - public PageResult pageRel(ShopCategoryParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCategoryParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCategory getByIdRel(Integer id) { - ShopCategoryParam param = new ShopCategoryParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatConversationServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatConversationServiceImpl.java deleted file mode 100644 index e482f7e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatConversationServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopChatConversationMapper; -import com.gxwebsoft.shop.service.ShopChatConversationService; -import com.gxwebsoft.shop.entity.ShopChatConversation; -import com.gxwebsoft.shop.param.ShopChatConversationParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 聊天消息表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopChatConversationServiceImpl extends ServiceImpl implements ShopChatConversationService { - - @Override - public PageResult pageRel(ShopChatConversationParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopChatConversationParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopChatConversation getByIdRel(Integer id) { - ShopChatConversationParam param = new ShopChatConversationParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatMessageServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatMessageServiceImpl.java deleted file mode 100644 index ca50663..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopChatMessageServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopChatMessageMapper; -import com.gxwebsoft.shop.service.ShopChatMessageService; -import com.gxwebsoft.shop.entity.ShopChatMessage; -import com.gxwebsoft.shop.param.ShopChatMessageParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 聊天消息表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopChatMessageServiceImpl extends ServiceImpl implements ShopChatMessageService { - - @Override - public PageResult pageRel(ShopChatMessageParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopChatMessageParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopChatMessage getByIdRel(Integer id) { - ShopChatMessageParam param = new ShopChatMessageParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommissionRoleServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommissionRoleServiceImpl.java deleted file mode 100644 index 26823a0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCommissionRoleServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopCommissionRoleMapper; -import com.gxwebsoft.shop.service.ShopCommissionRoleService; -import com.gxwebsoft.shop.entity.ShopCommissionRole; -import com.gxwebsoft.shop.param.ShopCommissionRoleParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分红角色Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 10:01:15 - */ -@Service -public class ShopCommissionRoleServiceImpl extends ServiceImpl implements ShopCommissionRoleService { - - @Override - public PageResult pageRel(ShopCommissionRoleParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCommissionRoleParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCommissionRole getByIdRel(Integer id) { - ShopCommissionRoleParam param = new ShopCommissionRoleParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCountServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCountServiceImpl.java deleted file mode 100644 index 51fa64d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCountServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopCountMapper; -import com.gxwebsoft.shop.service.ShopCountService; -import com.gxwebsoft.shop.entity.ShopCount; -import com.gxwebsoft.shop.param.ShopCountParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商城销售统计表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopCountServiceImpl extends ServiceImpl implements ShopCountService { - - @Override - public PageResult pageRel(ShopCountParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCountParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCount getByIdRel(Integer id) { - ShopCountParam param = new ShopCountParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyCateServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyCateServiceImpl.java deleted file mode 100644 index c613194..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyCateServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopCouponApplyCateMapper; -import com.gxwebsoft.shop.service.ShopCouponApplyCateService; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.param.ShopCouponApplyCateParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 优惠券可用分类Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Service -public class ShopCouponApplyCateServiceImpl extends ServiceImpl implements ShopCouponApplyCateService { - - @Override - public PageResult pageRel(ShopCouponApplyCateParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCouponApplyCateParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCouponApplyCate getByIdRel(Integer id) { - ShopCouponApplyCateParam param = new ShopCouponApplyCateParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public void removeByCouponId(Integer couponId) { - remove( - new LambdaQueryWrapper() - .eq(ShopCouponApplyCate::getCouponId, couponId) - ); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyItemServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyItemServiceImpl.java deleted file mode 100644 index 6baa5ea..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponApplyItemServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopCouponApplyItemMapper; -import com.gxwebsoft.shop.service.ShopCouponApplyItemService; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.param.ShopCouponApplyItemParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 优惠券可用分类Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 12:47:49 - */ -@Service -public class ShopCouponApplyItemServiceImpl extends ServiceImpl implements ShopCouponApplyItemService { - - @Override - public PageResult pageRel(ShopCouponApplyItemParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCouponApplyItemParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCouponApplyItem getByIdRel(Integer id) { - ShopCouponApplyItemParam param = new ShopCouponApplyItemParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public void removeByCouponId(Integer couponId) { - remove( - new LambdaQueryWrapper() - .eq(ShopCouponApplyItem::getCouponId, couponId) - ); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java deleted file mode 100644 index 29a17a3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopCouponServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.entity.ShopCouponApplyCate; -import com.gxwebsoft.shop.entity.ShopCouponApplyItem; -import com.gxwebsoft.shop.mapper.ShopCouponMapper; -import com.gxwebsoft.shop.service.ShopCouponApplyCateService; -import com.gxwebsoft.shop.service.ShopCouponApplyItemService; -import com.gxwebsoft.shop.service.ShopCouponService; -import com.gxwebsoft.shop.entity.ShopCoupon; -import com.gxwebsoft.shop.param.ShopCouponParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; - -/** - * 优惠券Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:23 - */ -@Service -public class ShopCouponServiceImpl extends ServiceImpl implements ShopCouponService { - @Resource - private ShopCouponApplyItemService couponApplyItemService; - @Resource - private ShopCouponApplyCateService couponApplyCateService; - - @Override - public PageResult pageRel(ShopCouponParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - for (ShopCoupon coupon : list) { - coupon.setCouponApplyCateList( - couponApplyCateService.list( - new LambdaQueryWrapper() - .eq(ShopCouponApplyCate::getCouponId, coupon.getId()) - ) - ); - coupon.setCouponApplyItemList( - couponApplyItemService.list( - new LambdaQueryWrapper() - .eq(ShopCouponApplyItem::getCouponId, coupon.getId()) - ) - ); - } - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopCouponParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopCoupon getByIdRel(Integer id) { - ShopCouponParam param = new ShopCouponParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java deleted file mode 100644 index ab445bf..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerApplyServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerApplyMapper; -import com.gxwebsoft.shop.service.ShopDealerApplyService; -import com.gxwebsoft.shop.entity.ShopDealerApply; -import com.gxwebsoft.shop.param.ShopDealerApplyParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商申请记录表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:50:18 - */ -@Service -public class ShopDealerApplyServiceImpl extends ServiceImpl implements ShopDealerApplyService { - - @Override - public PageResult pageRel(ShopDealerApplyParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerApplyParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerApply getByIdRel(Integer id) { - ShopDealerApplyParam param = new ShopDealerApplyParam(); - param.setApplyId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopDealerApply getByUserIdRel(Integer userId) { - ShopDealerApplyParam param = new ShopDealerApplyParam(); - param.setUserId(userId); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopDealerApply getByDealerNameRel(String dealerName) { - ShopDealerApplyParam param = new ShopDealerApplyParam(); - param.setDealerName(dealerName); - param.setType(4); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerBankServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerBankServiceImpl.java deleted file mode 100644 index edc77c3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerBankServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerBank; -import com.gxwebsoft.shop.mapper.ShopDealerBankMapper; -import com.gxwebsoft.shop.param.ShopDealerBankParam; -import com.gxwebsoft.shop.service.ShopDealerBankService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商提现银行卡Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopDealerBankServiceImpl extends ServiceImpl implements ShopDealerBankService { - - @Override - public PageResult pageRel(ShopDealerBankParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("is_default desc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerBankParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("is_default desc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerBank getByIdRel(Integer id) { - ShopDealerBankParam param = new ShopDealerBankParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopDealerBank getDefaultBank(Integer userId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ShopDealerBank::getUserId, userId) - .eq(ShopDealerBank::getIsDefault, true) - .orderByDesc(ShopDealerBank::getCreateTime) - .last("LIMIT 1"); - return getOne(wrapper); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerCapitalServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerCapitalServiceImpl.java deleted file mode 100644 index 897fbed..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerCapitalServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerCapitalMapper; -import com.gxwebsoft.shop.service.ShopDealerCapitalService; -import com.gxwebsoft.shop.entity.ShopDealerCapital; -import com.gxwebsoft.shop.param.ShopDealerCapitalParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商资金明细表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopDealerCapitalServiceImpl extends ServiceImpl implements ShopDealerCapitalService { - - @Override - public PageResult pageRel(ShopDealerCapitalParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerCapitalParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerCapital getByIdRel(Integer id) { - ShopDealerCapitalParam param = new ShopDealerCapitalParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerOrderServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerOrderServiceImpl.java deleted file mode 100644 index 0bab68f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerOrderServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerOrderMapper; -import com.gxwebsoft.shop.service.ShopDealerOrderService; -import com.gxwebsoft.shop.entity.ShopDealerOrder; -import com.gxwebsoft.shop.param.ShopDealerOrderParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商订单记录表Service实现 - * - * @author 科技小王子 - * @since 2025-08-12 11:55:18 - */ -@Service -public class ShopDealerOrderServiceImpl extends ServiceImpl implements ShopDealerOrderService { - - @Override - public PageResult pageRel(ShopDealerOrderParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerOrderParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerOrder getByIdRel(Integer id) { - ShopDealerOrderParam param = new ShopDealerOrderParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRecordServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRecordServiceImpl.java deleted file mode 100644 index 1b875e7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRecordServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopDealerRecord; -import com.gxwebsoft.shop.mapper.ShopDealerRecordMapper; -import com.gxwebsoft.shop.param.ShopDealerRecordParam; -import com.gxwebsoft.shop.service.ShopDealerRecordService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 客户跟进情况Service实现 - * - * @author 科技小王子 - * @since 2025-10-02 12:21:50 - */ -@Service -public class ShopDealerRecordServiceImpl extends ServiceImpl implements ShopDealerRecordService { - - @Override - public PageResult pageRel(ShopDealerRecordParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerRecordParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerRecord getByIdRel(Integer id) { - ShopDealerRecordParam param = new ShopDealerRecordParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java deleted file mode 100644 index 18d5383..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerRefereeServiceImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerRefereeMapper; -import com.gxwebsoft.shop.service.ShopDealerRefereeService; -import com.gxwebsoft.shop.entity.ShopDealerReferee; -import com.gxwebsoft.shop.param.ShopDealerRefereeParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商推荐关系表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopDealerRefereeServiceImpl extends ServiceImpl implements ShopDealerRefereeService { - - @Override - public PageResult pageRel(ShopDealerRefereeParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerRefereeParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerReferee getByIdRel(Integer id) { - ShopDealerRefereeParam param = new ShopDealerRefereeParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopDealerReferee getByUserIdRel(Integer userId) { - ShopDealerRefereeParam param = new ShopDealerRefereeParam(); - param.setUserId(userId); - param.setLevel(1); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerSettingServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerSettingServiceImpl.java deleted file mode 100644 index 336fd7a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerSettingServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerSettingMapper; -import com.gxwebsoft.shop.service.ShopDealerSettingService; -import com.gxwebsoft.shop.entity.ShopDealerSetting; -import com.gxwebsoft.shop.param.ShopDealerSettingParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商设置表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopDealerSettingServiceImpl extends ServiceImpl implements ShopDealerSettingService { - - @Override - public PageResult pageRel(ShopDealerSettingParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerSettingParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerSetting getByIdRel(String key) { - ShopDealerSettingParam param = new ShopDealerSettingParam(); - param.setKey(key); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java deleted file mode 100644 index a5767d3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerUserServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerUserMapper; -import com.gxwebsoft.shop.service.ShopDealerUserService; -import com.gxwebsoft.shop.entity.ShopDealerUser; -import com.gxwebsoft.shop.param.ShopDealerUserParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商用户记录表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopDealerUserServiceImpl extends ServiceImpl implements ShopDealerUserService { - - @Override - public PageResult pageRel(ShopDealerUserParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerUserParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerUser getByIdRel(Integer id) { - ShopDealerUserParam param = new ShopDealerUserParam(); - param.setUserId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopDealerUser getByUserIdRel(Integer userId) { - ShopDealerUserParam param = new ShopDealerUserParam(); - param.setUserId(userId); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public boolean updateByUserId(ShopDealerUser shopDealerUser) { - final int update = baseMapper.update(shopDealerUser, new LambdaQueryWrapper().eq(ShopDealerUser::getUserId, shopDealerUser.getUserId())); - return update > 0; - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerWithdrawServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerWithdrawServiceImpl.java deleted file mode 100644 index 9748034..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopDealerWithdrawServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopDealerWithdrawMapper; -import com.gxwebsoft.shop.service.ShopDealerWithdrawService; -import com.gxwebsoft.shop.entity.ShopDealerWithdraw; -import com.gxwebsoft.shop.param.ShopDealerWithdrawParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分销商提现明细表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopDealerWithdrawServiceImpl extends ServiceImpl implements ShopDealerWithdrawService { - - @Override - public PageResult pageRel(ShopDealerWithdrawParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopDealerWithdrawParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopDealerWithdraw getByIdRel(Integer id) { - ShopDealerWithdrawParam param = new ShopDealerWithdrawParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressServiceImpl.java deleted file mode 100644 index 1a7cdbc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopExpressMapper; -import com.gxwebsoft.shop.service.ShopExpressService; -import com.gxwebsoft.shop.entity.ShopExpress; -import com.gxwebsoft.shop.param.ShopExpressParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 物流公司Service实现 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Service -public class ShopExpressServiceImpl extends ServiceImpl implements ShopExpressService { - - @Override - public PageResult pageRel(ShopExpressParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopExpressParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopExpress getByIdRel(Integer expressId) { - ShopExpressParam param = new ShopExpressParam(); - param.setExpressId(expressId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateDetailServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateDetailServiceImpl.java deleted file mode 100644 index 2c5ea8b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateDetailServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopExpressTemplateDetailMapper; -import com.gxwebsoft.shop.service.ShopExpressTemplateDetailService; -import com.gxwebsoft.shop.entity.ShopExpressTemplateDetail; -import com.gxwebsoft.shop.param.ShopExpressTemplateDetailParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 运费模板Service实现 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Service -public class ShopExpressTemplateDetailServiceImpl extends ServiceImpl implements ShopExpressTemplateDetailService { - - @Override - public PageResult pageRel(ShopExpressTemplateDetailParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopExpressTemplateDetailParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopExpressTemplateDetail getByIdRel(Integer id) { - ShopExpressTemplateDetailParam param = new ShopExpressTemplateDetailParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateServiceImpl.java deleted file mode 100644 index 1858d49..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopExpressTemplateServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopExpressTemplateMapper; -import com.gxwebsoft.shop.service.ShopExpressTemplateService; -import com.gxwebsoft.shop.entity.ShopExpressTemplate; -import com.gxwebsoft.shop.param.ShopExpressTemplateParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 运费模板Service实现 - * - * @author 科技小王子 - * @since 2025-08-12 12:07:03 - */ -@Service -public class ShopExpressTemplateServiceImpl extends ServiceImpl implements ShopExpressTemplateService { - - @Override - public PageResult pageRel(ShopExpressTemplateParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopExpressTemplateParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopExpressTemplate getByIdRel(Integer id) { - ShopExpressTemplateParam param = new ShopExpressTemplateParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGiftServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGiftServiceImpl.java deleted file mode 100644 index 55a067e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGiftServiceImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.mapper.ShopGiftMapper; -import com.gxwebsoft.shop.service.ShopGiftService; -import com.gxwebsoft.shop.entity.ShopGift; -import com.gxwebsoft.shop.param.ShopGiftParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.service.ShopGoodsService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * 礼品卡Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 18:07:31 - */ -@Service -public class ShopGiftServiceImpl extends ServiceImpl implements ShopGiftService { - @Resource - private ShopGoodsService shopGoodsService; - - @Override - public PageResult pageRel(ShopGiftParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - if (!list.isEmpty()) { - Set goodsIds = list.stream().map(ShopGift::getGoodsId).collect(Collectors.toSet()); - List goodsList = shopGoodsService.listByIds(goodsIds); - for (ShopGift shopGift : list) { - ShopGoods shopGoods = goodsList.stream().filter(sG -> sG.getGoodsId().equals(shopGift.getGoodsId())).findFirst().orElse(null); - if (shopGoods != null) { - shopGift.setGoods(shopGoods); - } - } - } - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGiftParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGift getByIdRel(Integer id) { - ShopGiftParam param = new ShopGiftParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopGift getByCode(String code) { - ShopGiftParam param = new ShopGiftParam(); - param.setCode(code); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCategoryServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCategoryServiceImpl.java deleted file mode 100644 index 170ab88..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCategoryServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsCategoryMapper; -import com.gxwebsoft.shop.service.ShopGoodsCategoryService; -import com.gxwebsoft.shop.entity.ShopGoodsCategory; -import com.gxwebsoft.shop.param.ShopGoodsCategoryParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品分类Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 00:36:45 - */ -@Service -public class ShopGoodsCategoryServiceImpl extends ServiceImpl implements ShopGoodsCategoryService { - - @Override - public PageResult pageRel(ShopGoodsCategoryParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsCategoryParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsCategory getByIdRel(Integer categoryId) { - ShopGoodsCategoryParam param = new ShopGoodsCategoryParam(); - param.setCategoryId(categoryId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCommentServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCommentServiceImpl.java deleted file mode 100644 index 7f203bd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsCommentServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsCommentMapper; -import com.gxwebsoft.shop.service.ShopGoodsCommentService; -import com.gxwebsoft.shop.entity.ShopGoodsComment; -import com.gxwebsoft.shop.param.ShopGoodsCommentParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 评论表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopGoodsCommentServiceImpl extends ServiceImpl implements ShopGoodsCommentService { - - @Override - public PageResult pageRel(ShopGoodsCommentParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsCommentParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsComment getByIdRel(Integer id) { - ShopGoodsCommentParam param = new ShopGoodsCommentParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsIncomeConfigServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsIncomeConfigServiceImpl.java deleted file mode 100644 index d4ca36e..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsIncomeConfigServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsIncomeConfigMapper; -import com.gxwebsoft.shop.service.ShopGoodsIncomeConfigService; -import com.gxwebsoft.shop.entity.ShopGoodsIncomeConfig; -import com.gxwebsoft.shop.param.ShopGoodsIncomeConfigParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 分润配置Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopGoodsIncomeConfigServiceImpl extends ServiceImpl implements ShopGoodsIncomeConfigService { - - @Override - public PageResult pageRel(ShopGoodsIncomeConfigParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsIncomeConfigParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsIncomeConfig getByIdRel(Integer id) { - ShopGoodsIncomeConfigParam param = new ShopGoodsIncomeConfigParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsLogServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsLogServiceImpl.java deleted file mode 100644 index 0e2e46f..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsLogServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsLogMapper; -import com.gxwebsoft.shop.service.ShopGoodsLogService; -import com.gxwebsoft.shop.entity.ShopGoodsLog; -import com.gxwebsoft.shop.param.ShopGoodsLogParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品日志表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopGoodsLogServiceImpl extends ServiceImpl implements ShopGoodsLogService { - - @Override - public PageResult pageRel(ShopGoodsLogParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsLogParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsLog getByIdRel(Integer id) { - ShopGoodsLogParam param = new ShopGoodsLogParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRelationServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRelationServiceImpl.java deleted file mode 100644 index eaf1166..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRelationServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsRelationMapper; -import com.gxwebsoft.shop.service.ShopGoodsRelationService; -import com.gxwebsoft.shop.entity.ShopGoodsRelation; -import com.gxwebsoft.shop.param.ShopGoodsRelationParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品点赞和收藏表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopGoodsRelationServiceImpl extends ServiceImpl implements ShopGoodsRelationService { - - @Override - public PageResult pageRel(ShopGoodsRelationParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsRelationParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsRelation getByIdRel(Integer id) { - ShopGoodsRelationParam param = new ShopGoodsRelationParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRoleCommissionServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRoleCommissionServiceImpl.java deleted file mode 100644 index 95a72cc..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsRoleCommissionServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsRoleCommissionMapper; -import com.gxwebsoft.shop.service.ShopGoodsRoleCommissionService; -import com.gxwebsoft.shop.entity.ShopGoodsRoleCommission; -import com.gxwebsoft.shop.param.ShopGoodsRoleCommissionParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品绑定角色的分润金额Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 09:53:38 - */ -@Service -public class ShopGoodsRoleCommissionServiceImpl extends ServiceImpl implements ShopGoodsRoleCommissionService { - - @Override - public PageResult pageRel(ShopGoodsRoleCommissionParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsRoleCommissionParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsRoleCommission getByIdRel(Integer id) { - ShopGoodsRoleCommissionParam param = new ShopGoodsRoleCommissionParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsServiceImpl.java deleted file mode 100644 index 4984d72..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsServiceImpl.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsMapper; -import com.gxwebsoft.shop.service.ShopGoodsService; -import com.gxwebsoft.shop.entity.ShopGoods; -import com.gxwebsoft.shop.param.ShopGoodsParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; -import lombok.extern.slf4j.Slf4j; - -import java.util.List; - -/** - * 商品Service实现 - * - * @author 科技小王子 - * @since 2025-04-24 20:52:13 - */ -@Slf4j -@Service -public class ShopGoodsServiceImpl extends ServiceImpl implements ShopGoodsService { - - @Override - public PageResult pageRel(ShopGoodsParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoods getByIdRel(Integer goodsId) { - ShopGoodsParam param = new ShopGoodsParam(); - param.setGoodsId(goodsId); - return param.getOne(baseMapper.selectListRel(param)); - } - - @InterceptorIgnore(tenantLine = "true") - @Override - public boolean addSaleCount(Integer goodsId, Integer saleCount) { - try { - if (goodsId == null || saleCount == null || saleCount <= 0) { - log.warn("累加商品销量参数无效 - 商品ID: {}, 销量: {}", goodsId, saleCount); - return false; - } - - int affectedRows = baseMapper.addSaleCount(goodsId, saleCount); - boolean success = affectedRows > 0; - - if (success) { - log.info("商品销量累加成功 - 商品ID: {}, 累加数量: {}, 影响行数: {}", goodsId, saleCount, affectedRows); - } else { - log.warn("商品销量累加失败 - 商品ID: {}, 累加数量: {}, 影响行数: {}", goodsId, saleCount, affectedRows); - } - - return success; - } catch (Exception e) { - log.error("累加商品销量异常 - 商品ID: {}, 累加数量: {}", goodsId, saleCount, e); - return false; - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSkuServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSkuServiceImpl.java deleted file mode 100644 index cc1739b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSkuServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsSkuMapper; -import com.gxwebsoft.shop.service.ShopGoodsSkuService; -import com.gxwebsoft.shop.entity.ShopGoodsSku; -import com.gxwebsoft.shop.param.ShopGoodsSkuParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品sku列表Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Service -public class ShopGoodsSkuServiceImpl extends ServiceImpl implements ShopGoodsSkuService { - - @Override - public PageResult pageRel(ShopGoodsSkuParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsSkuParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsSku getByIdRel(Integer id) { - ShopGoodsSkuParam param = new ShopGoodsSkuParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSpecServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSpecServiceImpl.java deleted file mode 100644 index 812a5b3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopGoodsSpecServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopGoodsSpecMapper; -import com.gxwebsoft.shop.service.ShopGoodsSpecService; -import com.gxwebsoft.shop.entity.ShopGoodsSpec; -import com.gxwebsoft.shop.param.ShopGoodsSpecParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商品多规格Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 09:43:31 - */ -@Service -public class ShopGoodsSpecServiceImpl extends ServiceImpl implements ShopGoodsSpecService { - - @Override - public PageResult pageRel(ShopGoodsSpecParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopGoodsSpecParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopGoodsSpec getByIdRel(Integer id) { - ShopGoodsSpecParam param = new ShopGoodsSpecParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantAccountServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantAccountServiceImpl.java deleted file mode 100644 index 6d39658..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantAccountServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopMerchantAccountMapper; -import com.gxwebsoft.shop.service.ShopMerchantAccountService; -import com.gxwebsoft.shop.entity.ShopMerchantAccount; -import com.gxwebsoft.shop.param.ShopMerchantAccountParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商户账号Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopMerchantAccountServiceImpl extends ServiceImpl implements ShopMerchantAccountService { - - @Override - public PageResult pageRel(ShopMerchantAccountParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopMerchantAccountParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopMerchantAccount getByIdRel(Integer id) { - ShopMerchantAccountParam param = new ShopMerchantAccountParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantApplyServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantApplyServiceImpl.java deleted file mode 100644 index becb4aa..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantApplyServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopMerchantApplyMapper; -import com.gxwebsoft.shop.service.ShopMerchantApplyService; -import com.gxwebsoft.shop.entity.ShopMerchantApply; -import com.gxwebsoft.shop.param.ShopMerchantApplyParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商户入驻申请Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopMerchantApplyServiceImpl extends ServiceImpl implements ShopMerchantApplyService { - - @Override - public PageResult pageRel(ShopMerchantApplyParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopMerchantApplyParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopMerchantApply getByIdRel(Integer applyId) { - ShopMerchantApplyParam param = new ShopMerchantApplyParam(); - param.setApplyId(applyId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantServiceImpl.java deleted file mode 100644 index 9fb3e73..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopMerchantMapper; -import com.gxwebsoft.shop.service.ShopMerchantService; -import com.gxwebsoft.shop.entity.ShopMerchant; -import com.gxwebsoft.shop.param.ShopMerchantParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商户Service实现 - * - * @author 科技小王子 - * @since 2025-08-10 20:43:33 - */ -@Service -public class ShopMerchantServiceImpl extends ServiceImpl implements ShopMerchantService { - - @Override - public PageResult pageRel(ShopMerchantParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopMerchantParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopMerchant getByIdRel(Long merchantId) { - ShopMerchantParam param = new ShopMerchantParam(); - param.setMerchantId(merchantId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantTypeServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantTypeServiceImpl.java deleted file mode 100644 index 38c87cd..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopMerchantTypeServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopMerchantTypeMapper; -import com.gxwebsoft.shop.service.ShopMerchantTypeService; -import com.gxwebsoft.shop.entity.ShopMerchantType; -import com.gxwebsoft.shop.param.ShopMerchantTypeParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 商户类型Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopMerchantTypeServiceImpl extends ServiceImpl implements ShopMerchantTypeService { - - @Override - public PageResult pageRel(ShopMerchantTypeParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopMerchantTypeParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopMerchantType getByIdRel(Integer id) { - ShopMerchantTypeParam param = new ShopMerchantTypeParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryGoodsServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryGoodsServiceImpl.java deleted file mode 100644 index c48c23a..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryGoodsServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopOrderDeliveryGoodsMapper; -import com.gxwebsoft.shop.service.ShopOrderDeliveryGoodsService; -import com.gxwebsoft.shop.entity.ShopOrderDeliveryGoods; -import com.gxwebsoft.shop.param.ShopOrderDeliveryGoodsParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 发货单商品Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopOrderDeliveryGoodsServiceImpl extends ServiceImpl implements ShopOrderDeliveryGoodsService { - - @Override - public PageResult pageRel(ShopOrderDeliveryGoodsParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderDeliveryGoodsParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrderDeliveryGoods getByIdRel(Integer id) { - ShopOrderDeliveryGoodsParam param = new ShopOrderDeliveryGoodsParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryServiceImpl.java deleted file mode 100644 index 41cd996..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderDeliveryServiceImpl.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.utils.JSONUtil; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.shop.entity.*; -import com.gxwebsoft.shop.mapper.ShopOrderDeliveryMapper; -import com.gxwebsoft.shop.service.*; -import com.gxwebsoft.shop.param.ShopOrderDeliveryParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.kuaidi100.sdk.pojo.HttpResult; -import com.kuaidi100.sdk.request.BOrderReq; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.time.LocalDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * 发货单Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopOrderDeliveryServiceImpl extends ServiceImpl implements ShopOrderDeliveryService { - @Resource - private ShopExpressService expressService; - @Resource - private KuaiDi100Impl kuaiDi100; - @Resource - private ShopOrderService shopOrderService; - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - @Resource - private ShopGoodsService shopGoodsService; - @Resource - private ShopUserAddressService shopUserAddressService; - - @Override - public PageResult pageRel(ShopOrderDeliveryParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderDeliveryParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrderDelivery getByIdRel(Integer deliveryId) { - ShopOrderDeliveryParam param = new ShopOrderDeliveryParam(); - param.setDeliveryId(deliveryId); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopOrderDelivery getByOrderId(Integer orderId) { - return getOne( - new LambdaQueryWrapper() - .eq(ShopOrderDelivery::getOrderId, orderId) - .last("limit 1") - ); - } - - @Override - public Map setExpress(User user, ShopOrderDelivery orderDelivery, ShopOrder order) throws Exception { - ShopExpress express = expressService.getByIdRel(orderDelivery.getExpressId()); - ShopUserAddress userAddress = shopUserAddressService.getByIdRel(order.getAddressId()); - - BOrderReq bOrderReq = new BOrderReq(); - bOrderReq.setKuaidicom(express.getKuaidi100Code()); - bOrderReq.setSendManName(orderDelivery.getSendName()); - bOrderReq.setSendManMobile(orderDelivery.getSendPhone()); - bOrderReq.setSendManPrintAddr(order.getSendAddress()); - bOrderReq.setRecManName(userAddress.getName()); - bOrderReq.setRecManMobile(userAddress.getPhone()); - bOrderReq.setRecManPrintAddr(order.getAddress()); - bOrderReq.setCallBackUrl("https://cms-api.websoft.top/api/shop/order-delivery/notify"); - HttpResult res = kuaiDi100.border(bOrderReq); - if (res.getStatus() != 200) return new HashMap<>() {{ - put("res", false); - put("msg", "快递100接口异常"); - }}; - KuaiDi100Resp kuaiDi100Resp = JSONUtil.parseObject(res.getBody(), KuaiDi100Resp.class); - if (kuaiDi100Resp == null) return new HashMap<>() {{ - put("res", false); - put("msg", "快递100接口异常"); - }}; - - if (!kuaiDi100Resp.getResult()) - return new HashMap<>() {{ - put("res", false); - put("msg", kuaiDi100Resp.getMessage()); - }}; - Map bOrderData = (Map) kuaiDi100Resp.getData(); - orderDelivery.setExpressNo((String) bOrderData.get("kuaidinum")); - if (updateById(orderDelivery)) { - order.setDeliveryStatus(20); - order.setDeliveryTime(LocalDateTime.now()); - shopOrderService.updateById(order); - - if (order.getPayType().equals(1)) { - List orderGoodsList = shopOrderGoodsService.getListByOrderId(order.getOrderId()); - // 上传小程序发货信息 -// WxMaOrderShippingInfoUploadRequest uploadRequest = new WxMaOrderShippingInfoUploadRequest(); -// uploadRequest.setLogisticsType(1); -// uploadRequest.setDeliveryMode(1); -// -// OrderKeyBean orderKeyBean = new OrderKeyBean(); -// orderKeyBean.setOrderNumberType(2); -// orderKeyBean.setTransactionId(order.getTransactionId()); -// uploadRequest.setOrderKey(orderKeyBean); -// -// List shippingList = new ArrayList<>(); -// ShippingListBean shippingListBean = new ShippingListBean(); -// shippingListBean.setTrackingNo((String) bOrderData.get("kuaidinum")); -// shippingListBean.setExpressCompany(express.getWxCode()); -// ContactBean contactBean = new ContactBean(); -// contactBean.setReceiverContact(user.getMobile()); -// shippingListBean.setContact(contactBean); -// -// ShopGoods shopGoods = shopGoodsService.getById(orderGoodsList.get(0).getGoodsId()); -// -// String itemDesc = shopGoods.getName(); -// if (orderGoodsList.size() > 1) itemDesc += "等" + orderGoodsList.size() + "件商品"; -// shippingListBean.setItemDesc(itemDesc); -// shippingList.add(shippingListBean); -// uploadRequest.setShippingList(shippingList); -// -// uploadRequest.setUploadTime(new DateTime().toString(DatePattern.UTC_WITH_ZONE_OFFSET_PATTERN)); -// -// PayerBean payerBean = new PayerBean(); -// -// payerBean.setOpenid(user.getOpenid()); -// uploadRequest.setPayer(payerBean); -// -// WxMaService wxMaService = weChatController.wxMaService(); -// WxMaOrderShippingService wxMaOrderShippingService = new WxMaOrderShippingServiceImpl(wxMaService); -// WxMaOrderShippingInfoBaseResponse response = wxMaOrderShippingService.upload(uploadRequest); -// System.out.println("response" + response); - } - return new HashMap<>() {{ - put("res", true); - put("msg", "操作成功"); - }}; - } - return new HashMap<>() {{ - put("res", false); - put("msg", "未知错误"); - }}; - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderExtractServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderExtractServiceImpl.java deleted file mode 100644 index 91cfdab..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderExtractServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopOrderExtractMapper; -import com.gxwebsoft.shop.service.ShopOrderExtractService; -import com.gxwebsoft.shop.entity.ShopOrderExtract; -import com.gxwebsoft.shop.param.ShopOrderExtractParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 自提订单联系方式Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopOrderExtractServiceImpl extends ServiceImpl implements ShopOrderExtractService { - - @Override - public PageResult pageRel(ShopOrderExtractParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderExtractParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrderExtract getByIdRel(Integer id) { - ShopOrderExtractParam param = new ShopOrderExtractParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderGoodsServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderGoodsServiceImpl.java deleted file mode 100644 index 7019db0..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderGoodsServiceImpl.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopOrderGoodsMapper; -import com.gxwebsoft.shop.service.ShopOrderGoodsService; -import com.gxwebsoft.shop.entity.ShopOrderGoods; -import com.gxwebsoft.shop.param.ShopOrderGoodsParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; -import lombok.extern.slf4j.Slf4j; - -import java.util.List; - -/** - * 商品信息Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Slf4j -@Service -public class ShopOrderGoodsServiceImpl extends ServiceImpl implements ShopOrderGoodsService { - - @Override - public PageResult pageRel(ShopOrderGoodsParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderGoodsParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrderGoods getByIdRel(Integer id) { - ShopOrderGoodsParam param = new ShopOrderGoodsParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public List getListByOrderId(Integer orderId) { - return list( - new LambdaQueryWrapper() - .eq(ShopOrderGoods::getOrderId, orderId) - ); - } - - @Override - public List getListByOrderIdIgnoreTenant(Integer orderId) { - try { - if (orderId == null) { - log.warn("查询订单商品列表参数无效 - 订单ID: {}", orderId); - return List.of(); - } - - List orderGoodsList = baseMapper.selectListByOrderIdIgnoreTenant(orderId); - - log.info("忽略租户隔离查询订单商品成功 - 订单ID: {}, 商品数量: {}", - orderId, orderGoodsList != null ? orderGoodsList.size() : 0); - - return orderGoodsList != null ? orderGoodsList : List.of(); - } catch (Exception e) { - log.error("忽略租户隔离查询订单商品异常 - 订单ID: {}", orderId, e); - return List.of(); - } - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoLogServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoLogServiceImpl.java deleted file mode 100644 index fdd7f54..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoLogServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopOrderInfoLogMapper; -import com.gxwebsoft.shop.service.ShopOrderInfoLogService; -import com.gxwebsoft.shop.entity.ShopOrderInfoLog; -import com.gxwebsoft.shop.param.ShopOrderInfoLogParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 订单核销Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopOrderInfoLogServiceImpl extends ServiceImpl implements ShopOrderInfoLogService { - - @Override - public PageResult pageRel(ShopOrderInfoLogParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderInfoLogParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrderInfoLog getByIdRel(Integer id) { - ShopOrderInfoLogParam param = new ShopOrderInfoLogParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoServiceImpl.java deleted file mode 100644 index 6c2681b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderInfoServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopOrderInfoMapper; -import com.gxwebsoft.shop.service.ShopOrderInfoService; -import com.gxwebsoft.shop.entity.ShopOrderInfo; -import com.gxwebsoft.shop.param.ShopOrderInfoParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 场地Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopOrderInfoServiceImpl extends ServiceImpl implements ShopOrderInfoService { - - @Override - public PageResult pageRel(ShopOrderInfoParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderInfoParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrderInfo getByIdRel(Integer id) { - ShopOrderInfoParam param = new ShopOrderInfoParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java deleted file mode 100644 index 51db11c..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderServiceImpl.java +++ /dev/null @@ -1,1133 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.config.ConfigProperties; -import com.gxwebsoft.common.core.config.CertificateProperties; -import com.gxwebsoft.common.core.utils.*; -import com.gxwebsoft.common.core.service.PaymentCacheService; -import com.gxwebsoft.common.core.service.EnvironmentAwarePaymentService; -import com.gxwebsoft.common.core.config.SpringContextUtil; -import com.gxwebsoft.common.system.entity.Payment; -import com.gxwebsoft.shop.entity.*; -import com.gxwebsoft.shop.service.*; -import com.wechat.pay.java.core.RSAAutoCertificateConfig; -import lombok.extern.slf4j.Slf4j; -import com.gxwebsoft.common.system.service.PaymentService; -import com.gxwebsoft.common.system.service.SettingService; -import com.gxwebsoft.payment.constants.WechatPayType; -import com.gxwebsoft.shop.mapper.ShopOrderMapper; -import com.gxwebsoft.shop.param.ShopOrderParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.wechat.pay.java.core.Config; -import com.wechat.pay.java.core.RSAConfig; -import com.wechat.pay.java.core.RSAPublicKeyConfig; -import com.wechat.pay.java.core.exception.ServiceException; -import com.wechat.pay.java.service.payments.jsapi.JsapiServiceExtension; -import com.wechat.pay.java.service.payments.jsapi.model.*; -import com.wechat.pay.java.service.payments.nativepay.NativePayService; -// Native支付的类将使用完全限定名避免冲突 -import com.wechat.pay.java.service.payments.model.Transaction; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 订单Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Slf4j -@Service -public class ShopOrderServiceImpl extends ServiceImpl implements ShopOrderService { - @Value("${spring.profiles.active}") - String active; - @Resource - private ConfigProperties config; - @Resource - private RedisUtil redisUtil; - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - @Resource - private ShopGoodsService shopGoodsService; - @Resource - private PaymentService paymentService; - @Resource - private SettingService settingService; - @Resource - private CertificateProperties certConfig; - @Resource - private CertificateLoader certificateLoader; - @Resource - private PaymentCacheService paymentCacheService; - @Resource - private WechatCertAutoConfig wechatCertAutoConfig; - @Resource - private WechatPayDiagnostic wechatPayDiagnostic; - @Resource - private WechatPayCertificateDiagnostic certificateDiagnostic; - @Resource - private ShopOrderUpdate10550Service shopOrderUpdate10550Service; - @Resource - private ShopUserCouponService shopUserCouponService; - @Resource - private ShopOrderDeliveryService shopOrderDeliveryService; - @Resource - private ShopExpressService shopExpressService; - - - @Override - public PageResult pageRel(ShopOrderParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - - // 整理订单数据 - if (!CollectionUtils.isEmpty(list)) { - final Set orderIds = list.stream().map(ShopOrder::getOrderId).collect(Collectors.toSet()); - final List goodsList = shopOrderGoodsService.list(new LambdaQueryWrapper().in(ShopOrderGoods::getOrderId, orderIds)); - final Map> collect = goodsList.stream().collect(Collectors.groupingBy(ShopOrderGoods::getOrderId)); - list.forEach(d -> { - d.setOrderGoods(collect.get(d.getOrderId())); - - // 确保 realName 字段有值,优先使用关联查询的结果,如果为空则使用订单表中的 realName - if (StrUtil.isBlank(d.getRealName())) { - log.debug("订单 {} 的 realName 为空,尝试从其他字段获取", d.getOrderId()); - // 可以根据业务需求添加其他逻辑,比如从 nickname 或其他字段获取 - } - if (d.getDeliveryStatus() > 10 && d.getDeliveryType().equals(0)) { - ShopOrderDelivery shopOrderDelivery = shopOrderDeliveryService.getByOrderId(d.getOrderId()); - if (shopOrderDelivery != null) { - ShopExpress shopExpress = shopExpressService.getById(shopOrderDelivery.getExpressId()); - if (shopExpress != null) { - shopOrderDelivery.setExpressName(shopExpress.getExpressName()); - } - } - d.setShopOrderDelivery(shopOrderDelivery); - } - }); - } - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopOrderParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopOrder getByIdRel(Integer orderId) { - ShopOrderParam param = new ShopOrderParam(); - param.setOrderId(orderId); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public HashMap createWxOrder(ShopOrder order) { - Payment payment = null; // 声明在try块外面,这样catch块也能访问 - try { - System.out.println("=== 开始创建微信支付订单 ==="); - System.out.println("订单号: " + order.getOrderNo()); - System.out.println("租户ID: " + order.getTenantId()); - System.out.println("支付类型: " + order.getPayType()); - System.out.println("订单金额: " + order.getTotalPrice()); - System.out.println("用户OpenID: " + order.getOpenid()); - - // 检查订单基本信息 - if (order.getTenantId() == null) { - throw new RuntimeException("订单租户ID为null"); - } - if (order.getOrderNo() == null || order.getOrderNo().trim().isEmpty()) { - throw new RuntimeException("订单号为空"); - } - if (order.getTotalPrice() == null) { - throw new RuntimeException("订单金额为null"); - } - - // 根据支付类型检查OpenID - if (order.getPayType().equals(1)) { - // JSAPI支付需要OpenID - if (order.getOpenid() == null || order.getOpenid().trim().isEmpty()) { - throw new RuntimeException("JSAPI支付必须传openid"); - } - } - - // 后台微信支付配置信息 - payment = getPayment(order); - System.out.println("支付配置: " + (payment != null ? "已获取" : "未获取")); - - if (payment == null) { - throw new RuntimeException("支付配置为null,租户ID: " + order.getTenantId()); - } - - // 检查支付配置的关键字段 - if (payment.getAppId() == null || payment.getAppId().trim().isEmpty()) { - throw new RuntimeException("支付配置中应用ID为null或空"); - } - if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { - throw new RuntimeException("支付配置中商户号为null或空"); - } - - // 返回的订单数据 - final HashMap orderInfo = new HashMap<>(); - - // 根据支付类型选择不同的处理逻辑 - if (order.getPayType().equals(102)) { - // Native支付处理(兼容旧的102类型) - System.out.println("⚠️ 检测到使用废弃的微信Native支付类型(102),建议升级到微信支付(1)"); - order.setWechatPayType(WechatPayType.NATIVE); - return createNativePayOrder(order, payment); - } else if (order.getPayType().equals(1)) { - // 微信支付处理 - 根据是否有openid判断使用JSAPI还是Native - String wechatType = WechatPayType.getAutoType(order.getOpenid()); - order.setWechatPayType(wechatType); - - if (WechatPayType.JSAPI.equals(wechatType)) { - // 有openid,使用JSAPI支付 - return createJsapiPayOrder(order, payment); - } else { - // 无openid,使用Native支付 - return createNativePayOrder(order, payment); - } - } else { - // 其他支付方式暂时使用JSAPI处理 - return createJsapiPayOrder(order, payment); - } - - } catch (Exception e) { - System.err.println("=== 创建微信支付订单失败 ==="); - System.err.println("错误信息: " + e.getMessage()); - System.err.println("错误类型: " + e.getClass().getName()); - - // 特殊处理签名验证失败的情况 - if (e.getMessage() != null && e.getMessage().contains("signature is incorrect")) { - System.err.println("🔍 签名验证失败诊断:"); - System.err.println("1. 检查商户证书序列号是否正确"); - System.err.println("2. 检查APIv3密钥是否正确"); - System.err.println("3. 检查私钥文件是否正确"); - System.err.println("4. 检查微信支付平台证书是否过期"); - System.err.println("5. 建议使用自动证书配置避免证书管理问题"); - System.err.println("当前支付配置:"); - System.err.println("租户ID: " + order.getTenantId()); - System.err.println("商户号: " + (payment != null ? payment.getMchId() : "null")); - System.err.println("应用ID: " + (payment != null ? payment.getAppId() : "null")); - } - - throw new RuntimeException("创建微信支付订单失败:" + e.getMessage(), e); - } - } - - /** - * 创建Native支付订单 - */ - private HashMap createNativePayOrder(ShopOrder order, Payment payment) throws Exception { - System.out.println("=== 使用Native支付模式 ==="); - - // 构建Native支付服务 - Config wxPayConfig = getWxPayConfig(order); - NativePayService nativeService = new NativePayService.Builder().config(wxPayConfig).build(); - - // 订单金额(转换为分) - BigDecimal decimal = order.getTotalPrice(); - final BigDecimal multiply = decimal.multiply(new BigDecimal(100)); - Integer money = multiply.intValue(); - - // 测试环境使用1分钱 - if (active.equals("dev")) { - money = 1; - } - - // 构建Native支付请求 - com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest request = - new com.wechat.pay.java.service.payments.nativepay.model.PrepayRequest(); - com.wechat.pay.java.service.payments.nativepay.model.Amount amount = - new com.wechat.pay.java.service.payments.nativepay.model.Amount(); - amount.setTotal(money); - amount.setCurrency("CNY"); - request.setAmount(amount); - - request.setAppid(payment.getAppId()); - request.setMchid(payment.getMchId()); - - // 微信支付description字段限制127字节,需要截断处理 - String description = com.gxwebsoft.common.core.utils.WechatPayUtils.processDescription(order.getComments()); - request.setDescription(description); - request.setOutTradeNo(order.getOrderNo()); - request.setAttach(order.getTenantId().toString()); - - System.out.println("=== 关键信息确认 ==="); - System.out.println("发送给微信的订单号(OutTradeNo): " + order.getOrderNo()); - System.out.println("商户号(MchId): " + payment.getMchId()); - System.out.println("应用ID(AppId): " + payment.getAppId()); - - // 设置回调地址 - String notifyUrl = config.getServerUrl() + "/system/wx-pay/notify/" + order.getTenantId(); - if (active.equals("dev")) { - notifyUrl = "http://jimei-api.natapp1.cc/api/shop/wx-pay/notify/" + order.getTenantId(); - } - if (StrUtil.isNotBlank(payment.getNotifyUrl())) { - notifyUrl = payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString()); - } - request.setNotifyUrl(notifyUrl); - - System.out.println("=== 发起Native支付请求 ==="); - System.out.println("请求参数: " + request); - - // 调用Native支付API - com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse response = nativeService.prepay(request); - - System.out.println("=== Native支付响应成功 ==="); - System.out.println("二维码URL: " + response.getCodeUrl()); - - // 构建返回数据 - final HashMap orderInfo = new HashMap<>(); - orderInfo.put("provider", "wxpay"); - orderInfo.put("codeUrl", response.getCodeUrl()); // Native支付返回二维码URL - orderInfo.put("orderNo", order.getOrderNo()); - orderInfo.put("payType", WechatPayType.NATIVE); - orderInfo.put("wechatPayType", WechatPayType.NATIVE); - - return orderInfo; - } - - /** - * 创建JSAPI支付订单(原有逻辑) - */ - private HashMap createJsapiPayOrder(ShopOrder order, Payment payment) throws Exception { - System.out.println("=== 使用JSAPI支付模式 ==="); - - // JSAPI支付必须有OpenID - if (order.getOpenid() == null || order.getOpenid().trim().isEmpty()) { - throw new RuntimeException("JSAPI支付必须传openid"); - } - - // 构建JSAPI支付服务 - JsapiServiceExtension service = getWxService(order); - System.out.println("微信支付服务构建完成"); - - // 订单金额 - BigDecimal decimal = order.getPayPrice(); - final BigDecimal multiply = decimal.multiply(new BigDecimal(100)); - Integer money = multiply.intValue(); - - System.out.println("=== 构建支付请求参数 ==="); - - PrepayRequest request = new PrepayRequest(); - Amount amount = new Amount(); - amount.setTotal(money); - amount.setCurrency("CNY"); - request.setAmount(amount); - - System.out.println("设置应用ID: " + payment.getAppId()); - request.setAppid(payment.getAppId()); - - System.out.println("设置商户号: " + payment.getMchId()); - request.setMchid(payment.getMchId()); - - // 微信支付description字段限制127字节,需要截断处理 - String description = com.gxwebsoft.common.core.utils.WechatPayUtils.processDescription(order.getComments()); - System.out.println("设置描述: " + description); - request.setDescription(description); - - System.out.println("设置订单号: " + order.getOrderNo()); - request.setOutTradeNo(order.getOrderNo()); - - System.out.println("设置附加数据: " + order.getTenantId().toString()); - request.setAttach(order.getTenantId().toString()); - - final Payer payer = new Payer(); - System.out.println("设置用户OpenID: " + order.getOpenid()); - payer.setOpenid(order.getOpenid()); - request.setPayer(payer); - request.setNotifyUrl(config.getServerUrl() + "/system/wx-pay/notify/" + order.getTenantId()); // 默认回调地址 - // 测试环境 - if (active.equals("dev")) { - amount.setTotal(1); - request.setAmount(amount); - request.setNotifyUrl("http://jimei-api.natapp1.cc/api/shop/wx-pay/notify/" + order.getTenantId()); // 默认回调地址 - } - // 后台配置的回调地址 - if (StrUtil.isNotBlank(payment.getNotifyUrl())) { - request.setNotifyUrl(payment.getNotifyUrl().concat("/").concat(order.getTenantId().toString())); - System.out.println("后台配置的回调地址 = " + request.getNotifyUrl()); - } - System.out.println("=== 发起微信支付请求 ==="); - System.out.println("请求参数: " + request); - - PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request); - - System.out.println("=== 微信支付响应成功 ==="); - System.out.println("预支付ID: " + response.getPackageVal()); - - final HashMap orderInfo = new HashMap<>(); - orderInfo.put("provider", "wxpay"); - orderInfo.put("timeStamp", response.getTimeStamp()); - orderInfo.put("nonceStr", response.getNonceStr()); - orderInfo.put("package", response.getPackageVal()); - orderInfo.put("signType", "RSA"); - orderInfo.put("paySign", response.getPaySign()); - orderInfo.put("orderNo", order.getOrderNo()); - orderInfo.put("payType", WechatPayType.JSAPI); - orderInfo.put("wechatPayType", WechatPayType.JSAPI); - return orderInfo; - } - - @Override - public ShopOrder getByOutTradeNo(String outTradeNo) { - return baseMapper.getByOutTradeNo(outTradeNo); - } - - /** - * 修复订单支付状态 - * - * @param shopOrder - */ - @Override - public Boolean queryOrderByOutTradeNo(ShopOrder shopOrder) { - // 后台微信支付配置信息 - final Payment payment = getPayment(shopOrder); - QueryOrderByOutTradeNoRequest queryRequest = new QueryOrderByOutTradeNoRequest(); - queryRequest.setMchid(payment.getMchId()); - queryRequest.setOutTradeNo(shopOrder.getOrderNo()); - // 构建service - JsapiServiceExtension service = getWxService(shopOrder); - try { - Transaction result = service.queryOrderByOutTradeNo(queryRequest); - if (result.getTradeState().equals(Transaction.TradeStateEnum.SUCCESS)) { - shopOrder.setPayStatus(true); - shopOrder.setPayTime(LocalDateTime.now()); - shopOrder.setTransactionId(result.getTransactionId()); - updateById(shopOrder); - return true; - } - } catch (ServiceException e) { - // API返回失败, 例如ORDER_NOT_EXISTS - System.out.printf("code=[%s], message=[%s]\n", e.getErrorCode(), e.getErrorMessage()); - System.out.printf("reponse body=[%s]\n", e.getResponseBody()); - } - return false; - } - - @Override - public void updateByOutTradeNo(ShopOrder order) { - order.setExpirationTime(null); - baseMapper.updateByOutTradeNo(order); - - // 处理支付成功后的业务逻辑 - handlePaymentSuccess(order); - - if (order.getTenantId().equals(10550)) { - shopOrderUpdate10550Service.update(order); - } - } - - /** - * 处理支付成功后的业务逻辑 - */ - private void handlePaymentSuccess(ShopOrder order) { - try { - // 1. 使用优惠券 - if (order.getCouponId() != null && order.getCouponId() > 0) { - markCouponAsUsed(order); - } - - // 2. 累计商品销量 - updateGoodsSales(order); - - log.info("支付成功后业务逻辑处理完成 - 订单号:{}", order.getOrderNo()); - } catch (Exception e) { - log.error("处理支付成功后业务逻辑失败 - 订单号:{}", order.getOrderNo(), e); - // 不抛出异常,避免影响支付回调的成功响应 - } - } - - /** - * 标记优惠券为已使用 - */ - private void markCouponAsUsed(ShopOrder order) { - try { - // 注入 CouponStatusService 并使用其 useCoupon 方法 - // couponStatusService.useCoupon(order.getCouponId().longValue(), order.getOrderId(), order.getOrderNo()); - - // 临时保持原有逻辑,建议后续重构 - ShopUserCoupon coupon = shopUserCouponService.getById(order.getCouponId()); - if (coupon != null) { - coupon.markAsUsed(order.getOrderId(), order.getOrderNo()); - shopUserCouponService.updateById(coupon); - log.info("优惠券标记为已使用 - 优惠券ID:{},订单号:{}", order.getCouponId(), order.getOrderNo()); - } - } catch (Exception e) { - log.error("标记优惠券为已使用失败 - 优惠券ID:{},订单号:{}", order.getCouponId(), order.getOrderNo(), e); - } - } - - /** - * 累计商品销量 - */ - private void updateGoodsSales(ShopOrder order) { - try { - // 获取订单商品列表(忽略租户隔离) - final List orderGoodsList = shopOrderGoodsService.getListByOrderIdIgnoreTenant(order.getOrderId()); - - if (orderGoodsList.isEmpty()) { - log.warn("订单商品列表为空 - 订单号:{}", order.getOrderNo()); - return; - } - - // 累计每个商品的销量 - for (ShopOrderGoods orderGoods : orderGoodsList) { - updateSingleGoodsSales(orderGoods); - } - - log.info("商品销量累计完成 - 订单号:{},商品数量:{}", order.getOrderNo(), orderGoodsList.size()); - } catch (Exception e) { - log.error("累计商品销量失败 - 订单号:{}", order.getOrderNo(), e); - } - } - - /** - * 累计单个商品的销量 - * 使用新的addSaleCount方法,忽略租户隔离确保更新成功 - */ - private void updateSingleGoodsSales(ShopOrderGoods orderGoods) { - try { - if (orderGoods.getGoodsId() == null || orderGoods.getTotalNum() == null || orderGoods.getTotalNum() <= 0) { - log.warn("商品销量累计参数无效 - 商品ID:{},购买数量:{}", - orderGoods.getGoodsId(), orderGoods.getTotalNum()); - return; - } - - // 使用新的addSaleCount方法,忽略租户隔离 - boolean updated = shopGoodsService.addSaleCount(orderGoods.getGoodsId(), orderGoods.getTotalNum()); - - if (updated) { - log.info("商品销量累计成功 - 商品ID:{},商品名称:{},购买数量:{}", - orderGoods.getGoodsId(), orderGoods.getGoodsName(), orderGoods.getTotalNum()); - } else { - log.warn("商品销量累计失败 - 商品ID:{},商品名称:{},购买数量:{}", - orderGoods.getGoodsId(), orderGoods.getGoodsName(), orderGoods.getTotalNum()); - } - } catch (Exception e) { - log.error("累计单个商品销量异常 - 商品ID:{},商品名称:{},购买数量:{}", - orderGoods.getGoodsId(), orderGoods.getGoodsName(), orderGoods.getTotalNum(), e); - } - } - - /** - * 读取微信支付配置 - * 生产环境优先从缓存读取 Payment:1* 格式的商户信息 - * 开发环境自动使用本地回调地址 - * - * @param order - * @return - */ - public Payment getPayment(ShopOrder order) { - // 先清除可能的错误缓存 -// paymentCacheService.removePaymentConfig(order.getPayType().toString(), order.getTenantId()); - - // 使用环境感知的支付配置服务 - Payment payment; - try { - // 尝试使用环境感知服务 - EnvironmentAwarePaymentService envPaymentService = - SpringContextUtil.getBean(EnvironmentAwarePaymentService.class); - payment = envPaymentService.getEnvironmentAwarePaymentConfig(order.getPayType(), order.getTenantId()); - } catch (Exception e) { - // 如果环境感知服务不可用,回退到原有方式 - log.warn("环境感知支付服务不可用,使用原有配置方式: {}", e.getMessage()); - payment = paymentCacheService.getPaymentConfig(order.getPayType(), order.getTenantId()); - } - - // 添加详细的支付配置检查 - System.out.println("=== 支付配置检查 ==="); - System.out.println("订单支付类型: " + order.getPayType()); - System.out.println("租户ID: " + order.getTenantId()); - - if (payment == null) { - throw new RuntimeException("未找到支付配置,支付类型: " + order.getPayType() + ", 租户ID: " + order.getTenantId()); - } - - System.out.println("支付配置ID: " + payment.getId()); - System.out.println("支付方式名称: " + payment.getName()); - System.out.println("支付类型: " + payment.getType()); - System.out.println("支付代码: " + payment.getCode()); - System.out.println("应用ID: " + payment.getAppId()); - System.out.println("商户号: " + payment.getMchId()); - System.out.println("API密钥: " + (payment.getApiKey() != null ? "已配置(长度:" + payment.getApiKey().length() + ")" : "未配置")); - System.out.println("商户证书序列号: " + payment.getMerchantSerialNumber()); - System.out.println("状态: " + payment.getStatus()); - - return payment; - } - - /** - * 构建微信支付 - * - * @param order - * @return - */ - public JsapiServiceExtension getWxService(ShopOrder order) { - try { - final Payment payment = getPayment(order); - - // 提前声明所有需要的变量,避免重复定义 - String privateKey; - String apiclientCert = null; - String pubKey = null; - String tenantCertPath = null; - String privateKeyPath = null; - String pubKeyPath = null; - String apiclientCertPath = null; - String apiclientCertFile = null; - String pubKeyFile = null; - - // 运行配置诊断 - System.out.println("=== 运行微信支付配置诊断 ==="); - wechatPayDiagnostic.diagnosePaymentConfig(payment, null, active); - - // 运行证书诊断 - System.out.println("=== 运行证书诊断 ==="); - WechatPayCertificateDiagnostic.DiagnosticResult diagnosticResult = - certificateDiagnostic.diagnoseCertificateConfig(payment, order.getTenantId(), active); - System.out.println(diagnosticResult.getFullReport()); - - - - // 构建微信支付配置 - Config config = null; - if (active.equals("dev")) { - // 开发环境使用自动证书配置 - // 首先初始化私钥路径 - tenantCertPath = "dev/wechat/" + order.getTenantId(); - privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); - privateKey = certificateLoader.loadCertificatePath(privateKeyPath); - System.out.println("开发环境私钥路径: " + privateKeyPath); - System.out.println("开发环境私钥加载成功: " + privateKey); - - // 检查数据库配置是否完整 - if (payment.getMchId() == null || payment.getMchId().trim().isEmpty()) { - throw new RuntimeException("数据库中商户号(mchId)未配置"); - } - if (payment.getMerchantSerialNumber() == null || payment.getMerchantSerialNumber().trim().isEmpty()) { - throw new RuntimeException("数据库中商户证书序列号(merchantSerialNumber)未配置"); - } - if (payment.getApiKey() == null || payment.getApiKey().trim().isEmpty()) { - throw new RuntimeException("数据库中API密钥(apiKey)未配置"); - } - - System.out.println("=== 使用数据库支付配置 ==="); - System.out.println("商户号: " + payment.getMchId()); - System.out.println("序列号: " + payment.getMerchantSerialNumber()); - System.out.println("API密钥: 已配置(长度:" + payment.getApiKey().length() + ")"); - - // 临时使用RSA配置替代自动证书配置,避免404错误 - System.out.println("=== 注意:使用RSA配置替代自动证书配置 ==="); - System.out.println("原因:商户平台可能未开启API安全功能或未申请微信支付公钥"); - - // 首先检查是否配置了公钥,如果有则优先使用公钥模式 - if (payment.getPubKey() != null && !payment.getPubKey().isEmpty() && - payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { - - try { - // 开发环境固定使用 wechatpay_public_key.pem - pubKeyPath = tenantCertPath + "/wechatpay_public_key.pem"; - - System.out.println("开发环境公钥文件路径: " + pubKeyPath); - - // 检查公钥文件是否存在 - if (certificateLoader.certificateExists(pubKeyPath)) { - System.out.println("=== 检测到公钥配置,使用RSA公钥模式 ==="); - System.out.println("公钥文件: " + payment.getPubKey()); - System.out.println("公钥ID: " + payment.getPubKeyId()); - - pubKeyFile = certificateLoader.loadCertificatePath(pubKeyPath); - System.out.println("✅ 开发环境公钥文件加载成功: " + pubKeyFile); - - config = new RSAPublicKeyConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .publicKeyFromPath(pubKeyFile) - .publicKeyId(payment.getPubKeyId()) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(payment.getApiKey()) - .build(); - System.out.println("✅ 开发环境RSA公钥配置成功"); - } else { - System.out.println("⚠️ 开发环境公钥文件不存在,跳过公钥模式: " + pubKeyPath); - // 跳过公钥配置,继续后续的自动证书配置 - } - } catch (Exception e) { - System.err.println("❌ 开发环境公钥配置检查失败: " + e.getMessage()); - // 跳过公钥配置,继续后续的自动证书配置 - } - } - - // 如果没有公钥配置或公钥文件不存在,尝试自动证书配置 - if (config == null) { - // 没有公钥配置,尝试自动证书配置 - try { - System.out.println("=== 尝试创建自动证书配置 ==="); - System.out.println("商户号: " + payment.getMchId()); - System.out.println("私钥路径: " + privateKey); - System.out.println("序列号: " + payment.getMerchantSerialNumber()); - System.out.println("API密钥长度: " + (payment.getApiKey() != null ? payment.getApiKey().length() : 0)); - - config = wechatCertAutoConfig.createAutoConfig( - payment.getMchId(), - privateKey, - payment.getMerchantSerialNumber(), - payment.getApiKey() - ); - System.out.println("✅ 开发环境自动证书配置成功"); - } catch (Exception e) { - System.err.println("❌ 自动证书配置失败: " + e.getMessage()); - System.err.println("错误类型: " + e.getClass().getName()); - e.printStackTrace(); - - // 检查是否是证书相关的错误 - if (e.getMessage() != null && ( - e.getMessage().contains("certificate") || - e.getMessage().contains("X509Certificate") || - e.getMessage().contains("getSerialNumber") || - e.getMessage().contains("404") || - e.getMessage().contains("API安全"))) { - - System.err.println("🔍 证书问题诊断:"); - System.err.println("1. 检查商户平台是否已开启API安全功能"); - System.err.println("2. 检查是否已申请使用微信支付公钥"); - System.err.println("3. 检查网络连接是否正常"); - System.err.println("4. 检查商户证书序列号是否正确"); - System.err.println("5. 参考文档:https://pay.weixin.qq.com/doc/v3/merchant/4012153196"); - - // 开发环境回退到基础RSA配置 - System.err.println("⚠️ 开发环境回退到基础RSA配置..."); - try { - // 方案1:尝试使用RSA证书配置(需要商户证书文件) - apiclientCertPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getApiclientCertFile(); - - if (certificateLoader.certificateExists(apiclientCertPath)) { - apiclientCertFile = certificateLoader.loadCertificatePath(apiclientCertPath); - System.out.println("方案1: 使用RSA证书配置作为回退方案"); - System.out.println("商户证书路径: " + apiclientCertFile); - - try { - config = new RSAConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .wechatPayCertificatesFromPath(apiclientCertFile) - .build(); - System.out.println("✅ 开发环境RSA证书配置成功"); - } catch (Exception rsaException) { - System.err.println("RSA证书配置失败: " + rsaException.getMessage()); - throw rsaException; - } - } else { - System.err.println("❌ 商户证书文件不存在: " + apiclientCertPath); - System.err.println("⚠️ 尝试方案2: 使用最小化配置..."); - - // 方案2:使用最小化的RSA配置(仅私钥和序列号) - try { - // 创建一个最基础的配置,不依赖平台证书 - config = new com.wechat.pay.java.core.RSAConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .build(); - System.out.println("✅ 开发环境最小化RSA配置成功"); - } catch (Exception minimalException) { - System.err.println("最小化配置也失败: " + minimalException.getMessage()); - throw new RuntimeException("所有配置方案都失败,请检查私钥文件和商户配置", e); - } - } - } catch (Exception fallbackException) { - System.err.println("❌ 手动证书配置失败: " + fallbackException.getMessage()); - fallbackException.printStackTrace(); - - // 最后的回退:抛出详细错误信息 - System.err.println("=== 最终错误诊断 ==="); - System.err.println("1. 自动证书配置失败原因: " + e.getMessage()); - System.err.println("2. 手动证书配置失败原因: " + fallbackException.getMessage()); - System.err.println("3. 建议解决方案:"); - System.err.println(" - 检查微信商户平台是否开启API安全功能"); - System.err.println(" - 确认已申请使用微信支付公钥"); - System.err.println(" - 验证商户证书序列号是否正确"); - System.err.println(" - 检查私钥文件是否完整且格式正确"); - - throw new RuntimeException("微信支付配置失败,请检查商户平台API安全设置和证书配置。原始错误: " + e.getMessage() + ", 回退错误: " + fallbackException.getMessage(), e); - } - } else { - throw new RuntimeException("微信支付配置失败:" + e.getMessage(), e); - } - } - } - } else { - // 生产环境 - 首先初始化私钥 - final String certRootPath = certConfig.getCertRootPath(); - System.out.println("生产环境证书根路径: " + certRootPath); - - String privateKeyRelativePath = payment.getApiclientKey(); - System.out.println("数据库中的私钥相对路径: " + privateKeyRelativePath); - - // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 - String privateKeyFullPath; - // 处理数据库中可能存在的历史路径格式 - String cleanPath = privateKeyRelativePath; - if (privateKeyRelativePath.startsWith("/file/")) { - // 去掉历史的 /file/ 前缀 - cleanPath = privateKeyRelativePath.substring(6); - } else if (privateKeyRelativePath.startsWith("file/")) { - // 去掉历史的 file/ 前缀 - cleanPath = privateKeyRelativePath.substring(5); - } - // 确保路径以 / 开头 - if (!cleanPath.startsWith("/")) { - cleanPath = "/" + cleanPath; - } - privateKeyFullPath = certRootPath + cleanPath; - - System.out.println("生产环境私钥完整路径: " + privateKeyFullPath); - privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); - System.out.println("✅ 生产环境私钥加载完成: " + privateKey); - - // 生产环境也优先检查公钥配置 - if (payment.getPubKey() != null && !payment.getPubKey().isEmpty() && - payment.getPubKeyId() != null && !payment.getPubKeyId().isEmpty()) { - - System.out.println("=== 生产环境检测到公钥配置,使用RSA公钥模式 ==="); - System.out.println("公钥文件路径: " + payment.getPubKey()); - System.out.println("公钥ID: " + payment.getPubKeyId()); - - try { - // 生产环境处理公钥路径 - String pubKeyRelativePath = payment.getPubKey(); - System.out.println("数据库中的公钥相对路径: " + pubKeyRelativePath); - - // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 - String pubKeyFullPath; - // 处理数据库中可能存在的历史路径格式 - String cleanPubPath = pubKeyRelativePath; - if (pubKeyRelativePath.startsWith("/file/")) { - // 去掉历史的 /file/ 前缀 - cleanPubPath = pubKeyRelativePath.substring(6); - } else if (pubKeyRelativePath.startsWith("file/")) { - // 去掉历史的 file/ 前缀 - cleanPubPath = pubKeyRelativePath.substring(5); - } - // 确保路径以 / 开头 - if (!cleanPubPath.startsWith("/")) { - cleanPubPath = "/" + cleanPubPath; - } - pubKeyFullPath = certRootPath + cleanPubPath; - - System.out.println("生产环境公钥完整路径: " + pubKeyFullPath); - pubKeyFile = certificateLoader.loadCertificatePath(pubKeyFullPath); - System.out.println("✅ 生产环境公钥文件加载成功: " + pubKeyFile); - - config = new RSAPublicKeyConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .publicKeyFromPath(pubKeyFile) - .publicKeyId(payment.getPubKeyId()) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(payment.getApiKey()) - .build(); - System.out.println("✅ 生产环境RSA公钥配置成功"); - } catch (Exception pubKeyException) { - System.err.println("❌ 生产环境RSA公钥配置失败: " + pubKeyException.getMessage()); - pubKeyException.printStackTrace(); - throw new RuntimeException("生产环境RSA公钥配置失败: " + pubKeyException.getMessage(), pubKeyException); - } - } else { - // 没有公钥配置,使用自动证书配置 - System.out.println("=== 生产环境使用自动证书配置 ==="); - System.out.println("商户号: " + payment.getMchId()); - System.out.println("序列号: " + payment.getMerchantSerialNumber()); - System.out.println("API密钥: 已配置(长度:" + payment.getApiKey().length() + ")"); - - try { - // 优先使用自动证书配置,避免证书过期和序列号不匹配问题 - config = wechatCertAutoConfig.createAutoConfig( - payment.getMchId(), - privateKey, - payment.getMerchantSerialNumber(), - payment.getApiKey() - ); - System.out.println("✅ 生产环境自动证书配置成功"); - } catch (Exception autoConfigException) { - System.err.println("⚠️ 自动证书配置失败,回退到手动证书配置"); - System.err.println("自动配置错误: " + autoConfigException.getMessage()); - System.err.println("错误类型: " + autoConfigException.getClass().getName()); - autoConfigException.printStackTrace(); - - // 检查是否是证书相关的错误 - if (autoConfigException.getMessage() != null && ( - autoConfigException.getMessage().contains("certificate") || - autoConfigException.getMessage().contains("X509Certificate") || - autoConfigException.getMessage().contains("getSerialNumber") || - autoConfigException.getMessage().contains("404") || - autoConfigException.getMessage().contains("API安全"))) { - - System.err.println("🔍 生产环境证书问题诊断:"); - System.err.println("1. 检查商户平台是否已开启API安全功能"); - System.err.println("2. 检查是否已申请使用微信支付公钥"); - System.err.println("3. 检查网络连接是否正常"); - System.err.println("4. 检查商户证书序列号是否正确"); - } - - try { - // 回退到手动证书配置 - if (payment.getPubKey() != null && !payment.getPubKey().isEmpty()) { - System.out.println("使用RSA公钥配置作为回退方案"); - config = new RSAPublicKeyConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .publicKeyFromPath(pubKey) - .publicKeyId(payment.getPubKeyId()) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(payment.getApiKey()) - .build(); - System.out.println("✅ 生产环境RSA公钥配置成功"); - } else if (apiclientCert != null && !apiclientCert.isEmpty()) { - System.out.println("使用RSA证书配置作为回退方案"); - config = new RSAConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .wechatPayCertificatesFromPath(apiclientCert) - .build(); - System.out.println("✅ 生产环境RSA证书配置成功"); - } else { - throw new RuntimeException("生产环境缺少必要的证书文件,无法创建手动证书配置", autoConfigException); - } - } catch (Exception fallbackException) { - System.err.println("❌ 生产环境手动证书配置也失败: " + fallbackException.getMessage()); - throw new RuntimeException("生产环境微信支付配置失败,请检查商户平台API安全设置和证书配置", autoConfigException); - } - } - } - } - - // 构建service - return new JsapiServiceExtension.Builder().config(config).build(); - } catch (Exception e) { - System.err.println("=== 构建微信支付服务失败 ==="); - System.err.println("错误信息: " + e.getMessage()); - System.err.println("错误类型: " + e.getClass().getName()); - e.printStackTrace(); - throw new RuntimeException("构建微信支付服务失败:" + e.getMessage(), e); - } - } - - @Override - public BigDecimal total() { - try { - // 使用数据库聚合查询统计订单总金额,性能更高 - BigDecimal total = baseMapper.selectTotalAmount(); - - if (total == null) { - total = BigDecimal.ZERO; - } - - log.info("统计订单总金额完成,总金额:{}", total); - return total; - - } catch (Exception e) { - log.error("统计订单总金额失败", e); - return BigDecimal.ZERO; - } - } - - /** - * 获取Native支付的微信支付配置 - */ - private Config getWxPayConfig(ShopOrder order) throws Exception { - try { - final Payment payment = getPayment(order); - String privateKey; - String apiclientCert = null; - String pubKey = null; - - // 初始化证书路径 - if (active.equals("dev")) { - // 开发环境 - 构建包含租户号的证书路径 - String tenantCertPath = "dev/wechat/" + order.getTenantId(); - String privateKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getPrivateKeyFile(); - - System.out.println("开发环境证书路径 - 租户ID: " + order.getTenantId()); - System.out.println("开发环境证书路径 - 私钥: " + privateKeyPath); - - privateKey = certificateLoader.loadCertificatePath(privateKeyPath); - System.out.println("私钥完整路径: " + privateKey); - - // 尝试加载公钥(如果配置了) - if (StrUtil.isNotBlank(payment.getPubKey()) && StrUtil.isNotBlank(payment.getPubKeyId())) { - try { - String pubKeyPath = tenantCertPath + "/" + certConfig.getWechatPay().getDev().getWechatpayCertFile(); - pubKey = certificateLoader.loadCertificatePath(pubKeyPath); - System.out.println("✅ 开发环境公钥加载成功"); - } catch (Exception e) { - System.out.println("⚠️ 开发环境公钥加载失败,将使用自动证书配置: " + e.getMessage()); - } - } - } else { - // 生产环境 - 从数据库配置的路径加载 - final String certRootPath = certConfig.getCertRootPath(); - - System.out.println("生产环境证书路径 - 租户ID: " + order.getTenantId()); - System.out.println("生产环境证书根路径: " + certRootPath); - System.out.println("私钥文件名: " + payment.getApiclientKey()); - - String privateKeyRelativePath = payment.getApiclientKey(); - - // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 - String privateKeyFullPath; - // 处理数据库中可能存在的历史路径格式 - String cleanPath2 = privateKeyRelativePath; - if (privateKeyRelativePath.startsWith("/file/")) { - // 去掉历史的 /file/ 前缀 - cleanPath2 = privateKeyRelativePath.substring(6); - } else if (privateKeyRelativePath.startsWith("file/")) { - // 去掉历史的 file/ 前缀 - cleanPath2 = privateKeyRelativePath.substring(5); - } - // 确保路径以 / 开头 - if (!cleanPath2.startsWith("/")) { - cleanPath2 = "/" + cleanPath2; - } - privateKeyFullPath = certRootPath + cleanPath2; - - System.out.println("私钥完整路径: " + privateKeyFullPath); - privateKey = certificateLoader.loadCertificatePath(privateKeyFullPath); - System.out.println("✅ 生产环境私钥加载完成: " + privateKey); - - // 尝试加载公钥(如果配置了) - if (StrUtil.isNotBlank(payment.getPubKey()) && StrUtil.isNotBlank(payment.getPubKeyId())) { - try { - String pubKeyRelativePath = payment.getPubKey(); - System.out.println("数据库中的公钥相对路径: " + pubKeyRelativePath); - - // 生产环境已经没有/file目录,所有路径都直接拼接到根路径 - String pubKeyFullPath; - // 处理数据库中可能存在的历史路径格式 - String cleanPubPath2 = pubKeyRelativePath; - if (pubKeyRelativePath.startsWith("/file/")) { - // 去掉历史的 /file/ 前缀 - cleanPubPath2 = pubKeyRelativePath.substring(6); - } else if (pubKeyRelativePath.startsWith("file/")) { - // 去掉历史的 file/ 前缀 - cleanPubPath2 = pubKeyRelativePath.substring(5); - } - // 确保路径以 / 开头 - if (!cleanPubPath2.startsWith("/")) { - cleanPubPath2 = "/" + cleanPubPath2; - } - pubKeyFullPath = certRootPath + cleanPubPath2; - - System.out.println("生产环境公钥完整路径: " + pubKeyFullPath); - pubKey = certificateLoader.loadCertificatePath(pubKeyFullPath); - System.out.println("✅ 生产环境公钥加载成功"); - } catch (Exception e) { - System.out.println("⚠️ 生产环境公钥加载失败,将使用自动证书配置: " + e.getMessage()); - } - } - } - - // 根据可用的证书类型选择配置方式 - Config config; - if (pubKey != null && StrUtil.isNotBlank(payment.getPubKeyId())) { - // 使用RSA公钥配置(推荐方式) - System.out.println("🔧 使用RSA公钥配置"); - config = new RSAPublicKeyConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .publicKeyFromPath(pubKey) - .publicKeyId(payment.getPubKeyId()) - .apiV3Key(payment.getApiKey()) - .build(); - } else { - // 使用自动证书配置 - System.out.println("🔧 使用RSA自动证书配置"); - config = new RSAAutoCertificateConfig.Builder() - .merchantId(payment.getMchId()) - .privateKeyFromPath(privateKey) - .merchantSerialNumber(payment.getMerchantSerialNumber()) - .apiV3Key(payment.getApiKey()) - .build(); - } - - System.out.println("✅ 微信支付配置构建成功"); - return config; - - } catch (Exception e) { - System.err.println("❌ 构建微信支付服务失败: " + e.getMessage()); - e.printStackTrace(); - throw new RuntimeException("构建微信支付服务失败:" + e.getMessage(), e); - } - } - - @Override - public ShopOrder getByOrderNo(String orderNo, Integer tenantId) { - return this.lambdaQuery() - .eq(ShopOrder::getOrderNo, orderNo) - .eq(ShopOrder::getTenantId, tenantId) - .one(); - } - - @Override - public boolean syncPaymentStatus(String orderNo, Integer paymentStatus, String transactionId, String payTime, Integer tenantId) { - try { - // 查询订单 - ShopOrder order = getByOrderNo(orderNo, tenantId); - if (order == null) { - log.warn("同步支付状态失败:订单不存在, orderNo={}, tenantId={}", orderNo, tenantId); - return false; - } - - // 如果订单已经是支付成功状态,不需要更新 - if (order.getPayStatus() && paymentStatus == 1) { - log.info("订单已经是支付成功状态,无需更新: orderNo={}", orderNo); - return true; - } - - // 更新订单状态 - boolean updated = this.lambdaUpdate() - .eq(ShopOrder::getOrderNo, orderNo) - .eq(ShopOrder::getTenantId, tenantId) - .set(ShopOrder::getPayStatus, paymentStatus == 1) - .set(transactionId != null, ShopOrder::getTransactionId, transactionId) - .set(payTime != null, ShopOrder::getPayTime, payTime) - .set(ShopOrder::getUpdateTime, LocalDateTime.now()) - .update(); - - if (updated) { - log.info("订单支付状态同步成功: orderNo={}, paymentStatus={}, transactionId={}", - orderNo, paymentStatus, transactionId); - } else { - log.warn("订单支付状态同步失败: orderNo={}, paymentStatus={}", orderNo, paymentStatus); - } - - return updated; - - } catch (Exception e) { - log.error("同步订单支付状态异常: orderNo={}, error={}", orderNo, e.getMessage(), e); - return false; - } - } - - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderUpdate10550ServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderUpdate10550ServiceImpl.java deleted file mode 100644 index 671ac42..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopOrderUpdate10550ServiceImpl.java +++ /dev/null @@ -1,298 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.gxwebsoft.common.system.entity.DictData; -import com.gxwebsoft.common.system.entity.User; -import com.gxwebsoft.common.system.entity.UserReferee; -import com.gxwebsoft.common.system.param.DictDataParam; -import com.gxwebsoft.common.system.service.DictDataService; -import com.gxwebsoft.common.system.service.UserRefereeService; -import com.gxwebsoft.common.system.service.UserService; -import com.gxwebsoft.shop.entity.*; -import com.gxwebsoft.shop.service.*; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; - -/** - * 订单更新业务处理Service实现 - * 处理特定租户(10550)的订单相关业务逻辑 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Slf4j -@Service -public class ShopOrderUpdate10550ServiceImpl implements ShopOrderUpdate10550Service { - - @Resource - private UserService userService; - @Resource - private DictDataService dictDataService; - @Resource - private UserRefereeService userRefereeService; - @Resource - private ShopDealerOrderService shopDealerOrderService; - @Resource - private ShopDealerCapitalService shopDealerCapitalService; - @Resource - private ShopOrderGoodsService shopOrderGoodsService; - @Resource - private ShopGoodsService shopGoodsService; - - @Override - public void update(ShopOrder order) { - try { - log.info("开始处理订单更新业务 - 订单ID: {}, 用户ID: {}, 租户ID: {}", - order.getOrderId(), order.getUserId(), order.getTenantId()); - - // 1. 获取合伙人条件配置 - BigDecimal partnerCondition = getPartnerCondition(); - if (partnerCondition == null) { - log.warn("未找到合伙人条件配置,跳过用户等级更新"); - return; - } - - // 2. 更新用户消费金额和等级 - updateUserGradeAndExpendMoney(order, partnerCondition); - - // 3. 处理分销业务(如果需要) - // processDistributionBusiness(order); - - log.info("订单更新业务处理完成 - 订单ID: {}", order.getOrderId()); - } catch (Exception e) { - log.error("处理订单更新业务异常 - 订单ID: {}", order.getOrderId(), e); - } - } - - /** - * 获取合伙人条件配置 - * @return 合伙人条件金额 - */ - private BigDecimal getPartnerCondition() { - try { - // 查询字典ID为1460的配置 - DictDataParam param = new DictDataParam(); - param.setDictId(1460); - List dictDataList = dictDataService.listRel(param); - - if (dictDataList != null && !dictDataList.isEmpty()) { - String dictDataCode = dictDataList.get(0).getDictDataCode(); - BigDecimal partnerCondition = new BigDecimal(dictDataCode); - log.info("获取合伙人条件配置成功 - 金额: {}", partnerCondition); - return partnerCondition; - } - } catch (Exception e) { - log.error("获取合伙人条件配置异常", e); - } - return null; - } - - /** - * 更新用户等级和消费金额 - * @param order 订单信息 - * @param partnerCondition 合伙人条件金额 - */ - private void updateUserGradeAndExpendMoney(ShopOrder order, BigDecimal partnerCondition) { - try { - // 查询用户信息(忽略租户隔离) - User user = userService.getByIdIgnoreTenant(order.getUserId()); - if (user == null) { - log.warn("用户不存在 - 用户ID: {}", order.getUserId()); - return; - } - - // 累加消费金额 - BigDecimal currentExpendMoney = user.getExpendMoney() != null ? user.getExpendMoney() : BigDecimal.ZERO; - BigDecimal newExpendMoney = currentExpendMoney.add(order.getPayPrice()); - user.setExpendMoney(newExpendMoney); - - // 检查是否达到合伙人条件 - boolean shouldUpgrade = newExpendMoney.compareTo(partnerCondition) >= 0 && !Integer.valueOf(3).equals(user.getGradeId()); - if (shouldUpgrade) { - user.setGradeId(3); - log.info("用户等级升级为合伙人 - 用户ID: {}, 消费金额: {}, 条件金额: {}", - user.getUserId(), newExpendMoney, partnerCondition); - } - - // 更新用户信息(使用忽略租户隔离的更新方法) - userService.updateByUserId(user); - - log.info("用户信息更新成功 - 用户ID: {}, 消费金额: {} -> {}, 等级: {}", - user.getUserId(), currentExpendMoney, newExpendMoney, user.getGradeId()); - - } catch (Exception e) { - log.error("更新用户等级和消费金额异常 - 用户ID: {}", order.getUserId(), e); - } - } - - /** - * 处理分销业务(暂时注释,如需启用请取消注释) - * @param order 订单信息 - */ - @SuppressWarnings("unused") - private void processDistributionBusiness(ShopOrder order) { - try { - // 获取推荐人信息 - User parent = getParentUser(order.getUserId()); - if (parent == null) { - log.info("用户无推荐人,跳过分销业务处理 - 用户ID: {}", order.getUserId()); - return; - } - - // 计算佣金 - BigDecimal commission = calculateCommission(order); - if (commission.compareTo(BigDecimal.ZERO) <= 0) { - log.info("佣金为0,跳过分销业务处理 - 订单ID: {}", order.getOrderId()); - return; - } - - // 更新推荐人余额 - updateParentBalance(parent, commission); - - // 创建分销订单记录 - createDealerOrder(parent, order, commission); - - // 创建分销资金明细 - createDealerCapital(parent, order); - - log.info("分销业务处理完成 - 订单ID: {}, 推荐人ID: {}, 佣金: {}", - order.getOrderId(), parent.getUserId(), commission); - - } catch (Exception e) { - log.error("处理分销业务异常 - 订单ID: {}", order.getOrderId(), e); - } - } - - /** - * 获取推荐人信息 - * @param userId 用户ID - * @return 推荐人信息 - */ - private User getParentUser(Integer userId) { - try { - UserReferee userReferee = userRefereeService.getByUserId(userId); - if (userReferee != null && userReferee.getDealerId() != null) { - return userService.getByIdIgnoreTenant(userReferee.getDealerId()); - } - } catch (Exception e) { - log.error("获取推荐人信息异常 - 用户ID: {}", userId, e); - } - return null; - } - - /** - * 计算佣金 - * @param order 订单信息 - * @return 总佣金 - */ - private BigDecimal calculateCommission(ShopOrder order) { - try { - // 获取订单商品列表(忽略租户隔离) - List orderGoodsList = shopOrderGoodsService.getListByOrderIdIgnoreTenant(order.getOrderId()); - if (orderGoodsList.isEmpty()) { - return BigDecimal.ZERO; - } - - // 获取商品信息 - List goodsIds = orderGoodsList.stream() - .map(ShopOrderGoods::getGoodsId) - .toList(); - List goodsList = shopGoodsService.listByIds(goodsIds); - - // 计算总佣金 - BigDecimal totalCommission = BigDecimal.ZERO; - for (ShopOrderGoods orderGoods : orderGoodsList) { - ShopGoods goods = goodsList.stream() - .filter(g -> g.getGoodsId().equals(orderGoods.getGoodsId())) - .findFirst() - .orElse(null); - - if (goods != null && goods.getCommission() != null) { - BigDecimal goodsCommission = goods.getCommission() - .multiply(BigDecimal.valueOf(orderGoods.getTotalNum())); - totalCommission = totalCommission.add(goodsCommission); - } - } - - log.info("佣金计算完成 - 订单ID: {}, 总佣金: {}", order.getOrderId(), totalCommission); - return totalCommission; - - } catch (Exception e) { - log.error("计算佣金异常 - 订单ID: {}", order.getOrderId(), e); - return BigDecimal.ZERO; - } - } - - /** - * 更新推荐人余额 - * @param parent 推荐人信息 - * @param commission 佣金金额 - */ - private void updateParentBalance(User parent, BigDecimal commission) { - try { - BigDecimal currentBalance = parent.getBalance() != null ? parent.getBalance() : BigDecimal.ZERO; - BigDecimal newBalance = currentBalance.add(commission); - parent.setBalance(newBalance); - - userService.updateByUserId(parent); - - log.info("推荐人余额更新成功 - 用户ID: {}, 余额: {} -> {}", - parent.getUserId(), currentBalance, newBalance); - - } catch (Exception e) { - log.error("更新推荐人余额异常 - 用户ID: {}", parent.getUserId(), e); - } - } - - /** - * 创建分销订单记录 - * @param parent 推荐人信息 - * @param order 订单信息 - * @param commission 佣金金额 - */ - private void createDealerOrder(User parent, ShopOrder order, BigDecimal commission) { - try { - ShopDealerOrder dealerOrder = new ShopDealerOrder(); - dealerOrder.setUserId(parent.getUserId()); - dealerOrder.setOrderNo(order.getOrderNo()); - dealerOrder.setOrderPrice(order.getTotalPrice()); - dealerOrder.setFirstUserId(order.getUserId()); - dealerOrder.setFirstMoney(commission); - dealerOrder.setIsSettled(1); - dealerOrder.setSettleTime(LocalDateTime.now()); - - shopDealerOrderService.save(dealerOrder); - - log.info("分销订单记录创建成功 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId()); - - } catch (Exception e) { - log.error("创建分销订单记录异常 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId(), e); - } - } - - /** - * 创建分销资金明细 - * @param parent 推荐人信息 - * @param order 订单信息 - */ - private void createDealerCapital(User parent, ShopOrder order) { - try { - ShopDealerCapital dealerCapital = new ShopDealerCapital(); - dealerCapital.setUserId(parent.getUserId()); - dealerCapital.setOrderNo(order.getOrderNo()); - dealerCapital.setFlowType(10); // 分销收入 - - shopDealerCapitalService.save(dealerCapital); - - log.info("分销资金明细创建成功 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId()); - - } catch (Exception e) { - log.error("创建分销资金明细异常 - 推荐人ID: {}, 订单ID: {}", parent.getUserId(), order.getOrderId(), e); - } - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopRechargeOrderServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopRechargeOrderServiceImpl.java deleted file mode 100644 index ee0d9c3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopRechargeOrderServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopRechargeOrderMapper; -import com.gxwebsoft.shop.service.ShopRechargeOrderService; -import com.gxwebsoft.shop.entity.ShopRechargeOrder; -import com.gxwebsoft.shop.param.ShopRechargeOrderParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 会员充值订单表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:12 - */ -@Service -public class ShopRechargeOrderServiceImpl extends ServiceImpl implements ShopRechargeOrderService { - - @Override - public PageResult pageRel(ShopRechargeOrderParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopRechargeOrderParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopRechargeOrder getByIdRel(Integer orderId) { - ShopRechargeOrderParam param = new ShopRechargeOrderParam(); - param.setOrderId(orderId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecServiceImpl.java deleted file mode 100644 index 708f1c9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopSpecMapper; -import com.gxwebsoft.shop.service.ShopSpecService; -import com.gxwebsoft.shop.entity.ShopSpec; -import com.gxwebsoft.shop.param.ShopSpecParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 规格Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Service -public class ShopSpecServiceImpl extends ServiceImpl implements ShopSpecService { - - @Override - public PageResult pageRel(ShopSpecParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopSpecParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopSpec getByIdRel(Integer specId) { - ShopSpecParam param = new ShopSpecParam(); - param.setSpecId(specId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecValueServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecValueServiceImpl.java deleted file mode 100644 index 9e39e23..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSpecValueServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopSpecValueMapper; -import com.gxwebsoft.shop.service.ShopSpecValueService; -import com.gxwebsoft.shop.entity.ShopSpecValue; -import com.gxwebsoft.shop.param.ShopSpecValueParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 规格值Service实现 - * - * @author 科技小王子 - * @since 2025-05-01 09:44:00 - */ -@Service -public class ShopSpecValueServiceImpl extends ServiceImpl implements ShopSpecValueService { - - @Override - public PageResult pageRel(ShopSpecValueParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopSpecValueParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopSpecValue getByIdRel(Integer specValueId) { - ShopSpecValueParam param = new ShopSpecValueParam(); - param.setSpecValueId(specValueId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSplashServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSplashServiceImpl.java deleted file mode 100644 index b6d3f8d..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopSplashServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopSplashMapper; -import com.gxwebsoft.shop.service.ShopSplashService; -import com.gxwebsoft.shop.entity.ShopSplash; -import com.gxwebsoft.shop.param.ShopSplashParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 开屏广告Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Service -public class ShopSplashServiceImpl extends ServiceImpl implements ShopSplashService { - - @Override - public PageResult pageRel(ShopSplashParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopSplashParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopSplash getByIdRel(Integer id) { - ShopSplashParam param = new ShopSplashParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserAddressServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserAddressServiceImpl.java deleted file mode 100644 index cf599c6..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserAddressServiceImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopUserAddressMapper; -import com.gxwebsoft.shop.service.ShopUserAddressService; -import com.gxwebsoft.shop.entity.ShopUserAddress; -import com.gxwebsoft.shop.param.ShopUserAddressParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 收货地址Service实现 - * - * @author 科技小王子 - * @since 2025-07-22 23:06:40 - */ -@Service -public class ShopUserAddressServiceImpl extends ServiceImpl implements ShopUserAddressService { - - @Override - public PageResult pageRel(ShopUserAddressParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopUserAddressParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopUserAddress getByIdRel(Integer id) { - ShopUserAddressParam param = new ShopUserAddressParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopUserAddress getDefaultAddress(Integer userId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ShopUserAddress::getUserId, userId) - .eq(ShopUserAddress::getIsDefault, true) - .orderByDesc(ShopUserAddress::getCreateTime) - .last("LIMIT 1"); - return getOne(wrapper); - } - - @Override - public List getUserAddresses(Integer userId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(ShopUserAddress::getUserId, userId) - .orderByDesc(ShopUserAddress::getIsDefault) - .orderByAsc(ShopUserAddress::getSortNumber) - .orderByDesc(ShopUserAddress::getCreateTime); - return list(wrapper); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserBalanceLogServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserBalanceLogServiceImpl.java deleted file mode 100644 index 483b7b3..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserBalanceLogServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopUserBalanceLogMapper; -import com.gxwebsoft.shop.service.ShopUserBalanceLogService; -import com.gxwebsoft.shop.entity.ShopUserBalanceLog; -import com.gxwebsoft.shop.param.ShopUserBalanceLogParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 用户余额变动明细表Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Service -public class ShopUserBalanceLogServiceImpl extends ServiceImpl implements ShopUserBalanceLogService { - - @Override - public PageResult pageRel(ShopUserBalanceLogParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopUserBalanceLogParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopUserBalanceLog getByIdRel(Integer logId) { - ShopUserBalanceLogParam param = new ShopUserBalanceLogParam(); - param.setLogId(logId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCollectionServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCollectionServiceImpl.java deleted file mode 100644 index 5d6dd6b..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCollectionServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopUserCollectionMapper; -import com.gxwebsoft.shop.service.ShopUserCollectionService; -import com.gxwebsoft.shop.entity.ShopUserCollection; -import com.gxwebsoft.shop.param.ShopUserCollectionParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 我的收藏Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Service -public class ShopUserCollectionServiceImpl extends ServiceImpl implements ShopUserCollectionService { - - @Override - public PageResult pageRel(ShopUserCollectionParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopUserCollectionParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopUserCollection getByIdRel(Integer id) { - ShopUserCollectionParam param = new ShopUserCollectionParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java deleted file mode 100644 index fb3d5ed..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserCouponServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopUserCouponMapper; -import com.gxwebsoft.shop.service.ShopUserCouponService; -import com.gxwebsoft.shop.entity.ShopUserCoupon; -import com.gxwebsoft.shop.param.ShopUserCouponParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 用户优惠券Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopUserCouponServiceImpl extends ServiceImpl implements ShopUserCouponService { - - @Override - public PageResult pageRel(ShopUserCouponParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopUserCouponParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopUserCoupon getByIdRel(Integer id) { - ShopUserCouponParam param = new ShopUserCouponParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - - @Override - public List userList(Integer userId) { - return list( - new LambdaQueryWrapper() - .eq(ShopUserCoupon::getUserId, userId) - ); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserRefereeServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserRefereeServiceImpl.java deleted file mode 100644 index 1d6dae9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserRefereeServiceImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopUserRefereeMapper; -import com.gxwebsoft.shop.service.ShopUserRefereeService; -import com.gxwebsoft.shop.entity.ShopUserReferee; -import com.gxwebsoft.shop.param.ShopUserRefereeParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 用户推荐关系表Service实现 - * - * @author 科技小王子 - * @since 2025-08-11 23:51:41 - */ -@Service -public class ShopUserRefereeServiceImpl extends ServiceImpl implements ShopUserRefereeService { - - @Override - public PageResult pageRel(ShopUserRefereeParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopUserRefereeParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopUserReferee getByIdRel(Integer id) { - ShopUserRefereeParam param = new ShopUserRefereeParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - - @Override - public ShopUserReferee getByUserIdRel(Integer userId) { - ShopUserRefereeParam param = new ShopUserRefereeParam(); - param.setUserId(userId); - param.setLevel(1); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserServiceImpl.java deleted file mode 100644 index 9d7cde5..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopUserServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import com.gxwebsoft.shop.entity.ShopUser; -import com.gxwebsoft.shop.mapper.ShopUserMapper; -import com.gxwebsoft.shop.param.ShopUserParam; -import com.gxwebsoft.shop.service.ShopUserService; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 用户记录表Service实现 - * - * @author 科技小王子 - * @since 2025-10-03 13:41:09 - */ -@Service -public class ShopUserServiceImpl extends ServiceImpl implements ShopUserService { - - @Override - public PageResult pageRel(ShopUserParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopUserParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopUser getByIdRel(Integer userId) { - ShopUserParam param = new ShopUserParam(); - param.setUserId(userId); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java deleted file mode 100644 index 49cfeb9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopWebsiteServiceImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.gxwebsoft.cms.service.CmsWebsiteService; -import com.gxwebsoft.common.core.utils.JSONUtil; -import com.gxwebsoft.common.core.utils.RedisUtil; -import com.gxwebsoft.shop.service.ShopWebsiteService; -import com.gxwebsoft.shop.vo.ShopVo; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.concurrent.TimeUnit; - -/** - * 商城网站服务实现类 - * - * @author 科技小王子 - * @since 2025-08-13 - */ -@Slf4j -@Service -public class ShopWebsiteServiceImpl implements ShopWebsiteService { - - @Autowired - private CmsWebsiteService cmsWebsiteService; - - @Autowired - private RedisUtil redisUtil; - - /** - * 商城信息缓存键前缀 - */ - private static final String SHOP_INFO_KEY_PREFIX = "ShopInfo:"; - - @Override - public ShopVo getShopInfo(Integer tenantId) { - // 参数验证 - if (ObjectUtil.isEmpty(tenantId)) { - throw new IllegalArgumentException("租户ID不能为空"); - } - - // 商城专用缓存键 - String cacheKey = SHOP_INFO_KEY_PREFIX + tenantId; - String shopInfo = redisUtil.get(cacheKey); - if (StrUtil.isNotBlank(shopInfo)) { - log.info("从缓存获取商城信息,租户ID: {}", tenantId); -// try { -// return JSONUtil.parseObject(shopInfo, ShopVo.class); -// } catch (Exception e) { -// log.warn("商城缓存解析失败,从数据库重新获取: {}", e.getMessage()); -// } - } - - // 直接调用 CMS 服务获取站点信息,然后使用商城专用缓存 - ShopVo shopVO = cmsWebsiteService.getSiteInfo(tenantId); - if (shopVO == null) { - throw new RuntimeException("请先创建商城"); - } - - // 缓存结果(商城信息缓存时间设置为1小时) - try { - redisUtil.set(cacheKey, shopVO, 1L, TimeUnit.HOURS); - } catch (Exception e) { - log.warn("缓存商城信息失败: {}", e.getMessage()); - } - - log.info("获取商城信息成功,租户ID: {}", tenantId); - return shopVO; - } - - @Override - public void clearShopInfoCache(Integer tenantId) { - if (tenantId != null) { - String cacheKey = SHOP_INFO_KEY_PREFIX + tenantId; - redisUtil.delete(cacheKey); - log.info("清除商城信息缓存成功,租户ID: {}", tenantId); - } - } - - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopWechatDepositServiceImpl.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopWechatDepositServiceImpl.java deleted file mode 100644 index 9bf85d2..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/service/impl/ShopWechatDepositServiceImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.gxwebsoft.shop.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.gxwebsoft.shop.mapper.ShopWechatDepositMapper; -import com.gxwebsoft.shop.service.ShopWechatDepositService; -import com.gxwebsoft.shop.entity.ShopWechatDeposit; -import com.gxwebsoft.shop.param.ShopWechatDepositParam; -import com.gxwebsoft.common.core.web.PageParam; -import com.gxwebsoft.common.core.web.PageResult; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 押金Service实现 - * - * @author 科技小王子 - * @since 2025-01-11 10:45:13 - */ -@Service -public class ShopWechatDepositServiceImpl extends ServiceImpl implements ShopWechatDepositService { - - @Override - public PageResult pageRel(ShopWechatDepositParam param) { - PageParam page = new PageParam<>(param); - page.setDefaultOrder("sort_number asc, create_time desc"); - List list = baseMapper.selectPageRel(page, param); - return new PageResult<>(list, page.getTotal()); - } - - @Override - public List listRel(ShopWechatDepositParam param) { - List list = baseMapper.selectListRel(param); - // 排序 - PageParam page = new PageParam<>(); - page.setDefaultOrder("sort_number asc, create_time desc"); - return page.sortRecords(list); - } - - @Override - public ShopWechatDeposit getByIdRel(Integer id) { - ShopWechatDepositParam param = new ShopWechatDepositParam(); - param.setId(id); - return param.getOne(baseMapper.selectListRel(param)); - } - -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/task/CouponExpireTask.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/task/CouponExpireTask.java deleted file mode 100644 index 9781bd9..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/task/CouponExpireTask.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.gxwebsoft.shop.task; - -import com.gxwebsoft.shop.service.CouponStatusService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -/** - * 优惠券过期处理定时任务 - * - * @author WebSoft - * @since 2025-01-15 - */ -@Slf4j -@Component -public class CouponExpireTask { - - @Autowired - private CouponStatusService couponStatusService; - - @Value("${spring.profiles.active:dev}") - private String activeProfile; - - /** - * 每天凌晨2点执行过期优惠券处理 - * 生产环境:每天凌晨2点执行 - * 开发环境:每10分钟执行一次(用于测试) - */ - @Scheduled(cron = "${coupon.expire.cron:0 0 2 * * ?}") - public void processExpiredCoupons() { - log.info("开始执行过期优惠券处理任务..."); - - try { - long startTime = System.currentTimeMillis(); - - // 批量更新过期优惠券状态 - int updatedCount = couponStatusService.updateExpiredCoupons(); - - long endTime = System.currentTimeMillis(); - long duration = endTime - startTime; - - log.info("过期优惠券处理任务完成,更新数量: {},耗时: {}ms", updatedCount, duration); - - // 如果是开发环境,输出更详细的日志 - if ("dev".equals(activeProfile)) { - log.debug("开发环境 - 过期优惠券处理详情: 更新{}张优惠券", updatedCount); - } - - } catch (Exception e) { - log.error("过期优惠券处理任务执行失败", e); - } - } - - /** - * 每小时执行一次优惠券状态检查(可选) - * 用于及时发现和处理刚过期的优惠券 - */ - @Scheduled(cron = "0 0 * * * ?") - public void hourlyExpiredCouponsCheck() { - // 只在生产环境执行 - if (!"prod".equals(activeProfile)) { - return; - } - - log.debug("执行每小时优惠券状态检查..."); - - try { - int updatedCount = couponStatusService.updateExpiredCoupons(); - if (updatedCount > 0) { - log.info("每小时检查发现并更新了 {} 张过期优惠券", updatedCount); - } - } catch (Exception e) { - log.error("每小时优惠券状态检查失败", e); - } - } - - /** - * 手动触发过期优惠券处理(用于测试) - */ - public void manualProcessExpiredCoupons() { - log.info("手动触发过期优惠券处理任务..."); - processExpiredCoupons(); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/task/OrderAutoCancelTask.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/task/OrderAutoCancelTask.java deleted file mode 100644 index d1b71ff..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/task/OrderAutoCancelTask.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.gxwebsoft.shop.task; - -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.shop.config.OrderConfigProperties; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.service.OrderCancelService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * 订单自动取消定时任务 - * - * @author WebSoft - * @since 2025-01-26 - */ -@Slf4j -@Component -@ConditionalOnProperty(prefix = "shop.order.auto-cancel", name = "enabled", havingValue = "true", matchIfMissing = true) -public class OrderAutoCancelTask { - - @Autowired - private OrderCancelService orderCancelService; - - @Autowired - private OrderConfigProperties orderConfig; - - @Value("${spring.profiles.active:dev}") - private String activeProfile; - - /** - * 自动取消超时订单 - * 生产环境:每5分钟执行一次 - * 开发环境:每1分钟执行一次(便于测试) - */ - @Scheduled(cron = "${shop.order.auto-cancel.cron:0 */5 * * * ?}") - @IgnoreTenant("定时任务需要处理所有租户的超时订单") - public void cancelExpiredOrders() { - if (!orderConfig.getAutoCancel().isEnabled()) { - log.debug("订单自动取消功能已禁用"); - return; - } - - log.info("开始执行订单自动取消任务..."); - - try { - long startTime = System.currentTimeMillis(); - int totalCancelledCount = 0; - - // 处理默认配置的订单 - int defaultCancelledCount = processDefaultTimeoutOrders(); - totalCancelledCount += defaultCancelledCount; - - // 处理租户特殊配置的订单 - int tenantCancelledCount = processTenantSpecificOrders(); - totalCancelledCount += tenantCancelledCount; - - long endTime = System.currentTimeMillis(); - long duration = endTime - startTime; - - log.info("订单自动取消任务完成,总取消数量: {},默认配置: {},租户配置: {},耗时: {}ms", - totalCancelledCount, defaultCancelledCount, tenantCancelledCount, duration); - - // 开发环境输出更详细的日志 - if ("dev".equals(activeProfile)) { - log.debug("开发环境 - 订单自动取消详情: 总共取消{}个订单", totalCancelledCount); - } - - } catch (Exception e) { - log.error("订单自动取消任务执行失败", e); - } - } - - /** - * 处理使用默认超时配置的订单 - */ - private int processDefaultTimeoutOrders() { - try { - Integer defaultTimeout = orderConfig.getAutoCancel().getDefaultTimeoutMinutes(); - Integer batchSize = orderConfig.getAutoCancel().getBatchSize(); - - log.debug("处理默认超时订单,超时时间: {}分钟,批量大小: {}", defaultTimeout, batchSize); - - List expiredOrders = orderCancelService.findExpiredUnpaidOrders(defaultTimeout, batchSize); - - if (expiredOrders.isEmpty()) { - log.debug("没有找到使用默认配置的超时订单"); - return 0; - } - - // 过滤掉有特殊租户配置的订单 - List ordersToCancel = filterOrdersWithoutTenantConfig(expiredOrders); - - if (ordersToCancel.isEmpty()) { - log.debug("过滤后没有需要使用默认配置取消的订单"); - return 0; - } - - int cancelledCount = orderCancelService.batchCancelOrders(ordersToCancel); - log.info("默认配置取消订单完成,找到: {}个,过滤后: {}个,成功取消: {}个", - expiredOrders.size(), ordersToCancel.size(), cancelledCount); - - return cancelledCount; - - } catch (Exception e) { - log.error("处理默认超时订单失败", e); - return 0; - } - } - - /** - * 处理租户特殊配置的订单 - */ - private int processTenantSpecificOrders() { - try { - List tenantConfigs = orderConfig.getAutoCancel().getTenantConfigs(); - if (tenantConfigs == null || tenantConfigs.isEmpty()) { - log.debug("没有配置租户特殊超时规则"); - return 0; - } - - int totalCancelledCount = 0; - Integer batchSize = orderConfig.getAutoCancel().getBatchSize(); - - for (OrderConfigProperties.TenantCancelConfig tenantConfig : tenantConfigs) { - if (!tenantConfig.isEnabled()) { - log.debug("租户{}的自动取消功能已禁用", tenantConfig.getTenantId()); - continue; - } - - log.debug("处理租户{}的超时订单,超时时间: {}分钟", - tenantConfig.getTenantId(), tenantConfig.getTimeoutMinutes()); - - List tenantExpiredOrders = orderCancelService.findExpiredUnpaidOrdersByTenant( - tenantConfig.getTenantId(), tenantConfig.getTimeoutMinutes(), batchSize); - - if (!tenantExpiredOrders.isEmpty()) { - int cancelledCount = orderCancelService.batchCancelOrders(tenantExpiredOrders); - totalCancelledCount += cancelledCount; - - log.info("租户{}取消订单完成,找到: {}个,成功取消: {}个", - tenantConfig.getTenantId(), tenantExpiredOrders.size(), cancelledCount); - } - } - - return totalCancelledCount; - - } catch (Exception e) { - log.error("处理租户特殊配置订单失败", e); - return 0; - } - } - - /** - * 过滤掉有租户特殊配置的订单 - */ - private List filterOrdersWithoutTenantConfig(List orders) { - List tenantConfigs = orderConfig.getAutoCancel().getTenantConfigs(); - if (tenantConfigs == null || tenantConfigs.isEmpty()) { - return orders; - } - - return orders.stream() - .filter(order -> { - // 检查该订单的租户是否有特殊配置 - return tenantConfigs.stream() - .noneMatch(config -> config.isEnabled() && config.getTenantId().equals(order.getTenantId())); - }) - .collect(java.util.stream.Collectors.toList()); - } - - /** - * 手动触发订单自动取消任务(用于测试) - */ - @IgnoreTenant("手动触发的定时任务需要处理所有租户的超时订单") - public void manualCancelExpiredOrders() { - log.info("手动触发订单自动取消任务..."); - cancelExpiredOrders(); - } - - /** - * 获取任务状态信息 - */ - public String getTaskStatus() { - return String.format("订单自动取消任务状态 - 启用: %s, 默认超时: %d分钟, 检查间隔: %d分钟, 批量大小: %d", - orderConfig.getAutoCancel().isEnabled(), - orderConfig.getAutoCancel().getDefaultTimeoutMinutes(), - orderConfig.getAutoCancel().getCheckIntervalMinutes(), - orderConfig.getAutoCancel().getBatchSize()); - } -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/task/RefundStatusQueryTask.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/task/RefundStatusQueryTask.java deleted file mode 100644 index ecce124..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/task/RefundStatusQueryTask.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.gxwebsoft.shop.task; - -import com.gxwebsoft.common.core.annotation.IgnoreTenant; -import com.gxwebsoft.payment.dto.PaymentResponse; -import com.gxwebsoft.payment.enums.PaymentType; -import com.gxwebsoft.payment.exception.PaymentException; -import com.gxwebsoft.payment.service.PaymentService; -import com.gxwebsoft.shop.entity.ShopOrder; -import com.gxwebsoft.shop.service.ShopOrderService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * 退款状态查询定时任务 - * 定期查询处理中的退款订单状态,并更新订单状态 - * - * @author WebSoft - * @since 2025-01-26 - */ -@Slf4j -@Component -@ConditionalOnProperty(prefix = "shop.order.refund-query", name = "enabled", havingValue = "true", matchIfMissing = true) -public class RefundStatusQueryTask { - - @Autowired - private ShopOrderService shopOrderService; - - @Autowired - private PaymentService paymentService; - - /** - * 查询退款状态并更新订单 - * 生产环境:每10分钟执行一次 - * 开发环境:每2分钟执行一次(便于测试) - */ - @Scheduled(cron = "${shop.order.refund-query.cron:0 0/10 * * * ?}") - @IgnoreTenant("定时任务需要处理所有租户的退款订单") - public void queryRefundStatusAndUpdateOrders() { - log.info("开始执行退款状态查询任务..."); - - try { - long startTime = System.currentTimeMillis(); - int totalProcessedCount = 0; - - // 查询所有退款处理中的订单(状态为5) - List refundProcessingOrders = shopOrderService.lambdaQuery() - .eq(ShopOrder::getOrderStatus, 5) - .isNotNull(ShopOrder::getRefundOrder) - .list(); - - if (refundProcessingOrders.isEmpty()) { - log.info("没有找到退款处理中的订单"); - return; - } - - log.info("找到 {} 个退款处理中的订单,开始查询退款状态...", refundProcessingOrders.size()); - - int successCount = 0; - int failedCount = 0; - - for (ShopOrder order : refundProcessingOrders) { - try { - // 查询退款状态 - PaymentResponse response = paymentService.queryRefund( - order.getRefundOrder(), // 退款单号 - PaymentType.WECHAT_NATIVE, // 支付类型(这里假设是微信支付) - order.getTenantId() // 租户ID - ); - - if (response != null) { - // 根据退款状态更新订单 - if (response.getSuccess()) { - // 退款成功 - order.setOrderStatus(6); // 退款成功 - shopOrderService.updateById(order); - log.info("订单 {} 退款成功,更新订单状态为退款成功", order.getOrderNo()); - successCount++; - } else if (response.getPaymentStatus() != null) { - // 根据具体的退款状态处理 - switch (response.getPaymentStatus()) { - case REFUND_FAILED: - // 退款失败 - order.setOrderStatus(5); // 退款被拒绝(保持原状态或根据业务需要调整) - shopOrderService.updateById(order); - log.info("订单 {} 退款失败,更新订单状态", order.getOrderNo()); - failedCount++; - break; - case REFUNDING: - // 仍在退款中,无需处理 - log.debug("订单 {} 仍在退款中", order.getOrderNo()); - break; - default: - log.warn("订单 {} 未知的退款状态: {}", order.getOrderNo(), response.getPaymentStatus()); - break; - } - } - } else { - log.warn("订单 {} 退款状态查询返回空结果", order.getOrderNo()); - } - } catch (PaymentException e) { - log.error("查询订单 {} 退款状态时发生支付异常: {}", order.getOrderNo(), e.getMessage(), e); - failedCount++; - } catch (Exception e) { - log.error("查询订单 {} 退款状态时发生系统异常: {}", order.getOrderNo(), e.getMessage(), e); - failedCount++; - } - } - - long endTime = System.currentTimeMillis(); - long duration = endTime - startTime; - - log.info("退款状态查询任务完成,总处理数量: {},成功: {},失败: {},耗时: {}ms", - refundProcessingOrders.size(), successCount, failedCount, duration); - - } catch (Exception e) { - log.error("退款状态查询任务执行失败", e); - } - } - - /** - * 手动触发退款状态查询任务(用于测试) - */ - @IgnoreTenant("手动触发的定时任务需要处理所有租户的退款订单") - public void manualQueryRefundStatus() { - log.info("手动触发退款状态查询任务..."); - queryRefundStatusAndUpdateOrders(); - } -} \ No newline at end of file diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/vo/MenuVo.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/vo/MenuVo.java deleted file mode 100644 index 5e13bde..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/vo/MenuVo.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.gxwebsoft.shop.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -/** - * 导航信息视图对象 - * 专门用于前端展示,只包含前端需要的字段 - * - * @author WebSoft - * @since 2025-01-12 - */ -@Data -@Schema(description = "导航信息视图对象") -public class MenuVo implements Serializable { - - @Schema(description = "导航ID") - private Integer navigationId; - - @Schema(description = "导航名称") - private String title; - - @Schema(description = "导航类型") - private String model; - - @Schema(description = "唯一标识") - private String code; - - @Schema(description = "路由地址") - private String path; - - @Schema(description = "导航图标") - private String icon; - - @Schema(description = "导航颜色") - private String color; - - @Schema(description = "父级ID") - private Integer parentId; - - @Schema(description = "排序") - private Integer sort; - - @Schema(description = "是否隐藏 0显示 1隐藏") - private Integer hide; - - @Schema(description = "位置 0顶部 1底部") - private Integer top; - - @Schema(description = "打开方式 0当前窗口 1新窗口") - private Integer target; - - @Schema(description = "子导航") - private List children; -} diff --git a/jczxw-java/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java b/jczxw-java/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java deleted file mode 100644 index 69885e7..0000000 --- a/jczxw-java/src/main/java/com/gxwebsoft/shop/vo/ShopVo.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.gxwebsoft.shop.vo; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; - -/** - * 应用信息 - * 专门用于前端展示,只包含前端需要的字段 - * - * @author WebSoft - * @since 2025-01-12 - */ -@Data -@Schema(description = "应用信息视图对象") -public class ShopVo implements Serializable { - - @Schema(description = "站点ID") - private Integer websiteId; - - @Schema(description = "站点名称") - private String websiteName; - - @Schema(description = "站点编号") - private String websiteCode; - - @Schema(description = "应用介绍") - private String description; - - @Schema(description = "网站关键词") - private String keywords; - - @Schema(description = "小程序二维码") - private String mpQrCode; - - @Schema(description = "标题") - private String title; - - @Schema(description = "LOGO") - private String logo; - - @Schema(description = "图标") - private String icon; - - @Schema(description = "域名") - private String domain; - - @Schema(description = "后台管理地址") - private String adminUrl; - - @Schema(description = "API地址") - private String apiUrl; - - @Schema(description = "运行状态 0未开通 1正常 2维护中 3违规关停") - private Integer running; - - @Schema(description = "应用版本 10免费版 20授权版 30永久授权") - private Integer version; - - @Schema(description = "服务到期时间") - private String expirationTime; - - @Schema(description = "创建时间") - private String createTime; - - @Schema(description = "是否到期 -1已过期 1未过期") - private Integer expired; - - @Schema(description = "剩余天数") - private Long expiredDays; - - @Schema(description = "即将过期 0否 1是") - private Integer soon; - - @Schema(description = "状态图标") - private String statusIcon; - - @Schema(description = "状态文本") - private String statusText; - - @Schema(description = "网站配置") - private Object config; - - @Schema(description = "服务器时间信息") - private HashMap serverTime; - - @Schema(description = "顶部导航") - private List topNavs; - - @Schema(description = "底部导航") - private List bottomNavs; - - @Schema(description = "网站设置") - private Object setting; - - @Schema(description = "应用ID") - private Integer appId; - - @Schema(description = "应用名称") - private String appName; - - @Schema(description = "应用编号") - private String appCode; -}