Browse Source

0308.1

master
zhangye 5 years ago
parent
commit
ceba838ae8
  1. 3
      health/src/main/java/com/ccsens/health/api/DebugController.java
  2. 49
      health/src/main/java/com/ccsens/health/service/ClockService.java
  3. 29
      util/src/main/java/com/ccsens/util/wx/WxXcxUtil.java

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

@ -38,6 +38,9 @@ public class DebugController {
color.b = "0";
WxXcxUtil.getWxCode("pages/user-code/user-code"
,"d=1217647686598135808",color,"/home/cloud/tall/uploads/qrCode/2020-03-07/158357267174.png");
// WxXcxUtil.getWxCodeTest("pages/user-code/user-code?d=1217647686598135808"
// ,"d=1217647686598135808",color,"/home/cloud/tall/uploads/qrCode/2020-03-07/158357267174.png");
return JsonResponse.newInstance().ok("完成");
}
}

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

@ -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;
}
}

29
util/src/main/java/com/ccsens/util/wx/WxXcxUtil.java

@ -64,6 +64,7 @@ public class WxXcxUtil {
public static class WechatCode{
public String scene;
public String page;
// public String path;
public Integer width;
public Boolean auto_color;
public LineColor line_color;
@ -74,6 +75,14 @@ public class WxXcxUtil {
public String g;
public String b;
}
public static class WechatCodeA{
public String path;
public Integer width;
public Boolean auto_color;
public LineColor line_color;
public Boolean is_hyaline;
}
/**
* Prepare pay
*/
@ -231,6 +240,7 @@ public class WxXcxUtil {
WechatCode wechatCode = new WechatCode();
wechatCode.page = page;
wechatCode.scene = scene;
// wechatCode.path = page+"?"+scene;
wechatCode.line_color = color;
@ -239,6 +249,25 @@ public class WxXcxUtil {
HttpsUtil.httpsRequest(url,"POST",postStr,path);
}
// /**
// * 获取小程序二维码/小程序码
// * @return
// * @throws Exception
// */
// public static void getWxCodeTest(String page,String scene,LineColor color,String path) throws Exception {
// String url = String.format(URL_GET_WX_CODE_C, WxGzhUtil.getAccessToken());
//
// WechatCodeA wechatCodeA = new WechatCodeA();
// wechatCodeA.path = page;
//// wechatCode.path = page+"?"+scene;
//
//// WechatCodeA.line_color = color;
//
// String postStr = JacksonUtil.beanToJson(wechatCodeA);
// System.out.println(postStr);
// HttpsUtil.httpsRequest(url,"POST",postStr,path);
// }
/**
* 统一下单
*/

Loading…
Cancel
Save