修正快递查询

This commit is contained in:
Bo 2021-08-07 22:28:47 +08:00
parent 83bce07713
commit 69d476e628
3 changed files with 29 additions and 16 deletions

View File

@ -13,7 +13,6 @@ import com.kuaidi100.sdk.response.SubscribePushData;
import com.kuaidi100.sdk.response.SubscribePushParamResp; import com.kuaidi100.sdk.response.SubscribePushParamResp;
import com.kuaidi100.sdk.response.SubscribePushResult; import com.kuaidi100.sdk.response.SubscribePushResult;
import com.kuaidi100.sdk.response.SubscribeResp; import com.kuaidi100.sdk.response.SubscribeResp;
import com.kuaidi100.sdk.utils.PropertiesReader;
import com.kuaidi100.sdk.utils.SignUtils; import com.kuaidi100.sdk.utils.SignUtils;
import com.ruoyi.bps.domain.ExpSubsPushResp; import com.ruoyi.bps.domain.ExpSubsPushResp;
import com.ruoyi.bps.domain.ExpSubscribe; import com.ruoyi.bps.domain.ExpSubscribe;
@ -282,10 +281,13 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
String phone = contentJson.getString("phone"); String phone = contentJson.getString("phone");
//如果出货单号或者快递单号为空则返回错误信息并写入Logo //如果出货单号或者快递单号为空则返回错误信息并写入Logo
if(StringUtils.isEmpty(deliveryNo) || StringUtils.isEmpty(expressNo)){ if(StringUtils.isEmpty(deliveryNo) || StringUtils.isEmpty(expressNo)){
SubscribeResp subscribeResp=new SubscribeResp();
subscribeResp.setMessage("快递单号或出货单号为空");
subscribeResp.setResult(false);
subscribeResp.setReturnCode("700");
Map<String,Object> map=new HashMap<>(); Map<String,Object> map=new HashMap<>();
map.put("result",false); map.put("subscribeResp",subscribeResp);
map.put("returnCode",700);
map.put("message","快递单号或出货单号为空!");
map.put("deliveryNo",deliveryNo); map.put("deliveryNo",deliveryNo);
map.put("expressNo",expressNo); map.put("expressNo",expressNo);
//写入Logo //写入Logo
@ -303,8 +305,10 @@ public class ExpSubsPushApiServiceImpl implements IExpSubsPushApiService {
expSubscribe.setSalt("topgp"); //偷懒把请求来源记录到salt栏位不再增加exp_subscribe字段了以后找时间改吧 expSubscribe.setSalt("topgp"); //偷懒把请求来源记录到salt栏位不再增加exp_subscribe字段了以后找时间改吧
SubscribeResp subscribeResp= ExpressSubscribe(expSubscribe); SubscribeResp subscribeResp= ExpressSubscribe(expSubscribe);
Object object = JSONObject.toJSON(subscribeResp); /*Object object = JSONObject.toJSON(subscribeResp);
Map map=JSONObject.parseObject(object.toString(), Map.class); Map map=JSONObject.parseObject(object.toString(), Map.class);*/
Map<String,Object> map= new HashMap<>();
map.put("expSubscribe",subscribeResp);
map.put("deliveryNo",deliveryNo); map.put("deliveryNo",deliveryNo);
map.put("expressNo",expressNo); map.put("expressNo",expressNo);
return JSONObject.toJSONString(map); return JSONObject.toJSONString(map);

View File

@ -21,6 +21,7 @@ import com.kuaidi100.sdk.response.QueryTrackResp;
import com.kuaidi100.sdk.utils.PropertiesReader; import com.kuaidi100.sdk.utils.PropertiesReader;
import com.kuaidi100.sdk.utils.SignUtils; import com.kuaidi100.sdk.utils.SignUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
@ -37,13 +38,6 @@ import java.util.List;
public class ExpressInfoServiceImpl implements IExpressInfoService public class ExpressInfoServiceImpl implements IExpressInfoService
{ {
/* /*
String key = "Jydbrxsm2311";
String customer = "2DD48B3469B82F2B7700569093AB792B";
String secret = "8781ed9b35a7438499eb02fee915915a";
String userid = "2a62da2192c24d17a943ff78ee64f8c6";
*/
String key = PropertiesReader.get("key"); String key = PropertiesReader.get("key");
String customer = PropertiesReader.get("customer"); String customer = PropertiesReader.get("customer");
String secret = PropertiesReader.get("secret"); String secret = PropertiesReader.get("secret");
@ -52,6 +46,13 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
String tid = PropertiesReader.get("tid"); String tid = PropertiesReader.get("tid");
String secret_key = PropertiesReader.get("secret_key"); String secret_key = PropertiesReader.get("secret_key");
String secret_secret = PropertiesReader.get("secret_secret"); String secret_secret = PropertiesReader.get("secret_secret");
*/
@Value("${express.key}")
private String key;
@Value("${express.customer}")
private String customer;
@ -132,7 +133,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService
//如果没有输入快递公司编号则查询快递公司编号 //如果没有输入快递公司编号则查询快递公司编号
if(StringUtils.isEmpty(com)){ if(StringUtils.isEmpty(com)){
if(AutoGetExpressCom(nu)==null){ if(AutoGetExpressCom(nu)==null){
callbackExpressInfo.setData("根据快递单号查询不到快递公司,请确认快递单号是否正确"); callbackExpressInfo.setData("请提供要查询的快递所属物流公司编号");
return callbackExpressInfo; return callbackExpressInfo;
} }
com=AutoGetExpressCom(nu).getComCode(); com=AutoGetExpressCom(nu).getComCode();

View File

@ -14,6 +14,7 @@ import com.kuaidi100.sdk.utils.SignUtils;
import com.ruoyi.bps.service.IExpressService; import com.ruoyi.bps.service.IExpressService;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
@ -27,14 +28,21 @@ public class ExpressServiceImpl implements IExpressService {
String secret = "8781ed9b35a7438499eb02fee915915a"; String secret = "8781ed9b35a7438499eb02fee915915a";
String userid = "2a62da2192c24d17a943ff78ee64f8c6"; String userid = "2a62da2192c24d17a943ff78ee64f8c6";
*/ */
String key = PropertiesReader.get("key"); /*String key = PropertiesReader.get("key");
String customer = PropertiesReader.get("customer"); String customer = PropertiesReader.get("customer");
String secret = PropertiesReader.get("secret"); String secret = PropertiesReader.get("secret");
String siid = PropertiesReader.get("siid"); String siid = PropertiesReader.get("siid");
String userid = PropertiesReader.get("userid"); String userid = PropertiesReader.get("userid");
String tid = PropertiesReader.get("tid"); String tid = PropertiesReader.get("tid");
String secret_key = PropertiesReader.get("secret_key"); String secret_key = PropertiesReader.get("secret_key");
String secret_secret = PropertiesReader.get("secret_secret"); String secret_secret = PropertiesReader.get("secret_secret");*/
@Value("${express.key}")
private String key;
@Value("${express.customer}")
private String customer;
String msg=""; String msg="";
@Autowired @Autowired
IExpressService expressService; IExpressService expressService;