From f6ed1d4982d3d3334174d709bb44c494ca447448 Mon Sep 17 00:00:00 2001 From: Diyu0904 <1819728964@qq.com> Date: Fri, 28 Mar 2025 14:44:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=B8=BAPOST=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/DownloadRecordController.java | 3 +- .../controller/system/SysLoginController.java | 5 +- mcwl-common/pom.xml | 14 +++ .../mcwl/framework/config/SecurityConfig.java | 3 +- .../mcwl/resource/domain/DownloadRecord.java | 3 + .../mcwl/resource/domain/ModelProduct.java | 6 ++ .../impl/DownloadRecordServiceImpl.java | 91 +++++++++---------- .../service/impl/FileServiceImpl.java | 13 +-- .../service/impl/SysUserServiceImpl.java | 10 +- 9 files changed, 86 insertions(+), 62 deletions(-) diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java index 49183dc..5ae1dda 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/DownloadRecordController.java @@ -6,7 +6,6 @@ import com.mcwl.resource.domain.request.RequestDownload; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.service.impl.DownloadRecordServiceImpl; import io.swagger.annotations.Api; -import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -79,7 +78,7 @@ public class DownloadRecordController { return downloadRecordService.deleteDownloadRecord(ids); } - @ApiModelProperty(value = "根据文件名查询详情") + @ApiOperation(value = "根据文件名查询详情") @PostMapping("/selectFileByName") public R selectByFileName(@RequestBody RequestDownload requestDownload){ diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysLoginController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysLoginController.java index 5d49c89..11959fe 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysLoginController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/system/SysLoginController.java @@ -3,6 +3,7 @@ package com.mcwl.web.controller.system; import com.alibaba.fastjson2.JSONObject; import com.mcwl.common.annotation.Anonymous; import com.mcwl.common.constant.Constants; +import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.QueueConstants; import com.mcwl.common.constant.RedisConstants; import com.mcwl.common.core.domain.AjaxResult; @@ -60,13 +61,13 @@ public class SysLoginController public AjaxResult code(@RequestParam String phone){ if (StringUtils.isEmpty(phone)){ - return AjaxResult.error("请输入手机号"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请输入手机号"); } //校验验证码是否存在 if (redisCache.hasKey(RedisConstants.CODE_PHONE+phone)){ - return AjaxResult.error("请勿重复发送"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请勿重复发送"); } //生成验证码 diff --git a/mcwl-common/pom.xml b/mcwl-common/pom.xml index 76a0c9d..eb9195a 100644 --- a/mcwl-common/pom.xml +++ b/mcwl-common/pom.xml @@ -408,6 +408,20 @@ spring-boot-starter-websocket + + + + + + + + + + + + + + diff --git a/mcwl-framework/src/main/java/com/mcwl/framework/config/SecurityConfig.java b/mcwl-framework/src/main/java/com/mcwl/framework/config/SecurityConfig.java index f181d48..d9c0900 100644 --- a/mcwl-framework/src/main/java/com/mcwl/framework/config/SecurityConfig.java +++ b/mcwl-framework/src/main/java/com/mcwl/framework/config/SecurityConfig.java @@ -165,7 +165,8 @@ public class SecurityConfig { "/personalCenter/selectByUserIdImage", "/personalCenter/likeModel", "/personalCenter/likeWorkFlow", - "/personalCenter/likeImage" + "/personalCenter/likeImage", + "/api/ucenter/wx/**" ).permitAll() // 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll() diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java index 5ae7718..77544db 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/DownloadRecord.java @@ -104,4 +104,7 @@ public class DownloadRecord { @ApiModelProperty(value = "下载类型(0模型 1工作流)") private Integer downloadType; + @ApiModelProperty(value = "触发词") + private String triggerWords; + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java index d55e3ea..92d80a6 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelProduct.java @@ -135,6 +135,12 @@ public class ModelProduct extends BaseEntity { @ApiModelProperty(value = "删除标志(0代表存在 2代表删除)") private String delFlag; + /** + * 是否收费 + */ + @ApiModelProperty(value = "是否收费 0收费 1免费") + private Integer isFree; + /** * 商品价格 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java index 9d57c01..7f0ca1b 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/DownloadRecordServiceImpl.java @@ -2,18 +2,15 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.R; -import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.StringUtils; -import com.mcwl.resource.domain.*; +import com.mcwl.resource.domain.DownloadRecord; import com.mcwl.resource.domain.request.RequestDownload; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.*; import com.mcwl.resource.service.DownloadRecordService; -import com.mcwl.system.init.DictInit; import com.mcwl.system.mapper.SysUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -59,43 +56,43 @@ public class DownloadRecordServiceImpl implements DownloadRecordService { downloadRecord.setUserId(SecurityUtils.getUserId()); downloadRecord.setCreateTime(new Date()); - //获取作品信息 - if (downloadRecord.getProductType() == 0){ - - //查询文件/名称信息 - ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId()); - downloadRecord.setFileName(modelVersion.getFileName()); - downloadRecord.setFileSize(modelVersion.getFileSize()); - downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+""); - - //根据版本查找封面信息 - ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId()); - downloadRecord.setCover(modelProduct.getSurfaceUrl()); - downloadRecord.setProductName(modelProduct.getModelName()); - - //查询作者信息 - SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId()); - downloadRecord.setAuthorName(sysUser.getNickName()); - - }else { - - //查询文件/名称信息 - WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId()); - downloadRecord.setFileName(workFlowVersion.getFileName()); - downloadRecord.setFileSize(workFlowVersion.getFileSize()); - - - //根据版本查找封面信息 - WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId()); - downloadRecord.setCover(workFlow.getCoverPath()); - downloadRecord.setProductName(workFlow.getWorkflowName()); - - - //查询作者信息 - SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId()); - downloadRecord.setAuthorName(sysUser.getNickName()); - - } +// //获取作品信息 +// if (downloadRecord.getProductType() == 0){ +// +// //查询文件/名称信息 +// ModelVersion modelVersion = modelVersionMapper.selectById(downloadRecord.getProductId()); +// downloadRecord.setFileName(modelVersion.getFileName()); +// downloadRecord.setFileSize(modelVersion.getFileSize()); +// downloadRecord.setModelVersionType(modelVersion.getModelVersionType()+""); +// +// //根据版本查找封面信息 +// ModelProduct modelProduct = modelMapper.selectById(modelVersion.getModelId()); +// downloadRecord.setCover(modelProduct.getSurfaceUrl()); +// downloadRecord.setProductName(modelProduct.getModelName()); +// +// //查询作者信息 +// SysUser sysUser = sysUserMapper.selectUserById(modelProduct.getUserId()); +// downloadRecord.setAuthorName(sysUser.getNickName()); +// +// }else { +// +// //查询文件/名称信息 +// WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectById(downloadRecord.getProductId()); +// downloadRecord.setFileName(workFlowVersion.getFileName()); +// downloadRecord.setFileSize(workFlowVersion.getFileSize()); +// +// +// //根据版本查找封面信息 +// WorkFlow workFlow = workFlowMapper.selectById(workFlowVersion.getWorkFlowId()); +// downloadRecord.setCover(workFlow.getCoverPath()); +// downloadRecord.setProductName(workFlow.getWorkflowName()); +// +// +// //查询作者信息 +// SysUser sysUser = sysUserMapper.selectUserById(workFlow.getUserId()); +// downloadRecord.setAuthorName(sysUser.getNickName()); +// +// } downloadRecordMapper.insert(downloadRecord); @@ -172,12 +169,12 @@ public class DownloadRecordServiceImpl implements DownloadRecordService { } List downloadRecords = downloadRecordMapper.selectList(wrapper); - if (requestDownload.getType() != 999){ - //翻译底模 - for (DownloadRecord downloadRecord : downloadRecords) { - downloadRecord.setModelVersionType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,downloadRecord.getModelVersionType())); - } - } +// if (requestDownload.getType() != 999){ +// //翻译底模 +// for (DownloadRecord downloadRecord : downloadRecords) { +// downloadRecord.setModelVersionType(DictInit.getDictValue(DictConstants.MODE_VERSION_TYPE,downloadRecord.getModelVersionType())); +// } +// } return R.ok(downloadRecords); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java index 02ee8ae..efdf2c8 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java @@ -1,5 +1,6 @@ package com.mcwl.resource.service.impl; +import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.StringUtils; @@ -33,7 +34,7 @@ public class FileServiceImpl implements FileService { if (StringUtils.isEmpty(type)){ - return AjaxResult.error("请输入type"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请输入type"); } if (type.equals("model")) { @@ -41,7 +42,7 @@ public class FileServiceImpl implements FileService { ModelVersion modelVersion = versionMapper.selectByEncryptionFileName(name); if (modelVersion == null) { - return AjaxResult.error("文件不存在"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件不存在"); } return AjaxResult.success(modelVersion); @@ -49,13 +50,13 @@ public class FileServiceImpl implements FileService { WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name); if (workFlowVersion == null) { - return AjaxResult.error("文件不存在"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"文件不存在"); } return AjaxResult.success(workFlowVersion); } - return AjaxResult.error("type不合法"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"type不合法"); } @Override @@ -63,7 +64,7 @@ public class FileServiceImpl implements FileService { if (StringUtils.isEmpty(type)){ - return AjaxResult.error("请输入type"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请输入type"); } if (type.equals("model")) { @@ -84,7 +85,7 @@ public class FileServiceImpl implements FileService { return AjaxResult.success(1); } - return AjaxResult.error("type不合法"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"type不合法"); } diff --git a/mcwl-system/src/main/java/com/mcwl/system/service/impl/SysUserServiceImpl.java b/mcwl-system/src/main/java/com/mcwl/system/service/impl/SysUserServiceImpl.java index 037e35d..a38ab1a 100644 --- a/mcwl-system/src/main/java/com/mcwl/system/service/impl/SysUserServiceImpl.java +++ b/mcwl-system/src/main/java/com/mcwl/system/service/impl/SysUserServiceImpl.java @@ -3,6 +3,7 @@ package com.mcwl.system.service.impl; import com.alibaba.fastjson2.JSONObject; import com.mcwl.common.annotation.DataScope; import com.mcwl.common.constant.CacheConstants; +import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.constant.UserConstants; import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.entity.SysRole; @@ -639,7 +640,7 @@ public class SysUserServiceImpl implements ISysUserService if (3<=s){ - return AjaxResult.error("次数上限"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"次数上限"); }else { //次数+1 s++; @@ -653,7 +654,7 @@ public class SysUserServiceImpl implements ISysUserService //查看身份证是否唯一 SysUser user = userMapper.selectByIdCard(sysUser.getIdCard()); if (user != null){ - return AjaxResult.error("该信息已绑定"); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"该信息已绑定"); } //校验 String s1 = VerifyCard.idCard(sysUser.getName(), sysUser.getIdCard()); @@ -661,12 +662,13 @@ public class SysUserServiceImpl implements ISysUserService Integer code = jsonObject.getInteger("code"); if (code != 200){ - return AjaxResult.error(jsonObject.getString("msg")); + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,jsonObject.getString("msg")); } JSONObject data = jsonObject.getJSONObject("data"); String desc = data.getString("desc"); if (desc.equals("不一致")){ - return AjaxResult.error("请填写正确信息"); + + return AjaxResult.error(HttpStatus.SHOW_ERROR_MSG,"请填写正确信息"); } log.info("实名认证校验的结果:{}",s1); //修改数据库