Commit 898a8ccf authored by zhangyong's avatar zhangyong

1

parent e3c6eec2
......@@ -47,8 +47,7 @@ public class CommonController {
})
@RequestMapping(value = "/getOpenCity",method=RequestMethod.GET)
public String getOpenCity(HttpServletRequest request) {
String orgNO = request.getParameter("orgNO");
String langID = request.getParameter("langID");
return commonService.queryDistrictByOrgNO(orgNO, langID);
String langID = request.getParameter("langID");
return commonService.getOpenCity(langID);
}
}
......@@ -19,5 +19,5 @@ public interface CommonService {
public String queryDistrictByOrgNO(String orgNO,String langID) ;
public String getOpenCity() ;
public String getOpenCity(String langID) ;
}
......@@ -103,27 +103,28 @@ public class CommonServiceImpl implements CommonService{
*/
public String queryDistrictByOrgNO(String orgNO,String langID) {
try {
String psql="select provinceID=sRegionNO,province=sRegionDesc from tRegion where sRegionNO=(select sUpRegionNO from tRegion where sRegionNO=(select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) and nTag&1=0 ) and nTag&1=0 ";
String csql="select cityID=sRegionNO,city=sRegionDesc from tRegion r where sRegionNO=(select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) and r.nTag&1=0 ";
String dsql="select districtID=sRegionNO,district=sRegionDesc from tRegion where sUpRegionNO=(select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) AND nTag&1=0";
String ssql="select streetID=sRegionNO,street=sRegionDesc, upRegionNO=sUpRegionNO from tRegion where sUpRegionNO in (select districtID=sRegionNO from tRegion where sUpRegionNO = (select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) and nTag&1=0) AND nTag&1=0";
String psql="select ProvinceID=sRegionNO,Province=sRegionDesc from tRegion where sRegionNO=(select sUpRegionNO from tRegion where sRegionNO=(select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) and nTag&1=0 ) and nTag&1=0 ";
String csql="select CityID=sRegionNO,City=sRegionDesc from tRegion r where sRegionNO=(select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) and r.nTag&1=0 ";
String dsql="select DistrictID=sRegionNO,District=sRegionDesc from tRegion where sUpRegionNO=(select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) AND nTag&1=0";
String ssql="select StreetID=sRegionNO,Street=sRegionDesc, UpRegionNO=sUpRegionNO from tRegion where sUpRegionNO in (select districtID=sRegionNO from tRegion where sUpRegionNO = (select sRegionNO from tOrg where sOrgNO='"+orgNO+"' and nTag&1=0) and nTag&1=0) AND nTag&1=0";
jdbcTemplate.setDialect(new SqlServerDialect());
Map<String, Object> pMap=jdbcTemplate.queryForMap(psql);
Map<String, Object> cMap=jdbcTemplate.queryForMap(csql);
List<Map<String, Object>> dList=jdbcTemplate.queryForList(dsql);
List<Map<String, Object>> sList=jdbcTemplate.queryForList(ssql);
for(Map<String,Object> dMap:dList){
List<Map<String, Object>> dsList=new ArrayList<Map<String, Object>>();
for(Map<String,Object> sMap:sList){
if(sMap.get("upRegionNO").equals(dMap.get("districtID"))){
if(sMap.get("UpRegionNO").equals(dMap.get("DistrictID"))){
dsList.add(sMap);
}
}
dMap.put("countyList", dsList);
dMap.put("CountyList", dsList);
}
cMap.put("districtList", dList);
pMap.put("city", cMap);
return Rjx.jsonOk().set("province", pMap).toJson();
cMap.put("DistrictList", dList);
pMap.put("City", cMap);
return Rjx.jsonOk().set("Province", pMap).toJson();
} catch (Exception e) {
e.printStackTrace();
......@@ -131,11 +132,41 @@ public class CommonServiceImpl implements CommonService{
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Province_getfailure")).toJson();
}
/**
* 获取开通的城市
* <p>Title: getOpenCity</p>
* <p>Description: </p>
* @param langID
* @return
* @see com.egolm.shop.service.CommonService#getOpenCity(java.lang.String)
*/
@Override
public String getOpenCity() {
String psql="select provinceID=sRegionNO,province=sRegionDesc from tRegion where sRegionNO IN (SELECT DISTINCT sUpRegionNO from tRegion where sRegionNO IN (select DISTINCT sRegionNO from tOrg where nTag&1=0) and nTag&1=0 ) and nTag&1=0 ";
String csql="select cityID=sRegionNO,city=sRegionDesc from tRegion r where sRegionNO IN (SELECT DISTINCT sRegionNO from tOrg where nTag&1=0) and r.nTag&1=0 ";
return null;
public String getOpenCity(String langID) {
try {
String psql="SELECT OrgDesc = sOrgDesc,RegionNO = sRegionNO FROM tOrg WHERE nOrgLevel = 3 AND nTag&1=0 ";
String csql="SELECT OrgNO = sOrgNO,OrgDesc = sOrgDesc, RegionDesc = r.sRegionDesc, RegionNO = o.sRegionNO, UpRegionNO = r.sUpRegionNO FROM tOrg o LEFT JOIN tRegion r ON o.sRegionNO = r.sRegionNO AND o.nTag&1=0 AND r.nTag&1=0 WHERE nOrgLevel = 4 ";
jdbcTemplate.setDialect(new SqlServerDialect());
List<Map<String,Object>> plist = jdbcTemplate.queryForList(psql);
List<Map<String,Object>> clist = jdbcTemplate.queryForList(csql);
if(plist != null && plist.size()>0) {
for(Map<String,Object> pMap :plist) {
if(clist != null && clist.size()>0) {
List<Map<String,Object>> csList = new ArrayList<Map<String, Object>>();
for(Map<String,Object> cMap :clist) {
if(pMap.get("RegionNO").equals(cMap.get("UpRegionNO"))) {
csList.add(cMap);
}
}
pMap.put("City", csList);
}
}
}
return Rjx.jsonOk().set("Province", plist).toJson();
} catch (Exception e) {
e.printStackTrace();
}
return Rjx.jsonErr().setCode(-100).setMessage(I18NUtils.getMessage(langID, "Msg_Province_getfailure")).toJson();
}
}
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