| | |
| | | package com.yeshi.fanli.service.impl.activity;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.jsoup.Jsoup;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.entity.FileUploadResult;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | |
|
| | |
| | | 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;
|
| | |
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Service
|
| | | public class ActivityServiceImpl implements ActivityService {
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | | |
| | | @Resource
|
| | | private DynamicInfoService dynamicInfoService;
|
| | | |
| | | @Resource
|
| | | private ActivityUserService activityUserService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<RecommendActivity> getRecommendActivityList(int page, int pageSize) {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public long getRecommendActivityCount() {
|
| | | return recommendActivityMapper.getRecommendActivityCount();
|
| | | public long getRecommendActivityCount(String title) {
|
| | | return recommendActivityMapper.getRecommendActivityCount(title);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | 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 contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", fontColor1);
|
| | | contentJson1.put("content", "预估分享奖金:");
|
| | |
|
| | | String shareMoney = "0";
|
| | | String revenue = "¥0";
|
| | | String totalGetMoney = activity.getTotalGetMoney();
|
| | | if (totalGetMoney != null && totalGetMoney.trim().length() > 0) {
|
| | |
| | | if (split != null) {
|
| | | revenue = split[1];
|
| | | }
|
| | |
|
| | | String[] splitMoney = totalGetMoney.split("¥");
|
| | | if (splitMoney != null) {
|
| | | shareMoney = splitMoney[1];
|
| | | }
|
| | | }
|
| | |
|
| | | 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("shareId", map.get("shareId"));
|
| | | data.put("shareImg", map.get("loadResult"));
|
| | | data.put("notifyDesc", configService.get("goods_share_multiple_notify"));
|
| | | data.put("fanMoney", shareMoney);
|
| | | data.put("shareId", shareRecord.getRedisKey());
|
| | | data.put("shareImg", loadResult);
|
| | | data.put("notifyDesc", configService.get(ConfigKeyEnum.goodsShareMultipleNotify.getKey()));
|
| | |
|
| | | return data;
|
| | |
|
| | |
| | | return activityUserMapper.selectList();
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity addShareGoodsRecommendActivity(Long activityUid, String title, List<Long> goodsList,
|
| | | boolean top, int shareCount) throws ActivityException {
|
| | | public RecommendActivity addShareGoodsRecommendActivity(Long activityUid, List<Long> goodsList,
|
| | | RecommendActivity activity) throws ActivityException , Exception{
|
| | |
|
| | | if (goodsList == null || goodsList.size() == 0 || goodsList.size() > 9)
|
| | | throw new ActivityException(1, "商品数量错误:10>商品数量>0");
|
| | |
|
| | | RecommendActivity activity = new RecommendActivity();
|
| | | |
| | | if (StringUtil.isNullOrEmpty(activity.getTitle())) {
|
| | | throw new ActivityException(1, "标题不能为空");
|
| | | }
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null) {
|
| | | activity.setShareCount(0);
|
| | | }
|
| | | |
| | | Boolean top = activity.getTop();
|
| | | if (top == null) {
|
| | | activity.setTop(false);
|
| | | }
|
| | | |
| | | // 时间转换
|
| | | conversionTime(activity);
|
| | | |
| | | activity.setActivityUser(new ActivityUser(activityUid));
|
| | | activity.setCreateTime(new Date());
|
| | | activity.setGoodsList(null);
|
| | | activity.setOrderBy(0);
|
| | | activity.setShareCount(shareCount);
|
| | | activity.setTitle(title);
|
| | | activity.setTop(top);
|
| | | activity.setType(RecommendActivity.TYPE_SHARE_GOODS);
|
| | | recommendActivityMapper.insertSelective(activity);
|
| | |
|
| | |
| | | for (long auctionId : goodsList) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | tb = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | tb = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity addInviteImgRecommendActivity(Long activityUid, String title, String url, boolean top,
|
| | | int shareCount, int px, int py, int erCodeSize) throws ActivityException {
|
| | | RecommendActivity activity = new RecommendActivity();
|
| | | public RecommendActivity addInviteImgRecommendActivity(Long activityUid, RecommendActivity activity, String url,
|
| | | int px, int py, int erCodeSize) throws ActivityException, Exception {
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | throw new ActivityException(1, "图片为空");
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null) {
|
| | | activity.setShareCount(0);
|
| | | }
|
| | | |
| | | Boolean top = activity.getTop();
|
| | | if (top == null) {
|
| | | activity.setTop(false);
|
| | | }
|
| | | |
| | | // 时间转换
|
| | | conversionTime(activity);
|
| | | |
| | | activity.setActivityUser(new ActivityUser(activityUid));
|
| | | activity.setCreateTime(new Date());
|
| | | activity.setGoodsList(null);
|
| | | activity.setOrderBy(0);
|
| | | activity.setShareCount(shareCount);
|
| | | activity.setTitle(title);
|
| | | activity.setTop(top);
|
| | | activity.setType(RecommendActivity.TYPE_INVITE);
|
| | | recommendActivityMapper.insertSelective(activity);
|
| | | RecommendActivityImg img = new RecommendActivityImg();
|
| | |
| | | recommendActivityInviteInfo.setRecommendActivity(activity);
|
| | | recommendActivityInviteInfo.setSize(erCodeSize);
|
| | | recommendActivityInviteInfoMapper.insertSelective(recommendActivityInviteInfo);
|
| | |
|
| | | recommendActivityImgMapper.insertSelective(img);
|
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity addTextAndImgRecommendActivity(Long activityUid, String title, List<String> imgList,
|
| | | boolean top, int shareCount) throws ActivityException {
|
| | | RecommendActivity activity = new RecommendActivity();
|
| | | public RecommendActivity addTextAndImgRecommendActivity(Long activityUid, List<String> imgList,
|
| | | RecommendActivity activity) throws ActivityException, Exception {
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null) {
|
| | | activity.setShareCount(0);
|
| | | }
|
| | | |
| | | Boolean top = activity.getTop();
|
| | | if (top == null) {
|
| | | activity.setTop(false);
|
| | | }
|
| | | |
| | | // 时间转换
|
| | | conversionTime(activity);
|
| | | |
| | | activity.setActivityUser(new ActivityUser(activityUid));
|
| | | activity.setCreateTime(new Date());
|
| | | activity.setGoodsList(null);
|
| | | activity.setOrderBy(0);
|
| | | activity.setShareCount(shareCount);
|
| | | activity.setTitle(title);
|
| | | activity.setTop(top);
|
| | | activity.setType(RecommendActivity.TYPE_TEXTIMG);
|
| | | recommendActivityMapper.insertSelective(activity);
|
| | | for (String imgUrl : imgList) {
|
| | |
| | | return activity;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void deleteRecommendActivity(long[] ids) {
|
| | | 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(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity updateShareGoodsRecommendActivity(Long id, Long activityUid, String title,
|
| | | List<Long> goodsList, boolean top, int shareCount) throws ActivityException {
|
| | | public RecommendActivity updateShareGoodsRecommendActivity(Long activityUid,
|
| | | List<Long> goodsList, RecommendActivity activity) throws ActivityException , Exception{
|
| | | |
| | | if (goodsList == null || goodsList.size() == 0 || goodsList.size() > 9)
|
| | | throw new ActivityException(1, "商品数量错误:10>商品数量>0");
|
| | | |
| | | // 删除之前的商品
|
| | | recommendActivityTaoBaoGoodsMapper.batchDeleteByActivityid(new long[] { id });
|
| | | RecommendActivity activity = new RecommendActivity();
|
| | | activity.setId(id);
|
| | | recommendActivityTaoBaoGoodsMapper.batchDeleteByActivityid(new long[] { activity.getId() });
|
| | | |
| | | |
| | | activity.setActivityUser(new ActivityUser(activityUid));
|
| | | activity.setGoodsList(null);
|
| | | activity.setOrderBy(0);
|
| | | activity.setShareCount(shareCount);
|
| | | activity.setTitle(title);
|
| | | activity.setTop(top);
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null) {
|
| | | activity.setShareCount(0);
|
| | | }
|
| | | |
| | | Boolean top = activity.getTop();
|
| | | if (top == null) {
|
| | | activity.setTop(false);
|
| | | }
|
| | | |
| | | // 时间转换
|
| | | conversionTime(activity);
|
| | |
|
| | | 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(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity updateInviteImgRecommendActivity(Long id, Long activityUid, String title, String url,
|
| | | boolean top, int shareCount, int px, int py, int erCodeSize) throws ActivityException {
|
| | | recommendActivityImgMapper.batchDeleteByActivityid(new long[] { id });
|
| | | RecommendActivity activity = new RecommendActivity();
|
| | | activity.setId(id);
|
| | | public RecommendActivity updateInviteImgRecommendActivity(Long activityUid, RecommendActivity activity, String url,
|
| | | int px, int py, int erCodeSize) throws ActivityException , Exception{
|
| | | recommendActivityImgMapper.batchDeleteByActivityid(new long[] { activity.getId() });
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null) {
|
| | | activity.setShareCount(0);
|
| | | }
|
| | | |
| | | Boolean top = activity.getTop();
|
| | | if (top == null) {
|
| | | activity.setTop(false);
|
| | | }
|
| | | |
| | | // 时间转换
|
| | | conversionTime(activity);
|
| | | |
| | | activity.setActivityUser(new ActivityUser(activityUid));
|
| | | activity.setGoodsList(null);
|
| | | activity.setOrderBy(0);
|
| | | activity.setShareCount(shareCount);
|
| | | activity.setTitle(title);
|
| | | activity.setTop(top);
|
| | | activity.setType(RecommendActivity.TYPE_INVITE);
|
| | | recommendActivityMapper.updateByPrimaryKeySelective(activity);
|
| | | RecommendActivityImg img = new RecommendActivityImg();
|
| | |
| | | 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(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public RecommendActivity updateTextAndImgRecommendActivity(Long id, Long activityUid, String title,
|
| | | List<String> imgList, boolean top, int shareCount) throws ActivityException {
|
| | | recommendActivityImgMapper.batchDeleteByActivityid(new long[] { id });
|
| | | RecommendActivity activity = new RecommendActivity();
|
| | | activity.setId(id);
|
| | | public RecommendActivity updateTextAndImgRecommendActivity(Long activityUid, List<String> imgList, |
| | | RecommendActivity activity) throws ActivityException , Exception{
|
| | | recommendActivityImgMapper.batchDeleteByActivityid(new long[] { activity.getId() });
|
| | | |
| | | Integer shareCount = activity.getShareCount();
|
| | | if (shareCount == null) {
|
| | | activity.setShareCount(0);
|
| | | }
|
| | | |
| | | Boolean top = activity.getTop();
|
| | | if (top == null) {
|
| | | activity.setTop(false);
|
| | | }
|
| | | // 时间转换
|
| | | conversionTime(activity);
|
| | | |
| | | activity.setActivityUser(new ActivityUser(activityUid));
|
| | | activity.setGoodsList(null);
|
| | | activity.setOrderBy(0);
|
| | | activity.setShareCount(shareCount);
|
| | | activity.setTitle(title);
|
| | | activity.setTop(top);
|
| | | activity.setType(RecommendActivity.TYPE_TEXTIMG);
|
| | | recommendActivityMapper.updateByPrimaryKeySelective(activity);
|
| | | for (String imgUrl : imgList) {
|
| | |
| | | @Override
|
| | | public List<RecommendActivity> getRecommendActivityListCache(int page, int pageSize) {
|
| | | List<RecommendActivity> activityList = getRecommendActivityList(page, pageSize);
|
| | | if (activityList != null)
|
| | | for (RecommendActivity activity : activityList) {
|
| | | if (activity != null && activity.getGoodsList() != null)
|
| | | if (activityList != null) {
|
| | | 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()) {
|
| | | goods.setQuanPrice(goods.getDesc().replace("券后价:¥", ""));
|
| | | }
|
| | | }
|
| | | |
| | | // 过滤一遍
|
| | | if (!StringUtil.isNullOrEmpty(activity.getTitle())) {
|
| | | activity.setTitle(Jsoup.parse(activity.getTitle()).text());
|
| | | if (activity.getShareCount() >= 10000) {
|
| | | activity.setShareCountShow(NumberUtil.get1PointNumber(activity.getShareCount() / 10000.0) + "万");
|
| | | } else {
|
| | | activity.setShareCountShow(activity.getShareCount() + "");
|
| | | }
|
| | | }
|
| | | |
| | | Date startTime = activity.getStartTime();
|
| | | if (startTime != null) {
|
| | | activity.setCreateTime(startTime);
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | }
|
| | | return activityList;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "activityCache", key = "'getRecommendActivityCount'")
|
| | | @Override
|
| | | public long getRecommendActivityCountCache() {
|
| | | return getRecommendActivityCount();
|
| | | return recommendActivityMapper.getRecommendActivityEffectiveCount();
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Override
|
| | | public void upgradeShareGoodsRecommendActivity(Long id) throws ActivityException {
|
| | | // 获取商品
|
| | |
| | | public ActivityUser selectActivityUserByPrimaryKey(Long id) {
|
| | | return activityUserMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void updateRecommendActivityGoods(TaoBaoGoodsBrief goods) {
|
| | | List<RecommendActivityTaoBaoGoods> list = recommendActivityTaoBaoGoodsMapper
|
| | | .selectByAuctionId(goods.getAuctionId());
|
| | |
|
| | | BigDecimal d = TaoBaoUtil.getAfterUseCouplePrice(goods);
|
| | |
|
| | | RecommendActivityTaoBaoGoods updateGoods = new RecommendActivityTaoBaoGoods();
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && !"无".equalsIgnoreCase(goods.getCouponInfo())) {
|
| | | updateGoods.setDesc("券后价:¥" + d);
|
| | | updateGoods.setState(RecommendActivityTaoBaoGoods.STATE_NORMAL);
|
| | | } else {
|
| | | updateGoods.setState(RecommendActivityTaoBaoGoods.STATE_UNSHELVE);
|
| | | }
|
| | |
|
| | | if (list != null)
|
| | | for (RecommendActivityTaoBaoGoods tbGoods : list) {
|
| | | updateGoods.setId(tbGoods.getId());
|
| | | recommendActivityTaoBaoGoodsMapper.updateByPrimaryKeySelective(updateGoods);
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * web段时间转换
|
| | | * @param record
|
| | | */
|
| | | public void conversionTime(RecommendActivity record) throws ActivityException, Exception {
|
| | | // 是否时间控制
|
| | | if(!record.isTimeTask()) {
|
| | | record.setStartTime(null);
|
| | | record.setEndTime(null);
|
| | | } else {
|
| | | String startTime_str = record.getStartTime_str();
|
| | | String endTime_str = record.getEndTime_str();
|
| | | |
| | | if ((startTime_str == null|| startTime_str.trim().length() == 0) |
| | | && (endTime_str == null || endTime_str.trim().length() == 0)) {
|
| | | throw new ActivityException(1, "请输入控制时间");
|
| | | } else {
|
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
| | | if (startTime_str != null && startTime_str.trim().length() > 0) {
|
| | | startTime_str = startTime_str.replaceAll("T", " ");
|
| | | record.setStartTime(format.parse(startTime_str));
|
| | | }
|
| | | |
| | | if (endTime_str != null && endTime_str.trim().length() > 0) {
|
| | | endTime_str = endTime_str.replaceAll("T", " ");
|
| | | record.setEndTime(format.parse(endTime_str));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<String> getImgByActivityId(Long activityId){
|
| | | return recommendActivityImgMapper.getImgByActivityId(activityId);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<RecommendActivity> getNeedPublish() {
|
| | | return recommendActivityMapper.getNeedPublish();
|
| | | }
|
| | | }
|