喻健
2018-11-30 3d3a9b46b56ded968b1803456470b5ec31e43ce7
调整推送内容以及队员返回字段
7个文件已修改
74 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushGoodsController.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/PushGoodsMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/PushGoodsMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/PushGoodsService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/PushGoodsController.java
@@ -19,8 +19,10 @@
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.push.PushGoods;
import com.yeshi.fanli.entity.push.PushGoodsGroup;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.PushException;
import com.yeshi.fanli.exception.push.PushGoodsException;
import com.yeshi.fanli.goods.CommonGoods;
import com.yeshi.fanli.service.AdminUserService;
import com.yeshi.fanli.service.inter.push.PushGoodsGroupService;
import com.yeshi.fanli.service.inter.push.PushGoodsService;
@@ -28,6 +30,7 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.annotation.RequestNoLogin;
import com.yeshi.fanli.util.taobao.TaoBaoUtil;
@Controller
@RequestMapping("admin/new/api/v1/pushgoods")
@@ -152,11 +155,24 @@
                return;
            }
            List<TaoBaoGoodsBrief> listgoods = new ArrayList<TaoBaoGoodsBrief>();
            List<PushGoodsGroup> listGroup = pushGoodsGroupService.getAllInfoByPushId(pushGoods.getId());
            if (listGroup == null) {
                listGroup = new ArrayList<PushGoodsGroup>();
            } else {
                for (PushGoodsGroup pushGoodsGroup: listGroup) {
                    CommonGoods commonGoods = pushGoodsGroup.getCommonGoods();
                    if (commonGoods != null) {
                        TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
                        listgoods.add(goodsBrief);
                    }
                }
            }
            
            JSONObject data = new JSONObject();
            data.put("pushGoods", pushGoods);
            data.put("listGroup", listGroup);
            data.put("listGroup", listgoods);
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
fanli/src/main/java/com/yeshi/fanli/controller/client/PushController.java
@@ -210,8 +210,8 @@
     * @param acceptData
     * @param out
     */
    @RequestMapping(value = "/gethistory"/*, method = RequestMethod.POST*/)
    public void getHistory(AcceptData acceptData, String deviceToken, int page, PrintWriter out) {
    @RequestMapping(value = "/gethistory", method = RequestMethod.POST)
    public void getHistory(AcceptData acceptData, Long uid, String deviceToken, int page, PrintWriter out) {
        long count = 0;
        List<PushGoods> list = null;
@@ -224,11 +224,11 @@
            // 设备注册时间
            Date createTime = deviceActive.getCreateTime();
            count = PushGoodsService.countHistoryByPushTime(createTime);
            count = PushGoodsService.countHistoryByPushTime(uid, createTime);
            int pageSize = Constant.PAGE_SIZE;
            list = PushGoodsService.listHistoryByPushTime((page - 1) * pageSize, pageSize, createTime);
            list = PushGoodsService.listHistoryByPushTime((page - 1) * pageSize, pageSize, uid, createTime);
            if (list != null && list.size() > 0) {
                for (PushGoods pushGoods : list) {
                    JSONObject result = new JSONObject();
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -1618,10 +1618,10 @@
            long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
            long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
            
            JSONObject bossData = new JSONObject();
            JSONObject bossData = null;
            ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
            if (threeSale != null) {
                bossData = new JSONObject();
                UserInfo boss = threeSale.getBoss();
                if (boss != null) {
                    bossData.put("nickName", boss.getNickName());
@@ -1664,10 +1664,10 @@
        long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
        long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
        
        JSONObject bossData = new JSONObject();
        JSONObject bossData = null;
        ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
        if (threeSale != null) {
            bossData = new JSONObject();
            UserInfo boss = threeSale.getBoss();
            if (boss != null) {
                bossData.put("nickName", boss.getNickName());
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/PushGoodsMapper.java
@@ -49,7 +49,7 @@
     * @return
     */
    List<PushGoods> listHistoryByPushTime(@Param("start") long start, @Param("count") int count,
         @Param("pushTime") Date pushTime);
         @Param("uid") Long uid, @Param("pushTime") Date pushTime);
    
    /**
     * 统计历史推送商品信息
@@ -58,7 +58,7 @@
     * @param pushTime
     * @return
     */
    long countHistoryByPushTime(@Param("pushTime") Date pushTime);
    long countHistoryByPushTime(@Param("uid") Long uid, @Param("pushTime") Date pushTime);
    
    /**
     * 查询已推送记录
fanli/src/main/java/com/yeshi/fanli/mapping/push/PushGoodsMapper.xml
@@ -67,7 +67,7 @@
  
  
   <delete id="deleteBatchByPrimaryKey"  parameterType="java.util.List">
        delete from yeshi_ec_push_goods where gro_id in
        delete from yeshi_ec_push_goods where pg_id in
        <foreach item="item" collection="list" open="(" separator=","
            close=")">#{item}</foreach>
   </delete>
@@ -98,19 +98,21 @@
    
   <select id="listHistoryByPushTime" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_push_goods
        WHERE  pg_is_push = 1   AND <![CDATA[pg_push_time >= #{pushTime}]]>
        WHERE pg_is_push = 1   AND <![CDATA[pg_push_time >= #{pushTime}]]>
              AND (pg_uid is null <if test='uid != null'>or pg_uid = #{uid} </if>)
           ORDER BY pg_push_time desc 
        LIMIT ${start},${count}
   </select>
   
   <select id="countHistoryByPushTime" resultType="java.lang.Long">
        SELECT IFNULL(count(pg_id),0)  FROM yeshi_ec_push_goods
        WHERE  pg_is_push = 1   AND <![CDATA[pg_push_time >= #{pushTime}]]>
        WHERE pg_is_push = 1   AND <![CDATA[pg_push_time >= #{pushTime}]]>
              AND (pg_uid is null <if test='uid != null'>or pg_uid = #{uid} </if>)
   </select>
   
    <select id="listByPushState" resultMap="BaseResultMap" parameterType="java.util.List">
        SELECT <include refid="Base_Column_List" />  FROM yeshi_ec_push_goods
        WHERE  pg_is_push = 1 AND  gro_id in
        WHERE  pg_is_push = 1 AND  pg_id in
        <foreach item="item" collection="list" open="(" separator=","
            close=")">#{item}</foreach>
   </select>
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushGoodsServiceImpl.java
@@ -181,13 +181,13 @@
    @Transactional
    public int deleteBatchByPrimaryKey(List<Long> list) throws Exception {
        List<PushGoods> lisState = pushGoodsMapper.listByPushState(list);
        /*List<PushGoods> lisState = pushGoodsMapper.listByPushState(list);
        if (lisState != null && lisState.size() > 0) {
            for (PushGoods pushGoods : lisState) {
                // 已推送的消息不能删除
                list.remove(pushGoods.getId());
            }
        }
        }*/
        // 删除对应商品
        pushGoodsGroupService.deleteBatchByPushId(list);
@@ -206,13 +206,13 @@
    }
    @Override
    public List<PushGoods> listHistoryByPushTime(long start, int count, Date pushTime) {
        return pushGoodsMapper.listHistoryByPushTime(start, count, pushTime);
    public List<PushGoods> listHistoryByPushTime(long start, int count, Long uid, Date pushTime) {
        return pushGoodsMapper.listHistoryByPushTime(start, count, uid, pushTime);
    }
    @Override
    public long countHistoryByPushTime(Date pushTime) {
        return pushGoodsMapper.countHistoryByPushTime(pushTime);
    public long countHistoryByPushTime(Long uid, Date pushTime) {
        return pushGoodsMapper.countHistoryByPushTime(uid, pushTime);
    }
    @Override
@@ -243,11 +243,6 @@
            }
            Long goodsId = commonGoods.getGoodsId();
            JSONObject json = IOSPushFactory.createGoodsPush(goodsId, alertTitle, alertContent);
            if (json.toString().getBytes().length > 256) {
                throw new PushException(1, "标题或内容过长,请删减后再试");
            }
            String url = "https://item.taobao.com/item.htm?id=" + goodsId;
            
            pushService.pushGoods(pushGoods.getUid(), url, alertTitle, alertContent);
@@ -260,11 +255,6 @@
            }
            // 生成链接
            url = url + "?id=" + id;
            JSONObject json = IOSPushFactory.createURLPush(HttpUtil.getShortLink(url), alertTitle, alertContent);
            if (json.toString().getBytes().length > 256) {
                throw new PushException(1, "标题或内容过长,请删减后再试");
            }
            pushService.pushUrl(pushGoods.getUid(), url, alertTitle, alertContent);
        }
fanli/src/main/java/com/yeshi/fanli/service/inter/push/PushGoodsService.java
@@ -49,9 +49,9 @@
     * @param pushTime
     * @return
     */
    public List<PushGoods> listHistoryByPushTime(long start, int count, Date pushTime);
    public List<PushGoods> listHistoryByPushTime(long start, int count, Long uid, Date pushTime);
    public long countHistoryByPushTime(Date pushTime);
    public long countHistoryByPushTime(Long uid, Date pushTime);
    
    /**