Commit 9c4904a6 authored by 张永's avatar 张永
parents 3e874082 3c90f13c
...@@ -191,4 +191,21 @@ public class AddressController { ...@@ -191,4 +191,21 @@ public class AddressController {
TCustAddress custAddress = addressService.getAddById(addId); TCustAddress custAddress = addressService.getAddById(addId);
return Rjx.jsonOk().set("detail", custAddress).toJson(); return Rjx.jsonOk().set("detail", custAddress).toJson();
} }
@ApiOperation("获取默认地址")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "shopNo", dataType = "String", required = true, value = "店铺编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "custNo", dataType = "String", required = true, value = "用户编码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "terminal", dataType = "String", required = false, value = "终端标识", defaultValue = "wechat"),
@ApiImplicitParam(paramType = "query", name = "langID", dataType = "String", required = false, value = "语言", defaultValue = "936"),
@ApiImplicitParam(paramType = "query", name = "sign", dataType = "String", required = true, value = "签名", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "timestamp", dataType = "String", required = true, value = "时间戳", defaultValue = "")
})
@RequestMapping(value = "/getDefaultAddress",method=RequestMethod.GET)
public String getDefaultAddress(String custNo, String shopNo) {
Map<String, Object> map = addressService.getDefaultAddress(custNo, shopNo);
return Rjx.jsonOk().setData(map).toJson();
}
} }
...@@ -12,4 +12,5 @@ public interface AddressService { ...@@ -12,4 +12,5 @@ public interface AddressService {
public TCustAddress getAddById(String addId); public TCustAddress getAddById(String addId);
public String delete(String addId,String userNO,String shopNO,String langID); public String delete(String addId,String userNO,String shopNO,String langID);
public String defaultAdd(String addId,String userNO,String shopNO,String type,String langID) ; public String defaultAdd(String addId,String userNO,String shopNO,String type,String langID) ;
public Map<String, Object> getDefaultAddress(String custNo, String shopNo);
} }
...@@ -229,4 +229,28 @@ public class AddressServiceImpl implements AddressService { ...@@ -229,4 +229,28 @@ public class AddressServiceImpl implements AddressService {
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Operate_failure")).set("errorMsg",I18NUtils.getMessage(langID, "Msg_Paramtype_error")).toJson(); return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Operate_failure")).set("errorMsg",I18NUtils.getMessage(langID, "Msg_Paramtype_error")).toJson();
} }
} }
@Override
public Map<String, Object> getDefaultAddress(String custNo, String shopNo) {
String sql = "select * from tCustAddress where nTag&1 = 0 and sCustNO = ? and (sShopNO = ? or sShopNO is null or sShopNO = '') order by nTag desc";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql, custNo, shopNo);
Map<String, Object> defMap = null;
Integer nTag_Cur = 0;
for(Map<String, Object> map : list) {
Integer nTag = (Integer)map.get("nTag");
if(nTag != null) {
if((nTag&6) == 6) {
defMap = map;
break;
} else if((nTag&4) == 4 && nTag_Cur < 4) {
defMap = map;
} else if((nTag&4) == 2 && nTag_Cur < 2) {
defMap = map;
}
nTag_Cur = nTag;
}
}
return defMap;
}
} }
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