Compare commits

..

No commits in common. "7b0c1f6fbf47ac3f4d45cb227de6ec27b7cd7c85" and "b2a3596f20418526b86263e526d1de9ba577ed4b" have entirely different histories.

25 changed files with 258 additions and 246 deletions

View File

@ -5,16 +5,17 @@ import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.communityCenter.domain.dto.CommentDelRes;
import com.mcwl.communityCenter.domain.dto.CommentDetailRes;
import com.mcwl.communityCenter.domain.dto.CommentRes;
import com.mcwl.communityCenter.domain.vo.CommentVo;
import com.mcwl.communityCenter.domain.PublishComment;
import com.mcwl.communityCenter.service.PublishCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
*

View File

@ -18,12 +18,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
@ -155,40 +152,6 @@ public class MallProductController extends BaseController {
return modelService.selectModelById(id);
}
/**
*
* @param id
* @param isTop
* @return
*/
@PutMapping("/{id}/top")
public ResponseEntity<ModelProduct> setModelTop(@PathVariable Long id, @RequestParam boolean isTop) {
try {
modelService.setModelTop(id, isTop);
return ResponseEntity.ok().build();
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
/**
*
* @return
*/
@GetMapping
public ResponseEntity<List<ModelProduct>> fetchModelsSortedByTopStatus() {
List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus();
return ResponseEntity.ok(models);
}
/**
* -
*/
@ -256,6 +219,4 @@ public class MallProductController extends BaseController {
}
}

View File

@ -8,7 +8,6 @@ import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.dto.ModelImageRes;
import com.mcwl.resource.domain.vo.ModelImageVo;
@ -18,11 +17,9 @@ import com.mcwl.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
@ -105,25 +102,5 @@ public class ModelImageController {
}
@PutMapping("/{id}/top")
public ResponseEntity<ModelImage> setModelImageTop(@PathVariable Long id, @RequestParam boolean isTop) {
try {
modelImageLikeService.setModelImageTop(id, isTop);
return ResponseEntity.ok().build();
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
/**
*
* @return
*/
@GetMapping
public ResponseEntity<List<ModelImage>> fetchModelImagesSortedByTopStatus() {
List<ModelImage> models = modelImageLikeService.fetchModelImageSortedByTopStatus();
return ResponseEntity.ok(models);
}
}

View File

@ -2,8 +2,6 @@ package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.WorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.impl.WorkFlowServiceImpl;
@ -11,12 +9,9 @@ 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.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
@ -36,36 +31,6 @@ public class WorkFlowController extends BaseController {
@Autowired
private WorkFlowServiceImpl workFlowService;
/**
*
* @param id
* @param isTop
* @return
*/
@PutMapping("/{id}/top")
public ResponseEntity<WorkFlow> setworkFlowTop(@PathVariable Long id, @RequestParam boolean isTop) {
try {
workFlowService.setworkFlowTop(id, isTop);
return ResponseEntity.ok().build();
} catch (Exception e) {
return ResponseEntity.badRequest().build();
}
}
/**
*
* @return
*/
@GetMapping
public ResponseEntity<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() {
List<WorkFlow> models = workFlowService.fetchWorkFlowSortedByTopStatus();
return ResponseEntity.ok(models);
}
/***
*
* @param file

View File

@ -0,0 +1,53 @@
///*
// * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
// *
// * https://www.mall4j.com/
// *
// * 未经允许,不可做商业用途!
// *
// * 版权所有,侵权必究!
// */
//package com.mcwl.common.i18n;
//
//
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.context.i18n.LocaleContextHolder;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.*;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.Locale;
//import java.util.Objects;
//
///**
// * RequestContextFilter 会传入默认的Locale优先级(-105) 要比RequestContextFilter优先级高
// * @author LGH
// */
//@Slf4j
//@Component
//@Order(-104)
//public class YamiLocaleChangeFilter implements Filter {
//
// public static String ZH_CN = "zh_CN";
// public static String ZH_CN_L = "zh_cn";
//
// @Override
// public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
// HttpServletRequest request = (HttpServletRequest) servletRequest;
// HttpServletResponse response = (HttpServletResponse) servletResponse;
//
// String newLocale = request.getHeader("locale");
// if(Objects.equals(newLocale,ZH_CN)||Objects.equals(newLocale,ZH_CN_L)){
// newLocale = "zh";
// }
// if (newLocale != null) {
// String lowerLocale = newLocale.toLowerCase();
// LocaleContextHolder.setLocale(new Locale(lowerLocale));
// }
// filterChain.doFilter(request, response);
// }
//}

View File

@ -0,0 +1,58 @@
///*
// * Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
// *
// * https://www.mall4j.com/
// *
// * 未经允许,不可做商业用途!
// *
// * 版权所有,侵权必究!
// */
//package com.mcwl.common.i18n;
//
//
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.LocaleResolver;
//import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
//import org.springframework.web.servlet.support.RequestContextUtils;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
///**
// * @author LGH
// */
//@Component("localeChangeInterceptor")
//@Slf4j
//public class YamiLocaleChangeInterceptor extends LocaleChangeInterceptor {
//
// @Override
// public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
//
// String newLocale = request.getHeader(getParamName());
// if (newLocale != null) {
// LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
// if (localeResolver == null) {
// throw new IllegalStateException(
// "No LocaleResolver found: not in a DispatcherServlet request?");
// }
// try {
// localeResolver.setLocale(request, response, parseLocaleValue(newLocale));
// }
// catch (IllegalArgumentException ex) {
// if (isIgnoreInvalidLocale()) {
// if (logger.isDebugEnabled()) {
// logger.debug("Ignoring invalid locale value [" + newLocale + "]: " + ex.getMessage());
// }
// }
// else {
// throw ex;
// }
// }
// }
// // Proceed in any case.
// return true;
// }
//
//}

View File

@ -109,11 +109,4 @@ public class ModelImage extends BaseEntity {
*/
@ApiModelProperty(value = "是否置顶")
private Integer isTop;
/**
* 1 2
*/
@ApiModelProperty(value = "审核1公开 2自见")
private Integer jurisdiction;
}

View File

@ -123,19 +123,6 @@ public class ModelProduct extends BaseEntity {
*/
@ApiModelProperty(value = "是否推荐模型")
private Integer isRecommend;
/**
*
*/
@ApiModelProperty(value = "是否置顶")
private Integer isTop;
/**
* 1 2
*/
@ApiModelProperty(value = "审核1公开 2自见")
private Integer jurisdiction;
/**
* 0 2
*/

View File

@ -147,12 +147,6 @@ public class WorkFlow {
@ApiModelProperty(value = "审核权限")
private Integer jurisdiction;
/**
*
*/
@ApiModelProperty(value = "是否置顶")
private Integer isTop;
/**
*
*/

View File

@ -5,15 +5,7 @@ import com.mcwl.resource.domain.ModelImage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ModelImageMapper extends BaseMapper<ModelImage> {
Long sumLikeNumber(@Param("userId") Long userId);
List<ModelImage> fetchModelImageSortedByTopStatus();
void setModelImageTop(@Param("id") Long id, @Param("isTop") int i);
}

View File

@ -6,8 +6,6 @@ import com.mcwl.resource.domain.ModelProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
@ -29,11 +27,4 @@ public interface ModelMapper extends BaseMapper<ModelProduct> {
Long sumLikeNumber(@Param("userId") Long userId);
Long sumRunNumber(Long userId);
void updateTopStatus(@Param("id") Long id, @Param("isTop") int i);
List<ModelProduct> selectAllModelsSortedByTopStatus();
}

View File

@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.WorkFlow;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
*
* @author DaiZibo
@ -18,7 +16,4 @@ public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
void updateWorkFlow(WorkFlow workFlow);
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
}

View File

@ -4,17 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageLike;
import java.util.List;
public interface ModelImageLikeService extends IService<ModelImageLike> {
void like(Long imageId);
void setModelImageTop(Long id, boolean isTop);
List<ModelImage> fetchModelImageSortedByTopStatus();
}

View File

@ -39,8 +39,4 @@ public interface ModelImageService extends IService<ModelImage> {
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
ModelImageVo getDetail(@NotNull(message = "图片id不能为空") Long imageId);
}

View File

@ -36,10 +36,4 @@ public interface ModelService extends IService<ModelProduct> {
AjaxResult selectModelById(Long id);
void setModelTop(Long id, boolean isTop);
List<ModelProduct> fetchModelsSortedByTopStatus();
}

View File

@ -8,8 +8,6 @@ import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
import java.util.List;
/**
*
* @author DaiZibo
@ -31,9 +29,4 @@ public interface WorkFlowService extends IService<WorkFlow> {
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
void setworkFlowTop(Long id, boolean isTop);
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
}

View File

@ -46,27 +46,19 @@ public class ModelCommentServiceImpl extends ServiceImpl<ModelCommentMapper, Mod
@Override
public void comment(ModelComment modelComment) {
Long parentId = modelComment.getParentId();
ModelComment mic = modelCommentMapper.selectById(parentId);
if (Objects.nonNull(parentId)) {
ModelComment mic = modelCommentMapper.selectById(parentId);
if (Objects.isNull(mic)) {
return;
}
if (Objects.nonNull(parentId) && Objects.isNull(mic)) {
return;
}
modelComment.setUserId(SecurityUtils.getUserId());
modelComment.setCreateBy(SecurityUtils.getUsername());
modelComment.setCreateTime(new Date());
modelComment.setUpdateBy(SecurityUtils.getUsername());
modelComment.setUpdateTime(new Date());
modelCommentMapper.insert(modelComment);
}
/**
*
*
* @param imageId id
* @return
*/
@Override
public List<ModelCommentVo> getComment(Long imageId) {
List<ModelCommentVo> modelCommentVoList = new ArrayList<>();

View File

@ -15,7 +15,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service
@ -59,14 +58,4 @@ public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper,
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
modelImageMapper.updateById(modelImage);
}
@Override
public void setModelImageTop(Long id, boolean isTop) {
modelImageMapper.setModelImageTop(id,isTop?0:1);
}
@Override
public List<ModelImage> fetchModelImageSortedByTopStatus() {
return modelImageMapper.fetchModelImageSortedByTopStatus();
}
}

View File

@ -15,7 +15,6 @@ import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.dto.ModelImageRes;
@ -156,4 +155,5 @@ public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelIm
}
}

View File

@ -66,27 +66,7 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
/**
*
*
* @param modelId ID
* @param isTop
*/
@Override
public void setModelTop(Long id, boolean isTop) {
postMapper.updateTopStatus(id, isTop ? 1 : 0);
}
/**
*
*
* @param
* @return
*/
@Override
public List<ModelProduct> fetchModelsSortedByTopStatus() {
return postMapper.selectAllModelsSortedByTopStatus();
}
@Override
public Page<ModelProduct> selectByUserId(MallProductVo mallProductVo) {
@ -196,6 +176,143 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
return AjaxResult.success("添加成功,等待审核");
}
private void audit(RequestModel requestModel) {
// 执行审核操作
threadPoolTaskExecutor.submit(() -> {
ModelProduct modelProduct = requestModel.getModelProduct();
if (modelProduct != null){
if (modelProduct.getModelName() != null){
//审核名称
String s = BaiduCensor.TextCensor(modelProduct.getModelName()+","+modelProduct.getTags());
// 解析 JSON 字符串
JSONObject jsonObject = JSONObject.parseObject(s);
// 获取 'conclusion' 字段的值
String conclusion = jsonObject.getString("conclusion");
if (conclusion.equals("不合规")) {
//更改状态,添加原因 -> 结束任务
// 获取 'data' 数组
JSONArray dataArray = jsonObject.getJSONArray("data");
// 存储所有的失败原因
List<String> failureReasons = new ArrayList<>();
// 遍历 'data' 数组中的每个元素
for (Object itemObj : dataArray) {
JSONObject item = (JSONObject) itemObj;
String msg = item.getString("msg");
failureReasons.add(msg);
}
// 使用逗号拼接所有的失败原因
String concatenatedReasons = String.join(", ", failureReasons);
modelProduct.setAuditText(concatenatedReasons);
//修改状态以及失败原因
modelProduct.setAuditStatus(4);
baseMapper.updateById(modelProduct);
log.info("模型审核未通过");
//结束任务
return;
}
//修改为合格
modelProduct.setAuditText("");
modelProduct.setAuditStatus(modelProduct.getJurisdiction());
baseMapper.updateById(modelProduct);
}
}
List<ModelVersion> modelVersionList = requestModel.getModelVersionList();
if (modelVersionList != null){
//审核版本
for (ModelVersion modelVersion : modelVersionList) {
modelVersion.setModelId(modelProduct.getId());
//版本名称
String s1 = BaiduCensor.TextCensor(modelVersion.getVersionName() + "," +
modelVersion.getVersionDescription()+","+modelVersion.getTriggerWords());
// 解析 JSON 字符串
JSONObject jsonObject1 = JSONObject.parseObject(s1);
// 获取 'conclusion' 字段的值
String conclusion1 = jsonObject1.getString("conclusion");
if (conclusion1.equals("不合规")) {
//更改版本状态->跳出循环 审核下一个版本
// 获取 'data' 数组
JSONArray dataArray1 = jsonObject1.getJSONArray("data");
// 存储所有的失败原因
List<String> failureReasons = new ArrayList<>();
// 遍历 'data' 数组中的每个元素
for (Object itemObj : dataArray1) {
JSONObject item = (JSONObject) itemObj;
String msg = item.getString("msg");
failureReasons.add(msg);
}
// 使用逗号拼接所有的失败原因
String concatenatedReasons = String.join(", ", failureReasons);
modelVersion.setAuditText(concatenatedReasons);
modelVersion.setAuditStatus(4);
//校验id是否存在 区别修改审核或者新增审核
if (modelVersion.getId() != null){
modelVersionMapper.updateById(modelVersion);
}else {
modelVersionMapper.updateByName(modelVersion);
}
log.info("版本审核未通过");
continue;
}
//审核版本图片
String[] split = modelVersion.getFilePath().split(",");
for (String path : split) {
String s2 = BaiduCensor.ImageCnesor(path);
JSONObject jsonObject2 = JSONObject.parseObject(s2);
if (jsonObject2.getString("conclusion").equals("不合规")) {
//修改状态->跳出循环 判断下一个版本
// 获取 'data' 数组
JSONArray dataArray2 = jsonObject2.getJSONArray("data");
// 存储所有的失败原因
List<String> failureReasons = new ArrayList<>();
// 遍历 'data' 数组中的每个元素
for (Object itemObj : dataArray2) {
JSONObject item = (JSONObject) itemObj;
String msg = item.getString("msg");
failureReasons.add(msg);
}
// 使用逗号拼接所有的失败原因
String concatenatedReasons = String.join(", ", failureReasons);
modelVersion.setAuditText(concatenatedReasons);
modelVersion.setAuditStatus(4);
//校验id是否存在 区别修改审核或者新增审核
if (modelVersion.getId() != null){
modelVersionMapper.updateById(modelVersion);
}else {
modelVersionMapper.updateByName(modelVersion);
}
modelVersionMapper.updateByName(modelVersion);
log.info("图片审核未通过");
break;
}
}
//修改版本成功审核状态
modelProduct.setAuditText("");
modelVersion.setAuditStatus(1);
modelVersionMapper.updateByName(modelVersion);
log.info("全部通过审核");
}
}
});
}
@Override
public void updaModel(RequestModel requestModel) {
//修改模版的信息
@ -267,6 +384,4 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
}
}

View File

@ -388,15 +388,5 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
}
@Override
public void setworkFlowTop(Long id, boolean isTop) {
flowMapper.setworkFlowTop(id,isTop?0:1);
}
@Override
public List<WorkFlow> fetchWorkFlowSortedByTopStatus() {
return flowMapper.fetchWorkFlowSortedByTopStatus();
}
}

View File

@ -3,12 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.resource.mapper.ModelImageMapper">
<update id="setModelImageTop">
UPDATE model_image SET is_top = #{isTop} WHERE image_id = #{imageId}
</update>
<update id="fetchModelImageSortedByTopStatus">
SELECT is_top FROM model_image ORDER BY is_top DESC;
</update>
<select id="sumLikeNumber" resultType="java.lang.Long">
SELECT sum(like_num)sum FROM model_image where user_id = #{userId} ORDER BY(user_id);

View File

@ -69,9 +69,6 @@
</set>
where id = #{id}
</update>
<update id="updateTopStatus">
update model set is_top = #{isTop} where id = #{id}
</update>
<select id="sumNumber" resultType="java.lang.Long">
@ -84,8 +81,5 @@
<select id="sumRunNumber" resultType="java.lang.Long">
SELECT sum(reals)sum FROM model where user_id = #{userId} ORDER BY(user_id);
</select>
<select id="selectAllModelsSortedByTopStatus" resultType="com.mcwl.resource.domain.ModelProduct">
SELECT is_top FROM model ORDER BY is_top DESC;
</select>
</mapper>

View File

@ -31,7 +31,4 @@
</set>
WHERE id = #{id}
</update>
<select id="fetchWorkFlowSortedByTopStatus" resultType="com.mcwl.resource.domain.WorkFlow">
SELECT is_top FROM work_flow ORDER BY is_top DESC;
</select>
</mapper>