Commit f2903390 authored by 赵啸非's avatar 赵啸非

添加用户扩展xml

parent 635ae21f
......@@ -46,9 +46,9 @@ public interface SiteService extends ICRUDCacheService<SiteEntity, Long> {
*/
List<SiteEntity> getFlatSitesByAreaCode(String areaCode,Context context);
void setSiteTree(List<SiteTreeSelect> list, Context context);
void setSiteTree(List<SiteTreeSelect> list, Context context);
}
\ No newline at end of file
......@@ -6,11 +6,14 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.model.model.ModelQuery;
import com.mortals.xhx.module.model.service.ModelService;
import com.mortals.xhx.module.site.model.SiteBusinessEntity;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
......@@ -75,18 +78,6 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
if (ObjectUtils.isEmpty(siteTree)) {
siteTree = this.service.siteTree(getContext());
}
//校验
// Long siteId = getContext().getUser().getSiteId();
// String siteIds = getContext().getUser().getSiteIds();
// Set<String> siteSet = Arrays.stream(siteIds.split(",")).collect(Collectors.toSet());
// if(!ObjectUtils.isEmpty(siteId)){
// //遍历树
// SiteTreeSelect temp =reFucurs(siteTree,siteId.toString());
// if (!ObjectUtils.isEmpty(temp)) {
// siteTree = new ArrayList<>();
// siteTree.add(temp);
// }
// }
model.put("siteTree", siteTree);
this.init(model, getContext());
recordSysLog(request, busiDesc + " 【成功】");
......@@ -101,25 +92,30 @@ public class SiteController extends BaseCRUDJsonBodyMappingController<SiteServic
}
public SiteTreeSelect reFucurs(List<SiteTreeSelect> siteTree, String siteId) {
SiteTreeSelect temp=null;
for (SiteTreeSelect site : siteTree) {
if (site.getId().equals(siteId)) {
log.info("curTree:{}", JSON.toJSONString(site));
temp=site;
break;
} else {
if (!ObjectUtils.isEmpty(site.getChildren())) {
temp=reFucurs(site.getChildren(), siteId);
if(temp!=null){
break;
}
}
}
/**
* 根据区域查询站点列表
*/
@PostMapping(value = "getFlatSitesByAreaCode")
public String getFlatSitesByAreaCode(@RequestParam(value = "areaCode")String areaCode) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "根据区域编码查询站点列表" + this.getModuleDesc();
try {
List<SiteEntity> siteEntityList = this.service.getFlatSitesByAreaCode(areaCode, getContext());
model.put(KEY_RESULT_DATA, siteEntityList);
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点列表成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return temp;
return jsonObject.toJSONString();
}
/*
public SiteTreeSelect reFucurs(List<SiteTreeSelect> siteTree, Set<String> siteSet) {
SiteTreeSelect temp=null;
......
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