| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.DateUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dao.mybatis.redpack.RedPackForbidMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackExchangeContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackBalance;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackForbid;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackForbidRecord;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackDetailException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackForbidException;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackBalanceService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackForbidRecordService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
|
| | |
| | | @Resource
|
| | | private RedPackBalanceService redPackBalanceService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | | |
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void addForbid(RedPackForbidRecord record) throws RedPackForbidException {
|
| | |
| | | if (type == null)
|
| | | throw new RedPackForbidException(1,"封禁时间不能为空");
|
| | |
|
| | | String time = null;
|
| | | Date endTime = null;
|
| | | Date nowTime = new Date();
|
| | | if (type == RedPackForbidRecord.TYPE_ONE_MONTH) {
|
| | | time = "1个月";
|
| | | endTime = DateUtil.plusMonths(nowTime, 1);
|
| | | } else if (type == RedPackForbidRecord.TYPE_THREE_MONTH) {
|
| | | time = "3个月";
|
| | | endTime = DateUtil.plusMonths(nowTime, 3);
|
| | | } else if (type == RedPackForbidRecord.TYPE_SIX_MONTH) {
|
| | | time = "半年";
|
| | | endTime = DateUtil.plusMonths(nowTime, 6);
|
| | | } else if (type == RedPackForbidRecord.TYPE_ONE_YEAR) {
|
| | | time = "1年";
|
| | | endTime = DateUtil.plusYears(nowTime, 1);
|
| | | } else if (type == RedPackForbidRecord.TYPE_HUNDRED_YEAR) {
|
| | | time = "永久";
|
| | | endTime = DateUtil.plusYears(nowTime, 100);
|
| | | } else {
|
| | | throw new RedPackForbidException(1,"封禁时间类型不正确");
|
| | |
| | | } catch (RedPackDetailException e) {
|
| | | throw new RedPackForbidException(1, e.getMsg());
|
| | | }
|
| | | |
| | | //消息
|
| | | MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
|
| | | dto.setTime(time);
|
| | | dto.setReason("红包产生、使用、赠送环节涉嫌违规");
|
| | | dto.setHandle("清空所有红包余额");
|
| | | userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackForbid, new Gson().toJson(dto), "封禁无法申诉,请按照规则使用红包功能");
|
| | | }
|
| | |
|
| | |
|
| | |
| | | } catch (RedPackDetailException e) {
|
| | | throw new RedPackForbidException(1, e.getMsg());
|
| | | }
|
| | | |
| | | //消息
|
| | | MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
|
| | | dto.setBalance(redPackBalanceService.getBalance(uid).setScale(2).toString());
|
| | | dto.setMoney(money.setScale(2).toString());
|
| | | dto.setReason("红包产生、使用、赠送环节涉嫌违规");
|
| | | userMoneyMsgNotificationService.redPackMsg(uid, MsgTypeMoneyTypeEnum.redPackDeduct, new Gson().toJson(dto), "扣除金额无法申诉,请按照规则获得红包");
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void delete(List<Long> idsList) {
|
| | | if (idsList != null)
|
| | | for (Long id : idsList)
|
| | | for (Long id : idsList) {
|
| | | redPackForbidMapper.deleteByPrimaryKey(id);
|
| | | //消息
|
| | | MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
|
| | | dto.setReason("封禁时间到期,自动解封");
|
| | | dto.setTime("已可以重新使用红包功能");
|
| | | dto.setHandle("已被清空");
|
| | | userMoneyMsgNotificationService.redPackMsg(id, MsgTypeMoneyTypeEnum.redPackForbidRemove, |
| | | new Gson().toJson(dto), null);
|
| | | }
|
| | |
|
| | | }
|
| | |
|