|
@@ -17,11 +17,13 @@ import com.gis.common.base.service.impl.IBaseService;
|
|
|
import com.gis.common.constant.ErrorEnum;
|
|
|
import com.gis.common.util.BaseUtil;
|
|
|
import com.gis.common.util.Result;
|
|
|
+import io.swagger.annotations.ApiModelProperty;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@@ -139,6 +141,50 @@ public class HotelServiceImpl extends ServiceImpl<HotelMapper, HotelEntity> impl
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result info() {
|
|
|
+ List<HotelEntity> list = this.list();
|
|
|
+ // status 状态 > 0:可用, 1:储备, 2:应急储备
|
|
|
+ int total = 0; //酒店总数
|
|
|
+ int used = 0; // 酒店在用
|
|
|
+ int store = 0; // 酒店储备
|
|
|
+ int emergencyStore = 0; //酒店应急储备
|
|
|
+ int roomUsed = 0; //房间总入住数量
|
|
|
+ int roomUsable = 0; //房间总空闲数量
|
|
|
+
|
|
|
+ for (HotelEntity entity : list) {
|
|
|
+ Integer status = entity.getStatus();
|
|
|
+ if (status == 0){
|
|
|
+ used++;
|
|
|
+ } else if (status == 1) {
|
|
|
+ status++;
|
|
|
+ } else {
|
|
|
+ emergencyStore++;
|
|
|
+ }
|
|
|
+
|
|
|
+ roomUsed = roomUsed + entity.getUsed();
|
|
|
+ roomUsable = roomUsable + entity.getUsable();
|
|
|
+ }
|
|
|
+ total = list.size();
|
|
|
+
|
|
|
+ HashMap<Object, Object> map = new HashMap<>();
|
|
|
+ map.put("total", total);
|
|
|
+ map.put("used", used);
|
|
|
+ map.put("store", store);
|
|
|
+ map.put("emergencyStore", emergencyStore);
|
|
|
+ map.put("roomUsed", roomUsed);
|
|
|
+ map.put("roomUsable", roomUsable);
|
|
|
+
|
|
|
+
|
|
|
+ return Result.success(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result detail(Long id) {
|
|
|
+ return Result.success(getById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public Result saveEntity(HotelDto param) {
|