admin
2019-06-10 6b8ab82d1d7fb9d44d85eeb1dfd2e36d3c28c9cf
客服消息修改,新版大淘客数据添加
13个文件已修改
317 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgDeviceReadState.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgDeviceReadStateServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgDeviceReadStateService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserCommonMsgVO.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/CallBackController.java
@@ -1,12 +1,27 @@
package com.yeshi.fanli.controller;
import java.io.BufferedReader;
import java.io.IOException;
import java.security.SignatureException;
import java.util.Map;
import javax.annotation.Resource;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
import net.sf.json.JSONObject;
/**
 * 授权回调
 *
 * 
 * @author Administrator
 *
@@ -14,6 +29,9 @@
@Controller
@RequestMapping("client/v1/callback")
public class CallBackController {
    @Resource
    private MsgDeviceReadStateService msgDeviceReadStateService;
    /**
     * 客服消息回调
@@ -25,4 +43,75 @@
    }
    /**
     * 美洽消息回调
     *
     * @param response
     */
    @RequestMapping(value = "meiQia")
    public void meiQia(HttpServletRequest request, HttpServletResponse response) {
        String auth = request.getHeader("Authorization");
        String queryString = request.getQueryString();
        LogHelper.test("美洽:queryString-" + queryString + "-auth:" + auth);
        BufferedReader br = null;
        StringBuilder sb = new StringBuilder("");
        try {
            br = request.getReader();
            String str;
            while ((str = br.readLine()) != null) {
                sb.append(str);
            }
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        String sign = "";
        try {
            sign = sign(sb.toString());
        } catch (SignatureException e) {
            e.printStackTrace();
        }
        if (!auth.equalsIgnoreCase(sign)) {
            LogHelper.test("美洽回调签名错误");
            return;
        }
        JSONObject json = JSONObject.fromObject(sb.toString());
        String msg = "";
        if (json != null) {
            String deviceOS = json.optString("deviceOS");
            String contentType = json.optString("contentType");
            if (contentType.equalsIgnoreCase("text"))
                msg = json.optString("content");
            else if (contentType.equalsIgnoreCase("photo"))
                msg = "[图片]";
            else if (contentType.equalsIgnoreCase("audio"))
                msg = "[语音]";
            String customizedId = json.optJSONObject("customizedData").optString("设备标识");
            msgDeviceReadStateService.addUnreadDeviceMsg(MsgDeviceReadState.TYPE_KEFU, customizedId,
                    "android".equalsIgnoreCase(deviceOS) ? 1 : 2, 1, msg);
        }
        LogHelper.test("美洽:body----" + sb.toString());
    }
    public String sign(String raw_body) throws java.security.SignatureException {
        String key = "$2a$12$uC3EG/zSaSI37KKOgt1IgetDRHJY6Q2zEVDBr0DeWcwQbGNU7pewy";
        String result = "";
        try {
            SecretKeySpec signingKey = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA1");
            Mac mac = Mac.getInstance("HmacSHA1");
            mac.init(signingKey);
            byte[] rawHmac = mac.doFinal(raw_body.getBytes("UTF-8"));
            byte[] hexBytes = new org.apache.commons.codec.binary.Hex().encode(rawHmac);
            result = org.apache.commons.codec.binary.Base64.encodeBase64String(hexBytes).trim();
        } catch (Exception e) {
            throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
        }
        return "meiqia_sign:" + result;
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java
@@ -12,16 +12,19 @@
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
import com.yeshi.fanli.entity.config.AppHomeFloatImg;
import com.yeshi.fanli.entity.taobao.ClientTBPid;
import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.homemodule.FloatADService;
import com.yeshi.fanli.service.inter.msg.MsgDeviceReadStateService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.user.TBPidService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
import net.sf.json.JSONObject;
@@ -52,6 +55,9 @@
    @Resource
    private JumpDetailV2Service jumpDetailV2Service;
    @Resource
    private MsgDeviceReadStateService msgDeviceReadStateService;
    /**
     * 首页配置信息
@@ -259,6 +265,15 @@
        JSONObject data = new JSONObject();
        data.put("meiqia", "1".equalsIgnoreCase(configService.get("kefu_meiqia")) ? true : false);// 是否跳转美洽,不跳转美洽就用原来的
        out.print(JsonUtil.loadTrueResult(data));
        // 设置消息已读
        ThreadUtil.run(new Runnable() {
            @Override
            public void run() {
                msgDeviceReadStateService.setDeviceMsgRead(MsgDeviceReadState.TYPE_KEFU, acceptData.getDevice(),
                        "android".equalsIgnoreCase(acceptData.getPlatform()) ? 1 : 2);
            }
        });
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SearchController.java
@@ -4,10 +4,8 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
@@ -17,10 +15,12 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TaoBaoAuthUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yeshi.fanli.dto.dataoke.DaTaoKeGoodsResult;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.lable.QualityFactory;
import com.yeshi.fanli.entity.bus.recommend.Honest;
@@ -36,6 +36,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
@@ -50,6 +51,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
import com.yeshi.fanli.util.taobao.SearchFilterUtil;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
@@ -456,7 +458,9 @@
            data = searchGoods(kw, page, filter, order, startprice, endprice);
        } else {
            // 推荐:精选库
            data = searchQualityGoods(kw, page, filter, order, startprice, endprice);
            // data = searchQualityGoods(kw, page, filter, order, startprice,
            // endprice);
            data = searchDaTaoKeGoods(kw, page, filter, order, startprice, endprice);
        }
        // 获取推荐词
@@ -661,7 +665,7 @@
            if (daTaoKeList != null && daTaoKeList.size() > 0) {
                Collections.reverse(daTaoKeList);
                for (DaTaoKeDetail detail : daTaoKeList) {
                    taoBaoGoodsBriefs.add(0,TaoBaoUtil.convert(detail));
                    taoBaoGoodsBriefs.add(0, TaoBaoUtil.convert(detail));
                }
            }
        } catch (Exception e) {
@@ -930,6 +934,43 @@
        return data;
    }
    private JSONObject searchDaTaoKeGoods(String key, int page, String filter, String order, String startprice,
            String endprice) {
        page=page+1;
        int sort = DaTaoKeApiUtil.SORT_DEFAULT;
        if ("5".equalsIgnoreCase(order)) {
            sort = DaTaoKeApiUtil.SORT_COMMISSION;
        } else if ("1".equalsIgnoreCase(order)) {
            sort = DaTaoKeApiUtil.SORT_SALES;
        } else if ("2".equalsIgnoreCase(order)) {
            sort = DaTaoKeApiUtil.SORT_PRICE_HIGH_TO_LOW;
        } else if ("3".equalsIgnoreCase(order)) {
            sort = DaTaoKeApiUtil.SORT_PRICE_LOW_TO_HIGH;
        }
        List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
        BigDecimal proportion = manageService.getFanLiRate();
        DaTaoKeGoodsResult result = DaTaoKeApiUtil.search(key, null, page, 20, sort);
        if (result != null && result.getGoodsList() != null)
            for (DaTaoKeDetailV2 goods : result.getGoodsList()) {
                listExtra.add(
                        TaoBaoUtil.getTaoBaoGoodsBriefExtra(TaoBaoUtil.convert(goods), proportion.toString(), null));
            }
        List<TaoBaoSearchNav> navList = new ArrayList<>();
        Gson gson = new GsonBuilder().create();
        Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                .excludeFieldsWithoutExposeAnnotation().create();
        JSONObject data = new JSONObject();
        data.put("nav", gson.toJson(navList));
        data.put("result", gson2.toJson(listExtra));
        data.put("count", result.getTotalCount());
        return data;
    }
    /**
     * 设置查询佣金比例范围
     * 
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserMsgController.java
@@ -576,6 +576,27 @@
        out.print(JsonUtil.loadTrueResult(root));
    }
    private UserCommonMsgVO getKeFuMsg(AcceptData acceptData) {
        MsgDeviceReadState kefuState = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
                UserCommonMsgVO.TYPE_KEFU, acceptData.getDevice(),
                acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
        // 人工客服
        UserCommonMsgVO vo = new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "人工客服", new Date(),
                UserCommonMsgVO.TYPE_KEFU, "", false, null, null, 0);
        if (kefuState != null) {
            vo.setUnReadCount(kefuState.getUnReadCount() == null ? 0 : kefuState.getUnReadCount());
            if (!StringUtil.isNullOrEmpty(kefuState.getLatestContent()))
                vo.setLatestMsg(kefuState.getLatestContent());
            if (vo.getUnReadCount() != null && vo.getUnReadCount() > 0)
                vo.setRead(false);
            else
                vo.setRead(true);
        }
        return vo;
    }
    /**
     * 获取消息列表
     * 
@@ -600,7 +621,7 @@
        // 官宣任务
        if (uid != null) {
            MsgCommonDTO guanXuanMsg = msgConfigService.getGuanXuanMsg();
            if (guanXuanMsg != null&&guanXuanMsg.getShow()==true) {
            if (guanXuanMsg != null && guanXuanMsg.getShow() == true) {
                boolean read = false;
                UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
                if (num != null && (num.getGuanXuanReadTime() != null
@@ -613,16 +634,14 @@
                } else
                    commonMsgList.add(new UserCommonMsgVO(guanXuanMsg.getIcon(), guanXuanMsg.getTitle(),
                            guanXuanMsg.getUpdateTime(), UserCommonMsgVO.TYPE_GUANXUAN, guanXuanMsg.getContent(), read,
                            guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams()));
                            guanXuanMsg.getJumpDetail(), guanXuanMsg.getParams(), 0));
            }
        }
        // 返利券小助手
        MsgCommonDTO zhuShouMsg = msgConfigService.getZhuShouMsg();
        if (zhuShouMsg != null&&zhuShouMsg.getShow()==true) {
        if (zhuShouMsg != null && zhuShouMsg.getShow() == true) {
            boolean read = false;
            MsgDeviceReadState state = msgDeviceReadStateService.getByDeviceAndPlatformAndType(
                    UserCommonMsgVO.TYPE_ZHUSHOU, acceptData.getDevice(),
                    acceptData.getPlatform().equalsIgnoreCase("android") ? 1 : 2);
@@ -637,12 +656,11 @@
            } else
                commonMsgList.add(new UserCommonMsgVO(zhuShouMsg.getIcon(), zhuShouMsg.getTitle(),
                        zhuShouMsg.getUpdateTime(), UserCommonMsgVO.TYPE_ZHUSHOU, zhuShouMsg.getContent(), read,
                        zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams()));
                        zhuShouMsg.getJumpDetail(), zhuShouMsg.getParams(), 0));
        }
        // 人工客服
        commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_kefu.png", "人工客服", new Date(),
                UserCommonMsgVO.TYPE_KEFU, "", false, null, null));
        commonMsgList.add(getKeFuMsg(acceptData));
        // 推荐记录
        DeviceActive deviceActive = deviceActiveService.getDeviceByDeviceAndPlatform(acceptData.getDevice(),
@@ -662,7 +680,7 @@
                commonMsgList.add(new UserCommonMsgVO("http://img.flqapp.com/resource/msg/icon_recommend.png", "推荐记录",
                        list.get(0).getCreateTime(), UserCommonMsgVO.TYPE_RECOMMEND, list.get(0).getContent(), read,
                        jumpDetailV2Service.getByTypeCache("recommend_list"), null));
                        jumpDetailV2Service.getByTypeCache("recommend_list"), null, 0));
            }
        }
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgDeviceReadState.java
@@ -12,6 +12,7 @@
public class MsgDeviceReadState {
    public static String TYPE_ZHUSHOU = "zhushou";// 返利券小助手
    public static String TYPE_RECOMMEND = "recommend";// 推荐
    public static String TYPE_KEFU = "kefu";
    @Column(name = "mdrs_id")
    private Long id;
@@ -25,6 +26,8 @@
    private Date readTime;
    @Column(name = "mdrs_unread_count")
    private Integer unReadCount;
    @Column(name = "mdrs_latest_content")
    private String latestContent;//最近的未读消息
    @Column(name = "mdrs_createtime")
    private Date createTime;
    @Column(name = "mdrs_update_time")
@@ -93,4 +96,12 @@
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getLatestContent() {
        return latestContent;
    }
    public void setLatestContent(String latestContent) {
        this.latestContent = latestContent;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml
@@ -15,8 +15,10 @@
            jdbcType="TIMESTAMP" />
        <result column="mdrs_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <result column="mdrs_latest_content" property="latestContent"
            jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time
    <sql id="Base_Column_List">mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -25,33 +27,27 @@
        from yeshi_ec_msg_device_read_state where mdrs_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByDeviceAndPlatformAndType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and
        mdrs_platform=#{platform} and mdrs_type=#{type}
    </select>
    <select id="listByDeviceAndPlatform" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and
        mdrs_platform=#{platform}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_device_read_state where mdrs_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_msg_device_read_state
        (mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time)
        (mdrs_id,mdrs_device,mdrs_platform,mdrs_type,mdrs_read_time,mdrs_unread_count,mdrs_create_time,mdrs_update_time,mdrs_latest_content)
        values
        (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{platform,jdbcType=INTEGER},#{type,jdbcType=VARCHAR},#{readTime,jdbcType=TIMESTAMP},#{unReadCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
        (#{id,jdbcType=BIGINT},#{device,jdbcType=VARCHAR},#{platform,jdbcType=INTEGER},#{type,jdbcType=VARCHAR},#{readTime,jdbcType=TIMESTAMP},#{unReadCount,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{latestContent,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState"
        useGeneratedKeys="true" keyProperty="id">
@@ -65,6 +61,7 @@
            <if test="unReadCount != null">mdrs_unread_count,</if>
            <if test="createTime != null">mdrs_create_time,</if>
            <if test="updateTime != null">mdrs_update_time,</if>
            <if test="latestContent != null">mdrs_latest_content,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -76,6 +73,7 @@
            <if test="unReadCount != null">#{unReadCount,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="latestContent != null">#{latestContent,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState">update
@@ -86,8 +84,9 @@
        #{readTime,jdbcType=TIMESTAMP},mdrs_unread_count =
        #{unReadCount,jdbcType=INTEGER},mdrs_create_time =
        #{createTime,jdbcType=TIMESTAMP},mdrs_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where mdrs_id = #{id,jdbcType=BIGINT}
    </update>
        #{updateTime,jdbcType=TIMESTAMP} ,mdrs_latest_content
        =#{latestContent,jdbcType=VARCHAR} where mdrs_id =
        #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState">
        update yeshi_ec_msg_device_read_state
        <set>
@@ -98,18 +97,13 @@
            <if test="unReadCount != null">mdrs_unread_count=#{unReadCount,jdbcType=INTEGER},</if>
            <if test="createTime != null">mdrs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mdrs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="id !=null">mdrs_id =#{id,jdbcType=BIGINT},</if>
            <if test="latestContent !=null">mdrs_latest_content =#{latestContent,jdbcType=VARCHAR},
            </if>
        </set>
        where mdrs_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setAllMsgRead">
        update yeshi_ec_msg_device_read_state set
        mdrs_read_time=now(),mdrs_unread_count=0,mdrs_update_time=now()
        where
        mdrs_device=#{device} and
        mdrs_platform=#{platform}
    </update>
    <update id="setAllMsgRead">update yeshi_ec_msg_device_read_state set
        mdrs_read_time=now(),mdrs_unread_count=0,mdrs_update_time=now() where
        mdrs_device=#{device} and mdrs_platform=#{platform}</update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgDeviceReadStateServiceImpl.java
@@ -31,15 +31,16 @@
    }
    @Override
    public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount) {
    public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg) {
        MsgDeviceReadState state = msgDeviceReadStateMapper.selectByDeviceAndPlatformAndType(device, platform, type);
        if (state != null) {
            MsgDeviceReadState update = new MsgDeviceReadState();
            update.setId(state.getId());
            update.setUnReadCount(state.getUnReadCount() + msgCount);
            update.setUpdateTime(new Date());
            update.setLatestContent(msg);
            msgDeviceReadStateMapper.updateByPrimaryKeySelective(update);
        } else {//
        } else {
            state = new MsgDeviceReadState();
            state.setCreateTime(new Date());
            state.setDevice(device);
@@ -47,6 +48,7 @@
            state.setType(type);
            state.setUnReadCount(msgCount);
            state.setUpdateTime(new Date());
            state.setLatestContent(msg);
            msgDeviceReadStateMapper.insertSelective(state);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java
@@ -34,14 +34,15 @@
    @Override
    public void startSyncGoods() {
        LogHelper.test("大淘客同步开始");
        DaTaoKeGoodsResult result = DaTaoKeApiUtil.listAll(null);
        while (!StringUtil.isNullOrEmpty(result.getPageId())) {
        DaTaoKeGoodsResult result = DaTaoKeApiUtil.listAll("1");
        int page=0;
        while (result.getGoodsList() != null && result.getGoodsList().size() > 0) {
            System.out.println(page++);
            for (DaTaoKeDetailV2 v2 : result.getGoodsList())
                daTaoKeGoodsDetailV2Dao.save(v2);
            result = DaTaoKeApiUtil.listAll(result.getPageId());
            try {
                Thread.sleep(200);
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
@@ -50,14 +51,14 @@
    @Override
    public void updateData() {
        DaTaoKeGoodsResult result = DaTaoKeApiUtil.getUpdateGoodsList(null, null, null);
        while (!StringUtil.isNullOrEmpty(result.getPageId())) {
        DaTaoKeGoodsResult result = DaTaoKeApiUtil.getUpdateGoodsList("1", null, null);
        while (result.getGoodsList() != null && result.getGoodsList().size() > 0) {
            for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
                v2.setUpdateTime(new Date());
                daTaoKeGoodsDetailV2Dao.updateSelective(v2);
            }
            try {
                Thread.sleep(200);
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
@@ -67,19 +68,16 @@
    @Override
    public void deleteInvalid() {
        String startTime = null;
        DaTaoKeDetailV2 latest = daTaoKeGoodsDetailV2Dao.selectLatest();
        if (latest != null) {
            startTime = TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM-dd HH:mm:ss");
        }
        String startTime = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd 00:00:00");
        DaTaoKeGoodsResult result = DaTaoKeApiUtil.getInvalidGoodsList(null, startTime, null);
        while (!StringUtil.isNullOrEmpty(result.getPageId())) {
        while (result.getGoodsList() != null && result.getGoodsList().size() > 0) {
            for (DaTaoKeDetailV2 v2 : result.getGoodsList()) {
                v2.setUpdateTime(new Date());
                daTaoKeGoodsDetailV2Dao.delete(v2.getId());
            }
            result = DaTaoKeApiUtil.getInvalidGoodsList(result.getPageId(), startTime, null);
            System.out.println(result);
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgDeviceReadStateService.java
@@ -37,7 +37,7 @@
     * @param platform
     * @param msgCount
     */
    public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount);
    public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount,String msg);
    /**
     * 设置所有消息已读
fanli/src/main/java/com/yeshi/fanli/util/VersionUtil.java
@@ -9,8 +9,15 @@
        else
            return false;
    }
    public static boolean greaterThan_1_5_50(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 42))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) >= 51)))
            return true;
        else
            return false;
    }
    public static boolean smallerThan_1_5_1(String platform, String versionCode) {
        if ((("android".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 36))
                || (("ios".equalsIgnoreCase(platform) && Integer.parseInt(versionCode) < 44)))
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -144,6 +144,7 @@
        params.put("version", "v1.0.0");
        params.put("appKey", app.getAppKey());
        params.put("pageSize", 200 + "");
//        params.put("sort", "1");
        if (!StringUtil.isNullOrEmpty(pageId)) {
            params.put("pageId", pageId);
        }
@@ -192,6 +193,7 @@
        params.put("sign", getSign(params, app.getAppSecret()));
        String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-stale-goods-by-time", params,
                new HashMap<>());
        System.out.println(result);
        JSONObject json = JSONObject.fromObject(result);
        JSONObject dataJson = json.optJSONObject("data");
        if (dataJson != null) {
@@ -292,7 +294,7 @@
        params.put("appKey", app.getAppKey());
        params.put("pageSize", 200 + "");
        params.put("pageId", page + "");
        String cids = "";
        if (cidList != null && cidList.size() > 0)
            for (Integer cid : cidList) {
fanli/src/main/java/com/yeshi/fanli/util/taobao/DaTaoKeUtil.java
@@ -521,13 +521,15 @@
        if (detail != null) {
            // 重新设置标题与券价格
            goods.setTitle(detail.getdTitle());
            goods.setCouponAmount(detail.getQuanPrice());
            if (goods.getCouponAmount() != null && detail.getQuanPrice() != null
                    && goods.getCouponAmount().compareTo(detail.getQuanPrice()) < 0)
                goods.setCouponAmount(detail.getQuanPrice());
            goods.setZkPrice(detail.getOrgPrice());
            if (new BigDecimal(detail.getQuanCondition()).compareTo(new BigDecimal(0)) > 0)
                goods.setCouponInfo(String.format("满%s元减%s元", detail.getQuanCondition(),
                        MoneyBigDecimalUtil.getWithNoZera(detail.getQuanPrice()).toString()));
                        MoneyBigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString()));
            else
                goods.setCouponInfo(String.format("%s元无条件券", detail.getQuanPrice()));
                goods.setCouponInfo(String.format("%s元无条件券", goods.getCouponAmount()));
        }
        return goods;
    }
@@ -536,13 +538,15 @@
        if (detail != null) {
            // 重新设置标题与券价格
            goods.setTitle(detail.getDtitle());
            goods.setCouponAmount(detail.getCouponPrice());
            if (goods.getCouponAmount() != null && detail.getCouponPrice() != null
                    && goods.getCouponAmount().compareTo(detail.getCouponPrice()) < 0)
                goods.setCouponAmount(detail.getCouponPrice());
            goods.setZkPrice(detail.getOriginalPrice());
            if (new BigDecimal(detail.getCouponConditions()).compareTo(new BigDecimal(0)) > 0)
                goods.setCouponInfo(String.format("满%s元减%s元", detail.getCouponConditions(),
                        MoneyBigDecimalUtil.getWithNoZera(detail.getCouponPrice()).toString()));
                        MoneyBigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString()));
            else
                goods.setCouponInfo(String.format("%s元无条件券", detail.getCouponPrice()));
                goods.setCouponInfo(String.format("%s元无条件券", goods.getCouponAmount()));
        }
        return goods;
    }
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserCommonMsgVO.java
@@ -9,7 +9,7 @@
    public static String TYPE_GUANXUAN = "guanxuan";
    public static String TYPE_ZHUSHOU = "zhushou";
    public static String TYPE_RECOMMEND = "recommend";
    public static String TYPE_SYSTEM = "system";//系统消息
    public static String TYPE_SYSTEM = "system";// 系统消息
    private String icon;
    private String title;
@@ -19,9 +19,10 @@
    private Boolean read;// 是否已读
    private JumpDetailV2 jumpDetail;// 跳转详情
    private String params;// 跳转参数
    private Integer unReadCount;// 消息未读数
    public UserCommonMsgVO(String icon, String title, Date time, String type, String latestMsg, Boolean read,
            JumpDetailV2 jumpDetail, String params) {
            JumpDetailV2 jumpDetail, String params, Integer unReadCount) {
        this.icon = icon;
        this.title = title;
        this.time = time;
@@ -30,6 +31,15 @@
        this.read = read;
        this.jumpDetail = jumpDetail;
        this.params = params;
        this.unReadCount = unReadCount;
    }
    public Integer getUnReadCount() {
        return unReadCount;
    }
    public void setUnReadCount(Integer unReadCount) {
        this.unReadCount = unReadCount;
    }
    public UserCommonMsgVO() {