admin
2019-05-15 2dc52e3ba49433a54368c3b64ba3539b4bb051ae
Merge remote-tracking branch 'origin/master'
14个文件已修改
246 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/DynamicController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/dynamic/DynamicInfoDao.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/dataoke/DaTaoKeDetailMapper.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/share/ShareInfoDTO.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/DynamicInfoJob.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/dataoke/DaTaoKeDetailMapper.xml 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsRecordServiceImpl.java 70 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/dataoke/DaTaoKeGoodsService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/BrandController.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoShop;
import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.service.inter.brand.BrandClassService;
@@ -28,6 +29,7 @@
import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.ThreadUtil;
@@ -60,6 +62,9 @@
    @Resource
    private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
    @Resource
    private DaTaoKeGoodsService daTaoKeGoodsService;
    /**
     * 获取品牌分类
     * 
@@ -250,20 +255,37 @@
                        taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice());
                    }
                });
            }
            int pageSize = Constant.PAGE_SIZE;
            List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId((page - 1) * pageSize, pageSize, sid);
            // 商品列表信息
            int pageSize = 50;
            List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
            // 先查询大淘客数据
            List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, sid);
            if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
                for (DaTaoKeDetail daTaoKe: listDaTaoKe) {
                    listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
                }
            }
            // 不足50条数据、查询精选库
            if (listGoodsBrief.size() < pageSize) {
                int needCount = pageSize- listGoodsBrief.size();
                List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId(0, needCount, sid);
                if (listGoods != null && listGoods.size() > 0) {
                    listGoodsBrief.addAll(listGoods);
                }
            }
            long count = 0;
            JSONArray array = new JSONArray();
            if (listGoods != null && listGoods.size() > 0) {
            if (listGoodsBrief.size() > 0) {
                List<Long> listGid = new ArrayList<Long>();
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoods) {
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
                    listGid.add(taoBaoGoodsBrief.getAuctionId());
                }
                // API网络接口验证是否在售
                List<TaoBaoGoodsBrief> listTaoKeGoods = null;
                try {
@@ -275,12 +297,13 @@
                } catch (Exception e) {
                    e.printStackTrace();
                }
                Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
                        .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
                BigDecimal proportion = manageService.getFanLiRate();
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoods) {
                for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
                    if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
                        boolean stateSale = false; // 默认停售
                        Long goodsId = taoBaoGoodsBrief.getAuctionId();
@@ -291,16 +314,15 @@
                                break;
                            }
                        }
                        if (!stateSale) {
                            continue;
                        }
                    }
                    array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
                }
                count = taoBaoGoodsBriefService.countByShopId(sid);
            }
            data.put("count", count);
            data.put("count", array.size());
            data.put("list", array);
            out.print(JsonUtil.loadTrueResult(data));
        } catch (Exception e) {
fanli/src/main/java/com/yeshi/fanli/controller/client/DynamicController.java
@@ -131,7 +131,7 @@
    }
    @RequestMapping(value = "getList", method = RequestMethod.POST)
    public void getList2(AcceptData acceptData, Integer page, Long cid, Long subId, PrintWriter out) {
    public void getList(AcceptData acceptData, Integer page, Long cid, Long subId, PrintWriter out) {
        try {
            if (cid == null) {
                out.print(JsonUtil.loadFalseResult("主分类id不能为空"));
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java
@@ -685,6 +685,7 @@
                String url = String.format("http://%s%s?uid=%s&id=%s&appType=flq", configService.getH5Host(),
                        Constant.systemCommonConfig.getShareGoodsPagePath(), AESUtil.encrypt(uid + "", Constant.UIDAESKEY),
                        auctionId + "");
                String shortLink = HttpUtil.getShortLink(url);
                if (!StringUtil.isNullOrEmpty(shortLink)) {
                    url = shortLink;
@@ -753,7 +754,7 @@
                ShareInfoDTO shareInfo = userShareGoodsRecordService.saveShareRecord(uid, 
                        ShareSourceTypeEnum.activity, title, listGoods);
                data.put("shareId", shareInfo.getShareId());
                data.put("clickUrl", shareInfo.getCodeUrl());
                data.put("clickUrl", shareInfo.getShareUrl());
                data.put("pictUrl", TbImgUtil.getTBSizeImg(picUrl, 500));
                // 帮助链接
                data.put("helpLink","http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
fanli/src/main/java/com/yeshi/fanli/dao/dynamic/DynamicInfoDao.java
@@ -63,9 +63,16 @@
        Query query = new Query();
        query.addCriteria(Criteria.where("id").is(record.getId()));
        
        // 更新分享次数
        Update update = Update.update("imgs", record.getImgs()).set("desc", record.getDesc());
        mongoTemplate.updateMulti(query, update, DynamicInfo.class);
        if (record.getClassId() == 1) {
            Update update = Update.update("imgs", record.getImgs()).set("desc", record.getDesc());
            mongoTemplate.updateMulti(query, update, DynamicInfo.class);
        } else {
            Update update = Update.update("imgs", record.getImgs());
            mongoTemplate.updateMulti(query, update, DynamicInfo.class);
        }
    }
    
    /**
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/taobao/dataoke/DaTaoKeDetailMapper.java
@@ -86,5 +86,14 @@
     * @return
     */
    Long countSearchByTitleWithCid(@Param("title") String key, @Param("cid") Long cid);
    /**
     * 根据店铺id查询
     * @param start
     * @param count
     * @param sellerId
     * @return
     */
    public List<DaTaoKeDetail> listBySellerId( @Param("start")long start,  @Param("count")int count,  @Param("sellerId")Long sellerId);
}
fanli/src/main/java/com/yeshi/fanli/dto/share/ShareInfoDTO.java
@@ -5,10 +5,6 @@
    private Long shareId;
    // 分享链接
    private String shareUrl;
    // 分享二维码
    private String codeUrl;
    // md5
    private String md5;
    
    
    public Long getShareId() {
@@ -23,18 +19,4 @@
    public void setShareUrl(String shareUrl) {
        this.shareUrl = shareUrl;
    }
    public String getCodeUrl() {
        return codeUrl;
    }
    public void setCodeUrl(String codeUrl) {
        this.codeUrl = codeUrl;
    }
    public String getMd5() {
        return md5;
    }
    public void setMd5(String md5) {
        this.md5 = md5;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/DynamicInfoJob.java
@@ -31,9 +31,9 @@
    @Scheduled(cron = "0 0/10 6-23 * * ?")
    public void insetDynamicInfo() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
        if (!Constant.IS_TASK) {
            return;
        }
        
        try {
            dynamicInfoService.insertTimeHotSale();
@@ -64,9 +64,9 @@
    @Scheduled(cron = "0 0 6,7,15,16,21,22,23 * * ? ")
    public void insetShopInfo1() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
        if (!Constant.IS_TASK) {
            return;
        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -85,9 +85,9 @@
    @Scheduled(cron = "0 0/30 8,9,10 * * ?")
    public void insetShopInfo2() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
        if (!Constant.IS_TASK) {
            return;
        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -107,9 +107,9 @@
    @Scheduled(cron = "0 0/30 11,12,13,14 * * ?")
    public void insetShopInfo3() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
        if (!Constant.IS_TASK) {
            return;
        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -129,9 +129,9 @@
    @Scheduled(cron = "0 0/30 17,18,19,20 * * ? ")
    public void insetShopInfo4() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
        if (!Constant.IS_TASK) {
            return;
        }
        
        try {
            dynamicInfoService.insertShopInfo();
@@ -151,10 +151,10 @@
    @Scheduled(cron = "0 0 0 * * ?")
    public void remove() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
//
        if (!Constant.IS_TASK) {
            return;
        }
        try {
            dynamicInfoService.removeByDate(DateUtil.reduceDay(3, new Date()));
        } catch (Exception e) {
@@ -173,10 +173,10 @@
    @Scheduled(cron = "0 0/3 * * * ?")
    public void activityNeedPublish() {
        
//        if (!Constant.IS_TASK) {
//            return;
//        }
//
        if (!Constant.IS_TASK) {
            return;
        }
        try {
            List<RecommendActivity> list = activityService.getNeedPublish();
            if (list == null || list.size() == 0) {
fanli/src/main/java/com/yeshi/fanli/mapping/taobao/dataoke/DaTaoKeDetailMapper.xml
@@ -113,6 +113,13 @@
    </select>
    <select id="listBySellerId" resultMap="BaseResultMap">
        select    <include refid="Base_Column_List" /> from yeshi_ec_goods_dataoke
        where  seller_id = #{sellerId}
        order by update_time desc
        limit #{start},#{count}
    </select>
    <delete id="deleteByIdList">
        delete from
        yeshi_ec_goods_dataoke where
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java
@@ -280,7 +280,7 @@
        dynamicInfo.setClassId(classId);
        dynamicInfo.setSubclassId(subclassId);
        dynamicInfo.setDaTaoKeId(daTaoKe.getId());
        dynamicInfo.setCreateTime(DateUtil.reduceRandomMinute(new Date()));
        dynamicInfo.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8));
        dynamicInfo.setUpdateTime(new Date());
        // 随机分享次数
        dynamicInfo.setShareCount(1000 + (int) (Math.random() * 8000));
@@ -382,7 +382,7 @@
            dynamicVO.setCreateTime(existInfo.getCreateTime());
            dynamicVO.setShareCount(existInfo.getShareCount());
        } else {
            dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date()));
            dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8));
            dynamicVO.setShareCount(1000 + (int) (Math.random() * 8000));
        }
        
@@ -489,7 +489,7 @@
        dynamicVO.setShowType(DynamicInfo.SHOW_TYPE_TWO);
        dynamicVO.setShop(taoBaoShop);
        dynamicVO.setUser(activityUserService.listRand(1).get(0));
        dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date()));
        dynamicVO.setCreateTime(DateUtil.reduceRandomMinute(new Date(), 8));
        dynamicVO.setUpdateTime(new Date());
        
        // 介绍内容
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsServiceImpl.java
@@ -18,8 +18,6 @@
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
import sun.rmi.log.LogHandler;
@Service
public class DaTaoKeGoodsServiceImpl implements DaTaoKeGoodsService {
@@ -114,4 +112,9 @@
        return daTaoKeDetailMapper.getGoodsNotInList(cid, listId, count);
    }
    @Override
    public List<DaTaoKeDetail> listBySellerId(long start, int count, Long sellerId){
        return daTaoKeDetailMapper.listBySellerId(start, count, sellerId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserGoodsStorageServiceImpl.java
@@ -313,14 +313,13 @@
        BigDecimal totalMoney = new BigDecimal(0.00);
        List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
        
        String rateStr = hongBaoManageService.get("hongbao_goods_proportion");
        BigDecimal rate = hongBaoManageService.getShareRate();
        for (UserGoodsStorage userGoodsStorage: listResult) {
            CommonGoods commonGoods = userGoodsStorage.getCommonGoods();
            TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(commonGoods);
            listGoodsBrief.add(goodsBrief);
            
            BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goodsBrief, new BigDecimal(rateStr));
            BigDecimal money = TaoBaoUtil.getGoodsHongBaoMoney(goodsBrief, rate);
            totalMoney = MoneyBigDecimalUtil.add(totalMoney, money);
        }
        
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserShareGoodsRecordServiceImpl.java
@@ -368,13 +368,10 @@
        userShareGoodsRecord.setUpdateTime(date);
        userShareGoodsRecordMapper.insertSelective(userShareGoodsRecord);
        Map<String, Object> map = new HashMap<String, Object>();
        // 多个商品分享
        FileUploadResult loadResult = multipleGoodsShare(userShareGoodsRecord, listGoods);
         multipleGoodsShareRecord(userShareGoodsRecord, listGoods);
    
        ShareInfoDTO shareInfo = new ShareInfoDTO();
        shareInfo.setMd5(loadResult.getMd5());
        shareInfo.setCodeUrl(loadResult.getUrl());
        shareInfo.setShareId(userShareGoodsRecord.getId());
        shareInfo.setShareUrl(getShareUrl(userShareGoodsRecord));
        
@@ -441,6 +438,57 @@
    }
    /**
     * 多个商品分享生成记录
     *
     * @param userShareGoodsRecord
     * @param listGoods
     */
    @Transactional
    public void multipleGoodsShareRecord(UserShareGoodsRecord userShareGoodsRecord,
            List<TaoBaoGoodsBrief> listGoods) throws UserShareGoodsRecordException {
        // 分享记录
        Date date = new Date();
        List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
        List<UserShareGoodsGroup> listGroup = new ArrayList<UserShareGoodsGroup>();
        for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoods) {
            CommonGoods commonGoods = CommonGoodsFactory.create(taoBaoGoodsBrief);
            commonGoods.setState(taoBaoGoodsBrief.getState());
            try {
                CommonGoods resultCommonGoods = commonGoodsService.addOrUpdateCommonGoods(commonGoods);
                if (resultCommonGoods != null) {
                    TaoBaoGoodsBrief goodsBrief = TaoBaoUtil.convert(resultCommonGoods);
                    listGoodsBrief.add(goodsBrief);
                }
                UserShareGoodsGroup shareGoodsGroup = new UserShareGoodsGroup();
                shareGoodsGroup.setTotalOrder(0);
                shareGoodsGroup.setTotalBrowse(0);
                shareGoodsGroup.setTodayBrowse(0);
                shareGoodsGroup.setTotalMoney(new BigDecimal(0));
                shareGoodsGroup.setCreateTime(date);
                shareGoodsGroup.setUpdateTime(date);
                shareGoodsGroup.setCommonGoods(resultCommonGoods);
                shareGoodsGroup.setRecordId(userShareGoodsRecord.getId());
                listGroup.add(shareGoodsGroup);
            } catch (CommonGoodsException e) {
                e.printStackTrace();
                continue;
            }
        }
        if (listGroup.size() > 0) {
            userShareGoodsGroupService.insertBatch(listGroup);
        }
    }
    /**
     * 多个商品分享生成记录
     * 
@@ -754,15 +802,19 @@
        }
        shareRecord.setShareState(1);// 分享生效
        updateByPrimaryKeySelective(shareRecord);
        // 更新商品为已分享
        userGoodsStorageService.updateShareState(shareId);
        updateByPrimaryKeySelective(shareRecord);// 更新商品为已分享
        // 更新选品库商品为已分享
        executor.execute(new Runnable() {
            @Override
            public void run() {
                userGoodsStorageService.updateShareState(shareId);
            }
        });
    }
    @Override
    public long countShareRecordByUid(Long uid) {
        return userShareGoodsRecordMapper.countQueryByUid(uid, null);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/taobao/dataoke/DaTaoKeGoodsService.java
@@ -34,4 +34,14 @@
    
    public List<DaTaoKeDetail> getGoodsNotInList(Long cid, List<Long> listId, int count);
    /**
     * 根据店铺id筛选
     * @param start
     * @param count
     * @param sellerId
     * @return
     */
    public List<DaTaoKeDetail> listBySellerId(long start, int count, Long sellerId);
}
fanli/src/main/java/com/yeshi/fanli/util/dataoke/DaTaoKeApiUtil.java
@@ -147,7 +147,7 @@
        List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
        JSONArray arrayGoods = data.optJSONArray("goods");
        for (int i = 0; i < arrayGoods.size(); i++) {
            if (i > 3) {
            if (i >= 2) {
                break;
            }
            JSONObject itemGoods = arrayGoods.optJSONObject(i);