Compare commits
46 Commits
d49115ec61
...
b164460829
Author | SHA1 | Date |
---|---|---|
|
b164460829 | |
|
a8bf9b7390 | |
|
925705caaa | |
|
f2c3d73071 | |
|
0fc813f3a0 | |
|
b5ca5718f6 | |
|
3fed564e38 | |
|
d97050a4ef | |
|
484c99504a | |
|
5ef3c1bcd3 | |
|
ab147addea | |
|
88c9a15fed | |
|
ba0cc48174 | |
|
2ba9f440d3 | |
|
7d05307a4c | |
|
3c13cafd86 | |
|
b265f24f81 | |
|
1ef75e6bda | |
|
b1b884a82e | |
|
c1b6dac662 | |
|
436ff6877c | |
|
d09410bee7 | |
|
e31b12fd39 | |
|
537997deab | |
|
170ca3da7e | |
|
6ae9eca9b6 | |
|
f88c68ac0a | |
|
aecbdb60e1 | |
|
6fee8248de | |
|
9dcf061dcb | |
|
02d8dc45dd | |
|
83b07054a1 | |
|
7efb7973ef | |
|
58839f1f12 | |
|
1398011ee5 | |
|
fa542d1569 | |
|
f93986f743 | |
|
5f6844dc29 | |
|
f41ab7b899 | |
|
09a7640d6e | |
|
171100a643 | |
|
c2f0ada4f1 | |
|
3ebcf6e07e | |
|
ab5cc03786 | |
|
6a5ad7403a | |
|
40d37e42be |
|
@ -89,6 +89,12 @@
|
|||
<artifactId>mcwl-myInvitation</artifactId>
|
||||
<version>3.8.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-communityCenter</artifactId>
|
||||
<version>3.8.8</version>
|
||||
</dependency>
|
||||
<!-- 公共模块-->
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
|
@ -128,6 +134,46 @@
|
|||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-green</artifactId>
|
||||
<version>3.6.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.9</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.aliyun.oss</groupId>-->
|
||||
<!-- <artifactId>aliyun-sdk-oss</artifactId>-->
|
||||
<!-- <version>2.8.3</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.10</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.aliyun/imageaudit20191230 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>imageaudit20191230</artifactId>
|
||||
<version>2.0.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package com.mcwl;
|
||||
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.mcwl.pay.config.AliConfig;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
@ -17,6 +15,7 @@ import org.springframework.context.annotation.Bean;
|
|||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
@EnableConfigurationProperties
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class McWlApplication
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.aliyun.oss.OSS;
|
|||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.model.GetObjectRequest;
|
||||
import com.aliyun.oss.model.PutObjectRequest;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
|
@ -14,15 +13,17 @@ import java.util.UUID;
|
|||
/**
|
||||
* Oss服务调用
|
||||
*/
|
||||
@Log4j2
|
||||
public class OssUtil {
|
||||
|
||||
/**
|
||||
* Endpoint 存储对象概述 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限 访问路径前缀 存储对象概述
|
||||
*/
|
||||
private static String endPoint = "oss-cn-beijing.aliyuncs.com";
|
||||
|
||||
private static String accessKeyId = "LTAI5tSHZZ8wHJRP8X4r9TXT";
|
||||
|
||||
private static String accessKeySecret = "F82IVNx0IGJ3AnP6gSIfcyql1HCXIH";
|
||||
|
||||
private static String accessPre = "https://ybl2112.oss-cn-beijing.aliyuncs.com/";
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,6 @@ public class OssUtil {
|
|||
endPoint,
|
||||
accessKeyId,
|
||||
accessKeySecret);
|
||||
log.info("oss服务连接成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.dto.CommunityDto;
|
||||
import com.mcwl.communityCenter.domain.vo.CommunityVo;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 社区
|
||||
*/
|
||||
@Api(tags = "社区")
|
||||
@RestController
|
||||
@RequestMapping("community")
|
||||
@RequiredArgsConstructor
|
||||
public class CommunityController {
|
||||
|
||||
private final CommunityService communityService;
|
||||
|
||||
|
||||
/**
|
||||
* 社区列表
|
||||
*
|
||||
* @return 社区列表
|
||||
*/
|
||||
@ApiOperation(value = "社区列表")
|
||||
@PostMapping("list")
|
||||
public TableDataInfo getCommunityList(@RequestBody PageDomain pageDomain) {
|
||||
return communityService.listByPage(pageDomain);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加社区
|
||||
*
|
||||
* @param communityDto 社区参数
|
||||
* @return 添加结果
|
||||
*/
|
||||
@ApiOperation(value = "添加社区")
|
||||
@PostMapping("add")
|
||||
public AjaxResult addCommunity(@RequestBody CommunityDto communityDto) {
|
||||
Community community = new Community();
|
||||
BeanUtil.copyProperties(communityDto, community);
|
||||
communityService.save(community);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除社区
|
||||
*
|
||||
* @param id 社区id
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ApiOperation(value = "删除社区")
|
||||
@PostMapping("delete")
|
||||
public AjaxResult deleteCommunity(@NotNull(message = "id不能为空")
|
||||
@ApiParam(value = "id", required = true)
|
||||
Long id) {
|
||||
communityService.removeById(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.service.InviteService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 邀请
|
||||
*/
|
||||
@Api(tags = "邀请")
|
||||
@RestController
|
||||
@RequestMapping("invite")
|
||||
@RequiredArgsConstructor
|
||||
public class InviteController {
|
||||
|
||||
private final InviteService inviteService;
|
||||
|
||||
/**
|
||||
* 邀请码链接
|
||||
*/
|
||||
@ApiOperation(value = "邀请码链接")
|
||||
@GetMapping("inviteCode")
|
||||
public AjaxResult inviteCode(Long communityId) {
|
||||
// 获取邀请码链接
|
||||
String inviteCode = inviteService.getInviteCode(communityId);
|
||||
if (StringUtils.isBlank(inviteCode)) {
|
||||
return AjaxResult.warn("获取邀请码失败");
|
||||
}
|
||||
return AjaxResult.success(inviteCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接受邀请
|
||||
*/
|
||||
@ApiOperation(value = "接受邀请")
|
||||
@GetMapping("acceptInvite")
|
||||
public AjaxResult acceptInvite(@NotNull(message = "社区不能为空") Long communityId,
|
||||
@NotBlank(message = "邀请码不能为空") String inviteCode) {
|
||||
// 接受邀请
|
||||
boolean result = inviteService.acceptInvite(communityId, inviteCode);
|
||||
if (result) {
|
||||
return AjaxResult.success("接受邀请成功");
|
||||
}
|
||||
return AjaxResult.warn("接受邀请失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.communityCenter.domain.PublicModelCommentVo;
|
||||
import com.mcwl.communityCenter.domain.PublishCommission;
|
||||
import com.mcwl.communityCenter.service.PublishCommissionService;
|
||||
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 java.util.List;
|
||||
|
||||
/**社群评论
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.web.controller.communityCenter
|
||||
* @Filename:PublishCommissionController
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:21
|
||||
*/
|
||||
@Api(tags = "社群评论")
|
||||
@RequestMapping("PublishCommission")
|
||||
@RestController
|
||||
public class PublishCommissionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PublishCommissionService publishCommissionService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取评论
|
||||
* @param publishCommission
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取评论")
|
||||
@GetMapping("/comment/{Id}")
|
||||
public List<PublicModelCommentVo> getComment(@RequestBody PublishCommission publishCommission) {
|
||||
|
||||
return publishCommissionService.getComment(publishCommission);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加评论
|
||||
* @param publishCommission
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加评论")
|
||||
@PostMapping("/save")
|
||||
public ResponseEntity<String> save(@RequestBody PublishCommission publishCommission) {
|
||||
publishCommissionService.save(publishCommission);
|
||||
return ResponseEntity.ok("评论成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 点赞或取消点赞评论
|
||||
* @param userId 用户ID
|
||||
* @param commentId 评论ID
|
||||
* @return 更新后的点赞数
|
||||
*/
|
||||
@ApiOperation(value = "点赞或取消点赞评论")
|
||||
@PostMapping("/{commentId}/like")
|
||||
public ResponseEntity<Integer> toggleLike(@PathVariable Long commentId, @RequestParam Long userId) {
|
||||
int updatedLikes = publishCommissionService.toggleLike(userId, commentId);
|
||||
return ResponseEntity.ok(updatedLikes);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "删除评论")
|
||||
@DeleteMapping("/{id}")
|
||||
public ResponseEntity<String> delete(@PathVariable Long id) {
|
||||
publishCommissionService.removeById(id);
|
||||
return ResponseEntity.ok("删除成功");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.communityCenter.service.PublishCommissionLikeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**社群评论区点赞
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.web.controller.communityCenter
|
||||
* @Filename:PublishCommissionLikeController
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:21
|
||||
*/
|
||||
@Api(tags = "社群评论区点赞")
|
||||
@RestController
|
||||
@RequestMapping("PublishCommissionLike")
|
||||
public class PublishCommissionLikeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PublishCommissionLikeService publishCommissionLikeService;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.dto.PublishRes;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 发布
|
||||
*/
|
||||
@Api(tags = "发布")
|
||||
@RestController
|
||||
@RequestMapping("publish")
|
||||
@RequiredArgsConstructor
|
||||
public class PublishController {
|
||||
|
||||
private final PublishService publishService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取发布列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取发布列表")
|
||||
@PostMapping("list")
|
||||
public TableDataInfo getCommunityList(@RequestBody PageDomain pageDomain) {
|
||||
return publishService.listByPage(pageDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发布详情
|
||||
*/
|
||||
@ApiOperation(value = "获取发布详情")
|
||||
@GetMapping("detail")
|
||||
public AjaxResult getPublishDetail(Long id) {
|
||||
|
||||
PublishVo publishVo = publishService.getDetail(id);
|
||||
if (Objects.isNull(publishVo)) {
|
||||
return AjaxResult.error("获取详情失败");
|
||||
}
|
||||
return AjaxResult.success(publishVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
@ApiOperation(value = "添加")
|
||||
@PostMapping("add")
|
||||
public AjaxResult addPublish(@RequestBody PublishRes publishRes) {
|
||||
Publish publish = new Publish();
|
||||
BeanUtil.copyProperties(publishRes, publish);
|
||||
return AjaxResult.success(publishService.save(publish));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@GetMapping("remove")
|
||||
public AjaxResult deletePublish(Long id) {
|
||||
return AjaxResult.success(publishService.removeById(id));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.mcwl.web.controller.communityCenter;
|
||||
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionReplyDto;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||
import com.mcwl.communityCenter.service.QuestionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 提问
|
||||
*/
|
||||
@Api(tags = "提问")
|
||||
@RestController
|
||||
@RequestMapping("question")
|
||||
@RequiredArgsConstructor
|
||||
public class QuestionController {
|
||||
|
||||
|
||||
private final QuestionService questionService;
|
||||
|
||||
/**
|
||||
* 提问
|
||||
*/
|
||||
@PostMapping("addQuestion")
|
||||
@ApiOperation(value = "提问")
|
||||
public AjaxResult addQuestion(@RequestBody QuestionRes questionRes) {
|
||||
|
||||
questionService.addQuestion(questionRes);
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取未回复问题列表
|
||||
*/
|
||||
@GetMapping("listUnReplied")
|
||||
public TableDataInfo listUnReplied(QuestionPageRes questionPageRes) {
|
||||
|
||||
return questionService.listUnReplied(questionPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问题详情
|
||||
*/
|
||||
@GetMapping("detail")
|
||||
public AjaxResult getQuestionDetail(@NotNull(message = "id不能为空") Long id) {
|
||||
QuestionVo questionVo = questionService.getDetail(id);
|
||||
if (Objects.isNull(questionVo)) {
|
||||
return AjaxResult.error("获取详情失败");
|
||||
}
|
||||
return AjaxResult.success(questionVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复
|
||||
*/
|
||||
@PostMapping("reply")
|
||||
public AjaxResult reply(QuestionReplyDto questionReplyDto) {
|
||||
|
||||
questionService.reply(questionReplyDto);
|
||||
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -152,5 +152,17 @@ public class MemberController {
|
|||
return AjaxResult.success(unitPrice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是会员
|
||||
*/
|
||||
@GetMapping("isMember")
|
||||
public AjaxResult isMember() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
Member member = memberService.getUseUserMemberByUserId(userId);
|
||||
if (Optional.ofNullable(member).isPresent()) {
|
||||
return AjaxResult.success(true);
|
||||
}
|
||||
return AjaxResult.success(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,14 +10,11 @@ import com.alipay.api.AlipayConfig;
|
|||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.diagnosis.DiagnosisUtils;
|
||||
import com.alipay.api.domain.AlipayFundAccountQueryModel;
|
||||
import com.alipay.api.domain.AlipayFundTransToaccountTransferModel;
|
||||
import com.alipay.api.domain.AlipayFundTransUniTransferModel;
|
||||
import com.alipay.api.domain.Participant;
|
||||
import com.alipay.api.request.AlipayFundAccountQueryRequest;
|
||||
import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
||||
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
|
||||
import com.alipay.api.response.AlipayFundAccountQueryResponse;
|
||||
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
||||
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
|
@ -25,14 +22,11 @@ import com.alipay.easysdk.payment.facetoface.models.AlipayTradePrecreateResponse
|
|||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.memberCenter.domain.MemberLevel;
|
||||
import com.mcwl.memberCenter.service.MemberLevelService;
|
||||
import com.mcwl.memberCenter.service.MemberService;
|
||||
import com.mcwl.pay.config.AliConfig;
|
||||
import com.mcwl.pay.domain.OrderTrade;
|
||||
import com.mcwl.pay.domain.OrderTradeDto;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.lang.UUID;
|
|||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alipay.easysdk.factory.Factory;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import com.alipay.easysdk.payment.common.models.AlipayTradeQueryResponse;
|
||||
import com.mcwl.common.JSONUtils;
|
||||
import com.mcwl.common.annotation.Anonymous;
|
||||
|
@ -16,15 +17,15 @@ import com.mcwl.common.utils.SecurityUtils;
|
|||
import com.mcwl.pay.domain.OrderTrade;
|
||||
import com.mcwl.pay.domain.OrderTradeDto;
|
||||
import com.mcwl.pay.service.OrderTradeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.alipay.easysdk.kernel.Config;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
|
@ -35,7 +36,6 @@ import java.util.*;
|
|||
* @Date:2025/1/3 14:46
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/web/pay")
|
||||
@Validated
|
||||
|
@ -177,7 +177,7 @@ public class OrderTradeController extends BaseController {
|
|||
@PostMapping("/notify") // 注意这里必须是POST接口
|
||||
public String payNotify(HttpServletRequest request) throws Exception {
|
||||
|
||||
log.info("已经进入回调接口");
|
||||
|
||||
if (request.getParameter("trade_status").equals("TRADE_SUCCESS")) {
|
||||
System.out.println("=========支付宝异步回调========");
|
||||
|
||||
|
|
|
@ -1,24 +1,74 @@
|
|||
package com.mcwl.web.controller.rabbitmq.consumer;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.mcwl.common.constant.RedisConstants;
|
||||
import com.mcwl.common.core.domain.model.PhoneLoginBody;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.utils.uuid.TelSmsUtils;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 手机号登录短信验证码消费者
|
||||
*
|
||||
* @author DaiZibo
|
||||
* @date 2024/12/30
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
|
||||
@Component
|
||||
public class CodeConsumer {
|
||||
|
||||
@RabbitListener(queues = QueueConstants.CODE_QUEUE)
|
||||
public void code(String msg) {
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, String> redisTemplate;
|
||||
|
||||
@RabbitListener(queues = QueueConstants.CODE_QUEUE)
|
||||
public void code(Message message, Channel channel, String msg) {
|
||||
|
||||
|
||||
if (msg == "") {
|
||||
return;
|
||||
}
|
||||
String messageId = message.getMessageProperties().getMessageId();
|
||||
try {
|
||||
Long add = redisTemplate.opsForSet().add(RedisConstants.CODE_UUID + messageId, "1");
|
||||
redisTemplate.expire(RedisConstants.CODE_UUID + messageId, 2, TimeUnit.MINUTES);
|
||||
if (add > 0) {
|
||||
PhoneLoginBody phoneLoginBody = JSON.parseObject(msg, PhoneLoginBody.class);
|
||||
|
||||
//发送短信服务
|
||||
// 构建 sendDataMap
|
||||
Map<String, String> sendDataMap = new HashMap<>();
|
||||
sendDataMap.put("code", phoneLoginBody.getCode());
|
||||
String s1 = TelSmsUtils.sendSms(phoneLoginBody.getPhone(), "SMS_478520014", sendDataMap);
|
||||
|
||||
|
||||
//手动确认
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}else {
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
//删除标记
|
||||
redisTemplate.delete(RedisConstants.CODE_UUID+messageId);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
log.info("消费者获取到的数据:{}", msg);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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;
|
||||
|
@ -10,23 +10,20 @@ 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.domain.request.RequestWorkFlow;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.resource.service.ModelService;
|
||||
import com.mcwl.resource.service.WorkFlowService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
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.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*
|
||||
*模型
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.resource
|
||||
|
@ -34,7 +31,7 @@ import java.util.List;
|
|||
* @Description 商品
|
||||
* @Date:2024/12/31 10:48
|
||||
*/
|
||||
|
||||
@Api(tags = "模型")
|
||||
@RestController
|
||||
@RequestMapping("/model")
|
||||
public class MallProductController extends BaseController {
|
||||
|
@ -56,6 +53,8 @@ public class MallProductController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiModelProperty("图片")
|
||||
@Anonymous
|
||||
@PostMapping("/file")
|
||||
public AjaxResult Malifile(@RequestParam MultipartFile file) {
|
||||
|
||||
|
@ -70,6 +69,7 @@ public class MallProductController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "zip")
|
||||
@PostMapping("/zipUrlFile")
|
||||
public AjaxResult zipUrlFile(@RequestParam MultipartFile file) {
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
|
@ -83,6 +83,7 @@ public class MallProductController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "zip")
|
||||
@PostMapping("/zipUrl")
|
||||
public AjaxResult zipUrl(@RequestParam MultipartFile file) {
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
|
@ -93,6 +94,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 模型列表
|
||||
*/
|
||||
@ApiOperation(value = "模型列表")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -100,6 +102,7 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模型详情")
|
||||
@PostMapping("finbyid")
|
||||
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion) {
|
||||
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
|
||||
|
@ -107,6 +110,7 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "添加模型")
|
||||
@PostMapping("/insert")
|
||||
public AjaxResult addupdateModel(@RequestBody RequestModel requestModel) {
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
@ -116,6 +120,7 @@ public class MallProductController extends BaseController {
|
|||
return modelService.addModel(requestModel);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改模型")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult updateModel(@RequestBody RequestModel requestModel) {
|
||||
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||
|
@ -129,6 +134,7 @@ public class MallProductController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "删除模型")
|
||||
@PostMapping("delete")
|
||||
public AjaxResult delete(@RequestBody ModelProduct modelVersion) {
|
||||
modelService.removeById(modelVersion.getId());
|
||||
|
@ -139,6 +145,7 @@ public class MallProductController extends BaseController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询模型详情")
|
||||
@GetMapping("/selectModelById")
|
||||
public AjaxResult selectModelById(@RequestParam Long id){
|
||||
|
||||
|
@ -148,6 +155,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 我的发布-模型
|
||||
*/
|
||||
@ApiOperation(value = "我的发布-模型")
|
||||
@PostMapping("/selectByUserIdModel")
|
||||
public TableDataInfo selectByUserIdModel(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -157,6 +165,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 我的发布-工作流
|
||||
*/
|
||||
@ApiOperation(value = "我的发布-工作流")
|
||||
@PostMapping("/selectByUserIdWorkFlow")
|
||||
public TableDataInfo selectByUserIdWorkFlow(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -166,6 +175,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 我的发布-图片
|
||||
*/
|
||||
@ApiOperation(value = "我的发布-图片")
|
||||
@PostMapping("/selectByUserIdImage")
|
||||
public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes) {
|
||||
|
||||
|
@ -175,6 +185,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 点赞-模型
|
||||
*/
|
||||
@ApiOperation(value = "点赞-模型")
|
||||
@PostMapping("/likeModel")
|
||||
public TableDataInfo likeModel(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
|
@ -186,6 +197,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 点赞-工作流
|
||||
*/
|
||||
@ApiOperation(value = "点赞-工作流")
|
||||
@PostMapping("/likeWorkFlow")
|
||||
public TableDataInfo likeWorkFlow(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
|
@ -197,6 +209,7 @@ public class MallProductController extends BaseController {
|
|||
/**
|
||||
* 点赞-图片
|
||||
*/
|
||||
@ApiOperation(value = "点赞-图片")
|
||||
@PostMapping("/likeImage")
|
||||
public TableDataInfo likeImage(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.service.MallProductLikeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 点赞商品
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/2
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@RequestMapping("/like")
|
||||
@RestController
|
||||
public class MallProductLikeController {
|
||||
|
||||
@Autowired
|
||||
private MallProductLikeService mallProductLikeService;
|
||||
|
||||
/**
|
||||
* 查询用户点赞作品列表
|
||||
* @param mallProductVo
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/selectByUserLike")
|
||||
public AjaxResult selectByUserLike(@RequestBody MallProductVo mallProductVo){
|
||||
|
||||
Page<ModelProduct> mallProductPage = mallProductLikeService.selectByUserLike(mallProductVo);
|
||||
return AjaxResult.success(mallProductPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/删除点赞商品
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
@RepeatSubmit
|
||||
@GetMapping("/addLike")
|
||||
public AjaxResult addLike(@RequestParam Long productId){
|
||||
|
||||
return mallProductLikeService.addLike(productId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看作品是否点赞
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectLike")
|
||||
public AjaxResult selectLike(@RequestParam Long productId){
|
||||
Boolean aBoolean = mallProductLikeService.selectLike(productId);
|
||||
return AjaxResult.success(aBoolean);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -7,13 +7,15 @@ import com.mcwl.resource.domain.vo.ModelCommentVo;
|
|||
import com.mcwl.resource.service.ModelCommentLikeService;
|
||||
import com.mcwl.resource.service.ModelCommentService;
|
||||
import com.mcwl.resource.service.ModelLikeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**模型评论
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.resource
|
||||
|
@ -21,6 +23,7 @@ import java.util.List;
|
|||
* @Description TODO
|
||||
* @Date:2025/1/12 11:36
|
||||
*/
|
||||
@Api(tags = "模型评论")
|
||||
@RequestMapping("/ModelComment")
|
||||
@RestController
|
||||
public class ModelCommentController {
|
||||
|
@ -37,6 +40,7 @@ public class ModelCommentController {
|
|||
/**
|
||||
* 模型点赞/取消
|
||||
*/
|
||||
@ApiOperation(value = "模型点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/modelLike/{modelId}")
|
||||
public AjaxResult like(@PathVariable Long imageId) {
|
||||
|
@ -48,6 +52,7 @@ public class ModelCommentController {
|
|||
/**
|
||||
* 模型评论发布
|
||||
*/
|
||||
@ApiOperation(value = "模型评论发布")
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@RequestBody ModelComment modelComment) {
|
||||
modelCommentService.comment(modelComment);
|
||||
|
@ -57,6 +62,7 @@ public class ModelCommentController {
|
|||
/**
|
||||
* 模型评论点赞/取消
|
||||
*/
|
||||
@ApiOperation(value = "模型评论点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/commentLike/{commentId}")
|
||||
public AjaxResult commentLike(@PathVariable Long commentId) {
|
||||
|
@ -69,6 +75,7 @@ public class ModelCommentController {
|
|||
/**
|
||||
* 获取模型评论
|
||||
*/
|
||||
@ApiOperation(value = "获取模型评论")
|
||||
@GetMapping("/comment/{modelId}")
|
||||
public AjaxResult getComment(@PathVariable @NotNull(message = "模型id不能为空") Long modelId) {
|
||||
List<ModelCommentVo> modelCommentList = modelCommentService.getComment(modelId);
|
||||
|
@ -79,6 +86,7 @@ public class ModelCommentController {
|
|||
/**
|
||||
* 删除模型评论
|
||||
*/
|
||||
@ApiOperation(value = "删除模型评论")
|
||||
@GetMapping("/commentDelete/{commentId}")
|
||||
public AjaxResult commentDelete(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelCommentService.removeById(commentId);
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.annotation.RepeatSubmit;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
import com.mcwl.resource.service.ModelImageCommentService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@Api(tags = "图片评论")
|
||||
@RestController
|
||||
@RequestMapping("/imageComment")
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageCommentController {
|
||||
|
||||
private final ModelImageService modelImageService;
|
||||
|
||||
private final ModelImageCommentLikeService modelImageCommentLikeService;
|
||||
|
||||
private final ModelImageCommentService modelImageCommentService;
|
||||
|
||||
|
||||
/**
|
||||
* 图片评论发布
|
||||
*/
|
||||
@ApiOperation(value = "图片评论发布")
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@RequestBody ModelImageCommentRes modelImageCommentRes) {
|
||||
modelImageService.comment(modelImageCommentRes);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片评论点赞/取消
|
||||
*/
|
||||
@ApiOperation(value = "图片评论点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/commentLike/{commentId}")
|
||||
public AjaxResult commentLike(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelImageCommentLikeService.like(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片评论
|
||||
*/
|
||||
@ApiOperation(value = "删除图片评论")
|
||||
@GetMapping("/commentDelete/{commentId}")
|
||||
public AjaxResult commentDelete(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelImageCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片评论
|
||||
*/
|
||||
@ApiOperation(value = "获取图片评论")
|
||||
@GetMapping("/comment/{imageId}")
|
||||
public AjaxResult getComment(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
List<ModelImageCommentVo> modelImageCommentVoList = modelImageService.getComment(imageId);
|
||||
return AjaxResult.success(modelImageCommentVoList);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -7,31 +7,27 @@ import com.mcwl.common.core.domain.entity.SysUser;
|
|||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.oss.OssUtil;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
import com.mcwl.resource.domain.vo.ModelImageCommentVo;
|
||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
import com.mcwl.resource.service.ModelImageCommentService;
|
||||
import com.mcwl.resource.service.ModelImageLikeService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
@Api(tags = "图片")
|
||||
@RestController
|
||||
@RequestMapping("/modelImage")
|
||||
@RequestMapping("/image")
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageController {
|
||||
|
||||
|
@ -39,16 +35,13 @@ public class ModelImageController {
|
|||
|
||||
private final ModelImageLikeService modelImageLikeService;
|
||||
|
||||
private final ModelImageCommentLikeService modelImageCommentLikeService;
|
||||
|
||||
private final ModelImageCommentService modelImageCommentService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
@ApiOperation(value = "图片列表")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody PageDomain pageDomain) {
|
||||
ModelImagePageRes imagePageRes = new ModelImagePageRes();
|
||||
|
@ -59,23 +52,17 @@ public class ModelImageController {
|
|||
/**
|
||||
* 图片详情
|
||||
*/
|
||||
@ApiOperation(value = "图片详情")
|
||||
@GetMapping("/detail/{imageId}")
|
||||
public AjaxResult detail(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
ModelImageVo modelImageVo = new ModelImageVo();
|
||||
ModelImage modelImage = modelImageService.getById(imageId);
|
||||
if (Objects.nonNull(modelImage)) {
|
||||
BeanUtil.copyProperties(modelImage, modelImageVo);
|
||||
SysUser sysUser = sysUserService.selectUserById(modelImage.getUserId());
|
||||
modelImageVo.setUserId(SecurityUtils.getUserId());
|
||||
modelImageVo.setUserName(SecurityUtils.getUsername());
|
||||
modelImageVo.setUserAvatar(sysUser.getAvatar());
|
||||
}
|
||||
ModelImageVo modelImageVo = modelImageService.getDetail(imageId);
|
||||
return AjaxResult.success(modelImageVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片删除
|
||||
*/
|
||||
@ApiOperation(value = "图片删除")
|
||||
@GetMapping("/delete/{imageId}")
|
||||
public AjaxResult delete(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
modelImageService.removeById(imageId);
|
||||
|
@ -85,6 +72,7 @@ public class ModelImageController {
|
|||
/**
|
||||
* 图片修改
|
||||
*/
|
||||
@ApiOperation(value = "图片修改")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody ModelImageRes modelImageRes) {
|
||||
modelImageService.updateById(modelImageRes);
|
||||
|
@ -92,20 +80,10 @@ public class ModelImageController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
@GetMapping("/upload")
|
||||
public AjaxResult upload(MultipartFile file) {
|
||||
|
||||
return AjaxResult.success("上传成功", OssUtil.uploadMultipartFile(file));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片发布
|
||||
*/
|
||||
@ApiOperation(value = "图片发布")
|
||||
@PostMapping("/publish")
|
||||
public AjaxResult publish(@RequestBody ModelImageRes modelImageRes) {
|
||||
modelImageService.publish(modelImageRes);
|
||||
|
@ -115,6 +93,7 @@ public class ModelImageController {
|
|||
/**
|
||||
* 图片点赞/取消
|
||||
*/
|
||||
@ApiOperation(value = "图片点赞/取消")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/imageLike/{imageId}")
|
||||
public AjaxResult like(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
|
@ -123,42 +102,5 @@ public class ModelImageController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片评论发布
|
||||
*/
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@RequestBody ModelImageCommentRes modelImageCommentRes) {
|
||||
modelImageService.comment(modelImageCommentRes);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片评论点赞/取消
|
||||
*/
|
||||
@RepeatSubmit
|
||||
@GetMapping("/commentLike/{commentId}")
|
||||
public AjaxResult commentLike(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelImageCommentLikeService.like(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除图片评论
|
||||
*/
|
||||
@GetMapping("/commentDelete/{commentId}")
|
||||
public AjaxResult commentDelete(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
modelImageCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片评论
|
||||
*/
|
||||
@GetMapping("/comment/{imageId}")
|
||||
public AjaxResult getComment(@PathVariable @NotNull(message = "图片id不能为空") Long imageId) {
|
||||
List<ModelImageCommentVo> modelImageCommentVoList = modelImageService.getComment(imageId);
|
||||
return AjaxResult.success(modelImageCommentVoList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,23 @@
|
|||
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;
|
||||
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.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/** 模型版本
|
||||
|
@ -20,6 +28,7 @@ import java.util.List;
|
|||
* @Description TODO
|
||||
* @Date:2025/1/9 16:47
|
||||
*/
|
||||
@Api(tags = "模型版本")
|
||||
@RestController
|
||||
@RequestMapping("ModelVersion")
|
||||
public class ModelVersionController extends BaseController {
|
||||
|
@ -35,6 +44,7 @@ public class ModelVersionController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "图片")
|
||||
@PostMapping("/file")
|
||||
public AjaxResult Malifile(@RequestParam MultipartFile file){
|
||||
|
||||
|
@ -51,6 +61,7 @@ public class ModelVersionController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "zip")
|
||||
@PostMapping("/zipUrlFile")
|
||||
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
|
@ -66,6 +77,7 @@ public class ModelVersionController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "下载zip")
|
||||
@PostMapping("/zipUrl")
|
||||
public AjaxResult zipUrl(@RequestParam MultipartFile file){
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
|
@ -75,6 +87,7 @@ public class ModelVersionController extends BaseController {
|
|||
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本列表")
|
||||
@PostMapping("list")
|
||||
public TableDataInfo list(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
|
@ -84,22 +97,39 @@ public class ModelVersionController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本详情")
|
||||
@PostMapping("finbyid")
|
||||
public AjaxResult finbyid(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
|
||||
|
||||
ModelVersion modelVersion1 = modelVersionService.getById(modelVersion.getId());
|
||||
|
||||
ArrayList<String> arrayList = new ArrayList<>();
|
||||
|
||||
//获取
|
||||
String[] split = modelVersion1.getHigh().split(",");
|
||||
|
||||
for (String s : split) {
|
||||
arrayList.add(DictInit.getDictValue(DictConstants.DICT_TYPE_MODEL_VERSION_HIGH,s));
|
||||
}
|
||||
|
||||
return AjaxResult.success(modelVersion1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本添加")
|
||||
@PostMapping("insert")
|
||||
public AjaxResult insert(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
|
||||
modelVersionService.save(modelVersion);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本修改")
|
||||
@PostMapping("update")
|
||||
public AjaxResult update(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
|
@ -107,6 +137,8 @@ public class ModelVersionController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模型版本删除")
|
||||
@PostMapping("delete")
|
||||
public AjaxResult delete(@RequestBody ModelVersion modelVersion)
|
||||
{
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.mcwl.common.annotation.RepeatSubmit;
|
|||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.SysUserInfo;
|
||||
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;
|
||||
|
@ -16,7 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @date 2025/1/3
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Api(tags = "关注")
|
||||
@RequestMapping("/attention")
|
||||
@RestController
|
||||
public class SysUserAttentionController {
|
||||
|
@ -29,6 +31,7 @@ public class SysUserAttentionController {
|
|||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加/取消关注")
|
||||
@RepeatSubmit
|
||||
@GetMapping("/addAttention")
|
||||
public AjaxResult addAttention(@RequestParam Long userId) {
|
||||
|
@ -42,6 +45,7 @@ public class SysUserAttentionController {
|
|||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询是否关注用户")
|
||||
@GetMapping("/selectAttention")
|
||||
public AjaxResult selectAttention(@RequestParam Long userId) {
|
||||
|
||||
|
@ -54,6 +58,7 @@ public class SysUserAttentionController {
|
|||
* 查询个人粉丝,关注,下载量,喜欢
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询个人粉丝,关注,下载量,喜欢")
|
||||
@GetMapping("/selectUserInfo")
|
||||
public AjaxResult selectUserInfo(){
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.mcwl.common.core.domain.AjaxResult;
|
|||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.resource.domain.ToActivity;
|
||||
import com.mcwl.resource.service.ToActivityService;
|
||||
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.RequestBody;
|
||||
|
@ -13,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
/**活动
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.resource
|
||||
|
@ -21,6 +23,7 @@ import java.util.List;
|
|||
* @Description TODO
|
||||
* @Date:2025/1/9 17:59
|
||||
*/
|
||||
@Api(tags = "活动")
|
||||
@RestController
|
||||
@RequestMapping("ToActivity")
|
||||
public class ToActivityController extends BaseController {
|
||||
|
@ -30,6 +33,7 @@ public class ToActivityController extends BaseController {
|
|||
/**
|
||||
* 查询活动列表
|
||||
*/
|
||||
@ApiOperation(value = "活动列表")
|
||||
@PostMapping("/list")
|
||||
public TableDataInfo list(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
|
@ -40,6 +44,7 @@ public class ToActivityController extends BaseController {
|
|||
|
||||
|
||||
|
||||
@ApiOperation(value = "活动详情")
|
||||
@PostMapping("finById")
|
||||
public AjaxResult finById(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
|
@ -47,6 +52,7 @@ public class ToActivityController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动添加")
|
||||
@PostMapping("add")
|
||||
public AjaxResult add(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
|
@ -54,6 +60,7 @@ public class ToActivityController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动修改")
|
||||
@PostMapping("update")
|
||||
public AjaxResult update(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
|
@ -61,6 +68,7 @@ public class ToActivityController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动删除")
|
||||
@PostMapping("delete")
|
||||
public AjaxResult delete(@RequestBody ToActivity toActivity)
|
||||
{
|
||||
|
@ -68,6 +76,7 @@ public class ToActivityController extends BaseController {
|
|||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "活动批量删除")
|
||||
@PostMapping("deleteByIds")
|
||||
public AjaxResult deleteByIds(@RequestBody List<ToActivity> toActivity)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.WorkFlowComment;
|
||||
import com.mcwl.resource.domain.vo.WorkFlowCommentVo;
|
||||
import com.mcwl.resource.service.WorkFlowCommentLikeService;
|
||||
import com.mcwl.resource.service.WorkFlowCommentService;
|
||||
import com.mcwl.resource.service.WorkFlowLikeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工作流评论
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.resource
|
||||
* @Filename:ModelCommentcontroller
|
||||
* @Description TODO
|
||||
* @Date:2025/1/12 11:36
|
||||
*/
|
||||
@Api(tags = "工作流评论")
|
||||
@RequestMapping("/WorkFlowComment")
|
||||
@RestController
|
||||
public class WorkFlowCommentController {
|
||||
|
||||
@Autowired
|
||||
private WorkFlowLikeService workFlowLikeService;
|
||||
@Autowired
|
||||
private WorkFlowCommentService workFlowCommentService;
|
||||
@Autowired
|
||||
private WorkFlowCommentLikeService workFlowCommentLikeService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工作流点赞/取消
|
||||
*/
|
||||
@ApiOperation(value = "工作流点赞/取消")
|
||||
@GetMapping("/like/{workFlowId}")
|
||||
public AjaxResult like(@PathVariable Long workFlowId) {
|
||||
workFlowLikeService.like(workFlowId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工作流评论发布
|
||||
*/
|
||||
@ApiOperation(value = "工作流评论发布")
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@RequestBody WorkFlowComment modelComment) {
|
||||
workFlowCommentService.comment(modelComment);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 工作流评论点赞/取消
|
||||
*/
|
||||
@ApiOperation(value = "工作流评论点赞/取消")
|
||||
@GetMapping("/commentLike/{commentId}")
|
||||
public AjaxResult commentLike(@PathVariable Long commentId) {
|
||||
workFlowCommentLikeService.like(commentId);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取工作流评论
|
||||
*/
|
||||
@ApiOperation(value = "获取工作流评论")
|
||||
@GetMapping("/comment/{modelId}")
|
||||
public AjaxResult getComment(@PathVariable @NotNull(message = "模型id不能为空") Long modelId) {
|
||||
List<WorkFlowCommentVo> modelCommentList = workFlowCommentService.getComment(modelId);
|
||||
return AjaxResult.success(modelCommentList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除工作流评论
|
||||
*/
|
||||
@ApiOperation(value = "删除工作流评论")
|
||||
@GetMapping("/commentDelete/{commentId}")
|
||||
public AjaxResult commentDelete(@PathVariable @NotNull(message = "评论id不能为空") Long commentId) {
|
||||
workFlowCommentService.removeById(commentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,6 +6,8 @@ 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.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -20,7 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
* @Description 商品
|
||||
* @Date:2024/12/31 10:48
|
||||
*/
|
||||
|
||||
@Api(tags = "工作流")
|
||||
@RestController
|
||||
@RequestMapping("/WorkFlow")
|
||||
public class WorkFlowController extends BaseController {
|
||||
|
@ -34,6 +36,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "图片")
|
||||
@PostMapping("/file")
|
||||
public AjaxResult Malifile(@RequestParam MultipartFile file){
|
||||
|
||||
|
@ -47,6 +50,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "zip")
|
||||
@PostMapping("/zipUrlFile")
|
||||
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
|
@ -60,6 +64,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "下载zip")
|
||||
@PostMapping("/zipUrl")
|
||||
public AjaxResult zipUrl(@RequestParam MultipartFile file){
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
|
@ -72,6 +77,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param requestWorkFlow
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加工作流")
|
||||
@PostMapping("/addWorkFlow")
|
||||
public AjaxResult addWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){
|
||||
|
||||
|
@ -83,6 +89,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param requestWorkFlow
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改工作流")
|
||||
@PostMapping("/updateWorkFlow")
|
||||
public AjaxResult updateWorkFlow(@RequestBody RequestWorkFlow requestWorkFlow){
|
||||
|
||||
|
@ -96,6 +103,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除工作流")
|
||||
@GetMapping("/deleteWorkFlow")
|
||||
public AjaxResult deleteWorkFlow(@RequestParam Long id){
|
||||
|
||||
|
@ -108,6 +116,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param pageVo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询工作流列表")
|
||||
@PostMapping("/selectWorkFlow")
|
||||
public AjaxResult selectWorkFlow(@RequestBody PageVo pageVo){
|
||||
|
||||
|
@ -120,6 +129,7 @@ public class WorkFlowController extends BaseController {
|
|||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询工作流详情")
|
||||
@GetMapping("/selectWorkFlowById")
|
||||
public AjaxResult selectWorkFlowById(@RequestParam Long id){
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.mcwl.web.controller.resource;
|
|||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.service.impl.WorkFlowVersionServiceImpl;
|
||||
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;
|
||||
|
@ -15,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
* @date 2025/1/14
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Api(tags = "工作流版本")
|
||||
@RequestMapping("/WorkFlowVersion")
|
||||
@RestController
|
||||
public class WorkFlowVersionController {
|
||||
|
@ -29,6 +31,7 @@ public class WorkFlowVersionController {
|
|||
* @param workId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询工作流下的所有版本信息")
|
||||
@GetMapping("/selectVersionByWorkId")
|
||||
public AjaxResult selectVersionByWorkId(@RequestParam Long workId) {
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.mcwl.web.controller.system;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mcwl.common.annotation.Anonymous;
|
||||
import com.mcwl.common.constant.Constants;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
|
@ -18,15 +19,13 @@ import com.mcwl.framework.web.service.SysLoginService;
|
|||
import com.mcwl.framework.web.service.SysPermissionService;
|
||||
import com.mcwl.framework.web.service.TokenService;
|
||||
import com.mcwl.system.service.ISysMenuService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
|
@ -34,7 +33,6 @@ import java.util.concurrent.TimeUnit;
|
|||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
|
@ -74,19 +72,19 @@ public class SysLoginController
|
|||
//生成验证码
|
||||
String s = CodeUtils.generateCaptcha();
|
||||
|
||||
log.info("获取到的验证码:{}",s);
|
||||
|
||||
//存储redis
|
||||
redisCache.setCacheObject(RedisConstants.CODE_PHONE+phone,s,1, TimeUnit.MINUTES);
|
||||
|
||||
//发送短信服务
|
||||
// 构建 sendDataMap
|
||||
Map<String, String> sendDataMap = new HashMap<>();
|
||||
sendDataMap.put("code:", s);
|
||||
// TelSmsUtils.sendSms(phone,"SMS_460535072",sendDataMap);
|
||||
PhoneLoginBody phoneLoginBody = PhoneLoginBody.builder().code(s)
|
||||
.phone(phone).build();
|
||||
|
||||
rabbitTemplate.convertAndSend(QueueConstants.CODE_QUEUE,s);
|
||||
rabbitTemplate.convertAndSend(QueueConstants.CODE_QUEUE, JSONObject.toJSONString(phoneLoginBody), message -> {
|
||||
message.getMessageProperties().setMessageId(UUID.randomUUID().toString().replace("-",""));
|
||||
return message;
|
||||
});
|
||||
|
||||
return AjaxResult.success(s);
|
||||
return AjaxResult.success();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,15 @@ public class SysUserController extends BaseController
|
|||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取id
|
||||
*/
|
||||
@GetMapping("/getUserId")
|
||||
public AjaxResult getSysUserId() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return AjaxResult.success(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
|
|
@ -76,6 +76,28 @@ spring:
|
|||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 1.13.246.108
|
||||
# 端口,默认为6379
|
||||
port: 6370
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: MuYu_Cloud@Redis
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# 公众号配置
|
||||
wechat:
|
||||
|
@ -84,3 +106,26 @@ wechat:
|
|||
# 应用密钥
|
||||
secret: abbabcf1da711a3bbd95387ec83edcac
|
||||
|
||||
# yml版(application.yml)
|
||||
aliyun:
|
||||
oss:
|
||||
bucketName: ybl2112
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKeyId: LTAI5tSHZZ8wHJRP8X4r9TXT
|
||||
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
|
||||
accessPre: https://ybl2112.oss-cn-beijing.aliyuncs.com/
|
||||
|
||||
mall:
|
||||
mgt:
|
||||
aliPayConfig:
|
||||
protocol: https
|
||||
gatewayHost: openapi-sandbox.dl.alipaydev.com
|
||||
signType: RSA2
|
||||
appId: 9021000135682614
|
||||
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQxmQGcaiKjOhayWi+zNTvpp8B5YT8jFFkjLzrD+W+T2Dwf2GfFR4p95zsCJxYeoLWdghMPA6/GMFrLbuVFpaEjuTm4icqA9N8n5d3W0j7gh+wMjZoqyJclAIeb09ut7rY6mWzilA9kWmZnUG7MOWIU70RVRYrfJectCFw/odM9lG4XIVe13X2h+1ecTQyQzLWmnvKFCfo7dQjE7fIYiWfud1ZGUneNs3u73pNWMB6ThGTTCbs0atcgM3fYOg3q7fTxIu9VcaUCJiJ/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wAfqCO6hqxQiQT5vp1hvB0o1AgMBAAECggEAIhaEYLwMSispXo8D2cES9iaOU/z91hUX6Qv2Q4anuqqoEZh8nN91Db6etTjFz1NxURvTklelxTsH97t56n26DRY0MWTYgd0Kw9Iz8MeOpKGb4nnAM97vpUq4QQBGfLRIC2ENdzu+7vA5JBFR88hsky/cWaNmJ/EbJauIIDneE7GigMR2HF7kfzdZzOBN4ZEh/ef5NKeCnEieRJJhWRgrgNXVZ44Tqi67AM7ey9pyUtBe7fgzxXtrWXBN9yKaVxxSXm3KJXFQqA6mcilFVZaxMNlAySc4MPTW8lq0ozOCOCunoeIphNz/OVIxGu3/voXFXlBfOKqOkYMVZxMY6OrvtQKBgQD0nIlXK4VW72VaGpz9kxQkRNzJV/yqaqet1GOSlPM2l0RCRFOVVdnvbQdHGPe6+HxHL1dh5MP8T/aHoP+4UXkkQCc8moS2FZxJvFH2QTSZBcSSdGL7GMpROqs38J+XlJzrhNcB20lrW6D7yMeQa4YEcXwdbD8Er/YaIqODBWYYewKBgQCXg+16RLDArciwwhf0TBWZPor2iYFDdwU5UPu7CKOhU1MLfQhG85gGpXHjB6G8cMUi/ezxh/FEl+sWOZegpkPwL5/BQS9tNYWIaC4kipPF/a5Up4DMYUHVAuuPwNqqXpvgU+rGjCns0wtPRnjrkghLkc3oTSID7o7pzUwIk2whDwKBgAys3+EIfExY82OL5X6uVGjcuKQmTw11oWK8krxRw5iclgjpCXu/ix+BAtOIU634mlgF9/02oYE9k4TLrvSaJDDgsifNyfq1e/fGLmkYT+VuCxWbulVQn4s+AwlPCrYMGWWK6KlL9638fYcOjGjLaZJpXwkXRtyzUYlhKh/r87JpAoGBAIavRp2mi/xrPvgpQQPv0k9L8llfOCHRnjoqC+thrZsNp8eRmJcBmMVnskofEZ2iHQuS71pw/n58EQTLo0ayJbhPjVJL8K3CovXzrfjbmqqoa5xi3bJQTiXdF6rMw1QpD6Uk05E1LVuQ6v/IZFr7kBYlAQWb8z3NhQq+bPU+nyLvAoGAGpBbSM8gPzdWQqkHoos0icu3cj0GhN3MU7+1Eb/rsXyh/lk5wtZTEnHjwhdUOUtwVNjvrv7CzA7unhOoaM6YcE/Zpd4zt8pjqH1Mhds7UHf4Xg+A+J4G6meYnhSwfBpOub02ncsqfBlXE0qhFv6AvcMewWndyLb8EYaUUXTYkG0=
|
||||
publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHkjwHnoUnZuqbas+ZputyWIfU2WKBFKd+wFwlCZytpQhVA16CGAMCGpgjxUPpqbmOtPy74y0wxmDHB9IaYOVsVmi2SAl1IqfxwUSIllbdvbjBvZFAIQlPa8U/zHJPgdGNHDt/Bwqp5uB0OkcGLB9PYyAXBEKiu6zdTsiZloUrPwgnBRJ0iNHYiWo/oOYD9KfopLA+D1nQjqq8m3ShZe46ecMo6ZCHtQI/HtgL/EGga5KY2zOUi0Wwviu8w79RjjzfdsDkzu5VnBdaSru4awDyiF9nAF+uPgA4ZOdLKkpoEANwuIorDW8tT69Gwh+mYx9sDJMxJf7XOekdPbymomiwIDAQAB
|
||||
notifyUrl: https://253d7236.r27.cpolar.top/web/pay/notify
|
||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -65,28 +65,7 @@ spring:
|
|||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 1.13.246.108
|
||||
# 端口,默认为6379
|
||||
port: 6370
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: MuYu_Cloud@Redis
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
|
||||
# token配置
|
||||
token:
|
||||
|
@ -163,25 +142,5 @@ xss:
|
|||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
# yml版(application.yml)
|
||||
aliyun:
|
||||
oss:
|
||||
bucketName: ybl2112
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKeyId: LTAI5tSHZZ8wHJRP8X4r9TXT
|
||||
accessKeySecret: F82IVNx0IGJ3AnP6gSIfcyql1HCXIH
|
||||
policy : https://ybl2112.oss-cn-beijing.aliyuncs.com/
|
||||
|
||||
|
||||
mall:
|
||||
mgt:
|
||||
aliPayConfig:
|
||||
protocol: https
|
||||
gatewayHost: openapi-sandbox.dl.alipaydev.com
|
||||
signType: RSA2
|
||||
appId: 9021000135682614
|
||||
privateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQxmQGcaiKjOhayWi+zNTvpp8B5YT8jFFkjLzrD+W+T2Dwf2GfFR4p95zsCJxYeoLWdghMPA6/GMFrLbuVFpaEjuTm4icqA9N8n5d3W0j7gh+wMjZoqyJclAIeb09ut7rY6mWzilA9kWmZnUG7MOWIU70RVRYrfJectCFw/odM9lG4XIVe13X2h+1ecTQyQzLWmnvKFCfo7dQjE7fIYiWfud1ZGUneNs3u73pNWMB6ThGTTCbs0atcgM3fYOg3q7fTxIu9VcaUCJiJ/kNbL9sVEyOrSyx2f2o6w06zdEaOiQFsuDeS8QPYGMg7pf42wAfqCO6hqxQiQT5vp1hvB0o1AgMBAAECggEAIhaEYLwMSispXo8D2cES9iaOU/z91hUX6Qv2Q4anuqqoEZh8nN91Db6etTjFz1NxURvTklelxTsH97t56n26DRY0MWTYgd0Kw9Iz8MeOpKGb4nnAM97vpUq4QQBGfLRIC2ENdzu+7vA5JBFR88hsky/cWaNmJ/EbJauIIDneE7GigMR2HF7kfzdZzOBN4ZEh/ef5NKeCnEieRJJhWRgrgNXVZ44Tqi67AM7ey9pyUtBe7fgzxXtrWXBN9yKaVxxSXm3KJXFQqA6mcilFVZaxMNlAySc4MPTW8lq0ozOCOCunoeIphNz/OVIxGu3/voXFXlBfOKqOkYMVZxMY6OrvtQKBgQD0nIlXK4VW72VaGpz9kxQkRNzJV/yqaqet1GOSlPM2l0RCRFOVVdnvbQdHGPe6+HxHL1dh5MP8T/aHoP+4UXkkQCc8moS2FZxJvFH2QTSZBcSSdGL7GMpROqs38J+XlJzrhNcB20lrW6D7yMeQa4YEcXwdbD8Er/YaIqODBWYYewKBgQCXg+16RLDArciwwhf0TBWZPor2iYFDdwU5UPu7CKOhU1MLfQhG85gGpXHjB6G8cMUi/ezxh/FEl+sWOZegpkPwL5/BQS9tNYWIaC4kipPF/a5Up4DMYUHVAuuPwNqqXpvgU+rGjCns0wtPRnjrkghLkc3oTSID7o7pzUwIk2whDwKBgAys3+EIfExY82OL5X6uVGjcuKQmTw11oWK8krxRw5iclgjpCXu/ix+BAtOIU634mlgF9/02oYE9k4TLrvSaJDDgsifNyfq1e/fGLmkYT+VuCxWbulVQn4s+AwlPCrYMGWWK6KlL9638fYcOjGjLaZJpXwkXRtyzUYlhKh/r87JpAoGBAIavRp2mi/xrPvgpQQPv0k9L8llfOCHRnjoqC+thrZsNp8eRmJcBmMVnskofEZ2iHQuS71pw/n58EQTLo0ayJbhPjVJL8K3CovXzrfjbmqqoa5xi3bJQTiXdF6rMw1QpD6Uk05E1LVuQ6v/IZFr7kBYlAQWb8z3NhQq+bPU+nyLvAoGAGpBbSM8gPzdWQqkHoos0icu3cj0GhN3MU7+1Eb/rsXyh/lk5wtZTEnHjwhdUOUtwVNjvrv7CzA7unhOoaM6YcE/Zpd4zt8pjqH1Mhds7UHf4Xg+A+J4G6meYnhSwfBpOub02ncsqfBlXE0qhFv6AvcMewWndyLb8EYaUUXTYkG0=
|
||||
publicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApHkjwHnoUnZuqbas+ZputyWIfU2WKBFKd+wFwlCZytpQhVA16CGAMCGpgjxUPpqbmOtPy74y0wxmDHB9IaYOVsVmi2SAl1IqfxwUSIllbdvbjBvZFAIQlPa8U/zHJPgdGNHDt/Bwqp5uB0OkcGLB9PYyAXBEKiu6zdTsiZloUrPwgnBRJ0iNHYiWo/oOYD9KfopLA+D1nQjqq8m3ShZe46ecMo6ZCHtQI/HtgL/EGga5KY2zOUi0Wwviu8w79RjjzfdsDkzu5VnBdaSru4awDyiF9nAF+uPgA4ZOdLKkpoEANwuIorDW8tT69Gwh+mYx9sDJMxJf7XOekdPbymomiwIDAQAB
|
||||
notifyUrl: https://253d7236.r27.cpolar.top/web/pay/notify
|
||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||
knife4j:
|
||||
enable: true
|
||||
|
|
|
@ -1,71 +1,26 @@
|
|||
//package com.mcwl.memberCenter;
|
||||
//
|
||||
//import com.mcwl.McWlApplication;
|
||||
//import com.mcwl.common.core.domain.AjaxResult;
|
||||
//import com.mcwl.memberCenter.consumer.EmptyPointsRemindConsumer;
|
||||
//import com.mcwl.memberCenter.service.MemberLevelService;
|
||||
//import com.mcwl.memberCenter.service.MemberService;
|
||||
//import com.mcwl.memberCenter.task.UserMemberTask;
|
||||
//import com.mcwl.web.controller.memberCenter.MemberController;
|
||||
//import com.mcwl.web.controller.memberCenter.MemberLevelController;
|
||||
//import org.junit.Test;
|
||||
//import org.junit.runner.RunWith;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.boot.test.context.SpringBootTest;
|
||||
//import org.springframework.test.context.junit4.SpringRunner;
|
||||
//
|
||||
//@RunWith(SpringRunner.class)
|
||||
//@SpringBootTest(classes = McWlApplication.class)
|
||||
//public class MemberCenterTest {
|
||||
//
|
||||
//
|
||||
// @Autowired
|
||||
// private MemberLevelService memberLevelService;
|
||||
//
|
||||
// @Autowired
|
||||
// private MemberController memberController;
|
||||
//
|
||||
// @Autowired
|
||||
// private MemberService memberService;
|
||||
//
|
||||
// @Autowired
|
||||
// private UserMemberTask userMemberTask;
|
||||
//
|
||||
// @Autowired
|
||||
// private MemberLevelController memberLevelController;
|
||||
//
|
||||
// @Autowired
|
||||
// private EmptyPointsRemindConsumer emptyPointsRemindConsumer;
|
||||
// @Test
|
||||
// public void createUserMember() {
|
||||
// System.out.println(memberService.createUserMember(1L, 1013L, "wechat",1L));
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void emptyPointsTaskTest() {
|
||||
// userMemberTask.emptyPointsTsk();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void updateSubscriptionStatusTaskTest() {
|
||||
// userMemberTask.updateSubscriptionStatusTask();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void memberServiceTest() {
|
||||
// System.out.println(memberLevelService.list());
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getPointsTest() {
|
||||
// AjaxResult points = memberController.getPoints();
|
||||
// System.out.println("points = " + points);
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void getMemberLevelListTest() {
|
||||
// System.out.println("memberLevelController.getMemberBenefitList() = " + memberLevelController.getMemberBenefitList());
|
||||
// }
|
||||
//
|
||||
//}
|
||||
package com.mcwl.memberCenter;
|
||||
|
||||
import com.mcwl.McWlApplication;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.memberCenter.consumer.EmptyPointsRemindConsumer;
|
||||
import com.mcwl.memberCenter.service.MemberLevelService;
|
||||
import com.mcwl.memberCenter.service.MemberService;
|
||||
import com.mcwl.memberCenter.task.UserMemberTask;
|
||||
import com.mcwl.web.controller.memberCenter.MemberController;
|
||||
import com.mcwl.web.controller.memberCenter.MemberLevelController;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
|
||||
public class MemberCenterTest {
|
||||
|
||||
@Test
|
||||
public void aaa() {
|
||||
String s = "1,2,3,4,";
|
||||
System.out.println(s.split(","));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,24 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.12.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Jackson -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--OSS-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
|
@ -160,10 +178,12 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
|
|
|
@ -15,6 +15,11 @@ public class DictConstants {
|
|||
*/
|
||||
public static final String MALL_PRODUCT_STATUS = "mall_product_status";
|
||||
|
||||
/**
|
||||
* 高清修复
|
||||
*/
|
||||
public static final String DICT_TYPE_MODEL_VERSION_HIGH = "dict_type_model_version_high";
|
||||
|
||||
/**
|
||||
* 类型模型
|
||||
*/
|
||||
|
@ -49,6 +54,6 @@ public class DictConstants {
|
|||
/**
|
||||
* 图片标签
|
||||
*/
|
||||
public static final String IMAGE_LABLE = "image_lable";
|
||||
public static final String IMAGE_LABEL = "image_label";
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* www.hnapay.com
|
||||
*/
|
||||
|
||||
package com.mcwl.common.constant;
|
||||
|
||||
/**
|
||||
* 常量配置
|
||||
*/
|
||||
public class NcountKey {
|
||||
|
||||
public static String NCOUNT_URL = "https://ncount.hnapay.com/api/";
|
||||
|
||||
//新生签名使用的算法
|
||||
public static String ALGORITHM = "RSA";
|
||||
|
||||
//类型
|
||||
public static String SIGN_ALGORITHM = "SHA1withRSA";
|
||||
|
||||
//前置系统公钥
|
||||
/*public static String NCOUNT_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9vGvYjivDF5uPBNDXMtoAtjYQ2YPSsfareduDG6kHL/N3A05rFHA11Dbr+UON82Y4V0RFKAQeZFPWcTLjcy6ntZVI8XoYLpuVQBPsb0Ya+PwbzR8/TmUdUf91ru8APtJgqkULgPVrO1hhzZ1tQMznosNLTOqbknMnnMcwzB5yYwIDAQAB";*/
|
||||
|
||||
public static String NCOUNT_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9vGvYjivDF5uPBNDXMtoAtjYQ" +
|
||||
"2YPSsfareduDG6kHL/N3A05rFHA11Dbr+UON82Y4V0RFKAQeZFPWcTLjcy6ntZVI" +
|
||||
"8XoYLpuVQBPsb0Ya+PwbzR8/TmUdUf91ru8APtJgqkULgPVrO1hhzZ1tQMznosNL" +
|
||||
"TOqbknMnnMcwzB5yYwIDAQAB";
|
||||
|
||||
|
||||
// public static String MER_PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOMNbm6VJwmOQh74\r\n" +
|
||||
// "DyhrKpX+qLKYeeW3sUoXmmstka5AeAVf3UjHCwuZQHviwwGxUIdi0r320aIUetb1\r\n" +
|
||||
// "gRPm4WDMz9FPsBs54hPhHxIBrt3mXEl9cP4S8YdlivQY7Hbf1WqxNhy5wEf0OpkZ\r\n" +
|
||||
// "JjS7wEU46JfKwbGuzcSVkgWi+iuTAgMBAAECgYBX9OAO3qDcxss+jAHzOnCo4pof\r\n" +
|
||||
// "dYnjP6HiffpIAsMoqbjU/CoRA2p398pPM60vfq0fhVz2UiMrkptzom96cjpkNpQ4\r\n" +
|
||||
// "4uztdoozxKmnHiIV1ttISLqMjfh4xkapxVkFJDcEn8ZTpiMmfjEHX0ao3xk1gprL\r\n" +
|
||||
// "vLMpRr1ar5vCqFEGIQJBAPgrGYpteTtjpZqskP9Pg9O7E4XuAgJ01Kqd7Mp8s3Ij\r\n" +
|
||||
// "1nPUmhG+GDDV6MTNDVUfvLWTTvc4MjU2xTQm+6cu2RcCQQDqN72gqLbaKAMULUCt\r\n" +
|
||||
// "vVST7eT53OBPMjbBi90JRqNPZrXuS+Wr7tw3zVb8j5p0w2qBotK7wEq9Pmjidlma\r\n" +
|
||||
// "JhblAkAT95vJeH9tmNnlNQdBk4s+yOmMOBcvTWkjBSvdKuVhRKLnlO6EiO/3Ve6x\r\n" +
|
||||
// "jvIIrFIJpf2PhJT9lReO16gdznYnAkEApvOCpNF+PXUF9Mzo7K8naabKb9yku28E\r\n" +
|
||||
// "nuPOc/05DbEd/7V0CiFiMhiZZ8AJDi/5bFyesBw6ajjhVIOeDQYXjQJARsJP8PDK\r\n" +
|
||||
// "8sEtHtXwOn2vKbx1lSpT9aX3uK/eB7zJLUMBcAsLsoHZC+YqjKjoSD4sGM6ukH0w\r\n" +
|
||||
// "zzlZdaTU3Ued3g==";
|
||||
|
||||
//测试环境商户私钥
|
||||
/*public static String MER_PRIVATE_KEY = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAM2Ak5XX86FypU3t\n" +
|
||||
"DSXlDQp+eXgowPLjBoEt0ZfEfhUtLIrU8J4YzUiz9tUzI6o6mGafDltUasdyRtt3\n" +
|
||||
"+NdSQuFq7MhZyWwGUqle3ybGswYVkN8+LMADCQEOYphM4p0j/OGw7QYcL/ERHsUW\n" +
|
||||
"2MGPR6M/9xe0KURIDdeJC0ulxQ8TAgMBAAECgYEAqgTfldBl68PbSb5+60Q25uC+\n" +
|
||||
"hJBLGmiDwCp1Rng1zDVkrbQBIvvoE2d5Jui5cCQsZHLhwOP1t+8u+nKmuRaA51vB\n" +
|
||||
"sQ+F01SqYrmS/TV/iD5xjAteSXmTf76doP7FwrHuRQ391KcdIn+W0R7cv1tLBY5B\n" +
|
||||
"oRnAcAwWhQMiRWf+yPECQQD6TtJ7kETd5Rl3YryFMTvfW73oHxss87jz6/tUIPxF\n" +
|
||||
"rXYu+ywD4Ut1AWwtN6Td6kZhWOUhG2d4OUVYP0FtjjprAkEA0izql6EQB7SF8AE5\n" +
|
||||
"j8U7Weg8IqPk8b78neav8y1CpjSuwOaRxcS1Mk+W2/AXRvTRL2VUw+Az4boAz3MS\n" +
|
||||
"WnP3+QJBAJW6vtfhRgDCQciTjJfUCq+irmgC63upUzK+L7p0fNOlXrPd1ceAZmXY\n" +
|
||||
"cwBdb8a7lFw5E98JCIz3HU8bj6TcVn8CQQC3EfLBYsSwwXjNBnQaHAVHmfcPgU0B\n" +
|
||||
"mYc3DuKB4hGk7kytr+iXqHDgQt039FiCMOso6o28FEV8v+TGzgfVjCAZAkA9NWuj\n" +
|
||||
"VEHwFLZLtftLDQxGfJmWJGl4CipOjv6YpQEw0A2NBtUp5tuiJ09DNq5RaKJbfWUY\n" +
|
||||
"fQJkAZ0tsrXBWqgK";*/
|
||||
|
||||
public static String MER_PRIVATE_KEY = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBALAkYQn6emeoRsStWebayuyqMB91j27j+gMJO+YqdK1jVpgp4yh2pja9TxQvoLnd3mJcjyACYvW8imWjgtRDDJK4FOj1pYK+EgbX+32PpD8STDnbC93JertbexKk3NNQi5cur40qGEWRspJEPHZTvobZ+EhsJlH8b/oGG1VKORlXAgMBAAECgYA5qf82tBCEhNt+Ib4vzGroZaLRebwWMn4zpj88z6NY7A96SyQ5p/YsL3eHBTyZ/J+EFgcpFH7vMeUg9xGqibTAexqulCNTvOQBYNGra85yUsnob19sHR/YCx80HI5el8RD2mRL6kbmOnab5yi5O2fc8tl+DRJztKXU3YgNH+OhsQJBAPUENKWJJU/OloKYAvOceAy66ZzEKI/myt5x5jcmZTp7bc0wzsxQQ60TfTqfmpOqEd9cJWxggHvutzCBqPovOZkCQQC4CcaSKs3Z2E9/uPr92Z+DIv/5RHTkq66WstG5iM/5aoz7Hf7mP8xTgcjtKNPTcb+nC5IE6M41IuWnSAz8bCBvAkEAuR/FW3GFFIil5eRPDpuhhRTQn9cCQsABdhMe+3pyL77Elq2TAoJ+r82y59FhrMJqIJZx3DIJwhn6pZbCAs4duQJBAKTMrDIrflY660WWIbu7aqmFZ+6QrJQwYJC15DPeHU5daY1dGOqZ6qBEseYdD0Jis5okNEeNKUpPy5J2ZJqNQKUCQQDdyqJhwxjiQ7BtafYNEf/fmP5bkHSKhzOM6lIN8cLX6h535xHObHdOpmKgUg9mLHgJvlNQy+glh40AF2HdNcLS";
|
||||
|
||||
|
||||
public static String MER_ID = "300050402928";
|
||||
|
||||
/**
|
||||
* 支付宝的收款账户id
|
||||
*/
|
||||
public static String ZFB_MER_ID = "2405101553133642463";
|
||||
|
||||
//测试环境商户ID
|
||||
//public static String MER_ID = "110000030228";
|
||||
|
||||
}
|
|
@ -11,4 +11,6 @@ package com.mcwl.common.constant;
|
|||
public class RedisConstants {
|
||||
|
||||
public static final String CODE_PHONE = "code_phone:";
|
||||
|
||||
public static final String CODE_UUID = "code_uuid:";
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
@ -28,17 +29,21 @@ public class BaseEntity implements Serializable
|
|||
private String searchValue;
|
||||
|
||||
/** 创建者 */
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
private Date updateTime;
|
||||
|
||||
// 删除标志(0代表存在 2代表删除)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.common.core.page;
|
||||
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
@ -9,23 +11,29 @@ import javax.validation.constraints.NotNull;
|
|||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
@ApiModel("分页数据")
|
||||
public class PageDomain
|
||||
{
|
||||
/** 当前记录起始索引 */
|
||||
@NotNull(message = "当前记录起始索引不能为空")
|
||||
@ApiModelProperty(value = "当前记录起始索引",required = true)
|
||||
private Integer pageNum;
|
||||
|
||||
/** 每页显示记录数 */
|
||||
@NotNull(message = "每页显示记录数不能为空")
|
||||
@ApiModelProperty(value = "每页显示记录数",required = true)
|
||||
private Integer pageSize;
|
||||
|
||||
/** 排序列 */
|
||||
@ApiModelProperty(value = "排序列")
|
||||
private String orderByColumn;
|
||||
|
||||
/** 排序的方向desc或者asc */
|
||||
@ApiModelProperty(value = "排序的方向desc或者asc", example = "asc")
|
||||
private String isAsc = "asc";
|
||||
|
||||
/** 分页参数合理化 */
|
||||
@ApiModelProperty(hidden = true)
|
||||
private Boolean reasonable = true;
|
||||
|
||||
public String getOrderBy()
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package com.mcwl.common.core.page;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -8,20 +11,25 @@ import java.util.List;
|
|||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
@ApiModel("表格分页数据对象")
|
||||
public class TableDataInfo implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 总记录数 */
|
||||
@ApiModelProperty(value = "总记录数")
|
||||
private long total;
|
||||
|
||||
/** 列表数据 */
|
||||
@ApiModelProperty(value = "列表数据")
|
||||
private List<?> rows;
|
||||
|
||||
/** 消息状态码 */
|
||||
@ApiModelProperty(value = "消息状态码")
|
||||
private int code;
|
||||
|
||||
/** 消息内容 */
|
||||
@ApiModelProperty(value = "消息内容")
|
||||
private String msg;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package com.mcwl.common.exception;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* NCountDemoException
|
||||
*/
|
||||
public class NCountDemoException extends Exception {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7121642511651992156L;
|
||||
|
||||
/**
|
||||
* 模块名,抛出异常的类
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected Class errClass = null;
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
protected String errCode = null;
|
||||
|
||||
/**
|
||||
* 错误描述信息
|
||||
*/
|
||||
protected String errMsg = null;
|
||||
|
||||
public NCountDemoException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NCountDemoException(String errMsg) {
|
||||
super("no errMsg");
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public NCountDemoException(String errMsg, Exception e) {
|
||||
super("no errMsg", e);
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public NCountDemoException(String errCode, String errMsg) {
|
||||
super(errMsg);
|
||||
this.errCode = errCode;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public NCountDemoException(String errCode, String errMsg, Exception e) {
|
||||
super(errMsg, e);
|
||||
this.errCode = errCode;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public NCountDemoException(String errCode, Class errClass) {
|
||||
super("no errMsg");
|
||||
this.errCode = errCode;
|
||||
this.errClass = errClass;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public NCountDemoException(String errCode, String errMsg, Class errClass) {
|
||||
super(errMsg);
|
||||
this.errCode = errCode;
|
||||
this.errMsg = errMsg;
|
||||
this.errClass = errClass;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public NCountDemoException(String errCode, String errMsg, Class errClass, Exception e) {
|
||||
super(errMsg, e);
|
||||
this.errClass = errClass;
|
||||
this.errCode = errCode;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
public String printErrMsg() {
|
||||
StringBuffer msg = new StringBuffer("");
|
||||
if (StringUtils.isNotBlank(errCode)) {
|
||||
msg.append("Exception errCode is [").append(this.errCode).append("];\n");
|
||||
}
|
||||
|
||||
if (this.errClass != null) {
|
||||
msg.append("Exception Class is [").append(this.errClass.getName()).append("];\n");
|
||||
}
|
||||
|
||||
msg.append("Exception Message is [").append(this.errMsg).append("];\n");
|
||||
|
||||
// 打印错误异常堆栈
|
||||
if (getCause() != null) {
|
||||
getCause().printStackTrace();
|
||||
}
|
||||
|
||||
return msg.toString();
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Class getErrClass() {
|
||||
return errClass;
|
||||
}
|
||||
|
||||
public String getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.mcwl.common.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* mybatis-plus 自动填充处理器
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.strictInsertFill(metaObject, "createBy", String.class, SecurityUtils.getUsername());
|
||||
this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
|
||||
this.strictInsertFill(metaObject, "tenantId", Long.class, SecurityUtils.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setFieldValByName("updateBy", SecurityUtils.getUsername(), metaObject);
|
||||
this.setFieldValByName("updateTime", new Date(), metaObject);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package com.mcwl.common.utils;
|
||||
|
||||
/**
|
||||
* Base64工具类
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/16
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public class Base64Util {
|
||||
private static final char last2byte = (char) Integer.parseInt("00000011", 2);
|
||||
private static final char last4byte = (char) Integer.parseInt("00001111", 2);
|
||||
private static final char last6byte = (char) Integer.parseInt("00111111", 2);
|
||||
private static final char lead6byte = (char) Integer.parseInt("11111100", 2);
|
||||
private static final char lead4byte = (char) Integer.parseInt("11110000", 2);
|
||||
private static final char lead2byte = (char) Integer.parseInt("11000000", 2);
|
||||
private static final char[] encodeTable = new char[]{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
|
||||
|
||||
public Base64Util() {
|
||||
}
|
||||
|
||||
public static String encode(byte[] from) {
|
||||
StringBuilder to = new StringBuilder((int) ((double) from.length * 1.34D) + 3);
|
||||
int num = 0;
|
||||
char currentByte = 0;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < from.length; ++i) {
|
||||
for (num %= 8; num < 8; num += 6) {
|
||||
switch (num) {
|
||||
case 0:
|
||||
currentByte = (char) (from[i] & lead6byte);
|
||||
currentByte = (char) (currentByte >>> 2);
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
default:
|
||||
break;
|
||||
case 2:
|
||||
currentByte = (char) (from[i] & last6byte);
|
||||
break;
|
||||
case 4:
|
||||
currentByte = (char) (from[i] & last4byte);
|
||||
currentByte = (char) (currentByte << 2);
|
||||
if (i + 1 < from.length) {
|
||||
currentByte = (char) (currentByte | (from[i + 1] & lead2byte) >>> 6);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
currentByte = (char) (from[i] & last2byte);
|
||||
currentByte = (char) (currentByte << 4);
|
||||
if (i + 1 < from.length) {
|
||||
currentByte = (char) (currentByte | (from[i + 1] & lead4byte) >>> 4);
|
||||
}
|
||||
}
|
||||
|
||||
to.append(encodeTable[currentByte]);
|
||||
}
|
||||
}
|
||||
|
||||
if (to.length() % 4 != 0) {
|
||||
for (i = 4 - to.length() % 4; i > 0; --i) {
|
||||
to.append("=");
|
||||
}
|
||||
}
|
||||
|
||||
return to.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.mcwl.common.utils;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* 文件读取工具类
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/16
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public class FileUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 读取文件内容,作为字符串返回
|
||||
*/
|
||||
public static String readFileAsString(String filePath) throws IOException {
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(filePath);
|
||||
}
|
||||
|
||||
if (file.length() > 1024 * 1024 * 1024) {
|
||||
throw new IOException("File is too large");
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder((int) (file.length()));
|
||||
// 创建字节输入流
|
||||
FileInputStream fis = new FileInputStream(filePath);
|
||||
// 创建一个长度为10240的Buffer
|
||||
byte[] bbuf = new byte[10240];
|
||||
// 用于保存实际读取的字节数
|
||||
int hasRead = 0;
|
||||
while ( (hasRead = fis.read(bbuf)) > 0 ) {
|
||||
sb.append(new String(bbuf, 0, hasRead));
|
||||
}
|
||||
fis.close();
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件路径读取byte[] 数组
|
||||
*/
|
||||
public static byte[] readFileByBytes(String filePath) throws IOException {
|
||||
File file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
throw new FileNotFoundException(filePath);
|
||||
} else {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
|
||||
BufferedInputStream in = null;
|
||||
|
||||
try {
|
||||
in = new BufferedInputStream(new FileInputStream(file));
|
||||
short bufSize = 1024;
|
||||
byte[] buffer = new byte[bufSize];
|
||||
int len1;
|
||||
while (-1 != (len1 = in.read(buffer, 0, bufSize))) {
|
||||
bos.write(buffer, 0, len1);
|
||||
}
|
||||
|
||||
byte[] var7 = bos.toByteArray();
|
||||
return var7;
|
||||
} finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (IOException var14) {
|
||||
var14.printStackTrace();
|
||||
}
|
||||
|
||||
bos.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.mcwl.common.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* http工具类
|
||||
*
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/16
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public class HttpUtil {
|
||||
|
||||
public static String post(String requestUrl, String accessToken, String params)
|
||||
throws Exception {
|
||||
String contentType = "application/x-www-form-urlencoded";
|
||||
return HttpUtil.post(requestUrl, accessToken, contentType, params);
|
||||
}
|
||||
|
||||
public static String post(String requestUrl, String accessToken, String contentType, String params)
|
||||
throws Exception {
|
||||
String encoding = "UTF-8";
|
||||
if (requestUrl.contains("nlp")) {
|
||||
encoding = "GBK";
|
||||
}
|
||||
return HttpUtil.post(requestUrl, accessToken, contentType, params, encoding);
|
||||
}
|
||||
|
||||
public static String post(String requestUrl, String accessToken, String contentType, String params, String encoding)
|
||||
throws Exception {
|
||||
String url = requestUrl + "?access_token=" + accessToken;
|
||||
return HttpUtil.postGeneralUrl(url, contentType, params, encoding);
|
||||
}
|
||||
|
||||
public static String postGeneralUrl(String generalUrl, String contentType, String params, String encoding)
|
||||
throws Exception {
|
||||
URL url = new URL(generalUrl);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("Content-Type", contentType);
|
||||
connection.setRequestProperty("Connection", "Keep-Alive");
|
||||
connection.setUseCaches(false);
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
|
||||
// 得到请求的输出流对象
|
||||
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
|
||||
out.write(params.getBytes(encoding));
|
||||
out.flush();
|
||||
out.close();
|
||||
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> headers = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : headers.keySet()) {
|
||||
System.err.println(key + "--->" + headers.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
BufferedReader in = null;
|
||||
in = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), encoding));
|
||||
String result = "";
|
||||
String getLine;
|
||||
while ((getLine = in.readLine()) != null) {
|
||||
result += getLine;
|
||||
}
|
||||
in.close();
|
||||
System.err.println("result:" + result);
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
package com.mcwl.common.utils;
|
||||
|
||||
import com.alibaba.fastjson2.util.DateUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class ToDateUtils {
|
||||
/** 时间格式:yyyyMMddHHmmss'. */
|
||||
public static String DEFAULT_PATTERN = "yyyyMMddHHmmss";
|
||||
|
||||
/** 时间格式:yyyyMMdd'. */
|
||||
public static String yyyyMMdd = "yyyyMMdd";
|
||||
|
||||
/** 时间格式:yyyy-MM-dd'. */
|
||||
public static String yyyy_MM_dd = "yyyy-MM-dd";
|
||||
|
||||
/** 时间格式:HH:mm:ss'. */
|
||||
public static String HH_mm_ss = "HH:mm:ss";
|
||||
|
||||
/** 时间格式:yyyy-MM-dd' 'HH:mm:ss'. */
|
||||
public static String yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd' 'HH:mm:ss";
|
||||
|
||||
/** 时间格式:yyyy-MM-dd' 'HH:mm'. */
|
||||
public static String yyyy_MM_dd_HH_mm = "yyyy-MM-dd' 'HH:mm";
|
||||
|
||||
/**
|
||||
* 获取当前时间(格式:yyyyMMddHHmmss)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrDate() {
|
||||
return getCurrDate(DEFAULT_PATTERN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转日期,默认格式为yyyyMMddHHmmss
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static Date strToDate(String str) {
|
||||
return strToDate(str, DEFAULT_PATTERN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期格式化,默认格式为yyyyMMddHHmmss
|
||||
*
|
||||
* @param date
|
||||
* 日期
|
||||
* @return
|
||||
*/
|
||||
public static String format(Date date) {
|
||||
return DateUtils.format(date, DEFAULT_PATTERN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转日期
|
||||
*
|
||||
* @param str
|
||||
* 时间
|
||||
* @param pattern
|
||||
* 格式
|
||||
* @return
|
||||
*/
|
||||
public static Date strToDate(String str, String pattern) {
|
||||
SimpleDateFormat format = new SimpleDateFormat(pattern);
|
||||
Date date = null;
|
||||
try {
|
||||
date = format.parse(str);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期格式化
|
||||
*
|
||||
* @param date
|
||||
* 日期
|
||||
* @param pattern
|
||||
* 格式
|
||||
* @return
|
||||
*/
|
||||
public static String format(Date date, String pattern) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
|
||||
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间
|
||||
*
|
||||
* @param pattern
|
||||
* 格式
|
||||
* @return
|
||||
*/
|
||||
public static String getCurrDate(String pattern) {
|
||||
long d = System.currentTimeMillis();
|
||||
Date date = new Date(d);
|
||||
|
||||
return format(date, pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统当前时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Date getSystemDate() {
|
||||
long d = System.currentTimeMillis();
|
||||
Date date = new Date(d);
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化时间
|
||||
*
|
||||
* @param strTime
|
||||
* @param pattern
|
||||
* @return
|
||||
*/
|
||||
public static String getTime(String strTime, String pattern) {
|
||||
SimpleDateFormat s = new SimpleDateFormat(pattern);
|
||||
try {
|
||||
return String.valueOf(s.parse(strTime).getTime());// 时间戳
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return String.valueOf(new Date().getTime());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期格式
|
||||
*
|
||||
* @param date
|
||||
* @param mask
|
||||
* @return
|
||||
*/
|
||||
public static final String date2string(Date date, String style) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(style);
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地日期时间.
|
||||
*
|
||||
* @return 本地日期时间yyyyMMddHHmmss
|
||||
*/
|
||||
public static String getLocalFullDateTime14() {
|
||||
return date2string(new Date(), DEFAULT_PATTERN);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回指定格式时间
|
||||
* @param mask
|
||||
* @return
|
||||
*/
|
||||
public static final String now2string(String mask){
|
||||
return date2string(new Date(), mask);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param date
|
||||
* @param field
|
||||
* @param amount
|
||||
* @return 对指定的日期做加减运算;<br>
|
||||
* 减:add(new Date(), Calendar.DATE, -1)返回昨天的日期<br>
|
||||
* 加:add(new Date(), Calendar.YEAR, 1)返回一年后的今天
|
||||
*/
|
||||
public static Date add(Date date, int field, int amount) {
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(date);
|
||||
c.add(field, amount);
|
||||
return c.getTime();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回需要格式的字符串时间
|
||||
* @param str 字符串时间
|
||||
* @param patternS 字符串格式
|
||||
* @param patternE 格式化后的格式
|
||||
* @return
|
||||
*/
|
||||
public static String strToStr(String str, String patternS,String patternE){
|
||||
|
||||
return format(strToDate(str,patternS),patternE);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.mcwl.common.utils.baidu;
|
||||
|
||||
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 百度审核接口登录
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/16
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public class AuthService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取权限token
|
||||
* @return 返回示例:
|
||||
* {
|
||||
* "access_token": "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567",
|
||||
* "expires_in": 2592000
|
||||
* }
|
||||
*/
|
||||
|
||||
/**
|
||||
* 获取API访问token
|
||||
* 该token有一定的有效期,需要自行管理,当失效时需重新获取.
|
||||
* @param ak - 百度云官网获取的 API Key
|
||||
* @param sk - 百度云官网获取的 Securet Key
|
||||
* @return assess_token 示例:
|
||||
* "24.460da4889caad24cccdb1fea17221975.2592000.1491995545.282335-1234567"
|
||||
*/
|
||||
public static String getAuth(String ak, String sk) {
|
||||
// 获取token地址
|
||||
String authHost = "https://aip.baidubce.com/oauth/2.0/token?";
|
||||
String getAccessTokenUrl = authHost
|
||||
// 1. grant_type为固定参数
|
||||
+ "grant_type=client_credentials"
|
||||
// 2. 官网获取的 API Key
|
||||
+ "&client_id=" + ak
|
||||
// 3. 官网获取的 Secret Key
|
||||
+ "&client_secret=" + sk;
|
||||
try {
|
||||
URL realUrl = new URL(getAccessTokenUrl);
|
||||
// 打开和URL之间的连接
|
||||
HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.err.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String result = "";
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
/**
|
||||
* 返回结果示例
|
||||
*/
|
||||
System.err.println("result:" + result);
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
String access_token = jsonObject.getString("access_token");
|
||||
return access_token;
|
||||
} catch (Exception e) {
|
||||
System.err.printf("获取token失败!");
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,126 @@
|
|||
package com.mcwl.common.utils.baidu;
|
||||
|
||||
|
||||
import com.mcwl.common.utils.Base64Util;
|
||||
import com.mcwl.common.utils.HttpUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
|
||||
/**百度审核接口
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/16
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
|
||||
public class BaiduCensor {
|
||||
|
||||
//设置APPID/AK/SK
|
||||
public static final String APP_ID = "6273132";
|
||||
public static final String API_KEY = "8cxN3yyAbQeKGhS0cHAVzlNN";
|
||||
public static final String SECRET_KEY = "hubX4QXVGJbV9ccEVGv4Ifd2w80B71nD";
|
||||
|
||||
//图像审核
|
||||
public static String ImageCnesor(String filePath) {
|
||||
// 请求url
|
||||
String url = "https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined";
|
||||
try {
|
||||
byte[] imgData = downloadImageFromOSS(filePath);
|
||||
// 本地文件路径
|
||||
// String filePath = "[本地文件路径]";
|
||||
String imgStr = Base64Util.encode(imgData);
|
||||
String imgParam = URLEncoder.encode(imgStr, "UTF-8");
|
||||
String param = "image=" + imgParam;
|
||||
//获取accessToken
|
||||
String accessToken = AuthService.getAuth(API_KEY, SECRET_KEY);
|
||||
String result = HttpUtil.post(url, accessToken, param);
|
||||
//接口说明 https://ai.baidu.com/docs#/ImageCensoring-API/top
|
||||
System.out.println(result);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String TextCensor(String content) {
|
||||
// 请求url
|
||||
String url = "https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined";
|
||||
try {
|
||||
String param = "text=" + URLEncoder.encode(content, "utf-8");
|
||||
|
||||
// 注意这里仅为了简化编码每一次请求都去获取access_token,线上环境access_token有过期时间, 客户端可自行缓存,过期后重新获取。
|
||||
String accessToken = AuthService.getAuth(API_KEY, SECRET_KEY);
|
||||
|
||||
String result = HttpUtil.post(url, accessToken, param);
|
||||
System.out.println(result);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 从阿里云读取文件
|
||||
*
|
||||
* @param ossUrl
|
||||
* @return
|
||||
*/
|
||||
public static byte[] downloadImageFromOSS(String ossUrl) {
|
||||
HttpURLConnection connection = null;
|
||||
InputStream inputStream = null;
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
|
||||
try {
|
||||
//读取阿里云的图片使用次方法
|
||||
URL url = new URL(ossUrl);
|
||||
connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
int responseCode = connection.getResponseCode();
|
||||
if (responseCode == HttpURLConnection.HTTP_OK) {
|
||||
inputStream = connection.getInputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
return outputStream.toByteArray();
|
||||
} else {
|
||||
System.err.println("Failed to retrieve data from OSS: HTTP error code " + responseCode);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
|
||||
package com.mcwl.common.utils.sign;
|
||||
|
||||
/**
|
||||
* 十六进制转换
|
||||
*/
|
||||
public class HexStringByte {
|
||||
|
||||
/**
|
||||
* 字符串转换成十六进制值
|
||||
* @param bin String 我们看到的要转换成十六进制的字符串
|
||||
* @return
|
||||
*/
|
||||
public static String stringToHex(String bin) {
|
||||
char[] digital = "0123456789ABCDEF".toCharArray();
|
||||
StringBuffer sb = new StringBuffer("");
|
||||
byte[] bs = bin.getBytes();
|
||||
int bit;
|
||||
for (int i = 0; i < bs.length; i++) {
|
||||
bit = (bs[i] & 0x0f0) >> 4;
|
||||
sb.append(digital[bit]);
|
||||
bit = bs[i] & 0x0f;
|
||||
sb.append(digital[bit]);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 十六进制转换字符串
|
||||
* @param hex String 十六进制
|
||||
* @return String 转换后的字符串
|
||||
*/
|
||||
public static String hexToString(String hex) {
|
||||
String digital = "0123456789ABCDEF";
|
||||
char[] hex2char = hex.toCharArray();
|
||||
byte[] bytes = new byte[hex.length() / 2];
|
||||
int temp;
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
temp = digital.indexOf(hex2char[2 * i]) * 16;
|
||||
temp += digital.indexOf(hex2char[2 * i + 1]);
|
||||
bytes[i] = (byte) (temp & 0xff);
|
||||
}
|
||||
return new String(bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* java字节码转字符串
|
||||
* @param bts
|
||||
* @return
|
||||
*/
|
||||
|
||||
public static String byteToHex(byte[] bts) {
|
||||
String des = "";
|
||||
String tmp = null;
|
||||
for (int i = 0; i < bts.length; i++) {
|
||||
tmp = (Integer.toHexString(bts[i] & 0xFF));
|
||||
if (tmp.length() == 1) {
|
||||
des += "0";
|
||||
}
|
||||
des += tmp;
|
||||
}
|
||||
return des;
|
||||
}
|
||||
|
||||
/**
|
||||
* hex2byte.
|
||||
*
|
||||
* @param hexStr hexStr
|
||||
* @return byte[]
|
||||
*/
|
||||
public static byte[] hex2byte(String hexStr) {
|
||||
byte[] bts = new byte[hexStr.length() / 2];
|
||||
for (int i = 0, j = 0; j < bts.length; j++) {
|
||||
bts[j] = (byte) Integer.parseInt(hexStr.substring(i, i + 2), 16);
|
||||
i += 2;
|
||||
}
|
||||
return bts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转java字节码
|
||||
* @param b
|
||||
* @return
|
||||
*/
|
||||
public static byte[] hexToByte(byte[] b) {
|
||||
if ((b.length % 2) != 0) {
|
||||
throw new IllegalArgumentException("长度不是偶数");
|
||||
}
|
||||
byte[] b2 = new byte[b.length / 2];
|
||||
for (int n = 0; n < b.length; n += 2) {
|
||||
String item = new String(b, n, 2);
|
||||
// 两位一组,表示一个字节,把这样表示的16进制字符串,还原成一个进制字节
|
||||
b2[n / 2] = (byte) Integer.parseInt(item, 16);
|
||||
}
|
||||
b = null;
|
||||
return b2;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
|
||||
package com.mcwl.common.utils.sign;
|
||||
|
||||
|
||||
import com.baidu.aip.util.Base64Util;
|
||||
|
||||
import com.mcwl.common.constant.NcountKey;
|
||||
import com.mcwl.common.exception.NCountDemoException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* 签名 验签 加解密
|
||||
*/
|
||||
@Slf4j
|
||||
public class HnapaySign {
|
||||
|
||||
/**
|
||||
* RSA最大加密明文大小
|
||||
*/
|
||||
private static final int MAX_ENCRYPT_BLOCK = 117;
|
||||
|
||||
|
||||
/**
|
||||
* 签名
|
||||
*
|
||||
* @param privateKey
|
||||
* @param merData 明文串
|
||||
* @return 签名后的消息
|
||||
*/
|
||||
public static byte[] sign(PrivateKey privateKey, String merData) throws NCountDemoException {
|
||||
|
||||
try {
|
||||
return RSAAlgorithms.sign(privateKey, merData);
|
||||
} catch (Exception e) {
|
||||
throw new NCountDemoException("100F1002", "读取密钥异常", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证签名
|
||||
*
|
||||
* @param merData 明文串
|
||||
* @param signMsg 签名消息
|
||||
* @return 验证签名的结果 true--成功 false--失败
|
||||
* @throws NCountDemoException
|
||||
*/
|
||||
public static boolean verify(String merData, String signMsg)
|
||||
throws NCountDemoException {
|
||||
boolean result = false;
|
||||
String hexPublicKey = HexStringByte.byteToHex(Base64Util.decode(NcountKey.NCOUNT_PUBLIC_KEY));
|
||||
String signVal = HexStringByte.byteToHex(Base64Util.decode(signMsg));
|
||||
result = verifySignatureByRSA(merData, signVal, "UTF-8", hexPublicKey);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param src
|
||||
* @param dit
|
||||
* @param charsetType
|
||||
* @param publicKey
|
||||
* @return
|
||||
* @throws NCountDemoException
|
||||
*/
|
||||
private static boolean verifySignatureByRSA(String src, String dit, String charsetType, String publicKey)
|
||||
throws NCountDemoException {
|
||||
if ((src == null) || ("".equals(src.trim()))) {
|
||||
throw new NCountDemoException("src is empty ,verifySignatureByRSA无法执行");
|
||||
}
|
||||
if ((dit == null) || ("".equals(dit.trim()))) {
|
||||
throw new NCountDemoException("dit is empty ,verifySignatureByRSA无法执行");
|
||||
}
|
||||
try {
|
||||
return RSAAlgorithms.verify(publicKey, src, dit);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new NCountDemoException("验证签名出现异常:请检查输入参数", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 公钥加密
|
||||
* </p>
|
||||
*
|
||||
* @param data 源数据
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] encryptByPublicKey(byte[] data, String key) throws Exception {
|
||||
if (data == null) {
|
||||
throw new Exception("需要加密的数据为空");
|
||||
}
|
||||
PublicKey publicKey = getPublicKey(key);
|
||||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(publicKey.getEncoded());
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(NcountKey.ALGORITHM);
|
||||
Key publicK = keyFactory.generatePublic(x509KeySpec);
|
||||
// 对数据加密
|
||||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicK);
|
||||
int inputLen = data.length;
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
int offSet = 0;
|
||||
byte[] cache;
|
||||
int i = 0;
|
||||
// 对数据分段加密
|
||||
while (inputLen - offSet > 0) {
|
||||
if (inputLen - offSet > MAX_ENCRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK);
|
||||
} else {
|
||||
cache = cipher.doFinal(data, offSet, inputLen - offSet);
|
||||
}
|
||||
out.write(cache, 0, cache.length);
|
||||
i++;
|
||||
offSet = i * MAX_ENCRYPT_BLOCK;
|
||||
}
|
||||
byte[] encryptedData = out.toByteArray();
|
||||
out.close();
|
||||
return encryptedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param publicKey 密钥信息
|
||||
* @return 返回公钥
|
||||
* @throws Exception
|
||||
*/
|
||||
private static PublicKey getPublicKey(String publicKey) throws Exception {
|
||||
PublicKey pubKey = null;
|
||||
try {
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(NcountKey.ALGORITHM);
|
||||
pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(Base64Util.decode(publicKey)));
|
||||
} catch (InvalidKeySpecException e) {
|
||||
throw new Exception("公钥无效!", e);
|
||||
}
|
||||
return pubKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* hex2byte.
|
||||
*
|
||||
* @param hexStr hexStr
|
||||
* @return byte[]
|
||||
*/
|
||||
public static byte[] hex2byte(String hexStr) {
|
||||
byte[] bts = new byte[hexStr.length() / 2];
|
||||
for (int i = 0, j = 0; j < bts.length; j++) {
|
||||
bts[j] = (byte) Integer.parseInt(hexStr.substring(i, i + 2), 16);
|
||||
i += 2;
|
||||
}
|
||||
return bts;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.mcwl.common.utils.sign;
|
||||
|
||||
|
||||
import com.baidu.aip.util.Base64Util;
|
||||
import com.mcwl.common.constant.NcountKey;
|
||||
import com.mcwl.common.exception.NCountDemoException;
|
||||
|
||||
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PrivateKey;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
|
||||
public class KeyUtils {
|
||||
|
||||
/**
|
||||
* 加载私钥
|
||||
*
|
||||
*/
|
||||
public static PrivateKey loadPrivateKey(String privateKey) throws NCountDemoException {
|
||||
// 去除头尾标志
|
||||
// 去除换行符
|
||||
privateKey = privateKey.replace("\r", "").replace("\n", "").replace(" ", "");
|
||||
byte[] bPriKey = Base64Util.decode(privateKey);
|
||||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(bPriKey);
|
||||
KeyFactory keyFactory;
|
||||
try {
|
||||
keyFactory = KeyFactory.getInstance(NcountKey.ALGORITHM);
|
||||
PrivateKey key = keyFactory.generatePrivate(keySpec);
|
||||
return key;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new NCountDemoException("加载私钥异常", e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright (c) 2016. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
||||
* www.hnapay.com
|
||||
*/
|
||||
|
||||
package com.mcwl.common.utils.sign;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.mcwl.common.constant.NcountKey;
|
||||
import com.mcwl.common.exception.NCountDemoException;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.*;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
|
||||
/**
|
||||
* 签名验签
|
||||
*/
|
||||
public class RSAAlgorithms {
|
||||
|
||||
/**
|
||||
* @param publicKey
|
||||
* 公钥HEX字符串
|
||||
* @return 返回公钥
|
||||
* @throws Exception
|
||||
*/
|
||||
public static PublicKey getPublicKey(String publicKey) throws NCountDemoException {
|
||||
PublicKey pubKey = null;
|
||||
try {
|
||||
byte[] encodedKey = HexStringByte.hexToByte(publicKey.getBytes());
|
||||
KeyFactory keyFactory = KeyFactory.getInstance(NcountKey.ALGORITHM);
|
||||
pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey));
|
||||
} catch (InvalidKeySpecException e) {
|
||||
throw new NCountDemoException("公钥无效!", e);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new NCountDemoException("算法类型无效!", e);
|
||||
}
|
||||
return pubKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param priKey
|
||||
* 私钥
|
||||
* @param data
|
||||
* 要签名的数据
|
||||
* @return 签名消息
|
||||
* @throws Exception
|
||||
*/
|
||||
public static byte[] sign(PrivateKey priKey, String data) throws NCountDemoException {
|
||||
try {
|
||||
Signature signet = Signature.getInstance(NcountKey.SIGN_ALGORITHM);
|
||||
signet.initSign(priKey);
|
||||
signet.update(data.getBytes("UTF-8"));
|
||||
return signet.sign();
|
||||
} catch (Exception e) {
|
||||
throw new NCountDemoException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证签名
|
||||
*
|
||||
* @param publicKey
|
||||
* 公钥HEX字符串
|
||||
* @param merData
|
||||
* 签名数据
|
||||
* @param signMsg
|
||||
* 签名消息
|
||||
* @return 返回验证结果 true 成功 false 失败
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Boolean verify(String publicKey, String merData, String signMsg) throws NCountDemoException {
|
||||
|
||||
boolean bVerify = false;
|
||||
Signature signet = null;
|
||||
try {
|
||||
signet = Signature.getInstance(NcountKey.SIGN_ALGORITHM);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new NCountDemoException("算法类型不能为空!", e);
|
||||
}
|
||||
|
||||
PublicKey pubKey = getPublicKey(publicKey);
|
||||
|
||||
try {
|
||||
signet.initVerify(pubKey);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new NCountDemoException("公钥无效!", e);
|
||||
}
|
||||
try {
|
||||
signet.update(merData.getBytes("UTF-8"));
|
||||
} catch (SignatureException e) {
|
||||
throw new NCountDemoException("验签时符号异常!", e);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new NCountDemoException("不支持的编码方式", e);
|
||||
}
|
||||
|
||||
try {
|
||||
bVerify = signet.verify(HexStringByte.hex2byte(signMsg));
|
||||
} catch (SignatureException e) {
|
||||
throw new NCountDemoException("验签异常!", e);
|
||||
}
|
||||
return bVerify;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,8 +18,8 @@ public class TelSmsUtils {
|
|||
/**
|
||||
* 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限
|
||||
*/
|
||||
private static String accessKeyId = "LTAIEVXszCmcd1T5";
|
||||
private static String accessKeySecret = "2zHwciQXln8wExSEnkIYtRTSwLeRNd";
|
||||
private static String accessKeyId = "LTAI5tSHZZ8wHJRP8X4r9TXT";
|
||||
private static String accessKeySecret = "F82IVNx0IGJ3AnP6gSIfcyql1HCXIH";
|
||||
|
||||
/**
|
||||
* 短信访问域名
|
||||
|
@ -28,7 +28,7 @@ public class TelSmsUtils {
|
|||
/**
|
||||
* 短信签名
|
||||
*/
|
||||
private static String signName = "帝宇";
|
||||
private static String signName = "魔创未来";
|
||||
|
||||
/**
|
||||
* 实例化短信对象
|
||||
|
@ -65,7 +65,7 @@ public class TelSmsUtils {
|
|||
/**
|
||||
* 发送单条短信
|
||||
* @param tel
|
||||
* @param templateCode SMS_153991546
|
||||
* @param templateCode
|
||||
* @param sendDataMap
|
||||
*/
|
||||
public static String sendSms(String tel , String templateCode , Map<String,String> sendDataMap){
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
//package com.mcwl.common.web;
|
||||
//
|
||||
//
|
||||
//import org.springframework.dao.DataAccessException;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * 公共mapper
|
||||
//
|
||||
// */
|
||||
//public interface BaseMapper<K, V> {
|
||||
//
|
||||
// /**
|
||||
// * 根据条件查询数据的数量
|
||||
// *
|
||||
// * @param v 实体类
|
||||
// * @return 数量
|
||||
// */
|
||||
// int searchCount(V v);
|
||||
//
|
||||
// /**
|
||||
// * 根据条件查询数据
|
||||
// *
|
||||
// * @param v 实体类
|
||||
// * @return List<K> 实体类的集合
|
||||
// * @throws DataAccessException 数据访问异常
|
||||
// */
|
||||
// List<K> searchByCondition(V v) throws DataAccessException;
|
||||
//
|
||||
//}
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl</artifactId>
|
||||
<version>3.8.8</version>
|
||||
</parent>
|
||||
|
||||
<description>
|
||||
社区中心
|
||||
</description>
|
||||
|
||||
<artifactId>mcwl-communityCenter</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-system</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,24 @@
|
|||
package com.mcwl.communityCenter.constant;
|
||||
|
||||
|
||||
/**
|
||||
* 邀请常量
|
||||
*/
|
||||
public class InviteConstant {
|
||||
/**
|
||||
* 邀请类型 0普通用户
|
||||
*/
|
||||
public static final int INVITE_ADMIN = 1;
|
||||
/**
|
||||
* 邀请类型 1管理员
|
||||
*/
|
||||
public static final int INVITE_COMMON = 0;
|
||||
/**
|
||||
* 费用类型 0免费
|
||||
*/
|
||||
public static final int INVITE_FREE = 0;
|
||||
/**
|
||||
* 费用类型 1付费
|
||||
*/
|
||||
public static final int INVITE_FEE = 1;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.mcwl.communityCenter.constant;
|
||||
|
||||
/**
|
||||
* 状态常量
|
||||
*/
|
||||
public class StatusConstant {
|
||||
/**
|
||||
* 可用
|
||||
*/
|
||||
public static final int STATUS_AVAILABLE = 1;
|
||||
|
||||
/**
|
||||
* 不可用
|
||||
*/
|
||||
public static final int STATUS_UNAVAILABLE = 0;
|
||||
|
||||
/**
|
||||
* 已回复
|
||||
*/
|
||||
public static final int STATUS_REPLIED = 1;
|
||||
|
||||
/**
|
||||
* 未回复
|
||||
*/
|
||||
public static final int STATUS_UNREPLIED = 0;
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.mcwl.communityCenter.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.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 社区
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_community")
|
||||
@ApiModel(value = "社区")
|
||||
public class Community extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 社区名称
|
||||
*/
|
||||
@ApiModelProperty(value = "社区名称")
|
||||
private String communityName;
|
||||
|
||||
/**
|
||||
* 社区类型
|
||||
*/
|
||||
@ApiModelProperty(value = "社区类型")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@ApiModelProperty(value = "价格")
|
||||
private Double price;
|
||||
|
||||
/**
|
||||
* 有效期类型
|
||||
*/
|
||||
@ApiModelProperty(value = "有效期类型")
|
||||
private Integer validityType;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 社区通知
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_advice")
|
||||
public class CommunityAdvice extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
/**
|
||||
* 通知人
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 通知内容
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 是否已读
|
||||
*/
|
||||
private String isRead;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 邀请表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_invite")
|
||||
public class Invite extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id - 租户id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
/**
|
||||
* 被邀请人
|
||||
*/
|
||||
private Long inviteeUserId;
|
||||
/**
|
||||
* 受邀类型 0普通 1管理员
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 费用类型 0免费 1付费
|
||||
*/
|
||||
private Integer feeType;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 邀请码映射
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_invite_code_mapping")
|
||||
public class InviteCodeMapping extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
private String inviteCode;
|
||||
/**
|
||||
* 状态 1 可用 0 不可用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 评论区评论
|
||||
*/
|
||||
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
@ApiModel(description = "评论区评论")
|
||||
public class PublicModelCommentVo {
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 评论id
|
||||
*/
|
||||
@ApiModelProperty(value = "评论id")
|
||||
private Long commentId;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
@ApiModelProperty(value = "评论内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 子评论
|
||||
*/
|
||||
@ApiModelProperty(value = "子评论")
|
||||
private List<PublicModelCommentVo> contentList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 评论点赞数
|
||||
*/
|
||||
@ApiModelProperty(value = "评论点赞数")
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论时间
|
||||
*/
|
||||
@ApiModelProperty(value = "评论时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 发布
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_publish")
|
||||
public class Publish extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id - 租户id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 发布人
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 发布时间 - 定时发布
|
||||
*/
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论数
|
||||
*/
|
||||
private Integer commentNum;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.mcwl.communityCenter.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.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**社群评论区
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.web.controller.communityCenter
|
||||
* @Filename:PublishCommission
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:11
|
||||
*/
|
||||
@ApiModel(description = "评论区评论")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_publish_commission")
|
||||
public class PublishCommission extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Long tenantId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String content;
|
||||
/**
|
||||
* 父评论id
|
||||
*/
|
||||
@ApiModelProperty(value = "父评论id")
|
||||
private Long parentId;
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
private Integer likeNum;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
@ApiModelProperty(value = "删除标志(0代表存在 2代表删除)")
|
||||
private String delFlag;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.mcwl.communityCenter.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.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**社群评论点赞
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.domain
|
||||
* @Filename:PublishCommissionLike
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:16
|
||||
*/
|
||||
@ApiModel(description = "评论点赞")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_publish_commission_like")
|
||||
public class PublishCommissionLike extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 评论点赞id
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty(value = "评论点赞id")
|
||||
private Long id;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 社群id
|
||||
*/
|
||||
@ApiModelProperty(value = "社群id")
|
||||
private Long communityId;
|
||||
/**
|
||||
* 评论id
|
||||
*/
|
||||
@ApiModelProperty(value = "评论id")
|
||||
private Long publishCommissionId;
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
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.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 提问
|
||||
*/
|
||||
@ApiModel(description = "提问")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_question")
|
||||
public class Question extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
|
||||
/**
|
||||
* 用户id - 租户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id - 租户id")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 提问用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "提问用户id")
|
||||
private Long questionUserId;
|
||||
|
||||
/**
|
||||
* 提问内容
|
||||
*/
|
||||
@ApiModelProperty(value = "提问内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 答复用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "答复用户id")
|
||||
private Long replyUserId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
@ApiModelProperty(value = "答复内容")
|
||||
private String reply;
|
||||
|
||||
/**
|
||||
* 回复时间
|
||||
*/
|
||||
private Date replyTime;
|
||||
|
||||
/**
|
||||
* 提问图片
|
||||
*/
|
||||
@ApiModelProperty(value = "提问图片")
|
||||
private String questionUrl;
|
||||
|
||||
/**
|
||||
* 是否匿名
|
||||
*/
|
||||
@ApiModelProperty(value = "是否匿名")
|
||||
private Integer isAnonymous;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.mcwl.communityCenter.domain;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* 用户和社区关联表
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("cc_user_community")
|
||||
public class UserCommunity extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id - 多租户id
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
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.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 社区请求参数
|
||||
*/
|
||||
@Data
|
||||
@TableName("cc_community")
|
||||
@ApiModel(value = "社区请求参数")
|
||||
public class CommunityDto {
|
||||
|
||||
/**
|
||||
* 社区名称
|
||||
*/
|
||||
@ApiModelProperty(value = "社区名称", required = true)
|
||||
@NotBlank(message = "社区名称不能为空")
|
||||
private String communityName;
|
||||
|
||||
/**
|
||||
* 社区类型
|
||||
*/
|
||||
@ApiModelProperty(value = "社区类型", required = true)
|
||||
@NotNull(message = "社区类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
@ApiModelProperty(value = "价格", required = true)
|
||||
@NotNull(message = "价格不能为空")
|
||||
private Double price;
|
||||
|
||||
/**
|
||||
* 有效期类型
|
||||
*/
|
||||
@ApiModelProperty(value = "有效期类型", required = true)
|
||||
@NotNull(message = "有效期类型不能为空")
|
||||
private Integer validityType;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发布请求参数
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "发布请求参数")
|
||||
public class PublishRes {
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@NotBlank(message = "内容不能为空")
|
||||
@ApiModelProperty(value = "内容", required = true)
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 发布时间 - 定时发布
|
||||
*/
|
||||
@ApiModelProperty(value = "发布时间 - 定时发布")
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
private Integer status;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class QuestionPageRes extends PageDomain {
|
||||
|
||||
@NotNull(message = "社区不能为空")
|
||||
private Long communityId;
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class QuestionReplyDto {
|
||||
|
||||
/**
|
||||
* 问题id
|
||||
*/
|
||||
@NotNull(message = "问题id不能为空")
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
@NotBlank(message = "回复内容不能为空")
|
||||
private String content;
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 提问请求参数
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("提问请求参数")
|
||||
public class QuestionRes {
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@NotNull(message = "租户不能为空")
|
||||
@ApiModelProperty(value = "租户ID", hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@NotNull(message = "社区不能为空")
|
||||
@ApiModelProperty(value = "社区ID", required = true, position = 1)
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 提问用户id
|
||||
*/
|
||||
@NotNull(message = "提问用户不能为空")
|
||||
@ApiModelProperty(value = "提问用户id", required = true, position = 2)
|
||||
private Long questionUserId;
|
||||
|
||||
/**
|
||||
* 提问内容
|
||||
*/
|
||||
@NotBlank(message = "提问内容不能为空")
|
||||
@ApiModelProperty(value = "提问内容", required = true, position = 3)
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提问图片
|
||||
*/
|
||||
@ApiModelProperty(value = "提问图片", position = 4)
|
||||
private String questionUrl;
|
||||
|
||||
/**
|
||||
* 是否匿名 0 否 1 是
|
||||
*/
|
||||
//swagger给上默认值
|
||||
@ApiModelProperty(value = "是否匿名", example = "0", allowableValues = "0,1", position = 5)
|
||||
private Integer isAnonymous = 0;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.mcwl.communityCenter.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 社区请求参数
|
||||
*/
|
||||
@Data
|
||||
@TableName("cc_community")
|
||||
@ApiModel(value = "社区返回数据")
|
||||
public class CommunityVo {
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 社区名称
|
||||
*/
|
||||
@ApiModelProperty(value = "社区名称")
|
||||
private String communityName;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.mcwl.communityCenter.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class PublishVo {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id - 租户id
|
||||
*/
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 发布时间 - 定时发布
|
||||
*/
|
||||
private Date publishTime;
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 评论数
|
||||
*/
|
||||
private Integer commentNum;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package com.mcwl.communityCenter.domain.vo;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class QuestionVo {
|
||||
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 提问用户id
|
||||
*/
|
||||
private Long questionUserId;
|
||||
|
||||
/**
|
||||
* 提问用户名
|
||||
*/
|
||||
private String questionUserName;
|
||||
|
||||
/**
|
||||
* 提问用户头像
|
||||
*/
|
||||
private String questionUserAvatar;
|
||||
|
||||
/**
|
||||
* 提问内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提问图片
|
||||
*/
|
||||
private String questionUrl;
|
||||
|
||||
/**
|
||||
* 提问时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 答复用户id
|
||||
*/
|
||||
private Long replyUserId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
private String reply;
|
||||
|
||||
/**
|
||||
* 回复时间
|
||||
*/
|
||||
private Date replyTime;
|
||||
|
||||
/**
|
||||
* 是否匿名
|
||||
*/
|
||||
private Integer isAnonymous;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.mcwl.communityCenter.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.LongValue;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CustomTenantHandler implements TenantLineHandler {
|
||||
|
||||
private static final Set<String> tables = new HashSet<>();
|
||||
|
||||
/**
|
||||
* 按id隔离
|
||||
* 需要根据业务需要进行调整.需要多租户的表名
|
||||
*/
|
||||
static {
|
||||
tables.add("cc_publish");
|
||||
tables.add("cc_question");
|
||||
tables.add("cc_user_community");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
// 假设有一个租户上下文,能够从中获取当前用户的租户
|
||||
Long tenantId;
|
||||
try {
|
||||
tenantId = SecurityUtils.getUserId();
|
||||
} catch (Exception e) {
|
||||
return new LongValue(-1L);
|
||||
}
|
||||
// 返回租户ID的表达式,LongValue 是 JSQLParser 中表示 bigint 类型的 class
|
||||
return new LongValue(tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenantIdColumn() {
|
||||
return "tenant_id";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
// 根据需要返回是否忽略该表,true:表示忽略,false:需要解析并拼接多租户条件
|
||||
return !tables.contains(tableName);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.CommunityAdvice;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CommunityAdviceMapper extends BaseMapper<CommunityAdvice> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CommunityMapper extends BaseMapper<Community> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.InviteCodeMapping;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InviteCodeMappingMapper extends BaseMapper<InviteCodeMapping> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.Invite;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface InviteMapper extends BaseMapper<Invite> {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.PublishCommissionLike;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.mapper
|
||||
* @Filename:PublishCommissionLikeMapper
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:26
|
||||
*/
|
||||
@Mapper
|
||||
public interface PublishCommissionLikeMapper extends BaseMapper<PublishCommissionLike> {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.PublishCommission;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.mapper
|
||||
* @Filename:PublishCommissionMapper
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface PublishCommissionMapper extends BaseMapper<PublishCommission> {
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface PublishMapper extends BaseMapper<Publish> {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface QuestionMapper extends BaseMapper<Question> {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.mcwl.communityCenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.UserCommunity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface UserCommunityMapper extends BaseMapper<UserCommunity> {
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.CommunityAdvice;
|
||||
|
||||
public interface CommunityAdviceService extends IService<CommunityAdvice> {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
|
||||
public interface CommunityService extends IService<Community> {
|
||||
TableDataInfo listByPage(PageDomain pageDomain);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.communityCenter.domain.InviteCodeMapping;
|
||||
|
||||
public interface InviteCodeMappingService extends IService<InviteCodeMapping> {
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Invite;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public interface InviteService extends IService<Invite> {
|
||||
|
||||
/**
|
||||
* 获取邀请码
|
||||
* @param communityId 社区id
|
||||
* @return 邀请码
|
||||
*/
|
||||
String getInviteCode(@NotNull(message = "communityId不能为空") Long communityId);
|
||||
|
||||
/**
|
||||
* 接受邀请
|
||||
* @param communityId 社区id
|
||||
* @param inviteCode 邀请码
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean acceptInvite(@NotNull(message = "communityId不能为空") Long communityId, @NotBlank(message = "inviteCode不能为空") String inviteCode);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.communityCenter.domain.PublishCommissionLike;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.service
|
||||
* @Filename:PublishCommissionLikeService
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:23
|
||||
*/
|
||||
@Service
|
||||
public interface PublishCommissionLikeService extends IService<PublishCommissionLike> {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.communityCenter.domain.PublicModelCommentVo;
|
||||
import com.mcwl.communityCenter.domain.PublishCommission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.service
|
||||
* @Filename:PublishCommissionService
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:27
|
||||
*/
|
||||
|
||||
public interface PublishCommissionService extends IService<PublishCommission> {
|
||||
/**
|
||||
* 点赞或取消点赞评论
|
||||
* @param userId 用户ID
|
||||
* @param commentId 评论ID
|
||||
* @return 更新后的点赞数
|
||||
*/
|
||||
int toggleLike(Long userId, Long commentId);
|
||||
|
||||
List<PublicModelCommentVo> getComment(PublishCommission publishCommission);
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
|
||||
public interface PublishService extends IService<Publish> {
|
||||
TableDataInfo listByPage(PageDomain pageDomain);
|
||||
|
||||
PublishVo getDetail(Long id);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionReplyDto;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public interface QuestionService extends IService<Question> {
|
||||
|
||||
/**
|
||||
* 添加问题
|
||||
* @param questionRes 问题信息
|
||||
*/
|
||||
void addQuestion(QuestionRes questionRes);
|
||||
|
||||
|
||||
TableDataInfo listUnReplied(QuestionPageRes questionPageRes);
|
||||
|
||||
QuestionVo getDetail(@NotNull(message = "id不能为空") Long id);
|
||||
|
||||
/**
|
||||
* 回复问题
|
||||
* @param questionReplyDto 回复信息
|
||||
*/
|
||||
void reply(QuestionReplyDto questionReplyDto);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.mcwl.communityCenter.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.UserCommunity;
|
||||
|
||||
public interface UserCommunityService extends IService<UserCommunity> {
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.CommunityAdvice;
|
||||
import com.mcwl.communityCenter.mapper.CommunityAdviceMapper;
|
||||
import com.mcwl.communityCenter.mapper.CommunityMapper;
|
||||
import com.mcwl.communityCenter.service.CommunityAdviceService;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class CommunityAdviceServiceImpl extends ServiceImpl<CommunityAdviceMapper, CommunityAdvice>
|
||||
implements CommunityAdviceService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.HttpUtil;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.communityCenter.domain.Community;
|
||||
import com.mcwl.communityCenter.domain.vo.CommunityVo;
|
||||
import com.mcwl.communityCenter.mapper.CommunityMapper;
|
||||
import com.mcwl.communityCenter.service.CommunityService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class CommunityServiceImpl extends ServiceImpl<CommunityMapper, Community> implements CommunityService {
|
||||
|
||||
|
||||
@Override
|
||||
public TableDataInfo listByPage(PageDomain pageDomain) {
|
||||
|
||||
Page<Community> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
|
||||
|
||||
boolean isAsc = Objects.equals(pageDomain.getIsAsc(), "asc");
|
||||
|
||||
if (StringUtils.isBlank(pageDomain.getOrderByColumn())) {
|
||||
pageDomain.setOrderByColumn("create_time");
|
||||
}
|
||||
OrderItem orderItem = new OrderItem(pageDomain.getOrderByColumn(), isAsc);
|
||||
page.addOrder(orderItem);
|
||||
|
||||
baseMapper.selectPage(page, null);
|
||||
|
||||
List<Community> communityList = page.getRecords();
|
||||
List<CommunityVo> communityVoList = new ArrayList<>();
|
||||
for (Community community : communityList) {
|
||||
CommunityVo communityVo = new CommunityVo();
|
||||
BeanUtil.copyProperties(community, communityVo);
|
||||
communityVoList.add(communityVo);
|
||||
}
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(communityVoList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.communityCenter.domain.InviteCodeMapping;
|
||||
import com.mcwl.communityCenter.mapper.InviteCodeMappingMapper;
|
||||
import com.mcwl.communityCenter.service.InviteCodeMappingService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class InviteCodeMappingServiceImpl extends ServiceImpl<InviteCodeMappingMapper, InviteCodeMapping>
|
||||
implements InviteCodeMappingService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.ShareCodeUtils;
|
||||
import com.mcwl.communityCenter.constant.InviteConstant;
|
||||
import com.mcwl.communityCenter.constant.StatusConstant;
|
||||
import com.mcwl.communityCenter.domain.Invite;
|
||||
import com.mcwl.communityCenter.domain.InviteCodeMapping;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.UserCommunity;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
import com.mcwl.communityCenter.mapper.InviteMapper;
|
||||
import com.mcwl.communityCenter.mapper.PublishMapper;
|
||||
import com.mcwl.communityCenter.service.InviteCodeMappingService;
|
||||
import com.mcwl.communityCenter.service.InviteService;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import com.mcwl.communityCenter.service.UserCommunityService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class InviteServiceImpl extends ServiceImpl<InviteMapper, Invite> implements InviteService {
|
||||
|
||||
private final UserCommunityService userCommunityService;
|
||||
|
||||
private final InviteCodeMappingService inviteCodeMappingService;
|
||||
|
||||
|
||||
@Override
|
||||
public String getInviteCode(Long communityId) {
|
||||
|
||||
|
||||
// 查询用户的社区
|
||||
UserCommunity userCommunity = userCommunityService.lambdaQuery()
|
||||
.eq(UserCommunity::getCommunityId, communityId)
|
||||
.one();
|
||||
|
||||
if (Objects.isNull(userCommunity)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String idCode = ShareCodeUtils.idToCode(SecurityUtils.getUserId());
|
||||
|
||||
String inviteCode = "https://www.yaoqing.com?communityId=" + communityId + "&inviteCode=" + idCode;
|
||||
|
||||
// 插入数据库
|
||||
InviteCodeMapping inviteCodeMapping = new InviteCodeMapping();
|
||||
inviteCodeMapping.setUserId(SecurityUtils.getUserId());
|
||||
inviteCodeMapping.setInviteCode(idCode);
|
||||
inviteCodeMapping.setCommunityId(communityId);
|
||||
inviteCodeMapping.setStatus(StatusConstant.STATUS_AVAILABLE);
|
||||
inviteCodeMappingService.save(inviteCodeMapping);
|
||||
|
||||
return inviteCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean acceptInvite(Long communityId, String inviteCode) {
|
||||
|
||||
// 解析邀请码
|
||||
Long userId = ShareCodeUtils.codeToId(inviteCode);
|
||||
if (Objects.isNull(userId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 判断是否是同一个人
|
||||
if (Objects.equals(userId, SecurityUtils.getUserId())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 查询邀请码
|
||||
InviteCodeMapping inviteCodeMapping = inviteCodeMappingService.lambdaQuery()
|
||||
.eq(InviteCodeMapping::getUserId, userId)
|
||||
.eq(InviteCodeMapping::getInviteCode, inviteCode)
|
||||
.eq(InviteCodeMapping::getStatus, StatusConstant.STATUS_AVAILABLE)
|
||||
.one();
|
||||
|
||||
if (Objects.isNull(inviteCodeMapping)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
inviteCodeMapping.setStatus(StatusConstant.STATUS_UNAVAILABLE);
|
||||
inviteCodeMappingService.updateById(inviteCodeMapping);
|
||||
|
||||
Invite invite = new Invite();
|
||||
invite.setTenantId(userId);
|
||||
invite.setInviteeUserId(SecurityUtils.getUserId());
|
||||
invite.setType(InviteConstant.INVITE_ADMIN);
|
||||
invite.setFeeType(InviteConstant.INVITE_FEE);
|
||||
baseMapper.insert(invite);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.communityCenter.domain.PublishCommissionLike;
|
||||
import com.mcwl.communityCenter.mapper.PublishCommissionLikeMapper;
|
||||
import com.mcwl.communityCenter.service.PublishCommissionLikeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**评论区点赞业务层
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.service.impl
|
||||
* @Filename:PublishCommissionLikeServiceImpl
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:25
|
||||
*/
|
||||
@Service
|
||||
public class PublishCommissionLikeServiceImpl extends ServiceImpl<PublishCommissionLikeMapper, PublishCommissionLike>implements PublishCommissionLikeService {
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.communityCenter.domain.PublicModelCommentVo;
|
||||
import com.mcwl.communityCenter.domain.PublishCommission;
|
||||
import com.mcwl.communityCenter.domain.PublishCommissionLike;
|
||||
import com.mcwl.communityCenter.mapper.PublishCommissionLikeMapper;
|
||||
import com.mcwl.communityCenter.mapper.PublishCommissionMapper;
|
||||
import com.mcwl.communityCenter.service.PublishCommissionService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**评论区业务层
|
||||
* @Author:ChenYan
|
||||
* @Project:mcwl-ai
|
||||
* @Package:com.mcwl.communityCenter.service.impl
|
||||
* @Filename:PublishCommissionServiceImpl
|
||||
* @Description TODO
|
||||
* @Date:2025/1/17 14:28
|
||||
*/
|
||||
@Service
|
||||
public class PublishCommissionServiceImpl extends ServiceImpl<PublishCommissionMapper, PublishCommission> implements PublishCommissionService {
|
||||
@Autowired
|
||||
private PublishCommissionMapper publishCommentMapper;
|
||||
@Autowired
|
||||
private PublishCommissionLikeMapper likeMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 点赞或取消点赞评论
|
||||
* @param userId 用户ID
|
||||
* @param commentId 评论ID
|
||||
* @return 更新后的点赞数
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int toggleLike(Long userId, Long commentId) {
|
||||
// 检查评论是否存在
|
||||
PublishCommission comment = this.getById(commentId);
|
||||
if (comment == null) {
|
||||
throw new RuntimeException("Comment not found");
|
||||
}
|
||||
|
||||
// 检查用户是否已经点赞
|
||||
PublishCommissionLike like = likeMapper.selectOne(
|
||||
new LambdaQueryWrapper<PublishCommissionLike>()
|
||||
.eq(PublishCommissionLike::getUserId, userId)
|
||||
.eq(PublishCommissionLike::getPublishCommissionId, commentId));
|
||||
|
||||
if (like == null) { // 如果没有找到点赞记录,则进行点赞
|
||||
like = new PublishCommissionLike();
|
||||
like.setUserId(userId);
|
||||
like.setCommunityId(1L); // 假设有一个默认的社区ID
|
||||
like.setPublishCommissionId(commentId);
|
||||
likeMapper.insert(like);
|
||||
|
||||
// 更新评论的点赞数
|
||||
comment.setLikeNum(comment.getLikeNum() == null ? 1 : comment.getLikeNum() + 1);
|
||||
} else { // 如果找到了点赞记录,则取消点赞
|
||||
likeMapper.deleteById(like.getId());
|
||||
|
||||
// 更新评论的点赞数
|
||||
comment.setLikeNum(Math.max(0, comment.getLikeNum() - 1));
|
||||
}
|
||||
|
||||
// 保存更新后的评论信息
|
||||
this.updateById(comment);
|
||||
|
||||
return comment.getLikeNum();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PublicModelCommentVo> getComment(PublishCommission publishCommission) {
|
||||
List<PublicModelCommentVo> CommentVoList = new ArrayList<>();
|
||||
|
||||
// 查询所有父评论
|
||||
LambdaQueryWrapper<PublishCommission> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(PublishCommission::getTenantId, publishCommission.getTenantId())
|
||||
.isNull(PublishCommission::getParentId)
|
||||
.orderByDesc(PublishCommission::getCreateTime);
|
||||
// 添加父评论
|
||||
List<PublishCommission> modelCommentList = publishCommentMapper.selectList(lqw);
|
||||
for (PublishCommission Comment : modelCommentList) {
|
||||
PublicModelCommentVo CommentVo = getModelCommentVo(Comment);
|
||||
CommentVoList.add(CommentVo);
|
||||
}
|
||||
|
||||
return CommentVoList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建CommentVo对象
|
||||
*
|
||||
* @param Comment 父评论对象
|
||||
* @return CommentVo对象
|
||||
*/
|
||||
@NotNull
|
||||
private PublicModelCommentVo getModelCommentVo(PublishCommission Comment) {
|
||||
Long userId = Comment.getUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
|
||||
// 构建CommentVo对象
|
||||
PublicModelCommentVo CommentVo = new PublicModelCommentVo();
|
||||
CommentVo.setUserId(userId);
|
||||
CommentVo.setUserName(sysUser.getUserName());
|
||||
CommentVo.setUserAvatar(sysUser.getAvatar());
|
||||
CommentVo.setCommentId(Comment.getId());
|
||||
CommentVo.setContent(Comment.getContent());
|
||||
// 查询子评论
|
||||
CommentVo.setContentList(getContentList(Comment.getId()));
|
||||
CommentVo.setLikeNum(Comment.getLikeNum());
|
||||
CommentVo.setCreateTime(Comment.getCreateTime());
|
||||
return CommentVo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归查询子评论
|
||||
*
|
||||
* @param CommentId 父评论id
|
||||
* @return List<ModelCommentVo>
|
||||
*/
|
||||
private List<PublicModelCommentVo> getContentList(Long CommentId) {
|
||||
List<PublicModelCommentVo> CommentVoList = new ArrayList<>();
|
||||
if (Objects.isNull(CommentId)) {
|
||||
return CommentVoList;
|
||||
}
|
||||
|
||||
// 查询子评论
|
||||
LambdaQueryWrapper<PublishCommission> lqw = new LambdaQueryWrapper<PublishCommission>()
|
||||
.eq(PublishCommission::getParentId, CommentId)
|
||||
.orderByDesc(PublishCommission::getCreateTime);
|
||||
|
||||
List<PublishCommission> CommentList = publishCommentMapper.selectList(lqw);
|
||||
|
||||
for (PublishCommission Comment : CommentList) {
|
||||
Long userId = Comment.getUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
PublicModelCommentVo CommentVo = new PublicModelCommentVo();
|
||||
CommentVo.setUserId(userId);
|
||||
CommentVo.setUserName(sysUser.getUserName());
|
||||
CommentVo.setUserAvatar(sysUser.getAvatar());
|
||||
CommentVo.setCommentId(Comment.getId());
|
||||
CommentVo.setContent(Comment.getContent());
|
||||
CommentVo.setLikeNum(Comment.getLikeNum());
|
||||
CommentVo.setCreateTime(Comment.getCreateTime());
|
||||
|
||||
|
||||
CommentVoList.add(CommentVo);
|
||||
}
|
||||
return CommentVoList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
import com.mcwl.communityCenter.mapper.PublishMapper;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> implements PublishService {
|
||||
@Override
|
||||
public TableDataInfo listByPage(PageDomain pageDomain) {
|
||||
// 分页查询
|
||||
Page<Publish> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
boolean isAsc = Objects.equals(pageDomain.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(pageDomain.getOrderByColumn(), isAsc);
|
||||
page.addOrder(orderItem);
|
||||
|
||||
// 条件设置
|
||||
LambdaQueryWrapper<Publish> lqw = new LambdaQueryWrapper<>();
|
||||
|
||||
// 查询
|
||||
baseMapper.selectPage(page, lqw);
|
||||
|
||||
// 返回数据
|
||||
List<PublishVo> publishVoList = new ArrayList<>();
|
||||
|
||||
// 封装数据
|
||||
List<Publish> publishList = page.getRecords();
|
||||
for (Publish publish : publishList) {
|
||||
PublishVo publishVo = new PublishVo();
|
||||
BeanUtil.copyProperties(publish, publishVo);
|
||||
publishVo.setUserName(SecurityUtils.getUsername());
|
||||
publishVo.setAvatar(SecurityUtils.getLoginUser().getUser().getAvatar());
|
||||
// TODO 评论数
|
||||
publishVo.setCommentNum(0);
|
||||
publishVoList.add(publishVo);
|
||||
|
||||
}
|
||||
|
||||
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(publishVoList);
|
||||
rspData.setTotal(page.getTotal());
|
||||
|
||||
return rspData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PublishVo getDetail(Long id) {
|
||||
|
||||
Publish publish = baseMapper.selectById(id);
|
||||
if (Objects.isNull(publish)) {
|
||||
return null;
|
||||
}
|
||||
PublishVo publishVo = new PublishVo();
|
||||
BeanUtil.copyProperties(publish, publishVo);
|
||||
publishVo.setUserName(SecurityUtils.getUsername());
|
||||
publishVo.setAvatar(SecurityUtils.getLoginUser().getUser().getAvatar());
|
||||
return publishVo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.constant.HttpStatus;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.communityCenter.constant.StatusConstant;
|
||||
import com.mcwl.communityCenter.domain.CommunityAdvice;
|
||||
import com.mcwl.communityCenter.domain.Invite;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionPageRes;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionReplyDto;
|
||||
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||
import com.mcwl.communityCenter.mapper.CommunityAdviceMapper;
|
||||
import com.mcwl.communityCenter.mapper.PublishMapper;
|
||||
import com.mcwl.communityCenter.mapper.QuestionMapper;
|
||||
import com.mcwl.communityCenter.service.InviteService;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import com.mcwl.communityCenter.service.QuestionService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements QuestionService {
|
||||
|
||||
|
||||
private final CommunityAdviceMapper communityAdviceMapper;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 添加问题
|
||||
*
|
||||
* @param questionRes 问题信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addQuestion(QuestionRes questionRes) {
|
||||
|
||||
Long questionUserId = questionRes.getQuestionUserId();
|
||||
Long communityId = questionRes.getCommunityId();
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (Objects.equals(questionUserId, userId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取租户id
|
||||
Long tenantId = questionRes.getTenantId();
|
||||
|
||||
// 答复人是否是群主
|
||||
boolean isInviteUser = !Objects.equals(tenantId, questionUserId);
|
||||
|
||||
if (isInviteUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
Question question = new Question();
|
||||
BeanUtil.copyProperties(questionRes, question);
|
||||
question.setStatus(StatusConstant.STATUS_UNREPLIED);
|
||||
baseMapper.insert(question);
|
||||
|
||||
|
||||
CommunityAdvice communityAdvice = new CommunityAdvice();
|
||||
communityAdvice.setTenantId(tenantId);
|
||||
communityAdvice.setCommunityId(communityId);
|
||||
communityAdvice.setUserId(questionUserId);
|
||||
communityAdvice.setTitle("您有新的问题");
|
||||
communityAdvice.setContent(questionRes.getContent());
|
||||
communityAdviceMapper.insert(communityAdvice);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo listUnReplied(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);
|
||||
|
||||
|
||||
LambdaQueryWrapper<Question> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(Question::getCommunityId, questionPageRes.getCommunityId())
|
||||
.eq(Question::getStatus, StatusConstant.STATUS_UNREPLIED);
|
||||
baseMapper.selectPage(page, lqw);
|
||||
|
||||
// 获取分页数据
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QuestionVo getDetail(Long id) {
|
||||
|
||||
Question question = baseMapper.selectById(id);
|
||||
if (Objects.isNull(question)) {
|
||||
return null;
|
||||
}
|
||||
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());
|
||||
|
||||
|
||||
return questionVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 回复问题
|
||||
*
|
||||
* @param questionReplyDto 回复信息
|
||||
*/
|
||||
@Override
|
||||
public void reply(QuestionReplyDto questionReplyDto) {
|
||||
|
||||
Long questionId = questionReplyDto.getQuestionId();
|
||||
LambdaQueryWrapper<Question> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(Question::getId, questionId)
|
||||
.eq(Question::getStatus, StatusConstant.STATUS_UNREPLIED);
|
||||
|
||||
// 查询问题信息
|
||||
Question question = baseMapper.selectOne(lqw);
|
||||
|
||||
if (Objects.isNull(question)) {
|
||||
return;
|
||||
}
|
||||
|
||||
question.setContent(questionReplyDto.getContent());
|
||||
question.setStatus(StatusConstant.STATUS_REPLIED);
|
||||
question.setReplyTime(new Date());
|
||||
|
||||
baseMapper.updateById(question);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.mcwl.communityCenter.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.communityCenter.domain.Question;
|
||||
import com.mcwl.communityCenter.domain.UserCommunity;
|
||||
import com.mcwl.communityCenter.mapper.QuestionMapper;
|
||||
import com.mcwl.communityCenter.mapper.UserCommunityMapper;
|
||||
import com.mcwl.communityCenter.service.QuestionService;
|
||||
import com.mcwl.communityCenter.service.UserCommunityService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserCommunityServiceImpl extends ServiceImpl<UserCommunityMapper, UserCommunity> implements UserCommunityService {
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- SpringBoot 拦截器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -58,6 +59,12 @@
|
|||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-communityCenter</artifactId>
|
||||
<version>3.8.8</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue