| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | pushGoodsService.save(pushGoods, list);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("添加成功"));
|
| | |
|
| | | } catch (PushGoodsException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据信息已不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | Date controlTime = pushGoods.getControlTime();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
| | | if (controlTime == null) {
|
| | | pushGoods.setTimeTask(false);
|
| | | pushGoods.setControlTime_str("");
|
| | | } else {
|
| | | pushGoods.setTimeTask(true);
|
| | | pushGoods.setControlTime_str(sdf.format(controlTime));
|
| | | }
|
| | | |
| | |
|
| | | // 版本处理
|
| | | convertVersionList(pushGoods);
|
| | |
|
| | | List<TaoBaoGoodsBrief> listgoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | |
|
| | | List<PushGoodsGroup> listGroup = pushGoodsGroupService.getAllInfoByPushId(pushGoods.getId());
|
| | | List<PushGoodsGroup> listGroup = pushGoodsGroupService.getAllInfoByPushId(id);
|
| | | if (listGroup == null) {
|
| | | listGroup = new ArrayList<PushGoodsGroup>();
|
| | | } else {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("pushGoods", pushGoods);
|
| | | data.put("pushGoods", gson.toJson(pushGoods));
|
| | | data.put("listGroup", listgoods);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
| | | }
|
| | |
|
| | | for (PushGoods pushGoods : list) {
|
| | | |
| | | Date controlTime = pushGoods.getControlTime();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
| | | if (controlTime == null) {
|
| | | pushGoods.setTimeTask(false);
|
| | | pushGoods.setControlTime_str("");
|
| | | } else {
|
| | | pushGoods.setTimeTask(true);
|
| | | pushGoods.setControlTime_str(sdf.format(controlTime));
|
| | | }
|
| | | |
| | | long countGoods = pushGoodsGroupService.countByPushId(pushGoods.getId());
|
| | | pushGoods.setCountGoods(countGoods);
|
| | |
|
| | |
| | | }
|
| | |
|
| | | for (Long id: list) {
|
| | | pushGoodsService.executePush(id);
|
| | | pushGoodsService.handPush(id);
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|