From 99c0d0e0cab48e7e30bca2256ebac43b96ca1e50 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 15:04:03 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9C=BA=E6=9E=84=E6=A8=A1=E5=9D=97-=E9=83=A8?= =?UTF-8?q?=E9=97=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/AddAgencyFormDTO.java | 78 ++++++++++ .../epmet/dto/form/AgencydetailFormDTO.java | 43 ++++++ .../com/epmet/dto/form/EditAgencyFormDTO.java | 48 ++++++ .../epmet/dto/form/RemoveAgencyFormDTO.java | 42 ++++++ .../com/epmet/dto/form/SubAgencyFormDTO.java | 43 ++++++ .../epmet/dto/result/AddAgencyResultDTO.java | 40 +++++ .../dto/result/AgencydetailResultDTO.java | 82 +++++++++++ .../epmet/dto/result/ParentListResultDTO.java | 46 ++++++ .../epmet/dto/result/SubAgencyResultDTO.java | 48 ++++++ .../epmet/dto/result/SubListResultDTO.java | 45 ++++++ .../constant/CustomerAgencyConstant.java | 25 ++++ .../controller/CustomerAgencyController.java | 77 ++++++++-- .../java/com/epmet/dao/CustomerAgencyDao.java | 18 +++ .../epmet/service/CustomerAgencyService.java | 45 +++++- .../impl/CustomerAgencyServiceImpl.java | 138 +++++++++++++++++- .../resources/mapper/CustomerAgencyDao.xml | 22 +++ 16 files changed, 826 insertions(+), 14 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java new file mode 100644 index 0000000000..57c2e2939d --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddAgencyFormDTO.java @@ -0,0 +1,78 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 添加组织-接口入参 + * + * @author sun + */ +@Data +public class AddAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 上级机关组织Id(当前机关组织添加下级组织) + */ + @NotBlank(message = "上级机关组织ID不能为空") + private String pid; + + /** + * 机构组织名称 + */ + @NotBlank(message = "组织名称不能为空") + private String agencyName; + + /** + * 机关级别(社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private Integer areaCode; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java new file mode 100644 index 0000000000..0f3b999026 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取组织机构信息接口入参 + * + * @author sun + */ +@Data +public class AgencydetailFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java new file mode 100644 index 0000000000..e4a410120e --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/EditAgencyFormDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织名称编辑-接口入参 + * + * @author sun + */ +@Data +public class EditAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + + /** + * 机关组织名称 + */ + @NotBlank(message = "机关组织名称不能为空") + private String agencyName; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java new file mode 100644 index 0000000000..5caaec7ea5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/RemoveAgencyFormDTO.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 删除组织机关-接口入参 + * + * @author sun + */ +@Data +public class RemoveAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java new file mode 100644 index 0000000000..6cdf21a193 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/SubAgencyFormDTO.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-下级机关列表-接口入参 + * + * @author sun + */ +@Data +public class SubAgencyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + @NotBlank(message = "机关组织ID不能为空") + private String agencyId; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java new file mode 100644 index 0000000000..01f072752a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AddAgencyResultDTO.java @@ -0,0 +1,40 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 添加组织-接口返参 + * + * @author sun + */ +@Data +public class AddAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java new file mode 100644 index 0000000000..4fed7005d9 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencydetailResultDTO.java @@ -0,0 +1,82 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + + +/** + * 组织首页-获取组织机构信息接口返参 + * + * @author sun + */ +@Data +public class AgencydetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + + /** + * 组织名称 + */ + private String agencyName; + + /** + * 机关级别(社区级:community, + * 乡(镇、街道)级:street, + * 区县级: district, + * 市级: city + * 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private Integer areaCode; + + /** + * 国家 + */ + private String country; + + /** + * 省份 + */ + private String province; + + /** + * 城市 + */ + private String city; + + /** + * 本机关的所有上级机关 + */ + private List parentList; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java new file mode 100644 index 0000000000..73608b1943 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 组织首页-获取组织机构信息接口-本机关的所有上级机关信息 + * + * @author sun + */ +@Data +public class ParentListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String id; + /** + * 机关组织名称 + */ + private String name; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java new file mode 100644 index 0000000000..ea9810c94c --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubAgencyResultDTO.java @@ -0,0 +1,48 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + + +/** + * 组织首页-下级机关列表-接口返参 + * + * @author sun + */ +@Data +public class SubAgencyResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 下级机关总数 + */ + private Integer subAgencyCount; + + /** + * 下级机关总数 + */ + private List agencyList; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java new file mode 100644 index 0000000000..57ab12c3df --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubListResultDTO.java @@ -0,0 +1,45 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 组织首页-下级机关列表-查询本机关的直属下一级机关 + * + * @author sun + */ +@Data +public class SubListResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 机关组织Id + */ + private String agencyId; + /** + * 机关组织名称 + */ + private String agencyName; + + +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java new file mode 100644 index 0000000000..42d40b0199 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java @@ -0,0 +1,25 @@ +package com.epmet.constant; + +/** + * @author sun + * @dscription + */ +public interface CustomerAgencyConstant { + + /** + * 组织名称编辑修改失败 + */ + String UPDATE_EXCEPTION = "组织机构信息更新失败"; + /** + * 添加组织失败 + */ + String SAVE_EXCEPTION = "组织机构新增失败"; + /** + * 不允许删除组织 + */ + String NOT_DEL_AGENCY = "当前组织存在下级组织,不允许删除"; + /** + * 组织删除失败 + */ + String DEL_EXCEPTION = "组织删除失败"; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index a1e5ea58fe..9caad715cc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -26,8 +26,11 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddAgencyResultDTO; +import com.epmet.dto.result.AgencydetailResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.excel.CustomerAgencyExcel; import com.epmet.service.CustomerAgencyService; import org.springframework.beans.factory.annotation.Autowired; @@ -47,24 +50,24 @@ import java.util.Map; @RestController @RequestMapping("customeragency") public class CustomerAgencyController { - + @Autowired private CustomerAgencyService customerAgencyService; @GetMapping("page") - public Result> page(@RequestParam Map params){ + public Result> page(@RequestParam Map params) { PageData page = customerAgencyService.page(params); return new Result>().ok(page); } @GetMapping("{id}") - public Result get(@PathVariable("id") String id){ + public Result get(@PathVariable("id") String id) { CustomerAgencyDTO data = customerAgencyService.get(id); return new Result().ok(data); } @PostMapping - public Result save(@RequestBody CustomerAgencyDTO dto){ + public Result save(@RequestBody CustomerAgencyDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); customerAgencyService.save(dto); @@ -72,7 +75,7 @@ public class CustomerAgencyController { } @PutMapping - public Result update(@RequestBody CustomerAgencyDTO dto){ + public Result update(@RequestBody CustomerAgencyDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); customerAgencyService.update(dto); @@ -80,7 +83,7 @@ public class CustomerAgencyController { } @DeleteMapping - public Result delete(@RequestBody String[] ids){ + public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); customerAgencyService.delete(ids); @@ -94,14 +97,70 @@ public class CustomerAgencyController { } /** - * @return com.epmet.commons.tools.utils.Result> * @param staffOrgsFormDTO + * @return com.epmet.commons.tools.utils.Result> * @Author yinzuomei * @Description 登录-获取工作人员所有组织 * @Date 2020/4/20 21:59 **/ @PostMapping("getStaffOrgList") - public Result> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO){ + public Result> getStaffOrgList(@RequestBody StaffOrgFormDTO staffOrgsFormDTO) { return customerAgencyService.getStaffOrgList(staffOrgsFormDTO); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + @PostMapping("addagency") + public Result addAgency(@RequestBody AddAgencyFormDTO formDTO) { + return customerAgencyService.addAgency(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + @PostMapping("editagency") + public Result editAgency(@RequestBody EditAgencyFormDTO formDTO) { + return customerAgencyService.editAgency(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + @PostMapping("removeagency") + public Result removeAgency(@RequestBody RemoveAgencyFormDTO formDTO) { + return customerAgencyService.removeAgency(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + @PostMapping("agencydetail") + public Result agencyDetail(@RequestBody AgencydetailFormDTO formDTO) { + return customerAgencyService.agencyDetail(formDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + @PostMapping("subagencylist") + public Result subAgencyList(@RequestBody SubAgencyFormDTO formDTO) { + return customerAgencyService.subAgencyList(formDTO); + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 4f85e09091..0dc66e7bdd 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -18,7 +18,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ParentListResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.SubListResultDTO; import com.epmet.entity.CustomerAgencyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -41,4 +43,20 @@ public interface CustomerAgencyDao extends BaseDao { * @Date 2020/4/20 21:48 **/ List selectStaffOrgList(@Param("customerIdList") List customerIdList); + + /** + * @param listStr + * @return + * @Author sun + * @Description 查询当前机关的所有上级组织信息 + **/ + List selectPAgencyById(@Param("listStr") List listStr); + + /** + * @param pId + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + **/ + List selectSubAgencyById(@Param("pId") String pId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 62892b4576..7076fe6d2d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -21,8 +21,11 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.StaffOrgFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.AddAgencyResultDTO; +import com.epmet.dto.result.AgencydetailResultDTO; import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.result.SubAgencyResultDTO; import com.epmet.entity.CustomerAgencyEntity; import java.util.List; @@ -104,4 +107,44 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/4/20 21:45 **/ Result> getStaffOrgList(StaffOrgFormDTO staffOrgsFormDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + Result addAgency(AddAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + Result editAgency(EditAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + Result removeAgency(RemoveAgencyFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + Result agencyDetail(AgencydetailFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + Result subAgencyList(SubAgencyFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 2a2b79a024..4d17f1a674 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -21,21 +21,27 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerAgencyConstant; import com.epmet.dao.CustomerAgencyDao; import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.form.StaffOrgFormDTO; -import com.epmet.dto.result.StaffOrgsResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -49,6 +55,7 @@ import java.util.Map; @Service public class CustomerAgencyServiceImpl extends BaseServiceImpl implements CustomerAgencyService { + private static final Logger log = LoggerFactory.getLogger(CustomerAgencyServiceImpl.class); @Autowired private CustomerAgencyRedis customerAgencyRedis; @@ -68,8 +75,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -112,4 +119,127 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl list = baseDao.selectStaffOrgList(staffOrgsFormDTO.getCustomerIdList()); return new Result>().ok(list); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 添加组织 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result addAgency(AddAgencyFormDTO formDTO) { + Result result = new Result(); + AddAgencyResultDTO addAgencyResultDTO = new AddAgencyResultDTO(); + //0:属性映射赋值 + CustomerAgencyEntity entity = ConvertUtils.sourceToTarget(formDTO, CustomerAgencyEntity.class); + entity.setOrganizationName(formDTO.getAgencyName()); + entity.setTotalUser(NumConstant.ZERO); + //1:查询上级机关信息 + CustomerAgencyEntity parentEntity = baseDao.selectById(formDTO.getPid()); + entity.setCustomerId(parentEntity.getCustomerId()); + if (null == parentEntity.getPid()) { + entity.setPids(parentEntity.getId()); + entity.setAllParentName(parentEntity.getOrganizationName()); + } else { + entity.setPids(":" + parentEntity.getId()); + entity.setAllParentName("-" + parentEntity.getOrganizationName()); + } + //2:保存组织信息 + if (baseDao.insert(entity) < NumConstant.ONE) { + log.error(CustomerAgencyConstant.SAVE_EXCEPTION); + throw new RenException(CustomerAgencyConstant.SAVE_EXCEPTION); + } + //3:返回新组织Id + addAgencyResultDTO.setAgencyId(entity.getId()); + return result.ok(addAgencyResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织名称编辑 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result editAgency(EditAgencyFormDTO formDTO) { + Result result = new Result(); + CustomerAgencyEntity entity = new CustomerAgencyEntity(); + entity.setId(formDTO.getAgencyId()); + entity.setOrganizationName(formDTO.getAgencyName()); + if (baseDao.updateById(entity) < NumConstant.ONE) { + log.error(CustomerAgencyConstant.UPDATE_EXCEPTION); + throw new RenException(CustomerAgencyConstant.UPDATE_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 删除组织机关 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result removeAgency(RemoveAgencyFormDTO formDTO) { + Result result = new Result(); + //1:查询当前机关是否存在所属下级机关,存在下级的不能删除 + List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); + if (null != agencyList && agencyList.size() > NumConstant.ZERO) { + result.setMsg(CustomerAgencyConstant.NOT_DEL_AGENCY); + return result; + } + //2:删除当前机关组织(逻辑删) + if (baseDao.deleteById(formDTO.getAgencyId()) < NumConstant.ONE) { + log.error(CustomerAgencyConstant.DEL_EXCEPTION); + throw new RenException(CustomerAgencyConstant.DEL_EXCEPTION); + } + return result; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-获取组织机构信息 + */ + @Override + public Result agencyDetail(AgencydetailFormDTO formDTO) { + AgencydetailResultDTO agencydetailResultDTO = new AgencydetailResultDTO(); + //1:查询本机关详细信息 + CustomerAgencyEntity entity = baseDao.selectById(formDTO.getAgencyId()); + if (null == entity) { + return new Result().ok(agencydetailResultDTO); + } + agencydetailResultDTO = ConvertUtils.sourceToTarget(entity, AgencydetailResultDTO.class); + agencydetailResultDTO.setAgencyId(entity.getId()); + agencydetailResultDTO.setAgencyName(entity.getOrganizationName()); + //2:查询本机关的所有上级机关,按自上而下层级顺序 + if (null == entity.getPids()) { + return new Result().ok(agencydetailResultDTO); + } + List listStr = Arrays.asList(entity.getPids().split(":")); + List parentList = baseDao.selectPAgencyById(listStr); + agencydetailResultDTO.setParentList(parentList); + return new Result().ok(agencydetailResultDTO); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 组织首页-下级机关列表 + */ + @Override + public Result subAgencyList(SubAgencyFormDTO formDTO) { + SubAgencyResultDTO subAgencyResultDTO = new SubAgencyResultDTO(); + //1:根据当前机关Id查询直属下一级机关列表 + List agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); + subAgencyResultDTO.setAgencyList(agencyList); + //2:统计下一级机关数 + subAgencyResultDTO.setSubAgencyCount(agencyList.size()); + return new Result().ok(subAgencyResultDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 03f2671806..a80b7334c4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -37,4 +37,26 @@ #{customerId} + + + + \ No newline at end of file From 61bec2dc5b250a221c8a23064d0c0b75d2a27d4b Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Apr 2020 15:31:35 +0800 Subject: [PATCH 2/7] =?UTF-8?q?1.=20=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A7=92=E8=89=B2=E4=B8=8B=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/StaffRoleFormDTO.java | 22 ++++++++++++++++--- .../epmet/controller/StaffRoleController.java | 19 +++++++++++++--- .../java/com/epmet/dao/GovStaffRoleDao.java | 15 +++++++++++++ .../epmet/service/GovStaffRoleService.java | 8 +++++++ .../service/impl/GovStaffRoleServiceImpl.java | 11 ++++++++++ .../main/resources/mapper/GovStaffRoleDao.xml | 13 +++++++++++ 6 files changed, 82 insertions(+), 6 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java index ac116b4a4f..02ffc22867 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StaffRoleFormDTO.java @@ -7,12 +7,28 @@ import javax.validation.constraints.NotBlank; @Data public class StaffRoleFormDTO { - @NotBlank(message = "工作人员ID不能为空") + /**===========校验分组开始============*/ + + // 查询工作人员角色列表group + public interface GetRolesOfStaff {} + + // 查询某角色下的人员列表group + public interface GetStaffsInRole {} + + /**===========校验分组结束============*/ + + @NotBlank(message = "工作人员ID不能为空", groups = {GetRolesOfStaff.class}) private String staffId; /** - * 机构id,可以是agencyId,DeptId,GridId + * 组织id,可以是agencyId,DeptId,GridId */ - @NotBlank(message = "工作人员所属组织ID不能为空") + @NotBlank(message = "工作人员所属组织ID不能为空", groups = {GetRolesOfStaff.class, GetStaffsInRole.class}) private String orgId; + + /** + * 角色key + */ + @NotBlank(message = "角色Key不能为空", groups = {GetStaffsInRole.class}) + private String roleKey; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java index 8e6fcba4ac..73a94b7740 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -3,7 +3,6 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; @@ -32,12 +31,12 @@ public class StaffRoleController { private GovStaffRoleService govStaffRoleService; /** - * 根据工作人员查询工作人员具有的角色列表 + * 查询工作人员具有的角色列表 * @return */ @PostMapping("staffroles") public Result> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { - ValidatorUtils.validateEntity(staffRoleFormDTO); + ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetRolesOfStaff.class); String staffId = staffRoleFormDTO.getStaffId(); String orgId = staffRoleFormDTO.getOrgId(); List staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId); @@ -50,4 +49,18 @@ public class StaffRoleController { return new Result>().ok(staffRoleDTOS); } + /** + * 查询拥有指定角色的用户列表 + * @param staffRoleFormDTO + * @return + */ + @PostMapping("staffsinrole") + public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); + String roleKey = staffRoleFormDTO.getRoleKey(); + String orgId = staffRoleFormDTO.getOrgId(); + List roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId); + return new Result>().ok(roleDTOS); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index 8967f79733..fa244dce1c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.GovStaffRoleDTO; import com.epmet.entity.GovStaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -33,5 +34,19 @@ import java.util.List; @Mapper public interface GovStaffRoleDao extends BaseDao { + /** + * 根据staffId查询具有的角色列表 + * @param staffId + * @param orgId + * @return + */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); + + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 942a001921..8de688b50b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -99,4 +99,12 @@ public interface GovStaffRoleService extends BaseService { * @return */ List listRolesByStaffId(String staffId, String orgId); + + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffsInRole(String roleKey, String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index fac6d94901..b0249006aa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -111,4 +111,15 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { + return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index 95949edd10..e2b1d6fe7e 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -17,6 +17,7 @@ + + + + \ No newline at end of file From 66c36c29911ed71e53f17d963f3c15727de351fe Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Thu, 23 Apr 2020 15:34:04 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/StaffGridListDTO.java | 34 ++++++++++ .../epmet/dto/result/GridDetailResultDTO.java | 68 +++++++++++++++++++ .../com/epmet/controller/GridController.java | 36 ++++++++++ .../java/com/epmet/dao/CustomerGridDao.java | 17 +++++ .../com/epmet/feign/EpmetUserFeignClient.java | 14 ++-- .../EpmetUserFeignClientFallBack.java | 23 +++++++ .../EpmetUserFeignClientFallback.java | 24 ++++--- .../epmet/service/CustomerGridService.java | 8 +++ .../service/impl/CustomerGridServiceImpl.java | 15 ++++ .../main/resources/mapper/CustomerGridDao.xml | 30 ++++++++ .../controller/CustomerStaffController.java | 14 ++++ .../java/com/epmet/dao/CustomerStaffDao.java | 9 +++ .../epmet/service/CustomerStaffService.java | 10 +++ .../impl/CustomerStaffServiceImpl.java | 9 +++ .../resources/mapper/CustomerStaffDao.xml | 18 +++++ 15 files changed, 316 insertions(+), 13 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java new file mode 100644 index 0000000000..dc25ece228 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffGridListDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto; + +import lombok.Data; + +/** + * @Auther zxc + * @Create 2020-04-23 10:38 + */ +@Data +public class StaffGridListDTO { + + private static final long serialVersionUID = 1L; + + /** + * 用户id + */ + private String staffId; + + /** + * 用户姓名 + */ + private String staffName; + + /** + * 用户头像 + */ + private String staffHeadPhoto; + + /** + * 角色名称 + */ + private String roleName; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java new file mode 100644 index 0000000000..f822ea7773 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridDetailResultDTO.java @@ -0,0 +1,68 @@ +package com.epmet.dto.result; + +import com.epmet.dto.StaffGridListDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Auther zxc + * @Create 2020-04-23 10:28 + */ +@Data +public class GridDetailResultDTO implements Serializable { + + private static final long serialVersionUID = -1L; + + /** + * 网格id + */ + private String grid; + + /** + * 网格名称 + */ + private String gridName; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置维度 + */ + private String latitude; + + /** + * 所属地区码(所属组织地区码) + */ + private String areaCode; + + /** + * 管辖区域 + */ + private String manageDistrict; + + /** + * 当前网格总人数 + */ + private Integer totalUser; + + /** + * 所属组织机构ID(customer_agencys.id) + */ + private String agencyId; + + /** + * 所有上级组织ID + */ + private String pIds; + + /** + * 网格用户信息集合 + */ + private List staffGridList; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java new file mode 100644 index 0000000000..2f2b919b20 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java @@ -0,0 +1,36 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.GridDetailResultDTO; +import com.epmet.service.CustomerGridService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Auther zxc + * @Create 2020-04-23 9:50 + */ +@RestController +@RequestMapping("grid") +public class GridController { + + @Autowired + private CustomerGridService customerGridService; + + @PostMapping("griddetail") + public Result griddetail(@RequestBody CustomerGridFormDTO customerGridFormDTO){ + Result griddetail = customerGridService.griddetail(customerGridFormDTO); + return griddetail; + } + + /*@PostMapping("addgrid") + + @PostMapping("editgrid") + + @PostMapping("deletegrid")*/ + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index edf49d86d1..d387278ec5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -19,10 +19,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.GridDetailResultDTO; import com.epmet.entity.CustomerGridEntity; import org.apache.ibatis.annotations.Mapper; @@ -69,4 +71,19 @@ public interface CustomerGridDao extends BaseDao { * @Author sun */ List getMyGrids(String userId); + + /** + * 根据gridId获取网格详情 + * @param customerGridFormDTO + * @return + */ + GridDetailResultDTO griddetail(CustomerGridFormDTO customerGridFormDTO); + + /** + * 根据gridId查询uerId + * @param customerGridFormDTO + * @return + */ + List selectUserIdByGridId(CustomerGridFormDTO customerGridFormDTO); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 27332bf916..1774a21c15 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -3,18 +3,21 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; -import com.epmet.feign.fallback.EpmetUserFeignClientFallback; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * @author zhaoqifeng * @dscription * @date 2020/3/19 9:32 */ -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) public interface EpmetUserFeignClient { /** * 根据用户ID获取工作人员基本信息 @@ -27,4 +30,7 @@ public interface EpmetUserFeignClient { @PostMapping(value = "/epmetuser/customerstaff/getstaffinfobyuserid") Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + @PostMapping("/epmetuser/customerstaff/selectstaffgridlistbyuserid") + Result> getStaffGridList(@RequestBody List customerStaffGridDTOS); + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java new file mode 100644 index 0000000000..029f1a968f --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -0,0 +1,23 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @Auther zxc + * @Create 2020-04-23 14:10 + */ +@Component +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result> getStaffGridList(List customerStaffGridDTOS) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index df59c03f22..cb70ad18d3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -4,20 +4,26 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.OperUserDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** - * 用户模块 - * @author zhaoqifeng - * @date 2020/3/19 9:34 + * @Auther zxc + * @Create 2020-04-23 14:10 */ @Component -public class EpmetUserFeignClientFallback implements EpmetUserFeignClient { +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); + } - @Override - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerStaffInfoByUserId", formDTO); - } + @Override + public Result> getStaffGridList(List customerStaffGridDTOS) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java index 44b206c7c5..5d427e434a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java @@ -25,6 +25,7 @@ import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.GridDetailResultDTO; import com.epmet.entity.CustomerGridEntity; import java.util.List; @@ -122,4 +123,11 @@ public interface CustomerGridService extends BaseService { * @Author sun */ Result> getMyGrids(String userId); + + /** + * 根据gridId获取网格详情 + * @param customerGridFormDTO + * @return + */ + Result griddetail(CustomerGridFormDTO customerGridFormDTO); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java index f11352265f..da136fb56a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java @@ -26,11 +26,15 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerGridDao; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.ListCustomerGridFormDTO; import com.epmet.dto.result.CustomerGridByUserIdResultDTO; import com.epmet.dto.result.CustomerGridForStrangerResultDTO; +import com.epmet.dto.result.GridDetailResultDTO; import com.epmet.entity.CustomerGridEntity; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.CustomerGridRedis; import com.epmet.service.CustomerGridService; import com.epmet.util.ModuleConstant; @@ -55,6 +59,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl page(Map params) { @@ -163,4 +169,13 @@ public class CustomerGridServiceImpl extends BaseServiceImpl>().ok(baseDao.getMyGrids(userId)); } + @Override + public Result griddetail(CustomerGridFormDTO customerGridFormDTO) { + GridDetailResultDTO griddetail = baseDao.griddetail(customerGridFormDTO); + List customerStaffGridDTOS = baseDao.selectUserIdByGridId(customerGridFormDTO); + Result> staffGridList = epmetUserFeignClient.getStaffGridList(customerStaffGridDTOS); + griddetail.setStaffGridList(staffGridList.getData()); + return new Result().ok(griddetail); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 343558b7d7..f748ba157e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -109,4 +109,34 @@ cg.created_time DESC + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 6ae1285955..103d4163fc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -26,6 +26,9 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.excel.CustomerStaffExcel; import com.epmet.service.CustomerStaffService; @@ -117,6 +120,17 @@ public class CustomerStaffController { return customerStaffService.getCustomerStaffInfo(formDTO); } + /** + * 根据userId查询网格下用户信息 + * @param customerStaffGridDTOS + * @return + */ + @PostMapping(value = "selectstaffgridlistbyuserid") + public Result> selectStaffGridListByUserId(@RequestBody List customerStaffGridDTOS){ + Result> listResult = customerStaffService.selectStaffGridListByUserId(customerStaffGridDTOS); + return listResult; + } + /** * 根据用户ID获取工作人员基本信息 * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index 689af6a49b..14d91f75e9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -19,6 +19,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import org.apache.ibatis.annotations.Mapper; @@ -53,4 +55,11 @@ public interface CustomerStaffDao extends BaseDao { CustomerStaffDTO selectListCustomerStaffInfo(CustomerStaffFormDTO formDTO); CustomerStaffDTO selectStaffInfoByUserId(CustomerStaffDTO formDTO); + + /** + * 根据userId查询查询网格下的用户信息 + * @param customerStaffGridDTOS + * @return + */ + List selectStaffGridListByUserId(List customerStaffGridDTOS); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 12c2c04c52..3775510742 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -21,6 +21,9 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; @@ -122,4 +125,11 @@ public interface CustomerStaffService extends BaseService { * @date 2020/4/22 10:05 **/ Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO); + + /** + * 根据guidId查询网格下的用户信息 + * @param customerStaffGridDTOS + * @return + */ + Result> selectStaffGridListByUserId(List customerStaffGridDTOS); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index e0d2c3ac8f..4ac6f5a529 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -28,6 +28,9 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.UserConstant; import com.epmet.dao.CustomerStaffDao; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.CustomerStaffGridDTO; +import com.epmet.dto.StaffGridListDTO; +import com.epmet.dto.form.CustomerGridFormDTO; import com.epmet.dto.form.CustomerStaffFormDTO; import com.epmet.entity.CustomerStaffEntity; import com.epmet.redis.CustomerStaffRedis; @@ -140,4 +143,10 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(customerStaffDTO); } + @Override + public Result> selectStaffGridListByUserId(List customerStaffGridDTOS) { + List staffGridListDTOS = baseDao.selectStaffGridListByUserId(customerStaffGridDTOS); + return new Result>().ok(staffGridListDTOS); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index 08b3afb984..5385e021db 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -23,4 +23,22 @@ where cs.USER_ID=#{userId} and cs.DEL_FLAG='0' + + + \ No newline at end of file From aea54666ef2ccb0a15b31c6c1a20cf81a43eb316 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Apr 2020 15:47:38 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AF-=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=9C=BA=E5=85=B3=E7=BB=84=E7=BB=87=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/exception/EpmetErrorCode.java | 3 ++- .../main/java/com/epmet/constant/CustomerAgencyConstant.java | 4 ---- .../com/epmet/service/impl/CustomerAgencyServiceImpl.java | 5 +++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 0ddc89d09b..d07777427a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -26,7 +26,8 @@ public enum EpmetErrorCode { MOBILE_GET_CODE_ERROR(8104,"获取验证码失败"), MESSAGE_SMS_SEND_ERROR(8105, "短信发送失败"), - CANNOT_AUDIT_WARM(8201, "请完善居民信息"); + CANNOT_AUDIT_WARM(8201, "请完善居民信息"), + NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"); private int code; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java index 42d40b0199..3c28f465f9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerAgencyConstant.java @@ -14,10 +14,6 @@ public interface CustomerAgencyConstant { * 添加组织失败 */ String SAVE_EXCEPTION = "组织机构新增失败"; - /** - * 不允许删除组织 - */ - String NOT_DEL_AGENCY = "当前组织存在下级组织,不允许删除"; /** * 组织删除失败 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 4d17f1a674..3bbd8631c0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -41,7 +42,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -188,7 +188,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agencyList = baseDao.selectSubAgencyById(formDTO.getAgencyId()); if (null != agencyList && agencyList.size() > NumConstant.ZERO) { - result.setMsg(CustomerAgencyConstant.NOT_DEL_AGENCY); + result.setCode(EpmetErrorCode.NOT_DEL_AGENCY.getCode()); + result.setMsg(EpmetErrorCode.NOT_DEL_AGENCY.getMsg()); return result; } //2:删除当前机关组织(逻辑删) From 2b28fcd6a5fac1dd55ceaab76af9a6a66bfbb1ce Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Thu, 23 Apr 2020 15:55:05 +0800 Subject: [PATCH 5/7] =?UTF-8?q?FeignClientFallBack=E6=B7=BB=E5=8A=A0getCus?= =?UTF-8?q?tomerStaffInfoByUserId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/fallback/EpmetUserFeignClientFallback.java | 1 - .../gov-org/gov-org-server/src/main/resources/bootstrap.yml | 2 +- epmet-user/epmet-user-server/src/main/resources/bootstrap.yml | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java index cb70ad18d3..05b26449b3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java @@ -21,7 +21,6 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); } - @Override public Result> getStaffGridList(List customerStaffGridDTOS) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 3d1fddbaef..756bf6874f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: gov-org-server #环境 dev|test|prod profiles: - active: dev + active: dev-local messages: encoding: UTF-8 basename: i18n/messages_common diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 6674d13dfd..96d9187fb7 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-user-server #环境 dev|test|prod profiles: - active: dev + active: dev-local messages: encoding: UTF-8 basename: i18n/messages_common From 31882331397e214b46af200b93d029dfd4219185 Mon Sep 17 00:00:00 2001 From: zxc <954985705@qq.com> Date: Thu, 23 Apr 2020 15:58:29 +0800 Subject: [PATCH 6/7] =?UTF-8?q?FeignClientFallBack=E6=B7=BB=E5=8A=A0getCus?= =?UTF-8?q?tomerStaffInfoByUserId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-org/gov-org-server/src/main/resources/bootstrap.yml | 2 +- epmet-user/epmet-user-server/src/main/resources/bootstrap.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 756bf6874f..3d1fddbaef 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: gov-org-server #环境 dev|test|prod profiles: - active: dev-local + active: dev messages: encoding: UTF-8 basename: i18n/messages_common diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 96d9187fb7..6674d13dfd 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -10,7 +10,7 @@ spring: name: epmet-user-server #环境 dev|test|prod profiles: - active: dev-local + active: dev messages: encoding: UTF-8 basename: i18n/messages_common From 3a4bf0d93e0f56c3154b99dce3cf5f7c0b7ef968 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Apr 2020 16:08:03 +0800 Subject: [PATCH 7/7] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A7=92=E8=89=B2=E4=B8=8B=E7=9A=84=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EpmetUserFeignClientFallBack.java | 5 ++++ .../EpmetUserFeignClientFallback.java | 28 ------------------- .../epmet/controller/StaffRoleController.java | 11 ++++++-- .../java/com/epmet/dao/GovStaffRoleDao.java | 8 ------ .../main/java/com/epmet/dao/StaffRoleDao.java | 12 +++++++- .../epmet/service/GovStaffRoleService.java | 8 ------ .../com/epmet/service/StaffRoleService.java | 8 ++++++ .../service/impl/GovStaffRoleServiceImpl.java | 12 -------- .../service/impl/StaffRoleServiceImpl.java | 11 ++++++++ .../main/resources/mapper/GovStaffRoleDao.xml | 14 ---------- .../main/resources/mapper/StaffRoleDao.xml | 11 ++++++++ 11 files changed, 54 insertions(+), 74 deletions(-) delete mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 029f1a968f..05b26449b3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -3,6 +3,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.CustomerStaffGridDTO; import com.epmet.dto.StaffGridListDTO; import com.epmet.feign.EpmetUserFeignClient; @@ -16,6 +17,10 @@ import java.util.List; */ @Component public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + @Override + public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); + } @Override public Result> getStaffGridList(List customerStaffGridDTOS) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java deleted file mode 100644 index 05b26449b3..0000000000 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallback.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.epmet.feign.fallback; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerStaffDTO; -import com.epmet.dto.CustomerStaffGridDTO; -import com.epmet.dto.StaffGridListDTO; -import com.epmet.feign.EpmetUserFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** - * @Auther zxc - * @Create 2020-04-23 14:10 - */ -@Component -public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { - @Override - public Result getCustomerStaffInfoByUserId(CustomerStaffDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfoByUserId", formDTO); - } - @Override - public Result> getStaffGridList(List customerStaffGridDTOS) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffGridList", customerStaffGridDTOS); - } -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java index 73a94b7740..1c13ea4518 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffRoleController.java @@ -3,9 +3,11 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.StaffRoleDTO; import com.epmet.dto.form.StaffRoleFormDTO; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; +import com.epmet.service.StaffRoleService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -30,6 +32,9 @@ public class StaffRoleController { @Autowired private GovStaffRoleService govStaffRoleService; + @Autowired + private StaffRoleService staffRoleService; + /** * 查询工作人员具有的角色列表 * @return @@ -55,12 +60,12 @@ public class StaffRoleController { * @return */ @PostMapping("staffsinrole") - public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { + public Result> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO) { ValidatorUtils.validateEntity(staffRoleFormDTO, StaffRoleFormDTO.GetStaffsInRole.class); String roleKey = staffRoleFormDTO.getRoleKey(); String orgId = staffRoleFormDTO.getOrgId(); - List roleDTOS = govStaffRoleService.listStaffsInRole(roleKey, orgId); - return new Result>().ok(roleDTOS); + List staffRoleDTOS = staffRoleService.listStaffsInRole(roleKey, orgId); + return new Result>().ok(staffRoleDTOS); } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index fa244dce1c..0e187c2252 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -18,7 +18,6 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.GovStaffRoleDTO; import com.epmet.entity.GovStaffRoleEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -42,11 +41,4 @@ public interface GovStaffRoleDao extends BaseDao { */ List listRolesByStaffId(@Param("staffId") String staffId, @Param("orgId") String orgId); - /** - * 查询具有某角色的staff列表 - * @param roleKey - * @param orgId - * @return - */ - List listStaffsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 1a69f5a6c2..40d4b47b00 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.StaffRoleDTO; import com.epmet.entity.StaffRoleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 工作人员-角色关系表 @@ -29,5 +33,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface StaffRoleDao extends BaseDao { - + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffIdsByRoleKeyAndOrgId(@Param("roleKey") String roleKey, @Param("orgId") String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 8de688b50b..942a001921 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -99,12 +99,4 @@ public interface GovStaffRoleService extends BaseService { * @return */ List listRolesByStaffId(String staffId, String orgId); - - /** - * 查询具有某角色的staff列表 - * @param roleKey - * @param orgId - * @return - */ - List listStaffsInRole(String roleKey, String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index f5787beaa8..7ba2d5e83b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -92,4 +92,12 @@ public interface StaffRoleService extends BaseService { * @date 2020-04-22 */ void delete(String[] ids); + + /** + * 查询具有某角色的staff列表 + * @param roleKey + * @param orgId + * @return + */ + List listStaffsInRole(String roleKey, String orgId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index b0249006aa..28ae555889 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -110,16 +110,4 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByStaffId(String staffId, String orgId) { return baseDao.listRolesByStaffId(staffId, orgId); } - - /** - * 查询具有某角色的staff列表 - * @param roleKey - * @param orgId - * @return - */ - @Override - public List listStaffsInRole(String roleKey, String orgId) { - return baseDao.listStaffsByRoleKeyAndOrgId(roleKey, orgId); - } - } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index bf717ba530..ddcd8abe3b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -101,4 +101,15 @@ public class StaffRoleServiceImpl extends BaseServiceImpl listStaffsInRole(String roleKey, String orgId) { + return baseDao.listStaffIdsByRoleKeyAndOrgId(roleKey, orgId); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index e2b1d6fe7e..8259bfb9a8 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -28,18 +28,4 @@ sr.STAFF_ID = #{staffId} AND sr.ORG_ID = #{orgId} - - - - - \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 79ad9ca489..0cbdc611f6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -17,4 +17,15 @@ + + \ No newline at end of file