Browse Source

Merge branch 'master' of gitee.com:ccsens_s/ccsenscloud

master
zhangye 5 years ago
parent
commit
0e66a0cfe7
  1. 15
      cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java
  2. 9
      health/src/main/java/com/ccsens/health/api/HealthController.java
  3. 24
      health/src/main/java/com/ccsens/health/bean/dto/HealthDto.java
  4. 45
      health/src/main/java/com/ccsens/health/bean/po/SiteClockIn.java
  5. 228
      health/src/main/java/com/ccsens/health/bean/po/SiteClockInExample.java
  6. 12
      health/src/main/java/com/ccsens/health/bean/vo/ClockVo.java
  7. 34
      health/src/main/java/com/ccsens/health/bean/vo/HealthVo.java
  8. 8
      health/src/main/java/com/ccsens/health/persist/dao/HealthRecordsDao.java
  9. 7
      health/src/main/java/com/ccsens/health/persist/dao/SiteClockInDao.java
  10. 86
      health/src/main/java/com/ccsens/health/service/ClockService.java
  11. 11
      health/src/main/java/com/ccsens/health/service/HealthService.java
  12. 8
      health/src/main/java/com/ccsens/health/service/IHealthService.java
  13. 9
      health/src/main/java/com/ccsens/health/service/UserService.java
  14. 6
      health/src/main/java/com/ccsens/health/util/HealthConstant.java
  15. 24
      health/src/main/resources/mapper_dao/HealthRecordDao.xml
  16. 35
      health/src/main/resources/mapper_dao/SiteClockInDao.xml
  17. 89
      health/src/main/resources/mapper_raw/SiteClockInMapper.xml
  18. 1
      util/src/main/java/com/ccsens/util/DateUtil.java
  19. 3
      util/src/main/java/com/ccsens/util/WebConstant.java

15
cloudutil/src/main/java/com/ccsens/cloudutil/feign/TallFeignClient.java

@ -30,6 +30,16 @@ import java.util.Map;
@FeignClient(name = "tall", path = "v1.0", fallbackFactory = TallFeignClientFallBack.class)
public interface TallFeignClient {
/**
* 输入两个userid将两个账号合并保留企业用户的id
* @param userId 需要保存的userid
* @param uselessId 不需要保存的userid
* @return
*/
@GetMapping("/users/mergeUserId")
JsonResponse mergeUserId(@RequestParam(required = true, name = "userId") Long userId,@RequestParam(required = true, name = "uselessId") Long uselessId);
/**
* 获取
*
@ -159,6 +169,11 @@ class TallFeignClientFallBack implements FallbackFactory<TallFeignClient> {
log.error(msg);
}
return new TallFeignClient() {
@Override
public JsonResponse mergeUserId(Long userId, Long uselessId) {
return JsonResponse.newInstance().fail();
}
@Override
public String get(QueryParam map) {
return "hello world";

9
health/src/main/java/com/ccsens/health/api/HealthController.java

@ -10,6 +10,7 @@ import com.ccsens.health.service.IHealthService;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.dto.QueryDto;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -68,4 +69,12 @@ public class HealthController {
return JsonResponse.newInstance().ok(healthTypeStatisticsList);
}
@MustLogin
@ApiOperation(value = "健康类型统计", notes = "")
@PostMapping("list")
public JsonResponse<PageInfo<HealthVo.HealthList>> list(@RequestBody QueryDto<HealthDto.QueryList> params){
PageInfo<HealthVo.HealthList> pageInfo = healthService.list(params);
return JsonResponse.newInstance().ok(pageInfo);
}
}

24
health/src/main/java/com/ccsens/health/bean/dto/HealthDto.java

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.math.BigDecimal;
@Data
@ -30,4 +32,26 @@ public class HealthDto {
@ApiModelProperty("体温")
private BigDecimal animalHeat;
}
@ApiModel("查询健康上报列表参数")
@Data
public static class QueryList{
@ApiModelProperty("学号")
private String no;
@ApiModelProperty("姓名")
private String name;
@ApiModelProperty("班级")
private String department;
@ApiModelProperty("开始时间")
private Long startTime ;
@ApiModelProperty("开始时间")
private Long endTime ;
@ApiModelProperty("第几页")
@Min(value = 1)
private int pageNum = 1;
@ApiModelProperty("每页多少条")
@Min(value = 1)
@Max(value=100)
private int pageSize = 10;
}
}

45
health/src/main/java/com/ccsens/health/bean/po/SiteClockIn.java

@ -7,7 +7,7 @@ import java.util.Date;
public class SiteClockIn implements Serializable {
private Long id;
private Long qrcodeId;
private Long siteId;
private Long time;
@ -15,6 +15,12 @@ public class SiteClockIn implements Serializable {
private BigDecimal locationLatitude;
private Long outTime;
private BigDecimal outLocationLongitude;
private BigDecimal outLocationLatitude;
private Long userId;
private Date createdAt;
@ -33,12 +39,12 @@ public class SiteClockIn implements Serializable {
this.id = id;
}
public Long getQrcodeId() {
return qrcodeId;
public Long getSiteId() {
return siteId;
}
public void setQrcodeId(Long qrcodeId) {
this.qrcodeId = qrcodeId;
public void setSiteId(Long siteId) {
this.siteId = siteId;
}
public Long getTime() {
@ -65,6 +71,30 @@ public class SiteClockIn implements Serializable {
this.locationLatitude = locationLatitude;
}
public Long getOutTime() {
return outTime;
}
public void setOutTime(Long outTime) {
this.outTime = outTime;
}
public BigDecimal getOutLocationLongitude() {
return outLocationLongitude;
}
public void setOutLocationLongitude(BigDecimal outLocationLongitude) {
this.outLocationLongitude = outLocationLongitude;
}
public BigDecimal getOutLocationLatitude() {
return outLocationLatitude;
}
public void setOutLocationLatitude(BigDecimal outLocationLatitude) {
this.outLocationLatitude = outLocationLatitude;
}
public Long getUserId() {
return userId;
}
@ -104,10 +134,13 @@ public class SiteClockIn implements Serializable {
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", qrcodeId=").append(qrcodeId);
sb.append(", siteId=").append(siteId);
sb.append(", time=").append(time);
sb.append(", locationLongitude=").append(locationLongitude);
sb.append(", locationLatitude=").append(locationLatitude);
sb.append(", outTime=").append(outTime);
sb.append(", outLocationLongitude=").append(outLocationLongitude);
sb.append(", outLocationLatitude=").append(outLocationLatitude);
sb.append(", userId=").append(userId);
sb.append(", createdAt=").append(createdAt);
sb.append(", updatedAt=").append(updatedAt);

228
health/src/main/java/com/ccsens/health/bean/po/SiteClockInExample.java

@ -166,63 +166,63 @@ public class SiteClockInExample {
return (Criteria) this;
}
public Criteria andQrcodeIdIsNull() {
addCriterion("qrcode_id is null");
public Criteria andSiteIdIsNull() {
addCriterion("site_id is null");
return (Criteria) this;
}
public Criteria andQrcodeIdIsNotNull() {
addCriterion("qrcode_id is not null");
public Criteria andSiteIdIsNotNull() {
addCriterion("site_id is not null");
return (Criteria) this;
}
public Criteria andQrcodeIdEqualTo(Long value) {
addCriterion("qrcode_id =", value, "qrcodeId");
public Criteria andSiteIdEqualTo(Long value) {
addCriterion("site_id =", value, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdNotEqualTo(Long value) {
addCriterion("qrcode_id <>", value, "qrcodeId");
public Criteria andSiteIdNotEqualTo(Long value) {
addCriterion("site_id <>", value, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdGreaterThan(Long value) {
addCriterion("qrcode_id >", value, "qrcodeId");
public Criteria andSiteIdGreaterThan(Long value) {
addCriterion("site_id >", value, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdGreaterThanOrEqualTo(Long value) {
addCriterion("qrcode_id >=", value, "qrcodeId");
public Criteria andSiteIdGreaterThanOrEqualTo(Long value) {
addCriterion("site_id >=", value, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdLessThan(Long value) {
addCriterion("qrcode_id <", value, "qrcodeId");
public Criteria andSiteIdLessThan(Long value) {
addCriterion("site_id <", value, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdLessThanOrEqualTo(Long value) {
addCriterion("qrcode_id <=", value, "qrcodeId");
public Criteria andSiteIdLessThanOrEqualTo(Long value) {
addCriterion("site_id <=", value, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdIn(List<Long> values) {
addCriterion("qrcode_id in", values, "qrcodeId");
public Criteria andSiteIdIn(List<Long> values) {
addCriterion("site_id in", values, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdNotIn(List<Long> values) {
addCriterion("qrcode_id not in", values, "qrcodeId");
public Criteria andSiteIdNotIn(List<Long> values) {
addCriterion("site_id not in", values, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdBetween(Long value1, Long value2) {
addCriterion("qrcode_id between", value1, value2, "qrcodeId");
public Criteria andSiteIdBetween(Long value1, Long value2) {
addCriterion("site_id between", value1, value2, "siteId");
return (Criteria) this;
}
public Criteria andQrcodeIdNotBetween(Long value1, Long value2) {
addCriterion("qrcode_id not between", value1, value2, "qrcodeId");
public Criteria andSiteIdNotBetween(Long value1, Long value2) {
addCriterion("site_id not between", value1, value2, "siteId");
return (Criteria) this;
}
@ -406,6 +406,186 @@ public class SiteClockInExample {
return (Criteria) this;
}
public Criteria andOutTimeIsNull() {
addCriterion("out_time is null");
return (Criteria) this;
}
public Criteria andOutTimeIsNotNull() {
addCriterion("out_time is not null");
return (Criteria) this;
}
public Criteria andOutTimeEqualTo(Long value) {
addCriterion("out_time =", value, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeNotEqualTo(Long value) {
addCriterion("out_time <>", value, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeGreaterThan(Long value) {
addCriterion("out_time >", value, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeGreaterThanOrEqualTo(Long value) {
addCriterion("out_time >=", value, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeLessThan(Long value) {
addCriterion("out_time <", value, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeLessThanOrEqualTo(Long value) {
addCriterion("out_time <=", value, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeIn(List<Long> values) {
addCriterion("out_time in", values, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeNotIn(List<Long> values) {
addCriterion("out_time not in", values, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeBetween(Long value1, Long value2) {
addCriterion("out_time between", value1, value2, "outTime");
return (Criteria) this;
}
public Criteria andOutTimeNotBetween(Long value1, Long value2) {
addCriterion("out_time not between", value1, value2, "outTime");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeIsNull() {
addCriterion("out_location_longitude is null");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeIsNotNull() {
addCriterion("out_location_longitude is not null");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeEqualTo(BigDecimal value) {
addCriterion("out_location_longitude =", value, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeNotEqualTo(BigDecimal value) {
addCriterion("out_location_longitude <>", value, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeGreaterThan(BigDecimal value) {
addCriterion("out_location_longitude >", value, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("out_location_longitude >=", value, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeLessThan(BigDecimal value) {
addCriterion("out_location_longitude <", value, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeLessThanOrEqualTo(BigDecimal value) {
addCriterion("out_location_longitude <=", value, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeIn(List<BigDecimal> values) {
addCriterion("out_location_longitude in", values, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeNotIn(List<BigDecimal> values) {
addCriterion("out_location_longitude not in", values, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("out_location_longitude between", value1, value2, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLongitudeNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("out_location_longitude not between", value1, value2, "outLocationLongitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeIsNull() {
addCriterion("out_location_latitude is null");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeIsNotNull() {
addCriterion("out_location_latitude is not null");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeEqualTo(BigDecimal value) {
addCriterion("out_location_latitude =", value, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeNotEqualTo(BigDecimal value) {
addCriterion("out_location_latitude <>", value, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeGreaterThan(BigDecimal value) {
addCriterion("out_location_latitude >", value, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeGreaterThanOrEqualTo(BigDecimal value) {
addCriterion("out_location_latitude >=", value, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeLessThan(BigDecimal value) {
addCriterion("out_location_latitude <", value, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeLessThanOrEqualTo(BigDecimal value) {
addCriterion("out_location_latitude <=", value, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeIn(List<BigDecimal> values) {
addCriterion("out_location_latitude in", values, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeNotIn(List<BigDecimal> values) {
addCriterion("out_location_latitude not in", values, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("out_location_latitude between", value1, value2, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andOutLocationLatitudeNotBetween(BigDecimal value1, BigDecimal value2) {
addCriterion("out_location_latitude not between", value1, value2, "outLocationLatitude");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;

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

@ -16,12 +16,18 @@ public class ClockVo {
private Long siteId;
@ApiModelProperty("场所名称")
private String siteName;
@ApiModelProperty("打卡时间")
@ApiModelProperty("进门打卡时间")
private Long time;
@ApiModelProperty("经度")
@ApiModelProperty("进门定位-经度")
private BigDecimal longitude;
@ApiModelProperty("纬度")
@ApiModelProperty("进门定位-纬度")
private BigDecimal latitude;
@ApiModelProperty("出门打卡时间")
private Long outTime;
@ApiModelProperty("出门定位-经度")
private BigDecimal outLongitude;
@ApiModelProperty("出门定位-纬度")
private BigDecimal outLatitude;
}

34
health/src/main/java/com/ccsens/health/bean/vo/HealthVo.java

@ -95,4 +95,38 @@ public class HealthVo {
private String quarantine;
private String independent;
}
@Data
public static class HealthList{
@ApiModelProperty("打卡记录的id")
private Long id;
@ApiModelProperty("成员id")
private Long userId;
@ApiModelProperty("日期")
private Long time;
@ApiModelProperty("当前所在地区")
private String district;
@ApiModelProperty("当前所在详细地址")
private String address;
@ApiModelProperty("当前身体状态")
private Long healthTypeId;
@ApiModelProperty("就诊医院")
private String hospital;
@ApiModelProperty("有无湖北武汉接触史 0没有 1有")
private int touchHubei;
@ApiModelProperty("有无接触患者 0无 1有")
private int touchSick;
@ApiModelProperty("体温")
private BigDecimal animalHeat;
@ApiModelProperty("健康状态code")
private Byte code;
@ApiModelProperty("健康状态名字")
private String codeName;
@ApiModelProperty("工号")
private String no;
@ApiModelProperty("学生名字")
private String name;
@ApiModelProperty("部门")
private String department;
}
}

8
health/src/main/java/com/ccsens/health/persist/dao/HealthRecordsDao.java

@ -1,5 +1,6 @@
package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.dto.HealthDto;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.bean.vo.UserVo;
import com.ccsens.health.persist.mapper.HealthRecordsMapper;
@ -25,4 +26,11 @@ public interface HealthRecordsDao extends HealthRecordsMapper {
* @return
*/
HealthVo.HealthDetail queryDetail(@Param("userId")Long userId, @Param("endTime") Long endTime);
/**
* 查询健康信息
* @param param
* @return
*/
List<HealthVo.HealthList> list(HealthDto.QueryList param);
}

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

@ -2,6 +2,7 @@ package com.ccsens.health.persist.dao;
import com.ccsens.health.bean.dto.ClockDto;
import com.ccsens.health.bean.dto.MemberDto;
import com.ccsens.health.bean.po.SiteClockIn;
import com.ccsens.health.bean.vo.ClockVo;
import com.ccsens.health.persist.mapper.SiteClockInMapper;
import org.apache.ibatis.annotations.Param;
@ -29,4 +30,10 @@ public interface SiteClockInDao extends SiteClockInMapper {
*/
List<ClockVo.ClockInMsg> queryRecordBySite(List<ClockVo.ClockInMsg> dtos);
/**
* 查询上一个校园打卡记录
* @param userId
* @return
*/
SiteClockIn getPrevClockIn(@Param("userId") Long userId);
}

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

@ -15,6 +15,7 @@ import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.health.persist.dao.SiteClockInDao;
import com.ccsens.health.persist.dao.SiteDao;
import com.ccsens.health.persist.dao.SiteQrcodeDao;
import com.ccsens.health.util.HealthConstant;
import com.ccsens.util.*;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
@ -28,6 +29,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.sql.Struct;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -61,6 +63,10 @@ public class ClockService implements IClockService {
Long userId = params.getUserId();
//获取场所ID
SiteQrcode siteQrcode = siteQrcodeDao.selectByPrimaryKey(clickIn.getSiteId());
log.info("打卡二维码:{}", siteQrcode);
if (siteQrcode == null) {
throw new BaseException(CodeEnum.PARAM_ERROR);
}
Site site = siteDao.selectByPrimaryKey(siteQrcode.getSiteId());
log.info("场所信息:{}", site);
if (site == null) {
@ -77,17 +83,86 @@ public class ClockService implements IClockService {
// //2、通过userId获取成员id
// Employee employee = userService.getEmployeeByUserId(userId);
//添加打卡记录
SiteClockIn prevClockIn = siteClockInDao.getPrevClockIn(userId);
log.info("上一条打卡:{}", prevClockIn);
if (prevClockIn == null) {
saveClockIn(userId, site.getId(), siteQrcode.getOutOrIn(), clickIn);
} else if (siteQrcode.getOutOrIn().byteValue() == HealthConstant.SITE_IN) {
// 进场打卡
//1.判断上一打卡记录,判断是否有结束时间,无则设置当前时间为上一个场所的结束时间
if (prevClockIn.getOutTime() == null || prevClockIn.getOutTime().longValue() == 0) {
prevClockIn.setOutTime(System.currentTimeMillis());
siteClockInDao.updateByPrimaryKeySelective(prevClockIn);
}
//2.保存当前打卡
saveClockIn(userId, site.getId(), siteQrcode.getOutOrIn(), clickIn);
} else {
// 出去打卡
//1.判断上一个打卡场所是否为本场所+出去打卡时间为空
if (prevClockIn.getSiteId().longValue() == site.getId().longValue()
&& (prevClockIn.getOutTime() == null || prevClockIn.getOutTime().longValue() == 0)) {
prevClockIn.setOutTime(System.currentTimeMillis());
prevClockIn.setOutLocationLatitude(clickIn.getLocationLatitude());
prevClockIn.setOutLocationLongitude(clickIn.getLocationLongitude());
siteClockInDao.updateByPrimaryKeySelective(prevClockIn);
} else if (prevClockIn.getOutTime() != null && prevClockIn.getOutTime().longValue() != 0) {
//进门未打卡
saveOutClockIn(userId, site.getId(), prevClockIn.getOutTime(), clickIn);
} else {
//上一次出场所未打卡 + 进来未打卡
prevClockIn.setOutTime(System.currentTimeMillis());
siteClockInDao.updateByPrimaryKeySelective(prevClockIn);
saveOutClockIn(userId, site.getId(), prevClockIn.getTime(), clickIn);
}
}
}
/**
* 新增出门打卡记录进入时未打卡
* @param userId
* @param siteId
* @param inTimem
* @param clickIn
*/
private void saveOutClockIn(Long userId, Long siteId, Long inTimem, ClockDto.SiteDto clickIn) {
SiteClockIn siteClockIn = new SiteClockIn();
siteClockIn.setId(snowflake.nextId());
siteClockIn.setUserId(userId);
siteClockIn.setQrcodeId(clickIn.getSiteId());
siteClockIn.setSiteId(siteId);
siteClockIn.setTime(inTimem);
siteClockIn.setOutTime(System.currentTimeMillis());
siteClockIn.setOutLocationLatitude(clickIn.getLocationLatitude());
siteClockIn.setOutLocationLongitude(clickIn.getLocationLongitude());
log.info("新添加一条打卡记录");
siteClockInDao.insertSelective(siteClockIn);
}
/**
* 存储打卡记录
* @param userId
* @param siteId
* @param outOrIn
* @param clickIn
*/
private void saveClockIn(Long userId, Long siteId, byte outOrIn, ClockDto.SiteDto clickIn){
SiteClockIn siteClockIn = new SiteClockIn();
siteClockIn.setId(snowflake.nextId());
siteClockIn.setUserId(userId);
siteClockIn.setSiteId(siteId);
if (outOrIn == HealthConstant.SITE_IN) {
//进场打卡
siteClockIn.setTime(System.currentTimeMillis());
siteClockIn.setLocationLatitude(clickIn.getLocationLatitude());
siteClockIn.setLocationLongitude(clickIn.getLocationLongitude());
} else {
// 出场打卡
siteClockIn.setTime(DateUtil.parse(DateUtil.today()).getTime());
siteClockIn.setOutTime(System.currentTimeMillis());
siteClockIn.setOutLocationLatitude(clickIn.getLocationLatitude());
siteClockIn.setOutLocationLongitude(clickIn.getLocationLongitude());
}
siteClockInDao.insertSelective(siteClockIn);
}
/**
* 查看打卡记录
*
@ -100,10 +175,13 @@ public class ClockService implements IClockService {
JourneyDto.SelectDate selectDate = params.getParam();
Long startTime = selectDate.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : selectDate.getStartTime();
Long endTime = selectDate.getEndTime() == null ? System.currentTimeMillis() : selectDate.getEndTime();
String userId = tallFeignClient.getUserId(selectDate.getToken());
String userId = String.valueOf(params.getUserId());
if (StrUtil.isNotBlank(selectDate.getToken())) {
userId = tallFeignClient.getUserId(selectDate.getToken());
if (StrUtil.isEmpty(userId)) {
throw new BaseException(CodeEnum.NOT_LOGIN);
}
}
// //2、通过userid查询出成员id
// Employee employee = userService.getEmployeeByUserId(Long.valueOf(userId));
//3、查询该成员符合时间的记录

11
health/src/main/java/com/ccsens/health/service/HealthService.java

@ -20,6 +20,8 @@ import com.ccsens.util.WebConstant;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import com.ccsens.util.wx.WxXcxUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.micrometer.shaded.org.pcollections.PCollection;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,6 +29,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.Valid;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
@ -233,4 +236,12 @@ public class HealthService implements IHealthService{
}
return healthTypeStatisticsList;
}
@Override
public PageInfo<HealthVo.HealthList> list(QueryDto<HealthDto.QueryList> params) {
HealthDto.QueryList param = params.getParam();
PageHelper.startPage(param.getPageNum(), param.getPageSize());
List<HealthVo.HealthList> vos = healthRecordsDao.list(param);
return new PageInfo<>(vos);
}
}

8
health/src/main/java/com/ccsens/health/service/IHealthService.java

@ -4,6 +4,7 @@ import com.ccsens.health.bean.dto.HealthDto;
import com.ccsens.health.bean.dto.JourneyDto;
import com.ccsens.health.bean.vo.HealthVo;
import com.ccsens.util.bean.dto.QueryDto;
import com.github.pagehelper.PageInfo;
import java.io.IOException;
import java.util.List;
@ -16,4 +17,11 @@ public interface IHealthService {
List<HealthVo.HealthTypeVo> getHealthType();
List<HealthVo.HealthTypeStatistics> getHealthTypeStatistics(QueryDto<JourneyDto.StatisticsDate> params) throws Exception;
/**
* 健康列表
* @param params
* @return
*/
PageInfo<HealthVo.HealthList> list(QueryDto<HealthDto.QueryList> params);
}

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

@ -15,6 +15,7 @@ import com.ccsens.health.persist.dao.*;
import com.ccsens.health.util.HealthConstant;
import com.ccsens.util.CodeEnum;
import com.ccsens.util.DateUtil;
import com.ccsens.util.JsonResponse;
import com.ccsens.util.bean.dto.QueryDto;
import com.ccsens.util.exception.BaseException;
import lombok.extern.slf4j.Slf4j;
@ -185,8 +186,14 @@ public class UserService implements IUserService{
* @return
*/
private void bindUser(Long sourceUserId, Long targetUserId) {
log.info("sourceUserId:{}, targetUserId:{}", sourceUserId, targetUserId);
//TODO 帐号绑定
JsonResponse jsonResponse = tallFeignClient.mergeUserId(targetUserId, sourceUserId);
log.info("绑定帐号结果:{}", jsonResponse);
if (jsonResponse.getCode().intValue() != CodeEnum.SUCCESS.getCode().intValue()) {
log.info("绑定帐号失败:{}", jsonResponse);
throw new BaseException(jsonResponse.getCode(), jsonResponse.getMsg());
}
// 绑定实名认证
RealNameAuth auth = new RealNameAuth();
auth.setUserId(targetUserId);

6
health/src/main/java/com/ccsens/health/util/HealthConstant.java

@ -31,4 +31,10 @@ public class HealthConstant {
public static final byte JOURNEY_BACK_SCHOOL = 1;
/**行程类型: 日常外出*/
public static final byte JOURNEY_OUT_SCHOOL = 1;
/**场所进出:进*/
public static final byte SITE_IN = 0;
/**场所进出:出*/
public static final byte SITE_OUT = 1;
/**第一次打卡漏打默认两小时*/
public static final long DEFAULT_CLOCK_TIME = 2 *60 * 60 * 1000;
}

24
health/src/main/resources/mapper_dao/HealthRecordDao.xml

@ -119,4 +119,28 @@
and r.rec_status = 0
order by r.time desc limit 1
</select>
<select id="list" resultType="com.ccsens.health.bean.vo.HealthVo$HealthList">
select r.id, r.user_id as userId, r.time, r.district, r.address,
r.health_type_id as healthTypeId, r.touch_hubei as touchHubei,
r.touch_sick as touchSick, r.animal_heat as animalHeat,
t.code,t.name as codeName, a.no, a.name, m.department
from t_health_records r , t_health_type t, t_real_name_auth a, t_member m
where r.health_type_id = t.id and r.user_id = a.user_id and a.no = m.wkno
<if test="no != null and no != ''">
and m.wkno = #{no}
</if>
<if test="name != null and name != ''">
and m.name = #{name}
</if>
<if test="department != null and department != ''">
and m.department = #{department}
</if>
<if test="startTime != null">
and r.time &gt;=#{startTime}
</if>
<if test="endTime != null">
and r.time &lt;=#{endTime}
</if>
and r.rec_status = 0
</select>
</mapper>

35
health/src/main/resources/mapper_dao/SiteClockInDao.xml

@ -7,6 +7,22 @@
<result column="sTime" property="time"/>
<result column="sLongitude" property="longitude"/>
<result column="sLatitude" property="latitude"/>
<result column="outTime" property="outTime"/>
<result column="outLatitude" property="outLatitude"/>
<result column="outLongitude" property="outLongitude"/>
</resultMap>
<resultMap id="BaseResultMap" type="com.ccsens.health.bean.po.SiteClockIn">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="site_id" jdbcType="BIGINT" property="siteId" />
<result column="qrcode_id" jdbcType="BIGINT" property="qrcodeId" />
<result column="time" jdbcType="BIGINT" property="time" />
<result column="location_longitude" jdbcType="DECIMAL" property="locationLongitude" />
<result column="location_latitude" jdbcType="DECIMAL" property="locationLatitude" />
<result column="out_time" jdbcType="BIGINT" property="outTime" />
<result column="out_location_longitude" jdbcType="DECIMAL" property="outLocationLongitude" />
<result column="out_location_latitude" jdbcType="DECIMAL" property="outLocationLatitude" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
</resultMap>
<select id="selectHealthInfoByDate" resultMap="resultMap_siteClick" parameterType="java.util.Map">
@ -14,10 +30,13 @@
s.id as sId,
s.site_name as sSiteName,
c.time as sTime,
s.longitude as sLongitude,
s.latitude as sLatitude
c.location_longitude as sLongitude,
c.location_latitude as sLatitude,
c.out_time as outTime,
c.out_location_latitude as outLatitude,
c.out_location_longitude as outLongitude
from
t_site_clock_in c join t_site_qrcode q on q.id = c.qrcode_id join t_site s on q.site_id = s.id
t_site_clock_in c join t_site s on c.site_id = s.id
where
c.rec_status = 0
and
@ -33,11 +52,11 @@
select
COUNT(*)
from
t_site_qrcode q RIGHT JOIN t_site_clock_in c on q.id = c.qrcode_id
t_site s RIGHT JOIN t_site_clock_in c on s.id = c.site_id
where
c.rec_status = 0
and
q.site_id = #{siteId}
s.id = #{siteId}
and
c.time &lt;= #{endTime}
and
@ -57,7 +76,7 @@
and a.name = #{patientName}
</if>
<if test="startTime !=null and endTime != null">
and (i.out_time &gt;= #{startTime} or i.time &lt;= #{endTime})
and (i.out_time &gt;= #{startTime} and i.time &lt;= #{endTime})
</if>
<if test="startTime !=null and endTime == null">
and (i.out_time &gt;= #{startTime} or i.time &gt;= #{startTime})
@ -65,7 +84,6 @@
<if test="endTime !=null and startTime == null">
and (i.time &lt;= #{endTime} or i.out_time &lt;= #{endTime})
</if>
and i.rec_status = 0
</where>
order by i.time
@ -84,5 +102,8 @@
</where>
order by a.no, i.time
</select>
<select id="getPrevClockIn" resultMap="BaseResultMap">
select * from t_site_clock_in c where c.user_id = #{userId} and c.rec_status = 0 ORDER BY c.time desc limit 1
</select>
</mapper>

89
health/src/main/resources/mapper_raw/SiteClockInMapper.xml

@ -3,10 +3,13 @@
<mapper namespace="com.ccsens.health.persist.mapper.SiteClockInMapper">
<resultMap id="BaseResultMap" type="com.ccsens.health.bean.po.SiteClockIn">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="qrcode_id" jdbcType="BIGINT" property="qrcodeId" />
<result column="site_id" jdbcType="BIGINT" property="siteId" />
<result column="time" jdbcType="BIGINT" property="time" />
<result column="location_longitude" jdbcType="DECIMAL" property="locationLongitude" />
<result column="location_latitude" jdbcType="DECIMAL" property="locationLatitude" />
<result column="out_time" jdbcType="BIGINT" property="outTime" />
<result column="out_location_longitude" jdbcType="DECIMAL" property="outLocationLongitude" />
<result column="out_location_latitude" jdbcType="DECIMAL" property="outLocationLatitude" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
<result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
@ -71,8 +74,8 @@
</where>
</sql>
<sql id="Base_Column_List">
id, qrcode_id, time, location_longitude, location_latitude, user_id, created_at,
updated_at, rec_status
id, site_id, time, location_longitude, location_latitude, out_time, out_location_longitude,
out_location_latitude, user_id, created_at, updated_at, rec_status
</sql>
<select id="selectByExample" parameterType="com.ccsens.health.bean.po.SiteClockInExample" resultMap="BaseResultMap">
select
@ -105,14 +108,16 @@
</if>
</delete>
<insert id="insert" parameterType="com.ccsens.health.bean.po.SiteClockIn">
insert into t_site_clock_in (id, qrcode_id, time,
location_longitude, location_latitude, user_id,
created_at, updated_at, rec_status
)
values (#{id,jdbcType=BIGINT}, #{qrcodeId,jdbcType=BIGINT}, #{time,jdbcType=BIGINT},
#{locationLongitude,jdbcType=DECIMAL}, #{locationLatitude,jdbcType=DECIMAL}, #{userId,jdbcType=BIGINT},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}
)
insert into t_site_clock_in (id, site_id, time,
location_longitude, location_latitude, out_time,
out_location_longitude, out_location_latitude,
user_id, created_at, updated_at,
rec_status)
values (#{id,jdbcType=BIGINT}, #{siteId,jdbcType=BIGINT}, #{time,jdbcType=BIGINT},
#{locationLongitude,jdbcType=DECIMAL}, #{locationLatitude,jdbcType=DECIMAL}, #{outTime,jdbcType=BIGINT},
#{outLocationLongitude,jdbcType=DECIMAL}, #{outLocationLatitude,jdbcType=DECIMAL},
#{userId,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP},
#{recStatus,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.health.bean.po.SiteClockIn">
insert into t_site_clock_in
@ -120,8 +125,8 @@
<if test="id != null">
id,
</if>
<if test="qrcodeId != null">
qrcode_id,
<if test="siteId != null">
site_id,
</if>
<if test="time != null">
time,
@ -132,6 +137,15 @@
<if test="locationLatitude != null">
location_latitude,
</if>
<if test="outTime != null">
out_time,
</if>
<if test="outLocationLongitude != null">
out_location_longitude,
</if>
<if test="outLocationLatitude != null">
out_location_latitude,
</if>
<if test="userId != null">
user_id,
</if>
@ -149,8 +163,8 @@
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="qrcodeId != null">
#{qrcodeId,jdbcType=BIGINT},
<if test="siteId != null">
#{siteId,jdbcType=BIGINT},
</if>
<if test="time != null">
#{time,jdbcType=BIGINT},
@ -161,6 +175,15 @@
<if test="locationLatitude != null">
#{locationLatitude,jdbcType=DECIMAL},
</if>
<if test="outTime != null">
#{outTime,jdbcType=BIGINT},
</if>
<if test="outLocationLongitude != null">
#{outLocationLongitude,jdbcType=DECIMAL},
</if>
<if test="outLocationLatitude != null">
#{outLocationLatitude,jdbcType=DECIMAL},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
@ -187,8 +210,8 @@
<if test="record.id != null">
id = #{record.id,jdbcType=BIGINT},
</if>
<if test="record.qrcodeId != null">
qrcode_id = #{record.qrcodeId,jdbcType=BIGINT},
<if test="record.siteId != null">
site_id = #{record.siteId,jdbcType=BIGINT},
</if>
<if test="record.time != null">
time = #{record.time,jdbcType=BIGINT},
@ -199,6 +222,15 @@
<if test="record.locationLatitude != null">
location_latitude = #{record.locationLatitude,jdbcType=DECIMAL},
</if>
<if test="record.outTime != null">
out_time = #{record.outTime,jdbcType=BIGINT},
</if>
<if test="record.outLocationLongitude != null">
out_location_longitude = #{record.outLocationLongitude,jdbcType=DECIMAL},
</if>
<if test="record.outLocationLatitude != null">
out_location_latitude = #{record.outLocationLatitude,jdbcType=DECIMAL},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
@ -219,10 +251,13 @@
<update id="updateByExample" parameterType="map">
update t_site_clock_in
set id = #{record.id,jdbcType=BIGINT},
qrcode_id = #{record.qrcodeId,jdbcType=BIGINT},
site_id = #{record.siteId,jdbcType=BIGINT},
time = #{record.time,jdbcType=BIGINT},
location_longitude = #{record.locationLongitude,jdbcType=DECIMAL},
location_latitude = #{record.locationLatitude,jdbcType=DECIMAL},
out_time = #{record.outTime,jdbcType=BIGINT},
out_location_longitude = #{record.outLocationLongitude,jdbcType=DECIMAL},
out_location_latitude = #{record.outLocationLatitude,jdbcType=DECIMAL},
user_id = #{record.userId,jdbcType=BIGINT},
created_at = #{record.createdAt,jdbcType=TIMESTAMP},
updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
@ -234,8 +269,8 @@
<update id="updateByPrimaryKeySelective" parameterType="com.ccsens.health.bean.po.SiteClockIn">
update t_site_clock_in
<set>
<if test="qrcodeId != null">
qrcode_id = #{qrcodeId,jdbcType=BIGINT},
<if test="siteId != null">
site_id = #{siteId,jdbcType=BIGINT},
</if>
<if test="time != null">
time = #{time,jdbcType=BIGINT},
@ -246,6 +281,15 @@
<if test="locationLatitude != null">
location_latitude = #{locationLatitude,jdbcType=DECIMAL},
</if>
<if test="outTime != null">
out_time = #{outTime,jdbcType=BIGINT},
</if>
<if test="outLocationLongitude != null">
out_location_longitude = #{outLocationLongitude,jdbcType=DECIMAL},
</if>
<if test="outLocationLatitude != null">
out_location_latitude = #{outLocationLatitude,jdbcType=DECIMAL},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
@ -263,10 +307,13 @@
</update>
<update id="updateByPrimaryKey" parameterType="com.ccsens.health.bean.po.SiteClockIn">
update t_site_clock_in
set qrcode_id = #{qrcodeId,jdbcType=BIGINT},
set site_id = #{siteId,jdbcType=BIGINT},
time = #{time,jdbcType=BIGINT},
location_longitude = #{locationLongitude,jdbcType=DECIMAL},
location_latitude = #{locationLatitude,jdbcType=DECIMAL},
out_time = #{outTime,jdbcType=BIGINT},
out_location_longitude = #{outLocationLongitude,jdbcType=DECIMAL},
out_location_latitude = #{outLocationLatitude,jdbcType=DECIMAL},
user_id = #{userId,jdbcType=BIGINT},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},

1
util/src/main/java/com/ccsens/util/DateUtil.java

@ -150,6 +150,7 @@ public class DateUtil extends cn.hutool.core.date.DateUtil {
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime().getTime();
}

3
util/src/main/java/com/ccsens/util/WebConstant.java

@ -1,9 +1,6 @@
package com.ccsens.util;
import cn.hutool.core.codec.Base64;
import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.RandomStringUtils;
import java.io.File;

Loading…
Cancel
Save