Browse Source

0307v1.0

master
zhangye 5 years ago
parent
commit
ead787fc9f
  1. 2
      health/src/main/java/com/ccsens/health/api/ClockController.java
  2. 14
      health/src/main/java/com/ccsens/health/bean/vo/ClockVo.java
  3. 2
      health/src/main/java/com/ccsens/health/persist/dao/SiteClockInDao.java
  4. 28
      health/src/main/java/com/ccsens/health/service/ClockService.java
  5. 2
      health/src/main/java/com/ccsens/health/service/IClockService.java
  6. 14
      health/src/main/java/com/ccsens/health/service/UserService.java
  7. 2
      health/src/main/resources/mapper_dao/HealthRecordDao.xml
  8. 17
      health/src/main/resources/mapper_dao/SiteClockInDao.xml
  9. 5
      util/src/main/java/com/ccsens/util/CodeEnum.java

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

@ -60,7 +60,7 @@ public class ClockController {
@MustLogin
@ApiOperation(value = "获取所有场景信息", notes = "")
@RequestMapping(value = "siteInfo", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<ClockVo.SiteInfo>> getAllSiteInfo() throws Exception {
public JsonResponse<List<Site>> getAllSiteInfo() throws Exception {
log.info("获取所有场景信息");
List<Site> siteList = clockService.getAllSiteInfo();
return JsonResponse.newInstance().ok(siteList);

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

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ClockVo {
@ -17,9 +19,9 @@ public class ClockVo {
@ApiModelProperty("打卡时间")
private Long time;
@ApiModelProperty("经度")
private Long longitude;
private BigDecimal longitude;
@ApiModelProperty("纬度")
private Long latitude;
private BigDecimal latitude;
}
@ -33,9 +35,9 @@ public class ClockVo {
@ApiModelProperty("人数")
private Integer number;
@ApiModelProperty("经度")
private Long longitude;
private BigDecimal longitude;
@ApiModelProperty("纬度")
private Long latitude;
private BigDecimal latitude;
}
@Data
@ -48,8 +50,8 @@ public class ClockVo {
@ApiModelProperty("场所Code")
private String siteCode;
@ApiModelProperty("经度")
private Long longitude;
private BigDecimal longitude;
@ApiModelProperty("纬度")
private Long latitude;
private BigDecimal latitude;
}
}

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

@ -10,4 +10,6 @@ import java.util.List;
@Repository
public interface SiteClockInDao extends SiteClockInMapper {
List<ClockVo.SiteClockInfo> selectHealthInfoByDate(@Param("employee")Long employee, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
int getClockInNumberBySiteId(@Param("siteId")Long siteId);
}

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

@ -93,9 +93,32 @@ public class ClockService implements IClockService {
* @return
*/
@Override
public List<ClockVo.SiteClockStatistics> getSiteClickStatistics(QueryDto<JourneyDto.StatisticsDate> params) {
public List<ClockVo.SiteClockStatistics> getSiteClickStatistics(QueryDto<JourneyDto.StatisticsDate> params) throws Exception {
List<ClockVo.SiteClockStatistics> siteClockStatisticsList = new ArrayList<>();
//1、获取日期的开始结束时间
JourneyDto.StatisticsDate statisticsDate = params.getParam();
Long startTime = statisticsDate.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : statisticsDate.getStartTime();
Long endTime = statisticsDate.getEndTime() == null ? System.currentTimeMillis() : statisticsDate.getEndTime();
return null;
//TODO 1、获取所有场景(暂时只获取学校的场所)
SiteExample siteExample = new SiteExample();
siteExample.createCriteria().andParentCodeEqualTo("SXDX");
List<Site> siteList = siteDao.selectByExample(siteExample);
if(CollectionUtil.isNotEmpty(siteList)){
for(Site site:siteList){
//2、获取场景的二维码(包括进出),查找每个二维码下的打卡记录
int number = siteClockInDao.getClockInNumberBySiteId(site.getId());
ClockVo.SiteClockStatistics siteClockStatistics = new ClockVo.SiteClockStatistics();
siteClockStatistics.setSiteId(site.getId());
siteClockStatistics.setSiteName(site.getSiteName());
siteClockStatistics.setLatitude(site.getLatitude());
siteClockStatistics.setLongitude(site.getLongitude());
siteClockStatistics.setNumber(number);
siteClockStatisticsList.add(siteClockStatistics);
}
}
return siteClockStatisticsList;
}
/**
@ -125,6 +148,7 @@ public class ClockService implements IClockService {
//添加场所二维码记录
SiteQrcode siteQrcode = new SiteQrcode();
siteQrcode.setId(snowflake.nextId());
siteQrcode.setSiteId(createQRCode.getId());
siteQrcode.setOutOrIn((byte) createQRCode.getType());
String type = "in";
if(createQRCode.getType() == 1){

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

@ -14,7 +14,7 @@ public interface IClockService {
List<ClockVo.SiteClockInfo> getSiteClock(QueryDto<JourneyDto.SelectDate> params) throws Exception;
List<ClockVo.SiteClockStatistics> getSiteClickStatistics(QueryDto<JourneyDto.StatisticsDate> params);
List<ClockVo.SiteClockStatistics> getSiteClickStatistics(QueryDto<JourneyDto.StatisticsDate> params) throws Exception;
String getQRCode(QueryDto<JourneyDto.CreateQRCode> params) throws IOException;

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

@ -7,10 +7,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.dto.UserDto;
import com.ccsens.health.bean.po.Employee;
import com.ccsens.health.bean.po.EmployeeExample;
import com.ccsens.health.bean.po.HealthQRCodeExample;
import com.ccsens.health.bean.po.RealNameAuth;
import com.ccsens.health.bean.po.*;
import com.ccsens.health.bean.vo.UserVo;
import com.ccsens.health.persist.dao.EmployeeDao;
import com.ccsens.health.persist.dao.HealthRecordsDao;
@ -78,10 +75,19 @@ public class UserService implements IUserService{
//获取个人信息和tall的userId
UserDto.UserInfo userInfo = params.getParam();
Long userId = params.getUserId();
//检查是否认证过
RealNameAuthExample realNameAuthExample = new RealNameAuthExample();
realNameAuthExample.createCriteria().andUserIdEqualTo(userId);
List<RealNameAuth> realNameAuthList = realNameAuthDao.selectByExample(realNameAuthExample);
if(CollectionUtil.isNotEmpty(realNameAuthList)){
//如果不为空代表已经认证过,直接返回认证信息
throw new BaseException(CodeEnum.ALREADY_REAL_AUTH);
}
//实名认证,检查是否属于该学校的学生
//保存信息
RealNameAuth realNameAuth = new RealNameAuth();
realNameAuth.setId(snowflake.nextId());
realNameAuth.setUserId(userId);
realNameAuth.setIdCard(userInfo.getIdCard());
realNameAuth.setName(userInfo.getName());
realNameAuth.setNo(userInfo.getNo());

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

@ -93,7 +93,7 @@
SELECT
count(*) as times
FROM
t_employee e LEFT JOIN t_health_records r on e.user_id = r.user_id
t_employee e LEFT JOIN t_health_records r on e.tall_user_id = r.user_id
where
r.time &lt;= #{endTime}
and

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

@ -14,8 +14,8 @@
s.id as sId,
c.user_id as sSiteName,
c.time as sTime,
s.district as sLongitude,
s.address as sLatitude
s.longitude as sLongitude,
s.latitude as sLatitude
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
where
@ -29,20 +29,15 @@
ORDER By c.time DESC
</select>
<select id="selectByTypeId" parameterType="java.util.Map" resultType="int">
<select id="getClockInNumberBySiteId" parameterType="java.util.Map" resultType="int">
select
COUNT(*)
from
t_health_records h
t_site_qrcode q RIGHT JOIN t_site_clock_in c on q.id = c.qrcode_id
where
h.rec_status = 0
and
h.health_type_id = #{healthTypeId}
and
h.time &lt;= #{endTime}
c.rec_status = 0
and
h.time &gt;= #{startTime}
q.site_id = #{siteId}
</select>
</mapper>

5
util/src/main/java/com/ccsens/util/CodeEnum.java

@ -94,8 +94,9 @@ public enum CodeEnum {
NOT_SIGN_FIELD(77,"签到的字段不可用",true),
ALREADY_SIGN(78,"您已经签到过了,请勿重复签到",true),
ALREADY_ATTENTION(79,"您已经关注了这个项目",true),
NOT_EMPLOYEE(79,"未找到成员信息",true),
NOT_SITE(79,"未找到该场所",true)
NOT_EMPLOYEE(80,"未找到成员信息",true),
NOT_SITE(81,"未找到该场所",true),
ALREADY_REAL_AUTH(81,"未找到该场所",true)
;
public CodeEnum addMsg(String msg){

Loading…
Cancel
Save