| | |
| | | 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.springframework.cache.annotation.Cacheable;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public ActivityShareResult shareActivityGoods(Long uid, Long activityId) throws ActivityException {
|
| | | public ActivityShareResult shareActivityGoods(Long uid, Long activityId) throws ActivityException,UserShareGoodsRecordException {
|
| | |
|
| | | RecommendActivity activity = recommendActivityMapper.selectByPrimaryKey(activityId);
|
| | |
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | if (listGoodsBrief.size() > 0) {
|
| | | try {
|
| | | FileUploadResult loadResult = userShareGoodsRecordService.save(uid, |
| | | ShareSourceTypeEnum.activity, title, listGoodsBrief);
|
| | | imgList.add(loadResult);
|
| | | |
| | | } catch (UserShareGoodsRecordException e) {
|
| | | throw new ActivityException(1, e.getMsg());
|
| | | }
|
| | | } else {
|
| | | if (listGoodsBrief.size() < 1) {
|
| | | throw new ActivityException(1, "商品下架");
|
| | | }
|
| | |
|
| | | Map<String,Object> map = userShareGoodsRecordService.save(uid, ShareSourceTypeEnum.activity, title, listGoodsBrief);
|
| | | imgList.add((FileUploadResult) map.get("loadResult"));
|
| | | result.setImgList(imgList);
|
| | | |
| | | return result;
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public JSONObject shareGoodsV2(Long uid, Long activityId) throws ActivityException {
|
| | | public JSONObject shareGoodsV2(Long uid, Long activityId) throws ActivityException,UserShareGoodsRecordException {
|
| | |
|
| | | RecommendActivity activity = recommendActivityMapper.selectByPrimaryKey(activityId);
|
| | |
|
| | |
| | |
|
| | | result.setTitle(title);
|
| | |
|
| | | List<FileUploadResult> imgList = new ArrayList<>();
|
| | | List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | if (activity.getGoodsList() != null) {
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | FileUploadResult loadResult = null;
|
| | | if (listGoodsBrief.size() > 0) {
|
| | | try {
|
| | | loadResult = userShareGoodsRecordService.save(uid, |
| | | ShareSourceTypeEnum.activity, title, listGoodsBrief);
|
| | | imgList.add(loadResult);
|
| | | |
| | | } catch (UserShareGoodsRecordException e) {
|
| | | throw new ActivityException(1, e.getMsg());
|
| | | }
|
| | | } else {
|
| | | if (listGoodsBrief.size() < 1) {
|
| | | throw new ActivityException(1, "商品下架");
|
| | | }
|
| | |
|
| | | String revenue = "";
|
| | | |
| | | String fontColor1 = "#000000";
|
| | | String fontColor2 = "#E5005C";
|
| | | JSONArray array = new JSONArray();
|
| | | |
| | | JSONObject contentJson1 = new JSONObject();
|
| | | contentJson1.put("color", fontColor1);
|
| | | contentJson1.put("content", "预估分享奖金:");
|
| | | |
| | | String revenue = "¥0";
|
| | | String totalGetMoney = activity.getTotalGetMoney();
|
| | | if (totalGetMoney != null && totalGetMoney.trim().length() > 0) {
|
| | | revenue = totalGetMoney.replace("预计分享奖金", listGoodsBrief.size()+"个商品预估分享奖金");
|
| | | String[] split = totalGetMoney.split(":");
|
| | | if (split != null) {
|
| | | revenue = split[1];
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject contentJson2 = new JSONObject();
|
| | | contentJson2.put("color", fontColor2);
|
| | | contentJson2.put("content", revenue);
|
| | | |
| | | array.add(contentJson1);
|
| | | array.add(contentJson2);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("shareImg", loadResult);
|
| | | data.put("revenue", revenue);
|
| | | data.put("notifyDesc", configService.get("goods_share_notify"));
|
| | | |
| | | 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"));
|
| | |
|
| | | return data;
|
| | |
|