From 57249c3757157ea0271714ceb6e0a26cc8a3e0a1 Mon Sep 17 00:00:00 2001 From: zhangye <654600784@qq.com> Date: Tue, 7 Apr 2020 16:00:08 +0800 Subject: [PATCH] 0407.1 --- .../ccsens/health/api/AbnormalController.java | 10 ++++++ .../ccsens/health/api/HealthController.java | 2 ++ .../ccsens/health/bean/dto/AbnormalDto.java | 6 ++-- .../ccsens/health/bean/dto/JourneyDto.java | 4 +-- .../ccsens/health/bean/po/HealthAbnormal.java | 6 ++-- .../health/bean/po/HealthAbnormalExample.java | 20 +++++------ .../com/ccsens/health/bean/vo/AbnormalVo.java | 6 ++-- .../health/service/AbnormalService.java | 34 +++++++++++++++---- .../health/service/IAbnormalService.java | 3 ++ .../ccsens/health/service/UserService.java | 22 +++++++----- .../src/main/resources/application-prod.yml | 6 ++-- .../mapper_dao/HealthAbnormalDao.xml | 4 ++- .../main/resources/mapper_dao/MemberDao.xml | 6 ++-- .../mapper_raw/HealthAbnormalMapper.xml | 14 ++++---- 14 files changed, 94 insertions(+), 49 deletions(-) diff --git a/health/src/main/java/com/ccsens/health/api/AbnormalController.java b/health/src/main/java/com/ccsens/health/api/AbnormalController.java index 9907c730..4f37fa12 100644 --- a/health/src/main/java/com/ccsens/health/api/AbnormalController.java +++ b/health/src/main/java/com/ccsens/health/api/AbnormalController.java @@ -4,6 +4,7 @@ import com.ccsens.cloudutil.annotation.MustLogin; import com.ccsens.health.bean.dto.AbnormalDto; import com.ccsens.health.bean.dto.ClockDto; import com.ccsens.health.bean.vo.AbnormalVo; +import com.ccsens.health.bean.vo.HealthVo; import com.ccsens.health.service.IAbnormalService; import com.ccsens.util.JsonResponse; import com.ccsens.util.bean.dto.QueryDto; @@ -74,4 +75,13 @@ public class AbnormalController { abnormalService.delAbnormal(params); return JsonResponse.newInstance().ok(); } + + @MustLogin + @ApiOperation(value = "后台查询异常人员类型", notes = "") + @RequestMapping(value = "type", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse> getAbnormalHealthType() throws Exception { + log.info("后台查询异常人员类型"); + List healthTypeList = abnormalService.getAbnormalHealthType(); + return JsonResponse.newInstance().ok(healthTypeList); + } } diff --git a/health/src/main/java/com/ccsens/health/api/HealthController.java b/health/src/main/java/com/ccsens/health/api/HealthController.java index e1c90acf..b6215a81 100644 --- a/health/src/main/java/com/ccsens/health/api/HealthController.java +++ b/health/src/main/java/com/ccsens/health/api/HealthController.java @@ -65,6 +65,8 @@ public class HealthController { return JsonResponse.newInstance().ok(healthTypeList); } + + @MustLogin @ApiOperation(value = "健康类型统计", notes = "") @RequestMapping(value = "statistics", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) diff --git a/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java b/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java index 73960c6c..17d1faf2 100644 --- a/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java +++ b/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java @@ -57,8 +57,8 @@ public class AbnormalDto { @ApiModelProperty("原因") private String reason; @NotNull - @ApiModelProperty("状态 0:健康 1:治愈 2:隔离 3:疑似 4:确诊") - private int healthType; + @ApiModelProperty("状态id ") + private Long healthType; @NotNull @ApiModelProperty("开始确诊时间") private Long startTime; @@ -82,7 +82,7 @@ public class AbnormalDto { @ApiModelProperty("原因") private String reason; @ApiModelProperty("状态 0:健康 1:治愈 2:隔离 3:疑似 4:确诊") - private int healthType; + private Long healthType; @ApiModelProperty("开始确诊时间") private Long startTime; @ApiModelProperty("结束时间") 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 509180f3..29e28691 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 @@ -42,8 +42,8 @@ public class JourneyDto { @Data @ApiModel("查询的时间范围") public static class SelectDate{ - @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/bean/po/HealthAbnormal.java b/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormal.java index 906dc521..10ae73b3 100644 --- a/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormal.java +++ b/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormal.java @@ -17,7 +17,7 @@ public class HealthAbnormal implements Serializable { private String reason; - private Short healthStatus; + private Long healthStatus; private Long startTime; @@ -79,11 +79,11 @@ public class HealthAbnormal implements Serializable { this.reason = reason == null ? null : reason.trim(); } - public Short getHealthStatus() { + public Long getHealthStatus() { return healthStatus; } - public void setHealthStatus(Short healthStatus) { + public void setHealthStatus(Long healthStatus) { this.healthStatus = healthStatus; } diff --git a/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormalExample.java b/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormalExample.java index 18b92942..efbb7471 100644 --- a/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormalExample.java +++ b/health/src/main/java/com/ccsens/health/bean/po/HealthAbnormalExample.java @@ -516,52 +516,52 @@ public class HealthAbnormalExample { return (Criteria) this; } - public Criteria andHealthStatusEqualTo(Short value) { + public Criteria andHealthStatusEqualTo(Long value) { addCriterion("health_status =", value, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusNotEqualTo(Short value) { + public Criteria andHealthStatusNotEqualTo(Long value) { addCriterion("health_status <>", value, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusGreaterThan(Short value) { + public Criteria andHealthStatusGreaterThan(Long value) { addCriterion("health_status >", value, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusGreaterThanOrEqualTo(Short value) { + public Criteria andHealthStatusGreaterThanOrEqualTo(Long value) { addCriterion("health_status >=", value, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusLessThan(Short value) { + public Criteria andHealthStatusLessThan(Long value) { addCriterion("health_status <", value, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusLessThanOrEqualTo(Short value) { + public Criteria andHealthStatusLessThanOrEqualTo(Long value) { addCriterion("health_status <=", value, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusIn(List values) { + public Criteria andHealthStatusIn(List values) { addCriterion("health_status in", values, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusNotIn(List values) { + public Criteria andHealthStatusNotIn(List values) { addCriterion("health_status not in", values, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusBetween(Short value1, Short value2) { + public Criteria andHealthStatusBetween(Long value1, Long value2) { addCriterion("health_status between", value1, value2, "healthStatus"); return (Criteria) this; } - public Criteria andHealthStatusNotBetween(Short value1, Short value2) { + public Criteria andHealthStatusNotBetween(Long value1, Long value2) { addCriterion("health_status not between", value1, value2, "healthStatus"); return (Criteria) this; } diff --git a/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java b/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java index 02301f46..4d10a85e 100644 --- a/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java +++ b/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java @@ -55,8 +55,10 @@ public class AbnormalVo { private BigDecimal animalHeat; @ApiModelProperty("原因") private String reason; - @ApiModelProperty("状态 0:健康 1:治愈 2:隔离 3:疑似 4:确诊") - private int healthType; + @ApiModelProperty("状态id") + private Long healthType; + @ApiModelProperty("状态名") + private String healthName; @ApiModelProperty("开始确诊时间") private Long startTime; @ApiModelProperty("结束时间") diff --git a/health/src/main/java/com/ccsens/health/service/AbnormalService.java b/health/src/main/java/com/ccsens/health/service/AbnormalService.java index 18de7f79..7cfaa5e6 100644 --- a/health/src/main/java/com/ccsens/health/service/AbnormalService.java +++ b/health/src/main/java/com/ccsens/health/service/AbnormalService.java @@ -6,15 +6,13 @@ import cn.hutool.core.lang.Snowflake; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.ccsens.health.bean.dto.AbnormalDto; -import com.ccsens.health.bean.po.HealthAbnormal; -import com.ccsens.health.bean.po.HealthQRCode; -import com.ccsens.health.bean.po.HealthQRCodeExample; -import com.ccsens.health.bean.po.HealthRecords; +import com.ccsens.health.bean.po.*; import com.ccsens.health.bean.vo.AbnormalVo; import com.ccsens.health.bean.vo.HealthVo; import com.ccsens.health.persist.dao.HealthAbnormalDao; import com.ccsens.health.persist.dao.HealthQRCodeDao; import com.ccsens.health.persist.dao.HealthRecordsDao; +import com.ccsens.health.persist.dao.HealthTypeDao; import com.ccsens.util.CodeEnum; import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.util.exception.BaseException; @@ -44,6 +42,8 @@ public class AbnormalService implements IAbnormalService { @Autowired private HealthQRCodeDao healthQRCodeDao; @Autowired + private HealthTypeDao healthTypeDao; + @Autowired private IAsyncService asyncService; @Value("spring.profiles.active") private String active; @@ -113,7 +113,7 @@ public class AbnormalService implements IAbnormalService { HealthAbnormal healthAbnormal = new HealthAbnormal(); healthAbnormal.setId(snowflake.nextId()); BeanUtil.copyProperties(addAbnormal, healthAbnormal); - healthAbnormal.setHealthStatus((short) addAbnormal.getHealthType()); + healthAbnormal.setHealthStatus(addAbnormal.getHealthType()); healthAbnormalDao.insertSelective(healthAbnormal); //如果是确诊状态,检查该学生最新上报的健康信息,将二维码换成红色 @@ -192,7 +192,7 @@ public class AbnormalService implements IAbnormalService { healthAbnormal.setReason(updateAbnormal.getReason()); } if (ObjectUtil.isNotNull(updateAbnormal.getHealthType())) { - healthAbnormal.setHealthStatus((short) updateAbnormal.getHealthType()); + healthAbnormal.setHealthStatus(updateAbnormal.getHealthType()); } if (ObjectUtil.isNotNull(updateAbnormal.getStartTime())) { healthAbnormal.setStartTime(updateAbnormal.getStartTime()); @@ -217,4 +217,26 @@ public class AbnormalService implements IAbnormalService { healthAbnormal.setRecStatus((byte) 2); healthAbnormalDao.updateByPrimaryKeySelective(healthAbnormal); } + + /** + * 后台查询异常人员类型 + * @return + */ + @Override + public List getAbnormalHealthType() { + List healthTypeVoList = new ArrayList<>(); + + HealthTypeExample healthTypeExample = new HealthTypeExample(); + healthTypeExample.createCriteria().andSceneEqualTo((byte) 1); + List healthTypeList = healthTypeDao.selectByExample(healthTypeExample); + if (CollectionUtil.isNotEmpty(healthTypeList)) { + for (HealthType healthType : healthTypeList) { + HealthVo.HealthTypeVo healthTypeVo = new HealthVo.HealthTypeVo(); + healthTypeVo.setId(healthType.getId()); + healthTypeVo.setName(healthType.getName()); + healthTypeVoList.add(healthTypeVo); + } + } + return healthTypeVoList; + } } diff --git a/health/src/main/java/com/ccsens/health/service/IAbnormalService.java b/health/src/main/java/com/ccsens/health/service/IAbnormalService.java index ec45abd5..88e51b88 100644 --- a/health/src/main/java/com/ccsens/health/service/IAbnormalService.java +++ b/health/src/main/java/com/ccsens/health/service/IAbnormalService.java @@ -2,6 +2,7 @@ package com.ccsens.health.service; import com.ccsens.health.bean.dto.AbnormalDto; import com.ccsens.health.bean.vo.AbnormalVo; +import com.ccsens.health.bean.vo.HealthVo; import com.ccsens.util.bean.dto.QueryDto; import java.util.List; @@ -16,4 +17,6 @@ public interface IAbnormalService { void updateAbnormal(QueryDto params); void delAbnormal(QueryDto params); + + List getAbnormalHealthType(); } 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 7fd7a7ed..31b5b4fa 100644 --- a/health/src/main/java/com/ccsens/health/service/UserService.java +++ b/health/src/main/java/com/ccsens/health/service/UserService.java @@ -260,16 +260,20 @@ public class UserService implements IUserService { //判断是全局概览,还是搜索页面 if (selectTrack.getSearch() == 1) { - //全局橄榄,根据时间随机显示一个学生的轨迹 - //随机获取一个学生的信息 - MemberExample memberExample = new MemberExample(); - memberExample.clear(); - Long number = memberDao.countByExample(memberExample); - Random rand = new Random(); - int randomNumber = rand.nextInt(number.intValue()) + 1; - Member member = memberDao.selectByRandom(randomNumber); +// //全局橄榄,根据时间随机显示一个学生的轨迹 +// //随机获取一个学生的信息 +// MemberExample memberExample = new MemberExample(); +// memberExample.clear(); +// Long number = memberDao.countByExample(memberExample); +// Random rand = new Random(); +// int randomNumber = rand.nextInt(number.intValue()) + 1; +// Member member = memberDao.selectByRandom(randomNumber); //获取个人轨迹 - trackInfoList = realNameAuthDao.selectTrackInfoByWkno(member.getName(), member.getWkno(), startTime, endTime); + List trackInfo = new ArrayList<>(); + trackInfo = realNameAuthDao.selectTrackInfoByWkno(null, null, startTime, endTime); + if(CollectionUtil.isNotEmpty(trackInfo)) { + trackInfoList.add(trackInfo.get(0)); + } } else { //搜索页面,若没有参数,返回空 if (StrUtil.isEmpty(selectTrack.getName()) && StrUtil.isEmpty(selectTrack.getWkno())) { diff --git a/health/src/main/resources/application-prod.yml b/health/src/main/resources/application-prod.yml index 5847e0be..6db11ffa 100644 --- a/health/src/main/resources/application-prod.yml +++ b/health/src/main/resources/application-prod.yml @@ -1,11 +1,11 @@ server: - port: 7080 + port: 7081 servlet: context-path: spring: snowflake: - datacenterId: 1 - workerId: 1 + datacenterId: 2 + workerId: 2 application: name: health datasource: diff --git a/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml b/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml index 4870b2fa..acc9d1c7 100644 --- a/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml +++ b/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml @@ -10,6 +10,7 @@ + @@ -29,10 +30,11 @@ a.animal_heat as animalHeat, a.reason as reason, a.health_status as healthType, + t.`name` as healthName, a.start_time as startTime, a.end_time as endTime from - t_health_abnormal a left join t_member m on a.wkno = m.wkno + t_health_abnormal a left join t_member m on a.wkno = m.wkno join t_health_type t on a.health_status = t.id where a.rec_status = 0 diff --git a/health/src/main/resources/mapper_dao/MemberDao.xml b/health/src/main/resources/mapper_dao/MemberDao.xml index 81a33f78..14ef0999 100644 --- a/health/src/main/resources/mapper_dao/MemberDao.xml +++ b/health/src/main/resources/mapper_dao/MemberDao.xml @@ -60,15 +60,15 @@ LEFT join t_health_records hr on rn.user_id = hr.user_id where m.rec_status = 0 - + and m.name = #{name} - + and m.wkno = #{wkno} - + and m.department = #{department} diff --git a/health/src/main/resources/mapper_raw/HealthAbnormalMapper.xml b/health/src/main/resources/mapper_raw/HealthAbnormalMapper.xml index 20e7bb81..4c8546ec 100644 --- a/health/src/main/resources/mapper_raw/HealthAbnormalMapper.xml +++ b/health/src/main/resources/mapper_raw/HealthAbnormalMapper.xml @@ -8,7 +8,7 @@ - + @@ -115,7 +115,7 @@ ) values (#{id,jdbcType=BIGINT}, #{wkno,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, #{animalHeat,jdbcType=DECIMAL}, #{reason,jdbcType=VARCHAR}, - #{healthStatus,jdbcType=SMALLINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, + #{healthStatus,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT} ) @@ -179,7 +179,7 @@ #{reason,jdbcType=VARCHAR}, - #{healthStatus,jdbcType=SMALLINT}, + #{healthStatus,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT}, @@ -226,7 +226,7 @@ reason = #{record.reason,jdbcType=VARCHAR}, - health_status = #{record.healthStatus,jdbcType=SMALLINT}, + health_status = #{record.healthStatus,jdbcType=BIGINT}, start_time = #{record.startTime,jdbcType=BIGINT}, @@ -256,7 +256,7 @@ department = #{record.department,jdbcType=VARCHAR}, animal_heat = #{record.animalHeat,jdbcType=DECIMAL}, reason = #{record.reason,jdbcType=VARCHAR}, - health_status = #{record.healthStatus,jdbcType=SMALLINT}, + health_status = #{record.healthStatus,jdbcType=BIGINT}, start_time = #{record.startTime,jdbcType=BIGINT}, end_time = #{record.endTime,jdbcType=BIGINT}, created_at = #{record.createdAt,jdbcType=TIMESTAMP}, @@ -285,7 +285,7 @@ reason = #{reason,jdbcType=VARCHAR}, - health_status = #{healthStatus,jdbcType=SMALLINT}, + health_status = #{healthStatus,jdbcType=BIGINT}, start_time = #{startTime,jdbcType=BIGINT}, @@ -312,7 +312,7 @@ department = #{department,jdbcType=VARCHAR}, animal_heat = #{animalHeat,jdbcType=DECIMAL}, reason = #{reason,jdbcType=VARCHAR}, - health_status = #{healthStatus,jdbcType=SMALLINT}, + health_status = #{healthStatus,jdbcType=BIGINT}, start_time = #{startTime,jdbcType=BIGINT}, end_time = #{endTime,jdbcType=BIGINT}, created_at = #{createdAt,jdbcType=TIMESTAMP},