package com.iamberry.wechat.handles.admin;

import com.iamberry.app.tool.log.RatFWLogger;
import com.iamberry.wechat.core.entity.OrderUtil;
import com.iamberry.wechat.core.entity.ResultMsg;
import com.iamberry.wechat.core.entity.customized.OrderCustomized;
import com.iamberry.wechat.core.entity.drp.PlaceInfo;
import com.iamberry.wechat.core.entity.member.CashLog;
import com.iamberry.wechat.core.entity.member.Member;
import com.iamberry.wechat.core.entity.mq.MQMessage;
import com.iamberry.wechat.core.entity.order.*;
import com.iamberry.wechat.core.entity.page.PageRequest;
import com.iamberry.wechat.core.entity.page.PagedResult;
import com.iamberry.wechat.core.entity.reback.RebackInfo;
import com.iamberry.wechat.core.entity.receive.ChargerReceive;
import com.iamberry.wechat.core.entity.relationship.DealerRelation;
import com.iamberry.wechat.core.entity.relationship.WdRelation;
import com.iamberry.wechat.face.customized.OrderCustomizedService;
import com.iamberry.wechat.face.drp.PlaceInfoService;
import com.iamberry.wechat.face.efast.EfastRentService;
import com.iamberry.wechat.face.member.MemberService;
import com.iamberry.wechat.face.order.AdminOrderService;
import com.iamberry.wechat.face.order.CodeService;
import com.iamberry.wechat.face.reback.LoadRewardTaskService;
import com.iamberry.wechat.face.reback.RebackServices;
import com.iamberry.wechat.face.relationship.DealerRelationService;
import com.iamberry.wechat.face.relationship.WdRelationService;
import com.iamberry.wechat.handles.mq.MQServiceProxy;
import com.iamberry.wechat.tools.NameUtils;
import com.iamberry.wechat.tools.ResultInfo;
import com.iamberry.wechat.tools.SendMessageUtil;
import com.iamberry.wechat.utils.StitchAttrUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLDecoder;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import static com.iamberry.wechat.service.ImberryConfig.INFORM_SHIPPING;
//import cn.jpush.api.common.connection.IHttpClient.RequestMethod;

@Controller
@RequestMapping("/admin/customized")
public class AdminOrderCustomizedHandlers {

    @Autowired
    private OrderCustomizedService orderCustomizedService;

    /**
     *  查询
     * 2018年2月24日
     * @param pageNO	分页信息
     * @return
     */
    @RequestMapping("/order_list")
    public ModelAndView listIntegral(OrderCustomized orderCustomized,
                                     @RequestParam(value= "pageSize",defaultValue= "10" ,required=false) Integer pageSize,
                                     @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO,
                                     @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum,
                                     HttpServletRequest request) throws Exception {
        ModelAndView mv = new ModelAndView("admin/customized/list_order");
        // 封装请求数据
        PageRequest<OrderCustomized> pageRequest = new PageRequest<>(orderCustomized, pageNO, pageSize, totalNum == 0);
        // 查询订单列表
        PagedResult<OrderCustomized> result = orderCustomizedService.listOrderCustomizedPage(pageRequest);
        if (totalNum != 0) {
            result.setTotal(totalNum);
        }
        StitchAttrUtil.getSa().addNoPro("orderInfo")
                .setModelAndView(orderCustomized, mv, "/admin/customized/list_order", result);
        return mv;
    }

}
