Compare commits

...

10 Commits

Author SHA1 Message Date
Diyu0904 7a742d7338 修复图片审核 2025-01-21 17:30:38 +08:00
ChenYan 382f32de5f Merge remote-tracking branch 'origin/preview' into preview
# Conflicts:
#	mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java
2025-01-21 17:27:10 +08:00
ChenYan 02c090a971 feat 是否置顶 2025-01-21 17:25:46 +08:00
Diyu0904 2b791a875a 合并分支 图片审核+模型审核待合并 2025-01-21 17:15:45 +08:00
Diyu0904 cb5af5202f Merge branch 'feature/admin' into preview
# Conflicts:
#	mcwl-resource/src/main/java/com/mcwl/resource/domain/ModelImage.java
#	mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java
2025-01-21 17:05:14 +08:00
ChenYan 7b0c1f6fbf Merge branch 'preview' of https://gitea.qinmian.online/CY/mcwl-ai into preview
# Conflicts:
#	mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java
2025-01-21 16:55:15 +08:00
ChenYan d8c964f98b feat 是否置顶 2025-01-21 16:45:00 +08:00
yang b2a3596f20 feat: 会员和邀请添加swagger注解 2025-01-21 13:07:58 +08:00
yang f77029ead8 Merge branch 'feature/community-center' into preview 2025-01-20 16:43:29 +08:00
yang e34ce61003 feat: 图片、文件筛选 2025-01-20 16:43:00 +08:00
41 changed files with 624 additions and 175 deletions

View File

@ -5,17 +5,16 @@ 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.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
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 javax.validation.Valid;
import java.util.List;
/**
*

View File

@ -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);
}
/**
*
*/

View File

@ -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);
}
/**
*
*/

View File

@ -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);

View File

@ -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<MemberLevel> memberLevelList = memberLevelService.list();
@ -41,6 +45,7 @@ public class MemberLevelController {
*
*/
@GetMapping("getMemberBenefitList")
@ApiOperation(value = "获取会员等级及权益列表")
public AjaxResult getMemberBenefitList() {
List<MemberBenefitVO> memberBenefitVOList = new ArrayList<>();

View File

@ -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<Promotion> 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();

View File

@ -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<Invitation> 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();

View File

@ -18,9 +18,12 @@ 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;
/**
*
@ -152,6 +155,42 @@ public class MallProductController extends BaseController {
return modelService.selectModelById(id);
}
/**
*
* @param id
* @param isTop
* @return
*/
@ApiOperation(value = "设置模型置顶状态")
@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
*/
@ApiOperation(value = "获取置顶的模型列表")
@GetMapping
public ResponseEntity<List<ModelProduct>> fetchModelsSortedByTopStatus() {
List<ModelProduct> models = modelService.fetchModelsSortedByTopStatus();
return ResponseEntity.ok(models);
}
/**
* -
*/
@ -219,4 +258,6 @@ public class MallProductController extends BaseController {
}
}

View File

@ -8,6 +8,7 @@ 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;
@ -17,9 +18,11 @@ 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;
/**
@ -102,5 +105,33 @@ public class ModelImageController {
}
/**
*
* @param id
* @param isTop
* @return
*/
@ApiOperation(value = "设置图片置顶状态")
@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
*/
@ApiOperation(value = "获取置顶的图片列表")
@GetMapping
public ResponseEntity<List<ModelImage>> fetchModelImagesSortedByTopStatus() {
List<ModelImage> models = modelImageLikeService.fetchModelImageSortedByTopStatus();
return ResponseEntity.ok(models);
}
}

View File

@ -2,6 +2,8 @@ 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;
@ -9,9 +11,12 @@ 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;
/**
*
@ -31,6 +36,38 @@ public class WorkFlowController extends BaseController {
@Autowired
private WorkFlowServiceImpl workFlowService;
/**
*
* @param id
* @param isTop
* @return
*/
@ApiOperation(value = "设置工作流的置顶状态")
@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
*/
@ApiOperation(value = "获取置顶的模型列表")
@GetMapping
public ResponseEntity<List<WorkFlow>> fetchWorkFlowSortedByTopStatus() {
List<WorkFlow> models = workFlowService.fetchWorkFlowSortedByTopStatus();
return ResponseEntity.ok(models);
}
/***
*
* @param file

View File

@ -1,53 +0,0 @@
///*
// * 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

@ -1,58 +0,0 @@
///*
// * 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

@ -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;
/**
*
*/

View File

@ -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;
/**
* -

View File

@ -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;
/**
* -
*/

View File

@ -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;

View File

@ -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<Publish> {
@ -22,4 +24,19 @@ public interface PublishMapper extends BaseMapper<Publish> {
Long tenantId,
@Param("communityId")
Long communityId);
@InterceptorIgnore(tenantLine = "true")
Page<Publish> selectByTenantIdAndCommunityIdAndNotNullImagePage(Page<Publish> page,
@Param("tenantId")
Long tenantId,
@Param("communityId")
Long communityId);
@InterceptorIgnore(tenantLine = "true")
Page<Publish> selectByTenantIdAndCommunityIdAndNotNullFilePage(Page<Publish> page,
@Param("tenantId")
Long tenantId,
@Param("communityId")
Long communityId);
}

View File

@ -30,4 +30,15 @@ public interface QuestionMapper extends BaseMapper<Question> {
Long tenantId,
@Param("communityId")
Long communityId);
@InterceptorIgnore(tenantLine = "true")
Page<Question> listImage(Page<Question> page,
@NotNull(message = "租户不能为空")
@Param("tenantId")
Long tenantId,
@NotNull(message = "社区不能为空")
@Param("communityId")
Long communityId,
@Param("status")
Integer status);
}

View File

@ -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<Publish> {
AjaxResult publish(PublishRes publishRes);
TableDataInfo getPublishList(PublishPageRes publishPageRes);
TableDataInfo publishImage(@Valid PublishPageRes publishPageRes);
TableDataInfo publishFile(@Valid PublishPageRes publishPageRes);
}

View File

@ -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<Question> {
@ -30,4 +31,6 @@ public interface QuestionService extends IService<Question> {
* @param questionReplyRes
*/
AjaxResult reply(QuestionReplyRes questionReplyRes);
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
}

View File

@ -98,15 +98,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
@Override
public TableDataInfo getPublishList(PublishPageRes publishPageRes) {
Page<Publish> 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<Publish> page = this.initPage(publishPageRes);
// 根据租户id和社区id查询分页数据
baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
@ -133,4 +125,77 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
tableDataInfo.setMsg("查询成功");
return tableDataInfo;
}
@Override
public TableDataInfo publishImage(PublishPageRes publishPageRes) {
Page<Publish> page = this.initPage(publishPageRes);
// 根据租户id和社区id和fileUrl不为空查询分页数据
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
List<Publish> publishList = page.getRecords();
List<PublishVo> 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<Publish> page = this.initPage(publishPageRes);
// 根据租户id和社区id和imageUrl不为空查询分页数据
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
List<Publish> publishList = page.getRecords();
List<PublishVo> 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<Publish> initPage(PublishPageRes publishPageRes) {
Page<Publish> 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;
}
}

View File

@ -103,14 +103,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
@Override
public TableDataInfo list(QuestionPageRes questionPageRes) {
Page<Question> 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<Question> page = initPage(questionPageRes);
baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
@ -191,5 +184,49 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
}
@Override
public TableDataInfo listImage(QuestionPageRes questionPageRes) {
Page<Question> page = initPage(questionPageRes);
baseMapper.listImage(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
// 获取分页数据
List<Question> questionList = page.getRecords();
// Question数据转为QuestionVo
List<QuestionVo> 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<Question> initPage(QuestionPageRes questionPageRes) {
Page<Question> 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;
}
}

View File

@ -4,18 +4,84 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
<select id="selectByTenantIdAndCommunityIdPage" resultType="com.mcwl.communityCenter.domain.Publish">
select id, tenant_id, community_id, user_id, content, publish_time, like_num, comment_num, status, create_by, create_time
select id,
tenant_id,
community_id,
user_id,
content,
image_url,
file_url,
publish_time,
like_num,
comment_num,
status,
create_by,
create_time
from cc_publish
where tenant_id = #{tenantId}
and community_id = #{communityId}
and del_flag = '0'
</select>
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Publish">
select id, tenant_id, community_id, user_id, content, publish_time, like_num, comment_num, status, create_by, create_time
select id,
tenant_id,
community_id,
user_id,
content,
image_url,
file_url,
publish_time,
like_num,
comment_num,
status,
create_by,
create_time
from cc_publish
where id = #{id}
and tenant_id = #{tenantId}
and community_id = #{communityId}
and del_flag = '0'
</select>
<select id="selectByTenantIdAndCommunityIdAndNotNullImagePage"
resultType="com.mcwl.communityCenter.domain.Publish">
select id,
tenant_id,
community_id,
user_id,
content,
image_url,
file_url,
publish_time,
like_num,
comment_num,
status,
create_by,
create_time
from cc_publish
where tenant_id = #{tenantId}
and community_id = #{communityId}
and del_flag = '0'
and image_url is not null
</select>
<select id="selectByTenantIdAndCommunityIdAndNotNullFilePage"
resultType="com.mcwl.communityCenter.domain.Publish">
select id,
tenant_id,
community_id,
user_id,
content,
image_url,
file_url,
publish_time,
like_num,
comment_num,
status,
create_by,
create_time
from cc_publish
where tenant_id = #{tenantId}
and community_id = #{communityId}
and del_flag = '0'
and file_url is not null
</select>
</mapper>

View File

@ -23,4 +23,15 @@
and community_id = #{communityId}
and del_flag = '0'
</select>
<select id="listImage" resultType="com.mcwl.communityCenter.domain.Question">
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
from cc_question
where del_flag = '0'
and tenant_id = #{tenantId}
and community_id = #{communityId}
<if test="status != null">
and status= #{status}
</if>
and question_url is not null
</select>
</mapper>

View File

@ -123,6 +123,14 @@ public class ModelProduct extends BaseEntity {
*/
@ApiModelProperty(value = "是否推荐模型")
private Integer isRecommend;
/**
*
*/
@ApiModelProperty(value = "是否置顶")
private Integer isTop;
/**
* 0 2
*/

View File

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

View File

@ -5,7 +5,15 @@ 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,6 +6,8 @@ import com.mcwl.resource.domain.ModelProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
@ -27,4 +29,11 @@ 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,6 +4,8 @@ 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
@ -16,4 +18,9 @@ public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
void updateWorkFlow(WorkFlow workFlow);
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
void setworkFlowTop(Long id, int i);
}

View File

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

View File

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

View File

@ -8,6 +8,8 @@ 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
@ -29,4 +31,9 @@ public interface WorkFlowService extends IService<WorkFlow> {
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
void setworkFlowTop(Long id, boolean isTop);
List<WorkFlow> fetchWorkFlowSortedByTopStatus();
}

View File

@ -46,19 +46,27 @@ 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) && Objects.isNull(mic)) {
return;
if (Objects.nonNull(parentId)) {
ModelComment mic = modelCommentMapper.selectById(parentId);
if (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,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service
@ -58,4 +59,14 @@ 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

@ -66,7 +66,27 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
@Autowired
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
/**
*
*
* @param id 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) {
@ -176,6 +196,39 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
return AjaxResult.success("添加成功,等待审核");
}
@Override
public void updaModel(RequestModel requestModel) {
//修改模版的信息
ModelProduct modelProduct = requestModel.getModelProduct();
if (ObjectUtils.isNotEmpty(modelProduct)){
if (StringUtils.isNotNull(modelProduct.getId())){
modelProduct.setAuditStatus(3);
modelProduct.setUpdateTime(new Date());
postMapper.updateById(requestModel.getModelProduct());
}
}
//修改工作流版本的信息
if (requestModel.getModelVersionList().size() != 0){
//批量修改
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
modelVersion.setAuditStatus(3);
modelVersionMapper.updateById(modelVersion);
}
ModelProduct model = ModelProduct.builder().
id(requestModel.getModelVersionList().get(0).
getModelId()).build();
model.setUpdateTime(new Date());
postMapper.updateById(model);
}
//审核
audit(requestModel);
}
private void audit(RequestModel requestModel) {
// 执行审核操作
@ -313,39 +366,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
}
@Override
public void updaModel(RequestModel requestModel) {
//修改模版的信息
ModelProduct modelProduct = requestModel.getModelProduct();
if (ObjectUtils.isNotEmpty(modelProduct)){
if (StringUtils.isNotNull(modelProduct.getId())){
modelProduct.setAuditStatus(3);
modelProduct.setUpdateTime(new Date());
postMapper.updateById(requestModel.getModelProduct());
}
}
//修改工作流版本的信息
if (requestModel.getModelVersionList().size() != 0){
//批量修改
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
modelVersion.setAuditStatus(3);
modelVersionMapper.updateById(modelVersion);
}
ModelProduct model = ModelProduct.builder().
id(requestModel.getModelVersionList().get(0).
getModelId()).build();
model.setUpdateTime(new Date());
postMapper.updateById(model);
}
//审核
audit(requestModel);
}
@Override
public AjaxResult selectModelById(Long id) {
@ -384,4 +404,6 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
}
}

View File

@ -387,5 +387,15 @@ 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,6 +3,12 @@
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,6 +69,9 @@
</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">
@ -81,5 +84,8 @@
<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,4 +31,11 @@
</set>
WHERE id = #{id}
</update>
<update id="setworkFlowTop">
UPDATE work_flow SET is_top = #{isTop} 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>