| | |
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServlet;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.encrypt.DESUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.AppVersionInfo;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.LostOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.exception.order.CommonOrderException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.AppVersionService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | |
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private LostOrderService lostOrderService;
|
| | |
|
| | | /**
|
| | | * 订单列表
|
| | | *
|
| | |
| | | public void getOrder(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, Integer orderState,
|
| | | String orderNo, String startTime, String endTime, Integer slotTime, boolean needCount, Integer dateType,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (Constant.IS_TEST)
|
| | | uid = 389677L;
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "uploadParsedOrder", method = RequestMethod.POST)
|
| | | public void uploadParsedOrder(AcceptData acceptData, Long uid, String orderData, String source, PrintWriter out) {
|
| | | public void uploadParsedOrder(AcceptData acceptData, Long uid, String orderData, String source,
|
| | | HttpServletRequest request, PrintWriter out) {
|
| | | if (uid == null || StringUtil.isNullOrEmpty(orderData)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "数据错误"));
|
| | | return;
|
| | |
| | | }
|
| | |
|
| | | if ("findOrder".equalsIgnoreCase(source)) {
|
| | |
|
| | | boolean success = false;
|
| | | // 匹配订单
|
| | | for (String order : orders) {
|
| | | if (!StringUtil.isNullOrEmpty(order)) {
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(order);
|
| | | // 计算订单状态
|
| | |
|
| | | if (orderList != null && orderList.size() > 0) {
|
| | | int inValid = 0;
|
| | | for (TaoBaoOrder taoBaoOrder : orderList) {
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效")) {
|
| | | inValid++;
|
| | | }
|
| | | }
|
| | | // 订单全是失效
|
| | | if (inValid == orderList.size())
|
| | | continue;
|
| | |
|
| | | List<CommonOrder> commonOrderList = commonOrderService
|
| | | .listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, order);
|
| | | if (commonOrderList == null || commonOrderList.size() == 0) {
|
| | | Order o = orderService.findOrderByOrderIdAndType(order, Order.ORDER_TYPE_TAOBAO);
|
| | | if (o != null)// 原来已经存在,则不需要找回
|
| | | continue;
|
| | |
|
| | | Order or = new Order();
|
| | | or.setBeizhu("人工自动找回补单");
|
| | | or.setCreatetime(System.currentTimeMillis());
|
| | |
| | | isS = orderService.addOrder(or);
|
| | | if (isS) {
|
| | | CMQManager.getInstance().addTaoBaoOrderMsg(order, orderList);
|
| | | // 加入到LostOrder
|
| | | LostOrder lo = new LostOrder();
|
| | | lo.setCreateTime(System.currentTimeMillis());
|
| | | lo.setHandleTime(System.currentTimeMillis());
|
| | | lo.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
|
| | | lo.setOrder(or);
|
| | | lo.setOrderId(order);
|
| | | lo.setState(LostOrder.STATE_PASS);
|
| | | lo.setResultCode(LostOrder.RESULT_CODE_VERFING);
|
| | | lo.setType(LostOrder.TYPE_TAOBAO);
|
| | | lo.setUserInfo(new UserInfo(uid));
|
| | | lostOrderService.saveLostOrder(lo);
|
| | | if (success == false)
|
| | | success = true;
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, order, "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if (success) {
|
| | | out.print(JsonUtil.loadTrue(0, null, "订单找回成功,请到“我的-订单”中查看"));
|
| | | return;
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("没有可找回的订单,请尝试手动找回"));
|
| | | return;
|
| | | }
|
| | |
|
| | | } else {
|
| | | String orderId = null;
|
| | | if (orders != null && orders.length > 0)
|