Sfoglia il codice sorgente

行家话题积分

guomengjiao 3 settimane fa
parent
commit
0524d31923

+ 40 - 5
renren-admin/src/main/java/io/renren/modules/qmgj/service/impl/MemberInfoServiceImpl.java

@@ -724,6 +724,8 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
         WgFillInfoEntity wgFillInfoEntity = wgFillInfoService.info();
         BigDecimal perYearPrice = wgFillInfoEntity.getPerYearPrice();
         BigDecimal lifelongPrice = wgFillInfoEntity.getLifelongPrice();
+        BigDecimal yearlyBonusPoints = wgFillInfoEntity.getYearlyBonusPoints();
+        BigDecimal lifelongBonusPoints = wgFillInfoEntity.getLifelongBonusPoints();
 
         TaskConfigEntity taskConfigEntity = taskConfigService.loadByCode(code, true);
         Integer memberState = memberInfoEntity.getMemberState();
@@ -734,18 +736,19 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
             } else if (NumberUtil.equals(2, memberState)) {
                 throw new RRException("您已是终身会员");
             }
-            return payFor(memberInfoEntity, taskConfigEntity, perYearPrice, isDeductiblePrice);
+            return payFor(memberInfoEntity, taskConfigEntity, perYearPrice, isDeductiblePrice, yearlyBonusPoints);
         } else if (StrUtil.equals(code, TaskConfigEnum.LIFELONG.code())) {
             if (NumberUtil.equals(1, memberState)) {
                 lifelongPrice = NumberUtil.sub(lifelongPrice, perYearPrice);
             } else if (NumberUtil.equals(2, memberState)) {
                 throw new RRException("您已是终身会员");
             }
-            return payFor(memberInfoEntity, taskConfigEntity, lifelongPrice, isDeductiblePrice);
+            return payFor(memberInfoEntity, taskConfigEntity, lifelongPrice, isDeductiblePrice, lifelongBonusPoints);
         } else if (StrUtil.equals(code, TaskConfigEnum.MALE_UP.code())) {
             if (NumberUtil.equals(1, memberState)) {
                 lifelongPrice = NumberUtil.sub(lifelongPrice, perYearPrice);
-                return payFor(memberInfoEntity, taskConfigEntity, lifelongPrice, isDeductiblePrice);
+                lifelongBonusPoints = NumberUtil.sub(lifelongBonusPoints, yearlyBonusPoints);
+                return payFor(memberInfoEntity, taskConfigEntity, lifelongPrice, isDeductiblePrice, lifelongBonusPoints);
             }
         }
         return R.ok();
@@ -760,7 +763,7 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
      * @return
      */
     private R payFor(MemberInfoEntity memberInfoEntity, TaskConfigEntity taskConfigEntity, BigDecimal price,
-                     Integer isDeductiblePrice) {
+                     Integer isDeductiblePrice, BigDecimal bonusPoints) {
         if (NumberUtil.isGreater(NumberUtil.toBigDecimal(price), BigDecimal.ZERO)) {
             PointsConfigEntity pointsConfigEntity = pointsConfigMapper.selectOne(
                     new LambdaQueryWrapper<PointsConfigEntity>().eq(PointsConfigEntity::getStatus, YnEnum.YES.value()));
@@ -882,7 +885,20 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
                         scoreStuService.save(scoreStu);
                     }
                 }
-
+                // 增加积分记录
+                ScoreStu scoreStu = new ScoreStu();
+                scoreStu.setStuId(memberInfoEntity.getId());
+                scoreStu.setScoreType(ScoreType.TASK_SCORE.getCode());
+                scoreStu.setDay(new SimpleDateFormat("yyyyMMdd").format(new Date()));
+                scoreStu.setTaskId(TaskType.OPEN_VIP.getCode());
+                scoreStu.setBusinessId(TaskType.OPEN_VIP.getCode());
+                // 查询积分值
+                Integer totalScore = scoreStuService.getTotalScore(memberInfoEntity.getId());
+                scoreStu.setSurplusScore(NumberUtil.add(totalScore, bonusPoints).intValue());
+                scoreStu.setScoreValue(bonusPoints.intValue());
+                scoreStu.setScoreEvent(TaskType.OPEN_VIP.getInfo());
+                scoreStu.setCreateTime(new Date());
+                scoreStuService.save(scoreStu);
                 return R.ok();
             }
 
@@ -1300,6 +1316,9 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
                 String annualFeeCode = TaskConfigEnum.ANNUAL_FEE.code();
                 String lifelongCode = TaskConfigEnum.LIFELONG.code();
                 String maleUpCode = TaskConfigEnum.MALE_UP.code();
+                WgFillInfoEntity fillInfoEntity = wgFillInfoService.info();
+                BigDecimal yearlyBonusPoints = fillInfoEntity.getYearlyBonusPoints();
+                BigDecimal bonusPoints = fillInfoEntity.getLifelongBonusPoints();
 
                 WxConsumeInfoEntity wxConsumeInfoEntity = new WxConsumeInfoEntity();
                 if (StrUtil.equals(taskConfigCode, annualFeeCode)) {
@@ -1331,6 +1350,7 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
                             this.savePointsRecord(annualFee, pInviteCode, actuallyPaid);
                         }
                     }
+                    bonusPoints = yearlyBonusPoints;
                 } else if (StrUtil.equals(taskConfigCode, lifelongCode)) {
                     wxConsumeInfoEntity.setCode(TaskConfigEnum.LIFELONG.code());
                     updateMemberState(actuallyPaid, memberInfoEntity, pInviteCode, memberId, lifelongCode);
@@ -1342,6 +1362,21 @@ public class MemberInfoServiceImpl extends ServiceImpl<MemberInfoDao, MemberInfo
                     returnData.put("return_msg", "开通会员code码错误");
                     return StringUtil.GetMapToXML(returnData);
                 }
+                // 增加积分记录
+                ScoreStu scoreStu = new ScoreStu();
+                scoreStu.setStuId(memberInfoEntity.getId());
+                scoreStu.setScoreType(ScoreType.TASK_SCORE.getCode());
+                scoreStu.setDay(new SimpleDateFormat("yyyyMMdd").format(new Date()));
+                scoreStu.setTaskId(TaskType.OPEN_VIP.getCode());
+                scoreStu.setBusinessId(TaskType.OPEN_VIP.getCode());
+                // 查询积分值
+                Integer totalScore = scoreStuService.getTotalScore(memberInfoEntity.getId());
+                scoreStu.setSurplusScore(NumberUtil.add(totalScore, bonusPoints).intValue());
+                scoreStu.setScoreValue(bonusPoints.intValue());
+                scoreStu.setScoreEvent(TaskType.OPEN_VIP.getInfo());
+                scoreStu.setCreateTime(new Date());
+                scoreStuService.save(scoreStu);
+
                 wxConsumeInfoEntity.setBussNo(bussNo);
                 wxConsumeInfoEntity.setBussType(String.valueOf(orderEntity.getBusinessType()));
                 wxConsumeInfoEntity.setWxOrderNo(wxOrderNo);

+ 4 - 0
renren-admin/src/main/java/io/renren/modules/qyh/entity/MeetEntity.java

@@ -55,6 +55,10 @@ public class MeetEntity implements Serializable {
      * 请教价格
      */
     private BigDecimal meetPrice;
+    /**
+     * 请教积分
+     */
+    private BigDecimal meetPoints;
     /**
      * 预约时间
      */

+ 4 - 0
renren-admin/src/main/java/io/renren/modules/qyh/entity/OrderEntity.java

@@ -69,6 +69,10 @@ public class OrderEntity implements Serializable {
      * 实付
      */
     private BigDecimal actuallyPaid;
+    /**
+     * 积分
+     */
+    private BigDecimal points;
     /**
      * 积分抵扣
      */

+ 4 - 0
renren-admin/src/main/java/io/renren/modules/qyh/model/bo/PayForBO.java

@@ -54,6 +54,10 @@ public class PayForBO implements Serializable {
      * 实付
      */
     private BigDecimal actuallyPaid;
+    /**
+     * 积分
+     */
+    private BigDecimal points;
     /**
      * 积分抵扣
      */

+ 4 - 0
renren-admin/src/main/java/io/renren/modules/qyh/service/MeetService.java

@@ -9,8 +9,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
 
 import io.renren.common.utils.PageUtils;
 import io.renren.common.utils.R;
+import io.renren.modules.qmgj.entity.MemberInfoEntity;
 import io.renren.modules.qyh.entity.ExpertEntity;
 import io.renren.modules.qyh.entity.MeetEntity;
+import io.renren.modules.qyh.entity.OrderEntity;
 import io.renren.modules.qyh.model.dto.JoinTheGroupDTO;
 import io.renren.modules.qyh.model.dto.MeetDTO;
 import io.renren.modules.qyh.model.dto.MyAppointmentDTO;
@@ -52,4 +54,6 @@ public interface MeetService extends IService<MeetEntity> {
     void deleteByIds(Long[] ids);
 
     Integer myServiceStatistics(Long expertId, List<Integer> newArrayList);
+
+    MemberInfoEntity payCallback(OrderEntity orderEntity);
 }

+ 156 - 27
renren-admin/src/main/java/io/renren/modules/qyh/service/impl/MeetServiceImpl.java

@@ -1,32 +1,19 @@
 package io.renren.modules.qyh.service.impl;
 
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.time.LocalDateTime;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.shiro.SecurityUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.DesensitizedUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.renren.common.canstant.QueueConstant;
 import io.renren.common.enums.*;
 import io.renren.common.exception.RRException;
 import io.renren.common.utils.Constant;
@@ -35,10 +22,15 @@ import io.renren.common.utils.R;
 import io.renren.common.utils.config.PropertiesParameter;
 import io.renren.modules.qmgj.entity.MemberInfoEntity;
 import io.renren.modules.qmgj.service.MemberInfoService;
+import io.renren.modules.qmjz.entity.ScoreStu;
 import io.renren.modules.qmjz.entity.WxConsumeInfoEntity;
+import io.renren.modules.qmjz.enums.ScoreType;
+import io.renren.modules.qmjz.enums.TaskType;
+import io.renren.modules.qmjz.mapper.ScoreStuMapper;
+import io.renren.modules.qmjz.service.ScoreStuService;
 import io.renren.modules.qmjz.service.WxConsumeInfoService;
 import io.renren.modules.qmjz.utils.BeanCopyUtils;
-import io.renren.modules.sys.entity.SysUserEntity;
+import io.renren.modules.qmjz.utils.DateForStr;
 import io.renren.modules.qyh.entity.*;
 import io.renren.modules.qyh.mapper.MeetMapper;
 import io.renren.modules.qyh.model.bo.MeetPeopleBO;
@@ -49,7 +41,25 @@ import io.renren.modules.qyh.model.dto.MyAppointmentDTO;
 import io.renren.modules.qyh.model.dto.PointsRecordDTO;
 import io.renren.modules.qyh.model.vo.*;
 import io.renren.modules.qyh.service.*;
+import io.renren.modules.sys.entity.SysUserEntity;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
+import org.springframework.amqp.core.MessageProperties;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.LocalDateTime;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Slf4j
 @Service("meetService")
@@ -77,6 +87,12 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
     private LoginVerificationService loginVerificationService;
     @Autowired
     private WxConsumeInfoService wxConsumeInfoService;
+    @Autowired
+    private ScoreStuMapper scoreStuMapper;
+    @Autowired
+    private ScoreStuService scoreStuService;
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
 
     @Override
     public PageUtils myAppointmentPage(Map<String, Object> params) {
@@ -113,11 +129,13 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
 
         ExpertTopicEntity expertTopicEntity = expertTopicService.loadById(topicId, true);
         BigDecimal topicPrice = expertTopicEntity.getTopicPrice();
+        BigDecimal topicPoints = expertTopicEntity.getTopicPoints();
         LocalDateTime now = LocalDateTime.now();
 
         MeetEntity meetEntity = new MeetEntity();
         BeanCopyUtils.copyPropertiesIgnoreNull(dto, meetEntity);
         meetEntity.setMeetPrice(topicPrice);
+        meetEntity.setMeetPoints(topicPoints);
         meetEntity.setCreateId(userId);
         meetEntity.setUpdateId(userId);
         meetEntity.setCreateTime(now);
@@ -137,12 +155,15 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
 
         // 实付价格
         BigDecimal actualPrice = BigDecimal.ZERO;
+        BigDecimal actualPoints = BigDecimal.ZERO;
 
         // 拼团方式 0 一对一 1拼团
         Integer groupWay = dto.getGroupWay();
         if (NumberUtil.equals(groupWay, YnEnum.NO.value())) {
             actualPrice = topicPrice;
+            actualPoints = topicPoints;
             peopleEntity.setPayPrice(topicPrice);
+            peopleEntity.setPointsDeduction(topicPoints);
             meetEntity.setProcess(MeetProcessEnum.RESERVE.value());
             meetEntity.setMeetType(MeetTypeEnum.RESERVATION.value());
             baseMapper.insert(meetEntity);
@@ -155,8 +176,11 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
                 throw new RRException("拼团人数不能为空");
             }
             BigDecimal payPrice = NumberUtil.div(topicPrice, groupNumberPeople, 0, RoundingMode.FLOOR);
+            BigDecimal pointsDeduction = NumberUtil.div(topicPoints, groupNumberPeople, 0, RoundingMode.FLOOR);
             actualPrice = payPrice;
+            actualPoints = pointsDeduction;
             peopleEntity.setPayPrice(payPrice);
+            peopleEntity.setPointsDeduction(pointsDeduction);
             LocalDateTime groupWayEndTime = LocalDateTime.now().plusHours(48);
             meetEntity.setGroupWayEndTime(groupWayEndTime);
             meetEntity.setMeetType(MeetTypeEnum.IN_A_GROUP.value());
@@ -166,7 +190,7 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
         Map<String, String> payFor = null;
         try {
             payFor = getPayFor(memberInfoEntity, userId, meetEntity.getId(), expertTopicEntity, topicPrice, actualPrice,
-                now);
+                now, topicPoints, actualPoints);
         } catch (Exception e) {
             throw new RRException("支付失败", e);
         }
@@ -248,13 +272,15 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
         }
         ExpertTopicEntity expertTopicEntity = expertTopicService.loadById(meetEntity.getTopicId(), true);
         BigDecimal topicPrice = expertTopicEntity.getTopicPrice();
+        BigDecimal topicPoints = expertTopicEntity.getTopicPoints();
 
         BigDecimal payPrice = NumberUtil.div(topicPrice, groupNumberPeople, 0, RoundingMode.FLOOR);
+        BigDecimal pointsDeduction = NumberUtil.div(topicPoints, groupNumberPeople, 0, RoundingMode.FLOOR);
         LocalDateTime now = LocalDateTime.now();
 
         Map<String, String> payFor = null;
         try {
-            payFor = getPayFor(memberInfoEntity, userId, meetId, expertTopicEntity, topicPrice, payPrice, now);
+            payFor = getPayFor(memberInfoEntity, userId, meetId, expertTopicEntity, topicPrice, payPrice, now, topicPoints, pointsDeduction);
         } catch (Exception e) {
             throw new RRException("支付失败", e);
         }
@@ -281,7 +307,7 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
      * @return
      */
     private Map<String, String> getPayFor(MemberInfoEntity memberInfoEntity, Long userId, Long meetId,
-        ExpertTopicEntity expertTopicEntity, BigDecimal price, BigDecimal actuallyPaid, LocalDateTime payTime)
+        ExpertTopicEntity expertTopicEntity, BigDecimal price, BigDecimal actuallyPaid, LocalDateTime payTime, BigDecimal points, BigDecimal pointsDeduction)
         throws Exception {
         String openid = memberInfoEntity.getOpenid();
         OrderBusinessTypeEnum typeEnum = OrderBusinessTypeEnum.ASK_EXPERTS;
@@ -298,9 +324,112 @@ public class MeetServiceImpl extends ServiceImpl<MeetMapper, MeetEntity> impleme
         bo.setPayTime(payTime);
         bo.setPrice(price);
         bo.setActuallyPaid(actuallyPaid);
-        bo.setPointsDeduction(BigDecimal.ZERO);
+        bo.setPoints(points);
+        bo.setPointsDeduction(pointsDeduction);
         bo.setCode(TaskConfigEnum.MEET.code());
-        return orderService.payFor(bo);
+        Map<String, String> returnMap = orderService.payFor(bo);
+        if (actuallyPaid.compareTo(BigDecimal.ZERO) == 0 && pointsDeduction.compareTo(BigDecimal.ZERO) > 0) {
+            // 积分抵扣
+            Integer totalPoints = scoreStuMapper.getTotalPointsByMemberId(memberInfoEntity.getId());
+            if (NumberUtil.isGreater(pointsDeduction, BigDecimal.valueOf(totalPoints))) {
+                throw new RRException("积分不足");
+            }
+            ScoreStu add = new ScoreStu();
+            add.setDay(DateForStr.getInfoDateStr(new Date()));
+            add.setStuId(memberInfoEntity.getId());
+            add.setScoreType(ScoreType.STORE_SCORE.getCode());
+            add.setTaskId(TaskType.WORK_APPLY_DEDUCT.getCode());
+            add.setBusinessId(TaskType.WORK_APPLY_DEDUCT.getCode());
+            add.setScoreEvent(TaskType.WORK_APPLY_DEDUCT.getInfo());
+            add.setScoreValue(NumberUtil.sub(BigDecimal.ZERO, pointsDeduction).intValue());
+            add.setCreateTime(new Date());
+            add.setSurplusScore(NumberUtil.sub(BigDecimal.ZERO, pointsDeduction).intValue() + this.scoreStuService.getTotalScore(memberInfoEntity.getId()));
+            scoreStuMapper.insert(add);
+            String orderNo = returnMap.getOrDefault("orderNo", "");
+            if (StringUtils.isEmpty(orderNo)) {
+                throw new RRException("支付失败");
+            }
+            OrderEntity orderEntity = orderService.loadByPayNo(orderNo, false);
+            if (orderEntity == null) {
+                throw new RRException("支付失败");
+            }
+            payCallback(orderEntity);
+        }
+        return returnMap;
+    }
+
+    @Override
+    public MemberInfoEntity payCallback(OrderEntity orderEntity) {
+        BigDecimal money = orderEntity.getActuallyPaid();
+        // if(!NumberUtil.equals(money, NumberUtil.toBigDecimal(totalFee))) {
+        // // 支付失败
+        // returnData.put("return_code", "FAIL");
+        // returnData.put("return_msg", "订单金额不符合");
+        // return StringUtil.GetMapToXML(returnData);
+        // }
+
+        Long businessId = orderEntity.getBusinessId();
+        BigDecimal pointsDeduction = orderEntity.getPointsDeduction();
+        MemberInfoEntity memberInfoEntity = memberInfoService.getById(orderEntity.getMemberId());
+        Long memberId = memberInfoEntity.getId();
+
+        MeetEntity meetEntity = getById(businessId);
+        Integer groupWay = meetEntity.getGroupWay();
+
+        Long expertId = meetEntity.getExpertId();
+        LocalDateTime now = LocalDateTime.now();
+        Long meetId = meetEntity.getId();
+        if (NumberUtil.equals(groupWay, YnEnum.YES.value())) {
+            MeetPeopleEntity peopleEntity = new MeetPeopleEntity();
+            peopleEntity.setMeetId(meetId);
+            peopleEntity.setExpertId(expertId);
+            peopleEntity.setMemberId(memberId);
+            peopleEntity.setIsRegimentalCommander(YnEnum.YES.value());
+            peopleEntity.setIsMeetFinish(YnEnum.NO.value());
+            peopleEntity.setPayPrice(money);
+            peopleEntity.setPointsDeduction(pointsDeduction);
+            peopleEntity.setIsCancelMeet(YnEnum.NO.value());
+            peopleEntity.setCreateId(memberId);
+            peopleEntity.setUpdateId(memberId);
+            peopleEntity.setCreateTime(now);
+            peopleEntity.setUpdateTime(now);
+            peopleEntity.setIsDelete(IsDeleteEnum.NORMAL.value());
+            meetPeopleService.save(peopleEntity);
+            meetEntity.setProcess(MeetProcessEnum.RESERVE.value());
+            meetEntity.setMeetType(MeetTypeEnum.IN_A_GROUP.value());
+
+            JSONObject jsonObject = new JSONObject();
+            jsonObject.put("meetId", meetId);
+            rabbitTemplate.convertAndSend(QueueConstant.MEET_EXPIRATION_MS_QUEUE, jsonObject.toString(),
+                    message -> {
+                        MessageProperties messageProperties = message.getMessageProperties();
+                        long millis = LocalDateTimeUtil.between(now, now.plusDays(2)).toMillis();
+                        messageProperties.setExpiration(String.valueOf(millis));
+                        return message;
+                    });
+
+            Integer count = meetPeopleService.selectCountByMeetId(businessId);
+            Integer groupNumberPeople = meetEntity.getGroupNumberPeople();
+            if (NumberUtil.equals(groupNumberPeople, count)) {
+                meetEntity.setProcess(MeetProcessEnum.PAYMENT_SUCCESSFUL.value());
+                meetEntity.setMeetType(MeetTypeEnum.RESERVATION.value());
+
+            }
+        } else if (NumberUtil.equals(groupWay, YnEnum.NO.value())) {
+            meetEntity.setProcess(MeetProcessEnum.PAYMENT_SUCCESSFUL.value());
+            meetEntity.setMeetType(MeetTypeEnum.RESERVATION.value());
+            MeetPeopleEntity meetPeopleEntity = meetPeopleService.getBaseMapper()
+                    .selectOne(new LambdaQueryWrapper<MeetPeopleEntity>().eq(MeetPeopleEntity::getMeetId, meetId)
+                            .orderByDesc(MeetPeopleEntity::getCreateTime).last("limit 1"));
+            if(ObjectUtil.isNotNull(meetPeopleEntity)) {
+                meetPeopleEntity.setIsDelete(IsDeleteEnum.NORMAL.value());
+                meetPeopleService.save(meetPeopleEntity);
+            }
+        }
+        meetEntity.setUpdateTime(now);
+        meetEntity.setIsDelete(IsDeleteEnum.NORMAL.value());
+        updateById(meetEntity);
+        return memberInfoEntity;
     }
 
     @Override

+ 16 - 83
renren-admin/src/main/java/io/renren/modules/qyh/service/impl/OrderServiceImpl.java

@@ -125,9 +125,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Map<String, String> payFor(PayForBO bo) throws Exception {
-        PayInfo payInfo = new PayInfo();
-        payInfo.setOpenId(bo.getOpenid());
-        payInfo.setNotifyUrl(bo.getNotifyUrl());
         String orderNo = null;
         while (true) {
             orderNo = MD5Util.getUUID16();
@@ -137,15 +134,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
                 break;
             }
         }
-        payInfo.setOrderNo(orderNo);
-        payInfo.setMoney(bo.getActuallyPaid().multiply(new BigDecimal("100")).stripTrailingZeros().toPlainString());
-        String value = getIsOneCentPay();
-        payInfo.setIsOneCentPay(BooleanUtil.toBoolean(value));
-        Map<String, String> map = WxController.wxPayFunction(payInfo);
-
-        map.put("orderNo", orderNo);
-        map.put("businessId", String.valueOf(bo.getBusinessId()));
-
+        Map<String, String> map = new HashMap<>();
+        if (bo.getActuallyPaid().compareTo(BigDecimal.ZERO) > 0) {
+            PayInfo payInfo = new PayInfo();
+            payInfo.setOpenId(bo.getOpenid());
+            payInfo.setNotifyUrl(bo.getNotifyUrl());
+            payInfo.setOrderNo(orderNo);
+            payInfo.setMoney(bo.getActuallyPaid().multiply(new BigDecimal("100")).stripTrailingZeros().toPlainString());
+            String value = getIsOneCentPay();
+            payInfo.setIsOneCentPay(BooleanUtil.toBoolean(value));
+            map = WxController.wxPayFunction(payInfo);
+        }
         OrderEntity orderEntity = new OrderEntity();
         BeanCopyUtils.copyPropertiesIgnoreNull(bo, orderEntity);
         orderEntity.setPayNo(orderNo);
@@ -155,6 +154,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
         orderEntity.setCreateTime(LocalDateTime.now());
         orderEntity.setPayStatus(YnEnum.NO.value());
         baseMapper.insert(orderEntity);
+
+        map.put("orderNo", orderNo);
+        map.put("businessId", String.valueOf(bo.getBusinessId()));
         return map;
     }
 
@@ -257,77 +259,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
                 returnData.put("return_msg", "return_code不正确");
                 return StringUtil.GetMapToXML(returnData);
             } else {
-                BigDecimal money = orderEntity.getActuallyPaid();
-                // if(!NumberUtil.equals(money, NumberUtil.toBigDecimal(totalFee))) {
-                // // 支付失败
-                // returnData.put("return_code", "FAIL");
-                // returnData.put("return_msg", "订单金额不符合");
-                // return StringUtil.GetMapToXML(returnData);
-                // }
-
-                Long businessId = orderEntity.getBusinessId();
-                BigDecimal pointsDeduction = orderEntity.getPointsDeduction();
-                MemberInfoEntity memberInfoEntity = memberInfoService.getById(orderEntity.getMemberId());
-                Long memberId = memberInfoEntity.getId();
-
-                MeetEntity meetEntity = meetService.getById(businessId);
-                Integer groupWay = meetEntity.getGroupWay();
-
-                Long expertId = meetEntity.getExpertId();
-                LocalDateTime now = LocalDateTime.now();
-                Long meetId = meetEntity.getId();
-                if (NumberUtil.equals(groupWay, YnEnum.YES.value())) {
-                    MeetPeopleEntity peopleEntity = new MeetPeopleEntity();
-                    peopleEntity.setMeetId(meetId);
-                    peopleEntity.setExpertId(expertId);
-                    peopleEntity.setMemberId(memberId);
-                    peopleEntity.setIsRegimentalCommander(YnEnum.YES.value());
-                    peopleEntity.setIsMeetFinish(YnEnum.NO.value());
-                    peopleEntity.setPayPrice(money);
-                    peopleEntity.setPointsDeduction(pointsDeduction);
-                    peopleEntity.setIsCancelMeet(YnEnum.NO.value());
-                    peopleEntity.setCreateId(memberId);
-                    peopleEntity.setUpdateId(memberId);
-                    peopleEntity.setCreateTime(now);
-                    peopleEntity.setUpdateTime(now);
-                    peopleEntity.setIsDelete(IsDeleteEnum.NORMAL.value());
-                    meetPeopleService.save(peopleEntity);
-                    meetEntity.setProcess(MeetProcessEnum.RESERVE.value());
-                    meetEntity.setMeetType(MeetTypeEnum.IN_A_GROUP.value());
-
-                    JSONObject jsonObject = new JSONObject();
-                    jsonObject.put("meetId", meetId);
-                    rabbitTemplate.convertAndSend(QueueConstant.MEET_EXPIRATION_MS_QUEUE, jsonObject.toString(),
-                        message -> {
-                            MessageProperties messageProperties = message.getMessageProperties();
-                            long millis = LocalDateTimeUtil.between(now, now.plusDays(2)).toMillis();
-                            messageProperties.setExpiration(String.valueOf(millis));
-                            return message;
-                        });
-
-                    Integer count = meetPeopleService.selectCountByMeetId(businessId);
-                    Integer groupNumberPeople = meetEntity.getGroupNumberPeople();
-                    if (NumberUtil.equals(groupNumberPeople, count)) {
-                        meetEntity.setProcess(MeetProcessEnum.PAYMENT_SUCCESSFUL.value());
-                        meetEntity.setMeetType(MeetTypeEnum.RESERVATION.value());
-
-                    }
-                } else if (NumberUtil.equals(groupWay, YnEnum.NO.value())) {
-                    meetEntity.setProcess(MeetProcessEnum.PAYMENT_SUCCESSFUL.value());
-                    meetEntity.setMeetType(MeetTypeEnum.RESERVATION.value());
-                    MeetPeopleEntity meetPeopleEntity = meetPeopleService.getBaseMapper()
-                        .selectOne(new LambdaQueryWrapper<MeetPeopleEntity>().eq(MeetPeopleEntity::getMeetId, meetId)
-                            .orderByDesc(MeetPeopleEntity::getCreateTime).last("limit 1"));
-                    if(ObjectUtil.isNotNull(meetPeopleEntity)) {
-                        meetPeopleEntity.setIsDelete(IsDeleteEnum.NORMAL.value());
-                        meetPeopleService.save(meetPeopleEntity);
-                    }
-                }
-                meetEntity.setUpdateTime(now);
-                meetEntity.setIsDelete(IsDeleteEnum.NORMAL.value());
-                meetService.updateById(meetEntity);
                 returnData.put("return_code", "SUCCESS");
                 returnData.put("return_msg", "OK");
+                MemberInfoEntity memberInfoEntity = meetService.payCallback(orderEntity);
                 String bussNo = new Snowflake().nextIdStr();
 
                 orderEntity.setPayStatus(YnEnum.YES.value());
@@ -344,10 +278,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderEntity> impl
                 wxConsumeInfoEntity.setInputime(new Date());
                 wxConsumeInfoEntity.setIsread("0");
                 wxConsumeInfoEntity.setIsdelete("0");
-                wxConsumeInfoEntity.setBusinessId(meetId);
+                wxConsumeInfoEntity.setBusinessId(orderEntity.getBusinessId());
                 wxConsumeInfoEntity.setCode(TaskConfigEnum.MEET.code());
                 wxConsumeInfoService.save(wxConsumeInfoEntity);
-
             }
             // 支付成功 把订单号插入到redis里面,前端请求接口查看支付状态,有效期七天
             redisUtils.set("orderNo:" + payNo, "会员订单编号", 7 * 60 * 60 * 24);

+ 5 - 5
renren-admin/src/main/resources/statics/js/modules/qyh/expert.js

@@ -490,7 +490,7 @@ $(function () {
             { label: 'id', name: 'id', index: 'id', width: 50, key: true, hidden: true },
             { label: '话题名称', name: 'topicName', width: 80, sortable: false },
             { label: '话题描述', name: 'topicDescribe', width: 80, sortable: false },
-            { label: '话题价格', name: 'topicPrice', width: 80, sortable: false },
+            { label: '话题积分', name: 'topicPoints', width: 80, sortable: false },
             {
                 label: '状态', name: 'status', width: 80, sortable: false, formatter: function (value, options, row) {
                     if (value == 1) {
@@ -616,7 +616,7 @@ var vm2 = new Vue({
         showList: true,
         title: null,
         workStu: {
-            topicPrice: '',
+            topicPoints: '',
             status: ''
         },
         showInfo: false,
@@ -647,7 +647,7 @@ var vm2 = new Vue({
             vm2.showList = false;
             vm2.title = "新增";
             vm2.showInfo = false;
-            vm2.workStu.topicPrice = '';
+            vm2.workStu.topicPoints = '';
             vm2.workStu.id = null;
             vm2.workStu.status = '';
             vm2.workStu.topicName = '';
@@ -824,8 +824,8 @@ var vm2 = new Vue({
             window.location.href = baseURL + "qmgj/workstu/qrcode/" + vm2.parent;
         },
         topicSubmit() {
-            if (vm2.workStu.topicPrice == '') {
-                layer.msg('[话题价格]不能为空', { icon: 5 });
+            if (vm2.workStu.topicPoints == '') {
+                layer.msg('[话题积分]不能为空', { icon: 5 });
                 return false;
             }
             if (vm2.workStu.status == '') {

+ 1 - 1
renren-admin/src/main/resources/statics/js/modules/qyh/experttopic.js

@@ -7,7 +7,7 @@ $(function () {
 			{ label: '行家id', name: 'expertId', index: 'expert_id', width: 80 },
 			{ label: '话题名称', name: 'topicName', index: 'topic_name', width: 80 },
 			{ label: '话题描述', name: 'topicDescribe', index: 'topic_describe', width: 80 },
-			{ label: '话题价格', name: 'topicPrice', index: 'topic_price', width: 80 },
+			{ label: '话题积分', name: 'topicPoints', index: 'topic_price', width: 80 },
 			{ label: '状态 1启用 0禁用', name: 'status', index: 'status', width: 80 },
 			{ label: '创建人', name: 'createId', index: 'create_id', width: 80 },
 			{ label: '创建时间', name: 'createTime', index: 'create_time', width: 80 },

+ 2 - 9
renren-admin/src/main/resources/templates/modules/qyh/expert.html

@@ -244,16 +244,9 @@
             </div>
         </div>
         <div class="form-group">
-            <div class="col-sm-2 control-label">话题价格</div>
+            <div class="col-sm-2 control-label">话题积分</div>
             <div class="col-sm-4">
-                <select class="form-control" v-model="workStu.topicPrice">
-                    <option value="" disabled hidden>--话题价格--</option>
-                    <option value="60" >60</option>
-                    <option value="120" >120</option>
-                    <option value="180" >180</option>
-                    <option value="240" >240</option>
-                    <option value="300" >300</option>
-                </select>
+                <input type="text" maxlength="15" class="form-control" v-model="workStu.topicPoints" placeholder="话题积分" lay-verify="required" oninput="num(this)"/>
             </div>
         </div>
         <div class="form-group">

+ 2 - 2
renren-admin/src/main/resources/templates/modules/qyh/experttopic.html

@@ -44,9 +44,9 @@
                         </div>
                     </div>
 											                    <div class="form-group">
-                        <div class="col-sm-2 control-label">话题价格</div>
+                        <div class="col-sm-2 control-label">话题积分</div>
                         <div class="col-sm-10">
-                            <input type="text" class="form-control" v-model="wjxyExpertTopic.topicPrice" placeholder="话题价格"/>
+                            <input type="text" class="form-control" v-model="wjxyExpertTopic.topicPoints" placeholder="话题积分" oninput="num(this)"/>
                         </div>
                     </div>
 											                    <div class="form-group">