Commit 0a0c2bd4 by 朱淼
parents 46bf6023 30bb5321
......@@ -152,7 +152,7 @@ CREATE TABLE `plat_elder_medical_examination_info`
CREATE TABLE `plat_elder_children_info`
(
`id` varchar(64) NOT NULL COMMENT 'id',
`elder_id` varchar(64) NULL COMMENT '长者id',
`elder_id` varchar(600) NULL COMMENT '长者id',
`openid` varchar(64) NOT NULL COMMENT 'openid',
`name` varchar(64) DEFAULT NULL COMMENT '姓名',
`phone` varchar(64) DEFAULT NULL COMMENT '手机号码',
......
......@@ -24,4 +24,6 @@ public class HeaderConst {
public static final String FEIGN_NO_REMOVE="feignNoRemove";
public static final String DATA_SCOPE = "data-scope";
public static final String ROLE_ID = "role-id";
}
......@@ -24,7 +24,10 @@ import java.util.Set;
public class PlatAuthorizationInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//todo 按钮权限关闭
if(true){
return true;
}
Action annotation;
if (handler instanceof HandlerMethod) {
......
......@@ -72,6 +72,11 @@ public class PlatUserLoginVO implements Serializable {
private boolean initFlag = false;
/**
* 当前账号选择的右上角角色
*/
private String currentRoleId;
public void init(){
if(initFlag){
......
......@@ -14,6 +14,8 @@ import com.makeit.module.iot.vo.ResponseMessage;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.HttpClient;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -49,6 +51,7 @@ public class IotCommonService {
}
public ResponseMessage sendPatch(String url, HttpRequest request) throws IOException {
Response response = request.patch();
ResponseMessage responseMessage = getResponseMessage(url, response);
return responseMessage;
}
......
......@@ -73,15 +73,17 @@ public class IotProductDeviceService extends IotCommonService {
}
@Async
public void syncUpdateDeviceInfo(String id,String name) {
public void syncUpdateDeviceInfo(String id, String name, String productId) {
String url = iotUrl + "/device-instance";
// 条件可以自己改
Map<String,Object> reqMap = Maps.newHashMap();
reqMap.put("id",id);
reqMap.put("name",name);
reqMap.put("productId",productId);
String body = JsonUtil.toJson(reqMap);
HttpRequest request = buildRequest(url, body);
request.encode("UTF-8");
request.contentType("application/json");
try {
ResponseMessage responseMessage = sendPatch(url, request);
if (responseMessage.getStatus() == 200) {
......@@ -129,13 +131,13 @@ public class IotProductDeviceService extends IotCommonService {
}
DeviceInfoContentBreathe breathe = JsonUtil.toObj((String) deviceOperationLogEntity.getContent(), DeviceInfoContentBreathe.class);
return breathe;
LocalDateTime time = LongTimestampUtil.toLocalDateTime(breathe.getTimestamp());
/* LocalDateTime time = LongTimestampUtil.toLocalDateTime(breathe.getTimestamp());
if (ignoreDuration != null && Duration.between(time, LocalDateTime.now()).getSeconds() > ignoreDuration) {
return null;
}
}*/
return breathe;
}
......
......@@ -175,6 +175,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
Page<SysConfig> pageList = page(p, listLambdaQueryWrapper(sysConfig));
JoinUtil.join(pageList.getRecords(), sysConfigCategoryService, SysConfig::getCategoryId, SysConfigCategory::getId, (c, cc) -> {
c.setCategoryCode(cc.getCode());
c.setCategoryName(cc.getName());
});
......
......@@ -28,6 +28,9 @@ public class PlatSpaceVO extends BaseIdDTO {
@ApiModelProperty("属性 1-居家 2-机构")
private String attribute;
@ApiModelProperty("上级路径")
private String patentPath;
@ApiModelProperty("子集")
private List<PlatSpaceVO> children;
}
......@@ -30,6 +30,7 @@ import com.makeit.entity.saas.PlatTenant;
import com.makeit.entity.saas.PlatTenantMenu;
import com.makeit.enums.CodeMessageEnum;
import com.makeit.enums.CommonEnum;
import com.makeit.enums.HeaderConst;
import com.makeit.enums.IsTenantAccountEnum;
import com.makeit.enums.biz.auth.SysEnum;
import com.makeit.enums.id.TreeConst;
......@@ -61,6 +62,7 @@ import com.makeit.utils.data.convert.StreamUtil;
import com.makeit.utils.data.excel.ExcelUtil;
import com.makeit.utils.data.excel.ExcelValidatorUtil;
import com.makeit.utils.data.id.IdGen;
import com.makeit.utils.request.RequestUtil;
import com.makeit.utils.sql.groupby.DynamicQuery;
import com.makeit.utils.sql.groupby.SqlUtil;
import com.makeit.utils.sql.join.JoinUtil;
......@@ -537,9 +539,15 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
private List<PlatMenu> getMenuListByUserId(PlatUserLoginVO userLoginVO) {
String currentRoleId = userLoginVO.getCurrentRoleId();
List<String> roleIdList = new ArrayList<>();
if(StringUtils.isBlank(currentRoleId)) {
List<PlatRole> roleList = getRoleList(userLoginVO.getId());
List<String> roleIdList = StreamUtil.map(roleList, PlatRole::getId);
roleIdList = StreamUtil.map(roleList, PlatRole::getId);
}else {
roleIdList.add(currentRoleId);
}
roleIdList.add(-1 + "");
List<PlatRoleMenu> roleMenuList = platRoleMenuService.list(new QueryWrapper<PlatRoleMenu>().lambda()
......@@ -554,7 +562,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
.orderByAsc(PlatMenu::getCreateDate)
);
userLoginVO.setRoleList(BeanDtoVoUtils.listVo(roleList, PlatRoleDTOVO.class));
//userLoginVO.setRoleList(BeanDtoVoUtils.listVo(roleList, PlatRoleDTOVO.class));
if (StringUtils.isNotBlank(userLoginVO.getTenantId())) {
Set<String> menuIdSet = StreamUtil.mapToSet(getMenuListByTenantId(userLoginVO.getTenantId()), PlatMenu::getId);
......@@ -589,6 +597,7 @@ public class PlatUserServiceImpl extends ServiceImpl<PlatUserMapper, PlatUser>
return userLoginVO;
}
userLoginVO.setCurrentRoleId(RequestUtil.getHeader(HeaderConst.ROLE_ID));
List<PlatMenu> menuList = getMenuListByUserId(userLoginVO);
fillMenuList(menuList, userLoginVO);
......
......@@ -129,7 +129,7 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
deviceCacheUtil.put(db);
iotProductDeviceService.syncUpdateDeviceInfo(db.getOriDeviceId(),dto.getName());
// iotProductDeviceService.syncUpdateDeviceInfo(db.getOriDeviceId(),dto.getName(),db.getProductId());
}
@Override
......
......@@ -98,7 +98,11 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
public void elderSleepSleepAnalysisTask() {
List<String> dayHourRangeList = getLastDayHourRange();
String currentDate = DateUtil.format(new Date(), DatePattern.NORM_DATE_PATTERN);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.add(Calendar.DAY_OF_MONTH, -1);
Date previousDate = calendar.getTime();
String currentDate = DateUtil.format(previousDate, DatePattern.NORM_DATE_PATTERN);
SaasSleepAnalysisModel analysisModel = saasSleepAnalysisModelService.getOne(new QueryWrapper<SaasSleepAnalysisModel>().lambda()
.orderByDesc(BaseEntity::getCreateBy)
......@@ -157,8 +161,8 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
continue;
}
String tenantId = elder.getTenantId();
/* String reportStartTime = "";
String reportEndTime = "";*/
String reportStartTime = "";
String reportEndTime = "";
for (String hourRange : dayHourRangeList) {
String[] hourRangeArray = hourRange.split("~");
List<DeviceOperationLogEntity> deviceOperationLogEntities = productDeviceService.getDeviceLogByTimeRange(platDevice.getOriDeviceId(), "reportProperty", 5000, hourRangeArray[0], hourRangeArray[1]);
......@@ -180,10 +184,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
Map<String, AnalysisVO> statisticsMap = Maps.newHashMap();
List<DeviceInfoContentBreathe> deviceInfoContentBreathes;
for (Map.Entry<String, List<DeviceInfoContentBreathe>> entry : minuteMap.entrySet()) {
/* if (StringUtils.isEmpty(reportStartTime)) {
if (StringUtils.isEmpty(reportStartTime)) {
reportStartTime = entry.getKey();
}
reportEndTime = entry.getKey();*/
reportEndTime = entry.getKey();
deviceInfoContentBreathes = entry.getValue();
DeviceInfoContentBreathe.Properties breatheProperties;
......@@ -500,10 +504,10 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
int timeHourRange = 24;
/* if (StringUtils.isNotEmpty(reportStartTime) && StringUtils.isNotEmpty(reportEndTime)) {
if (StringUtils.isNotEmpty(reportStartTime) && StringUtils.isNotEmpty(reportEndTime)) {
Long durationRange = getDurationRange(reportStartTime, reportEndTime);
timeHourRange = (int) (durationRange / 60);
}*/
}
// 判断是否满足配置的呼吸心率异常类型
BigDecimal dayBrStopRate = brStopCount == 0 ? BigDecimal.ZERO : new BigDecimal(timeHourRange).divide(new BigDecimal(brStopCount), 2, RoundingMode.HALF_UP);
......@@ -610,7 +614,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
platElderBreatheAbnormal.setTenantId(tenantId);
platElderBreatheAbnormalList.add(platElderBreatheAbnormal);
}
// platElderBreatheAbnormalService.saveBatch(platElderBreatheAbnormalList);
//platElderBreatheAbnormalService.saveBatch(platElderBreatheAbnormalList);
int totalActionCount = 0;
......@@ -1030,7 +1034,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
elderSleep.setTenantId(tenantId);
}
// TODO 起床时间和入睡时间
//platElderSleepService.saveBatch(elderSleepList);
platElderSleepService.saveBatch(elderSleepList);
EvaluateReportVO elderReport = saasElderReportConfigService.getByScore(totalScore);
......@@ -1048,7 +1052,7 @@ public class PlatElderSleepServiceImpl extends ServiceImpl<PlatElderSleepMapper,
elderSleepAnalysis.setSleepResult(sleepReport.getResult());
elderSleepAnalysis.setTenantId(tenantId);
elderSleepAnalysis.setSleepEvaluate(elderReport == null ? "" : elderReport.getEvaluate());
// platElderSleepAnalysisService.save(elderSleepAnalysis);
platElderSleepAnalysisService.save(elderSleepAnalysis);
}
}
......
......@@ -370,6 +370,7 @@ public class PlatSpaceServiceImpl extends ServiceImpl<PlatSpaceMapper, PlatSpace
vo.setParentId(space.getParentId());
vo.setId(space.getId());
vo.setAttribute(space.getAttribute());
vo.setPatentPath(space.getParentPath());
return vo;
}
......
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