Browse Source

0325.2

master
zhangye 5 years ago
parent
commit
bc669384c4
  1. 4
      health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java
  2. 62
      health/src/main/java/com/ccsens/health/service/UserService.java
  3. 6
      health/src/main/resources/application-prod.yml

4
health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java

@ -48,8 +48,8 @@ public class JourneyDto {
public static class SelectUser{ public static class SelectUser{
@ApiModelProperty("userId") @ApiModelProperty("userId")
private Long userId; private Long userId;
@ApiModelProperty("token") // @ApiModelProperty("token")
private String token; // private String token;
@ApiModelProperty("开始时间 默认今天零点") @ApiModelProperty("开始时间 默认今天零点")
private Long startTime; private Long startTime;
@ApiModelProperty("结束时间 默认当前时间") @ApiModelProperty("结束时间 默认当前时间")

62
health/src/main/java/com/ccsens/health/service/UserService.java

@ -33,7 +33,7 @@ import java.util.Random;
@Slf4j @Slf4j
@Service @Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class UserService implements IUserService{ public class UserService implements IUserService {
@Autowired @Autowired
private EmployeeDao employeeDao; private EmployeeDao employeeDao;
@Autowired @Autowired
@ -53,6 +53,7 @@ public class UserService implements IUserService{
/** /**
* 查询个人信息 * 查询个人信息
*
* @param params * @param params
* @return * @return
*/ */
@ -63,28 +64,28 @@ public class UserService implements IUserService{
Long startTime = selectUser.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectUser.getStartTime(); Long startTime = selectUser.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectUser.getStartTime();
Long endTime = selectUser.getEndTime() == null ? System.currentTimeMillis() : selectUser.getEndTime(); Long endTime = selectUser.getEndTime() == null ? System.currentTimeMillis() : selectUser.getEndTime();
Long userId = null; Long userId = null;
if(ObjectUtil.isNotNull(selectUser.getUserId())){ if (ObjectUtil.isNotNull(selectUser.getUserId())) {
userId = selectUser.getUserId(); userId = selectUser.getUserId();
}else { } else {
// String id = tallFeignClient.getUserId(selectUser.getToken()); // String id = tallFeignClient.getUserId(selectUser.getToken());
// if(StrUtil.isNotEmpty(id)){ // if(StrUtil.isNotEmpty(id)){
userId = params.getUserId(); userId = params.getUserId();
// } // }
} }
if(ObjectUtil.isNull(userId)){ if (ObjectUtil.isNull(userId)) {
throw new BaseException(CodeEnum.NOT_EMPLOYEE); throw new BaseException(CodeEnum.NOT_EMPLOYEE);
} }
//查询信息 //查询信息
UserVo.UserInfo userInfoVo = new UserVo.UserInfo(); UserVo.UserInfo userInfoVo = null;
RealNameAuthExample realNameAuthExample = new RealNameAuthExample(); RealNameAuthExample realNameAuthExample = new RealNameAuthExample();
realNameAuthExample.createCriteria().andUserIdEqualTo(userId); realNameAuthExample.createCriteria().andUserIdEqualTo(userId);
List<RealNameAuth> realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample); List<RealNameAuth> realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample);
if(CollectionUtil.isNotEmpty(realNameAuthList)){ if (CollectionUtil.isNotEmpty(realNameAuthList)) {
userInfoVo = new UserVo.UserInfo(); userInfoVo = new UserVo.UserInfo();
BeanUtil.copyProperties(realNameAuthList.get(0),userInfoVo); BeanUtil.copyProperties(realNameAuthList.get(0), userInfoVo);
// userInfoVo.setRealName(HealthConstant.REAL_NAME_YES); // userInfoVo.setRealName(HealthConstant.REAL_NAME_YES);
}
// //判断是否为学校成员 // //判断是否为学校成员
// EmployeeExample newExample = new EmployeeExample(); // EmployeeExample newExample = new EmployeeExample();
// newExample.createCriteria().andTallUserIdEqualTo(userId); // newExample.createCriteria().andTallUserIdEqualTo(userId);
@ -94,28 +95,29 @@ public class UserService implements IUserService{
// userInfoVo.setSchoolMember(HealthConstant.SCHOOL_MEMBER_YES); // userInfoVo.setSchoolMember(HealthConstant.SCHOOL_MEMBER_YES);
// } // }
//查询健康码 //查询健康码
List<UserVo.HealthCode> healthCodeList = healthRecordsDao.getHealthQrCodeByEmployeeId(userId,startTime,endTime); List<UserVo.HealthCode> healthCodeList = healthRecordsDao.getHealthQrCodeByEmployeeId(userId, startTime, endTime);
if(CollectionUtil.isNotEmpty(healthCodeList)){ if (CollectionUtil.isNotEmpty(healthCodeList)) {
for(UserVo.HealthCode healthCode : healthCodeList){ for (UserVo.HealthCode healthCode : healthCodeList) {
healthCode.setHealthLevel(0); healthCode.setHealthLevel(0);
//获取健康状态 //获取健康状态
HealthType healthType = healthTypeDao.selectByPrimaryKey(healthCode.getHealthTypeId()); 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); healthCode.setHealthLevel(1);
}
} }
} }
} }
userInfoVo.setHealthCodeList(healthCodeList);
} }
userInfoVo.setHealthCodeList(healthCodeList);
return userInfoVo; return userInfoVo;
} }
/** /**
* 保存个人信息 * 保存个人信息
*
* @param params * @param params
* @return * @return
*/ */
@ -137,7 +139,7 @@ public class UserService implements IUserService{
RealNameAuthExample realNameAuthExample = new RealNameAuthExample(); RealNameAuthExample realNameAuthExample = new RealNameAuthExample();
realNameAuthExample.createCriteria().andNoEqualTo(userInfo.getNo()).andNameEqualTo(userInfo.getName()); realNameAuthExample.createCriteria().andNoEqualTo(userInfo.getNo()).andNameEqualTo(userInfo.getName());
List<RealNameAuth> realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample); List<RealNameAuth> realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample);
if(CollectionUtil.isNotEmpty(realNameAuthList)){ if (CollectionUtil.isNotEmpty(realNameAuthList)) {
//判断是否为同一个user_id //判断是否为同一个user_id
RealNameAuth auth = realNameAuthList.get(0); RealNameAuth auth = realNameAuthList.get(0);
if (auth.getUserId().longValue() == userId.longValue()) { if (auth.getUserId().longValue() == userId.longValue()) {
@ -191,7 +193,7 @@ public class UserService implements IUserService{
realNameAuthDao.insertSelective(realNameAuth); realNameAuthDao.insertSelective(realNameAuth);
//返回 //返回
UserVo.UserInfo userInfoVo = new UserVo.UserInfo(); UserVo.UserInfo userInfoVo = new UserVo.UserInfo();
BeanUtil.copyProperties(realNameAuth,userInfoVo); BeanUtil.copyProperties(realNameAuth, userInfoVo);
// userInfoVo.setRealName(HealthConstant.REAL_NAME_YES); // userInfoVo.setRealName(HealthConstant.REAL_NAME_YES);
// userInfoVo.setSchoolMember(bindQyCount > 0 ? HealthConstant.SCHOOL_MEMBER_YES : HealthConstant.SCHOOL_MEMBER_NO); // userInfoVo.setSchoolMember(bindQyCount > 0 ? HealthConstant.SCHOOL_MEMBER_YES : HealthConstant.SCHOOL_MEMBER_NO);
return userInfoVo; return userInfoVo;
@ -199,6 +201,7 @@ public class UserService implements IUserService{
/** /**
* 绑定帐号 * 绑定帐号
*
* @param sourceUserId 源userId * @param sourceUserId 源userId
* @param targetUserId 替换的userId() * @param targetUserId 替换的userId()
* @return * @return
@ -243,6 +246,7 @@ public class UserService implements IUserService{
/** /**
* 查询个人轨迹 * 查询个人轨迹
*
* @param params * @param params
* @return * @return
*/ */
@ -255,7 +259,7 @@ public class UserService implements IUserService{
Long endTime = selectTrack.getEndTime() == null ? System.currentTimeMillis() : selectTrack.getEndTime(); Long endTime = selectTrack.getEndTime() == null ? System.currentTimeMillis() : selectTrack.getEndTime();
//判断是全局概览,还是搜索页面 //判断是全局概览,还是搜索页面
if(selectTrack.getSearch() == 1){ if (selectTrack.getSearch() == 1) {
//全局橄榄,根据时间随机显示一个学生的轨迹 //全局橄榄,根据时间随机显示一个学生的轨迹
//随机获取一个学生的信息 //随机获取一个学生的信息
MemberExample memberExample = new MemberExample(); MemberExample memberExample = new MemberExample();
@ -265,13 +269,13 @@ public class UserService implements IUserService{
int randomNumber = rand.nextInt(number.intValue()) + 1; int randomNumber = rand.nextInt(number.intValue()) + 1;
Member member = memberDao.selectByRandom(randomNumber); Member member = memberDao.selectByRandom(randomNumber);
//获取个人轨迹 //获取个人轨迹
trackInfoList = realNameAuthDao.selectTrackInfoByWkno(member.getName(),member.getWkno(),startTime,endTime); trackInfoList = realNameAuthDao.selectTrackInfoByWkno(member.getName(), member.getWkno(), startTime, endTime);
}else{ } else {
//搜索页面,若没有参数,返回空 //搜索页面,若没有参数,返回空
if(StrUtil.isEmpty(selectTrack.getName()) && StrUtil.isEmpty(selectTrack.getWkno())){ if (StrUtil.isEmpty(selectTrack.getName()) && StrUtil.isEmpty(selectTrack.getWkno())) {
return null; return null;
} }
trackInfoList = realNameAuthDao.selectTrackInfoByWkno(selectTrack.getName(),selectTrack.getWkno(),startTime,endTime); trackInfoList = realNameAuthDao.selectTrackInfoByWkno(selectTrack.getName(), selectTrack.getWkno(), startTime, endTime);
} }
return trackInfoList; return trackInfoList;

6
health/src/main/resources/application-prod.yml

@ -1,11 +1,11 @@
server: server:
port: 7081 port: 7080
servlet: servlet:
context-path: context-path:
spring: spring:
snowflake: snowflake:
datacenterId: 2 datacenterId: 1
workerId: 2 workerId: 1
application: application:
name: health name: health
datasource: datasource:

Loading…
Cancel
Save