parent
3859feb21d
commit
2b8c8abd5a
|
@ -1,16 +1,12 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.service.impl.ModelVersionServiceImpl;
|
||||
import com.mcwl.resource.service.impl.WorkFlowVersionServiceImpl;
|
||||
import com.mcwl.resource.service.impl.FileServiceImpl;
|
||||
import com.mcwl.web.controller.common.OssUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -30,10 +26,7 @@ import java.util.Map;
|
|||
public class FileController {
|
||||
|
||||
@Autowired
|
||||
private ModelVersionServiceImpl modelVersionService;
|
||||
|
||||
@Autowired
|
||||
private WorkFlowVersionServiceImpl workFlowVersionService;
|
||||
private FileServiceImpl fileService;
|
||||
|
||||
/***
|
||||
*
|
||||
|
@ -102,4 +95,17 @@ public class FileController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据文件名查找是否存在
|
||||
* @param name
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectFileName")
|
||||
@ApiOperation(value = "根据文件名查找是否存在")
|
||||
public AjaxResult selectFileName(@RequestParam String name,String type){
|
||||
|
||||
return fileService.selectFileName(name,type);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -147,4 +147,19 @@ public class ModelProduct extends BaseEntity {
|
|||
private List<String> styleList;
|
||||
|
||||
|
||||
/**
|
||||
* 是否关注 0未关注 1关注
|
||||
*/
|
||||
@ApiModelProperty(value = "是否关注 0未关注 1关注")
|
||||
@TableField(exist = false)
|
||||
private Integer isAttention;
|
||||
|
||||
|
||||
/**
|
||||
* 是否点赞 0未点赞 1点赞
|
||||
*/
|
||||
@ApiModelProperty(value = "是否点赞 0未点赞 1点赞")
|
||||
@TableField(exist = false)
|
||||
private Integer isLike;
|
||||
|
||||
}
|
||||
|
|
|
@ -149,6 +149,14 @@ public class ModelVersion extends BaseEntity {
|
|||
*/
|
||||
@ApiModelProperty(value = "是否隐藏图片生成信息")
|
||||
private Integer hideImageGenInfo;
|
||||
|
||||
/**
|
||||
* 文件解密秘钥
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "文件解密秘钥")
|
||||
private String keyRate;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
|
@ -170,4 +178,5 @@ public class ModelVersion extends BaseEntity {
|
|||
@TableField(exist = false)
|
||||
private ArrayList<String> highList;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
@ -83,4 +84,11 @@ public class WorkFlowVersion {
|
|||
*/
|
||||
@ApiModelProperty("文件名字")
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 解密文件秘钥
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty("解密文件秘钥")
|
||||
private String keyRate;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.mcwl.resource.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelLike;
|
||||
import com.mcwl.resource.domain.WorkFlowLike;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -18,4 +19,7 @@ public interface ModelLikeMapper extends BaseMapper<ModelLike> {
|
|||
ModelLike getLike(@Param("userId") Long userId, @Param("modelId") Long modelId);
|
||||
|
||||
void updateDelFlagById(ModelLike modelLike);
|
||||
|
||||
WorkFlowLike selectModelLikeById(@Param("userId") Long userId, @Param("id") Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -22,4 +22,6 @@ public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
|||
|
||||
void updateByName(ModelVersion modelVersion);
|
||||
|
||||
ModelVersion selectByFileName(@Param("name") String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public interface WorkFlowVersionMapper extends BaseMapper<WorkFlowVersion> {
|
|||
|
||||
void updateByName(WorkFlowVersion workFlowVersion);
|
||||
|
||||
WorkFlowVersion selectByFileName(@Param("name") String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* @author DaiZibo
|
||||
* @date 2025/2/14
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public interface FileService {
|
||||
AjaxResult selectFileName(String name, String type);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||
import com.mcwl.resource.mapper.WorkFlowVersionMapper;
|
||||
import com.mcwl.resource.service.FileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author DaiZibo
|
||||
* @date 2025/2/14
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class FileServiceImpl implements FileService {
|
||||
|
||||
@Autowired
|
||||
private ModelVersionMapper versionMapper;
|
||||
|
||||
@Autowired
|
||||
private WorkFlowVersionMapper workFlowVersionMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult selectFileName(String name, String type) {
|
||||
|
||||
if (type.equals("model")) {
|
||||
|
||||
ModelVersion modelVersion = versionMapper.selectByFileName(name);
|
||||
if (modelVersion == null) {
|
||||
|
||||
return AjaxResult.error("文件不存在");
|
||||
}
|
||||
|
||||
return AjaxResult.success(modelVersion.getKeyRate());
|
||||
}else if (type.equals("work")){
|
||||
WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name);
|
||||
if (workFlowVersion == null) {
|
||||
|
||||
return AjaxResult.error("文件不存在");
|
||||
}
|
||||
|
||||
return AjaxResult.success(workFlowVersion.getKeyRate());
|
||||
}
|
||||
|
||||
return AjaxResult.error("type不合法");
|
||||
}
|
||||
}
|
|
@ -76,7 +76,7 @@ public class ModelLikeServiceImpl extends ServiceImpl<ModelLikeMapper, ModelLike
|
|||
baseMapper.insert(modelLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
model.setNumbers(model.getNumbers() + 1);
|
||||
model.setNumbers(model.getLikeNum() + 1);
|
||||
modelMapper.updateById(model);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.DictConstants;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
|
@ -20,12 +19,16 @@ import com.mcwl.common.utils.StringUtils;
|
|||
import com.mcwl.common.utils.baidu.BaiduCensor;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.ModelVersion;
|
||||
import com.mcwl.resource.domain.SysUserAttention;
|
||||
import com.mcwl.resource.domain.WorkFlowLike;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.request.RequestModel;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.domain.vo.ModelVo;
|
||||
import com.mcwl.resource.mapper.ModelLikeMapper;
|
||||
import com.mcwl.resource.mapper.ModelMapper;
|
||||
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||
import com.mcwl.resource.mapper.SysUserAttentionMapper;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.resource.service.ToActivityService;
|
||||
import com.mcwl.system.init.DictInit;
|
||||
|
@ -67,6 +70,12 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
@Autowired
|
||||
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
||||
|
||||
@Autowired
|
||||
private SysUserAttentionMapper sysUserAttentionMapper;
|
||||
|
||||
@Autowired
|
||||
private ModelLikeMapper modelLikeMapper;
|
||||
|
||||
/**
|
||||
* 设置模型置顶状态
|
||||
*
|
||||
|
@ -460,6 +469,18 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
|
|||
modelProduct.setActivityId(toActivityService.getById(modelProduct.getActivityId()).getActivityName());
|
||||
}
|
||||
|
||||
modelProduct.setIsAttention(1);
|
||||
SysUserAttention sysUserAttention = sysUserAttentionMapper.selectAttention(SecurityUtils.getUserId(), modelProduct.getUserId());
|
||||
if (sysUserAttention == null){
|
||||
modelProduct.setIsAttention(0);
|
||||
}
|
||||
|
||||
WorkFlowLike workFlowLike = modelLikeMapper.selectModelLikeById(SecurityUtils.getUserId(),modelProduct.getId());
|
||||
modelProduct.setIsLike(1);
|
||||
if (workFlowLike == null){
|
||||
modelProduct.setIsLike(0);
|
||||
}
|
||||
|
||||
return R.ok(modelProduct);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,4 +23,8 @@
|
|||
from model_like
|
||||
where user_id = #{userId} and model_id = #{modelId}
|
||||
</select>
|
||||
|
||||
<select id="selectModelLikeById" resultType="com.mcwl.resource.domain.WorkFlowLike">
|
||||
select * from model_like where user_id = #{userId} and model_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -31,4 +31,8 @@
|
|||
where version_name = #{versionName} and model_id = #{modelId}
|
||||
</update>
|
||||
|
||||
<select id="selectByFileName" resultType="com.mcwl.resource.domain.ModelVersion">
|
||||
select key_rate from model_version where file_name = #{name}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -22,4 +22,8 @@
|
|||
audit_text = #{auditText}
|
||||
where version_name = #{versionName} and work_flow_id = #{workFlowId}
|
||||
</update>
|
||||
|
||||
<select id="selectByFileName" resultType="com.mcwl.resource.domain.WorkFlowVersion">
|
||||
select key_rate from work_flow_version where file_name = #{name}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue