| | |
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopInfoDTO;
|
| | | import com.yeshi.fanli.entity.brand.BrandClass;
|
| | | import com.yeshi.fanli.entity.brand.BrandClassShop;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfo;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
|
| | | import com.yeshi.fanli.exception.brand.BrandClassException;
|
| | | import com.yeshi.fanli.exception.brand.BrandClassShopException;
|
| | | import com.yeshi.fanli.exception.brand.BrandInfoException;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private BrandClassShopService brandClassShopService;
|
| | | |
| | | @Resource
|
| | | private BrandInfoService brandInfoService;
|
| | |
|
| | | /**
|
| | | * 保存信息
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 品牌信息保存
|
| | | * @param callback
|
| | | * @param brandInfo
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveBrand")
|
| | | public void saveBrand(String callback, BrandInfo brandInfo, PrintWriter out) {
|
| | | try {
|
| | | brandInfoService.saveObject(brandInfo);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (BrandInfoException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 删除
|
| | | * |
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "deleteBrand")
|
| | | public void deleteBrand(String callback, String idArray, PrintWriter out) {
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | | return;
|
| | | }
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | | int count = brandInfoService.deleteBatchByPrimaryKey(list);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除[" + count + "]条数据"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 品牌信息查询
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * @param cid
|
| | | * @param state
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryBrand")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Long cid, Integer state,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<BrandInfo> list = brandInfoService.listQuery((pageIndex - 1) * pageSize, pageSize, key, cid, state);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | long count = brandInfoService.countQuery(key, cid, state);
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfo;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfoRecord;
|
| | | import com.yeshi.fanli.entity.brand.BrandShopCahe;
|
| | | import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | 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.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandGoodsCaheService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoRecordService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
|
| | | import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.brand.BrandInfoVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.vo.goods.ShopInfoVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private BrandInfoRecordService brandInfoRecordService;
|
| | | |
| | | @Resource
|
| | | private BrandGoodsCaheService brandGoodsCaheService;
|
| | | |
| | | @Resource
|
| | | private BrandShopCaheService brandShopCaheService;
|
| | |
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 店铺足迹
|
| | | *
|
| | |
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 品牌列表列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getListV3", method = RequestMethod.POST)
|
| | | public void getListV3(AcceptData acceptData, Integer page, Long cid, Long uid, PrintWriter out) {
|
| | | if (page == null || page < 1) {
|
| | | out.print(JsonUtil.loadFalseResult("页码不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (cid != null && cid == 0) {
|
| | | cid = null;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1 && cid != null) {
|
| | | List<BrandInfo> brandlist = brandInfoService.listValidByCidToApp(cid);
|
| | | if(brandlist == null)
|
| | | brandlist = new ArrayList<BrandInfo>();
|
| | | data.put("brandlist", JsonUtil.getApiCommonGson().toJson(brandlist));
|
| | | }
|
| | | |
| | | |
| | | long count = brandInfoService.countValidByCidToApp(cid);
|
| | | |
| | | List<BrandInfoVO> list = brandInfoService.listValidToApp((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid);
|
| | | if (list == null)
|
| | | list = new ArrayList<BrandInfoVO>();
|
| | | |
| | | GsonBuilder gb = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
|
| | | gb.excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gb.create();
|
| | | |
| | | data.put("count", count);
|
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 店铺详情过渡页
|
| | | * |
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShopInfoV3", method = RequestMethod.POST)
|
| | | public void getShopInfoV3(AcceptData acceptData, Integer page, Long id, Long uid, PrintWriter out) {
|
| | | if (id == null) {
|
| | | out.print(JsonUtil.loadFalseResult("缺失店铺id"));
|
| | | return;
|
| | | }
|
| | | |
| | | // 添加足迹
|
| | | if (page == 1) {
|
| | | brandInfoRecordService.addRecord(id, uid, acceptData.getDevice());
|
| | | }
|
| | | |
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | List<BrandGoodsCahe> listGoods = brandGoodsCaheService.getByBrandId((page - 1) * 50, 50,id);
|
| | | for (BrandGoodsCahe brandGoods: listGoods) {
|
| | | JDGoods goodsJD = brandGoods.getGoodsJD();
|
| | | if (goodsJD != null) {
|
| | | array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goodsJD, fanLiRate, shareRate)));
|
| | | continue;
|
| | | }
|
| | | |
| | | TaoBaoGoodsBrief goodsTB = brandGoods.getGoodsTB();
|
| | | if (goodsTB != null) {
|
| | | array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsTB, null, fanLiRate, shareRate)));
|
| | | continue;
|
| | | }
|
| | | |
| | | PDDGoodsDetail goodsPDD = brandGoods.getGoodsPDD();
|
| | | if (goodsPDD != null) {
|
| | | array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, fanLiRate, shareRate)));
|
| | | continue;
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | if (page == 1 && array.size() > 0) {
|
| | | // 2、顶部轮播图
|
| | | List<SwiperPicture> topPicList = new ArrayList<>();
|
| | | List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("index_top");
|
| | | if (oldtopPicList != null && oldtopPicList.size() > 0)
|
| | | topPicList.addAll(oldtopPicList);
|
| | | |
| | | List<ShopInfoVO> shopList = new ArrayList<ShopInfoVO>();
|
| | | List<BrandShopCahe> listshopCahe = brandShopCaheService.getByBrandId(id);
|
| | | if (listshopCahe != null && listshopCahe.size() > 0) {
|
| | | for (BrandShopCahe brandShopCahe: listshopCahe) {
|
| | | shopList.add(brandShopCahe.getShop());
|
| | | }
|
| | | }
|
| | | data.put("picList", JsonUtil.getApiCommonGson().toJson(topPicList));
|
| | | data.put("shopList", JsonUtil.getApiCommonGson().toJson(shopList));
|
| | | }
|
| | | |
| | | data.put("count", 50);
|
| | | data.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 店铺足迹
|
| | | * |
| | | * @param acceptData
|
| | | * @param type
|
| | | * 精选1, 足迹列表2
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHistoryV3", method = RequestMethod.POST)
|
| | | public void getHistoryV3(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
|
| | | if (type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("类型不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (page == null || page < 1) {
|
| | | out.print(JsonUtil.loadFalseResult("页码不正确"));
|
| | | return;
|
| | | }
|
| | |
|
| | | int pageSize;
|
| | | if (type == 1) {
|
| | | pageSize = 4;
|
| | | } else {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | | |
| | | List<BrandInfoRecord> listRecord = brandInfoRecordService.listRecord((page - 1) * pageSize, pageSize, uid, acceptData.getDevice());
|
| | | List<BrandInfo> list = new ArrayList<BrandInfo>();
|
| | | if (listRecord != null && listRecord.size() > 0) {
|
| | | for (BrandInfoRecord history : listRecord) {
|
| | | list.add(history.getBrandInfo());
|
| | | }
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", brandInfoRecordService.countRecord(uid, acceptData.getDevice()));
|
| | | data.put("list", JsonUtil.getApiCommonGson().toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.vo.integral.DailySignVO;
|
| | | import com.yeshi.fanli.vo.integral.ExchangeTipVO;
|
| | | import com.yeshi.fanli.vo.integral.IntegralDetailVO;
|
| | |
| | | * // 未领取id
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'receiveGoldCoin-'+#uid")
|
| | | @RequestMapping(value = "receiveGoldCoin", method = RequestMethod.POST)
|
| | | public void receiveGoldCoin(AcceptData acceptData, Long uid, Integer type, String ids, String gids,
|
| | | PrintWriter out) {
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("goldCoin", goldCoin);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralTaskRecordException e) {
|
| | | } catch (IntegralTaskRecordException e) { |
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | }
|
| | | }
|
| | |
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'integralexchange-'+#uid")
|
| | | @RequestMapping(value = "exchange", method = RequestMethod.POST)
|
| | | public void exchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | try {
|
| | |
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'exchangeInviteCode-'+#uid")
|
| | | @RequestMapping(value = "exchangeInviteCode", method = RequestMethod.POST)
|
| | | public void exchangeInviteCode(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | try {
|
| | |
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
|
| | | import com.yeshi.fanli.util.cache.IntegralGetCacheManager;
|
| | | import com.yeshi.fanli.util.cache.TaoBaoGoodsCacheUtil;
|
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | |
| | | * @param goodsType
|
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'tokenReceive-'+#uid")
|
| | | @RequestMapping(value = "tokenReceive", method = RequestMethod.POST)
|
| | | public void tokenReceive(AcceptData acceptData, Long uid, String token, PrintWriter out) {
|
| | | try {
|
| | |
| | | package com.yeshi.fanli.dao.brand;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | |
| | |
|
| | | @Repository
|
| | | public class BrandGoodsCaheDao extends MongodbBaseDao<BrandGoodsCahe> {
|
| | | |
| | | |
| | | /**
|
| | | * 新增
|
| | | * @param record
|
| | | */
|
| | | public void insert(BrandGoodsCahe record) {
|
| | | if (record == null) {
|
| | | return;
|
| | | }
|
| | | mongoTemplate.insert(record);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询商品列表
|
| | |
| | |
|
| | | return mongoTemplate.find(query, BrandGoodsCahe.class);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 统计条数
|
| | | * @param brandId
|
| | | * @return
|
| | | */
|
| | | public long countByBrandId(Long brandId){
|
| | | if (brandId == null) |
| | | return 0;
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("brandId").is(brandId));
|
| | | return mongoTemplate.count(query, BrandGoodsCahe.class);
|
| | | }
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 删除根据时间
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public void removeByDate(Long brandId, Integer goodsType, Date createTime) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(
|
| | | new Criteria().andOperator(
|
| | | Criteria.where("brandId").is(brandId),
|
| | | Criteria.where("goodsType").is(goodsType),
|
| | | Criteria.where("createTime").lt(createTime)
|
| | | )
|
| | | );
|
| | | mongoTemplate.remove(query, BrandGoodsCahe.class);
|
| | | }
|
| | | }
|
| | |
| | | package com.yeshi.fanli.dao.brand;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | |
| | |
|
| | | @Repository
|
| | | public class BrandShopCaheDao extends MongodbBaseDao<BrandShopCahe> {
|
| | | |
| | | |
| | | /**
|
| | | * 新增
|
| | | * @param record
|
| | | */
|
| | | public void insert(BrandShopCahe record) {
|
| | | if (record == null) {
|
| | | return;
|
| | | }
|
| | | mongoTemplate.insert(record);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询品牌下店铺
|
| | |
| | | return mongoTemplate.find(query, BrandShopCahe.class);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询品牌下店铺
|
| | | * @param brandId
|
| | | * @return
|
| | | */
|
| | | public List<BrandShopCahe> getByBrandShop(Long brandId, int type){
|
| | | if (brandId == null) |
| | | return null;
|
| | | Query query = new Query();
|
| | | query.addCriteria(
|
| | | new Criteria().andOperator(
|
| | | Criteria.where("brandId").is(brandId),
|
| | | Criteria.where("shop.userType").is(type)
|
| | | )
|
| | | );
|
| | | return mongoTemplate.find(query, BrandShopCahe.class);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 删除根据时间
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public void removeByDate(Long brandId, int userType,Date createTime) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(
|
| | | new Criteria().andOperator(
|
| | | Criteria.where("brandId").is(brandId),
|
| | | Criteria.where("shop.userType").is(userType),
|
| | | Criteria.where("createTime").lt(createTime)
|
| | | )
|
| | | );
|
| | | mongoTemplate.remove(query, BrandShopCahe.class);
|
| | | }
|
| | | }
|
| | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.brand.BrandClass; |
| | | import com.yeshi.fanli.entity.brand.BrandInfo; |
| | | import com.yeshi.fanli.vo.brand.BrandInfoVO; |
| | | |
| | | public interface BrandInfoMapper extends BaseMapper<BrandInfo> { |
| | | |
| | | /** |
| | | * 查询列表 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @param state |
| | | * @return |
| | | */ |
| | | List<BrandInfo> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key, |
| | | @Param("cid")Long cid, @Param("state") Integer state); |
| | | |
| | | long countQuery(@Param("key") String key, @Param("cid") Long cid, @Param("state") Integer state); |
| | | |
| | | |
| | | int deleteBatchByPrimaryKey(List<Long> list); |
| | | |
| | |
| | | */ |
| | | List<BrandInfo> listValidAll(@Param("start")long start, @Param("count")int count); |
| | | |
| | | |
| | | /** |
| | | * 查询店铺cid |
| | | * @param cid |
| | | * @return |
| | | */ |
| | | List<BrandInfo> listValidByCidToApp(@Param("cid") Long cid); |
| | | |
| | | /** |
| | | * 查询店铺cid |
| | | * @param cid |
| | | * @return |
| | | */ |
| | | long countValidByCid(@Param("cid") Long cid); |
| | | |
| | | /** |
| | | * 查询店铺cid |
| | | * @param cid |
| | | * @return |
| | | */ |
| | | long countValidByCidToApp(@Param("cid") Long cid); |
| | | |
| | | } |
| | |
| | | package com.yeshi.fanli.dao.mybatis.user; |
| | | |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra; |
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO; |
| | | |
| | | public interface UserInfoExtraMapper extends BaseMapper<UserInfoExtra> { |
| | | |
| | | /** |
| | | * 获取用户附加信息 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserInfoExtra getInfoExtraByUid(Long uid); |
| | | |
| | | /** |
| | | * 获取用户附加信息等其他信息 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserInfoExtraVO getInfoExtraVOByUid(Long uid); |
| | | |
| | | |
| | | /** |
| | | * 更新用户信息根据Uid |
| | | * @param userInfoExtra |
| | | */ |
| | | void updateInfoExtraByUid(UserInfoExtra userInfoExtra); |
| | | |
| | | |
| | | /** |
| | | * 统计各个等级数量 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | long countByRankId(Long rankId); |
| | | |
| | | |
| | | /** |
| | | * 获取用户附加信息 |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | UserInfoExtra gerUserRank(Long uid); |
| | | |
| | | package com.yeshi.fanli.dao.mybatis.user;
|
| | |
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.vo.user.UserInfoExtraVO;
|
| | |
|
| | | public interface UserInfoExtraMapper extends BaseMapper<UserInfoExtra> {
|
| | | |
| | | /**
|
| | | * 获取用户附加信息
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | UserInfoExtra getInfoExtraByUid(Long uid);
|
| | | |
| | | /**
|
| | | * 用于数据更新 加锁
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | UserInfoExtra getByUidForUpdate(Long uid);
|
| | | |
| | | /**
|
| | | * 获取用户附加信息等其他信息
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | UserInfoExtraVO getInfoExtraVOByUid(Long uid);
|
| | | |
| | | |
| | | /**
|
| | | * 更新用户信息根据Uid
|
| | | * @param userInfoExtra
|
| | | */
|
| | | void updateInfoExtraByUid(UserInfoExtra userInfoExtra);
|
| | | |
| | | |
| | | /**
|
| | | * 统计各个等级数量
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countByRankId(Long rankId);
|
| | | |
| | | |
| | | /**
|
| | | * 获取用户附加信息
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | UserInfoExtra gerUserRank(Long uid);
|
| | | |
| | | |
| | | /**
|
| | | * 用于数据更新 加锁
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | void updateGoldCoin(@Param("id")Long id, @Param("goldCoin")Integer goldCoin);
|
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.pdd;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import com.google.gson.annotations.SerializedName;
|
| | |
|
| | | public class PDDShopDetail implements Serializable {
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | |
| | | @SerializedName("mall_id")
|
| | | private Long mallId;// 店铺id
|
| | | |
| | | @SerializedName("mall_name")
|
| | | private String mallName;// 店铺名称
|
| | | |
| | | @SerializedName("img_url")
|
| | | private String imgUrl;// 店铺logo
|
| | | |
| | | @SerializedName("merchant_type")
|
| | | private Integer merchanType;// 店铺类型,1-个人,2-企业,3-旗舰店,4-专卖店,5-专营店,6-普通店
|
| | | |
| | | @SerializedName("sales_tip")
|
| | | private String salesTip;// 销量
|
| | | |
| | | @SerializedName("serv_txt")
|
| | | private String servTxt; // 服务评分
|
| | | |
| | | @SerializedName("lgst_txt")
|
| | | private String lgstTxt; // 物流评分
|
| | | |
| | | @SerializedName("desc_txt")
|
| | | private String descTxt; // 描述评分
|
| | | |
| | | @SerializedName("mallRate")
|
| | | private Integer mallRate;// 全店推广佣金
|
| | | |
| | | @SerializedName("goods_num")
|
| | | private Integer goodsNum;// 商品数
|
| | |
|
| | | public Long getMallId() {
|
| | | return mallId;
|
| | | }
|
| | |
|
| | | public void setMallId(Long mallId) {
|
| | | this.mallId = mallId;
|
| | | }
|
| | |
|
| | | public String getMallName() {
|
| | | return mallName;
|
| | | }
|
| | |
|
| | | public void setMallName(String mallName) {
|
| | | this.mallName = mallName;
|
| | | }
|
| | |
|
| | | public String getImgUrl() {
|
| | | return imgUrl;
|
| | | }
|
| | |
|
| | | public void setImgUrl(String imgUrl) {
|
| | | this.imgUrl = imgUrl;
|
| | | }
|
| | |
|
| | | public Integer getMerchanType() {
|
| | | return merchanType;
|
| | | }
|
| | |
|
| | | public void setMerchanType(Integer merchanType) {
|
| | | this.merchanType = merchanType;
|
| | | }
|
| | |
|
| | | public String getSalesTip() {
|
| | | return salesTip;
|
| | | }
|
| | |
|
| | | public void setSalesTip(String salesTip) {
|
| | | this.salesTip = salesTip;
|
| | | }
|
| | |
|
| | | public String getServTxt() {
|
| | | return servTxt;
|
| | | }
|
| | |
|
| | | public void setServTxt(String servTxt) {
|
| | | this.servTxt = servTxt;
|
| | | }
|
| | |
|
| | | public String getLgstTxt() {
|
| | | return lgstTxt;
|
| | | }
|
| | |
|
| | | public void setLgstTxt(String lgstTxt) {
|
| | | this.lgstTxt = lgstTxt;
|
| | | }
|
| | |
|
| | | public String getDescTxt() {
|
| | | return descTxt;
|
| | | }
|
| | |
|
| | | public void setDescTxt(String descTxt) {
|
| | | this.descTxt = descTxt;
|
| | | }
|
| | |
|
| | | public Integer getMallRate() {
|
| | | return mallRate;
|
| | | }
|
| | |
|
| | | public void setMallRate(Integer mallRate) {
|
| | | this.mallRate = mallRate;
|
| | | }
|
| | |
|
| | | public Integer getGoodsNum() {
|
| | | return goodsNum;
|
| | | }
|
| | |
|
| | | public void setGoodsNum(Integer goodsNum) {
|
| | | this.goodsNum = goodsNum;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dto.pdd;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | public class PDDShopResult implements Serializable{
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | private int totalCount;// 总数量
|
| | | private List<PDDShopDetail> list;// 店铺列表
|
| | |
|
| | | public PDDShopResult() {
|
| | | }
|
| | |
|
| | | public PDDShopResult(int totalCount, List<PDDShopDetail> list) {
|
| | | this.totalCount = totalCount;
|
| | | this.list = list;
|
| | | }
|
| | |
|
| | | public int getTotalCount() {
|
| | | return totalCount;
|
| | | }
|
| | |
|
| | | public void setTotalCount(int totalCount) {
|
| | | this.totalCount = totalCount;
|
| | | }
|
| | |
|
| | | public List<PDDShopDetail> getList() {
|
| | | return list;
|
| | | }
|
| | |
|
| | | public void setList(List<PDDShopDetail> list) {
|
| | | this.list = list;
|
| | | }
|
| | | }
|
| | |
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
|
| | | @Document(collection = "brand_goods_cahe")
|
| | | public class BrandGoodsCahe implements Serializable{
|
| | |
| | | @Field("brandId")
|
| | | private Long brandId;
|
| | |
|
| | | @Field("goods")
|
| | | private GoodsDetailVO goods;
|
| | | @Field("goodsType")
|
| | | private Integer goodsType;
|
| | | |
| | | @Field("goodsTB")
|
| | | private TaoBaoGoodsBrief goodsTB;
|
| | | |
| | | @Field("goodsJD")
|
| | | private JDGoods goodsJD;
|
| | | |
| | | @Field("goodsPDD")
|
| | | private PDDGoodsDetail goodsPDD;
|
| | |
|
| | | @Field("weight")
|
| | | private Integer weight;
|
| | |
| | | @Field("createTime")
|
| | | private Date createTime;
|
| | |
|
| | | @Field("updateTime")
|
| | | private Date updateTime;
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | |
| | | this.brandId = brandId;
|
| | | }
|
| | |
|
| | | public GoodsDetailVO getGoods() {
|
| | | return goods;
|
| | | public Integer getGoodsType() {
|
| | | return goodsType;
|
| | | }
|
| | |
|
| | | public void setGoods(GoodsDetailVO goods) {
|
| | | this.goods = goods;
|
| | | public void setGoodsType(Integer goodsType) {
|
| | | this.goodsType = goodsType;
|
| | | }
|
| | |
|
| | | public TaoBaoGoodsBrief getGoodsTB() {
|
| | | return goodsTB;
|
| | | }
|
| | |
|
| | | public void setGoodsTB(TaoBaoGoodsBrief goodsTB) {
|
| | | this.goodsTB = goodsTB;
|
| | | }
|
| | |
|
| | | public JDGoods getGoodsJD() {
|
| | | return goodsJD;
|
| | | }
|
| | |
|
| | | public void setGoodsJD(JDGoods goodsJD) {
|
| | | this.goodsJD = goodsJD;
|
| | | }
|
| | |
|
| | | public PDDGoodsDetail getGoodsPDD() {
|
| | | return goodsPDD;
|
| | | }
|
| | |
|
| | | public void setGoodsPDD(PDDGoodsDetail goodsPDD) {
|
| | | this.goodsPDD = goodsPDD;
|
| | | }
|
| | |
|
| | | public Integer getWeight() {
|
| | |
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
| | |
| | | @Field("createTime")
|
| | | private Date createTime;
|
| | |
|
| | | @Field("updateTime")
|
| | | private Date updateTime;
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.job;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Scheduled;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | /**
|
| | | * 品牌信息更新
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Component
|
| | | public class BrandInfoJob {
|
| | |
|
| | | @Resource
|
| | | private BrandInfoService brandInfoService;
|
| | |
|
| | | /**
|
| | | * 每两个小时进行更新品牌商品信息
|
| | | */
|
| | | @Scheduled(cron = "0 0 1/2 * * ? ")
|
| | | public void updateGoods() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | |
|
| | | long count = brandInfoService.countValidByCid(null);
|
| | | if (count == 0)
|
| | | return;
|
| | |
|
| | | for (int page = 1; page < (count / 100) + 1; page++) {
|
| | | brandInfoService.addShopAndGoods((page - 1) * 100, 100);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandInfo"> |
| | | <id column="bf_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="bf_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="bf_icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="bf_weight" property="weight" jdbcType="DOUBLE"/> |
| | | <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/> |
| | | <result column="bf_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass"> |
| | | <id column="bf_cid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO"> |
| | | <id column="bf_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="bf_name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="bf_icon" property="icon" jdbcType="VARCHAR"/> |
| | | <result column="bf_weight" property="weight" jdbcType="DOUBLE"/> |
| | | <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/> |
| | | <result column="bf_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass"> |
| | | <id column="bf_cid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_weight,bf_goods_total,bf_state,bf_create_time,bf_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_weight,bf_goods_total,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{weight,jdbcType=DOUBLE},#{goodsTotal,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">bf_id,</if> |
| | | <if test="brandClass != null">bf_cid,</if> |
| | | <if test="name != null">bf_name,</if> |
| | | <if test="icon != null">bf_icon,</if> |
| | | <if test="weight != null">bf_weight,</if> |
| | | <if test="goodsTotal != null">bf_goods_total,</if> |
| | | <if test="state != null">bf_state,</if> |
| | | <if test="createTime != null">bf_create_time,</if> |
| | | <if test="updateTime != null">bf_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="brandClass != null">#{brandClass.id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="weight != null">#{weight,jdbcType=DOUBLE},</if> |
| | | <if test="goodsTotal != null">#{goodsTotal,jdbcType=INTEGER},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_weight = #{weight,jdbcType=DOUBLE},bf_goods_total = #{goodsTotal,jdbcType=INTEGER},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info |
| | | <set> |
| | | <if test="brandClass != null">bf_cid=#{brandClass.id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">bf_name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="icon != null">bf_icon=#{icon,jdbcType=VARCHAR},</if> |
| | | <if test="weight != null">bf_weight=#{weight,jdbcType=DOUBLE},</if> |
| | | <if test="goodsTotal != null">bf_goods_total=#{goodsTotal,jdbcType=INTEGER},</if> |
| | | <if test="state != null">bf_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">bf_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">bf_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where bf_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List"> |
| | | delete from yeshi_ec_brand_info WHERE bf_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | <select id="listBrandInfoVO" resultMap="ResultVOMap"> |
| | | SELECT * FROM yeshi_ec_brand_info d |
| | | WHERE d.`bf_state` = 1 <if test="cid != null">AND d.`bf_cid` = #{cid} </if> |
| | | ORDER BY d.`bf_weight` DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countBrandInfo" resultType="Long"> |
| | | SELECT IFNULL(COUNT(d.`bf_id`),0) FROM yeshi_ec_brand_info d |
| | | WHERE d.`bf_state` = 1 <if test="cid != null">AND d.`bf_cid` = #{cid} </if> |
| | | </select> |
| | | |
| | | <select id="listValidAll" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_brand_info d |
| | | WHERE d.`bf_state` = 1 |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | </mapper> |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| | |
|
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.brand.BrandInfo">
|
| | | <id column="bf_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="bf_name" property="name" jdbcType="VARCHAR"/>
|
| | | <result column="bf_icon" property="icon" jdbcType="VARCHAR"/>
|
| | | <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
|
| | | <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/>
|
| | | <result column="bf_state" property="state" jdbcType="INTEGER"/>
|
| | | <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
| | | <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
|
| | | <id column="bf_cid" property="id" jdbcType="BIGINT" /> |
| | | </association>
|
| | | </resultMap>
|
| | | |
| | | <resultMap id="ResultVOMap" type="com.yeshi.fanli.vo.brand.BrandInfoVO">
|
| | | <id column="bf_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="bf_name" property="name" jdbcType="VARCHAR"/>
|
| | | <result column="bf_icon" property="icon" jdbcType="VARCHAR"/>
|
| | | <result column="bf_weight" property="weight" jdbcType="DOUBLE"/>
|
| | | <result column="bf_goods_total" property="goodsTotal" jdbcType="INTEGER"/>
|
| | | <result column="bf_state" property="state" jdbcType="INTEGER"/>
|
| | | <result column="bf_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="bf_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
| | | <association column="bf_cid" property="brandClass" javaType="com.yeshi.fanli.entity.brand.BrandClass">
|
| | | <id column="bf_cid" property="id" jdbcType="BIGINT" /> |
| | | </association>
|
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">bf_id,bf_cid,bf_name,bf_icon,bf_weight,bf_goods_total,bf_state,bf_create_time,bf_update_time</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
| | | <include refid="Base_Column_List"/>from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_brand_info where bf_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info (bf_id,bf_cid,bf_name,bf_icon,bf_weight,bf_goods_total,bf_state,bf_create_time,bf_update_time) values (#{id,jdbcType=BIGINT},#{brandClass.id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{icon,jdbcType=VARCHAR},#{weight,jdbcType=DOUBLE},#{goodsTotal,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_brand_info
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">bf_id,</if>
|
| | | <if test="brandClass != null">bf_cid,</if>
|
| | | <if test="name != null">bf_name,</if>
|
| | | <if test="icon != null">bf_icon,</if>
|
| | | <if test="weight != null">bf_weight,</if>
|
| | | <if test="goodsTotal != null">bf_goods_total,</if>
|
| | | <if test="state != null">bf_state,</if>
|
| | | <if test="createTime != null">bf_create_time,</if>
|
| | | <if test="updateTime != null">bf_update_time,</if>
|
| | | </trim>values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="brandClass != null">#{brandClass.id,jdbcType=BIGINT},</if>
|
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if>
|
| | | <if test="icon != null">#{icon,jdbcType=VARCHAR},</if>
|
| | | <if test="weight != null">#{weight,jdbcType=DOUBLE},</if>
|
| | | <if test="goodsTotal != null">#{goodsTotal,jdbcType=INTEGER},</if>
|
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info set bf_cid = #{brandClass.id,jdbcType=BIGINT},bf_name = #{name,jdbcType=VARCHAR},bf_icon = #{icon,jdbcType=VARCHAR},bf_weight = #{weight,jdbcType=DOUBLE},bf_goods_total = #{goodsTotal,jdbcType=INTEGER},bf_state = #{state,jdbcType=INTEGER},bf_create_time = #{createTime,jdbcType=TIMESTAMP},bf_update_time = #{updateTime,jdbcType=TIMESTAMP} where bf_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.brand.BrandInfo">update yeshi_ec_brand_info
|
| | | <set>
|
| | | <if test="brandClass != null">bf_cid=#{brandClass.id,jdbcType=BIGINT},</if>
|
| | | <if test="name != null">bf_name=#{name,jdbcType=VARCHAR},</if>
|
| | | <if test="icon != null">bf_icon=#{icon,jdbcType=VARCHAR},</if>
|
| | | <if test="weight != null">bf_weight=#{weight,jdbcType=DOUBLE},</if>
|
| | | <if test="goodsTotal != null">bf_goods_total=#{goodsTotal,jdbcType=INTEGER},</if>
|
| | | <if test="state != null">bf_state=#{state,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">bf_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">bf_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </set> where bf_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | |
| | | <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
|
| | | delete from yeshi_ec_brand_info WHERE bf_id in
|
| | | <foreach collection="list" item="item" open="(" close=")"
|
| | | separator=",">#{item}</foreach>
|
| | | </delete>
|
| | | |
| | | <select id="listBrandInfoVO" resultMap="ResultVOMap">
|
| | | SELECT * FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1 AND d.bf_goods_total <![CDATA[>=]]> 3
|
| | | <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
|
| | | ORDER BY d.`bf_weight` DESC,d.bf_id
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | <select id="countBrandInfo" resultType="Long">
|
| | | SELECT IFNULL(COUNT(d.`bf_id`),0) FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1 AND d.bf_goods_total <![CDATA[>=]]> 3
|
| | | <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
|
| | | </select>
|
| | | |
| | | <select id="listValidByCidToApp" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1 AND d.`bf_cid` = #{cid} AND d.bf_goods_total <![CDATA[>=]]> 3
|
| | | </select>
|
| | | |
| | | <select id="countValidByCid" resultType="Long">
|
| | | SELECT IFNULL(COUNT(d.`bf_id`),0) FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1 <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
|
| | | </select>
|
| | | |
| | | <select id="countValidByCidToApp" resultType="Long">
|
| | | SELECT IFNULL(COUNT(d.`bf_id`),0) FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1 <if test="cid != null">AND d.`bf_cid` = #{cid} </if>
|
| | | AND d.bf_goods_total <![CDATA[>=]]> 3
|
| | | </select>
|
| | | |
| | | <select id="listValidAll" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listQuery" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_brand_info
|
| | | WHERE 1=1 |
| | | <if test="key != null and key !='' ">
|
| | | AND bf_name LIKE '%${key}%'
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND bf_state = #{state}
|
| | | </if>
|
| | | <if test="cid != null">
|
| | | AND bf_cid = #{cid}
|
| | | </if>
|
| | | ORDER BY bf_weight DESC
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | <select id="countQuery" resultType="java.lang.Long">
|
| | | SELECT IFNULL(COUNT(bf_id),0) FROM yeshi_ec_brand_info
|
| | | WHERE 1=1 |
| | | <if test="key != null and key !='' ">
|
| | | AND bf_name LIKE '%${key}%'
|
| | | </if>
|
| | | <if test="state != null">
|
| | | AND bf_state = #{state}
|
| | | </if>
|
| | | <if test="cid != null">
|
| | | AND bf_cid = #{cid}
|
| | | </if>
|
| | | </select>
|
| | | </mapper>
|
| | |
| | | <if test="uid != null">AND bir_uid = #{uid}</if> |
| | | <if test="device != null">AND bir_device = #{device}</if> |
| | | </select> |
| | | |
| | | |
| | | <select id="listValidByCidToApp" resultMap="BaseResultMap"> |
| | | SELECT * FROM |
| | | (SELECT bir_id FROM yeshi_ec_brand_info_record |
| | | WHERE bir_state = 0 |
| | | <if test="uid != null">AND bir_uid = #{uid}</if> |
| | | <if test="device != null">AND bir_device = #{device}</if> |
| | | GROUP BY bir_bid)A |
| | | LEFT JOIN yeshi_ec_brand_info_record h on A.bir_id = h.bir_id |
| | | LEFT JOIN `yeshi_ec_brand_info` p ON h.`bir_bid` = p.`bf_id` |
| | | ORDER BY h.bir_update_time DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | </mapper> |
| | |
| | | where uie_uid = #{userInfo.id,jdbcType=BIGINT}
|
| | | </update>
|
| | |
|
| | | <update id="updateGoldCoin">
|
| | | UPDATE yeshi_ec_user_info_extra |
| | | SET uie_gold_coin = IF(uie_gold_coin IS NULL,${goldCoin}, uie_gold_coin + ${goldCoin}) |
| | | WHERE uie_id = #{id}
|
| | | </update>
|
| | |
|
| | | <select id="getInfoExtraByUid" resultMap="BaseResultMap">
|
| | | SELECT * FROM
|
| | |
| | | WHERE uie_uid = #{uid}
|
| | | </select>
|
| | |
|
| | | <select id="getByUidForUpdate" resultMap="BaseResultMap">
|
| | | SELECT * FROM
|
| | | yeshi_ec_user_info_extra
|
| | | WHERE uie_uid = #{uid} FOR UPDATE
|
| | | </select>
|
| | |
|
| | | <select id="getInfoExtraVOByUid" resultMap="VOResultMap">
|
| | | SELECT
|
| | | u.`id`,u.`nick_name`,u.`portrait`,ue.*,rk.*
|
| | |
| | |
|
| | | @Override
|
| | | public List<TaoBaoShop> listEffectiveClassShop(Long cid) {
|
| | | if (cid == null && cid <= 0)
|
| | | if (cid == null)
|
| | | return null;
|
| | |
|
| | | List<BrandClassShop> list = brandClassShopMapper.listEffective(cid);
|
| | |
| | | package com.yeshi.fanli.service.impl.brand;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dto.jd.JDFilter;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchFilter;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchResult;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandGoodsCaheService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private BrandGoodsCaheDao brandGoodsCaheDao;
|
| | | |
| | | @Resource
|
| | | private BrandShopCaheService brandShopCaheService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | * @return
|
| | | */
|
| | | private int addBrandGoodsTB(BrandInfo brandInfo) {
|
| | | Date date = new Date();
|
| | | SearchFilter filter = new SearchFilter();
|
| | | filter.setKey(brandInfo.getName());
|
| | | filter.setPage(1);
|
| | | filter.setPageSize(50);
|
| | | filter.setPageSize(100);
|
| | | filter.setTmall(true);
|
| | | filter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
|
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(filter);
|
| | | if (searchResult == null || searchResult.getTaoBaoGoodsBriefs() == null |
| | | || searchResult.getTaoBaoGoodsBriefs().size() == 0)
|
| | | return 0;
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | List<TaoBaoGoodsBrief> listGoods = searchResult.getTaoBaoGoodsBriefs();
|
| | | for (TaoBaoGoodsBrief goods: listGoods) {
|
| | | BrandGoodsCahe brandGoods = new BrandGoodsCahe();
|
| | | brandGoods.setBrandId(brandInfo.getId());
|
| | | brandGoods.setWeight((int) (Math.random() * 1000));
|
| | | brandGoods.setGoods(GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate));
|
| | | brandGoods.setCreateTime(new Date());
|
| | | brandGoods.setUpdateTime(new Date());
|
| | | brandGoodsCaheDao.save(brandGoods);
|
| | | int count = 0;
|
| | | if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null |
| | | && searchResult.getTaoBaoGoodsBriefs().size() > 0) {
|
| | | boolean addShop = true;
|
| | | List<TaoBaoGoodsBrief> listGoods = searchResult.getTaoBaoGoodsBriefs();
|
| | | for (TaoBaoGoodsBrief goods: listGoods) {
|
| | | // 添加店铺
|
| | | String shopTitle = goods.getShopTitle();
|
| | | if (addShop && !StringUtil.isNullOrEmpty(shopTitle) && shopTitle.contains("旗舰店") |
| | | && shopTitle.contains(brandInfo.getName())) {
|
| | | addShop = brandShopCaheService.addBrandShopTB(brandInfo.getId(), goods.getAuctionId(),
|
| | | goods.getSellerId());
|
| | | }
|
| | | |
| | | // 添加商品
|
| | | if (count < 50) {
|
| | | BrandGoodsCahe brandGoods = new BrandGoodsCahe();
|
| | | brandGoods.setBrandId(brandInfo.getId());
|
| | | brandGoods.setWeight((int) (Math.random() * 1000));
|
| | | brandGoods.setGoodsType(1);
|
| | | brandGoods.setGoodsTB(goods);
|
| | | brandGoods.setCreateTime(date);
|
| | | brandGoodsCaheDao.insert(brandGoods);
|
| | | count ++;
|
| | | } else if (!addShop) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | return listGoods.size();
|
| | | // 删除之前的
|
| | | brandGoodsCaheDao.removeByDate(brandInfo.getId(), 1 , date);
|
| | | |
| | | return count;
|
| | | }
|
| | |
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | private int addBrandGoodsJD(BrandInfo brandInfo) {
|
| | | int count = 0;
|
| | | JDSearchResult result = null;
|
| | | String way = configService.get("jd_api_search_key");
|
| | | if ("1".equals(way)) {
|
| | | JDFilter filterAPI = new JDFilter();
|
| | | filterAPI.setKeyword(SearchFilterUtil.filterSearchContent(brandInfo.getName()));
|
| | | filterAPI.setPageIndex(1);
|
| | | filterAPI.setPageSize(100);
|
| | | filterAPI.setSort(JDFilter.SORT_DESC);
|
| | | filterAPI.setSortName(JDFilter.SORTNAME_ORDER_COUNT_30DAYS);
|
| | | result = JDApiUtil.queryByKey(filterAPI);
|
| | | } else {
|
| | | // 网页爬取
|
| | | JDSearchFilter jdfilter = new JDSearchFilter();
|
| | | jdfilter.setKey(SearchFilterUtil.filterSearchContent(brandInfo.getName()));
|
| | | jdfilter.setPageNo(1);
|
| | | jdfilter.setPageSize(100);
|
| | | jdfilter.setSort(JDSearchFilter.SORT_DESC);
|
| | | jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
|
| | | result = JDUtil.searchByKey(jdfilter);
|
| | | }
|
| | |
|
| | | int count = 0;
|
| | | if (result != null) {
|
| | | PageEntity pageEntity = result.getPageEntity();
|
| | | if (pageEntity != null) {
|
| | | count = (int) pageEntity.getTotalCount();
|
| | | Date date = new Date();
|
| | | for (int i=0; i < 2;i ++) {
|
| | | if ("1".equals(way)) {
|
| | | JDFilter filterAPI = new JDFilter();
|
| | | filterAPI.setKeyword(SearchFilterUtil.filterSearchContent(brandInfo.getName()));
|
| | | filterAPI.setPageIndex(1);
|
| | | filterAPI.setPageSize(30);
|
| | | filterAPI.setSort(JDFilter.SORT_DESC);
|
| | | filterAPI.setSortName(JDFilter.SORTNAME_ORDER_COUNT_30DAYS);
|
| | | result = JDApiUtil.queryByKey(filterAPI);
|
| | | } else {
|
| | | // 网页爬取
|
| | | JDSearchFilter jdfilter = new JDSearchFilter();
|
| | | jdfilter.setKey(SearchFilterUtil.filterSearchContent(brandInfo.getName()));
|
| | | jdfilter.setPageNo(1);
|
| | | jdfilter.setPageSize(30);
|
| | | jdfilter.setSort(JDSearchFilter.SORT_DESC);
|
| | | jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
|
| | | result = JDUtil.searchByKey(jdfilter);
|
| | | }
|
| | |
|
| | | List<JDGoods> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (JDGoods goods : goodsList) {
|
| | | BrandGoodsCahe brandGoods = new BrandGoodsCahe();
|
| | | brandGoods.setBrandId(brandInfo.getId());
|
| | | brandGoods.setWeight((int) (Math.random() * 1000));
|
| | | brandGoods.setGoods(GoodsDetailVOFactory.convertJDGoods(goods, fanLiRate, shareRate));
|
| | | brandGoods.setCreateTime(new Date());
|
| | | brandGoods.setUpdateTime(new Date());
|
| | | brandGoodsCaheDao.save(brandGoods);
|
| | | |
| | | if (result != null) {
|
| | | List<JDGoods> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | for (JDGoods goods : goodsList) {
|
| | | BrandGoodsCahe brandGoods = new BrandGoodsCahe();
|
| | | brandGoods.setBrandId(brandInfo.getId());
|
| | | brandGoods.setWeight((int) (Math.random() * 1000));
|
| | | brandGoods.setGoodsJD(goods);
|
| | | brandGoods.setGoodsType(2);
|
| | | brandGoods.setCreateTime(date);
|
| | | brandGoodsCaheDao.insert(brandGoods);
|
| | | |
| | | if (count == 0) {
|
| | | JDShopInfo shopInfo = goods.getShopInfo();
|
| | | if(shopInfo != null) {
|
| | | brandShopCaheService.addBrandShopJD(brandInfo, shopInfo);
|
| | | }
|
| | | }
|
| | | |
| | | count ++;
|
| | | if (count >= 50) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | // 删除之前
|
| | | brandGoodsCaheDao.removeByDate(brandInfo.getId(), 2 , date);
|
| | | |
| | | return count;
|
| | | }
|
| | |
|
| | |
| | | PDDSearchFilter pddfilter = new PDDSearchFilter();
|
| | | pddfilter.setKw(brandInfo.getName());
|
| | | pddfilter.setPage(1);
|
| | | pddfilter.setPageSize(50);
|
| | | pddfilter.setPageSize(100);
|
| | | pddfilter.setSortType(6);
|
| | |
|
| | | Date date = new Date();
|
| | | int count = 0;
|
| | | PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
|
| | | if (result != null) {
|
| | | count = result.getTotalCount();
|
| | | List<PDDGoodsDetail> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | BrandGoodsCahe brandGoods = new BrandGoodsCahe();
|
| | | brandGoods.setBrandId(brandInfo.getId());
|
| | | brandGoods.setWeight((int) (Math.random() * 1000));
|
| | | brandGoods.setGoods(GoodsDetailVOFactory.convertPDDGoods(goods, fanLiRate, shareRate));
|
| | | brandGoods.setCreateTime(new Date());
|
| | | brandGoods.setUpdateTime(new Date());
|
| | | brandGoodsCaheDao.save(brandGoods);
|
| | | brandGoods.setGoodsType(3);
|
| | | brandGoods.setGoodsPDD(goods);
|
| | | brandGoods.setCreateTime(date);
|
| | | brandGoodsCaheDao.insert(brandGoods);
|
| | | count ++;
|
| | | if (count >= 50) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | // 添加店铺
|
| | | brandShopCaheService.addBrandShopPDD(brandInfo);
|
| | | |
| | | // 删除之前
|
| | | brandGoodsCaheDao.removeByDate(brandInfo.getId(), 3, date);
|
| | | |
| | | return count;
|
| | | |
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<BrandGoodsCahe> getByBrandId(int start, int count, Long brandId){
|
| | | return brandGoodsCaheDao.getByBrandId(start, count, brandId);
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countByBrandId(Long brandId){
|
| | | return brandGoodsCaheDao.countByBrandId(brandId);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Async()
|
| | | @Override
|
| | | public void addRecord(Long brandId, Long uid, String device) {
|
| | | if (brandId == null || brandId == 0)
|
| | |
| | | package com.yeshi.fanli.service.impl.brand;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.brand.BrandShopCaheDao;
|
| | | import com.yeshi.fanli.dao.mybatis.brand.BrandInfoMapper;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfo;
|
| | | import com.yeshi.fanli.entity.brand.BrandShopCahe;
|
| | | import com.yeshi.fanli.entity.taobao.SearchShopFilter;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
|
| | | import com.yeshi.fanli.exception.brand.BrandInfoException;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandGoodsCaheService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.ShopInfoVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.vo.brand.BrandInfoVO;
|
| | | import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | @Service
|
| | | public class BrandInfoServiceImpl implements BrandInfoService {
|
| | | |
| | |
|
| | | @Resource
|
| | | private BrandInfoMapper brandInfoMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private BrandClassShopService brandClassShopService;
|
| | |
|
| | | @Resource
|
| | | private BrandShopCaheDao brandShopCaheDao;
|
| | | |
| | |
|
| | | @Resource
|
| | | private BrandGoodsCaheService brandGoodsCaheService;
|
| | | |
| | | |
| | | |
| | |
|
| | | @Resource
|
| | | private BrandShopCaheService brandShopCaheService;
|
| | |
|
| | | @Override
|
| | | public void saveObject(BrandInfo record) throws BrandInfoException{
|
| | | public void saveObject(BrandInfo record) throws BrandInfoException {
|
| | | String name = record.getName();
|
| | | if (name == null || name.trim().length() == 0)
|
| | | throw new BrandInfoException(1, "名称不能为空");
|
| | | |
| | |
|
| | | Integer state = record.getState();
|
| | | if (state == null)
|
| | | record.setState(0);
|
| | | |
| | |
|
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | | record.setCreateTime(new Date());
|
| | |
| | | BrandInfo resultObj = brandInfoMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null)
|
| | | throw new BrandInfoException(1, "修改内容已不存在");
|
| | | |
| | |
|
| | | record.setCreateTime(resultObj.getCreateTime());
|
| | | record.setUpdateTime(new Date());
|
| | | brandInfoMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | return brandInfoMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<BrandInfo> listQuery(long start, int count, String key, Integer state) {
|
| | | return null;
|
| | | public List<BrandInfo> listQuery(long start, int count, String key, Long cid, Integer state) {
|
| | | return brandInfoMapper.listQuery(start, count, key, cid, state);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public long countQuery(String key, Integer state) {
|
| | | return 0;
|
| | | public long countQuery(String key, Long cid, Integer state) {
|
| | | return brandInfoMapper.countQuery(key, cid, state);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "brandCache", key = "'listValidBrandInfoCache-'+#cid")
|
| | | public List<BrandInfo> listValidBrandInfoCache(Long cid) {
|
| | | List<BrandInfo> listInfo = new ArrayList<BrandInfo>();
|
| | | |
| | |
|
| | | List<TaoBaoShop> listShop = brandClassShopService.listEffectiveClassShop(cid);
|
| | | if (listShop == null || listShop.size() == 0)
|
| | | return listInfo;
|
| | |
| | | }
|
| | | return listInfo;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | @Cacheable(value = "brandCache", key = "'listBrandInfoCache-'+#start+'-'+#start +'-'+#cid")
|
| | | public List<BrandInfoVO> listBrandInfoCache(long start, int count, Long cid) {
|
| | | List<BrandInfoVO> listInfo = new ArrayList<BrandInfoVO>();
|
| | | |
| | |
|
| | | List<TaoBaoShopVO> listShop = brandClassShopService.listEffectiveShop(start, count, cid);
|
| | | if (listShop == null || listShop.size() == 0)
|
| | | return listInfo;
|
| | | |
| | |
|
| | | for (TaoBaoShopVO taoBaoShopVO : listShop) {
|
| | | String shopNameCustom = taoBaoShopVO.getShopNameCustom();
|
| | | if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
|
| | |
| | | if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
|
| | | taoBaoShopVO.setShopIcon(shopIconCustom);
|
| | | }
|
| | | |
| | |
|
| | | BrandInfoVO brandInfoVO = new BrandInfoVO();
|
| | | brandInfoVO.setId(taoBaoShopVO.getId());
|
| | | brandInfoVO.setName(taoBaoShopVO.getShopName());
|
| | |
| | | return listInfo;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public long countBrandInfo(Long cid){
|
| | | public long countBrandInfo(Long cid) {
|
| | | return brandClassShopService.countBrandShopinfo(cid);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void addShopAndGoods(long start, int count) {
|
| | | List<BrandInfo> list = brandInfoMapper.listValidAll(start, count);
|
| | | if(list == null || list.size() == 0) |
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | |
| | | for (BrandInfo brandInfo: list) {
|
| | |
|
| | | for (BrandInfo brandInfo : list) {
|
| | | String key = brandInfo.getName();
|
| | | if(StringUtil.isNullOrEmpty(key))
|
| | | if (StringUtil.isNullOrEmpty(key))
|
| | | continue;
|
| | | |
| | | // 添加店铺
|
| | | addBrandShop(brandInfo);
|
| | | |
| | | // 添加店铺
|
| | |
|
| | | // 添加商品
|
| | | int goodsTotal = brandGoodsCaheService.addBrandGoods(brandInfo);
|
| | | |
| | |
|
| | | brandInfo.setGoodsTotal(goodsTotal);
|
| | | brandInfo.setUpdateTime(new Date());
|
| | | brandInfoMapper.updateByPrimaryKeySelective(brandInfo);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 加入品牌店铺
|
| | | * @param brandInfo
|
| | | */
|
| | | private void addBrandShop(BrandInfo brandInfo) {
|
| | | SearchShopFilter filter = new SearchShopFilter();
|
| | | filter.setKey(brandInfo.getName());
|
| | | filter.setPageSize(100);
|
| | | filter.setTmall(true);
|
| | | filter.setSort("(total_auction_des");
|
| | | |
| | | |
| | | TaoBaoShopInfo taoBaoShop = null;
|
| | | for(int page = 1; page < 3; page++) {
|
| | | filter.setPage(page);
|
| | | List<TaoBaoShopInfo> listShop = TaoKeApiUtil.searchShop(filter);
|
| | | if(listShop == null || listShop.size() == 0)
|
| | |
|
| | | @Override
|
| | | public long countValidByCid(Long cid) {
|
| | | return brandInfoMapper.countValidByCid(cid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countValidByCidToApp(Long cid) {
|
| | | return brandInfoMapper.countValidByCidToApp(cid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Cacheable(value = "brandCache", key = "'listValidByCidToApp-'+#cid")
|
| | | public List<BrandInfo> listValidByCidToApp(Long cid) {
|
| | | if (cid == null)
|
| | | return null;
|
| | | return brandInfoMapper.listValidByCidToApp(cid);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "brandCache", key = "'listValidToApp-'+#start+'-'+#start +'-'+#cid")
|
| | | @Override
|
| | | public List<BrandInfoVO> listValidToApp(long start, int count, Long cid) {
|
| | | List<BrandInfoVO> list = brandInfoMapper.listBrandInfoVO(start, count, cid);
|
| | | if (list == null || list.size() == 0)
|
| | | return null;
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | |
|
| | | List<BrandInfoVO> listInfo = new ArrayList<BrandInfoVO>();
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | BrandInfoVO brand = list.get(i);
|
| | | if (brand == null)
|
| | | continue;
|
| | |
|
| | | for (TaoBaoShopInfo shop: listShop) {
|
| | | String shopTitle = shop.getShopTitle();
|
| | | if(StringUtil.isNullOrEmpty(shopTitle))
|
| | | List<BrandGoodsCahe> listGoods = brandGoodsCaheService.getByBrandId(1, 3, brand.getId());
|
| | | if (listGoods == null || listGoods.size() < 3)
|
| | | continue;
|
| | |
|
| | | List<GoodsDetailVO> listGoodsVO = new ArrayList<GoodsDetailVO>();
|
| | | for (BrandGoodsCahe brandGoods : listGoods) {
|
| | | JDGoods goodsJD = brandGoods.getGoodsJD();
|
| | | if (goodsJD != null) {
|
| | | listGoodsVO.add(GoodsDetailVOFactory.convertJDGoods(goodsJD, fanLiRate, shareRate));
|
| | | continue;
|
| | | |
| | | if(!shopTitle.contains("旗舰店"))
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goodsTB = brandGoods.getGoodsTB();
|
| | | if (goodsTB != null) {
|
| | | listGoodsVO.add(GoodsDetailVOFactory.convertTaoBao(goodsTB, null, fanLiRate, shareRate));
|
| | | continue;
|
| | | |
| | | taoBaoShop = shop;
|
| | | break;
|
| | | }
|
| | |
|
| | | PDDGoodsDetail goodsPDD = brandGoods.getGoodsPDD();
|
| | | if (goodsPDD != null) {
|
| | | listGoodsVO.add(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, fanLiRate, shareRate));
|
| | | continue;
|
| | | }
|
| | | }
|
| | | |
| | | if (taoBaoShop != null) |
| | | break;
|
| | |
|
| | | if (listGoodsVO.size() >= 3) {
|
| | | brand.setListGoods(listGoodsVO);
|
| | | listInfo.add(brand);
|
| | | }
|
| | | }
|
| | | |
| | | BrandShopCahe brandShop = new BrandShopCahe();
|
| | | brandShop.setBrandId(brandInfo.getId());
|
| | | brandShop.setShop(ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop));
|
| | | brandShop.setCreateTime(new Date());
|
| | | brandShop.setUpdateTime(new Date());
|
| | | brandShopCaheDao.save(brandShop);
|
| | | return listInfo;
|
| | | }
|
| | | |
| | | |
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.brand;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.brand.BrandGoodsCaheDao;
|
| | | import com.yeshi.fanli.dao.brand.BrandShopCaheDao;
|
| | | import com.yeshi.fanli.dto.jd.JDFilter;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchFilter;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchResult;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
|
| | | import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.brand.BrandShopCahe;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandShopCaheService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.ShopInfoVOFactory;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.SearchFilterUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.goods.ShopInfoVO;
|
| | |
|
| | | @Service
|
| | | public class BrandShopCaheServiceImpl implements BrandShopCaheService {
|
| | |
| | | @Resource
|
| | | private BrandShopCaheDao brandShopCaheDao;
|
| | |
|
| | | |
| | | @Override
|
| | | public void addBrandShop(BrandInfo brandInfo) {
|
| | | int count = 0;
|
| | | // // 淘宝
|
| | | // count += addBrandShopTB(brandInfo);
|
| | | // // 京东
|
| | | // count += addBrandShopJD(brandInfo);
|
| | | // // 拼多多
|
| | | // count += addBrandShopPDD(brandInfo);
|
| | | |
| | | }
|
| | | @Resource
|
| | | private TaoBaoShopService taoBaoShopService;
|
| | |
|
| | |
|
| | | /**
|
| | | * 淘宝商品
|
| | | * 淘宝店铺
|
| | | * @param brandInfo
|
| | | * @return
|
| | | */
|
| | | private void addBrandShopTB(BrandInfo brandInfo) {
|
| | | @Override
|
| | | public boolean addBrandShopTB(Long brandId, Long auctionId, Long sellerId) {
|
| | | TaoBaoShop taoBaoShop = taoBaoShopService.getTaoBaoShop(auctionId, sellerId);
|
| | | if (taoBaoShop == null)
|
| | | return true;
|
| | |
|
| | | Date date = new Date();
|
| | | BrandShopCahe brandShop = new BrandShopCahe();
|
| | | brandShop.setBrandId(brandId);
|
| | | brandShop.setShop(ShopInfoVOFactory.convertTaoBaoShop(taoBaoShop));
|
| | | brandShop.setCreateTime(date);
|
| | | brandShopCaheDao.insert(brandShop);
|
| | | |
| | | // 删除店铺
|
| | | brandShopCaheDao.removeByDate(brandId, 11, date);
|
| | | |
| | | return false;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 京东商品
|
| | | * 京东
|
| | | *
|
| | | * @param brandInfo
|
| | | * @return
|
| | | */
|
| | | private void addBrandShopJD(BrandInfo brandInfo) {
|
| | | @Override
|
| | | public void addBrandShopJD(BrandInfo brandInfo, JDShopInfo shopInfo) {
|
| | | Date date = new Date();
|
| | | ShopInfoVO shopInfoVO = ShopInfoVOFactory.convertJDShop(shopInfo);
|
| | | shopInfoVO.setShopIcon(brandInfo.getIcon());
|
| | | BrandShopCahe brandShop = new BrandShopCahe();
|
| | | brandShop.setBrandId(brandInfo.getId());
|
| | | brandShop.setShop(shopInfoVO);
|
| | | brandShop.setCreateTime(date);
|
| | | brandShopCaheDao.save(brandShop);
|
| | |
|
| | | brandShopCaheDao.removeByDate(brandInfo.getId(), 20, date);
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 拼多多商品
|
| | | * 拼多多
|
| | | * @param brandInfo
|
| | | * @return
|
| | | */
|
| | | private void addBrandShopPDD(BrandInfo brandInfo) {
|
| | | @Override
|
| | | public void addBrandShopPDD(BrandInfo brandInfo) {
|
| | | ShopInfoVO shopInfoVO = null;
|
| | | String key = brandInfo.getName();
|
| | | PDDSearchFilter pddfilter = new PDDSearchFilter();
|
| | | pddfilter.setKw(key);
|
| | | pddfilter.setPage(1);
|
| | | pddfilter.setPageSize(100);
|
| | | pddfilter.setSortType(6);
|
| | | pddfilter.setMerchantType(3);
|
| | | PDDGoodsResult result = PinDuoDuoApiUtil.searchGoods(pddfilter);
|
| | | if (result != null) {
|
| | | List<PDDGoodsDetail> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | for (PDDGoodsDetail goods : goodsList) {
|
| | | String mallName = goods.getMallName();
|
| | | if(goods.getMallId() != null && !StringUtil.isNullOrEmpty(mallName) && mallName.contains(key)){
|
| | | shopInfoVO = new ShopInfoVO();
|
| | | shopInfoVO.setId(goods.getMallId().toString());
|
| | | shopInfoVO.setShopName(mallName);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | if (shopInfoVO != null) {
|
| | | shopInfoVO.setShopIcon(brandInfo.getIcon());
|
| | | shopInfoVO.setUserType(30);
|
| | | shopInfoVO.setShopLink("https://mobile.yangkeduo.com/mall_page.html?mall_id=" + shopInfoVO.getId());
|
| | | |
| | | Date date = new Date(); |
| | | BrandShopCahe brandShop = new BrandShopCahe();
|
| | | brandShop.setBrandId(brandInfo.getId());
|
| | | brandShop.setShop(shopInfoVO);
|
| | | brandShop.setCreateTime(date);
|
| | | brandShopCaheDao.insert(brandShop);
|
| | | |
| | | brandShopCaheDao.removeByDate(brandInfo.getId(), 30, date);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public List<BrandShopCahe> getByBrandId(Long brandId){
|
| | | return brandShopCaheDao.getByBrandId(brandId);
|
| | | }
|
| | | }
|
| | |
| | | return userInfoExtraMapper.getInfoExtraByUid(uid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public UserInfoExtra getByUidForUpdate(Long uid) {
|
| | | return userInfoExtraMapper.getByUidForUpdate(uid);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void updateGoldCoin(Long id, Integer goldCoin) {
|
| | | userInfoExtraMapper.updateGoldCoin(id, goldCoin);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public UserInfoExtraVO getInfoExtraVOByUid(Long uid) {
|
| | | return userInfoExtraMapper.getInfoExtraVOByUid(uid);
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public Integer receiveGoldCoinALL(Long uid) throws IntegralTaskRecordException {
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null)
|
| | | throw new IntegralTaskRecordException(1, "用户信息不全");
|
| | |
|
| | |
| | | if (addDetail(uid, record))
|
| | | totalGoldCoin += record.getGoldCoin();
|
| | | }
|
| | |
|
| | | |
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | | if (goldCoin == null)
|
| | | goldCoin = 0;
|
| | |
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setGoldCoin(goldCoin + totalGoldCoin);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | throw new IntegralTaskRecordException(1, "用户信息不全");
|
| | | }
|
| | |
|
| | | return extra.getGoldCoin();
|
| | | goldCoin = goldCoin + totalGoldCoin;
|
| | | |
| | | // 更新金币
|
| | | userInfoExtraService.updateGoldCoin(userInfoExtra.getId(), goldCoin);
|
| | | |
| | | return goldCoin;
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | @Override |
| | | @Transactional(rollbackFor=Exception.class)
|
| | | public Integer receiveGoldCoin(Long uid, Set<Long> idList) throws IntegralTaskRecordException {
|
| | | if (idList == null || idList.size() == 0) {
|
| | | throw new IntegralTaskRecordException(1, "id为空");
|
| | | }
|
| | |
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getByUidForUpdate(uid);
|
| | | if (userInfoExtra == null) {
|
| | | throw new IntegralTaskRecordException(1, "用户信息不全");
|
| | | }
|
| | |
| | | if (addDetail(uid, record))
|
| | | totalGoldCoin += record.getGoldCoin();
|
| | | }
|
| | |
|
| | | |
| | | Integer goldCoin = userInfoExtra.getGoldCoin();
|
| | | if (goldCoin == null)
|
| | | goldCoin = 0;
|
| | |
|
| | | UserInfoExtra extra = new UserInfoExtra();
|
| | | extra.setId(userInfoExtra.getId());
|
| | | extra.setGoldCoin(goldCoin + totalGoldCoin);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(extra);
|
| | | } catch (UserInfoExtraException e) {
|
| | | throw new IntegralTaskRecordException(1, "用户信息不全");
|
| | | }
|
| | | goldCoin = goldCoin + totalGoldCoin;
|
| | | |
| | | // 更新金币
|
| | | userInfoExtraService.updateGoldCoin(userInfoExtra.getId(), goldCoin);
|
| | |
|
| | | return extra.getGoldCoin();
|
| | | return goldCoin;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public boolean addDetail(Long uid, IntegralTaskRecord record) throws IntegralTaskRecordException {
|
| | |
|
| | | Long uid2 = record.getUid();
|
| | | if (uid2 == null || uid.longValue() != uid2.longValue())
|
| | | return false; // 用户id不符合
|
| | |
| | | package com.yeshi.fanli.service.inter.brand;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfo;
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | public int addBrandGoods(BrandInfo brandInfo);
|
| | |
|
| | | /**
|
| | | * 查询品牌商品
|
| | | * @param start
|
| | | * @param count
|
| | | * @param brandId
|
| | | * @return
|
| | | */
|
| | | public List<BrandGoodsCahe> getByBrandId(int start, int count, Long brandId);
|
| | |
|
| | | /**
|
| | | * 统计品牌商品数量
|
| | | * @param brandId
|
| | | * @return
|
| | | */
|
| | | public long countByBrandId(Long brandId);
|
| | |
|
| | | }
|
| | |
| | | * @param state
|
| | | * @return
|
| | | */
|
| | | public List<BrandInfo> listQuery(long start, int count, String key, Integer state);
|
| | | public List<BrandInfo> listQuery(long start, int count, String key, Long cid, Integer state);
|
| | |
|
| | | public long countQuery(String key, Integer state);
|
| | | public long countQuery(String key, Long cid, Integer state);
|
| | |
|
| | | /**
|
| | | * 查询品牌返回前端
|
| | |
| | | */
|
| | | public List<BrandInfo> listValidBrandInfoCache(Long cid);
|
| | |
|
| | | /**
|
| | | * 查询分类下品牌
|
| | | * @param cid
|
| | | * @return
|
| | | */
|
| | | public List<BrandInfo> listValidByCidToApp(Long cid);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询品牌以及对应商品
|
| | | * @param start
|
| | | * @param count
|
| | | * @param cid
|
| | | * @return
|
| | | */
|
| | | public List<BrandInfoVO> listValidToApp(long start, int count, Long cid);
|
| | |
|
| | | |
| | | /**
|
| | | * 新增商品或店铺信息
|
| | | * @param start
|
| | | * @param count
|
| | | */
|
| | | public void addShopAndGoods(long start, int count);
|
| | |
|
| | |
|
| | | public long countValidByCidToApp(Long cid);
|
| | |
|
| | |
|
| | | public long countValidByCid(Long cid);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.brand;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.entity.brand.BrandInfo;
|
| | | import com.yeshi.fanli.entity.brand.BrandShopCahe;
|
| | |
|
| | | /**
|
| | | * 品牌店铺
|
| | |
| | | */
|
| | | public interface BrandShopCaheService {
|
| | |
|
| | | public void addBrandShop(BrandInfo brandInfo);
|
| | |
|
| | | /**O
|
| | | * 获取品牌店铺
|
| | | * @param brandId
|
| | | * @return
|
| | | */
|
| | | public List<BrandShopCahe> getByBrandId(Long brandId);
|
| | |
|
| | | /**
|
| | | * 添加淘宝店铺信息
|
| | | * @param brandId
|
| | | * @param auctionId
|
| | | * @param sellerId
|
| | | */
|
| | | public boolean addBrandShopTB(Long brandId, Long auctionId, Long sellerId);
|
| | |
|
| | | /**
|
| | | * 添加京东店铺信息
|
| | | * @param brandId
|
| | | * @param shopInfo
|
| | | */
|
| | | public void addBrandShopJD(BrandInfo brandInfo, JDShopInfo shopInfo);
|
| | |
|
| | | /**
|
| | | * 添加拼多多店铺
|
| | | * @param brandInfo
|
| | | */
|
| | | public void addBrandShopPDD(BrandInfo brandInfo);
|
| | |
|
| | | }
|
| | |
| | | * @throws UserInfoExtraException
|
| | | */
|
| | | public UserInfo getInviterInfo(WXAccountInfoDTO wxAccount,Long uid, String code) throws UserInfoExtraException;
|
| | |
|
| | | /**
|
| | | * 更新信息 + 加锁
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public UserInfoExtra getByUidForUpdate(Long uid);
|
| | | |
| | | /**
|
| | | * 更新用户金币
|
| | | * @param id
|
| | | * @param goldCoin
|
| | | * @return
|
| | | */
|
| | | public void updateGoldCoin(Long id, Integer goldCoin);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShop;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
|
| | |
| | | shopInfoVO.setGoodRatePercentage(shop.getGoodRatePercentage());
|
| | |
|
| | | Integer shopType = shop.getUserType();
|
| | | if (shopType != null && shopType == 2) {
|
| | | if (shopType != null && shopType == 1) {
|
| | | shopInfoVO.setUserType(11); // 天猫
|
| | | } else {
|
| | | shopInfoVO.setUserType(10); // 淘宝
|
| | |
| | | shopInfoVO.setScoreSeller(new BigDecimal(goods.getAvgServ()));
|
| | | shopInfoVO.setScoreLogistics(new BigDecimal(goods.getAvgLgst()));
|
| | | shopInfoVO.setGoodRatePercentage(new BigDecimal(goods.getGoodsEvalScore()));
|
| | | // shopInfoVO.setShopIcon(shop.getShopIcon());
|
| | | // shopInfoVO.setShopLink(shop.getShopLink());
|
| | | shopInfoVO.setShopLink("https://mobile.yangkeduo.com/mall_page.html?mall_id=" + goods.getMallId());
|
| | | return shopInfoVO;
|
| | | }
|
| | | |
| | | /**
|
| | | * 拼多多店铺
|
| | | * @param goods 淘宝商品
|
| | | * @param pid
|
| | | * @param fanLiRate 返利比例
|
| | | * @return
|
| | | */
|
| | | public static ShopInfoVO convertJDShop(JDShopInfo shopInfo) {
|
| | | ShopInfoVO shopInfoVO = new ShopInfoVO();
|
| | | shopInfoVO.setId(shopInfo.getShopId().toString());
|
| | | shopInfoVO.setShopName(shopInfo.getShopName());
|
| | | shopInfoVO.setUserType(20);
|
| | | shopInfoVO.setShopLink("https://shop.m.jd.com/?shopId=" + shopInfo.getShopId());
|
| | | return shopInfoVO;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dto.pdd.PDDOrderResult;
|
| | | import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
|
| | | import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
|
| | | import com.yeshi.fanli.dto.pdd.PDDShopDetail;
|
| | | import com.yeshi.fanli.dto.pdd.PDDShopResult;
|
| | | import com.yeshi.fanli.entity.pdd.PDDOrder;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | map.put("keyword", sf.getKw());
|
| | | if (sf.getGoodsIdList() != null)
|
| | | map.put("goods_id_list", "[" + StringUtil.concat(sf.getGoodsIdList(), ",") + "]");
|
| | |
|
| | | if (sf.getMerchantType() != null)
|
| | | map.put("merchant_type", sf.getMerchantType() + "");
|
| | | map.put("pid", PID_FANLI);
|
| | | String result = baseRequest(map);
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取商品详情
|
| | | * |
| | | * @param goodsId
|
| | | */
|
| | | public static PDDShopResult getShopList(Integer page,Long catId) {
|
| | | JSONArray arrayType = new JSONArray();
|
| | | arrayType.add(3);
|
| | | |
| | | Map<String, String> map = new HashMap<>();
|
| | | map.put("type", "pdd.ddk.merchant.list.get");
|
| | | if (catId != null)
|
| | | map.put("cat_id", catId +"");
|
| | | if (page != null)
|
| | | map.put("page_number", page +"");
|
| | | |
| | | if (page != null)
|
| | | map.put("page_number", page +"");
|
| | | |
| | | map.put("merchant_type_list", arrayType.toString());
|
| | | |
| | | String result = baseRequest(map);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | JSONObject root = resultJson.optJSONObject("merchant_list_response");
|
| | | if (root != null) {
|
| | | int totalCount = root.optInt("total");
|
| | | |
| | | JSONArray array = root.optJSONArray("mall_search_info_vo_list");
|
| | | Type type = new TypeToken<List<PDDShopDetail>>() {}.getType();
|
| | | List<PDDShopDetail> listShop = new Gson().fromJson(array.toString(), type);
|
| | | return new PDDShopResult(totalCount, listShop);
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod pm = new PostMethod("https://jinbao.pinduoduo.com/network/api/common/queryTopGoodsList");
|
| | | pm.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko");
|
| | | pm.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3730.400 QQBrowser/10.5.3805.400");
|
| | | pm.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
| | | pm.setRequestHeader("Referer", "https://jinbao.pinduoduo.com/promotion/hot-promotion");
|
| | | pm.setRequestBody(params.toString());
|