| | |
| | | sqlSentence.sqlSentence("SELECT ot.id,ot.payTime,(SELECT COUNT(*) FROM orders_total a" + |
| | | " JOIN orders_info info2 ON info2.orderId = a.id" + |
| | | " WHERE a.isDel = 0 AND a.userId = #{m.userId} AND a.status IN(2,3,9)" + |
| | | " AND a.payTime >= ot.payTime AND a.payTime <= DATE_FORMAT(DATE_ADD(ot.payTime,INTERVAL 6 MONTH),'%Y-%m-%d 23:59:59')" + |
| | | " AND a.payStatus = 3 AND info2.isBothTheOne = 3 AND info2.snapPayTotal > 0 AND a.id != #{m.newId}) AS num" + |
| | | " FROM orders_total ot" + |
| | | " JOIN orders_info info ON info.orderId = ot.id" + |
| | |
| | | logger.info("再生俱乐部老带新复购单数量:{}",firstOrder.getNum()); |
| | | return null; |
| | | } |
| | | //判断是不是在时间内 |
| | | if(firstOrder.getPayTime().getTime() > ordersTotal.getPayTime().getTime()){ |
| | | return null; |
| | | } |
| | | Date endTime = DateUtil.addMonth(firstOrder.getPayTime(),6); |
| | | endTime = DateUtil.dayToEndDate(endTime); |
| | | if(endTime.getTime() < ordersTotal.getPayTime().getTime()){ |
| | | return null; |
| | | } |
| | | inviterPercent = 5; |
| | | } |
| | | }else{ |