yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserCloudControllerV2.java
@@ -5,9 +5,7 @@
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@@ -39,7 +37,6 @@
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.user.cloud.UserCloudException;
import com.yeshi.fanli.exception.user.cloud.UserCloudGoodsException;
import com.yeshi.fanli.exception.user.cloud.UserCloudGroupException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
@@ -301,6 +298,7 @@
      JSONObject data = new JSONObject();
      QrcodeLoginDTO dto = AitaokerApiUtil.getQrcodeMacloginCheck(robotId, wId);
      if (dto != null) {
         LogHelper.cloudInfo("方法macloginCheck: [uid=" + uid + "][wxID=" + dto.getWcId() + "][ NickName=" + dto.getNickName() + "]" );
         try {
            // 更新微信信息
            userCloudService.updateWXInfo(uid, dto.getWcId(), dto.getNickName(), dto.getHeadUrl());
@@ -568,67 +566,15 @@
      JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
   }
   /**
    * 添加、取消发单库
    *  删除云发单备选库
    * 
    * @param callback
    * @param acceptData
    * @param uid
    * @param goodsId
    * @param goodsType
    * @param out
    */
   @RequestMapping(value = "accordGoods")
   public void accordGoods(String callback, AcceptData acceptData, Long uid, String goodsId, Integer goodsType,
         PrintWriter out) {
      if (uid == null) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
         return;
      }
      if (goodsType == null || goodsId == null) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "参数不完整"));
         return;
      }
      try {
         boolean state = false;
         String queryGoodsId = goodsId;
         if (goodsType == Constant.SOURCE_TYPE_SUNING) { // 苏宁
            String[] ids = SuningUtil.getGoodsIdDetail(goodsId);
            queryGoodsId = ids[1];
         }
         UserCloudGoods cloudGoods = userCloudGoodsService.getByUidAndGoods(uid, Long.parseLong(queryGoodsId), goodsType);
         if (cloudGoods != null) { // 取消加入选品库
            userCloudGoodsService.deleteByPrimaryKeyAndUid(cloudGoods.getId(), uid);
         } else { // 加入选品库
            Set<String> set = new HashSet<String>();
            set.add(goodsId);
            userCloudGoodsService.addGoods(uid, set, goodsType);
            state = true;
         }
         JSONObject data = new JSONObject();
         data.put("state", state);
         out.print(JsonUtil.loadTrueResult(data));
      } catch (UserCloudGoodsException e) {
         out.print(JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         out.print(JsonUtil.loadFalseResult("操作失败"));
         LogHelper.errorDetailInfo(e);
         ;
      }
   }
   /**
    * 添加、取消发单库
    *
    * @param callback
    * @param acceptData
    * @param uid
    * @param goodsId
    * @param goodsType
    * @param id
    * @param out
    */
   @RequestMapping(value = "deleteGoods")
@@ -752,11 +698,10 @@
         userCloudService.sendByDynamic(uid, id);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("一键发单成功"));
      } catch (UserCloudException e) {
         if (e.getCode() > 1000) {
         if (e.getCode() > 1000 && e.getCode() < 1100) {
            JSONObject data = new JSONObject();
            data.put("msg", e.getMsg());
            data.put("link",  configService.get(ConfigKeyEnum.robotCloudLink.getKey()));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(1000, data));
            JsonUtil.printMode(out, callback, JsonUtil.loadTrue(e.getCode(), data, e.getMsg()).toString());
         } else {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getCode(),e.getMsg()));
         }
@@ -795,10 +740,9 @@
            } else {
               gid = Long.parseLong(goodsId);
            }
            userCloudService.sendCustomGoods(uid, gid, goodsType, sellerId);
         }
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("一键发单成功"));
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("加入发单库成功"));
      } catch (UserCloudException e) {
         if (e.getCode() > 1000 && e.getCode() < 1100) {
            JSONObject data = new JSONObject();