| | |
| | | @Resource
|
| | | private BindRemindService bindRemindService;
|
| | |
|
| | | @Resource |
| | | @Resource
|
| | | private RedPackBalanceService redPackBalanceService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | | @Resource
|
| | | private RedPackForbidService redPackForbidService;
|
| | |
|
| | |
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | * @return |
| | | */ |
| | | Long countInviteOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state, |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate,@Param("orderType") int orderType); |
| | | |
| | | /** |
| | | * 根据用户ID,订单状态和结算时间统计分享赚的订单数量 |
| | |
| | | * @return |
| | | */ |
| | | Long countShareOrderCountByUidAndSettleTime(@Param("uid") Long uid, @Param("state") int state, |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate); |
| | | @Param("minDate") Date minDate, @Param("maxDate") Date maxDate,@Param("orderType") Integer orderType); |
| | | |
| | | /** |
| | | * 通过用户ID和状态查询数量 |
| | |
| | | h.`hb_uid`=#{uid} and (h.`hb_type`=6 or h.`hb_type`=7 OR
|
| | | h.`hb_type`=21 OR h.`hb_type`=22) and co.`co_state`=#{state} and
|
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate}
|
| | | and #{maxDate}>co.`co_settle_time`;
|
| | | and #{maxDate}>co.`co_settle_time` and hb_order_type=#{orderType};
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` WHERE
|
| | | h.`hb_uid`=#{uid} and h.`hb_type`=20 and co.`co_state`=#{state} and
|
| | | co.`co_settle_time` is not null and co.`co_settle_time`>=#{minDate}
|
| | | and #{maxDate}>co.`co_settle_time`;
|
| | | and #{maxDate}>co.`co_settle_time` and hb_order_type=#{orderType};
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | | #{date} order by d.`umd_createtime` desc,d.umd_id desc limit #{count}
|
| | | </select>
|
| | | <select id="selectCountByUidAndMaxCreateTime" resultType="java.lang.Long">SELECT
|
| | | count(umd_id) FROM yeshi_ec_user_money_detail where umd_uid=#{uid} and d.umd_show=1 and
|
| | | count(umd_id) FROM yeshi_ec_user_money_detail where umd_uid=#{uid} and umd_show=1 and
|
| | | `umd_createtime`<![CDATA[
|
| | | <=
|
| | | ]]>
|
| | |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type} |
| | | </select> |
| | | |
| | | <select id="getByUidAndTeamUidAndType" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_red_pack_win_invite d |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type} |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getByUidAndTeamUidAndTypeMonth" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_red_pack_win_invite d |
| | | WHERE d.`rwr_uid` = #{uid} AND d.`rwr_team_uid` = #{teamUid} AND d.`rwr_type` = #{type} |
| | | AND DATE_FORMAT(d.rwr_create_time,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m') |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | <select id="getByUidAndTeamUidAndType" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_red_pack_win_invite d |
| | |
| | | if (oldHongBao == null)
|
| | | throw new HongBaoException(10, "红包对象不存在");
|
| | | // 已经失效,已经领取,新老状态一致的红包不做处理
|
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO||oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | return false;
|
| | |
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null && children.size() > 0)
|
| | | for (HongBaoV2 child : children) {
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | continue;
|
| | |
|
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId());
|
| | | childUpdate.setState(hongBao.getState());
|
| | | childUpdate.setUpdateTime(new Date());
|
| | |
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (children != null)
|
| | | for (HongBaoV2 child : children) {
|
| | | if (child.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | continue;
|
| | |
|
| | | HongBaoV2 childUpdate = new HongBaoV2(child.getId());
|
| | | // 统一设置状态
|
| | | childUpdate.setState(hongBao.getState());
|
| | |
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual,
|
| | | mqMsg);
|
| | | sourceType, null, null, new Date(), 0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date(),0);
|
| | | sourceType, null, null, new Date(), 0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | |
| | |
|
| | | // 邀请赚到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_INVITE, uid,
|
| | | sourceType, null, null, new Date(),0);
|
| | | sourceType, null, null, new Date(), 0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER,OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid, sourceType,
|
| | | null, null, new Date(), 0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date(),0);
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid, sourceType,
|
| | | null, null, new Date(), 0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | |
| | | hongBaoList.addAll(tempHongBaoList);
|
| | | }
|
| | |
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid,
|
| | | sourceType, null, null, new Date(),0);
|
| | | Message msg =MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_SHARE, uid, sourceType,
|
| | | null, null, new Date(), 0);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String taskKey = getTaskKey(uid);
|
| | | msg.setKey(taskKey);
|
| | | // 添加事务消息
|
| | |
| | | Date minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | long validCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_JS,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, Constant.SOURCE_TYPE_TAOBAO);
|
| | | long weiQuanCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_WQ,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInvite(uid, Constant.SOURCE_TYPE_TAOBAO,
|
| | | (int) validCount, (int) weiQuanCount, invitemoney, new Date());
|
| | |
| | | Date minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | long validCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_JS,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, sourceType);
|
| | | long weiQuanCount = hongBaoV2Mapper.countInviteOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_WQ,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, sourceType);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInvite(uid, sourceType, (int) validCount,
|
| | | (int) weiQuanCount, invitemoney, new Date());
|
| | |
| | | Date minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | long validCount = hongBaoV2Mapper.countShareOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_JS,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, Constant.SOURCE_TYPE_TAOBAO);
|
| | | long weiQuanCount = hongBaoV2Mapper.countShareOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_WQ,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, Constant.SOURCE_TYPE_TAOBAO,
|
| | | (int) validCount, (int) weiQuanCount, sharemoney, new Date());
|
| | |
| | | Date minDate = new Date(TimeUtil
|
| | | .convertToTimeTemp(ca.get(Calendar.YEAR) + "-" + (ca.get(Calendar.MONTH) + 1), "yyyy-M"));
|
| | | long validCount = hongBaoV2Mapper.countShareOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_JS,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, sourceType);
|
| | | long weiQuanCount = hongBaoV2Mapper.countShareOrderCountByUidAndSettleTime(uid, CommonOrder.STATE_WQ,
|
| | | minDate, maxDate);
|
| | | minDate, maxDate, sourceType);
|
| | |
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, Constant.SOURCE_TYPE_TAOBAO,
|
| | | (int) validCount, (int) weiQuanCount, sharemoney, new Date());
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, sourceType, (int) validCount,
|
| | | (int) weiQuanCount, sharemoney, new Date());
|
| | | // 添加资金
|
| | | userMoneyService.addUserMoney(uid, sharemoney, userMoneyDetail);
|
| | |
|
| | |
| | | // 自购到账事务消息
|
| | | OrderMoneyRecievedMQMsg mqMsg = new OrderMoneyRecievedMQMsg(OrderMoneyRecievedMQMsg.TYPE_ZIGOU,
|
| | | mainUser.getId(), hongBaoOrder.getCommonOrder().getSourceType(),
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date(),0);
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), null, new Date(), 0);
|
| | | mqMsg.setOrderFirst(first);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual,
|
| | | mqMsg);
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderFanLiActual, mqMsg);
|
| | | String key = mainUser.getId() + "-" + UUID.randomUUID().toString();
|
| | | msg.setKey(key);
|
| | | try {
|
| | |
| | | List<Long> inviteAndShareUids = hongBaoV2Mapper.listUidCanBanlanceShareAndInvite(1000);
|
| | | Set<Long> uidSets = new HashSet<>();
|
| | | if (inviteAndShareUids != null)
|
| | | for (Long uid : inviteAndShareUids)
|
| | | uidSets.add(uid);
|
| | | for (Long uid : inviteAndShareUids) {
|
| | | if (userInfoMapper.selectAvailableByPrimaryKey(uid) != null)
|
| | | uidSets.add(uid);
|
| | | }
|
| | | // 根据用户ID
|
| | | Iterator<Long> its = uidSets.iterator();
|
| | | while (its.hasNext()) {
|
| | |
| | | } catch (OrderMoneySettleException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | if (1 > 0)
|
| | | return;
|
| | |
|
| | | //
|
| | | try {
|
| | | orderMoneySettleService.inviteSettleJD(uid);
|
| | | } catch (OrderMoneySettleException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | //
|
| | | try {
|
| | | orderMoneySettleService.inviteSettlePDD(uid);
|
| | | } catch (OrderMoneySettleException e) {
|
| | |
| | | } catch (OrderMoneySettleException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | //
|
| | | try {
|
| | | orderMoneySettleService.shareSettlePDD(uid);
|
| | | } catch (OrderMoneySettleException e) {
|
| | |
| | | }
|
| | | if (resultCode == 1) {// 只发送新增消息
|
| | | OrderMQMsg mqMsg = new OrderMQMsg(orderId, sourceType, uid, OrderMQMsg.HANDLE_TYPE_ADD,
|
| | | isCommonOrderValid(coList),0,new Date());
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic,
|
| | | mqMsg);
|
| | | isCommonOrderValid(coList), 0, new Date());
|
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderStatistic, mqMsg);
|
| | | producer.send(msg);
|
| | | }
|
| | | }
|
| | |
| | | import org.yeshi.utils.mail.ShowMail;
|
| | |
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | |
| | | String content = null;
|
| | |
|
| | | String columnName = firstRow.getCell(c).getStringCellValue().trim();
|
| | | if (cell == null)
|
| | | continue;
|
| | | if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
|
| | | if (HSSFDateUtil.isCellDateFormatted(cell)) { // 判断日期类型
|
| | | Date date = cell.getDateCellValue();
|
| | | content = TimeUtil.getGernalTime(date.getTime(), "yyyy-MM-dd");
|
| | | } else { // 否
|
| | | content = cell.getNumericCellValue() + "";
|
| | | content = cell.getNumericCellValue() + "";
|
| | | }
|
| | |
|
| | | } else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
|
| | |
| | | }
|
| | | switch (columnName) {
|
| | | case "渠道号":
|
| | | order.setChannelId(new BigDecimal(content).longValue()+"");
|
| | | order.setChannelId(new BigDecimal(content).longValue() + "");
|
| | | break;
|
| | | case "渠道名称":
|
| | | order.setChannelName(content);
|
| | |
| | | order.setTrackPid(content);
|
| | | break;
|
| | | case "rid":
|
| | | order.setRid(new BigDecimal(content).longValue()+"");
|
| | | order.setRid(new BigDecimal(content).longValue() + "");
|
| | | break;
|
| | | case "订单日期":
|
| | | order.setOrderDate(new Date(TimeUtil.convertToTimeTemp(content, "yyyy-MM-dd")));
|
| | |
| | | for (int i = list.size() - 1; i >= 0; i--) {
|
| | | ShowMail showMail = new ShowMail((MimeMessage) list.get(i));
|
| | | if ("qiuming.wu<qiuming.wu@ele.me>".equalsIgnoreCase(showMail.getFrom())) {
|
| | | if (count++ > 4)
|
| | | if (count++ > 5)
|
| | | break;
|
| | | boolean attch = showMail.isContainAttach((Part) list.get(i));
|
| | | if (attch) {
|
| | | List<InputStream> attchList = showMail.saveAttachMent((Part) list.get(i));
|
| | | if (attchList.size() > 0) {
|
| | | List<ElmeOrder> orderList = ElmeOrderUtil.parseOrder(attchList.get(0));
|
| | | if (orderList != null && orderList.size() > 0)
|
| | | totalOrderList.addAll(orderList);
|
| | | try {
|
| | | boolean attch = showMail.isContainAttach((Part) list.get(i));
|
| | | if (attch) {
|
| | | List<InputStream> attchList = showMail.saveAttachMent((Part) list.get(i));
|
| | | if (attchList.size() > 0) {
|
| | | List<ElmeOrder> orderList = ElmeOrderUtil.parseOrder(attchList.get(0));
|
| | | if (orderList != null && orderList.size() > 0)
|
| | | totalOrderList.addAll(orderList);
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return totalOrderList;
|
| | | }
|
| | |
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.share.name() + "-" + uid + "-" + timeF));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.share.name() + "-" + orderType + "-" + uid + "-" + timeF));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.share.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.share);
|
| | |
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.invite.name() + "-" + uid + "-" + timeF));
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.invite.name() + "-" + orderType + "-" + uid + "-" + timeF));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.invite.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.invite);
|