Browse Source

0412.1

master
zhangye 5 years ago
parent
commit
c48d3a97d6
  1. 17
      health/src/main/java/com/ccsens/health/api/ClockController.java
  2. 6
      health/src/main/java/com/ccsens/health/api/JourneyController.java
  3. 19
      health/src/main/java/com/ccsens/health/bean/dto/ClockDto.java
  4. 8
      health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java
  5. 13
      health/src/main/java/com/ccsens/health/bean/vo/ClockVo.java
  6. 1
      health/src/main/java/com/ccsens/health/persist/dao/JourneyAbnormalDao.java
  7. 7
      health/src/main/java/com/ccsens/health/persist/dao/JourneyDao.java
  8. 9
      health/src/main/java/com/ccsens/health/persist/dao/SiteDao.java
  9. 25
      health/src/main/java/com/ccsens/health/service/ClockService.java
  10. 4
      health/src/main/java/com/ccsens/health/service/IClockService.java
  11. 2
      health/src/main/java/com/ccsens/health/service/IJourneyService.java
  12. 9
      health/src/main/java/com/ccsens/health/service/JourneyService.java
  13. 4
      health/src/main/resources/application.yml
  14. 42
      health/src/main/resources/mapper_dao/JourneyDao.xml
  15. 117
      health/src/main/resources/mapper_dao/SiteDao.xml

17
health/src/main/java/com/ccsens/health/api/ClockController.java

@ -116,7 +116,7 @@ public class ClockController {
@ApiOperation(value = "场所统计概览", notes = "")
@RequestMapping(value = "overview", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<ClockVo.SiteOverview>> selectSiteOverview(@ApiParam @Validated @RequestBody QueryDto<ClockDto.SiteOverview> params) throws Exception {
log.info("修改场所信息:{}", params);
log.info("场所统计概览:{}", params);
List<ClockVo.SiteOverview> siteOverviewList = clockService.selectSiteOverview(params.getParam());
return JsonResponse.newInstance().ok(siteOverviewList);
}
@ -124,9 +124,18 @@ public class ClockController {
@MustLogin
@ApiOperation(value = "场所内人员列表", notes = "")
@RequestMapping(value = "member", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<ClockVo.SiteMemberList>> selectSiteMemberList(@ApiParam @Validated @RequestBody QueryDto<ClockDto.SelectSiteMember> params) throws Exception {
log.info("修改场所信息:{}", params);
List<ClockVo.SiteMemberList> siteOverviewList = clockService.selectSiteMemberList(params.getParam());
public JsonResponse<PageInfo<ClockVo.SiteMemberList>> selectSiteMemberList(@ApiParam @Validated @RequestBody QueryDto<ClockDto.SelectSiteMember> params) throws Exception {
log.info("场所内人员列表:{}", params);
PageInfo<ClockVo.SiteMemberList> siteOverviewList = clockService.selectSiteMemberList(params.getParam());
return JsonResponse.newInstance().ok(siteOverviewList);
}
@MustLogin
@ApiOperation(value = "场所实时统计", notes = "")
@RequestMapping(value = "real_time_statistics", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<ClockVo.RealTimeStatistics>> getRealTimeStatistics(@ApiParam @Validated @RequestBody QueryDto<ClockDto.RealTimeStatistics> params) throws Exception {
log.info("场所实时统计:{}", params);
List<ClockVo.RealTimeStatistics> siteOverviewList = clockService.getRealTimeStatistics(params.getParam());
return JsonResponse.newInstance().ok(siteOverviewList);
}
}

6
health/src/main/java/com/ccsens/health/api/JourneyController.java

@ -52,9 +52,9 @@ public class JourneyController {
@MustLogin
@ApiOperation(value = "查询学生校外行程", notes = "")
@RequestMapping(value = "infoList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<JourneyVo.StudentJourneyInfo>> getJourneyInfoList(@ApiParam @Validated @RequestBody QueryDto<JourneyDto.SelectJourneyByName> params) throws Exception {
log.info("查询行程:{}",params);
List<JourneyVo.StudentJourneyInfo> journeyInfoList = journeyService.getJourneyInfoList(params.getParam(),params.getUserId());
public JsonResponse<PageInfo<JourneyVo.StudentJourneyInfo>> getJourneyInfoList(@ApiParam @Validated @RequestBody QueryDto<JourneyDto.SelectJourneyByName> params) throws Exception {
log.info("查询学生校外行程:{}",params);
PageInfo<JourneyVo.StudentJourneyInfo> journeyInfoList = journeyService.getJourneyInfoList(params.getParam(),params.getUserId());
return JsonResponse.newInstance().ok(journeyInfoList);
}

19
health/src/main/java/com/ccsens/health/bean/dto/ClockDto.java

@ -49,17 +49,17 @@ public class ClockDto {
@Data
@ApiModel("时间段内场所人数统计")
public static class SiteOverview{
@ApiModelProperty("场所ID")
@ApiModelProperty("场所")
private String siteName;
@ApiModelProperty("开始时间")
private Long startTime;
private Long time;
}
@Data
@ApiModel("查找场所内的学生列表")
public static class SelectSiteMember{
@ApiModelProperty("场所ID")
private Long siteId;
@ApiModelProperty("场所")
private Long siteName;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("学号")
@ -78,4 +78,15 @@ public class ClockDto {
@Max(value=100)
private int pageSize = 10;
}
@Data
@ApiModel("场所实时统计")
public static class RealTimeStatistics{
@ApiModelProperty("场所名")
private String siteName;
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间")
private Long endTime;
}
}

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

@ -53,18 +53,18 @@ public class JourneyDto {
public static class SelectJourneyByName{
@Size(max = 6,min = 0,message = "信息格式错误")
@ApiModelProperty("学生姓名")
private Long name;
private String name;
@Size(max = 16,min = 0,message = "信息格式错误")
@ApiModelProperty("学号")
private Long wkno;
private String wkno;
@ApiModelProperty("出行方式 0铁路 1飞机 2客运车辆 3自驾 4船 5其他")
private int tripMode;
@Size(max = 12,min = 0,message = "信息格式错误")
@ApiModelProperty("车次号")
private String carNo;
@ApiModelProperty("开始时间 默认今天零点")
@ApiModelProperty("开始时间")
private Long startTime;
@ApiModelProperty("结束时间 默认当前时间")
@ApiModelProperty("结束时间")
private Long endTime;
@ApiModelProperty("第几页")
@Min(value = 1)

13
health/src/main/java/com/ccsens/health/bean/vo/ClockVo.java

@ -129,11 +129,22 @@ public class ClockVo {
@ApiModelProperty("班级")
private String department;
@ApiModelProperty("进入打卡时间")
private Long time;
private Long inTime;
@ApiModelProperty("出去打卡时间")
private Long outTime;
@ApiModelProperty("健康状态")
private Long healthType;
}
@Data
@ApiModel("实时统计场所的出入次数")
public static class RealTimeStatistics{
@ApiModelProperty("时间")
private String time;
@ApiModelProperty("进入打卡次数")
private int inCount;
@ApiModelProperty("出去打卡次数")
private int outCount;
}
}

1
health/src/main/java/com/ccsens/health/persist/dao/JourneyAbnormalDao.java

@ -2,6 +2,7 @@ package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.vo.JourneyVo;
import com.ccsens.health.persist.mapper.JourneyAbnormalMapper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

7
health/src/main/java/com/ccsens/health/persist/dao/JourneyDao.java

@ -42,4 +42,11 @@ public interface JourneyDao extends JourneyMapper {
* @return
*/
List<MemberVo.ContactPatientOutside> queryByCarNo(List<MemberDto.ContactPatientDto> carNos);
/**
* 查询学生校外行程
* @param param
* @return
*/
List<JourneyVo.StudentJourneyInfo> getJourneyInfoList(JourneyDto.SelectJourneyByName param);
}

9
health/src/main/java/com/ccsens/health/persist/dao/SiteDao.java

@ -1,8 +1,11 @@
package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.dto.ClockDto;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.vo.ClockVo;
import com.ccsens.health.persist.mapper.SiteMapper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -15,4 +18,10 @@ public interface SiteDao extends SiteMapper {
* @return
*/
List<ClockVo.SiteList> queryAll(JourneyDto.Query query);
List<ClockVo.SiteOverview> selectSiteOverview(@Param("siteName") String siteName, @Param("time")Long time);
List<ClockVo.SiteMemberList> selectSiteMemberList(ClockDto.SelectSiteMember param);
List<ClockVo.RealTimeStatistics> getRealTimeStatistics(ClockDto.RealTimeStatistics param);
}

25
health/src/main/java/com/ccsens/health/service/ClockService.java

@ -13,6 +13,7 @@ import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.po.*;
import com.ccsens.health.bean.vo.ClockVo;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.bean.vo.JourneyVo;
import com.ccsens.health.persist.dao.RealNameAuthDao;
import com.ccsens.health.persist.dao.SiteClockInDao;
import com.ccsens.health.persist.dao.SiteDao;
@ -53,7 +54,9 @@ public class ClockService implements IClockService {
@Autowired
private RedisUtil redisUtil;
@Autowired
private HealthService healthService;
private IHealthService healthService;
@Autowired
private IConstantService constantService;
@Autowired
private IUserService userService;
@Autowired
@ -88,8 +91,11 @@ public class ClockService implements IClockService {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//获取打卡范围常量
String r = "0.8";
r = constantService.getByKey("radius");
//判断经纬度是否正确
boolean inCircle = DistanceUtil.isInCircle(site.getLongitude(), site.getLatitude(), clickIn.getLocationLongitude(), clickIn.getLocationLatitude(), "0.8");
boolean inCircle = DistanceUtil.isInCircle(site.getLongitude(), site.getLatitude(), clickIn.getLocationLongitude(), clickIn.getLocationLatitude(), r);
log.info("是否在半径内:{}", inCircle);
if (!inCircle) {
throw new BaseException(CodeEnum.LOCATION_LONG);
@ -424,11 +430,20 @@ public class ClockService implements IClockService {
@Override
public List<ClockVo.SiteOverview> selectSiteOverview(ClockDto.SiteOverview param) {
return null;
List<ClockVo.SiteOverview> siteOverviewList = siteDao.selectSiteOverview(param.getSiteName(),param.getTime());
return siteOverviewList;
}
@Override
public PageInfo<ClockVo.SiteMemberList> selectSiteMemberList(ClockDto.SelectSiteMember param) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
List<ClockVo.SiteMemberList> siteMemberList = siteDao.selectSiteMemberList(param);
return new PageInfo<>(siteMemberList);
}
@Override
public List<ClockVo.SiteMemberList> selectSiteMemberList(ClockDto.SelectSiteMember param) {
return null;
public List<ClockVo.RealTimeStatistics> getRealTimeStatistics(ClockDto.RealTimeStatistics param) {
List<ClockVo.RealTimeStatistics> realTimeStatisticsList = siteDao.getRealTimeStatistics(param);
return realTimeStatisticsList;
}
}

4
health/src/main/java/com/ccsens/health/service/IClockService.java

@ -31,5 +31,7 @@ public interface IClockService {
List<ClockVo.SiteOverview> selectSiteOverview(ClockDto.SiteOverview param);
List<ClockVo.SiteMemberList> selectSiteMemberList(ClockDto.SelectSiteMember param);
PageInfo<ClockVo.SiteMemberList> selectSiteMemberList(ClockDto.SelectSiteMember param);
List<ClockVo.RealTimeStatistics> getRealTimeStatistics(ClockDto.RealTimeStatistics param);
}

2
health/src/main/java/com/ccsens/health/service/IJourneyService.java

@ -46,5 +46,5 @@ public interface IJourneyService {
*/
PageInfo<JourneyVo.ClassBack> classBackStatistics(JourneyDto.BackClass backClass);
List<JourneyVo.StudentJourneyInfo> getJourneyInfoList(JourneyDto.SelectJourneyByName param, Long userId);
PageInfo<JourneyVo.StudentJourneyInfo> getJourneyInfoList(JourneyDto.SelectJourneyByName param, Long userId);
}

9
health/src/main/java/com/ccsens/health/service/JourneyService.java

@ -8,6 +8,7 @@ import cn.hutool.core.util.StrUtil;
import com.ccsens.cloudutil.feign.TallFeignClient;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.po.*;
import com.ccsens.health.bean.vo.ClockVo;
import com.ccsens.health.bean.vo.JourneyVo;
import com.ccsens.health.bean.vo.UserVo;
import com.ccsens.health.persist.dao.EmployeeDao;
@ -158,9 +159,10 @@ public class JourneyService implements IJourneyService{
* 查询学生校外行程
*/
@Override
public List<JourneyVo.StudentJourneyInfo> getJourneyInfoList(JourneyDto.SelectJourneyByName param, Long userId) {
// List<JourneyVo.StudentJourneyInfo> studentJourneyInfos =
return null;
public PageInfo<JourneyVo.StudentJourneyInfo> getJourneyInfoList(JourneyDto.SelectJourneyByName param, Long userId) {
PageHelper.startPage(param.getPageNum(), param.getPageSize());
List<JourneyVo.StudentJourneyInfo> studentJourneyInfos = journeyDao.getJourneyInfoList(param);
return new PageInfo<>(studentJourneyInfos);
}
/**
@ -195,7 +197,6 @@ public class JourneyService implements IJourneyService{
PageHelper.startPage(page, 10);
List<JourneyVo.AddAbnormalJourney> addAbnormalJourneyList =
journeyAbnormalDao.selectAbnormalJourney(abnormalJourney.getCarNo(),abnormalJourney.getTripMode(),abnormalJourney.getStartTime(),abnormalJourney.getEndTime());
return addAbnormalJourneyList;
}

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

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: common, util-test
active: dev
include: common, util-dev

42
health/src/main/resources/mapper_dao/JourneyDao.xml

@ -113,5 +113,45 @@
ORDER BY a.no, j.start_time
</select>
<select id="getJourneyInfoList" resultType="com.ccsens.health.bean.vo.JourneyVo$StudentJourneyInfo">
select
j.id as id,
j.user_id as userId,
m.name as name,
m.wkno as wkno,
m.department as department,
j.trip_mode as tripMode,
j.car_no as carNo,
j.journey_type as journeyType,
j.start_time as startTime,
j.end_time as endTime,
j.together as together
from
t_journey j LEFT JOIN t_real_name_auth r on j.user_id = r.user_id LEFT JOIN t_member m on m.wkno = r.no
where
j.rec_status = 0
<if test="name != null and name != ''">
and
m.name = #{name}
</if>
<if test="wkno != null and wkno != ''">
and
m.wkno = #{wkno}
</if>
<if test="tripMode != null">
and
j.trip_mode = #{tripMode}
</if>
<if test="carNo != null and carNo != ''">
and
j.car_no = #{carNo}
</if>
<if test="endTime != null">
and j.start_time &lt;= #{endTime}
</if>
<if test="startTime != null">
and j.end_time &gt;= #{startTime}
</if>
order by j.start_time DESC
</select>
</mapper>

117
health/src/main/resources/mapper_dao/SiteDao.xml

@ -22,4 +22,121 @@
(select * from t_site_qrcode where out_or_in = 1) t2
on t.id = t2.site_id
</select>
<select id="selectSiteOverview" resultType="com.ccsens.health.bean.vo.ClockVo$SiteOverview" parameterType="java.util.Map">
SELECT
s.id as id,
s.site_name as siteName,
COUNT(c.id) as number
FROM
t_site s left join t_site_clock_in c on c.site_id = s.id
<if test="time != null">
and
c.time &lt;= #{time} and c.out_time &gt;= #{time}
</if>
where
s.rec_status = 0
<if test="siteName != null and siteName != ''">
and s.site_name = #{siteName}
</if>
GROUP BY s.id
</select>
<select id="selectSiteMemberList" resultType="com.ccsens.health.bean.vo.ClockVo$SiteMemberList">
SELECT
c.id as id,
s.site_name as sitrName,
m.name as name,
m.wkno as wkno,
m.department as department,
c.time as inTime,
c.out_time as outTime,
a.user_id as userId,
h.health_type_id as healthType
FROM
t_site_clock_in c left join t_site s on c.site_id = s.id
left join t_real_name_auth a on c.user_id = a.user_id
left join t_member m on a.`no` = m.wkno
left join (
SELECT *
FROM
t_health_records
ORDER BY time DESC
limit 1
) h on h.user_id = a.user_id
where
s. rec_status = 0
<if test="siteName != null and siteName != ''">
and s.site_name = #{siteName}
</if>
<if test="name != null and name != ''">
and m.name = #{name}
</if>
<if test="wkno != null and wkno != ''">
and m.wkno = #{wkno}
</if>
<if test="department != null and department != ''">
and m.department = #{department}
</if>
<if test="endTime != null">
and c.time &lt;= #{endTime}
</if>
<if test="startTime != null">
and c.out_time &gt;= #{startTime}
</if>
ORDER BY c.time DESC
</select>
<sql id="t1">
select FROM_UNIXTIME(sc.time/1000,'%Y-%m-%d %H') as time, count(*) as inCount from t_site s, t_site_clock_in sc where s.id = sc.site_id
<if test="siteName != null and siteName != ''">
and s.site_name = #{siteName}
</if>
<if test="startTime != null">
and sc.time &gt;= #{startTime}
</if>
<if test="endTime != null">
and sc.time &lt;= #{endTime}
</if>
group by FROM_UNIXTIME(sc.time/1000,'%Y-%m-%d %H')
</sql>
<sql id="t2">
select FROM_UNIXTIME(sc.out_time/1000,'%Y-%m-%d %H') as time, count(*) as outCount from t_site s, t_site_clock_in sc where s.id = sc.site_id
<if test="siteName != null and siteName != ''">
and s.site_name = #{siteName}
</if>
<if test="startTime != null">
and sc.out_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and sc.out_time &lt;= #{endTime}
</if>
group by FROM_UNIXTIME(sc.out_time/1000,'%Y-%m-%d %H')
</sql>
<select id="getRealTimeStatistics" resultType="com.ccsens.health.bean.vo.ClockVo$RealTimeStatistics">
select t1.time as time, t1.inCount as inCount, t2.outCount as outCount from
(
<include refid="t1" />
) t1
left join
(
<include refid="t2" />
) t2
on t1.time = t2.time
union
select t2.time, t1.inCount, t2.outCount from
(
<include refid="t1" />
) t1
right join
(
<include refid="t2" />
) t2
on t1.time = t2.time
order by time
</select>
</mapper>
Loading…
Cancel
Save