| | |
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsGroup;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord.ShareSourceTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserGoodsStorage;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | String shareType = shareRecord.getShareType();
|
| | | if (StringUtil.isNullOrEmpty(shareType)) {
|
| | | shareRecord.setShareType(UserShareGoodsRecord.SHARETYPE_SINGLE);
|
| | | }
|
| | | |
| | | BigDecimal totalMoney = shareRecord.getTotalMoney();
|
| | | if (totalMoney == null) {
|
| | | shareRecord.setTotalMoney(new BigDecimal(0));
|
| | | }
|
| | | }
|
| | | } else {
|
| | | for (UserShareGoodsRecord shareRecord : list) {
|
| | | String shareType = shareRecord.getShareType();
|
| | | if (StringUtil.isNullOrEmpty(shareType)) {
|
| | | shareRecord.setShareType(UserShareGoodsRecord.SHARETYPE_SINGLE);
|
| | | }
|
| | | |
| | | BigDecimal totalMoney = shareRecord.getTotalMoney();
|
| | | if (totalMoney == null) {
|
| | | shareRecord.setTotalMoney(new BigDecimal(0));
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | recordDTO.setSource(ShareSourceTypeEnum.goodsDetail);
|
| | |
|
| | | // 分享id
|
| | | String key = StringUtil.Md5(uid + "#" + auctionId);
|
| | | String key = StringUtil.Md5(uid + "#GoodsDetail#" + auctionId);
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorage(Long uid, List<TaoBaoGoodsBrief> listGoodsBrief)
|
| | | public ShareGoodsRecordDTO addRecordGoodsStorage(Long uid, List<TaoBaoGoodsBrief> listGoodsBrief, List<Long> listStorageID)
|
| | | throws UserShareGoodsRecordException {
|
| | | if (uid == null || uid <= 0 || listGoodsBrief == null || listGoodsBrief.size() == 0) {
|
| | | throw new UserShareGoodsRecordException(1, "传递参数不正确");
|
| | |
| | | ShareGoodsRecordDTO recordDTO = new ShareGoodsRecordDTO();
|
| | | recordDTO.setUid(uid);
|
| | | recordDTO.setShareId(id);
|
| | | recordDTO.setListGoodsBrief(listGoodsBrief);
|
| | | recordDTO.setShareUrl(shareUrl);
|
| | | recordDTO.setListId(listStorageID);
|
| | | recordDTO.setListGoodsBrief(listGoodsBrief);
|
| | | recordDTO.setSharePictureUrl(uploadResult.getUrl());
|
| | | recordDTO.setSource(ShareSourceTypeEnum.storage);
|
| | |
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "##" + id);
|
| | | String key = StringUtil.Md5(uid + "#GoodsStorage#" + id);
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | recordDTO.setSharePictureUrl(uploadResult.getUrl());
|
| | | recordDTO.setSource(ShareSourceTypeEnum.activity);
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "##" + id);
|
| | | String key = StringUtil.Md5(uid + "#Activity#" + id);
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | ShareGoodsRecordDTO recordDTO = new ShareGoodsRecordDTO();
|
| | | recordDTO.setUid(uid);
|
| | | recordDTO.setShareId(id);
|
| | | recordDTO.setListGoodsBrief(listGoodsBrief);
|
| | | recordDTO.setShareUrl(shareUrl);
|
| | | recordDTO.setListGoodsBrief(listGoodsBrief);
|
| | | recordDTO.setSource(ShareSourceTypeEnum.activity);
|
| | |
|
| | | // 缓存分享商品信息
|
| | | String key = StringUtil.Md5(uid + "##" + id);
|
| | | String key = StringUtil.Md5(uid + "#Dynamic#" + id);
|
| | | recordDTO.setRedisKey(key);
|
| | |
|
| | | redisManager.cacheCommonString(key, JsonUtil.getSimpleGson().toJson(recordDTO), 60 * 20);
|
| | |
| | | shareRecord.setUpdateTime(new Date());
|
| | | updateByPrimaryKeySelective(shareRecord);
|
| | |
|
| | | // 保存商品信息
|
| | | multipleGoodsShareRecord(shareId, recordDTO.getListGoodsBrief());
|
| | | |
| | | // 更新选品库商品状态 为已分享
|
| | | List<UserShareGoodsGroup> listgoods = userShareGoodsGroupService.listByRecordId(shareId);
|
| | | if (listgoods != null && listgoods.size() > 0) {
|
| | | for (UserShareGoodsGroup userShareGoodsGroup : listgoods) {
|
| | | CommonGoods commonGoods = userShareGoodsGroup.getCommonGoods();
|
| | | if (commonGoods == null) {
|
| | | continue;
|
| | | }
|
| | | userGoodsStorageService.updateShareStateByCommonGoodsId(commonGoods.getId());
|
| | | List<Long> listId = recordDTO.getListId();
|
| | | if (listId != null && listId.size() > 0) {
|
| | | for (Long id : listId) {
|
| | | UserGoodsStorage userGoodsStorage = new UserGoodsStorage();
|
| | | userGoodsStorage.setId(id);
|
| | | userGoodsStorage.setState(1);
|
| | | userGoodsStorageService.updateByPrimaryKeySelective(userGoodsStorage);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | // 清理缓存
|
| | | redisManager.removeCommonString(shareKey);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | InputStream inputStream = ImageUtil.drawGoodsShareBigImg(erCodeInputStream, portrait, listGoods);
|
| | | InputStream inputStream = ImageUtil.drawGoodsSharePicture(erCodeInputStream, portrait, listGoods);
|
| | | FileUploadResult shareImg = COSManager.getInstance().uploadInputStream(inputStream,
|
| | | "sharegoods/share_" + uid + "_" + shareId + "_" + System.currentTimeMillis() + ".png");
|
| | |
|