diff --git a/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java b/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java index cd2c589f..781af2cf 100644 --- a/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java +++ b/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java @@ -48,8 +48,8 @@ public class JourneyDto { public static class SelectUser{ @ApiModelProperty("userId") private Long userId; - @ApiModelProperty("token") - private String token; +// @ApiModelProperty("token") +// private String token; @ApiModelProperty("开始时间 默认今天零点") private Long startTime; @ApiModelProperty("结束时间 默认当前时间") diff --git a/health/src/main/java/com/ccsens/health/service/UserService.java b/health/src/main/java/com/ccsens/health/service/UserService.java index deff7a07..7fd7a7ed 100644 --- a/health/src/main/java/com/ccsens/health/service/UserService.java +++ b/health/src/main/java/com/ccsens/health/service/UserService.java @@ -33,7 +33,7 @@ import java.util.Random; @Slf4j @Service @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) -public class UserService implements IUserService{ +public class UserService implements IUserService { @Autowired private EmployeeDao employeeDao; @Autowired @@ -53,6 +53,7 @@ public class UserService implements IUserService{ /** * 查询个人信息 + * * @param params * @return */ @@ -63,28 +64,28 @@ public class UserService implements IUserService{ Long startTime = selectUser.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectUser.getStartTime(); Long endTime = selectUser.getEndTime() == null ? System.currentTimeMillis() : selectUser.getEndTime(); Long userId = null; - if(ObjectUtil.isNotNull(selectUser.getUserId())){ + if (ObjectUtil.isNotNull(selectUser.getUserId())) { userId = selectUser.getUserId(); - }else { + } else { // String id = tallFeignClient.getUserId(selectUser.getToken()); // if(StrUtil.isNotEmpty(id)){ - userId = params.getUserId(); + userId = params.getUserId(); // } } - if(ObjectUtil.isNull(userId)){ + if (ObjectUtil.isNull(userId)) { throw new BaseException(CodeEnum.NOT_EMPLOYEE); } //查询信息 - UserVo.UserInfo userInfoVo = new UserVo.UserInfo(); + UserVo.UserInfo userInfoVo = null; RealNameAuthExample realNameAuthExample = new RealNameAuthExample(); realNameAuthExample.createCriteria().andUserIdEqualTo(userId); List realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample); - if(CollectionUtil.isNotEmpty(realNameAuthList)){ + if (CollectionUtil.isNotEmpty(realNameAuthList)) { userInfoVo = new UserVo.UserInfo(); - BeanUtil.copyProperties(realNameAuthList.get(0),userInfoVo); + BeanUtil.copyProperties(realNameAuthList.get(0), userInfoVo); // userInfoVo.setRealName(HealthConstant.REAL_NAME_YES); - } + // //判断是否为学校成员 // EmployeeExample newExample = new EmployeeExample(); // newExample.createCriteria().andTallUserIdEqualTo(userId); @@ -94,28 +95,29 @@ public class UserService implements IUserService{ // userInfoVo.setSchoolMember(HealthConstant.SCHOOL_MEMBER_YES); // } - //查询健康码 - List healthCodeList = healthRecordsDao.getHealthQrCodeByEmployeeId(userId,startTime,endTime); - if(CollectionUtil.isNotEmpty(healthCodeList)){ - for(UserVo.HealthCode healthCode : healthCodeList){ - healthCode.setHealthLevel(0); - //获取健康状态 - HealthType healthType = healthTypeDao.selectByPrimaryKey(healthCode.getHealthTypeId()); - if(ObjectUtil.isNotNull(healthType)){ - //如果健康状态异常,健康码为橙色 - if(healthType.getQuarantine() != 0){ - healthCode.setHealthLevel(1); + //查询健康码 + List healthCodeList = healthRecordsDao.getHealthQrCodeByEmployeeId(userId, startTime, endTime); + if (CollectionUtil.isNotEmpty(healthCodeList)) { + for (UserVo.HealthCode healthCode : healthCodeList) { + healthCode.setHealthLevel(0); + //获取健康状态 + HealthType healthType = healthTypeDao.selectByPrimaryKey(healthCode.getHealthTypeId()); + if (ObjectUtil.isNotNull(healthType)) { + //如果健康状态异常,健康码为橙色 + if (healthType.getQuarantine() != 0) { + healthCode.setHealthLevel(1); + } } } } + userInfoVo.setHealthCodeList(healthCodeList); } - userInfoVo.setHealthCodeList(healthCodeList); - return userInfoVo; } /** * 保存个人信息 + * * @param params * @return */ @@ -137,7 +139,7 @@ public class UserService implements IUserService{ RealNameAuthExample realNameAuthExample = new RealNameAuthExample(); realNameAuthExample.createCriteria().andNoEqualTo(userInfo.getNo()).andNameEqualTo(userInfo.getName()); List realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample); - if(CollectionUtil.isNotEmpty(realNameAuthList)){ + if (CollectionUtil.isNotEmpty(realNameAuthList)) { //判断是否为同一个user_id RealNameAuth auth = realNameAuthList.get(0); if (auth.getUserId().longValue() == userId.longValue()) { @@ -191,7 +193,7 @@ public class UserService implements IUserService{ realNameAuthDao.insertSelective(realNameAuth); //返回 UserVo.UserInfo userInfoVo = new UserVo.UserInfo(); - BeanUtil.copyProperties(realNameAuth,userInfoVo); + BeanUtil.copyProperties(realNameAuth, userInfoVo); // userInfoVo.setRealName(HealthConstant.REAL_NAME_YES); // userInfoVo.setSchoolMember(bindQyCount > 0 ? HealthConstant.SCHOOL_MEMBER_YES : HealthConstant.SCHOOL_MEMBER_NO); return userInfoVo; @@ -199,6 +201,7 @@ public class UserService implements IUserService{ /** * 绑定帐号 + * * @param sourceUserId 源userId(舍) * @param targetUserId 替换的userId(留) * @return @@ -243,6 +246,7 @@ public class UserService implements IUserService{ /** * 查询个人轨迹 + * * @param params * @return */ @@ -255,7 +259,7 @@ public class UserService implements IUserService{ Long endTime = selectTrack.getEndTime() == null ? System.currentTimeMillis() : selectTrack.getEndTime(); //判断是全局概览,还是搜索页面 - if(selectTrack.getSearch() == 1){ + if (selectTrack.getSearch() == 1) { //全局橄榄,根据时间随机显示一个学生的轨迹 //随机获取一个学生的信息 MemberExample memberExample = new MemberExample(); @@ -265,13 +269,13 @@ public class UserService implements IUserService{ int randomNumber = rand.nextInt(number.intValue()) + 1; Member member = memberDao.selectByRandom(randomNumber); //获取个人轨迹 - trackInfoList = realNameAuthDao.selectTrackInfoByWkno(member.getName(),member.getWkno(),startTime,endTime); - }else{ + trackInfoList = realNameAuthDao.selectTrackInfoByWkno(member.getName(), member.getWkno(), startTime, endTime); + } else { //搜索页面,若没有参数,返回空 - if(StrUtil.isEmpty(selectTrack.getName()) && StrUtil.isEmpty(selectTrack.getWkno())){ + if (StrUtil.isEmpty(selectTrack.getName()) && StrUtil.isEmpty(selectTrack.getWkno())) { return null; } - trackInfoList = realNameAuthDao.selectTrackInfoByWkno(selectTrack.getName(),selectTrack.getWkno(),startTime,endTime); + trackInfoList = realNameAuthDao.selectTrackInfoByWkno(selectTrack.getName(), selectTrack.getWkno(), startTime, endTime); } return trackInfoList; diff --git a/health/src/main/resources/application-prod.yml b/health/src/main/resources/application-prod.yml index 82993fe4..eedec364 100644 --- a/health/src/main/resources/application-prod.yml +++ b/health/src/main/resources/application-prod.yml @@ -1,11 +1,11 @@ server: - port: 7081 + port: 7080 servlet: context-path: spring: snowflake: - datacenterId: 2 - workerId: 2 + datacenterId: 1 + workerId: 1 application: name: health datasource: