Browse Source

0307v3.4

master
zhangye 5 years ago
parent
commit
42ed23371f
  1. 10
      health/src/main/java/com/ccsens/health/api/DebugController.java
  2. 2
      health/src/main/java/com/ccsens/health/bean/vo/ClockVo.java
  3. 4
      health/src/main/java/com/ccsens/health/bean/vo/HealthVo.java
  4. 2
      health/src/main/java/com/ccsens/health/persist/dao/SiteClockInDao.java
  5. 21
      health/src/main/java/com/ccsens/health/service/ClockService.java
  6. 34
      health/src/main/java/com/ccsens/health/service/HealthService.java
  7. 2
      health/src/main/java/com/ccsens/health/service/IHealthService.java
  8. 4
      health/src/main/resources/mapper_dao/SiteClockInDao.xml

10
health/src/main/java/com/ccsens/health/api/DebugController.java

@ -33,11 +33,11 @@ public class DebugController {
@RequestMapping(value="qrcode",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
public JsonResponse qrcode(HttpServletRequest request) throws Exception {
WxXcxUtil.LineColor color = new WxXcxUtil.LineColor();
color.r = "129";
color.g = "216";
color.b = "65";
WxXcxUtil.getWxCode("pages/sign/sign"
,"d=1235756988936359936&t=0",color,"/home/cloud/tall/uploads/qrCode/2020-03-07/1583572671726.png");
color.r = "243";
color.g = "139";
color.b = "0";
WxXcxUtil.getWxCode("pages/usercode/usercode"
,"d=1217647686598135808",color,"/home/cloud/tall/uploads/qrCode/2020-03-07/158357267174.png");
return JsonResponse.newInstance().ok("完成");
}
}

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

@ -58,7 +58,7 @@ public class ClockVo {
}
@Data
@ApiModel("获取个人打卡记录")
@ApiModel("获取所有场所信息")
public static class SiteList{
@ApiModelProperty("场景id")
private Long id;

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

@ -36,10 +36,12 @@ public class HealthVo {
private int healthLevel;
@ApiModelProperty("健康码")
private String healthCode;
@ApiModelProperty("健康状态名字")
private String healthTypeName;
}
@Data
@ApiModel("健康状态")
@ApiModel("健康状态类型")
public static class HealthTypeVo{
@ApiModelProperty("id")
private Long id;

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

@ -11,5 +11,5 @@ import java.util.List;
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);
int getClockInNumberBySiteId(@Param("siteId")Long siteId, @Param("startTime")Long startTime, @Param("endTime")Long endTime);
}

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

@ -110,7 +110,7 @@ public class ClockService implements IClockService {
if(CollectionUtil.isNotEmpty(siteList)){
for(Site site:siteList){
//2、获取场景的二维码(包括进出),查找每个二维码下的打卡记录
int number = siteClockInDao.getClockInNumberBySiteId(site.getId());
int number = siteClockInDao.getClockInNumberBySiteId(site.getId(),startTime,endTime);
ClockVo.SiteClockStatistics siteClockStatistics = new ClockVo.SiteClockStatistics();
siteClockStatistics.setSiteId(site.getId());
siteClockStatistics.setSiteName(site.getSiteName());
@ -188,15 +188,18 @@ public class ClockService implements IClockService {
SiteQrcode siteQrcode = siteQrcodeDao.selectByPrimaryKey(siteQrcodeId);
Site site = new Site();
if(ObjectUtil.isNotNull(siteQrcode)) {
site = siteDao.selectByPrimaryKey(siteQrcode.getId());
site = siteDao.selectByPrimaryKey(siteQrcode.getSiteId());
}
ClockVo.SiteInfo siteInfo = null;
if(ObjectUtil.isNotNull(site)) {
siteInfo = new ClockVo.SiteInfo();
siteInfo.setId(site.getId());
siteInfo.setSiteCode(site.getSiteCode());
siteInfo.setSiteName(site.getSiteName());
siteInfo.setLongitude(site.getLongitude());
siteInfo.setLatitude(site.getLatitude());
siteInfo.setType(siteQrcode.getOutOrIn());
}
ClockVo.SiteInfo siteInfo = new ClockVo.SiteInfo();
siteInfo.setId(site.getId());
siteInfo.setSiteCode(site.getSiteCode());
siteInfo.setSiteName(site.getSiteName());
siteInfo.setLongitude(site.getLongitude());
siteInfo.setLatitude(site.getLatitude());
siteInfo.setType(siteQrcode.getOutOrIn());
return siteInfo;
}
}

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

@ -19,6 +19,7 @@ import com.ccsens.util.QrCodeUtil;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -48,7 +49,8 @@ public class HealthService implements IHealthService{
* @return
*/
@Override
public HealthVo.HealthInfo addHealthInfo(QueryDto<HealthDto.healthInfo> params) throws IOException {
public HealthVo.HealthInfo addHealthInfo(QueryDto<HealthDto.healthInfo> params) throws Exception {
HealthVo.HealthInfo healthInfoVo = new HealthVo.HealthInfo();
//1、获取健康信息和userId
HealthDto.healthInfo healthInfo = params.getParam();
Long userId = params.getUserId();
@ -59,10 +61,33 @@ public class HealthService implements IHealthService{
healthRecords.setUserId(userId);
BeanUtil.copyProperties(healthInfo,healthRecords);
healthRecordsDao.insertSelective(healthRecords);
//健康码颜色(默认绿色)
WxXcxUtil.LineColor color = new WxXcxUtil.LineColor();
color.r = "134";
color.g = "219";
color.b = "71";
healthInfoVo.setHealthLevel(0);
//获取健康状态
HealthType healthType = healthTypeDao.selectByPrimaryKey(healthInfo.getHealthTypeId());
if(ObjectUtil.isNotNull(healthType)){
//如果健康状态异常,健康码为橙色
if(healthType.getQuarantine() != 0){
color.r = "243";
color.g = "139";
color.b = "0";
healthInfoVo.setHealthLevel(0);
}
healthInfoVo.setHealthTypeName(healthType.getName());
}
//TODO 4、生成健康码,返回地址
String qrcodeInfo = WebConstant.QRCODE_HEALTH + "?token=" + healthInfo.getToken() + "&scene=1011";
String path = QrCodeUtil.urlToQRCode(qrcodeInfo,WebConstant.UPLOAD_PATH_BASE);
String qrcodePath = WebConstant.TEST_URL_BASE_HEALTH + path;
String fileName = "/qrCode/" + cn.hutool.core.date.DateUtil.today() + "/" + System.currentTimeMillis() + ".png";
String path = WebConstant.UPLOAD_PATH_BASE+fileName;
WxXcxUtil.getWxCode(WebConstant.QRCODE_HEALTH
,"d="+userId,color,path);
String qrcodePath = WebConstant.TEST_URL_BASE_HEALTH + fileName;
//5、将健康码信息存入数据库
HealthQRCode healthQRCode = new HealthQRCode();
healthQRCode.setId(snowflake.nextId());
@ -72,7 +97,6 @@ public class HealthService implements IHealthService{
healthQRCode.setTime(System.currentTimeMillis());
healthQRCodeDao.insertSelective(healthQRCode);
//6、查询健康信息和健康码地址返回前端
HealthVo.HealthInfo healthInfoVo = new HealthVo.HealthInfo();
BeanUtil.copyProperties(healthRecords,healthInfoVo);
healthInfoVo.setUserId(userId);
healthInfoVo.setHealthCode(qrcodePath);

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

@ -9,7 +9,7 @@ import java.io.IOException;
import java.util.List;
public interface IHealthService {
HealthVo.HealthInfo addHealthInfo(QueryDto<HealthDto.healthInfo> params) throws IOException;
HealthVo.HealthInfo addHealthInfo(QueryDto<HealthDto.healthInfo> params) throws Exception;
List<HealthVo.HealthInfo> getHealthInfo(QueryDto<JourneyDto.SelectDate> params) throws Exception;

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

@ -38,6 +38,10 @@
c.rec_status = 0
and
q.site_id = #{siteId}
and
c.time &lt;= #{endTime}
and
c.time &gt;= #{startTime}
</select>
</mapper>
Loading…
Cancel
Save