Commit e39b8d01 authored by tianyiming's avatar tianyiming

特设八大类总览、认领/管理列表树

parent 3d585557
package com.yeejoin.amos.boot.module.tzs.api.service; package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
/** /**
* 装备分类接口类 * 装备分类接口类
* *
...@@ -9,4 +14,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service; ...@@ -9,4 +14,7 @@ package com.yeejoin.amos.boot.module.tzs.api.service;
*/ */
public interface IEquipmentCategoryService { public interface IEquipmentCategoryService {
List<Map<String,Object>> equipTree();
Page equipClaimOverview();
} }
package com.yeejoin.amos.boot.module.tzs.biz.controller; package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.ApiOperation; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser; import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
import java.util.ArrayList; import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import java.util.Collection; import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import io.swagger.annotations.Api;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/** /**
* 装备分类 * 装备分类
...@@ -42,6 +39,9 @@ public class EquipmentCategoryController extends BaseController { ...@@ -42,6 +39,9 @@ public class EquipmentCategoryController extends BaseController {
@Autowired @Autowired
EquipmentCategoryServiceImpl equipmentCategoryServiceImpl; EquipmentCategoryServiceImpl equipmentCategoryServiceImpl;
@Autowired
IEquipmentCategoryService equipmentCategoryService;
/** /**
* 新增装备分类 * 新增装备分类
* *
...@@ -152,4 +152,28 @@ public class EquipmentCategoryController extends BaseController { ...@@ -152,4 +152,28 @@ public class EquipmentCategoryController extends BaseController {
return ResponseHelper.buildResponse(jsonArray); return ResponseHelper.buildResponse(jsonArray);
} }
/**
* 设备八大类列表树
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备八大类列表树", notes = "设备八大类列表树")
@GetMapping(value = "/equipTree")
public ResponseModel<Object> equipTree() {
return ResponseHelper.buildResponse(equipmentCategoryService.equipTree());
}
/**
* 设备认领总览
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "设备认领总览", notes = "设备认领总览")
@GetMapping(value = "/equipClaimOverview")
public ResponseModel<Object> equipClaimOverview() {
return ResponseHelper.buildResponse(equipmentCategoryService.equipClaimOverview());
}
} }
package com.yeejoin.amos.boot.module.tzs.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory; import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService; import com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService;
import com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto; import com.yeejoin.amos.boot.module.tzs.biz.utils.JsonUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 装备分类服务实现类 * 装备分类服务实现类
...@@ -17,10 +24,17 @@ import java.util.List; ...@@ -17,10 +24,17 @@ import java.util.List;
* @date 2021-10-20 * @date 2021-10-20
*/ */
@Service @Service
public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryDto,EquipmentCategory,EquipmentCategoryMapper> implements IEquipmentCategoryService { public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryDto, EquipmentCategory, EquipmentCategoryMapper> implements IEquipmentCategoryService {
@Autowired @Autowired
EquipmentCategoryMapper equipmentCategoryMapper; EquipmentCategoryMapper equipmentCategoryMapper;
@Value("classpath:/json/equipCategory.json")
private Resource equipCategory;
@Value("classpath:/json/equipStatus.json")
private Resource equipStatus;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -32,10 +46,59 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -32,10 +46,59 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* 列表查询 示例 * 列表查询 示例
*/ */
public List<EquipmentCategoryDto> queryForEquipmentCategoryList() { public List<EquipmentCategoryDto> queryForEquipmentCategoryList() {
return this.queryForList("" , false); return this.queryForList("", false);
} }
public List<EquipmentCategoryDto> selectClassify() { public List<EquipmentCategoryDto> selectClassify() {
return equipmentCategoryMapper.selectClassify(); return equipmentCategoryMapper.selectClassify();
} }
@Override
public List<Map<String, Object>> equipTree() {
List<Map> mapList = JsonUtils.getResourceJson(equipCategory);
List<Map<String, Object>> menus = new ArrayList<>();
for (Map map : mapList) {
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("instanceName", map.get("name"));
resultMap.put("instanceId", map.get("code"));
menus.add(resultMap);
}
return menus;
}
@Override
public Page equipClaimOverview() {
Page page = new Page<>();
List<Map> mapList = JsonUtils.getResourceJson(equipCategory);
List<Map<String, Object>> list = new ArrayList<>();
for (Map map : mapList) {
Map<String, Object> resultMap = new HashMap<>();
// Map<String, Object> map1 = equipmentCategoryMapper.getCategoryCount(map.get("code").toString());
Map<String,Object> objectMap = new HashMap<>();
objectMap.put("waitClaim",985);
objectMap.put("alreadyClaim",18985);
objectMap.put("refuseClaim",985);
List<Map<String, Object>> list1= new ArrayList<>();
List<Map> equipStatusList = JsonUtils.getResourceJson(equipStatus);
for (Map equipStatusMap : equipStatusList) {
Map<String, Object> map1 = new HashMap<>();
map1.put("name",equipStatusMap.get("value"));
map1.put("value",objectMap.get(equipStatusMap.get("value")));
list1.add(map1);
}
resultMap.put("name",map.get("name"));
resultMap.put("image",map.get("image"));
resultMap.put("waitClaim",985);
resultMap.put("alreadyClaim",18985);
resultMap.put("refuseClaim",985);
resultMap.put("sum",20955);
resultMap.put("value",list1);
list.add(resultMap);
}
page.setCurrent(1);
page.setTotal(list.size());
page.setRecords(list);
return page;
}
} }
\ No newline at end of file
package com.yeejoin.amos.boot.module.tzs.biz.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
public class JsonUtils {
//将json文件转化为list<Map>
public static List<Map> getResourceJson(Resource resource) {
String json = null;
try {
json = IOUtils.toString(resource.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(resource + "json文件转化失败");
}
return JSONObject.parseArray(json, Map.class);
}
}
[
{
"name": "电梯",
"code": "3000",
"image": "upload/tzs/common/image/总览电梯.png"
},
{
"name": "起重机械",
"code": "4000",
"image": "upload/tzs/common/image/总览电梯.png"
},
{
"name": "场内机动车辆",
"code": "5000",
"image": "upload/tzs/common/image/总览厂车.png"
},
{
"name": "锅炉",
"code": "1000",
"image": "upload/tzs/common/image/总览锅炉.png"
},
{
"name": "压力容器",
"code": "2000",
"image": "upload/tzs/common/image/总览压力容器.png"
},
{
"name": "压力管道",
"code": "8000",
"image": "upload/tzs/common/image/总览压力管道.png"
},
{
"name": "大型游乐设施",
"code": "6000",
"image": "upload/tzs/common/image/总览游乐设施.png"
},
{
"name": "客运索道",
"code": "9000",
"image": "upload/tzs/common/image/总览索道.png"
}
]
\ No newline at end of file
[
{
"name": "待认领",
"value": "waitClaim"
},
{
"name": "已认领",
"value": "alreadyClaim"
},
{
"name": "拒领",
"value": "refuseClaim"
}
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment