|
|
@ -1,15 +1,30 @@ |
|
|
|
package com.ccsens.health.service; |
|
|
|
|
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.ccsens.health.bean.dto.ClockDto; |
|
|
|
import com.ccsens.health.bean.dto.JourneyDto; |
|
|
|
import com.ccsens.health.bean.po.Site; |
|
|
|
import com.ccsens.health.bean.po.SiteQrcode; |
|
|
|
import com.ccsens.health.bean.vo.ClockVo; |
|
|
|
import com.ccsens.health.persist.dao.SiteDao; |
|
|
|
import com.ccsens.util.CodeEnum; |
|
|
|
import com.ccsens.util.QrCodeUtil; |
|
|
|
import com.ccsens.util.WebConstant; |
|
|
|
import com.ccsens.util.bean.dto.QueryDto; |
|
|
|
import com.ccsens.util.exception.BaseException; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class ClockService implements IClockService { |
|
|
|
@Autowired |
|
|
|
private SiteDao siteDao; |
|
|
|
@Autowired |
|
|
|
private Snowflake snowflake; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -18,7 +33,7 @@ public class ClockService implements IClockService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void siteClockIn(QueryDto<ClockDto.SiteDto> params) { |
|
|
|
|
|
|
|
//
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -40,4 +55,32 @@ public class ClockService implements IClockService { |
|
|
|
public List<ClockVo.SiteClockStatistics> getSiteClickStatistics(String date) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取场所的二维码 |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public String getQRCode(QueryDto<JourneyDto.CreateQRCode> params) throws IOException { |
|
|
|
JourneyDto.CreateQRCode createQRCode = params.getParam(); |
|
|
|
//根据id查找场馆信息
|
|
|
|
Site site = siteDao.selectByPrimaryKey(createQRCode.getId()); |
|
|
|
if(ObjectUtil.isNull(site)){ |
|
|
|
throw new BaseException(CodeEnum.NOT_SITE); |
|
|
|
} |
|
|
|
//添加场所二维码记录
|
|
|
|
SiteQrcode siteQrcode = new SiteQrcode(); |
|
|
|
siteQrcode.setId(snowflake.nextId()); |
|
|
|
siteQrcode.setOutOrIn((byte) createQRCode.getType()); |
|
|
|
String type = "in"; |
|
|
|
if(createQRCode.getType() == 1){ |
|
|
|
type = "out"; |
|
|
|
} |
|
|
|
//生成二维码
|
|
|
|
String qrcodeInfo = WebConstant.QRCODE_SITE + "?siteId=" + siteQrcode.getId() + "&scene=1011" + "&siteName="+site.getSiteCode()+"&type="+type; |
|
|
|
String path = QrCodeUtil.urlToQRCode(qrcodeInfo,WebConstant.UPLOAD_PATH_BASE_HEALTH); |
|
|
|
String qrcodePath = WebConstant.TEST_URL_BASE_HEALTH + path; |
|
|
|
return qrcodePath; |
|
|
|
} |
|
|
|
} |
|
|
|