chenjiahe
2024-01-29 34dfebb7b2f579f88f1c1b397aa2ddda340dd7d7
再生俱乐部提交-添加睡眠功能
2个文件已修改
70 ■■■■ 已修改文件
phi_platform_common/src/main/java/com/hx/phip/service/tool/club/UserCluebMemberServiceTool.java 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
phi_platform_common/src/main/java/com/hx/phip/service/tool/club/UserCluebMemberServiceTool.java
@@ -6,6 +6,7 @@
import com.hx.mybatisTool.SqlSentence;
import com.hx.phiappt.common.OrderItemConstants;
import com.hx.phiappt.common.OrderTotalConstants;
import com.hx.phiappt.common.RefundStatus;
import com.hx.phiappt.common.UserProjectConstants;
import com.hx.phiappt.constants.enums.ProjectRelationTypeEnum;
import com.hx.phiappt.model.cardItem.CardEquity;
@@ -16,6 +17,7 @@
import com.hx.phiappt.model.order.OrderItemSon;
import com.hx.phiappt.model.order.OrdersTotal;
import com.hx.phiappt.model.project.ProjectTypeRelation;
import com.hx.phiappt.model.refund.RefundRecord;
import com.hx.phiappt.model.user.UserCard;
import com.hx.phiappt.model.user.UserCardUsed;
import com.hx.phiappt.model.user.club.UserClubMember;
@@ -23,6 +25,8 @@
import com.hx.phip.service.club.UserClubMemberService;
import com.hx.phip.vo.club.ChekCureVo;
import com.hx.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@@ -34,6 +38,10 @@
 */
@Component
public class UserCluebMemberServiceTool {
    /**log4j日志*/
    private static Logger logger = LoggerFactory.getLogger(UserCluebMemberServiceTool.class.getName());
    @Resource
    private  CommonService commonService;
@@ -130,6 +138,29 @@
        if(ordersTotal.getPayStatus() != OrderTotalConstants.PAY_STATUS_SUC){
            return;
        }
        //退款订单状态判断,有其他原因,必须要判断是否退款完成
        int whileNum = 0;
        while (true){
            RefundRecord refundRecord = commonService.selectOneByKey(RefundRecordMapper.class,refundId);
            //退款状态是成功的
            if(refundRecord.getRefundStatus() == RefundStatus.STATUS_SUCC_REFUND){
                break;
            }
            if(whileNum < 120){
                try{
                    //睡眠5秒
                    Thread.sleep(5000);
                }catch (Exception ignored){
                }
                whileNum++;
            }else{
                //状态不对就跳出循环
                return;
            }
        }
        //查找是否有会员
        UserClubMember userClubMember = getUserClubMember(ordersTotal.getUserId(),marketType,new Date(),commonService);
@@ -242,7 +273,7 @@
        }
    }
    /**订单退款校验是否符合会员条件
    /**订单退款作废校验是否符合会员条件
     * @param orderId 订单标识
     * @param marketType 俱乐部类型,MarketSystem里面的类型
     */
@@ -262,6 +293,28 @@
        //未支付跳过
        if(ordersTotal.getPayStatus() != OrderTotalConstants.PAY_STATUS_SUC){
            return;
        }
        //退款订单状态判断,有其他原因,必须要判断是否退款完成
        int whileNum = 0;
        while (true){
            RefundRecord refundRecord = commonService.selectOneByKey(RefundRecordMapper.class,refundId);
            //退款状态是作废的
            if(refundRecord.getRefundStatus() == RefundStatus.STATUS_REFUND_CANCEL){
                break;
            }
            if(whileNum < 120){
                try{
                    //睡眠5秒
                    Thread.sleep(5000);
                }catch (Exception ignored){
                }
                whileNum++;
            }else{
                //状态不对就跳出循环
                return;
            }
        }
        //查找是否有会员
@@ -319,9 +372,8 @@
        }
        //当前订单的,总疗程数,所有的项目疗程数总和
        System.out.println("chekCureVo:");
        ChekCureVo chekCureVo = orderHandle(ordersTotal,skuNoSet,commonService);
        System.out.println("chekCureVo:"+JSON.toJSONString(chekCureVo));
        logger.info("{}俱乐部会员-订单号:{},结果:{}",marketSystem.getTitle(),ordersTotal.getOrderNo(),JSON.toJSONString(chekCureVo));
        if(!chekCureVo.isCureProject()){
            //订单没有参与规则
            return RESULT_NOT_JOIN;
@@ -415,7 +467,6 @@
                    chekCureVo.setCureNum(chekCureVo.getCureNum()+orderItem.getUsedTotal()-orderItem.getHasReNum());
                    chekCureVo.setCureProject(true);
                }
                System.out.println("项目:"+chekCureVo.getCureNum());
            }else if(OrderItemConstants.TYPE_PROMOTION.equals(orderItem.getType())){
                //---促销
                orderItemSonList = getOrderItemSonList(orderItem.getId(),OrderItemConstants.TYPE_PROJECT,commonService);
@@ -426,11 +477,9 @@
                        chekCureVo.setCureProject(true);
                    }
                }
                System.out.println("促销:"+chekCureVo.getCureNum());
            }else if(OrderItemConstants.TYPE_CARD.equals(orderItem.getType())){
                //---卡项,注意,不是卡包
                chekCureVo = handleCard(chekCureVo,orderItem,skuNoSet,commonService);
                System.out.println("卡项:"+chekCureVo.getCureNum());
            }
        }
        return chekCureVo;
@@ -495,7 +544,6 @@
        //存储已经算过的条目
        Set<String> NMSet;
        for(UserCard userCard:userCardList){
            System.out.println("userCard.getEffectiveStatus():"+userCard.getEffectiveStatus());
            //获取已退款的卡项条目次数
            values.clear();
            values.put("sourceType", UserCardUsed.SOURCE_TYPE_USER_CARD_REFUND);
phi_platform_user/src/main/java/com/hx/phip/service/order/impl/OrderRefundServiceImpl.java
@@ -1809,10 +1809,6 @@
        if(StringUtils.noNull(refundRecord.getOrderId())){
            RefundRecord finalRefundRecord = refundRecord;
            OrderControllerV2.threadPool.getThreadPool().execute(() ->{
                try{
                    Thread.sleep(5000);
                }catch (Exception ignored){
                }
                userCluebMemberServiceTool.refundChekMember(finalRefundRecord.getOrderId(),null, finalRefundRecord.getId(), MarketSystem.TYPE_REGENERATION);
            });
        }
@@ -2804,10 +2800,6 @@
        //俱乐部会员
        OrderControllerV2.threadPool.getThreadPool().execute(() ->{
            try{
                Thread.sleep(5000);
            }catch (Exception ignored){
            }
            userCluebMemberServiceTool.refundCancelChekMember(ordersTotal.getId(),null, refundRecord.getId(), MarketSystem.TYPE_REGENERATION);
        });