From 2e64c232ab6b51b2cecf1ee96e1e9b709234f326 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期六, 21 八月 2021 16:35:14 +0800 Subject: [PATCH] 随手拍改版接口开发 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoActivityServiceImpl.java | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoActivityServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoActivityServiceImpl.java index 12d7601..df1c936 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoActivityServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoActivityServiceImpl.java @@ -68,20 +68,26 @@ public R addActivity(AddEasyPhotoActivityDTO addEasyPhotoActivityDTO){ //判断当前活动时间是否与其他时间有冲突 - Integer count = this.baseMapper.getEasyPhotoActivityTimeConflict(addEasyPhotoActivityDTO.getActivityStartAt(),addEasyPhotoActivityDTO.getActivityEndAt(),null); + Integer count = this.baseMapper.getEasyPhotoActivityTimeConflict(addEasyPhotoActivityDTO.getActivityStartAt(),addEasyPhotoActivityDTO.getActivityEndAt(),null,addEasyPhotoActivityDTO.getCommunityId()); if(count > 0){ return R.fail("在此期间已有活动,请勿重复添加"); } + + Date nowDate = new Date(); ComActEasyPhotoActivityDO photoActivityDO = new ComActEasyPhotoActivityDO(); BeanUtils.copyProperties(addEasyPhotoActivityDTO,photoActivityDO); photoActivityDO.setActivityStartAt(DateUtils.stringToDate(addEasyPhotoActivityDTO.getActivityStartAt(),DateUtils.ymdhm_format)); photoActivityDO.setActivityEndAt(DateUtils.stringToDate(addEasyPhotoActivityDTO.getActivityEndAt(),DateUtils.ymdhm_format)); photoActivityDO.setCreateAt(new Date()); photoActivityDO.setReleaseAt(new Date()); - if(new Date().getTime() > photoActivityDO.getActivityStartAt().getTime()){ - photoActivityDO.setStatus(2); + if(photoActivityDO.getActivityEndAt().getTime() <= nowDate.getTime()){ + return R.fail("活动结束时间不可小于当前时间"); + } + + if(nowDate.getTime() >= photoActivityDO.getActivityStartAt().getTime()){ + photoActivityDO.setStatus(ComActEasyPhotoActivityDO.status.jxz); }else{ - photoActivityDO.setStatus(1); + photoActivityDO.setStatus(ComActEasyPhotoActivityDO.status.dks); } photoActivityDO.setCount(0); @@ -104,14 +110,23 @@ return R.fail("未查询到活动记录"); } - Integer count = this.baseMapper.getEasyPhotoActivityTimeConflict(editEasyPhotoActivityDTO.getActivityStartAt(),editEasyPhotoActivityDTO.getActivityEndAt(),editEasyPhotoActivityDTO.getId()); + Integer count = this.baseMapper.getEasyPhotoActivityTimeConflict(editEasyPhotoActivityDTO.getActivityStartAt(),editEasyPhotoActivityDTO.getActivityEndAt(),editEasyPhotoActivityDTO.getId(),photoActivityDO.getCommunityId()); if(count > 0){ return R.fail("在此期间已有活动,请勿重复添加"); } BeanUtils.copyProperties(editEasyPhotoActivityDTO,photoActivityDO); - photoActivityDO.setActivityStartAt(DateUtils.stringToDate(editEasyPhotoActivityDTO.getActivityStartAt(),DateUtils.ymdhms_format)); - photoActivityDO.setActivityEndAt(DateUtils.stringToDate(editEasyPhotoActivityDTO.getActivityEndAt(),DateUtils.ymdhms_format)); + photoActivityDO.setActivityStartAt(DateUtils.stringToDate(editEasyPhotoActivityDTO.getActivityStartAt(),DateUtils.ymdhm_format)); + photoActivityDO.setActivityEndAt(DateUtils.stringToDate(editEasyPhotoActivityDTO.getActivityEndAt(),DateUtils.ymdhm_format)); + if(new Date().getTime() > photoActivityDO.getActivityStartAt().getTime()){ + photoActivityDO.setStatus(ComActEasyPhotoActivityDO.status.jxz); + }else{ + photoActivityDO.setStatus(ComActEasyPhotoActivityDO.status.dks); + } + + if(new Date().getTime() > photoActivityDO.getActivityEndAt().getTime()){ + photoActivityDO.setStatus(ComActEasyPhotoActivityDO.status.yjs); + } if(this.baseMapper.updateById(photoActivityDO) > 0){ return R.ok(); } -- Gitblit v1.7.1