|
|
@@ -1,9 +1,18 @@
|
|
|
package com.ylx.massage.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ylx.common.core.domain.model.WxLoginUser;
|
|
|
import com.ylx.common.exception.ServiceException;
|
|
|
import com.ylx.common.utils.StringUtils;
|
|
|
+import com.ylx.lottery.domain.LotteryCountLog;
|
|
|
+import com.ylx.lottery.domain.vo.LocalActivityTableVO;
|
|
|
+import com.ylx.lottery.domain.vo.LotteryActivityVO;
|
|
|
+import com.ylx.lottery.domain.vo.LotteryStatVO;
|
|
|
+import com.ylx.lottery.service.LotteryCountLogService;
|
|
|
+import com.ylx.lottery.service.LotteryCountService;
|
|
|
import com.ylx.massage.domain.CommentUserAudit;
|
|
|
import com.ylx.massage.domain.TComment;
|
|
|
import com.ylx.massage.domain.TOrder;
|
|
|
@@ -38,29 +47,33 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
|
|
|
@Resource
|
|
|
private TCommentUserMapper tCommentUserMapper;
|
|
|
+ @Resource
|
|
|
+ private LotteryCountService lotteryCountService;
|
|
|
+ @Resource
|
|
|
+ private LotteryCountLogService lotteryCountLogService;
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean saveComment(TCommentUser comment, WxLoginUser wxLoginUser) {
|
|
|
//订单ID不能为空
|
|
|
- if(StringUtils.isBlank(comment.getOrderId())){
|
|
|
+ if (StringUtils.isBlank(comment.getOrderId())) {
|
|
|
throw new ServiceException("订单id不能为空");
|
|
|
}
|
|
|
//判断订单是否存在
|
|
|
TOrder order1 = orderService.getById(comment.getOrderId());
|
|
|
- if(order1 == null){
|
|
|
+ if (order1 == null) {
|
|
|
throw new ServiceException("订单不存在");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(comment.getOrderNo())){
|
|
|
+ if (StringUtils.isBlank(comment.getOrderNo())) {
|
|
|
throw new ServiceException("订单号不能为空");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(comment.getText())){
|
|
|
+ if (StringUtils.isBlank(comment.getText())) {
|
|
|
throw new ServiceException("评论内容不能空");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(comment.getJsId())){
|
|
|
+ if (StringUtils.isBlank(comment.getJsId())) {
|
|
|
throw new ServiceException("技师id不能空");
|
|
|
}
|
|
|
- if(StringUtils.isBlank(comment.getName())){
|
|
|
+ if (StringUtils.isBlank(comment.getName())) {
|
|
|
throw new ServiceException("技师姓名不能空");
|
|
|
}
|
|
|
comment.setOpenId(wxLoginUser.getCOpenid());
|
|
|
@@ -84,13 +97,76 @@ public class TCommentUserServiceImpl extends ServiceImpl<TCommentUserMapper, TCo
|
|
|
//修改订单状态(已完成)
|
|
|
order.setnStatus(OrderStatusEnum.COMPLETE.getCode());
|
|
|
order.setcId(comment.getOrderId());
|
|
|
- return orderService.updateById(order);
|
|
|
+ boolean bool = orderService.updateById(order);
|
|
|
+ if (bool) {
|
|
|
+
|
|
|
+ // 评价有礼
|
|
|
+ List<LotteryActivityVO> lotteryActivityVOS = lotteryCountService.queryActivityRules();
|
|
|
+ if (CollUtil.isNotEmpty(lotteryActivityVOS)) {
|
|
|
+ for (LotteryActivityVO activity : lotteryActivityVOS) {
|
|
|
+
|
|
|
+ List<LocalActivityTableVO> gyyPointTables = activity.getGyyPointTables();
|
|
|
+ if (CollUtil.isNotEmpty(gyyPointTables)) {
|
|
|
+ for (LocalActivityTableVO localActivityTable : gyyPointTables) {
|
|
|
+
|
|
|
+ LotteryCountLog lotteryCountLog = new LotteryCountLog();
|
|
|
+ lotteryCountLog.setOpenId(wxLoginUser.getCOpenid());
|
|
|
+ lotteryCountLog.setUserId(wxLoginUser.getId());
|
|
|
+ lotteryCountLog.setUserPhone(wxLoginUser.getCPhone());
|
|
|
+ // 活动类型:2.任务奖励
|
|
|
+ lotteryCountLog.setActivityType(2);
|
|
|
+ lotteryCountLog.setLocalActivityTableId(localActivityTable.getId());
|
|
|
+ lotteryCountLog.setLotteryNum(localActivityTable.getPointNumber());
|
|
|
+ lotteryCountLog.setReceiveTime(new Date());
|
|
|
+ lotteryCountLog.setIsDelete("0");
|
|
|
+ // 同步状态 0-未同步到本地生活
|
|
|
+ lotteryCountLog.setStatus(0);
|
|
|
+ lotteryCountLogService.save(lotteryCountLog);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+
|
|
|
+ // 非任务奖励活动
|
|
|
+ if (ObjectUtil.isNull(activity.getParticipationRules()) || ObjectUtil.notEqual(activity.getParticipationRules(), 3)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<LocalActivityTableVO> localActivityTables = activity.getLocalActivityTables();
|
|
|
+ if (CollUtil.isEmpty(localActivityTables)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LocalActivityTableVO localActivityTable : localActivityTables) {
|
|
|
+
|
|
|
+ // 判断是否评价有礼
|
|
|
+ if (ObjectUtil.isNull(localActivityTable.getType()) || ObjectUtil.notEqual(localActivityTable.getType(), 4)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ LotteryCountLog lotteryCountLog = new LotteryCountLog();
|
|
|
+ lotteryCountLog.setOpenId(wxLoginUser.getCOpenid());
|
|
|
+ lotteryCountLog.setUserId(wxLoginUser.getId());
|
|
|
+ lotteryCountLog.setUserPhone(wxLoginUser.getCPhone());
|
|
|
+ // 活动类型:2.任务奖励
|
|
|
+ lotteryCountLog.setActivityType(2);
|
|
|
+ lotteryCountLog.setLocalActivityTableId(localActivityTable.getId());
|
|
|
+ lotteryCountLog.setLotteryNum(1);
|
|
|
+ lotteryCountLog.setReceiveTime(new Date());
|
|
|
+ lotteryCountLog.setIsDelete("0");
|
|
|
+ // 同步状态 0-未同步到本地生活
|
|
|
+ lotteryCountLog.setStatus(0);
|
|
|
+ lotteryCountLogService.save(lotteryCountLog);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return bool;
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
+ @Override
|
|
|
public List<TCommentUser> selectAll(TCommentUser tCommentUser) {
|
|
|
- return tCommentUserMapper.selectAll(tCommentUser);
|
|
|
+ return tCommentUserMapper.selectAll(tCommentUser);
|
|
|
}
|
|
|
}
|
|
|
|