Commit 54232d71 authored by 曹盼盼's avatar 曹盼盼

修改设备列表

parent 3c60a3f0
package com.yeejoin.amos.boot.module.tzs.api.dto;
import lombok.Data;
/**
* @Author cpp
* @Description
* @Date 2023/3/16
*/
@Data
public class JgAllDto {
private static final long serialVersionUID = 1L;
private String SEQUENCE_NBR;
private String orgBranchName;
private String ORG_BRANCH_CODE;
private String USE_UNIT_NAME;
private String USE_UNIT_CREDIT_CODE;
private String EQU_LIST_CODE;
private String EQU_LIST;
private String EQU_CATEGORY;
private String USE_ORG_CODE;
private String CODE96333;
private String EQU_CODE;
private String SUPERVISORY_CODE;
private String USE_PLACE;
private String ADDRESS;
private String EQU_STATE;
private String CLAIM_STATUS;
}
package com.yeejoin.amos.boot.module.tzs.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
@AllArgsConstructor
@Getter
public enum EquimentEnum {
/**
* 设备状态枚举
*
*/
XINZENG("新增",0),
ZAIYONG("在用",1),
TINGYONG("停用",2),
BAOFEI("报废",3),
ZHUXIAO("注销",4),
QIANCHU("迁出",5),
CHAICHU("拆除",6),
MULUWAI("目录外",7),
FEIFASHEBEI("非法设备",8);
String name;
Integer code;
public static Map<Integer,String> getName=new HashMap<>();
public static Map<String,Integer> getCode=new HashMap<>();
static {
for (EquimentEnum e : EquimentEnum.values()){
getName.put(e.code, e.name);
getCode.put(e.name, e.code);
}
}
}
......@@ -211,7 +211,7 @@ public class EquipmentCategoryController extends BaseController {
@GetMapping(value = "/getTable")
@ApiOperation(httpMethod = "GET", value = "设备认领和设备管理通用接口", notes = "设备认领和设备管理通用接口")
public ResponseModel<Page<Map<String,Object>>> getTable(@RequestParam Map<String,Object> map) {
return equipmentCategoryServiceImpl.getTable(map);
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.getTable(map));
}
......@@ -224,4 +224,13 @@ public class EquipmentCategoryController extends BaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getChildren")
@ApiOperation(httpMethod = "GET", value = "通过设备种类code获取设备类别", notes = "通过设备种类code获取设备类别")
public ResponseModel<List<EquipmentCategory>> getChildren(String code) {
return ResponseHelper.buildResponse(equipmentCategoryServiceImpl.getChildren(code));
}
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
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.CategoryOtherInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory;
import com.yeejoin.amos.boot.module.tzs.api.entity.RescueStation;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquimentEnum;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.tzs.api.enums.EquipmentClassifityEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.CategoryOtherInfoMapper;
......@@ -278,14 +281,19 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* * 如果为企业添加使用单位查询参数(USE_UNIT_CREDIT_CODE)
*/
private static final String LEVEL = "company";
private static final String EQUSTATE = "EQU_STATE";
public ResponseModel<Page<Map<String, Object>>> getTable(Map<String, Object> map) {
public Page<Map<String, Object>> getTable(Map<String, Object> map) {
if (!ValidationUtil.isEmpty(map.get(EQUSTATE))) {
map.put(EQUSTATE, EquimentEnum.getCode.get(map.get(EQUSTATE).toString()).toString());
}
ResponseModel<Page<Map<String, Object>>> model = new ResponseModel<>();
JSONObject object = getCompanyType();
String leve = object.getString("leve");
String code = object.getString("companyCode");
if (!ValidationUtil.isEmpty(leve)) {
if (LEVEL.equals(leve)) {
if (LEVEL.equals(LEVEL)) {
//企业
map.put("USE_UNIT_CREDIT_CODE", code);
model = idxFeignService.getPage(map);
......@@ -295,12 +303,23 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
model = idxFeignService.getPage(map);
}
}
return model;
//设备状态码对应枚举值
List<Map<String, Object>> records = model.getResult().getRecords();
List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> record : records) {
Integer integer = Integer.valueOf(record.get(EQUSTATE).toString());
String status = EquimentEnum.getName.get(integer);
record.put(EQUSTATE, status);
result.add(record);
}
Page<Map<String, Object>> mapPage = model.getResult().setRecords(result);
return mapPage;
}
private static final String TABLENAME="tableName";
private static final String TABLENAME = "tableName";
public List<Map<String, Object>> scalp(Map<String, Object> map) {
List<Map<String, Object>> list =new ArrayList<>();
List<Map<String, Object>> list = new ArrayList<>();
if (!ValidationUtil.isEmpty(map.get("orgBranchName"))) {
list = equipmentCategoryMapper.getSrcee(map.get(TABLENAME).toString(),
map.get("orgBranchName").toString(), null, null, null, null);
......@@ -315,13 +334,27 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
if (!ValidationUtil.isEmpty(map.get("usePlace"))) {
list = equipmentCategoryMapper.getSrcee(map.get(TABLENAME).toString(),
null, null,null , map.get("usePlace").toString(), null);
null, null, null, map.get("usePlace").toString(), null);
}
if (!ValidationUtil.isEmpty(map.get("equState"))) {
list = equipmentCategoryMapper.getSrcee(map.get(TABLENAME).toString(),
null, null,null , null, map.get("equState").toString());
null, null, null, null, map.get("equState").toString());
}
return list;
}
/**
* 设备字典,通过设备父类code,获得子类
*/
public List<EquipmentCategory> getChildren(String code) {
LambdaQueryWrapper<EquipmentCategory> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EquipmentCategory::getCode, code);
EquipmentCategory equipmentCategory = baseMapper.selectOne(wrapper);
LambdaQueryWrapper<EquipmentCategory> wrapper2 = new LambdaQueryWrapper<>();
wrapper2.eq(EquipmentCategory::getParentId, equipmentCategory.getId());
List<EquipmentCategory> equipmentCategories = baseMapper.selectList(wrapper2);
return equipmentCategories;
}
}
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