yujian
2020-06-29 ec60e757d358636dcac1589c44a66f3e276fe58c
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/LostOrderController.java
@@ -16,6 +16,7 @@
import com.google.gson.Gson;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.user.LostOrder;
import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.order.LostOrderService;
import com.yeshi.fanli.util.Constant;
@@ -85,7 +86,7 @@
                  && order.getResultCode() == LostOrder.RESULT_CODE_SUCCESS) {
               // 申诉成功
               json.put("state", 1);
               json.put("stateDesc", "订单找回成功,请我的-订单中查看");
               json.put("stateDesc", "订单找回成功,请到我的-订单中查看");
            } else if (order.getState() == 2 || (order.getState() == 1 && order.getResultCode() != null
                  && order.getResultCode() == LostOrder.RESULT_CODE_FAIL)) {
               // 申诉失败
@@ -138,18 +139,50 @@
   @RequestMapping("findLostOrder")
   public void findLostOrder(AcceptData acceptData, LostOrder lostOrder, HttpServletRequest request, PrintWriter out) {
      boolean orderNum = true;
      Integer type = lostOrder.getType();
      if (type == null) {
         type = Constant.SOURCE_TYPE_TAOBAO;
      }
      if (!NumberUtil.isNumeric(lostOrder.getOrderId())) {
         orderNum = false;
      } else if (lostOrder.getOrderId().length() < 12 || lostOrder.getOrderId().length() > 20) {
         orderNum = false;
      } else
         orderNum = Utils.isOrderNum(lostOrder.getOrderId());
      boolean orderNum = true;
      String orderId = lostOrder.getOrderId();
      if (type == Constant.SOURCE_TYPE_TAOBAO) {
         if (!NumberUtil.isNumeric(orderId) || (orderId.length() < 12 || orderId.length() > 20)) {
            orderNum = false;
         } else {
            orderNum = Utils.isOrderNum(orderId);
         }
      } else if (type == Constant.SOURCE_TYPE_JD) {
         if (!NumberUtil.isNumeric(orderId) || (orderId.length() < 6 || orderId.length() > 20)) {
            orderNum = false;
         }
      } else if (type == Constant.SOURCE_TYPE_PDD) {
         if (!orderId.contains("-")) {
            orderNum = false;
         } else {
            String[] split = orderId.split("-");
            if (split == null || split.length != 2) {
               orderNum = false;
            } else {
               if (!NumberUtil.isNumeric(split[0]) || !NumberUtil.isNumeric(split[1])) {
                  orderNum = false;
               }
            }
         }
      } else if (type == Constant.SOURCE_TYPE_VIP) {
         if (!NumberUtil.isNumeric(orderId) || (orderId.length() < 10 || orderId.length() > 18)) {
            orderNum = false;
         }
      } else if (type == Constant.SOURCE_TYPE_SUNING) {
         if (!NumberUtil.isNumeric(orderId) || (orderId.length() < 10 || orderId.length() > 15)) {
            orderNum = false;
         }
      }
      if (lostOrder.getUserInfo() == null || lostOrder.getUserInfo().getId() == null
            || lostOrder.getUserInfo().getId() <= 0) {
         out.print(JsonUtil.loadFalseResult(1, "请登录返利券账号"));
         out.print(JsonUtil.loadFalseResult(1,
               String.format("请登录%s账号", Constant.getAppName(acceptData.getPlatform(), acceptData.getVersion()))));
         return;
      }
      lostOrder.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
@@ -173,6 +206,8 @@
            stateInfo = "该订单申诉已失败,请在订单列表中查看";
         } else if (state == -7) {
            stateInfo = "今日申诉次数已达上限";
         } else if (state == -1001) {
            stateInfo = "订单违规";
         }
      }
      JSONObject data = new JSONObject();
@@ -184,8 +219,8 @@
   @RequestMapping("getConfig")
   public void getConfig(AcceptData acceptData, PrintWriter out) {
      JSONObject data = new JSONObject();
      data.put("what", configService.get("lost_order_help_what"));
      data.put("reason", configService.get("lost_order_help_reason"));
      data.put("what", configService.get(ConfigKeyEnum.lostOrderHelpWhat.getKey()));
      data.put("reason", configService.get(ConfigKeyEnum.lostOrderHelpReason.getKey()));
      out.print(JsonUtil.loadTrueResult(data));
   }