Commit 1270c71ac96943010af0ee0c74eb417d930a3d94
1 parent
6eeb8e013f
Exists in
master
and in
1 other branch
query baseconfig
Showing 8 changed files with 161 additions and 6 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/ConfigTypeEnums.java
- platform-common/src/main/java/com/lyms/platform/common/enums/ServiceTypeEnums.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BasicConfigController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EnumsController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyManageRequest.java
- platform-resource/resources/config-dev.properties
platform-common/src/main/java/com/lyms/platform/common/enums/ConfigTypeEnums.java
View file @
1270c71
| 1 | +package com.lyms.platform.common.enums; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.lyms.platform.common.utils.SystemConfig; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by lqy on 2016/06/20 | |
| 8 | + */ | |
| 9 | +public enum ConfigTypeEnums { | |
| 10 | + | |
| 11 | + | |
| 12 | + CERT_TYPE("cert",SystemConfig.CERTE_TYPE_ID), | |
| 13 | + COUNTRY_TYPE("country",SystemConfig.COUNTRY_TYPE_ID), | |
| 14 | + NATION_TYPE("nation",SystemConfig.NATION_TYPE_ID), | |
| 15 | + PROFESSION_TYPE("profession",SystemConfig.PROFESSION_TYPE_ID), | |
| 16 | + CENSUS_TYPE("census",SystemConfig.CENSUS_TYPE_ID), | |
| 17 | + LIVE_TYPE("live",SystemConfig.LIVE_TYPE_ID), | |
| 18 | + LEVEL_TYPE("level",SystemConfig.LEVEL_TYPE_ID); | |
| 19 | + | |
| 20 | + | |
| 21 | + private ConfigTypeEnums(String type,String value){ | |
| 22 | + this.type=type; | |
| 23 | + this.value = value; | |
| 24 | + } | |
| 25 | + private String type; | |
| 26 | + private String value; | |
| 27 | + | |
| 28 | + public String getType() { | |
| 29 | + return type; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setType(String type) { | |
| 33 | + this.type = type; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public String getValue() { | |
| 37 | + return value; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setValue(String value) { | |
| 41 | + this.value = value; | |
| 42 | + } | |
| 43 | + public static String getTypeParentId(String ctype){ | |
| 44 | + for(ConfigTypeEnums s : ConfigTypeEnums.values()) { | |
| 45 | + if(ctype.equals(s.getType())){ | |
| 46 | + return s.getValue(); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + return ""; | |
| 50 | + } | |
| 51 | + | |
| 52 | +} |
platform-common/src/main/java/com/lyms/platform/common/enums/ServiceTypeEnums.java
View file @
1270c71
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | List<Map<String,String>> list = new ArrayList<>(); |
| 34 | 34 | for(ServiceTypeEnums s : ServiceTypeEnums.values()) { |
| 35 | 35 | Map<String,String> map = new HashMap<>(); |
| 36 | - map.put("id", s.getId()+""); | |
| 36 | + map.put("id", String.valueOf(s.getId())); | |
| 37 | 37 | map.put("name", s.getTitle()); |
| 38 | 38 | list.add(map); |
| 39 | 39 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BasicConfigController.java
View file @
1270c71
| ... | ... | @@ -3,6 +3,7 @@ |
| 3 | 3 | import com.lyms.platform.common.base.BaseController; |
| 4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 5 | import com.lyms.platform.common.result.BaseListResponse; |
| 6 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 6 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 7 | 8 | import com.lyms.platform.operate.web.facade.BasicConfigFacade; |
| 8 | 9 | import com.lyms.platform.operate.web.request.BasicConfigAddRequest; |
| ... | ... | @@ -125,5 +126,19 @@ |
| 125 | 126 | basicConfigFacade.batchAddBasicConfig(list); |
| 126 | 127 | return 1; |
| 127 | 128 | } |
| 129 | + | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * | |
| 133 | + * 查询基础数据根据类型 | |
| 134 | + * | |
| 135 | + * @return 返回结果 | |
| 136 | + */ | |
| 137 | + @RequestMapping(method = RequestMethod.GET, value = "/getBaseConfigByType") | |
| 138 | + @ResponseBody | |
| 139 | + public BaseObjectResponse getBaseConfigByType(@RequestParam("type") String type) { | |
| 140 | + return basicConfigFacade.getBaseConfigByType(type); | |
| 141 | + } | |
| 142 | + | |
| 128 | 143 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BookbuildingController.java
View file @
1270c71
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/EnumsController.java
View file @
1270c71
| ... | ... | @@ -121,6 +121,22 @@ |
| 121 | 121 | return list; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | + /** | |
| 125 | + * 获取服务类型接口 | |
| 126 | + */ | |
| 127 | + @RequestMapping(value = "/getServiceType", method = RequestMethod.GET) | |
| 128 | + @ResponseBody | |
| 129 | + public List getServiceType() { | |
| 130 | + List<Map<String,String>> list = new ArrayList<>(); | |
| 131 | + for(ServiceTypeEnums s : ServiceTypeEnums.values()) { | |
| 132 | + Map<String,String> map = new HashMap<>(); | |
| 133 | + map.put("id", String.valueOf(s.getId())); | |
| 134 | + map.put("name", s.getTitle()); | |
| 135 | + list.add(map); | |
| 136 | + } | |
| 137 | + return list; | |
| 138 | + } | |
| 139 | + | |
| 124 | 140 | |
| 125 | 141 | public static void main(String a[]) { |
| 126 | 142 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java
View file @
1270c71
| ... | ... | @@ -2,9 +2,13 @@ |
| 2 | 2 | |
| 3 | 3 | import com.lyms.platform.biz.service.BasicConfigService; |
| 4 | 4 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | +import com.lyms.platform.common.enums.ConfigTypeEnums; | |
| 5 | 6 | import com.lyms.platform.common.enums.YnEnums; |
| 6 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
| 8 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 7 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 10 | +import com.lyms.platform.common.utils.StringUtils; | |
| 11 | +import com.lyms.platform.common.utils.SystemConfig; | |
| 8 | 12 | import com.lyms.platform.operate.web.request.BasicConfigAddRequest; |
| 9 | 13 | import com.lyms.platform.operate.web.request.BasicConfigQueryRequest; |
| 10 | 14 | import com.lyms.platform.operate.web.request.BasicConfigUpdateRequest; |
| ... | ... | @@ -171,5 +175,30 @@ |
| 171 | 175 | } |
| 172 | 176 | return provincesResults; |
| 173 | 177 | } |
| 178 | + | |
| 179 | + /** | |
| 180 | + * 根据类型查询响应的 基础数据 | |
| 181 | + * @param type | |
| 182 | + * @return | |
| 183 | + */ | |
| 184 | + public BaseObjectResponse getBaseConfigByType(String type) { | |
| 185 | + | |
| 186 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 187 | + | |
| 188 | + List<BasicConfigResult> results = new ArrayList<>(); | |
| 189 | + | |
| 190 | + String parentId = ConfigTypeEnums.getTypeParentId(type); | |
| 191 | + | |
| 192 | + if (!StringUtils.isEmpty(parentId)) | |
| 193 | + { | |
| 194 | + results = getBaseicConfigByParentId(parentId); | |
| 195 | + } | |
| 196 | + objectResponse.setData(results); | |
| 197 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 198 | + objectResponse.setErrormsg("成功"); | |
| 199 | + return objectResponse; | |
| 200 | + } | |
| 201 | + | |
| 202 | + | |
| 174 | 203 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyManageRequest.java
View file @
1270c71
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by lqy on 2016/6/17. | |
| 5 | + */ | |
| 6 | +public class BabyManageRequest { | |
| 7 | + //孕妇名称 | |
| 8 | + private String name; | |
| 9 | + | |
| 10 | + //服务类型 | |
| 11 | + private Integer serviceType; | |
| 12 | + | |
| 13 | + //身份证号 | |
| 14 | + private String cardNo; | |
| 15 | + | |
| 16 | + | |
| 17 | + //儿童管理类型 0全部 1高危 | |
| 18 | + private Integer babyType; | |
| 19 | + | |
| 20 | + public String getName() { | |
| 21 | + return name; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setName(String name) { | |
| 25 | + this.name = name; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public String getCardNo() { | |
| 29 | + return cardNo; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setCardNo(String cardNo) { | |
| 33 | + this.cardNo = cardNo; | |
| 34 | + } | |
| 35 | + | |
| 36 | + public Integer getServiceType() { | |
| 37 | + return serviceType; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setServiceType(Integer serviceType) { | |
| 41 | + this.serviceType = serviceType; | |
| 42 | + } | |
| 43 | +} |
platform-resource/resources/config-dev.properties
View file @
1270c71
| 1 | -mongo.db.host=localhost | |
| 2 | -mongo.db.port=27017 | |
| 3 | -mongo.db.dbname=platform1 | |
| 1 | +mongo.db.host=119.90.57.26 | |
| 2 | +mongo.db.port=10001 | |
| 3 | +mongo.db.dbname=platform | |
| 4 | 4 | mongo.db.username=platform |
| 5 | 5 | mongo.db.password=platform123 |
| 6 | 6 | mongo.socketTimeout=1000 |
| 7 | 7 | mongo.connectionsPerHost=20 |
| 8 | 8 | mongo.threadsAllowedToBlockForConnectionMultiplier=10 |
| 9 | -mongo.connectTimeout=1000 | |
| 9 | +mongo.connectTimeout=10000 | |
| 10 | 10 | mongo.maxWaitTime=2000 |
| 11 | 11 | mongo.autoConnectRetry=true |
| 12 | 12 | mongo.socketKeepAlive=true |