|
|
@ -20,6 +20,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; |
|
|
|
|
|
|
@ -127,7 +128,7 @@ public class ClockService implements IClockService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public String getQRCode(QueryDto<JourneyDto.CreateQRCode> params) throws IOException { |
|
|
|
public String getQRCode(QueryDto<JourneyDto.CreateQRCode> params) throws Exception { |
|
|
|
String qrcodePath = null; |
|
|
|
JourneyDto.CreateQRCode createQRCode = params.getParam(); |
|
|
|
//根据id查找场馆信息
|
|
|
@ -150,14 +151,13 @@ public class ClockService implements IClockService { |
|
|
|
siteQrcode.setId(snowflake.nextId()); |
|
|
|
siteQrcode.setSiteId(createQRCode.getId()); |
|
|
|
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); |
|
|
|
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_SITE |
|
|
|
,"d="+siteQrcode.getId()+"&t="+createQRCode.getType(),null,path); |
|
|
|
qrcodePath = WebConstant.TEST_URL_BASE_HEALTH + fileName; |
|
|
|
siteQrcode.setQrcodePath(qrcodePath); |
|
|
|
//添加数据库
|
|
|
|
siteQrcodeDao.insertSelective(siteQrcode); |
|
|
@ -174,4 +174,22 @@ public class ClockService implements IClockService { |
|
|
|
List<Site> siteList = siteDao.selectByExample(siteExample); |
|
|
|
return siteList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public ClockVo.SiteInfo getSiteInfoById(Long siteQrcodeId) { |
|
|
|
SiteQrcode siteQrcode = siteQrcodeDao.selectByPrimaryKey(siteQrcodeId); |
|
|
|
Site site = new Site(); |
|
|
|
if(ObjectUtil.isNotNull(siteQrcode)) { |
|
|
|
site = siteDao.selectByPrimaryKey(siteQrcode.getId()); |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|