|
@@ -2,6 +2,7 @@ package com.qlm.controller.jinzai;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
+import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
|
|
|
@@ -52,7 +53,6 @@ public class MobileController extends Controller{
|
|
|
|
|
|
|
|
|
|
|
|
|
String ipAddress = IpAddressUtil.getIpAddress(getRequest());
|
|
String ipAddress = IpAddressUtil.getIpAddress(getRequest());
|
|
|
-
|
|
|
|
|
CityInfo ipInfo = IpAddressUtil.getCityInfoByMemorySearch(ipAddress);
|
|
CityInfo ipInfo = IpAddressUtil.getCityInfoByMemorySearch(ipAddress);
|
|
|
|
|
|
|
|
String ipProvince = "";
|
|
String ipProvince = "";
|
|
@@ -100,6 +100,132 @@ public class MobileController extends Controller{
|
|
|
Record result = new Record();
|
|
Record result = new Record();
|
|
|
boolean cuan = true;
|
|
boolean cuan = true;
|
|
|
boolean isThird = false;
|
|
boolean isThird = false;
|
|
|
|
|
+ boolean isOther = true;
|
|
|
|
|
+ if(code.length() == 20){//可能是箱码
|
|
|
|
|
+ if(code.startsWith("jz") || code.startsWith("JZ")){//小码
|
|
|
|
|
+ Record jinzai_upload_child = Db.findFirst("select * from jinzai_upload_child where child_code = ?",code.toLowerCase());
|
|
|
|
|
+ if(jinzai_upload_child != null){
|
|
|
|
|
+ code = jinzai_upload_child.getStr("master_code");
|
|
|
|
|
+ }else{
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ String master_code = code;
|
|
|
|
|
+ master_code = master_code.toUpperCase();
|
|
|
|
|
+ Record masterInfo = Db.findFirst("select * from jinzai_upload_master where id = ?",master_code);
|
|
|
|
|
+ if(masterInfo != null){
|
|
|
|
|
+ isOther = false;
|
|
|
|
|
+ String pinxiang = masterInfo.getStr("pinxiang");
|
|
|
|
|
+ String kouwei = masterInfo.getStr("kouwei");
|
|
|
|
|
+ result.set("pinxiang", pinxiang+kouwei);
|
|
|
|
|
+ searchInfo.set("product_name", pinxiang);
|
|
|
|
|
+ if(!WxUtil.isNull(master_code)){
|
|
|
|
|
+ status = true;
|
|
|
|
|
+ Record fahuoInfo = Db.findFirst("select * from deliveryorders where CaseCode =?",master_code);
|
|
|
|
|
+ if(fahuoInfo != null){
|
|
|
|
|
+ String CustomerNo = fahuoInfo.getStr("CustomerNo");
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ result.set("fahuoInfo", fahuoInfo);
|
|
|
|
|
+ List<Record> list = Db.find("select * from jinzai_jxs_area where code = ?",CustomerNo);
|
|
|
|
|
+ String realCity = "";
|
|
|
|
|
+ for (Record jxsInfo : list) {
|
|
|
|
|
+ String saleCity = jxsInfo.getStr("city");
|
|
|
|
|
+ String saleProvince = jxsInfo.getStr("province");
|
|
|
|
|
+
|
|
|
|
|
+ if(realCity.length()>0){
|
|
|
|
|
+ realCity+=",";
|
|
|
|
|
+ }
|
|
|
|
|
+ realCity+=saleProvince+saleCity;
|
|
|
|
|
+ if(cuan){
|
|
|
|
|
+ if(compareProvice.contains(saleProvince)){
|
|
|
|
|
+ if(compareCity.contains(saleCity)){
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ result.set("saleLocation", realCity);
|
|
|
|
|
+
|
|
|
|
|
+ searchInfo.set("kehu", realCity);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ Record jinzai_upload_child = Db.findFirst("select * from jinzai_upload_child where child_code = ?",code.toLowerCase());
|
|
|
|
|
+ if(jinzai_upload_child==null){
|
|
|
|
|
+ //可能是大小写问题 再查询遍
|
|
|
|
|
+ jinzai_upload_child = Db.findFirst("select * from jinzai_upload_child where child_code = ?",code);
|
|
|
|
|
+ if(jinzai_upload_child==null)
|
|
|
|
|
+ jinzai_upload_child = Db.findFirst("select * from jinzai_upload_child where lower(child_code) = ?",code.toLowerCase());
|
|
|
|
|
+ }
|
|
|
|
|
+ if(jinzai_upload_child!=null){
|
|
|
|
|
+ String master_code = jinzai_upload_child.getStr("master_code");
|
|
|
|
|
+ Record masterInfo = Db.findFirst("select * from jinzai_upload_master where id = ?",master_code);
|
|
|
|
|
+ isOther = false;
|
|
|
|
|
+ String pinxiang = masterInfo.getStr("pinxiang");
|
|
|
|
|
+ String kouwei = masterInfo.getStr("kouwei");
|
|
|
|
|
+ result.set("pinxiang", ((pinxiang==null||pinxiang.isEmpty())?"":pinxiang)+((kouwei==null||kouwei.isEmpty())?"":kouwei));
|
|
|
|
|
+ searchInfo.set("product_name", pinxiang);
|
|
|
|
|
+ if(!WxUtil.isNull(master_code)){
|
|
|
|
|
+ status = true;
|
|
|
|
|
+ Record fahuoInfo = Db.findFirst("select * from deliveryorders where CaseCode =?",master_code);
|
|
|
|
|
+ result.set("fahuoInfo", fahuoInfo);
|
|
|
|
|
+ if(fahuoInfo != null){
|
|
|
|
|
+ String CustomerNo = fahuoInfo.getStr("CustomerNo");
|
|
|
|
|
+
|
|
|
|
|
+ result.set("fahuoInfo", fahuoInfo);
|
|
|
|
|
+ List<Record> list = Db.find("select * from jinzai_jxs_area where code = ?",CustomerNo);
|
|
|
|
|
+ String realCity = "";
|
|
|
|
|
+ for (Record jxsInfo : list) {
|
|
|
|
|
+ String saleCity = jxsInfo.getStr("city");
|
|
|
|
|
+ String saleProvince = jxsInfo.getStr("province");
|
|
|
|
|
+
|
|
|
|
|
+ if(realCity.length()>0){
|
|
|
|
|
+ realCity+=",";
|
|
|
|
|
+ }
|
|
|
|
|
+ realCity+=saleProvince+saleCity;
|
|
|
|
|
+ if(cuan){
|
|
|
|
|
+ if(compareProvice.contains(saleProvince)){
|
|
|
|
|
+ if(compareCity.contains(saleCity)){
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ result.set("saleLocation", realCity);
|
|
|
|
|
+
|
|
|
|
|
+ searchInfo.set("kehu", realCity);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }else{
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!isOther){
|
|
|
|
|
+ if(cuan){
|
|
|
|
|
+ searchInfo.set("status", 0);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ searchInfo.set("status", 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(!isThird){
|
|
|
|
|
+ Db.save("t_jz_searchrecord", searchInfo);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ result.set("status", status).set("msg", msg).set("cuan", cuan).set("location", compareProvice+compareCity);
|
|
|
|
|
+ renderJson(result);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if(code.length() == 6 || code.length() == 11){//6位码先查爱创的,没查到就走老逻辑
|
|
if(code.length() == 6 || code.length() == 11){//6位码先查爱创的,没查到就走老逻辑
|
|
|
Map<String,String> header =new HashMap<String,String>();
|
|
Map<String,String> header =new HashMap<String,String>();
|
|
|
header.put("content-type", "application/json;charset=UTF-8");
|
|
header.put("content-type", "application/json;charset=UTF-8");
|
|
@@ -283,8 +409,10 @@ public class MobileController extends Controller{
|
|
|
String saleCity = jxsInfo.getStr("city");
|
|
String saleCity = jxsInfo.getStr("city");
|
|
|
String saleProvince = jxsInfo.getStr("province");
|
|
String saleProvince = jxsInfo.getStr("province");
|
|
|
|
|
|
|
|
- if(saleCity.equals(compareCity)){
|
|
|
|
|
- cuan = false;
|
|
|
|
|
|
|
+ if(compareProvice.contains(saleProvince)){
|
|
|
|
|
+ if(compareCity.contains(saleCity)){
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
result.set("saleLocation", saleProvince+saleCity);
|
|
result.set("saleLocation", saleProvince+saleCity);
|
|
|
|
|
|
|
@@ -331,8 +459,10 @@ public class MobileController extends Controller{
|
|
|
String saleCity = jxsInfo.getStr("city");
|
|
String saleCity = jxsInfo.getStr("city");
|
|
|
String saleProvince = jxsInfo.getStr("province");
|
|
String saleProvince = jxsInfo.getStr("province");
|
|
|
|
|
|
|
|
- if(saleCity.equals(compareCity)){
|
|
|
|
|
- cuan = false;
|
|
|
|
|
|
|
+ if(compareProvice.contains(saleProvince)){
|
|
|
|
|
+ if(compareCity.contains(saleCity)){
|
|
|
|
|
+ cuan = false;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
result.set("saleLocation", saleProvince+saleCity);
|
|
result.set("saleLocation", saleProvince+saleCity);
|
|
|
|
|
|