Commit d12ac03f6df79a15f75350a604c221f2f7b321f7
1 parent
695be66718
Exists in
master
and in
8 other branches
修改区域
Showing 3 changed files with 61 additions and 28 deletions
platform-biz-service/src/main/java/com/lyms/platform/permission/model/Organization.java
View file @
d12ac03
| ... | ... | @@ -28,9 +28,9 @@ |
| 28 | 28 | |
| 29 | 29 | private IdTextModel levelObj; |
| 30 | 30 | private IdTextModel typeObj; |
| 31 | - private BasicConfig province; | |
| 32 | - private BasicConfig city; | |
| 33 | - private BasicConfig area; | |
| 31 | + private Object province; | |
| 32 | + private Object city; | |
| 33 | + private Object area; | |
| 34 | 34 | private String foreignId; |
| 35 | 35 | |
| 36 | 36 | Map<String, Departments> departmentsMap = new HashMap<>(); |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | |
| ... | ... | @@ -51,27 +51,27 @@ |
| 51 | 51 | this.foreignId = foreignId; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - public BasicConfig getProvince() { | |
| 54 | + public Object getProvince() { | |
| 55 | 55 | return province; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - public void setProvince(BasicConfig province) { | |
| 58 | + public void setProvince(Object province) { | |
| 59 | 59 | this.province = province; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public BasicConfig getCity() { | |
| 62 | + public Object getCity() { | |
| 63 | 63 | return city; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public void setCity(BasicConfig city) { | |
| 66 | + public void setCity(Object city) { | |
| 67 | 67 | this.city = city; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - public BasicConfig getArea() { | |
| 70 | + public Object getArea() { | |
| 71 | 71 | return area; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public void setArea(BasicConfig area) { | |
| 74 | + public void setArea(Object area) { | |
| 75 | 75 | this.area = area; |
| 76 | 76 | } |
| 77 | 77 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/OrganizationController.java
View file @
d12ac03
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | import com.lyms.platform.common.utils.ResultUtils; |
| 13 | 13 | import com.lyms.platform.common.utils.SystemConfig; |
| 14 | 14 | import com.lyms.platform.operate.web.result.FrontEndResult; |
| 15 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 15 | 16 | import com.lyms.platform.permission.model.*; |
| 16 | 17 | import com.lyms.platform.permission.service.*; |
| 17 | 18 | import com.lyms.platform.pojo.BasicConfig; |
| ... | ... | @@ -22,8 +23,7 @@ |
| 22 | 23 | |
| 23 | 24 | import javax.servlet.http.HttpServletRequest; |
| 24 | 25 | import javax.servlet.http.HttpServletResponse; |
| 25 | -import java.util.Date; | |
| 26 | -import java.util.List; | |
| 26 | +import java.util.*; | |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Created by zhang.rui on 2015/9/28 0028. |
| 30 | 30 | |
| ... | ... | @@ -203,12 +203,13 @@ |
| 203 | 203 | @RequestMapping(value = "/organization", method = RequestMethod.GET) |
| 204 | 204 | @ResponseBody |
| 205 | 205 | @TokenRequired |
| 206 | - public FrontEndResult getOrganization(HttpServletResponse response, | |
| 206 | + public FrontEndResult getOrganization( | |
| 207 | 207 | @RequestParam(value = "id", required = false) Integer id, |
| 208 | 208 | @RequestParam(value = "keyword", required = false) String keyword, |
| 209 | 209 | @RequestParam(value = "page", required = false) Integer page, |
| 210 | 210 | @RequestParam(value = "limit", required = false) Integer limit, |
| 211 | - @RequestParam(value = "areaId", required = false) String areaId) { | |
| 211 | + @RequestParam(value = "areaId", required = false) String areaId, | |
| 212 | + @RequestParam(value = "lite", required = false) String f) { | |
| 212 | 213 | |
| 213 | 214 | limit = limit == null ? 10 : limit; |
| 214 | 215 | page = page == null ? 1 : page; |
| 215 | 216 | |
| 216 | 217 | |
| 217 | 218 | |
| 218 | 219 | |
| 219 | 220 | |
| ... | ... | @@ -243,31 +244,45 @@ |
| 243 | 244 | } |
| 244 | 245 | |
| 245 | 246 | List<Organization> organizations = organizationService.queryOrganization(organizationQuery); |
| 246 | - | |
| 247 | + List<Object> data = new ArrayList<>(); | |
| 248 | + boolean falg =StringUtils.isNotEmpty(f); | |
| 247 | 249 | for(Organization organization : organizations) { |
| 248 | 250 | organization.setTypeObj(OrganizationLevelEnum.getById(organization.getLevel())); |
| 249 | 251 | organization.setLevelObj(OrganizationTypeEnum.getById(organization.getType())); |
| 250 | - if(null != organization.getProvinceId()) { | |
| 251 | - organization.setProvince(basicConfigService.getOneBasicConfigById(organization.getProvinceId())); | |
| 252 | + if(null != organization.getProvinceId()) { | |
| 253 | + organization.setProvince(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getProvinceId()),falg)); | |
| 254 | + } | |
| 255 | + if(null != organization.getCityId()) { | |
| 256 | + organization.setCity(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getCityId()),falg)); | |
| 257 | + } | |
| 258 | + if(null != organization.getAreaId()) { | |
| 259 | + organization.setArea(CommonsHelper.convterToMap(basicConfigService.getOneBasicConfigById(organization.getAreaId()),falg)); | |
| 260 | + } | |
| 261 | + Object obj = organization; | |
| 262 | + if(falg){ | |
| 263 | + obj = convert(organization); | |
| 252 | 264 | } |
| 253 | - if(null != organization.getCityId()) { | |
| 254 | - organization.setCity(basicConfigService.getOneBasicConfigById(organization.getCityId())); | |
| 255 | - } | |
| 256 | - if(null != organization.getAreaId()) { | |
| 257 | - organization.setArea(basicConfigService.getOneBasicConfigById(organization.getAreaId())); | |
| 258 | - } | |
| 265 | + data.add(obj); | |
| 259 | 266 | } |
| 260 | 267 | |
| 261 | 268 | FrontEndResult frontEndResult = new FrontEndResult(); |
| 262 | - frontEndResult.setData(organizations); | |
| 269 | + frontEndResult.setData(data); | |
| 263 | 270 | frontEndResult.setPageInfo(organizationQuery.getPageInfo()); |
| 264 | 271 | frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 265 | 272 | |
| 266 | 273 | return frontEndResult; |
| 267 | -// ResultUtils.buildSuccessResultAndWrite(response, frontEndResult); | |
| 268 | 274 | } |
| 269 | - | |
| 270 | - | |
| 271 | - | |
| 275 | + private Map<String,Object> convert(Organization organization){ | |
| 276 | + Map<String,Object> map = new HashMap<>(); | |
| 277 | + map.put("id",organization.getId()); | |
| 278 | + map.put("name",organization.getName()); | |
| 279 | + map.put("areaId",organization.getAreaId()); | |
| 280 | + map.put("area",organization.getArea()); | |
| 281 | + map.put("city",organization.getCity()); | |
| 282 | + map.put("cityId",organization.getCityId()); | |
| 283 | + map.put("province",organization.getProvince()); | |
| 284 | + map.put("provinceId",organization.getProvinceId()); | |
| 285 | + return map; | |
| 286 | + } | |
| 272 | 287 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java
View file @
d12ac03
| ... | ... | @@ -7,10 +7,28 @@ |
| 7 | 7 | import com.lyms.platform.pojo.BasicConfig; |
| 8 | 8 | import com.lyms.platform.pojo.Patients; |
| 9 | 9 | |
| 10 | +import java.util.HashMap; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 10 | 13 | /** |
| 11 | 14 | * Created by Administrator on 2016/5/1 0001. |
| 12 | 15 | */ |
| 13 | 16 | public final class CommonsHelper { |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + public static Object convterToMap(BasicConfig basicConfig,boolean sample){ | |
| 22 | + if(sample&&null!=basicConfig){ | |
| 23 | + Map<String,Object> map = new HashMap<>(); | |
| 24 | + map.put("id",basicConfig.getId()); | |
| 25 | + map.put("name",basicConfig.getName()); | |
| 26 | + map.put("code",basicConfig.getCode()); | |
| 27 | + return map; | |
| 28 | + } | |
| 29 | + return basicConfig; | |
| 30 | + } | |
| 31 | + | |
| 14 | 32 | /** |
| 15 | 33 | * 填充地址信息 |
| 16 | 34 | * |