Пример #1
0
 /**
  * @description 获得店铺需要审核的商品分类
  * @detail <方法详细描述>
  * @author <a href="*****@*****.**">肖湘</a>
  * @version 1.0.0
  * @data 2015-6-10
  * @param data
  * @return
  */
 public Object getShopGoodsCat(Object data) {
   HeadObject head = new HeadObject();
   List<CompanyCheckCat> list = null;
   list = companyCheckCatMapper.getShopGoodsCat((Integer) data);
   head.setRetCode(ErrorCode.SUCCESS);
   return new ResultObject(head, list);
 }
Пример #2
0
 /**
  * @description <b>查询需要评论订单</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-6-15
  * @param @param qryDTO
  * @param @return
  * @return Order
  */
 public Object findNeedCommentOrder(Object data) {
   HeadObject head = new HeadObject();
   List<OrderCommentDTO> order = null;
   order = orderCommentMapper.selectNeedCommentOrder((OrderQryDTO) data);
   head.setRetCode(ErrorCode.SUCCESS);
   return new ResultObject(head, order);
 }
Пример #3
0
 /**
  * @description <b>修改订单评论</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-6-13
  * @param @param object
  * @param @return
  * @return Object
  */
 public Object updateOrderCommentDisply(Object object) {
   HeadObject head = new HeadObject();
   try {
     orderCommentMapper.updateOrderCommentDisply((Map<String, Object>) object);
     head.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     head.setRetCode(ErrorCode.FAILURE);
     log.error("订单评论保存失败", e);
   }
   return new ResultObject(head);
 }
Пример #4
0
 /**
  * @description <b>修改订单评论</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-6-13
  * @param @param object
  * @param @return
  * @return Object
  */
 public Object deleteOrderComment(Object object) {
   HeadObject head = new HeadObject();
   try {
     orderCommentMapper.deleteByPrimaryKey((Long) object);
     head.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     head.setRetCode(ErrorCode.FAILURE);
     log.error("订单评论保存失败", e);
   }
   return new ResultObject(head);
 }
Пример #5
0
 /**
  * @description <b>修改订单评论</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-6-13
  * @param @param object
  * @param @return
  * @return Object
  */
 public Object updateOrderComment(Object object) {
   HeadObject head = new HeadObject();
   OrderComment record = (OrderComment) object;
   try {
     orderCommentMapper.updateByPrimaryKeySelective(record);
     head.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     head.setRetCode(ErrorCode.FAILURE);
     log.error("订单评论保存失败", e);
   }
   return new ResultObject(head, record);
 }
Пример #6
0
 /**
  * @Title: deleteCartFromDb @Description: (根据货品id列表从购物车数据库删除指定商品)
  *
  * @author <a href="*****@*****.**">赖彩妙</a>
  * @date 2015-4-13
  * @version 1.0.0
  * @param request
  * @param proIdList
  * @param memberId
  * @param @return
  * @param @throws Exception
  * @return boolean 返回类型
  * @throws
  */
 private boolean deleteCartFromDb(List<Integer> proIdList, Integer memberId) throws Exception {
   HeadObject headObject =
       CommonHeadUtil.geneHeadObject("cartService.deleteCartByProIdAndMemberId");
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("memberId", memberId);
   jsonObject.put("proIdList", proIdList);
   headObject =
       (HeadObject) orderService.doServiceByServer(new RequestObject(headObject, jsonObject));
   String retCode = headObject.getRetCode();
   if (ErrorCode.SUCCESS.equals(retCode)) {
     return true;
   }
   return false;
 }
Пример #7
0
 /**
  * @description <b>获取用户的评论信息</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-5-15
  * @param @param data
  * @param @return
  * @return Object
  */
 public Object findMemberCommentByCommentId(Object data) {
   HeadObject headObject = new HeadObject();
   OrderCommentDTO comments = null;
   try {
     MemberCommentQryDTO qryDTO = (MemberCommentQryDTO) data;
     comments = orderCommentMapper.selectMemberCommentByCommentId(qryDTO);
     headObject.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     headObject.setRetCode(ErrorCode.FAILURE);
     log.error("获取用户评论失败", e);
     e.printStackTrace();
   }
   return new ResultObject(headObject, comments);
 }
Пример #8
0
 /**
  * @description <b>保存订单评论</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-6-13
  * @param @param object
  * @param @return
  * @return Object
  */
 public Object saveOrderComment(Object object) {
   HeadObject head = new HeadObject();
   OrderComment record = (OrderComment) object;
   try {
     record.setCreateTime(new Date());
     orderCommentMapper.insertSelective(record);
     HeadObject headObject = CommonHeadUtil.geneHeadObject("goodsService.addCommentsCount");
     itemService.doServiceByServer(new RequestObject(headObject, record.getGoodsId()));
     head.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     head.setRetCode(ErrorCode.FAILURE);
     log.error("订单评论保存失败", e);
   }
   return new ResultObject(head, record);
 }
Пример #9
0
 /**
  * @Title: addCartToDb @Description: (添加商品至购物车数据库)
  *
  * @author <a href="*****@*****.**">赖彩妙</a>
  * @date 2015-4-12
  * @version 1.0.0
  * @param request
  * @param newCart
  * @param accountId
  * @param @return
  * @param @throws Exception
  * @return String 返回类型
  * @throws
  */
 private String addCartToDb(Cart newCart, Integer accountId) throws Exception {
   // 根据用户id查询购物车商品
   HeadObject headObject = CommonHeadUtil.geneHeadObject("cartService.findCartListByAccountId");
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("accountId", accountId);
   ResultObject resultObject =
       (ResultObject)
           orderService.doServiceByServer(new RequestObject(headObject, jsonObject)); // 判断失效商品?
   List<Cart> cartList =
       (List<Cart>) JSONArray.toCollection((JSONArray) resultObject.getContent(), Cart.class);
   // 判断购物车中是否已存在该商品,存在则加数量,不存在则加入购物车
   boolean isExist = false;
   for (Cart c : cartList) {
     if (c.getProductId().equals(newCart.getProductId())) // 该商品已存在
     {
       // 修改购物车中商品购买数量
       headObject = CommonHeadUtil.geneHeadObject("cartService.updateQuantityByProAndMem");
       newCart.setQuantity(c.getQuantity() + newCart.getQuantity());
       headObject =
           (HeadObject)
               orderService.doServiceByServer(
                   new RequestObject(headObject, JSONObject.fromObject(newCart)));
       if (headObject.getRetCode().equals(ErrorCode.FAILURE)) {
         return errorMsg;
       }
       isExist = true;
     }
   }
   if (!isExist) {
     if (cartList.size() >= MAX_CART_SIZE) {
       return "购物车已满,请清理后再加入购物车";
     } else {
       // 将购物车数据存入数据库
       headObject = CommonHeadUtil.geneHeadObject("cartService.saveCart");
       jsonObject.clear();
       jsonObject.put("specValueId", newCart.getSpecValueId());
       newCart.setSpecValueId(null);
       newCart.setCartId(null);
       jsonObject.put("newCart", newCart);
       headObject =
           (HeadObject) orderService.doServiceByServer(new RequestObject(headObject, jsonObject));
       if (resultObject.getHead().getRetCode().equals(ErrorCode.FAILURE)) {
         return errorMsg;
       }
     }
   }
   return null;
 }
Пример #10
0
 /**
  * @Title: saveCommentReply @Description: TODO(这里用一句话描述这个方法的作用)
  *
  * @author <a href="*****@*****.**">赖彩妙</a>
  * @date 2015-6-23 下午6:03:39
  * @version 1.0.0
  * @param @param data
  * @param @return
  * @return Object 返回类型
  * @throws
  */
 public Object saveCommentReply(Object data) {
   log.info("start[MemberCommentService.saveCommentReply]");
   HeadObject head = new HeadObject();
   try {
     OrderComment orderComment = (OrderComment) data;
     orderComment.setCreateTime(new Date());
     this.orderCommentMapper.insertSelective(orderComment);
     head.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     log.error("卖家中心>>交易管理>>评论管理>>保存商家解释信息失败", e);
     e.printStackTrace();
     head.setRetCode(ErrorCode.FAILURE);
   }
   log.info("end[MemberCommentService.saveCommentReply]");
   return new ResultObject(head);
 }
Пример #11
0
 /**
  * 查询订单评论
  *
  * @param data
  * @return
  */
 public Object findCommentByOrderId(Object data) {
   log.info("start[MemberCommentService.selectCommentCountByProductId]");
   Long orderId = (Long) data;
   OrderComment orderComment = new OrderComment();
   HeadObject head = new HeadObject();
   try {
     orderComment = orderCommentMapper.findCommentByOrderId(orderId);
     head.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     e.printStackTrace();
     head.setRetCode(ErrorCode.FAILURE);
     log.error(e.toString());
   }
   log.info("end[MemberCommentService.selectCommentCountByProductId]");
   ResultObject result =
       new ResultObject(new HeadObject(ErrorCode.SUCCESS), JSONObject.toJSON(orderComment));
   return result;
 }
Пример #12
0
 /**
  * @description <b>获取用户的评论信息</b>
  * @author 王鹏
  * @version 1.0.0
  * @data 2015-5-15
  * @param @param data
  * @param @return
  * @return Object
  */
 public Object findMemberComment(Object data) {
   HeadObject headObject = new HeadObject();
   ResultPage<Object> comments = null;
   try {
     MemberCommentQryDTO qryDTO = (MemberCommentQryDTO) data;
     qryDTO.buildOrderByField();
     PageHelper.startPage(qryDTO.getPage(), qryDTO.getRows());
     comments = new ResultPage<Object>(this.orderCommentMapper.selectMemberCommentCount(qryDTO));
     if (comments.getRows().size() > 0) {
       qryDTO.setCommentIds(comments.getRows());
       qryDTO.setCommentsType(CommentsType.COMMENT.getKey().toString());
       comments.setRows(orderCommentMapper.selectMemberComment(qryDTO));
     }
     headObject.setRetCode(ErrorCode.SUCCESS);
   } catch (Exception e) {
     headObject.setRetCode(ErrorCode.FAILURE);
     log.error("获取用户评论失败", e);
     e.printStackTrace();
   }
   return new ResultObject(headObject, JSONObject.toJSON(comments));
 }
Пример #13
0
 /**
  * @description 更新店铺商品是否需要审核开关
  * @detail <方法详细描述>
  * @author <a href="*****@*****.**">肖湘</a>
  * @version 1.0.0
  * @data 2015-6-10
  * @param data
  * @return
  */
 public Object updateShopGoodCheck(Object data) {
   HeadObject head = new HeadObject();
   Map<String, Object> shopMap = new HashMap<String, Object>();
   @SuppressWarnings("unchecked")
   Map<String, Object> map = (Map<String, Object>) data;
   Integer[] goodCategory = (Integer[]) map.get("goodCategory");
   Integer companyId = (Integer) map.get("companyId");
   // 1.先删除,再添加
   companyCheckCatMapper.deleteByCompanyId(companyId);
   shopMap.put("companyId", companyId);
   if (goodCategory != null) {
     Map<String, Object> cmap = new HashMap<String, Object>();
     cmap.put("companyId", companyId);
     cmap.put("goodCategory", goodCategory);
     companyCheckCatMapper.save(cmap);
     shopMap.put("isCheck", GlobalStatic.SHOP_CHECK_IN_GOODS);
   } else {
     shopMap.put("isCheck", GlobalStatic.SHOP_CHECK_OUT_GOODS);
   }
   companyMapper.updateShopGoodCheck(shopMap); // 更新店铺的状态
   head.setRetCode(ErrorCode.SUCCESS);
   return new ResultObject(head);
 }
Пример #14
0
  /**
   * 上传图片
   *
   * @throws IOException
   */
  @RequestMapping("/paintingUploadImg")
  @ResponseBody
  public ResultObject paintingUploadImg(String data, HttpServletRequest request)
      throws IOException {
    JSONObject jsonData = JSONObject.fromObject(data);
    String imgStr = jsonData.getString("file");
    byte[] buffer = Base64.decode(imgStr);
    HeadObject head = CommonHeadUtil.geneHeadObject("pictureService.insertPicture");
    ResultObject resultObject = new ResultObject();
    ImagesDTO imagesDTO = null;
    // 保存
    try {
      imagesDTO = imagesService.uploadSingleFile(buffer, GlobalStatic.IMAGES_PATH_SHOP);
      head.setRetCode(ErrorCode.SUCCESS);
    } catch (Exception e) {
      log.error(e.getMessage());
      e.printStackTrace();
      head.setRetCode(ErrorCode.FAILURE);
    }

    resultObject.setHead(head);
    resultObject.setContent(imagesDTO);
    return resultObject;
  }