소스 검색

修改统计量

wangyangyang 4 년 전
부모
커밋
ebe9799eb6

+ 41 - 3
sms_water/src/main/java/com/huaxu/controller/ThingSettingController.java

@@ -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

+ 19 - 0
sms_water/src/main/java/com/huaxu/dto/ThingDetailInfoDto.java

@@ -0,0 +1,19 @@
+package com.huaxu.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class ThingDetailInfoDto {
+    /** 物品口径 */
+    @ApiModelProperty(value = "物品口径")
+    private Integer thingBore;
+
+    /** 物品长度 */
+    @ApiModelProperty(value = "物品长度")
+    private Double thingLength;
+
+    /** 物品个数 */
+    @ApiModelProperty(value = "物品个数")
+    private Integer thingCount;
+}

+ 17 - 0
sms_water/src/main/java/com/huaxu/dto/ThingInfoDto.java

@@ -0,0 +1,17 @@
+package com.huaxu.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class ThingInfoDto {
+    /**
+     * 物品材质类型
+     */
+    @ApiModelProperty(value = "物品材质类型")
+    private Integer thingObjectType;
+    @ApiModelProperty(value = "物品材质详细信息")
+    List<ThingDetailInfoDto> detailInfoDtoList;
+}