记得上下班打卡 | git大法好,push需谨慎

Commit 65ab5603 authored by sunyuntian's avatar sunyuntian

运费为0元时返23元

parent a85a0330
...@@ -29,22 +29,24 @@ public class KylinGetShunFengPriceController { ...@@ -29,22 +29,24 @@ public class KylinGetShunFengPriceController {
@GetMapping("getPrice") @GetMapping("getPrice")
@ApiOperation("运费查询") @ApiOperation("运费查询")
public ResponseDto<String> getFreightCharge(String adcode, String expressType){ public ResponseDto<String> getFreightCharge(String adcode, String expressType){
String substring = adcode.substring(0, 3); /* String substring = adcode.substring(0, 3);
if(substring.equals("110") || substring.equals("120") || substring.equals("130")){ if(substring.equals("110") || substring.equals("120") || substring.equals("130")){
if (expressType.equals("1")){ if (expressType.equals("1")){
expressType="2"; return ResponseDto.success("23.00");
}
} }
}*/
Object obj = redisUtil.get(KylinRedisConst.RETURN_ADDRESS_CODE + adcode + KylinRedisConst.EXPRESS_TYPE + expressType); Object obj = redisUtil.get(KylinRedisConst.RETURN_ADDRESS_CODE + adcode + KylinRedisConst.EXPRESS_TYPE + expressType);
if (obj != null){ if (obj != null){
KylinFreightChargeDao k= (KylinFreightChargeDao)obj; KylinFreightChargeDao k= (KylinFreightChargeDao)obj;
//运费为0元时返23元
if (k.getPrice().equals("0.00")){
return ResponseDto.success("23.00");
}
return ResponseDto.success(k.getPrice()); return ResponseDto.success(k.getPrice());
}else { }else {
return ResponseDto.failure("查询失败"); //查询不到运费数据时返回23元
return ResponseDto.success("23.00");
// return ResponseDto.failure("查询失败");
} }
} }
} }
...@@ -52,7 +52,7 @@ public class KylinFreightChargeServiceImpl { ...@@ -52,7 +52,7 @@ public class KylinFreightChargeServiceImpl {
String s = jsonUtils.readJsonFile(fileName); String s = jsonUtils.readJsonFile(fileName);
List<HashMap> provinceListMap = JSONObject.parseArray(s, HashMap.class); List<HashMap> provinceListMap = JSONObject.parseArray(s, HashMap.class);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
Integer num=0;
for (Map pMap : provinceListMap) { for (Map pMap : provinceListMap) {
String dProvince = (String) pMap.get("name"); String dProvince = (String) pMap.get("name");
List<HashMap> cityListMap = (List<HashMap>) pMap.get("districts"); List<HashMap> cityListMap = (List<HashMap>) pMap.get("districts");
...@@ -67,15 +67,6 @@ public class KylinFreightChargeServiceImpl { ...@@ -67,15 +67,6 @@ public class KylinFreightChargeServiceImpl {
String productCode = kylinExpressModuleVo.getProductCode().toString(); //快件类型码 String productCode = kylinExpressModuleVo.getProductCode().toString(); //快件类型码
String adcode = (String) adMap.get("adcode"); String adcode = (String) adMap.get("adcode");
String dAddress = (String) adMap.get("name"); String dAddress = (String) adMap.get("name");
/* if (dProvince.equals("北京市") || dProvince.equals("天津市") || dProvince.equals("河北省")){
if (productCode.equals("1")){
hBody.put("expressType", "2");//快递类型
}else {
hBody.put("expressType", productCode);//快递类型
}
}else {
hBody.put("expressType", productCode);//快递类型
}*/
hBody.put("expressType", productCode); hBody.put("expressType", productCode);
hBody.put("dProvince", dProvince); //省 hBody.put("dProvince", dProvince); //省
hBody.put("dCity", dCity); hBody.put("dCity", dCity);
...@@ -94,15 +85,6 @@ public class KylinFreightChargeServiceImpl { ...@@ -94,15 +85,6 @@ public class KylinFreightChargeServiceImpl {
kylinFreightCharge.setAdname(dAddress); kylinFreightCharge.setAdname(dAddress);
kylinFreightCharge.setAdcode(adcode); kylinFreightCharge.setAdcode(adcode);
String price = map.get("price"); String price = map.get("price");
/* if (price.equals("0元")){
hBody.put("expressType", "2");//快递类型
// 生成签名并请求
String SFresult = shunfengSignUtils.generateSignatureAndRequestNew(hBody, "/public/order/v1/getFreight");
hashMap = JsonUtils.fromJson(SFresult, HashMap.class);
HashMap<String, String> SFmap = (HashMap<String, String>) hashMap.get("result");
price=SFmap.get("price");
}*/
String p = price.replace("元",".00"); String p = price.replace("元",".00");
kylinFreightCharge.setPrice(p); kylinFreightCharge.setPrice(p);
kylinFreightCharge.setBusinessType(map.get("businessType")); kylinFreightCharge.setBusinessType(map.get("businessType"));
...@@ -117,14 +99,14 @@ public class KylinFreightChargeServiceImpl { ...@@ -117,14 +99,14 @@ public class KylinFreightChargeServiceImpl {
int i = kylinFreightChargeMapper.setFreightCharge(kylinFreightCharge); int i = kylinFreightChargeMapper.setFreightCharge(kylinFreightCharge);
//存redis //存redis
redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.RETURN_ADDRESS_CODE + adcode + KylinRedisConst.EXPRESS_TYPE + productCode, kylinFreightCharge); redisDataSourceUtil.getRedisKylinUtil().set(KylinRedisConst.RETURN_ADDRESS_CODE + adcode + KylinRedisConst.EXPRESS_TYPE + productCode, kylinFreightCharge);
num++;
} }
} }
} }
} }
} }
} }
log.info("耗时:{}", (System.currentTimeMillis() - startTime) + "毫秒"); log.info("耗时:{}", (System.currentTimeMillis() - startTime) + "毫秒"+" "+"总条数"+num);
} }
//读取kylin_freight_charge全表数据存redis //读取kylin_freight_charge全表数据存redis
public void findDataAddRedis(){ public void findDataAddRedis(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment