Merge remote-tracking branch 'origin/preview' into preview
# Conflicts: # mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.javafeature/comment
commit
64de27cc8c
|
@ -24,6 +24,17 @@
|
|||
<version>0.4.7</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.alipay.sdk/alipay-sdk-java -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-sdk-java</artifactId>
|
||||
<version>4.40.30.ALL</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alipay.sdk</groupId>
|
||||
<artifactId>alipay-easysdk</artifactId>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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;
|
||||
|
@ -8,6 +9,7 @@ import org.springframework.boot.SpringApplication;
|
|||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
//package com.mcwl.web.controller.comment;
|
||||
//
|
||||
//
|
||||
//import com.mcwl.comment.domain.ProductCommentConditionEntity;
|
||||
//import com.mcwl.comment.domain.ProductCommentEntity;
|
||||
//import com.mcwl.comment.service.impl.CommentServiceImpl;
|
||||
//import com.mcwl.common.utils.ResponsePageEntity;
|
||||
//import com.mcwl.resource.domain.MallProduct;
|
||||
//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.comment
|
||||
// * @Filename:CommentController
|
||||
// * @Description TODO
|
||||
// * @Date:2025/1/4 18:56
|
||||
// */
|
||||
//@RestController
|
||||
//@RequestMapping("/comment")
|
||||
//public class CommentController {
|
||||
//
|
||||
// @Autowired
|
||||
// private CommentServiceImpl commentService;
|
||||
//
|
||||
// /**
|
||||
// * 通过id查询商品评论信息
|
||||
// *
|
||||
// * @param id 系统ID
|
||||
// * @return 商品评论信息
|
||||
// */
|
||||
// @GetMapping("/findById")
|
||||
// public MallProduct findById(Long id) {
|
||||
// return commentService.findById(id);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 添加商品评论
|
||||
// *
|
||||
// * @param productCommentEntity 商品评论实体
|
||||
// * @return 影响行数
|
||||
// */
|
||||
// @PostMapping("/insert")
|
||||
// public int insert(@RequestBody ProductCommentEntity productCommentEntity) {
|
||||
// return commentService.insert(productCommentEntity);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 修改商品评论
|
||||
// *
|
||||
// * @param productCommentEntity 商品评论实体
|
||||
// * @return 影响行数
|
||||
// */
|
||||
// @PostMapping("/update")
|
||||
// public int update(@RequestBody ProductCommentEntity productCommentEntity) {
|
||||
// return commentService.update(productCommentEntity);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 批量删除商品评论
|
||||
// *
|
||||
// * @param ids 商品评论ID集合
|
||||
// * @return 影响行数
|
||||
// */
|
||||
// @PostMapping("/deleteByIds")
|
||||
// public int deleteByIds(@RequestBody @NotNull List<Long> ids) {
|
||||
// return commentService.deleteByIds(ids);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -111,7 +111,7 @@ public class MemberController {
|
|||
return AjaxResult.warn("用户不存在");
|
||||
}
|
||||
|
||||
Member member = memberService.rechargePoints(userId, amount * 10);
|
||||
Member member = memberService.rechargePoints(userId, amount * 100);
|
||||
|
||||
// 返回充值积分
|
||||
if (!Optional.ofNullable(member).isPresent()) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -118,9 +118,9 @@ public class OrderTradeController extends BaseController {
|
|||
|
||||
String type = orderTradeDto.getType();
|
||||
|
||||
if ("member".equals(type)) {
|
||||
if ("member".equalsIgnoreCase(type)) {
|
||||
qrUrl = aliPayIntegration.memberPay(orderTradeDto);
|
||||
} else if ("points".equals(type)) {
|
||||
} else if ("points".equalsIgnoreCase(type)) {
|
||||
qrUrl = aliPayIntegration.pointsPay(orderTradeDto.getPaymentAmount());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.mcwl.web.controller.pay.WxPay;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.mcwl.web.controller.pay.WxPay.util.PayUtil;
|
||||
import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
*
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/6
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/wx/pay")
|
||||
public class WxPayController {
|
||||
|
||||
/**
|
||||
* 预支付下单
|
||||
*
|
||||
* @param orderSn 订单号
|
||||
* @param total 分
|
||||
* @param description 描述
|
||||
*/
|
||||
@GetMapping(value = "/getPay")
|
||||
public String getPay(String orderSn, int total, String description) {
|
||||
PayUtil payUtil = new PayUtil();
|
||||
try {
|
||||
return payUtil.requestwxChatPay(orderSn, total, description, "oYgFI91D00GpCwccdnKDR4KNxI4k");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 支付回调
|
||||
@PostMapping(value = "/returnNotify")
|
||||
public Map returnNotify(@RequestBody JSONObject jsonObject) {
|
||||
// v3 私钥
|
||||
String key = "xxxxx";
|
||||
String json = jsonObject.toString();
|
||||
String associated_data = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.associated_data");
|
||||
String ciphertext = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.ciphertext");
|
||||
String nonce = (String) JSONUtil.getByPath(JSONUtil.parse(json), "resource.nonce");
|
||||
try {
|
||||
String decryptData = new AesUtil(key.getBytes(StandardCharsets.UTF_8)).decryptToString(associated_data.getBytes(StandardCharsets.UTF_8), nonce.getBytes(StandardCharsets.UTF_8), ciphertext);
|
||||
System.out.println("decryptData = " + decryptData);
|
||||
//TODO 业务校验
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
HashMap<String, String> stringStringHashMap = new HashMap<>();
|
||||
stringStringHashMap.put("code", "200");
|
||||
stringStringHashMap.put("message", "返回成功");
|
||||
// 返回这个说明应答成功
|
||||
return stringStringHashMap;
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
* @apiNote
|
||||
*/
|
||||
|
||||
@RequestMapping("like")
|
||||
@RequestMapping("/like")
|
||||
@RestController
|
||||
public class MallProductLikeController {
|
||||
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.oss.OssUtil;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||
import com.mcwl.resource.domain.ModelImageLike;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
import com.mcwl.resource.service.ModelImageLikeService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/modelImage")
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageController {
|
||||
|
||||
private final ModelImageService modelImageService;
|
||||
|
||||
private final ModelImageLikeService modelImageLikeService;
|
||||
|
||||
private final ModelImageCommentLikeService modelImageCommentLikeService;
|
||||
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
*/
|
||||
@GetMapping("/upload")
|
||||
public AjaxResult upload(MultipartFile file) {
|
||||
|
||||
return AjaxResult.success("上传成功", OssUtil.uploadMultipartFile(file));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片发布
|
||||
*/
|
||||
@PostMapping("/publish")
|
||||
public AjaxResult publish(@RequestBody ModelImageRes modelImageRes) {
|
||||
modelImageService.publish(modelImageRes);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片点赞/取消
|
||||
*/
|
||||
@GetMapping("/imageLike/{imageId}")
|
||||
public AjaxResult like(@PathVariable Long imageId) {
|
||||
modelImageLikeService.like(imageId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 图片评论发布
|
||||
*/
|
||||
@PostMapping("/comment")
|
||||
public AjaxResult comment(@RequestBody ModelImageCommentRes modelImageCommentRes) {
|
||||
modelImageService.comment(modelImageCommentRes);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片评论点赞/取消
|
||||
*/
|
||||
@GetMapping("/commentLike/{commentId}")
|
||||
public AjaxResult commentLike(@PathVariable Long commentId) {
|
||||
modelImageCommentLikeService.like(commentId);
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
package com.mcwl.web.controller.resource;
|
||||
|
||||
import com.mcwl.common.core.controller.BaseController;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.web.controller.common.OssUtil;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
* 工作流
|
||||
* @Author:ChenYan
|
||||
* @Project:McWl
|
||||
* @Package:com.mcwl.web.controller.resource
|
||||
* @Filename:MallProductController
|
||||
* @Description 商品
|
||||
* @Date:2024/12/31 10:48
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/WorkFlow")
|
||||
public class WorkFlowController extends BaseController {
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 图片
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/file")
|
||||
public AjaxResult Malifile(@RequestParam MultipartFile file){
|
||||
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
return AjaxResult.success(s);
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* zip
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/zipUrlFile")
|
||||
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
return AjaxResult.success(s);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* 下载zip
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/zipUrl")
|
||||
public AjaxResult zipUrl(@RequestParam MultipartFile file){
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
return AjaxResult.success(s);
|
||||
}
|
||||
|
||||
|
||||
// @PostMapping("/add")
|
||||
// public AjaxResult
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.mcwl.web.controller.system;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.system.domain.vo.AdviceVo;
|
||||
import com.mcwl.system.service.ISysAdviceService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("system/advice")
|
||||
@RequiredArgsConstructor
|
||||
public class SysAdviceController {
|
||||
|
||||
private final ISysAdviceService sysAdviceService;
|
||||
|
||||
/**
|
||||
* 根据当前用户获取新消息提醒
|
||||
*/
|
||||
@GetMapping("getUserNewMsg")
|
||||
public AjaxResult getUserNewMsg() {
|
||||
List<AdviceVo> adviceVo = sysAdviceService.getUserNewMsg();
|
||||
return AjaxResult.success(adviceVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前用户获取系统公告
|
||||
*/
|
||||
@GetMapping("getUserSystemNotice")
|
||||
public AjaxResult getUserSystemNotice() {
|
||||
List<AdviceVo> adviceVo = sysAdviceService.getUserSystemNotice();
|
||||
return AjaxResult.success(adviceVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据当前用户获取所有消息
|
||||
*/
|
||||
@GetMapping("getUserAllMsg")
|
||||
public AjaxResult getUserAllMsg() {
|
||||
List<AdviceVo> adviceVo = sysAdviceService.getUserAllMsg();
|
||||
return AjaxResult.success(adviceVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有消息
|
||||
*/
|
||||
@GetMapping("getAllMsg")
|
||||
public AjaxResult getAllMsg() {
|
||||
List<AdviceVo> adviceVo = sysAdviceService.getAllMsg();
|
||||
return AjaxResult.success(adviceVo);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -269,4 +269,16 @@ public class SysUserController extends BaseController
|
|||
userService.updateUserInfo(sysUser);
|
||||
return AjaxResult.success("修改成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 实名认证
|
||||
* @param sysUser
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateIdCard")
|
||||
public AjaxResult updateIdCard(@RequestBody SysUser sysUser){
|
||||
|
||||
return userService.updateIdCard(sysUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,12 +14,13 @@ import com.mcwl.system.domain.SysUserThirdAccount;
|
|||
import com.mcwl.system.service.ISysUserService;
|
||||
import com.mcwl.system.service.ISysUserThirdAccountService;
|
||||
import com.mcwl.system.service.IWXService;
|
||||
import com.mcwl.web.controller.common.OssUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
@ -59,13 +60,6 @@ public class WXController {
|
|||
@Resource
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Anonymous
|
||||
@PostMapping("/test")
|
||||
public AjaxResult test(@RequestParam MultipartFile file){
|
||||
|
||||
String s = OssUtil.uploadMultipartFile(file);
|
||||
return AjaxResult.success(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码登录用uuid生成
|
||||
|
|
|
@ -183,5 +183,5 @@ mall:
|
|||
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://702bc39c.r27.cpolar.top/web/pay/notify
|
||||
notifyUrl: https://253d7236.r27.cpolar.top/web/pay/notify
|
||||
gatewayUrl: https://openapi-sandbox.dl.alipaydev.com/gateway.do
|
||||
|
|
|
@ -341,7 +341,26 @@
|
|||
<version>3.5.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.alibaba</groupId>-->
|
||||
<!-- <artifactId>fastjson</artifactId>-->
|
||||
<!-- <version>1.2.15</version>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -47,5 +47,10 @@ public class CacheConstants
|
|||
*/
|
||||
public static final String WX_OPENID_KEY = "wx_openid:";
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
public static final String WE_CHAT = "we_chat";
|
||||
|
||||
public static final String ID_CARD_COUNT = "id_card_count:";
|
||||
}
|
||||
|
|
|
@ -58,9 +58,6 @@ public class SysUser extends BaseEntity
|
|||
/** 密码 */
|
||||
private String password;
|
||||
|
||||
/** 钱包 */
|
||||
private Long wallet;
|
||||
|
||||
/** 帐号状态(0正常 1停用) */
|
||||
@Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
@ -98,6 +95,16 @@ public class SysUser extends BaseEntity
|
|||
/** 简介 */
|
||||
private String brief;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String idCard;
|
||||
|
||||
/**
|
||||
* 邀请人id
|
||||
*/
|
||||
|
@ -108,6 +115,7 @@ public class SysUser extends BaseEntity
|
|||
*/
|
||||
private Double freePoints;
|
||||
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
||||
|
@ -241,6 +249,22 @@ public class SysUser extends BaseEntity
|
|||
return delFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getIdCard() {
|
||||
return idCard;
|
||||
}
|
||||
|
||||
public void setIdCard(String idCard) {
|
||||
this.idCard = idCard;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
|
@ -324,7 +348,6 @@ public class SysUser extends BaseEntity
|
|||
this.brief = brief;
|
||||
}
|
||||
|
||||
|
||||
public Long getInviterUserId() {
|
||||
return inviterUserId;
|
||||
}
|
||||
|
@ -363,6 +386,10 @@ public class SysUser extends BaseEntity
|
|||
", postIds=" + Arrays.toString(postIds) +
|
||||
", roleId=" + roleId +
|
||||
", brief='" + brief + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", idCard='" + idCard + '\'' +
|
||||
", inviterUserId=" + inviterUserId +
|
||||
", freePoints=" + freePoints +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,328 @@
|
|||
package com.mcwl.common.utils;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpDelete;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpPut;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.conn.scheme.Scheme;
|
||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||
import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 校验实名认证信息
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/8
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public class HttpUtils {
|
||||
|
||||
/**
|
||||
* get
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doGet(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpGet request = new HttpGet(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* post form
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @param bodys
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doPost(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
Map<String, String> bodys)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
if (bodys != null) {
|
||||
List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
|
||||
|
||||
for (String key : bodys.keySet()) {
|
||||
nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
|
||||
}
|
||||
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
|
||||
formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
|
||||
request.setEntity(formEntity);
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post String
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @param body
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doPost(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
String body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(body)) {
|
||||
request.setEntity(new StringEntity(body, "utf-8"));
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post stream
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @param body
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doPost(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
byte[] body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPost request = new HttpPost(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
if (body != null) {
|
||||
request.setEntity(new ByteArrayEntity(body));
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put String
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @param body
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doPut(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
String body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(body)) {
|
||||
request.setEntity(new StringEntity(body, "utf-8"));
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put stream
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @param body
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doPut(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys,
|
||||
byte[] body)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpPut request = new HttpPut(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
if (body != null) {
|
||||
request.setEntity(new ByteArrayEntity(body));
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete
|
||||
*
|
||||
* @param host
|
||||
* @param path
|
||||
* @param method
|
||||
* @param headers
|
||||
* @param querys
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static HttpResponse doDelete(String host, String path, String method,
|
||||
Map<String, String> headers,
|
||||
Map<String, String> querys)
|
||||
throws Exception {
|
||||
HttpClient httpClient = wrapClient(host);
|
||||
|
||||
HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
|
||||
for (Map.Entry<String, String> e : headers.entrySet()) {
|
||||
request.addHeader(e.getKey(), e.getValue());
|
||||
}
|
||||
|
||||
return httpClient.execute(request);
|
||||
}
|
||||
|
||||
private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
|
||||
StringBuilder sbUrl = new StringBuilder();
|
||||
sbUrl.append(host);
|
||||
if (!StringUtils.isBlank(path)) {
|
||||
sbUrl.append(path);
|
||||
}
|
||||
if (null != querys) {
|
||||
StringBuilder sbQuery = new StringBuilder();
|
||||
for (Map.Entry<String, String> query : querys.entrySet()) {
|
||||
if (0 < sbQuery.length()) {
|
||||
sbQuery.append("&");
|
||||
}
|
||||
if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
|
||||
sbQuery.append(query.getValue());
|
||||
}
|
||||
if (!StringUtils.isBlank(query.getKey())) {
|
||||
sbQuery.append(query.getKey());
|
||||
if (!StringUtils.isBlank(query.getValue())) {
|
||||
sbQuery.append("=");
|
||||
sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 < sbQuery.length()) {
|
||||
sbUrl.append("?").append(sbQuery);
|
||||
}
|
||||
}
|
||||
|
||||
return sbUrl.toString();
|
||||
}
|
||||
|
||||
private static HttpClient wrapClient(String host) {
|
||||
HttpClient httpClient = new DefaultHttpClient();
|
||||
if (host.startsWith("https://")) {
|
||||
sslClient(httpClient);
|
||||
}
|
||||
|
||||
return httpClient;
|
||||
}
|
||||
|
||||
private static void sslClient(HttpClient httpClient) {
|
||||
try {
|
||||
SSLContext ctx = SSLContext.getInstance("TLS");
|
||||
X509TrustManager tm = new X509TrustManager() {
|
||||
|
||||
@Override
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] xcs, String str) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] xcs, String str) {
|
||||
|
||||
}
|
||||
};
|
||||
ctx.init(null, new TrustManager[]{tm}, null);
|
||||
SSLSocketFactory ssf = new SSLSocketFactory(ctx);
|
||||
ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
|
||||
ClientConnectionManager ccm = httpClient.getConnectionManager();
|
||||
SchemeRegistry registry = ccm.getSchemeRegistry();
|
||||
registry.register(new Scheme("https", 443, ssf));
|
||||
} catch (KeyManagementException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
} catch (NoSuchAlgorithmException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.mcwl.common.utils;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 身份证校验
|
||||
*
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/8
|
||||
* @apiNote
|
||||
*/
|
||||
public class VerifyCard {
|
||||
|
||||
public static String idCard(String name, String card) {
|
||||
String host = "https://kzidcardv1.market.alicloudapi.com";
|
||||
String path = "/api-mall/api/id_card/check";
|
||||
String method = "POST";
|
||||
String appcode = "680661d47eb740bcb85472cec9774ecf";
|
||||
Map<String, String> headers = new HashMap<String, String>();
|
||||
//最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
|
||||
headers.put("Authorization", "APPCODE " + appcode);
|
||||
//根据API的要求,定义相对应的Content-Type
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
|
||||
Map<String, String> querys = new HashMap<String, String>();
|
||||
Map<String, String> bodys = new HashMap<String, String>();
|
||||
bodys.put("name", name);
|
||||
bodys.put("idcard", card);
|
||||
|
||||
|
||||
try {
|
||||
/**
|
||||
* 重要提示如下:
|
||||
* HttpUtils请从
|
||||
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java
|
||||
* 下载
|
||||
*
|
||||
* 相应的依赖请参照
|
||||
* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
|
||||
*/
|
||||
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
|
||||
System.out.println(response.toString());
|
||||
//获取response的body
|
||||
//System.out.println(EntityUtils.toString(response.getEntity()));
|
||||
return EntityUtils.toString(response.getEntity());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,14 @@
|
|||
package com.mcwl.memberCenter.consumer;
|
||||
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.memberCenter.domain.Member;
|
||||
import com.mcwl.memberCenter.service.MemberService;
|
||||
import com.mcwl.system.domain.SysAdvice;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.service.ISysAdviceService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -11,6 +17,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 积分消费者
|
||||
|
@ -20,16 +27,27 @@ import java.io.IOException;
|
|||
@RequiredArgsConstructor
|
||||
public class EmptyPointsRemindConsumer {
|
||||
|
||||
private final MemberService memberService;
|
||||
private final ISysAdviceService sysAdviceService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 积分清零提醒
|
||||
*/
|
||||
@RabbitListener(queues = QueueConstants.EMPTY_POINTS_REMIND_QUEUE, ackMode = "MANUAL")
|
||||
public void emptyPointsRemind(Member Member, Channel channel, Message message) {
|
||||
public void emptyPointsRemind(Member member, Channel channel, Message message) {
|
||||
try {
|
||||
// TODO 发送短信提醒用户积分即将清零
|
||||
log.info("获取到积分清零提醒的数据:{}", Member);
|
||||
SysUser sysUser = sysUserService.selectUserByUserName("admin");
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(sysUser.getUserId());
|
||||
sysAdvice.setReceiverId(member.getUserId());
|
||||
sysAdvice.setType(AdviceEnum.NEW_MESSAGE_REMIND);
|
||||
sysAdvice.setTitle("积分清零提醒");
|
||||
sysAdvice.setContent("您的积分即将清零,请及时消费");
|
||||
sysAdvice.setCreateBy(sysUser.getUserName());
|
||||
sysAdvice.setUpdateBy(sysUser.getUserName());
|
||||
sysAdvice.setUpdateTime(new Date());
|
||||
sysAdviceService.save(sysAdvice);
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
log.error("处理积分清零提醒消息时出错: {}", e.getMessage(), e);
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package com.mcwl.memberCenter.consumer;
|
||||
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.memberCenter.domain.Member;
|
||||
import com.mcwl.system.domain.SysAdvice;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.service.ISysAdviceService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -19,6 +24,9 @@ import java.io.IOException;
|
|||
@RequiredArgsConstructor
|
||||
public class MemberBillingConsumer {
|
||||
|
||||
private final ISysAdviceService sysAdviceService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 会员账单
|
||||
|
@ -27,7 +35,14 @@ public class MemberBillingConsumer {
|
|||
public void memberBillingQueue(Member member, Channel channel, Message message) {
|
||||
try {
|
||||
// TODO 发送短信提醒用户会员账单,如果支付成功,更新last_payment_date,并重新计算end_date(start_date + 1个月)
|
||||
log.info("获取到会员账单的数据:{}", member);
|
||||
SysUser sysUser = sysUserService.selectUserByUserName("admin");
|
||||
SysAdvice sysAdvice = new SysAdvice();
|
||||
sysAdvice.setSenderId(sysUser.getUserId());
|
||||
sysAdvice.setReceiverId(member.getUserId());
|
||||
sysAdvice.setType(AdviceEnum.NEW_MESSAGE_REMIND);
|
||||
sysAdvice.setTitle("会员账单");
|
||||
sysAdvice.setContent("您的会员即将到期,请及时支付");
|
||||
sysAdviceService.save(sysAdvice);
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
log.error("处理会员账单消息时出错: {}", e.getMessage(), e);
|
||||
|
|
|
@ -7,20 +7,14 @@ import com.mcwl.common.core.domain.AjaxResult;
|
|||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.memberCenter.domain.MemberBenefit;
|
||||
import com.mcwl.memberCenter.domain.MemberLevel;
|
||||
import com.mcwl.memberCenter.domain.Member;
|
||||
import com.mcwl.memberCenter.domain.Promotion;
|
||||
import com.mcwl.memberCenter.domain.*;
|
||||
import com.mcwl.memberCenter.enums.MemberBenefitTypeEnum;
|
||||
import com.mcwl.memberCenter.enums.MemberEnum;
|
||||
import com.mcwl.memberCenter.enums.MemberPeriodicEnum;
|
||||
import com.mcwl.memberCenter.enums.PromotionEnum;
|
||||
import com.mcwl.memberCenter.mapper.MemberMapper;
|
||||
import com.mcwl.memberCenter.mapper.PromotionMapper;
|
||||
import com.mcwl.memberCenter.service.MemberBenefitService;
|
||||
import com.mcwl.memberCenter.service.MemberLevelService;
|
||||
import com.mcwl.memberCenter.service.MemberService;
|
||||
import com.mcwl.memberCenter.service.PromotionService;
|
||||
import com.mcwl.memberCenter.service.*;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -41,6 +35,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||
|
||||
private final PromotionMapper promotionMapper;
|
||||
|
||||
private final MemberConsumeService memberConsumeService;
|
||||
|
||||
@Override
|
||||
public Member createUserMember(Long userId, Long memberLevelId, String paymentMethod, Long promotionId) {
|
||||
if (userId == null) {
|
||||
|
@ -195,16 +191,19 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||
throw new ServiceException("积分不足");
|
||||
}
|
||||
|
||||
// 保存消费记录
|
||||
saveMemberConsume(consumePoints, userId, points);
|
||||
|
||||
// 先扣除会员的积分
|
||||
if (member != null) {
|
||||
double mp = member.getPoints() - consumePoints;
|
||||
if (mp >= 0) {
|
||||
member.setPoints(mp);
|
||||
consumePoints = 0.0;
|
||||
} else {
|
||||
member.setPoints(0D);
|
||||
consumePoints = consumePoints - memberPoints;
|
||||
}
|
||||
member.setPoints(mp);
|
||||
baseMapper.updateById(member);
|
||||
}
|
||||
// consumePoints有剩余再扣除用户的积分
|
||||
|
@ -215,6 +214,18 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||
|
||||
}
|
||||
|
||||
private void saveMemberConsume(Double consumePoints, Long userId, double points) {
|
||||
MemberConsume memberConsume = new MemberConsume();
|
||||
memberConsume.setUserId(userId);
|
||||
memberConsume.setConsumePoints(consumePoints);
|
||||
memberConsume.setRemainingPoints(points - consumePoints);
|
||||
memberConsume.setConsumeTime(new Date());
|
||||
memberConsume.setCreateBy(SecurityUtils.getUsername());
|
||||
memberConsume.setUpdateBy(SecurityUtils.getUsername());
|
||||
memberConsume.setUpdateTime(new Date());
|
||||
memberConsumeService.save(memberConsume);
|
||||
}
|
||||
|
||||
private List<Member> getUseUserMember(Long userId) {
|
||||
// startDate 小于等于当前时间、endDate 大于等于当前时间
|
||||
// subscriptionStatus 不为 "过期" 或 "待支付"
|
||||
|
|
|
@ -2,13 +2,17 @@ package com.mcwl.memberCenter.task;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.constant.QueueConstants;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.memberCenter.domain.Member;
|
||||
import com.mcwl.memberCenter.enums.MemberEnum;
|
||||
import com.mcwl.memberCenter.service.MemberService;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -19,6 +23,8 @@ public class UserMemberTask {
|
|||
|
||||
private final MemberService memberService;
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
private final RabbitTemplate rabbitTemplate;
|
||||
|
||||
|
||||
|
@ -41,14 +47,23 @@ public class UserMemberTask {
|
|||
/**
|
||||
* 清空积分 每月月底前两天
|
||||
*/
|
||||
@Transactional
|
||||
public void emptyPointsTsk() {
|
||||
List<Member> memberList = memberService.getUseUserMember();
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
List<SysUser> sysUserList = new ArrayList<>();
|
||||
if (memberList == null || memberList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (Member member : memberList) {
|
||||
member.setPoints(0.0);
|
||||
member.setUpdateTime(new Date());
|
||||
userIdList.add(member.getUserId());
|
||||
}
|
||||
sysUserList = sysUserService.listByIds(userIdList);
|
||||
for (SysUser sysUser : sysUserList) {
|
||||
sysUser.setFreePoints(0.0);
|
||||
sysUserService.updateUser(sysUser);
|
||||
}
|
||||
memberService.updateBatchById(memberList);
|
||||
}
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mcwl</groupId>
|
||||
<artifactId>mcwl-resource</artifactId>
|
||||
<version>3.8.8</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.mcwl.pay.config;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@Configuration
|
||||
@Component
|
||||
public class AliConfig {
|
||||
@Value("${mall.mgt.aliPayConfig.appId}")
|
||||
private String appId;
|
||||
@Value("${mall.mgt.aliPayConfig.privateKey}")
|
||||
private String privateKey;
|
||||
@Value("${mall.mgt.aliPayConfig.publicKey}")
|
||||
private String publicKey;
|
||||
@Value("${mall.mgt.aliPayConfig.gatewayUrl}")
|
||||
private String gatewayUrl;
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.mcwl.pay.domain.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum OrderTypeEnum {
|
||||
|
||||
POINTS("points"),
|
||||
MEMBER("member");
|
||||
|
||||
private final String name;
|
||||
|
||||
}
|
|
@ -5,17 +5,27 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import com.mcwl.common.core.redis.RedisCache;
|
||||
import com.mcwl.common.domain.IdsParam;
|
||||
import com.mcwl.common.utils.DateUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.memberCenter.domain.RechargeRecord;
|
||||
import com.mcwl.memberCenter.service.MemberService;
|
||||
import com.mcwl.memberCenter.service.RechargeRecordService;
|
||||
import com.mcwl.myInvitation.domain.Commission;
|
||||
import com.mcwl.myInvitation.domain.Consume;
|
||||
import com.mcwl.myInvitation.service.CommissionService;
|
||||
import com.mcwl.myInvitation.service.ConsumeService;
|
||||
import com.mcwl.pay.domain.OrderTrade;
|
||||
import com.mcwl.pay.domain.PaymentResult;
|
||||
import com.mcwl.pay.domain.enums.PaymentStatus;
|
||||
import com.mcwl.pay.mapper.OrderTradeMapper;
|
||||
import com.mcwl.pay.service.OrderTradeService;
|
||||
import com.mcwl.resource.domain.enums.OrderTypeEnum;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import com.mcwl.system.service.impl.SysUserServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author:ChenYan
|
||||
|
@ -36,12 +46,6 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
@Autowired
|
||||
private OrderTradeService orderTradeService;
|
||||
|
||||
@Autowired
|
||||
private OrderTradeMapper orderTradeMapper;
|
||||
|
||||
@Autowired
|
||||
private OrderTradeService orderTradeService;
|
||||
|
||||
@Autowired
|
||||
private CommissionService commissionService;
|
||||
|
||||
|
@ -141,11 +145,15 @@ public class OrderTradeServiceImpl extends ServiceImpl<OrderTradeMapper, OrderTr
|
|||
user.setFreePoints(user.getFreePoints() + points);
|
||||
sysUserService.updateUser(user);
|
||||
|
||||
// 添加充值记录
|
||||
RechargeRecord rechargeRecord = new RechargeRecord();
|
||||
rechargeRecord.setUserId(userId);
|
||||
rechargeRecord.setCode(orderTrade.getCode());
|
||||
rechargeRecord.setAmount(Double.parseDouble(amount));
|
||||
rechargeRecord.setPoints(points);
|
||||
rechargeRecord.setCreateBy(user.getUserName());
|
||||
rechargeRecord.setUpdateBy(user.getUserName());
|
||||
rechargeRecord.setUpdateTime(new Date());
|
||||
rechargeRecordService.save(rechargeRecord);
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**图片表
|
||||
|
@ -16,47 +19,66 @@ import lombok.NoArgsConstructor;
|
|||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("model_image")
|
||||
public class ModelImage {
|
||||
public class ModelImage extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 图片地址(最多8张,切割)
|
||||
*/
|
||||
private Long image_paths;
|
||||
private String imagePaths;
|
||||
/**
|
||||
* 是否添加水印
|
||||
*/
|
||||
private Long has_watermark;
|
||||
private Integer hasWatermark;
|
||||
/**
|
||||
* 是否会员下载
|
||||
*/
|
||||
private Long is_member_download;
|
||||
private Integer isMemberDownload;
|
||||
/**
|
||||
* 是否不可下载
|
||||
*/
|
||||
private Long is_not_downloadable;
|
||||
private Integer isNotDownloadable;
|
||||
/**
|
||||
* 是否隐藏生成信息
|
||||
*/
|
||||
private Long hide_gen_info;
|
||||
private Integer hideGenInfo;
|
||||
/**
|
||||
* 图片标题(最多30字)
|
||||
*/
|
||||
private Long title;
|
||||
private String title;
|
||||
/**
|
||||
* 图片标签(多个,切割)
|
||||
*/
|
||||
private Long tags;
|
||||
private String tags;
|
||||
/**
|
||||
* 描述信息(最多500)
|
||||
*/
|
||||
private Long description;
|
||||
private String description;
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
* 在线生成数
|
||||
*/
|
||||
private Long del_flag;
|
||||
private Integer onlineGenNum;
|
||||
/**
|
||||
* 下载数
|
||||
*/
|
||||
private Integer downloadNum;
|
||||
/**
|
||||
* 返图数
|
||||
*/
|
||||
private Integer returnNum;
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 图片评论
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("model_image_comment")
|
||||
public class ModelImageComment extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 图片id
|
||||
*/
|
||||
private Long modelImageId;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 父评论id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 点赞数
|
||||
*/
|
||||
private Integer likeNum;
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 图片评论点赞
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("model_image_comment_like")
|
||||
public class ModelImageCommentLike extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 图片评论id
|
||||
*/
|
||||
private Long modelImageCommentId;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.mcwl.resource.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 图片点赞表
|
||||
*/
|
||||
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ModelImageLike extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 图片id
|
||||
*/
|
||||
private Long modelImageId;
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.mcwl.resource.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Data
|
||||
public class ModelImageCommentRes {
|
||||
/**
|
||||
* 图片id
|
||||
*/
|
||||
@NotNull(message = "图片id不能为空")
|
||||
private Long modelImageId;
|
||||
|
||||
/**
|
||||
* 评论内容
|
||||
*/
|
||||
@NotBlank(message = "评论内容不能为空")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 父评论id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.mcwl.resource.domain.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
@Data
|
||||
public class ModelImageRes {
|
||||
/**
|
||||
* 图片地址(最多8张,切割)
|
||||
*/
|
||||
@NotBlank(message = "图片地址不能为空")
|
||||
private String imagePaths;
|
||||
/**
|
||||
* 是否添加水印
|
||||
*/
|
||||
private Integer hasWatermark;
|
||||
/**
|
||||
* 是否会员下载
|
||||
*/
|
||||
private Integer isMemberDownload;
|
||||
/**
|
||||
* 是否不可下载
|
||||
*/
|
||||
private Integer isNotDownloadable;
|
||||
/**
|
||||
* 是否隐藏生成信息
|
||||
*/
|
||||
private Integer hideGenInfo;
|
||||
/**
|
||||
* 图片标题(最多30字)
|
||||
*/
|
||||
@NotBlank(message = "图片标题不能为空")
|
||||
private String title;
|
||||
/**
|
||||
* 图片标签(多个,切割)
|
||||
*/
|
||||
private String tags;
|
||||
/**
|
||||
* 描述信息(最多500)
|
||||
*/
|
||||
private String description;
|
||||
|
||||
}
|
|
@ -9,7 +9,10 @@ package com.mcwl.resource.domain.enums;
|
|||
* @Date:2025/1/6 19:51
|
||||
*/
|
||||
public enum OrderTypeEnum {
|
||||
TIME("time"), NUM("num");
|
||||
TIME("time"),
|
||||
NUM("num"),
|
||||
POINTS("points"),
|
||||
MEMBER("member");
|
||||
|
||||
private final String name;
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ModelImageCommentLikeMapper extends BaseMapper<ModelImageCommentLike> {
|
||||
ModelImageCommentLike getLikeImageComment(Long userId, Long commentId);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ModelImageCommentMapper extends BaseMapper<ModelImageComment> {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageLike;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ModelImageLikeMapper extends BaseMapper<ModelImageLike> {
|
||||
ModelImageLike getLikeImage(Long userId, Long imageId);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ModelImageMapper extends BaseMapper<ModelImage> {
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.WorkFlow;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 工作流
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface WorkFlowMapper extends BaseMapper<WorkFlow> {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.mcwl.resource.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.resource.domain.WorkFlowVersion;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 工作流版本 业务实现层
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Mapper
|
||||
public interface WorkFlowVersionMapper extends BaseMapper<WorkFlowVersion> {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
|
||||
|
||||
public interface ModelImageCommentLikeService extends IService<ModelImageCommentLike> {
|
||||
void like(Long commentId);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
|
||||
|
||||
public interface ModelImageCommentService extends IService<ModelImageComment> {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageLike;
|
||||
|
||||
|
||||
public interface ModelImageLikeService extends IService<ModelImageLike> {
|
||||
|
||||
void like(Long imageId);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
|
||||
|
||||
public interface ModelImageService extends IService<ModelImage> {
|
||||
|
||||
/**
|
||||
* 发布
|
||||
* @param modelImageRes 发布对象
|
||||
*/
|
||||
void publish(ModelImageRes modelImageRes);
|
||||
|
||||
/**
|
||||
* 评论
|
||||
* @param modelImageCommentRes 评论对象
|
||||
*/
|
||||
void comment(ModelImageCommentRes modelImageCommentRes);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
/**
|
||||
* 工作流 业务层
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public interface WorkFlowService {
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.mcwl.resource.service;
|
||||
|
||||
/**
|
||||
* 工作流版本 业务层
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
public interface WorkFlowVersionService {
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.domain.ModelImageCommentLike;
|
||||
import com.mcwl.resource.domain.ModelImageLike;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||
import com.mcwl.resource.service.ModelImageCommentLikeService;
|
||||
import com.mcwl.resource.service.ModelImageCommentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {
|
||||
|
||||
private final ModelImageCommentMapper modelImageCommentMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void like(Long commentId) {
|
||||
ModelImageComment modelImageComment = modelImageCommentMapper.selectById(commentId);
|
||||
if (Objects.isNull(modelImageComment)) {
|
||||
throw new ServiceException("该评论不存在");
|
||||
}
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
ModelImageCommentLike modelImageCommentLike = baseMapper.getLikeImageComment(userId, commentId);
|
||||
if (Objects.nonNull(modelImageCommentLike)) {
|
||||
if (Objects.equals(modelImageCommentLike.getDelFlag(), "0")) {
|
||||
modelImageCommentLike.setDelFlag("1");
|
||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() - 1);
|
||||
} else {
|
||||
modelImageCommentLike.setDelFlag("0");
|
||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
||||
}
|
||||
// 更新点赞记录
|
||||
baseMapper.updateById(modelImageCommentLike);
|
||||
// 更新图片评论点赞数
|
||||
modelImageCommentMapper.updateById(modelImageComment);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
modelImageCommentLike = new ModelImageCommentLike();
|
||||
modelImageCommentLike.setUserId(userId);
|
||||
modelImageCommentLike.setModelImageCommentId(commentId);
|
||||
modelImageCommentLike.setCreateBy(SecurityUtils.getUsername());
|
||||
modelImageCommentLike.setUpdateBy(SecurityUtils.getUsername());
|
||||
modelImageCommentLike.setUpdateTime(new Date());
|
||||
baseMapper.insert(modelImageCommentLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
|
||||
modelImageCommentMapper.updateById(modelImageComment);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||
import com.mcwl.resource.service.ModelImageCommentService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ModelImageCommentServiceImpl extends ServiceImpl<ModelImageCommentMapper, ModelImageComment> implements ModelImageCommentService {
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageLike;
|
||||
import com.mcwl.resource.mapper.ModelImageLikeMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||
import com.mcwl.resource.service.ModelImageLikeService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageLikeServiceImpl extends ServiceImpl<ModelImageLikeMapper, ModelImageLike> implements ModelImageLikeService {
|
||||
|
||||
private final ModelImageMapper modelImageMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void like(Long imageId) {
|
||||
ModelImage modelImage = modelImageMapper.selectById(imageId);
|
||||
if (Objects.isNull(modelImage)) {
|
||||
throw new ServiceException("该图片不存在或已下架");
|
||||
}
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
ModelImageLike modelImageLike = baseMapper.getLikeImage(userId, imageId);
|
||||
if (Objects.nonNull(modelImageLike)) {
|
||||
if (Objects.equals(modelImageLike.getDelFlag(), "0")) {
|
||||
modelImageLike.setDelFlag("1");
|
||||
modelImage.setLikeNum(modelImage.getLikeNum() - 1);
|
||||
} else {
|
||||
modelImageLike.setDelFlag("0");
|
||||
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
||||
}
|
||||
// 更新点赞记录
|
||||
baseMapper.updateById(modelImageLike);
|
||||
// 更新图片点赞数
|
||||
modelImageMapper.updateById(modelImage);
|
||||
return;
|
||||
}
|
||||
|
||||
// 添加点赞记录
|
||||
modelImageLike = new ModelImageLike();
|
||||
modelImageLike.setUserId(userId);
|
||||
modelImageLike.setModelImageId(imageId);
|
||||
modelImageLike.setCreateBy(SecurityUtils.getUsername());
|
||||
modelImageLike.setUpdateBy(SecurityUtils.getUsername());
|
||||
modelImageLike.setUpdateTime(new Date());
|
||||
baseMapper.insert(modelImageLike);
|
||||
|
||||
// 更新图片点赞数
|
||||
modelImage.setLikeNum(modelImage.getLikeNum() + 1);
|
||||
modelImageMapper.updateById(modelImage);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.resource.domain.MallProductLike;
|
||||
import com.mcwl.resource.domain.ModelImage;
|
||||
import com.mcwl.resource.domain.ModelImageComment;
|
||||
import com.mcwl.resource.domain.ModelProduct;
|
||||
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
|
||||
import com.mcwl.resource.domain.dto.ModelImageRes;
|
||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||
import com.mcwl.resource.mapper.MallProductLikeMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageCommentMapper;
|
||||
import com.mcwl.resource.mapper.ModelImageMapper;
|
||||
import com.mcwl.resource.service.MallProductLikeService;
|
||||
import com.mcwl.resource.service.MallProductService;
|
||||
import com.mcwl.resource.service.ModelImageCommentService;
|
||||
import com.mcwl.resource.service.ModelImageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelImage> implements ModelImageService {
|
||||
|
||||
private final ModelImageCommentMapper modelImageCommentMapper;
|
||||
|
||||
private final ModelImageMapper modelImageMapper;
|
||||
|
||||
@Override
|
||||
public void comment(ModelImageCommentRes modelImageCommentRes) {
|
||||
Long parentId = modelImageCommentRes.getParentId();
|
||||
ModelImageComment mic = modelImageCommentMapper.selectById(parentId);
|
||||
|
||||
if (Objects.nonNull(parentId) && Objects.isNull(mic)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ModelImageComment modelImageComment = new ModelImageComment();
|
||||
BeanUtil.copyProperties(modelImageCommentRes, modelImageComment);
|
||||
modelImageComment.setUserId(SecurityUtils.getUserId());
|
||||
modelImageComment.setCreateBy(SecurityUtils.getUsername());
|
||||
modelImageComment.setUpdateBy(SecurityUtils.getUsername());
|
||||
modelImageComment.setUpdateTime(new Date());
|
||||
modelImageCommentMapper.insert(modelImageComment);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publish(ModelImageRes modelImageRes) {
|
||||
|
||||
ModelImage modelImage = new ModelImage();
|
||||
BeanUtil.copyProperties(modelImageRes, modelImage);
|
||||
modelImage.setCreateBy(SecurityUtils.getUsername());
|
||||
modelImage.setUpdateBy(SecurityUtils.getUsername());
|
||||
modelImage.setUpdateTime(new Date());
|
||||
modelImage.setStatus(3);
|
||||
modelImageMapper.insert(modelImage);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -71,9 +71,8 @@ public class SysUserAttentionServiceImpl implements SysUserAttentionService {
|
|||
public SysUserInfo selectUserInfo() {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
return SysUserInfo.builder().bean(sysUserAttentionMapper.selectBean(userId))
|
||||
.download(mallProductMapper.sumNumber(userId))
|
||||
// .download(mallProductMapper.sumNumber(userId))
|
||||
.likeCount(mallProductLikeMapper.countLike(userId))
|
||||
.attention(sysUserAttentionMapper.selectAttentionCount(userId)).build();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.mcwl.resource.service.WorkFlowService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 工作流 业务实现层
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class WorkFlowServiceImpl implements WorkFlowService {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.mcwl.resource.service.impl;
|
||||
|
||||
import com.mcwl.resource.service.WorkFlowService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 工作流版本 业务实现层
|
||||
* @author DaiZibo
|
||||
* @date 2025/1/9
|
||||
* @apiNote
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class WorkFlowVersionServiceImpl implements WorkFlowService {
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.ModelImageCommentLikeMapper">
|
||||
|
||||
<resultMap type="modelImageCommentLike" id="ModelImageCommentLikeResult">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="modelImageCommentId" column="model_image_comment_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectModelImageCommentLikeVo">
|
||||
select id,
|
||||
user_id,
|
||||
model_image_comment_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
del_flag,
|
||||
remark
|
||||
from model_image_comment_like
|
||||
</sql>
|
||||
|
||||
<select id="getLikeImageComment" resultMap="ModelImageCommentLikeResult">
|
||||
<include refid="selectModelImageCommentLikeVo"/>
|
||||
where user_id = #{userId}
|
||||
and model_image_comment_id = #{imageId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.resource.mapper.ModelImageLikeMapper">
|
||||
|
||||
<resultMap type="modelImageLike" id="ModelImageLikeResult">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="modelImageId" column="model_image_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectModelImageLikeVo">
|
||||
select id,
|
||||
user_id,
|
||||
model_image_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
del_flag,
|
||||
remark
|
||||
from model_image_like
|
||||
</sql>
|
||||
|
||||
<select id="getLikeImage" resultMap="ModelImageLikeResult">
|
||||
<include refid="selectModelImageLikeVo"/>
|
||||
where user_id = #{userId}
|
||||
and model_image_id = #{imageId}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,54 @@
|
|||
package com.mcwl.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 消息通知
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_advice")
|
||||
public class SysAdvice extends BaseEntity {
|
||||
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 发送者id
|
||||
*/
|
||||
private Long senderId;
|
||||
|
||||
/**
|
||||
* 接收者id
|
||||
*/
|
||||
private Long receiverId;
|
||||
|
||||
/**
|
||||
* 消息类型 表示新消息提醒,系统公告等
|
||||
*/
|
||||
private AdviceEnum type;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 是否已读 0 是 1 否
|
||||
*/
|
||||
private String isRead;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.mcwl.system.domain.enums;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 通知枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AdviceEnum {
|
||||
|
||||
/**
|
||||
* 新消息提醒
|
||||
*/
|
||||
NEW_MESSAGE_REMIND("newMessageRemind", "新消息提醒"),
|
||||
|
||||
/**
|
||||
* 系统公告
|
||||
*/
|
||||
SYSTEM_NOTICE("systemNotice", "系统公告"),
|
||||
|
||||
/**
|
||||
* 邮件提醒
|
||||
*/
|
||||
EMAIL_REMIND("emailRemind", "邮件提醒"),
|
||||
|
||||
/**
|
||||
* 短信提醒
|
||||
*/
|
||||
SMS_REMIND("smsRemind", "短信提醒"),
|
||||
|
||||
/**
|
||||
* 推送提醒
|
||||
*/
|
||||
PUSH_REMIND("pushRemind", "推送提醒"),
|
||||
|
||||
/**
|
||||
* 点赞提醒
|
||||
*/
|
||||
LIKE_REMIND("likeRemind", "点赞提醒"),
|
||||
/**
|
||||
* 评论提醒
|
||||
*/
|
||||
COMMENT_REMIND("commentRemind", "评论提醒"),
|
||||
/**
|
||||
* 私信提醒
|
||||
*/
|
||||
PRIVATE_MESSAGE_REMIND("privateMessageRemind", "私信提醒");
|
||||
|
||||
private final String name;
|
||||
|
||||
@EnumValue
|
||||
private final String value;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.mcwl.system.domain.vo;
|
||||
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AdviceVo {
|
||||
|
||||
/**
|
||||
* 消息类型 表示新消息提醒,系统公告等
|
||||
*/
|
||||
private AdviceEnum type;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 是否已读 0 是 1 否
|
||||
*/
|
||||
private String isRead;
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.mcwl.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mcwl.system.domain.SysAdvice;
|
||||
import com.mcwl.system.domain.SysConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息通知
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysAdviceMapper extends BaseMapper<SysAdvice> {
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.mcwl.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -133,5 +132,10 @@ public interface SysUserMapper
|
|||
|
||||
SysUser selectUserInfoById(@Param("userId") Long userId);
|
||||
|
||||
void updateIdCard(SysUser sysUser);
|
||||
|
||||
SysUser selectByIdCard(@Param("idCard") String idCard);
|
||||
|
||||
List<SysUser> listByIds(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.mcwl.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mcwl.system.domain.SysAdvice;
|
||||
import com.mcwl.system.domain.SysConfig;
|
||||
import com.mcwl.system.domain.vo.AdviceVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息通知 服务层
|
||||
*
|
||||
* @author mcwl
|
||||
*/
|
||||
public interface ISysAdviceService extends IService<SysAdvice> {
|
||||
|
||||
List<AdviceVo> getUserNewMsg();
|
||||
|
||||
List<AdviceVo> getUserSystemNotice();
|
||||
|
||||
List<AdviceVo> getUserAllMsg();
|
||||
|
||||
List<AdviceVo> getAllMsg();
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.mcwl.system.service;
|
||||
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -213,4 +214,8 @@ public interface ISysUserService
|
|||
|
||||
SysUser selectUserInfoById(Long userId);
|
||||
|
||||
AjaxResult updateIdCard(SysUser sysUser);
|
||||
|
||||
List<SysUser> listByIds(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.mcwl.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.system.domain.SysAdvice;
|
||||
import com.mcwl.system.domain.SysUserThirdAccount;
|
||||
import com.mcwl.system.domain.enums.AdviceEnum;
|
||||
import com.mcwl.system.domain.vo.AdviceVo;
|
||||
import com.mcwl.system.mapper.SysAdviceMapper;
|
||||
import com.mcwl.system.service.ISysAdviceService;
|
||||
import com.mcwl.system.service.IWXService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 消息管理 业务层处理
|
||||
*/
|
||||
@Service
|
||||
public class SysAdviceServiceImpl extends ServiceImpl<SysAdviceMapper, SysAdvice> implements ISysAdviceService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<AdviceVo> getUserNewMsg() {
|
||||
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
|
||||
.eq(SysAdvice::getReceiverId, userId)
|
||||
.eq(SysAdvice::getType, AdviceEnum.NEW_MESSAGE_REMIND));
|
||||
|
||||
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdviceVo> getUserSystemNotice() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
|
||||
.eq(SysAdvice::getReceiverId, userId)
|
||||
.eq(SysAdvice::getType, AdviceEnum.SYSTEM_NOTICE));
|
||||
|
||||
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdviceVo> getUserAllMsg() {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
|
||||
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
|
||||
.eq(SysAdvice::getReceiverId, userId));
|
||||
|
||||
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdviceVo> getAllMsg() {
|
||||
|
||||
List<SysAdvice> sysAdvices = baseMapper.selectList(null);
|
||||
|
||||
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
|
||||
}
|
||||
}
|
|
@ -1,13 +1,17 @@
|
|||
package com.mcwl.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.mcwl.common.annotation.DataScope;
|
||||
import com.mcwl.common.constant.CacheConstants;
|
||||
import com.mcwl.common.constant.UserConstants;
|
||||
import com.mcwl.common.core.domain.AjaxResult;
|
||||
import com.mcwl.common.core.domain.entity.SysRole;
|
||||
import com.mcwl.common.core.domain.entity.SysUser;
|
||||
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.common.utils.VerifyCard;
|
||||
import com.mcwl.common.utils.bean.BeanValidators;
|
||||
import com.mcwl.common.utils.spring.SpringUtils;
|
||||
import com.mcwl.system.domain.SysPost;
|
||||
|
@ -30,6 +34,7 @@ import javax.validation.Validator;
|
|||
import java.security.SecureRandom;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -42,6 +47,9 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(SysUserServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
|
@ -600,6 +608,53 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
return userMapper.selectUserInfoById(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateIdCard(SysUser sysUser) {
|
||||
|
||||
//获取次数
|
||||
Integer s = redisCache.getCacheObject(CacheConstants.ID_CARD_COUNT + sysUser.getUserId());
|
||||
Integer count = 0;
|
||||
if (s != null){
|
||||
|
||||
if (3<=s){
|
||||
|
||||
return AjaxResult.error("次数上限");
|
||||
}else {
|
||||
//次数+1
|
||||
s++;
|
||||
count = s;
|
||||
}
|
||||
}
|
||||
|
||||
//存入次数
|
||||
redisCache.setCacheObject(CacheConstants.ID_CARD_COUNT+sysUser.getUserId(),count,1, TimeUnit.DAYS);
|
||||
|
||||
//查看身份证是否唯一
|
||||
SysUser user = userMapper.selectByIdCard(sysUser.getIdCard());
|
||||
if (user != null){
|
||||
return AjaxResult.error("该信息已绑定");
|
||||
}
|
||||
//校验
|
||||
String s1 = VerifyCard.idCard(sysUser.getName(), sysUser.getIdCard());
|
||||
JSONObject jsonObject = JSONObject.parseObject(s1);
|
||||
Integer code = jsonObject.getInteger("code");
|
||||
if (code != 200){
|
||||
|
||||
return AjaxResult.error(jsonObject.getString("msg"));
|
||||
}
|
||||
log.info("实名认证校验的结果:{}",s1);
|
||||
//修改数据库
|
||||
userMapper.updateIdCard(sysUser);
|
||||
|
||||
return AjaxResult.success("实名认证成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> listByIds(List<Long> userIdList) {
|
||||
return userMapper.listByIds(userIdList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 生成随机密码
|
||||
* @param length
|
||||
|
@ -618,5 +673,4 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
||||
select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.inviter_user_id, u.free_points,
|
||||
d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
|
||||
r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
|
||||
from sys_user u
|
||||
|
@ -150,8 +150,21 @@
|
|||
</select>
|
||||
|
||||
<select id="selectUserInfoById" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||
select user_id,avatar,brief,nick_name from sys_user where user_id = #{userId}
|
||||
select user_id,avatar,brief,nick_name,name from sys_user where user_id = #{userId}
|
||||
</select>
|
||||
<select id="selectByIdCard" resultType="com.mcwl.common.core.domain.entity.SysUser">
|
||||
select * from sys_user where id_card = #{idCard}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listByIds" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.user_id in
|
||||
<foreach collection="list" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
|
@ -226,7 +239,13 @@
|
|||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
<update id="updateIdCard">
|
||||
update sys_user set name = #{name},
|
||||
id_card = #{idCard}
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserById" parameterType="Long">
|
||||
update sys_user set del_flag = '2' where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
|
|
Loading…
Reference in New Issue