Commit 50494e7b authored by tangwei's avatar tangwei

换流站修改bug

parent 2448ffd8
...@@ -38,7 +38,7 @@ public class BasicEntity /*extends Resource*/ implements Serializable{ ...@@ -38,7 +38,7 @@ public class BasicEntity /*extends Resource*/ implements Serializable{
private Date createDate = new Date(); private Date createDate = new Date();
@Id @Id
@GeneratedValue(strategy=GenerationType.AUTO) @GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name = "ID",nullable=false,unique=true) @Column(name = "ID",nullable=false,unique=true)
public long getId() { public long getId() {
return id; return id;
......
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.yeejoin.amos.fas.business.param.PointListParam; import com.yeejoin.amos.fas.business.param.PointListParam;
import com.yeejoin.amos.fas.business.param.QueryParamUtil; import com.yeejoin.amos.fas.business.param.QueryParamUtil;
import com.yeejoin.amos.fas.business.service.intfc.ICommonService; import com.yeejoin.amos.fas.business.service.intfc.ICommonService;
...@@ -16,11 +18,13 @@ import io.swagger.annotations.ApiParam; ...@@ -16,11 +18,13 @@ import io.swagger.annotations.ApiParam;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping(value = "/api/common") @RequestMapping(value = "/api/common")
...@@ -47,9 +51,57 @@ public class CommonController extends BaseController { ...@@ -47,9 +51,57 @@ public class CommonController extends BaseController {
return CommonResponseUtil.failure("公司信息获取失败!"); return CommonResponseUtil.failure("公司信息获取失败!");
} }
List<DepartmentModel> deps = commonService.getDepartment(getToken(),getProduct(),getAppKey(), companyId); List<DepartmentModel> deps = commonService.getDepartment(getToken(),getProduct(),getAppKey(), companyId);
return CommonResponseUtil.success(deps);
return CommonResponseUtil.success(objectsToMaps(deps));
} }
public static <T> Map<String, Object> beanToMap(T bean) {
Map<String, Object> map = Maps.newHashMap();
if (bean != null) {
BeanMap beanMap = BeanMap.create(bean);
for (Object key : beanMap.keySet()) {
if("sequenceNbr".equals(key+"")){
map.put(key+"", beanMap.get(key)+"");
}else{
map.put(key+"", beanMap.get(key));
}
}
}
return map;
}
public static <T> List<Map<String, Object>> objectsToMaps(List<T> objList) {
List<Map<String, Object>> list = Lists.newArrayList();
if (objList != null && objList.size() > 0) {
Map<String, Object> map = null;
T bean = null;
for (int i = 0,size = objList.size(); i < size; i++) {
bean = objList.get(i);
map = beanToMap(bean);
list.add(map);
}
}
return list;
}
/** /**
* 查询巡检点信息 * 查询巡检点信息
* *
......
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