Merge branch 'feature/admin' into preview

# Conflicts:
#	mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java
#	mcwl-system/src/main/java/com/mcwl/system/mapper/SysUserMapper.java
#	mcwl-system/src/main/resources/mapper/system/SysUserMapper.xml
master
Diyu0904 2025-02-12 13:20:19 +08:00
commit 7c3621ac2d
19 changed files with 480 additions and 258 deletions

View File

@ -0,0 +1,105 @@
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.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.multipart.MultipartFile;
import java.util.HashMap;
import java.util.Map;
/**
* /
*
* @author DaiZibo
* @date 2025/2/10
* @apiNote
*/
@Api(tags = "上传文件")
@RestController
@RequestMapping("/file")
public class FileController {
@Autowired
private ModelVersionServiceImpl modelVersionService;
@Autowired
private WorkFlowVersionServiceImpl workFlowVersionService;
/***
*
*
* @param file
* @return
*/
@ApiOperation("上传图片")
@PostMapping("/imgUpload")
public AjaxResult imgUpload(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
String fileName = file.getOriginalFilename();
Map<String, String> map = new HashMap<>();
map.put("fileName", fileName);
map.put("url", s);
return AjaxResult.success(map);
}
/***
*
*
* @param file
* @return
*/
@ApiOperation("上传文件")
@PostMapping("/fileUpload")
public AjaxResult fileUpload(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
String fileName = file.getOriginalFilename();
Map<String, String> map = new HashMap<>();
map.put("fileName", fileName);
map.put("url", s);
return AjaxResult.success(map);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "zip")
@PostMapping("/zipUrlFile")
public AjaxResult zipUrlFile(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "zip")
@PostMapping("/zipUrl")
public AjaxResult zipUrl(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
}

View File

@ -1,30 +1,23 @@
package com.mcwl.web.controller.resource;
import com.mcwl.common.annotation.Anonymous;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.PageDomain;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.domain.IdsParam;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImagePageRes;
import com.mcwl.resource.domain.request.RequestModel;
import com.mcwl.resource.service.*;
import com.mcwl.web.controller.common.OssUtil;
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 javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -62,56 +55,6 @@ public class MallProductController extends BaseController {
private ModelImageLikeService modelImageLikeService;
/***
*
*
* @param file
* @return
*/
@ApiModelProperty("图片")
@Anonymous
@PostMapping("/file")
public AjaxResult Malifile(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
String fileName = file.getOriginalFilename();
Map<String, String> map = new HashMap<>();
map.put("fileName", fileName);
map.put("url", s);
return AjaxResult.success(map);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "zip")
@PostMapping("/zipUrlFile")
public AjaxResult zipUrlFile(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "zip")
@PostMapping("/zipUrl")
public AjaxResult zipUrl(@RequestParam MultipartFile file) {
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/**
*
*/

View File

@ -5,12 +5,10 @@ import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.service.ModelVersionService;
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.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -31,54 +29,6 @@ public class ModelVersionController extends BaseController {
private ModelVersionService modelVersionService;
/***
*
*
* @param file
* @return
*/
@ApiOperation(value = "图片")
@PostMapping("/file")
public AjaxResult Malifile(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "zip")
@PostMapping("/zipUrlFile")
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "下载zip")
@PostMapping("/zipUrl")
public AjaxResult zipUrl(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/**
*
* @param modelId

View File

@ -1,16 +1,16 @@
package com.mcwl.web.controller.resource;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.annotation.RepeatSubmit;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.resource.domain.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.impl.SysUserAttentionServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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.*;
/**
*
@ -66,4 +66,32 @@ public class SysUserAttentionController {
return AjaxResult.success(sysUserInfo);
}
/**
*
* @return
*/
@ApiOperation(value = "查询关注列表")
@PostMapping("/selectAttention")
public AjaxResult selectAttention(PageVo pageVo){
PageInfo<SysUser> sysUserList = sysUserAttentionService.selectAttentionPage(pageVo);
return AjaxResult.success(sysUserList);
}
/**
*
* @return
*/
@ApiOperation(value = "查询粉丝列表")
@PostMapping("/selectToAttention")
public AjaxResult selectToAttention(PageVo pageVo){
PageInfo<SysUser> sysUserList = sysUserAttentionService.selectToAttentionPage(pageVo);
return AjaxResult.success(sysUserList);
}
}

View File

@ -7,15 +7,15 @@ import com.mcwl.resource.domain.dto.AddRequestWorkFlow;
import com.mcwl.resource.domain.request.RequestWorkFlow;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.service.impl.WorkFlowServiceImpl;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;
@ -67,47 +67,6 @@ public class WorkFlowController extends BaseController {
/***
*
* @param file
* @return
*/
@ApiOperation(value = "图片")
@PostMapping("/file")
public AjaxResult Malifile(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "zip")
@PostMapping("/zipUrlFile")
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@ApiOperation(value = "下载zip")
@PostMapping("/zipUrl")
public AjaxResult zipUrl(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/**
*
* @param addRequestWorkFlow
@ -115,7 +74,7 @@ public class WorkFlowController extends BaseController {
*/
@ApiOperation(value = "添加工作流")
@PostMapping("/addWorkFlow")
public AjaxResult addWorkFlow(@Valid @RequestBody AddRequestWorkFlow addRequestWorkFlow){
public AjaxResult addWorkFlow(@Validated @RequestBody AddRequestWorkFlow addRequestWorkFlow){
return workFlowService.addWorkFlow(addRequestWorkFlow);
}
@ -141,7 +100,7 @@ public class WorkFlowController extends BaseController {
*/
@ApiOperation(value = "删除工作流")
@GetMapping("/deleteWorkFlow")
public AjaxResult deleteWorkFlow(@RequestParam Long id){
public AjaxResult deleteWorkFlow(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){
workFlowService.deleteWorkFlow(id);
return AjaxResult.success("删除成功");
@ -167,9 +126,34 @@ public class WorkFlowController extends BaseController {
*/
@ApiOperation(value = "查询工作流详情")
@GetMapping("/selectWorkFlowById")
public AjaxResult selectWorkFlowById(@RequestParam Long id,Integer type){
public AjaxResult selectWorkFlowById(@RequestParam @Valid @NotNull(message = "工作流id不能为空") Long id){
return workFlowService.selectWorkFlowById(id,type);
return workFlowService.selectWorkFlowById(id);
}
/**
*
* @param name
* @return
*/
@ApiOperation(value = "校验名字是否重复")
@GetMapping("/selectWorkFlowByName")
public AjaxResult selectWorkFlowByName(@RequestParam String name){
Long sign = workFlowService.selectWorkFlowByName(name);
return AjaxResult.success(sign);
}
/**
*
* @return
*/
@ApiOperation(value = "工作流回显接口")
@GetMapping("/selectWorkFlowVersionById")
public AjaxResult selectWorkFlowVersionById(@RequestParam @Valid @NotNull(message = "图片id不能为空") Long id){
return workFlowService.selectWorkFlowVersionById(id);
}
}

View File

@ -57,9 +57,9 @@ spring:
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
max-file-size: 1024MB
# 设置总上传的文件大小
max-request-size: 20MB
max-request-size: 1024MB
# 服务模块
devtools:
restart:

View File

@ -52,5 +52,19 @@ public class CacheConstants
*/
public static final String WE_CHAT = "we_chat";
/**
*
*/
public static final String ID_CARD_COUNT = "id_card_count:";
/**
*
*/
public static final String MODEL = "model";
/**
*
*/
public static final String WORK_FLOW = "work_flow";
}

View File

@ -114,13 +114,4 @@ public class BaiduCensor {
}
public static void main(String[] args) {
String s = BaiduCensor.TextCensor("我草你妈的");
String s1 = BaiduCensor.ImageCnesor("https://ybl2112.oss-cn-beijing.aliyuncs.com/2025/JANUARY/2/19/4/877e449c-3c0d-4630-a304-91ec110499f2.png");
}
}

View File

@ -130,7 +130,7 @@ public class SecurityConfig
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
requests.antMatchers("/login", "/register", "/captchaImage","/ali/pay/doPay","/ali/pay/notify",
"/ali/pay/callback").permitAll()
"/ali/pay/callback","/file/**").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@ -143,16 +143,16 @@ public class WorkFlow {
*
*/
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
*
*/
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**

View File

@ -73,9 +73,9 @@ public class WorkFlowVersion {
private String auditText;
/**
* ID
* ID
*/
@ApiModelProperty("模型ID")
@ApiModelProperty("工作流ID")
private Long workFlowId;
/**

View File

@ -8,6 +8,8 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
@ -26,9 +28,11 @@ import java.util.List;
public class AddRequestWorkFlow {
@ApiModelProperty(value = "工作流信息")
@Valid
private AddWorkFlow addWorkFlow;
@NotNull(message = "工作流信息不能为空")
private AddWorkFlow workFlow;
@Valid
@NotEmpty(message = "工作流版本信息不能为空")
@ApiModelProperty(value = "工作流版本信息")
private List<AddWorkFlowVersion> addWorkFlowVersions;
private List<AddWorkFlowVersion> workFlowVersionList;
}

View File

@ -1,7 +1,10 @@
package com.mcwl.resource.service;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.resource.domain.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo;
/**
*
@ -16,4 +19,8 @@ public interface SysUserAttentionService {
Boolean selectAttention(Long userId);
SysUserInfo selectUserInfo();
PageInfo<SysUser> selectAttentionPage(PageVo pageVo);
PageInfo<SysUser> selectToAttentionPage(PageVo pageVo);
}

View File

@ -27,7 +27,7 @@ public interface WorkFlowService extends IService<WorkFlow> {
AjaxResult selectWorkFlow(PageVo pageVo);
AjaxResult selectWorkFlowById(Long id,Integer type);
AjaxResult selectWorkFlowById(Long id);
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
@ -37,4 +37,7 @@ public interface WorkFlowService extends IService<WorkFlow> {
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
Long selectWorkFlowByName(String name);
AjaxResult selectWorkFlowVersionById(Long id);
}

View File

@ -31,7 +31,6 @@ import com.mcwl.system.init.DictInit;
import com.mcwl.system.service.ISysUserService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
@ -249,12 +248,31 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
if (modelProduct != null){
//判断模型是否删除
if (modelProduct.getDelFlag().equals("2")){
//不做审核
log.info("删除工作流信息,不做审核校验");
return;
}
if (modelProduct.getModelName() != null){
//审核名称
String s = BaiduCensor.TextCensor(modelProduct.getModelName()+","+modelProduct.getTags());
// 解析 JSON 字符串
JSONObject jsonObject = JSONObject.parseObject(s);
//获取状态码
String code = jsonObject.getString("code");
if (!code.equals("200")){
//审核失败,数据有问题
modelProduct.setAuditStatus(4);
modelProduct.setAuditText("审核失败");
baseMapper.updateById(modelProduct);
log.info("模型审核未通过");
return;
}
// 获取 'conclusion' 字段的值
String conclusion = jsonObject.getString("conclusion");
@ -297,6 +315,14 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
if (modelVersionList != null){
//审核版本
for (ModelVersion modelVersion : modelVersionList) {
//判断版本是否删除
if (modelVersion.getDelFlag().equals("2")){
//不做审核
log.info("删除模型版本信息,不做审核校验");
continue;
}
modelVersion.setModelId(modelProduct.getId());
//版本名称
String s1 = BaiduCensor.TextCensor(modelVersion.getVersionName() + "," +
@ -318,18 +344,26 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
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("版本审核未通过");
// 使用逗号拼接所有的失败原因
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;
modelProduct.setAuditText(concatenatedReasons);
//修改状态以及失败原因
modelProduct.setAuditStatus(4);
baseMapper.updateById(modelProduct);
log.info("模型版本审核未通过");
return;
}
//审核版本图片
@ -350,27 +384,40 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
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;
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(concatenatedReasons);
//修改状态以及失败原因
modelProduct.setAuditStatus(4);
baseMapper.updateById(modelProduct);
log.info("模型版本审核未通过");
return;
}
}
//修改版本成功审核状态
// //修改版本成功审核状态
// modelProduct.setAuditText("");
// modelVersion.setAuditStatus(1);
// modelVersionMapper.updateByName(modelVersion);
// log.info("全部通过审核");
//修改为合格
modelProduct.setAuditText("");
modelVersion.setAuditStatus(1);
modelVersionMapper.updateByName(modelVersion);
log.info("全部通过审核");
modelProduct.setAuditStatus(modelProduct.getJurisdiction());
baseMapper.updateById(modelProduct);
log.info("模型全部通过审核");
}
}

View File

@ -1,23 +1,24 @@
package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.SysUserAttention;
import com.mcwl.resource.domain.SysUserInfo;
import com.mcwl.resource.domain.vo.PageVo;
import com.mcwl.resource.mapper.MallProductLikeMapper;
import com.mcwl.resource.mapper.ModelImageMapper;
import com.mcwl.resource.mapper.ModelMapper;
import com.mcwl.resource.mapper.SysUserAttentionMapper;
import com.mcwl.resource.service.ModelImageService;
import com.mcwl.resource.service.ModelService;
import com.mcwl.resource.service.SysUserAttentionService;
import com.mcwl.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
*
@ -43,6 +44,9 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
@Autowired
private ModelImageMapper modelImageMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Override
public AjaxResult addAttention(Long userId) {
@ -106,4 +110,30 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
.imageLikeNum(imageLikeNum)
.build();
}
@Override
public PageInfo<SysUser> selectAttentionPage(PageVo pageVo) {
PageHelper pageHelper = new PageHelper();
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
//条件构造器
List<SysUser> sysUserList = sysUserMapper.selectUserPage(SecurityUtils.getUserId());
return new PageInfo<SysUser>(sysUserList);
}
@Override
public PageInfo<SysUser> selectToAttentionPage(PageVo pageVo) {
PageHelper pageHelper = new PageHelper();
pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize());
//条件构造器
List<SysUser> sysUserList = sysUserMapper.selectToUserPage(SecurityUtils.getUserId());
return new PageInfo<SysUser>(sysUserList);
}
}

View File

@ -73,9 +73,9 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
BeanUtil.copyProperties(addRequestWorkFlo, requestWorkFlow);
// RequestWorkFlow requestWorkFlow = JSON.parseObject(JSON.toJSONString(addRequestWorkFlo), RequestWorkFlow.class);
//获取封面图
String filePath = requestWorkFlow.getWorkFlowVersionList().get(0).getFilePath();
String filePath = requestWorkFlow.getWorkFlowVersionList().get(0).getImagePaths();
String[] split = filePath.split(",");
@ -94,7 +94,6 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
audit(requestWorkFlow);
return AjaxResult.success("添加成功,等待审核");
}
@ -103,14 +102,31 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
threadPoolTaskExecutor.submit(() -> {
WorkFlow workFlow = requestWorkFlow.getWorkFlow();
if (workFlow != null){
if (workFlow != null) {
if (workFlow.getWorkflowName() != null){
//判断是否删除
if (workFlow.getDelFlag().equals("2")) {
//不做审核
log.info("删除工作流信息,不做审核校验");
return;
}
if (workFlow.getWorkflowName() != null) {
//审核名称
String s = BaiduCensor.TextCensor(workFlow.getWorkflowName());
// 解析 JSON 字符串
JSONObject jsonObject = JSONObject.parseObject(s);
//获取状态码
String code = jsonObject.getString("code");
if (!code.equals("200")) {
//审核失败,数据有问题
workFlow.setAuditStatus(4);
workFlow.setAuditText("审核失败");
flowMapper.updateById(workFlow);
log.info("工作流审核未通过");
return;
}
// 获取 'conclusion' 字段的值
String conclusion = jsonObject.getString("conclusion");
@ -150,14 +166,31 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
List<WorkFlowVersion> workFlowVersionList = requestWorkFlow.getWorkFlowVersionList();
if (workFlowVersionList != null){
if (workFlowVersionList != null) {
//审核版本
for (WorkFlowVersion workFlowVersion : workFlowVersionList) {
//判断是否删除
if (workFlowVersion.getDelFlag().equals("2")) {
//不做审核
log.info("删除工作流版本信息,不做审核校验");
continue;
}
workFlowVersion.setWorkFlowId(workFlow.getId());
//版本名称
String s1 = BaiduCensor.TextCensor(workFlowVersion.getVersionName() + "," + workFlowVersion.getVersionDescription());
// 解析 JSON 字符串
JSONObject jsonObject1 = JSONObject.parseObject(s1);
String code = jsonObject1.getString("code");
if (!code.equals("200")) {
//审核失败,数据有问题
workFlow.setAuditStatus(4);
workFlow.setAuditText("审核失败");
flowMapper.updateById(workFlow);
log.info("工作流审核未通过");
return;
}
// 获取 'conclusion' 字段的值
String conclusion1 = jsonObject1.getString("conclusion");
if (conclusion1.equals("不合规")) {
@ -175,16 +208,21 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
}
// 使用逗号拼接所有的失败原因
String concatenatedReasons = String.join(", ", failureReasons);
workFlowVersion.setAuditText(concatenatedReasons);
workFlowVersion.setAuditStatus(4);
//校验id是否存在 区别修改审核或者新增审核
if (workFlowVersion.getId() != null){
workFlowVersionMapper.updateById(workFlowVersion);
}else {
workFlowVersionMapper.updateByName(workFlowVersion);
}
log.info("版本审核未通过");
continue;
workFlow.setAuditText(concatenatedReasons);
//修改状态以及失败原因
workFlow.setAuditStatus(4);
flowMapper.updateById(workFlow);
// workFlowVersion.setAuditText(concatenatedReasons);
// workFlowVersion.setAuditStatus(4);
// //校验id是否存在 区别修改审核或者新增审核
// if (workFlowVersion.getId() != null){
// workFlowVersionMapper.updateById(workFlowVersion);
// }else {
// workFlowVersionMapper.updateByName(workFlowVersion);
// }
log.info("版本审核文字未通过");
return;
}
//审核版本图片
@ -192,6 +230,15 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
for (String path : split) {
String s2 = BaiduCensor.ImageCnesor(path);
JSONObject jsonObject2 = JSONObject.parseObject(s2);
String code1 = jsonObject2.getString("code");
if (!code1.equals("200")) {
//审核失败,数据有问题
workFlow.setAuditStatus(4);
workFlow.setAuditText("审核失败");
flowMapper.updateById(workFlow);
log.info("工作流审核未通过");
return;
}
if (jsonObject2.getString("conclusion").equals("不合规")) {
//修改状态->跳出循环 判断下一个版本
@ -207,24 +254,34 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
}
// 使用逗号拼接所有的失败原因
String concatenatedReasons = String.join(", ", failureReasons);
workFlowVersion.setAuditText(concatenatedReasons);
workFlowVersion.setAuditStatus(4);
//校验id是否存在 区别修改审核或者新增审核
if (workFlowVersion.getId() != null){
workFlowVersionMapper.updateById(workFlowVersion);
}else {
workFlowVersionMapper.updateByName(workFlowVersion);
}
log.info("图片审核未通过");
break;
workFlow.setAuditText(concatenatedReasons);
//修改状态以及失败原因
workFlow.setAuditStatus(4);
flowMapper.updateById(workFlow);
// workFlowVersion.setAuditText(concatenatedReasons);
// workFlowVersion.setAuditStatus(4);
// //校验id是否存在 区别修改审核或者新增审核
// if (workFlowVersion.getId() != null){
// workFlowVersionMapper.updateById(workFlowVersion);
// }else {
// workFlowVersionMapper.updateByName(workFlowVersion);
// }
log.info("工作流图片审核未通过");
return;
}
}
//修改版本成功审核状态
// workFlow.setAuditText("");
// workFlowVersion.setAuditStatus(1);
// workFlowVersionMapper.updateByName(workFlowVersion);
// log.info("全部通过审核");
//修改为合格
workFlow.setAuditText("");
workFlowVersion.setAuditStatus(1);
workFlowVersionMapper.updateByName(workFlowVersion);
log.info("全部通过审核");
workFlow.setAuditStatus(workFlow.getJurisdiction());
flowMapper.updateById(workFlow);
}
}
@ -245,6 +302,10 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
// flowMapper.updateWorkFlow(requestWorkFlow.getWorkFlow());
flowMapper.updateById(requestWorkFlow.getWorkFlow());
}
if (workFlows.getDelFlag().equals("2")){
return;
}
//修改工作流版本的信息
if (requestWorkFlow.getWorkFlowVersionList().size() != 0) {
@ -253,7 +314,13 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
for (WorkFlowVersion workFlowVersion : requestWorkFlow.getWorkFlowVersionList()) {
workFlowVersion.setAuditStatus(3);
// workFlowVersionMapper.updateWorkFlowVersion(workFlowVersion);
if (workFlowVersion.getId() != null){
workFlowVersionMapper.updateById(workFlowVersion);
}else {
workFlowVersion.setWorkFlowId(workFlows.getId());
workFlowVersionMapper.insert(workFlowVersion);
}
}
WorkFlow workFlow = WorkFlow.builder().id(requestWorkFlow.getWorkFlowVersionList().get(0).getWorkFlowId())
@ -297,16 +364,14 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
}
@Override
public AjaxResult selectWorkFlowById(Long id,Integer type) {
public AjaxResult selectWorkFlowById(Long id) {
//查询详情
WorkFlow workFlow = flowMapper.selectById(id);
if (workFlow == null){
if (workFlow == null) {
return AjaxResult.error("工作流不存在");
}
if (type == 1){
//类别
if (StringUtils.isNotEmpty(workFlow.getType())) {
ArrayList<String> strings = new ArrayList<>();
@ -319,8 +384,6 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
workFlow.setTypeList(strings);
}
}
return AjaxResult.success(workFlow);
}
@ -340,11 +403,11 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
page.addOrder(orderItemList);
LambdaQueryWrapper<WorkFlow> lqw = new LambdaQueryWrapper<>();
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0 , WorkFlow::getAuditStatus, imagePageRes.getStatus())
lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, WorkFlow::getAuditStatus, imagePageRes.getStatus())
.eq(WorkFlow::getUserId, SecurityUtils.getUserId())
.ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime())
.le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime())
.eq(WorkFlow::getDelFlag,0);
.eq(WorkFlow::getDelFlag, 0);
baseMapper.selectPage(page, lqw);
// 获取分页数据
@ -380,7 +443,7 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
@Override
public void setworkFlowTop(Long id, boolean isTop) {
flowMapper.setworkFlowTop(id,isTop?1:0);
flowMapper.setworkFlowTop(id, isTop ? 1 : 0);
}
@Override
@ -388,5 +451,39 @@ public class WorkFlowServiceImpl extends ServiceImpl<WorkFlowMapper, WorkFlow> i
return flowMapper.fetchWorkFlowSortedByTopStatus();
}
@Override
public Long selectWorkFlowByName(String name) {
LambdaQueryWrapper<WorkFlow> workFlowLambdaQueryWrapper = new LambdaQueryWrapper<>();
workFlowLambdaQueryWrapper.eq(WorkFlow::getWorkflowName, name);
workFlowLambdaQueryWrapper.eq(WorkFlow::getDelFlag, 0);
return baseMapper.selectCount(workFlowLambdaQueryWrapper);
}
@Override
public AjaxResult selectWorkFlowVersionById(Long id) {
RequestWorkFlow requestWorkFlow = new RequestWorkFlow();
WorkFlow workFlow = baseMapper.selectById(id);
if (workFlow == null){
return AjaxResult.error("数据不存在");
}
if (workFlow.getDelFlag() == 2){
return AjaxResult.error("数据不存在");
}
LambdaQueryWrapper<WorkFlowVersion> workFlowVersionLambdaQueryWrapper = new LambdaQueryWrapper<>();
workFlowVersionLambdaQueryWrapper.eq(WorkFlowVersion::getWorkFlowId,id);
workFlowVersionLambdaQueryWrapper.eq(WorkFlowVersion::getDelFlag,0);
List<WorkFlowVersion> workFlowVersions = workFlowVersionMapper.selectList(workFlowVersionLambdaQueryWrapper);
requestWorkFlow.setWorkFlow(workFlow);
requestWorkFlow.setWorkFlowVersionList(workFlowVersions);
return AjaxResult.success(requestWorkFlow);
}
}

View File

@ -139,4 +139,9 @@ public interface SysUserMapper
List<SysUser> listByIds(List<Long> userIdList);
List<SysUser> selectUserByIds(@Param("userIds") List<Long> userIds);
List<SysUser> selectUserPage(@Param("userId") Long userId);
List<SysUser> selectToUserPage(@Param("userId") Long userId);
}

View File

@ -175,6 +175,20 @@
</foreach>
</select>
<select id="selectUserPage" resultType="com.mcwl.common.core.domain.entity.SysUser">
select u.user_id,nick_name,avatar FROM sys_user_attention as a
LEFT JOIN sys_user as u
on a.user_id = u.user_id
WHERE a.user_id = #{userId}
</select>
<select id="selectToUserPage" resultType="com.mcwl.common.core.domain.entity.SysUser">
select u.user_id,nick_name,avatar FROM sys_user_attention as a
LEFT JOIN sys_user as u
on a.user_id = u.user_id
WHERE a.to_user_id = #{userId}
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>