| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | */ |
| | | @Component |
| | | public class UserCluebMemberServiceTool { |
| | | |
| | | /**log4j日志*/ |
| | | private static Logger logger = LoggerFactory.getLogger(UserCluebMemberServiceTool.class.getName()); |
| | | |
| | | |
| | | @Resource |
| | | private CommonService commonService; |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | /**订单退款校验是否符合会员条件 |
| | | /**订单退款作废校验是否符合会员条件 |
| | | * @param orderId 订单标识 |
| | | * @param marketType 俱乐部类型,MarketSystem里面的类型 |
| | | */ |
| | |
| | | //未支付跳过 |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | //查找是否有会员 |
| | |
| | | } |
| | | |
| | | //当前订单的,总疗程数,所有的项目疗程数总和 |
| | | 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; |
| | |
| | | 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); |
| | |
| | | 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; |
| | |
| | | //存储已经算过的条目 |
| | | 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); |