|
|
@ -48,6 +48,7 @@ public class ClockService implements IClockService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 场景扫码打卡 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
*/ |
|
|
|
@Override |
|
|
@ -69,6 +70,7 @@ public class ClockService implements IClockService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 查看打卡记录 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -79,19 +81,20 @@ public class ClockService implements IClockService { |
|
|
|
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()); |
|
|
|
if(StrUtil.isEmpty(userId)){ |
|
|
|
if (StrUtil.isEmpty(userId)) { |
|
|
|
throw new BaseException(CodeEnum.NOT_LOGIN); |
|
|
|
} |
|
|
|
// //2、通过userid查询出成员id
|
|
|
|
// Employee employee = userService.getEmployeeByUserId(Long.valueOf(userId));
|
|
|
|
//3、查询该成员符合时间的记录
|
|
|
|
List<ClockVo.SiteClockInfo> siteClockInfoList = siteClockInDao.selectHealthInfoByDate(Long.valueOf(userId),startTime,endTime); |
|
|
|
List<ClockVo.SiteClockInfo> siteClockInfoList = siteClockInDao.selectHealthInfoByDate(Long.valueOf(userId), startTime, endTime); |
|
|
|
//4、返回
|
|
|
|
return siteClockInfoList; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 场所扫码统计 |
|
|
|
* |
|
|
|
* @param |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -107,10 +110,10 @@ public class ClockService implements IClockService { |
|
|
|
SiteExample siteExample = new SiteExample(); |
|
|
|
siteExample.createCriteria().andParentCodeEqualTo("SXDX"); |
|
|
|
List<Site> siteList = siteDao.selectByExample(siteExample); |
|
|
|
if(CollectionUtil.isNotEmpty(siteList)){ |
|
|
|
for(Site site:siteList){ |
|
|
|
if (CollectionUtil.isNotEmpty(siteList)) { |
|
|
|
for (Site site : siteList) { |
|
|
|
//2、获取场景的二维码(包括进出),查找每个二维码下的打卡记录
|
|
|
|
int number = siteClockInDao.getClockInNumberBySiteId(site.getId(),startTime,endTime); |
|
|
|
int number = siteClockInDao.getClockInNumberBySiteId(site.getId(), startTime, endTime); |
|
|
|
ClockVo.SiteClockStatistics siteClockStatistics = new ClockVo.SiteClockStatistics(); |
|
|
|
siteClockStatistics.setSiteId(site.getId()); |
|
|
|
siteClockStatistics.setSiteName(site.getSiteName()); |
|
|
@ -126,6 +129,7 @@ public class ClockService implements IClockService { |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取场所的二维码 |
|
|
|
* |
|
|
|
* @param params |
|
|
|
* @return |
|
|
|
*/ |
|
|
@ -135,7 +139,7 @@ public class ClockService implements IClockService { |
|
|
|
JourneyDto.CreateQRCode createQRCode = params.getParam(); |
|
|
|
//根据id查找场馆信息
|
|
|
|
Site site = siteDao.selectByPrimaryKey(createQRCode.getId()); |
|
|
|
if(ObjectUtil.isNull(site)){ |
|
|
|
if (ObjectUtil.isNull(site)) { |
|
|
|
throw new BaseException(CodeEnum.NOT_SITE); |
|
|
|
} |
|
|
|
//查询已生成的二维码
|
|
|
@ -144,9 +148,9 @@ public class ClockService implements IClockService { |
|
|
|
.andOutOrInEqualTo((byte) createQRCode.getType()); |
|
|
|
List<SiteQrcode> siteQrcodeList = siteQrcodeDao.selectByExample(siteQrcodeExample); |
|
|
|
//如果有,直接返回
|
|
|
|
if(CollectionUtil.isNotEmpty(siteQrcodeList)){ |
|
|
|
if (CollectionUtil.isNotEmpty(siteQrcodeList)) { |
|
|
|
qrcodePath = siteQrcodeList.get(0).getQrcodePath(); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
//否则新加一条
|
|
|
|
//添加场所二维码记录
|
|
|
|
SiteQrcode siteQrcode = new SiteQrcode(); |
|
|
@ -156,9 +160,9 @@ public class ClockService implements IClockService { |
|
|
|
|
|
|
|
//生成二维码
|
|
|
|
String fileName = "/qrCode/" + cn.hutool.core.date.DateUtil.today() + "/" + System.currentTimeMillis() + ".png"; |
|
|
|
String path = WebConstant.UPLOAD_PATH_BASE+fileName; |
|
|
|
String path = WebConstant.UPLOAD_PATH_BASE + fileName; |
|
|
|
WxXcxUtil.getWxCode(WebConstant.QRCODE_SITE |
|
|
|
,"d="+siteQrcode.getId()+"&t="+createQRCode.getType(),null,path); |
|
|
|
, "d=" + siteQrcode.getId() + "&t=" + createQRCode.getType(), null, path); |
|
|
|
qrcodePath = WebConstant.TEST_URL_BASE_HEALTH + fileName; |
|
|
|
siteQrcode.setQrcodePath(qrcodePath); |
|
|
|
//添加数据库
|
|
|
@ -186,20 +190,21 @@ public class ClockService implements IClockService { |
|
|
|
@Override |
|
|
|
public ClockVo.SiteInfo getSiteInfoById(Long siteQrcodeId) { |
|
|
|
SiteQrcode siteQrcode = siteQrcodeDao.selectByPrimaryKey(siteQrcodeId); |
|
|
|
Site site = new Site(); |
|
|
|
if(ObjectUtil.isNotNull(siteQrcode)) { |
|
|
|
site = siteDao.selectByPrimaryKey(siteQrcode.getSiteId()); |
|
|
|
if (ObjectUtil.isNull(siteQrcode)) { |
|
|
|
throw new BaseException(CodeEnum.NOT_SITE); |
|
|
|
} |
|
|
|
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()); |
|
|
|
Site site = siteDao.selectByPrimaryKey(siteQrcode.getSiteId()); |
|
|
|
if (ObjectUtil.isNull(site)) { |
|
|
|
throw new BaseException(CodeEnum.NOT_SITE); |
|
|
|
} |
|
|
|
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; |
|
|
|
} |
|
|
|
} |
|
|
|