|
@@ -1,19 +1,21 @@
|
|
|
package com.huaxu.controller;
|
|
|
|
|
|
+import com.huaxu.dto.ThingDetailInfoDto;
|
|
|
+import com.huaxu.dto.ThingInfoDto;
|
|
|
import com.huaxu.entity.SceneEntity;
|
|
|
import com.huaxu.model.AjaxMessage;
|
|
|
import com.huaxu.model.ResultStatus;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
+import org.apache.ibatis.annotations.Mapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.ui.ModelMap;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Date;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import com.huaxu.entity.ThingSettingEntity;
|
|
|
import com.huaxu.service.ThingSettingService;
|
|
@@ -40,6 +42,42 @@ public class ThingSettingController{
|
|
|
List<ThingSettingEntity> thingSettingEntities = thingSettingService.findList(thingSettingEntity);
|
|
|
return new AjaxMessage<>(ResultStatus.OK, thingSettingEntities);
|
|
|
}
|
|
|
+ @RequestMapping(value = "/findDetailList",method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ @ApiOperation(value = "查询物品统计信息")
|
|
|
+ public AjaxMessage<List<ThingInfoDto>> findDetailList(@ApiParam(value = "物品类型(1管网 2窨井 3阀门 4消防栓)", required = true) @RequestParam Integer thingType) {
|
|
|
+ ThingSettingEntity thingSettingEntity = new ThingSettingEntity();
|
|
|
+ thingSettingEntity.setThingType(thingType);
|
|
|
+ List<ThingSettingEntity> thingSettingEntities = thingSettingService.findList(thingSettingEntity);
|
|
|
+ List<ThingInfoDto> thingInfoDtos = new ArrayList<>();
|
|
|
+ Map<Integer,List<ThingDetailInfoDto>> map = new HashMap<>();
|
|
|
+ for(ThingSettingEntity item:thingSettingEntities)
|
|
|
+ {
|
|
|
+ List<ThingDetailInfoDto> list = new ArrayList<>();
|
|
|
+ Integer key = item.getThingObjectType();
|
|
|
+ if(!map.containsKey(key.intValue())) {
|
|
|
+ ThingDetailInfoDto detailInfoDto = new ThingDetailInfoDto();
|
|
|
+ detailInfoDto.setThingBore(item.getThingBore());
|
|
|
+ detailInfoDto.setThingCount(item.getThingCount());
|
|
|
+ detailInfoDto.setThingLength(item.getThingLength());
|
|
|
+ list.add(detailInfoDto);
|
|
|
+ map.put(key, list);
|
|
|
+ }else {
|
|
|
+ ThingDetailInfoDto detailInfoDto = new ThingDetailInfoDto();
|
|
|
+ detailInfoDto.setThingBore(item.getThingBore());
|
|
|
+ detailInfoDto.setThingCount(item.getThingCount());
|
|
|
+ detailInfoDto.setThingLength(item.getThingLength());
|
|
|
+ map.get(key.intValue()).add(detailInfoDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (Integer key : map.keySet()) {
|
|
|
+ ThingInfoDto thingInfoDto = new ThingInfoDto();
|
|
|
+ thingInfoDto.setThingObjectType(key);
|
|
|
+ thingInfoDto.setDetailInfoDtoList(map.get(key.intValue()));
|
|
|
+ thingInfoDtos.add(thingInfoDto) ;
|
|
|
+ }
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK, thingInfoDtos);
|
|
|
+ }
|
|
|
|
|
|
@RequestMapping(value = "/findTotalList",method = RequestMethod.GET)
|
|
|
@ResponseBody
|