admin
2019-07-25 b07774086106aebcdb01fa2cc460d9c5a952d8d9
添加消息页通知大图
5个文件已修改
99 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgCommonDTO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgConfigService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserCommonMsgVO.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -834,6 +834,27 @@
            }
        }
        /**
         * 提醒大图
         */
        MsgCommonDTO notify = msgConfigService.getNotifyMsg();
        if (notify != null && notify.getShow() == true) {
            boolean read = false;
            MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
                    UserCommonMsgVO.TYPE_NOTIFY, acceptData.getDevice(),
                    acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
            if (state != null && state.getReadTime() != null
                    && zhuShouMsg.getUpdateTime().getTime() < state.getReadTime().getTime())
                read = true;
            // 查询是否已读
            UserCommonMsgVO vo = new UserCommonMsgVO(notify.getIcon(), notify.getTitle(), notify.getUpdateTime(),
                    UserCommonMsgVO.TYPE_NOTIFY, notify.getContent(), read, notify.getJumpDetail(), notify.getParams(),
                    0);
            vo.setPicture(notify.getPicture());
            root.put("notifyMsg", builder.create().toJson(vo));
        }
        root.put("list", builder.create().toJson(listCenter));
        root.put("commonList", builder.create().toJson(commonMsgList));
        root.put("count", listCenter.size());
fanli/src/main/java/com/yeshi/fanli/dto/msg/MsgCommonDTO.java
@@ -20,7 +20,16 @@
    private Date endTime;// 结束时间
    private JumpDetailV2 jumpDetail;// 跳转方式
    private String params;// 跳转参数
    private String picture;//大图
    private Date updateTime;
    public String getPicture() {
        return picture;
    }
    public void setPicture(String picture) {
        this.picture = picture;
    }
    public String getContentMd5() {
        return contentMd5;
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java
@@ -111,4 +111,46 @@
        return new Gson().fromJson(value.getValue(), MsgCommonDTO.class);
    }
    @Override
    public void addNotifyMsg(MsgCommonDTO dto) throws ConfigException {
        Config value = configService.getConfig(KEY_NOTIFY);
        if (StringUtil.isNullOrEmpty(dto.getContent()) || StringUtil.isNullOrEmpty(dto.getParams())
                || dto.getShow() == null)
            throw new ConfigException(1, "参数不完整");
        if (value != null) {
            MsgCommonDTO old = new Gson().fromJson(value.getValue(), MsgCommonDTO.class);
            old.setStartTime(dto.getStartTime());
            old.setShow(dto.getShow());
            old.setParams(dto.getParams());
            old.setEndTime(dto.getEndTime());
            old.setContent(dto.getContent());
            if (!StringUtil.Md5(dto.getContent() + "#" + dto.getPicture() + "#" + dto.getParams())
                    .equalsIgnoreCase(old.getContentMd5())) {
                old.setUpdateTime(new Date());
            }
            old.setPicture(dto.getPicture());
            Config cf = new Config();
            cf.setId(value.getId());
            cf.setValue(new Gson().toJson(old));
            configService.update(cf);
        } else {
            dto.setContentMd5(StringUtil.Md5(dto.getContent() + "#" + dto.getPicture() + "#" + dto.getParams()));
            dto.setUpdateTime(new Date());
            Config config = new Config();
            config.setCreatetime(System.currentTimeMillis() + "");
            config.setKey(KEY_NOTIFY);
            config.setName("消息-大图通知");
            config.setValue(new Gson().toJson(dto));
            configService.save(config);
        }
    }
    @Override
    public MsgCommonDTO getNotifyMsg() {
        Config value = configService.getConfig(KEY_NOTIFY);
        if (value == null)
            return null;
        return new Gson().fromJson(value.getValue(), MsgCommonDTO.class);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgConfigService.java
@@ -7,6 +7,7 @@
    public String KEY_ZHUSHOU = "msg-config-zhushou";
    public String KEY_GUANXUAN = "msg-config-guanxuan";
    public String KEY_NOTIFY = "msg-config-notify";
    /**
     * 添加小助手消息
@@ -23,6 +24,14 @@
    public void addGuanXuanMsg(MsgCommonDTO dto) throws ConfigException;
    /**
     * 添加通知大图消息
     *
     * @param dto
     * @throws ConfigException
     */
    public void addNotifyMsg(MsgCommonDTO dto) throws ConfigException;
    /**
     * 获取助手消息
     * 
     * @return
@@ -35,4 +44,12 @@
     * @return
     */
    public MsgCommonDTO getGuanXuanMsg();
    /**
     * 获取通知大图消息
     *
     * @return
     */
    public MsgCommonDTO getNotifyMsg();
}
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserCommonMsgVO.java
@@ -10,6 +10,7 @@
    public static String TYPE_ZHUSHOU = "zhushou";
    public static String TYPE_RECOMMEND = "recommend";
    public static String TYPE_SYSTEM = "system";// 系统消息
    public static String TYPE_NOTIFY = "notify";// 通知消息
    private String icon;
    private String title;
@@ -20,6 +21,7 @@
    private JumpDetailV2 jumpDetail;// 跳转详情
    private String params;// 跳转参数
    private Integer unReadCount;// 消息未读数
    private String picture;// 大图
    public UserCommonMsgVO(String icon, String title, Date time, String type, String latestMsg, Boolean read,
            JumpDetailV2 jumpDetail, String params, Integer unReadCount) {
@@ -34,6 +36,14 @@
        this.unReadCount = unReadCount;
    }
    public String getPicture() {
        return picture;
    }
    public void setPicture(String picture) {
        this.picture = picture;
    }
    public Integer getUnReadCount() {
        return unReadCount;
    }