Commit 4ad50040e245efeae77c2f05b8fe11a8aed7812e
1 parent
eeebe4831c
Exists in
master
and in
1 other branch
修复bug,数据脱敏处理、去除java 1.8特有的api
Showing 8 changed files with 116 additions and 60 deletions
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AfterVisitPelvicFloorRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyAfterVisitBuildListRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyAfterVisitRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PelvicFloorInfoListRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyAfterVisitServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PelvicFloorServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/EncryptUtil.java
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/AfterVisitPelvicFloorRequest.java
View file @
4ad5004
... | ... | @@ -40,6 +40,19 @@ |
40 | 40 | */ |
41 | 41 | private String yearResult; |
42 | 42 | |
43 | + /** | |
44 | + * 是否加密 1|是 2|否 | |
45 | + */ | |
46 | + private String isEncrypt = "2"; | |
47 | + | |
48 | + public String getIsEncrypt() { | |
49 | + return isEncrypt; | |
50 | + } | |
51 | + | |
52 | + public void setIsEncrypt(String isEncrypt) { | |
53 | + this.isEncrypt = isEncrypt; | |
54 | + } | |
55 | + | |
43 | 56 | public String getQueryNo() { |
44 | 57 | return queryNo; |
45 | 58 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyAfterVisitBuildListRequest.java
View file @
4ad5004
... | ... | @@ -93,6 +93,19 @@ |
93 | 93 | */ |
94 | 94 | private String positiveProject; |
95 | 95 | |
96 | + /** | |
97 | + * 是否加密 1|是 2|否 | |
98 | + */ | |
99 | + private String isEncrypt = "2"; | |
100 | + | |
101 | + public String getIsEncrypt() { | |
102 | + return isEncrypt; | |
103 | + } | |
104 | + | |
105 | + public void setIsEncrypt(String isEncrypt) { | |
106 | + this.isEncrypt = isEncrypt; | |
107 | + } | |
108 | + | |
96 | 109 | public String getPositiveProject() { |
97 | 110 | return positiveProject; |
98 | 111 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyAfterVisitRequest.java
View file @
4ad5004
... | ... | @@ -58,6 +58,19 @@ |
58 | 58 | */ |
59 | 59 | private Integer highRiskType; |
60 | 60 | |
61 | + /** | |
62 | + * 是否加密 1|是 2|否 | |
63 | + */ | |
64 | + private String isEncrypt = "2"; | |
65 | + | |
66 | + public String getIsEncrypt() { | |
67 | + return isEncrypt; | |
68 | + } | |
69 | + | |
70 | + public void setIsEncrypt(String isEncrypt) { | |
71 | + this.isEncrypt = isEncrypt; | |
72 | + } | |
73 | + | |
61 | 74 | public Integer getHighRiskType() { |
62 | 75 | return highRiskType; |
63 | 76 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/PelvicFloorInfoListRequest.java
View file @
4ad5004
... | ... | @@ -49,6 +49,19 @@ |
49 | 49 | @Size(max = 1) |
50 | 50 | private String treatmentStatus; |
51 | 51 | |
52 | + /** | |
53 | + * 是否加密 1|是 2|否 | |
54 | + */ | |
55 | + private String isEncrypt = "2"; | |
56 | + | |
57 | + public String getIsEncrypt() { | |
58 | + return isEncrypt; | |
59 | + } | |
60 | + | |
61 | + public void setIsEncrypt(String isEncrypt) { | |
62 | + this.isEncrypt = isEncrypt; | |
63 | + } | |
64 | + | |
52 | 65 | public String getStartTreatmentTime() { |
53 | 66 | return startTreatmentTime; |
54 | 67 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyAfterVisitServiceImpl.java
View file @
4ad5004
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | import com.lyms.platform.operate.web.request.BabyAfterVisitRequest; |
18 | 18 | import com.lyms.platform.operate.web.service.BabyAfterVisitService; |
19 | 19 | import com.lyms.platform.operate.web.utils.CollectionUtils; |
20 | +import com.lyms.platform.operate.web.utils.EncryptUtil; | |
20 | 21 | import com.lyms.platform.operate.web.utils.InitDataUtils; |
21 | 22 | import com.lyms.platform.operate.web.worker.BabyAfterVisitInfoModelWork; |
22 | 23 | import com.lyms.platform.operate.web.worker.BabyAfterVisitStatisticsModelWork; |
... | ... | @@ -131,6 +132,9 @@ |
131 | 132 | highRiskType = exists ? -1 : highRiskType; |
132 | 133 | } |
133 | 134 | objectMap.put("highRiskType", highRiskType); |
135 | + | |
136 | + objectMap.put("mphone", "1".equals(request.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMphone()) : model.getMphone()); | |
137 | + objectMap.put("mcertNo", "1".endsWith(request.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMcertNo()) : model.getMcertNo()); | |
134 | 138 | mapList.add(objectMap); |
135 | 139 | |
136 | 140 | } |
... | ... | @@ -322,7 +326,7 @@ |
322 | 326 | // 起止月龄 |
323 | 327 | Integer startMonthsAge = request.getStartMonthsAge(); |
324 | 328 | Integer endMonthsAge = request.getEndMonthsAge(); |
325 | - if (Objects.nonNull(startMonthsAge) && Objects.nonNull(endMonthsAge) && endMonthsAge >= startMonthsAge) { | |
329 | + if (startMonthsAge != null && endMonthsAge != null && endMonthsAge >= startMonthsAge) { | |
326 | 330 | // 当月最后一天 |
327 | 331 | Calendar calendar = Calendar.getInstance(); |
328 | 332 | Date start; |
... | ... | @@ -331,7 +335,6 @@ |
331 | 335 | } else { |
332 | 336 | calendar.setTime(new Date()); |
333 | 337 | calendar.add(Calendar.MONTH, -startMonthsAge); |
334 | - //calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); | |
335 | 338 | start = calendar.getTime(); |
336 | 339 | } |
337 | 340 | |
... | ... | @@ -392,7 +395,7 @@ |
392 | 395 | |
393 | 396 | // 逾期天数 |
394 | 397 | Integer beyondDay = request.getBeyondDay(); |
395 | - boolean nonNull = Objects.nonNull(beyondDay); | |
398 | + boolean nonNull = beyondDay != null; | |
396 | 399 | if (appointmentTimeBoolean && nonNull) { |
397 | 400 | startAppointmentTime += " 00:00:00"; |
398 | 401 | endAppointmentTime += " 23:59:59"; |
... | ... | @@ -410,20 +413,6 @@ |
410 | 413 | s2 = getStartDate(beyondDay); |
411 | 414 | } |
412 | 415 | |
413 | - Date date = new Date(); | |
414 | - // 交集 | |
415 | - /* boolean a = s2.before(e1) && e1.after(e2) && s1.before(s2) && date.after(s2) && date.before(e1); | |
416 | - boolean b = s2.before(e1) && e2.before(e1) && s1.before(s2) && date.after(s2) && date.before(e2); | |
417 | - boolean c = s2.before(s1) && s1.before(e2) && e2.before(e1) && date.before(e2) && date.after(s1); | |
418 | - boolean d = s2.before(s1) && s1.before(e1) && e1.before(e2) && date.before(e1) && date.after(s1); | |
419 | - boolean e = s2.after(s1) && s1.after(e2) && e2.after(e1) && date.after(s1) && date.before(e2); | |
420 | - if (a || b) { | |
421 | - query.addCriteria(Criteria.where("appointmentTime").gte(s2).lte(date)); | |
422 | - } else if (c || d || e) { | |
423 | - query.addCriteria(Criteria.where("appointmentTime").gte(s1).lte(date)); | |
424 | - }else { | |
425 | - return new BaseResponse(); | |
426 | - }*/ | |
427 | 416 | if (s1.before(s2) && s2.before(e1) && e1.before(e2)) { |
428 | 417 | query.addCriteria(Criteria.where("appointmentTime").gte(s2).lte(e1)); |
429 | 418 | } else if (s1.before(s2) && s2.before(e2) && e2.before(s1)) { |
... | ... | @@ -454,10 +443,6 @@ |
454 | 443 | if (beyondDay > 0) { |
455 | 444 | end = getEndDate(beyondDay); |
456 | 445 | start = getStartDate(beyondDay); |
457 | - /*if (date.before(start) || date.after(end)) { | |
458 | - return new BaseResponse(); | |
459 | - } | |
460 | - query.addCriteria(Criteria.where("appointmentTime").gte(start).lte(date));*/ | |
461 | 446 | query.addCriteria(Criteria.where("appointmentTime").gte(start).lte(end)); |
462 | 447 | } else { |
463 | 448 | // 针对逾期天数为负数 |
... | ... | @@ -495,7 +480,8 @@ |
495 | 480 | objectMap.put("sexStr", SexEnum.getTextById(model.getSex())); |
496 | 481 | objectMap.put("birthStr", DateUtil.getyyyy_MM_dd(model.getBirth())); |
497 | 482 | objectMap.put("monthsAge", DateUtil.getBabyMonthAge(model.getBirth(), new Date())); |
498 | - objectMap.put("mphone",model.getMphone().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")); | |
483 | + // 脱敏处理 | |
484 | + objectMap.put("mphone","1".equals(request.getIsEncrypt()) ? EncryptUtil.numberEncrypt(model.getMphone()) : model.getMphone()); | |
499 | 485 | |
500 | 486 | // 预约时间 |
501 | 487 | Date appointmentTime = model.getAppointmentTime(); |
... | ... | @@ -754,6 +740,7 @@ |
754 | 740 | * @param type 0-追访概况、1-档案转正、2-儿保检查、3-眼保检查 |
755 | 741 | * @param statusType 1- 状态:正常 2-状态:作废 4-状态:预建档/临时建档 1-状态:正式建档/已建档 |
756 | 742 | */ |
743 | + @Override | |
757 | 744 | public void addOrUpdateAfterVisitData(BaseModel model, Integer type, Integer statusType){ |
758 | 745 | try { |
759 | 746 | ExecutorService service = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, |
... | ... | @@ -878,7 +865,7 @@ |
878 | 865 | } |
879 | 866 | List<String> projectStrs = InitDataUtils.getPositiveProjectByKey(babyEyeCheck); |
880 | 867 | if (CollectionUtils.isNotEmpty(projectStrs)) { |
881 | - String join = String.join(",", projectStrs); | |
868 | + String join = org.apache.commons.lang.StringUtils.join(projectStrs,","); | |
882 | 869 | update.set("positiveProject", join); |
883 | 870 | } |
884 | 871 | |
885 | 872 | |
... | ... | @@ -918,17 +905,17 @@ |
918 | 905 | String afterVisitWorkflow = request.getAfterVisitWorkflow(); |
919 | 906 | Date appointmentTime = request.getAppointmentTime(); |
920 | 907 | String type = request.getType(); |
921 | - if (Objects.isNull(babyId) || Objects.isNull(afterVisitUser) || | |
922 | - Objects.isNull(afterVisitTime) || Objects.isNull(afterVisitWay) || | |
923 | - Objects.isNull(isAppointment) || Objects.isNull(afterVisitResult) || | |
924 | - Objects.isNull(afterVisitWorkflow) || (Objects.equals(isAppointment, "1") && Objects.isNull(appointmentTime)) || | |
925 | - Objects.isNull(type)) { | |
908 | + if (StringUtils.isEmpty(babyId) || StringUtils.isEmpty(afterVisitUser) || | |
909 | + afterVisitTime == null || StringUtils.isEmpty(afterVisitWay) || | |
910 | + StringUtils.isEmpty(isAppointment) || StringUtils.isEmpty(afterVisitResult) || | |
911 | + StringUtils.isEmpty(afterVisitWorkflow) || (Objects.equals(isAppointment, "1") && appointmentTime == null) || | |
912 | + StringUtils.isEmpty(type)) { | |
926 | 913 | return new BaseResponse("参数缺失", ErrorCodeConstants.PARAMETER_ERROR); |
927 | 914 | } |
928 | 915 | BabyAfterVisitInfoDetailModel model = request; |
929 | 916 | model.setCreateTime(new Date()); |
930 | 917 | model.setAfterVisitTime(new Date(afterVisitTime.getTime())); |
931 | - if (Objects.nonNull(appointmentTime)) { | |
918 | + if (appointmentTime != null) { | |
932 | 919 | model.setAppointmentTime(new Date(appointmentTime.getTime())); |
933 | 920 | } |
934 | 921 | model.setYn(1); |
... | ... | @@ -966,7 +953,7 @@ |
966 | 953 | Query query = new Query(); |
967 | 954 | String babyId = request.getBabyId(); |
968 | 955 | String type = request.getType(); |
969 | - if (Objects.isNull(babyId) || Objects.isNull(type)) { | |
956 | + if (StringUtils.isEmpty(babyId) || StringUtils.isEmpty(type)) { | |
970 | 957 | return new BaseResponse("数据缺失", ErrorCodeConstants.PARAMETER_ERROR); |
971 | 958 | } |
972 | 959 | query.addCriteria(Criteria.where(BABY_ID).is(babyId).and("type").is(type).and("yn").is(1)); |
... | ... | @@ -1003,7 +990,7 @@ |
1003 | 990 | String id = request.getId(); |
1004 | 991 | String babyId = request.getBabyId(); |
1005 | 992 | String type = request.getType(); |
1006 | - if (Objects.isNull(id) || Objects.isNull(babyId) || Objects.isNull(type)) { | |
993 | + if (StringUtils.isEmpty(id) || StringUtils.isEmpty(babyId) || StringUtils.isEmpty(type)) { | |
1007 | 994 | return new BaseResponse("参数缺失", ErrorCodeConstants.PARAMETER_ERROR); |
1008 | 995 | } |
1009 | 996 | mongoTemplate.updateFirst(Query.query(Criteria.where("_id").is(id)), Update.update("yn", 2), BabyAfterVisitInfoModel.class); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BabyEvaluationCriterionServiceImpl.java
View file @
4ad5004
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/PelvicFloorServiceImpl.java
View file @
4ad5004
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | import com.lyms.platform.operate.web.facade.AutoMatchFacade; |
12 | 12 | import com.lyms.platform.operate.web.request.*; |
13 | 13 | import com.lyms.platform.operate.web.service.PelvicFloorService; |
14 | +import com.lyms.platform.operate.web.utils.EncryptUtil; | |
14 | 15 | import com.lyms.platform.permission.dao.master.MasterUsersMapper; |
15 | 16 | import com.lyms.platform.permission.model.Users; |
16 | 17 | import com.lyms.platform.pojo.*; |
17 | 18 | |
... | ... | @@ -569,12 +570,11 @@ |
569 | 570 | String treatmentTimeStr = null == treatmentTime ? "" :DateUtil.getyyyy_MM_dd(treatmentTime); |
570 | 571 | map.put("detailModels", subMaps); |
571 | 572 | map.put("treatmentTimeStr", treatmentTimeStr); |
572 | - map.put("cardNo", infoModel.getCardNo()); | |
573 | - map.put("cardNoEnc", numberEncrypt(infoModel.getCardNo())); | |
574 | 573 | map.put("name", infoModel.getName()); |
575 | 574 | map.put("age", DateUtil.getAge(infoModel.getBirth())); |
576 | - map.put("phoneEnc", numberEncrypt(infoModel.getPhone())); | |
577 | - map.put("phone", infoModel.getPhone()); | |
575 | + // 脱敏处理 | |
576 | + map.put("cardNo", "1".equals(param.getIsEncrypt()) ? EncryptUtil.numberEncrypt(infoModel.getCardNo()) : infoModel.getCardNo()); | |
577 | + map.put("phone", "1".equals(param.getIsEncrypt()) ? EncryptUtil.numberEncrypt(infoModel.getPhone()) : infoModel.getPhone()); | |
578 | 578 | String checkDoctorStr = ""; |
579 | 579 | String checkDoctorId = infoModel.getCheckDoctorId(); |
580 | 580 | if (StringUtils.isNotEmpty(checkDoctorId)) { |
... | ... | @@ -635,30 +635,6 @@ |
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
638 | - * 脱敏处理 | |
639 | - * | |
640 | - * @param strNo | |
641 | - * @return | |
642 | - */ | |
643 | - public String numberEncrypt(String strNo) { | |
644 | - if (StringUtils.isEmpty(strNo)) { | |
645 | - return ""; | |
646 | - } | |
647 | - int length = strNo.length(); | |
648 | - if (length == 11) { | |
649 | - // 手机号 | |
650 | - strNo = strNo.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); | |
651 | - } else if (length > 11) { | |
652 | - // 身份证 | |
653 | - strNo = strNo.replaceAll("(?<=\\w{3})\\w(?=\\w{4})", "*"); | |
654 | - } else if (length >= 8 && length < 11) { | |
655 | - // 护照 | |
656 | - strNo = strNo.substring(0, 2) + new String(new char[strNo.length() - 5]).replace("\0", "*") + strNo.substring(strNo.length() - 3); | |
657 | - } | |
658 | - return strNo; | |
659 | - } | |
660 | - | |
661 | - /** | |
662 | 638 | * 追访管理-盆底治疗 - 列表 |
663 | 639 | * |
664 | 640 | * @param param |
... | ... | @@ -711,7 +687,11 @@ |
711 | 687 | List<AfterVisitPelvicFloorModel> floorModels = mongoTemplate.find(query, AfterVisitPelvicFloorModel.class); |
712 | 688 | List<Map<String, Object>> mapList = new LinkedList<>(); |
713 | 689 | for (AfterVisitPelvicFloorModel model : floorModels) { |
714 | - | |
690 | + if ("1".equals(param.getIsEncrypt())) { | |
691 | + // 脱敏处理 | |
692 | + model.setPhone(EncryptUtil.numberEncrypt(model.getPhone())); | |
693 | + model.setCardNo(EncryptUtil.numberEncrypt(model.getCardNo())); | |
694 | + } | |
715 | 695 | Map<String, Object> map = BeanUtils.objectToObjectMap(model); |
716 | 696 | map.put("age", DateUtil.getAge(model.getBirth())); |
717 | 697 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/EncryptUtil.java
View file @
4ad5004
1 | +package com.lyms.platform.operate.web.utils; | |
2 | + | |
3 | +import com.lyms.platform.common.utils.StringUtils; | |
4 | + | |
5 | +/** | |
6 | + * 必要信息脱敏处理 | |
7 | + * @Author dongqin | |
8 | + * @Description | |
9 | + * @Date 15:05 2019/7/29 | |
10 | + */ | |
11 | +public class EncryptUtil { | |
12 | + | |
13 | + /** | |
14 | + * 脱敏处理 | |
15 | + * | |
16 | + * @param strNo | |
17 | + * @return | |
18 | + */ | |
19 | + public static String numberEncrypt(String strNo) { | |
20 | + if (StringUtils.isEmpty(strNo)) { | |
21 | + return ""; | |
22 | + } | |
23 | + int length = strNo.length(); | |
24 | + if (length == 11) { | |
25 | + // 手机号 | |
26 | + strNo = strNo.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"); | |
27 | + } else if (length > 11) { | |
28 | + // 身份证 | |
29 | + strNo = strNo.replaceAll("(?<=\\w{3})\\w(?=\\w{4})", "*"); | |
30 | + } else if (length >= 8 && length < 11) { | |
31 | + // 护照 | |
32 | + strNo = strNo.substring(0, 2) + new String(new char[strNo.length() - 5]).replace("\0", "*") + strNo.substring(strNo.length() - 3); | |
33 | + } | |
34 | + return strNo; | |
35 | + } | |
36 | +} |