Commit 7be9cc17 authored by “yiyousong”'s avatar “yiyousong”
parents e8d87303 982a28aa
......@@ -28,7 +28,7 @@ public class SyncTreeSiteThread implements Runnable {
SiteService siteService = SpringUtils.getBean(SiteService.class);
List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context);
siteService.setSiteTree(siteTreeSelects, context);
// log.info("刷新用户站点树=》userID:{} siteIds:{} siteTree:{}",context.getUser().getId(),context.getUser().getSiteIds(), JSON.toJSONString(siteService.getSiteTree(context)));
log.info("刷新用户站点树=》userID:{} siteIds:{} siteTree:{}",context.getUser().getId(),context.getUser().getSiteIds(), JSON.toJSONString(siteService.getSiteTree(context)));
}
}
......@@ -26,6 +26,9 @@ import com.mortals.framework.springcloud.service.IApplicationStartedService;
import org.springframework.util.ObjectUtils;
import java.util.List;
import static com.mortals.xhx.common.key.Constant.USER_SITE_TREE;
@Component
@Slf4j
public class DemoStartedService implements IApplicationStartedService {
......@@ -35,10 +38,15 @@ public class DemoStartedService implements IApplicationStartedService {
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Autowired
private ICacheService cacheService;
@Override
public void start() {
logger.info("开始服务..[初始化用户站点树]");
//删除redis 中的 站点树
cacheService.del(USER_SITE_TREE);
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(0L);
......@@ -56,33 +64,6 @@ public class DemoStartedService implements IApplicationStartedService {
ThreadPool.getInstance().execute(syncTreeSiteThread);
/* userService.find(new UserQuery()).forEach(user->{
Context context = new Context();
context.setUser(user);
ThreadPool.getInstance().execute(new SyncTreeSiteThread(context));
});*/
/* if(ObjectUtils.isEmpty(userFeign)){
logger.info("userFeign未加载,加载本地用户");
userService.find(new UserQuery()).forEach(user->{
Context context = new Context();
context.setUser(user);
ThreadPool.getInstance().execute(new SyncTreeSiteThread(context));
});
return;
}*/
/* userFeign.list(new UserPdu()).getData().getData().stream().forEach(userPdu->{
Context context = new Context();
UserEntity entity = new UserEntity();
entity.initAttrValue();
BeanUtils.copyProperties(userPdu, entity, BeanUtil.getNullPropertyNames(userPdu));
context.setUser(entity);
ThreadPool.getInstance().execute(new SyncTreeSiteThread(context));
});*/
}
@Override
......
......@@ -209,6 +209,13 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
public List<SiteTreeSelect> siteTree(Context context) {
Map<String, AreaEntity> areaMap = new HashMap<>();
SiteQuery siteQuery = new SiteQuery();
//如果站点为空 或者用户为空 返回空数组
if (context.getUser() == null) {
return new ArrayList<>();
}
List<SiteEntity> siteList = new ArrayList<>();
if (context.getUser().getSiteIds() != null) {
Set<String> siteSet = Arrays.stream(context.getUser().getSiteIds().split(",")).filter(f -> !f.equals("")).collect(Collectors.toSet());
if (!ObjectUtils.isEmpty(siteSet)) {
......@@ -217,17 +224,20 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
siteQuery.idList(siteIdList);
}
}
//查詢指定的站點ids
log.info(String.format("siteQuery==>%s", JSON.toJSONString(siteQuery)));
siteList = this.find(siteQuery);
}
//查詢指定的站點ids
log.info(String.format("siteQuery==>%s", JSON.toJSONString(siteQuery)));
List<SiteEntity> siteList = this.find(siteQuery);
//如果是管理员 默认全部站点
if (context.getUser().isAdmin()) {
log.info("user is admin !");
if (context.getUser().isAdmin() || context.getUser().getId() == 0L) {
log.info("user is admin ! id:{}", context.getUser().getId());
siteList = this.find(new SiteQuery());
}
if (ObjectUtils.isEmpty(siteList)) {
return new ArrayList<>();
}
//turn to sitemap
Map<String, SiteEntity> siteMap = siteList.parallelStream().collect(Collectors.toMap(x -> x.getSiteCode(), y -> y, (o, n) -> n));
//遍历过滤站点树
......@@ -459,7 +469,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
throw new AppException("当前站点无子区域!");
}
siteAreaVo.setAreaCode(areaEntity.getAreaCode());
siteAreaVo.setAreaName(AreaLevelEnum.getByValue(areaEntity.getAreaLevel()).getValue()==AreaLevelEnum.地市州.getValue()?"市本级":areaEntity.getName());
siteAreaVo.setAreaName(AreaLevelEnum.getByValue(areaEntity.getAreaLevel()).getValue() == AreaLevelEnum.地市州.getValue() ? "市本级" : areaEntity.getName());
List<SiteEntity> siteEntityList = this.find(new SiteQuery().areaCode(areaEntity.getAreaCode()));
siteAreaVo.setSiteList(siteEntityList);
list.add(siteAreaVo);
......@@ -500,7 +510,11 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
if (!ObjectUtils.isEmpty(query.getSiteName())) {
SiteEntity siteEntity = this.selectOne(new SiteQuery().siteName(query.getSiteName()));
if (!ObjectUtils.isEmpty(siteEntity)) {
query.setAreaLevel(siteEntity.getAreaLevel());
AreaEntity areaCache = areaService.getExtCache(siteEntity.getAreaCode());
query.setAreaLevel(areaCache == null ? 1 : areaCache.getAreaLevel());
log.info("areaLevel:{}", query.getAreaLevel());
} else {
return Rest.ok(new ArrayList<>());
}
}
//获取所有层级的区域
......@@ -541,7 +555,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
public void setSiteTree(List<SiteTreeSelect> list, Context context) {
siteTreeMap.put(context.getUser().getId(), list);
//存放到redis中去
cacheService.hsetnx(USER_SITE_TREE, context.getUser().getId().toString(), JSON.toJSONString(list));
cacheService.hset(USER_SITE_TREE, context.getUser().getId().toString(), JSON.toJSONString(list));
}
@Override
......@@ -671,12 +685,12 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
// new MatterQuery().setMatterNoNotList();
// List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()));
// List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()));
//HashSet<String> matterNoSet = new HashSet<>();
Set<String> matterNoSet = matterService.getDao().getMatterListByAreaCode(new MatterQuery().areaCode(siteEntity.getAreaCode())).parallelStream().map(i->i.getMatterNo()).collect(Collectors.toSet());
Set<String> matterNoSet = matterService.getDao().getMatterListByAreaCode(new MatterQuery().areaCode(siteEntity.getAreaCode())).parallelStream().map(i -> i.getMatterNo()).collect(Collectors.toSet());
/* Integer page = 1;
Integer size = 200;
......
......@@ -19,10 +19,13 @@ public interface WindowDao extends ICRUDDao<WindowEntity, Long> {
String SQLID_SUB_HALL_LIST = "getSubHallList";
String SQLID_SUB_HALL_COUNT = "getSubHallListCount";
String SQLID_GETHALLBYDEPT = "getHallByDept";
Result<WindowEntity> getSubHallList(WindowEntity windowQuery, PageInfo pageInfo);
Result<WindowEntity> getHallByDept(WindowEntity windowQuery);
}
......@@ -52,6 +52,19 @@ public class WindowDaoImpl extends BaseCRUDDaoMybatis<WindowEntity, Long> implem
return result;
}
/**
* @param windowQuery
* @return
*/
@Override
public Result<WindowEntity> getHallByDept(WindowEntity windowQuery) {
Result<WindowEntity> result = new Result();
ParamDto paramDto = this.getQueryParam(windowQuery);
List list = this.getSqlSession().selectList(this.getSqlId(SQLID_GETHALLBYDEPT), paramDto);
result.setList(list);
return result;
}
public int getSubHallListCount(ParamDto paramDto) {
return this.getSqlSession().selectOne(this.getSqlId(SQLID_SUB_HALL_COUNT), this.cpyQueryParamDto(paramDto));
}
......
......@@ -45,4 +45,7 @@ public interface WindowService extends ICRUDCacheService<WindowEntity, Long> {
Result<WindowEntity> findSubHallList(WindowEntity windowQuery, PageInfo pageInfo, Context context) throws AppException;
Result<WindowEntity> getHallByDept(WindowEntity windowQuery, Context context) throws AppException;
}
\ No newline at end of file
......@@ -152,6 +152,17 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
return this.getDao().getSubHallList(windowQuery, pageInfo);
}
/**
* @param windowQuery
* @param context
* @return
* @throws AppException
*/
@Override
public Result<WindowEntity> getHallByDept(WindowEntity windowQuery, Context context) throws AppException {
return this.getDao().getHallByDept(windowQuery);
}
@Override
protected void removeAfter(Long[] ids, Context context, int result) throws AppException {
......
......@@ -42,8 +42,6 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
@Autowired
private ParamService paramService;
@Autowired
private WindowBusinessService windowBusinessService;
public WindowController() {
......@@ -112,4 +110,33 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
return ret;
}
@PostMapping(value = "getHallByDept")
@UnAuth
public Rest<Object> getHallByDept(@RequestBody WindowEntity query) {
Rest<Object> ret = new Rest<>();
Map<String, Object> model = new HashMap<>();
Context context = this.getContext();
String busiDesc = "根据部门查询所属大厅!";
int code = VALUE_RESULT_SUCCESS;
try {
Result<WindowEntity> result = this.getService().getHallByDept(query, context);
model.put(KEY_RESULT_DATA, result.getList());
model.put(PAGEINFO_KEY, result.getPageInfo());
parsePageInfo(model, result.getPageInfo());
model.put(MESSAGE_INFO, busiDesc + "成功");
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】");
}
} catch (Exception e) {
code = VALUE_RESULT_FAILURE;
this.doException(request, busiDesc, model, e);
}
this.init(model, context);
ret.setCode(code);
ret.setData(model);
ret.setMsg(model.get(MESSAGE_INFO) == null ? "" : model.remove(MESSAGE_INFO).toString());
return ret;
}
}
\ No newline at end of file
......@@ -32,4 +32,35 @@
</trim>
</select>
<!-- 根据部门id获取所属大厅 -->
<select id="getHallByDept" parameterType="paramDto" resultMap="WindowEntity-Map">
SELECT
deptId,deptName,hallId ,hallName
FROM
mortals_sys_window w,
mortals_sys_window_hall wh
<trim suffixOverrides="where" suffix="">
where w.id = wh.windowId and
<trim prefixOverrides="and" prefix="">
<if test="condition.siteId!=null and condition.siteId!=''">
and w.siteId = #{condition.siteId}
</if>
<if test="condition.deptId!=null and condition.deptId!=''">
and w.deptId = #{condition.deptId}
</if>
<if test="condition.containsKey('deptIdList')">
and w.deptId in
<foreach collection="condition.deptIdList" open="(" close=")" index="index"
item="item" separator=",">
#{item}
</foreach>
</if>
</trim>
GROUP BY
wh.hallId
</trim>
</select>
</mapper>
\ No newline at end of file
......@@ -65,7 +65,7 @@ Accept: application/json
###构建站点树
GET {{baseUrl}}/site/siteTree
#Authorization: {{authToken}}
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjM1OmVjZTkyMWQ1MzY2NDRkMmRhZTU0YmU0ZjA4ODE0OWZkIn0.EXKwA8I8t5rK864aJqMEh51XZ8IPtjG3juV51mgJf80
Authorization: eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjE6NTgyNzRlMWM1MDlhNDQ2YzhmYjVlMDRkNjNlM2JmOTAifQ.dLq6-GLVOPvxq66pbqpj0K5qx1y3FzbKzbKq-wCxOr4
Accept: application/json
......@@ -87,7 +87,7 @@ POST {{baseUrl}}/site/getAreaSitesByAreaLevel
Content-Type: application/json
{
"areaLevel":2
"siteName":"徐州区办事处"
}
###站点列表
......
......@@ -5,7 +5,7 @@ Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"password":"xhx@yb888",
"securityCode":"8888"
}
......@@ -163,4 +163,14 @@ Content-Type: application/x-www-form-urlencoded
businessid=125&matter=125&devicenum=C0-FB-F9-CD-3B-5D&peopleid=13
### 参数列表组合查询
POST {{baseUrl}}/param/list
Content-Type: application/json
{
"page":1,
"size": -1,
"firstOrganize": "Window",
"secondOrganize": "hongqi"
}
......@@ -22,6 +22,15 @@ Content-Type: application/json
}
###站点部门窗口列表
POST {{baseUrl}}/window/getHallByDept
Content-Type: application/json
{
"deptId":426
}
###站点部门窗口更新与保存
POST {{baseUrl}}/window/save
Content-Type: application/json
......
import http from "../request/http";
let baseURL = process.env.VUE_APP_API_BASE_URL;
let BASEURL = process.env.VUE_APP_API_PHP_URL;
let BAS_EURL = process.env.VUE_APP_API_IMG_URL
// 1.15.1. 获取站点下的数据管理列表
export function censusListInterface(params) {
return http.post(`${baseURL}/zwfw/site/model/census/list`, params);
}
/* 排号机部分 */
// 大厅列表数据
export function getDatingList(params) {
return http.post(`${BAS_EURL}base/site/hall/list`, params);
}
// 部门列表数据
export function getBumenList(params) {
return http.post(`${BAS_EURL}base/dept/list`, params);
}
//排号机列表数据
export function getTaskList(params) {
return http.get(`${BASEURL}/admin/take/takelist`, params);
......
......@@ -10,6 +10,18 @@
</div>
<span>
<a-space>
<a-select v-model="searchForm.hallid">
<a-select-option value=""> 全部大厅 </a-select-option>
<a-select-option v-for="item in datingList" :key="item.id" :value="item.id">
{{ item.hallName }}
</a-select-option>
</a-select>
<a-select v-model="searchForm.sectionid">
<a-select-option value=""> 全部部门 </a-select-option>
<a-select-option v-for="item in bumenList" :key="item.id" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
<a-select v-model="searchForm.id">
<a-select-option value=""> 全部设备 </a-select-option>
<a-select-option v-for="item in deviceData" :key="item.id" :value="item.id">
......@@ -116,6 +128,8 @@ import BusinessInfo from "./components/businessInfo.vue";
import WorkpeopleInfo from "./components/workpeopleInfo.vue";
import HandlingDetails from "./components/HandlingDetails.vue";
import {
getDatingList,
getBumenList,
getTaskList,
getQueueData,
getQueueInfo,
......@@ -264,6 +278,8 @@ export default {
style: "", // 状态
time: [moment().format("YYYY-MM-DD"), moment().format("YYYY-MM-DD")], // 时间区间
flownum: "", // 排号编码
hallid:"",
sectionid:""
},
//状态
style: [
......@@ -289,6 +305,10 @@ export default {
},
tableSelectedKeys: [],
tableSelectedRows: [],
// 大厅列表
datingList:[],
// 部门列表
bumenList:[],
};
},
components: {
......@@ -298,11 +318,25 @@ export default {
HandlingDetails,
},
created() {
this.getDatingListArr();
this.getBumenListArr();
this.getTaskListArr();
this.getQueueDataArr();
},
mounted() { },
methods: {
// 获取大厅列表
async getDatingListArr() {
await getDatingList({ page: 1, size: -1 }).then((res) => {
this.datingList = res.data.data;
});
},
// // 获取部门列表
async getBumenListArr() {
await getBumenList({ page: 1, size: -1 }).then((res) => {
this.bumenList = res.data.data;
});
},
//重置按钮
resetBtn() {
this.tablePagination.current = 1;
......
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