| | |
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinRecord;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinReport;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinReportService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinRecordService userTaoLiJinRecordService;
|
| | | |
| | | @Resource
|
| | | private UserTaoLiJinReportService userTaoLiJinReportService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | BigDecimal total = new BigDecimal(0);
|
| | | for (UserTaoLiJinOrigin userTaoLiJinOrigin: list) {
|
| | | |
| | | UserTaoLiJinOrigin origin = new UserTaoLiJinOrigin();
|
| | | origin.setId(userTaoLiJinOrigin.getId());
|
| | | origin.setMoneySurplus(new BigDecimal(0));
|
| | | origin.setUpdateTime(new Date());
|
| | | userTaoLiJinOriginMapper.updateByPrimaryKeySelective(origin);
|
| | |
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd hh.mm");
|
| | | String time = sd.format(userTaoLiJinOrigin.getCreateTime());
|
| | | if (origin.getOrigin().equals(TaoLiJinOriginEnum.refund)) {
|
| | | String rightsId = userTaoLiJinOrigin.getRightsId();
|
| | | UserTaoLiJinReport report = userTaoLiJinReportService.selectByPrimaryKey(rightsId);
|
| | | Date shareTime = null;
|
| | | if (report == null) {
|
| | | shareTime = date;
|
| | | } else {
|
| | | shareTime = report.getCreateTime();
|
| | | }
|
| | | |
| | | // 消息
|
| | | MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
|
| | | content.setState("红包收回");
|
| | | content.setSource("于["+ sd.format(shareTime) + "]创建的分享未被领取部分");
|
| | | content.setTimeDesc("退回于" + time);
|
| | | content.setMoney(userTaoLiJinOrigin.getMoneySurplus());
|
| | | content.setReason("本笔退回推广红包从退回日起至今并未产生分享记录");
|
| | | content.setResult("长期未使用收回");
|
| | | userOtherMsgNotificationService.taoLiJinMsg(uid, "如有疑问请联系人工客服", content);
|
| | | |
| | | } else {
|
| | | // 消息
|
| | | MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
|
| | | content.setState("红包收回");
|
| | | content.setSource(origin.getOrigin().getDesc());
|
| | | content.setTimeDesc("获得于" + time);
|
| | | content.setMoney(userTaoLiJinOrigin.getMoneySurplus());
|
| | | content.setReason("本笔推广红包从获得日起至今并未产生分享记录");
|
| | | content.setResult("长期未使用收回");
|
| | | userOtherMsgNotificationService.taoLiJinMsg(uid, "如有疑问请联系人工客服", content);
|
| | | }
|
| | | |
| | | |
| | | total = MoneyBigDecimalUtil.add(total, userTaoLiJinOrigin.getMoneySurplus());
|
| | | }
|
| | | |
| | | // 用户剩余淘礼金
|
| | | UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
|
| | | if (userMoneyExtra == null || userMoneyExtra.getTlj() == null) {
|
| | | return;
|
| | | }
|
| | | |
| | | UserMoneyExtra updateExtra = new UserMoneyExtra();
|
| | | updateExtra.setUid(uid);
|
| | | |
| | | BigDecimal tljSelf = userMoneyExtra.getTljSelf();
|
| | | if (tljSelf != null && tljSelf.compareTo(new BigDecimal(0)) > 0) { // 剩余淘礼金-- 自购
|
| | | BigDecimal sub = MoneyBigDecimalUtil.sub(tljSelf, total);
|
| | | if (sub.compareTo(new BigDecimal(0)) > 0) {
|
| | | updateExtra.setTljSelf(sub);
|
| | | } else {
|
| | | updateExtra.setTljSelf(new BigDecimal(0));
|
| | | }
|
| | | } |
| | | updateExtra.setTlj(MoneyBigDecimalUtil.sub(userMoneyExtra.getTlj(), total));
|
| | | updateExtra.setUpdateTime(new Date());
|
| | | userMoneyExtraService.updateByPrimaryKeySelective(updateExtra);
|
| | | |
| | |
|
| | | // 插入明细
|
| | | UserTaoLiJinDetail detail = new UserTaoLiJinDetail();
|
| | |
| | | detail.setMoney(new BigDecimal("-" + total.toString()));
|
| | | detail.setTitle(TaoLiJinDetailTypeEnum.sendBack.getDesc());
|
| | | detail.setType(TaoLiJinDetailTypeEnum.sendBack);
|
| | | detail.setCreateTime(date);
|
| | | detail.setCreateTime(new Date());
|
| | | userTaoLiJinDetailService.insertSelective(detail);
|
| | | |
| | | // 消息
|
| | | final BigDecimal totalMoney = total;
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | MsgOtherTaoLiJinContentDTO content = new MsgOtherTaoLiJinContentDTO();
|
| | | content.setState("红包扣除");
|
| | | content.setSource("15天内未产生过推广红包分享记录");
|
| | | content.setMoney(totalMoney);
|
| | | userOtherMsgNotificationService.taoLiJinMsg(uid, "清除后无法恢复", content);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @Override
|