Commit 8b3efe9f by 汪志阳

fix:bug修改

parent a6a6d251
......@@ -79,7 +79,7 @@ public class OffBedAlarm implements IAlarm {
log.error("离床告警配置解析失败,config:{}", JSONUtil.toJsonStr(config));
return;
}
if (!"0".equals(ruleConfig.getStartTimeType())) {
if (!CURRENT_DAY.equals(ruleConfig.getStartTimeType())) {
return;
}
JSONObject properties = platAlarmCheckDTO.getProperties();
......@@ -94,7 +94,7 @@ public class OffBedAlarm implements IAlarm {
return;
}
LocalDateTime startTime = timeRange.get(0);
LocalDateTime endTime = "1".equals(ruleConfig.getEndTimeType()) ? timeRange.get(1).plusDays(1) : timeRange.get(1);
LocalDateTime endTime = CURRENT_DAY.equals(ruleConfig.getEndTimeType()) ? timeRange.get(1) : timeRange.get(1).plusDays(1);
if (startTime.isAfter(endTime)) {
log.error("离床告警配置开始时间大于结束时间,config:{}", JSONUtil.toJsonStr(ruleConfig));
return;
......
......@@ -305,7 +305,9 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
@Transactional(rollbackFor = Exception.class)
public void bind(String elderId) {
PlatElderChildrenInfo childrenInfo = getById(WechatUserUtil.getUserId());
if (childrenInfo == null) {
return;
}
List<PlatElderChildrenInfo> platElderChildrenInfoList = list(new QueryWrapper<PlatElderChildrenInfo>().lambda()
.eq(PlatElderChildrenInfo::getOpenid, childrenInfo.getOpenid())
.isNotNull(PlatElderChildrenInfo::getElderId));
......@@ -320,15 +322,25 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
throw new RuntimeException("找不到要绑定的长者");
}
// 优先同租户同组织下的长者,没有的话就同租户下的,再没有就拿初始的数据
PlatElderChildrenInfo platElderChildrenInfo = platElderChildrenInfoList.stream()
.filter(f -> f.getOrgId().equals(platElder.getOrgId())
|| f.getTenantId().equals(platElder.getTenantId())).findFirst().orElse(childrenInfo);
PlatElderChildrenInfo orgChildrenInfo = platElderChildrenInfoList.stream()
.filter(f -> f.getOrgId().equals(platElder.getOrgId())).findFirst().orElse(null);
PlatElderChildrenInfo tenantInfo = platElderChildrenInfoList.stream()
.filter(f -> f.getTenantId().equals(platElder.getTenantId())).findFirst().orElse(null);
PlatElderChildrenInfo copyInfo = null;
if(orgChildrenInfo != null){
copyInfo = orgChildrenInfo;
}
if(tenantInfo != null && orgChildrenInfo == null){
copyInfo = tenantInfo;
}
if(copyInfo == null){
copyInfo = childrenInfo;
}
newChildrenInfo.setTenantId(platElder.getTenantId());
newChildrenInfo.setOpenid(platElderChildrenInfo.getOpenid());
newChildrenInfo.setPhone(platElderChildrenInfo.getPhone());
newChildrenInfo.setName(platElderChildrenInfo.getName());
newChildrenInfo.setAvatar(platElderChildrenInfo.getAvatar());
newChildrenInfo.setOpenid(copyInfo.getOpenid());
newChildrenInfo.setPhone(copyInfo.getPhone());
newChildrenInfo.setName(copyInfo.getName());
newChildrenInfo.setAvatar(copyInfo.getAvatar());
PlatOrgSplitDTO vo = platOrgService.getOrgSplitVO(platElder.getOrgId());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment