yujian
2019-11-23 8ba58b43d48b81733dbe5e4c9894e3c919a049bf
红包封禁消息
6个文件已修改
61 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/aspect/LoginAspect.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/MsgMoneyDetailServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/UserMoneyMsgNotificationServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackForbidServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/aspect/LoginAspect.java
@@ -35,7 +35,7 @@
    @Resource
    private AdminUserService adminUserService;
//    @Around("execution(public * com.yeshi.fanli.controller.admin.*.*(..))")
    @Around("execution(public * com.yeshi.fanli.controller.admin.*.*(..))")
    public Object verifyLoginState(ProceedingJoinPoint joinPoint) throws IOException {
        Signature signature = joinPoint.getSignature();
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java
@@ -41,7 +41,8 @@
        redPackTwoStageReward("第二阶段-递增奖励-好友完成订单"),
        redPackThreeStageReward("第三阶段-连续奖励-好友完成订单"),
        redPackUseSuccess("红包使用成功"),
        redPackUseFail("红包使用失败");
        redPackUseFail("红包使用失败"),
        redPackForbid("红包功能封禁");
        private final String desc;
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/MsgMoneyDetailServiceImpl.java
@@ -135,7 +135,8 @@
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackTwoStageReward
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackThreeStageReward
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseFail
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseSuccess) {
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackUseSuccess
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.redPackForbid) {
            if (detail.getUser() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
fanli/src/main/java/com/yeshi/fanli/service/impl/money/msg/UserMoneyMsgNotificationServiceImpl.java
@@ -318,8 +318,7 @@
    @Override
    public void inviteOrderSubSidy(Long uid, Date date, String from, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteOrderSubSidyMsg(uid, date, from, money, balance,
                null);
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteOrderSubSidyMsg(uid, date, from, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackForbidServiceImpl.java
@@ -10,13 +10,17 @@
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;
@@ -34,6 +38,10 @@
    @Resource
    private RedPackBalanceService redPackBalanceService;
    
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void addForbid(RedPackForbidRecord record) throws RedPackForbidException {
@@ -45,17 +53,23 @@
        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,"封禁时间类型不正确");
@@ -88,6 +102,13 @@
        } catch (RedPackDetailException e) {
            throw new RedPackForbidException(1, e.getMsg());
        }
        //消息
        MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
        dto.setTime(time);
        dto.setReason("红包产生、使用、赠送环节涉嫌违规");
        dto.setHandle("清空所有红包余额");
        userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackForbid, new Gson().toJson(dto), "封禁信息无法申诉,请按照规则使用红包功能");
    }
    
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -741,6 +741,35 @@
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_hongbao_tixian.png", dto.getTitle(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackForbid) { // 红包封禁消息
            if (StringUtil.isNullOrEmpty(msg.getContent()))
                return null;
            MsgRedPackExchangeContentDTO dto = new Gson().fromJson(msg.getContent(),
                    MsgRedPackExchangeContentDTO.class);
            if (dto == null)
                return null;
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getReason() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("原因", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getTime() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("封禁时间", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(dto.getHandle(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("处理", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/img/tlj/icon_tlj.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackOneStageReward
                || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackTwoStageReward
                || msg.getMsgType() == MsgTypeMoneyTypeEnum.redPackThreeStageReward) { // 红包邀请获得