Commit 77c2ba28 authored by 赵啸非's avatar 赵啸非

添加根据区域编码查询基础事项

parent fc79ef4e
package com.mortals.xhx.feign.site;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 站点 Feign接口
*
* @author zxfei
* @date 2022-06-28
*/
@FeignClient(name = "base-manager", path = "/base", fallbackFactory = SiteFeignFallbackFactory.class)
public interface ISiteFeign extends IFeign {
/**
* 查看站点列表
*
* @param sitePdu
* @return
*/
@PostMapping(value = "/site/list")
Rest<RespData<List<SitePdu>>> list(@RequestBody SitePdu sitePdu);
/**
* 查看站点
*
* @param id
* @return
*/
@GetMapping(value = "/site/info")
Rest<SitePdu> info(@RequestParam(value = "id") Long id);
/**
* 删除站点
*
* @param ids
* @return
*/
@GetMapping(value = "/site/delete")
Rest<Void> delete(Long[] ids, @RequestHeader("Authorization") String authorization);
/**
* 站点保存更新
*
* @param sitePdu
* @return
*/
@PostMapping(value = "/site/save")
Rest<RespData<SitePdu>> save(@RequestBody SitePdu sitePdu, @RequestHeader("Authorization") String authorization);
/**
* 获取站点树
*
* @return
*/
@GetMapping(value = "/site/siteTree")
String siteTree(@RequestHeader("Authorization") String authorization);
/**
* 查询站点及子站点
*
* @param sitePdu
* @return
*/
@PostMapping(value = "/site/getFlatSitesBySiteId")
Rest<List<SitePdu>> getFlatSitesBySiteId(@RequestBody SitePdu sitePdu);
/**
* 查询站点及子站点
*
* @param sitePdu
* @return
*/
@PostMapping(value = "/site/getFlatSitesByAreaCode")
Rest<List<SitePdu>> getFlatSitesByAreaCode(@RequestBody SitePdu sitePdu);
}
@Slf4j
@Component
class SiteFeignFallbackFactory implements FallbackFactory<ISiteFeign> {
@Override
public ISiteFeign create(Throwable t) {
log.error("异常:", t);
return new ISiteFeign() {
@Override
public Rest<RespData<List<SitePdu>>> list(SitePdu sitePdu) {
return Rest.fail("暂时无法获取站点列表,请稍后再试!");
}
@Override
public Rest<SitePdu> info(Long id) {
return Rest.fail("暂时无法获取站点详细,请稍后再试!");
}
@Override
public Rest<Void> delete(Long[] ids, String authorization) {
return Rest.fail("暂时无法删除站点,请稍后再试!");
}
@Override
public Rest<RespData<SitePdu>> save(SitePdu sitePdu, String authorization) {
return Rest.fail("暂时无法保存站点,请稍后再试!");
}
@Override
public String siteTree(String authorization) {
return JSON.toJSONString(Rest.fail("暂时无法获取站点树,请稍后再试!"));
}
@Override
public Rest<List<SitePdu>> getFlatSitesBySiteId(SitePdu sitePdu) {
return Rest.fail("暂时无法获取站点子站点,请稍后再试!");
}
@Override
public Rest<List<SitePdu>> getFlatSitesByAreaCode(SitePdu sitePdu) {
return Rest.fail("暂时无法获取站点子站点,请稍后再试!");
}
};
}
}
......@@ -344,7 +344,7 @@ export default {
page: this.leftCurrent,
size: this.leftSize,
matterName: this.leftSearch,
deptId: this.departmentLeft,
deptCode: this.departmentLeft,
siteId: this.siteId,
});
if (res.data.code === 1) {
......
......@@ -16,23 +16,23 @@
>
</div>
<div slot="right" class="flex">
<!-- <el-select
<el-select
v-model="departmentLeft"
size="small"
placeholder="选择部门"
class="autoWidth"
>
<template slot="prefix">
{{ (deptList.find((v) => v.id === departmentLeft) || {}).name }}
{{ (deptList.find((v) => v.deptCode === departmentLeft) || {}).name }}
</template>
<el-option
v-for="item in deptList"
:key="item.id"
:key="item.deptNumber"
:label="item.name"
:value="item.id"
:value="item.deptNumber"
>
</el-option>
</el-select>-->
</el-select>
<el-input
size="small"
style="width: 200px"
......@@ -161,7 +161,7 @@
>
</div>
<div slot="right" class="flex">
<!-- <el-select
<el-select
v-model="departmentRight"
size="small"
placeholder="选择部门"
......@@ -169,17 +169,17 @@
>
<template slot="prefix">
{{
(deptList.find((v) => v.id === departmentRight) || {}).name
(deptList.find((v) => v.deptCode === departmentRight) || {}).name
}}
</template>
<el-option
v-for="item in deptList"
:key="item.id"
:key="item.deptNumber"
:label="item.name"
:value="item.id"
:value="item.deptNumber"
>
</el-option>
</el-select>-->
</el-select>
<el-input
size="small"
style="width: 200px"
......@@ -330,8 +330,8 @@ export default {
page: this.rightCurrent,
size: this.rightSize,
matterName: this.rightSearch,
deptId: this.departmentRight,
//siteId: this.siteId,
deptCode: this.departmentRight,
siteId: this.siteId,
});
if (res.data.code === 1) {
let { total, data } = res.data.data;
......@@ -348,7 +348,7 @@ export default {
page: this.leftCurrent,
size: this.leftSize,
matterName: this.leftSearch,
deptId: this.departmentLeft,
deptCode: this.departmentLeft,
siteId: this.siteId,
});
if (res.data.code === 1) {
......
package com.mortals.xhx.module.sheet.web;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -37,6 +42,8 @@ public class SheetMatterController extends BaseCRUDJsonBodyMappingController<She
@Autowired
private ParamService paramService;
@Autowired
private ISiteFeign siteFeign;
public SheetMatterController(){
super.setModuleDesc( "基础事项");
......@@ -85,6 +92,11 @@ public class SheetMatterController extends BaseCRUDJsonBodyMappingController<She
if(!ObjectUtils.isEmpty(query.getMatterName())){
query.setMatterName("%"+query.getMatterName()+"%");
}
Rest<SitePdu> rest = siteFeign.info(query.getSiteId());
if(rest.getCode()== YesNoEnum.YES.getValue()){
query.setSiteId(null);
query.setAreaCode(rest.getData().getAreaCode());
}
super.doListBefore(query, model, context);
}
}
\ No newline at end of file
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