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

添加样表设备部门过滤

parent c0f0041c
......@@ -15,9 +15,11 @@ import com.mortals.framework.web.BaseJsonBodyController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.dept.DeptPdu;
import com.mortals.xhx.feign.base.IApiBaseManagerFeign;
import com.mortals.xhx.feign.base.pdu.DeptPdu;
import com.mortals.xhx.feign.base.pdu.SitePdu;
import com.mortals.xhx.feign.dept.IDeptFeign;
import com.mortals.xhx.feign.rsp.ApiResp;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.baseset.model.BasesetEntity;
......@@ -65,6 +67,8 @@ public class HomeController extends BaseJsonBodyController {
private ISiteFeign siteFeign;
@Autowired
private BasesetService basesetService;
@Autowired
private IDeptFeign deptFeign;
@PostMapping({"site/list"})
public Rest<Object> list() {
......@@ -136,13 +140,13 @@ public class HomeController extends BaseJsonBodyController {
List<Long> deptIdList = deviceMatterDatumService.find(new DeviceMatterDatumQuery().deviceCode(queryPdu.getDeviceCode())).stream().map(item -> item.getDeptId()).collect(Collectors.toList());
deptPdu.setIdList(deptIdList);
}
String resp = iApiBaseManagerFeign.getDeptByQuery(deptPdu);
ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
Rest<RespData<List<DeptPdu>>> apiResp = deptFeign.list(deptPdu);
// ApiResp<JSONObject> apiResp = JSON.parseObject(resp, ApiResp.class);
if (apiResp.getCode() != YesNoEnum.YES.getValue()) {
throw new AppException("获取用户站点部门列表失败:" + apiResp.getMsg());
}
if (apiResp.getData().get("data") != null) {
model.put("data", apiResp.getData().get("data"));
if (apiResp.getData().getData()!= null) {
model.put("data", apiResp.getData().getData());
} else {
model.put("data", Collections.emptyList());
}
......@@ -173,8 +177,15 @@ public class HomeController extends BaseJsonBodyController {
model.put("deptMap", new HashMap<>());
try {
if (queryPdu.getSiteId() != null) {
Map<String, String> deptMap = matterService.find(new MatterQuery().siteId(queryPdu.getSiteId())).stream().collect(Collectors.toMap(x -> x.getDeptCode(), y -> y.getDeptName(), (o, n) -> n));
model.put("deptMap", deptMap);
if (!ObjectUtils.isEmpty(queryPdu.getDeviceCode())) {
Map<String, String> deptMap = deviceMatterDatumService.find(new DeviceMatterDatumQuery().siteId(queryPdu.getSiteId()).deviceCode(queryPdu.getDeviceCode())).stream().collect(Collectors.toMap(x -> x.getDeptCode(), y -> y.getDeptName(), (o, n) -> n));
;
model.put("deptMap", deptMap);
// deptPdu.setIdList(deptIdList);
} else {
Map<String, String> deptMap = matterService.find(new MatterQuery().siteId(queryPdu.getSiteId())).stream().collect(Collectors.toMap(x -> x.getDeptCode(), y -> y.getDeptName(), (o, n) -> n));
model.put("deptMap", deptMap);
}
}
model.put("message_info", busiDesc + "成功");
this.recordSysLog(this.request, busiDesc + " 【成功】");
......
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