diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java index 7938929..5a014fe 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/PublishController.java @@ -62,6 +62,24 @@ public class PublishController { return publishService.publish(publishRes); } + /** + * 获取发布图片列表 + */ + @ApiOperation(value = "获取发布图片列表") + @PostMapping("publishImage") + public TableDataInfo publishImage(@RequestBody @Valid PublishPageRes publishPageRes) { + return publishService.publishImage(publishPageRes); + } + + /** + * 获取发布文件列表 + */ + @ApiOperation(value = "获取发布文件列表") + @PostMapping("publishFile") + public TableDataInfo publishFile(@RequestBody @Valid PublishPageRes publishPageRes) { + return publishService.publishFile(publishPageRes); + } + /** * 删除 */ diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java index b30ae11..8e7147b 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionController.java @@ -44,15 +44,25 @@ public class QuestionController { /** - * 获取问题列表 + * 获取提问列表 */ @PostMapping("list") - @ApiOperation(value = "获取问题列表") + @ApiOperation(value = "获取提问列表") public TableDataInfo list(@RequestBody @Valid QuestionPageRes questionPageRes) { return questionService.list(questionPageRes); } + /** + * 获取提问图片列表 + */ + @PostMapping("listImage") + @ApiOperation(value = "获取提问图片列表") + public TableDataInfo listImage(@RequestBody @Valid QuestionPageRes questionPageRes) { + + return questionService.listImage(questionPageRes); + } + /** * 获取问题详情 */ diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java index b0a7d40..d6b6860 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberController.java @@ -14,6 +14,8 @@ import com.mcwl.memberCenter.service.MemberLevelService; import com.mcwl.memberCenter.service.MemberService; import com.mcwl.system.service.ISysUserService; import com.mcwl.memberCenter.domain.vo.PointsVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.*; @@ -26,6 +28,7 @@ import java.util.Optional; @RestController @RequestMapping("member") @RequiredArgsConstructor +@Api(tags = "会员中心") public class MemberController { private final MemberService memberService; @@ -76,6 +79,7 @@ public class MemberController { * @return 积分余额和历史记录 */ @GetMapping("getPoints") + @ApiOperation(value = "获取积分余额和历史记录") public AjaxResult getPoints() { Long userId = SecurityUtils.getUserId(); @@ -103,6 +107,7 @@ public class MemberController { * 会员积分充值 */ @PostMapping("rechargePoints") + @ApiOperation(value = "会员积分充值") public AjaxResult rechargePoints(@RequestBody @Valid RechargePointsDto rechargePointsDto) { Long userId = rechargePointsDto.getUserId(); Double amount = rechargePointsDto.getAmount(); @@ -129,6 +134,7 @@ public class MemberController { * 消费积分 */ @GetMapping("consumePoints/{consumePoints}") + @ApiOperation(value = "消费积分") public AjaxResult consumePoints(@PathVariable Double consumePoints) { if (consumePoints == null || consumePoints <= 0) { @@ -145,6 +151,7 @@ public class MemberController { * 根据会员等级和活动计算支付金额 */ @GetMapping("calculatePayment") + @ApiOperation(value = "根据会员等级和活动计算支付金额") public AjaxResult calculatePayment(@NotNull(message = "请选择会员") Long memberLevelId, @RequestParam(required = false) Long promotionId) { MemberLevel memberLevel = memberLevelService.getById(memberLevelId); Double unitPrice = memberLevel.getUnitPrice(); @@ -156,6 +163,7 @@ public class MemberController { * 是否是会员 */ @GetMapping("isMember") + @ApiOperation(value = "是否是会员") public AjaxResult isMember() { Long userId = SecurityUtils.getUserId(); Member member = memberService.getUseUserMemberByUserId(userId); diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java index e292e0b..0ff9277 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/MemberLevelController.java @@ -6,6 +6,8 @@ import com.mcwl.memberCenter.domain.MemberLevel; import com.mcwl.memberCenter.service.MemberBenefitService; import com.mcwl.memberCenter.service.MemberLevelService; import com.mcwl.memberCenter.domain.vo.MemberBenefitVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -17,6 +19,7 @@ import java.util.List; @RestController @RequestMapping("memberLevel") @RequiredArgsConstructor +@Api(tags = "会员中心") public class MemberLevelController { private final MemberLevelService memberLevelService; @@ -29,6 +32,7 @@ public class MemberLevelController { * @return 会员等级列表 */ @GetMapping("list") + @ApiOperation(value = "获取会员等级列表") public AjaxResult list() { List memberLevelList = memberLevelService.list(); @@ -41,6 +45,7 @@ public class MemberLevelController { * 获取会员等级及权益列表 */ @GetMapping("getMemberBenefitList") + @ApiOperation(value = "获取会员等级及权益列表") public AjaxResult getMemberBenefitList() { List memberBenefitVOList = new ArrayList<>(); diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java index 59e120e..60f804a 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/memberCenter/PromotionController.java @@ -14,6 +14,8 @@ import com.mcwl.memberCenter.enums.PromotionEnum; import com.mcwl.memberCenter.service.MemberPromotionService; import com.mcwl.memberCenter.service.MemberService; import com.mcwl.memberCenter.service.PromotionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.*; @@ -29,6 +31,7 @@ import java.util.Optional; @RestController @RequestMapping("promotion") @RequiredArgsConstructor +@Api(tags = "会员中心") public class PromotionController { private final PromotionService promotionService; @@ -42,6 +45,7 @@ public class PromotionController { * 创建活动 */ @PostMapping("createPromotion") + @ApiOperation(value = "创建活动") public AjaxResult createPromotion(@RequestBody @Valid PromotionDto promotionDto) { Date startTime = promotionDto.getStartTime(); @@ -63,6 +67,7 @@ public class PromotionController { * 活动列表 */ @GetMapping("promotionList") + @ApiOperation(value = "活动列表") public AjaxResult promotionList() { List promotionList = promotionService.lambdaQuery() .gt(Promotion::getEndTime, new Date()) @@ -74,6 +79,7 @@ public class PromotionController { * 获取当前用户参与的活动 */ @GetMapping("myPromotionList") + @ApiOperation(value = "获取当前用户参与的活动") public AjaxResult myPromotionList() { // 获取当前用户 Long userId = SecurityUtils.getUserId(); @@ -87,6 +93,7 @@ public class PromotionController { * 参与活动 */ @PostMapping("joinPromotion") + @ApiOperation(value = "参与活动") public AjaxResult joinPromotion(@RequestBody @Valid JoinPromotionDto joinPromotionDto) { // 用户id Long userId = joinPromotionDto.getUserId(); diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java index 332ce95..394a744 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/myInvitation/InvitationController.java @@ -7,6 +7,8 @@ import com.mcwl.myInvitation.domain.Invitation; import com.mcwl.myInvitation.domain.dto.EarningsDisplayDto; import com.mcwl.myInvitation.service.InvitationService; import com.mcwl.myInvitation.domain.vo.EarningsDisplayVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.GetMapping; @@ -26,6 +28,7 @@ import static com.mcwl.common.core.domain.AjaxResult.success; @RestController() @RequiredArgsConstructor @RequestMapping("/invitation") +@Api(tags = "邀请管理") public class InvitationController { private final InvitationService invitationService; @@ -37,6 +40,7 @@ public class InvitationController { * @return 邀请码 */ @GetMapping("/getInvitationCode") + @ApiOperation(value = "获取邀请码") public AjaxResult getInvitationCode() { // 获取当前用户 Long userId = SecurityUtils.getUserId(); @@ -55,6 +59,7 @@ public class InvitationController { */ @GetMapping("/list/{userId}") + @ApiOperation(value = "获取邀请列表") public AjaxResult list(@PathVariable Long userId) { List list = invitationService.lambdaQuery() .eq(Invitation::getUserId, userId) @@ -67,6 +72,7 @@ public class InvitationController { * 邀请人收益展示 */ @GetMapping("earningsDisplay") + @ApiOperation(value = "邀请人收益展示") public AjaxResult earningsDisplay() { Long userId = SecurityUtils.getUserId(); diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java index 5ff2370..5232b12 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelVersionController.java @@ -1,11 +1,9 @@ package com.mcwl.web.controller.resource; -import cn.hutool.core.lang.Dict; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.page.TableDataInfo; -import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.service.ModelVersionService; import com.mcwl.system.init.DictInit; @@ -17,7 +15,6 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.util.ArrayList; -import java.util.Date; import java.util.List; /** 模型版本 @@ -85,7 +82,16 @@ public class ModelVersionController extends BaseController { } + /** + * 详情页 版本列表 + * @param modelId + * @return + */ + @GetMapping("/selectByModelId") + public AjaxResult selectByModelId(@RequestParam Long modelId){ + return modelVersionService.selectByModelId(modelId); + } @ApiOperation(value = "模型版本列表") @PostMapping("list") diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java new file mode 100644 index 0000000..e667ac5 --- /dev/null +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java @@ -0,0 +1,72 @@ +package com.mcwl.web.controller.resource; + +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.service.ReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +/** + * 举报功能 + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@RequestMapping("/report") +@RestController +public class ReportController { + + @Autowired + private ReportService reportService; + + /** + * 新增举报内容 + * @param report + * @return + */ + @PostMapping("/addReport") + public AjaxResult addReport(@RequestBody Report report){ + + reportService.addReport(report); + return AjaxResult.success("举报成功"); + } + + /** + * 查询举报列表 + * @param pageVo + * @return + */ + @PostMapping("/selectReport") + public AjaxResult selectReport(@RequestBody PageVo pageVo){ + + + return reportService.selectReport(pageVo); + } + + /** + * 删除举报 + * @param id + * @return + */ + @GetMapping("/deleteReport") + public AjaxResult deleteReport(@RequestParam Long id){ + + reportService.deleteReport(id); + return AjaxResult.success("删除成功"); + } + + /** + * 修改状态 + * @param id + * @return + */ + @GetMapping("/updateStatus") + public AjaxResult updateStatus(@RequestParam Long id){ + + reportService.updateStatus(id); + return AjaxResult.success("修改成功"); + } + +} diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java index f71e490..31ff596 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ToActivityController.java @@ -48,7 +48,7 @@ public class ToActivityController extends BaseController { @PostMapping("finById") public AjaxResult finById(@RequestBody ToActivity toActivity) { - return AjaxResult.success(toActivityService.getById(toActivity)); + return AjaxResult.success(toActivityService.getById(toActivity.getId())); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Publish.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Publish.java index d2aea50..d813ed9 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Publish.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/Publish.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.mcwl.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; @@ -39,6 +40,16 @@ public class Publish extends BaseEntity { */ private String content; + /** + * 发布图片 + */ + private String imageUrl; + + /** + * 发布文件 + */ + private String fileUrl; + /** * 发布人 */ diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/PublishRes.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/PublishRes.java index b2921e6..651f987 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/PublishRes.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/PublishRes.java @@ -32,6 +32,17 @@ public class PublishRes { @NotBlank(message = "内容不能为空") @ApiModelProperty(value = "内容", required = true) private String content; + /** + * 发布图片 + */ + @ApiModelProperty(value = "发布图片") + private String imageUrl; + + /** + * 发布文件 + */ + @ApiModelProperty(value = "发布文件") + private String fileUrl; /** * 发布时间 - 定时发布 diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/PublishVo.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/PublishVo.java index 2241902..fb9aeca 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/PublishVo.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/PublishVo.java @@ -8,7 +8,7 @@ import springfox.documentation.annotations.ApiIgnore; import java.util.Date; /** - * 发布、提问信息 + * 发布信息 */ @Data @ApiModel(description = "发布信息") @@ -56,6 +56,18 @@ public class PublishVo { @ApiModelProperty(value = "内容") private String content; + /** + * 发布图片 + */ + @ApiModelProperty(value = "发布图片") + private String imageUrl; + + /** + * 发布文件 + */ + @ApiModelProperty(value = "发布文件") + private String fileUrl; + /** * 发布时间 - 定时发布 */ diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionVo.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionVo.java index 4077f82..43570c9 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionVo.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionVo.java @@ -1,6 +1,8 @@ package com.mcwl.communityCenter.domain.vo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import javax.validation.constraints.NotBlank; @@ -8,64 +10,77 @@ import javax.validation.constraints.NotNull; import java.util.Date; @Data +@ApiModel(description = "问题信息") public class QuestionVo { + @ApiModelProperty(value = "主键") private Long id; /** * 社区id */ + @ApiModelProperty(value = "社区id") private Long communityId; /** * 提问用户id */ + @ApiModelProperty(value = "提问用户id") private Long questionUserId; /** * 提问用户名 */ + @ApiModelProperty(value = "提问用户名") private String questionUserName; /** * 提问用户头像 */ + @ApiModelProperty(value = "提问用户头像") private String questionUserAvatar; /** * 提问内容 */ + @ApiModelProperty(value = "提问内容") private String content; /** * 提问图片 */ + @ApiModelProperty(value = "提问图片") private String questionUrl; /** * 提问时间 */ + @ApiModelProperty(value = "提问时间") private Date createTime; /** * 答复用户id */ + @ApiModelProperty(value = "答复用户id") private Long replyUserId; /** * 回复内容 */ + @ApiModelProperty(value = "回复内容") private String reply; /** * 回复时间 */ + @ApiModelProperty(value = "回复时间") private Date replyTime; /** * 是否匿名 */ + @ApiModelProperty(value = "是否匿名") private Integer isAnonymous; diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java index 399a418..61aa019 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/PublishMapper.java @@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.security.core.parameters.P; +import javax.validation.constraints.NotNull; + @Mapper public interface PublishMapper extends BaseMapper { @@ -22,4 +24,19 @@ public interface PublishMapper extends BaseMapper { Long tenantId, @Param("communityId") Long communityId); + + @InterceptorIgnore(tenantLine = "true") + Page selectByTenantIdAndCommunityIdAndNotNullImagePage(Page page, + @Param("tenantId") + Long tenantId, + @Param("communityId") + Long communityId); + + @InterceptorIgnore(tenantLine = "true") + Page selectByTenantIdAndCommunityIdAndNotNullFilePage(Page page, + @Param("tenantId") + Long tenantId, + @Param("communityId") + Long communityId); + } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionMapper.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionMapper.java index 1a965a1..5bd9359 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionMapper.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionMapper.java @@ -30,4 +30,15 @@ public interface QuestionMapper extends BaseMapper { Long tenantId, @Param("communityId") Long communityId); + + @InterceptorIgnore(tenantLine = "true") + Page listImage(Page page, + @NotNull(message = "租户不能为空") + @Param("tenantId") + Long tenantId, + @NotNull(message = "社区不能为空") + @Param("communityId") + Long communityId, + @Param("status") + Integer status); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java index 9ef00df..0478a1d 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/PublishService.java @@ -11,6 +11,7 @@ import com.mcwl.communityCenter.domain.dto.PublishPageRes; import com.mcwl.communityCenter.domain.dto.PublishRes; import com.mcwl.communityCenter.domain.vo.PublishVo; +import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.List; @@ -25,4 +26,8 @@ public interface PublishService extends IService { AjaxResult publish(PublishRes publishRes); TableDataInfo getPublishList(PublishPageRes publishPageRes); + + TableDataInfo publishImage(@Valid PublishPageRes publishPageRes); + + TableDataInfo publishFile(@Valid PublishPageRes publishPageRes); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java index 9e536a1..b81658e 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionService.java @@ -10,6 +10,7 @@ import com.mcwl.communityCenter.domain.dto.QuestionReplyRes; import com.mcwl.communityCenter.domain.dto.QuestionRes; import com.mcwl.communityCenter.domain.vo.QuestionVo; +import javax.validation.Valid; import javax.validation.constraints.NotNull; public interface QuestionService extends IService { @@ -30,4 +31,6 @@ public interface QuestionService extends IService { * @param questionReplyRes 回复信息 */ AjaxResult reply(QuestionReplyRes questionReplyRes); + + TableDataInfo listImage(@Valid QuestionPageRes questionPageRes); } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishServiceImpl.java index cc2809f..f671a98 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/PublishServiceImpl.java @@ -98,15 +98,7 @@ public class PublishServiceImpl extends ServiceImpl impl @Override public TableDataInfo getPublishList(PublishPageRes publishPageRes) { - Page page = new Page<>(publishPageRes.getPageNum(), publishPageRes.getPageSize()); - - if (StringUtils.isBlank(publishPageRes.getOrderByColumn())) { - publishPageRes.setOrderByColumn("create_time"); - } - boolean isAsc = Objects.equals(publishPageRes.getIsAsc(), "asc"); - OrderItem orderItem = new OrderItem(publishPageRes.getOrderByColumn(), isAsc); - - page.addOrder(orderItem); + Page page = this.initPage(publishPageRes); // 根据租户id和社区id查询分页数据 baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId()); @@ -133,4 +125,77 @@ public class PublishServiceImpl extends ServiceImpl impl tableDataInfo.setMsg("查询成功"); return tableDataInfo; } + + @Override + public TableDataInfo publishImage(PublishPageRes publishPageRes) { + + Page page = this.initPage(publishPageRes); + + // 根据租户id和社区id和fileUrl不为空查询分页数据 + baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId()); + + List publishList = page.getRecords(); + List publishVoList = new ArrayList<>(); + for (Publish publish : publishList) { + PublishVo publishVo = new PublishVo(); + BeanUtil.copyProperties(publish, publishVo); + Long userId = publish.getUserId(); + SysUser sysUser = sysUserService.selectUserById(userId); + publishVo.setUserName(sysUser.getUserName()); + publishVo.setAvatar(sysUser.getAvatar()); + publishVoList.add(publishVo); + } + + + // 封装返回 + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setRows(publishVoList); + tableDataInfo.setTotal(page.getTotal()); + tableDataInfo.setCode(HttpStatus.SUCCESS); + tableDataInfo.setMsg("查询成功"); + return tableDataInfo; + } + + @Override + public TableDataInfo publishFile(PublishPageRes publishPageRes) { + Page page = this.initPage(publishPageRes); + + // 根据租户id和社区id和imageUrl不为空查询分页数据 + baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId()); + + List publishList = page.getRecords(); + List publishVoList = new ArrayList<>(); + for (Publish publish : publishList) { + PublishVo publishVo = new PublishVo(); + BeanUtil.copyProperties(publish, publishVo); + Long userId = publish.getUserId(); + SysUser sysUser = sysUserService.selectUserById(userId); + publishVo.setUserName(sysUser.getUserName()); + publishVo.setAvatar(sysUser.getAvatar()); + publishVoList.add(publishVo); + } + + + // 封装返回 + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setRows(publishVoList); + tableDataInfo.setTotal(page.getTotal()); + tableDataInfo.setCode(HttpStatus.SUCCESS); + tableDataInfo.setMsg("查询成功"); + return tableDataInfo; + } + + private Page initPage(PublishPageRes publishPageRes) { + Page page = new Page<>(publishPageRes.getPageNum(), publishPageRes.getPageSize()); + + if (StringUtils.isBlank(publishPageRes.getOrderByColumn())) { + publishPageRes.setOrderByColumn("create_time"); + } + boolean isAsc = Objects.equals(publishPageRes.getIsAsc(), "asc"); + OrderItem orderItem = new OrderItem(publishPageRes.getOrderByColumn(), isAsc); + + page.addOrder(orderItem); + + return page; + } } diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionServiceImpl.java index c9eef6d..a62db84 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionServiceImpl.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionServiceImpl.java @@ -103,14 +103,7 @@ public class QuestionServiceImpl extends ServiceImpl i @Override public TableDataInfo list(QuestionPageRes questionPageRes) { - Page page = new Page<>(questionPageRes.getPageNum(), questionPageRes.getPageSize()); - OrderItem orderItem = new OrderItem(); - if (StringUtils.isBlank(questionPageRes.getOrderByColumn())) { - questionPageRes.setOrderByColumn("create_time"); - } - orderItem.setColumn(questionPageRes.getOrderByColumn()); - orderItem.setAsc(Objects.equals(questionPageRes.getIsAsc(), "asc")); - page.addOrder(orderItem); + Page page = initPage(questionPageRes); baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus()); @@ -191,5 +184,49 @@ public class QuestionServiceImpl extends ServiceImpl i } + @Override + public TableDataInfo listImage(QuestionPageRes questionPageRes) { + + Page page = initPage(questionPageRes); + + baseMapper.listImage(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus()); + + // 获取分页数据 + List questionList = page.getRecords(); + // Question数据转为QuestionVo + List questionVoList = new ArrayList<>(); + for (Question question : questionList) { + QuestionVo questionVo = new QuestionVo(); + BeanUtil.copyProperties(question, questionVo); + Long questionUserId = question.getQuestionUserId(); + SysUser sysUser = sysUserService.selectUserById(questionUserId); + questionVo.setQuestionUserName(sysUser.getUserName()); + questionVo.setQuestionUserAvatar(sysUser.getAvatar()); + questionVoList.add(questionVo); + + } + + // 封装分页信息 + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(questionVoList); + rspData.setTotal(page.getTotal()); + + return rspData; + } + + private Page initPage(QuestionPageRes questionPageRes) { + Page page = new Page<>(questionPageRes.getPageNum(), questionPageRes.getPageSize()); + OrderItem orderItem = new OrderItem(); + if (StringUtils.isBlank(questionPageRes.getOrderByColumn())) { + questionPageRes.setOrderByColumn("create_time"); + } + orderItem.setColumn(questionPageRes.getOrderByColumn()); + orderItem.setAsc(Objects.equals(questionPageRes.getIsAsc(), "asc")); + page.addOrder(orderItem); + return page; + } + } diff --git a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishMapper.xml b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishMapper.xml index 0340213..4630d62 100644 --- a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishMapper.xml +++ b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/PublishMapper.xml @@ -4,18 +4,84 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + \ No newline at end of file diff --git a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionMapper.xml b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionMapper.xml index af98a15..6612c5b 100644 --- a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionMapper.xml +++ b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionMapper.xml @@ -23,4 +23,15 @@ and community_id = #{communityId} and del_flag = '0' + \ No newline at end of file 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 82b7eb9..c2a5789 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 @@ -3,7 +3,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 com.fasterxml.jackson.annotation.JsonFormat; import com.mcwl.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -11,9 +10,7 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; import java.util.List; /** @@ -44,11 +41,6 @@ public class ModelProduct extends BaseEntity { */ @ApiModelProperty(value = "名称") private String modelName; - /** - * 描述 - */ - @ApiModelProperty(value = "描述") - private String versionDescription; /*** * 用户id */ @@ -113,7 +105,14 @@ public class ModelProduct extends BaseEntity { * 审核状态 */ @ApiModelProperty(value = "审核状态") - private Integer auditSatus; + private Integer auditStatus; + + /** + * 审核(1公开 2自见) + */ + @ApiModelProperty(value = "审核") + private Integer jurisdiction; + /** * 审核失败原因 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java index 743e0c5..648ff16 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelVersion.java @@ -35,9 +35,9 @@ public class ModelVersion extends BaseEntity { @TableId private Long id; /** - * 模型id + * 模型ID */ - @ApiModelProperty(value = "模型id") + @ApiModelProperty(value = "模型ID") private Long modelId; /** * 版本名称 @@ -45,9 +45,9 @@ public class ModelVersion extends BaseEntity { @ApiModelProperty(value = "版本名称") private String versionName; /** - * 基础模型 + * 模型类型ID */ - @ApiModelProperty(value = "基础模型") + @ApiModelProperty(value = "模型类型ID") private Long modelType; /** * 文件地址 @@ -84,11 +84,21 @@ public class ModelVersion extends BaseEntity { */ @ApiModelProperty(value = "cfg") private Integer cfg; + /** + * 是否免费 + */ + @ApiModelProperty(value = "是否免费") + private Integer isFree; /** * 是否公开 */ @ApiModelProperty(value = "是否公开") private Integer isPublic; + /** + * 是否加密 + */ + @ApiModelProperty(value = "是否加密") + private String isEncrypt; /** * 是否在线使用 */ @@ -138,7 +148,7 @@ public class ModelVersion extends BaseEntity { * 审核状态 */ @ApiModelProperty(value = "审核状态") - private Integer auditSatus; + private Integer auditStatus; /** * 审核失败原因 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java new file mode 100644 index 0000000..675a170 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java @@ -0,0 +1,73 @@ +package com.mcwl.resource.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * 举报表 + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@Builder +@Data +@NoArgsConstructor +@AllArgsConstructor +@TableName("report") +public class Report { + + /** + * 主键ID + */ + private Long id; + + /** + * 被举报的商品ID + */ + private Long productId; + + /** + * 举报人ID + */ + private Long userId; + + /** + * 举报类型 + */ + private Integer reportId; + + /** + * 区分举报内容(1模型 2图片 3工作流) + */ + private Integer type; + + /** + * 举报描述 + */ + private String text; + + /** + * 状态(0未处理 1已处理) + */ + private Integer status = 0; + + /** + * 创建时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + private Date createTime; + + /** + * 逻辑删除(0展示 2删除) + */ + private Integer delFlag = 0; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java index 51662f7..c370231 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/ToActivity.java @@ -2,7 +2,6 @@ package com.mcwl.resource.domain; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; -import com.mcwl.common.core.domain.BaseEntity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -22,7 +21,7 @@ import lombok.NoArgsConstructor; @Data @ApiModel(description = "活动") @TableName("to_activity") -public class ToActivity extends BaseEntity { +public class ToActivity{ /** * 主键 */ diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java index dbde791..1e4aad2 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/PageVo.java @@ -9,6 +9,7 @@ import lombok.NoArgsConstructor; /** * 分页+条件 + * * @author DaiZibo * @date 2025/1/13 * @apiNote @@ -21,12 +22,14 @@ import lombok.NoArgsConstructor; @ApiModel(description = "分页+条件") public class PageVo { - @ApiModelProperty(value = "页码") - private Integer pageNumber; -@ApiModelProperty(value = "每页条数") - private Integer pageSize; -@ApiModelProperty(value = "名称") - private String name; -@ApiModelProperty(value = "排序") - private Integer order; + @ApiModelProperty(value = "页码") + private Integer pageNumber; + @ApiModelProperty(value = "每页条数") + private Integer pageSize; + @ApiModelProperty(value = "名称") + private String name; + @ApiModelProperty(value = "排序") + private Integer order; + @ApiModelProperty(value = "条件过滤") + private Integer type; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java index e495c36..70ca73c 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java @@ -20,6 +20,6 @@ import java.util.List; public interface ModelVersionMapper extends BaseMapper { void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List modelVersionList); - + void updateByName(ModelVersion modelVersion); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java new file mode 100644 index 0000000..a0badf3 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java @@ -0,0 +1,15 @@ +package com.mcwl.resource.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mcwl.resource.domain.Report; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@Mapper +public interface ReportMapper extends BaseMapper { +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java index 2664d26..88d8ec0 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowLikeMapper.java @@ -17,4 +17,6 @@ import org.apache.ibatis.annotations.Param; public interface WorkFlowLikeMapper extends BaseMapper { WorkFlowLike getLike(@Param("userId") Long userId, @Param("modelId") Long modelId); + void updateStatus(WorkFlowLike workFlowLike); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java index 5e77324..f98735e 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelVersionService.java @@ -1,6 +1,7 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.resource.domain.ModelVersion; import java.util.List; @@ -18,4 +19,6 @@ public interface ModelVersionService extends IService { List selectLogininforList(ModelVersion modelVersion); + AjaxResult selectByModelId(Long modelId); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java new file mode 100644 index 0000000..a45b898 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java @@ -0,0 +1,24 @@ +package com.mcwl.resource.service; + +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.vo.PageVo; + +/** + * 举报 业务层 + * + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +public interface ReportService { + void addReport(Report report); + + AjaxResult selectReport(PageVo pageVo); + + void deleteReport(Long id); + + void updateStatus(Long id); + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java index 7e56908..f25cf21 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java @@ -1,6 +1,8 @@ package com.mcwl.resource.service.impl; import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; @@ -14,6 +16,7 @@ import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.utils.SecurityUtils; 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.dto.ModelImagePageRes; @@ -28,6 +31,7 @@ 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.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -59,6 +63,9 @@ public class ModelServiceImpl extends ServiceImpl impl @Autowired private ISysUserService sysUserService; + @Autowired + private ThreadPoolTaskExecutor threadPoolTaskExecutor; + /** * 设置模型置顶状态 * @@ -93,8 +100,6 @@ public class ModelServiceImpl extends ServiceImpl impl mallProductLambdaQueryWrapper.eq(ModelProduct::getUserId,userId); mallProductLambdaQueryWrapper.eq(ModelProduct::getDelFlag,0); - - // 开始时间和结束时间过滤 if (mallProductVo.getStartTime() != null && mallProductVo.getEndTime() != null) { // 查询开始时间和结束时间之间的商品 @@ -135,7 +140,7 @@ public class ModelServiceImpl extends ServiceImpl impl page.addOrder(orderItem); LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); - lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditSatus, imagePageRes.getStatus()) + lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditStatus, imagePageRes.getStatus()) .eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId()) .ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime()) .le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime()); @@ -185,6 +190,9 @@ public class ModelServiceImpl extends ServiceImpl impl //批量添加版本 modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList()); + //执行审核方法 + audit(requestModel); + return AjaxResult.success("添加成功,等待审核"); } @@ -192,12 +200,13 @@ public class ModelServiceImpl extends ServiceImpl impl public void updaModel(RequestModel requestModel) { //修改模版的信息 ModelProduct modelProduct = requestModel.getModelProduct(); - if (ObjectUtils.isEmpty(modelProduct)){ + if (ObjectUtils.isNotEmpty(modelProduct)){ - } - if (StringUtils.isNotNull(modelProduct.getId())){ - modelProduct.setAuditSatus(3); - postMapper.updateModel(requestModel.getModelProduct()); + if (StringUtils.isNotNull(modelProduct.getId())){ + modelProduct.setAuditStatus(3); + modelProduct.setUpdateTime(new Date()); + postMapper.updateById(requestModel.getModelProduct()); + } } //修改工作流版本的信息 @@ -205,7 +214,7 @@ public class ModelServiceImpl extends ServiceImpl impl //批量修改 for (ModelVersion modelVersion : requestModel.getModelVersionList()) { - modelVersion.setAuditSatus(3); + modelVersion.setAuditStatus(3); modelVersionMapper.updateById(modelVersion); } @@ -214,9 +223,11 @@ public class ModelServiceImpl extends ServiceImpl impl getModelId()).build(); model.setUpdateTime(new Date()); postMapper.updateById(model); - } + //审核 + audit(requestModel); + } @Override diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java index 974ae78..773a9e1 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelVersionServiceImpl.java @@ -2,13 +2,17 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.DictConstants; +import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.mapper.ModelVersionMapper; import com.mcwl.resource.service.ModelVersionService; +import com.mcwl.system.init.DictInit; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /**模型版本 业务实现层 @@ -49,15 +53,30 @@ public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,Mo return modelVersionMapper.selectList(queryWrapper); } + @Override + public AjaxResult selectByModelId(Long modelId) { + //根据模型ID查询所有的版本信息 + LambdaQueryWrapper modelVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + modelVersionLambdaQueryWrapper.eq(ModelVersion::getModelId,modelId); + modelVersionLambdaQueryWrapper.eq(ModelVersion::getDelFlag,0); + List modelVersions = modelVersionMapper.selectList(modelVersionLambdaQueryWrapper); + for (ModelVersion modelVersion : modelVersions) { + ArrayList arrayList = new ArrayList<>(); + //获取 + String[] split = modelVersion.getHigh().split(","); + for (String s : split) { + arrayList.add(DictInit.getDictValue(DictConstants.DICT_TYPE_MODEL_VERSION_HIGH,s)); + } - - - + modelVersion.setHighList(arrayList); + } + return AjaxResult.success(modelVersions); + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java new file mode 100644 index 0000000..552505a --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java @@ -0,0 +1,72 @@ +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.core.domain.AjaxResult; +import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.mapper.ReportMapper; +import com.mcwl.resource.service.ReportService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * 举报 业务实现层 + * + * @author DaiZibo + * @date 2025/1/18 + * @apiNote + */ + +@Service +public class ReportServiceImpl implements ReportService { + + + @Autowired + private ReportMapper reportMapper; + + @Override + public void addReport(Report report) { + + report.setCreateTime(new Date()); + report.setUserId(SecurityUtils.getUserId()); + reportMapper.insert(report); + } + + @Override + public AjaxResult selectReport(PageVo pageVo) { + + Page page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); + + //构造查询条件 + LambdaQueryWrapper reportLambdaQueryWrapper = new LambdaQueryWrapper<>(); + reportLambdaQueryWrapper.eq(Report::getDelFlag, 0); + if (pageVo.getType() != null) { + reportLambdaQueryWrapper.eq(Report::getStatus, 0); + } + + return AjaxResult.success(reportMapper.selectPage(page, reportLambdaQueryWrapper)); + } + + @Override + public void deleteReport(Long id) { + + Report report = new Report().builder().id(id) + .delFlag(2).build(); + + reportMapper.updateById(report); + } + + @Override + public void updateStatus(Long id) { + + Report report = new Report().builder().id(id) + .status(1) + .build(); + + reportMapper.updateById(report); + } +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java index 66a2546..6284e04 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowCommentServiceImpl.java @@ -40,10 +40,12 @@ public class WorkFlowCommentServiceImpl extends ServiceImpl i } //修改为合格 + workFlow.setAuditText(""); workFlow.setAuditStatus(workFlow.getJurisdiction()); flowMapper.updateById(workFlow); } @@ -170,7 +171,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } // 使用逗号拼接所有的失败原因 String concatenatedReasons = String.join(", ", failureReasons); - workFlow.setAuditText(concatenatedReasons); + workFlowVersion.setAuditText(concatenatedReasons); workFlowVersion.setAuditStatus(4); //校验id是否存在 区别修改审核或者新增审核 if (workFlowVersion.getId() != null){ @@ -202,7 +203,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } // 使用逗号拼接所有的失败原因 String concatenatedReasons = String.join(", ", failureReasons); - workFlow.setAuditText(concatenatedReasons); + workFlowVersion.setAuditText(concatenatedReasons); workFlowVersion.setAuditStatus(4); //校验id是否存在 区别修改审核或者新增审核 if (workFlowVersion.getId() != null){ @@ -217,6 +218,7 @@ public class WorkFlowServiceImpl extends ServiceImpl i } //修改版本成功审核状态 + workFlow.setAuditText(""); workFlowVersion.setAuditStatus(1); workFlowVersionMapper.updateByName(workFlowVersion); log.info("全部通过审核"); diff --git a/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml index 7ac880f..b9dce78 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml @@ -7,24 +7,30 @@ INSERT INTO model_version ( - version_name, model_type, file_path, trigger_words, sampling, high, vae, cfg, + model_id,version_name, model_type, file_path, trigger_words, sampling, high, vae, cfg, is_free, is_public, is_encrypt, is_online_use, allow_download_image, allow_software_use, allow_fusion, allow_commercial_use, allow_usage, is_exclusive_model, sample_image_paths, hide_image_gen_info, audit_status, audit_text, del_flag ) VALUES - + ( - #{item.versionName}, #{item.modelType}, #{item.filePath}, #{item.triggerWords}, + #{modelProduct.id},#{item.versionName}, #{item.modelType}, #{item.filePath}, #{item.triggerWords}, #{item.sampling}, #{item.high}, #{item.vae}, #{item.cfg}, #{item.isFree}, #{item.isPublic}, #{item.isEncrypt}, #{item.isOnlineUse}, #{item.allowDownloadImage}, #{item.allowSoftwareUse}, #{item.allowFusion}, #{item.allowCommercialUse}, #{item.allowUsage}, #{item.isExclusiveModel}, - #{item.sampleImagePaths}, #{item.hideImageGenInfo}, #{item.auditStatus}, - #{item.auditText}, #{item.delFlag} + #{item.sampleImagePaths}, #{item.hideImageGenInfo}, 3, + #{item.auditText},'0' ) + + update model_version set audit_status = #{auditStatus}, + audit_text = #{auditText} + where version_name = #{versionName} and model_id = #{modelId} + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml index c8d918b..f40d9d2 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowLikeMapper.xml @@ -4,18 +4,31 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + UPDATE work_flow_like + SET user_id = #{userId}, + work_flow_id = #{workFlowId}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + del_flag = #{delFlag} + WHERE id = #{id} + +