diff --git a/ct/src/main/java/com/ccsens/ct/api/SiteController.java b/ct/src/main/java/com/ccsens/ct/api/SiteController.java index d6403e44..ce324678 100644 --- a/ct/src/main/java/com/ccsens/ct/api/SiteController.java +++ b/ct/src/main/java/com/ccsens/ct/api/SiteController.java @@ -64,7 +64,7 @@ public class SiteController { @RequestMapping(value = "siteAll", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse selectSiteAllByBusinessId(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("透过商户id查看所有场所的信息:{}",params); - SiteVo.SiteInfoVo siteInfoVo = siteService.selectSiteAllByBusinessId(params); + SiteVo.SiteInfoVo siteInfoVo = siteService.selectSiteAllByBusinessId(params.getParam().getId()); return JsonResponse.newInstance().ok(siteInfoVo); } diff --git a/ct/src/main/java/com/ccsens/ct/bean/dto/SiteDto.java b/ct/src/main/java/com/ccsens/ct/bean/dto/SiteDto.java index 0b29541e..86361aab 100644 --- a/ct/src/main/java/com/ccsens/ct/bean/dto/SiteDto.java +++ b/ct/src/main/java/com/ccsens/ct/bean/dto/SiteDto.java @@ -17,12 +17,19 @@ public class SiteDto { @ApiModelProperty("所属商户id") @NotNull(message = "商户id不能为空") private Long id; - @ApiModelProperty("场所信息") - private List siteInfo; + @ApiModelProperty("场所名") + @NotEmpty(message = "场所名不能为空") + private String siteName; + @ApiModelProperty("经度") + private BigDecimal longitude; + @ApiModelProperty("纬度") + private BigDecimal latitude; +// @ApiModelProperty("场所信息") +// private List siteInfo; } @Data - @ApiModel("添加场所") + @ApiModel("添加时场所信息") public static class SiteInfo{ @ApiModelProperty("场所名") @NotEmpty(message = "场所名不能为空") diff --git a/ct/src/main/java/com/ccsens/ct/service/ISiteService.java b/ct/src/main/java/com/ccsens/ct/service/ISiteService.java index 38a1e46a..7fd7fdf0 100644 --- a/ct/src/main/java/com/ccsens/ct/service/ISiteService.java +++ b/ct/src/main/java/com/ccsens/ct/service/ISiteService.java @@ -15,7 +15,7 @@ public interface ISiteService { SiteVo.SiteInfo updateSiteInfo(QueryDto params); - SiteVo.SiteInfoVo selectSiteAllByBusinessId(QueryDto params); + SiteVo.SiteInfoVo selectSiteAllByBusinessId(Long businessId); String downloadQrCode(Long businessId); } diff --git a/ct/src/main/java/com/ccsens/ct/service/SiteService.java b/ct/src/main/java/com/ccsens/ct/service/SiteService.java index f7939bab..bb093538 100644 --- a/ct/src/main/java/com/ccsens/ct/service/SiteService.java +++ b/ct/src/main/java/com/ccsens/ct/service/SiteService.java @@ -48,24 +48,24 @@ public class SiteService implements ISiteService { List siteInfos = new ArrayList<>(); SiteDto.SiteInfoDto siteInfoDto = params.getParam(); - if (CollectionUtil.isNotEmpty(siteInfoDto.getSiteInfo())){ - if(siteInfoDto.getSiteInfo().size() > 5){ - throw new BaseException(CodeEnum.SITE_EXCEED); - } +// if (CollectionUtil.isNotEmpty(siteInfoDto.getSiteInfo())){ +// if(siteInfoDto.getSiteInfo().size() > 5){ +// throw new BaseException(CodeEnum.SITE_EXCEED); +// } //查找该商户下已有场所 SiteExample siteExample = new SiteExample(); siteExample.createCriteria().andBusinessIdEqualTo(siteInfoDto.getId()); List siteList = siteDao.selectByExample(siteExample); //目前一个商户只能添加五个场所 if(CollectionUtil.isNotEmpty(siteList)) { - if (siteInfoDto.getSiteInfo().size() + siteList.size() > 5) { + if (siteList.size() >= 5) { throw new BaseException(CodeEnum.SITE_EXCEED); } } //添加场所 - for (SiteDto.SiteInfo siteInfo : siteInfoDto.getSiteInfo()) { +// for (SiteDto.SiteInfo siteInfo : siteInfoDto.getSiteInfo()) { SiteExample siteName = new SiteExample(); - siteName.createCriteria().andBusinessIdEqualTo(siteInfoDto.getId()).andSiteNameEqualTo(siteInfo.getSiteName()); + siteName.createCriteria().andBusinessIdEqualTo(siteInfoDto.getId()).andSiteNameEqualTo(siteInfoDto.getSiteName()); List sites = siteDao.selectByExample(siteName); if(CollectionUtil.isNotEmpty(sites)){ throw new BaseException(CodeEnum.SITE_NAME_REPETITION); @@ -74,9 +74,9 @@ public class SiteService implements ISiteService { Site site = new Site(); site.setId(snowflake.nextId()); site.setBusinessId(siteInfoDto.getId()); - site.setSiteName(siteInfo.getSiteName()); - site.setLongitude(siteInfo.getLongitude()); - site.setLatitude(siteInfo.getLatitude()); + site.setSiteName(siteInfoDto.getSiteName()); + site.setLongitude(siteInfoDto.getLongitude()); + site.setLatitude(siteInfoDto.getLatitude()); siteDao.insertSelective(site); String path = WebConstant.UPLOAD_PATH_BASE + "/business/" + siteInfoDto.getId() + "/siteqrcode/" + site.getSiteName(); @@ -102,29 +102,31 @@ public class SiteService implements ISiteService { outSiteQrcode.setQrcodePath(WebConstant.TEST_URL_BASE_CT +"/business/" + siteInfoDto.getId() + "/siteqrcode/" + site.getSiteName() + "/out/" + outFileName); outSiteQrcode.setBigQrcodePath(WebConstant.TEST_URL_BASE_CT + "/business/" + siteInfoDto.getId() + "/siteqrcode/" + site.getSiteName() + "/out/" + bigOutFileName); siteQrcodeDao.insertSelective(outSiteQrcode); - //获取返回的场所信息 - SiteVo.SiteInfo siteInfo1 = new SiteVo.SiteInfo(); - siteInfo1.setId(site.getId()); - siteInfo1.setName(site.getSiteName()); - siteInfo1.setLongitude(site.getLongitude()); - siteInfo1.setLatitude(site.getLatitude()); - siteInfo1.setInQrCode(inSiteQrcode.getQrcodePath()); - siteInfo1.setOutQrCode(outSiteQrcode.getQrcodePath()); - siteInfos.add(siteInfo1); - } - } +// //获取返回的场所信息 +//// SiteVo.SiteInfo siteInfo1 = new SiteVo.SiteInfo(); +//// siteInfo1.setId(site.getId()); +//// siteInfo1.setName(site.getSiteName()); +//// siteInfo1.setLongitude(site.getLongitude()); +//// siteInfo1.setLatitude(site.getLatitude()); +//// siteInfo1.setInQrCode(inSiteQrcode.getQrcodePath()); +//// siteInfo1.setOutQrCode(outSiteQrcode.getQrcodePath()); +//// siteInfos.add(siteInfo1); +// } +// } //生成场所二维码压缩包并返回下载路径 ZipUtil.zip(WebConstant.UPLOAD_PATH_BASE + "/business/" + siteInfoDto.getId() + "/siteqrcode",WebConstant.UPLOAD_PATH_BASE + "/business/" + siteInfoDto.getId() + "/QrCode.zip"); //查找商户信息 - Business business = businessDao.selectByPrimaryKey(siteInfoDto.getId()); - siteInfoVo.setBusinessId(business.getId()); - siteInfoVo.setBusinessName(business.getName()); - siteInfoVo.setSite(siteInfos); - siteInfoVo.setDownloadPath(WebConstant.TEST_URL_BASE_CT + "/business/" + siteInfoDto.getId() + "/QrCode.zip"); - siteInfoVo.setPath("http://test.tall.wiki/ct-dev/sign-history"); +// Business business = businessDao.selectByPrimaryKey(siteInfoDto.getId()); +// siteInfoVo.setBusinessId(business.getId()); +// siteInfoVo.setBusinessName(business.getName()); +// siteInfoVo.setSite(siteInfos); +// siteInfoVo.setDownloadPath(WebConstant.TEST_URL_BASE_CT + "/business/" + siteInfoDto.getId() + "/QrCode.zip"); +// siteInfoVo.setPath("http://test.tall.wiki/ct-dev/sign-history"); + + siteInfoVo = selectSiteAllByBusinessId(siteInfoDto.getId()); return siteInfoVo; } @@ -205,14 +207,14 @@ public class SiteService implements ISiteService { /** * 通过商户id查询所有的场所信息 * - * @param params + * @param businessId * @return */ @Override - public SiteVo.SiteInfoVo selectSiteAllByBusinessId(QueryDto params) { + public SiteVo.SiteInfoVo selectSiteAllByBusinessId(Long businessId) { SiteVo.SiteInfoVo siteInfoVo = new SiteVo.SiteInfoVo(); //获取商户信息 - Business business = businessDao.selectByPrimaryKey(params.getParam().getId()); + Business business = businessDao.selectByPrimaryKey(businessId); if (ObjectUtil.isNull(business)) { throw new BaseException(CodeEnum.NOT_BUSINESS); } @@ -220,6 +222,7 @@ public class SiteService implements ISiteService { siteInfoVo.setBusinessName(business.getName()); //TODO siteInfoVo.setPath("http://test.tall.wiki/ct-dev/sign-history"); + siteInfoVo.setDownloadPath(WebConstant.TEST_URL_BASE_CT + "/business/" + business.getId() + "/QrCode.zip"); //获取场所信息 List siteInfoList = new ArrayList<>(); SiteExample siteExample = new SiteExample(); diff --git a/health/src/main/java/com/ccsens/health/api/AbnormalController.java b/health/src/main/java/com/ccsens/health/api/AbnormalController.java index 013590e9..935ff6bf 100644 --- a/health/src/main/java/com/ccsens/health/api/AbnormalController.java +++ b/health/src/main/java/com/ccsens/health/api/AbnormalController.java @@ -41,10 +41,10 @@ public class AbnormalController { @MustLogin @ApiOperation(value = "异常人员添加", notes = "") @RequestMapping(value = "add", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse addAbnormal(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { + public JsonResponse addAbnormal(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("异常人员添加:{}",params); - abnormalService.addAbnormal(params); - return JsonResponse.newInstance().ok(); + AbnormalVo.AbnormalStatisticsVo abnormalStatisticsVo = abnormalService.addAbnormal(params); + return JsonResponse.newInstance().ok(abnormalStatisticsVo); } @MustLogin diff --git a/health/src/main/java/com/ccsens/health/api/ClockController.java b/health/src/main/java/com/ccsens/health/api/ClockController.java index e7fe5f45..d1daf172 100644 --- a/health/src/main/java/com/ccsens/health/api/ClockController.java +++ b/health/src/main/java/com/ccsens/health/api/ClockController.java @@ -71,7 +71,7 @@ public class ClockController { @ApiOperation(value = "通过二维码内的id获取场所的信息", notes = "") @RequestMapping(value = "site", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse getSiteInfoById(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { - log.info("获取所有场景信息"); + log.info("通过二维码内的id获取场所的信息"); ClockVo.SiteInfo siteInfo = clockService.getSiteInfoById(params.getParam().getId()); return JsonResponse.newInstance().ok(siteInfo); } @@ -79,19 +79,19 @@ public class ClockController { @MustLogin @ApiOperation(value = "生成场所二维码", notes = "") @RequestMapping(value = "qrCode", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse getQRCode(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { + public JsonResponse getQRCode(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("生成场所二维码"); - String codePath = clockService.getQRCode(params); + ClockVo.SiteList codePath = clockService.getQRCode(params); return JsonResponse.newInstance().ok(codePath); } @MustLogin @ApiOperation(value = "添加场所", notes = "") @RequestMapping(value = "addSite", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse addSite(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { + public JsonResponse addSite(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("添加场所:{}", params); - clockService.addSite(params.getParam().toSite()); - return JsonResponse.newInstance().ok(); + ClockVo.SiteList codePath = clockService.addSite(params.getParam().toSite()); + return JsonResponse.newInstance().ok(codePath); } @MustLogin diff --git a/health/src/main/java/com/ccsens/health/api/HealthController.java b/health/src/main/java/com/ccsens/health/api/HealthController.java index b248c41c..42f97aa7 100644 --- a/health/src/main/java/com/ccsens/health/api/HealthController.java +++ b/health/src/main/java/com/ccsens/health/api/HealthController.java @@ -70,7 +70,7 @@ public class HealthController { } @MustLogin - @ApiOperation(value = "健康类型统计", notes = "") + @ApiOperation(value = "健康信息统计", notes = "") @PostMapping("list") public JsonResponse> list(@RequestBody QueryDto params){ diff --git a/health/src/main/java/com/ccsens/health/api/JourneyController.java b/health/src/main/java/com/ccsens/health/api/JourneyController.java index beb8cfe6..d5c5e03b 100644 --- a/health/src/main/java/com/ccsens/health/api/JourneyController.java +++ b/health/src/main/java/com/ccsens/health/api/JourneyController.java @@ -52,10 +52,10 @@ public class JourneyController { @MustLogin @ApiOperation(value = "添加异常行程信息", notes = "") @RequestMapping(value = "addAbnormalJourney", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) - public JsonResponse addAbnormalJourney(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { + public JsonResponse addAbnormalJourney(@ApiParam @Validated @RequestBody QueryDto params) throws Exception { log.info("添加异常行程信息:{}",params); - journeyService.addAbnormalJourney(params); - return JsonResponse.newInstance().ok(); + JourneyVo.AddAbnormalJourney abnormalJourney = journeyService.addAbnormalJourney(params); + return JsonResponse.newInstance().ok(abnormalJourney); } @MustLogin diff --git a/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java b/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java index a7fe3d11..d262075b 100644 --- a/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java +++ b/health/src/main/java/com/ccsens/health/bean/dto/AbnormalDto.java @@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.math.BigDecimal; @@ -39,19 +40,18 @@ public class AbnormalDto { @Data @ApiModel("新增异常人员信息") public static class AddAbnormal{ - @NotNull + @NotEmpty @ApiModelProperty("学号") private String wkno; - @NotNull + @NotEmpty @ApiModelProperty("姓名") private String name; - @NotNull + @NotEmpty @ApiModelProperty("班级(所在机构)") private String department; @NotNull @ApiModelProperty("体温") private BigDecimal animalHeat; - @NotNull @ApiModelProperty("原因") private String reason; @NotNull diff --git a/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java b/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java index b427dcc6..cd2c589f 100644 --- a/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java +++ b/health/src/main/java/com/ccsens/health/bean/dto/JourneyDto.java @@ -8,6 +8,7 @@ import org.springframework.beans.BeanUtils; import javax.validation.constraints.Max; import javax.validation.constraints.Min; +import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; import java.math.BigDecimal; @@ -78,6 +79,8 @@ public class JourneyDto { public static class Query{ @ApiModelProperty("场所上级") private String parentCode = "SXDX"; + @ApiModelProperty("场所名称 不传则查询所有,传了就模糊查询符合条件的数据") + private String siteName; @ApiModelProperty("第几页") @Min(value = 1) private int pageNum = 1; @@ -93,7 +96,6 @@ public class JourneyDto { @NotNull @ApiModelProperty("场所名字") private String siteName; - @NotNull @ApiModelProperty("场所code") private String siteCode; @NotNull @@ -145,7 +147,7 @@ public class JourneyDto { @NotNull @ApiModelProperty("出行方式 0铁路 1飞机 2客运车辆 3自驾 4船 5其他") private int tripMode; - @NotNull + @NotEmpty @ApiModelProperty("车次号") private String carNo; @NotNull diff --git a/health/src/main/java/com/ccsens/health/bean/dto/UserDto.java b/health/src/main/java/com/ccsens/health/bean/dto/UserDto.java index 3f9e5c41..66c075f2 100644 --- a/health/src/main/java/com/ccsens/health/bean/dto/UserDto.java +++ b/health/src/main/java/com/ccsens/health/bean/dto/UserDto.java @@ -12,8 +12,8 @@ public class UserDto { public static class UserInfo{ @ApiModelProperty("姓名") private String name; - @ApiModelProperty("身份证号") - private String idCard; +// @ApiModelProperty("身份证号") +// private String idCard; @ApiModelProperty("身份 0学生 1老师 2工作人员") private int post; @ApiModelProperty("学号") diff --git a/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java b/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java index 2ce2b8b9..95dcb186 100644 --- a/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java +++ b/health/src/main/java/com/ccsens/health/bean/vo/AbnormalVo.java @@ -44,7 +44,7 @@ public class AbnormalVo { @ApiModel("异常人员统计返回") public static class AbnormalStatisticsVo{ @ApiModelProperty("id") - private String id; + private Long id; @ApiModelProperty("学号") private String wkno; @ApiModelProperty("姓名") diff --git a/health/src/main/java/com/ccsens/health/bean/vo/UserVo.java b/health/src/main/java/com/ccsens/health/bean/vo/UserVo.java index 5b587f8f..e1a74b74 100644 --- a/health/src/main/java/com/ccsens/health/bean/vo/UserVo.java +++ b/health/src/main/java/com/ccsens/health/bean/vo/UserVo.java @@ -39,6 +39,8 @@ public class UserVo { public static class HealthCode{ @ApiModelProperty("打卡时间") private Long time; + @JsonIgnore//健康状态id + private Long healthTypeId; @ApiModelProperty("健康码等级 0正常 1隔离中或疑似 2确诊") private int healthLevel; @ApiModelProperty("健康码") @@ -67,10 +69,12 @@ public class UserVo { private Long id; @ApiModelProperty("场所名称") private String name; - @ApiModelProperty("打卡时间") + @ApiModelProperty("进场打卡时间") private Long time; - @ApiModelProperty("打卡类型 0进 1出") - private int type; + @ApiModelProperty("出场打卡时间") + private Long outTime; +// @ApiModelProperty("打卡类型 0进 1出") +// private int type; } } diff --git a/health/src/main/java/com/ccsens/health/persist/dao/JourneyAbnormalDao.java b/health/src/main/java/com/ccsens/health/persist/dao/JourneyAbnormalDao.java index 335b54ff..a4a78c08 100644 --- a/health/src/main/java/com/ccsens/health/persist/dao/JourneyAbnormalDao.java +++ b/health/src/main/java/com/ccsens/health/persist/dao/JourneyAbnormalDao.java @@ -9,5 +9,5 @@ import java.util.List; @Repository public interface JourneyAbnormalDao extends JourneyAbnormalMapper { - List selectAbnormalJourney(@Param("carNo") String carNo, @Param("tripMode") int tripMode, @Param("startTime") Long startTime, @Param("endTime") Long endTime); + List selectAbnormalJourney(@Param("carNo") String carNo, @Param("tripMode") Integer tripMode, @Param("startTime") Long startTime, @Param("endTime") Long endTime); } diff --git a/health/src/main/java/com/ccsens/health/service/AbnormalService.java b/health/src/main/java/com/ccsens/health/service/AbnormalService.java index 1165e588..93ec5792 100644 --- a/health/src/main/java/com/ccsens/health/service/AbnormalService.java +++ b/health/src/main/java/com/ccsens/health/service/AbnormalService.java @@ -64,12 +64,16 @@ public class AbnormalService implements IAbnormalService{ * @param params */ @Override - public void addAbnormal(QueryDto params) { + public AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto params) { AbnormalDto.AddAbnormal addAbnormal = params.getParam(); HealthAbnormal healthAbnormal = new HealthAbnormal(); healthAbnormal.setId(snowflake.nextId()); BeanUtil.copyProperties(addAbnormal,healthAbnormal); healthAbnormalDao.insertSelective(healthAbnormal); + + AbnormalVo.AbnormalStatisticsVo abnormalStatisticsVo = new AbnormalVo.AbnormalStatisticsVo(); + BeanUtil.copyProperties(healthAbnormal,abnormalStatisticsVo); + return abnormalStatisticsVo; } /** diff --git a/health/src/main/java/com/ccsens/health/service/ClockService.java b/health/src/main/java/com/ccsens/health/service/ClockService.java index a42f87b7..9bcb3bd6 100644 --- a/health/src/main/java/com/ccsens/health/service/ClockService.java +++ b/health/src/main/java/com/ccsens/health/service/ClockService.java @@ -74,7 +74,7 @@ public class ClockService implements IClockService { } //判断经纬度是否正确 - boolean inCircle = DistanceUtil.isInCircle(site.getLongitude(), site.getLatitude(), clickIn.getLocationLongitude(), clickIn.getLocationLatitude(), "0.05"); + boolean inCircle = DistanceUtil.isInCircle(site.getLongitude(), site.getLatitude(), clickIn.getLocationLongitude(), clickIn.getLocationLatitude(), "1"); log.info("是否在半径内:{}", inCircle); if (!inCircle) { throw new BaseException(CodeEnum.LOCATION_LONG); @@ -232,7 +232,9 @@ public class ClockService implements IClockService { * @return */ @Override - public String getQRCode(QueryDto params) throws Exception { + public ClockVo.SiteList getQRCode(QueryDto params) throws Exception { + ClockVo.SiteList siteVo = new ClockVo.SiteList(); + String qrcodePath = null; JourneyDto.CreateQRCode createQRCode = params.getParam(); //根据id查找场馆信息 @@ -266,8 +268,31 @@ public class ClockService implements IClockService { //添加数据库 siteQrcodeDao.insertSelective(siteQrcode); } + //返回的信息 + siteVo.setId(site.getId()); + siteVo.setSiteName(site.getSiteName()); + siteVo.setSiteCode(site.getSiteCode()); + siteVo.setLongitude(site.getLongitude()); + siteVo.setLatitude(site.getLatitude()); + //二维码 + int a = createQRCode.getType() == 0 ? 1 : 0; + SiteQrcodeExample url = new SiteQrcodeExample(); + url.createCriteria().andSiteIdEqualTo(createQRCode.getId()) + .andOutOrInEqualTo((byte) a); + List siteQrcodes = siteQrcodeDao.selectByExample(url); + if(a == 0){ + siteVo.setOutUrl(qrcodePath); + if(CollectionUtil.isNotEmpty(siteQrcodes)){ + siteVo.setInUrl(siteQrcodes.get(0).getQrcodePath()); + } + }else { + siteVo.setInUrl(qrcodePath); + if(CollectionUtil.isNotEmpty(siteQrcodes)){ + siteVo.setOutUrl(siteQrcodes.get(0).getQrcodePath()); + } + } - return qrcodePath; + return siteVo; } @@ -280,9 +305,27 @@ public class ClockService implements IClockService { @Override - public void addSite(Site site) { + public ClockVo.SiteList addSite(Site site) { + + //验证场所名是否重复 + SiteExample siteExample = new SiteExample(); + siteExample.createCriteria().andParentCodeEqualTo(site.getParentCode()).andSiteNameEqualTo(site.getSiteName()); + List siteList = siteDao.selectByExample(siteExample); + if(CollectionUtil.isNotEmpty(siteList)){ + throw new BaseException(CodeEnum.SITE_NAME_REPETITION); + } site.setId(snowflake.nextId()); siteDao.insertSelective(site); + + //返回的信息 + ClockVo.SiteList siteVo = new ClockVo.SiteList(); + siteVo.setId(site.getId()); + siteVo.setSiteName(site.getSiteName()); + siteVo.setSiteCode(site.getSiteCode()); + siteVo.setLongitude(site.getLongitude()); + siteVo.setLatitude(site.getLatitude()); + + return siteVo; } /** diff --git a/health/src/main/java/com/ccsens/health/service/IAbnormalService.java b/health/src/main/java/com/ccsens/health/service/IAbnormalService.java index 9f03659f..8ac9b932 100644 --- a/health/src/main/java/com/ccsens/health/service/IAbnormalService.java +++ b/health/src/main/java/com/ccsens/health/service/IAbnormalService.java @@ -9,7 +9,7 @@ import java.util.List; public interface IAbnormalService { List abnormalOverview(QueryDto params) throws Exception; - void addAbnormal(QueryDto params); + AbnormalVo.AbnormalStatisticsVo addAbnormal(QueryDto params); List abnormalStatistics(QueryDto params); diff --git a/health/src/main/java/com/ccsens/health/service/IClockService.java b/health/src/main/java/com/ccsens/health/service/IClockService.java index b90ca3ff..810fc4b7 100644 --- a/health/src/main/java/com/ccsens/health/service/IClockService.java +++ b/health/src/main/java/com/ccsens/health/service/IClockService.java @@ -17,13 +17,13 @@ public interface IClockService { List getSiteClickStatistics(QueryDto params) throws Exception; - String getQRCode(QueryDto params) throws Exception; + ClockVo.SiteList getQRCode(QueryDto params) throws Exception; PageInfo getAllSiteInfo(JourneyDto.Query query); ClockVo.SiteInfo getSiteInfoById(Long id); - void addSite(Site site); + ClockVo.SiteList addSite(Site site); void delSite(Long id); diff --git a/health/src/main/java/com/ccsens/health/service/IJourneyService.java b/health/src/main/java/com/ccsens/health/service/IJourneyService.java index 65647758..92518f8f 100644 --- a/health/src/main/java/com/ccsens/health/service/IJourneyService.java +++ b/health/src/main/java/com/ccsens/health/service/IJourneyService.java @@ -13,7 +13,7 @@ public interface IJourneyService { List getJourney(QueryDto params) throws Exception; - void addAbnormalJourney(QueryDto params); + JourneyVo.AddAbnormalJourney addAbnormalJourney(QueryDto params); List selectAbnormalJourney(QueryDto params) throws Exception; diff --git a/health/src/main/java/com/ccsens/health/service/JourneyService.java b/health/src/main/java/com/ccsens/health/service/JourneyService.java index 1ad32232..f32a9274 100644 --- a/health/src/main/java/com/ccsens/health/service/JourneyService.java +++ b/health/src/main/java/com/ccsens/health/service/JourneyService.java @@ -152,12 +152,16 @@ public class JourneyService implements IJourneyService{ * @param params */ @Override - public void addAbnormalJourney(QueryDto params) { + public JourneyVo.AddAbnormalJourney addAbnormalJourney(QueryDto params) { JourneyDto.AddAbnormalJourney addAbnormalJourney = params.getParam(); JourneyAbnormal journeyAbnormal = new JourneyAbnormal(); BeanUtil.copyProperties(addAbnormalJourney,journeyAbnormal); journeyAbnormal.setId(snowflake.nextId()); journeyAbnormalDao.insertSelective(journeyAbnormal); + + JourneyVo.AddAbnormalJourney abnormalJourney = new JourneyVo.AddAbnormalJourney(); + BeanUtil.copyProperties(journeyAbnormal,abnormalJourney); + return abnormalJourney; } /** @@ -168,12 +172,13 @@ public class JourneyService implements IJourneyService{ @Override public List selectAbnormalJourney(QueryDto params) throws Exception { JourneyDto.SelectAbnormalJourney abnormalJourney = params.getParam(); - Long startTime = abnormalJourney.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : abnormalJourney.getStartTime(); - Long endTime = abnormalJourney.getEndTime() == null ? System.currentTimeMillis() : abnormalJourney.getEndTime(); - Integer page = abnormalJourney.getPage() == null ? 1 : abnormalJourney.getPage(); +// Long startTime = abnormalJourney.getStartTime() == null ? DateUtil.getZeroTime(new Date()) : abnormalJourney.getStartTime(); +// Long endTime = abnormalJourney.getEndTime() == null ? System.currentTimeMillis() : abnormalJourney.getEndTime(); + int page = abnormalJourney.getPage() == null ? 1 : abnormalJourney.getPage(); + PageHelper.startPage(page, 10); List addAbnormalJourneyList = - journeyAbnormalDao.selectAbnormalJourney(abnormalJourney.getCarNo(),abnormalJourney.getTripMode(),startTime,endTime); + journeyAbnormalDao.selectAbnormalJourney(abnormalJourney.getCarNo(),abnormalJourney.getTripMode(),abnormalJourney.getStartTime(),abnormalJourney.getEndTime()); return addAbnormalJourneyList; } diff --git a/health/src/main/java/com/ccsens/health/service/UserService.java b/health/src/main/java/com/ccsens/health/service/UserService.java index 47c3c820..7461fc0d 100644 --- a/health/src/main/java/com/ccsens/health/service/UserService.java +++ b/health/src/main/java/com/ccsens/health/service/UserService.java @@ -44,6 +44,8 @@ public class UserService implements IUserService{ private TallFeignClient tallFeignClient; @Autowired private HealthRecordsDao healthRecordsDao; + @Autowired + private HealthTypeDao healthTypeDao; @Resource private MemberDao memberDao; @Resource @@ -94,7 +96,19 @@ public class UserService implements IUserService{ //查询健康码 List healthCodeList = healthRecordsDao.getHealthQrCodeByEmployeeId(userId,startTime,endTime); - + if(CollectionUtil.isNotEmpty(healthCodeList)){ + for(UserVo.HealthCode healthCode : healthCodeList){ + healthCode.setHealthLevel(0); + //获取健康状态 + HealthType healthType = healthTypeDao.selectByPrimaryKey(healthCode.getHealthTypeId()); + if(ObjectUtil.isNotNull(healthType)){ + //如果健康状态异常,健康码为橙色 + if(healthType.getQuarantine() != 0){ + healthCode.setHealthLevel(1); + } + } + } + } userInfoVo.setHealthCodeList(healthCodeList); return userInfoVo; @@ -169,7 +183,7 @@ public class UserService implements IUserService{ RealNameAuth realNameAuth = new RealNameAuth(); realNameAuth.setId(snowflake.nextId()); realNameAuth.setUserId(userId); - realNameAuth.setIdCard(userInfo.getIdCard()); +// realNameAuth.setIdCard(userInfo.getIdCard()); realNameAuth.setName(userInfo.getName()); realNameAuth.setNo(userInfo.getNo()); realNameAuth.setPost((byte) userInfo.getPost()); diff --git a/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml b/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml index bcd192e3..63be32d7 100644 --- a/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml +++ b/health/src/main/resources/mapper_dao/HealthAbnormalDao.xml @@ -35,19 +35,19 @@ t_health_abnormal a left join t_member m on a.wkno = m.wkno where a.rec_status = 0 - + and m.type != 2 - + and m.type = 2 - + and a.department = #{department} - + and a.health_status = #{healthType} @@ -65,7 +65,7 @@ t_health_abnormal ha LEFT JOIN t_member m on ha.wkno = m.wkno WHERE ha.rec_status = 0 - + and m.department = #{department} @@ -99,7 +99,7 @@ JOIN t_member m on rn.no = m.wkno WHERE j.rec_status = 0 - + and m.department = #{department} diff --git a/health/src/main/resources/mapper_dao/HealthRecordDao.xml b/health/src/main/resources/mapper_dao/HealthRecordDao.xml index 10856dec..6d5256b6 100644 --- a/health/src/main/resources/mapper_dao/HealthRecordDao.xml +++ b/health/src/main/resources/mapper_dao/HealthRecordDao.xml @@ -17,6 +17,7 @@ + @@ -69,6 +70,7 @@ \ No newline at end of file diff --git a/health/src/main/resources/mapper_dao/RealNameAuthDao.xml b/health/src/main/resources/mapper_dao/RealNameAuthDao.xml index 54ecc5a3..abeb7f8a 100644 --- a/health/src/main/resources/mapper_dao/RealNameAuthDao.xml +++ b/health/src/main/resources/mapper_dao/RealNameAuthDao.xml @@ -10,6 +10,7 @@ + @@ -21,19 +22,20 @@ m.wkno as wkno, s.id as cId, s.site_name as cName, - sc.time as cTime + sc.time as cTime, + sc.out_time as cOutTime from t_site s right JOIN t_site_qrcode sq on sq.site_id = s.id - right JOIN t_site_clock_in sc on sc.site_id = s.id + right JOIN t_site_clock_in sc on sc.site_id = s.id right JOIN t_real_name_auth r on sc.user_id = r.user_id join t_member m on r.no = m.wkno where m.rec_status = 0 - + and m.name = #{name} - + and m.wkno = #{wkno} diff --git a/health/src/main/resources/mapper_dao/SiteDao.xml b/health/src/main/resources/mapper_dao/SiteDao.xml index 0a23004f..e1cb1f56 100644 --- a/health/src/main/resources/mapper_dao/SiteDao.xml +++ b/health/src/main/resources/mapper_dao/SiteDao.xml @@ -7,8 +7,12 @@ select t.id, t.site_name as siteName, t.site_code as siteCode, t.longitude, t.latitude, t1.qrcode_path as inUrl, t2.qrcode_path as outUrl from (select * from t_site + where rec_status = 0 - where parent_code = #{parentCode, jdbcType=VARCHAR} + and parent_code = #{parentCode, jdbcType=VARCHAR} + + + and site_name like concat('%',#{siteName, jdbcType=VARCHAR},'%') ) t left join diff --git a/util/src/main/java/com/ccsens/util/wx/WxGzhUtil.java b/util/src/main/java/com/ccsens/util/wx/WxGzhUtil.java index e1e0d35a..a22cce3e 100644 --- a/util/src/main/java/com/ccsens/util/wx/WxGzhUtil.java +++ b/util/src/main/java/com/ccsens/util/wx/WxGzhUtil.java @@ -31,9 +31,9 @@ public class WxGzhUtil { */ private static WxAccessToken globalWxAccessToken; /** - * accessToken 过期提前10分钟刷新 + * accessToken 过期提前10分钟刷新(为防止过期,改成提前一个小时刷新) */ - private static final Integer ACCESS_TOKEN_RESERVED_SECONDS = 10 * 60; + private static final Integer ACCESS_TOKEN_RESERVED_SECONDS = 60 * 60; private static final String URL_LOGIN = "https://api.weixin.qq.com/sns/jscode2session?appid=%1$s&secret=%2$s&js_code=%3$s&grant_type=%4$s"; diff --git a/util/src/test/java/com/ccsens/util/KeyTest.java b/util/src/test/java/com/ccsens/util/KeyTest.java index 3479a700..0e40fe70 100644 --- a/util/src/test/java/com/ccsens/util/KeyTest.java +++ b/util/src/test/java/com/ccsens/util/KeyTest.java @@ -23,6 +23,7 @@ public class KeyTest { /**加密*/ @Test public void test3(){ +// String key = "a6RlI/GctLgENUvF6DOY7w=="; String key = "g9RlI/GctLgDFJvF6DOY7w=="; String string = "po3OynBO[M3579p6L7)o"; SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, Base64.decode(key));