Commit 44763700abb31b1216a6276ff41b43cd8fdf58b9
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 8 changed files
- platform-common/src/main/java/com/lyms/platform/common/enums/RiskDefaultTypeEnum.java
- platform-common/src/main/java/com/lyms/platform/common/utils/SystemConfig.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BasicConfig.java
- platform-dal/src/main/java/com/lyms/platform/query/BasicConfigQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RiskController.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/BasicConfigAddRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasicConfigUpdateRequest.java
platform-common/src/main/java/com/lyms/platform/common/enums/RiskDefaultTypeEnum.java
View file @
4476370
| 1 | +package com.lyms.platform.common.enums; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Administrator on 2016/6/22 0022. | |
| 5 | + */ | |
| 6 | +public enum RiskDefaultTypeEnum { | |
| 7 | + Orange("橙色","orange"), | |
| 8 | + Yellow("黄色","yellow"), | |
| 9 | + Red("红色","red"), | |
| 10 | + Purple("紫色","purple") | |
| 11 | + ; | |
| 12 | + | |
| 13 | + private RiskDefaultTypeEnum(String title, String color) { | |
| 14 | + this.color = color; | |
| 15 | + this.title = title; | |
| 16 | + } | |
| 17 | + | |
| 18 | + private String title; | |
| 19 | + private String color; | |
| 20 | + | |
| 21 | + public String getTitle() { | |
| 22 | + return title; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setTitle(String title) { | |
| 26 | + this.title = title; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public String getColor() { | |
| 30 | + return color; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setColor(String color) { | |
| 34 | + this.color = color; | |
| 35 | + } | |
| 36 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/SystemConfig.java
View file @
4476370
| ... | ... | @@ -59,5 +59,13 @@ |
| 59 | 59 | public static final String YSFYS = "5769eef90cf22c3157577422"; |
| 60 | 60 | //本次妊娠 |
| 61 | 61 | public static final String BCRS = "5769eef90cf22c3157577422"; |
| 62 | + | |
| 63 | + // 高危风险(new) | |
| 64 | + public static final String GWFX_NEW = "6A09E3B0-8418-47CA-A846-55514EE08A24"; | |
| 65 | + | |
| 66 | + // 高危风险类型的类型(typeId) | |
| 67 | + public static final String GWFX_NEW_COLOR_TYPE_ID = "TYPE-GWFX-NEW"; | |
| 68 | + | |
| 69 | + | |
| 62 | 70 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/BasicConfig.java
View file @
4476370
| ... | ... | @@ -33,6 +33,25 @@ |
| 33 | 33 | private Long createDate; |
| 34 | 34 | private Long modifiedDate; |
| 35 | 35 | |
| 36 | + private Integer score; | |
| 37 | + private String describe; | |
| 38 | + | |
| 39 | + public Integer getScore() { | |
| 40 | + return score; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setScore(Integer score) { | |
| 44 | + this.score = score; | |
| 45 | + } | |
| 46 | + | |
| 47 | + public String getDescribe() { | |
| 48 | + return describe; | |
| 49 | + } | |
| 50 | + | |
| 51 | + public void setDescribe(String describe) { | |
| 52 | + this.describe = describe; | |
| 53 | + } | |
| 54 | + | |
| 36 | 55 | public static long getSerialVersionUID() { |
| 37 | 56 | return serialVersionUID; |
| 38 | 57 | } |
platform-dal/src/main/java/com/lyms/platform/query/BasicConfigQuery.java
View file @
4476370
| ... | ... | @@ -21,6 +21,8 @@ |
| 21 | 21 | |
| 22 | 22 | private Integer enable; |
| 23 | 23 | |
| 24 | + private String typeId; | |
| 25 | + | |
| 24 | 26 | public Integer getEnable() { |
| 25 | 27 | return enable; |
| 26 | 28 | } |
| ... | ... | @@ -45,6 +47,9 @@ |
| 45 | 47 | if (null != parentId) { |
| 46 | 48 | condition = condition.and("parentId", parentId, MongoOper.IS); |
| 47 | 49 | } |
| 50 | + if (null != typeId) { | |
| 51 | + condition = condition.and("typeId", typeId, MongoOper.IS); | |
| 52 | + } | |
| 48 | 53 | if(null!=enable){ |
| 49 | 54 | condition = condition.and("enable", enable, MongoOper.IS); |
| 50 | 55 | } |
| ... | ... | @@ -55,6 +60,14 @@ |
| 55 | 60 | } |
| 56 | 61 | |
| 57 | 62 | return condition.toMongoQuery(); |
| 63 | + } | |
| 64 | + | |
| 65 | + public String getTypeId() { | |
| 66 | + return typeId; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void setTypeId(String typeId) { | |
| 70 | + this.typeId = typeId; | |
| 58 | 71 | } |
| 59 | 72 | |
| 60 | 73 | public String getKeyword() { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RiskController.java
View file @
4476370
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 4 | +import com.lyms.platform.common.base.BaseController; | |
| 5 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 6 | +import com.lyms.platform.common.enums.YnEnums; | |
| 7 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 8 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 9 | +import com.lyms.platform.common.result.BaseResponse; | |
| 10 | +import com.lyms.platform.common.utils.SystemConfig; | |
| 11 | +import com.lyms.platform.operate.web.facade.BasicConfigFacade; | |
| 12 | +import com.lyms.platform.operate.web.request.BasicConfigQueryRequest; | |
| 13 | +import com.lyms.platform.operate.web.result.FrontEndResult; | |
| 14 | +import com.lyms.platform.pojo.BasicConfig; | |
| 15 | +import com.lyms.platform.query.BasicConfigQuery; | |
| 16 | +import org.apache.commons.lang.StringUtils; | |
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | +import org.springframework.stereotype.Controller; | |
| 19 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 20 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 21 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 22 | +import org.springframework.web.bind.annotation.ResponseBody; | |
| 23 | + | |
| 24 | +import javax.validation.Valid; | |
| 25 | +import java.util.ArrayList; | |
| 26 | +import java.util.HashMap; | |
| 27 | +import java.util.List; | |
| 28 | +import java.util.Map; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Created by Administrator on 2016/6/22 0022. | |
| 32 | + */ | |
| 33 | +@Controller | |
| 34 | +public class RiskController extends BaseController { | |
| 35 | + | |
| 36 | + @Autowired | |
| 37 | + private BasicConfigService basicConfigService; | |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 高危风险版本查询 | |
| 41 | + * | |
| 42 | + * @return 返回结果 | |
| 43 | + */ | |
| 44 | + @RequestMapping(method = RequestMethod.GET, value = "/risk/version") | |
| 45 | + @ResponseBody | |
| 46 | + public FrontEndResult queryRiskVersion(@RequestParam(value = "versionId", required = false) String versionId) { | |
| 47 | + BasicConfigQuery query = new BasicConfigQuery(); | |
| 48 | + query.setId(versionId); | |
| 49 | + query.setParentId(SystemConfig.GWFX_NEW); | |
| 50 | + query.setYn(YnEnums.YES.getId()); | |
| 51 | + List<BasicConfig> list = basicConfigService.queryBasicConfig(query); | |
| 52 | + List<Map> data = new ArrayList<>(); | |
| 53 | + query.setTypeId(SystemConfig.GWFX_NEW_COLOR_TYPE_ID); | |
| 54 | + for (BasicConfig config:list) { | |
| 55 | + Map<String,Object> map = new HashMap<>(); | |
| 56 | + map.put("id", config.getId()); | |
| 57 | + map.put("name", config.getName()); | |
| 58 | + query.setParentId(config.getId()); | |
| 59 | + List<BasicConfig> levelList = basicConfigService.queryBasicConfig(query); | |
| 60 | + List<Map> subList = new ArrayList<>(); | |
| 61 | + for (BasicConfig b:levelList) { | |
| 62 | + Map<String,Object> submap = new HashMap<>(); | |
| 63 | + submap.put("id", b.getId()); | |
| 64 | + submap.put("name", b.getName()); | |
| 65 | + submap.put("code", b.getCode()); | |
| 66 | + subList.add(submap); | |
| 67 | + } | |
| 68 | + map.put("levelList", subList); | |
| 69 | + data.add(map); | |
| 70 | + } | |
| 71 | + return FrontEndResult.ini().setData(data).setPageInfo(query.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 72 | + } | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 高危风险查询 | |
| 76 | + * | |
| 77 | + * @return 返回结果 | |
| 78 | + */ | |
| 79 | + @RequestMapping(method = RequestMethod.GET, value = "/risklist") | |
| 80 | + @ResponseBody | |
| 81 | + public BaseResponse queryRisk(@RequestParam("versionId") String versionId, | |
| 82 | + @RequestParam("page") Integer page, | |
| 83 | + @RequestParam("limit") Integer limit, | |
| 84 | + @RequestParam(value = "typeId", required = false) String typeId, | |
| 85 | + @RequestParam(value = "keyword", required = false) String s) { | |
| 86 | + if (StringUtils.isNotBlank(versionId)) { | |
| 87 | + BasicConfigQuery query = new BasicConfigQuery(); | |
| 88 | + query.setParentId(versionId); | |
| 89 | + query.setYn(YnEnums.YES.getId()); | |
| 90 | + query.setNeed("y"); | |
| 91 | + query.setLimit(limit); | |
| 92 | + query.setPage(page); | |
| 93 | + query.setTypeId(typeId); | |
| 94 | + query.setKeyword(s); | |
| 95 | + List<BasicConfig> list = basicConfigService.queryBasicConfig(query); | |
| 96 | + return FrontEndResult.ini().setData(list).setPageInfo(query.getPageInfo()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 97 | + } else { | |
| 98 | + return new BaseResponse("versionId is null", ErrorCodeConstants.PARAMETER_ERROR); | |
| 99 | + } | |
| 100 | + } | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 高危风险查询 | |
| 104 | + * | |
| 105 | + * @return 返回结果 | |
| 106 | + */ | |
| 107 | + @RequestMapping(method = RequestMethod.POST, value = "/riskcopy") | |
| 108 | + @ResponseBody | |
| 109 | + public BaseResponse copyRisk(@RequestParam("versionId") String versionId) { | |
| 110 | + if (StringUtils.isNotBlank(versionId)) { | |
| 111 | + BasicConfig b = basicConfigService.getOneBasicConfigById(versionId); | |
| 112 | + if (b != null) { | |
| 113 | + b.setId(null); | |
| 114 | + b.setName(b.getName() + " - 副本"); | |
| 115 | + basicConfigService.addBasicConfig(b); | |
| 116 | + BasicConfigQuery query = new BasicConfigQuery(); | |
| 117 | + query.setParentId(versionId); | |
| 118 | + query.setYn(YnEnums.YES.getId()); | |
| 119 | + List<BasicConfig> list = basicConfigService.queryBasicConfig(query); | |
| 120 | + List<BasicConfig> configList = new ArrayList<>(); | |
| 121 | + Map<String, String> map = new HashMap<>(); | |
| 122 | + for (BasicConfig config:list) { | |
| 123 | + String oldId = new String(config.getId()); | |
| 124 | + config.setId(null); | |
| 125 | + config.setParentId(b.getId()); | |
| 126 | + if (SystemConfig.GWFX_NEW_COLOR_TYPE_ID.equals(b.getTypeId())) { | |
| 127 | + basicConfigService.addBasicConfig(config); | |
| 128 | + map.put(oldId, config.getId()); | |
| 129 | + } else { | |
| 130 | + configList.add(config); | |
| 131 | + } | |
| 132 | + } | |
| 133 | + if (configList.size() > 0) { | |
| 134 | + for (BasicConfig config : configList) { | |
| 135 | + config.setTypeId(map.get(config.getTypeId())); | |
| 136 | + } | |
| 137 | + basicConfigService.batchSave(configList); | |
| 138 | + } | |
| 139 | + return new BaseResponse("成功", ErrorCodeConstants.SUCCESS); | |
| 140 | + } else { | |
| 141 | + return new BaseResponse("版本数据不存在", ErrorCodeConstants.BUSINESS_ERROR); | |
| 142 | + } | |
| 143 | + | |
| 144 | + } else { | |
| 145 | + return new BaseResponse("versionId is null", ErrorCodeConstants.PARAMETER_ERROR); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + | |
| 149 | + @RequestMapping(method = RequestMethod.POST, value = "/risk/version") | |
| 150 | + @ResponseBody | |
| 151 | + public BaseResponse addRiskVersion(@RequestParam("name") String name) { | |
| 152 | + BasicConfig config = new BasicConfig(); | |
| 153 | + config.setParentId(SystemConfig.GWFX_NEW); | |
| 154 | + config.setTypeId("0"); | |
| 155 | + config.setName(name); | |
| 156 | + config.setYn(YnEnums.YES.getId()); | |
| 157 | + config.setCode(name); | |
| 158 | + config.setEnable(YnEnums.YES.getId()); | |
| 159 | + config.setCreateDate(System.currentTimeMillis()); | |
| 160 | + basicConfigService.addBasicConfig(config); | |
| 161 | + return new BaseObjectResponse().setData(config.getId()).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
| 162 | + } | |
| 163 | + | |
| 164 | + | |
| 165 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BasicConfigFacade.java
View file @
4476370
| ... | ... | @@ -79,6 +79,9 @@ |
| 79 | 79 | obj.setName(basicConfigUpdateRequest.getName()); |
| 80 | 80 | obj.setId(basicConfigUpdateRequest.getId()); |
| 81 | 81 | obj.setEnable(basicConfigUpdateRequest.getEnable()); |
| 82 | + obj.setTypeId(basicConfigUpdateRequest.getTypeId()); | |
| 83 | + obj.setScore(basicConfigUpdateRequest.getScore()); | |
| 84 | + obj.setDescribe(basicConfigUpdateRequest.getDescribe()); | |
| 82 | 85 | BasicConfigQuery basicConfigQuery = new BasicConfigQuery(); |
| 83 | 86 | basicConfigQuery.setId(basicConfigUpdateRequest.getId()); |
| 84 | 87 | basicConfigQuery.setYn(YnEnums.YES.getId()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasicConfigAddRequest.java
View file @
4476370
| ... | ... | @@ -18,6 +18,34 @@ |
| 18 | 18 | @FormParam |
| 19 | 19 | private String code; |
| 20 | 20 | |
| 21 | + private String typeId; | |
| 22 | + private Integer score; | |
| 23 | + private String describe; | |
| 24 | + | |
| 25 | + public String getTypeId() { | |
| 26 | + return typeId; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public void setTypeId(String typeId) { | |
| 30 | + this.typeId = typeId; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public Integer getScore() { | |
| 34 | + return score; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setScore(Integer score) { | |
| 38 | + this.score = score; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public String getDescribe() { | |
| 42 | + return describe; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setDescribe(String describe) { | |
| 46 | + this.describe = describe; | |
| 47 | + } | |
| 48 | + | |
| 21 | 49 | public String getParentId() { |
| 22 | 50 | return parentId; |
| 23 | 51 | } |
| ... | ... | @@ -54,6 +82,9 @@ |
| 54 | 82 | if(StringUtils.isEmpty(parentId)){ |
| 55 | 83 | return null; |
| 56 | 84 | } |
| 85 | + basicConfig.setTypeId(typeId); | |
| 86 | + basicConfig.setDescribe(describe); | |
| 87 | + basicConfig.setScore(score); | |
| 57 | 88 | basicConfig.setCode(code); |
| 58 | 89 | basicConfig.setName(name); |
| 59 | 90 | basicConfig.setParentId(parentId); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BasicConfigUpdateRequest.java
View file @
4476370
| ... | ... | @@ -16,6 +16,33 @@ |
| 16 | 16 | private String code; |
| 17 | 17 | @FormParam |
| 18 | 18 | private int enable; |
| 19 | + private String typeId; | |
| 20 | + private Integer score; | |
| 21 | + private String describe; | |
| 22 | + | |
| 23 | + public String getTypeId() { | |
| 24 | + return typeId; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setTypeId(String typeId) { | |
| 28 | + this.typeId = typeId; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public Integer getScore() { | |
| 32 | + return score; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setScore(Integer score) { | |
| 36 | + this.score = score; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public String getDescribe() { | |
| 40 | + return describe; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setDescribe(String describe) { | |
| 44 | + this.describe = describe; | |
| 45 | + } | |
| 19 | 46 | |
| 20 | 47 | public int getEnable() { |
| 21 | 48 | return enable; |