| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.activity.RecommendActivityInviteInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.activity.RecommendActivityMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.activity.RecommendActivityTaoBaoGoodsMapper;
|
| | | import com.yeshi.fanli.dto.share.ShareGoodsRecordDTO;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityShareResult;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityImg;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityInviteInfo;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivityTaoBaoGoods;
|
| | | import com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord.ShareSourceTypeEnum;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | | |
| | | @Resource
|
| | | private DynamicInfoService dynamicInfoService;
|
| | | |
| | | @Resource
|
| | | private ActivityUserService activityUserService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<RecommendActivity> getRecommendActivityList(int page, int pageSize) {
|
| | |
| | | throw new ActivityException(1, "商品下架");
|
| | | }
|
| | |
|
| | | Map<String, Object> map = userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.activity, title,
|
| | | listGoodsBrief);
|
| | | imgList.add((FileUploadResult) map.get("loadResult"));
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordActivity(uid, listGoodsBrief);
|
| | | FileUploadResult loadResult = new FileUploadResult();
|
| | | loadResult.setUrl(shareRecord.getSharePictureUrl());
|
| | | |
| | | imgList.add(loadResult);
|
| | | result.setImgList(imgList);
|
| | |
|
| | | return result;
|
| | |
| | | JSONObject contentJson2 = new JSONObject();
|
| | | contentJson2.put("color", fontColor2);
|
| | | contentJson2.put("content", revenue);
|
| | |
|
| | | |
| | | array.add(contentJson1);
|
| | | array.add(contentJson2);
|
| | |
|
| | | ShareGoodsRecordDTO shareRecord = userShareGoodsRecordService.addRecordActivity(uid, listGoodsBrief);
|
| | | FileUploadResult loadResult = new FileUploadResult();
|
| | | loadResult.setUrl(shareRecord.getSharePictureUrl());
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
|
| | | Map<String, Object> map = userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.activity, title,
|
| | | listGoodsBrief);
|
| | |
|
| | | data.put("title", title);
|
| | | data.put("revenue", array);
|
| | | data.put("fanMoney", shareMoney);
|
| | | data.put("shareId", map.get("shareId"));
|
| | | data.put("shareImg", map.get("loadResult"));
|
| | | data.put("notifyDesc", configService.get("goods_share_multiple_notify"));
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | data.put("shareImg", loadResult);
|
| | | data.put("notifyDesc", configService.get(ConfigKeyEnum.goodsShareMultipleNotify.getKey()));
|
| | |
|
| | | return data;
|
| | |
|
| | |
| | | return activityUserMapper.selectList();
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity addShareGoodsRecommendActivity(Long activityUid, List<Long> goodsList,
|
| | | RecommendActivity activity) throws ActivityException , Exception{
|
| | |
| | | for (long auctionId : goodsList) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | tb = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | tb = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity addInviteImgRecommendActivity(Long activityUid, RecommendActivity activity, String url,
|
| | | int px, int py, int erCodeSize) throws ActivityException, Exception {
|
| | |
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity addTextAndImgRecommendActivity(Long activityUid, List<String> imgList,
|
| | | RecommendActivity activity) throws ActivityException, Exception {
|
| | |
| | | recommendActivityMapper.batchDeleteByPrimaryKey(ids);
|
| | | recommendActivityImgMapper.batchDeleteByActivityid(ids);
|
| | | recommendActivityTaoBaoGoodsMapper.batchDeleteByActivityid(ids);
|
| | | |
| | | try {
|
| | | for (Long id: ids) {
|
| | | dynamicInfoService.deleteActivity(id);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | return recommendActivityMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity updateShareGoodsRecommendActivity(Long activityUid,
|
| | | List<Long> goodsList, RecommendActivity activity) throws ActivityException , Exception{
|
| | |
| | | activity.setType(RecommendActivity.TYPE_SHARE_GOODS);
|
| | | recommendActivityMapper.updateByPrimaryKeySelective(activity);
|
| | |
|
| | | List<RecommendActivityTaoBaoGoods> listgoods = new ArrayList<RecommendActivityTaoBaoGoods>();
|
| | | BigDecimal taotaoMoney = new BigDecimal(0);
|
| | | for (long auctionId : goodsList) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | |
|
| | | try {
|
| | | tb = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | tb = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | recommendActivityTaoBaoGoodsMapper.insertSelective(goods);
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb);
|
| | | taotaoMoney = taotaoMoney.add(money);
|
| | | |
| | | listgoods.add(goods);
|
| | | }
|
| | |
|
| | | RecommendActivity updateActivity = new RecommendActivity();
|
| | | updateActivity.setId(activity.getId());
|
| | | updateActivity.setTotalGetMoney("预估分享奖金:¥" + taotaoMoney.toString());
|
| | | recommendActivityMapper.updateByPrimaryKeySelective(updateActivity);
|
| | |
|
| | | |
| | | // 1.5.4 动态信息更新
|
| | | RecommendActivity exist = recommendActivityMapper.selectByPrimaryKey(activity.getId());
|
| | | if (exist.getState() != null && exist.getState() == 1) {
|
| | | try {
|
| | | ActivityUser activityUser = activityUserService.selectByPrimaryKey(activityUid);
|
| | | exist.setActivityUser(activityUser);
|
| | | exist.setGoodsList(listgoods);
|
| | | dynamicInfoService.insertActivityRecommend(exist);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity updateInviteImgRecommendActivity(Long activityUid, RecommendActivity activity, String url,
|
| | | int px, int py, int erCodeSize) throws ActivityException , Exception{
|
| | |
| | | recommendActivityInviteInfo.setSize(erCodeSize);
|
| | | recommendActivityInviteInfoMapper.insertSelective(recommendActivityInviteInfo);
|
| | |
|
| | | |
| | | RecommendActivity exist = recommendActivityMapper.selectByPrimaryKey(activity.getId());
|
| | | if (exist.getState() != null && exist.getState() == 1) {
|
| | | try {
|
| | | ActivityUser activityUser = activityUserService.selectByPrimaryKey(activityUid);
|
| | | activity.setActivityUser(activityUser);
|
| | | activity.setInviteInfo(recommendActivityInviteInfo);
|
| | | List<String> imageList = new ArrayList<String>();
|
| | | imageList.add(url);
|
| | | activity.setImageList(imageList);
|
| | | dynamicInfoService.insertInviteActivity(activity);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity updateTextAndImgRecommendActivity(Long activityUid, List<String> imgList,
|
| | | RecommendActivity activity) throws ActivityException , Exception{
|
| | |
| | | public List<RecommendActivity> getRecommendActivityListCache(int page, int pageSize) {
|
| | | List<RecommendActivity> activityList = getRecommendActivityList(page, pageSize);
|
| | | if (activityList != null) {
|
| | | for (RecommendActivity activity : activityList) {
|
| | | for (int i = 0; i < activityList.size(); i++) {
|
| | | |
| | | RecommendActivity activity = activityList.get(i);
|
| | | |
| | | // 筛选出不足9个的商品
|
| | | if (RecommendActivity.TYPE_SHARE_GOODS == activity.getType()
|
| | | && (activity.getGoodsList() == null || activity.getGoodsList().size() < 9)) {
|
| | | activityList.remove(activity);
|
| | | i--;
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | if (activity != null && activity.getGoodsList() != null) {
|
| | | for (RecommendActivityTaoBaoGoods goods : activity.getGoodsList()) {
|
| | |
| | | return recommendActivityMapper.getRecommendActivityEffectiveCount();
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void upgradeShareGoodsRecommendActivity(Long id) throws ActivityException {
|
| | | // 获取商品
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<String> getImgByActivityId(Long activityId){
|
| | | return recommendActivityImgMapper.getImgByActivityId(activityId);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<RecommendActivity> getNeedPublish() {
|
| | | return recommendActivityMapper.getNeedPublish();
|
| | | }
|
| | | }
|