huanghongfa
2021-08-21 2e64c232ab6b51b2cecf1ee96e1e9b709234f326
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,7 +110,7 @@
            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("在此期间已有活动,请勿重复添加");
        }