| | |
| | | import com.yeshi.fanli.dao.mybatis.MoneyRecordMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserConnectHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
|
| | | import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.LoginResult;
|
| | | import com.yeshi.fanli.entity.bus.user.MoneyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserConnectHistoryMapper userConnectHistoryMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMapper hongBaoMapper;
|
| | |
|
| | | @Resource
|
| | | private OrderMapper orderMapper;
|
| | |
| | | userInfoMapper.connectUser(mainUser.getId(), lessUser.getId());
|
| | |
|
| | | // 查询是否有多余的新人红包
|
| | | List<HongBao> list = hongBaoMapper.selectByUidAndType(mainUser.getId(), HongBao.TYPE_XINREN);
|
| | | int subCount = 0;
|
| | | int addCount = 0;
|
| | | for (HongBao hb : list) {
|
| | | if (hb.getMoney().compareTo(new BigDecimal(0)) > 0)
|
| | | addCount++;
|
| | | if (hb.getMoney().compareTo(new BigDecimal(0)) < 0)
|
| | | subCount++;
|
| | | }
|
| | |
|
| | | // 有2个或者2个以上的新人红包
|
| | | if (addCount - subCount > 1) {
|
| | | // 扣除一个新人红包
|
| | | // TODO 扣除新人红包操作
|
| | |
|
| | | AccountMessage accountMessage = new AccountMessage();
|
| | | accountMessage.setContent(" 账号合并扣除重复新人红包" + list.get(1).getMoney().toString() + "元");
|
| | | accountMessage.setCreateTime(System.currentTimeMillis());
|
| | | accountMessage.setIsOpen(false);
|
| | | accountMessage.setSystemMsgId(0);
|
| | | accountMessage.setTitle(" 账号合并扣除重复新人红包");
|
| | | accountMessage.setUserInfo(mainUser);
|
| | | accountMessageMapper.insertSelective(accountMessage);
|
| | |
|
| | | userInfoMapper.subHongBaoByUid(mainUser.getId(), list.get(1).getMoney());
|
| | |
|
| | | HongBao hongBao = new HongBao(mainUser, new BigDecimal(0).subtract(list.get(1).getMoney()), null,
|
| | | HongBao.TYPE_XINREN, HongBao.STATE_YILINGQU, System.currentTimeMillis(), System.currentTimeMillis(),
|
| | | System.currentTimeMillis(), null, "账号合并扣除");
|
| | |
|
| | | hongBaoMapper.insertSelective(hongBao);
|
| | |
|
| | | MoneyRecord moneyRecord = new MoneyRecord(mainUser, hongBao, list.get(1).getMoney(), "账号合并扣除重复新人红包", "账号合并",
|
| | | System.currentTimeMillis(), 2);
|
| | | moneyRecordMapper.insertSelective(moneyRecord);
|
| | | }
|
| | |
|
| | | userAccountMsgNotificationService.connectSuccess(mainUser.getId(), lessUser.getId());
|
| | | }
|
| | |
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | |
|
| | | // TODO 备份资金明细
|
| | | // 备份红包信息
|
| | | List<HongBao> hongBaoList = hongBaoMapper.selectByUid(uid);
|
| | | // 备份订单,子订单信息
|
| | | List<Order> orderList = orderMapper.selectByUid(uid);
|
| | | List<OrderItem> orderItemList = orderItemMapper.selectByUid(uid);
|
| | |
| | |
|
| | | fw.write("#UserInfo" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(user) + "\r\n");
|
| | |
|
| | | fw.write("#HongBao" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(hongBaoList) + "\r\n");
|
| | |
|
| | | fw.write("#Order" + "\r\n");
|
| | | fw.write(JsonUtil.getSimpleGsonWithDate().toJson(orderList) + "\r\n");
|