Commit f58bd4e3 authored by “yiyousong”'s avatar “yiyousong”
parents e20690ab 65eb7c6e
...@@ -20,7 +20,6 @@ ALTER TABLE mortals_sys_workman ADD COLUMN `operatorId` varchar (128) default " ...@@ -20,7 +20,6 @@ ALTER TABLE mortals_sys_workman ADD COLUMN `operatorId` varchar (128) default "
-- ---------------------------- -- ----------------------------
2023-3-28 2023-3-28
-- ---------------------------- -- ----------------------------
...@@ -211,3 +210,11 @@ ALTER TABLE mortals_sys_app_info_field ADD COLUMN `serviceApiParams` varchar(10 ...@@ -211,3 +210,11 @@ ALTER TABLE mortals_sys_app_info_field ADD COLUMN `serviceApiParams` varchar(10
ALTER TABLE mortals_sys_app_info_templete_field ADD COLUMN `serviceApi` varchar(255) default '' COMMENT '事件服务接口请求地址'; ALTER TABLE mortals_sys_app_info_templete_field ADD COLUMN `serviceApi` varchar(255) default '' COMMENT '事件服务接口请求地址';
ALTER TABLE mortals_sys_app_info_templete_field ADD COLUMN `serviceApiParams` varchar(1024) default '' COMMENT '事件服务接口请求参数'; ALTER TABLE mortals_sys_app_info_templete_field ADD COLUMN `serviceApiParams` varchar(1024) default '' COMMENT '事件服务接口请求参数';
-- ----------------------------
2023-10-17
-- ----------------------------
ALTER TABLE mortals_sys_window_hall ADD COLUMN `siteId` bigint(20) default '1' COMMENT '站点Id';
...@@ -38,7 +38,9 @@ public class UserEntityExt extends BaseEntityLong { ...@@ -38,7 +38,9 @@ public class UserEntityExt extends BaseEntityLong {
private List<ModelEntity> modleList; private List<ModelEntity> modleList;
/**
* 所属区域code,多个逗号分隔
*/
private String areaCodes;
} }
\ No newline at end of file
...@@ -43,14 +43,8 @@ public class SyncTreeSiteThread implements Runnable { ...@@ -43,14 +43,8 @@ public class SyncTreeSiteThread implements Runnable {
Context contextTemp = new Context(); Context contextTemp = new Context();
contextTemp.setUser(userEntity); contextTemp.setUser(userEntity);
siteService.setSiteTree(siteTreeSelects, contextTemp); siteService.setSiteTree(siteTreeSelects, contextTemp);
if(userEntity.getId()==2065L){
log.info("2065===>{}",JSON.toJSONString(userEntity));
}
} }
} }
// log.info("刷新用户站点树=》userID:{} siteIds:{} siteTree:{}",context.getUser().getId(),context.getUser().getSiteIds(), JSON.toJSONString(siteService.getSiteTree(context)));
} }
} }
...@@ -45,6 +45,9 @@ public interface AreaService extends ICRUDCacheService<AreaEntity,Long> { ...@@ -45,6 +45,9 @@ public interface AreaService extends ICRUDCacheService<AreaEntity,Long> {
List<AreaTreeSelect> buildAreaTreeSelect(List<AreaEntity> areaList); List<AreaTreeSelect> buildAreaTreeSelect(List<AreaEntity> areaList);
List<AreaTreeSelect> buildCustomAreaTreeSelect(List<AreaEntity> areaList);
/** /**
* 根据父id查询子节点 * 根据父id查询子节点
* @param parentId * @param parentId
...@@ -55,6 +58,7 @@ public interface AreaService extends ICRUDCacheService<AreaEntity,Long> { ...@@ -55,6 +58,7 @@ public interface AreaService extends ICRUDCacheService<AreaEntity,Long> {
/** /**
* 获取当前节点所有子节点 * 获取当前节点所有子节点
* @param rootId * @param rootId
......
...@@ -164,6 +164,31 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -164,6 +164,31 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
return returnList.stream().map(AreaTreeSelect::new).collect(Collectors.toList()); return returnList.stream().map(AreaTreeSelect::new).collect(Collectors.toList());
} }
/**
* @param areaList
* @return
*/
@Override
public List<AreaTreeSelect> buildCustomAreaTreeSelect(List<AreaEntity> areaList) {
List<AreaEntity> returnList = new ArrayList<>();
List<AreaEntity> list = this.find(new AreaQuery());
List<Long> tempList = areaList.stream().map(AreaEntity::getId).collect(Collectors.toList());
for (AreaEntity areaEntity : list) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(areaEntity.getPid())) {
recursionFn(list, areaEntity);
returnList.add(areaEntity);
}
}
if (returnList.isEmpty()) {
returnList = list;
}
return returnList.stream().map(AreaTreeSelect::new).collect(Collectors.toList());
}
@Override @Override
public List<AreaTreeSelect> getListByParentId(String parentId, Context context) { public List<AreaTreeSelect> getListByParentId(String parentId, Context context) {
if (ObjectUtils.isEmpty(parentId)) { if (ObjectUtils.isEmpty(parentId)) {
...@@ -186,6 +211,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -186,6 +211,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
return collect; return collect;
} }
@Override @Override
public List<AreaTreeSelect> getListByRootId(String rootId, Context context) { public List<AreaTreeSelect> getListByRootId(String rootId, Context context) {
if (ObjectUtils.isEmpty(rootId)) { if (ObjectUtils.isEmpty(rootId)) {
......
...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -73,6 +74,33 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic ...@@ -73,6 +74,33 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
} }
/**
* 获取站点下拉树列表
*/
@PostMapping("authAreaTree")
public String authAreaTree() {
Map<String, Object> model = new HashMap<>();
JSONObject ret = new JSONObject();
String busiDesc = "查询" + this.getModuleDesc();
int code = VALUE_RESULT_SUCCESS;
try {
List<String> areaCodeList = Arrays.asList(this.getContext().getUser().getAreaCodes().split(","));
AreaQuery areaQuery = new AreaQuery();
areaQuery.setAreaCodeList(areaCodeList);
List<AreaEntity> list = this.service.find(areaQuery);
List<AreaTreeSelect> treeSelects = this.service.buildCustomAreaTreeSelect(list);
model.put(KEY_RESULT_DATA, treeSelects);
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, code);
return ret.toJSONString();
}
/** /**
* 根据parentId查询子信息 * 根据parentId查询子信息
*/ */
...@@ -122,5 +150,4 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic ...@@ -122,5 +150,4 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
return ret.toJSONString(); return ret.toJSONString();
} }
} }
\ No newline at end of file
package com.mortals.xhx.module.window.model; package com.mortals.xhx.module.window.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.window.model.vo.WindowHallVo; import com.mortals.xhx.module.window.model.vo.WindowHallVo;
import lombok.Data; import lombok.Data;
/** /**
* 大厅窗口实体对象 * 大厅窗口实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-04-25 * @date 2023-10-17
*/ */
@Data @Data
public class WindowHallEntity extends WindowHallVo { public class WindowHallEntity extends WindowHallVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 窗口ID * 站点Id
*/ */
private Long siteId;
/**
* 窗口ID
*/
private Long windowId; private Long windowId;
/** /**
* 窗口名称 * 窗口名称
*/ */
private String windowName; private String windowName;
/** /**
* 大厅ID * 大厅ID
*/ */
private Long hallId; private Long hallId;
/** /**
* 大厅名称 * 大厅名称
*/ */
private String hallName; private String hallName;
/** /**
* 排序 * 排序
*/ */
private Integer sort; private Integer sort;
/** /**
* 备注 * 备注
*/ */
private String remark; private String remark;
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
...@@ -50,24 +57,19 @@ public class WindowHallEntity extends WindowHallVo { ...@@ -50,24 +57,19 @@ public class WindowHallEntity extends WindowHallVo {
if (obj instanceof WindowHallEntity) { if (obj instanceof WindowHallEntity) {
WindowHallEntity tmp = (WindowHallEntity) obj; WindowHallEntity tmp = (WindowHallEntity) obj;
if (this.getId() == tmp.getId()) { if (this.getId() == tmp.getId()) {
return true; return true;
} }
} }
return false; return false;
} }
public void initAttrValue(){ public void initAttrValue(){
this.siteId = null;
this.windowId = null; this.windowId = null;
this.windowName = "";
this.windowName = ""; this.hallId = null;
this.hallName = "";
this.hallId = null; this.sort = 0;
this.remark = "";
this.hallName = "";
this.sort = 0;
this.remark = "";
} }
} }
\ No newline at end of file
...@@ -15,6 +15,11 @@ client.global.set("authToken", JSON.parse(response.body).data.token); ...@@ -15,6 +15,11 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
%} %}
###构建站点树
POST {{baseUrl}}/area/authAreaTree
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIwNjY6MThhNmEyOGM0ZDNhNGQ3OTgyYjlhOWFlYjU0MDU3MTAifQ.Ex92WgtbmsV6EBONj5SO48iG7oy4l6imsIcNK-qtJUw
Accept: application/json
###首页 ###首页
POST {{baseUrl}}/login/index POST {{baseUrl}}/login/index
......
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