Commit bb0143b8374de32c96672761d3df1efe2b983d50
1 parent
de922bde76
Exists in
master
and in
1 other branch
血糖报告
Showing 2 changed files with 12 additions and 5 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/IBloodSugarService.java
View file @
bb0143b
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/BloodSugarServiceImpl.java
View file @
bb0143b
... | ... | @@ -907,12 +907,19 @@ |
907 | 907 | } |
908 | 908 | |
909 | 909 | @Override |
910 | - public BaseResponse addWeightInfo(String id, Double beforeWeight, Double currentWeight) { | |
910 | + public BaseResponse addWeightInfo(String id, String beforeWeight, String currentWeight) { | |
911 | + BaseResponse resp = new BaseResponse(); | |
912 | + if (StringUtils.isEmpty(beforeWeight) || StringUtils.isEmpty(currentWeight)) | |
913 | + { | |
914 | + resp.setErrorcode(ResponseCode.DATA_ERROR.getCode()); | |
915 | + resp.setErrormsg(ResponseCode.DATA_ERROR.getMsg()); | |
916 | + return resp; | |
917 | + } | |
911 | 918 | BloodSugar bloodSugarsMonth = mongoTemplate.findOne(Query.query(Criteria.where("id").is(id)), BloodSugar.class); |
912 | - bloodSugarsMonth.setWeight(beforeWeight); | |
913 | - bloodSugarsMonth.setCurrentWeight(currentWeight); | |
919 | + bloodSugarsMonth.setWeight(Double.valueOf(String.format("%.2f", Double.parseDouble(beforeWeight)))); | |
920 | + bloodSugarsMonth.setCurrentWeight(Double.valueOf(String.format("%.2f", Double.parseDouble(currentWeight)))); | |
914 | 921 | bloodSugarService.update(bloodSugarsMonth); |
915 | - BaseResponse resp = new BaseResponse(); | |
922 | + | |
916 | 923 | resp.setErrorcode(ResponseCode.SUCCESS.getCode()); |
917 | 924 | resp.setErrormsg(ResponseCode.SUCCESS.getMsg()); |
918 | 925 | return resp; |