zhizhi wu 5 years ago
parent
commit
ccb1fa1339
  1. 2
      health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java
  2. 4
      health/src/main/java/com/ccsens/health/bean/dto/MemberDto.java
  3. 11
      health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java
  4. 2
      health/src/main/java/com/ccsens/health/persist/dao/HealthAbnormalDao.java
  5. 15
      health/src/main/java/com/ccsens/health/persist/dao/MemberDao.java
  6. 24
      health/src/main/java/com/ccsens/health/service/AbnormalService.java
  7. 6
      health/src/main/java/com/ccsens/health/service/StudentService.java
  8. 31
      health/src/main/resources/mapper_dao/HealthAbnormalDao.xml
  9. 62
      health/src/main/resources/mapper_dao/MemberDao.xml
  10. 7
      health/src/main/resources/mapper_dao/RealNameAuthDao.xml
  11. 18
      tall/src/main/java/com/ccsens/tall/service/UserService.java
  12. 4
      tall/src/main/resources/application.yml

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

@ -192,7 +192,7 @@ public class JourneyDto {
} }
@Data @Data
@ApiModel("修改异常行程信息") @ApiModel("删除异常行程信息id")
public static class DeleteAbnormalJourney { public static class DeleteAbnormalJourney {
@NotNull @NotNull
@ApiModelProperty("id") @ApiModelProperty("id")

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

@ -19,9 +19,9 @@ public class MemberDto {
@ApiModelProperty("班级(所在机构)") @ApiModelProperty("班级(所在机构)")
private String department; private String department;
@ApiModelProperty("开始时间") @ApiModelProperty("开始时间")
private String startTime; private Long startTime;
@ApiModelProperty("结束时间") @ApiModelProperty("结束时间")
private String endTime; private Long endTime;
@ApiModelProperty("健康状态 0发烧 1其他") @ApiModelProperty("健康状态 0发烧 1其他")
private int type; private int type;
} }

11
health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java

@ -1,12 +1,10 @@
package com.ccsens.health.bean.vo; package com.ccsens.health.bean.vo;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal; import java.math.BigDecimal;
@Data @Data
@ -24,21 +22,26 @@ public class AbnormalVo {
@ApiModelProperty("异常状态code") @ApiModelProperty("异常状态code")
private Integer code; private Integer code;
@ApiModelProperty("数量") @ApiModelProperty("数量")
private Long number; private int number;
public String getAbnormalName(){ public String getAbnormalName(){
if(code == null){
return null;
}
switch (code){ switch (code){
case 0: return "健康"; case 0: return "健康";
case 1: return "治愈"; case 1: return "治愈";
case 2: return "隔离"; case 2: return "隔离";
case 3: return "疑似"; case 3: return "疑似";
case 4: return "确诊"; case 4: return "确诊";
case 5: return "出行异常";
case 6: return "未上报";
default:return null; default:return null;
} }
} }
} }
@Data @Data
@ApiModel("异常人员统计") @ApiModel("异常人员统计返回")
public static class AbnormalStatisticsVo{ public static class AbnormalStatisticsVo{
@ApiModelProperty("id") @ApiModelProperty("id")
private String id; private String id;

2
health/src/main/java/com/ccsens/health/persist/dao/HealthAbnormalDao.java

@ -14,4 +14,6 @@ public interface HealthAbnormalDao extends HealthAbnormalMapper {
List<AbnormalVo.AbnormalStatisticsVo> getAbnormalList(@Param("post") Integer post, @Param("department")String department, @Param("healthType")Integer healthType); List<AbnormalVo.AbnormalStatisticsVo> getAbnormalList(@Param("post") Integer post, @Param("department")String department, @Param("healthType")Integer healthType);
List<AbnormalVo.AbnormalOverview> abnormalOverview(@Param("department")String department, @Param("startTime")Long startTime, @Param("endTime")Long endTime); List<AbnormalVo.AbnormalOverview> abnormalOverview(@Param("department")String department, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
int selectJourneyNumber(@Param("department")String department, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
} }

15
health/src/main/java/com/ccsens/health/persist/dao/MemberDao.java

@ -1,6 +1,7 @@
package com.ccsens.health.persist.dao; package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.po.Member; import com.ccsens.health.bean.po.Member;
import com.ccsens.health.bean.vo.MemberVo;
import com.ccsens.health.persist.mapper.MemberMapper; import com.ccsens.health.persist.mapper.MemberMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -20,4 +21,18 @@ public interface MemberDao extends MemberMapper {
* @return * @return
*/ */
Member selectByRandom(@Param("randomNumber") int randomNumber); Member selectByRandom(@Param("randomNumber") int randomNumber);
/**
* 学生健康列表
* @param name
* @param wkno
* @param department
* @param startTime
* @param endTime
* @param type
* @return
*/
List<MemberVo.StudentHealthVo> selectHealthInfo(@Param("name")String name, @Param("wkno")String wkno,
@Param("department")String department,@Param("startTime")Long startTime,
@Param("endTime")Long endTime, @Param("type")int type);
} }

24
health/src/main/java/com/ccsens/health/service/AbnormalService.java

@ -1,16 +1,15 @@
package com.ccsens.health.service; package com.ccsens.health.service;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.ccsens.health.bean.dto.AbnormalDto; import com.ccsens.health.bean.dto.AbnormalDto;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.po.HealthAbnormal; import com.ccsens.health.bean.po.HealthAbnormal;
import com.ccsens.health.bean.vo.AbnormalVo; import com.ccsens.health.bean.vo.AbnormalVo;
import com.ccsens.health.persist.dao.HealthAbnormalDao; import com.ccsens.health.persist.dao.HealthAbnormalDao;
import com.ccsens.util.CodeEnum; import com.ccsens.util.CodeEnum;
import com.ccsens.util.DateUtil;
import com.ccsens.util.bean.dto.QueryDto; import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException; import com.ccsens.util.exception.BaseException;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
@ -20,7 +19,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Slf4j @Slf4j
@ -40,11 +39,22 @@ public class AbnormalService implements IAbnormalService{
@Override @Override
public List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params) throws Exception { public List<AbnormalVo.AbnormalOverview> abnormalOverview(QueryDto<AbnormalDto.SelectAbnormal> params) throws Exception {
AbnormalDto.SelectAbnormal selectAbnormal = params.getParam(); AbnormalDto.SelectAbnormal selectAbnormal = params.getParam();
// Long startTime = selectAbnormal.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectAbnormal.getStartTime(); List<AbnormalVo.AbnormalOverview> abnormalOverviewList = new ArrayList<>();
// Long endTime = selectAbnormal.getEndTime() == null ? System.currentTimeMillis() : selectAbnormal.getEndTime(); //人员异常
abnormalOverviewList =
List<AbnormalVo.AbnormalOverview> abnormalOverviewList =
healthAbnormalDao.abnormalOverview(selectAbnormal.getDepartment(),selectAbnormal.getStartTime(),selectAbnormal.getEndTime()); healthAbnormalDao.abnormalOverview(selectAbnormal.getDepartment(),selectAbnormal.getStartTime(),selectAbnormal.getEndTime());
if(CollectionUtil.isNotEmpty(abnormalOverviewList)){
for(AbnormalVo.AbnormalOverview abnormalOverview : abnormalOverviewList){
abnormalOverview.setAbnormalType(1);
}
}
//行程异常
int journeyNumber = healthAbnormalDao.selectJourneyNumber(selectAbnormal.getDepartment(),selectAbnormal.getStartTime(),selectAbnormal.getEndTime());
AbnormalVo.AbnormalOverview abnormalOverview = new AbnormalVo.AbnormalOverview();
abnormalOverview.setAbnormalType(2);
abnormalOverview.setCode(5);
abnormalOverview.setNumber(journeyNumber);
abnormalOverviewList.add(abnormalOverview);
return abnormalOverviewList; return abnormalOverviewList;
} }

6
health/src/main/java/com/ccsens/health/service/StudentService.java

@ -65,7 +65,11 @@ public class StudentService implements IStudentService{
*/ */
@Override @Override
public List<MemberVo.StudentHealthVo> getStudentHealthList(QueryDto<MemberDto.StudentHealth> params) { public List<MemberVo.StudentHealthVo> getStudentHealthList(QueryDto<MemberDto.StudentHealth> params) {
return null; MemberDto.StudentHealth studentHealth = params.getParam();
List<MemberVo.StudentHealthVo> studentHealthVoList =
memberDao.selectHealthInfo(studentHealth.getName(),studentHealth.getWkno(),studentHealth.getDepartment(),
studentHealth.getStartTime(),studentHealth.getEndTime(),studentHealth.getType());
return studentHealthVoList;
} }
@Override @Override

31
health/src/main/resources/mapper_dao/HealthAbnormalDao.xml

@ -81,4 +81,35 @@
GROUP BY a.health_status GROUP BY a.health_status
</select> </select>
<select id="selectJourneyNumber" resultType="int" parameterType="java.util.Map">
SELECT
count(*)
FROM
t_journey j JOIN t_journey_abnormal a
on
j.car_no = a.car_no
and
j.trip_mode = a.trip_mode
and
j.start_time &lt;= a.end_time
AND
j.end_time &gt;= a.start_time
JOIN t_real_name_auth rn on j.user_id = rn.user_id
JOIN t_member m on rn.no = m.wkno
WHERE
j.rec_status = 0
<if test="department != null">
and
m.department = #{department}
</if>
<if test="endTime != null">
and
j.start_time &lt;= #{endTime}
</if>
<if test="startTime != null">
and
j.end_time &gt;= #{startTime}
</if>
</select>
</mapper> </mapper>

62
health/src/main/resources/mapper_dao/MemberDao.xml

@ -2,6 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ccsens.health.persist.dao.MemberDao"> <mapper namespace="com.ccsens.health.persist.dao.MemberDao">
<resultMap id="resultMap_student" type="com.ccsens.health.bean.vo.MemberVo$StudentHealthVo">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="wkno" property="wkno"/>
<result column="department" property="department"/>
<result column="time" property="time"/>
<result column="touchHubei" property="touchHubei"/>
<result column="touchSick" property="touchSick"/>
<result column="animalHeat" property="animalHeat"/>
<result column="healthType" property="healthType"/>
<result column="hospital" property="hospital"/>
<result column="address" property="address"/>
</resultMap>
<insert id="insertBatch"> <insert id="insertBatch">
insert into t_member (id, wkno, `name`, insert into t_member (id, wkno, `name`,
@ -25,4 +38,53 @@
t_member t_member
limit #{randomNumber},1; limit #{randomNumber},1;
</select> </select>
<select id="selectHealthInfo" resultMap="resultMap_student" parameterType="java.util.Map">
SELECT
*
FROM
(
SELECT
m.id as id,
m.name as name,
m.wkno as wkno,
m.department as department,
hr.time as time,
hr.touch_hubei as touchHubei,
hr.touch_sick as touchSick,
hr.animal_heat as animalHeat,
hr.hospital as hospital,
hr.address as address
FROM
t_member m JOIN t_real_name_auth rn on m.wkno = rn.no
LEFT join t_health_records hr on rn.user_id = hr.user_id
where
m.rec_status = 0
<if test="name != null">
and
m.name = #{name}
</if>
<if test="wkno != null">
and
m.wkno = #{wkno}
</if>
<if test="department != null">
and
m.department = #{department}
</if>
<if test="endTime != null">
and
hr.time &lt;= #{endTime}
</if>
<if test="startTime != null">
and
hr.time &gt;= #{startTime}
</if>
ORDER BY hr.time DESC
limit 99999
) a
GROUP BY a.id
</select>
</mapper> </mapper>

7
health/src/main/resources/mapper_dao/RealNameAuthDao.xml

@ -21,13 +21,12 @@
m.wkno as wkno, m.wkno as wkno,
s.id as cId, s.id as cId,
s.site_name as cName, s.site_name as cName,
sc.time as cTime, sc.time as cTime
sq.out_or_in as cType
from from
t_site s right JOIN t_site_qrcode sq on sq.site_id = s.id t_site s right JOIN t_site_qrcode sq on sq.site_id = s.id
right JOIN t_site_clock_in sc on sc.qrcode_id = sq.id right JOIN t_site_clock_in sc on sc.site_id = s.id
right JOIN t_real_name_auth r on sc.user_id = r.user_id right JOIN t_real_name_auth r on sc.user_id = r.user_id
right join t_member m on r.no = m.wkno join t_member m on r.no = m.wkno
where where
m.rec_status = 0 m.rec_status = 0
<if test="name != null"> <if test="name != null">

18
tall/src/main/java/com/ccsens/tall/service/UserService.java

@ -1255,18 +1255,18 @@ public class UserService implements IUserService {
if(ObjectUtil.isNull(user) || ObjectUtil.isNull(uselessUser)){ if(ObjectUtil.isNull(user) || ObjectUtil.isNull(uselessUser)){
throw new BaseException(CodeEnum.NOT_MEMBER); throw new BaseException(CodeEnum.NOT_MEMBER);
} }
userDao.replaceAuth(userId, uselessId); userDao.replaceAuth(uselessId,userId);
//查询所有关联userId的数据库表 auth表 attention表 balance表 project表 member表 DeliverPostLog表 proLog表 //查询所有关联userId的数据库表 auth表 attention表 balance表 project表 member表 DeliverPostLog表 proLog表
//依次将查出的数据的旧userId 替换成新的userId //依次将查出的数据的旧userId 替换成新的userId
userDao.replaceAttention(userId, uselessId); userDao.replaceAttention(uselessId,userId);
userDao.replaceBalance(userId, uselessId); userDao.replaceBalance(uselessId,userId);
userDao.replaceProject(userId, uselessId); userDao.replaceProject(uselessId,userId);
userDao.replaceMember(userId, uselessId); userDao.replaceMember(uselessId,userId);
userDao.replaceDeliverPostLog(userId, uselessId); userDao.replaceDeliverPostLog(uselessId,userId);
userDao.replaceProLog(userId, uselessId); userDao.replaceProLog(uselessId,userId);
//将以前的余额添加至此账号 //将以前的余额添加至此账号
SysUser oldUser = userDao.selectByPrimaryKey(userId); SysUser oldUser = userDao.selectByPrimaryKey(uselessId);
SysUser newUser = userDao.selectByPrimaryKey(uselessId); SysUser newUser = userDao.selectByPrimaryKey(userId);
updateBalance(oldUser, newUser); updateBalance(oldUser, newUser);
//将以前的user删除 //将以前的user删除
oldUser.setRecStatus((byte) 2); oldUser.setRecStatus((byte) 2);

4
tall/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring: spring:
profiles: profiles:
active: test active: dev
include: util-test,common include: util-dev,common
Loading…
Cancel
Save