|
@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.time.Duration;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -93,4 +94,16 @@ public class FosterRecordServiceImpl extends ServiceImpl<IFosterRecordMapper, Fo
|
|
public IPage<AppFosterRecordRespDTO> getPageList(Page<AppFosterRecordRespDTO> page, AppFosterRecordQueryDTO queryDTO) {
|
|
public IPage<AppFosterRecordRespDTO> getPageList(Page<AppFosterRecordRespDTO> page, AppFosterRecordQueryDTO queryDTO) {
|
|
return baseMapper.getPageList(page, queryDTO);
|
|
return baseMapper.getPageList(page, queryDTO);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Integer getFosterDays(AppFosterRecordQueryDTO queryDTO) {
|
|
|
|
+ FosterRecord fosterRecord = this.lambdaQuery()
|
|
|
|
+ .eq(FosterRecord::getAppUserId, queryDTO.getAppUserId())
|
|
|
|
+ .eq(FosterRecord::getGardenId, queryDTO.getGardenId())
|
|
|
|
+ .eq(FosterRecord::getTreeId, queryDTO.getTreeId())
|
|
|
|
+ .one();
|
|
|
|
+ LocalDateTime createdTime = fosterRecord.getCreatedTime();
|
|
|
|
+ Duration between = Duration.between(createdTime, LocalDateTime.now());
|
|
|
|
+ return between.toDays() == 0 ? 1 : (int) between.toDays();
|
|
|
|
+ }
|
|
}
|
|
}
|