Merge remote-tracking branch 'origin/master'
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private DaTaoKeGoodsService daTaoKeGoodsService;
|
| | |
|
| | | /**
|
| | | * 获取品牌分类
|
| | |
| | | taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice());
|
| | | }
|
| | | });
|
| | | |
| | | }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | | List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId((page - 1) * pageSize, pageSize, sid);
|
| | |
|
| | | long count = 0;
|
| | | JSONArray array = new JSONArray();
|
| | | // 商品列表信息
|
| | | 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);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | 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 {
|
| | |
| | | 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();
|
| | |
| | | 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) {
|
| | |
| | | }
|
| | |
|
| | | @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不能为空"));
|
| | |
| | | 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;
|
| | |
| | | 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");
|
| | |
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("id").is(record.getId()));
|
| | |
|
| | | // 更新分享次数
|
| | | 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);
|
| | | }
|
| | | |
| | | |
| | | |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | */ |
| | | 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); |
| | | |
| | | } |
| | |
| | | private Long shareId;
|
| | | // 分享链接
|
| | | private String shareUrl;
|
| | | // 分享二维码
|
| | | private String codeUrl;
|
| | | // md5
|
| | | private String md5;
|
| | |
|
| | |
|
| | | public Long getShareId() {
|
| | |
| | | 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;
|
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | | @Scheduled(cron = "0 0/10 6-23 * * ?")
|
| | | public void insetDynamicInfo() {
|
| | |
|
| | | // if (!Constant.IS_TASK) {
|
| | | // return;
|
| | | // }
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | dynamicInfoService.insertTimeHotSale();
|
| | |
| | | @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();
|
| | |
| | | @Scheduled(cron = "0 0/30 8,9,10 * * ?")
|
| | | public void insetShopInfo2() {
|
| | |
|
| | | // if (!Constant.IS_TASK) {
|
| | | // return;
|
| | | // }
|
| | | if (!Constant.IS_TASK) {
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | dynamicInfoService.insertShopInfo();
|
| | |
| | | @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();
|
| | |
| | | @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();
|
| | |
| | | @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) {
|
| | |
| | | @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) {
|
| | |
| | | </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 |
| | |
| | | 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));
|
| | |
| | | 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));
|
| | | }
|
| | |
|
| | |
| | | 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());
|
| | |
|
| | | // 介绍内容
|
| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | |
|
| | | import sun.rmi.log.LogHandler;
|
| | |
|
| | | @Service
|
| | | public class DaTaoKeGoodsServiceImpl implements DaTaoKeGoodsService {
|
| | |
|
| | |
| | | return daTaoKeDetailMapper.getGoodsNotInList(cid, listId, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetail> listBySellerId(long start, int count, Long sellerId){
|
| | | return daTaoKeDetailMapper.listBySellerId(start, count, sellerId);
|
| | | }
|
| | | |
| | | }
|
| | |
| | | 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);
|
| | | }
|
| | |
|
| | |
| | | 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));
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 多个商品分享生成记录
|
| | | * |
| | | * @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);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | shareRecord.setShareState(1);// 分享生效
|
| | | updateByPrimaryKeySelective(shareRecord);
|
| | | // 更新商品为已分享
|
| | | updateByPrimaryKeySelective(shareRecord);// 更新商品为已分享
|
| | | |
| | | // 更新选品库商品为已分享
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | userGoodsStorageService.updateShareState(shareId);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countShareRecordByUid(Long uid) {
|
| | |
|
| | | return userShareGoodsRecordMapper.countQueryByUid(uid, null);
|
| | |
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | 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);
|
| | |
|
| | | }
|
| | |
| | | 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);
|