|
|
@ -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(); |
|
|
|
// }
|
|
|
|
} |
|
|
|
|
|
|
|
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<RealNameAuth> 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);
|
|
|
@ -95,27 +96,28 @@ public class UserService implements IUserService{ |
|
|
|
// }
|
|
|
|
|
|
|
|
//查询健康码
|
|
|
|
List<UserVo.HealthCode> healthCodeList = healthRecordsDao.getHealthQrCodeByEmployeeId(userId,startTime,endTime); |
|
|
|
if(CollectionUtil.isNotEmpty(healthCodeList)){ |
|
|
|
for(UserVo.HealthCode healthCode : healthCodeList){ |
|
|
|
List<UserVo.HealthCode> 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 (ObjectUtil.isNotNull(healthType)) { |
|
|
|
//如果健康状态异常,健康码为橙色
|
|
|
|
if(healthType.getQuarantine() != 0){ |
|
|
|
if (healthType.getQuarantine() != 0) { |
|
|
|
healthCode.setHealthLevel(1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
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<RealNameAuth> 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; |
|
|
|